| | |
| | | JSONObject.toJSONString(stringRedisTemplate.opsForHash().entries(detailKey)) |
| | | , ReportingWorkDetail.class |
| | | ); |
| | | |
| | | //判断流程卡是否报满 |
| | | FlowCard flowCard = flowCardMapper.selectOne(new LambdaQueryWrapper<FlowCard>() |
| | | .eq(FlowCard::getProcessId, reportingWork.getProcessId()) |
| | | .eq(FlowCard::getOrderNumber, reportingWorkDetail.getOrderNumber()) |
| | | .eq(FlowCard::getTechnologyNumber, reportingWorkDetail.getTechnologyNumber()) |
| | | ); |
| | | //生产数量= 流程卡数量-终止数量 |
| | | int flowCardReportingWorkNum = flowCard.getQuantity()-flowCard.getTerminationQuantity(); |
| | | OrderProcessDetail orderProcessDetail = orderProcessDetailMapper |
| | | .selectOne(new LambdaQueryWrapper<OrderProcessDetail>() |
| | | .eq(OrderProcessDetail::getProcessId, reportingWork.getProcessId()) |
| | | .eq(OrderProcessDetail::getOrderNumber, reportingWorkDetail.getOrderNumber()) |
| | | .eq(OrderProcessDetail::getTechnologyNumber, reportingWorkDetail.getTechnologyNumber()) |
| | | .eq(OrderProcessDetail::getProcess, reportingWork.getThisProcess()) |
| | | ); |
| | | //报工数量 |
| | | int completedQuantity = reportingWorkDetail.getCompletedQuantity(); |
| | | //已报数量 |
| | | int finishReportingWorkNum = orderProcessDetail.getReportingWorkNum(); |
| | | |
| | | //若报工数量+已报数量>流程卡数量 则报工数量为流程卡数量-已报数量 |
| | | if((completedQuantity+finishReportingWorkNum)>flowCardReportingWorkNum){ |
| | | completedQuantity = flowCardReportingWorkNum - finishReportingWorkNum; |
| | | reportingWorkDetail.setCompletedQuantity(completedQuantity); |
| | | //若报工数量小于0 则报工数量为0 |
| | | if(completedQuantity<0){ |
| | | reportingWorkDetail.setCompletedQuantity(0); |
| | | } |
| | | } |
| | | |
| | | |
| | | reportingWorkDetail.setReportingWorkId(reportingWorkId); |
| | | reportingWorkDetailMapper.insert(reportingWorkDetail); |
| | | |
| | |
| | | |
| | | orderProcessDetailMapper.update(null, updateWrapper); |
| | | }); |
| | | |
| | | //获取完工明细数量总和 |
| | | int num = reportingWorkDetailMapper.selectFinishQuantity(reportingWorkId); |
| | | reportingWorkMapper.update(null, |
| | | new LambdaUpdateWrapper<ReportingWork>() |
| | | .eq(ReportingWork::getReportingWorkId, reportingWorkId) |
| | | .setSql("this_completed_quantity = " + num) |
| | | ); |
| | | |
| | | } |
| | | |
| | | |
| | | }); |
| | | } |
| | | Set<String> uploadKeys = stringRedisTemplate.keys("upload:reportingWork:*"); |