| | |
| | | Integer count = reportingWorkMapper.selectCountByProcessId(processId, nextProcess); |
| | | //获取最后一道工序 |
| | | String lastProcess = reportingWorkMapper.selectLastProcess(processId); |
| | | //判断是否是入库工序 |
| | | if (lastProcess.equals(thisProcess)) {//是入库工序 |
| | | //查询该流程卡数量、可入库数量、已入库数量 |
| | | Map<String, Object> list = reportingWorkMapper.selectReceiptQuantity(processId); |
| | | if (list.get("quantity") == list.get("receiptQuantity")) { |
| | | return false; |
| | | } else { |
| | | //转换类型:已入库数量 |
| | | Integer receiptQuantity = Integer.parseInt(list.get("receivedQuantity").toString()); |
| | | //转换类型:可入库数量 |
| | | Integer inventoryQuantity = Integer.parseInt(list.get("inventoryQuantity").toString()); |
| | | //查询该报工编号本工序完工数量 |
| | | Integer completedQuantity = reportingWorkMapper.selectCompletedQuantity(reportingWorkId); |
| | | //当该工序完工数量小于等于已入库数量时 |
| | | //可入库数量-已入库数量>=报工编号本工序完工数量 |
| | | if (inventoryQuantity - receiptQuantity >= completedQuantity) { |
| | | //获取是否有已补片或返工 |
| | | Integer countStates= Integer.valueOf(reportingWorkMapper.getPatchConditionMp(reportingWorkId)); |
| | | //判断是否有补片返工数据 |
| | | if (countStates==0){ |
| | | //判断是否是入库工序 |
| | | if (lastProcess.equals(thisProcess)) {//是入库工序 |
| | | //查询该流程卡数量、可入库数量、已入库数量 |
| | | Map<String, Object> list = reportingWorkMapper.selectReceiptQuantity(processId); |
| | | if (list.get("quantity") == list.get("receiptQuantity")) { |
| | | return false; |
| | | } else { |
| | | //转换类型:已入库数量 |
| | | Integer receiptQuantity = Integer.parseInt(list.get("receivedQuantity").toString()); |
| | | //转换类型:可入库数量 |
| | | Integer inventoryQuantity = Integer.parseInt(list.get("inventoryQuantity").toString()); |
| | | //查询该报工编号本工序完工数量 |
| | | Integer completedQuantity = reportingWorkMapper.selectCompletedQuantity(reportingWorkId); |
| | | //当该工序完工数量小于等于已入库数量时 |
| | | //可入库数量-已入库数量>=报工编号本工序完工数量 |
| | | if (inventoryQuantity - receiptQuantity >= completedQuantity) { |
| | | //查询当前报工编号完工次破数量的数据 |
| | | List<Map<String, Object>> workDateList = reportingWorkMapper.reportingWorkDate(reportingWorkId); |
| | | for (Map<String, Object> item : workDateList) { |
| | | //更新流程卡可入库数量 |
| | | reportingWorkMapper.updateInventoryQuantity(processId, item.get("order_number"), item.get("technology_number"), item.get("completed_quantity")); |
| | | //更新报工流程表数据 |
| | | reportingWorkMapper.updateWorkProcess(processId, item.get("order_number"), item.get("technology_number"), item.get("completed_quantity"), item.get("breakage_quantity"), thisProcess); |
| | | } |
| | | //删除报工,将审核状态改为-1 |
| | | reportingWorkMapper.deleteWork(reportingWorkId); |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | } else {//不是入库工序 |
| | | if (count == 0) { |
| | | //查询当前报工编号完工次破数量的数据 |
| | | List<Map<String, Object>> workDateList = reportingWorkMapper.reportingWorkDate(reportingWorkId); |
| | | for (Map<String, Object> item : workDateList) { |
| | | //更新流程卡可入库数量 |
| | | reportingWorkMapper.updateInventoryQuantity(processId, item.get("order_number"), item.get("technology_number"), item.get("completed_quantity")); |
| | | //更新报工流程表数据 |
| | | reportingWorkMapper.updateWorkProcess(processId, item.get("order_number"), item.get("technology_number"), item.get("completed_quantity"), item.get("breakage_quantity"), thisProcess); |
| | | } |
| | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | } else {//不是入库工序 |
| | | if (count == 0) { |
| | | //查询当前报工编号完工次破数量的数据 |
| | | List<Map<String, Object>> workDateList = reportingWorkMapper.reportingWorkDate(reportingWorkId); |
| | | for (Map<String, Object> item : workDateList) { |
| | | //更新报工流程表数据 |
| | | reportingWorkMapper.updateWorkProcess(processId, item.get("order_number"), item.get("technology_number"), item.get("completed_quantity"), item.get("breakage_quantity"), thisProcess); |
| | | } |
| | | //删除报工,将审核状态改为-1 |
| | | reportingWorkMapper.deleteWork(reportingWorkId); |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | else { |
| | | return false; |
| | | } |
| | | |
| | | } else { |
| | | return false; |