From 136d0b16a487c3b72199f9b96ae1e788a35219e3 Mon Sep 17 00:00:00 2001 From: 18110972313 <780768673@qq.com> Date: Fri, 16 May 2025 17:57:34 +0800 Subject: [PATCH] =?UTF-8?q?update=20MES=E7=89=A9=E6=96=99=E6=B6=88?= =?UTF-8?q?=E8=80=97=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=BF=AE=E6=94=B9SAP?= =?UTF-8?q?=E8=BF=87=E8=B4=A6=E6=97=A5=E6=9C=9F=E6=8A=A5=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../idm/service/impl/ToSAPServiceImpl.java | 2 +- .../idm/service/Impl/InvoiceServiceImpl.java | 107 +++++++++++++++++- 2 files changed, 107 insertions(+), 2 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 41561ce..0638c14 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 @@ -2609,7 +2609,7 @@ public class ToSAPServiceImpl { //过账日期 body.put("BUDAT", budatData); //凭证日期 - body.put("BLDAT", TimeStampUtil.getCurrentTime("yyyyMMdd")); + body.put("BLDAT", budatData); //凭证抬头文本 body.put("BKTXT", uniqueID); //用户名 diff --git a/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/InvoiceServiceImpl.java b/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/InvoiceServiceImpl.java index 2ccc440..4b1e2af 100644 --- a/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/InvoiceServiceImpl.java +++ b/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/InvoiceServiceImpl.java @@ -15,9 +15,11 @@ import com.cim.idm.mwmsextend.materialpacking.service.MaterialPackingServiceUtil import com.cim.idm.mwmsextend.materialshiprequest.service.MaterialShipRequestServiceImpl; import com.cim.idm.service.ChargeSplitService; import com.cim.idm.service.InvoiceService; +import com.cim.idm.service.QMSService; import com.cim.idm.service.impl.MESServiceImpl; import com.cim.idm.service.impl.ToSAPServiceImpl; import com.cim.idm.util.MessageLogUtil; +import com.cim.idm.util.NCHttpUtil; import com.cim.idm.util.ToSAPMessageUtil; import com.cim.idm.utils.AjaxResult; import com.cim.idm.utils.CodeGenerator; @@ -39,7 +41,9 @@ import com.cim.idm.wmspackage.materialreceivetactdetail.management.data.Material import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; import groovy.lang.Lazy; +import io.micrometer.core.instrument.util.StringUtils; import org.apache.commons.collections4.MapUtils; +import org.quartz.SimpleTrigger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -58,7 +62,8 @@ public class InvoiceServiceImpl implements InvoiceService { @Autowired private ToSAPServiceImpl toSAPService; - + @Autowired + private QMSService qmsService; @Autowired @Lazy private ChargeSplitService chargeSplitService; @@ -3433,6 +3438,11 @@ public class InvoiceServiceImpl implements InvoiceService { // billCode=toSAPService.saleStockOut_NEW(shipRequestName, "SDK", eventUser,materialPackingKeyList); billCode=saleStockOut_NEW(shipRequestName, "SDK", eventUser,materialPackingKeyList,commitDate); untils.SaveUnDoInfo_ForSap(materialPackingKeyList, billCode, makeEventInfo); + //单据类型等于ZLF0-ZLF9,物料编码以7开头都属于成品胶水需要调用QMS质检接口 + String message = checkShipRequestTypeSendIQC(commitDate, siteName ,shipRequestName, makeEventInfo, materialPackingKeyList); + if (StringUtils.isNotEmpty(message)) { + throw new CustomException(message); + } break; case "08": // 委外 case "OEM": // 委外 @@ -3568,4 +3578,99 @@ public class InvoiceServiceImpl implements InvoiceService { String sendData = MainData.toJSONString(); return sendData; } + + public String checkShipRequestTypeSendIQC(String shippingDate,String siteName, String shipRequestName, EventInfo eventInfo, List materialPackingNameList) throws Exception { + String message = ""; + JSONArray jsonArray = new JSONArray(); + Map jsonObjectMap = new HashMap<>(); + String sql=" SELECT \n" + + "MP.SITENAME,\n" + + "MP.SHIPREQUESTNAME,\n" + + "MP.MATERIALSPECNAME,\n" + + "MP.MATERIALPACKINGNAME,\n" + + "MP.REMARK,\n" + + "MP.CHARGE,\n" + + "MP.SDKTRUEID,\n" + + "MS.DESC_CN\n" + + "FROM\n" + + "MATERIALPACKING MP \n" + + "LEFT JOIN MATERIALSPEC MS ON MP.SITENAME = MS.SITENAME AND MP.MATERIALSPECNAME = MS.MATERIALSPECNAME\n" + + "WHERE\n" + + "MP.SITENAME =:SITENAME\n" + + "AND MP.SHIPREQUESTNAME =:SHIPREQUESTNAME\n" + + "AND MP.MATERIALPACKINGNAME IN (:BOXLIST)\n" + + "AND MP.MATERIALSPECNAME LIKE '7%' "; + + Map hashMap = new HashMap(); + hashMap.put("SHIPREQUESTNAME", shipRequestName); + hashMap.put("SITENAME", siteName); + hashMap.put("BOXLIST", materialPackingNameList); + List> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql.toString(), hashMap); + if (!queryForList.isEmpty()){ + + for (int i = 0; i < queryForList.size(); i++) { + String source = "wms"; + String deliveryNumber = queryForList.get(i).get("SHIPREQUESTNAME") == null ? "" : queryForList.get(i).get("SHIPREQUESTNAME").toString(); + String materialCode = queryForList.get(i).get("MATERIALSPECNAME") == null ? "" : queryForList.get(i).get("MATERIALSPECNAME").toString(); + String materialName = queryForList.get(i).get("DESC_CN") == null ? "" : queryForList.get(i).get("DESC_CN").toString(); + String specification = queryForList.get(i).get("SDKTRUEID") == null ? "" : queryForList.get(i).get("SDKTRUEID").toString(); + String materialPackingName = queryForList.get(i).get("MATERIALPACKINGNAME") == null ? "" : queryForList.get(i).get("MATERIALPACKINGNAME").toString(); + if (jsonObjectMap.containsKey(materialName)){ + JSONObject jsonObject = jsonObjectMap.get(materialName); + String shipmentBatch = jsonObject.getString("shipmentBatch"); + jsonObject.put("shipmentBatch",shipmentBatch + "," + materialPackingName); + }else { + JSONObject jsonObject = new JSONObject(true); + //必传字段 + jsonObject.put("source", source); + //出货日期,取页面上的过账日期 + jsonObject.put("shippingDate", shippingDate); +// 发货单号 + jsonObject.put("deliveryNumber", deliveryNumber); +// 料号 + jsonObject.put("materialCode", materialCode); +// 发货品名 + jsonObject.put("materialName", materialName); +// 规格 + jsonObject.put("specification", specification); + //发货批次号 + jsonObject.put("shipmentBatch", materialPackingName); + jsonObjectMap.put(materialName, jsonObject); + //非必传字段 + /** + * String inspectionNumber = queryForList.get(i).get("SHIPREQUESTNAME") == null ? "" : queryForList.get(i).get("SHIPREQUESTNAME").toString(); + * String quantity = queryForList.get(i).get("MATERIALQUANTITY") == null ? "" : queryForList.get(i).get("MATERIALQUANTITY").toString(); + * String inspectBatch = queryForList.get(i).get("CHARGE") == null ? "" : queryForList.get(i).get("CHARGE").toString(); + * String samplingQuantity = queryForList.get(i).get("") == null ? "" : queryForList.get(i).get("").toString(); + * String samplingSpecification = queryForList.get(i).get("") == null ? "" : queryForList.get(i).get("").toString(); + * String remark = queryForList.get(i).get("REMARK") == null ? "" : queryForList.get(i).get("REMARK").toString(); + * String materialGroup = queryForList.get(i).get("MATERIALPROCESSGROUPNAME") == null ? "" : queryForList.get(i).get("MATERIALPROCESSGROUPNAME").toString(); + // 发货数量 + jsonObject.put("quantity", quantity); + // 客户名称 + jsonObject.put("customName", customName); + // 客户代码 + jsonObject.put("customCode", customCode); + // 检验单号 + jsonObject.put("inspectionNumber", inspectionNumber); + //检验批号 + jsonObject.put("inspectBatch", inspectBatch); + + // 抽检数量 + jsonObject.put("samplingQuantity", samplingQuantity); + // 抽检规格 + jsonObject.put("samplingSpecification", samplingSpecification); + // 备注 + jsonObject.put("remark", remark); + // 物料组 + jsonObject.put("materialGroup", materialGroup); + */ + } + } + jsonArray.addAll(jsonObjectMap.values()); + String jsonArrayJSONString = jsonArray.toJSONString(); + message = qmsService.sendQMSByUrlJson(jsonArrayJSONString, "/opc/addShipmentInspection",eventInfo); + } + return message; + } }