| | |
| | | damageDetail.setOrderNumber(reportingWorkDetail.getOrderNumber()); |
| | | damageDetail.setProcessId(reportingWork.getProcessId()); |
| | | damageDetail.setTechnologyNumber(reportingWorkDetail.getTechnologyNumber()); |
| | | if(damageDetail.getResponsibleProcess()!=reportingWork.getThisProcess()){ |
| | | damageDetail.setQualityInsStatus(1); |
| | | } |
| | | damageDetailsMapper.insert(damageDetail); |
| | | }); |
| | | } |
| | |
| | | .setSql("reporting_work_num =reporting_work_num +"+orderProcessDetail.getReportingWorkNum()) |
| | | .setSql("broken_num =broken_num +"+orderProcessDetail.getBrokenNum()); |
| | | orderProcessDetailMapper.update(null,updateWrapper); |
| | | reportingWorkDetailMapper.insert(reportingWorkDetail); |
| | | |
| | | //判断完工数量和刺破数量是否为0,为0则不插入到数据库 |
| | | if(!(reportingWorkDetail.getCompletedQuantity()==0 && reportingWorkDetail.getBreakageQuantity()==0)){ |
| | | reportingWorkDetailMapper.insert(reportingWorkDetail); |
| | | } |
| | | |
| | | //更新流程卡表的报工数量 |
| | | if(Objects.equals(reportingWork.getNextProcess(), "")){ |
| | | LambdaUpdateWrapper<FlowCard> flowCardLambdaUpdateWrapper = |
| | |
| | | List<DamageDetails> damageDetails = reportingWorkDetail.getDamageDetails(); |
| | | //每一条报工数据循环插入次破明细表 |
| | | if(damageDetails!=null && !damageDetails.isEmpty()){ |
| | | damageDetails.forEach(damageDetailsMapper::insert); |
| | | damageDetails.forEach(damageDetail->{ |
| | | if(!Objects.equals(reportingWork.getThisProcess(), damageDetail.getResponsibleProcess())){ |
| | | damageDetail.setQualityInsStatus(1); |
| | | } |
| | | damageDetailsMapper.insert(damageDetail); |
| | | }); |
| | | } |
| | | //插入报工数据 |
| | | reportingWorkDetailMapper.insert(reportingWorkDetail); |
| | |
| | | orderProcessDetailMapper.updateQuantity(reportingWork.getReportingWorkId(),reportingWork.getThisProcess(),"add"); |
| | | return true; |
| | | } |
| | | //报工管理查询 |
| | | public Map<String, Object> selectReportingWorkSv(Integer pageNum, Integer pageSize, java.sql.Date selectTime1, java.sql.Date selectTime2, String orderId, ReportingWork reportingWork) { |
| | | Integer offset = (pageNum - 1) * pageSize; |
| | | if (orderId.equals("null")) { |
| | | orderId = ""; |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", reportingWorkMapper.selectReportingWorkMp(offset, pageSize, selectTime1, selectTime2, orderId, reportingWork)); |
| | | map.put("total", reportingWorkMapper.getPageTotal(offset, pageSize, selectTime1, selectTime2, orderId, reportingWork)); |
| | | //System.out.println(map.get("data")); |
| | | return map; |
| | | } |
| | | |
| | | public Boolean deleteWorkSv(String reportingWorkId, String processId, String thisProcess) { |
| | | if (!reportingWorkId.isEmpty() && !processId.isEmpty() && !thisProcess.isEmpty()) { |
| | | //获取当前报工编号下工序 |
| | | String nextProcess = reportingWorkMapper.selectNextProcess(reportingWorkId); |
| | | //查询当前报工编号下工序是否报工 |
| | | Integer count = reportingWorkMapper.selectCountByProcessId(processId, nextProcess); |
| | | //获取最后一道工序 |
| | | String lastProcess = reportingWorkMapper.selectLastProcess(processId); |
| | | //判断是否是入库工序 |
| | | if (lastProcess.equals(thisProcess)) {//是入库工序 |
| | | //查询该流程卡数量、可入库数量、已入库数量 |
| | | Map<String, Object> list = reportingWorkMapper.selectReceiptQuantity(processId); |
| | | // System.out.println(list.get("quantity")+"--"+list.get("inventoryQuantity")+"---"+list.get("receivedQuantity")); |
| | | 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); |
| | | //当该工序完工数量小于等于已入库数量时 |
| | | //System.out.println("inventoryQuantity:" + inventoryQuantity +"completedQuantity:" + completedQuantity + "---receiptQuantity:" + receiptQuantity); |
| | | //可入库数量-已入库数量>=报工编号本工序完工数量 |
| | | 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.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; |
| | | } |
| | | } |
| | | |
| | | public Map<String, Object> selectQualityTestingSv(Integer pageNum, Integer pageSize, java.sql.Date selectTime1, java.sql.Date selectTime2, Integer state, String processId, ReportingWork reportingWork) { |
| | | Integer offset = (pageNum - 1) * pageSize; |
| | | if (processId.equals("null")) { |
| | | processId = ""; |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", reportingWorkMapper.selectQualityTestingMp(offset, pageSize, selectTime1, selectTime2,state, processId, reportingWork)); |
| | | map.put("total", reportingWorkMapper.getQualityPageTotal(offset, pageSize, selectTime1, selectTime2,state, processId, reportingWork)); |
| | | |
| | | return map; |
| | | } |
| | | |
| | | public Boolean updateQualityStatusSv(String reportingWorkId,String username) { |
| | | if (!reportingWorkId.isEmpty()) { |
| | | reportingWorkMapper.updateQualityStatusMp(reportingWorkId,username); |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public Map<String, Object> detailsQualitySv(String reportingWorkId,String processId,String thisProcess, ReportingWork reportingWork) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", reportingWorkMapper.detailsQualityMp(reportingWorkId, reportingWork)); |
| | | map.put("basic",getReportingWorkBase(processId,thisProcess)); |
| | | System.out.println(map.get("basic")); |
| | | return map; |
| | | } |
| | | } |