From 56688501184c57d16f8ca30fcd1e93338c0f7b41 Mon Sep 17 00:00:00 2001 From: mengjiao <3338049200@qq,com> Date: Mon, 18 Mar 2024 15:30:51 +0800 Subject: [PATCH 1/3] =?UTF-8?q?wms=E5=8C=85=E6=9D=90=E5=87=BA=E5=BA=93?= =?UTF-8?q?=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B916---?= =?UTF-8?q?=E5=8F=8D=E5=86=B2=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/wms/OdsProcureOutOrderMapper.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/OdsProcureOutOrderMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/OdsProcureOutOrderMapper.xml index 761dd7be..608035f7 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/OdsProcureOutOrderMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/OdsProcureOutOrderMapper.xml @@ -296,6 +296,7 @@ LEFT JOIN (SELECT Produce_Code,Material_Code,SUM(Plan_Number) Plan_Number FROM ods_procure_out_order GROUP BY Produce_Code,Material_Code)AS out_order ON out_order.Produce_Code= mes_prepare.workorder_name AND out_order.Material_Code=mes_prepare_detail.material_code WHERE mes_prepare_detail.prepare_id= #{ID} + ORDER BY mes_prepare_detail.recoil insert into wms_raw_mission_out(id, From c8e9bd9791a515f404b50ffe9734d5a2a5d88926 Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Mon, 18 Mar 2024 17:00:23 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=8A=A5=E5=B7=A5=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=89=A9=E6=96=99=E7=BB=84=E6=88=90+=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E5=90=8E=E5=8F=B0=E5=8A=A0=E4=B8=8B=E5=8F=91?= =?UTF-8?q?=E4=BA=8C=E6=AC=A1=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/op/system/api/RemoteSapService.java | 3 + .../system/api/domain/sap/SapBaseProduct.java | 10 ++ .../api/factory/RemoteSapFallbackFactory.java | 5 + .../controller/MesReportWorkController.java | 11 +++ .../op/mes/domain/MesReportWorkConsume.java | 19 ++++ .../mapper/MesReportWorkConsumeMapper.java | 2 + .../op/mes/mapper/MesReportWorkMapper.java | 6 +- .../op/mes/service/IMesReportWorkService.java | 4 + .../service/impl/IWCInterfaceServiceImpl.java | 97 +++++++++++++------ .../impl/MesReportWorkConsumeServiceImpl.java | 38 +++++++- .../impl/MesReportWorkServiceImpl.java | 14 +++ .../mapper/mes/MesReportWorkConsumeMapper.xml | 58 ++++++----- .../mapper/mes/MesReportWorkMapper.xml | 62 ++++++------ .../ProOrderWorkorderController.java | 8 +- .../java/com/op/plan/domain/ProOrder.java | 10 ++ .../plan/mapper/ProOrderWorkorderMapper.java | 2 + .../service/IProOrderWorkorderService.java | 2 + .../service/impl/ProOrderServiceImpl.java | 9 +- .../impl/ProOrderWorkorderServiceImpl.java | 6 ++ .../resources/mapper/plan/ProOrderMapper.xml | 5 +- .../mapper/plan/ProOrderWorkorderMapper.xml | 11 +++ 21 files changed, 283 insertions(+), 99 deletions(-) diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java index 0a84fae2..85908d3c 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/RemoteSapService.java @@ -28,6 +28,9 @@ public interface RemoteSapService { @PostMapping("/sap/shopUpdateSync") public R shopUpdateSync(@RequestBody SapShopOrderQuery sapProOrder); + @PostMapping("/sap/shopOrderBomUpdate") + public R shopOrderBomUpdate(@RequestBody(required = false) List> mapList); + @PostMapping("/sap/sapRouterSync") public R sapRouterSync(@RequestBody SapRouterQuery sapRouterQuery); diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapBaseProduct.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapBaseProduct.java index 9573c014..ce218f3f 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapBaseProduct.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/sap/SapBaseProduct.java @@ -166,6 +166,16 @@ public class SapBaseProduct extends BaseEntity { @Excel(name = "补料比例") private String appendPercent; + private String meins; + + public String getMeins() { + return meins; + } + + public void setMeins(String meins) { + this.meins = meins; + } + public void setProductId(String productId) { this.productId = productId; } diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteSapFallbackFactory.java b/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteSapFallbackFactory.java index e9709b2a..1c4ca56b 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteSapFallbackFactory.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/factory/RemoteSapFallbackFactory.java @@ -79,6 +79,11 @@ public class RemoteSapFallbackFactory implements FallbackFactory> mapList) { + return R.fail("sap shopOrderBomUpdate失败" + throwable.getMessage()); + } + @Override public R sapBackflushMP(List sapBackflushMPQueryList) { return R.fail("反冲物料领料过账失败" + throwable.getMessage()); 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 ad034b78..4f1c22df 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 @@ -456,6 +456,17 @@ public class MesReportWorkController extends BaseController { public List getNewPrepareData(@RequestBody MesPrepareDetail mesPrepareDetail) { return mesReportWorkService.getNewPrepareData(mesPrepareDetail); } + /**删除新增的报工物料组成**/ + @DeleteMapping("/deleteBomRowNow/{id}") + public AjaxResult deleteBomRowNow(@PathVariable String id) { + return toAjax(mesReportWorkService.deleteBomRowNow(id)); + } + //获取仓库下拉列表 + @GetMapping("/getWarehouseList") + public List getWarehouseList(MesReportWorkConsume workConsume) { + List rlist = mesReportWorkService.getWarehouseList(workConsume); + return rlist; + } } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/MesReportWorkConsume.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesReportWorkConsume.java index 1f85da30..beaa3cfa 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/domain/MesReportWorkConsume.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/MesReportWorkConsume.java @@ -109,6 +109,25 @@ public class MesReportWorkConsume extends BaseEntity { private String pMaterialCode; private String workorderCodeSap; + private String warehouseCode; + private String warehouseName; + + public String getWarehouseCode() { + return warehouseCode; + } + + public void setWarehouseCode(String warehouseCode) { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseName() { + return warehouseName; + } + + public void setWarehouseName(String warehouseName) { + this.warehouseName = warehouseName; + } + public String getWorkorderCodeSap() { return workorderCodeSap; } 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 cd7d55f6..7ccb2c3f 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 @@ -79,4 +79,6 @@ public interface MesReportWorkConsumeMapper { List getSonConsumeList(MesReportWorkConsume mesReportWorkConsume); List getBomList(MesReportWorkConsume mesReportWorkConsume); + + MesReportWorkConsume getNewConsumeInfo(String workorderCode); } 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 d4dd9335..5362f1a4 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 @@ -137,5 +137,9 @@ public interface MesReportWorkMapper { ProOrderWorkorder getSonWorkOrder(String workorderCode); - public MesReportWork getReportWorkHz1(MesReportWork mesReportWork); + int deleteBomRowNow(String id); + + List getWarehouseList(MesReportWorkConsume workConsume); + + List getUpdateAttr1Boms(MesReportWork 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 3063faf2..db5c06ce 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 @@ -111,4 +111,8 @@ public interface IMesReportWorkService { List getAllLevelReportList(MesReportWork mesReportWork); List getNewPrepareData(MesPrepareDetail mesPrepareDetail); + + int deleteBomRowNow(String id); + + List getWarehouseList(MesReportWorkConsume workConsume); } 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 83c28596..b8c3ca60 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 @@ -306,26 +306,29 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { * 关闭母工单,关闭子工单 * * 一层---------------------------------------- * * 工单进行报工的时候公式调整如下(数值单位不用管): - * * 机器=开机时长 - * * 人工 = 用人数*机器(开机时长) + * * 产量=sum(每批次半成品的产量)【单位pc】 + * * 机器=sum(工时数) 【设备开机时间】 + * * 人工 = sum(每批的工时数*每批用人数) * * 折旧 = 机器 * * 其它 = 人工 * * 二层---------------------------------------- * * 子单进行报工的时候公式调整如下(数值单位不用管): - * * 机器=sum(工时数) - * * 人工 = 用人数*机器 + * * 产量=sum(每批次半成品的产量)【单位pc】 + * * 机器=sum(工时数)【设备开机时间】 + * * 人工 = sum(人数*开机时间)【人数为每批次的产线人数,开机时间为每批次工时】 * * 折旧 = 机器 * * 其它 = 人工 * *

