主生产付款单编辑供应商带出辅助余额等信息-张鑫0515
This commit is contained in:
		
							parent
							
								
									137c78408a
								
							
						
					
					
						commit
						13d8c2b50a
					
				|  | @ -0,0 +1,379 @@ | |||
| package nccloud.web.arap.paybill.action; | ||||
| 
 | ||||
| import nccloud.web.arap.arappub.action.CardBodyAfterEditPubAction; | ||||
| import nccloud.web.arap.arappub.info.CardBodyEventInfo; | ||||
| import nccloud.web.arap.paybill.handler.PayBillCardBodyEditHandlerList; | ||||
| import java.text.SimpleDateFormat; | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import com.google.gson.Gson; | ||||
| import nc.itf.gl.api.IResourceService; | ||||
| import nc.md.model.MetaDataException; | ||||
| import nc.md.persist.framework.IMDPersistenceQueryService; | ||||
| import nc.vo.arap.basebill.BaseAggVO; | ||||
| import nc.vo.arap.pay.PayBillItemVO; | ||||
| import nc.vo.arap.pay.PayBillVO; | ||||
| import nc.vo.bd.supplier.SupplierVO; | ||||
| import nc.vo.gl.openapi.GLQueryWebVO; | ||||
| import nc.vo.org.AccountingBookVO; | ||||
| import nc.vo.pub.lang.UFDate; | ||||
| import nccloud.api.rest.utils.NCCRestUtils; | ||||
| import nccloud.framework.service.ServiceLocator; | ||||
| 
 | ||||
