diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkConsumeMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkConsumeMapper.java index 92f41acd..b349ef97 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkConsumeMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkConsumeMapper.java @@ -75,4 +75,6 @@ public interface MesReportWorkConsumeMapper { int submitConsumePS(@Param("list")List mesReportWorkConsumes); int addConsumePS(@Param("list")List rconsumes); + + List getSonConsumeList(MesReportWorkConsume mesReportWorkConsume); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkMapper.java index f0de465f..1513a6cc 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/MesReportWorkMapper.java @@ -121,4 +121,8 @@ public interface MesReportWorkMapper { List getPrepareList(MesPrepareDetail mesPrepareDetail); int addReportPS(@Param("list") List rworks); + + public MesReportWork getReportWorkHz(MesReportWork mesReportWork); + + MesReportWork getEndReport(MesReportWork pWork); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java index 4858cb07..c91ee251 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/IWCInterfaceServiceImpl.java @@ -304,28 +304,26 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { mesReportWork.setUploadStatus("1");//除了1报工成功的,都需要报工 mesReportWork.setProdType("prod"); mesReportWork.setWorkorderCode(sapWorkOrders.get(1).getWorkorderCode()); - List reportWorks = mesReportWorkMapper.getReportWork(mesReportWork); - if(CollectionUtils.isEmpty(reportWorks)){ - return R.fail("未查询到报工单"); + MesReportWork sHzWorks = mesReportWorkMapper.getReportWorkHz(mesReportWork); + if(sHzWorks==null){ + return R.fail("未查询到子报工单"); } - MesReportWork sWork = reportWorks.get(0); //子工单报工 logger.info("==========================子工单报工开始"); - this.reportToSap(sWork); + this.reportHzToSap(sHzWorks); logger.info("==========================子工单报工结束"); mesReportWork.setWorkorderCode(sapWorkOrders.get(0).getWorkorderCode()); - List reportWorks2 = mesReportWorkMapper.getReportWork(mesReportWork); - if(CollectionUtils.isEmpty(reportWorks2)){ - return R.fail("未查询到报工单"); + MesReportWork pHzWork = mesReportWorkMapper.getReportWorkHz(mesReportWork); + if(pHzWork==null){ + return R.fail("未查询到母报工单"); } - MesReportWork pWork = reportWorks2.get(0); - //母工单报工 logger.info("==========================母工单报工开始"); - this.reportToSap(pWork); + this.reportHzToSap(pHzWork); logger.info("==========================母工单报工结束"); //最终报工标识:关闭子母工单 - if("1".equals(pWork.getEndReport())){ + MesReportWork endReport = mesReportWorkMapper.getEndReport(pHzWork); + if("1".equals(endReport.getEndReport())){ logger.info("报工======母sap工单编码:"+sapWorkOrders.get(0).getWorkorderCodeSap()+ "子sap工单编码:"+sapWorkOrders.get(1).getWorkorderCodeSap() ); @@ -350,7 +348,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { return R.ok(); } - private R reportToSap(MesReportWork workOrder){ + private R reportHzToSap(MesReportWork workOrder){ SapRFW sapRFW = new SapRFW(); sapRFW.setAufnr(workOrder.getWorkorderCodeSap());//虚拟工单号 sapRFW.setGamng(workOrder.getQuantityFeedback().toString());//报工数量 @@ -379,6 +377,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { } sapRFW.setLt_hwList(lt_hwList); logger.info(workOrder.getWorkorderCodeSap()+"sap工单报工请求:"+JSONObject.toJSONString(sapRFW)); + R r = remoteSapService.sapRFWOrder(sapRFW); logger.info(workOrder.getWorkorderCodeSap()+"sap工单报工结果:"+r.getCode()+","+r.getData()+","+r.getMsg()); //上传成功,更改mes_report_work状态 @@ -390,6 +389,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { } workOrder.setUploadTime(DateUtils.getNowDate()); mesReportWorkMapper.updateSyncSapStatus(workOrder); + return R.ok(); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkConsumeServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkConsumeServiceImpl.java index 8972f8a8..2f93a072 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkConsumeServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkConsumeServiceImpl.java @@ -152,7 +152,14 @@ public class MesReportWorkConsumeServiceImpl implements IMesReportWorkConsumeSer @Override @DS("#header.poolName") public List getConsumeList(MesReportWorkConsume mesReportWorkConsume) { - return mesReportWorkConsumeMapper.getConsumeList(mesReportWorkConsume); + List dtos = new ArrayList<>(); + if("0".equals(mesReportWorkConsume.getParentOrder())){ + dtos = mesReportWorkConsumeMapper.getConsumeList(mesReportWorkConsume); + }else{ + dtos = mesReportWorkConsumeMapper.getSonConsumeList(mesReportWorkConsume); + } + + return dtos; } @Override diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkConsumeMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkConsumeMapper.xml index 9faba0e3..1d3c7ed6 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkConsumeMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkConsumeMapper.xml @@ -93,15 +93,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mrwc.recoil from mes_report_work_consume mrwc where mrwc.del_flag = '0' - and mrwc.workorder_code = #{workorderCode} - - - and mrwc.parent_order = #{workorderCode} - + + - + insert into mes_report_work_consume record_id, diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml index 737e9b7a..6f1a8645 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/MesReportWorkMapper.xml @@ -469,8 +469,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + insert into mes_report_work diff --git a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml index a0fe4877..c1d9381d 100644 --- a/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml +++ b/op-modules/op-plan/src/main/resources/mapper/plan/ProOrderMapper.xml @@ -63,9 +63,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and prod_spc = #{prodSpc} and CONVERT(varchar(10),plan_pro_date, 120) >= '${planDateStart}' and '${planDateEnd}%' >= CONVERT(varchar(10),plan_pro_date, 120) + and prod_type != 'white' + and del_flag = '0' - and prod_type != 'white' - and del_flag = '0' ORDER BY plan_pro_date DESC