From 8290916c8dab145b70ae3ffcdb1f5ab117ee949f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=B8=85?= <3115919733@qq.com> Date: Mon, 26 May 2025 09:33:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AC=E5=B7=A5=E5=8D=95=E5=87=BA=E5=BA=93?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=86=B2=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cim/idm/service/Impl/MESToWMSServiceImpl.java | 15 +++++++++++++-- .../java/com/cim/idm/service/MESToWMSService.java | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/MESToWMSServiceImpl.java b/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/MESToWMSServiceImpl.java index 1448e87..17498ba 100644 --- a/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/MESToWMSServiceImpl.java +++ b/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/MESToWMSServiceImpl.java @@ -53,6 +53,8 @@ public class MESToWMSServiceImpl implements MESToWMSService { @Autowired private MesToWmsDao mesToWmsDao; + @Autowired + private InvoiceServiceImpl invoiceService; @Override @Transactional @@ -666,7 +668,7 @@ public class MESToWMSServiceImpl implements MESToWMSService { */ @Override @Transactional - public AjaxResult workOrder_Request(JSONArray in) { + public AjaxResult workOrder_Request(JSONArray in) throws Exception { //转工单,按照批次先传MDC消耗请求SAP出库,再生成入库信息传SAP入库 log.info("Received work order request: {}", in.toJSONString()); //转换前工单formOrder,转换后工单toOrder,料号 materialSpecname,批次 charge @@ -707,7 +709,7 @@ public class MESToWMSServiceImpl implements MESToWMSService { * 出库方法 */ @Transactional - public String materialOutByMES(List materialSpecnameList, List chargeList) { + public String materialOutByMES(List materialSpecnameList, List chargeList) throws Exception { String result = ""; //调用Mybatis方法查询当前可出库存 List materialPackingList = mesToWmsDao.getMaterialPackingList(materialSpecnameList, chargeList); @@ -716,6 +718,15 @@ public class MESToWMSServiceImpl implements MESToWMSService { materialPackingList, "MES" ); + if (undoid != null) { + // 冲销 + String undo = invoiceService.cancelShipInter(undoid, "MES"); + if (undo == null || undo.isEmpty()) { + throw new GlobalException("下发mes失败后冲销失败!"); + } else { + throw new GlobalException("发送到mes失败!"); + } + } //更新MDC表状态 mesToWmsDao.updateMDCFlag(materialSpecnameList, chargeList, "T"); return undoid; diff --git a/zi-wms-pda/src/main/java/com/cim/idm/service/MESToWMSService.java b/zi-wms-pda/src/main/java/com/cim/idm/service/MESToWMSService.java index bbd030a..fbccc71 100644 --- a/zi-wms-pda/src/main/java/com/cim/idm/service/MESToWMSService.java +++ b/zi-wms-pda/src/main/java/com/cim/idm/service/MESToWMSService.java @@ -40,7 +40,7 @@ public interface MESToWMSService { * @param in * @return */ - AjaxResult workOrder_Request(JSONArray in); + AjaxResult workOrder_Request(JSONArray in) throws Exception; @Transactional AjaxResult materialConsumeRequestSapcprkUndo(String undoId, String user, String payMentDate) throws Exception;