销售订单审批后推送到QMS系统
This commit is contained in:
		
							parent
							
								
									543f9965ef
								
							
						
					
					
						commit
						5783d9fd5b
					
				|  | @ -37,7 +37,7 @@ import java.util.Map; | |||
| public class AfterApprovingSynchronizeRuleQMS implements IRule<SaleOrderVO> { | ||||
|     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<String, String> configParams; | ||||
| 
 | ||||
| 
 | ||||
|  | @ -79,13 +79,17 @@ public class AfterApprovingSynchronizeRuleQMS implements IRule<SaleOrderVO> { | |||
| 
 | ||||
|             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()); | ||||
|             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); | ||||
|             }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<SaleOrderVO> { | |||
|             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<SaleOrderVO> { | |||
| // | ||||
| //                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<String,Object> mrlmap = (Map<String, Object>) baseDAO.executeQuery(wlsql, new ColumnProcessor()); | ||||
|                 Map<String,Object> mrlmap = (Map<String, Object>) 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<SaleOrderVO> { | |||
|                 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")); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue