销售订单新增接口图号 优化
This commit is contained in:
		
							parent
							
								
									d33e5f20fa
								
							
						
					
					
						commit
						989319a6d3
					
				|  | @ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; | |||
| import com.alibaba.fastjson.serializer.SerializerFeature; | ||||
| import nc.bs.dao.BaseDAO; | ||||
| import nc.bs.dao.DAOException; | ||||
| import nc.bs.framework.common.NCLocator; | ||||
| import nc.bs.logging.Log; | ||||
| import nc.bs.trade.business.HYPubBO; | ||||
| import nc.bs.trade.business.HYSuperDMO; | ||||
|  | @ -14,8 +15,11 @@ import nc.impl.pubapp.pattern.rule.IRule; | |||
| import nc.jdbc.framework.processor.ColumnProcessor; | ||||
| import nc.jdbc.framework.processor.MapListProcessor; | ||||
| import nc.jdbc.framework.processor.MapProcessor; | ||||
| import nc.pubitf.uapbd.IMaterialPubService; | ||||
| import nc.util.mmf.framework.base.MMValueCheck; | ||||
| import nc.vo.bd.defdoc.DefdocVO; | ||||
| import nc.vo.bd.material.MaterialVO; | ||||
| import nc.vo.bd.material.plan.MaterialPlanVO; | ||||
| import nc.vo.org.OrgVO; | ||||
| import nc.vo.pmpub.project.ProjectHeadVO; | ||||
| import nc.vo.pub.BusinessException; | ||||
|  | @ -25,10 +29,8 @@ import nc.vo.so.m30.entity.SaleOrderHVO; | |||
| import nc.vo.so.m30.entity.SaleOrderVO; | ||||
| import nccloud.baseapp.core.log.NCCForUAPLogger; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.Collections; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.*; | ||||
| import java.util.stream.Stream; | ||||
| 
 | ||||
| /** | ||||
|  * 销售订单推送高压mes | ||||
|  | @ -92,6 +94,15 @@ public class AfterSoSyncRuleGyMes implements IRule<SaleOrderVO> { | |||
|                 baseDAO.executeUpdate(sql); | ||||
| 
 | ||||
|                 for (SaleOrderBVO item : itemVOS) { | ||||
|                     String cmaterialvid = item.getCmaterialvid(); | ||||
|                     Map<String, MaterialPlanVO> planMap = queryMaterialPlanInfoByPks(new String[]{cmaterialvid}, pkOrg, | ||||
|                             new String[]{MaterialPlanVO.DEF1}); | ||||
|                     String drawingNumber = ""; | ||||
|                     if (MMValueCheck.isNotEmpty(planMap) && | ||||
|                             MMValueCheck.isNotEmpty(planMap.get(cmaterialvid))) { | ||||
|                         drawingNumber = planMap.get(cmaterialvid).getDef1(); | ||||
|                     } | ||||
| 
 | ||||
|                     Object projectName = getDefName("zdy-001", vdef6); | ||||
| //                Object projectName = hybo.findColValue(ProjectHeadVO.getDefaultTableName(), ProjectHeadVO.PROJECT_NAME, ProjectHeadVO.PK_PROJECT + " = '" + item.getCprojectid() + "' "); | ||||
|                     String wlsql = " select code,name,graphid from bd_material where dr = 0 and pk_material = '" + item.getCmaterialvid() + "' "; | ||||
|  | @ -105,7 +116,8 @@ public class AfterSoSyncRuleGyMes implements IRule<SaleOrderVO> { | |||
|                     itemObj.put("productQuantity", (int) item.getNastnum().doubleValue());// 数量 | ||||
|                     itemObj.put("materialCode", mrlMap.get("code"));// 物料编码 | ||||
|                     itemObj.put("materialName", mrlMap.get("name"));// 物料名称 | ||||
|                     itemObj.put("drawingNumber", mrlMap.get("graphid"));// ͼºÅ | ||||
| //                    itemObj.put("drawingNumber", mrlMap.get("graphid"));// ͼºÅ | ||||
|                     itemObj.put("drawingNumber", drawingNumber);// ͼºÅ | ||||
|                     itemObj.put("supplyDate", item.getDreceivedate().toString());// 供货日期-要求收货日期 | ||||
|                     itemObj.put("remark", item.getVrownote());// 备注 | ||||
|                     itemObj.put("bipCreateBy", createName);// 创建人 | ||||
|  | @ -117,6 +129,15 @@ public class AfterSoSyncRuleGyMes implements IRule<SaleOrderVO> { | |||
|                 } | ||||
|             } else { | ||||
|                 for (SaleOrderBVO item : itemVOS) { | ||||
|                     String cmaterialvid = item.getCmaterialvid(); | ||||
|                     Map<String, MaterialPlanVO> planMap = queryMaterialPlanInfoByPks(new String[]{cmaterialvid}, pkOrg, | ||||
|                             new String[]{MaterialPlanVO.DEF1}); | ||||
|                     String drawingNumber = ""; | ||||
|                     if (MMValueCheck.isNotEmpty(planMap) && | ||||
|                             MMValueCheck.isNotEmpty(planMap.get(cmaterialvid))) { | ||||
|                         drawingNumber = planMap.get(cmaterialvid).getDef1(); | ||||
|                     } | ||||
| 
 | ||||
|                     Object projectName = getDefName("zdy-001", vdef6); | ||||
|                     String wlsql = " select code,name,graphid from bd_material where dr = 0 and pk_material = '" + item.getCmaterialvid() + "' "; | ||||
|                     Map<String, Object> mrlMap = (Map<String, Object>) baseDAO.executeQuery(wlsql, new MapProcessor()); | ||||
|  | @ -128,7 +149,8 @@ public class AfterSoSyncRuleGyMes implements IRule<SaleOrderVO> { | |||
|                     itemObj.put("productQuantity", (int) item.getNastnum().doubleValue());// 数量 | ||||
|                     itemObj.put("materialCode", mrlMap.get("code"));// 物料编码 | ||||
|                     itemObj.put("materialName", mrlMap.get("name"));// 物料名称 | ||||
|                     itemObj.put("drawingNumber", mrlMap.get("graphid"));// ͼºÅ | ||||
| //                    itemObj.put("drawingNumber", mrlMap.get("graphid"));// ͼºÅ | ||||
|                     itemObj.put("drawingNumber", drawingNumber);// ͼºÅ | ||||
|                     itemObj.put("supplyDate", item.getDreceivedate().toString());// 供货日期-要求收货日期 | ||||
|                     itemObj.put("remark", item.getVrownote());// 备注 | ||||
|                     itemObj.put("bipUpdateBy", createName);// 修改人 | ||||
|  | @ -253,6 +275,20 @@ public class AfterSoSyncRuleGyMes implements IRule<SaleOrderVO> { | |||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     public static Map<String, MaterialPlanVO> queryMaterialPlanInfoByPks(String[] pks, String pk_stockorg, | ||||
|                                                                          String[] fields) throws BusinessException { | ||||
|         Map<String, MaterialPlanVO> map = null; | ||||
|         List<String> vids = Stream.of(pks).filter(Objects::nonNull).distinct().toList(); | ||||
|         if (vids.isEmpty()) { | ||||
|             map = new HashMap<>(); | ||||
|         } else { | ||||
|             map = NCLocator.getInstance().lookup(IMaterialPubService.class) | ||||
|                     .queryMaterialPlanInfoByPks(vids.toArray(new String[0]), pk_stockorg, fields); | ||||
|         } | ||||
| 
 | ||||
|         return map; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue