From 9a838e0f7d763acde8e0d92197165e3afa4b9d8e Mon Sep 17 00:00:00 2001 From: lihao Date: Fri, 14 Nov 2025 09:26:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=B1=E5=8F=98=E6=B5=81=E7=A8=8B=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E8=AE=A2=E5=8D=95=E7=94=9F=E6=88=90=E7=9B=B8=E5=90=8C?= =?UTF-8?q?=E6=89=B9=E6=AC=A1=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mmpac/pmo/action/MMBillToPmoAction.java | 498 ++++++++++++++++++ .../mmpac/pmo/pac0002/bp/util/PMOBPUtil.java | 76 +-- .../rule/fill/PMOFillBatchCodeRule.java | 126 ++--- 3 files changed, 599 insertions(+), 101 deletions(-) create mode 100644 mmpac/src/client/nccloud/web/mmpac/pmo/action/MMBillToPmoAction.java diff --git a/mmpac/src/client/nccloud/web/mmpac/pmo/action/MMBillToPmoAction.java b/mmpac/src/client/nccloud/web/mmpac/pmo/action/MMBillToPmoAction.java new file mode 100644 index 00000000..59906fef --- /dev/null +++ b/mmpac/src/client/nccloud/web/mmpac/pmo/action/MMBillToPmoAction.java @@ -0,0 +1,498 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nccloud.web.mmpac.pmo.action; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import nc.bs.dao.BaseDAO; +import nc.bs.dao.DAOException; +import nc.bs.framework.common.NCLocator; +import nc.bs.trade.business.HYPubBO; +import nc.itf.bd.material.baseinfo.IMaterialBaseInfoQueryService; +import nc.itf.mmdp.aid.IAIDService; +import nc.itf.mmpac.pmo.pac0002.IPMOMaintainService; +import nc.itf.mmpac.pmo.pac0002.IPMOQueryService; +import nc.itf.mmpac.pmo.pac0002.IPMOTransTypeQueryService; +import nc.itf.mmsop.ppm.planrelease.IPlanReleaseBusinessService; +import nc.pub.billcode.itf.IBillcodeManage; +import nc.util.mmf.framework.base.MMArrayUtil; +import nc.util.mmf.framework.base.MMMapUtil; +import nc.util.mmf.framework.base.MMStringUtil; +import nc.util.mmf.framework.base.MMValueCheck; +import nc.vo.bd.material.MaterialVO; +import nc.vo.bd.material.stock.MaterialStockVO; +import nc.vo.mmdp.aid.entity.AidResultVO; +import nc.vo.mmdp.aid.entity.MOParaVO; +import nc.vo.mmpac.pmo.pac0002.constant.PMOConstLang; +import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO; +import nc.vo.mmpac.pmo.pac0002.entity.PMOHeadVO; +import nc.vo.mmpac.pmo.pac0002.entity.PMOItemVO; +import nc.vo.mmpac.pmo.pac0002.entity.PMOTransTypeVO; +import nc.vo.mmpac.pmo.pac0002.enumeration.PMOFBillstatusEnum; +import nc.vo.mmpac.pmo.pac0002.enumeration.PMOFItemStatusEnum; +import nc.vo.mmpac.pmo.pac0002.enumeration.PMOFSrcMoOperTypeEnum; +import nc.vo.mmpac.pmo.pac0002.enumeration.PMOReworkTypeEnum; +import nc.vo.pub.BusinessException; +import nc.vo.pub.lang.UFDate; +import nc.vo.pub.lang.UFDateTime; +import nc.vo.pub.lang.UFDouble; +import nc.vo.pubapp.AppContext; +import nc.vo.pubapp.pattern.exception.ExceptionUtils; +import nccloud.dto.mmpub.pub.utils.MMRowNoUtils; +import nccloud.framework.core.json.IJson; +import nccloud.framework.service.ServiceLocator; +import nccloud.framework.web.container.ClientInfo; +import nccloud.framework.web.container.IRequest; +import nccloud.framework.web.container.SessionContext; +import nccloud.framework.web.json.JsonFactory; +import nccloud.framework.web.processor.template.BillCardConvertProcessor; +import nccloud.framework.web.ui.pattern.billcard.BillCard; +import nccloud.framework.web.ui.pattern.billcard.BillCardOperator; +import nccloud.pubitf.mmpac.pwr.service.IPublicPwrService4Pmo; +import nccloud.pubitf.mmpsc.pscrecive.service.IPublicReciveService4MO; +import nccloud.pubitf.mmsfc.operationrep.service.IPublicTransferOprepService; +import nccloud.web.mmpac.pmo.dto.MMToPmoDTO; +import nccloud.web.mmpac.pmo.util.PmoScaleUtil; +import nccloud.web.mmpac.pmo.util.PmoUtil; + +public class MMBillToPmoAction extends PMOCommonAction { + public MMBillToPmoAction() { + } + + public Object doAction(IRequest request) { + BillCard[] cards = null; + + try { + String read = request.read(); + IJson json = JsonFactory.create(); + MMToPmoDTO info = (MMToPmoDTO)json.fromJson(read, MMToPmoDTO.class); + PMOAggVO[] vos = null; + String message = null; + if (info.getVsrctype().equals("55A4")) { + if (info.getBusitype().equals("rework")) { + vos = ((IPublicPwrService4Pmo)ServiceLocator.find(IPublicPwrService4Pmo.class)).reworkpushPmo(info.getPks(), info.getBpks(), info.getGpks()); + vos = this.fillValue4ReMO(vos); + } else if (info.getBusitype().equals("reject")) { + BillCard rejectCard = info.getBillCard(); + BillCardConvertProcessor processor = new BillCardConvertProcessor(this.getAreas()); + PMOAggVO rejectvo = (PMOAggVO)processor.fromBillCard(rejectCard); + vos = this.fillValue4ReMO(new PMOAggVO[]{rejectvo}); + } + } else if (info.getVsrctype().equals("55D2")) { + if (info.getBusitype().equals("rework")) { + vos = (PMOAggVO[])((IPublicTransferOprepService)ServiceLocator.find(IPublicTransferOprepService.class)).reworkDMOORPMO(info.getPks(), info.getBpks(), info.getGpks()); + vos = this.fillValue4OprepReMO(vos); + } + } else if (!info.getVsrctype().equals("aidToMo")) { + if (info.getVsrctype().equals("MdTask")) { + String[] taskIds = info.getPks(); + if (MMArrayUtil.isNotEmpty(taskIds)) { + Object aggObj = ((IPlanReleaseBusinessService)ServiceLocator.find(IPlanReleaseBusinessService.class)).disposeOrder(taskIds[0]); + if (aggObj instanceof PMOAggVO[]) { + vos = (PMOAggVO[])aggObj; + vos = this.fillInfo4PPM(vos); + } + } + } else if (info.getVsrctype().equals("55E5")) { + vos = ((IPublicReciveService4MO)ServiceLocator.find(IPublicReciveService4MO.class)).reworkpushPmo(info.getPks(), info.getGpks()); + vos = this.fillValue4OprepReMO(vos); + } else { + + } + } else { + MOParaVO[] paras = info.getMoparas(); + AidResultVO resultvo = ((IAIDService)ServiceLocator.find(IAIDService.class)).createMoVO(paras); + PMOAggVO[] aggvos = (PMOAggVO[])resultvo.getAggvos(); + message = resultvo.getMessage(); + List listTotalAggvo = new ArrayList(); + boolean isAllSrc_TO_SO = true; + + for(PMOAggVO vo : aggvos) { + if (!MMValueCheck.isEmpty(vo.getChildrenVO())) { + for(PMOItemVO itemvo : vo.getChildrenVO()) { + if (!"5X".equalsIgnoreCase(itemvo.getVsrctype()) && !"30".equalsIgnoreCase(itemvo.getVsrctype())) { + isAllSrc_TO_SO = false; + break; + } + } + } + } + + if (isAllSrc_TO_SO) { + vos = aggvos; + } else { + try { + PMOAggVO[] tempaggvos = ((IPMOMaintainService)ServiceLocator.find(IPMOMaintainService.class)).fillVOInfo4AID(aggvos); + + for(PMOAggVO aggvo : tempaggvos) { + listTotalAggvo.add(aggvo); + } + + vos = (PMOAggVO[])listTotalAggvo.toArray(new PMOAggVO[listTotalAggvo.size()]); + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + } + } + + if (null == vos || vos.length == 0) { + return null; + } + setbarchCode(vos); + (new PmoUtil()).fillDefaultValue4Push(vos); + BillCardOperator operator = new BillCardOperator(info.getPagecode()); + if (vos != null && vos.length > 0) { + cards = new BillCard[vos.length]; + + for(int i = 0; i < vos.length; ++i) { + int[] rows = this.getItemRows(vos[i]); + MMRowNoUtils.setMultiSelectRowNo(vos[i].getChildrenVO(), rows); + BillCard billCard = operator.toCard(vos[i]); + this.afterProcess(billCard); + cards[i] = billCard; + } + } + + if (MMValueCheck.isNotEmpty(message)) { + Map resultMap = new HashMap(); + resultMap.put("cards", cards); + resultMap.put("message", message); + return resultMap; + } + } catch (Exception e) { + ExceptionUtils.wrappException(e); + } + + return cards; + } + private void setbarchCode(PMOAggVO[] bills) { + List xbitemList = new ArrayList(); + HYPubBO hybo = new HYPubBO(); + String org = null; + try { + org = hybo.findColValue("org_adminorg", "pk_adminorg", " code = 'C030' ") + ""; + + for (PMOAggVO vo : bills) { + for(PMOItemVO itemVO : vo.getChildrenVO()) { + if(itemVO.getPk_org().equals(org)) { + // 只有实际独立需求的流程生产订单生成相同批次号 根据上游单据类型为销售订单进行判断 + // if(itemVO.getVsrctype().equals("30")){ + // xbitemList.add(itemVO); + // } + if(checkMaterial(itemVO.getCmaterialvid(),itemVO.getPk_org()) && (null==itemVO.getVbatchcode() || itemVO.getVbatchcode().equals(""))){ + xbitemList.add(itemVO); + } + } + } + } + if(xbitemList.size() > 0) { + PMOItemVO[] vos = (PMOItemVO[])xbitemList.toArray(new PMOItemVO[xbitemList.size()]); + IBillcodeManage billcodeManage = (IBillcodeManage) NCLocator.getInstance().lookup(IBillcodeManage.class); + String[] billcodes = null; + try { + billcodes = billcodeManage.getBatchBillCodes_RequiresNew("55A2-2", vos[0].getPk_group(), vos[0].getPk_org(), vos[0],1); + } catch (BusinessException ex) { + ExceptionUtils.wrappException(ex); + } + for (PMOItemVO vo : vos) { + vo.setVbatchcode(billcodes[0]); + } + for (PMOAggVO vo : bills) { + for(PMOItemVO itemVO : vo.getChildrenVO()) { + for (PMOItemVO xb : vos) { + if(itemVO.getCmoid().equals(xb.getCmoid())) { + itemVO.setVbatchcode(billcodes[0]); + } + } + } + } + } + } catch (BusinessException e) { + throw new RuntimeException(e); + } + } + 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 list = null; + try { + list = (List) 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; + } + private PMOAggVO[] fillInfo4PPM(PMOAggVO[] aggvos) { + Map trantypemap = new HashMap(); + if (MMArrayUtil.isEmpty(aggvos)) { + return aggvos; + } else { + for(PMOAggVO aggvo : aggvos) { + PMOItemVO[] items = aggvo.getChildrenVO(); + PMOHeadVO headvo = aggvo.getParentVO(); + if (MMStringUtil.isEmpty(headvo.getCplanfactoryid())) { + headvo.setCplanfactoryid(headvo.getPk_org()); + headvo.setCplanfactoryvid(headvo.getPk_org_v()); + } + + headvo.setVersion("1.0"); + headvo.setDbilldate(AppContext.getInstance().getBusiDate()); + headvo.setFbillstatus(Integer.valueOf(PMOFBillstatusEnum.FREE.getEnumValue().getValue().toString())); + if (MMStringUtil.isEmpty(headvo.getCtrantypeid())) { + if (trantypemap.containsKey("55A2-01")) { + headvo.setCtrantypeid((String)trantypemap.get("55A2-01")); + headvo.setVtrantypecode("55A2-01"); + } else { + PMOTransTypeVO[] trantype = this.queryPMOTranTypeIDByTranTypeCode(new String[]{"55A2-01"}, headvo.getPk_group()); + headvo.setCtrantypeid(trantype[0].getCtrantypeid()); + headvo.setVtrantypecode("55A2-01"); + trantypemap.put("55A2-01", trantype[0].getCtrantypeid()); + } + } + + if (!MMArrayUtil.isEmpty(items)) { + for(PMOItemVO item : items) { + item.setFitemstatus(PMOFItemStatusEnum.I_PLAN); + UFDate begindate = new UFDate(item.getTrequiredate().toLocalString(), true); + UFDate enddate = new UFDate(item.getTrequiredate().toLocalString(), false); + item.setTplanstarttime(new UFDateTime(begindate.getMillis())); + item.setTplanendtime(new UFDateTime(enddate.getMillis())); + } + } + } + + List listTotalAggvo = new ArrayList(); + + try { + PMOAggVO[] tempaggvos = ((IPMOMaintainService)ServiceLocator.find(IPMOMaintainService.class)).fillVOInfo4AID(aggvos); + + for(PMOAggVO aggvo : tempaggvos) { + listTotalAggvo.add(aggvo); + } + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + + return (PMOAggVO[])listTotalAggvo.toArray(new PMOAggVO[listTotalAggvo.size()]); + } + } + + private PMOAggVO[] fillValue4ReMO(PMOAggVO[] aggvos) throws BusinessException { + ClientInfo clientinfo = SessionContext.getInstance().getClientInfo(); + UFDate busiDate = new UFDate(clientinfo.getBizDateTime()); + UFDate busBeginDate = busiDate.asLocalBegin(); + UFDate busEndDate = busiDate.asLocalEnd(); + List codeList = new ArrayList(); + List frommoidList = new ArrayList(); + + for(PMOAggVO vo : aggvos) { + if (MMValueCheck.isNotEmpty(vo.getParentVO().getVtrantypecode())) { + codeList.add(vo.getParentVO().getVtrantypecode()); + } + + if (MMArrayUtil.isNotEmpty(vo.getChildrenVO())) { + for(PMOItemVO item : vo.getChildrenVO()) { + frommoidList.add(item.getVfromid()); + } + } + } + + codeList.add("55A2-03"); + PMOTransTypeVO[] transtypevos = this.queryPMOTranTypeIDByTranTypeCode((String[])codeList.toArray(new String[codeList.size()]), aggvos[0].getParentVO().getPk_group()); + Map transtypeMap = new HashMap(); + if (MMValueCheck.isEmpty(transtypevos)) { + codeList.add("55A2-Cxx-scrap"); + transtypevos = this.queryPMOTranTypeIDByTranTypeCode((String[])codeList.toArray(new String[codeList.size()]), aggvos[0].getParentVO().getPk_group()); + } + + if (MMValueCheck.isNotEmpty(transtypevos)) { + for(PMOTransTypeVO transtypevo : transtypevos) { + transtypeMap.put(transtypevo.getVtrantypecode(), transtypevo); + } + } else { + ExceptionUtils.wrappBusinessException(PMOConstLang.getMSG_ADD_SCRAP_TRANSTYPE()); + } + + IPMOQueryService queryServ = (IPMOQueryService)ServiceLocator.find(IPMOQueryService.class); + Map originHeadMap = queryServ.queryHeadByid((String[])frommoidList.toArray(new String[frommoidList.size()]), new String[]{"cpmohid", "ctrantypeid"}); + Set transTypeIDSet = new HashSet(); + if (MMMapUtil.isNotEmpty(originHeadMap)) { + for(Map.Entry entry : originHeadMap.entrySet()) { + transTypeIDSet.add(((PMOHeadVO)entry.getValue()).getCtrantypeid()); + } + } + + new HashMap(); + new HashMap(); + IPMOTransTypeQueryService transTypeServ = (IPMOTransTypeQueryService)ServiceLocator.find(IPMOTransTypeQueryService.class); + Map var37 = transTypeServ.getScrapAddTypeByTranTypeIDs((String[])transTypeIDSet.toArray(new String[transTypeIDSet.size()])); + Set scrapAddTypeIDSet = new HashSet(); + + for(Map.Entry entry : var37.entrySet()) { + if (MMValueCheck.isNotEmpty(((PMOTransTypeVO)entry.getValue()).getCscrapaddtypeid())) { + scrapAddTypeIDSet.add(((PMOTransTypeVO)entry.getValue()).getCscrapaddtypeid()); + } + } + + Map var39 = transTypeServ.getScrapAddTypeByTranTypeIDs((String[])scrapAddTypeIDSet.toArray(new String[scrapAddTypeIDSet.size()])); + + for(PMOAggVO aggvo : aggvos) { + PMOItemVO[] items = aggvo.getChildrenVO(); + if (MMArrayUtil.isNotEmpty(items)) { + if (PMOFSrcMoOperTypeEnum.RW.equalsValue(items[0].getFsrcmooper())) { + PMOHeadVO head = (PMOHeadVO)originHeadMap.get(items[0].getVfromid()); + PMOTransTypeVO originTransType = (PMOTransTypeVO)var37.get(head.getCtrantypeid()); + if (MMValueCheck.isNotEmpty(originTransType.getCscrapaddtypeid())) { + PMOTransTypeVO scrapAddType = (PMOTransTypeVO)var39.get(originTransType.getCscrapaddtypeid()); + if (MMValueCheck.isNotEmpty(scrapAddType)) { + aggvo.getParentVO().setCtrantypeid(scrapAddType.getCtrantypeid()); + aggvo.getParentVO().setVtrantypecode(scrapAddType.getVtrantypecode()); + } + } else if (transtypeMap.containsKey("55A2-03")) { + aggvo.getParentVO().setCtrantypeid(((PMOTransTypeVO)transtypeMap.get("55A2-03")).getCtrantypeid()); + aggvo.getParentVO().setVtrantypecode("55A2-03"); + } else if (transtypeMap.containsKey("55A2-Cxx-scrap")) { + aggvo.getParentVO().setCtrantypeid(((PMOTransTypeVO)transtypeMap.get("55A2-Cxx-scrap")).getCtrantypeid()); + aggvo.getParentVO().setVtrantypecode("55A2-Cxx-scrap"); + } + } + + for(PMOItemVO item : items) { + item.setTplanstarttime(new UFDateTime(busBeginDate.toString())); + item.setTplanendtime(new UFDateTime(busEndDate.toString())); + } + } + } + + PMOAggVO[] bills = null; + + try { + bills = ((IPMOMaintainService)ServiceLocator.find(IPMOMaintainService.class)).fillVOInfo4WR(aggvos); + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + + if (MMValueCheck.isEmpty(bills)) { + return null; + } else { + return aggvos; + } + } + + private PMOAggVO[] fillValue4OprepReMO(PMOAggVO[] vos) { + if (MMArrayUtil.isEmpty(vos)) { + return vos; + } else { + List codeList = new ArrayList(); + + for(PMOAggVO vo : vos) { + if (MMValueCheck.isNotEmpty(vo.getParentVO().getVtrantypecode())) { + codeList.add(vo.getParentVO().getVtrantypecode()); + } + } + + Map codevoMap = new HashMap(); + if (codeList.size() > 0) { + PMOTransTypeVO[] transtypevos = this.queryPMOTranTypeIDByTranTypeCode((String[])codeList.toArray(new String[codeList.size()]), vos[0].getParentVO().getPk_group()); + if (!MMArrayUtil.isEmpty(transtypevos)) { + for(PMOTransTypeVO trantypevo : transtypevos) { + codevoMap.put(trantypevo.getVtrantypecode(), trantypevo); + } + } + } + + PMOItemVO[] itemvos = null; + + for(PMOAggVO vo : vos) { + itemvos = vo.getChildrenVO(); + if (!MMArrayUtil.isEmpty(itemvos)) { + Integer fsrcmooper = null; + if (MMMapUtil.isNotEmpty(codevoMap)) { + PMOTransTypeVO trantypevo = (PMOTransTypeVO)codevoMap.get(vo.getParentVO().getVtrantypecode()); + if (MMValueCheck.isNotEmpty(trantypevo) && MMValueCheck.isNotEmpty(trantypevo.getFreworktype())) { + if (PMOReworkTypeEnum.BILL_REWORK.equalsValue(trantypevo.getFreworktype())) { + fsrcmooper = PMOFSrcMoOperTypeEnum.RE.toIntValue(); + } else if (PMOReworkTypeEnum.PROCEDURE_REWORK.equalsValue(trantypevo.getFreworktype())) { + fsrcmooper = PMOFSrcMoOperTypeEnum.PROCRE.toIntValue(); + } + } + } + + if (MMArrayUtil.isNotEmpty(itemvos)) { + ClientInfo clientinfo = SessionContext.getInstance().getClientInfo(); + UFDate busiDate = new UFDate(clientinfo.getBizDateTime()); + UFDate busBeginDate = busiDate.asLocalBegin(); + UFDate busEndDate = busiDate.asLocalEnd(); + + for(PMOItemVO itemvo : itemvos) { + itemvo.setNrwxis(UFDouble.ZERO_DBL); + itemvo.setFsrcmooper(fsrcmooper); + itemvo.setTplanstarttime(new UFDateTime(busBeginDate.toString())); + itemvo.setTplanendtime(new UFDateTime(busEndDate.toString())); + } + } + } + } + + return vos; + } + } + + private PMOTransTypeVO[] queryPMOTranTypeIDByTranTypeCode(String[] vtrantypecodes, String pk_group) { + IPMOTransTypeQueryService serv = (IPMOTransTypeQueryService)ServiceLocator.find(IPMOTransTypeQueryService.class); + + try { + PMOTransTypeVO[] result = serv.queryPMOTranTypeByTranTypeCodes(vtrantypecodes, pk_group); + return result; + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + return null; + } + } + + public void afterProcess(BillCard card) { + PmoScaleUtil util = new PmoScaleUtil(); + util.processBillCard(card); + } + + private int[] getItemRows(PMOAggVO aggVO) { + int[] trows = new int[aggVO.getChildrenVO().length]; + List lists = new ArrayList(); + + for(int i = 0; i < trows.length; ++i) { + Object object = aggVO.getChildrenVO()[i].getCmaterialvid(); + if (MMValueCheck.isNotEmpty(object) && !"".equals(object.toString())) { + lists.add(i); + } + } + + int[] rows = new int[lists.size()]; + + for(int n = 0; n < lists.size(); ++n) { + rows[n] = (Integer)lists.get(n); + } + + return rows; + } +} diff --git a/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/util/PMOBPUtil.java b/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/util/PMOBPUtil.java index 4287b30e..8bf96b5c 100644 --- a/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/util/PMOBPUtil.java +++ b/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/util/PMOBPUtil.java @@ -850,45 +850,45 @@ public class PMOBPUtil { } if (!MMArrayUtil.isEmpty(aggvos)){ - List xbitemList = new ArrayList(); - HYPubBO hybo = new HYPubBO(); - String org = hybo.findColValue("org_adminorg", "pk_adminorg", " code = 'C030' ") + ""; - - for (PMOAggVO vo : aggvos) { - for(PMOItemVO itemVO : vo.getChildrenVO()) { - if(itemVO.getPk_org().equals(org)) { -// 只有实际独立需求的流程生产订单生成相同批次号 根据上游单据类型为销售订单进行判断 -// if(itemVO.getVsrctype().equals("30")){ -// xbitemList.add(itemVO); +// List xbitemList = new ArrayList(); +// HYPubBO hybo = new HYPubBO(); +// String org = hybo.findColValue("org_adminorg", "pk_adminorg", " code = 'C030' ") + ""; +// +// for (PMOAggVO vo : aggvos) { +// for(PMOItemVO itemVO : vo.getChildrenVO()) { +// if(itemVO.getPk_org().equals(org)) { +// // 只有实际独立需求的流程生产订单生成相同批次号 根据上游单据类型为销售订单进行判断 +// // if(itemVO.getVsrctype().equals("30")){ +// // xbitemList.add(itemVO); +// // } +// if(checkMaterial(itemVO.getCmaterialvid(),itemVO.getPk_org()) && (null==itemVO.getVbatchcode() || itemVO.getVbatchcode().equals(""))){ +// // xbitemList.add(itemVO); // } - if(checkMaterial(itemVO.getCmaterialvid(),itemVO.getPk_org())){ - xbitemList.add(itemVO); - } - } - } - } - if(xbitemList.size() > 0) { - PMOItemVO[] vos = (PMOItemVO[])xbitemList.toArray(new PMOItemVO[xbitemList.size()]); - IBillcodeManage billcodeManage = (IBillcodeManage)NCLocator.getInstance().lookup(IBillcodeManage.class); - String[] billcodes = null; - try { - billcodes = billcodeManage.getBatchBillCodes_RequiresNew("55A2-2", vos[0].getPk_group(), vos[0].getPk_org(), vos[0],1); - } catch (BusinessException ex) { - ExceptionUtils.wrappException(ex); - } - for (PMOItemVO vo : vos) { - vo.setVbatchcode(billcodes[0]); - } - for (PMOAggVO vo : aggvos) { - for(PMOItemVO itemVO : vo.getChildrenVO()) { - for (PMOItemVO xb : vos) { - if(itemVO.getCmoid().equals(xb.getCmoid())) { - itemVO.setVbatchcode(billcodes[0]); - } - } - } - } - } +// } +// } +// } +// if(xbitemList.size() > 0) { +// PMOItemVO[] vos = (PMOItemVO[])xbitemList.toArray(new PMOItemVO[xbitemList.size()]); +// IBillcodeManage billcodeManage = (IBillcodeManage)NCLocator.getInstance().lookup(IBillcodeManage.class); +// String[] billcodes = null; +// try { +// billcodes = billcodeManage.getBatchBillCodes_RequiresNew("55A2-2", vos[0].getPk_group(), vos[0].getPk_org(), vos[0],1); +// } catch (BusinessException ex) { +// ExceptionUtils.wrappException(ex); +// } +// for (PMOItemVO vo : vos) { +// vo.setVbatchcode(billcodes[0]); +// } +// for (PMOAggVO vo : aggvos) { +// for(PMOItemVO itemVO : vo.getChildrenVO()) { +// for (PMOItemVO xb : vos) { +// if(itemVO.getCmoid().equals(xb.getCmoid())) { +// itemVO.setVbatchcode(billcodes[0]); +// } +// } +// } +// } +// } } diff --git a/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/rule/fill/PMOFillBatchCodeRule.java b/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/rule/fill/PMOFillBatchCodeRule.java index ea5f8593..1e9eaa38 100644 --- a/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/rule/fill/PMOFillBatchCodeRule.java +++ b/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/rule/fill/PMOFillBatchCodeRule.java @@ -215,69 +215,69 @@ public class PMOFillBatchCodeRule implements IRule { } } - if (xbitemList.size() > 0) { - PMOItemVO[] vos = (PMOItemVO[])xbitemList.toArray(new PMOItemVO[itemList.size()]); - IBillcodeManage billcodeManage = (IBillcodeManage)NCLocator.getInstance().lookup(IBillcodeManage.class); - String[] billcodes = null; - - try { - billcodes = billcodeManage.getBatchBillCodes_RequiresNew("55A2-2", vos[0].getPk_group(), vos[0].getPk_org(), vos[0],1); - } catch (BusinessException ex) { - ExceptionUtils.wrappException(ex); - } - - if (MMStringUtil.isEmpty(billcodes[0])) { - ExceptionUtils.wrappBusinessException(PMOConstLang.getMSG_RULE_PUT_BATCHCODECREATE_CHECK()); - } - - int i = 0; - List eparaList = new ArrayList(); - - for(PMOItemVO vo : vos) { - vo.setVbatchcode(billcodes[0]); - if (!MMValueCheck.isEmpty(vo.getVbatchcode())) { - PbParamVO paravo = PMOTransferUtil.getBatchParamVO((PMOHeadVO)headMap.get(vo.getCpmohid()), vo, false); - PbEventParamVO eparavo = new PbEventParamVO(paravo, (PbParamVO)null, (PbParamVO)null, (PbParamVO)null); - eparaList.add(eparavo); - } - } - - Map ResultParamVOMap = PMOBPService.getIPbMaintainServiceForPac().batchSavePdParamVO((PbEventParamVO[])eparaList.toArray(new PbEventParamVO[eparaList.size()])); - if (MMMapUtil.isEmpty(ResultParamVOMap)) { - return; - } - - for(PMOItemVO item : vos) { - PMOHeadVO headvo = (PMOHeadVO)headMap.get(item.getCpmohid()); - if (!MMValueCheck.isEmpty(item.getVbatchcode())) { - String var10001 = headvo.getPk_org(); - PbParamVO paravo = (PbParamVO)ResultParamVOMap.get(var10001 + headvo.getVbillcode() + item.getVrowno()); - if (!MMValueCheck.isEmpty(paravo)) { - item.setVbatchcode(paravo.getVprodbatchcode()); - item.setCbatchid(paravo.getPk_batchcode()); - } - } - } - - try { - List paramList = new ArrayList(); - - for(PMOItemVO vo : vos) { - PickmTransParamForMO param = new PickmTransParamForMO(); - param.setSourceBillID(vo.getCpmohid()); - param.setSourceBillRowID(vo.getCmoid()); - param.setBatchCode(vo.getVbatchcode()); - param.setBatchid(vo.getCbatchid()); - paramList.add(param); - } - - if (paramList.size() > 0) { - PMOBPService.getIPpickmBusinessServiceForPmo().updatePickmBatchCode((PickmTransParamForMO[])paramList.toArray(new PickmTransParamForMO[0])); - } - } catch (Exception e) { - ExceptionUtils.wrappException(e); - } - } + // if (xbitemList.size() > 0) { + // PMOItemVO[] vos = (PMOItemVO[])xbitemList.toArray(new PMOItemVO[itemList.size()]); + // IBillcodeManage billcodeManage = (IBillcodeManage)NCLocator.getInstance().lookup(IBillcodeManage.class); + // String[] billcodes = null; + // + // try { + // billcodes = billcodeManage.getBatchBillCodes_RequiresNew("55A2-2", vos[0].getPk_group(), vos[0].getPk_org(), vos[0],1); + // } catch (BusinessException ex) { + // ExceptionUtils.wrappException(ex); + // } + // + // if (MMStringUtil.isEmpty(billcodes[0])) { + // ExceptionUtils.wrappBusinessException(PMOConstLang.getMSG_RULE_PUT_BATCHCODECREATE_CHECK()); + // } + // + // int i = 0; + // List eparaList = new ArrayList(); + // + // for(PMOItemVO vo : vos) { + // vo.setVbatchcode(billcodes[0]); + // if (!MMValueCheck.isEmpty(vo.getVbatchcode())) { + // PbParamVO paravo = PMOTransferUtil.getBatchParamVO((PMOHeadVO)headMap.get(vo.getCpmohid()), vo, false); + // PbEventParamVO eparavo = new PbEventParamVO(paravo, (PbParamVO)null, (PbParamVO)null, (PbParamVO)null); + // eparaList.add(eparavo); + // } + // } + // + // Map ResultParamVOMap = PMOBPService.getIPbMaintainServiceForPac().batchSavePdParamVO((PbEventParamVO[])eparaList.toArray(new PbEventParamVO[eparaList.size()])); + // if (MMMapUtil.isEmpty(ResultParamVOMap)) { + // return; + // } + // + // for(PMOItemVO item : vos) { + // PMOHeadVO headvo = (PMOHeadVO)headMap.get(item.getCpmohid()); + // if (!MMValueCheck.isEmpty(item.getVbatchcode())) { + // String var10001 = headvo.getPk_org(); + // PbParamVO paravo = (PbParamVO)ResultParamVOMap.get(var10001 + headvo.getVbillcode() + item.getVrowno()); + // if (!MMValueCheck.isEmpty(paravo)) { + // item.setVbatchcode(paravo.getVprodbatchcode()); + // item.setCbatchid(paravo.getPk_batchcode()); + // } + // } + // } + // + // try { + // List paramList = new ArrayList(); + // + // for(PMOItemVO vo : vos) { + // PickmTransParamForMO param = new PickmTransParamForMO(); + // param.setSourceBillID(vo.getCpmohid()); + // param.setSourceBillRowID(vo.getCmoid()); + // param.setBatchCode(vo.getVbatchcode()); + // param.setBatchid(vo.getCbatchid()); + // paramList.add(param); + // } + // + // if (paramList.size() > 0) { + // PMOBPService.getIPpickmBusinessServiceForPmo().updatePickmBatchCode((PickmTransParamForMO[])paramList.toArray(new PickmTransParamForMO[0])); + // } + // } catch (Exception e) { + // ExceptionUtils.wrappException(e); + // } + // } } }