* * 母单进行报工的时候公式调整如下: - * * 机器=sum(工时数) - * * 人工 = 4*sum(工时数) + * * 产量=sum(每批次半成品的产量)【单位pc】 + * * 机器=sum(工时数)【设备开机时间】 + * * 人工 = 4*sum(开机时间) 【人数固定为4人,可修改】 * * 折旧 = 机器 * * 其它 = 人工 * * 三层及其以上---------------------------------------- * * 工单进行报工的时候公式调整如下(数值单位不用管),根据上位机用户真实填的来: - * * 机器=开机时长 - * * 人工 = 人工 + * * 机器=sum(工时数)【设备开机时间】 + * * 人工 = sum(人数*开机时间) * * 折旧 = 机器 * * 其它 = 人工 * @param mesReportWork @@ -343,19 +346,28 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { if (CollectionUtils.isEmpty(workOrders)) { return R.fail("子母工单信息缺失"); } + + /**修改sap物料损耗组成**/ + R updateBomsSap = this.updateAttr1BomsSap(workOrders); + if(updateBomsSap.getCode()== 500){ + return updateBomsSap; + } + R sapRson = null; if(workOrders.size()==1){ /**(一层报工)工单报工**/ mesReportWork.setUploadStatus("1");//除了1报工成功的,都需要报工 mesReportWork.setProdType("prod"); mesReportWork.setWorkorderCode(workOrders.get(0).getWorkorderCode()); - MesReportWork sHzWorks = mesReportWorkMapper.getReportWorkHz1(mesReportWork); + MesReportWork sHzWorks = mesReportWorkMapper.getReportWorkHz(mesReportWork); if(sHzWorks==null){ return R.fail("未查询到一层报工单"); } + //机器=sum(工时数) 【设备开机时间】 Sac1 + //人工 = sum(每批的工时数*每批用人数) Sac2 //子工单报工 logger.info("==========================一层工单报工开始"); - sapRson = this.reportHzToSap(sHzWorks,1); + sapRson = this.reportHzToSap(sHzWorks); logger.info("==========================一层工单报工结束:"+JSONObject.toJSONString(sapRson)); }else if(workOrders.size()==2){ /**(两层报工)子工单先报工,然后母工单报工**/ @@ -368,7 +380,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { } //子工单报工 logger.info("==========================子工单报工开始"); - sapRson = this.reportHzToSap(sHzWorks,2); + sapRson = this.reportHzToSap(sHzWorks); logger.info("==========================子工单报工结束:"+JSONObject.toJSONString(sapRson)); if(sapRson.getCode()== 200){ //一定是子单报工成功返回后,再母单报工 @@ -385,25 +397,32 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { //母工单报工 logger.info("==========================母工单报工开始"); pHzWork.setQuantityFeedback(sHzWorks.getQuantityFeedback()); - pHzWork.setSac2("4");//母单报工固定值 - R sapR = this.reportHzToSap(pHzWork,2); + //pHzWork.setSac2("4");//母单报工固定值(上位机插入数据时候默认4) + R sapR = this.reportHzToSap(pHzWork); logger.info("==========================母工单报工结束"+JSONObject.toJSONString(sapR)); return sapR; } }else if(workOrders.size()>=3){ - for(MesReportWork workOrder:workOrders){ + MesReportWork hzWorks = null; + for(int n=0;n workOrderCodes) { + //是否有变动的物料损耗组成 + List updateBoms = mesReportWorkMapper.getUpdateAttr1Boms(workOrderCodes.get(workOrderCodes.size()-1)); + if(!CollectionUtils.isEmpty(updateBoms)){ + List> mapList = new ArrayList<>(); + Map mapBom = null; + for(MesReportWorkConsume updateBom:updateBoms){ + mapBom = new HashMap(); + mapBom.put("P_AUFNR",updateBom.getWorkorderCodeSap());// 订单号 例如:000100308287 + mapBom.put("P_MATNR",updateBom.getMaterialCode());// 物料号 例如:000000040000015089 + mapBom.put("P_GMEIN",updateBom.getUnit());// 基本计量单位 例如:m + mapBom.put("P_WERKS",workOrderCodes.get(0).getFactoryCode());//物料工厂 例如:1000 + mapBom.put("P_LGORT",updateBom.getWarehouseCode());//仓库编号 例如:0013 + mapList.add(mapBom); + } + + logger.info(workOrderCodes.get(workOrderCodes.size()-1).getWorkorderCode() + + "报工损耗物料组件修改请求:" + JSONObject.toJSONString(mapList)); + R bomUpdateR = remoteSapService.shopOrderBomUpdate(mapList); + logger.info(workOrderCodes.get(workOrderCodes.size()-1).getWorkorderCode() + + "报工损耗物料组件修改结果:" + JSONObject.toJSONString(bomUpdateR)); + return bomUpdateR; + } + return R.ok(); + } /** * * @param workOrder * @return */ - private R reportHzToSap(MesReportWork workOrder,int cengji) { + private R reportHzToSap(MesReportWork workOrder) { Date nowTime = DateUtils.getNowDate(); SapRFW sapRFW = new SapRFW(); sapRFW.setAufnr(workOrder.getWorkorderCodeSap());//虚拟工单号 sapRFW.setGamng(workOrder.getQuantityFeedback().toString());//报工数量 SapRFW.lt_gs ltgs = new SapRFW.lt_gs();//生产订单报工工时修改 ltgs.setConf_activity1(workOrder.getSac1());//机器 - BigDecimal newMan = null; - if(cengji == 3){ - //订单是三层的情况 - newMan = new BigDecimal(workOrder.getSac2()); - }else{ - //订单是一层、二层的情况 - newMan = new BigDecimal(workOrder.getSac1()) - .multiply(new BigDecimal(workOrder.getSac2())); - } - ltgs.setConf_activity2(newMan.toString());//人工 + ltgs.setConf_activity2(workOrder.getSac2());//人工 ltgs.setConf_activity3(workOrder.getSac1());//折旧 - ltgs.setConf_activity4(newMan.toString());//其它 + ltgs.setConf_activity4(workOrder.getSac2());//其它 // ltgs.setConf_activity5(workOrder.getSac5()); // ltgs.setConf_activity6(workOrder.getSac6()); sapRFW.setLt_gs(ltgs); @@ -481,6 +517,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService { mesReportWorkMapper.updateSyncSapStatus(workOrder); return r; +// 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 1d6fe2d6..65f44bfd 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 @@ -1,10 +1,8 @@ package com.op.mes.service.impl; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.utils.DateUtils; @@ -16,6 +14,7 @@ import com.op.mes.mapper.MesReportWorkMapper; import com.op.system.api.domain.dto.BaseBomDTO; import com.op.system.api.domain.mes.BaseProductDTO; import com.op.system.api.domain.mes.BaseTeamTDTO; +import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -171,7 +170,36 @@ public class MesReportWorkConsumeServiceImpl implements IMesReportWorkConsumeSer mesReportWorkConsume.setUpdateTime(nowTime); mesReportWorkConsume.setUpdateBy(updateBy); } - return mesReportWorkConsumeMapper.submitConsumePS(mesReportWorkConsumes); + List updates = mesReportWorkConsumes + .stream() + .filter(u -> u.getCreateTime()!=null).collect(Collectors.toList()); + List adds = mesReportWorkConsumes + .stream() + .filter(u -> u.getCreateTime()==null).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(adds)){ + Map consumeInfoMap = new HashMap<>(); + for(MesReportWorkConsume add:adds){ + MesReportWorkConsume newConsumeInfo = consumeInfoMap.get(add.getWorkorderCode()); + if(newConsumeInfo==null){ + MesReportWorkConsume mapItem = mesReportWorkConsumeMapper.getNewConsumeInfo(add.getWorkorderCode()); + consumeInfoMap.put(add.getWorkorderCode(),mapItem); + } + newConsumeInfo = consumeInfoMap.get(add.getWorkorderCode()); + + add.setRecordId(IdUtils.fastSimpleUUID()); + add.setReportCode(newConsumeInfo.getReportCode()); + add.setWorkorderCode(newConsumeInfo.getWorkorderCode()); + add.setCreateTime(nowTime); + add.setCreateTime(nowTime); + add.setAttr1("1");//新增标识 + add.setParentOrder(newConsumeInfo.getParentOrder()); + } + int addNum =mesReportWorkConsumeMapper.addConsumePS(adds); + System.out.println("addNum:"+addNum); + } + int updateNum =mesReportWorkConsumeMapper.submitConsumePS(updates); + System.out.println("addNum:"+updateNum); + return updateNum; } @Override 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 b2f0a60a..803dc359 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 @@ -237,6 +237,18 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService { return details; } + @Override + @DS("#header.poolName") + public int deleteBomRowNow(String id) { + return mesReportWorkMapper.deleteBomRowNow(id); + } + + @Override + @DS("#header.poolName") + public List getWarehouseList(MesReportWorkConsume workConsume) { + return mesReportWorkMapper.getWarehouseList(workConsume); + } + @Override @DS("#header.poolName") public int submitReportPS(List mesReportWorks) { @@ -550,6 +562,8 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService { return dtos; } + + public static void main(String[] args) { Calendar calendar = Calendar.getInstance(); Date now = calendar.getTime(); 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 a33283fa..559692d2 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 @@ -66,26 +66,25 @@ where record_id = #{recordId} + insert into mes_report_work_consume @@ -203,13 +211,15 @@ ( record_id,report_code,workorder_code, material_code,material_name,quantity,unit, - create_by,create_time,parent_order,recoil + create_by,create_time,parent_order,recoil, + warehouse_code,warehouse_name )values ( #{item.recordId},#{item.reportCode},#{item.workorderCode}, #{item.materialCode},#{item.materialName},#{item.quantity},#{item.unit}, - #{item.createBy},#{item.createTime},#{item.parentOrder},#{item.recoil} + #{item.createBy},#{item.createTime},#{item.parentOrder},#{item.recoil}, + #{item.warehouseCode},#{item.warehouseName} ) @@ -243,7 +253,9 @@ set quantity = #{item.quantity}, update_by = #{item.updateBy}, - update_time = #{item.updateTime} + update_time = #{item.updateTime}, + warehouse_code = #{item.warehouseCode}, + warehouse_name = #{item.warehouseName} where record_id = #{item.recordId} 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 33b8d260..764ee92e 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 @@ -472,7 +472,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select mrw.workorderCode,mrw.productCode,mrw.productName,mrw.machineCode,mrw.machineName, mrw.shiftCode,mrw.quantityFeedback, - mrw.workTime,mrw.useMan,mrw.uploadStatus,mrw.unit, + mrw.workTime,mrw.uploadStatus,mrw.unit, pow.order_code orderCode,pow.quantity_split quantity, pow.workorder_code_sap workorderCodeSap, pow.product_date productDate, @@ -495,7 +496,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" shift_code shiftCode, sum(quantity_feedback) quantityFeedback, sum(work_time) workTime, - use_man useMan, upload_status uploadStatus, upload_time uploadTime, upload_msg uploadMsg, @@ -510,7 +510,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and machine_name like concat('%', #{machineName}, '%') and upload_status = #{uploadStatus} group by workorder_code, product_code,product_name,machine_code,machine_name,shift_code - ,upload_status,unit,use_man + ,upload_status,unit ,upload_time,upload_msg ) mrw left join pro_order_workorder pow on mrw.workorderCode = pow.workorder_code @@ -581,45 +581,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" workorder_code, sum(quantity_feedback) quantity_feedback, sum(work_time) sac1, - use_man sac2, + sum(work_time*use_man) sac2, product_code, product_name from mes_report_work where upload_status != #{uploadStatus} and prod_type = #{prodType} and workorder_code = #{workorderCode} - group by workorder_code,product_code,product_name,use_man + group by workorder_code,product_code,product_name ) mrw left join pro_order_workorder ow on mrw.workorder_code = ow.workorder_code left join base_equipment equ on equ.equipment_code = ow.workorder_name - + + insert into mes_report_work @@ -896,4 +887,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + update mes_report_work_consume + set del_flag = '1' + where record_id = #{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 46048642..333d7f92 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 @@ -4,12 +4,14 @@ import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletResponse; +import com.alibaba.fastjson2.JSONObject; import com.op.common.core.exception.ServiceException; import com.op.plan.domain.ProOrder; import com.op.plan.domain.dto.SplitOrderDTO; import com.op.plan.service.IProWetMaterialPlanDetailService; import com.op.plan.service.IProWetMaterialPlanService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -40,8 +42,6 @@ import com.op.common.core.web.page.TableDataInfo; public class ProOrderWorkorderController extends BaseController { @Autowired private IProOrderWorkorderService proOrderWorkorderService; - @Autowired - private IProWetMaterialPlanDetailService proWetMaterialPlanDetailService; /** * 通过子工单code查询并返回所有级联工单 @@ -255,6 +255,10 @@ public class ProOrderWorkorderController extends BaseController { @Log(title = "下发生产工单", businessType = BusinessType.OTHER) @PostMapping("/downWorkorder/{workorderIds}") public AjaxResult downWorkorder(@PathVariable String[] workorderIds) { + List orderNotW0 = proOrderWorkorderService.getOrderNotW0(workorderIds); + if(workorderIds.length != orderNotW0.size()){ + return AjaxResult.error("存在已经派发的订单,请重新选择工单!"); + } return toAjax(proOrderWorkorderService.downProOrderWorkorderByWorkorderIds(workorderIds)); } } diff --git a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrder.java b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrder.java index f42c0aa7..665cfc57 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrder.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/domain/ProOrder.java @@ -152,6 +152,16 @@ public class ProOrder extends TreeEntity { private Integer sortNo; // 车数 private Integer carNum; + @Excel(name = "订单状态", readConverterExp = "0=正常,1=关闭") + private String delFlag; + + public String getDelFlag() { + return delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } public Integer getCarNum() { return carNum; 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 a42f2eff..057509dc 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 @@ -190,5 +190,7 @@ public interface ProOrderWorkorderMapper { int deletePrepareBatch(@Param("workorders")List workorders); int deletePrepareDetailBatch(@Param("workorders")List workorders); + + List getOrderNotW0(@Param("workorderCodes") String[] workorderCodes); } 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 92d77931..b547d098 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 @@ -131,4 +131,6 @@ public interface IProOrderWorkorderService { List getNextLevelWorkOrderList(ProOrderWorkorder proOrderWorkorder); AjaxResult subChangeWorkOrderPro(SplitOrderDTO splitOrderDTO); + + List getOrderNotW0(String[] workorderIds); } 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 04f47982..952a19eb 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 @@ -270,6 +270,7 @@ public class ProOrderServiceImpl implements IProOrderService { // 获取单位换算值 Long conver = 1L; String belongWorkOrder = "0"; + ProOrderDTO productNameInfo = splitOrderDTO.getProduct(); while (run) { // 先进行当前订单拆分操作 // 1.设置工单信息,并更新订单信息至数据库 @@ -297,10 +298,10 @@ public class ProOrderServiceImpl implements IProOrderService { R rSapChange = remoteSapService.shopUpdateSync(sapChange);//sap只能同步指定日期的数据 logger.info("母订单"+proOrder.getOrderCode()+ "订单数量变更结果:"+rSapChange.getCode()+","+rSapChange.getMsg()); - }else{ - workOrder.setProductCode(splitOrderDTO.getProduct().getChildren().get(0).getProdCode()); - workOrder.setProductName(splitOrderDTO.getProduct().getChildren().get(0).getProdDesc()); } + workOrder.setProductCode(productNameInfo.getProdCode()); + workOrder.setProductName(productNameInfo.getProdDesc()); + workOrder.setBelongWorkOrder(belongWorkOrder); workOrder.setProdType("LJ01"); @@ -321,6 +322,8 @@ public class ProOrderServiceImpl implements IProOrderService { parentOrder.append(workOrder.getWorkorderCode()); // code自增 endCode++; + + productNameInfo = productNameInfo.getChildren().get(0); } else { if(!"0".equals(workOrder.getParentOrder())) { // 设置子节点end_flag字段信息 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 91b58af0..522729da 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 @@ -1092,6 +1092,12 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { return error(500, "批次号不能重复"); } + @Override + @DS("#header.poolName") + public List getOrderNotW0(String[] workorderIds) { + return proOrderWorkorderMapper.getOrderNotW0(workorderIds); + } + /** * 校验工单是否可以修改 * 如果工单已生成湿料计划则不允许修改 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 9542f4f8..0612fdb9 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 @@ -30,13 +30,14 @@ + select id, plan_factory_code, order_type, order_code, prod_code, prod_desc, quantity, quantity_split, unit, worker_order, plan_pro_date, plan_complete, atrr1, atrr2, atrr3, status, parent_order, create_by, create_time, update_by, update_time, prod_type, - factory_code, prod_spc ,car_num + factory_code, prod_spc ,car_num,del_flag from pro_order @@ -67,7 +68,7 @@ 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 del_flag = #{delFlag} ORDER BY plan_pro_date DESC 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 37eb1ed2..948cf41d 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 @@ -523,6 +523,17 @@ and pow.del_flag = '0' + insert into mes_prepare_detail From 40c14a4a366dadd1ba5a955ebe6ad69deb29a58e Mon Sep 17 00:00:00 2001 From: zhaoxiaolin Date: Tue, 19 Mar 2024 09:23:09 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=89=B9=E6=AC=A1?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ProOrderServiceImpl.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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 952a19eb..9626a0fa 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 @@ -100,15 +100,15 @@ public class ProOrderServiceImpl implements IProOrderService { @Transactional(rollbackFor = Exception.class) public AjaxResult subSplitOrder(SplitOrderDTO splitOrderDTO) { boolean checkout = true; - // 校验批次编号是否存在(重复问题) - List batchCodes = proOrderMapper.selectBatchCodes(); - for (int i = 0; i < batchCodes.size(); i++) { - for (int j = 0; j < splitOrderDTO.getFormFields().size(); j++) { - if (batchCodes.get(i).equals(splitOrderDTO.getFormFields().get(j).getBatchCode())) { - checkout = false; - } - } - } +// // 校验批次编号是否存在(重复问题) +// List batchCodes = proOrderMapper.selectBatchCodes();//这种校验不可取需要修改 +// for (int i = 0; i < batchCodes.size(); i++) { +// for (int j = 0; j < splitOrderDTO.getFormFields().size(); j++) { +// if (batchCodes.get(i).equals(splitOrderDTO.getFormFields().get(j).getBatchCode())) { +// checkout = false; +// } +// } +// } //校验各工序设备是否已选择 List processes= proOrderMapper.getRouteProcess(splitOrderDTO.getRouteCode()); if(splitOrderDTO.getProdLineCodeArray().length == 0){ @@ -134,7 +134,7 @@ public class ProOrderServiceImpl implements IProOrderService { splitOrderDTO.setProdLineCode(codeArray); } - // 如果不重复 + // 如果校验通过 if (checkout) { /****白坯订单*****/