| public class CardBodyAfterEditAction extends CardBodyAfterEditPubAction { | ||||
| 	/** | ||||
| 	 * 220201/224103/224105/224101科目的期末余额 | ||||
| 	 */ | ||||
| 	private String endlocamount220201 = ""; | ||||
| 	private String endlocamount224103 = ""; | ||||
| 	private String endlocamount224105 = ""; | ||||
| 	private String endlocamount224101 = ""; | ||||
| 	IMDPersistenceQueryService imDPersistenceService = ServiceLocator.find(IMDPersistenceQueryService.class); | ||||
| 
 | ||||
| 	public void afterEvent(CardBodyEventInfo eventInfo) { | ||||
| 		PayBillCardBodyEditHandlerList handlerList = new PayBillCardBodyEditHandlerList(); | ||||
| 		eventInfo = changeCard(eventInfo); | ||||
| 		handlerList.fireToHandler(eventInfo); | ||||
| 	} | ||||
| 
 | ||||
| 	public CardBodyEventInfo changeCard(CardBodyEventInfo eventInfo) { | ||||
| 		BaseAggVO aggvo = eventInfo.getAggvo(); | ||||
| 		String key = eventInfo.getEvent().getAttrcode(); | ||||
| 
 | ||||
| 		if (key.equals("supplier")) { | ||||
| 			PayBillItemVO[] payvoArry = (PayBillItemVO[]) aggvo.getChildrenVO(); | ||||
| 			PayBillVO billvo = (PayBillVO) aggvo.getParent(); | ||||
| //			财务组织编码 | ||||
| 			String pk_relorg = billvo.getPk_fiorg(); | ||||
| //			核算账薄编码 | ||||
| 			String accbookCode = getAccbookCode(pk_relorg); | ||||
| //			单据号 | ||||
| 			String billno = billvo.getBillno(); | ||||
| //			单据日期 | ||||
| 			UFDate billdate = billvo.getBilldate(); | ||||
| //			当前时间 | ||||
| 			Long serverDate = System.currentTimeMillis(); | ||||
| //			如果有单据号则为修改,修改时单据日期选择现在 | ||||
| 			if (billno != null) { | ||||
| 				billdate = new UFDate(serverDate); | ||||
| 			} | ||||
| 			for (int i = 0; i < payvoArry.length; i++) { | ||||
| 				PayBillItemVO payvo = payvoArry[i]; | ||||
| 				String supplier = payvo.getSupplier(); | ||||
| //						如果供应商不是空或者null | ||||
| 				if (!"".equals(supplier) && null != supplier) { | ||||
| 					SupplierVO suppliervo = getSupplierVO(supplier); | ||||
| 					{ | ||||
| 						if (suppliervo != null) { | ||||
| //							供应商编码 | ||||
| 							String code = suppliervo.getCode(); | ||||
| //							供应商名称 | ||||
| 							String name = suppliervo.getName(); | ||||
| 							getAccountingSubject(accbookCode, billdate, code, name); | ||||
| 							payvoArry[i].setDef30(endlocamount220201); | ||||
| 							payvoArry[i].setDef31(endlocamount224103); | ||||
| 							payvoArry[i].setDef32(endlocamount224105); | ||||
| 							payvoArry[i].setDef33(endlocamount224101); | ||||
| 						} | ||||
| 					} | ||||
| 				} else { | ||||
| 					payvoArry[i].setDef30(null); | ||||
| 					payvoArry[i].setDef31(null); | ||||
| 					payvoArry[i].setDef32(null); | ||||
| 					payvoArry[i].setDef33(null); | ||||
| 				} | ||||
| 			} | ||||
| 			aggvo.setChildrenVO(payvoArry); | ||||
| 			eventInfo.setAggvo(aggvo); | ||||
| 		} | ||||
| 		return eventInfo; | ||||
| 
 | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * nccloud/api/gl/accountrep/assbalance 查询辅助余额接口.查220201/224103/224105的科目的期末余额 | ||||
| 	 *  | ||||
| 	 * @param accbookCode    辅助核算编码 | ||||
| 	 * @param billdate       单据日期 | ||||
| 	 * @param checkvaluecode 供应商编码 | ||||
| 	 * @param checkvaluename 供应商名称 | ||||
| 	 */ | ||||
| 	public void getAccountingSubject(String acccode, UFDate date, String code, String name) { | ||||
| 		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); | ||||
| 		String strdate = formatter.format(date.toDate()); | ||||
| 
 | ||||
| 		endlocamount220201 = getendlocamountBy(queryAssBalance(getRequest(acccode, strdate, code, name))); | ||||
| 		endlocamount224103 = getendlocamountBy(queryAssBalance(getRequest1(acccode, strdate, code, name))); | ||||
| 		endlocamount224105 = getendlocamountBy(queryAssBalance(getRequest2(acccode, strdate, code, name))); | ||||
| 		endlocamount224101 = getendlocamountBy(queryAssBalance(getRequest3(acccode, strdate, code, name))); | ||||
| 	} | ||||
| 
 | ||||
| 	public List<Map<String, Object>> queryAssBalance(String json) { | ||||
| 		NCCRestUtils.initInvocationInfo(); | ||||
| 		GLQueryWebVO qryWebVO = (GLQueryWebVO) new Gson().fromJson(json, GLQueryWebVO.class); | ||||
| 		List<Map<String, Object>> data = null; | ||||
| 		try { | ||||
| 			data = ServiceLocator.find(IResourceService.class).queryAssBalanceByVO(qryWebVO); | ||||
| 		} catch (Exception e) { | ||||
| 			e.printStackTrace(); | ||||
| 		} | ||||
| 		if (data == null) { | ||||
| 			return null; | ||||
| 		} | ||||
| 		return data; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * 解析json获取期末余额 | ||||
| 	 *  | ||||
| 	 * @param json | ||||
| 	 * @return 期末余额 endlocamount | ||||
| 	 */ | ||||
| 	public String getendlocamountBy(List<Map<String, Object>> data) { | ||||
| 		if (data == null) { | ||||
| 			return null; | ||||
| 		} | ||||
| 		String str2 = (String) data.get(0).get("endlocamount"); | ||||
| 		String str3 = (String) data.get(0).get("endorint"); | ||||
| 		if (str2 == null || "".equals(str2)) { | ||||
| 			str2 = "0.0"; | ||||
| 		} else { | ||||
| 			if ("借".equals(str3)) { | ||||
| 				str2 = "-" + str2; | ||||
| 			} | ||||
| 		} | ||||
| 		return str2; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 *  | ||||
| 	 * @return 获取核算账薄code | ||||
| 	 */ | ||||
| 	public String getAccbookCode(String pk_relorg) { | ||||
| 		List<AccountingBookVO> bills = null; | ||||
| 		String sql = "pk_relorg = '" + pk_relorg + "' and dr = 0 "; | ||||
| 		String accbookCode = ""; | ||||
| 		try { | ||||
| 			bills = (List<AccountingBookVO>) imDPersistenceService.queryBillOfVOByCond(AccountingBookVO.class, sql, | ||||
| 					false); | ||||
| 			if (bills.size() != 0) { | ||||
| 				accbookCode = bills.get(0).getCode(); | ||||
| 			} | ||||
| 		} catch (MetaDataException e) { | ||||
| 			// TODO Auto-generated catch block | ||||
| 			e.printStackTrace(); | ||||
| 		} | ||||
| 		return accbookCode; | ||||
| 
 | ||||
| 	} | ||||
| 
 | ||||
| 	public SupplierVO getSupplierVO(String pk_supplier) { | ||||
| 		List<SupplierVO> supplier = null; | ||||
| 		SupplierVO suppliervo = null; | ||||
| 		String sql = "pk_supplier = '" + pk_supplier + "' and dr = 0 "; | ||||
| 		try { | ||||
| 			supplier = (List<SupplierVO>) imDPersistenceService.queryBillOfVOByCond(SupplierVO.class, sql, false); | ||||
| 			if (supplier.size() != 0) { | ||||
| 				suppliervo = supplier.get(0); | ||||
| 			} | ||||
| 		} catch (MetaDataException e) { | ||||
| 			// TODO Auto-generated catch block | ||||
| 			e.printStackTrace(); | ||||
| 		} | ||||
| 		return suppliervo; | ||||
| 	} | ||||
| 
 | ||||
| 	private static String getRequest(String accbookCode, String strdate, String code, String name) { | ||||
| 		Map<String, Object> map = new HashMap<String, Object>(); | ||||
| 		List<String> accbookcodeList = new ArrayList<String>(); | ||||
| 		accbookcodeList.add(accbookCode); | ||||
| 		map.put("accbookCode", accbookcodeList); | ||||
| 		map.put("queryByPeriod", "false"); | ||||
| 		map.put("inclUntallyed", "true"); | ||||
| 		map.put("inclTransfer", "true"); | ||||
| 		map.put("inclError", "true"); | ||||
| 		map.put("inclReclassify", "true"); | ||||
| 		map.put("date", strdate); | ||||
| 		map.put("endDate", strdate); | ||||
| 		map.put("currtypeCode", "本币"); | ||||
| 
 | ||||
| 		List<Map<String, Object>> queryObjList = new ArrayList<Map<String, Object>>(); | ||||
| 		Map<String, Object> quyMap = new HashMap<String, Object>(); | ||||
| 		Map<String, Object> typeMap = new HashMap<String, Object>(); | ||||
| 
 | ||||
| 		typeMap.put("checktypecode", "会计科目"); | ||||
| 		typeMap.put("checktypename", "会计科目"); | ||||
| 		quyMap.put("checktype", typeMap); | ||||
| 		List<Map<String, String>> valueList = new ArrayList<Map<String, String>>(); | ||||
| 		Map<String, String> valueMap = new HashMap<String, String>(); | ||||
| 
 | ||||
| 		valueMap.put("checkvaluecode", "220201"); | ||||
| 		valueMap.put("checkvaluename", "应付款"); | ||||
| 		valueList.add(valueMap); | ||||
| 		quyMap.put("checkvalue", valueList); | ||||
| 		queryObjList.add(quyMap); | ||||
| 		// | ||||
| 		Map<String, Object> quyMap1 = new HashMap<String, Object>(); | ||||
| 		Map<String, Object> typeMap1 = new HashMap<String, Object>(); | ||||
| 
 | ||||
| 		typeMap1.put("checktypecode", "0019"); | ||||
| 		typeMap1.put("checktypename", "供应商档案"); | ||||
| 		quyMap1.put("checktype", typeMap1); | ||||
| 		List<Map<String, String>> valueList1 = new ArrayList<Map<String, String>>(); | ||||
| 		Map<String, String> valueMap1 = new HashMap<String, String>(); | ||||
| 
 | ||||
| 		valueMap1.put("checkvaluecode", code); | ||||
| 		valueMap1.put("checkvaluename", name); | ||||
| 		valueList1.add(valueMap1); | ||||
| 		quyMap1.put("checkvalue", valueList1); | ||||
| 		queryObjList.add(quyMap1); | ||||
| 		map.put("queryObj", queryObjList); | ||||
| 		return new Gson().toJson(map); | ||||
| 	} | ||||
| 
 | ||||
| 	private static String getRequest1(String accbookCode, String strdate, String code, String name) { | ||||
| 		Map<String, Object> map = new HashMap<String, Object>(); | ||||
| 		List<String> accbookcodeList = new ArrayList<String>(); | ||||
| 		accbookcodeList.add(accbookCode); | ||||
| 		map.put("accbookCode", accbookcodeList); | ||||
| 		map.put("queryByPeriod", "false"); | ||||
| 		map.put("inclUntallyed", "true"); | ||||
| 		map.put("inclTransfer", "true"); | ||||
| 		map.put("inclError", "true"); | ||||
| 		map.put("inclReclassify", "true"); | ||||
| 		map.put("date", strdate); | ||||
| 		map.put("endDate", strdate); | ||||
| 		map.put("currtypeCode", "本币"); | ||||
| 
 | ||||
| 		List<Map<String, Object>> queryObjList = new ArrayList<Map<String, Object>>(); | ||||
| 		Map<String, Object> quyMap = new HashMap<String, Object>(); | ||||
| 		Map<String, Object> typeMap = new HashMap<String, Object>(); | ||||
| 
 | ||||
| 		typeMap.put("checktypecode", "会计科目"); | ||||
| 		typeMap.put("checktypename", "会计科目"); | ||||
| 		quyMap.put("checktype", typeMap); | ||||
| 		List<Map<String, String>> valueList = new ArrayList<Map<String, String>>(); | ||||
| 		Map<String, String> valueMap = new HashMap<String, String>(); | ||||
| 
 | ||||
| 		valueMap.put("checkvaluecode", "224103"); | ||||
| 		valueMap.put("checkvaluename", "单位"); | ||||
| 		valueList.add(valueMap); | ||||
| 		quyMap.put("checkvalue", valueList); | ||||
| 		queryObjList.add(quyMap); | ||||
| 		// | ||||
| 		Map<String, Object> quyMap1 = new HashMap<String, Object>(); | ||||
| 		Map<String, Object> typeMap1 = new HashMap<String, Object>(); | ||||
| 
 | ||||
| 		typeMap1.put("checktypecode", "0019"); | ||||
| 		typeMap1.put("checktypename", "供应商档案"); | ||||
| 		quyMap1.put("checktype", typeMap1); | ||||
| 		List<Map<String, String>> valueList1 = new ArrayList<Map<String, String>>(); | ||||
| 		Map<String, String> valueMap1 = new HashMap<String, String>(); | ||||
| 
 | ||||
| 		valueMap1.put("checkvaluecode", code); | ||||
| 		valueMap1.put("checkvaluename", name); | ||||
| 		valueList1.add(valueMap1); | ||||
| 		quyMap1.put("checkvalue", valueList1); | ||||
| 		queryObjList.add(quyMap1); | ||||
| 		map.put("queryObj", queryObjList); | ||||
| 		return new Gson().toJson(map); | ||||
| 	} | ||||
| 
 | ||||
| 	private static String getRequest2(String accbookCode, String strdate, String code, String name) { | ||||
| 		Map<String, Object> map = new HashMap<String, Object>(); | ||||
| 		List<String> accbookcodeList = new ArrayList<String>(); | ||||
| 		accbookcodeList.add(accbookCode); | ||||
| 		map.put("accbookCode", accbookcodeList); | ||||
| 		map.put("queryByPeriod", "false"); | ||||
| 		map.put("inclUntallyed", "true"); | ||||
| 		map.put("inclTransfer", "true"); | ||||
| 		map.put("inclError", "true"); | ||||
| 		map.put("inclReclassify", "true"); | ||||
| 		map.put("date", strdate); | ||||
| 		map.put("endDate", strdate); | ||||
| 		map.put("currtypeCode", "本币"); | ||||
| 
 | ||||
| 		List<Map<String, Object>> queryObjList = new ArrayList<Map<String, Object>>(); | ||||
| 		Map<String, Object> quyMap = new HashMap<String, Object>(); | ||||
| 		Map<String, Object> typeMap = new HashMap<String, Object>(); | ||||
| 
 | ||||
| 		typeMap.put("checktypecode", "会计科目"); | ||||
| 		typeMap.put("checktypename", "会计科目"); | ||||
| 		quyMap.put("checktype", typeMap); | ||||
| 		List<Map<String, String>> valueList = new ArrayList<Map<String, String>>(); | ||||
| 		Map<String, String> valueMap = new HashMap<String, String>(); | ||||
| 
 | ||||
| 		valueMap.put("checkvaluecode", "224105"); | ||||
| 		valueMap.put("checkvaluename", "运费"); | ||||
| 		valueList.add(valueMap); | ||||
| 		quyMap.put("checkvalue", valueList); | ||||
| 		queryObjList.add(quyMap); | ||||
| 		// | ||||
| 		Map<String, Object> quyMap1 = new HashMap<String, Object>(); | ||||
| 		Map<String, Object> typeMap1 = new HashMap<String, Object>(); | ||||
| 
 | ||||
| 		typeMap1.put("checktypecode", "0019"); | ||||
| 		typeMap1.put("checktypename", "供应商档案"); | ||||
| 		quyMap1.put("checktype", typeMap1); | ||||
| 		List<Map<String, String>> valueList1 = new ArrayList<Map<String, String>>(); | ||||
| 		Map<String, String> valueMap1 = new HashMap<String, String>(); | ||||
| 
 | ||||
| 		valueMap1.put("checkvaluecode", code); | ||||
| 		valueMap1.put("checkvaluename", name); | ||||
| 		valueList1.add(valueMap1); | ||||
| 		quyMap1.put("checkvalue", valueList1); | ||||
| 		queryObjList.add(quyMap1); | ||||
| 		map.put("queryObj", queryObjList); | ||||
| 		return new Gson().toJson(map); | ||||
| 	} | ||||
| 
 | ||||
| 	private static String getRequest3(String accbookCode, String strdate, String code, String name) { | ||||
| 		Map<String, Object> map = new HashMap<String, Object>(); | ||||
| 		List<String> accbookcodeList = new ArrayList<String>(); | ||||
| 		accbookcodeList.add(accbookCode); | ||||
| 		map.put("accbookCode", accbookcodeList); | ||||
| 		map.put("queryByPeriod", "false"); | ||||
| 		map.put("inclUntallyed", "true"); | ||||
| 		map.put("inclTransfer", "true"); | ||||
| 		map.put("inclError", "true"); | ||||
| 		map.put("inclReclassify", "true"); | ||||
| 		map.put("date", strdate); | ||||
| 		map.put("endDate", strdate); | ||||
| 		map.put("currtypeCode", "本币"); | ||||
| 
 | ||||
| 		List<Map<String, Object>> queryObjList = new ArrayList<Map<String, Object>>(); | ||||
| 		Map<String, Object> quyMap = new HashMap<String, Object>(); | ||||
| 		Map<String, Object> typeMap = new HashMap<String, Object>(); | ||||
| 
 | ||||
| 		typeMap.put("checktypecode", "会计科目"); | ||||
| 		typeMap.put("checktypename", "会计科目"); | ||||
| 		quyMap.put("checktype", typeMap); | ||||
| 		List<Map<String, String>> valueList = new ArrayList<Map<String, String>>(); | ||||
| 		Map<String, String> valueMap = new HashMap<String, String>(); | ||||
| 
 | ||||
| 		valueMap.put("checkvaluecode", "224101"); | ||||
| 		valueMap.put("checkvaluename", "保证金"); | ||||
| 		valueList.add(valueMap); | ||||
| 		quyMap.put("checkvalue", valueList); | ||||
| 		queryObjList.add(quyMap); | ||||
| 		// | ||||
| 		Map<String, Object> quyMap1 = new HashMap<String, Object>(); | ||||
| 		Map<String, Object> typeMap1 = new HashMap<String, Object>(); | ||||
| 
 | ||||
| 		typeMap1.put("checktypecode", "0019"); | ||||
| 		typeMap1.put("checktypename", "供应商档案"); | ||||
| 		quyMap1.put("checktype", typeMap1); | ||||
| 		List<Map<String, String>> valueList1 = new ArrayList<Map<String, String>>(); | ||||
| 		Map<String, String> valueMap1 = new HashMap<String, String>(); | ||||
| 
 | ||||
| 		valueMap1.put("checkvaluecode", code); | ||||
| 		valueMap1.put("checkvaluename", name); | ||||
| 		valueList1.add(valueMap1); | ||||
| 		quyMap1.put("checkvalue", valueList1); | ||||
| 		queryObjList.add(quyMap1); | ||||
| 		map.put("queryObj", queryObjList); | ||||
| 		return new Gson().toJson(map); | ||||
| 	} | ||||
| } | ||||
|  | @ -0,0 +1,119 @@ | |||
| package nc.vo.scmpub.util; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashSet; | ||||
| import java.util.List; | ||||
| import java.util.Set; | ||||
| 
 | ||||
| import nc.impl.pubapp.pattern.data.vo.VOQuery; | ||||
| import nc.vo.bd.material.MaterialVersionVO; | ||||
| import nc.vo.ml.NCLangRes4VoTransl; | ||||
| import nc.vo.pub.CircularlyAccessibleValueObject; | ||||
| import nc.vo.pub.VOStatus; | ||||
| import nc.vo.pubapp.pattern.exception.ExceptionUtils; | ||||
| import nc.vo.pubapp.pattern.model.entity.bill.AbstractBill; | ||||
| import nccloud.commons.lang.StringUtils; | ||||
| 
 | ||||
| /** | ||||
|  * @author jilush | ||||
|  * @version ncc1.0 | ||||
|  * @description 物料未做版本化时oid、vid一致性校验 | ||||
|  * @date 2022/6/27 14:56 | ||||
|  */ | ||||
| public class MaterialOVidConsistentCheck { | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @description 校验物料ovid是否一致 | ||||
| 	 * @param vos | ||||
| 	 * @param materialoidField 物料oid名称 | ||||
| 	 * @param materialvidField 物料vid名称 | ||||
| 	 * @param crownoField      行号名称 | ||||
| 	 * @return | ||||
| 	 * @author jilush | ||||
| 	 * @date 2022/6/27 15:02 | ||||
| 	 * @version ncc1.0 | ||||
| 	 */ | ||||
| 	public void check(AbstractBill[] vos, String materialoidField, String materialvidField, String crownoField) { | ||||
| 		// 1、构造没有做过版本化的物料set | ||||
| 		Set<String> noMulVersionMaterialSet = getIsBMulVersionMaterialMap(vos, materialoidField); | ||||
| 		// 2、校验非多版本 | ||||
| 		checkMulVersion(vos, materialoidField, materialvidField, crownoField, noMulVersionMaterialSet); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @param vos | ||||
| 	 * @param pk_sourceField | ||||
| 	 * @param pk_materialField | ||||
| 	 * @param crownoField | ||||
| 	 * @param isBMulVersionMaterialMap | ||||
| 	 * @return | ||||
| 	 * @description 校验多版本 | ||||
| 	 * @author jilush | ||||
| 	 * @date 2022/6/27 15:20 | ||||
| 	 * @version ncc1.0 | ||||
| 	 */ | ||||
| 	private void checkMulVersion(AbstractBill[] vos, String pk_sourceField, String pk_materialField, String crownoField, | ||||
| 			Set<String> noMulVersionMaterialSet) { | ||||
| 		for (AbstractBill vo : vos) { | ||||
| 			CircularlyAccessibleValueObject[] childrenVOS = vo.getChildrenVO(); | ||||
| 			StringBuilder errorMsg = new StringBuilder(); | ||||
| 			List<String> crownList = new ArrayList<>(); | ||||
| 			for (CircularlyAccessibleValueObject childrenVO : childrenVOS) { | ||||
| 				if (childrenVO.getStatus() != VOStatus.DELETED) { | ||||
| 					String pk_source = (String) childrenVO.getAttributeValue(pk_sourceField); | ||||
| 					// 未做过版本化时校验 | ||||
| 					if (noMulVersionMaterialSet.contains(pk_source)) { | ||||
| 						String pk_material = (String) childrenVO.getAttributeValue(pk_materialField); | ||||
| 						if (!StringUtils.equals(pk_material, pk_source)) { | ||||
| 							crownList.add((String) childrenVO.getAttributeValue(crownoField)); | ||||
| 						} | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 			if (crownList.size() > 0) { | ||||
| 				errorMsg.append(NCLangRes4VoTransl.getNCLangRes().getStrByID("4001002_0", "04001002-0811", null, | ||||
| 						crownList.toArray(new String[0]))); | ||||
| 				errorMsg.append(NCLangRes4VoTransl.getNCLangRes().getStrByID("4001002_0", "04001002-0856")); | ||||
| 				ExceptionUtils.wrappBusinessException(errorMsg.toString()); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @description 根据vo查询物料oid信息并组装set | ||||
| 	 * @param vos | ||||
| 	 * @param pk_sourceField | ||||
| 	 * @return | ||||
| 	 * @author jilush | ||||
| 	 * @date 2022/6/27 15:10 | ||||
| 	 * @version ncc1.0 | ||||
| 	 */ | ||||
| 	private Set<String> getIsBMulVersionMaterialMap(AbstractBill[] vos, String pk_sourceField) { | ||||
| 		// 1、获取物料版本主键 | ||||
| 		Set<String> pk_sourceSet = new HashSet<String>(); | ||||
| 		for (AbstractBill vo : vos) { | ||||
| 			CircularlyAccessibleValueObject[] childrenVOs = vo.getChildrenVO(); | ||||
| 			for (CircularlyAccessibleValueObject childrenVO : childrenVOs) { | ||||
| 				if (childrenVO.getStatus() != VOStatus.DELETED) { | ||||
| 					pk_sourceSet.add((String) childrenVO.getAttributeValue(pk_sourceField)); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		if (pk_sourceSet.size() > 0) { | ||||
| 			// 2、查询物料版本信息 | ||||
| 			VOQuery<MaterialVersionVO> materialVersionVOQuery = new VOQuery<>(MaterialVersionVO.class); | ||||
| 			MaterialVersionVO[] materialVersionVOS = materialVersionVOQuery.query(pk_sourceSet.toArray(new String[0])); | ||||
| 			// 3、组装set,版本号大于1表示物料做过版本化 | ||||
| 			Set<String> noMulVersionMaterialSet = new HashSet<>(); | ||||
| 			for (MaterialVersionVO materialVersionVO : materialVersionVOS) { | ||||
| 				if (materialVersionVO.getVersion() == 1) { | ||||
| 					noMulVersionMaterialSet.add(materialVersionVO.getPk_source()); | ||||
| 				} | ||||
| 			} | ||||
| 			return noMulVersionMaterialSet; | ||||
| 		} | ||||
| 		return new HashSet<String>(); | ||||
| 
 | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
		Loading…
	
		Reference in New Issue