From 41f2c820fbfc0388ff47136a6b9cb151e7f226d0 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Thu, 29 Feb 2024 09:27:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E5=B1=82=E8=AE=A2=E5=8D=95=E6=94=B9?= =?UTF-8?q?=E9=80=A01.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MesReportWorkController.java | 10 +- .../com/op/mes/domain/MesReportWorkTabs.java | 48 ++++++ .../op/mes/mapper/MesReportWorkMapper.java | 2 + .../op/mes/service/IMesReportWorkService.java | 2 + .../service/impl/IWCInterfaceServiceImpl.java | 71 ++++---- .../impl/MesReportWorkServiceImpl.java | 31 ++++ .../mapper/mes/MesReportWorkMapper.xml | 13 +- .../ProOrderWorkorderController.java | 19 ++- .../com/op/plan/domain/ProOrderWorkorder.java | 10 ++ .../plan/mapper/ProOrderWorkorderMapper.java | 6 + .../service/IProOrderWorkorderService.java | 4 + .../service/impl/ProOrderServiceImpl.java | 6 +- .../impl/ProOrderWorkorderServiceImpl.java | 153 ++++++++++++------ .../mapper/plan/ProOrderWorkorderMapper.xml | 56 ++++++- 14 files changed, 326 insertions(+), 105 deletions(-) create mode 100644 op-modules/op-mes/src/main/java/com/op/mes/domain/MesReportWorkTabs.java diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorkController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorkController.java index 539f3510..2fbba6f8 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorkController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/MesReportWorkController.java @@ -392,7 +392,7 @@ public class MesReportWorkController extends BaseController { return mesReportWorkService.getBatchList(ProOrderWorkorder); } - /**获取母子报工记录**/ + /**获取母子报工记录(废弃)---改为:2.0查询各级报工详细列表**/ @RequiresPermissions("mes:reportWork:report") @GetMapping("/getReportList") public List getReportList(MesReportWork mesReportWork) { @@ -400,6 +400,14 @@ public class MesReportWorkController extends BaseController { return rlist; } + /**2.0查询各级报工详细列表**/ + @RequiresPermissions("mes:reportWork:report") + @GetMapping("/getAllLevelReportList") + public List getAllLevelReportList(MesReportWork mesReportWork) { + List rlist = mesReportWorkService.getAllLevelReportList(mesReportWork); + return rlist; + } + @PostMapping("/submitReportPS") public AjaxResult submitReportPS(@RequestBody List mesReportWorks) { return toAjax(mesReportWorkService.submitReportPS(mesReportWorks)); diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/MesReportWorkTabs.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesReportWorkTabs.java new file mode 100644 index 00000000..81f2e853 --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesReportWorkTabs.java @@ -0,0 +1,48 @@ +package com.op.mes.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.op.common.core.annotation.Excel; +import com.op.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * 报工报表对象 mes_report_work + * + * @author Open Platform + * @date 2023-08-24 + */ +public class MesReportWorkTabs extends BaseEntity { + private static final long serialVersionUID = 1L; + private String libId; + private String title; + private List libList; + + public String getLibId() { + return libId; + } + + public void setLibId(String libId) { + this.libId = libId; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public List getLibList() { + return libList; + } + + public void setLibList(List libList) { + this.libList = libList; + } +} 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 bf111453..a5189bd3 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 @@ -134,4 +134,6 @@ public interface MesReportWorkMapper { int reportSapCancel(MesReportWork mesReportWork); List getPutInOrderList(MesReportWork mesReportWorks); + + ProOrderWorkorder getSonWorkOrder(String workorderCode); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/IMesReportWorkService.java b/op-modules/op-mes/src/main/java/com/op/mes/service/IMesReportWorkService.java index 5d84c41e..dcfd6d13 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/IMesReportWorkService.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/IMesReportWorkService.java @@ -106,4 +106,6 @@ public interface IMesReportWorkService { int reportSapCancel(MesReportWork mesReportWork); List getPutInOrderList(MesReportWork mesReportWorks); + + List getAllLevelReportList(MesReportWork mesReportWork); } 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 20d95d58..1f90b4aa 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 @@ -298,54 +298,39 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { } //根据belong_work_order找到sap工单 - List sapWorkOrders = mesReportWorkMapper.getSapWorkOrder(mesReportWork.getWorkorderCode()); - if (CollectionUtils.isEmpty(sapWorkOrders) || sapWorkOrders.size() < 2) { + List workOrders = mesReportWorkMapper.getSapWorkOrder(mesReportWork.getWorkorderCode()); + if (CollectionUtils.isEmpty(workOrders)) { return R.fail("子母工单信息缺失"); } - /**子工单先报工,然后母工单报工**/ - mesReportWork.setUploadStatus("1");//除了1报工成功的,都需要报工 - mesReportWork.setProdType("prod"); - mesReportWork.setWorkorderCode(sapWorkOrders.get(1).getWorkorderCode()); - MesReportWork sHzWorks = mesReportWorkMapper.getReportWorkHz(mesReportWork); - if (sHzWorks == null) { - return R.fail("未查询到子报工单"); - } - //子工单报工 - logger.info("==========================子工单报工开始"); - R sapRson = this.reportHzToSap(sHzWorks); - logger.info("==========================子工单报工结束:" + JSONObject.toJSONString(sapRson)); - if (sapRson.getCode() == 200) { - //一定是子单报工成功返回后,再母单报工 - mesReportWork.setWorkorderCode(sapWorkOrders.get(0).getWorkorderCode()); - MesReportWork pHzWork = mesReportWorkMapper.getReportWorkHz(mesReportWork); - if (pHzWork == null) { - return R.fail("未查询到母报工单"); + R sapRson = null; + /**子工单先报工,然后母工单报工:workOrders内容就是-子子母**/ + for(MesReportWork workOrder:workOrders){ + mesReportWork.setUploadStatus("1");//除了1报工成功的,都需要报工 + mesReportWork.setProdType("prod"); + mesReportWork.setWorkorderCode(workOrder.getWorkorderCode()); + MesReportWork sHzWorks = mesReportWorkMapper.getReportWorkHz(mesReportWork); + if (sHzWorks == null) { + return R.fail(workOrder.getWorkorderCode()+"未查询到报工单"); } - try { - Thread.sleep(3000); - } catch (Exception e) { - e.printStackTrace(); + //子工单报工 + logger.info("==========================工单("+sHzWorks.getWorkorderCodeSap()+")报工开始"); + sapRson = this.reportHzToSap(sHzWorks); + logger.info("==========================工单("+sHzWorks.getWorkorderCodeSap()+")报工结束:" + + JSONObject.toJSONString(sapRson)); + if (sapRson.getCode() == 200) { + try { + Thread.sleep(3000); + } catch (Exception e) { + e.printStackTrace(); + } + //最终报工标识且sap报工成功:关闭子母工单 + //MesReportWork endReport = mesReportWorkMapper.getEndReport(pHzWork); + }else{ + //报工不成功跳出循环 + break; } - //母工单报工 - logger.info("==========================母工单报工开始"); - pHzWork.setQuantityFeedback(sHzWorks.getQuantityFeedback()); - pHzWork.setSac1(sHzWorks.getSac1()); - R sapR = this.reportHzToSap(pHzWork); - logger.info("==========================母工单报工结束" + JSONObject.toJSONString(sapR)); - return sapR; - //最终报工标识且sap报工成功:关闭子母工单 -// MesReportWork endReport = mesReportWorkMapper.getEndReport(pHzWork); -//-----改为由上位机触发 -// if("1".equals(endReport.getEndReport())&&sapR.getCode()==200){ -// MesReportWork rworkVo = new MesReportWork(); -// rworkVo.setStatus("w3"); -// rworkVo.setUpdateTime(DateUtils.getNowDate()); -// rworkVo.setUpdateBy(SecurityUtils.getUsername()); -// rworkVo.setWorkorderCode(belongWorkOrder); -// //pro_work_order status->w3报工--belong_work_order -// mesReportWorkMapper.updateOrderWorkStatus(rworkVo); -// } } + return sapRson; } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java index 645a4a90..be5ac1cb 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/MesReportWorkServiceImpl.java @@ -151,6 +151,37 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService { return mesReportWorkMapper.getReportList(mesReportWork); } + @Override + @DS("#header.poolName") + public List getAllLevelReportList(MesReportWork mesReportWork) { + List tabs = new ArrayList<>(); + MesReportWorkTabs pTabs = new MesReportWorkTabs(); + int i = 1; + pTabs.setLibId("order"+i); + pTabs.setTitle("第"+i+"层工单信息"); + mesReportWork.setParentOrder("0"); + List liblist0 = mesReportWorkMapper.getReportList(mesReportWork); + pTabs.setLibList(liblist0); + tabs.add(pTabs); + + ProOrderWorkorder sonWorkOrder = mesReportWorkMapper.getSonWorkOrder(mesReportWork.getWorkorderCode()); + while(sonWorkOrder!=null){ + int xh = ++i; + MesReportWorkTabs sTabs = new MesReportWorkTabs(); + sTabs.setLibId("order"+xh); + sTabs.setTitle("第"+xh+"层工单信息"); + mesReportWork.setParentOrder(sonWorkOrder.getParentOrder()); + mesReportWork.setWorkorderCode(sonWorkOrder.getParentOrder()); + List liblist = mesReportWorkMapper.getReportList(mesReportWork); + sTabs.setLibList(liblist); + tabs.add(sTabs); + + sonWorkOrder = mesReportWorkMapper.getSonWorkOrder(sonWorkOrder.getWorkorderCode()); + } + + return tabs; + } + @Override @DS("#header.poolName") public int submitReportPS(List mesReportWorks) { 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 3baa8388..9bbf1359 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 @@ -473,7 +473,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" workorder_code workorderCode from pro_order_workorder where belong_work_order = #{workorderCode} and del_flag = '0' - order by parent_order + order by order_code + - + insert into mes_report_work id, 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 46785bbe..c78544be 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 @@ -121,6 +121,23 @@ public class ProOrderWorkorderController extends BaseController { List list = proOrderWorkorderService.selectProOrderWorkorderList(proOrderWorkorder); return getDataTable(list); } + /**查询生产工单列表--顶级母单**/ + @RequiresPermissions("mes:pro:proworkorder:list") + @GetMapping("/listLevel0") + public TableDataInfo listLevel0(ProOrderWorkorder proOrderWorkorder) { + startPage(); + List list = proOrderWorkorderService.getWorkorderLevel0List(proOrderWorkorder); + return getDataTable(list); + } + /**查询生产工单列表--下一级**/ + @GetMapping("/getNextLevelWorkOrderList/{parentOrder}") + public List getNextLevelWorkOrderList(@PathVariable("parentOrder") String parentOrder) { + ProOrderWorkorder proOrderWorkorder = new ProOrderWorkorder(); + proOrderWorkorder.setParentOrder(parentOrder); + List list = proOrderWorkorderService.getNextLevelWorkOrderList(proOrderWorkorder); + return list; + } + /** * 导出生产工单列表 @@ -218,7 +235,7 @@ public class ProOrderWorkorderController extends BaseController { } /** - * 下发生产工单 + * 下发生产工单。workorderIds:母工单号 */ @RequiresPermissions("mes:pro:workorder:edit") @Log(title = "下发生产工单", businessType = BusinessType.OTHER) diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java index a40324d1..9b56b68f 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrderWorkorder.java @@ -286,6 +286,16 @@ public class ProOrderWorkorder extends TreeEntity { */ private String factoryCode; + private Boolean hasChildren; + + public Boolean getHasChildren() { + return hasChildren; + } + + public void setHasChildren(Boolean hasChildren) { + this.hasChildren = hasChildren; + } + public String getPproductCode() { return pproductCode; } 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 712459ec..6749019c 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 @@ -178,5 +178,11 @@ public interface ProOrderWorkorderMapper { List selectProOrderWorkorderList999(ProOrderWorkorder proOrderWorkorder); ProWetMaterialPlanDetail getWetMaterial(String workorderId); + + List getLevelWorkOrderList(ProOrderWorkorder proOrderWorkorder); + + ProOrderWorkorder getSonWorkOrder(ProOrderWorkorder whiteOrder); + + ProOrderWorkorder selectSonWorkOrder(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 fa14e5c2..16732bd5 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 @@ -125,4 +125,8 @@ public interface IProOrderWorkorderService { void deleteWhiteWorkorderByWorkOrder(List whiteWorkOrder); AjaxResult subChangeWorkOrderM(SplitOrderDTO splitOrderDTO); + + List getWorkorderLevel0List(ProOrderWorkorder proOrderWorkorder); + + List getNextLevelWorkOrderList(ProOrderWorkorder proOrderWorkorder); } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java index 23ebea08..8e160ee4 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderServiceImpl.java @@ -321,8 +321,10 @@ public class ProOrderServiceImpl implements IProOrderService { // code自增 endCode++; } else { - // 设置子节点end_flag字段信息 - workOrder.setEndFlag(1); + if(!"0".equals(workOrder.getParentOrder())) { + // 设置子节点end_flag字段信息 + workOrder.setEndFlag(1); + } // 更新数据库记录信息 proOrderWorkorderMapper.updateProOrderWorkorder(workOrder); // 结束循环 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 1d6eced2..ed4f774b 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 @@ -64,8 +64,6 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { @Autowired private ProOrderMapper proOrderMapper; @Autowired - private ProWorkorderProcessDetailMapper proWorkorderProcessDetailMapper; - @Autowired private ProWetMaterialPlanDetailMapper proWetMaterialPlanDetailMapper; @Autowired private RemoteSapService remoteSapService; @@ -140,6 +138,71 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { return workorderList; } + @Override + @DS("#header.poolName") + public List getWorkorderLevel0List(ProOrderWorkorder proOrderWorkorder) { + List workorderList = proOrderWorkorderMapper.getLevelWorkOrderList(proOrderWorkorder); + + for (ProOrderWorkorder workorder : workorderList) { +// List childrens = new ArrayList<>(); +// ProOrderWorkorder child = new ProOrderWorkorder(); +// child.setWorkorderCode("test"); +// childrens.add(child); +// workorder.setChildren(childrens); + workorder.setHasChildren(true); + + String prodLineName = ""; + String equipCods = "'"; + JSONArray codeArray = JSONArray.parseArray(workorder.getProdLineCode()); + for (int c = 0; c < codeArray.size(); c++) { + equipCods += codeArray.getJSONArray(c).getString(1) + "','"; + } + + Map equipMap = proOrderMapper.getEquipInfoByCodes(equipCods.substring(1));//设备字典 + for (int c = 0; c < codeArray.size(); c++) { + String equipCode = codeArray.getJSONArray(c).getString(1); + CascaderDTO eInfo = equipMap.get(equipCode); + if (eInfo != null) { + prodLineName += eInfo.getLabel() + ","; + } + } + workorder.setProdLineName(prodLineName); + + // 通过工艺编码code查询出机型名称 + workorder.setRouteName(proOrderWorkorderMapper.selectRouteNameByRouteCode(workorder.getRouteCode())); + } + return workorderList; + } + + @Override + @DS("#header.poolName") + public List getNextLevelWorkOrderList(ProOrderWorkorder proOrderWorkorder) { + List workorderList = proOrderWorkorderMapper.getLevelWorkOrderList(proOrderWorkorder); + for (ProOrderWorkorder workorder : workorderList) { + String prodLineName = ""; + String equipCods = "'"; + JSONArray codeArray = JSONArray.parseArray(workorder.getProdLineCode()); + for (int c = 0; c < codeArray.size(); c++) { + equipCods += codeArray.getJSONArray(c).getString(1) + "','"; + } + + Map equipMap = proOrderMapper.getEquipInfoByCodes(equipCods.substring(1));//设备字典 + for (int c = 0; c < codeArray.size(); c++) { + String equipCode = codeArray.getJSONArray(c).getString(1); + CascaderDTO eInfo = equipMap.get(equipCode); + if (eInfo != null) { + prodLineName += eInfo.getLabel() + ","; + } + } + workorder.setProdLineName(prodLineName); + + // 通过工艺编码code查询出机型名称 + workorder.setRouteName(proOrderWorkorderMapper.selectRouteNameByRouteCode(workorder.getRouteCode())); + workorder.setHasChildren(true); + } + return workorderList; + } + /** * 新增生产工单 * @@ -290,26 +353,30 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { wids.add(whiteOrder.getWorkorderId()); wcodes.add(whiteOrder.getWorkorderCode()); ordercodes.add(whiteOrder.getOrderCode()); - Boolean isTop = true; - //成品的母工单//查上一级工单 - while (isTop) { - //查上一级工单 - whiteOrder.setWorkorderCode(whiteOrder.getParentOrder()); - ProOrderWorkorder pWorkOrder = proOrderWorkorderMapper.getPWorkOrder(whiteOrder); - if (pWorkOrder != null) { - wids.add(pWorkOrder.getWorkorderId()); - wcodes.add(pWorkOrder.getWorkorderCode()); - ordercodes.add(pWorkOrder.getOrderCode()); - } - if ("0".equals(pWorkOrder.getParentOrder())) { - BeanUtils.copyProperties(pWorkOrder, whiteOrder); - isTop = false; + Boolean isNotTop = true; + //成品的母工单//查下一级工单 + while (isNotTop) { + if(!"0".equals(whiteOrder.getParentOrder())){ + //查上一级工单 + whiteOrder.setWorkorderCode(whiteOrder.getParentOrder()); + ProOrderWorkorder sWorkOrder = proOrderWorkorderMapper.getSonWorkOrder(whiteOrder); + if (sWorkOrder != null) { + wids.add(sWorkOrder.getWorkorderId()); + wcodes.add(sWorkOrder.getWorkorderCode()); + ordercodes.add(sWorkOrder.getOrderCode()); + } + if ("0".equals(sWorkOrder.getParentOrder())) { + BeanUtils.copyProperties(sWorkOrder, whiteOrder); + isNotTop = false; + } + }else{ + isNotTop = false; } } - //顺序母子 - Collections.reverse(wids); - Collections.reverse(wcodes); - Collections.reverse(ordercodes); + //顺序子母->母子 +// Collections.reverse(wids); +// Collections.reverse(wcodes); +// Collections.reverse(ordercodes); sapList = new ArrayList<>(); SapCreateOrder sap = new SapCreateOrder(); @@ -356,11 +423,10 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { //关闭母子订单//订单的订单编码(关闭订单暂时隐藏) SapCloseOrderQuery sapCloseOrderQuery = new SapCloseOrderQuery(); - sapCloseOrderQuery.setLeadOrder(ordercodes.get(0)); - sapCloseOrderQuery.setOrder(ordercodes.get(1)); + sapCloseOrderQuery.setOrderCodes(ordercodes); R closeR= remoteSapService.sapCloseOrder(sapCloseOrderQuery); - logger.info(whiteOrder.getWorkorderCode()+"下发工单后关闭母订单"+sapCloseOrderQuery.getLeadOrder()+":"+ - sapCloseOrderQuery.getOrder()+":"+ + logger.info(whiteOrder.getWorkorderCode()+"下发工单后关闭老订单"+ + JSONObject.toJSONString(sapCloseOrderQuery)+ closeR.getCode()+","+ closeR.getMsg()+","+ closeR.getData()); @@ -488,16 +554,6 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { return success(orderAndWork); } else { - boolean run = true; - while (run) { - ProOrderWorkorder fatherWorkOrder = proOrderWorkorderMapper.selectWorkOrderByCode(proOrderWorkorder.getParentOrder()); - // 如果存在父工单 - if (fatherWorkOrder != null) { - BeanUtils.copyProperties(fatherWorkOrder, proOrderWorkorder); - } else { - run = false; - } - } // 通过母订单id查询母订单详情 ProOrder proOrder = proOrderMapper.selectProOrderById(proOrderWorkorder.getOrderId()); if (proOrder != null) { @@ -894,7 +950,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { } /** - * 通过子工单code查询并返回所有级联工单 + * 通过母工单code查询并返回所有级联工单 * * @param code * @return @@ -905,34 +961,24 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { // 创建返回工单列表 List proOrderWorkorderList = new ArrayList(); // 查询该工单信息 - ProOrderWorkorder proOrderWorkorder = proOrderWorkorderMapper.selectWorkOrderByCode(code); - formatProOrderWorkorder(proOrderWorkorder); - proOrderWorkorderList.add(proOrderWorkorder); + ProOrderWorkorder pWorkorder = proOrderWorkorderMapper.selectWorkOrderByCode(code); + formatProOrderWorkorder(pWorkorder); + proOrderWorkorderList.add(pWorkorder); boolean flag = true; - - // 临时存放parentCode - StringBuilder tempCode = new StringBuilder(); - tempCode.append(proOrderWorkorder.getParentOrder()); - + String parentOrder = pWorkorder.getWorkorderCode(); + //母查子遍历 while (flag) { - ProOrderWorkorder workorder = proOrderWorkorderMapper.selectWorkOrderByCode(tempCode.toString()); + ProOrderWorkorder workorder = proOrderWorkorderMapper.selectSonWorkOrder(parentOrder); if (workorder != null) { formatProOrderWorkorder(workorder); proOrderWorkorderList.add(workorder); - tempCode.setLength(0); - tempCode.append(workorder.getParentOrder()); + parentOrder = workorder.getWorkorderCode(); } else { flag = false; } } - // 反转list - List reversalWorkOrderList = new ArrayList<>(); - for (int i = proOrderWorkorderList.size() - 1; i >= 0; i--) { - reversalWorkOrderList.add(proOrderWorkorderList.get(i)); - } - - return success(reversalWorkOrderList); + return success(proOrderWorkorderList); } /** @@ -1033,6 +1079,7 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { proOrderWorkorder.setShiftDesc(shiftDesc); proOrderWorkorder.setBatchCodeList(batchCodes); proOrderWorkorder.setBatchNumList(batchNums); + proOrderWorkorder.setHasChildren(null);//会直接导致树结构不展示 // 通过母工单workorder_id查询子工单 List childWorkorders = proOrderWorkorderMapper.selectChildWorkOrder(proOrderWorkorder.getWorkorderCode()); if (!childWorkorders.isEmpty()) { 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 6f33adc5..ac5ed3a1 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 @@ -65,7 +65,7 @@ pow.workorder_code_sap, ppow.product_code pproductCode,ppow.product_name pproductName,ppow.workorder_code_sap pworkorderCodeSap from pro_order_workorder pow - left join pro_order_workorder ppow on pow.parent_order = ppow.workorder_code + left join pro_order_workorder ppow on pow.parent_order = ppow.workorder_code and ppow.del_flag = '0' and pow.workorder_code like concat('%', #{workorderCode}, '%') @@ -95,7 +95,45 @@ and '${productDateEnd}' >= CONVERT(varchar(10),pow.product_date, 120) - and pow.del_flag = '0' and ppow.del_flag = '0' + and pow.del_flag = '0' + + + + + +