From 23d125763d15eede2d645413fe85ad756853b72f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E9=A3=9E?= Date: Fri, 23 May 2025 16:59:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=B7=BB=E5=8A=A0=E8=B4=A8=E6=A3=80?= =?UTF-8?q?=E5=86=B2=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../idm/service/impl/ToSAPServiceImpl.java | 2 +- .../controller/MaterialUndoController.java | 37 +++++--- .../com/cim/idm/controller/QMSController.java | 16 +++- .../com/cim/idm/model/MaterialUndoDto.java | 8 ++ .../service/Impl/MaterialUndoServiceImpl.java | 87 +++++++++++++++---- .../Impl/NoInvoiceManagerServiceImpl.java | 1 + 6 files changed, 120 insertions(+), 31 deletions(-) diff --git a/zi-wms-inf/src/main/java/com/cim/idm/service/impl/ToSAPServiceImpl.java b/zi-wms-inf/src/main/java/com/cim/idm/service/impl/ToSAPServiceImpl.java index 728cf45..052aec3 100644 --- a/zi-wms-inf/src/main/java/com/cim/idm/service/impl/ToSAPServiceImpl.java +++ b/zi-wms-inf/src/main/java/com/cim/idm/service/impl/ToSAPServiceImpl.java @@ -5744,7 +5744,7 @@ public class ToSAPServiceImpl { ErpMessageLog erplog = new ErpMessageLog(); erplog.setEventUser(""); erplog.setServerName("WmsToErp"); - erplog.setEventName("iqcResultFeekback"); + erplog.setEventName("pqcSyncdata2-QMS质检结果"); erplog.setInterfaceTime(TimeStampUtil.getCurrentTime(TimeStampUtil.FORMAT_DEFAULT)); erplog.setMessageId(UUID.randomUUID().toString()); erplog.setSendMsg(sendData); diff --git a/zi-wms-pda/src/main/java/com/cim/idm/controller/MaterialUndoController.java b/zi-wms-pda/src/main/java/com/cim/idm/controller/MaterialUndoController.java index 5799526..f9e524e 100644 --- a/zi-wms-pda/src/main/java/com/cim/idm/controller/MaterialUndoController.java +++ b/zi-wms-pda/src/main/java/com/cim/idm/controller/MaterialUndoController.java @@ -41,17 +41,22 @@ public class MaterialUndoController { String undoId = undoDto.getUndoId(); String userId = undoDto.getUserId(); String flag = undoDto.getFlag(); - String inv_TYPE = undoDto.getINV_TYPE(); + String inv_TYPE = undoDto.getINV_TYPE() == null ? "" : undoDto.getINV_TYPE(); String lastEventName = undoDto.getLastEventName(); String commitDate = undoDto.getCommitDate(); + String preErpLocation = undoDto.getPreErpLocation(); + String preLocationName = undoDto.getPreLocationName(); + String locationName = undoDto.getErpLocation(); + String erpLocation = undoDto.getLocationName(); + //根据物料凭证校验物料状态是否一致 - try { - Boolean checkUndoCondition = untils.CheckUndoCondition(undoId); - } catch (Exception e) { - e.printStackTrace(); - return AjaxResult.me().setSuccess(false).setMessage(e.toString()); - } +// try { +// Boolean checkUndoCondition = untils.CheckUndoCondition(undoId); +// } catch (Exception e) { +// e.printStackTrace(); +// return AjaxResult.me().setSuccess(false).setMessage(e.toString()); +// } //校验单据类型,根据单据类型判断逻辑 // switch (inv_TYPE) { // case "45": @@ -71,20 +76,28 @@ public class MaterialUndoController { // return AjaxResult.me().setSuccess(false).setMessage("单据类型不支持冲销"); // } - if ("Z001".equals(inv_TYPE) || "Z005".equals(inv_TYPE) || "Z006".equals(inv_TYPE) || "Z007".equals(inv_TYPE)) { + if ("Z002".equals(inv_TYPE) || "Z003".equals(inv_TYPE) || "Z004".equals(inv_TYPE) || "Z001".equals(inv_TYPE) || "Z005".equals(inv_TYPE) || "Z006".equals(inv_TYPE) || "Z007".equals(inv_TYPE)) { // materialUndoServiceImpl.rkUndo(undoId, userId); // 入库 materialUndoServiceImpl.cgrkUndo(undoId, userId); // 采购入库 - } else if ("Z002".equals(inv_TYPE) || "Z003".equals(inv_TYPE) || "Z004".equals(inv_TYPE)) { - materialUndoServiceImpl.cprkUndo(undoId, userId);// 成品入库 - } else if (inv_TYPE.contains("ZLF") || "Z008".equals(inv_TYPE)) { // 出库冲销 + } +// else if ("Z002".equals(inv_TYPE) || "Z003".equals(inv_TYPE) || "Z004".equals(inv_TYPE)) { +// materialUndoServiceImpl.cprkUndo(undoId, userId);// 成品入库 +// } + else if ("Z008".equals(inv_TYPE)) { // 出库冲销 materialUndoServiceImpl.ckUndo(undoId, userId); } else if (inv_TYPE.contains("ZLR")) { materialUndoServiceImpl.ckUndo(undoId, userId); }else if(inv_TYPE.contains("ZK")) { // 转库 materialUndoServiceImpl.zkUndo(undoId, userId); + }else if(lastEventName.contains("自动转库")) { // 自动转库 + materialUndoServiceImpl.zdZkUndo(undoId, userId,preErpLocation,preLocationName); + }else if(lastEventName.contains("质检结果")) { // 质检结果 + materialUndoServiceImpl.zjJgUndo(undoId, userId); }else if(inv_TYPE.contains("NLCC") && lastEventName.contains("调拨出库")) { // 调拨出库 materialUndoServiceImpl.orderUndo(undoId, userId,commitDate); - }else { + } else if (inv_TYPE.contains("ZLF")) { // 销售发货出库 + materialUndoServiceImpl.orderUndo(undoId, userId,commitDate); + } else { return AjaxResult.me().setSuccess(false).setMessage("单据类型不支持冲销"); } diff --git a/zi-wms-pda/src/main/java/com/cim/idm/controller/QMSController.java b/zi-wms-pda/src/main/java/com/cim/idm/controller/QMSController.java index 78a9610..0397f2c 100644 --- a/zi-wms-pda/src/main/java/com/cim/idm/controller/QMSController.java +++ b/zi-wms-pda/src/main/java/com/cim/idm/controller/QMSController.java @@ -284,7 +284,7 @@ public class QMSController { SetEventInfo setEventInfo = new SetEventInfo(); SetEventInfo setEventInfo2 = new SetEventInfo(); - EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("iqcSyncdata", "", "iqcSyncdata"); + EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("QMS质检结果", "QMS", "pqcSyncdata2-QMS质检结果"); EventInfo eventInfo = new EventInfo(); eventInfo.setEventName("iqcSyncdata"); eventInfo.setEventUser("pQC"); @@ -314,7 +314,7 @@ public class QMSController { String pqcResult = jb.get("judgementResult").toString();//检验结果 String pqcResultDate = jb.get("resultTime").toString();//检验时间 String user = jb.get("inspector").toString();//检验员 - makeEventInfo = new EventInfoUtil().makeEventInfo("iqcSyncdata", user, "iqcSyncdata"); +// makeEventInfo = new EventInfoUtil().makeEventInfo("iqcSyncdata", user, "iqcSyncdata"); String exceptionHandling = jb.get("exceptionHandling") == null ? "" : jb.get("exceptionHandling").toString();//异常处理 (0复卷,1降级,2报废) String specialState = jb.get("specialState") == null ? "" : jb.get("specialState").toString();//特殊状态 (0特采、1紧急放行、2退供应商) String transferStatus = jb.get("transferStatus") == null ? "" : jb.get("transferStatus").toString();//异常处理 @@ -354,6 +354,7 @@ public class QMSController { //eventInfo.setEventTime(Timestamp.valueOf(pqcResultDate)); eventInfo.setEventUser(user); List sapBoxList = new ArrayList<> (); + if ("0".equals(tpType)) {//采购到货单, 领料退库,产成品入库 // 获取JSON数组 @@ -418,6 +419,10 @@ public class QMSController { if(sapBoxList.size() > 0) { String undoId = toSAPService.iqcResultFeekback(sapBoxList,siteName,commonNumber,materialCode,pqcResult,pqcResultDate,user, exceptionHandling,specialState); + if (undoId == null || "".equals(undoId)) { + throw new CustomException("SAP过账失败!"); + } + untils.SaveUnDoInfo_ForSap(sapBoxList, undoId, makeEventInfo); } if(mpList.size()>0) @@ -517,6 +522,11 @@ public class QMSController { if(sapBoxList.size() > 0) { String undoId = toSAPService.iqcResultFeekback(sapBoxList,siteName,commonNumber,materialCode,pqcResult,pqcResultDate,user, exceptionHandling,specialState); + + if (undoId == null || "".equals(undoId)) { + throw new CustomException("SAP过账失败!"); + } + untils.SaveUnDoInfo_ForSap(sapBoxList, undoId, makeEventInfo); } if(mpList.size()>0) @@ -992,7 +1002,7 @@ public class QMSController { // billCode = NCWServiceImpl.OQZkNoInvoice(LocationBoxList, sendUser); if (billCode == null || "".equals(billCode)) { - throw new CustomException("ERP过账失败!"); + throw new CustomException("SAP过账失败!"); } EventInfoUtil eventInfoUtil = new EventInfoUtil(); diff --git a/zi-wms-pda/src/main/java/com/cim/idm/model/MaterialUndoDto.java b/zi-wms-pda/src/main/java/com/cim/idm/model/MaterialUndoDto.java index 92e9781..098f964 100644 --- a/zi-wms-pda/src/main/java/com/cim/idm/model/MaterialUndoDto.java +++ b/zi-wms-pda/src/main/java/com/cim/idm/model/MaterialUndoDto.java @@ -16,4 +16,12 @@ public class MaterialUndoDto { private String lastEventName; private String commitDate; + + private String preErpLocation; + + private String preLocationName; + + private String locationName; + + private String erpLocation; } diff --git a/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/MaterialUndoServiceImpl.java b/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/MaterialUndoServiceImpl.java index aa13ed3..39acda8 100644 --- a/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/MaterialUndoServiceImpl.java +++ b/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/MaterialUndoServiceImpl.java @@ -74,29 +74,34 @@ public class MaterialUndoServiceImpl implements IMaterialUndoService { @Transactional public void cgrkUndo (String undoId, String user) throws Exception { - String billCode = toSAPService.cancelShipInter(undoId, user); - if (billCode == null) { - throw new GlobalException("报送ERP失败,请联系IT处理!"); - } +// String billCode = toSAPService.cancelShipInter(undoId, user); +// if (billCode == null) { +// throw new GlobalException("报送ERP失败,请联系IT处理!"); +// } - EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("MakeUndo", user, "MakeUndo"); + EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("采购入库冲销", user, "采购入库冲销"); String condition="WHERE UNDOID =? "; String[] bindSet={undoId}; //根据物料凭证找到所有的待冲销数据,更新库存状态为创建 + + // 直接删除生成的标签 List list = MaterialPackingServiceProxy.getMaterialPackingService().select(condition, bindSet); - Map hashMap = new HashMap (); - hashMap.put("stockState", "Created"); - SetEventInfo setEventInfo = new SetEventInfo(); - setEventInfo.setUserColumns(hashMap); - for (MaterialPacking materialPacking : list) { + if(list.size() > 0) { + for (MaterialPacking materialPacking : list) { MaterialPackingKey key = materialPacking.getKey(); - MaterialPackingServiceProxy.getMaterialPackingService().setEvent(key, makeEventInfo, setEventInfo); +// MaterialPackingServiceProxy.getMaterialPackingService().setEvent(key, makeEventInfo, setEventInfo); + + String delSql = "DELETE FROM MATERIALPACKING WHERE MATERIALPACKINGNAME = :MATERIALPACKINGNAME"; + String MATERIALPACKINGNAME = materialPacking.getMaterialPackingName(); + Map hashMap = new HashMap (); + hashMap.put("MATERIALPACKINGNAME", MATERIALPACKINGNAME); +// SetEventInfo setEventInfo = new SetEventInfo(); +// setEventInfo.setUserColumns(hashMap); + IDMFrameServiceProxy.getSqlTemplate().update(delSql, hashMap); + + } } -// String sql = "UPDATE BS_MATERIALPACKINGUNDOINFO b SET b.FLAG = 'Y' WHERE b.UNDOID = :UNDOID"; -// Map hashMap2 = new HashMap (); -// hashMap2.put("UNDOID", undoId); -// IDMFrameServiceProxy.getSqlTemplate().update(sql, hashMap2); // 更新凭证冲销状态 MaterialReversalDao.updateReversalUnDoId(undoId); } @@ -298,6 +303,58 @@ public class MaterialUndoServiceImpl implements IMaterialUndoService { MaterialReversalDao.updateReversalUnDoId(undoId); } + /** + * 自动转库 + * @param undoId + * @param user + */ + @Transactional + public void zdZkUndo (String undoId, String user,String preErpLocation,String preLocationName) throws Exception { + + String billCode = toSAPService.cancelShipInter(undoId, user); + if (billCode == null) { + throw new GlobalException("报送ERP失败,请联系IT处理!"); + } + + EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("冲销自动转库", user, "冲销自动转库"); + String condition="WHERE UNDOID =? "; + String[] bindSet={undoId}; + //根据物料凭证找到所有的待冲销数据,更新库存状态为创建 + List list = MaterialPackingServiceProxy.getMaterialPackingService().select(condition, bindSet); + + for (MaterialPacking materialPacking : list) { + Map hashMap = new HashMap (); + hashMap.put("erpLocation", preErpLocation); + hashMap.put("locationName", preLocationName); +// hashMap.put("preErpLocation", materialPacking.getErpLocation()); +// hashMap.put("preLocationName", materialPacking.getLocationName()); + SetEventInfo setEventInfo = new SetEventInfo(); + setEventInfo.setUserColumns(hashMap); + MaterialPackingKey key = materialPacking.getKey(); + MaterialPackingServiceProxy.getMaterialPackingService().setEvent(key, makeEventInfo, setEventInfo); + } + + // 更新凭证冲销状态 + MaterialReversalDao.updateReversalUnDoId(undoId); + } + + /** + * 质检结果 + * @param undoId + * @param user + */ + @Transactional + public void zjJgUndo (String undoId, String user) throws Exception { + + String billCode = toSAPService.cancelShipInter(undoId, user); + if (billCode == null) { + throw new GlobalException("SAP质检结果冲销失败!"); + } + + // 更新凭证冲销状态 + MaterialReversalDao.updateReversalUnDoId(undoId); + } + @Transactional public void orderUndo (String undoId, String user, String commitDate) throws Exception { diff --git a/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/NoInvoiceManagerServiceImpl.java b/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/NoInvoiceManagerServiceImpl.java index f5cff0e..ec53b29 100644 --- a/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/NoInvoiceManagerServiceImpl.java +++ b/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/NoInvoiceManagerServiceImpl.java @@ -54,6 +54,7 @@ public class NoInvoiceManagerServiceImpl { } String undoid = ""; // undoid = NCWServiceImpl.qtrNoInvoice(list,user,commitDate,opCode); + SDKMaterialPackingServiceImpl.updateUndoIdByList(list, undoid, makeEventInfo,opCode); //更新库存状态 SDKMaterialPackingServiceImpl.SaveUnDoInfo( undoid,commitDate);