Merge remote-tracking branch 'origin/main'
This commit is contained in:
		
						commit
						e19258381e
					
				|  | @ -1,14 +1,18 @@ | |||
| package nccloud.web.mmpac.pickm.action; | ||||
| 
 | ||||
| 
 | ||||
| import nc.bs.dao.BaseDAO; | ||||
| import nc.bs.dao.DAOException; | ||||
| import nc.bs.framework.common.InvocationInfoProxy; | ||||
| import nc.bs.framework.common.NCLocator; | ||||
| import nc.bs.uapbd.util.MyHelper; | ||||
| import nc.itf.ic.m4a.IGeneralInMaintain; | ||||
| import nc.itf.mmpac.pickm.IPickmQueryService; | ||||
| import nc.itf.pu.m20.IPraybillApprove; | ||||
| import nc.itf.pu.m20.IPraybillMaintain; | ||||
| import nc.itf.scctpub.reference.uap.pf.PfServiceScmUtil; | ||||
| import nc.itf.uap.pf.IPFBusiAction; | ||||
| import nc.itf.uap.pf.IWorkflowMachine; | ||||
| import nc.itf.uap.pf.busiflow.PfButtonClickContext; | ||||
| import nc.jdbc.framework.processor.ColumnProcessor; | ||||
| import nc.jdbc.framework.processor.MapListProcessor; | ||||
|  | @ -29,6 +33,8 @@ import nc.vo.pub.ISuperVO; | |||
| import nc.vo.pub.compiler.PfParameterVO; | ||||
| import nc.vo.pub.lang.UFDate; | ||||
| import nc.vo.pub.lang.UFDouble; | ||||
| import nc.vo.pub.pf.workflow.IPFActionName; | ||||
| import nc.vo.pub.workflownote.WorkflownoteVO; | ||||
| import nccloud.api.rest.utils.ResultMessageUtil; | ||||
| import nccloud.dto.mmpac.pickm.pub.entity.PickmQueryInfoDTO; | ||||
| import nccloud.framework.core.exception.ExceptionUtils; | ||||
|  | @ -37,6 +43,7 @@ import nccloud.framework.service.ServiceLocator; | |||
| import nccloud.framework.web.action.itf.ICommonAction; | ||||
| import nccloud.framework.web.container.IRequest; | ||||
| import nccloud.framework.web.json.JsonFactory; | ||||
| import nccloud.pubitf.riart.approve.IApproveService; | ||||
| 
 | ||||
| import java.util.*; | ||||
| 
 | ||||
|  | @ -106,7 +113,31 @@ public class PickmToBuyingreqAction implements ICommonAction { | |||
|                 updetaPmoNum(updateList); | ||||
|             } | ||||
|             IPraybillApprove approve= ServiceLocator.find(IPraybillApprove.class); | ||||
|             Object res= PfServiceScmUtil.processBatch("APPROVE", "20", insertVos, null, null); | ||||
|             List<PraybillVO> approveVos=new ArrayList<>(); | ||||
|             Map<String, String>  configParams = MyHelper.getConfigParams("zdh-config", null); | ||||
|             for (PraybillVO prayVO : insertVos) { | ||||
|                 String orgCode = MyHelper.transferField(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, prayVO.getHVO().getPk_org()); | ||||
|                 if (!checkIfOrg(orgCode, configParams)) { | ||||
|                     IApproveService appService = NCLocator.getInstance().lookup(IApproveService.class); | ||||
|                     boolean flag=appService.hasApproveFlow(prayVO.getHVO().getVtrantypecode(), prayVO.getHVO().getPk_praybill()); | ||||
|                     if(flag){ | ||||
|                         Object res1= PfServiceScmUtil.processBatch("SAVE", "20", new PraybillVO[]{prayVO}, null, null); | ||||
|                     }else{ | ||||
|                         approveVos.add(prayVO); | ||||
|                     } | ||||
| 
 | ||||
|                 }else{ | ||||
|                     approveVos.add(prayVO); | ||||
|                 } | ||||
|             } | ||||
|             if(approveVos.isEmpty()){ | ||||
|                 Map<String, Object> returnMap = new HashMap<>(); | ||||
|                 returnMap.put("data", insertVos); | ||||
|                 returnMap.put("success", true); | ||||
| 
 | ||||
|                 return returnMap; | ||||
|             } | ||||
|             Object res= PfServiceScmUtil.processBatch("APPROVE", "20", approveVos.toArray(new PraybillVO[0]), null, null); | ||||
| 
 | ||||
