From 5783d9fd5ba345666456c431a8fd454e76eb2fab Mon Sep 17 00:00:00 2001 From: lihao Date: Thu, 11 Sep 2025 11:03:30 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E5=90=8E=E6=8E=A8=E9=80=81=E5=88=B0QMS=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AfterApprovingSynchronizeRuleQMS.java | 48 +++++++++++-------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/so/src/private/nc/bs/so/m30/rule/approve/AfterApprovingSynchronizeRuleQMS.java b/so/src/private/nc/bs/so/m30/rule/approve/AfterApprovingSynchronizeRuleQMS.java index 1b9dc9f..3af6949 100644 --- a/so/src/private/nc/bs/so/m30/rule/approve/AfterApprovingSynchronizeRuleQMS.java +++ b/so/src/private/nc/bs/so/m30/rule/approve/AfterApprovingSynchronizeRuleQMS.java @@ -37,7 +37,7 @@ import java.util.Map; public class AfterApprovingSynchronizeRuleQMS implements IRule { private static final String LOG_INFO_NAME = "qyMesLog"; private static final Log logger = Log.getInstance(LOG_INFO_NAME); - private static final String reqUrl = "IF_QyErpApi.ashx?action=addxsht"; + private static final String reqUrl = "/IF_QyErpApi.ashx?action=addxsht"; private Map configParams; @@ -79,13 +79,17 @@ public class AfterApprovingSynchronizeRuleQMS implements IRule { SaleOrderHVO pmoHeadVO = vo.getParentVO(); SaleOrderBVO[] itemVOS=vo.getChildrenVO(); - singleObj.put("batchid",now.toString()); + singleObj.put("batchid",now); singleObj.put("hth",pmoHeadVO.getVdef6()); - singleObj.put("fplx",pmoHeadVO.getDbilldate()); - String sql = " select name from bd_psndoc where cuserid = '" + pmoHeadVO.getCemployeeid() + "' "; - String billmakerName = (String) baseDAO.executeQuery(sql, new ColumnProcessor()); + singleObj.put("fplx",pmoHeadVO.getDbilldate().toString().substring(0,10)); + if(null !=pmoHeadVO.getCemployeeid()){ + String sql = " select name from bd_psndoc where cuserid = '" + pmoHeadVO.getCemployeeid() + "' "; + String billmakerName = (String) baseDAO.executeQuery(sql, new ColumnProcessor()); - singleObj.put("xsy",billmakerName); + singleObj.put("xsy",billmakerName); + }else{ + singleObj.put("xsy",""); + } singleObj.put("dhdwid",pmoHeadVO.getCcustomerid()); String customersql = " select name from bd_customer where pk_customer = '" + pmoHeadVO.getCcustomerid() + "' "; @@ -97,7 +101,7 @@ public class AfterApprovingSynchronizeRuleQMS implements IRule { String lrrName = (String) baseDAO.executeQuery(lrrsql, new ColumnProcessor()); singleObj.put("lrr",lrrName); - singleObj.put("lrrq",pmoHeadVO.getDmakedate()); + singleObj.put("lrrq",pmoHeadVO.getDmakedate().toString().substring(0,10)); singleObj.put("bz",pmoHeadVO.getVnote()); // ´¦ÀíContentÊý×é JSONArray contentArray = new JSONArray(); @@ -110,20 +114,24 @@ public class AfterApprovingSynchronizeRuleQMS implements IRule { // // Object name = hybo.findColValue("bd_material", "name", "pk_material = '"+item.getCmaterialvid()+"' "); String wlsql = " select code,name,materialspec,materialtype from bd_material where pk_material = '" + item.getCmaterialvid() + "' "; - Map mrlmap = (Map) baseDAO.executeQuery(wlsql, new ColumnProcessor()); + Map mrlmap = (Map) baseDAO.executeQuery(wlsql, new MapProcessor()); itemObj.put("wlbh", mrlmap.get("code")); itemObj.put("wlmc", mrlmap.get("name")); - itemObj.put("wlxhgg", mrlmap.get("materialspec")+(String)mrlmap.get("materialtype")); - itemObj.put("dhsl", item.getNastnum()); - itemObj.put("xsj", item.getNqtorigtaxprice()); - itemObj.put("bxzje", item.getNqtorigtaxprice()); - itemObj.put("jhrq", item.getDsenddate()); + itemObj.put("wlxhgg", ((String)mrlmap.get("materialspec")!=null ? mrlmap.get("materialspec").toString() : "" )+((String)mrlmap.get("materialtype")!=null ? mrlmap.get("materialtype").toString() : "" )); + itemObj.put("dhsl", item.getNastnum().doubleValue()); + itemObj.put("xsj", item.getNqtorigtaxprice().doubleValue()); + itemObj.put("bxzje", item.getNqtorigtaxprice().doubleValue()); + itemObj.put("jhrq", item.getDsenddate().toString().substring(0,10)); itemObj.put("bz", item.getVrownote()); + Object pk_project = hybo.findColValue("bd_project", "project_name", " pk_project = '" + item.getCprojectid() + "' "); + itemObj.put("xmmc", pk_project); + contentArray.add(itemObj); } singleObj.put("Content", contentArray); + /* { "batchid": "XS202408001", @@ -165,18 +173,18 @@ public class AfterApprovingSynchronizeRuleQMS implements IRule { SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty ); - logger.error("QMS-Material-param = " + jsonStr); - NCCForUAPLogger.debug("QMS-Material-param = " + jsonStr); + logger.error("QMS-SaleOrder-param = " + jsonStr); + NCCForUAPLogger.debug("QMS-SaleOrder-param = " + jsonStr); String baseUrl = configParams.get("qmsBaseUrl"); String requestUrl = baseUrl + reqUrl; - logger.error("QMS-Material-url = " + requestUrl); + logger.error("QMS-SaleOrder-url = " + requestUrl); String result = ThirdPartyPostRequestUtil.sendPostRequest(requestUrl, jsonStr); JSONObject resultObj = JSONObject.parseObject(result); - logger.error("QMS-Material-res = " + result); + logger.error("QMS-SaleOrder-res = " + result); - if (!"success".equals(resultObj.getString("success"))) { - // throw new BusinessException("QMS-Material-error:" + resultObj.getString("msg")); - logger.error("QMS-Material-error,result[" + resultObj.toJSONString() + "]"); + if (!"true".equals(resultObj.getString("success"))) { + logger.error("QMS-SaleOrder-error,result[" + resultObj.toJSONString() + "]"); + throw new BusinessException("QMS-SaleOrder-error:" + resultObj.getString("message")); } }