From f8c0b9311085794d2e9fbf05df62b54fb901413d Mon Sep 17 00:00:00 2001 From: lihao Date: Fri, 17 Oct 2025 19:02:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=B0=E8=B4=A7=E5=8D=95=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=85=A5=E5=BA=93=E5=8D=95=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=9C=80=E7=BB=88=E9=9C=80=E6=B1=82=E6=95=B0=E9=87=8F=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/InboundPubServiceImpl.java | 1071 +++++++++++++++++ 1 file changed, 1071 insertions(+) create mode 100644 ic/src/private/nccloud/pubimpl/ic/inbound/service/InboundPubServiceImpl.java diff --git a/ic/src/private/nccloud/pubimpl/ic/inbound/service/InboundPubServiceImpl.java b/ic/src/private/nccloud/pubimpl/ic/inbound/service/InboundPubServiceImpl.java new file mode 100644 index 00000000..187a863b --- /dev/null +++ b/ic/src/private/nccloud/pubimpl/ic/inbound/service/InboundPubServiceImpl.java @@ -0,0 +1,1071 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nccloud.pubimpl.ic.inbound.service; + +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.framework.common.NCLocator; +import nc.bs.logging.Logger; +import nc.impl.pubapp.pattern.data.vo.VOQuery; +import nc.impl.pubapp.pattern.database.IDExQueryBuilder; +import nc.itf.scmpub.reference.uap.pf.PfServiceScmUtil; +import nc.itf.uap.pf.IPfExchangeService; +import nc.md.model.MetaDataException; +import nc.pubitf.ic.m4y.ITransOutRefQuery; +import nc.pubitf.pu.m21.ic.m45.IOrderQueryFor45; +import nc.pubitf.pu.m23.ic.m45.IQuery23For45; +import nc.pubitf.pu.m23.ic.m47.IQuery23For47; +import nc.pubitf.sc.m61.ic.ISCOrderFor47Ref; +import nc.ui.querytemplate.querytree.IQueryScheme; +import nc.vo.ali.lease.leasein.AggLeaseInVO; +import nc.vo.ali.lease.leasein.LeaseInBodyVO; +import nc.vo.ali.lease.leasein.LeaseInHeadVO; +import nc.vo.alo.lease.restore.AggLeaseRestoreVO; +import nc.vo.alo.lease.restore.LeaseRestoreBodyVO; +import nc.vo.alo.lease.restore.LeaseRestoreHeadVO; +import nc.vo.aum.borrow.restore.ReturnBodyVO; +import nc.vo.aum.borrow.restore.ReturnHeadVO; +import nc.vo.aum.borrow.restore.ReturnVO; +import nc.vo.aum.deploy.out.DeployOutBodyVO; +import nc.vo.aum.deploy.out.DeployOutHeadVO; +import nc.vo.aum.deploy.out.DeployOutVO; +import nc.vo.aum.deploy.usedout.DeployUsedOutBodyVO; +import nc.vo.aum.deploy.usedout.DeployUsedOutHeadVO; +import nc.vo.aum.deploy.usedout.DeployUsedOutVO; +import nc.vo.aum.disused.DisusedBodyVO; +import nc.vo.aum.disused.DisusedHeadVO; +import nc.vo.aum.disused.DisusedVO; +import nc.vo.aum.freeze.FreezeBodyVO; +import nc.vo.aum.freeze.FreezeHeadVO; +import nc.vo.aum.freeze.FreezeVO; +import nc.vo.ic.admin.ICModuleManager; +import nc.vo.ic.general.define.ICBillBodyVO; +import nc.vo.ic.general.define.ICBillHeadVO; +import nc.vo.ic.general.define.ICBillVO; +import nc.vo.ic.m4401.entity.AssetInVO; +import nc.vo.ic.m45.entity.PurchaseInBodyVO; +import nc.vo.ic.m45.entity.PurchaseInVO; +import nc.vo.ic.m47.entity.SubcontInBodyVO; +import nc.vo.ic.m47.entity.SubcontInVO; +import nc.vo.ic.m4e.entity.TransInVO; +import nc.vo.ic.m4y.entity.TransOutBodyVO; +import nc.vo.ic.m4y.entity.TransOutVO; +import nc.vo.ic.pub.util.NCBaseTypeUtils; +import nc.vo.ml.NCLangRes4VoTransl; +import nc.vo.pu.m21.entity.OrderItemVO; +import nc.vo.pu.m21.entity.OrderVO; +import nc.vo.pu.m23.entity.ArriveItemVO; +import nc.vo.pu.m23.entity.ArriveVO; +import nc.vo.pub.BusinessException; +import nc.vo.pub.CircularlyAccessibleValueObject; +import nc.vo.pub.compiler.PfParameterVO; +import nc.vo.pub.lang.UFBoolean; +import nc.vo.pub.lang.UFDate; +import nc.vo.pub.lang.UFDateTime; +import nc.vo.pub.lang.UFDouble; +import nc.vo.pubapp.pattern.exception.ExceptionUtils; +import nc.vo.pubapp.pattern.pub.MathTool; +import nc.vo.pubapp.pattern.pub.SqlBuilder; +import nc.vo.pubapp.query2.sql.process.QuerySchemeProcessor; +import nc.vo.sc.m61.entity.SCOrderItemVO; +import nc.vo.sc.m61.entity.SCOrderVO; +import nc.vo.scmpub.util.TransferSortUtil; +import nccloud.dto.baseapp.querytree.dataformat.Condition; +import nccloud.dto.baseapp.querytree.dataformat.PageInfo; +import nccloud.dto.baseapp.querytree.dataformat.QueryCondition; +import nccloud.dto.baseapp.querytree.dataformat.QueryTreeFormatVO; +import nccloud.dto.ic.pub.entity.BillVOWithExtendInfo; +import nccloud.dto.ic.pub.entity.TransferInfo; +import nccloud.dto.scmpub.pub.utils.SCMRowNoUtils; +import nccloud.pubimpl.ic.pub.utils.ICBillExtendInfoHelper; +import nccloud.pubitf.ic.inbound.service.IInboundPubService; +import nccloud.pubitf.platform.query.INCCloudQueryService; + +public class InboundPubServiceImpl implements IInboundPubService { + public InboundPubServiceImpl() { + } + + private IQueryScheme getScheme(String oid, String queryAreaCode, String pageCode, String bodytable, String bodytablepk, String[] bodyPks) { + IQueryScheme scheme = null; + INCCloudQueryService queryutil = (INCCloudQueryService)NCLocator.getInstance().lookup(INCCloudQueryService.class); + QueryTreeFormatVO info = new QueryTreeFormatVO(); + info.setOid(oid); + info.setQuerytype("tree"); + info.setPageInfo((PageInfo)null); + info.setPageCode(pageCode); + info.setQueryAreaCode(queryAreaCode); + List conditions = new ArrayList(); + QueryCondition con = new QueryCondition(); + con.setConditions(conditions); + con.setLogic("and"); + info.setQuerycondition(con); + scheme = queryutil.convertCondition(info); + QuerySchemeProcessor processor = new QuerySchemeProcessor(scheme); + String bTableAlias = processor.getTableAliasOfAttribute(bodytablepk + "." + bodytablepk); + SqlBuilder sqlb = new SqlBuilder(); + sqlb.append(" and "); + IDExQueryBuilder builder = new IDExQueryBuilder("TEMP_PUBAPPO_"); + sqlb.append(builder.buildSQL(bTableAlias + "." + bodytablepk, bodyPks)); + processor.appendWhere(sqlb.toString()); + return scheme; + } + + public PurchaseInVO[] queryAndVOchangeByIds(TransferInfo infos) throws BusinessException { + IPfExchangeService service = (IPfExchangeService)NCLocator.getInstance().lookup(IPfExchangeService.class); + Map Hid_ts = new HashMap(); + Map Bid_ts = new HashMap(); + String[] orderhidts = infos.getInfo()[0].getHids(); + String[] orderhids = new String[orderhidts.length]; + + for(int i = 0; i < orderhidts.length; ++i) { + String[] pkts = orderhidts[i].split(","); + Hid_ts.put(pkts[0], new UFDateTime(pkts[1])); + orderhids[i] = pkts[0]; + } + + String[] orderbidts = infos.getInfo()[0].getBids(); + String[] orderbids = new String[orderbidts.length]; + + for(int i = 0; i < orderbidts.length; ++i) { + String[] pkts = orderbidts[i].split(","); + Bid_ts.put(pkts[0], new UFDateTime(pkts[1])); + orderbids[i] = pkts[0]; + } + + IQueryScheme scheme = this.getScheme("0001Z810000000070SFL", "query21", "order", "po_order_b", "pk_order_b", orderbids); + IOrderQueryFor45 queryService = (IOrderQueryFor45)NCLocator.getInstance().lookup(IOrderQueryFor45.class); + OrderVO[] ordervos = queryService.queryFor45Pull(scheme); + if (null == ordervos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(OrderVO ordervo : ordervos) { + ordervo.getHVO().setTs((UFDateTime)Hid_ts.get(ordervo.getHVO().getPk_order())); + OrderItemVO[] bodys = ordervo.getBVO(); + + for(OrderItemVO body : bodys) { + body.setTs((UFDateTime)Bid_ts.get(body.getPk_order_b())); + } + } + + PurchaseInVO[] retvos1 = (PurchaseInVO[])service.runChangeDataAryNeedClassify("21", "45", ordervos, (PfParameterVO)null, 2); + Map Hid_ts1 = new HashMap(); + Map Bid_ts1 = new HashMap(); + String[] arrivehidts = infos.getInfo()[1].getHids(); + String[] arrivehids = new String[arrivehidts.length]; + + for(int i = 0; i < arrivehidts.length; ++i) { + String[] pkts = arrivehidts[i].split(","); + Hid_ts1.put(pkts[0], new UFDateTime(pkts[1])); + arrivehids[i] = pkts[0]; + } + + String[] arrivebidts = infos.getInfo()[1].getBids(); + String[] arrivebids = new String[arrivebidts.length]; + + for(int i = 0; i < arrivebidts.length; ++i) { + String[] pkts = arrivebidts[i].split(","); + String pk = pkts[0].contains("@") ? pkts[0].split("@")[0] : pkts[0]; + Bid_ts1.put(pk, new UFDateTime(pkts[1])); + arrivebids[i] = pk; + } + + IQueryScheme scheme2 = this.getScheme("0001Z8100000000752W8", "query23", "arrive", "po_arriveorder_b", "pk_arriveorder_b", arrivebids); + IQuery23For45 queryService2 = (IQuery23For45)NCLocator.getInstance().lookup(IQuery23For45.class); + ArriveVO[] arrivevos = queryService2.queryArrive(scheme2); + if (null == arrivevos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(ArriveVO arrivevo : arrivevos) { + arrivevo.getHVO().setTs((UFDateTime)Hid_ts1.get(arrivevo.getHVO().getPk_arriveorder())); + ArriveItemVO[] bodys = arrivevo.getBVO(); + + for(ArriveItemVO body : bodys) { + body.setTs((UFDateTime)Bid_ts1.get(body.getPk_arriveorder_b())); + if(null!=body.getAttributeValue("vbdef33") && body.getNastnum().compareTo(body.getAttributeValue("vbdef33"))<0){ + throw new BusinessException("入库数量大于最终需求数量不能生成采购入库!"); + } + } + } + + PurchaseInVO[] retvos2 = (PurchaseInVO[])service.runChangeDataAryNeedClassify("23", "45", arrivevos, (PfParameterVO)null, 2); + PurchaseInVO[] retvos = new PurchaseInVO[retvos1.length + retvos2.length]; + System.arraycopy(retvos1, 0, retvos, 0, retvos1.length); + System.arraycopy(retvos2, 0, retvos, retvos1.length, retvos2.length); + retvos = (PurchaseInVO[])(new TransferSortUtil("vsourcerowno", "vsourcebillcode")).sort(retvos); + return retvos; + } + + public PurchaseInVO[] queryAndVOchangeByIds1(TransferInfo info) throws BusinessException { + IPfExchangeService service = (IPfExchangeService)NCLocator.getInstance().lookup(IPfExchangeService.class); + Map Hid_ts = new HashMap(); + Map Bid_ts = new HashMap(); + String[] orderhidts = info.getInfo()[0].getHids(); + String[] orderhids = new String[orderhidts.length]; + + for(int i = 0; i < orderhidts.length; ++i) { + String[] pkts = orderhidts[i].split(","); + Hid_ts.put(pkts[0], new UFDateTime(pkts[1])); + orderhids[i] = pkts[0]; + } + + Set pk_receiveplans = new HashSet(); + String[] orderbidts = info.getInfo()[0].getBids(); + String[] orderbids = new String[orderbidts.length]; + + for(int i = 0; i < orderbidts.length; ++i) { + String[] pkts = orderbidts[i].split(","); + String pk = pkts[0].contains("@") ? pkts[0].split("@")[0] : pkts[0]; + if (pkts[0].contains("@")) { + pk_receiveplans.add(pkts[0].split("@")[1]); + } + + Bid_ts.put(pk, new UFDateTime(pkts[1])); + orderbids[i] = pk; + } + + IQueryScheme scheme = this.getScheme("0001Z810000000070SFL", "query21", "order", "po_order_b", "pk_order_b", orderbids); + IOrderQueryFor45 queryService = (IOrderQueryFor45)NCLocator.getInstance().lookup(IOrderQueryFor45.class); + String isretflag = info.getInfo()[0].getIsretflag(); + OrderVO[] ordervos = null; + if (isretflag != null && isretflag.equals("true")) { + scheme.put("all_condition", new HashMap()); + ordervos = queryService.queryFor45Return(scheme); + } else { + ordervos = queryService.queryFor45Pull(scheme); + } + + if (null == ordervos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(OrderVO ordervo : ordervos) { + ordervo.getHVO().setTs((UFDateTime)Hid_ts.get(ordervo.getHVO().getPk_order())); + OrderItemVO[] bodys = ordervo.getBVO(); + List bodyLists = new ArrayList(); + + for(OrderItemVO body : bodys) { + if (body.getPk_receiveplan() != null && !"".equals(body.getPk_receiveplan())) { + if (pk_receiveplans.contains(body.getPk_receiveplan())) { + body.setTs((UFDateTime)Bid_ts.get(body.getPk_order_b())); + bodyLists.add(body); + } + } else { + body.setTs((UFDateTime)Bid_ts.get(body.getPk_order_b())); + bodyLists.add(body); + } + } + + ordervo.setBVO((OrderItemVO[])bodyLists.toArray(new OrderItemVO[0])); + } + + PurchaseInVO[] retvos1 = (PurchaseInVO[])service.runChangeDataAryNeedClassify("21", "45", ordervos, (PfParameterVO)null, 2); + if (isretflag != null && isretflag.equals("true")) { + for(PurchaseInVO vo : retvos1) { + vo.getHead().setFreplenishflag(UFBoolean.TRUE); + + for(PurchaseInBodyVO bodyVO : vo.getBodys()) { + bodyVO.setNqtunitnum(MathTool.sub(UFDouble.ZERO_DBL, bodyVO.getNqtunitnum())); + } + } + } + + retvos1 = (PurchaseInVO[])(new TransferSortUtil("vsourcerowno", "vsourcebillcode")).sort(retvos1); + this.setRowNum(retvos1); + return retvos1; + } + + public void setRowNum(PurchaseInVO[] purchaseinvos) { + for(PurchaseInVO purchaseinvo : purchaseinvos) { + PurchaseInBodyVO[] bvos = (PurchaseInBodyVO[])purchaseinvo.getChildrenVO(); + + for(PurchaseInBodyVO bodyvo : bvos) { + bodyvo.setAttributeValue("crowno", (Object)null); + } + + int length = purchaseinvo.getChildrenVO().length; + int[] rowIndex = new int[length]; + + for(int i = 0; i < length; rowIndex[i] = i++) { + } + + SCMRowNoUtils.addLineRowNos(purchaseinvo.getChildrenVO(), "crowno", rowIndex); + } + + } + + public PurchaseInVO[] queryAndVOchangeByIds2(TransferInfo info) throws BusinessException { + IPfExchangeService service = (IPfExchangeService)NCLocator.getInstance().lookup(IPfExchangeService.class); + Map Hid_ts = new HashMap(); + Map Bid_ts = new HashMap(); + String[] arrivehidts = info.getInfo()[0].getHids(); + String[] arrivehids = new String[arrivehidts.length]; + + for(int i = 0; i < arrivehidts.length; ++i) { + String[] pkts = arrivehidts[i].split(","); + Hid_ts.put(pkts[0], new UFDateTime(pkts[1])); + arrivehids[i] = pkts[0]; + } + + String[] arrivebidts = info.getInfo()[0].getBids(); + String[] arrivebids = new String[arrivebidts.length]; + List idList = new ArrayList(); + + for(int i = 0; i < arrivebidts.length; ++i) { + String[] pkts = arrivebidts[i].split(","); + idList.add(pkts[0]); + String pk = pkts[0].contains("@") ? pkts[0].split("@")[0] : pkts[0]; + Bid_ts.put(pk, new UFDateTime(pkts[1])); + arrivebids[i] = pk; + } + + IQueryScheme scheme2 = this.getScheme("0001Z8100000000752W8", "query23", "arrive", "po_arriveorder_b", "pk_arriveorder_b", arrivebids); + IQuery23For45 queryService2 = (IQuery23For45)NCLocator.getInstance().lookup(IQuery23For45.class); + ArriveVO[] arrivevos = queryService2.queryArrive(scheme2); + if (null == arrivevos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(ArriveVO vo : arrivevos) { + List bVOList = new ArrayList(); + + for(ArriveItemVO bVO : vo.getBVO()) { + if (idList.contains(bVO.getPk_arriveorder_b())) { + bVOList.add(bVO); + } else { + String var10001 = bVO.getPk_arriveorder_b(); + if (idList.contains(var10001 + "@" + bVO.getPk_checkdetail())) { + bVOList.add(bVO); + } + } + } + + vo.setBVO((ArriveItemVO[])bVOList.toArray(new ArriveItemVO[bVOList.size()])); + } + + for(ArriveVO arrivevo : arrivevos) { + arrivevo.getHVO().setTs((UFDateTime)Hid_ts.get(arrivevo.getHVO().getPk_arriveorder())); + ArriveItemVO[] bodys = arrivevo.getBVO(); + + for(ArriveItemVO body : bodys) { + body.setTs((UFDateTime)Bid_ts.get(body.getPk_arriveorder_b())); + } + } + + PurchaseInVO[] retvos2 = (PurchaseInVO[])service.runChangeDataAryNeedClassify("23", "45", arrivevos, (PfParameterVO)null, 2); + retvos2 = (PurchaseInVO[])(new TransferSortUtil("vsourcerowno", "vsourcebillcode")).sort(retvos2); + return retvos2; + } + + public SubcontInVO[] queryAndVOchangeByPKs(TransferInfo infos) throws BusinessException { + IPfExchangeService service = (IPfExchangeService)NCLocator.getInstance().lookup(IPfExchangeService.class); + Map Hid_ts = new HashMap(); + Map Bid_ts = new HashMap(); + String[] arrivehidts = infos.getInfo()[0].getHids(); + String[] arrivehids = new String[arrivehidts.length]; + + for(int i = 0; i < arrivehidts.length; ++i) { + String[] pkts = arrivehidts[i].split(","); + Hid_ts.put(pkts[0], new UFDateTime(pkts[1])); + arrivehids[i] = pkts[0]; + } + + String[] arrivebidts = infos.getInfo()[0].getBids(); + String[] arrivebids = new String[arrivebidts.length]; + + for(int i = 0; i < arrivebidts.length; ++i) { + String[] pkts = arrivebidts[i].split(","); + String pk = pkts[0].contains("@") ? pkts[0].split("@")[0] : pkts[0]; + Bid_ts.put(pk, new UFDateTime(pkts[1])); + arrivebids[i] = pk; + } + + IQueryScheme scheme2 = this.getScheme("0001Z8100000000757KN", "ref23Query", "arrive2", "po_arriveorder_b", "pk_arriveorder_b", arrivebids); + IQuery23For47 queryService2 = (IQuery23For47)NCLocator.getInstance().lookup(IQuery23For47.class); + ArriveVO[] arrivevos = queryService2.queryArrive(scheme2); + if (null == arrivevos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(ArriveVO arrivevo : arrivevos) { + arrivevo.getHVO().setTs((UFDateTime)Hid_ts.get(arrivevo.getHVO().getPk_arriveorder())); + ArriveItemVO[] bodys = arrivevo.getBVO(); + + for(ArriveItemVO body : bodys) { + body.setTs((UFDateTime)Bid_ts.get(body.getPk_arriveorder_b())); + } + } + + Map Hid_ts1 = new HashMap(); + Map Bid_ts1 = new HashMap(); + String[] orderhidts = infos.getInfo()[1].getHids(); + String[] orderhids = new String[orderhidts.length]; + + for(int i = 0; i < orderhidts.length; ++i) { + String[] pkts = orderhidts[i].split(","); + Hid_ts1.put(pkts[0], new UFDateTime(pkts[1])); + orderhids[i] = pkts[0]; + } + + String[] orderbidts = infos.getInfo()[1].getBids(); + String[] orderbids = new String[orderbidts.length]; + + for(int i = 0; i < orderbidts.length; ++i) { + String[] pkts = orderbidts[i].split(","); + Bid_ts1.put(pkts[0], new UFDateTime(pkts[1])); + orderbids[i] = pkts[0]; + } + + IQueryScheme scheme = this.getScheme("0001Z8100000000757SA", "query61", "scordervo", "sc_order_b", "pk_order_b", orderbids); + ISCOrderFor47Ref queryService = (ISCOrderFor47Ref)NCLocator.getInstance().lookup(ISCOrderFor47Ref.class); + SCOrderVO[] scordervos = queryService.query(scheme); + if (null == scordervos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(SCOrderVO scordervo : scordervos) { + scordervo.getParentVO().setTs((UFDateTime)Hid_ts1.get(scordervo.getParentVO().getPk_order())); + SCOrderItemVO[] bodys = scordervo.getChildrenVO(); + + for(SCOrderItemVO body : bodys) { + body.setTs((UFDateTime)Bid_ts1.get(body.getPk_order_b())); + } + } + + SubcontInVO[] retvos1 = (SubcontInVO[])service.runChangeDataAryNeedClassify("61", "47", scordervos, (PfParameterVO)null, 2); + SubcontInVO[] retvos2 = (SubcontInVO[])service.runChangeDataAryNeedClassify("23", "47", arrivevos, (PfParameterVO)null, 2); + SubcontInVO[] retvos = new SubcontInVO[retvos1.length + retvos2.length]; + System.arraycopy(retvos1, 0, retvos, 0, retvos1.length); + System.arraycopy(retvos2, 0, retvos, retvos1.length, retvos2.length); + retvos = (SubcontInVO[])(new TransferSortUtil("vsourcerowno", "vsourcebillcode")).sort(retvos); + return retvos; + } + + public SubcontInVO[] queryAndVOchangeByPKs1(TransferInfo infos) throws BusinessException { + IPfExchangeService service = (IPfExchangeService)NCLocator.getInstance().lookup(IPfExchangeService.class); + Map Hid_ts = new HashMap(); + Map Bid_ts = new HashMap(); + String[] arrivehidts = infos.getInfo()[0].getHids(); + String[] arrivehids = new String[arrivehidts.length]; + + for(int i = 0; i < arrivehidts.length; ++i) { + String[] pkts = arrivehidts[i].split(","); + Hid_ts.put(pkts[0], new UFDateTime(pkts[1])); + arrivehids[i] = pkts[0]; + } + + String[] arrivebidts = infos.getInfo()[0].getBids(); + String[] arrivebids = new String[arrivebidts.length]; + + for(int i = 0; i < arrivebidts.length; ++i) { + String[] pkts = arrivebidts[i].split(","); + Bid_ts.put(pkts[0], new UFDateTime(pkts[1])); + arrivebids[i] = pkts[0]; + } + + IQueryScheme scheme2 = this.getScheme("0001Z8100000000757KN", "ref23Query", "arrive2", "po_arriveorder_b", "pk_arriveorder_b", arrivebids); + IQuery23For47 queryService2 = (IQuery23For47)NCLocator.getInstance().lookup(IQuery23For47.class); + ArriveVO[] arrivevos = queryService2.queryArrive(scheme2); + if (null == arrivevos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(ArriveVO arrivevo : arrivevos) { + arrivevo.getHVO().setTs((UFDateTime)Hid_ts.get(arrivevo.getHVO().getPk_arriveorder())); + ArriveItemVO[] bodys = arrivevo.getBVO(); + + for(ArriveItemVO body : bodys) { + body.setTs((UFDateTime)Bid_ts.get(body.getPk_arriveorder_b())); + } + } + + SubcontInVO[] retvos1 = (SubcontInVO[])service.runChangeDataAryNeedClassify("23", "47", arrivevos, (PfParameterVO)null, 2); + retvos1 = (SubcontInVO[])(new TransferSortUtil("vsourcerowno", "vsourcebillcode")).sort(retvos1); + return retvos1; + } + + public SubcontInVO[] queryAndVOchangeByPKs2(TransferInfo infos) throws BusinessException { + IPfExchangeService service = (IPfExchangeService)NCLocator.getInstance().lookup(IPfExchangeService.class); + Map Hid_ts = new HashMap(); + Map Bid_ts = new HashMap(); + String[] orderhidts = infos.getInfo()[0].getHids(); + String[] orderhids = new String[orderhidts.length]; + + for(int i = 0; i < orderhidts.length; ++i) { + String[] pkts = orderhidts[i].split(","); + Hid_ts.put(pkts[0], new UFDateTime(pkts[1])); + orderhids[i] = pkts[0]; + } + + String[] orderbidts = infos.getInfo()[0].getBids(); + String[] orderbids = new String[orderbidts.length]; + + for(int i = 0; i < orderbidts.length; ++i) { + String[] pkts = orderbidts[i].split(","); + Bid_ts.put(pkts[0], new UFDateTime(pkts[1])); + orderbids[i] = pkts[0]; + } + + String isretflag = infos.getInfo()[0].getIsretflag(); + IQueryScheme scheme = this.getScheme("0001Z8100000000757SA", "query61", "scordervo", "sc_order_b", "pk_order_b", orderbids); + ISCOrderFor47Ref queryService = (ISCOrderFor47Ref)NCLocator.getInstance().lookup(ISCOrderFor47Ref.class); + SCOrderVO[] scordervos = null; + if (isretflag != null && isretflag.equals("true")) { + scordervos = queryService.queryForRet(scheme); + } else { + scordervos = queryService.query(scheme); + } + + if (null == scordervos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(SCOrderVO scordervo : scordervos) { + scordervo.getParentVO().setTs((UFDateTime)Hid_ts.get(scordervo.getParentVO().getPk_order())); + SCOrderItemVO[] bodys = scordervo.getChildrenVO(); + + for(SCOrderItemVO body : bodys) { + body.setTs((UFDateTime)Bid_ts.get(body.getPk_order_b())); + } + } + + SubcontInVO[] retvos1 = (SubcontInVO[])service.runChangeDataAryNeedClassify("61", "47", scordervos, (PfParameterVO)null, 2); + if (isretflag != null && isretflag.equals("true")) { + for(SubcontInVO retvos : retvos1) { + retvos.getHead().setFreplenishflag(UFBoolean.TRUE); + SubcontInBodyVO[] subbodys = retvos.getBodys(); + + for(SubcontInBodyVO bodyvo : subbodys) { + if (NCBaseTypeUtils.isGtZero(bodyvo.getNnum())) { + bodyvo.setNnum(NCBaseTypeUtils.negUFDouble(bodyvo.getNnum())); + bodyvo.setNassistnum(NCBaseTypeUtils.negUFDouble(bodyvo.getNassistnum())); + } + + if (NCBaseTypeUtils.isGtZero(bodyvo.getNshouldnum())) { + bodyvo.setNshouldnum(NCBaseTypeUtils.negUFDouble(bodyvo.getNshouldnum())); + bodyvo.setNshouldassistnum(NCBaseTypeUtils.negUFDouble(bodyvo.getNshouldassistnum())); + } + } + } + } + + retvos1 = (SubcontInVO[])(new TransferSortUtil("vsourcerowno", "vsourcebillcode")).sort(retvos1); + return retvos1; + } + + public TransInVO[] queryAndVOchange(TransferInfo info) throws BusinessException { + long time1 = System.currentTimeMillis(); + IPfExchangeService service = (IPfExchangeService)NCLocator.getInstance().lookup(IPfExchangeService.class); + Map Hid_ts = new HashMap(); + Map Bid_ts = new HashMap(); + String[] arrivehidts = info.getInfo()[0].getHids(); + String[] arrivehids = new String[arrivehidts.length]; + + for(int i = 0; i < arrivehidts.length; ++i) { + String[] pkts = arrivehidts[i].split(","); + Hid_ts.put(pkts[0], new UFDateTime(pkts[1])); + arrivehids[i] = pkts[0]; + } + + String[] arrivebidts = info.getInfo()[0].getBids(); + String[] arrivebids = new String[arrivebidts.length]; + + for(int i = 0; i < arrivebidts.length; ++i) { + String[] pkts = arrivebidts[i].split(","); + Bid_ts.put(pkts[0], new UFDateTime(pkts[1])); + arrivebids[i] = pkts[0]; + } + + IQueryScheme scheme = this.getScheme("0001Z8100000000753AN", "query4Y", "transout", "ic_transout_b", "cgeneralbid", arrivebids); + long time2 = System.currentTimeMillis(); + ITransOutRefQuery queryService = (ITransOutRefQuery)NCLocator.getInstance().lookup(ITransOutRefQuery.class); + TransOutVO[] transoutvos = queryService.queryBillsFor4E(scheme); + long time3 = System.currentTimeMillis(); + if (null == transoutvos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(TransOutVO transoutvo : transoutvos) { + transoutvo.getParentVO().setTs((UFDateTime)Hid_ts.get(transoutvo.getHead().getCgeneralhid())); + TransOutBodyVO[] bodys = transoutvo.getBodys(); + + for(TransOutBodyVO body : bodys) { + body.setTs((UFDateTime)Bid_ts.get(body.getCgeneralbid())); + } + } + + long time4 = System.currentTimeMillis(); + TransInVO[] retvos2 = (TransInVO[])service.runChangeDataAryNeedClassify("4Y", "4E", transoutvos, (PfParameterVO)null, 2); + long time5 = System.currentTimeMillis(); + Logger.error("time1 查询方案:" + (time2 - time1) + ",查询上游单据:" + (time3 - time2) + ",循环设置ts:" + (time4 - time3) + ",转单:" + (time5 - time4)); + retvos2 = (TransInVO[])(new TransferSortUtil("vsourcerowno", "vsourcebillcode")).sort(retvos2); + return retvos2; + } + + public AssetInVO[] queryAndVOchangefor4401(TransferInfo info) { + IPfExchangeService service = (IPfExchangeService)NCLocator.getInstance().lookup(IPfExchangeService.class); + Map Hid_ts = new HashMap(); + Map Bid_ts = new HashMap(); + String[] hidts = info.getInfo()[0].getHids(); + String[] hids = new String[hidts.length]; + + for(int i = 0; i < hidts.length; ++i) { + String[] pkts = hidts[i].split(","); + Hid_ts.put(pkts[0], new UFDateTime(pkts[1])); + hids[i] = pkts[0]; + } + + String[] bidts = info.getInfo()[0].getBids(); + String[] bids = new String[bidts.length]; + + for(int i = 0; i < bidts.length; ++i) { + String[] pkts = bidts[i].split(","); + Bid_ts.put(pkts[0], new UFDateTime(pkts[1])); + bids[i] = pkts[0]; + } + + AssetInVO[] retvos2 = null; + VOQuery headquery2 = null; + VOQuery bodyquery2 = null; + StringBuilder errorMessag = new StringBuilder(); + if ("4A33".equals(info.getInfo()[0].getCbilltype())) { + headquery2 = new VOQuery(DeployOutHeadVO.class); + bodyquery2 = new VOQuery(DeployOutBodyVO.class); + DeployOutHeadVO[] arriveheadvos = (DeployOutHeadVO[])headquery2.query(hids); + if (null == arriveheadvos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(DeployOutHeadVO arriveheadvo : arriveheadvos) { + arriveheadvo.setTs((UFDateTime)Hid_ts.get(arriveheadvo.getPk_redeploy_out())); + } + + DeployOutBodyVO[] arrivebodyvos = (DeployOutBodyVO[])bodyquery2.query(bids); + if (null == arrivebodyvos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(DeployOutBodyVO arrivebodyvo : arrivebodyvos) { + arrivebodyvo.setTs((UFDateTime)Bid_ts.get(arrivebodyvo.getPk_redeploy_out_b())); + } + + DeployOutVO[] arrivevos = new DeployOutVO[arriveheadvos.length]; + + for(int i = 0; i < arriveheadvos.length; ++i) { + DeployOutVO vo = new DeployOutVO(); + List ownbodys = new ArrayList(); + vo.setParent(arriveheadvos[i]); + + for(DeployOutBodyVO bodyvo : arrivebodyvos) { + if (bodyvo.getPk_redeploy_out().equals(arriveheadvos[i].getPk_redeploy_out())) { + ownbodys.add(bodyvo); + } + } + + vo.setChildrenVO((CircularlyAccessibleValueObject[])ownbodys.toArray(new DeployOutBodyVO[ownbodys.size()])); + arrivevos[i] = vo; + } + + try { + retvos2 = (AssetInVO[])service.runChangeDataAryNeedClassify("4A33", "4401", arrivevos, (PfParameterVO)null, 2); + if (retvos2 == null || retvos2.length == 0) { + errorMessag.append(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0518")); + + for(DeployOutHeadVO vo : arriveheadvos) { + errorMessag.append(vo.getBill_code() + ","); + } + } + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + } else if ("4A47".equals(info.getInfo()[0].getCbilltype())) { + headquery2 = new VOQuery(DeployUsedOutHeadVO.class); + bodyquery2 = new VOQuery(DeployUsedOutBodyVO.class); + DeployUsedOutHeadVO[] arriveheadvos = (DeployUsedOutHeadVO[])headquery2.query(hids); + if (null == arriveheadvos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(DeployUsedOutHeadVO arriveheadvo : arriveheadvos) { + arriveheadvo.setTs((UFDateTime)Hid_ts.get(arriveheadvo.getPk_redeploy_out())); + } + + DeployUsedOutBodyVO[] arrivebodyvos = (DeployUsedOutBodyVO[])bodyquery2.query(bids); + + for(DeployUsedOutBodyVO arrivebodyvo : arrivebodyvos) { + arrivebodyvo.setTs((UFDateTime)Bid_ts.get(arrivebodyvo.getPk_redeploy_out_b())); + } + + DeployUsedOutVO[] arrivevos = new DeployUsedOutVO[arriveheadvos.length]; + + for(int i = 0; i < arriveheadvos.length; ++i) { + DeployUsedOutVO vo = new DeployUsedOutVO(); + List ownbodys = new ArrayList(); + vo.setParent(arriveheadvos[i]); + + for(DeployUsedOutBodyVO bodyvo : arrivebodyvos) { + if (bodyvo.getPk_redeploy_out().equals(arriveheadvos[i].getPk_redeploy_out())) { + ownbodys.add(bodyvo); + } + } + + vo.setChildrenVO((CircularlyAccessibleValueObject[])ownbodys.toArray(new DeployUsedOutBodyVO[ownbodys.size()])); + arrivevos[i] = vo; + } + + try { + retvos2 = (AssetInVO[])service.runChangeDataAryNeedClassify("4A47", "4401", arrivevos, (PfParameterVO)null, 2); + if (retvos2 == null || retvos2.length == 0) { + errorMessag.append(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0519")); + + for(DeployUsedOutHeadVO vo : arriveheadvos) { + errorMessag.append(vo.getBill_code() + ","); + } + } + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + } else if ("4A17".equals(info.getInfo()[0].getCbilltype())) { + headquery2 = new VOQuery(ReturnHeadVO.class); + bodyquery2 = new VOQuery(ReturnBodyVO.class); + ReturnHeadVO[] arriveheadvos = (ReturnHeadVO[])headquery2.query(hids); + if (null == arriveheadvos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(ReturnHeadVO arriveheadvo : arriveheadvos) { + arriveheadvo.setTs((UFDateTime)Hid_ts.get(arriveheadvo.getPk_borrow())); + } + + ReturnBodyVO[] arrivebodyvos = (ReturnBodyVO[])bodyquery2.query(bids); + + for(ReturnBodyVO arrivebodyvo : arrivebodyvos) { + arrivebodyvo.setTs((UFDateTime)Bid_ts.get(arrivebodyvo.getPk_borrow_b())); + } + + ReturnVO[] arrivevos = new ReturnVO[arriveheadvos.length]; + + for(int i = 0; i < arriveheadvos.length; ++i) { + ReturnVO vo = new ReturnVO(); + List ownbodys = new ArrayList(); + vo.setParent(arriveheadvos[i]); + + for(ReturnBodyVO bodyvo : arrivebodyvos) { + if (bodyvo.getPk_borrow().equals(arriveheadvos[i].getPk_borrow())) { + ownbodys.add(bodyvo); + } + } + + vo.setChildrenVO((CircularlyAccessibleValueObject[])ownbodys.toArray(new ReturnBodyVO[ownbodys.size()])); + arrivevos[i] = vo; + } + + try { + retvos2 = (AssetInVO[])service.runChangeDataAryNeedClassify("4A17", "4401", arrivevos, (PfParameterVO)null, 2); + if (retvos2 == null || retvos2.length == 0) { + errorMessag.append(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0520")); + + for(ReturnHeadVO vo : arriveheadvos) { + errorMessag.append(vo.getBill_code() + ","); + } + } + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + } else if ("4A16".equals(info.getInfo()[0].getCbilltype())) { + headquery2 = new VOQuery(nc.vo.aum.assign.restore.ReturnHeadVO.class); + bodyquery2 = new VOQuery(nc.vo.aum.assign.restore.ReturnBodyVO.class); + nc.vo.aum.assign.restore.ReturnHeadVO[] arriveheadvos = (nc.vo.aum.assign.restore.ReturnHeadVO[])headquery2.query(hids); + if (null == arriveheadvos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(nc.vo.aum.assign.restore.ReturnHeadVO arriveheadvo : arriveheadvos) { + arriveheadvo.setTs((UFDateTime)Hid_ts.get(arriveheadvo.getPk_assign())); + } + + nc.vo.aum.assign.restore.ReturnBodyVO[] arrivebodyvos = (nc.vo.aum.assign.restore.ReturnBodyVO[])bodyquery2.query(bids); + if (null == arrivebodyvos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(nc.vo.aum.assign.restore.ReturnBodyVO arrivebodyvo : arrivebodyvos) { + arrivebodyvo.setTs((UFDateTime)Bid_ts.get(arrivebodyvo.getPk_assign_b())); + } + + nc.vo.aum.assign.restore.ReturnVO[] arrivevos = new nc.vo.aum.assign.restore.ReturnVO[arriveheadvos.length]; + + for(int i = 0; i < arriveheadvos.length; ++i) { + nc.vo.aum.assign.restore.ReturnVO vo = new nc.vo.aum.assign.restore.ReturnVO(); + List ownbodys = new ArrayList(); + vo.setParent(arriveheadvos[i]); + + for(nc.vo.aum.assign.restore.ReturnBodyVO bodyvo : arrivebodyvos) { + if (bodyvo.getPk_assign().equals(arriveheadvos[i].getPk_assign())) { + ownbodys.add(bodyvo); + } + } + + vo.setChildrenVO((CircularlyAccessibleValueObject[])ownbodys.toArray(new nc.vo.aum.assign.restore.ReturnBodyVO[ownbodys.size()])); + arrivevos[i] = vo; + } + + try { + retvos2 = (AssetInVO[])service.runChangeDataAryNeedClassify("4A16", "4401", arrivevos, (PfParameterVO)null, 2); + if (retvos2 == null || retvos2.length == 0) { + errorMessag.append(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0521")); + + for(nc.vo.aum.assign.restore.ReturnHeadVO vo : arriveheadvos) { + errorMessag.append(vo.getBill_code() + ","); + } + } + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + } else if ("4A09".equals(info.getInfo()[0].getCbilltype())) { + headquery2 = new VOQuery(FreezeHeadVO.class); + bodyquery2 = new VOQuery(FreezeBodyVO.class); + FreezeHeadVO[] arriveheadvos = (FreezeHeadVO[])headquery2.query(hids); + if (null == arriveheadvos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(FreezeHeadVO arriveheadvo : arriveheadvos) { + arriveheadvo.setTs((UFDateTime)Hid_ts.get(arriveheadvo.getPk_freeze())); + } + + FreezeBodyVO[] arrivebodyvos = (FreezeBodyVO[])bodyquery2.query(bids); + if (null == arrivebodyvos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(FreezeBodyVO arrivebodyvo : arrivebodyvos) { + arrivebodyvo.setTs((UFDateTime)Bid_ts.get(arrivebodyvo.getPk_freeze_b())); + } + + FreezeVO[] arrivevos = new FreezeVO[arriveheadvos.length]; + + for(int i = 0; i < arriveheadvos.length; ++i) { + FreezeVO vo = new FreezeVO(); + List ownbodys = new ArrayList(); + vo.setParent(arriveheadvos[i]); + + for(FreezeBodyVO bodyvo : arrivebodyvos) { + if (bodyvo.getPk_freeze().equals(arriveheadvos[i].getPk_freeze())) { + ownbodys.add(bodyvo); + } + } + + vo.setChildrenVO((CircularlyAccessibleValueObject[])ownbodys.toArray(new FreezeBodyVO[ownbodys.size()])); + arrivevos[i] = vo; + } + + retvos2 = (AssetInVO[])PfServiceScmUtil.executeVOChange("4A09", "4401", arrivevos); + if (retvos2 == null || retvos2.length == 0) { + errorMessag.append(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0522")); + + for(FreezeHeadVO vo : arriveheadvos) { + errorMessag.append(vo.getBill_code() + ","); + } + } + } else if ("4A19".equals(info.getInfo()[0].getCbilltype())) { + headquery2 = new VOQuery(DisusedHeadVO.class); + bodyquery2 = new VOQuery(DisusedBodyVO.class); + DisusedHeadVO[] arriveheadvos = (DisusedHeadVO[])headquery2.query(hids); + if (null == arriveheadvos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(DisusedHeadVO arriveheadvo : arriveheadvos) { + arriveheadvo.setTs((UFDateTime)Hid_ts.get(arriveheadvo.getPk_reduce())); + } + + DisusedBodyVO[] arrivebodyvos = (DisusedBodyVO[])bodyquery2.query(bids); + if (null == arrivebodyvos) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(DisusedBodyVO arrivebodyvo : arrivebodyvos) { + arrivebodyvo.setTs((UFDateTime)Bid_ts.get(arrivebodyvo.getPk_reduce_b())); + } + + DisusedVO[] arrivevos = new DisusedVO[arriveheadvos.length]; + + for(int i = 0; i < arriveheadvos.length; ++i) { + DisusedVO vo = null; + + try { + vo = new DisusedVO(); + } catch (MetaDataException e) { + ExceptionUtils.wrappException(e); + } + + List ownbodys = new ArrayList(); + vo.setParent(arriveheadvos[i]); + + for(DisusedBodyVO bodyvo : arrivebodyvos) { + if (bodyvo.getPk_reduce().equals(arriveheadvos[i].getPk_reduce())) { + ownbodys.add(bodyvo); + } + } + + vo.setChildrenVO((CircularlyAccessibleValueObject[])ownbodys.toArray(new DisusedBodyVO[ownbodys.size()])); + arrivevos[i] = vo; + } + + try { + retvos2 = (AssetInVO[])service.runChangeDataAryNeedClassify("4A19", "4401", arrivevos, (PfParameterVO)null, 2); + if (retvos2 == null || retvos2.length == 0) { + errorMessag.append(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0523")); + + for(DisusedHeadVO vo : arriveheadvos) { + errorMessag.append(vo.getBill_code() + ","); + } + } + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + } else if ("4A25".equals(info.getInfo()[0].getCbilltype())) { + headquery2 = new VOQuery(LeaseInHeadVO.class); + bodyquery2 = new VOQuery(LeaseInBodyVO.class); + LeaseInHeadVO[] leaseInHeadVOs = (LeaseInHeadVO[])headquery2.query(hids); + if (null == leaseInHeadVOs) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(LeaseInHeadVO leaseInHeadVO : leaseInHeadVOs) { + leaseInHeadVO.setTs((UFDateTime)Hid_ts.get(leaseInHeadVO.getPk_lease_in())); + } + + LeaseInBodyVO[] LeaseInBodyVOs = (LeaseInBodyVO[])bodyquery2.query(bids); + if (null == LeaseInBodyVOs) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(LeaseInBodyVO LeaseInBodyVO : LeaseInBodyVOs) { + LeaseInBodyVO.setTs((UFDateTime)Bid_ts.get(LeaseInBodyVO.getPk_lease_in_b())); + } + + AggLeaseInVO[] aggLeaseInVO = new AggLeaseInVO[leaseInHeadVOs.length]; + + for(int i = 0; i < leaseInHeadVOs.length; ++i) { + AggLeaseInVO vo = null; + vo = new AggLeaseInVO(); + List ownbodys = new ArrayList(); + vo.setParent(leaseInHeadVOs[i]); + + for(LeaseInBodyVO bodyvo : LeaseInBodyVOs) { + if (bodyvo.getPk_lease_in().equals(leaseInHeadVOs[i].getPk_lease_in())) { + ownbodys.add(bodyvo); + } + } + + vo.setChildrenVO((CircularlyAccessibleValueObject[])ownbodys.toArray(new LeaseInBodyVO[ownbodys.size()])); + aggLeaseInVO[i] = vo; + } + + try { + retvos2 = (AssetInVO[])service.runChangeDataAryNeedClassify("4A25", "4401", aggLeaseInVO, (PfParameterVO)null, 2); + if (retvos2 == null || retvos2.length == 0) { + errorMessag.append(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0524")); + + for(LeaseInHeadVO vo : leaseInHeadVOs) { + errorMessag.append(vo.getBill_code() + ","); + } + } + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + } else if ("4A29".equals(info.getInfo()[0].getCbilltype())) { + headquery2 = new VOQuery(LeaseRestoreHeadVO.class); + bodyquery2 = new VOQuery(LeaseRestoreBodyVO.class); + LeaseRestoreHeadVO[] leaseRestoreHeadVOs = (LeaseRestoreHeadVO[])headquery2.query(hids); + if (null == leaseRestoreHeadVOs) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(LeaseRestoreHeadVO leaseRestoreHeadVO : leaseRestoreHeadVOs) { + leaseRestoreHeadVO.setTs((UFDateTime)Hid_ts.get(leaseRestoreHeadVO.getPk_lease_restore())); + } + + LeaseRestoreBodyVO[] leaseRestoreBodyVOs = (LeaseRestoreBodyVO[])bodyquery2.query(bids); + if (null == leaseRestoreBodyVOs) { + ExceptionUtils.wrappBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0270")); + } + + for(LeaseRestoreBodyVO leaseRestoreBodyVO : leaseRestoreBodyVOs) { + leaseRestoreBodyVO.setTs((UFDateTime)Bid_ts.get(leaseRestoreBodyVO.getPk_lease_restore_b())); + } + + AggLeaseRestoreVO[] aggLeaseRestoreVO = new AggLeaseRestoreVO[leaseRestoreHeadVOs.length]; + + for(int i = 0; i < leaseRestoreHeadVOs.length; ++i) { + AggLeaseRestoreVO vo = new AggLeaseRestoreVO(); + List ownbodys = new ArrayList(); + vo.setParent(leaseRestoreHeadVOs[i]); + + for(LeaseRestoreBodyVO bodyvo : leaseRestoreBodyVOs) { + if (bodyvo.getPk_lease_restore().equals(leaseRestoreHeadVOs[i].getPk_lease_restore())) { + ownbodys.add(bodyvo); + } + } + + vo.setChildrenVO((CircularlyAccessibleValueObject[])ownbodys.toArray(new LeaseRestoreBodyVO[ownbodys.size()])); + aggLeaseRestoreVO[i] = vo; + } + + try { + retvos2 = (AssetInVO[])service.runChangeDataAryNeedClassify("4A29", "4401", aggLeaseRestoreVO, (PfParameterVO)null, 2); + if (retvos2 == null || retvos2.length == 0) { + errorMessag.append(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0525")); + + for(LeaseRestoreHeadVO vo : leaseRestoreHeadVOs) { + errorMessag.append(vo.getBill_code() + ","); + } + } + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + } + + if (retvos2 == null || retvos2.length == 0) { + errorMessag.append(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0526")); + ExceptionUtils.wrappBusinessException(errorMessag.toString()); + } + + retvos2 = (AssetInVO[])(new TransferSortUtil("vsourcerowno", "vsourcebillcode")).sort(retvos2); + return retvos2; + } + + public Map qryIsMaterialSNMng(ICBillVO[] vos) { + ICBillExtendInfoHelper helper = new ICBillExtendInfoHelper(); + Map infos = new HashMap(); + + for(ICBillVO vo : vos) { + new BillVOWithExtendInfo(); + ICBillHeadVO head = vo.getHead(); + ICBillBodyVO[] bodys = vo.getBodys(); + String pk_org = head.getPk_org(); + BillVOWithExtendInfo info = helper.getExtendInfoByBillVO(vo); + info.setBillvo((ICBillVO)null); + + for(ICBillBodyVO body : bodys) { + infos.put(pk_org + body.getCmaterialvid(), info); + } + } + + return infos; + } + + public UFDate qyrICMoudleEnableDate(String pk_org) { + return (new ICModuleManager()).getInitDate(pk_org); + } +}