From e53a7fa44eb05b2c195afd78fedc59bba6b09790 Mon Sep 17 00:00:00 2001 From: mzr Date: Fri, 8 Aug 2025 18:18:01 +0800 Subject: [PATCH 1/6] =?UTF-8?q?refactor(uapbd):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=9D=90=E6=96=99=E4=B8=8B=E8=BD=BD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 MaterialPlmDownloadAction 中添加日志记录,便于调试和监控 - 更新 GetPlmFileUtil 类中的文件下载逻辑,提高代码可读性和性能 - 修复 zip压缩包创建过程中的潜在资源泄漏问题 --- .../action/MaterialPlmDownloadAction.java | 7 +++- .../nc/bs/uapbd/util/GetPlmFileUtil.java | 37 +++---------------- 2 files changed, 12 insertions(+), 32 deletions(-) diff --git a/uapbd/src/client/nccloud/web/uapbd/material/action/MaterialPlmDownloadAction.java b/uapbd/src/client/nccloud/web/uapbd/material/action/MaterialPlmDownloadAction.java index fe6559d..a6f1010 100644 --- a/uapbd/src/client/nccloud/web/uapbd/material/action/MaterialPlmDownloadAction.java +++ b/uapbd/src/client/nccloud/web/uapbd/material/action/MaterialPlmDownloadAction.java @@ -1,10 +1,13 @@ package nccloud.web.uapbd.material.action; +import nc.bs.logging.Logger; import nc.bs.uapbd.util.GetPlmFileUtil; +import nccloud.baseapp.core.log.NCCForUAPLogger; import nccloud.framework.core.io.WebFile; import nccloud.framework.web.action.itf.ICommonAction; import nccloud.framework.web.container.IRequest; +import java.util.Arrays; import java.util.Map; /** @@ -21,11 +24,13 @@ public class MaterialPlmDownloadAction implements ICommonAction { try { Map params_1 = request.readParameters(); String[] pks = params_1.get("materialCode"); // ȡ pk - String materialCode = "101092250323,101092250323"; + NCCForUAPLogger.debug("ȡ pk:" + Arrays.toString(pks)); + String materialCode = "101092250323,101092250321,101092250322"; String[] materialCodeArr = materialCode.split(",", -1); GetPlmFileUtil fileUtil = new GetPlmFileUtil(); files = fileUtil.getPlmFiles(materialCodeArr); } catch (Exception e) { + Logger.error("MaterialPlmDownloadAction-exp:" + e.getMessage()); throw new RuntimeException(e); } return files; diff --git a/uapbd/src/public/nc/bs/uapbd/util/GetPlmFileUtil.java b/uapbd/src/public/nc/bs/uapbd/util/GetPlmFileUtil.java index 98d520d..7800d14 100644 --- a/uapbd/src/public/nc/bs/uapbd/util/GetPlmFileUtil.java +++ b/uapbd/src/public/nc/bs/uapbd/util/GetPlmFileUtil.java @@ -88,8 +88,8 @@ public class GetPlmFileUtil { String objId = plmFileJson.getString("objId"); String fname = plmFileJson.getString("fname"); - byte[] pdfBytes = this.doDownloadPlmFile(objId); - InputStream ins = new ByteArrayInputStream(pdfBytes); + byte[] fileBytes = this.doDownloadPlmFile(objId); + InputStream ins = new ByteArrayInputStream(fileBytes); file = new WebFile(fname, ins); } else { @@ -98,29 +98,14 @@ public class GetPlmFileUtil { ByteArrayOutputStream zipOut = new ByteArrayOutputStream(); ZipOutputStream zipStream = new ZipOutputStream(zipOut); try { -// int i=0; for (String materialCode : materialCodeArr) { JSONObject plmFileJson = this.getPlmFile(materialCode); String objId = plmFileJson.getString("objId"); String fname = plmFileJson.getString("fname"); - byte[] pdfBytes =this.doDownloadPlmFile(objId); - InputStream ins = new ByteArrayInputStream(pdfBytes); -// InputStream ins = this.doDownloadPlmFile(objId); - try { - byte[] bytes = parseFileStream(ins); - zipStream.putNextEntry(new ZipEntry(fname+"")); -// i++; - zipStream.write(bytes); - zipStream.closeEntry(); - } finally { - if (ins != null) { - try { - ins.close(); - } catch (IOException e) { - logger.error("Failed to close input stream: " + e.getMessage()); - } - } - } + byte[] fileBytes = this.doDownloadPlmFile(objId); + zipStream.putNextEntry(new ZipEntry(fname)); + zipStream.write(fileBytes); + zipStream.closeEntry(); } zipStream.finish(); } finally { @@ -289,16 +274,6 @@ public class GetPlmFileUtil { byte[] responseString = httpClient.execute(get, response -> EntityUtils.toByteArray(response.getEntity())); get.releaseConnection(); return responseString; -// // ִ󲢷ļ -// return httpClient.execute(httpGet, response -> { -// // Ӧ״̬ -// int statusCode = response.getStatusLine().getStatusCode(); -// if (statusCode >= 200 && statusCode < 300) { -// return response.getEntity().getContent(); -// } else { -// throw new IOException("HTTP request failed with status code: " + statusCode); -// } -// }); } /** From 2b301aa939705568be1140c712970ec43f8c7a3c Mon Sep 17 00:00:00 2001 From: mzr Date: Fri, 8 Aug 2025 18:37:43 +0800 Subject: [PATCH 2/6] =?UTF-8?q?MyHelper=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uapbd/src/public/nc/bs/uapbd/util/MyHelper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/uapbd/src/public/nc/bs/uapbd/util/MyHelper.java b/uapbd/src/public/nc/bs/uapbd/util/MyHelper.java index 163aaa9..3889bb8 100644 --- a/uapbd/src/public/nc/bs/uapbd/util/MyHelper.java +++ b/uapbd/src/public/nc/bs/uapbd/util/MyHelper.java @@ -39,9 +39,10 @@ public class MyHelper { sqlBuilder.append(pkField, pk); Object o = dao.executeQuery(sqlBuilder.toString(), new ColumnProcessor()); if (o == null) { - throw new BusinessException("δѯϢsql" + sqlBuilder + ""); + Logger.info("δѯϢsql" + sqlBuilder + ""); + // throw new BusinessException("δѯϢsql" + sqlBuilder + ""); } - return o.toString(); + return String.valueOf(o); } /** From a6f637ba97475d7e57f6b044e204dcbed8cff62f Mon Sep 17 00:00:00 2001 From: mzr Date: Sat, 9 Aug 2025 18:11:09 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=89=A9=E6=96=99PLM?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../action/MaterialPlmDownloadAction.java | 291 +++++++++++++++++- .../nc/bs/uapbd/util/GetPlmFileUtil.java | 26 +- 2 files changed, 287 insertions(+), 30 deletions(-) diff --git a/uapbd/src/client/nccloud/web/uapbd/material/action/MaterialPlmDownloadAction.java b/uapbd/src/client/nccloud/web/uapbd/material/action/MaterialPlmDownloadAction.java index a6f1010..f899206 100644 --- a/uapbd/src/client/nccloud/web/uapbd/material/action/MaterialPlmDownloadAction.java +++ b/uapbd/src/client/nccloud/web/uapbd/material/action/MaterialPlmDownloadAction.java @@ -1,14 +1,37 @@ package nccloud.web.uapbd.material.action; -import nc.bs.logging.Logger; -import nc.bs.uapbd.util.GetPlmFileUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import nc.bs.dao.DAOException; +import nc.bs.logging.Log; +import nc.bs.trade.business.HYSuperDMO; +import nc.vo.bd.defdoc.DefdocVO; +import nc.vo.cmp.util.StringUtils; +import nc.vo.pub.BusinessException; import nccloud.baseapp.core.log.NCCForUAPLogger; +import nccloud.framework.core.exception.ExceptionUtils; import nccloud.framework.core.io.WebFile; import nccloud.framework.web.action.itf.ICommonAction; import nccloud.framework.web.container.IRequest; +import org.apache.http.client.config.CookieSpecs; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.util.EntityUtils; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.text.SimpleDateFormat; import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; /** * ȡPLMļ @@ -17,22 +40,270 @@ import java.util.Map; * @date 2025/8/4 */ public class MaterialPlmDownloadAction implements ICommonAction { + private static final String LOG_INFO_NAME = "dldzlog"; + private static final Log logger = Log.getInstance(LOG_INFO_NAME); + private String plmBaseUrl = ""; + private String plmUser = ""; + private String token = ""; + private static final String tokenUrl = "/sipmweb/api/oauth"; + // ϱȡ㲿ID + private String materialIdUrl = "/sipmweb/api/{rid}/search/{t}"; + // 㲿IDȡάͼIDϢ + private String materialFileIdUrl = "/sipmweb/api/{rid}/relation/{t}/{id}/data"; + // ļ + private String downlownUrl = "/sipmweb/web/download"; @Override public Object doAction(IRequest request) { WebFile files = null; try { Map params_1 = request.readParameters(); - String[] pks = params_1.get("materialCode"); // ȡ pk - NCCForUAPLogger.debug("ȡ pk:" + Arrays.toString(pks)); - String materialCode = "101092250323,101092250321,101092250322"; - String[] materialCodeArr = materialCode.split(",", -1); - GetPlmFileUtil fileUtil = new GetPlmFileUtil(); - files = fileUtil.getPlmFiles(materialCodeArr); + String[] materialCodeArr = params_1.get("materialCode"); // ȡ pk + if (materialCodeArr == null || materialCodeArr.length == 0) { + ExceptionUtils.wrapBusinessException("ϱ벻Ϊ"); + } + NCCForUAPLogger.debug("MaterialPlmDownloadAction-pk = " + Arrays.toString(materialCodeArr)); + // String materialCode = "101092250323,101092250321,101092250322"; + // String[] materialCodeArr = materialCode.split(",", -1); + files = this.getPlmFiles(materialCodeArr); } catch (Exception e) { - Logger.error("MaterialPlmDownloadAction-exp:" + e.getMessage()); - throw new RuntimeException(e); + logger.error("MaterialPlmDownloadAction-exp:" + e.getMessage()); + ExceptionUtils.wrapException(e); } return files; } + + public WebFile getPlmFiles(String[] materialCodeArr) throws Exception { + WebFile file = null; + if (materialCodeArr == null || materialCodeArr.length == 0) { + return file; + } + // ȡPLMIJ + Map configParams = getConfigParams("Dldz-config"); + if (configParams == null || configParams.isEmpty()) { + throw new BusinessException("δPLM"); + } + plmBaseUrl = configParams.get("plmBaseUrl"); + plmUser = configParams.get("plmUser"); + token = getToken(); + if (materialCodeArr.length == 1) { + String materialCode = materialCodeArr[0]; + JSONObject plmFileJson = this.getPlmFile(materialCode); + String objId = plmFileJson.getString("objId"); + String fname = plmFileJson.getString("fname"); + + byte[] fileBytes = this.doDownloadPlmFile(objId); + if (fileBytes.length == 0) { + throw new BusinessException("δѯPLMļ"); + } + InputStream ins = new ByteArrayInputStream(fileBytes); + file = new WebFile(fname, ins); + } else { + // Ϻϲzipļļ + // ڴе ZIP + ByteArrayOutputStream zipOut = new ByteArrayOutputStream(); + ZipOutputStream zipStream = new ZipOutputStream(zipOut); + try { + for (String materialCode : materialCodeArr) { + JSONObject plmFileJson = this.getPlmFile(materialCode); + String objId = plmFileJson.getString("objId"); + String fname = plmFileJson.getString("fname"); + byte[] fileBytes = this.doDownloadPlmFile(objId); + if (fileBytes.length == 0) { + continue; + } + zipStream.putNextEntry(new ZipEntry(fname)); + zipStream.write(fileBytes); + zipStream.closeEntry(); + } + zipStream.finish(); + } finally { + zipStream.close(); + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss"); + String zipName = "ͼֽ_" + sdf.format(new Date()); + // WebFile ZIP ļ + InputStream ins = new ByteArrayInputStream(zipOut.toByteArray()); + file = new WebFile(zipName + ".zip", ins); + } + + return file; + } + + public JSONObject getPlmFile(String materialCode) throws Exception { + String materialId = getMaterialId(materialCode); + return getFileId(materialId); + } + + + /** + * ȡtoken + */ + private String getToken() throws IOException, BusinessException { + Map tokenMap = new HashMap<>(); + tokenMap.put("uname", plmUser); + tokenMap.put("f", "true"); + String tokenStr = doGet(plmBaseUrl + tokenUrl, tokenMap); + logger.error("GetPlmFileUtil-getToken-tokenStr = " + tokenStr); + JSONObject jsonObject = JSONObject.parseObject(tokenStr); + String token = jsonObject.getString("errmsg"); + if (token == null || token.isEmpty()) { + throw new BusinessException("PLMȨʧ"); + } + return token; + } + + /** + * ϱȡ㲿ID + */ + private String getMaterialId(String materialCode) throws IOException, BusinessException { + String fileUrl = plmBaseUrl + materialIdUrl; + fileUrl = fileUrl.replace("{rid}", token); + // MPART㲿 + fileUrl = fileUrl.replace("{t}", "MPART"); + Map map = new HashMap<>(); + map.put("key", materialCode);// ؼ + map.put("start", "0");// ƫ + map.put("size", "10");// + String result = doGet(fileUrl, map); + logger.error("GetPlmFileUtil-getMaterialId-result = " + result); + JSONObject jsonObject = JSONObject.parseObject(result); + String list = jsonObject.getString("list"); + JSONArray jsonArray = JSONObject.parseArray(list); + if (jsonArray == null || jsonArray.isEmpty()) { + throw new BusinessException("ȡPLMidʧ"); + } + JSONObject listJson = jsonArray.getJSONObject(0); + String objId = listJson.getString("objId"); + if (objId == null || objId.isEmpty()) { + throw new BusinessException("ȡPLMidʧ"); + } + return objId; + } + + /** + * 㲿IDȡļID + */ + private JSONObject getFileId(String materialId) throws IOException, BusinessException { + String fileUrl = plmBaseUrl + materialFileIdUrl; + fileUrl = fileUrl.replace("{rid}", token); + // MPART㲿 + fileUrl = fileUrl.replace("{t}", "MPART"); + // id + fileUrl = fileUrl.replace("{id}", materialId); + Map map = new HashMap<>(); + map.put("re", "MPART_SIPM1");// ϵID άͼMPART_SIPM1 + map.put("start", "0");// ƫ + map.put("item", "SIPM1");// + String result = doGet(fileUrl, map); + logger.error("GetPlmFileUtil-getFileId-result = " + result); + JSONObject jsonObject = JSONObject.parseObject(result); + String list = jsonObject.getString("list"); + JSONArray jsonArray = JSONObject.parseArray(list); + if (jsonArray == null || jsonArray.isEmpty()) { + throw new BusinessException("ȡPLMϵļϢʧ"); + } + JSONObject listJson = jsonArray.getJSONObject(0); + String objId = listJson.getString("objId"); + if (objId == null || objId.isEmpty()) { + throw new BusinessException("ȡPLMϵļϢʧ"); + } + return listJson; + } + + /** + * PLMļӿ + */ + private byte[] doDownloadPlmFile(String fileId) throws IOException { + String fileUrl = plmBaseUrl + downlownUrl; + Map map = new HashMap<>(); + map.put("rid", token); + map.put("id", fileId);// id + map.put("t", "SIPM1");// + map.put("type", "D");// ļBD,DDļļBDPDFͼ + return getFileFromPlm(fileUrl, map); + } + + public Map getConfigParams(String code) { + Map map = new HashMap<>(); + String strWhere = " pk_defdoclist in (select pk_defdoclist from bd_defdoclist where code='[code]' and dr=0 ) and dr=0"; + strWhere = strWhere.replace("[code]", code); + try { + DefdocVO[] defdocVOs = (DefdocVO[]) new HYSuperDMO().queryByWhereClause(DefdocVO.class, strWhere); + if (defdocVOs != null) { + for (DefdocVO defdocVO : defdocVOs) { + String value = StringUtils.isEmpty(defdocVO.getMemo()) ? defdocVO.getName() : defdocVO.getMemo(); + map.put(defdocVO.getCode().trim(), value); + } + } + } catch (DAOException e) { + logger.error("Failed to get config parameters for code: " + code, e); + } + return map; + } + + + private String doGet(String requestUrl, Map paramMap) throws IOException { + PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); + cm.setMaxTotal(5000); + cm.setDefaultMaxPerRoute(500); + + RequestConfig globalConfig = RequestConfig.custom().setConnectionRequestTimeout(50000) // ӳػȡӳʱ + .setConnectTimeout(50000) // ӽʱ + .setSocketTimeout(200000) // ȴӦʱ + .setCookieSpec(CookieSpecs.IGNORE_COOKIES).build(); + + CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm) + .setDefaultRequestConfig(globalConfig).build(); + StringBuilder param = new StringBuilder("?"); + if (paramMap != null) { + for (Map.Entry entry : paramMap.entrySet()) { + param.append(entry.getKey()); + param.append("="); + param.append(entry.getValue()); + param.append("&"); + } + param.deleteCharAt(param.length() - 1); + } + String url = requestUrl + param; + HttpGet get = new HttpGet(url); + String responseString = httpClient.execute(get, response -> EntityUtils.toString(response.getEntity())); + get.releaseConnection(); + return responseString; + } + + /** + * õļӿڲļ + * + * @param requestUrl ļӿURL + * @return ļ + */ + private byte[] getFileFromPlm(String requestUrl, Map paramMap) throws IOException { + PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); + cm.setMaxTotal(5000); + cm.setDefaultMaxPerRoute(500); + + RequestConfig globalConfig = RequestConfig.custom().setConnectionRequestTimeout(50000) // ӳػȡӳʱ + .setConnectTimeout(50000) // ӽʱ + .setSocketTimeout(200000) // ȴӦʱ + .setCookieSpec(CookieSpecs.IGNORE_COOKIES).build(); + + CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm) + .setDefaultRequestConfig(globalConfig).build(); + StringBuilder param = new StringBuilder("?"); + if (paramMap != null) { + for (Map.Entry entry : paramMap.entrySet()) { + param.append(entry.getKey()); + param.append("="); + param.append(entry.getValue()); + param.append("&"); + } + param.deleteCharAt(param.length() - 1); + } + String url = requestUrl + param; + HttpGet get = new HttpGet(url); + byte[] responseString = httpClient.execute(get, response -> EntityUtils.toByteArray(response.getEntity())); + get.releaseConnection(); + return responseString; + } } diff --git a/uapbd/src/public/nc/bs/uapbd/util/GetPlmFileUtil.java b/uapbd/src/public/nc/bs/uapbd/util/GetPlmFileUtil.java index 7800d14..ca1d0c0 100644 --- a/uapbd/src/public/nc/bs/uapbd/util/GetPlmFileUtil.java +++ b/uapbd/src/public/nc/bs/uapbd/util/GetPlmFileUtil.java @@ -17,7 +17,6 @@ import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.util.EntityUtils; -import javax.xml.bind.DatatypeConverter; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -89,8 +88,10 @@ public class GetPlmFileUtil { String fname = plmFileJson.getString("fname"); byte[] fileBytes = this.doDownloadPlmFile(objId); + if (fileBytes.length == 0) { + throw new BusinessException("δѯPLMļ"); + } InputStream ins = new ByteArrayInputStream(fileBytes); - file = new WebFile(fname, ins); } else { // Ϻϲzipļļ @@ -103,6 +104,9 @@ public class GetPlmFileUtil { String objId = plmFileJson.getString("objId"); String fname = plmFileJson.getString("fname"); byte[] fileBytes = this.doDownloadPlmFile(objId); + if (fileBytes.length == 0) { + continue; + } zipStream.putNextEntry(new ZipEntry(fname)); zipStream.write(fileBytes); zipStream.closeEntry(); @@ -276,22 +280,4 @@ public class GetPlmFileUtil { return responseString; } - /** - * ļ - * - * @param inputStream ļ - * @return - */ - private byte[] parseFileStream(InputStream inputStream) throws IOException { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - int nRead; - byte[] data = new byte[1024]; - while ((nRead = inputStream.read(data, 0, data.length)) != -1) { - buffer.write(data, 0, nRead); - } - byte[] byteArray = buffer.toByteArray(); - buffer.close(); - return byteArray; - } - } From b452f1dc4dd341f1856062ecdf6e0484f0cb78f6 Mon Sep 17 00:00:00 2001 From: mzr Date: Mon, 11 Aug 2025 16:08:54 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E5=90=88=E5=90=8C=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=8E=A5=E5=8F=A3=EF=BC=8C=E8=B0=83=E6=95=B4=E4=BC=A0?= =?UTF-8?q?=E5=8F=82=E7=9A=84=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ml/m45/WmsSyncPurchaseInListener.java | 431 ++++++++++++++++++ .../ml/m4a/WmsSyncGeneralInListener.java | 39 ++ .../ErpSaleOrderToBIPBackgroupWorkPlugin.java | 6 +- 3 files changed, 474 insertions(+), 2 deletions(-) create mode 100644 ic/src/private/nccloud/wmssync/ml/m45/WmsSyncPurchaseInListener.java create mode 100644 ic/src/private/nccloud/wmssync/ml/m4a/WmsSyncGeneralInListener.java diff --git a/ic/src/private/nccloud/wmssync/ml/m45/WmsSyncPurchaseInListener.java b/ic/src/private/nccloud/wmssync/ml/m45/WmsSyncPurchaseInListener.java new file mode 100644 index 0000000..3a2b14b --- /dev/null +++ b/ic/src/private/nccloud/wmssync/ml/m45/WmsSyncPurchaseInListener.java @@ -0,0 +1,431 @@ +package nccloud.wmssync.ml.m45; + +import nc.bs.businessevent.IBusinessEvent; +import nc.bs.businessevent.IBusinessListener; +import nc.bs.dao.BaseDAO; +import nc.bs.framework.common.NCLocator; +import nc.bs.ic.general.businessevent.ICGeneralCommonEvent; +import nc.bs.logging.Log; +import nc.vo.bd.material.MaterialVO; +import nc.vo.bd.stordoc.StordocVO; +import nc.vo.bd.supplier.SupplierVO; +import nc.vo.ic.m45.entity.PurchaseInBodyVO; +import nc.vo.ic.m45.entity.PurchaseInHeadVO; +import nc.vo.ic.m45.entity.PurchaseInVO; +import nc.vo.org.StockOrgVO; +import nc.vo.pmpub.project.ProjectHeadVO; +import nc.vo.pub.BusinessException; +import nc.vo.pub.lang.UFDateTime; +import nccloud.api.uapbd.wms.utils.IWmsSyncUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * ɹ·WMS + */ +public class WmsSyncPurchaseInListener implements IBusinessListener { + + private static final String WAREHOUSE_PREFIX = "CK"; + private static final String WAREHOUSE_SUFFIX = "001"; + + public static final IWmsSyncUtils WMS_SYNC_UTILS = NCLocator.getInstance().lookup(IWmsSyncUtils.class); + + public static final BaseDAO dao = new BaseDAO(); + + private static final Log log = Log.getInstance("wmslog"); + + @Override + public void doAction(IBusinessEvent iBusinessEvent) throws BusinessException { + // ȼǷBDCommonEvent + if (iBusinessEvent instanceof ICGeneralCommonEvent event) { + PurchaseInVO[] purchaseInVOs = (PurchaseInVO[]) event.getOldObjs(); + if (purchaseInVOs != null) { + log.info("ɹⵥ·WMSʼ"); + for (PurchaseInVO purchaseInVO : purchaseInVOs) { + try { + sendToWMS(purchaseInVO); + } catch (BusinessException e) { + throw new BusinessException("ɹⵥ·WMSʧ:" + e.getMessage(), e); + } + } + } + + } + } + + private void sendToWMS(PurchaseInVO purchaseInVO) throws BusinessException { + String pkOrg = purchaseInVO.getHead().getPk_org(); + String orgCode = WMS_SYNC_UTILS.transferCodeByPk(StockOrgVO.getDefaultTableName(), StockOrgVO.CODE, StockOrgVO.PK_STOCKORG, pkOrg); + if (WMS_SYNC_UTILS.checkIfIncludeOrg(orgCode)) { + log.info("ɹⵥ·WMSʼ֯code" + orgCode); + + // WMS + Map requestData = buildWMSRequestData(purchaseInVO, orgCode); + + // WMSӿ + WMS_SYNC_UTILS.sendToExternalSystem("putASN", requestData); + + log.info("ɹⵥ·WMSɣݺţ" + purchaseInVO.getHead().getVbillcode()); + } else { + log.info("ɹⵥ·: ǰ֯" + orgCode + "ָ֯ͬWMS"); + } + } + + /** + * WMS putASNӿ + * + * @param purchaseInVO ɹⵥVO - ERP: PurchaseInVO + * @param orgCode ֯ + * @return WMS + * @throws BusinessException + */ + private Map buildWMSRequestData(PurchaseInVO purchaseInVO, String orgCode) throws BusinessException { + Map requestData = new HashMap<>(); + + Map data = new HashMap<>(); + PurchaseInHeadVO head = purchaseInVO.getHead(); + PurchaseInBodyVO[] bodies = purchaseInVO.getBodys(); + + // headlist + Map headlist = buildHeadList(head, bodies, orgCode); + + // details + List> detailsList = new ArrayList<>(); + if (bodies != null) { + for (PurchaseInBodyVO body : bodies) { + Map detail = buildDetailItem(body, head); + detailsList.add(detail); + } + } + headlist.put("details", detailsList); + data.put("header", List.of(headlist)); + requestData.put("data", data); + + return requestData; + } + + /** + * WMSͷ + * + * @param head ɹⵥͷVO - ERP: PurchaseInHeadVO + * @param bodies ɹⵥVO - ERP: PurchaseInBodyVO[] + * @param orgCode ֯ + * @return WMSͷ + * @throws BusinessException + */ + private Map buildHeadList(PurchaseInHeadVO head, PurchaseInBodyVO[] bodies, String orgCode) throws BusinessException { + Map headlist = new HashMap<>(); + + // warehouseId - ֿ - ERP: cwarehouseid -> WMS: warehouseId + headlist.put("warehouseId", WAREHOUSE_PREFIX + orgCode + WAREHOUSE_SUFFIX); + + // customerId - ID - ERP: ĬϹ̶ֵ -> WMS: customerId + headlist.put("customerId", "TKJT"); + + // asnType - - ERP: ҵж -> WMS: asnType + headlist.put("asnType", "CGRK"); // ɹⶩ + + // docNo - ERPݺ - ERP: vbillcode -> WMS: docNo + headlist.put("docNo", head.getVbillcode()); + + // asnReferenceA - SRM - ERP: ޶Ӧֶ -> WMS: asnReferenceA + // headlist.put("asnReferenceA", ""); + + // asnReferenceB - ASNοϢB - ERP: ޶Ӧֶ -> WMS: asnReferenceB + // headlist.put("asnReferenceB", ""); + + // asnReferenceC - ASNοϢC - ERP: ޶Ӧֶ -> WMS: asnReferenceC + // headlist.put("asnReferenceC", ""); + + // asnReferenceD - ASNοϢD - ERP: ޶Ӧֶ -> WMS: asnReferenceD + // headlist.put("asnReferenceD", ""); + + // asnCreationTime - ASNʱ - ERP: creationtime -> WMS: asnCreationTime + UFDateTime creationTime = head.getCreationtime(); + if (creationTime != null) { + headlist.put("asnCreationTime", creationTime.toString()); + } + + // expectedArriveTime1 - Ԥڵʱδ - ERP: ޶Ӧֶ -> WMS: expectedArriveTime1 + // headlist.put("expectedArriveTime1", ""); + + // expectedArriveTime2 - Ԥڵʱε - ERP: ޶Ӧֶ -> WMS: expectedArriveTime2 + // headlist.put("expectedArriveTime2", ""); + + // supplierId - ӦID - ERP: cvendorid -> WMS: supplierId + String supplierCode = WMS_SYNC_UTILS.transferCodeByPk(SupplierVO.getDefaultTableName(), + SupplierVO.CODE, SupplierVO.PK_SUPPLIER, head.getCvendorid()); + headlist.put("supplierId", supplierCode); + + // supplierName - Ӧ - ERP: ͨӦIDѯ -> WMS: supplierName + String supplierName = WMS_SYNC_UTILS.transferCodeByPk(SupplierVO.getDefaultTableName(), + SupplierVO.NAME, SupplierVO.PK_SUPPLIER, head.getCvendorid()); + headlist.put("supplierName", supplierName); + + // supplierAddress1 - Ӧ̵ַ - ERP: ͨӦIDѯַ -> WMS: supplierAddress1 + String supplierAddress = WMS_SYNC_UTILS.transferCodeByPk(SupplierVO.getDefaultTableName(), SupplierVO.CORPADDRESS, SupplierVO.PK_SUPPLIER, head.getCvendorid()); + headlist.put("supplierAddress1", supplierAddress != null ? supplierAddress : ""); + + // supplierAddress2~4 - Ӧ̵ַ2~4 - ERP: ޶Ӧֶ -> WMS: supplierAddress2~4 + // headlist.put("supplierAddress2", ""); + // headlist.put("supplierAddress3", ""); + // headlist.put("supplierAddress4", ""); + + // Ӧ̹ʡݵϢ - ERP: ޶Ӧֶ -> WMS: supplierCountry + // headlist.put("supplierCountry", ""); + // headlist.put("supplierProvince", ""); + // headlist.put("supplierCity", ""); + // headlist.put("supplierDistrict", ""); + // headlist.put("supplierStreet", ""); + + // supplierContact - Ӧϵ - ERP: ޶Ӧֶ -> WMS: supplierContact +// String supplierContact = WMS_SYNC_UTILS.transferFieldByPkAllowNull(SupplierVO.getDefaultTableName(), +// SupplierVO.LINKMAN, SupplierVO.PK_SUPPLIER, head.getCvendorid()); +// headlist.put("supplierContact", supplierContact != null ? supplierContact : ""); + + // supplierFax - Ӧ̴ - ERP: ޶Ӧֶ -> WMS: supplierFax + // headlist.put("supplierFax", ""); + + // supplierMail - Ӧ̵ʼ - ERP: ޶Ӧֶ -> WMS: supplierMail + // headlist.put("supplierMail", ""); + + // supplierTel1 - Ӧƶ绰 - ERP: ͨӦIDѯ绰 -> WMS: supplierTel1 + String supplierTel = WMS_SYNC_UTILS.transferFieldByPkAllowNull(SupplierVO.getDefaultTableName(), + SupplierVO.TEL1, SupplierVO.PK_SUPPLIER, head.getCvendorid()); + headlist.put("supplierTel1", supplierTel != null ? supplierTel : ""); + + // supplierTel2 - Ӧ̶̹绰 - ERP: ޶Ӧֶ -> WMS: supplierTel2 + // headlist.put("supplierTel2", ""); + + // supplierZip - Ӧ - ERP: ޶Ӧֶ -> WMS: supplierZip + // headlist.put("supplierZip", ""); + + // carrierId - ID - ERP: ޶Ӧֶ -> WMS: carrierId + // headlist.put("carrierId", ""); + + // carrierName - - ERP: ޶Ӧֶ -> WMS: carrierName + // headlist.put("carrierName", ""); + + // issuePartyId - µID - ERP: ޶Ӧֶ -> WMS: issuePartyId + // headlist.put("issuePartyId", ""); + + // issuePartyName - µ - ERP: ޶Ӧֶ -> WMS: issuePartyName + // headlist.put("issuePartyName", ""); + + // countryOfDestination - ĿĹ - ERP: crececountryid -> WMS: countryOfDestination + // headlist.put("countryOfDestination", ""); + + // countryOfOrigin - ԭ - ERP: csendcountryid -> WMS: countryOfOrigin + // headlist.put("countryOfOrigin", ""); + + // followUp - ҵ񵣵 - ERP: cbizid -> WMS: followUp + // headlist.put("followUp", ""); + + // hedi01 - EDIϢ01 - ERP: Զֶ -> WMS: hedi01 + // headlist.put("hedi01", ""); + + // hedi02 - ǷΪ - expectedQty -> WMS: hedi02 + // ȼбexpectedQtyܺж + boolean hasNegativeQty = false; + if (bodies != null) { + for (PurchaseInBodyVO body : bodies) { + if (body.getNshouldnum() != null && body.getNshouldnum().doubleValue() < 0) { + hasNegativeQty = true; + break; + } + } + } + String isNegative = hasNegativeQty ? "Y" : "N"; + headlist.put("hedi02", isNegative); + + // ͷԶʹ + // ȡԴ/ԴͷϢӱһ¼лȡ + String sourceBillHid = ""; + String firstBillHid = ""; + String sourceTranstype = ""; + String firstTranstype = ""; + + if (bodies != null && bodies.length > 0) { + PurchaseInBodyVO firstBody = bodies[0]; + sourceBillHid = firstBody.getCsourcebillhid() != null ? firstBody.getCsourcebillhid() : ""; + firstBillHid = firstBody.getCfirstbillhid() != null ? firstBody.getCfirstbillhid() : ""; + sourceTranstype = firstBody.getCsourcetranstype() != null ? firstBody.getCsourcetranstype() : ""; + firstTranstype = firstBody.getCfirsttranstype() != null ? firstBody.getCfirsttranstype() : ""; + } + + // hedi03 - Դݱͷ - ERP: csourcebillhid -> WMS: hedi03 + headlist.put("hedi03", sourceBillHid); + + // hedi04 - Դͷݱͷ - ERP: cfirstbillhid -> WMS: hedi04 + headlist.put("hedi04", firstBillHid); + + // hedi05 - Դݽ - ERP: csourcetranstype -> WMS: hedi05 + headlist.put("hedi05", sourceTranstype); + + // hedi06 - Դͷݽ - ERP: cfirsttranstype -> WMS: hedi06 + headlist.put("hedi06", firstTranstype); + + // hedi07 - ǰݱͷ - ERP: cgeneralhid -> WMS: hedi07 + headlist.put("hedi07", head.getCgeneralhid()); + + // hedi08~10 - EDIϢ08~10 - ERP: Զֶ -> WMS: hedi08~10 + // headlist.put("hedi08", ""); + headlist.put("hedi09", 0); + headlist.put("hedi10", 0); + + // װжϢ - ERP: ޶Ӧֶ -> WMS: placeOfϵ + // headlist.put("placeOfDischarge", ""); + // headlist.put("placeOfLoading", ""); + // headlist.put("placeOfDelivery", ""); + + // priority - ȼ - ERP: ޶Ӧֶ -> WMS: priority + // headlist.put("priority", ""); + + // userDefine1~6 - ûԶ1~6 - ERP: Զֶ -> WMS: userDefine1~6 + // headlist.put("userDefine1", ""); + // headlist.put("userDefine2", ""); + // headlist.put("userDefine3", ""); + // headlist.put("userDefine4", ""); + // headlist.put("userDefine5", ""); + // headlist.put("userDefine6", ""); + + // notes - ע - ERP: vnote -> WMS: notes + headlist.put("notes", head.getVnote() != null ? head.getVnote() : ""); + + // createSource - Դ - ERP: ̶ֵ -> WMS: createSource + headlist.put("createSource", "ERP"); + + // crossdockFlag - Խ - ERP: ޶Ӧֶ -> WMS: crossdockFlag + // headlist.put("crossdockFlag", ""); + + return headlist; + } + + /** + * WMSϸ + * + * @param body ɹⵥVO - ERP: PurchaseInBodyVO + * @param head ɹⵥͷVO - ERP: PurchaseInHeadVO + * @return WMSϸ + * @throws BusinessException + */ + private Map buildDetailItem(PurchaseInBodyVO body, PurchaseInHeadVO head) throws BusinessException { + Map detail = new HashMap<>(); + + // lineNo - ERPк - ERP: crowno -> WMS: lineNo + detail.put("lineNo", body.getCrowno()); + + // sku - Ʒ - ERP: cmaterialvid -> WMS: sku + String materialCode = WMS_SYNC_UTILS.transferCodeByPk(MaterialVO.getDefaultTableName(), + MaterialVO.CODE, MaterialVO.PK_MATERIAL, body.getCmaterialvid()); + detail.put("sku", materialCode); + + // expectedQty - Ӧ - ERP: nshouldnum -> WMS: expectedQty (ȷΪ) + double expectedQty = body.getNshouldnum() != null ? body.getNshouldnum().doubleValue() : 0; + detail.put("expectedQty", Math.abs(expectedQty)); // ȡֵȷΪ + + // totalPrice - ܼ - ERP: ֱӶӦֶ -> WMS: totalPrice + detail.put("totalPrice", 0); + + // packUom - λ - ERP: castunitid -> WMS: packUom (ѡEA/IP/CS/PL) + // String unitCode = WMS_SYNC_UTILS.transferCodeByPk("bd_measdoc", + // "code", "pk_measdoc", body.getCastunitid()); + // detail.put("packUom", convertToWMSUnit(unitCode)); + detail.put("packUom", "EA"); // ĬEA + + // lotAtt01 - - ERP: dproducedate -> WMS: lotAtt01 + detail.put("lotAtt01", body.getDproducedate() != null ? body.getDproducedate().toString() : ""); + + // lotAtt02 - ʧЧ - ERP: dvalidate -> WMS: lotAtt02 + detail.put("lotAtt02", body.getDvalidate() != null ? body.getDvalidate().toString() : ""); + + // lotAtt03 - - ERP: dbizdate -> WMS: lotAtt03 + detail.put("lotAtt03", body.getDbizdate() != null ? body.getDbizdate().toString() : ""); + + // lotAtt04 - ERPκ - ERP: vbatchcode -> WMS: lotAtt04 + detail.put("lotAtt04", body.getVbatchcode() != null ? body.getVbatchcode() : ""); + + // lotAtt05 - ERPֿ - ERP: cbodywarehouseid -> WMS: lotAtt05 + String bodyWarehouseCode = WMS_SYNC_UTILS.transferCodeByPk(StordocVO.getDefaultTableName(), + StordocVO.CODE, StordocVO.PK_STORDOC, body.getCbodywarehouseid()); + detail.put("lotAtt05", bodyWarehouseCode); + + // lotAtt06 - Ӧ - ERP: cvendorid -> WMS: lotAtt06 + String bodySupplierCode = WMS_SYNC_UTILS.transferCodeByPk(SupplierVO.getDefaultTableName(), + SupplierVO.CODE, SupplierVO.PK_SUPPLIER, body.getCvendorid()); + detail.put("lotAtt06", bodySupplierCode); + + // lotAtt07 - - ERP: -> WMS: lotAtt07 + detail.put("lotAtt07", ""); // ɹ + + // lotAtt08 - ״̬ - ERP: ĬϺϸ -> WMS: lotAtt08 + detail.put("lotAtt08", "HG"); + + // lotAtt09 - Ŀ - ERP: cprojectid -> WMS: lotAtt09 + String projectCode = WMS_SYNC_UTILS.transferCodeByPk(ProjectHeadVO.getDefaultTableName(), + ProjectHeadVO.PROJECT_CODE, ProjectHeadVO.PK_PROJECT, body.getCprojectid()); + detail.put("lotAtt09", projectCode != null ? projectCode : ""); + + // lotAtt10~24 - 10~24 - ERP: ޶Ӧֶ -> WMS: lotAtt10~24 + // for (int i = 10; i <= 24; i++) { + // detail.put("lotAtt" + String.format("%02d", i), ""); + // } + + // dedi04 - Դݱ - ERP: csourcebillbid -> WMS: dedi04 + detail.put("dedi04", body.getCsourcebillbid() != null ? body.getCsourcebillbid() : ""); + + // dedi05 - Դͷݱ - ERP: cfirstbillbid -> WMS: dedi05 + detail.put("dedi05", body.getCfirstbillbid() != null ? body.getCfirstbillbid() : ""); + + // dedi06 - ǰݱ - ERP: cgeneralbid -> WMS: dedi06 + detail.put("dedi06", body.getCgeneralbid() != null ? body.getCgeneralbid() : ""); + + // dedi07 - Դͷݺ - ERP: vfirstbillcode -> WMS: dedi07 + // detail.put("dedi07", body.getVfirstbillcode() != null ? body.getVfirstbillcode() : ""); + + // dedi08 - Դк - ERP: vsourcerowno -> WMS: dedi08 + // detail.put("dedi08", body.getVsourcerowno() != null ? body.getVsourcerowno() : ""); + + // dedi09 - ʹ ֻܴ + // detail.put("dedi09", ""); + + // dedi10 - ʹ ֻܴ + // detail.put("dedi10", ""); + + // dedi11 - ǰݱ - ERP: cgeneralbid -> WMS: dedi11 + // detail.put("dedi11", ""); // ֶuserDefine6 + + // dedi12 - ǰݺ - ERP: vbillcode -> WMS: dedi12 + // detail.put("dedi12", head.getVbillcode() != null ? head.getVbillcode() : ""); + + // dedi13 - ǰк - ERP: crowno -> WMS: dedi13 + // detail.put("dedi13", body.getCrowno() != null ? body.getCrowno() : ""); + + // dedi14~16 - Ϊչֶ + // detail.put("dedi14", ""); + // detail.put("dedi15", ""); + // detail.put("dedi16", ""); + + // userDefine1~6 - ûԶֶ - ͣ + // userDefine1 - + // detail.put("userDefine1", ""); + // userDefine2 - + // detail.put("userDefine2", ""); + // userDefine3 - + // detail.put("userDefine3", ""); + // userDefine4 - Դݱ + // detail.put("userDefine4", body.getCsourcebillbid() != null ? body.getCsourcebillbid() : ""); + // userDefine5 - Դͷݱ + // detail.put("userDefine5", body.getCfirstbillbid() != null ? body.getCfirstbillbid() : ""); + // userDefine6 - ǰݱ + // detail.put("userDefine6", body.getCgeneralbid() != null ? body.getCgeneralbid() : ""); + + // notes - ע - ERP: vnotebody -> WMS: notes + detail.put("notes", body.getVnotebody() != null ? body.getVnotebody() : ""); + + return detail; + } +} diff --git a/ic/src/private/nccloud/wmssync/ml/m4a/WmsSyncGeneralInListener.java b/ic/src/private/nccloud/wmssync/ml/m4a/WmsSyncGeneralInListener.java new file mode 100644 index 0000000..5dbf231 --- /dev/null +++ b/ic/src/private/nccloud/wmssync/ml/m4a/WmsSyncGeneralInListener.java @@ -0,0 +1,39 @@ +package nccloud.wmssync.ml.m4a; + +import nc.bs.businessevent.IBusinessEvent; +import nc.bs.businessevent.IBusinessListener; +import nc.bs.dao.BaseDAO; +import nc.bs.framework.common.NCLocator; +import nc.bs.ic.general.businessevent.ICGeneralCommonEvent; +import nc.bs.logging.Log; +import nc.vo.bd.defdoc.DefdocVO; +import nc.vo.bd.material.MaterialVO; +import nc.vo.bd.stordoc.StordocVO; +import nc.vo.bd.supplier.SupplierVO; +import nc.vo.ic.m4a.entity.GeneralInBodyVO; +import nc.vo.ic.m4a.entity.GeneralInHeadVO; +import nc.vo.ic.m4a.entity.GeneralInVO; +import nc.vo.org.StockOrgVO; +import nc.vo.pmpub.project.ProjectHeadVO; +import nc.vo.pub.BusinessException; +import nc.vo.pub.lang.UFDateTime; +import nccloud.api.uapbd.wms.utils.IWmsSyncUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * ⵥ·WMS + */ +public class WmsSyncGeneralInListener implements IBusinessListener { + + + @Override + public void doAction(IBusinessEvent iBusinessEvent) throws BusinessException { + + } + +} + diff --git a/uapbd/src/private/nc/bs/uapbd/bip/workplugin/ErpSaleOrderToBIPBackgroupWorkPlugin.java b/uapbd/src/private/nc/bs/uapbd/bip/workplugin/ErpSaleOrderToBIPBackgroupWorkPlugin.java index 4237dc8..da394fb 100644 --- a/uapbd/src/private/nc/bs/uapbd/bip/workplugin/ErpSaleOrderToBIPBackgroupWorkPlugin.java +++ b/uapbd/src/private/nc/bs/uapbd/bip/workplugin/ErpSaleOrderToBIPBackgroupWorkPlugin.java @@ -1,6 +1,7 @@ package nc.bs.uapbd.bip.workplugin; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import com.yonyou.cloud.utils.StringUtils; @@ -198,8 +199,9 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug js_apct.put("contractOrdersList", l_map_f); js_apct.put("id", hid); - - js_apct_detail.put("HTXSDD", js_apct); + JSONArray array = new JSONArray(); + array.add(js_apct); + js_apct_detail.put("HTXSDD", array); logger.error("ErpSaleOrderToBIPBackgroupWorkPlugin-param = " + js_apct_detail.toJSONString()); String resultString = doSendHttp(custUpdateUrl, "POST", tokenParam, "", headers, js_apct_detail.toJSONString()); logger.error("ErpSaleOrderToBIPBackgroupWorkPlugin-res = " + resultString); From d8f705b1826fdd89aea77876a8d4380b838d02a6 Mon Sep 17 00:00:00 2001 From: mzr Date: Mon, 11 Aug 2025 16:11:42 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=8F=98=E6=9B=B4=E6=8E=A8=E8=89=BE=E6=99=AE?= =?UTF-8?q?MES?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/PMOAdjustBP.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/PMOAdjustBP.java b/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/PMOAdjustBP.java index 6c1e7a6..8dea373 100644 --- a/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/PMOAdjustBP.java +++ b/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/PMOAdjustBP.java @@ -3,6 +3,7 @@ package nc.bs.mmpac.pmo.pac0002.bp; import java.util.ArrayList; import java.util.List; +import nc.bs.mmpac.pmo.pac0002.bp.rule.AfterApproveSyncEpicMesRule; import nc.bs.mmpac.pmo.pac0002.bp.rule.AfterApprovingSynchronizeRuleRZ; import nc.bs.mmpac.pmo.pac0002.pluginpoint.PMOPluginPoint; import nc.bs.mmpac.pmo.pac0002.rule.PMOATPUpdateRule; @@ -251,6 +252,8 @@ public class PMOAdjustBP { //MES IRule pushRZRule = new AfterApprovingSynchronizeRuleRZ(Boolean.FALSE); processer.addAfterFinalRule(pushRZRule); + // MES + processer.addAfterRule(new AfterApproveSyncEpicMesRule()); } // ŲϽ From fee308abd6da9afaeeb0df0891c98573d1a7ed90 Mon Sep 17 00:00:00 2001 From: mzr Date: Mon, 11 Aug 2025 16:40:24 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix(so):=20=E4=BF=AE=E5=A4=8D=20BIP?= =?UTF-8?q?=E5=90=88=E5=90=8C=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=8E=A5=E5=8F=A3=E6=95=B0=E6=8D=AE=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/so/src/private/nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java b/so/src/private/nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java index 3c06264..c74264a 100644 --- a/so/src/private/nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java +++ b/so/src/private/nccloud/api/impl/so/m30/APISaleOrderMaitainImpl.java @@ -1,5 +1,6 @@ package nccloud.api.impl.so.m30; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; import nc.bd.itf.tools.BFPubTools; @@ -1345,7 +1346,9 @@ public class APISaleOrderMaitainImpl implements IAPISaleOrderMaitain { updateJson.put("contractOrdersList", l_map_f); // BIPͬ۶ id updateJson.put("id", soMap.get("vdef9")); - bodyJson.put("HTXSDD", updateJson); + JSONArray array = new JSONArray(); + array.add(updateJson); + bodyJson.put("HTXSDD", array); NCCForUAPLogger.debug("updateBipFlagSo-bodyJson:" + bodyJson); Logger.error("updateBipFlagSo-bodyJson:" + bodyJson); String resultString = doSendHttp(updateUrl, "POST", tokenParam, "", headers, bodyJson.toJSONString());