|             Map<String, Object> returnMap = new HashMap<>(); | ||||
|             returnMap.put("data", res); | ||||
|  | @ -122,6 +153,19 @@ public class PickmToBuyingreqAction implements ICommonAction { | |||
|         } | ||||
| 
 | ||||
|     } | ||||
|     private boolean checkIfOrg(String code, Map<String, String> configParams) throws BusinessException { | ||||
|         String targetCode = configParams.get("org"); | ||||
|         if (targetCode == null || nc.vo.am.common.util.StringUtils.isEmpty(targetCode)) { | ||||
|             throw new BusinessException("δÅäÖÃ×éÖ¯²ÎÊý"); | ||||
|         } | ||||
|         String[] orgItem = targetCode.split(","); | ||||
|         for (String orgCode : orgItem) { | ||||
|             if (!orgCode.isEmpty() && orgCode.equals(code)) { | ||||
|                 return false; | ||||
|             } | ||||
|         } | ||||
|         return true; | ||||
|     } | ||||
|     private void updetaPmoNum(List<Map<String, Object>> updateList) throws DAOException { | ||||
|         BaseDAO dao = new BaseDAO(); | ||||
|         for (Map<String, Object> updateMap : updateList) { | ||||
|  |  | |||
|  | @ -87,6 +87,10 @@ public class PmoToQmsAction implements ICommonAction { | |||
|             if (checkIfOrg(orgCode, configParams)) { | ||||
|                 continue; | ||||
|             } | ||||
|             String billType = vo.getParentVO().getVtrantypecode(); | ||||
|             if (checkBillType(billType, configParams)) { | ||||
|                 continue; | ||||
|             } | ||||
|             if (vo.getChildrenVO().length >= 0) { | ||||
|                 if (null != vo.getChildrenVO()[0].getAttributeValue("vdef32") && vo.getChildrenVO()[0].getAttributeValue("vdef32").equals("Y")) { | ||||
|                     continue; | ||||
|  | @ -211,4 +215,17 @@ public class PmoToQmsAction implements ICommonAction { | |||
|         } | ||||
|         return true; | ||||
|     } | ||||
|     private boolean checkBillType(String code, Map<String, String> configParams) throws BusinessException { | ||||
|         String targetCode = configParams.get("xbBillType"); | ||||
|         if (targetCode == null || nc.vo.am.common.util.StringUtils.isEmpty(targetCode)) { | ||||
|             throw new BusinessException("δÅäÖõ¥¾ÝÀàÐͲÎÊý"); | ||||
|         } | ||||
|         String[] types = targetCode.split(","); | ||||
|         for (String type : types) { | ||||
|             if (!type.isEmpty() && type.equals(code)) { | ||||
|                 return false; | ||||
|             } | ||||
|         } | ||||
|         return true; | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -23,6 +23,7 @@ import nc.bs.mmpac.pmo.pac0002.bp.service.PMOBPService; | |||
| import nc.bs.pubapp.AppBsContext; | ||||
| import nc.bs.trade.business.HYPubBO; | ||||
| import nc.impl.pubapp.bd.userdef.UserDefSaveRule; | ||||
| import nc.itf.bd.material.baseinfo.IMaterialBaseInfoQueryService; | ||||
| import nc.itf.uap.rbac.IUserManageQuery_C; | ||||
| import nc.jdbc.framework.generator.SequenceGenerator; | ||||
| import nc.jdbc.framework.processor.ColumnListProcessor; | ||||
|  | @ -42,6 +43,7 @@ import nc.util.mmf.framework.base.MMMapUtil; | |||
| import nc.util.mmf.framework.base.MMNumberUtil; | ||||
| import nc.util.mmf.framework.base.MMValueCheck; | ||||
| import nc.util.mmf.framework.db.MMSqlBuilder; | ||||
| import nc.vo.bd.material.MaterialVO; | ||||
| import nc.vo.bd.material.prod.MaterialProdVO; | ||||
| import nc.vo.bd.material.stock.MaterialStockVO; | ||||
| import nc.vo.bd.vermatch.enumeration.MfgTypeEnum; | ||||
|  | @ -855,7 +857,13 @@ public class PMOBPUtil { | |||
|                 for (PMOAggVO vo : aggvos) { | ||||
|                     for(PMOItemVO itemVO : vo.getChildrenVO()) { | ||||
|                         if(itemVO.getPk_org().equals(org)) { | ||||
|                             xbitemList.add(itemVO); | ||||
| //                            只有实际独立需求的流程生产订单生成相同批次号  根据上游单据类型为销售订单进行判断 | ||||
| //                             if(itemVO.getVsrctype().equals("30")){ | ||||
| //                                 xbitemList.add(itemVO); | ||||
| //                             } | ||||
|                             if(checkMaterial(itemVO.getCmaterialvid(),itemVO.getPk_org())){ | ||||
|                                 xbitemList.add(itemVO); | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|  | @ -891,6 +899,31 @@ public class PMOBPUtil { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private boolean checkMaterial(String cmaterialid,String org) throws BusinessException { | ||||
|         // 根据物料档案库存信息页签批次管理字段判断是否生成批次号,只有勾选批次管理的物料才生成生产批次号 | ||||
| 
 | ||||
|         MaterialVO[] vos = NCLocator.getInstance().lookup(IMaterialBaseInfoQueryService.class).queryDataByPks(new String[]{cmaterialid}); | ||||
|         for (MaterialVO vo : vos) { | ||||
|             String whereSql = " pk_material='" + vo.getPk_material() + "' and pk_org='" + org + "'  and nvl(dr,0)=0 "; | ||||
|             List<MaterialStockVO> list = null; | ||||
|             try { | ||||
|                 list = (List<MaterialStockVO>) new BaseDAO().retrieveByClause(MaterialStockVO.class, whereSql); | ||||
|             } catch (DAOException e) { | ||||
|                 e.printStackTrace(); | ||||
|             } | ||||
|             if(!list.isEmpty()){ | ||||
|                 for (MaterialStockVO materialStockVO:list){ | ||||
|                     if(materialStockVO.getWholemanaflag().booleanValue()) { | ||||
|                         return true; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     public Map<String, MaterialStockVO> getInwarehouseid(String[] cmaterialvids, String pk_org) { | ||||
|         Map<String, MaterialStockVO> stockMap = new HashMap(); | ||||
|         if (MMArrayUtil.isEmpty(cmaterialvids)) { | ||||
|  |  | |||
|  | @ -84,8 +84,8 @@ public class QCRptDataPushtoQmsAction implements ICommonAction { | |||
|                 if (bvos != null && bvos.length > 0) { | ||||
|                     for (ArriveItemVO itemVO : bvos) { | ||||
|                         // 获取vbdef23字段值,处理null情况 | ||||
|                         String vbdef23 = (String) itemVO.getAttributeValue("vbdef23"); | ||||
|                         if (vbdef23 != null && "Y".equalsIgnoreCase(vbdef23)) { | ||||
|                         String vbdef32 = (String) itemVO.getAttributeValue("vbdef32"); | ||||
|                         if (vbdef32 != null && "Y".equalsIgnoreCase(vbdef32)) { | ||||
|                             needSkip = true; | ||||
|                             break; // 只要有一个明细符合,直接跳出明细循环 | ||||
|                         } | ||||
|  | @ -181,7 +181,7 @@ public class QCRptDataPushtoQmsAction implements ICommonAction { | |||
| 
 | ||||
|     private void updateArrveOrder(String pkArriveorder) throws DAOException { | ||||
|         BaseDAO dao = new BaseDAO(); | ||||
|         String sql = "update po_arriveorder_b set vbdef23='Y' where pk_arriveorder='" | ||||
|         String sql = "update po_arriveorder_b set vbdef32='Y' where pk_arriveorder='" | ||||
|                 + pkArriveorder + "'"; | ||||
|         dao.executeUpdate(sql); | ||||
|     } | ||||
|  |  | |||
|  | @ -81,16 +81,16 @@ public class QCRptDataPushtoQmsAction implements ICommonAction { | |||
|                 boolean needSkip = false; // 标记是否需要跳过当前ArriveVO | ||||
| 
 | ||||
|                 // 检查当前到货单的所有明细,只要有一个明细的vbdef23为Y/y,就跳过整个到货单 | ||||
|                 if (bvos != null && bvos.length > 0) { | ||||
|                     for (ArriveItemVO itemVO : bvos) { | ||||
|                         // 获取vbdef23字段值,处理null情况 | ||||
|                         String vbdef23 = (String) itemVO.getAttributeValue("vbdef23"); | ||||
|                         if (vbdef23 != null && "Y".equalsIgnoreCase(vbdef23)) { | ||||
|                             needSkip = true; | ||||
|                             break; // 只要有一个明细符合,直接跳出明细循环 | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|                 // if (bvos != null && bvos.length > 0) { | ||||
|                 //     for (ArriveItemVO itemVO : bvos) { | ||||
|                 //         // 获取vbdef32字段值,处理null情况 | ||||
|                 //         String vbdef32 = (String) itemVO.getAttributeValue("vbdef32"); | ||||
|                 //         if (vbdef32 != null && "Y".equalsIgnoreCase(vbdef32)) { | ||||
|                 //             needSkip = true; | ||||
|                 //             break; // 只要有一个明细符合,直接跳出明细循环 | ||||
|                 //         } | ||||
|                 //     } | ||||
|                 // } | ||||
| 
 | ||||
|                 // 不需要跳过的,加入有效列表 | ||||
|                 if (!needSkip) { | ||||
|  | @ -166,22 +166,29 @@ public class QCRptDataPushtoQmsAction implements ICommonAction { | |||
|                 itemObj.put("wlxhgg", materialtype + materialspec); // 物料型号规格 | ||||
|                 itemObj.put("sjsl", reportHeaderVO.getNapplynum().toString()); // 送检数量(设计单位),按设计计量单位统计的送检数量 | ||||
|                 itemObj.put("jldw", cunitname); // 计量单位 | ||||
|                 itemObj.put("bz", reportItemVO.getVbdef1()); // 明细备注,用于填写该送检物料的补充说明 | ||||
|                 itemObj.put("bz",  getBz(bvo,reportItemVO.getCfirstbid())); // 明细备注,用于填写该送检物料的补充说明 | ||||
|                 itemObj.put("bipzyid", pkReportbill); // 质检报告ID | ||||
|                 itemObj.put("bipqdid", reportItemVO.getPk_reportbill_b()); // 质检报告明细ID | ||||
|                 contentArray.add(itemObj); | ||||
|             } | ||||
|             singleObj.put("Content", contentArray); | ||||
| //            pushData(singleObj); | ||||
| //            update.add(hvo.getPk_arriveorder()); | ||||
| //            updateArrveOrder(hvo.getPk_arriveorder()); | ||||
|            pushData(singleObj); | ||||
|            update.add(hvo.getPk_arriveorder()); | ||||
|            updateArrveOrder(hvo.getPk_arriveorder()); | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     private Object getBz(ArriveItemVO[] bvo, String cfirstbid) { | ||||
|         for (ArriveItemVO arriveItemVO : bvo) { | ||||
|             if(arriveItemVO.getPk_arriveorder_b().equals(cfirstbid)) { | ||||
|                 return arriveItemVO.getVmemob(); | ||||
|             } | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|     private void updateArrveOrder(String pkArriveorder) throws DAOException { | ||||
|         BaseDAO dao = new BaseDAO(); | ||||
|         String sql = "update po_arriveorder_b set vbdef23='Y' where pk_arriveorder='" | ||||
|         String sql = "update po_arriveorder_b set vbdef32='Y' where pk_arriveorder='" | ||||
|                 + pkArriveorder + "'"; | ||||
|         dao.executeUpdate(sql); | ||||
|     } | ||||
|  | @ -215,87 +222,6 @@ public class QCRptDataPushtoQmsAction implements ICommonAction { | |||
|         return cghth; | ||||
|     } | ||||
| 
 | ||||
|     private void buildSyncData1(ReportVO[] useVOs) throws BusinessException { | ||||
|         for (ReportVO vo : useVOs) { | ||||
|             ReportHeaderVO hvo = vo.getHVO(); | ||||
|             ReportItemVO[] bvo = vo.getBVO(); | ||||
|             // 判断物料的业务单元是否是箱变公司,不是则跳过 | ||||
|             String pkOrg = hvo.getPk_org(); | ||||
|             String orgCode = MyHelper.transferField(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg); | ||||
|             if (checkIfOrg(orgCode, configParams)) { | ||||
|                 continue; | ||||
|             } | ||||
|             // 查询供应商信息 | ||||
|             String pk_supplier_v = hvo.getPk_supplier_v(); | ||||
|             SupplierVersionVO supplierVersionVO = new SupplierVersionVO(); | ||||
|             if (pk_supplier_v != null && !pk_supplier_v.isEmpty() && !"~".equals(pk_supplier_v)) { | ||||
|                 ISupplierBaseInfoQryService baseQryService = NCLocator.getInstance().lookup(ISupplierBaseInfoQryService.class); | ||||
|                 supplierVersionVO = baseQryService.querySupplierVersionByVID(pk_supplier_v); | ||||
|             } | ||||
|             // 查询人员信息 | ||||
|             String pkApplyer = hvo.getPk_applyer(); | ||||
|             String applyerName = MyHelper.getStrValByCondition(PsndocVO.getDefaultTableName(), PsndocVO.NAME, | ||||
|                     PsndocVO.PK_PSNDOC + " = '" + pkApplyer + "'"); | ||||
|             String bz = "", cghth = ""; | ||||
|             if (bvo != null && bvo.length > 0) { | ||||
|                 bz = bvo[0].getVbdef1(); // BOM备注 | ||||
|                 cghth = bvo[0].getVbdef2(); // 采购单号 | ||||
|             } | ||||
|             // 组装数据 | ||||
|             JSONObject singleObj = new JSONObject(); | ||||
|             long cts = System.currentTimeMillis(); | ||||
|             singleObj.put("batchid", cts); | ||||
|             singleObj.put("csdh", hvo.getVapplybillcode());// 送检单号,采购送检单的唯一标识编号 | ||||
|             singleObj.put("sjrq", hvo.getDapplydate().toString());// 送检日期,格式建议为 yyyy-MM-dd | ||||
|             singleObj.put("wlgysid", supplierVersionVO.getCode());// 供应商编码 | ||||
|             singleObj.put("wlgysmc", supplierVersionVO.getName());// 供应商名称 | ||||
|             singleObj.put("sjr", applyerName);// 送检人,负责提交送检单的人员姓名 | ||||
|             singleObj.put("cghth", cghth);// 采购合同号,关联对应的采购合同 | ||||
|             singleObj.put("bz", hvo.getVmemo());// 摘要备注,用于填写送检单的补充说明信息 | ||||
| 
 | ||||
|             String pkMaterial = hvo.getPk_material(); | ||||
|             Map<String, Object> materialMap = MyHelper.getMapValByCondition(MaterialVO.getDefaultTableName(), "code,name,materialspec,materialtype", | ||||
|                     "pk_material = '" + pkMaterial + "'"); | ||||
|             String cunitid = hvo.getCunitid();// 主单位 | ||||
|             String cunitname = MyHelper.getStrValByCondition(MeasdocVO.getDefaultTableName(), MeasdocVO.NAME, | ||||
|                     MeasdocVO.PK_MEASDOC + " = '" + cunitid + "'"); | ||||
|             // 处理Content数组 | ||||
|             JSONArray contentArray = new JSONArray(); | ||||
|             JSONObject itemObj = new JSONObject(); | ||||
|             itemObj.put("wlbh", materialMap.getOrDefault("code", "")); // 物料编码 | ||||
|             itemObj.put("wlmc", materialMap.getOrDefault("name", "")); // 物料名称 | ||||
|             String materialtype = skipNull(materialMap.get("materialtype")); | ||||
|             String materialspec = skipNull(materialMap.get("materialspec")); | ||||
|             itemObj.put("wlxhgg", materialtype + materialspec); // 物料型号规格 | ||||
|             itemObj.put("sjsl", hvo.getNapplynum().toString()); // 送检数量(设计单位),按设计计量单位统计的送检数量 | ||||
|             itemObj.put("jldw", cunitname); // 计量单位 | ||||
|             itemObj.put("bz", bz); // 明细备注,用于填写该送检物料的补充说明 | ||||
|             contentArray.add(itemObj); | ||||
| 
 | ||||
|             singleObj.put("Content", contentArray); | ||||
| /*            { | ||||
|                 "batchid": "10002", | ||||
|                 "csdh": "SJ202405001", | ||||
|                 "sjrq": "2024-05-20", | ||||
|                 "wlgysid": "GY001", | ||||
|                 "wlgysmc": "XX 金属材料有限公司", | ||||
|                 "sjr": "张三", | ||||
|                 "cghth": "HT202405003", | ||||
|                 "bz": "紧急送检,需优先检测", | ||||
|                 "Content": [ | ||||
|                     { | ||||
|                         "wlbh": "ACC26711", | ||||
|                             "wlmc": "铜排", | ||||
|                             "wlxhgg": "15558190831", | ||||
|                             "jldw": "米", | ||||
|                             "sjsl": "50", | ||||
|                             "bz": "无特殊要求" | ||||
|                     } | ||||
|                 ] | ||||
|                }*/ | ||||
|             pushData(singleObj); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 推送同步数据 | ||||
|  |  | |||
|  | @ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | ||||
| 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; | ||||
|  | @ -169,15 +171,30 @@ public class SyncDeleteQcQmsRule implements IRule<ReportVO> { | |||
|                 } | ||||
| 
 | ||||
|                 itemObj.put("jldw", cunitname); // 计量单位 | ||||
|                 itemObj.put("bz", reportItemVO.getVbdef1()); // 明细备注 | ||||
|                 itemObj.put("bz", getBz(bvo,reportItemVO.getCfirstbid())); // Ã÷ϸ±¸×¢ ËÍ»õµ¥±¸×¢ | ||||
|                 itemObj.put("bipzyid", pkReportbill); // 质检报告ID | ||||
|                 itemObj.put("bipqdid", reportItemVO.getPk_reportbill_b()); // 质检报告明细ID | ||||
|                 contentArray.add(itemObj); | ||||
|             } | ||||
|             singleObj.put("Content", contentArray); | ||||
|             pushData(singleObj); | ||||
|             updateArrveOrder(hvo.getPk_arriveorder()); | ||||
|         } | ||||
|     } | ||||
|     private void updateArrveOrder(String pkArriveorder) throws DAOException { | ||||
|         BaseDAO dao = new BaseDAO(); | ||||
|         String sql = "update po_arriveorder_b set vbdef32='Y' where pk_arriveorder='" | ||||
|                 + pkArriveorder + "'"; | ||||
|         dao.executeUpdate(sql); | ||||
|     } | ||||
|     private Object getBz(ArriveItemVO[] bvo, String cfirstbid) { | ||||
|         for (ArriveItemVO arriveItemVO : bvo) { | ||||
|             if(arriveItemVO.getPk_arriveorder_b().equals(cfirstbid)) { | ||||
|                 return arriveItemVO.getVmemob(); | ||||
|             } | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
| 
 | ||||
|     // 以下方法与原逻辑一致,未做修改 | ||||
|     private String getCghthVal(ArriveHeaderVO hvo, ArriveItemVO[] bvo) throws BusinessException { | ||||
|  |  | |||
|  | @ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | ||||
| 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; | ||||
|  | @ -139,15 +141,30 @@ public class SyncQcQmsRule implements IRule<ReportVO> { | |||
|                 itemObj.put("wlxhgg", materialtype + materialspec); // 物料型号规格 | ||||
|                 itemObj.put("sjsl", reportHeaderVO.getNapplynum().toString()); // 送检数量(设计单位),按设计计量单位统计的送检数量 | ||||
|                 itemObj.put("jldw", cunitname); // 计量单位 | ||||
|                 itemObj.put("bz", reportItemVO.getVbdef1()); // 明细备注,用于填写该送检物料的补充说明 | ||||
|                 itemObj.put("bz", getBz(bvo,reportItemVO.getCfirstbid())); // Ã÷ϸ±¸×¢£¬ËÍ»õµ¥±¸×¢ | ||||
|                 itemObj.put("bipzyid", pkReportbill); // 质检报告ID | ||||
|                 itemObj.put("bipqdid", reportItemVO.getPk_reportbill_b()); // 质检报告明细ID | ||||
|                 contentArray.add(itemObj); | ||||
|             } | ||||
|             singleObj.put("Content", contentArray); | ||||
|             pushData(singleObj); | ||||
|             updateArrveOrder(hvo.getPk_arriveorder()); | ||||
|         } | ||||
|     } | ||||
|     private void updateArrveOrder(String pkArriveorder) throws DAOException { | ||||
|         BaseDAO dao = new BaseDAO(); | ||||
|         String sql = "update po_arriveorder_b set vbdef32='Y' where pk_arriveorder='" | ||||
|                 + pkArriveorder + "'"; | ||||
|         dao.executeUpdate(sql); | ||||
|     } | ||||
|     private Object getBz(ArriveItemVO[] bvo, String cfirstbid) { | ||||
|         for (ArriveItemVO arriveItemVO : bvo) { | ||||
|             if(arriveItemVO.getPk_arriveorder_b().equals(cfirstbid)) { | ||||
|                 return arriveItemVO.getVmemob(); | ||||
|             } | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
| 
 | ||||
|     private String getCghthVal(ArriveHeaderVO hvo, ArriveItemVO[] bvo) throws BusinessException { | ||||
|         String cghth = ""; | ||||
|  | @ -178,87 +195,6 @@ public class SyncQcQmsRule implements IRule<ReportVO> { | |||
|         return cghth; | ||||
|     } | ||||
| 
 | ||||
|     private void buildSyncData1(ReportVO[] useVOs) throws BusinessException { | ||||
|         for (ReportVO vo : useVOs) { | ||||
|             ReportHeaderVO hvo = vo.getHVO(); | ||||
|             ReportItemVO[] bvo = vo.getBVO(); | ||||
|             // 判断物料的业务单元是否是箱变公司,不是则跳过 | ||||
|             String pkOrg = hvo.getPk_org(); | ||||
|             String orgCode = MyHelper.transferField(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg); | ||||
|             if (checkIfOrg(orgCode, configParams)) { | ||||
|                 continue; | ||||
|             } | ||||
|             // 查询供应商信息 | ||||
|             String pk_supplier_v = hvo.getPk_supplier_v(); | ||||
|             SupplierVersionVO supplierVersionVO = new SupplierVersionVO(); | ||||
|             if (pk_supplier_v != null && !pk_supplier_v.isEmpty() && !"~".equals(pk_supplier_v)) { | ||||
|                 ISupplierBaseInfoQryService baseQryService = NCLocator.getInstance().lookup(ISupplierBaseInfoQryService.class); | ||||
|                 supplierVersionVO = baseQryService.querySupplierVersionByVID(pk_supplier_v); | ||||
|             } | ||||
|             // 查询人员信息 | ||||
|             String pkApplyer = hvo.getPk_applyer(); | ||||
|             String applyerName = MyHelper.getStrValByCondition(PsndocVO.getDefaultTableName(), PsndocVO.NAME, | ||||
|                     PsndocVO.PK_PSNDOC + " = '" + pkApplyer + "'"); | ||||
|             String bz = "", cghth = ""; | ||||
|             if (bvo != null && bvo.length > 0) { | ||||
|                 bz = bvo[0].getVbdef1(); // BOM备注 | ||||
|                 cghth = bvo[0].getVbdef2(); // 采购单号 | ||||
|             } | ||||
|             // 组装数据 | ||||
|             JSONObject singleObj = new JSONObject(); | ||||
|             long cts = System.currentTimeMillis(); | ||||
|             singleObj.put("batchid", cts); | ||||
|             singleObj.put("csdh", hvo.getVapplybillcode());// 送检单号,采购送检单的唯一标识编号 | ||||
|             singleObj.put("sjrq", hvo.getDapplydate().toString());// 送检日期,格式建议为 yyyy-MM-dd | ||||
|             singleObj.put("wlgysid", supplierVersionVO.getCode());// 供应商编码 | ||||
|             singleObj.put("wlgysmc", supplierVersionVO.getName());// 供应商名称 | ||||
|             singleObj.put("sjr", applyerName);// 送检人,负责提交送检单的人员姓名 | ||||
|             singleObj.put("cghth", cghth);// 采购合同号,关联对应的采购合同 | ||||
|             singleObj.put("bz", hvo.getVmemo());// 摘要备注,用于填写送检单的补充说明信息 | ||||
| 
 | ||||
|             String pkMaterial = hvo.getPk_material(); | ||||
|             Map<String, Object> materialMap = MyHelper.getMapValByCondition(MaterialVO.getDefaultTableName(), "code,name,materialspec,materialtype", | ||||
|                     "pk_material = '" + pkMaterial + "'"); | ||||
|             String cunitid = hvo.getCunitid();// 主单位 | ||||
|             String cunitname = MyHelper.getStrValByCondition(MeasdocVO.getDefaultTableName(), MeasdocVO.NAME, | ||||
|                     MeasdocVO.PK_MEASDOC + " = '" + cunitid + "'"); | ||||
|             // 处理Content数组 | ||||
|             JSONArray contentArray = new JSONArray(); | ||||
|             JSONObject itemObj = new JSONObject(); | ||||
|             itemObj.put("wlbh", materialMap.getOrDefault("code", "")); // 物料编码 | ||||
|             itemObj.put("wlmc", materialMap.getOrDefault("name", "")); // 物料名称 | ||||
|             String materialtype = skipNull(materialMap.get("materialtype")); | ||||
|             String materialspec = skipNull(materialMap.get("materialspec")); | ||||
|             itemObj.put("wlxhgg", materialtype + materialspec); // 物料型号规格 | ||||
|             itemObj.put("sjsl", hvo.getNapplynum().toString()); // 送检数量(设计单位),按设计计量单位统计的送检数量 | ||||
|             itemObj.put("jldw", cunitname); // 计量单位 | ||||
|             itemObj.put("bz", bz); // 明细备注,用于填写该送检物料的补充说明 | ||||
|             contentArray.add(itemObj); | ||||
| 
 | ||||
|             singleObj.put("Content", contentArray); | ||||
| /*            { | ||||
|                 "batchid": "10002", | ||||
|                 "csdh": "SJ202405001", | ||||
|                 "sjrq": "2024-05-20", | ||||
|                 "wlgysid": "GY001", | ||||
|                 "wlgysmc": "XX 金属材料有限公司", | ||||
|                 "sjr": "张三", | ||||
|                 "cghth": "HT202405003", | ||||
|                 "bz": "紧急送检,需优先检测", | ||||
|                 "Content": [ | ||||
|                     { | ||||
|                         "wlbh": "ACC26711", | ||||
|                             "wlmc": "铜排", | ||||
|                             "wlxhgg": "15558190831", | ||||
|                             "jldw": "米", | ||||
|                             "sjsl": "50", | ||||
|                             "bz": "无特殊要求" | ||||
|                     } | ||||
|                 ] | ||||
|                }*/ | ||||
|             pushData(singleObj); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 推送同步数据 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue