diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorksServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorksServiceImpl.java index a2a860a7..92605175 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorksServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorksServiceImpl.java @@ -68,11 +68,11 @@ public class MesReportWorksServiceImpl implements IMesReportWorksService { new LinkedBlockingQueue()); try { dateSources.forEach(dateSource -> { - if("ds_1000".equals(dateSource.get("poolName"))){ + //if("ds_1000".equals(dateSource.get("poolName"))){ logger.info("++++++++++++" + dateSource.get("poolName") + "++++车间生产情况企业微信提醒开始++++++++++"); Runnable run = () -> setMesProInfoFunc(dateSource.get("poolName")); executorService.execute(run); - } + //} }); } catch (Exception e) { logger.error("service == mesProTask == exception", e); diff --git a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderWorkorderController.java b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderWorkorderController.java index 9d6f77c1..c36f4115 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderWorkorderController.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/controller/ProOrderWorkorderController.java @@ -326,4 +326,15 @@ public class ProOrderWorkorderController extends BaseController { public List getBatchCode(@PathVariable("workorderId") String workorderId) { return proOrderWorkorderService.getBatchCode(workorderId); } + + /** + * 删除生产工单 + */ + @RequiresPermissions("mes:pro:workorder:edit") + @Log(title = "生产工单领料单更新", businessType = BusinessType.UPDATE) + @PostMapping("/updateWorkOrderBom/{workorderCode}") + public AjaxResult updateWorkOrderBom(@PathVariable String workorderCode) { + int m = proOrderWorkorderService.updateWorkOrderBom(workorderCode); + return toAjax(m); + } } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java index a0244f0b..5c459328 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/mapper/ProOrderWorkorderMapper.java @@ -251,5 +251,10 @@ public interface ProOrderWorkorderMapper { ProOrderWorkorder getOldVersionUsedInfo(ProOrderWorkorder proOrderWorkorder); List getPreIdCardListNow(ProOrderWorkorder proOrderWorkorder); + + void clearMP(List wcodes); + void clearMPDetail(List wcodes); + + List getWorkList(String workorderCode); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderWorkorderService.java b/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderWorkorderService.java index ab91ff9a..2649e2f1 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderWorkorderService.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/IProOrderWorkorderService.java @@ -155,4 +155,6 @@ public interface IProOrderWorkorderService { List getBatchCode(String workorderId);//获取批次号 List getIdCardListRefresh(ProOrderWorkorder proOrderWorkorder); + + int updateWorkOrderBom(String workorderCode); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java index 6c2f8b88..aa1e2b12 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java @@ -451,57 +451,57 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { logger.info("获取sap领料单:" + sapWorkOrders.get(m) + "开始"); List sapMaterialPreparationList = remoteSapService.materialPreparation(sapWorkOrders.get(m)).getData(); if (CollectionUtils.isEmpty(sapMaterialPreparationList)) { - System.out.println("sap无领料单数据"); - } - //取出各领料单 - String orderCode = sapWorkOrders.get(m); - logger.info("sap工单码:" + orderCode); - /**mes_prepare**/ - String mesPrepareId = IdUtils.fastSimpleUUID(); - MesPrepareDTO mesPrepare0 = new MesPrepareDTO(); - mesPrepare0.setPrepareId(mesPrepareId); - mesPrepare0.setWorkorderCode(workOrders.get(m)); - mesPrepare0.setWorkorderName(orderCode);//工单(子) - mesPrepare0.setCreateTime(createDate); - mesPrepare0.setCreateBy(SecurityUtils.getUsername()); - mesPrepare0.setStatus("L0");//默认待确认 - proOrderWorkorderMapper.insertMesPrepare(mesPrepare0); - /**mes_prepare_detail**/ - List details = new ArrayList<>(); - - MesPrepareDetailDTO detail = null; - for (SapMaterialPreparation sap : sapMaterialPreparationList) { - detail = new MesPrepareDetailDTO(); - detail.setPrepareId(mesPrepareId); - detail.setRecordId(IdUtils.fastSimpleUUID()); - detail.setAttr1(sap.getRSPOS());//预留/相关需求的项目编号 - detail.setMaterialCode(sap.getMATNR());//物料号 - detail.setMaterailName(sap.getMAKTX());//物料描述(短文本) - detail.setFactoryCode(sap.getWERKS());//工厂 - detail.setLocator(sap.getLGORT());//库存地点 - detail.setNeedDate(sap.getBDTER());//组件的需求日期 - detail.setQuantity(sap.getBDMNG());////需求量 - detail.setFundQuanlity(sap.getZQLSL());//欠料数量 - detail.setUnit(sap.getMEINS());//基本计量单位 - detail.setRecoil(sap.getRGEKZ());//反冲标识 - detail.setBuyFlag(sap.getDBSKZ());//直接采购标识 - detail.setCreateBy(SecurityUtils.getUsername()); - detail.setCreateTime(createDate); - detail.setParentWorkOrder(workOrders.get(0)); - detail.setErfmg(sap.getERFMG());//以输入单位计的数量 - detail.setErfme(sap.getERFME());//条目单位 - details.add(detail); - logger.info("领料单内容detail:" + sap.getRSPOS() + "," + sap.getMATNR() + "," + - sap.getMAKTX() + "," + sap.getWERKS() + "," + sap.getLGORT() + "," + - sap.getBDTER() + "," + sap.getBDMNG() + "," + sap.getZQLSL() + "," + - sap.getMEINS() + "," + sap.getRGEKZ() + "," + sap.getDBSKZ()+ "," + - sap.getERFMG() + "," + sap.getERFME() - ); - } - if (!CollectionUtils.isEmpty(details)) { - proOrderWorkorderMapper.insertMesPrepareDetails(details); + logger.info("sap无领料单数据"); + }else{ + //取出各领料单 + String orderCode = sapWorkOrders.get(m); + logger.info("sap工单码:" + orderCode); + /**mes_prepare**/ + String mesPrepareId = IdUtils.fastSimpleUUID(); + MesPrepareDTO mesPrepare0 = new MesPrepareDTO(); + mesPrepare0.setPrepareId(mesPrepareId); + mesPrepare0.setWorkorderCode(workOrders.get(m)); + mesPrepare0.setWorkorderName(orderCode);//工单(子) + mesPrepare0.setCreateTime(createDate); + mesPrepare0.setCreateBy(SecurityUtils.getUsername()); + mesPrepare0.setStatus("L0");//默认待确认 + proOrderWorkorderMapper.insertMesPrepare(mesPrepare0); + /**mes_prepare_detail**/ + List details = new ArrayList<>(); + + MesPrepareDetailDTO detail = null; + for (SapMaterialPreparation sap : sapMaterialPreparationList) { + detail = new MesPrepareDetailDTO(); + detail.setPrepareId(mesPrepareId); + detail.setRecordId(IdUtils.fastSimpleUUID()); + detail.setAttr1(sap.getRSPOS());//预留/相关需求的项目编号 + detail.setMaterialCode(sap.getMATNR());//物料号 + detail.setMaterailName(sap.getMAKTX());//物料描述(短文本) + detail.setFactoryCode(sap.getWERKS());//工厂 + detail.setLocator(sap.getLGORT());//库存地点 + detail.setNeedDate(sap.getBDTER());//组件的需求日期 + detail.setQuantity(sap.getBDMNG());////需求量 + detail.setFundQuanlity(sap.getZQLSL());//欠料数量 + detail.setUnit(sap.getMEINS());//基本计量单位 + detail.setRecoil(sap.getRGEKZ());//反冲标识 + detail.setBuyFlag(sap.getDBSKZ());//直接采购标识 + detail.setCreateBy(SecurityUtils.getUsername()); + detail.setCreateTime(createDate); + detail.setParentWorkOrder(workOrders.get(0)); + detail.setErfmg(sap.getERFMG());//以输入单位计的数量 + detail.setErfme(sap.getERFME());//条目单位 + details.add(detail); + logger.info("领料单内容detail:" + sap.getRSPOS() + "," + sap.getMATNR() + "," + + sap.getMAKTX() + "," + sap.getWERKS() + "," + sap.getLGORT() + "," + + sap.getBDTER() + "," + sap.getBDMNG() + "," + sap.getZQLSL() + "," + + sap.getMEINS() + "," + sap.getRGEKZ() + "," + sap.getDBSKZ()+ "," + + sap.getERFMG() + "," + sap.getERFME() + ); + } + if (!CollectionUtils.isEmpty(details)) { + proOrderWorkorderMapper.insertMesPrepareDetails(details); + } } - logger.info("获取sap领料单:" + sapWorkOrders.get(m) + "结束"); } } @@ -1455,6 +1455,32 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { return dtos; } + @Override + @DS("#header.poolName") + public int updateWorkOrderBom(String workorderCode) { + List proOrders = proOrderWorkorderMapper.getWorkList(workorderCode); + if(CollectionUtils.isEmpty(proOrders)){ + return 0; + } + + /**获取领料单 + *sapCodes顺序:母子 + * wcodes:母子 + **/ + List sapCodes = new ArrayList<>(); + List wcodes = new ArrayList<>(); + for(ProOrderWorkorder pow:proOrders){ + sapCodes.add(pow.getWorkorderCodeSap()); + wcodes.add(pow.getWorkorderCode()); + } + + //清理---mes_prepare_detail、mes_prepare + proOrderWorkorderMapper.clearMP(wcodes); + proOrderWorkorderMapper.clearMPDetail(wcodes); + this.getMesPrepare(sapCodes, wcodes); + return 1; + } + /** * 校验工单是否可以修改 * 如果工单已生成湿料计划则不允许修改 diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml index c3aaa907..62179ebb 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderWorkorderMapper.xml @@ -890,6 +890,13 @@ where pow.workorder_code = #{workorderCode} and pow.del_flag = '0' and powbp.del_flag = '0' order by CAST(powbp.pallet_num AS INT) + INSERT INTO pro_order_workorder_batch_pallet ( @@ -1033,6 +1040,24 @@ select workorder_code_sap from pro_order_workorder where workorder_code = #{workorderCode} ) and add_flag = '0' and attr1 = '0' + + update mes_prepare + set del_flag = '1', + update_time = GETDATE() + where workorder_code in + + #{workCode} + + + + update mes_prepare_detail + set del_flag = '1', + update_time = GETDATE() + where parent_work_order in + + #{workCode} + + update qc_check_task set income_batch_no = #{newIncomeBatchNo} where income_batch_no = #{incomeBatchNo} and order_no = #{orderNo} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskProduce.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskProduce.java index e6786c81..7a81db3c 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskProduce.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskProduce.java @@ -44,13 +44,14 @@ public class QcCheckTaskProduce extends BaseEntity { public void setIncomeBatchNo(String incomeBatchNo) { this.incomeBatchNo = incomeBatchNo; } - + private String cpkType; /** * 订单号 */ @Excel(name = "订单号") + private String workorderCodeSap; + @Excel(name = "工单号") private String orderNo; - /** * 物料号 */ @@ -209,6 +210,22 @@ public class QcCheckTaskProduce extends BaseEntity { private String shiftId; private String bz;//备注 + public String getCpkType() { + return cpkType; + } + + public void setCpkType(String cpkType) { + this.cpkType = cpkType; + } + + public String getWorkorderCodeSap() { + return workorderCodeSap; + } + + public void setWorkorderCodeSap(String workorderCodeSap) { + this.workorderCodeSap = workorderCodeSap; + } + public String getStandardNo() { return standardNo; } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskWarehousing.java b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskWarehousing.java index f4e327e1..28031e25 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskWarehousing.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/domain/QcCheckTaskWarehousing.java @@ -40,6 +40,8 @@ public class QcCheckTaskWarehousing extends BaseEntity { * 订单号 */ @Excel(name = "订单号") + private String workorderCodeSap; + @Excel(name = "工单号") private String orderNo; /** @@ -181,6 +183,14 @@ public class QcCheckTaskWarehousing extends BaseEntity { private String checkLevel; private String sampleCode; + public String getWorkorderCodeSap() { + return workorderCodeSap; + } + + public void setWorkorderCodeSap(String workorderCodeSap) { + this.workorderCodeSap = workorderCodeSap; + } + public String getSampleCode() { return sampleCode; } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskProduceServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskProduceServiceImpl.java index 3c18292d..27883de4 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskProduceServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcCheckTaskProduceServiceImpl.java @@ -428,11 +428,11 @@ public class QcCheckTaskProduceServiceImpl implements IQcCheckTaskProduceService new LinkedBlockingQueue()); try { dateSources.forEach(dateSource -> { - if("ds_1000".equals(dateSource.get("poolName"))){ + //if("ds_1000".equals(dateSource.get("poolName"))){ logger.info("++++++++++++" + dateSource.get("poolName") + "++++过程检验巡检开始++++++++++"); Runnable run = () -> createProduceXJFunc(dateSource.get("poolName")); executorService.execute(run); - } + //} }); } catch (Exception e) { logger.error("service == createProduceXJTask == exception", e); diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml index 7eb0d7be..22e2cc14 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckReportIncomeMapper.xml @@ -100,7 +100,7 @@ qct.check_time, qct.check_result, qct.status, qct.check_type, qct.attr1, qct.attr2, qct.attr3, qct.attr4, qct.create_by, qct.create_time, qct.update_by, qct.update_time, qct.factory_code, qct.del_flag,qct.reason,qct.product_type,qct.order_type,qct.jgy,qct.pgy,qct.cxzz, - ISNULL(bp.mvgr5, '成品蚊香【物料组】') standardNo + ISNULL(bp.mvgr5, '09JS08S-048B') standardNo from qc_check_task qct left join base_product bp on bp.product_code = qct.material_code where qct.record_id = #{recordId} diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskProduceMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskProduceMapper.xml index 403088fa..9cc197ec 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskProduceMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskProduceMapper.xml @@ -44,6 +44,9 @@ + + + @@ -103,14 +106,17 @@ qct.supplier_code, qct.supplier_name, qct.income_time, qct.check_loc, qct.check_status, qct.check_man_code, qct.check_man_name,qct.check_time, qct.check_result, qct.status, qct.create_by,qct.create_time, qct.update_by, qct.update_time, - qct.check_type,qct.sample_quality,qct.noOk_quality, - q.type_code,q.check_name + qct.check_type,qct.sample_quality,qct.noOk_quality,bpa.cpk_type, + q.type_code,q.check_name,SUBSTRING(pow.workorder_code_sap, 4, 12) workorderCodeSap from qc_check_task qct left join qc_check_type q on q.id = qct.check_type + left join pro_order_workorder pow on pow.workorder_code = qct.order_no + left join base_product_attached bpa on concat('0000000',bpa.product_code) = qct.material_code and qct.check_no = #{checkNo} and qct.income_batch_no = #{incomeBatchNo} and qct.order_no = #{orderNo} + and pow.workorder_code_sap like concat('%',#{workorderCodeSap}, '%') and qct.material_code like concat('%', #{materialCode}, '%') and qct.material_name like concat('%', @@ -137,6 +143,7 @@ and #{checkTimeEnd} > CONVERT(varchar(30),qct.check_time, 120) and qct.check_type = #{checkType} and q.type_code = #{typeCode} + and pow.del_flag = '0' order by qct.create_time desc diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskWarehousingMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskWarehousingMapper.xml index c409a234..d83c356a 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskWarehousingMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskWarehousingMapper.xml @@ -36,7 +36,7 @@ - + @@ -55,13 +55,15 @@ qct.supplier_code, qct.supplier_name, qct.income_time, qct.check_loc, qct.check_status, qct.check_man_code, qct.check_man_name,qct.check_time, qct.check_result, qct.status, qct.create_by,qct.create_time, qct.update_by, qct.update_time,qct.check_type, qct.sample_quality, - qct.noOk_quality, q.type_code ,q.check_name checkName + qct.noOk_quality, q.type_code ,q.check_name checkName,SUBSTRING(pow.workorder_code_sap, 4, 12) workorderCodeSap from qc_check_task qct left join qc_check_type q on q.id = qct.check_type + left join pro_order_workorder pow on pow.workorder_code = qct.order_no and qct.check_no = #{checkNo} and qct.income_batch_no = #{incomeBatchNo} and qct.order_no = #{orderNo} + and pow.workorder_code_sap like concat('%',#{workorderCodeSap}, '%') and qct.material_code = #{materialCode} and qct.material_name like concat('%', #{materialName}, '%') @@ -87,6 +89,7 @@ and #{checkTimeEnd} > CONVERT(varchar(30),qct.check_time, 120) and qct.check_type = #{checkType} and q.type_code = #{typeCode} + and pow.del_flag = '0' diff --git a/op-modules/op-system/src/main/java/com/op/system/service/impl/SysUserServiceImpl.java b/op-modules/op-system/src/main/java/com/op/system/service/impl/SysUserServiceImpl.java index 3e438d9e..1719d171 100644 --- a/op-modules/op-system/src/main/java/com/op/system/service/impl/SysUserServiceImpl.java +++ b/op-modules/op-system/src/main/java/com/op/system/service/impl/SysUserServiceImpl.java @@ -549,7 +549,8 @@ public class SysUserServiceImpl implements ISysUserService { Date maxTime = calendar.getTime(); String ymd = DateFormatUtils.format(maxTime, "yyyy-MM-dd");//yyyy-MM-dd log.info("更新人力-参数:"+ ymd); - AjaxResult hrR = remoteOpenService.GetHrUserInfo(ymd); + //AjaxResult hrR = remoteOpenService.GetHrUserInfo(ymd); + AjaxResult hrR = remoteOpenService.GetHrUserInfo("2024-09-01"); List infoList = new ArrayList<>(); if((int)hrR.get("code")==200 && hrR.get("data")!=null){ @@ -593,7 +594,6 @@ public class SysUserServiceImpl implements ISysUserService { dto.setDeptId(Long.parseLong(dto.getOucod())); } - int n = 0; //sap返回的编码 List codes = dtos.stream().map(HRInfo::getUserName).collect(Collectors.toList()); //sap返回的工作中心编码-本地已存在 @@ -607,21 +607,23 @@ public class SysUserServiceImpl implements ISysUserService { if(!CollectionUtils.isEmpty(updates)){ int allsize = updates.size(); - int inserttimes = allsize/150+1; + int inserttimes = allsize/100+1; for(int m=0;m everyList; if(m<(inserttimes-1)){ - everyList = updates.subList(m*150,(m+1)*150); + everyList = updates.subList(m*100,(m+1)*100); }else{ - everyList = updates.subList(m*150,allsize); + everyList = updates.subList(m*100,allsize); } if(everyList.size()>0){ - m = userMapper.updateUserBatchs(everyList); - System.out.println("人员新增成功条数:"+ m); + int snum = userMapper.updateUserBatchs(everyList); + if(snum == 1){ + log.info("人员编辑成功条数:"+ everyList.size()); + }else{ + log.info("人员编辑失败条数:"+ everyList.size()); + } } } - int m = userMapper.updateUserBatchs(updates); - System.out.println("人员更新成功条数:"+m); } List adds = dtos.stream() .filter(item -> noExsitCodes.contains(item.getUserName())) @@ -629,22 +631,22 @@ public class SysUserServiceImpl implements ISysUserService { if(!CollectionUtils.isEmpty(adds)){ int allsize = adds.size(); - int inserttimes = allsize/150+1; + int inserttimes = allsize/100+1; for(int m=0;m everyList; if(m<(inserttimes-1)){ - everyList = adds.subList(m*150,(m+1)*160); + everyList = adds.subList(m*100,(m+1)*100); }else{ - everyList = adds.subList(m*150,allsize); + everyList = adds.subList(m*100,allsize); } if(everyList.size()>0){ - n = userMapper.addUserBatchs(everyList); - System.out.println("人员新增成功条数:"+ n); + int nnum = userMapper.addUserBatchs(everyList); + log.info("人员新增成功条数:"+ nnum); } } } - return n; + return 1; } }