diff --git a/arap/src/client/nccloud/web/arap/arappub/action/BillSaveCheckAgainAction.java b/arap/src/client/nccloud/web/arap/arappub/action/BillSaveCheckAgainAction.java new file mode 100644 index 0000000..dd37fa3 --- /dev/null +++ b/arap/src/client/nccloud/web/arap/arappub/action/BillSaveCheckAgainAction.java @@ -0,0 +1,85 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nccloud.web.arap.arappub.action; + +import com.alibaba.fastjson.JSON; +import com.hazelcast.internal.json.Json; +import com.hazelcast.internal.json.JsonValue; +import nc.bs.dao.BaseDAO; +import nc.bs.dao.DAOException; +import nc.jdbc.framework.processor.MapListProcessor; +import nccloud.framework.core.json.IJson; +import nccloud.framework.web.action.itf.ICommonAction; +import nccloud.framework.web.container.IRequest; +import nccloud.framework.web.json.JsonFactory; +import nccloud.web.arap.arappub.info.SaveInfo; +import nccloud.web.arap.arappub.util.BillActionUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class BillSaveCheckAgainAction implements ICommonAction { + public BillSaveCheckAgainAction() { + } + + public Object doAction(IRequest request) { + String json = request.read(); + Map maps = JSON.parseObject(json, Map.class); + + + List amounts= (List) maps.get("amounts"); + List accounts= (List) maps.get("accounts"); +// String sql = "SELECT pb.PK_ORG " + +// "FROM ap_payitem pi " + +// "LEFT JOIN ap_paybill pb " + +// "ON pb.PK_PAYBILL = pi.PK_PAYBILL " + +// "WHERE pb.dr = 0 " + +// " AND pi.recaccount = '"+accounts.get(0)+"' AND pi.local_money_de = "+amounts.get(0)+" AND pb.PK_ORG ='"+maps.get("pkorg")+"'" + +// " AND TO_DATE(pb.BILLDATE, 'YYYY-MM-DD HH24:MI:SS') > TO_DATE('"+maps.get("billdata")+"', 'YYYY-MM-DD HH24:MI:SS') - INTERVAL '10' DAY \n" + +// " AND TO_DATE(pb.BILLDATE, 'YYYY-MM-DD HH24:MI:SS') < TO_DATE('"+maps.get("billdata")+"', 'YYYY-MM-DD HH24:MI:SS');"; + String sql = buildQuery(maps, accounts, amounts); + BaseDAO dao = new BaseDAO(); + try { + ArrayList> al = (ArrayList>)dao.executeQuery(sql, new MapListProcessor()); + Map map = new HashMap<>(); + if(al.size() == 0) { + map.put("num",0); + return map; + }else{ + map.put("num",1); + map.put("money",al.get(0).get("local_money_de")); + return map; + } + } catch (DAOException e) { + throw new RuntimeException(e); + } + + } + private String buildQuery(Map maps, List accounts, List amounts) { + StringBuilder conditions = new StringBuilder(); + + // 生成账号和金额的对应条件 + for (int i = 0; i < accounts.size(); i++) { + if (i > 0) { + conditions.append(" OR "); + } + conditions.append("(pi.recaccount = '").append(accounts.get(i)).append("' AND pi.local_money_de = '").append(amounts.get(i)).append("')"); + } + + return "SELECT pb.PK_ORG,pi.local_money_de " + + "FROM ap_payitem pi " + + "LEFT JOIN ap_paybill pb " + + "ON pb.PK_PAYBILL = pi.PK_PAYBILL " + + "WHERE pb.dr = 0 " + + " AND (" + conditions.toString() + ") " + + " AND pb.PK_ORG = '" + maps.get("pkorg") + "' " + + " AND TO_DATE(pb.BILLDATE, 'YYYY-MM-DD HH24:MI:SS') > TO_DATE('" + maps.get("billdata") + "', 'YYYY-MM-DD HH24:MI:SS') - INTERVAL '10' DAY " + + " AND TO_DATE(pb.BILLDATE, 'YYYY-MM-DD HH24:MI:SS') < TO_DATE('" + maps.get("billdata") + "', 'YYYY-MM-DD HH24:MI:SS')"; + } + +} diff --git a/arap/src/client/yyconfig/modules/arap/app/config/authorize/arap_authorize.xml b/arap/src/client/yyconfig/modules/arap/app/config/authorize/arap_authorize.xml new file mode 100644 index 0000000..82295b7 --- /dev/null +++ b/arap/src/client/yyconfig/modules/arap/app/config/authorize/arap_authorize.xml @@ -0,0 +1,2340 @@ + + + + 20060CONFER,20080CONFER + + + arap.billconfer.selfinsert + + arap.billconfer.selfupdate + + arap.billconfer.query + + arap.billconfer.delete + + + + + 20060QOR,20080QOR + + + arap.queryobj.query + + arap.queryobj.getData + + arap.queryobj.rebuild + + arap.queryobj.save + + arap.queryobj.switch + + + + + 20060RIS,20080RIS + + + arap.reportnodeinit.query + + arap.reportnodeinit.delete + + arap.reportnodeinit.getData + + arap.reportnodeinit.initreport + + arap.report.linkQueryProcessOperator + + platform.appregister.appregref + + platform.appregister.menuitemregref + + + + + 20060RBM,20060RBM000,20060RBM001 + + + arap.arappub.isConsolidatedTax + + arap.arappub.deleteAfterEditCalculate + + arap.arappub.linkterm + + arap.arappub.termafterevent + + arap.arappub.termaddrow + + arap.recbill.query + + arap.recbill.cardquery + + arap.recbill.querygridbypks + + arap.recbill.querybypks + + arap.recbill.cardHeadAfterEdit + + arap.recbill.cardBodyAfterEdit + + arap.recbill.initadd + + arap.recbill.addline + + arap.recbill.linkQueryTax + + arap.recbill.querywidget + + cmp.settlementmanagement.settlement.card.index + + riart.ref.fiBillTypeTableRefAction + + arap.arappub.queryBillCardByPK + + arap.arappub.transferquery + + fct.bill.transferquery + + aum.compensation.srccompensation_query + + aum.sale.srcsale_query + + alo.rent.settlerec_query + + arap.closeaccount.getcloseaccountreport + + arap.closeaccount.oncancelcloseAccount + + arap.closeaccount.oncheck + + arap.closeaccount.oncloseaccountover + + arap.closeaccount.querybypkorg + + arap.billverify.varyMoneyConfirm + + arap.gatheringbill.cardheadafteredit + + arap.gatheringbill.cardbodyafteredit + + arap.recbill.recbillexport + + arap.arappub.refund + + arap.arappub.cancelrefund + + arap.arappub.listrefund + + arap.arappub.listcancelrefund + + arap.recbill.arsubtorecbill + + arap.arappub.generate + + arap.arappub.listgenerate + + arap.recbill.invgenerate + + arap.recbill.invlistgenerate + + arap.arappub.billbatchsendsp + + arap.arappub.billbatchcancelsendsp + + arap.recbill.querybulebill + + + arap.initrecbill.query + + arap.initrecbill.cardquery + + arap.initrecbill.delete + + arap.initrecbill.save + + arap.initrecbill.pausetransact + + arap.initrecbill.cancelpausetransact + + arap.initrecbill.querygridbypks + + arap.initrecbill.cardHeadAfterEdit + + arap.initrecbill.cardBodyAfterEdit + + arap.initrecbill.defvalue + + arap.initrecbill.addline + + arap.initrecbill.edit + arap.receivablebill.initrecbill.card.index + + arap.arappub.queryrelatedapp + + + arap.recbillconfer.cardHeadAfterEdit + + arap.recbillconfer.cardBodyAfterEdit + + arap.arappub.save + + arap.arappub.confirm + + arap.arappub.cancelconfirm + + arap.recbillconfer.cardquery + + arap.recbillconfer.cardquery + + arap.arappub.confirmdelete + + arap.arappub.confirmbatchdelete + + arap.recbillconfer.querygridbypks + + arap.recbillconfer.cancelPause + + arap.recbillconfer.copy + + arap.recbillconfer.delete + + arap.recbillconfer.edit + + arap.recbillconfer.initadd + + arap.recbillconfer.insert + + arap.recbillconfer.pause + + arap.recbillconfer.query + + arap.recbillconfer.update + + arap.arappub.cardRefresh + + aol.settle.settle_query + + aol.rent.receiveapply_transferquery + + rom.balancerec.balancerec_query + + aol.lease.expense_query + + arap.arappub.getrelationbill + + arap.arappub.getrelationbill + + arap.arappub.checkRecItemIsEnableDel + + arap.arappub.CheckGenerateInvoiceTimeAction + + arap.arappub.arapItemByPks + + arap.arappub.arapLinkQueryUpBillAtt + + arap.recbill.getTaxRateTotalMapForSSC + + arap.billverify.preVerifyLinkedQuery + + arap.recbill.queryconferwidget + arap.recbillconfer.queryconferwidget + + arap.retention.qryrmcdmoney + + + + + 20060GBM,20060GBM000,20060GBM001 + + + arap.arappub.validatecmp + + arap.arappub.linkinformer + + arap.gatheringbill.query + + arap.gatheringbill.querygridbyids + + arap.gatheringbill.cardquery + + arap.gatheringbill.addline + + arap.gatheringbill.add + + arap.gatheringbill.cardheadafteredit + + arap.gatheringbill.cardbodyafteredit + + arap.gatheringbill.saleordertogather + + arap.gatheringbill.fct2togatherbill + + arap.gatheringbill.arsubtogatherbill + + arap.gatheringbill.cttogatherbill + + arap.gatheringbill.cmH1togatherbill + + arap.gatheringbill.querywidget + + arap.arappub.queryrelatedapp + + arap.arappub.associatesettinfo + + riart.ref.fiBillTypeTableRefAction + + arap.arappub.queryBillCardByPK + + arap.arappub.transferquery + + fct.bill.transferquery + + aol.rent.receiveapply_transferquery + + arap.billverify.varyMoneyConfirm + + arap.recbill.cardHeadAfterEdit + + arap.recbill.cardBodyAfterEdit + + arap.gatheringbill.gatherbillexport + + arap.arappub.refund + + arap.arappub.cancelrefund + + arap.arappub.listrefund + + arap.arappub.listcancelrefund + + arap.arappub.generate + + arap.arappub.listgenerate + + arap.arappub.billbatchsendsp + + arap.arappub.billbatchcancelsendsp + + + arap.arappub.confirmbatchdelete + + arap.confirmgatheringbill.querygridbyids + + arap.confirmgatheringbill.query + + arap.confirmgatheringbill.cardquery + + arap.confirmgatheringbill.cardbodyafteredit + + arap.confirmgatheringbill.cardheadafteredit + + arap.arappub.confirm + + arap.arappub.cancelconfirm + + arap.arappub.confirmdelete + + + arap.initgatheringbill.query + + arap.initgatheringbill.cardquery + + arap.initgatheringbill.delete + + arap.initgatheringbill.save + + arap.initgatheringbill.cardheadafteredit + + arap.initgatheringbill.cardbodyafteredit + + arap.initgatheringbill.initadd + + arap.initgatheringbill.querygridbypks + + arap.initgatheringbill.addline + + arap.initgatheringbill.print + + arap.initgatheringbill.edit + + arap.arappub.releasetoarapsave + + arap.arappub.save + + arap.arappub.edit + + cmp.informerrelease.SscRelease.list.index + + arap.arappub.releasetoarap + + arap.arappub.billsendsp + + arap.arappub.billcancelsendsp + + arap.arappub.arapItemByPks + + arap.arappub.arapLinkQueryUpBillAtt + + arap.billverify.preVerifyLinkedQuery + arap.gatheringbill.queryconferwidget + arap.confirmgatheringbill.queryconferwidget + + + + + 20080PBM,20080PBM000,20080PBM001 + + + arap.arappub.linkterm + + arap.arappub.termafterevent + + arap.arappub.termaddrow + + arap.payablebill.querycard + + arap.payablebill.queryscheme + + arap.payablebill.querygridbyids + + arap.payablebill.defvalue + + arap.payablebill.cardheadafteredit + + arap.payablebill.cardbodyafteredit + + arap.payablebill.querywithpks + + arap.payablebill.querywidget + + arap.arappub.queryrelatedapp + + arap.payablebillpub.addline + + arap.arappub.queryBillCardByPK + + arap.arappub.transferquery + + fct.bill.transferquery + + aum.sale.srcsale_query + + aum.insurance.srcinsurance_query + + aum.install.srcinstall_query + + ali.rent.settlerec_query + + ali.temporary.tempsettle_query + + ali.rent.expenseTransfer_query + + ali.rent.paymentapply_transferquery + + arap.closeaccount.getcloseaccountreport + + arap.closeaccount.oncancelcloseAccount + + arap.closeaccount.oncheck + + arap.closeaccount.oncloseaccountover + + arap.closeaccount.querybypkorg + + arap.billverify.varyMoneyConfirm + + arap.paybill.cardbodyafteredit + + arap.paybill.cardbodyafteredit + + arap.payablebill.payablebillexport + + arap.arappub.generate + + arap.arappub.listgenerate + + arap.arappub.billbatchsendsp + + arap.arappub.billbatchcancelsendsp + + + arap.initpayablebill.delete + + arap.initpayablebill.save + + arap.initpayablebill.querycard + + arap.initpayablebill.queryscheme + + arap.initpayablebill.querygridbyids + + arap.initpayablebill.cardheadafteredit + + arap.initpayablebill.cardbodyafteredit + + arap.initpayablebill.defvalue + + + arap.confirmpayablebill.cardheadafteredit + + arap.confirmpayablebill.cardbodyafteredit + + arap.arappub.save + + arap.arappub.confirm + + arap.arappub.cancelconfirm + + arap.confirmpayablebill.querycard + + arap.arappub.confirmdelete + + arap.arappub.confirmbatchdelete + + arap.confirmpayablebill.queryscheme + + arap.confirmpayablebill.querygridbyids + + arap.arappub.cardRefresh + + arap.arappub.sendeleinvoice + + arap.arappub.arapItemByPks + + arap.arappub.arapLinkQueryUpBillAtt + + arap.billverify.preVerifyLinkedQuery + + arap.payablebill.queryconferwidget + arap.confirmpayablebill.queryconferwidget + + arap.retention.qryrmcdmoney + + + + + 20080EBM,20080EBM000,20080EBM001 + + + arap.arappub.validatecmp + + arap.arappub.linkinformer + + arap.paybill.querycard + + arap.paybill.queryintellectcard + + arap.paybill.querygridbyids + + arap.paybill.queryscheme + + arap.paybill.cardheadafteredit + + arap.paybill.cardbodyafteredit + + arap.paybill.defvalue + + arap.paybill.putopaybill + + arap.paybill.z2topaybill + + arap.paybill.fct1topaybill + + arap.paybill.querywidget + + arap.arappub.queryrelatedapp + + arap.paybillpub.addline + + arap.arappub.queryBillCardByPK + + arap.arappub.transferquery + + fct.bill.transferquery + + cmp.apply.To36D1 + + ali.rent.paymentapply_transferquery + + arap.arappub.commisionpay + + arap.arappub.cancelcommisionpay + + arap.arappub.associatesettinfo + + arap.billverify.varyMoneyConfirm + + arap.payablebill.cardheadafteredit + + arap.payablebill.cardbodyafteredit + + arap.paybill.paybillexport + + arap.arappub.generate + + arap.arappub.listgenerate + + arap.arappub.billbatchsendsp + + arap.arappub.billbatchcancelsendsp + + + arap.initpaybill.delete + + arap.initpaybill.save + + arap.initpaybill.querycard + + arap.initpaybill.querygridbyids + + arap.initpaybill.queryscheme + + arap.initpaybill.cardheadafteredit + + arap.initpaybill.cardbodyafteredit + + arap.initpaybill.defvalue + + + arap.confirmpaybill.querycard + + arap.confirmpaybill.queryscheme + + arap.confirmpaybill.querygridbyids + + arap.confirmpaybill.cardbodyafteredit + + arap.confirmpaybill.cardheadafteredit + + arap.arappub.save + + arap.arappub.confirm + + arap.arappub.cancelconfirm + + arap.arappub.confirmbatchdelete + + arap.arappub.confirmdelete + + arap.arappub.cardRefresh + + arap.arappub.sendeleinvoice + + arap.arappub.releasetoarapsave + + arap.arappub.save + + arap.arappub.edit + + cmp.informerrelease.SscRelease.list.index + + arap.arappub.releasetoarap + + arap.arappub.billsendsp + + arap.arappub.billcancelsendsp + + arap.arappub.arapItemByPks + + arap.arappub.arapLinkQueryUpBillAtt + + arap.billverify.preVerifyLinkedQuery + + arap.paybill.queryconferwidget + arap.confirmpaybill.queryconferwidget + arap.arappub.savecheck + + + + + 20060RBM,20060GBM,20080PBM,20080EBM,20060RBM000,20060RBM001,20060GBM000,20060GBM001,20080PBM000,20080PBM001,20080EBM000,20080EBM001,200805EPB,200805EPB000,200805EPB001 + + + + arap.arappub.batchcommit + + arap.arappub.batchuncommit + + arap.arappub.delete + + arap.arappub.madebill + + arap.arappub.linkconfer + + arap.arappub.queryGridByPK + + arap.arappub.commit + + arap.arappub.uncommit + + arap.arappub.save + + arap.arappub.tempsave + + arap.arappub.saveandcommit + + arap.arappub.edit + + arap.arappub.prepay + + arap.arappub.redback + + arap.arappub.linkvouchar + + arap.arappub.linktbb + + arap.arappub.transfer + + arap.billtype.browse + + arap.arappub.queryallbtns + + arap.arappub.cmpLinkArapList + + arap.arappub.cmpLinkArapCard + + arap.billverify.varyMoney + + arap.arappub.billCanEditProperties + + arap.arappub.sendeleinvoice + + arap.arappub.checkfrozenforedit + + arap.arappub.bodybatchedit + + arap.arappub.getrelationbill + + arap.arappub.billsendsp + + arap.arappub.billcancelsendsp + + arap.arappub.billsendsp + + arap.arappub.billcancelsendsp + + arap.arappub.arapItemByPks + + arap.arappub.arapLinkQueryUpBillAtt + + arap.arappub.arapbillexectallocation + + arap.arappub.querytradetypeaction + + arap.arappub.querytradetypes + + arap.arappub.querylistemptydata + + + + + 20060RBM,20060GBM,20080PBM,20080EBM,20060ARO,20060RO,20080APO,20080PO,200605ERB,20060RBM000,20060RBM001,20060GBM000,20060GBM001,20080PBM000,20080PBM001,20080EBM000,20080EBM001,20060BDPI,200805EPB,20080ESAPO,200805EPB,200805EPB000,200805EPB001 + + + + arap.arappub.batchcommit + + arap.arappub.batchuncommit + + arap.arappub.delete + + arap.arappub.madebill + + arap.arappub.linkconfer + + arap.arappub.queryGridByPK + + arap.arappub.commit + + arap.arappub.uncommit + + arap.arappub.save + + arap.arappub.tempsave + + arap.arappub.saveandcommit + + arap.arappub.edit + + arap.arappub.prepay + + arap.arappub.redback + + arap.arappub.linkvouchar + + arap.arappub.linktbb + + arap.arappub.transfer + + arap.billtype.browse + + arap.arappub.queryallbtns + + arap.arappub.cmpLinkArapList + + arap.arappub.cmpLinkArapCard + + arap.billverify.varyMoney + + arap.arappub.billCanEditProperties + + arap.arappub.arapBillLinkReport + + arap.arappub.linkbal + + arap.arappub.print + + arap.arappub.previewprint + + arap.arappub.outPut + + arap.arappub.officialPrint + + arap.arappub.cancelPrint + + arap.arappub.pause + + arap.arappub.cancelpause + + arap.ref.ratecontrol + + arap.arappub.linkdeal + + arap.arappub.linkarapbill + arap.arappub.linkarapbillnobtn + + arap.arappub.copy + + arap.arappub.linktermsave + + arap.arappub.cardRefresh + + arap.arappub.processImpMoney + + arap.arappub.getBusitypeAndBilldate + + arap.arappub.checkfrozenforedit + + arap.arappub.getrelationbill + + arap.arappub.billsendsp + + arap.arappub.billcancelsendsp + + arap.arappub.arapItemByPks + + arap.arappub.arapLinkQueryUpBillAtt + + arap.arappub.arapbillexectallocation + + + + + 20060ARO + + + arap.initrecbill.query + + arap.initrecbill.cardquery + + arap.initrecbill.delete + + arap.initrecbill.save + + arap.initrecbill.pausetransact + + arap.initrecbill.cancelpausetransact + + arap.initrecbill.querygridbypks + + arap.initrecbill.cardHeadAfterEdit + + arap.initrecbill.cardBodyAfterEdit + + arap.initrecbill.defvalue + + arap.initrecbill.addline + + arap.initrecbill.edit + arap.receivablebill.initrecbill.card.index + + riart.ref.fiBillTypeTableRefAction + + arap.arappub.queryrelatedapp + + arap.arappub.isConsolidatedTax + + arap.recbill.recbillexport + + + + + 20060RO + + + arap.initgatheringbill.query + + arap.initgatheringbill.cardquery + + arap.gatheringbill.cardintellectquery + + arap.initgatheringbill.delete + + arap.initgatheringbill.save + + arap.initgatheringbill.cardheadafteredit + + arap.initgatheringbill.cardbodyafteredit + + arap.initgatheringbill.initadd + + arap.initgatheringbill.querygridbypks + + arap.initgatheringbill.addline + + arap.initgatheringbill.print + + riart.ref.fiBillTypeTableRefAction + + arap.initgatheringbill.edit + + arap.gatheringbill.gatherbillexport + + + + + 20080APO + + + arap.initpayablebill.delete + + arap.initpayablebill.save + + arap.initpayablebill.querycard + + arap.initpayablebill.queryscheme + + arap.initpayablebill.querygridbyids + + arap.initpayablebill.cardheadafteredit + + arap.initpayablebill.cardbodyafteredit + + arap.initpayablebill.defvalue + + arap.payablebillpub.addline + + arap.payablebill.payablebillexport + + + + + 20060ARO,20060RO,20080APO,20080PO,20080ESAPO + + + arap.init.batchdelete + + arap.arappub.linkterm + + arap.arappub.termafterevent + + arap.arappub.termaddrow + + arap.init.edit + + arap.init.close + + arap.init.cancelclose + + arap.arappub.queryallbtns + + arap.retention.qryrmcdmoney + + + + + 20080PO + + + arap.initpaybill.delete + + arap.initpaybill.save + + arap.initpaybill.querycard + + arap.initpaybill.querygridbyids + + arap.initpaybill.queryscheme + + arap.initpaybill.cardheadafteredit + + arap.initpaybill.cardbodyafteredit + + arap.initpaybill.defvalue + + arap.paybillpub.addline + + arap.paybill.paybillexport + + + + + 20080ESAPO + + + arap.initestipayablebill.delete + + arap.initestipayablebill.save + + arap.initestipayablebill.querycard + + arap.initestipayablebill.querygridbyids + + arap.initestipayablebill.queryscheme + + arap.initestipayablebill.cardheadafteredit + + arap.initestipayablebill.cardbodyafteredit + + arap.initestipayablebill.defvalue + + arap.initestipayablebill.addline + + arap.initestipayablebill.estipaybillexport + + arap.arappub.querytradetypeaction + + arap.arappub.querytradetypes + + arap.arappub.querylistemptydata + + + + + 200605ERB + + + arap.estirecbill.query + + arap.estirecbill.querygridbypks + + arap.estirecbill.cardquery + + arap.estirecbill.save + + arap.estirecbill.cancelPause + + arap.estirecbill.pause + + arap.estirecbill.cardBodyAfterEdit + + arap.estirecbill.cardHeadAfterEdit + + arap.arappub.madebill + + arap.arappub.linkconfer + + arap.arappub.linkvouchar + + arap.arappub.linkterm + + arap.arappub.termaddrow + + arap.arappub.termafterevent + + arap.arappub.linktermsave + + arap.arappub.listunapprove + + arap.arappub.listapprove + + arap.arappub.edit + + arap.arappub.approve + + arap.arappub.unapprove + + arap.arappub.delete + + platform.flow.approve + + arap.estireceivable.estirecbill.card.index + + arap.arappub.queryBillCardByPK + + arap.arappub.cardRefresh + + arap.arappub.save + + arap.arappub.queryGridByPK + + arap.arappub.arapItemByPks + + arap.arappub.arapLinkQueryUpBillAtt + + + + + 20060GBC + + + arap.arappub.confirmbatchdelete + + arap.confirmgatheringbill.querygridbyids + + arap.confirmgatheringbill.query + + arap.confirmgatheringbill.cardquery + + arap.confirmgatheringbill.cardbodyafteredit + + arap.confirmgatheringbill.cardheadafteredit + + arap.arappub.confirm + + arap.arappub.cancelconfirm + + arap.arappub.confirmdelete + + arap.arappub.save + + arap.arappub.cardRefresh + + arap.arappub.arapItemByPks + + arap.arappub.arapLinkQueryUpBillAtt + + arap.confirmgatheringbill.queryconferwidget + + + + + 20060CUFT + + + arap.notice.addline + + arap.notice.query + + arap.notice.serch + + arap.notice.cardquery + + arap.notice.insert + + arap.notice.update + + arap.notice.delete + + arap.notice.cardheadafteredit + + arap.notice.cardbodyafteredit + + arap.notice.querygridbypks + + + + + 20060CUFB + + + arap.reminder.print + + arap.reminder.query + + arap.arappub.linkarapbill + arap.arappub.linkarapbillnobtn + + arap.arappub.printGridData + + + + + 20080SPLC + + + arap.confirmpayablebill.cardheadafteredit + + arap.confirmpayablebill.cardbodyafteredit + + arap.arappub.save + + arap.arappub.confirm + + arap.arappub.cancelconfirm + + arap.confirmpayablebill.querycard + + arap.arappub.confirmdelete + + arap.arappub.confirmbatchdelete + + arap.confirmpayablebill.queryscheme + + arap.confirmpayablebill.querygridbyids + + arap.arappub.cardRefresh + + arap.arappub.arapItemByPks + + arap.arappub.arapLinkQueryUpBillAtt + arap.confirmpayablebill.queryconferwidget + + + + + 20082005,20062005 + + + arap.detaillink.ntbquery + + arap.detaillink.glquery + + arap.arappub.linkarapbill + arap.arappub.linkarapbillnobtn + + + + + 200805EPB,20080ESAPO,200805EPB000,200805EPB001 + + + arap.arappub.edit + + arap.arappub.approve + + arap.arappub.unapprove + + arap.arappub.pause + + arap.arappub.cancelpause + + arap.arappub.arapBillLinkReport + + arap.arappub.print + + arap.arappub.previewprint + + arap.arappub.outPut + + arap.arappub.officialPrint + + arap.arappub.cancelPrint + + arap.arappub.linkvouchar + + arap.arappub.linkterm + + arap.arappub.termaddrow + + arap.arappub.termafterevent + + arap.arappub.linktermsave + + arap.arappub.madebill + + arap.estipayablebill.querycard + + arap.estipayablebill.queryscheme + + arap.estipayablebill.querygridbyids + + arap.arappub.save + + arap.arappub.listunapprove + + arap.arappub.listapprove + + arap.arappub.queryBillCardByPK + + arap.arappub.cardRefresh + + arap.arappub.queryGridByPK + + arap.arappub.arapItemByPks + + arap.arappub.arapLinkQueryUpBillAtt + + arap.arappub.queryallbtns + + arap.estipayablebill.defvalue + + arap.initestipayablebill.defvalue + + arap.estipayablebill.cardheadafteredit + + arap.estipayablebill.cardbodyafteredit + + arap.initestipayablebill.cardheadafteredit + + arap.initestipayablebill.cardbodyafteredit + + arap.estipayablebill.billsaveaction + + arap.arappub.commit + + arap.arappub.uncommit + + arap.arappub.tempsave + + arap.arappub.saveandcommit + + arap.estipayablebill.addline + + arap.arappub.batchuncommit + + arap.arappub.copy + + arap.arappub.delete + + arap.arappub.batchcommit + + + + + 20060RBC + + + arap.recbillconfer.cardHeadAfterEdit + + arap.recbillconfer.cardBodyAfterEdit + + arap.arappub.save + + arap.arappub.confirm + + arap.arappub.cancelconfirm + + arap.recbillconfer.cardquery + + arap.recbillconfer.cardquery + + arap.arappub.confirmdelete + + arap.arappub.confirmbatchdelete + + arap.recbillconfer.querygridbypks + + arap.recbillconfer.cancelPause + + arap.recbillconfer.copy + + arap.recbillconfer.delete + + arap.recbillconfer.edit + + arap.recbillconfer.initadd + + arap.recbillconfer.insert + + arap.recbillconfer.pause + + arap.recbillconfer.query + + arap.recbillconfer.update + + arap.arappub.cardRefresh + + arap.arappub.arapItemByPks + + arap.arappub.arapLinkQueryUpBillAtt + + arap.recbillconfer.queryconferwidget + + + + + 20060CRT,20060CRU,20060RCA,20060RCB,20080DT,20080DU,20080PCA,20080PCB + + + + arap.arappub.queryGridByPK + + arap.debtransfer.cancletransfer + + arap.debtransfer.afterchangeRateType + + arap.arappub.printDebtTransferAction + + arap.arappub.outDebtTransferAction + + arap.arappub.linkarapbill + arap.arappub.linkarapbillnobtn + + arap.debtransfer.transfer + + arap.debtransfer.hisRecord + + arap.debtransfer.query + + + + + 20060VQ + + + arap.verifyquery.cancelVerify + + arap.verifyquery.cancelDtlVerify + + arap.arappub.printVerify + + arap.arappub.printVerifyDetail + + arap.verifyquery.query + + arap.verifyfa.setdefault + + arap.verifyfa.canceldefault + + arap.arappub.queryGridByPK + + arap.verifyquery.verifyMainquery + + arap.arappub.linkarapbill + arap.arappub.linkarapbillnobtn + + arap.verifyquery.detailquery + + arap.verifyquery.detailquerybyids + + + + + 101007,20060BCA,20080BCA + + uapbd.org.QueryCloseAccNccAction + uapbd.org.InitBatchCloseAccNccAction + uapbd.org.QueryAccperiodmonth + uapbd.org.BatchAntiCloseAccNccAction + uapbd.org.BatchCloseAccNccAction + uapbd.org.BatchPrecloseAccNccAction + uapbd.org.BatchAntiPrecloseAccAction + + + + + 101006,20060CA,20060TED,20080CA,20080TED + + uapbd.org.CloseaccbookModuleQryAction + uapbd.org.CloseaccbookBodyQryAction + uapbd.org.CloseaccbookPeriodQryAction + uapbd.org.PreCloseAccBookNCCAction + uapbd.org.CloseAccBookNCCAction + uapbd.org.AntiPreCloseAccBookNCCAction + uapbd.org.AntiCloseAccBookNCCAction + uapbd.org.CloseAccCheckNCCAction + uapbd.org.DoCheckCloseAccNCCAction + uapbd.org.QueryCheckItemUrlAction + arap.arappub.checkcloseacc + + arap.closeaccount.querybypkorg + + arap.closeaccount.oncheck + + arap.closeaccount.getcloseaccountreport + + arap.closeaccount.oncancelcloseAccount + + arap.closeaccount.oncloseaccountover + + + + + 20060EPG,20080EPG + + platform.appregister.queryallbtns + + arap.agiotage.onhisrecord + + arap.agiotage.onRecordLinkDetail + + arap.agiotage.oncalculation + + arap.agiotage.onCancelAgiotageForGather + + arap.agiotage.onCancelAgiotage + + arap.arappub.gridOutputExcelAction + + arap.agiotage.oncalbefore + + arap.agiotage.onCurrLinkDetail + + arap.arappub.queryGridByPK + + arap.arappub.agiotagePrintDetail + + + + + 20060EPL + + platform.appregister.queryallbtns + + arap.agiotage.onhisrecord + + arap.agiotage.onRecordLinkDetail + + arap.agiotage.oncalculation + + arap.agiotage.onCancelAgiotageForGather + + arap.agiotage.onCancelAgiotage + + arap.arappub.gridOutputExcelAction + arap.receivablebill.agiotage.sumquery.index + arap.receivablebill.agiotage.calculation.index + + arap.agiotage.onconfirm + + arap.agiotage.initpanel + + arap.agiotage.onCancelAgiotageBySum + + arap.arappub.linkarapbill + arap.arappub.linkarapbillnobtn + + + + + 2006BTED,2008BTED + + platform.appregister.queryallbtns + + arap.batchcloseaccount.query + + arap.batchcloseaccount.getReport + + arap.batchcloseaccount.batchcloseaccount + + arap.batchcloseaccount.batchcancelcloseaccount + + + + + 20061901,20061902,20061903,20061904,20061906,20061907,20061908,20061909,20061910,20061911,20061912,20061913,20061914,20061915,20061916,20061934,20061935,20061933 + + + arap.report.linkQueryProcessOperator + arap.ref.freecustcontrol + arap.arappub.reportLinkBill + arap.report.reportLinkVouchar + arap.report.linkQueryCredit + arap.report.checkSystemStartDate + arap.report.qrydate + + + + + 20081901,20081902,20081903,20081904,20081906,20081907,20081908,20081909,20081910,20081911,20081912,20081913,20081914,20081929,20081930 + + + arap.report.linkQueryProcessOperator + arap.ref.freecustcontrol + arap.arappub.reportLinkBill + arap.report.reportLinkVouchar + arap.report.linkQueryCredit + arap.report.checkSystemStartDate + arap.report.qrydate + + + + + 20062002,20082002,20060RBM,20060RBM000,20060RBM001,20080PBM,20080PBM000,20080PBM001,20060GBM,20060GBM000,20060GBM001,20080EBM,20080EBM000,20080EBM001 + + + arap.billverify.varyMoneyPanel + + arap.arappub.linkarapbill + arap.arappub.linkarapbillnobtn + + arap.arappub.queryallbtns + + arap.billverify.nowVerifyQuery + + arap.billverify.nowVerify + + arap.billverify.varyMoney + + arap.billverify.getbillType + + arap.billverify.varyMoneyConfirm + + arap.payablebill.cardheadafteredit + + arap.ref.ratecontrol + + arap.payablebill.cardbodyafteredit + + arap.billverify.preVerifyLinkingQuery + + arap.billverify.preVerifyLinkedQuery + + arap.billverify.preVerifyLink + + arap.billverify.preVerifyCancelLink + + arap.gatheringbill.cardheadafteredit + + arap.gatheringbill.cardbodyafteredit + + arap.recbill.cardHeadAfterEdit + + arap.recbill.cardBodyAfterEdit + + arap.paybill.cardheadafteredit + + arap.paybill.cardbodyafteredit + + + + + 20062003,20082003 + + + arap.billtype.browse + + + + + 20061905,20081905 + + + arap.arappub.arapStatementQry + + arap.report.printData + + arap.arappub.arapStatementBillLink + arap.arappub.arapStatementTranslateChildGrid + + + + + 20080SPAC + + + arap.confirmpaybill.querycard + + arap.confirmpaybill.queryscheme + + arap.confirmpaybill.querygridbyids + + arap.confirmpaybill.cardbodyafteredit + + arap.confirmpaybill.cardheadafteredit + + arap.arappub.save + + arap.arappub.confirm + + arap.arappub.cancelconfirm + + arap.arappub.confirmbatchdelete + + arap.arappub.confirmdelete + + arap.arappub.cardRefresh + + arap.arappub.arapItemByPks + + arap.arappub.arapLinkQueryUpBillAtt + arap.confirmpaybill.queryconferwidget + + + + + 20080VQ + + + arap.verifyquery.cancelVerify + + arap.verifyquery.cancelDtlVerify + + arap.arappub.printVerify + + arap.arappub.printVerifyDetail + + arap.verifyquery.query + + arap.verifyfa.setdefault + + arap.verifyfa.canceldefault + + arap.arappub.queryGridByPK + + arap.verifyquery.verifyMainquery + + arap.arappub.linkarapbill + arap.arappub.linkarapbillnobtn + + arap.verifyquery.detailquery + + arap.verifyquery.detailquerybyids + + + + + 20080MV,20060MV + + + arap.verifyfa.edit + + arap.verifyfa.afterEvent + + arap.verify.loadVerifyFa + + arap.verify.autoVerify + + arap.verificationsheet.verifyqueryap.list.index + + arap.verify.verify + + arap.arappub.linkarapbill + arap.arappub.linkarapbillnobtn + + arap.verify.query + + arap.verify.selectAll + + + + + 20080VPS,20060VPS + + + arap.verifyfa.afterEvent + + arap.verifyfa.modify + + arap.verifyfa.add + + arap.verifyfa.edit + + arap.verifyfa.setdefault + + arap.verifyfa.canceldefault + + arap.verifyfa.query + + arap.verifyfa.delete + + arap.verifyfa.copyVerifyScheme + + + + + 20080EPL + + arap.payablebill.agiotage.sumquery.index + arap.payablebill.agiotage.calculation.index + platform.appregister.queryallbtns + + arap.agiotage.oncalculation + + arap.agiotage.onCancelAgiotageForGather + + arap.agiotage.onRecordLinkDetail + + arap.agiotage.onCancelAgiotage + + arap.arappub.gridOutputExcelAction + + arap.agiotage.onconfirm + + arap.agiotage.initpanel + + arap.agiotage.onCancelAgiotageBySum + + arap.arappub.linkarapbill + arap.arappub.linkarapbillnobtn + + arap.agiotage.onhisrecord + + + + + + + + + + + + + * + + + arap.arappub.print + + arap.arappub.previewprint + + arap.arappubBusi.print + + arap.ref.freecustcontrol + + arap.paytodowidget.query + + arap.recaccountWidget.query + + arap.rectodowidget.query + + arap.arinternalconfer.query + + arap.apinternalconfer.query + + arap.arappub.queryrelatedapp + platform.appregister.queryappcontext + resources.arap.receivablebill.recbill.main.index + resources.arap.gatheringbill.gatheringbill.main.index.html + + resources.arap.payablebill.payablebill.main.index + resources.arap.paybill.paybill.main.index.html + arap.billtype.browse + + arap.paybill.queryintellectcard + + arap.ref.arapGathingBillRef + + arap.ref.creditRefInfoStdRef + + arap.ref.arapReminderBillRef + + arap.ref.ProvisiondimRef + + arap.ref.BdProVisionRuleRef + + arap.ref.verifyFaRef + + arap.ref.arapTranstypeRef + + arap.ref.arTranstypeRef + + arap.ref.apTranstypeRef + arap.glaccount.transformcard + arap.glaccount.transformvo + arap.arappub.orgclossref + + arap.arappub.ischecknoref + + arap.arappub.checketcforbusi + + arap.arappub.linkarapbill + arap.arappub.linkarapbillnobtn + + arap.arappub.arapQueryAccountBookAction + + arap.ref.ratecontrol + + arap.arappub.querypage + + arap.arappub.ar52qry + + arap.arappub.ar52save + + arap.arappub.transformBillEnclosureQuery + + arap.arappub.arapFileLeftTreeQuery + + arap.arappub.arapExportTree + + arap.arappub.queryModuleEnable + + + arap.arappub.getQuertObjs + + arap.arappub.pubquerycondition + + arap.gatheringbill.cardintellectquery + + + + + 20060BDP,20060BDL,20060BDPI,20060BDR,20060BDA + + + arap.baddebts.edit + + arap.baddebts.save + + arap.baddebts.delete + + arap.baddebts.commit + + arap.baddebts.unCommit + + arap.baddebts.batchCommit + + arap.baddebts.batchUnCommit + + arap.baddebts.madebill + + arap.baddebts.linkvouchar + + arap.baddebts.querypage + + > + arap.report.qrydate + + arap.arappub.checkfrozenforedit + + + + + 20060BDPC,20060BDPG + + + arap.bdprovisionrule.save + + arap.bdprovisionrule.query + + arap.bdprovisionrule.addline + + arap.bdprovisionrule.enableOrStop + + arap.report.qrydate + + + + + 20060PRSG,20060PRSO + + + arap.bdprovisionRatio.save + + arap.bdprovisionRatio.delete + + arap.bdprovisionRatio.edit + + arap.bdprovisionRatio.query + + arap.bdprovisionRatio.querygridbypks + + arap.bdprovisionRatio.querycard + + arap.bdprovisionRatio.versioning + + arap.bdprovisionRatio.cancelversion + + arap.bdprovisionRatio.quicksetupquery + + arap.bdprovisionRatio.cover + + + + + 20060BDP + + + arap.bdprovision.query + + arap.bdprovision.provision + + arap.bdprovision.unProvision + + arap.bdprovision.batchProvision + + arap.bdprovision.batchUnProvision + + arap.bdprovision.querygridbypks + + arap.bdprovision.cardquery + + arap.bdprovision.cardprovision + + arap.bdprovision.cardunprovision + + arap.bdprovision.fiplinklistquery + + arap.bdprovision.fiplinkcardquery + + arap.arappub.checkfrozenforedit + + + + + 20060BDP000 + + + arap.bdprovision.cardquery + + arap.baddebts.madebill + + arap.baddebts.linkvouchar + + arap.baddebts.querypage + + arap.bdprovision.fiplinklistquery + + arap.bdprovision.fiplinkcardquery + + + + + 20060BDPI000 + + + arap.indiprovision.cardquery + + arap.baddebts.madebill + + arap.baddebts.linkvouchar + + arap.baddebts.querypage + + arap.indiprovision.fiplinklistquery + + arap.indiprovision.fiplinkcardquery + + + + + 20060BDR000 + + + arap.bdrecovery.querycard + + arap.baddebts.madebill + + arap.baddebts.linkvouchar + + arap.baddebts.querypage + + arap.bdrecovery.fiplinklistquery + + arap.bdrecovery.fiplinkcardquery + + + + + 20060BDL000 + + + arap.bdloss.cardquery + + arap.baddebts.madebill + + arap.baddebts.linkvouchar + + arap.baddebts.querypage + + arap.bdloss.fiplinklistquery + + arap.bdloss.fiplinkcardquery + + + + + 20060BDL + + + arap.bdloss.query + + arap.bdloss.cardquery + + arap.bdloss.delete + + arap.bdloss.save + + arap.bdloss.querygridbypks + + arap.bdloss.querybdloss + + arap.bdloss.cardbodyafteredit + + arap.bdloss.cardheadafteredit + + arap.bdloss.cardsunbodyafteredit + + arap.bdloss.saveandcommit + + arap.bdloss.fiplinklistquery + + arap.bdloss.fiplinkcardquery + + + + + 20060BDPI + + + arap.indiprovision.query + + arap.indiprovision.querygridbypks + + arap.indiprovision.cardquery + + arap.indiprovision.provision + + arap.indiprovision.addquery + + arap.indiprovision.unProvision + + arap.indiprovision.batchProvision + + arap.indiprovision.batchUnProvision + + arap.indiprovision.cardbodyafteredit + + arap.indiprovision.cardheadafteredit + + arap.indiprovision.save + + arap.indiprovision.cardprovision + + arap.indiprovision.cardunprovision + + arap.indiprovision.fiplinklistquery + + arap.indiprovision.fiplinkcardquery + + arap.indiprovision.saveandcommit + + + + + 20060BDR + + + arap.bdrecovery.save + + arap.bdrecovery.saveandcommit + + arap.bdrecovery.delete + + arap.bdrecovery.edit + + arap.bdrecovery.query + + arap.bdrecovery.querygridbypks + + arap.bdrecovery.querycard + + arap.bdrecovery.addquery + + arap.bdrecovery.recmomeycomplement + + arap.bdrecovery.matchar + + arap.bdrecovery.cardbodyafteredit + + arap.bdrecovery.cardheadafteredit + + arap.bdrecovery.fiplinklistquery + + arap.bdrecovery.fiplinkcardquery + + + + + 20060BDA + + + arap.bdaccount.query + + + + + 10300201,10300202,10300203,10300204 + + + arap.providerdesign.accountAgeDataSetDesign + + + + + 10170410,10170412 + + + arap.arappub.getAppMessageByBillType + arap.arappub.arapQueryAccountBookAction + arap.ref.freecustcontrol + + + + + 20080CVRED,20060CVRED + + + arap.cvred.query + + arap.cvred.cvred + + arap.cvred.refresh + + arap.cvred.queryVerResult + + + + + 20060ALLOC,20080ALLOC + + + arap.allocation.query + + arap.allocation.querygridbyids + + arap.allocation.querydetailbyids + + arap.allocation.exeperiodalloc + + arap.allocation.unexeperiodalloc + + arap.allocation.querybybillpks + + arap.allocation.allocafteredit + + arap.allocation.editsave + + arap.allocation.editdetailsave + + arap.allocation.allocdetailafteredit + + arap.allocation.allocConfirm + + arap.allocation.allocUnConfirm + + arap.allocation.allocLinkTbb + + arap.allocation.allocLinkTbbDetail + + + + + 20080RMM,20060RMM + + + arap.retention.query + + arap.retention.querygridbyids + + arap.retention.freeze + + arap.retention.unfreeze + + arap.retention.qryrmcdbills + + arap.retention.chkcurtodomoney + + + + + 20080RMC,20060RMC,20060RMC001,20080RMC001 + + + arap.retention.transferquery + + arap.retention.querybycondition + + arap.retention.querycard + + arap.retention.querypage + + arap.retention.retentionbillcarryforward + + arap.retention.retentionbillsave + + arap.retention.retentionbilldelete + + arap.arappub.print + + arap.arappub.previewprint + + arap.arappub.outPut + + arap.arappub.officialPrint + + arap.arappub.cancelPrint + + arap.arappub.madebill + + arap.retention.retentionbillcommit + + arap.retention.retentionbilluncommit + + arap.retention.retentionbilllistcommit + + arap.retention.retentionbilllistuncommit + + arap.retention.retentionbilllistapprove + + arap.retention.retentionbilllistunapprove + + arap.arappub.linkarapbill + + arap.retention.retentionconvertafteredit + + arap.retention.retentionconvertafterbodyedit + + arap.retention.retentionlinkbill + + arap.ref.ratecontrol + + + + + 20080RMD,20060RMD,20060RMD001,20080RMD001 + + + arap.retention.transferquery + + arap.retention.queryReduceList + + arap.retention.queryReduceCard + + arap.retention.queryReducePage + + arap.retention.retentionReduceBillCarryForward + + arap.retention.retentionReduceBillSave + + arap.retention.retentionReduceBillDelete + + arap.retention.reduceCardBodyAfterEdit + + arap.retention.reduceCardHeadAfterEdit + + arap.retention.reduceBillCommit + + arap.retention.reduceBillUnCommit + + arap.retention.reducebilllistcommit + + arap.retention.reducebilllistuncommit + + arap.retention.reducebilllistapprove + + arap.retention.reducebilllistunapprove + + arap.arappub.print + + arap.arappub.previewprint + + arap.arappub.outPut + + arap.arappub.officialPrint + + arap.arappub.cancelPrint + + arap.arappub.madebill + + arap.arappub.linkarapbill + + arap.ref.ratecontrol + + + + + 10171003,10171004 + + arap.refer.reconBillDealRef + + + diff --git a/arap/src/client/yyconfig/modules/arap/arappub/config/action/arapbaseconfig.xml b/arap/src/client/yyconfig/modules/arap/arappub/config/action/arapbaseconfig.xml new file mode 100644 index 0000000..c990cbf --- /dev/null +++ b/arap/src/client/yyconfig/modules/arap/arappub/config/action/arapbaseconfig.xml @@ -0,0 +1,578 @@ + + + + arap.arappub.redback + + nccloud.web.arap.arappub.action.BillWriteBackAction + RedBack + + + arap.init.close + + nccloud.web.arap.arappub.action.InitBillCloseAction + + + arap.init.cancelclose + + nccloud.web.arap.arappub.action.InitBillCancelCloseAction + + + + arap.init.edit + + nccloud.web.arap.arappub.action.Bill4InitEditAction + Edit + + + arap.init.batchdelete + + nccloud.web.arap.arappub.action.Bill4InitBatchDeleteAction + Delete + + + arap.arappub.pause + + nccloud.web.arap.arappub.action.Bill4PauseTransactAction + Pausetrans + + + arap.arappub.cancelpause + + nccloud.web.arap.arappub.action.Bill4CancelPauseTransactAction + + Cancelpause + + + arap.arappub.save + + nccloud.web.arap.arappub.action.BillSaveAction + Save + + + arap.arappub.tempsave + + nccloud.web.arap.arappub.action.BillTempSaveAction + TempSave + + + arap.arappub.delete + + nccloud.web.arap.arappub.action.BillDeleteAction + Delete + + + arap.arappub.copy + + nccloud.web.arap.arappub.action.BillCopyAction + Copy,Copy_inner + + + arap.arappub.edit + + nccloud.web.arap.arappub.action.BillEditAction + Edit + + + arap.arappub.confirm + + nccloud.web.arap.arappub.action.BillConfirmAction + Confirm,Confirm_inner + + + arap.arappub.cancelconfirm + + nccloud.web.arap.arappub.action.BillCancelConfirmAction + CancelConfirm,CancelConfirm_inner + + + arap.arappub.confirmdelete + + nccloud.web.arap.arappub.action.BillConfirmDeleteAction + Delete,Delete_Inner + + + arap.arappub.confirmbatchdelete + + nccloud.web.arap.arappub.action.BillConfirmBatchDeleteAction + + Delete + + + arap.arappub.commit + + nccloud.web.arap.arappub.action.BillCommitAction + Commit + + + arap.arappub.batchcommit + + nccloud.web.arap.arappub.action.BillListCommitAction + Commit + + + arap.arappub.uncommit + + nccloud.web.arap.arappub.action.BillUnCommitAction + Uncommit + + + arap.arappub.batchuncommit + + nccloud.web.arap.arappub.action.BillListUnCommitAction + Uncommit + + + arap.arappub.approve + + nccloud.web.arap.arappub.action.BillApproveAction + Approve,Approve_inner + + + arap.arappub.unapprove + + nccloud.web.arap.arappub.action.BillUnApproveAction + UnApprove,UnApprove_inner + + + arap.arappub.listapprove + + nccloud.web.arap.arappub.action.BillListApproveAction + Approve + + + arap.arappub.listunapprove + + nccloud.web.arap.arappub.action.BillListUnApproveAction + UnApprove + + + arap.arappub.prepay + + nccloud.web.arap.arappub.action.BillPrepayAction + PrePay + + + arap.arappub.saveandcommit + + nccloud.web.arap.arappub.action.BillSaveAndCommitAction + SaveAndCommit + + + arap.arappub.madebill + + nccloud.web.arap.arappub.action.MadeBillAction + MadeBill + + + arap.arappub.checkcloseacc + + nccloud.web.arap.arappub.action.CheckCloseAccValueAction + + + + arap.arappub.print + + nccloud.web.arap.arappub.action.PrintAction + Print + + + arap.arappub.previewprint + + nccloud.web.arap.arappub.action.PrintPreviewAction + Print + + + arap.arappubBusi.print + + nccloud.web.arap.arappub.action.PrintBusiAction + + + arap.arappub.arappfbusinesstype + + nccloud.web.arap.arappub.action.ArapPFBusinessTypeAction + + + + arap.arappub.transferquery + + nccloud.web.arap.arappub.action.TransferQuery + + + arap.arappub.transfer + + nccloud.web.arap.arappub.action.TransferExchangeAction + + + arap.arappub.orgclossref + + nccloud.web.arap.arappub.action.InitBillCloseRef + + + arap.arappub.getQuertObjs + + nccloud.web.arap.arappub.action.QueryObjsAction + + + arap.arappub.outPut + + nccloud.web.arap.arappub.action.PrintOutPutAction + + + arap.arappub.officialPrint + + nccloud.web.arap.arappub.action.OfficialPrintAction + OfficalPrint + + + arap.arappub.cancelPrint + + nccloud.web.arap.arappub.action.CancelPrintAction + CancelPrint + + + arap.arappub.arapStatementQry + + nccloud.web.arap.arappub.action.ArapStatementQryAction + + + arap.arappub.arapStatementTranslateChildGrid + + nccloud.web.arap.arappub.action.ArapStatementTranslateChildGrid + + + + arap.arappub.reportLinkBill + + nccloud.web.arap.arappub.action.ReportLinkBillAction + + + arap.arappub.arapStatementBillLink + + nccloud.web.arap.arappub.action.ArapStatementBillLinkQueryAction + + + + arap.arappub.queryGridByPK + + nccloud.web.arap.arappub.action.QueryGridByPKAction + + + arap.arappub.arapQueryAccountBookAction + + nccloud.web.arap.arappub.action.QueryAccountBookAction + + + arap.arappub.queryrelatedapp + + nccloud.web.arap.arappub.action.QueryRelatedAppAction + + + arap.arappub.sendeleinvoice + + nccloud.web.arap.arappub.action.SendEleInvoiceAction + InvoiceUploader + + + arap.arappub.arapBillLinkReport + + nccloud.web.arap.arappub.action.ArapBillLinkReportAction + + LinkBal + + + arap.arappub.associatesettinfo + + nccloud.web.arap.arappub.action.AssociateSettInfoAction + ConnectSettleInfo + + + arap.arappub.validatecmp + + nccloud.web.arap.arappub.action.ValidateCmpAction + + + arap.arappub.printVerify + + nccloud.web.arap.verificationsheet.verify.action.PrintVerifyAction + + Print + + + arap.arappub.printVerifyDetail + + nccloud.web.arap.verificationsheet.verify.action.PrintVerifyDetailAction + + Print + + + arap.arappub.outPutVerify + + nccloud.web.arap.verificationsheet.verify.action.OutPutVerifyAction + Output + + + arap.arappub.outPutVerifyDetail + + nccloud.web.arap.verificationsheet.verify.action.OutPutVerifyDetailAction + Output + + + arap.arappub.printGridData + + nccloud.web.arap.gatheringbill.reminder.action.PrintGridDataAction + + + + arap.arappub.agiotagePrintDetail + + nccloud.web.arap.arappub.action.AgiotagePrintDetailAction + + Print + + + arap.arappub.printDebtTransferAction + + nccloud.web.arap.arappub.action.PrintDebtTransferAction + Print + + + arap.arappub.gridOutputExcelAction + + nccloud.web.arap.arappub.action.GridOutputExcelAction + ExportData + + + arap.arappub.releasetoarap + + nccloud.web.arap.arappub.action.ReleaseToArapAction + + + arap.arappub.releasetoarapsave + + nccloud.web.arap.arappub.action.ReleaseToArapSaveAction + + + arap.arappub.outDebtTransferAction + + nccloud.web.arap.arappub.action.PrintOutDebtTransferAction + + + + arap.arappub.queryallbtns + + nccloud.web.arap.arappub.action.QueryAllBtns + + + arap.arappub.ischecknoref + + nccloud.web.arap.arappub.action.IsChecknoRefAction + + + arap.arappub.checketcforbusi + + nccloud.web.arap.paybill.action.CheckEtcNoteForBusi + + + arap.arappub.cardRefresh + + nccloud.web.arap.arappub.action.ArapCardRefreshAction + Refresh + + + arap.arappub.commisionpay + + nccloud.web.arap.arappub.action.BillCommisionPaySaveAction + + + + arap.arappub.cancelcommisionpay + + nccloud.web.arap.arappub.action.BillCancelCommisionPayAction + + + + arap.arappub.getAppMessageByBillType + + nccloud.web.arap.arappub.action.GetAppMessageByBillType + + + arap.arappub.querypage + + nccloud.web.arap.arappub.action.ArapQueryPageAction + + + arap.arappub.processImpMoney + + nccloud.web.arap.arappub.action.BillProcessImpMoneyAction + + + + arap.arappub.getBusitypeAndBilldate + + nccloud.web.arap.arappub.action.ArapGetBusitypeAndBilldate + + + + arap.arappub.ar52qry + + nccloud.web.arap.arappub.param.action.AR52ParamQueryAction + + + + arap.arappub.ar52save + + nccloud.web.arap.arappub.param.action.AR52ParamSaveAction + + + + arap.arappub.transformBillEnclosureQuery + + nccloud.web.arap.arappub.action.TransformBillEnclosureQueryAction + + + + arap.arappub.arapFileLeftTreeQuery + + nccloud.web.arap.arappub.action.ArapFileLeftTreeQueryAction + + + + arap.arappub.deleteAfterEditCalculate + + nccloud.web.arap.arappub.action.DeleteAfterEditCalculateAction + + + + arap.arappub.isConsolidatedTax + + nccloud.web.arap.arappub.action.IsConsolidatedTaxAction + + + arap.arappub.refund + + nccloud.web.arap.arappub.action.BillRefundAction + Refund + + + arap.arappub.cancelrefund + + nccloud.web.arap.arappub.action.BillCancelRefundAction + CancelRefund + + + arap.arappub.listrefund + + nccloud.web.arap.arappub.action.BillListRefundAction + Refund + + + arap.arappub.listcancelrefund + + nccloud.web.arap.arappub.action.BillListCancelRefundAction + + CancelRefund + + + arap.arappub.generate + + nccloud.web.arap.arappub.action.BillGenerateAction + Generate + + + arap.arappub.listgenerate + + nccloud.web.arap.arappub.action.BillListGenerateAction + Generate + + + arap.arappub.billCanEditProperties + + nccloud.web.arap.arappub.action.BillCanEditPropertiesAction + + + arap.arappub.checkfrozenforedit + + nccloud.web.arap.arappub.action.CheckFrozenForEdit + Edit,Edit_inner + + + arap.arappub.queryModuleEnable + + nccloud.web.arap.arappub.action.QueryModuleEnableAction + + + arap.arappub.bodybatchedit + + nccloud.web.arap.arappub.action.CardBodyAfterBatchEditPubAction + + + arap.arappub.getrelationbill + + nccloud.web.arap.arappub.action.GetRelationBillAction + + + arap.arappub.billsendsp + + nccloud.web.arap.arappub.action.BillSendSPAction + SendSP + + + arap.arappub.billcancelsendsp + + nccloud.web.arap.arappub.action.BillCancelSendSPAction + CancelSendSP + + + arap.arappub.billbatchsendsp + + nccloud.web.arap.arappub.action.BillBatchSendSPAction + SendSP + + + arap.arappub.billbatchcancelsendsp + + nccloud.web.arap.arappub.action.BillBatchCancelSendSPAction + CancelSendSP + + + arap.arappub.checkRecItemIsEnableDel + + nccloud.web.arap.arappub.action.CheckRecItemIsEnableDelAction + + + arap.arappub.checkGenerateInvoiceTime + + nccloud.web.arap.arappub.action.CheckGenerateInvoiceTimeAction + + + arap.arappub.arapbillexectallocation + + nccloud.web.arap.arappub.action.ArapBillExectAllocation + + + arap.arappub.pubquerycondition + + nccloud.web.arap.arappub.action.PubQueryConditonAction + + + arap.arappub.querytradetypeaction + + nccloud.web.arap.arappub.action.QueryTradetypeAction + + + arap.arappub.querytradetypes + + nccloud.web.arap.arappub.action.QueryTradetypesAction + + + arap.arappub.querylistemptydata + + nccloud.web.arap.arappub.action.queryListEmptyAreaData + + + arap.arappub.savecheck + + nccloud.web.arap.arappub.action.BillSaveCheckAgainAction + Save + + diff --git a/ic/src/private/nc/bs/ic/onhand/action/OnhandResBalance.java b/ic/src/private/nc/bs/ic/onhand/action/OnhandResBalance.java new file mode 100644 index 0000000..4328566 --- /dev/null +++ b/ic/src/private/nc/bs/ic/onhand/action/OnhandResBalance.java @@ -0,0 +1,872 @@ +package nc.bs.ic.onhand.action; + +import java.lang.reflect.Array; +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.ic.pub.db.SqlIn; +import nc.bs.ic.pub.env.ICBSContext; +import nc.itf.scmpub.reference.uap.group.SysInitGroupQuery; +import nc.pubitf.ic.onhand.IOnhandQry; +import nc.vo.ic.location.ICLocationVO; +import nc.vo.ic.material.define.InvBasVO; +import nc.vo.ic.material.define.InvMeasVO; +import nc.vo.ic.onhand.define.BalanceOnhandRes; +import nc.vo.ic.onhand.define.ICBillOnhandReq; +import nc.vo.ic.onhand.define.IOnhandReq; +import nc.vo.ic.onhand.define.OnhandBalanceResult; +import nc.vo.ic.onhand.define.OnhandRes; +import nc.vo.ic.onhand.entity.OnhandDimVO; +import nc.vo.ic.onhand.entity.OnhandNumVO; +import nc.vo.ic.onhand.entity.OnhandSNVO; +import nc.vo.ic.onhand.entity.OnhandSNViewVO; +import nc.vo.ic.onhand.entity.OnhandVO; +import nc.vo.ic.onhand.pub.OnhandQryCond; +import nc.vo.ic.onhand.pub.OnhandVOTools; +import nc.vo.ic.pub.calc.BusiCalculator; +import nc.vo.ic.pub.define.ICPubMetaNameConst; +import nc.vo.ic.pub.sql.SqlUtil; +import nc.vo.ic.pub.util.CollectionUtils; +import nc.vo.ic.pub.util.DimMatchUtil; +import nc.vo.ic.pub.util.NCBaseTypeUtils; +import nc.vo.ic.pub.util.StringUtil; +import nc.vo.ic.pub.util.VOEntityUtil; +import nc.vo.ic.pub.util.ValueCheckUtil; +import nc.vo.pub.BusinessException; +import nc.vo.pub.lang.UFDouble; +import nc.vo.pubapp.pattern.exception.ExceptionUtils; +import nccloud.commons.lang.ArrayUtils; + +/** + *

+ * Դƽ + *

    + *
  • ִ + *
  • Ԥִ + *
+ *

+ * ʷ + *

+ * + * @version v60 + * @since v60 + * @author yangb + * @time 2010-4-10 02:13:20 + */ +public class OnhandResBalance implements ResAlloc { + + private BusiCalculator calculator; + + // ʹýΪĹ + private List ctranstypes; + + // + private Map> mapResults; + +// // +// private Map> mapSnResults; + + // еĽ + private Map mapyethandvo; + + // + private T[] onhandReq; + + // к + private T[] onhandSNReq; + + private OnhandResManager onhandres; + + // Դƥ + private DimMatchUtil reqsmatch; + + private String[] onhandSNDimFields = new String[] { + OnhandDimVO.PK_GROUP, OnhandDimVO.PK_ORG, + OnhandDimVO.CWAREHOUSEID, OnhandDimVO.CMATERIALVID, OnhandDimVO.CMATERIALOID, + OnhandDimVO.CASTUNITID, OnhandDimVO.PK_BATCHCODE, OnhandDimVO.CVMIVENDERID, + OnhandDimVO.CINVCUSTID, OnhandDimVO.CSTATEID, OnhandDimVO.CVENDORID, + OnhandDimVO.CPROJECTID, OnhandDimVO.CASSCUSTID, OnhandDimVO.CPRODUCTORID, + OnhandDimVO.CFFILEID, OnhandDimVO.VFREE1, OnhandDimVO.VFREE2, + OnhandDimVO.VFREE3, OnhandDimVO.VFREE4, OnhandDimVO.VFREE5, + OnhandDimVO.VFREE6, OnhandDimVO.VFREE7, OnhandDimVO.VFREE8, + OnhandDimVO.VFREE9, OnhandDimVO.VFREE10 + }; + + /** + * zhengxinm кżûв鲻ݵ ȥ ־ǿõ + */ + private String[] onhandSNDimFieldsWithoutBatch = new String[] { + OnhandDimVO.PK_GROUP, OnhandDimVO.PK_ORG, + OnhandDimVO.CWAREHOUSEID, OnhandDimVO.CMATERIALVID, OnhandDimVO.CMATERIALOID, + OnhandDimVO.CASTUNITID, OnhandDimVO.CVMIVENDERID, + OnhandDimVO.CINVCUSTID, OnhandDimVO.CSTATEID, OnhandDimVO.CVENDORID, + OnhandDimVO.CPROJECTID, OnhandDimVO.CASSCUSTID, OnhandDimVO.CPRODUCTORID, + OnhandDimVO.CFFILEID, OnhandDimVO.VFREE1, OnhandDimVO.VFREE2, + OnhandDimVO.VFREE3, OnhandDimVO.VFREE4, OnhandDimVO.VFREE5, + OnhandDimVO.VFREE6, OnhandDimVO.VFREE7, OnhandDimVO.VFREE8, + OnhandDimVO.VFREE9, OnhandDimVO.VFREE10 + }; + + /** + * OnhandResBalance Ĺ + */ + public OnhandResBalance(T[] reqs) { + this.onhandReq = reqs; + this.calculator = BusiCalculator.getBusiCalculatorAtBS(); + } + + /** + * Դ return true ---ʾԴ, ϸѾǰ, + */ + @Override + public boolean assignRes(OnhandRes handres) { + List lreqs = this.reqsmatch.searchMatchedDimObj(handres, -1); + if (ValueCheckUtil.isNullORZeroLength(lreqs)) { + return true; + } + boolean byetoverhand = this.processResDataForHand(handres); + OnhandBalanceResult balancerow = null; + int ireqs = lreqs.size(); + for (T req : lreqs) { + balancerow = this.mapResults.get(req); + if (balancerow == null) { + balancerow = new OnhandBalanceResult(req); + this.mapResults.put(req, balancerow); + } + // balancerow.isFull() λǽ£Ϊջ0Ϊû,Ϊbalancerow.isFull(boolean,boolean,boolean) + boolean isNumAssign = handres.isNumUseable(); + boolean isAstNumAssign = handres.isAstnumUseable(); + boolean isGrossNumAssign = handres.isGrossnumUseable(); + this.assignRes(balancerow, handres); + if (balancerow.isFull(isNumAssign, isAstNumAssign, isGrossNumAssign)) { + this.reqsmatch.remoteMatchedDimObj(req); + ireqs--; + } + if (!handres.isUseable()) { + break; + } + } + if (byetoverhand) { + return true; + } + if (ireqs <= 0) { + return true; + } + return false; + } + + /** + * ȡƽ ˵ + * + * @author yangb + * @time 2010-4-10 03:10:01 + */ + public OnhandBalanceResult getResults(T req) { + if (this.mapResults == null) { + return null; + } + return this.mapResults.get(req); + } + + /** + * ִƽ ˵ + * + * @author yangb + * @time 2010-4-10 03:10:01 + */ + public void onhandBalance() { + // + this.processData(); + // add by wangceb кż start + this.processAllocSNData(); + // add by wangceb кż end + + if (ValueCheckUtil.isNullORZeroLength(this.onhandReq) + || this.reqsmatch == null) { + return; + } + if (ValueCheckUtil.isNullORZeroLength(this.mapyethandvo)) { + return; + } + OnhandVO[] handvos = + this.mapyethandvo.values().toArray( + new OnhandVO[this.mapyethandvo.size()]); + // ϸ + this.getOnhandRes().matchRes(handvos, this); + // 䵥Ʒ + this.allocSn(handvos); + } + + /** + * @param ctranstype Ҫõ ctranstype + */ + public void setCtranstype(List ctranstypes) { + this.ctranstypes = ctranstypes; + } + + /** + * 䵥Ʒ,ѷĽ + */ + private void allocSn(OnhandVO[] handvos) { + if (ValueCheckUtil.isNullORZeroLength(handvos) + || ValueCheckUtil.isNullORZeroLength(this.mapResults)) { + return; + } + Set onhandpks = + VOEntityUtil.getVOsValueSet(handvos, OnhandDimVO.PK_ONHANDDIM); + + // ѯƷԴ + List[] ls = this.getOuttrackinOnhandRes(); + if (!ValueCheckUtil.isNullORZeroLength(ls) + && !ValueCheckUtil.isNullORZeroLength(ls[0])) { + this.getOnhandRes().loadSNRes(handvos, + ls[0].toArray(new String[ls[0].size()]), + ls[1].toArray(new String[ls[1].size()])); + } + else { + this.getOnhandRes().loadSNRes(handvos, null, null); + } + OnhandSNVO[] snvos = null; + for (OnhandBalanceResult rts : this.mapResults.values()) { + if (rts.getResults() == null) { + continue; + } + for (BalanceOnhandRes res : rts.getResults()) { + // ԴеĴ˵Ѿٴ + if (res.getNastnum() == null + || !onhandpks.contains(res.getOnhanddimvo().getPk_onhanddim())) { + continue; + } + // Ʒ + snvos = this.getOnhandRes().getSNRes(res.getOnhanddimvo(), + res.getCgeneralbid(), res.getNastnum().intValue()); + res.addSnVo(snvos); + } + } + } + + /** + * ˵ + * + * @author yangb + * @time 2010-4-10 03:10:01 + */ + private void assignRes(OnhandBalanceResult balance, OnhandRes res) { + if (!res.isUseable()) { + return; + } + UFDouble dtemp = null; + BalanceOnhandRes balanceres = new BalanceOnhandRes(res); + // //Ʒ + // OnhandSNVO[] snvos = getOnhandRes().getSNRes(res.getOnhanddimvo(), + // res.getCgeneralbid(), + // balance.getNreqnum().intValue()); + // balanceres.addSnVo(snvos); + if (res.isNumUseable()) { + dtemp = NCBaseTypeUtils.sub(res.getNuseablenum(), balance.getNreqnum()); + if (NCBaseTypeUtils.isGtZero(dtemp)) { + balanceres.setNnum(balance.getNreqnum()); + balance.setNreqnum(UFDouble.ZERO_DBL); + res.setNuseablenum(dtemp); + } + else { + balanceres.setNnum(res.getNuseablenum()); + balance.setNreqnum(NCBaseTypeUtils.sub(balance.getNreqnum(), balanceres + .getNnum())); + res.setNuseablenum(UFDouble.ZERO_DBL); + } + }else{ + balanceres.setNnum(UFDouble.ZERO_DBL); + } + + + if (res.isAstnumUseable()) { + dtemp = + NCBaseTypeUtils.sub(res.getNuseableastnum(), balance.getNreqastnum()); + if (NCBaseTypeUtils.isGtZero(dtemp)) { + balanceres.setNastnum(balance.getNreqastnum()); + balance.setNreqastnum(UFDouble.ZERO_DBL); + res.setNuseableastnum(dtemp); + } + else { + balanceres.setNastnum(res.getNuseableastnum()); + balance.setNreqastnum(NCBaseTypeUtils.sub(balance.getNreqastnum(), + balanceres.getNastnum())); + res.setNuseableastnum(UFDouble.ZERO_DBL); + } + }else{ + balanceres.setNastnum(UFDouble.ZERO_DBL); + } + + if (res.isGrossnumUseable()) { + dtemp = + NCBaseTypeUtils.sub(res.getNuseablegrossnum(), balance + .getNreqgrossnum()); + if (NCBaseTypeUtils.isGtZero(dtemp)) { + balanceres.setNgrossnum(balance.getNreqgrossnum()); + balance.setNreqgrossnum(UFDouble.ZERO_DBL); + res.setNuseablegrossnum(dtemp); + } + else { + balanceres.setNgrossnum(res.getNuseablegrossnum()); + balance.setNreqgrossnum(NCBaseTypeUtils.sub(balance.getNreqgrossnum(), + balanceres.getNgrossnum())); + res.setNuseablegrossnum(UFDouble.ZERO_DBL); + } + }else{ + balanceres.setNgrossnum(UFDouble.ZERO_DBL); + } + balance.addBalanceOnhandRes(balanceres); + } + + /** + * ˵ + * + * @author yangb + * @time 2010-4-10 03:10:01 + */ + @SuppressWarnings("unchecked") + private void filterReqsData() { + if (ValueCheckUtil.isNullORZeroLength(this.onhandReq)) { + return; + } + List datas = new ArrayList(); + List sndatas = new ArrayList(); + for (T req : this.onhandReq) { + if (req == null) { + continue; + } + if (req.getOnhandDim() == null) { + continue; + } + if (req.getOnhandDim().getPk_org() == null + || req.getOnhandDim().getCmaterialvid() == null + || req.getOnhandDim().getCmaterialoid() == null) { + continue; + } + if (NCBaseTypeUtils.isNullOrZero(req.getReqNum()) + && NCBaseTypeUtils.isNullOrZero(req.getReqAssistNum()) + && NCBaseTypeUtils.isNullOrZero(req.getReqGrossNum())) { + continue; + } + if (this.isNeedSearchSN(req)) { + sndatas.add(req); +// continue; + } + + datas.add(req); + } + if (datas.size() > 0) { + T[] arrtemp = + (T[]) Array.newInstance(datas.get(0).getClass(), datas.size()); + this.onhandReq = datas.toArray(arrtemp); + } else { + this.onhandReq = null; + } + + if (sndatas.size() > 0) { + T[] arrtemp = + (T[]) Array.newInstance(sndatas.get(0).getClass(), sndatas.size()); + this.onhandSNReq = sndatas.toArray(arrtemp); + } + } + + /** + * ¼ккӦͬ + * @param req + * @return + */ + private boolean isNeedSearchSN(T req) { + ICLocationVO[] locationvos = req.getLocationVOs(); + if (ValueCheckUtil.isNullORZeroLength(locationvos)) { + return false; + } + String key = SysInitGroupQuery.isSNEnabled() ? ICPubMetaNameConst.PK_SERIALCODE : ICPubMetaNameConst.VSERIALCODE; + String[] snvalues = VOEntityUtil.getVOsValuesNotDel(locationvos, key, String.class); + if (StringUtil.isSEmptyOrNullForAll(snvalues)) { + return false; + } +// if (NCBaseTypeUtils.isNullOrZero(req.getReqAssistNum()) || snvalues.length != req.getReqAssistNum().intValue()) { +// return false; +// } + return true; + } + + /** + * ȡִԴ ˵ + * + * @author yangb + * @time 2010-4-10 03:10:01 + */ + private OnhandResManager getOnhandRes() { + if (this.onhandres == null) { + this.onhandres = new OnhandResManager(); + if (!ValueCheckUtil.isNullORZeroLength(this.ctranstypes)) { + this.onhandres.setCtranstype(this.ctranstypes); + } + } + return this.onhandres; + } + + /** + * ȡⵥϸ + */ + @SuppressWarnings("unchecked") + private List[] getOuttrackinOnhandRes() { + if (ValueCheckUtil.isNullORZeroLength(this.mapResults)) { + return null; + } + List listbid = new ArrayList(); + List listbilltype = new ArrayList(); + String cgeneralbid = null; + for (OnhandBalanceResult rts : this.mapResults.values()) { + if (rts.getResults() == null) { + continue; + } + for (BalanceOnhandRes res : rts.getResults()) { + cgeneralbid = res.getCgeneralbid(); + if (cgeneralbid == null) { + continue; + } + if (listbid.contains(cgeneralbid)) { + continue; + } + listbid.add(cgeneralbid); + listbilltype.add(res.getCbilltype()); + } + } + if (listbid.size() <= 0) { + return null; + } + return new List[] { + listbilltype, listbid + }; + } + + /** + * ԤִԴ,: (Ƚȳ,ȳ) () ,
+ * ֱӸִԴ,
+ * üѯϸ,Ч
+ * + * @author yangb + * @time 2010-4-10 03:10:01 + */ + private OnhandVO[] preAllocHandRes(OnhandVO[] handvos) { + if (ValueCheckUtil.isNullORZeroLength(handvos)) { + return handvos; + } + this.getOnhandRes().loadInv(handvos); + this.processNrsastnum(handvos); + List lrethandvos = new ArrayList(); + List lprehandvos = new ArrayList(); + for (OnhandVO handvo : handvos) { + if (NCBaseTypeUtils.isLEZero(OnhandVOTools.calcHandNum(handvo)) + && NCBaseTypeUtils.isLEZero(OnhandVOTools.calcHandAstNum(handvo))) { + continue; + } + if (this.getOnhandRes().isNeedSearchFlow(handvo.getPk_org(), + handvo.getCmaterialvid())) { + lrethandvos.add(handvo); + continue; + } + OnhandRes handres = new OnhandRes(handvo); + List lreqs = this.reqsmatch.searchMatchedDimObj(handres, -1); + if (ValueCheckUtil.isNullORZeroLength(lreqs)) { + continue; + } + OnhandBalanceResult balancerow = null; + lprehandvos.add(handvo); + for (T req : lreqs) { + balancerow = this.mapResults.get(req); + if (balancerow == null) { + balancerow = new OnhandBalanceResult(req); + this.mapResults.put(req, balancerow); + } + boolean isNumAssign=handres.isNumUseable(); + boolean isAstNumAssign=handres.isAstnumUseable(); + boolean isGrossNumAssign= handres.isGrossnumUseable(); + this.assignRes(balancerow, handres); + if (balancerow.isFull(isNumAssign,isAstNumAssign,isGrossNumAssign)) { + this.reqsmatch.remoteMatchedDimObj(req); + } + if (!handres.isUseable()) { + break; + } + } + } + if (lprehandvos.size() > 0) { + this.allocSn(CollectionUtils.listToArray(lprehandvos)); + } + return CollectionUtils.listToArray(lrethandvos); + } + + /** + * ǽģԤģҪ¼Ԥ󵥾ݸ + * @param handvos + */ + private void processNrsastnum(OnhandVO[] handvos){ + Map mapmeasInv =this.loadInvMeas(handvos); + if (ValueCheckUtil.isNullORZeroLength(mapmeasInv)) { + return ; + } + List reserveVOs = new ArrayList(); + + for (OnhandVO onhandVO : handvos) { + String key = onhandVO.getCmaterialvid()+onhandVO.getCastunitid(); + InvMeasVO invmeasVO = mapmeasInv.get(key); + if(invmeasVO == null){ + reserveVOs.add(onhandVO); + continue; + } + //λƽԤΪ + if(ValueCheckUtil.isTrue(invmeasVO.getIsstorebalance()) + && !NCBaseTypeUtils.isNullOrZero(onhandVO.getNrsnum())){ + reserveVOs.add(onhandVO); + } + } + if(ValueCheckUtil.isNullORZeroLength(reserveVOs)){ + return; + } +// Map invvos = +// this.loadInvBas(reserveVOs.toArray(new OnhandVO[0])); + for (OnhandVO onhandVO : reserveVOs) { +// InvBasVO invvo = invvos.get(onhandVO.getCmaterialvid()); +// if (invvo == null) { +// continue; +// } +// String cunitid = invvo.getPk_measdoc(); + InvMeasVO invmeasvo = + mapmeasInv.get(onhandVO.getCmaterialvid() + onhandVO.getCastunitid()); + if (invmeasvo == null) { + onhandVO.setNrsastnum(onhandVO.getNrsnum()); + continue; + } + String convertRate = invmeasvo.getMeasrate(); + String cunitid = invmeasvo.getPk_measdoc(); + UFDouble nrsnum = onhandVO.getNrsnum(); + onhandVO.setNrsastnum(this.calculator.calculateAstNum(nrsnum, + convertRate, cunitid)); + } + } + + /** + * ϸϢ + * + * @param handvos + * @return + */ + private Map loadInvMeas(OnhandVO[] handvos) { + Map mapInv = new HashMap(); + if (handvos == null || handvos.length <= 0) { + return null; + } + + ICBSContext con = new ICBSContext(); + InvMeasVO[] invvos = + con.getInvInfo().getInvMeasVO( + VOEntityUtil.getVOsValues(handvos, OnhandDimVO.CMATERIALVID, + String.class), + VOEntityUtil.getVOsValues(handvos, OnhandDimVO.CASTUNITID, + String.class)); + if (invvos == null) { + return null; + } + for (InvMeasVO invvo : invvos) { + if (invvo == null) { + continue; + } + mapInv.put(invvo.getPk_material() + invvo.getPk_measdoc(), invvo); + } + return mapInv; + } + + /** + * ϻϢڻȡλ + * @param handvos + * @return + */ + private Map loadInvBas(OnhandVO[] handvos) { + Map mapInv = new HashMap(); + if (handvos == null || handvos.length <= 0) { + return null; + } + + ICBSContext con = new ICBSContext(); + InvBasVO[] invvos = + con.getInvInfo().getInvBasVO( + VOEntityUtil.getVOsValues(handvos, OnhandDimVO.CMATERIALVID, + String.class)); + if (invvos == null) { + return null; + } + for (InvBasVO invvo : invvos) { + if (invvo == null) { + continue; + } + mapInv.put(invvo.getPk_material(), invvo); + } + return mapInv; + } + + /** + * кż + */ + private void processAllocSNData() { + if (ValueCheckUtil.isNullORZeroLength(onhandSNReq)) { + return; + } + for (T req : onhandSNReq) { + // ȡвѯkey -- кŻpk + Set llist = this.getAllSNValues(req); + // ѯкŽ + OnhandSNViewVO[] snvos = this.queryOnhandSNs(llist, req); + if (ValueCheckUtil.isNullORZeroLength(snvos)) { + return; + } + if (ValueCheckUtil.isNullORZeroLength(this.mapResults)) { + this.mapResults = new HashMap>(); + } + String key = SysInitGroupQuery.isSNEnabled() ? ICPubMetaNameConst.PK_SERIALCODE + : ICPubMetaNameConst.VSERIALCODE; + + Map onhandsnmap = CollectionUtils.hashVOArray( + key, snvos); + // ÿ + this.processAllocSNReq(key, onhandsnmap, req); + } + } + + private void processAllocSNReq(String key, + Map onhandsnmap, T req) { + OnhandBalanceResult balancerow = this.mapResults.get(req); + if (balancerow == null) { + balancerow = new OnhandBalanceResult(req); + this.mapResults.put(req, balancerow); + } + List snList = new ArrayList(); + // ѡӦкŽ + ICLocationVO[] lovs = req.getLocationVOs(); + for (ICLocationVO lov : lovs) { + String keyvalue = (String) lov.getAttributeValue(key); + if(onhandsnmap.get(keyvalue) != null) { + snList.add(onhandsnmap.get(keyvalue)); + } + } + if(snList.size() < 1) { + return; + } + Map> snmap = VOEntityUtil + .groupVOByKeys(new String[] { OnhandDimVO.PK_ONHANDDIM }, + CollectionUtils.listToArray(snList)); + for (Map.Entry> entry : snmap + .entrySet()) { + BalanceOnhandRes res = new BalanceOnhandRes(); + res.setOnhanddimvo(entry.getValue().get(0).getOnhandDimVO()); + List listsnvo = new ArrayList(); + for (OnhandSNViewVO viewvo : entry.getValue()) { + listsnvo.add(viewvo.getOnhandSNVO()); + } + //־кż + res.setBySN(true); + res.setListsnvo(listsnvo); + UFDouble[] dsums = VOEntityUtil.sumVOsFieldValuesNotDel( + CollectionUtils.listToArray(entry.getValue()), + new String[] { OnhandSNVO.NONHANDNUM, + OnhandSNVO.NONHANDASTNUM}); + res.setNnum(dsums[0]); + res.setNastnum(dsums[1]); + balancerow.addBalanceOnhandRes(res); + } + } + + private OnhandSNViewVO[] queryOnhandSNs(Set llist, T req) { + // OnhandSelectDim select = new OnhandSelectDim(); + // select.addSelectFields(OnhandDimVO.getContentFields()); + OnhandQryCond cond = new OnhandQryCond(); + Object[] voValues = VOEntityUtil.getVOValues(((ICBillOnhandReq)req).getOnhandDim(), onhandSNDimFields); + cond.addFilterDimConditon(onhandSNDimFieldsWithoutBatch, voValues); + cond.addAllSelectFields(); + OnhandSNViewVO[] snvos = null; + try { + if (SysInitGroupQuery.isSNEnabled()) { + String where = + SqlIn.formInSQL(OnhandSNVO.ALIASNAME + "." + ICPubMetaNameConst.PK_SERIALCODE, new ArrayList(llist)); + where += " and " + SqlUtil.getFun_COALESCE(OnhandSNVO.ALIASNAME + "." + OnhandNumVO.NONHANDNUM, "0.0") + " > 0.0"; + cond.setWhere(where); + snvos = NCLocator + .getInstance() + .lookup(IOnhandQry.class) + .queryOnhandSN(cond); + // ֻǵкȥ棬ûпǵά⣬ncc߼޸ijɸIJֿⲻкţԱҪԲֿΪάȥ + // ޸Ϊʹķ --raoczh 2019.8.19 + // .queryOnhandSNBySNCode(select, + // CollectionUtils.setToArray(llist)); + + } else { + String where = + SqlIn.formInSQL(OnhandSNVO.ALIASNAME + "." + OnhandSNVO.VSNCODE, new ArrayList(llist)); + where += " and " + SqlUtil.getFun_COALESCE(OnhandSNVO.ALIASNAME + "." + OnhandNumVO.NONHANDNUM, "0.0") + " > 0.0"; + cond.setWhere(where); + snvos = NCLocator + .getInstance() + .lookup(IOnhandQry.class) + .queryOnhandSN(cond); + // .queryOnhandSNBySNCodes(select, + // CollectionUtils.setToArray(llist)); + } + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + return snvos; + } + + private Set getAllSNValues(T onhandSN) { + Set llist = new HashSet(); + String key = SysInitGroupQuery.isSNEnabled() ? ICPubMetaNameConst.PK_SERIALCODE + : ICPubMetaNameConst.VSERIALCODE; + + // ȡк + if(ArrayUtils.isNotEmpty(onhandSN.getLocationVOs())) { + for(ICLocationVO lvo : onhandSN.getLocationVOs()) { + if(lvo.getAttributeValue(key) != null) { + llist.add((String)lvo.getAttributeValue(key)); + } + } +// String[] value = VOEntityUtil.getVOsValuesNotDel( +// onhandSN.getLocationVOs(), key, String.class); +// CollectionUtils.addArrayToSet(llist, value); + } + return llist; + } + + /** + * ƽǰԤ ˵ + * + * @author yangb + * @time 2010-4-10 03:10:01 + */ + private void processData() { + //к + this.filterReqsData(); + if (ValueCheckUtil.isNullORZeroLength(this.onhandReq)) { + return; + } + // ʵʽάȴѯ + OnhandDimVO[] dimvos = new OnhandDimVO[this.onhandReq.length]; + for (int i = 0; i < this.onhandReq.length; i++) { + dimvos[i] = this.onhandReq[i].getOnhandDim(); + } + dimvos = + OnhandVOTools.getRealOnhandDim(new ICBSContext().getInvInfo(), dimvos); + + OnhandVO[] handvos = this.getOnhandRes().loadOnhandRes(dimvos); + if (ValueCheckUtil.isNullORZeroLength(handvos)) { + return; + } + + this.reqsmatch = + new DimMatchUtil(this.onhandReq, OnhandDimVO.getDimContentFields(), + new String[] { + OnhandDimVO.PK_GROUP, OnhandDimVO.PK_ORG, + OnhandDimVO.CWAREHOUSEID, OnhandDimVO.CMATERIALOID, + OnhandDimVO.CMATERIALVID, + }); + + this.mapResults = new HashMap>(); + + handvos = this.preAllocHandRes(handvos); + + if (ValueCheckUtil.isNullORZeroLength(handvos)) { + this.reqsmatch = null; + return; + } + this.processOnhandData(handvos); + } + + /** + * ѯִ 0,ͳƿ֯+ֿ+ͳʵʿԽ Żϸѯ ˵ + * + * @author yangb + * @time 2010-4-10 03:10:01 + */ + private void processOnhandData(OnhandVO[] handvos) { + // ˲Դ + String key = null; + this.mapyethandvo = new HashMap(); + for (OnhandVO handvo : handvos) { + key = + handvo.getAttributeValue(OnhandDimVO.VSUBHASHCODE) + + handvo.getClocationid(); + this.mapyethandvo.put(key, handvo); + } + } + + /** + * ԴнĹϵ + */ + private boolean processResDataForHand(OnhandRes handres) { + String onhandkey = + handres.getOnhanddimvo().getVsubhashcode() + + handres.getOnhanddimvo().getClocationid(); + OnhandVO handvo = this.mapyethandvo.get(onhandkey); + if (handvo == null) { + handres.setNuseablenum(UFDouble.ZERO_DBL); + handres.setNuseableastnum(UFDouble.ZERO_DBL); + handres.setNuseablegrossnum(UFDouble.ZERO_DBL); + return true; + } + handres.getOnhanddimvo().setPk_onhanddim(handvo.getPk_onhanddim()); + // Ƿ񳬳Դ + boolean byetoverhand = false; + // Ԥ + UFDouble onhandnum = OnhandVOTools.calcHandNum(handvo); + UFDouble dtemp = NCBaseTypeUtils.sub(onhandnum, handres.getNuseablenum()); + if (NCBaseTypeUtils.isLEZero(dtemp)) { + handres.setNuseablenum(onhandnum); + handvo.setNonhandnum(UFDouble.ZERO_DBL); + } + if (handvo.getCastunitid() != null) { + // Ԥ + UFDouble onhandasnum = + OnhandVOTools.calcRealAstHandNum(handvo.getOnhandNumVO()); + UFDouble dtemp1 = + NCBaseTypeUtils.sub(onhandasnum, handres.getNuseableastnum()); + if (NCBaseTypeUtils.isLEZero(dtemp1)) { + handres.setNuseableastnum(onhandasnum); + handvo.setNonhandastnum(UFDouble.ZERO_DBL); + } + } + else { + + handres.setNuseableastnum(this.calculator.calculateAstNum( + handres.getNuseablenum(), handres.getOnhanddimvo().getVchangerate(), + handres.getOnhanddimvo().getCastunitid())); + handvo.setNonhandastnum(UFDouble.ZERO_DBL); + } + if (NCBaseTypeUtils.isGtZero(handvo.getNgrossnum())) { + // Ԥ + UFDouble onhandgrossnum = + OnhandVOTools.calcRealGrossHandNum(handvo.getOnhandNumVO()); + + UFDouble dtemp2 = + NCBaseTypeUtils.sub(onhandgrossnum, handres.getNuseablegrossnum()); + if (NCBaseTypeUtils.isLEZero(dtemp2)) { + handres.setNuseablegrossnum(onhandgrossnum); + handvo.setNgrossnum(UFDouble.ZERO_DBL); + } + } + if (NCBaseTypeUtils.isLEZero(OnhandVOTools.calcHandNum(handvo)) + && NCBaseTypeUtils.isLEZero(OnhandVOTools.calcRealAstHandNum(handvo + .getOnhandNumVO()))) { + byetoverhand = true; + this.mapyethandvo.remove(onhandkey); + } + return byetoverhand; + } + +} diff --git a/ic/src/private/nc/impl/ic/onhand/service/OnhandResServiceImpl.java b/ic/src/private/nc/impl/ic/onhand/service/OnhandResServiceImpl.java new file mode 100644 index 0000000..9ac80ec --- /dev/null +++ b/ic/src/private/nc/impl/ic/onhand/service/OnhandResServiceImpl.java @@ -0,0 +1,737 @@ +package nc.impl.ic.onhand.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 java.util.Map.Entry; + +import nc.bs.framework.common.NCLocator; +import nc.bs.ic.onhand.action.OnhandResBalance; +import nc.bs.ic.onhand.bp.OnhandBaseQry; +import nc.bs.ic.onhand.bp.OnhandDataFactory; +import nc.bs.ic.onhand.bp.OnhandLocationQry; +import nc.bs.ic.onhand.bp.OnhandSynQuery; +import nc.bs.ic.pub.env.ICBSContext; +import nc.impl.pubapp.bd.material.assistant.MarAssistantCheckUtils; +import nc.itf.ic.onhand.OnhandResService; +import nc.itf.scmpub.reference.uap.bd.customer.CustomerPubService; +import nc.itf.scmpub.reference.uap.bd.supplier.SupplierPubService; +import nc.pubitf.ic.reserve.ReserveInOut; +import nc.pubitf.uapbd.IMaterialPubService_C; +import nc.pubitf.uapbd.assistant.IMarAssistantPubService; +import nc.vo.bd.material.MaterialVO; +import nc.vo.bd.userdefrule.UserdefitemVO; +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.material.define.InvCalBodyVO; +import nc.vo.ic.onhand.define.ICBillOnhandReq; +import nc.vo.ic.onhand.define.ICBillPickResults; +import nc.vo.ic.onhand.define.OnhandBalanceResult; +import nc.vo.ic.onhand.entity.OnhandDimVO; +import nc.vo.ic.onhand.entity.OnhandVO; +import nc.vo.ic.onhand.pub.HashVOUtils; +import nc.vo.ic.onhand.pub.OnhandQueryDim; +import nc.vo.ic.onhand.pub.OnhandSelectDim; +import nc.vo.ic.onhand.pub.OnhandVOTools; +import nc.vo.ic.pub.define.ICPubMetaNameConst; +import nc.vo.ic.pub.util.CollectionUtils; +import nc.vo.ic.pub.util.DimMatchedObj; +import nc.vo.ic.pub.util.NCBaseTypeUtils; +import nc.vo.ic.pub.util.StringUtil; +import nc.vo.ic.pub.util.VOEntityUtil; +import nc.vo.ic.pub.util.ValueCheckUtil; +import nc.vo.pub.AggregatedValueObject; +import nc.vo.pub.BusinessException; +import nc.vo.pub.ISuperVO; +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 nc.vo.pubapp.pattern.pub.MapList; +import nc.vo.pubapp.pattern.pub.MathTool; +import nc.vo.sc.m61.entity.SCOrderIssueVO; +import nc.vo.scmpub.res.billtype.ICBillType; + +/** + *

+ * Դ + * + * @version v60 + * @since v60 + * @author yangb + * @time 2010-4-15 10:14:36 + */ +public class OnhandResServiceImpl implements OnhandResService { + + /** + * OnhandResServiceImpl Ĺ + */ + public OnhandResServiceImpl() { + // ĬϹ + } + + @Override + public SCOrderIssueVO[] getSCOrderIssueVOs(AggregatedValueObject[] billvos) + throws BusinessException { + if (ValueCheckUtil.isNullORZeroLength(billvos)) { + return null; + } + try { + return OnhandDataFactory.getOnhandDataSource(billvos[0]) + .getSCOrderIssueVOs(billvos); + } + catch (Exception e) { + ExceptionUtils.marsh(e); + } + return null; + } + + @Override + public ICBillPickResults pickAuto(ICBillVO billvo) throws BusinessException { + return this.pickAuto(billvo, true); + } + + /** + * Զ + * @param billvo vo + * @param pickNumNotNull ʵΪǷҪ¼ + * @return + * @throws BusinessException + */ + public ICBillPickResults pickAuto(ICBillVO billvo, boolean pickNumNotNull) throws BusinessException { + try { + List> retults = + this.pickAutoInner(new ICBillVO[] { + billvo + }, pickNumNotNull); + if (retults == null || retults.size() <= 0) { + return null; + } + if(retults.get(0).isResPick()) { + return null; + } + ICBillPickResults ret = new ICBillPickResults(retults, billvo.getBodys()); + ret.getPickBodys(); + return ret; + } + catch (Exception e) { + ExceptionUtils.marsh(e); + } + return null; + } + + /** + * + */ + @Override + public ICBillVO[] pickAuto(ICBillVO[] bills) throws BusinessException { + return this.pickAuto(bills, true); + } + + /** + * ԶԤҪԤ費Ҫ¼һ + * modify by yangls7 for hwpoc + * @param bills + * @param pickNumNotNull Ƿ¼ʵΪ0 + * @return + * @throws BusinessException + */ + public ICBillVO[] pickAuto(ICBillVO[] bills, boolean pickNumNotNull) throws BusinessException { + for(ICBillVO billvo : bills) { + ICBillBodyVO[] bodyvos = billvo.getBodys(); + for (int i = 0; i < bodyvos.length; i++) { + bodyvos[i].setAttributeValue(ICPubMetaNameConst.NNUM, null); + bodyvos[i].setAttributeValue(ICPubMetaNameConst.NASSISTNUM, null); + bodyvos[i].setAttributeValue(ICPubMetaNameConst.VNOTEBODY, null); + } + } + // Ԥ + NCLocator.getInstance().lookup(ReserveInOut.class) + .reserveOutAutoPick(bills, false); + + List> retults = + this.pickAutoInner(bills, pickNumNotNull); +// if (retults == null || retults.size() <= 0) { +// return bills; +// } + try { + List lbodys = new ArrayList(); + for (ICBillVO bill : bills) { + ICBillBodyVO[] bodys = bill.getBodys(); + if (ValueCheckUtil.isNullORZeroLength(bodys)) { + continue; + } + for (ICBillBodyVO body : bodys) { + lbodys.add(body); + } + } + ICBillPickResults ret = + new ICBillPickResults(retults, lbodys.toArray(new ICBillBodyVO[lbodys + .size()])); + + ICBillBodyVO[] pickbodys = ret.getPickBodys(); + MapList mapPickBodyVOs = + new MapList(); + //ݹӦ ͻoid vidֵ + HashSet cvendoridset = new HashSet(); + HashSet casscustidset = new HashSet(); + // ͻ + HashSet ctplcustomeridset = new HashSet(); + // Ĵ湩Ӧ + HashSet cvmivenderidset = new HashSet(); + for (ICBillBodyVO body : pickbodys) { + String cvendorid = body.getCvendorid(); + String casscustid = body.getCasscustid(); + String ctplcustomerid = body.getCtplcustomerid(); + String cvmivenderid = body.getCvmivenderid(); + if (cvendorid != null) { + cvendoridset.add(cvendorid); + } + if (casscustid != null) { + casscustidset.add(casscustid); + } + if (ctplcustomerid != null) { + ctplcustomeridset.add(ctplcustomerid); + } + if (cvmivenderid != null) { + cvmivenderidset.add(cvmivenderid); + } + + } + // ȡбĹӦoid ̨߼δֻϸԵĿͻ Ӧoid vid + HashMap cvendoridMap = new HashMap(); + HashMap casscustidMap = new HashMap(); + HashMap ctplcustomeridMap = new HashMap(); + HashMap cvmivenderidMap = new HashMap(); + HashMap cvendoridAndDate= new HashMap(); + HashMap casscustidAndDate= new HashMap(); + HashMap ctplcustomeridAndDate = new HashMap(); + HashMap cvmivenderidAndDate = new HashMap(); + UFDate busidate = AppContext.getInstance().getBusiDate(); + if (cvendoridset != null && cvendoridset.size() > 0) { + for(String cvendorid : cvendoridset) { + cvendoridAndDate.put(cvendorid,busidate); + } + //ݹӦoidҵڲѯvid + cvendoridMap = (HashMap) SupplierPubService.querySupplierVidsByOidAndDate(cvendoridAndDate); + } + if (casscustidset != null && casscustidset.size() > 0) { + for(String casscustid : casscustidset) { + casscustidAndDate.put(casscustid,busidate); + } + //ݿͻoidҵڲѯvid + casscustidMap = (HashMap) CustomerPubService.queryCustomerVidsByOidsAndDate(casscustidAndDate); + } + if (ctplcustomeridset != null && ctplcustomeridset.size() > 0) { + for (String ctplcustomerid : ctplcustomeridset) { + ctplcustomeridAndDate.put(ctplcustomerid, busidate); + } + // ݻͻoidҵڲѯvid + ctplcustomeridMap = (HashMap) CustomerPubService + .queryCustomerVidsByOidsAndDate(ctplcustomeridAndDate); + } + if (cvmivenderidset != null && cvmivenderidset.size() > 0) { + for (String cvmivenderid : cvmivenderidset) { + cvmivenderidAndDate.put(cvmivenderid, busidate); + } + // ݼĴ湩Ӧoidҵڲѯvid + cvmivenderidMap = (HashMap) SupplierPubService + .querySupplierVidsByOidAndDate(cvmivenderidAndDate); + } + //ݿͻ Ӧoidvidֵ + for (ICBillBodyVO body : pickbodys) { + if (body.getCvendorid() != null) { + body.setCvendorvid(cvendoridMap.get(body.getCvendorid())); + } + if (body.getCasscustid() != null) { + body.setCasscustvid(casscustidMap.get(body.getCasscustid())); + } + if (body.getCtplcustomerid() != null) { + body.setCtplcustomervid(ctplcustomeridMap.get(body.getCtplcustomerid())); + } + if (body.getCvmivenderid() != null) { + body.setCvmivendervid(cvmivenderidMap.get(body.getCvmivenderid())); + } + } + for (ICBillBodyVO pickbody : pickbodys) { + mapPickBodyVOs.put(pickbody.getPseudoColumn(), pickbody); + } + for (ICBillVO bill : bills) { + lbodys = mapPickBodyVOs.get(bill.getHead().getPseudoColumn()); + if (ValueCheckUtil.isNullORZeroLength(lbodys)) { + continue; + } + bill.setChildrenVO(CollectionUtils.listToArray(lbodys)); + // ¼ʶ + bill.getHead().setAttributeValue("ispickauto", "Y"); + } + // ԤҪбע + for(ICBillVO bill : bills) { + for(ICBillBodyVO bodyVO : bill.getBodys()) { + if(MathTool.equals(bodyVO.getNnum(), bodyVO.getNshouldnum())) { + bodyVO.setVnotebody(null); + } + } + } + return bills; + } + catch (Exception e) { + ExceptionUtils.marsh(e); + } + return bills; + } + + /** + * ѯݵִ(Զƽʹã˷Զƽ) + *

+ * ϸƥIJѯֻ÷ǿάֶ ĬϲѯάֶΣܴúͲõĽ + * + * @param bills ѯά + * @since 6.0 + * @author yangb + * @time 2010-7-8 09:18:24 + */ + @Override + public OnhandVO[] queryOnhandVOByBills(ICBillVO[] bills) + throws BusinessException { + try { + List ldimvos = + OnhandVOTools.getOnhandDimVOs(bills, new ICBSContext().getInvInfo()); + if (ValueCheckUtil.isNullORZeroLength(ldimvos)) { + return null; + } + ICBSContext context = new ICBSContext(); + OnhandDimVO[] dimvos = ldimvos.toArray(new OnhandDimVO[ldimvos.size()]); + OnhandVOTools.getRealOnhandDim(context.getInvInfo(), dimvos); + InvCalBodyVO[] invCalVOs = + context.getInvInfo().getInvCalBodyVO( + VOEntityUtil.getVOsValues(dimvos, OnhandDimVO.PK_ORG, + String.class), + VOEntityUtil.getVOsValues(dimvos, OnhandDimVO.CMATERIALVID, + String.class)); + List lbalancevos = new ArrayList(); + Set keysset = new HashSet(); + String key = null; + for (int i = 0; i < dimvos.length; i++) { + if (!ValueCheckUtil.isTrue(invCalVOs[i].getAutobalancemeas())) { + continue; + } + key = HashVOUtils.getContentKey(dimvos[i]); + if (keysset.contains(key)) { + continue; + } + lbalancevos.add(dimvos[i]); + } + if (ValueCheckUtil.isNullORZeroLength(lbalancevos)) { + return null; + } + return this.queryOnhandVOByDims(lbalancevos + .toArray(new OnhandDimVO[lbalancevos.size()])); + } + catch (Exception e) { + ExceptionUtils.marsh(e); + } + return null; + } + + /** + * ѯִ + *

+ * ϸƥIJѯֻ÷ǿάֶ ĬϲѯάֶΣܴúͲõĽ + * + * @param dimvos ѯά + * @since 6.0 + * @author yangb + * @time 2010-7-8 09:18:24 + */ + @Override + public OnhandVO[] queryOnhandVOByDims(OnhandDimVO[] dimvos) + throws BusinessException { + try { + OnhandSelectDim select = new OnhandSelectDim(); + select.setSum(false); + select.addSelectFields(CollectionUtils.combineArrs( + OnhandDimVO.getDimContentFields(), new String[] { + OnhandDimVO.PK_ONHANDDIM, OnhandDimVO.VHASHCODE, + OnhandDimVO.VSUBHASHCODE + })); + return this.queryOnhandVOByDims(select, dimvos, false, null); + } + catch (Exception e) { + ExceptionUtils.marsh(e); + } + return null; + } + + @Override + public OnhandVO[] queryOnhandVOByDims(OnhandSelectDim select, + OnhandDimVO[] dimvos, boolean bqueryuseablestate, String bytranstype) + throws BusinessException { + try { + List ltranstypes = null; + if (bytranstype != null) { + ltranstypes = new ArrayList(); + ltranstypes.add(bytranstype); + } + return new OnhandBaseQry().queryOnhandVOByDims(select, dimvos, + bqueryuseablestate, ltranstypes); + } + catch (Exception e) { + ExceptionUtils.marsh(e); + } + return null; + } + + /** + * ִάȲѯõĴΪԤṩ ѯ״̬õĴ + * + * @author yangb + * @time 2010-6-5 10:43:05 + */ + @Override + public OnhandVO[] queryUseableOnhand(OnhandDimVO[] dimvos) + throws BusinessException { + if (ValueCheckUtil.isNullORZeroLength(dimvos)) { + return null; + } + try { + OnhandSelectDim select = new OnhandSelectDim(); + select.setSum(false); + select.addSelectFields(CollectionUtils.combineArrs( + OnhandDimVO.getDimContentFields(), new String[] { + OnhandDimVO.PK_ONHANDDIM, OnhandDimVO.VHASHCODE, + OnhandDimVO.VSUBHASHCODE + })); + return this.queryOnhandVOByDims(select, dimvos, true, null); + } + catch (Exception e) { + ExceptionUtils.marsh(e); + } + return null; + } + + /** + * ִάȲѯõĴΪṩ ѯ״̬õĴ + * δȥӰIJֿ + * + * @author yangb + * @time 2010-6-5 10:43:05 + */ + @Override + public OnhandVO[] queryUseableOnhandForAtp(OnhandDimVO[] dimvos) + throws BusinessException { + try { + return new OnhandBaseQry().queryOnhandVOByDims(null, dimvos, true, null); + } + catch (Exception e) { + ExceptionUtils.marsh(e); + } + return null; + } + + + + /** + * + * @param billvos + * @param pickNumNotNull ʵΪ0ǷҪ¼ + * @return + */ + private List> pickAutoInner( + ICBillVO[] billvos, boolean pickNumNotNull) { + if (ValueCheckUtil.isNullORZeroLength(billvos)) { + return null; + } + //ϸbooleanֵδ ĬֵN Դ˴Ƚմ Ϊnull + IMarAssistantPubService assistantPubService = NCLocator.getInstance().lookup(IMarAssistantPubService.class); + try { + UserdefitemVO[] userdefitemVOs = assistantPubService.queryMarAssistantDefine(AppContext.getInstance().getPkGroup()); + boolean isUseDef = false; + if(userdefitemVOs!=null) { + for (UserdefitemVO vo : userdefitemVOs) { + if(vo.getClassid().equals("BS000010000100001032")) { + isUseDef = true; + } + } + } + if (isUseDef) { + this.processFreeDef(billvos); + } + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + List ltranstypes = new ArrayList(); + List lreqs = new ArrayList(); + int count = 0, totalrownum = 0; + Integer billno = null; + for (ICBillVO billvo : billvos) { + ICBillBodyVO[] bodys = billvo.getBodys(); + ICBillHeadVO head = billvo.getHead(); + ICBillOnhandReq req = null; + billno = Integer.valueOf(count); + head.setPseudoColumn(billno); + for (int i = 0; i < bodys.length; i++) { + bodys[i].setPseudoColumn(billno); + // ֧¼ʵ + // дʵ򲻼, ֵݼv57һ + // Ԥڼ֮ǰѾʵÿգ鲻Ҫټ modify by yangls7 for hwpoc + if (pickNumNotNull && (!NCBaseTypeUtils.isNullOrZero(bodys[i].getNnum()) + || !NCBaseTypeUtils.isNullOrZero(bodys[i].getNassistnum()))) { + // ҲҪԶ1ʵӦеʱ򣬻ᴮУίϺ + totalrownum++; + continue; + } + if (MathTool.compareTo(bodys[i].getNshouldnum(), UFDouble.ZERO_DBL) < 0 + && MathTool.compareTo(bodys[i].getNshouldassistnum(), + UFDouble.ZERO_DBL) < 0) { + totalrownum++; + continue; + } + bodys[i].setPk_group(head.getPk_group()); + bodys[i].setPk_org(head.getPk_org()); + bodys[i].setPk_org_v(head.getPk_org_v()); + bodys[i].setCbodywarehouseid(head.getCwarehouseid()); + req = new ICBillOnhandReq(bodys[i]); + req.setRowno(String.valueOf(totalrownum)); + totalrownum++; + lreqs.add(req); + if (!StringUtil.isSEmptyOrNull(head.getVtrantypecode())) { + ltranstypes.add(head.getVtrantypecode()); + } + } + count++; + } + List> results = + new ArrayList>(); + if (ValueCheckUtil.isNullORZeroLength(lreqs)) { + results.add(new OnhandBalanceResult(true)); + return results; + } + ICBillOnhandReq[] reqs = new ICBillOnhandReq[lreqs.size()]; + reqs = lreqs.toArray(reqs); + OnhandResBalance resb = + new OnhandResBalance(reqs); + resb.setCtranstype(ltranstypes); + + resb.onhandBalance(); + OnhandBalanceResult result = null; + for (ICBillOnhandReq reqq : reqs) { + result = resb.getResults(reqq); + if (result != null) { + results.add(result); + } + } + return results; + } + + private void processFreeDef(ICBillVO[] billvos) { + ICBillVO billvo = billvos[0]; + MapList checkvalue = check(ICPubMetaNameConst.CMATERIALVID, billvo.getBodys()); + for (ICBillBodyVO bodyvo : billvo.getBodys()) { + if (checkvalue == null) { + for (int k = 1; k <= 10; k++) { + String index = "vfree" + k; + Object vfree = bodyvo.getAttributeValue(index); + if ((vfree != null && (vfree.equals("N") || vfree.equals("false"))) ) { + bodyvo.setAttributeValue(index, null); + } + } + } else { + Map> maplist = checkvalue.toMap(); + List list = maplist.get(bodyvo.getAttributeValue(ICPubMetaNameConst.CMATERIALVID)); + for (int k = 1; k <= 10; k++) { + String index = "vfree" + k; + Object vfree = bodyvo.getAttributeValue(index); + if ((vfree != null && (vfree.equals("N") || vfree.equals("false")))) { + if(list==null || !list.contains(index)) { + bodyvo.setAttributeValue(index, null); + } + } + } + } + } + } + + public MapList check(String materialField,ISuperVO[] valueObjects) { + MapList materialMapList = new MapList(); + Map materialMap = this.getMaterialMap(materialField, valueObjects);// + if (materialMap == null || materialMap.size() == 0) { + return null; + } + Map> marFrameMap = this.getMarFrameMap(materialMap); + if (marFrameMap == null || marFrameMap.size() == 0) { + return null; + } + for (ISuperVO value : valueObjects) { + Object pk_material = value.getAttributeValue(materialField); + String pk_marasstframe = materialMap.get(pk_material).getPk_marasstframe(); + List list = marFrameMap.get(pk_marasstframe); + if(list==null) { + continue; + } + for(Integer listvlaue:list) { + if (pk_marasstframe != null) { + materialMapList.put(pk_material.toString(), "vfree"+(listvlaue-5)); + } + } + } + return materialMapList; + } + private Map> getMarFrameMap(Map materialMap) { + Map> marFrameMap = null; + try { + Set marFramePkSet = new HashSet(); + for (Entry entry : materialMap.entrySet()) { + String pk_marasstframe = entry.getValue().getPk_marasstframe(); + if (pk_marasstframe != null) { + marFramePkSet.add(pk_marasstframe); + } + } + marFrameMap = + MarAssistantCheckUtils.queryMarAsstFrameIncludeDefPropIndex(marFramePkSet + .toArray(new String[0])); + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + return marFrameMap; + } + + private Map getMaterialMap(String materialField, ISuperVO[] valueObjects) { + Map materialMap = null; + try { + Set marPkSet = new HashSet(); + for (int i = 0; i < valueObjects.length; i++) { + String pk_material = (String) valueObjects[i].getAttributeValue(materialField); + marPkSet.add(pk_material); + } + + IMaterialPubService_C marService = + NCLocator.getInstance().lookup(IMaterialPubService_C.class); + materialMap = + marService.queryMaterialBaseInfoByPks(marPkSet.toArray(new String[0]), new String[] { + MaterialVO.PK_MARASSTFRAME, MaterialVO.NAME, MaterialVO.NAME2, MaterialVO.NAME3, + MaterialVO.NAME4, MaterialVO.NAME5, MaterialVO.NAME6}); + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + return materialMap; + } + + @Override + public Map queryLastInLocation(String pk_calbody, + String cwarehouseid, String[] cmaterialvids) throws BusinessException { + try { + return new OnhandLocationQry().queryLastInLocation(pk_calbody, + cwarehouseid, cmaterialvids); + } + catch (Exception ex) { + ExceptionUtils.marsh(ex); + return new HashMap(); + } + + } + + @Override + public Map queryOnhandLocation(String pk_calbody, + String cwarehouseid, String[] cmaterialvids) throws BusinessException { + try { + return new OnhandLocationQry().queryOnhandLocation(pk_calbody, + cwarehouseid, cmaterialvids); + } + catch (Exception ex) { + ExceptionUtils.marsh(ex); + return new HashMap(); + } + } + + @Override + public OnhandVO[] queryAtpOnhand(OnhandDimVO[] dimvos, boolean bextendWarehouse) + throws BusinessException { + try { + return new OnhandSynQuery().queryOnhandForAtp(null, getQueryDim(dimvos), + bextendWarehouse); + } + catch (Exception e) { + ExceptionUtils.marsh(e); + } + return new OnhandVO[0]; + } + + private OnhandQueryDim[] getQueryDim(OnhandDimVO[] dimvos) { + if (ValueCheckUtil.isNullORZeroLength(dimvos)) { + return null; + } + DimMatchedObj handkey = null; + OnhandQueryDim[] dimconds = new OnhandQueryDim[dimvos.length]; + for (int i = 0; i < dimvos.length; i++) { + handkey = + new DimMatchedObj(dimvos[i], + OnhandDimVO.getDimContentFields()); + dimconds[i] = new OnhandQueryDim(); + dimconds[i].addDimCondition(handkey.getDimFields(), + VOEntityUtil.getVOValues(dimvos[i], handkey.getDimFields())); + } + return dimconds; + } + + @Override + public OnhandVO[] queryAtpOnhandUP(OnhandDimVO[] dimvos, + UFDateTime tupdatetime, UFDateTime endtime, boolean bextendWarehouse) throws BusinessException { + return new OnhandSynQuery().queryOnhandForAtpUP(null, + this.getQueryDim(dimvos), tupdatetime, endtime, bextendWarehouse); + } + + @Override + public ICBillPickResults reservePickAuto(ICBillVO[] billvos) + throws BusinessException { + //ʵ + this.cleanBodyNum(billvos); + //ԤԤĺټ + billvos = this.processReserve(billvos); + return this.pickAuto(billvos[0], false); + } + + /** + * Ԥ + * @param vos + * @return + */ + private ICBillVO[] processReserve(ICBillVO[] vos) { + if (ICBillType.GeneralOut.getCode().equals( + (vos[0].getHead().getBillType().getCode()))) { + return vos; + } + try { + // Ԥ + ICBillVO[] retvos = NCLocator.getInstance().lookup(ReserveInOut.class) + .reserveOutAutoPick(vos, false); + return retvos; + } + catch (Exception e) { + ExceptionUtils.wrappException(e); + } + return null; + } + + /** + * ձʵʵ + * @param vos + * @return + */ + private void cleanBodyNum(ICBillVO[] vos) { + for(ICBillVO vo : vos) { + for(ICBillBodyVO bodyVO : vo.getBodys()) { + bodyVO.setNnum(null); + bodyVO.setNassistnum(null); + bodyVO.setVnotebody(null); + } + } + } + + +} diff --git a/ic/src/private/nccloud/pubimpl/ic/pub/service/PickAutoServiceImpl.java b/ic/src/private/nccloud/pubimpl/ic/pub/service/PickAutoServiceImpl.java new file mode 100644 index 0000000..dddc921 --- /dev/null +++ b/ic/src/private/nccloud/pubimpl/ic/pub/service/PickAutoServiceImpl.java @@ -0,0 +1,1153 @@ +package nccloud.pubimpl.ic.pub.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 java.util.Map.Entry; + +import nc.bs.framework.common.InvocationInfoProxy; +import nc.bs.framework.common.NCLocator; +import nc.bs.ic.pub.env.ICBSContext; +import nc.impl.pubapp.bd.material.assistant.MarAssistantCheckUtils; +import nc.impl.pubapp.pattern.database.DataAccessUtils; +import nc.itf.ic.onhand.OnhandResService; +import nc.itf.scmpub.reference.uap.bd.customer.CustomerPubService; +import nc.itf.scmpub.reference.uap.bd.supplier.SupplierPubService; +import nc.itf.scmpub.reference.uap.group.SysInitGroupQuery; +import nc.pubitf.ic.reserve.ReserveInOut; +import nc.pubitf.uapbd.IMaterialPubService_C; +import nc.pubitf.uapbd.assistant.IMarAssistantPubService; +import nc.vo.bd.material.MaterialVO; +import nc.vo.bd.userdefrule.UserdefitemVO; +import nc.vo.ic.batchcode.BatchSynchronizer; +import nc.vo.ic.batchcode.ICBatchFields; +import nc.vo.ic.general.deal.ICBillValueSetter; +import nc.vo.ic.general.define.ICBillBodyVO; +import nc.vo.ic.general.define.ICBillVO; +import nc.vo.ic.general.define.MetaNameConst; +import nc.vo.ic.location.ICLocationVO; +import nc.vo.ic.material.define.InvBasAndCalInfo; +import nc.vo.ic.material.define.InvCalBodyVO; +import nc.vo.ic.material.define.InvMeasVO; +import nc.vo.ic.onhand.define.ICBillPickResults; +import nc.vo.ic.onhand.entity.OnhandDimVO; +import nc.vo.ic.pub.calc.BusiCalculator; +import nc.vo.ic.pub.define.ICPubMetaNameConst; +import nc.vo.ic.pub.lang.OnhandRes; +import nc.vo.ic.pub.util.CollectionUtils; +import nc.vo.ic.pub.util.NCBaseTypeUtils; +import nc.vo.ic.pub.util.StringUtil; +import nc.vo.ic.pub.util.VOEntityUtil; +import nc.vo.ic.pub.util.ValueCheckUtil; +import nc.vo.ic.sncode.ICSnFields; +import nc.vo.ic.sncode.ICSnForLocationFields; +import nc.vo.ic.sncode.SnCodeForLocationVOSynchronizer; +import nc.vo.ic.sncode.SnCodeSynchronizer; +import nc.vo.pub.BusinessException; +import nc.vo.pub.CircularlyAccessibleValueObject; +import nc.vo.pub.ISuperVO; +import nc.vo.pub.VOStatus; +import nc.vo.pub.lang.UFBoolean; +import nc.vo.pub.lang.UFDate; +import nc.vo.pub.lang.UFDouble; +import nc.vo.pubapp.AppContext; +import nc.vo.pubapp.pattern.data.IRowSet; +import nc.vo.pubapp.pattern.exception.ExceptionUtils; +import nc.vo.pubapp.pattern.pub.MapList; +import nc.vo.pubapp.pattern.pub.MathTool; +import nc.vo.pubapp.pattern.pub.SqlBuilder; +import nccloud.commons.collections.MapUtils; +import nccloud.dto.scmpub.pub.context.BillCardBodyChangedRow; +import nccloud.dto.scmpub.pub.context.BillCardBodyEditEvent; +import nccloud.pubimpl.ic.pub.operator.bodyafterrule.NumEventRule; +import nccloud.pubitf.ic.pub.service.IPickAutoService; + +/** + * Զ + * + * @author hujieh + * + */ +public class PickAutoServiceImpl implements IPickAutoService { + + Map invInfoMap = new HashMap(); + private Map isasunitstore; + + private BusiCalculator calc = BusiCalculator.getBusiCalculatorAtBS(); + + + @Override + public Object autoPick(ICBillVO billvo, Map userObject) { + List delbodys = this.processDelBody(new ICBillVO[]{billvo}); + //ǰбעֹʾ + this.clearBodyNote(billvo); + ICBillVO retBillvo = (ICBillVO) billvo.clone(); +// ICBillBodyVO[] bodyvos = retBillvo.getBodys(); + this.preprocess(retBillvo); + OnhandResService resserver = NCLocator.getInstance().lookup( + OnhandResService.class); + try { + + // Ԥ + ICBillVO[] retvos = NCLocator.getInstance().lookup(ReserveInOut.class) + .reserveOutAutoPick(new ICBillVO[] {retBillvo}, false); + retBillvo = retvos[0]; + ICBillBodyVO[] bodyvos = retvos[0].getBodys(); + //֧Ԥ modify by yangls7 +// ICBillPickResults results = resserver.reservePickAuto(billvo); + ICBillPickResults results = resserver.pickAuto(retBillvo); + if (results == null) { + this.setBodyNoteOnhandErro(retBillvo.getBodys(), results); + return retBillvo; + } + if(results.isResPick()) { + fireNumEditEvent(retBillvo, ICPubMetaNameConst.NNUM, retBillvo.getBody(0).getNnum(), -1, userObject); + return retBillvo; + } + // ѯϻϢͿϢŵinvInfoMap + this.loadInvCalBodyInfo(retBillvo); + // бһû񵽻ʾϢ +// this.setBodyNoteOnhandErro(retBillvo.getBodys(), results); + // Ƿ񸨼棬Ƿѡ˸λǷ¼ + this.getBAstunitStorebalance(retBillvo); + // ͬкŵϢ + this.fillSNDocToLocation(retBillvo, results); + List newBodyVOs = new ArrayList(); + // + for (int i = 0; i < bodyvos.length; i++) { + // һб + ICBillBodyVO[] bodys = results.getPickBodys(i); + if (bodys == null || bodys.length <= 0) { + // ûмݣֱӷ± + newBodyVOs.add(bodyvos[i]); + //zhengxinm ûм ԤʱѾ ܼɹDZ屸ע ûձ屸ע 2020-11-04 + if ((bodyvos[i].getNassistnum() != null ? bodyvos[i].getNassistnum() : new UFDouble(0)).doubleValue() + ==(bodyvos[i].getNshouldassistnum() != null ? bodyvos[i].getNshouldassistnum() : new UFDouble(0)).doubleValue()) { + bodyvos[i].setVnotebody(null); + } + continue; + } + // ԭʼкţüкţккظ + bodyvos[i].setCrowno(null); + // this.getEditorModel().getCardPanelWrapper().copyLine(); + List rowBodyVOs = new ArrayList(); + for (int k = 0; k < bodys.length; k++) {//֪֮ǰΪɶ к Ĺ zhengxinm 2021-03-10 + if (k == 0) { + this.setOnhandDataToBody(bodys[k], bodyvos[i]); + if (bodyvos[i].getStatus() != VOStatus.NEW) { + bodyvos[i].setStatus(VOStatus.UPDATED); + } + rowBodyVOs.add(bodyvos[i]); + } else { + ICBillBodyVO tempBodyvo = (ICBillBodyVO) bodyvos[i].clone(); + this.processForNewVO(tempBodyvo); + //78--2025491911--sdlizheng--ʵ䵽Ӧһϼƴ--start + if(k==bodys.length-1){ + this.setOnhandDataToBody_End(bodys[k], tempBodyvo,rowBodyVOs); + }else{ + this.setOnhandDataToBody(bodys[k], tempBodyvo); + } + rowBodyVOs.add(tempBodyvo); + //78--2025491911--sdlizheng--ʵ䵽Ӧһϼƴ--start + + } + } + newBodyVOs.addAll(rowBodyVOs); + } + // ѯĶӦⵥΪ룬Ҫתģ巭 + this.translateCcorres(newBodyVOs); + retBillvo.setChildren(bodyvos[0].getClass(), + CollectionUtils.listToArray(newBodyVOs)); + this.setbodyNote(retBillvo, results); + // ͬθֶ + new BatchSynchronizer(new ICBatchFields()).fillBatchVOtoBill(retBillvo + .getBodys()); + //Ӧ ͻvidֶ + fireCvendoridEvent(retBillvo.getBodys()); + + // ͬкŸֶ + new SnCodeSynchronizer(new ICSnFields()).fillBatchVOtoBill(retBillvo + .getBodys()); + fireNumEditEvent(retBillvo, ICPubMetaNameConst.NNUM, newBodyVOs.get(0).getNnum(), -1, userObject); + + } catch (BusinessException e) { + ExceptionUtils.wrappBusinessException(e.getMessage()); + } + CircularlyAccessibleValueObject[] allChildrenVO = retBillvo.getAllChildrenVO(); + CollectionUtils.addArrayToList(delbodys, (ICBillBodyVO[])allChildrenVO); + retBillvo.setChildrenVO(CollectionUtils.listToArray(delbodys)); + return retBillvo; + } + + private void setOnhandDataToBody_End(ICBillBodyVO bodyvo, ICBillBodyVO origin, List newBodyVOs) { + if (bodyvo == null) { + return; + } + // ƣֹкظ +// origin +// .setAttributeValue(MetaNameConst.CGENERALBID, bodyvo.getCgeneralbid()); + // кãѾԭʼкţü + origin.setAttributeValue(ICPubMetaNameConst.CROWNO, bodyvo.getCrowno()); + this.processOnhandDimInfo(bodyvo, origin); + // λ֣λϢ + this.resetBodyLocationID(bodyvo, origin); + this.processCcorrespondInfo(bodyvo, origin); + + this.processNumInfo_End(bodyvo, origin,newBodyVOs); + this.setSNInfoToBody(bodyvo, origin); + } + + private void processNumInfo_End(ICBillBodyVO bodyvo, ICBillBodyVO origin, List newBodyVOs) { + origin.setAttributeValue(ICPubMetaNameConst.NNUM, bodyvo.getNnum()); + origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, bodyvo.getNassistnum()); + origin.setAttributeValue(ICPubMetaNameConst.NGROSSNUM, + bodyvo.getNgrossnum()); + //ǰеӦ + UFDouble sumShouldNum=UFDouble.ZERO_DBL; + UFDouble sumShouldAssistNum=UFDouble.ZERO_DBL; + for(ICBillBodyVO bodyVO:newBodyVOs){ + UFDouble nShouldnum = bodyVO.getNshouldnum(); + UFDouble nShouldAssistNum = bodyVO.getNshouldassistnum(); + sumShouldNum= MathTool.add(sumShouldNum,nShouldnum); + sumShouldAssistNum= MathTool.add(sumShouldAssistNum,nShouldAssistNum); + } + //78--2025491911--sdlizheng--ʵ䵽Ӧһϼƴ--start + origin.setAttributeValue(ICPubMetaNameConst.NSHOULDNUM, MathTool.sub(bodyvo.getNshouldnum(),sumShouldNum) ); + origin.setAttributeValue(ICPubMetaNameConst.NSHOULDASSISTNUM, MathTool.sub(bodyvo.getNshouldassistnum(),sumShouldAssistNum)); + //78--2025491911--sdlizheng--ʵ䵽Ӧһϼƴ--start + + UFDouble shouldnum = origin.getNshouldnum(); + UFDouble shouldastnum = origin.getNshouldassistnum(); + UFDouble num = origin.getNnum(); + if (NCBaseTypeUtils.isNullOrZero(shouldnum) + && NCBaseTypeUtils.isNullOrZero(shouldastnum) + && NCBaseTypeUtils.isNullOrZero(num)) { + return; + } + + InvCalBodyVO calbodyvo = invInfoMap.get(origin.getCmaterialvid()) + .getInvcalbodyvo(); + + // ո⸨ǼǰӰ + origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, null); + // v636汾 ƷĴı + if (ValueCheckUtil.isTrue(calbodyvo.getSerialmanaflag())) { + origin.setAttributeValue(ICPubMetaNameConst.NNUM, bodyvo.getNnum()); +// this.caculateAfterNumEdit(bodyvo); + origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, + bodyvo.getNassistnum()); + boolean isNullServialcode = StringUtil.isSEmptyOrNullForAll(VOEntityUtil + .getVOsValuesNotDel(bodyvo.getLocationVOs(), + ICLocationVO.VSERIALCODE, String.class)); + if (bodyvo.getLocationVOs() != null && isNullServialcode) { + this.processLocAstNum(bodyvo); + } +// origin.setLocationVOs(bodyvo.getLocationVOs()); + ICLocationVO[] lvos = origin.getLocationVOs(); + ICLocationVO[] lvos2 = bodyvo.getLocationVOs(); + if(lvos2 != null) { + //ȡpks[null,null,...] ӹ + String[] lpks = VOEntityUtil.getVOsValuesNotDel(lvos == null ? new ICLocationVO[] {} : lvos, + ICLocationVO.PK_SERIALCODE, String.class); + List lpkList = new ArrayList(); + if (lpks != null && lpks.length > 0) { + for (String lpk : lpks) { + if (lpk != null) { + lpkList.add(lpk); + } + } + } + + //ȡpks[null,null,...] ӹ + + if(lpkList.size() > 0) { + int needNum = shouldnum.intValue(); + + for (ICLocationVO lvo : lvos2) { + if(!lpkList.contains(lvo.getPk_serialcode()) && lvos.length < needNum) { + lvos = CollectionUtils.combineArrs(lvos, new ICLocationVO[] {lvo}); +// needNum--; + } + } + } else { + lvos = CollectionUtils.combineArrs(lvos, lvos2); + } + } + origin.setLocationVOs(lvos); + return; + } + +// this.caculateAfterNumEdit(bodyvo); + // ڸǽϣ㸨֮󣬻ᵼ½չʾͽݲһ£ý + if (!ValueCheckUtil.isNullORZeroLength(this.isasunitstore)) { + if (ValueCheckUtil.isTrue(this.isasunitstore.get((String) origin + .getAttributeValue(ICPubMetaNameConst.CMATERIALVID) + + (String) origin.getAttributeValue(ICPubMetaNameConst.CASTUNITID)))) { + origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, + bodyvo.getNassistnum()); + } else { + bodyvo.setNassistnum(calc.calculateAstNum(bodyvo.getNnum(), + (String) origin.getAttributeValue(ICPubMetaNameConst.VCHANGERATE), + bodyvo.getCasscustid())); + } + } + + if (bodyvo.getLocationVOs() != null) { + this.processLocAstNum(bodyvo); + origin.setLocationVOs(bodyvo.getLocationVOs()); + } + } + + /** + * ѯĶӦⵥΪ룬Ҫתģ巭 + * @param newBodyVOs + */ + private void translateCcorres(List newBodyVOs) { + Set codeSet = new HashSet(); + if(newBodyVOs != null && newBodyVOs.size() > 0) { + for(ICBillBodyVO bodyVO : newBodyVOs) { + codeSet.add(bodyVO.getCcorrespondtranstype()); + } + } + Map idMap = new HashMap(); + if(codeSet.size() > 0) { + String pk_group = InvocationInfoProxy.getInstance().getGroupId(); + SqlBuilder sql = new SqlBuilder(); + sql.append(" select pk_billtypecode, pk_billtypeid from bd_billtype where "); + sql.append(" pk_group ", pk_group); + sql.append(" and "); + sql.append( " pk_billtypecode ", codeSet.toArray(new String[codeSet.size()])); + IRowSet query = new DataAccessUtils().query(sql.toString()); + while (query.next()) { + idMap.put(query.getString(0), query.getString(1)); + } + } + if(MapUtils.isNotEmpty(idMap)) { + for(ICBillBodyVO bodyVO : newBodyVOs) { + bodyVO.setCcorrespondtranstype(idMap.get(bodyVO.getCcorrespondtranstype())); + } + } + } + + + private void fireCvendoridEvent(ICBillBodyVO[] bodys) { + if (bodys == null || bodys.length == 0) { + return; + } + HashSet cvendoridset = new HashSet(); + HashSet casscustidset = new HashSet(); + // ͻ + HashSet ctplcustomeridset = new HashSet(); + // Ĵ湩Ӧ + HashSet cvmivenderidset = new HashSet(); + for (ICBillBodyVO body : bodys) { + String cvendorid = body.getCvendorid(); + String casscustid = body.getCasscustid(); + String ctplcustomerid = body.getCtplcustomerid(); + String cvmivenderid = body.getCvmivenderid(); + if (cvendorid != null) { + cvendoridset.add(cvendorid); + } + if (casscustid != null) { + casscustidset.add(casscustid); + } + if (ctplcustomerid != null) { + ctplcustomeridset.add(ctplcustomerid); + } + if (cvmivenderid != null) { + cvmivenderidset.add(cvmivenderid); + } + } + // ȡбĹӦoid ̨߼δֻϸԵĿͻ Ӧoid vid + HashMap cvendoridMap = new HashMap(); + HashMap casscustidMap = new HashMap(); + HashMap cvendoridAndDate= new HashMap(); + HashMap casscustidAndDate= new HashMap(); + HashMap ctplcustomeridMap = new HashMap(); + HashMap cvmivenderidMap = new HashMap(); + HashMap ctplcustomeridAndDate = new HashMap(); + HashMap cvmivenderidAndDate = new HashMap(); + UFDate busidate = AppContext.getInstance().getBusiDate(); + if (cvendoridset != null && cvendoridset.size() > 0) { + for(String cvendorid : cvendoridset) { + cvendoridAndDate.put(cvendorid,busidate); + } + //ݹӦoidҵڲѯvid + cvendoridMap = (HashMap) SupplierPubService.querySupplierVidsByOidAndDate(cvendoridAndDate); + } + if (casscustidset != null && casscustidset.size() > 0) { + for(String casscustid : casscustidset) { + casscustidAndDate.put(casscustid,busidate); + } + //ݿͻoidҵڲѯvid + casscustidMap = (HashMap) CustomerPubService.queryCustomerVidsByOidsAndDate(casscustidAndDate); + } + if (ctplcustomeridset != null && ctplcustomeridset.size() > 0) { + for (String ctplcustomerid : ctplcustomeridset) { + ctplcustomeridAndDate.put(ctplcustomerid, busidate); + } + // ݻͻoidҵڲѯvid + ctplcustomeridMap = (HashMap) CustomerPubService + .queryCustomerVidsByOidsAndDate(ctplcustomeridAndDate); + } + if (cvmivenderidset != null && cvmivenderidset.size() > 0) { + for (String cvmivenderid : cvmivenderidset) { + cvmivenderidAndDate.put(cvmivenderid, busidate); + } + // ݼĴ湩Ӧoidҵڲѯvid + cvmivenderidMap = (HashMap) SupplierPubService + .querySupplierVidsByOidAndDate(cvmivenderidAndDate); + } + //ݿͻ Ӧoidvidֵ + for (ICBillBodyVO body : bodys) { + if (body.getCvendorid() != null) { + body.setCvendorvid(cvendoridMap.get(body.getCvendorid())); + } + if (body.getCasscustid() != null) { + body.setCasscustvid(casscustidMap.get(body.getCasscustid())); + } + if (body.getCtplcustomerid() != null) { + body.setCtplcustomervid(ctplcustomeridMap.get(body.getCtplcustomerid())); + } + if (body.getCvmivenderid() != null) { + body.setCvmivendervid(cvmivenderidMap.get(body.getCvmivenderid())); + } + } + } + + private List processDelBody(ICBillVO[] vos) { + ICBillBodyVO[] bodys = vos[0].getBodys(); + List realbody = new ArrayList(); + List delbodys = new ArrayList(); + for (ICBillBodyVO body : bodys) { + if (body.getStatus() != 3) { + realbody.add(body); + } else { + delbodys.add(body); + } + } + vos[0].setChildrenVO(null); + vos[0].setChildrenVO(CollectionUtils.listToArray(realbody)); + return delbodys; + } + + /** + * ༭ + * + * @param row + * @param newnum + * @param oldnum + */ + private void fireNumEditEvent(ICBillVO billvo, String numField, + UFDouble num, int index, Map userObject) { + //ȡbillvoʵŵ༭¼֮vo + Map nassistnumMap = new HashMap<>(); + Map nnumMap = new HashMap<>(); + CircularlyAccessibleValueObject[] bodys = billvo.getAllChildrenVO(); + int i = 0; + for (CircularlyAccessibleValueObject body : bodys) { + UFDouble nassistnum = (UFDouble) body.getAttributeValue(MetaNameConst.NASSISTNUM); + UFDouble nnum = (UFDouble) body.getAttributeValue(MetaNameConst.NNUM); + String crowno = (String) body.getAttributeValue(MetaNameConst.CROWNO); + if(crowno == null) { + i = i + 10; + crowno = i + ""; + body.setAttributeValue(MetaNameConst.CROWNO, crowno); + } + nassistnumMap.put(crowno, nassistnum); + nnumMap.put(crowno, nnum); + } + + BillCardBodyChangedRow changedRow = new BillCardBodyChangedRow(num, + null, null); + BillCardBodyEditEvent event = new BillCardBodyEditEvent(numField, + index, new BillCardBodyChangedRow[] { changedRow }, null); + new NumEventRule().afterEdit(billvo, event, userObject); + + CircularlyAccessibleValueObject[] newBodys = billvo.getAllChildrenVO(); + for (CircularlyAccessibleValueObject body : newBodys) { + if(nassistnumMap.get(body.getAttributeValue(MetaNameConst.CROWNO)) != null) { + body.setAttributeValue(MetaNameConst.NASSISTNUM, nassistnumMap.get(body.getAttributeValue(MetaNameConst.CROWNO))); + } + if(nnumMap.get(body.getAttributeValue(MetaNameConst.CROWNO)) != null) { + body.setAttributeValue(MetaNameConst.NNUM, nnumMap.get(body.getAttributeValue(MetaNameConst.CROWNO))); + } + } + } + + /** + * Ӧıעóɡִ㡱 ijֻõһС + *

+ * ˵ + * + * @param bodys + *

+ * @since 6.3 + * @author zhaofeid + * @time 2013-7-31 04:45:39 + */ + private void setbodyNote(ICBillVO billvo, ICBillPickResults results) { + ICBillBodyVO[] uiBodys = billvo.getBodys(); + String errMsg = OnhandRes.getOnhandErro(); + Set origRowNo = new HashSet(); + + + int realIndex = 0; + int pickIndex = 1;//± + for (int i = 0, loop = uiBodys.length; i < loop; i++) { + if(uiBodys[i].getNshouldassistnum() == null && uiBodys[i].getNshouldnum() == null) { + continue; + } + + ICBillBodyVO[] bodys = results.getPickBodys(realIndex); + if (ValueCheckUtil.isNullORZeroLength(bodys)) { + continue; + } + + ICBillBodyVO uibody = uiBodys[i]; + UFDouble nshouldnum = uibody.getNshouldnum(); + String crowno = uibody.getCrowno(); + for (ICBillBodyVO body : bodys) { + //ֹμ㣬ӻλжϣͬһбк󣬱кͼлλͬ--sdlizheng start + if(body.getClocationid().equals(uibody.getClocationid())){ + UFDouble nnum = body.getNnum(); + nshouldnum = nshouldnum.sub(nnum); + } + //ֹμ㣬ӻλжϣͬһбк󣬱кͼлλͬ--sdlizheng start + } + + if (nshouldnum!=null && UFDouble.ZERO_DBL.compareTo(nshouldnum) < 0) { + origRowNo.add(crowno); + } + //sdlizheng --ΪУȡpickbodysʱ±rowҪѭ˴Ѽ֮1--start + if(pickIndex==bodys.length){ + realIndex++; + pickIndex=1; + }else { + pickIndex++; + } + //sdlizheng --ΪУȡpickbodysʱ±rowҪѭ˴Ѽ֮1--end + } + for (int i = 0; i < uiBodys.length; i++) { + String rowno = (String) uiBodys[i] + .getAttributeValue(ICPubMetaNameConst.CROWNO); + if (origRowNo.contains(rowno)) { + uiBodys[i].setAttributeValue(ICPubMetaNameConst.VNOTEBODY, errMsg); + } + } + } + + private void processForNewVO(ICBillBodyVO tempBodyvo) { + // ճлѸеı¸ʱ㱨ۻʴ + tempBodyvo.setAttributeValue(MetaNameConst.NQTUNITNUM, null); + tempBodyvo.setAttributeValue(ICPubMetaNameConst.NSHOULDNUM, null); + tempBodyvo.setAttributeValue(ICPubMetaNameConst.NSHOULDASSISTNUM, null); + tempBodyvo.setAttributeValue(ICPubMetaNameConst.NNUM, null); + tempBodyvo.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, null); + tempBodyvo.setAttributeValue(MetaNameConst.CGENERALBID, null); + tempBodyvo.setLocationVOs(null); + tempBodyvo.setAttributeValue("rowid", null); + tempBodyvo.setStatus(VOStatus.NEW); + + //չ + clearExtendTableData(tempBodyvo); + } + + private void clearExtendTableData(ICBillBodyVO tempBodyvo) { + String[] extendTableField = new String[] { "naccumvminum", + "ncorrespondgrsnum", "ncorrespondastnum", "ncorrespondnum", + "naccumoutsignnum", "naccumoutbacknum", "nrushnum", "nsignnum", + "ntotaltrannum", "btranendflag", "naccumwastnum", "csumid" }; + for(String field : extendTableField) { + tempBodyvo.setAttributeValue(field, null); + } + } + + private void setOnhandDataToBody(ICBillBodyVO bodyvo, ICBillBodyVO origin) { + if (bodyvo == null) { + return; + } + // ƣֹкظ +// origin +// .setAttributeValue(MetaNameConst.CGENERALBID, bodyvo.getCgeneralbid()); + // кãѾԭʼкţü + origin.setAttributeValue(ICPubMetaNameConst.CROWNO, bodyvo.getCrowno()); + this.processOnhandDimInfo(bodyvo, origin); + // λ֣λϢ + this.resetBodyLocationID(bodyvo, origin); + this.processCcorrespondInfo(bodyvo, origin); + + this.processNumInfo(bodyvo, origin); + this.setSNInfoToBody(bodyvo, origin); + } + + private void setSNInfoToBody(ICBillBodyVO bodyvo, ICBillBodyVO origin) { + // к + if (!SysInitGroupQuery.isSNEnabled()) { + return; + } + UFDouble nassistnum = (UFDouble) origin + .getAttributeValue(ICPubMetaNameConst.NASSISTNUM); + // ֻбΪ1ʱñֵ + if (!NCBaseTypeUtils.isEquals(nassistnum, UFDouble.ONE_DBL)) { + return; + } + ICLocationVO[] lvoes = origin.getLocationVOs(); + //Ϊһλɾʵ¼֮Ȼһûɾֻһ + if(lvoes != null && lvoes.length > 0) { + List lvoLists = new ArrayList<>(); + for(ICLocationVO lvo : lvoes) { + if(VOStatus.DELETED != lvo.getStatus()) { + lvoLists.add(lvo); + } + } + ICLocationVO[] lvos = lvoLists.toArray(new ICLocationVO[] {}); + if (ValueCheckUtil.isNullORZeroLength(lvos) || lvos.length != 1) { + return; + } + ICLocationVO lvo = lvos[0]; + if (StringUtil.isNullStringOrNull(lvo.getVserialcode()) + && StringUtil.isNullStringOrNull(lvo.getPk_serialcode())) { + return; + } + origin.setAttributeValue(ICPubMetaNameConst.VSERIALCODE, + lvos[0].getVserialcode()); + origin.setAttributeValue(ICPubMetaNameConst.PK_SERIALCODE, + lvos[0].getPk_serialcode()); + } + } + + private void processNumInfo(ICBillBodyVO bodyvo, ICBillBodyVO origin) { + origin.setAttributeValue(ICPubMetaNameConst.NNUM, bodyvo.getNnum()); + origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, bodyvo.getNassistnum()); + origin.setAttributeValue(ICPubMetaNameConst.NGROSSNUM, + bodyvo.getNgrossnum()); + //78--2025491911--sdlizheng--ʵ䵽Ӧһϼƴ--start + origin.setAttributeValue(ICPubMetaNameConst.NSHOULDNUM, bodyvo.getNnum()); + origin.setAttributeValue(ICPubMetaNameConst.NSHOULDASSISTNUM, bodyvo.getNassistnum()); + //78--2025491911--sdlizheng--ʵ䵽Ӧһϼƴ--start + + UFDouble shouldnum = origin.getNshouldnum(); + UFDouble shouldastnum = origin.getNshouldassistnum(); + UFDouble num = origin.getNnum(); + if (NCBaseTypeUtils.isNullOrZero(shouldnum) + && NCBaseTypeUtils.isNullOrZero(shouldastnum) + && NCBaseTypeUtils.isNullOrZero(num)) { + return; + } + + InvCalBodyVO calbodyvo = invInfoMap.get(origin.getCmaterialvid()) + .getInvcalbodyvo(); + + // ո⸨ǼǰӰ + origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, null); + // v636汾 ƷĴı + if (ValueCheckUtil.isTrue(calbodyvo.getSerialmanaflag())) { + origin.setAttributeValue(ICPubMetaNameConst.NNUM, bodyvo.getNnum()); +// this.caculateAfterNumEdit(bodyvo); + origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, + bodyvo.getNassistnum()); + boolean isNullServialcode = StringUtil.isSEmptyOrNullForAll(VOEntityUtil + .getVOsValuesNotDel(bodyvo.getLocationVOs(), + ICLocationVO.VSERIALCODE, String.class)); + if (bodyvo.getLocationVOs() != null && isNullServialcode) { + this.processLocAstNum(bodyvo); + } +// origin.setLocationVOs(bodyvo.getLocationVOs()); + ICLocationVO[] lvos = origin.getLocationVOs(); + ICLocationVO[] lvos2 = bodyvo.getLocationVOs(); + if(lvos2 != null) { + //ȡpks[null,null,...] ӹ + String[] lpks = VOEntityUtil.getVOsValuesNotDel(lvos == null ? new ICLocationVO[] {} : lvos, + ICLocationVO.PK_SERIALCODE, String.class); + List lpkList = new ArrayList(); + if (lpks != null && lpks.length > 0) { + for (String lpk : lpks) { + if (lpk != null) { + lpkList.add(lpk); + } + } + } + + //ȡpks[null,null,...] ӹ + + if(lpkList.size() > 0) { + int needNum = shouldnum.intValue(); + + for (ICLocationVO lvo : lvos2) { + if(!lpkList.contains(lvo.getPk_serialcode()) && lvos.length < needNum) { + lvos = CollectionUtils.combineArrs(lvos, new ICLocationVO[] {lvo}); +// needNum--; + } + } + } else { + lvos = CollectionUtils.combineArrs(lvos, lvos2); + } + } + origin.setLocationVOs(lvos); + return; + } + +// this.caculateAfterNumEdit(bodyvo); + // ڸǽϣ㸨֮󣬻ᵼ½չʾͽݲһ£ý + if (!ValueCheckUtil.isNullORZeroLength(this.isasunitstore)) { + if (ValueCheckUtil.isTrue(this.isasunitstore.get((String) origin + .getAttributeValue(ICPubMetaNameConst.CMATERIALVID) + + (String) origin.getAttributeValue(ICPubMetaNameConst.CASTUNITID)))) { + origin.setAttributeValue(ICPubMetaNameConst.NASSISTNUM, + bodyvo.getNassistnum()); + } else { + bodyvo.setNassistnum(calc.calculateAstNum(bodyvo.getNnum(), + (String) origin.getAttributeValue(ICPubMetaNameConst.VCHANGERATE), + bodyvo.getCasscustid())); + } + } + + if (bodyvo.getLocationVOs() != null) { + this.processLocAstNum(bodyvo); + origin.setLocationVOs(bodyvo.getLocationVOs()); + } + } + + + + /** + * λϢĸ¼㣬βʱλƷϢ⡣ + * + * @param body + * @param cal + */ + private void processLocAstNum(ICBillBodyVO body) { + ICLocationVO[] locs = body.getLocationVOs(); + if (ValueCheckUtil.isNullORZeroLength(locs)) { + return; + } + + UFDouble bodynum = body.getNassistnum(); + UFDouble nsum = UFDouble.ZERO_DBL; + UFDouble nassistnum = UFDouble.ZERO_DBL; + for (int i = 0; i < locs.length - 1; i++) { + // ˴ǷƷҪлλϢʱ´ + nassistnum = calc.calculateAstNum(locs[i].getNnum(), + body.getVchangerate(), body.getCastunitid()); + + locs[i].setNassistnum(nassistnum); + nsum = NCBaseTypeUtils.add(nsum, nassistnum); + } + if (locs.length != 1) { + locs[locs.length - 1].setNassistnum(NCBaseTypeUtils.sub(bodynum, nsum)); + } else if (locs.length == 1) { + locs[0].setNassistnum(bodynum); + } + } + + private void processCcorrespondInfo(ICBillBodyVO bodyvo, ICBillBodyVO origin) { + String[] corresponds = new String[] { MetaNameConst.CCORRESPONDTYPE, + MetaNameConst.CCORRESPONDTRANSTYPE, MetaNameConst.CCORRESPONDCODE, + MetaNameConst.CCORRESPONDHID, MetaNameConst.CCORRESPONDBID, + MetaNameConst.CCORRESPONDROWNO, ICPubMetaNameConst.CROWNO, + ICPubMetaNameConst.NCOSTMNY, ICPubMetaNameConst.NPLANNEDMNY, + MetaNameConst.DBIZDATE, ICPubMetaNameConst.VNOTEBODY }; + String cmateiralvid = (String) origin + .getAttributeValue(ICPubMetaNameConst.CMATERIALVID); + InvCalBodyVO invvo = this.invInfoMap.get(cmateiralvid).getInvcalbodyvo(); + // ڷdzϣӦⵥϢԭʼϢⵥ + if (invvo == null || !ValueCheckUtil.isTrue(invvo.getOuttrackin())) { + return; + } + for (String field : corresponds) { + origin.setAttributeValue(field, bodyvo.getAttributeValue(field)); + } + } + + /** + * ñλIDƷϢֲڶλձ壬õƷλϢ + * + * @param bodyvo + * @param row + * ǰ + */ + private void resetBodyLocationID(ICBillBodyVO bodyvo, ICBillBodyVO origin) { + ICLocationVO[] locs = bodyvo.getLocationVOs(); + + if (ValueCheckUtil.isNullORZeroLength(locs)) { + return; + } + + List locids = VOEntityUtil.getVOsValueListNotDel(locs, + ICLocationVO.CLOCATIONID); + if (ValueCheckUtil.isNullORZeroLength(locids)) { + return; + } + + String locid = locids.get(0); + for (String id : locids) { + if (!StringUtil.isStringEqual(locid, id)) { + locid = null; + break; + } + } + origin.setAttributeValue(ICPubMetaNameConst.CLOCATIONID, locid); + } + + private void processOnhandDimInfo(ICBillBodyVO bodyvo, ICBillBodyVO origin) { + for (String field : OnhandDimVO.getDimContentFields()) { + if (field.equals(OnhandDimVO.VBATCHCODE)) { + origin.setAttributeValue(field, bodyvo.getAttributeValue(field)); + continue; + } + if (field.equals(OnhandDimVO.CLOCATIONID)) { + // V60λ֣λϢ + continue; + } + // Ļǻʼǽ泡ϣϢ + if (field.equals(OnhandDimVO.VCHANGERATE) + && StringUtil.isSEmptyOrNull(bodyvo.getVchangerate())) { + continue; + } + // ̶(״̬ĿӦ̡̡ͻ) + if (field.equals(OnhandDimVO.CSTATEID) + && StringUtil.isSEmptyOrNull(bodyvo.getCstateid())) { + continue; + } + if (field.equals(OnhandDimVO.CPROJECTID) + && StringUtil.isSEmptyOrNull(bodyvo.getCprojectid())) { + continue; + } + if (field.equals(OnhandDimVO.CVENDORID) + && StringUtil.isSEmptyOrNull(bodyvo.getCvendorid())) { + continue; + } + if (field.equals(OnhandDimVO.CPRODUCTORID) + && StringUtil.isSEmptyOrNull(bodyvo.getCproductorid())) { + continue; + } + if (field.equals(OnhandDimVO.CASSCUSTID) + && StringUtil.isSEmptyOrNull(bodyvo.getCasscustid())) { + continue; + } + if (field.equals(OnhandDimVO.CFFILEID) + && StringUtil.isSEmptyOrNull(bodyvo.getCffileid())) { + continue; + } + origin.setAttributeValue(field, bodyvo.getAttributeValue(field)); + } + } + + /** + * ֮ǰɵıע + * + * @param uiBodys + */ + private void clearBodyNote(ICBillVO billvo) { + ICBillBodyVO[] bodyvos = billvo.getBodys(); + for (int i = 0; i < bodyvos.length; i++) { + bodyvos[i].setAttributeValue(ICPubMetaNameConst.NNUM, null); + bodyvos[i].setAttributeValue(ICPubMetaNameConst.NASSISTNUM, null); +// String vnote = (String) bodyvos[i] +// .getAttributeValue(ICPubMetaNameConst.VNOTEBODY); +// if (StringUtil.isSEmptyOrNull(vnote) +// || vnote.indexOf(OnhandRes.getOnhandErro()) < 0) { +// continue; +// } + bodyvos[i].setAttributeValue(ICPubMetaNameConst.VNOTEBODY, null); + } + } + + /** + * ǰԤʵձ屸עʽǽı䶯 + */ + private void preprocess(ICBillVO billvo) { + // յݱ +// for (ICBillBodyVO body : billvo.getBodys()) { +// ICLocationVO[] locationVOs = body.getLocationVOs(); +// if(locationVOs != null) { +// for (ICLocationVO icLocationVO : locationVOs) { +// icLocationVO.setStatus(3); +// } +// } +// body.setLocationVOs(locationVOs); +// } + IMarAssistantPubService assistantPubService = NCLocator.getInstance().lookup(IMarAssistantPubService.class); + try { + UserdefitemVO[] userdefitemVOs = assistantPubService.queryMarAssistantDefine(AppContext.getInstance().getPkGroup()); + boolean isUseDef = false; + if(userdefitemVOs!=null) { + for (UserdefitemVO vo : userdefitemVOs) { + if(vo.getClassid().equals("BS000010000100001032")) { + isUseDef = true; + } + } + } + if (isUseDef) { + this.processFreeDef(billvo); + } + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + // ͳһ䶯ʸʽĻʸʽƥ + new ICBillValueSetter().procChangeRateFormat(new ICBillVO[] { billvo }, + new ICBSContext().getInvInfo()); + } + + /** + * ǰ ˲ɸ ´άȲƥ + */ + @SuppressWarnings("unchecked") + private void processFreeDef(ICBillVO billvo) { + Class clazz = (Class) billvo.getClass(); + MapList checkvalue = check(ICPubMetaNameConst.CMATERIALVID, billvo.getChildren(clazz)); + for (ICBillBodyVO bodyvo : billvo.getBodys()) { + if (checkvalue == null) { + for (int k = 1; k <= 10; k++) { + String index = "vfree" + k; + Object vfree = bodyvo.getAttributeValue(index); + if ((vfree != null&&vfree.equals("N")) ) { + bodyvo.setAttributeValue(index, null); + } + } + } else { + Map> maplist = checkvalue.toMap(); + List list = maplist.get(bodyvo.getAttributeValue(ICPubMetaNameConst.CMATERIALVID)); + for (int k = 1; k <= 10; k++) { + String index = "vfree" + k; + Object vfree = bodyvo.getAttributeValue(index); + if ((vfree != null && vfree.equals("N"))) { + if(list==null || !list.contains(index)) { + bodyvo.setAttributeValue(index, null); + } + } + } + } + } + } + + public MapList check(String materialField,ISuperVO[] valueObjects) { + MapList materialMapList = new MapList(); + Map materialMap = this.getMaterialMap(materialField, valueObjects); + if (materialMap == null || materialMap.size() == 0) { + return null; + } + Map> marFrameMap = this.getMarFrameMap(materialMap); + if (marFrameMap == null || marFrameMap.size() == 0) { + return null; + } + for (ISuperVO value : valueObjects) { + Object pk_material = value.getAttributeValue(materialField); + String pk_marasstframe = materialMap.get(pk_material).getPk_marasstframe(); + List list = marFrameMap.get(pk_marasstframe); + if(list==null) { + continue; + } + for(Integer listvlaue:list) { + if (pk_marasstframe != null) { + materialMapList.put(pk_material.toString(), "vfree"+(listvlaue-5)); + } + } + } + return materialMapList; + } + private Map> getMarFrameMap(Map materialMap) { + Map> marFrameMap = null; + try { + Set marFramePkSet = new HashSet(); + for (Entry entry : materialMap.entrySet()) { + String pk_marasstframe = entry.getValue().getPk_marasstframe(); + if (pk_marasstframe != null) { + marFramePkSet.add(pk_marasstframe); + } + } + marFrameMap = + MarAssistantCheckUtils.queryMarAsstFrameIncludeDefPropIndex(marFramePkSet + .toArray(new String[0])); + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + return marFrameMap; + } + private Map getMaterialMap(String materialField, ISuperVO[] valueObjects) { + Map materialMap = null; + try { + Set marPkSet = new HashSet(); + for (int i = 0; i < valueObjects.length; i++) { + String pk_material = (String) valueObjects[i].getAttributeValue(materialField); + marPkSet.add(pk_material); + } + + IMaterialPubService_C marService = + NCLocator.getInstance().lookup(IMaterialPubService_C.class); + materialMap = + marService.queryMaterialBaseInfoByPks(marPkSet.toArray(new String[0]), new String[] { + MaterialVO.PK_MARASSTFRAME, MaterialVO.NAME, MaterialVO.NAME2, MaterialVO.NAME3, + MaterialVO.NAME4, MaterialVO.NAME5, MaterialVO.NAME6}); + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + return materialMap; + } + + + + /** + * ûм𵽴Уñ屸עִ㡱 + * + * @param uiBodys + * @param results + */ + private void setBodyNoteOnhandErro(ICBillBodyVO[] uiBodys, + ICBillPickResults results) { + String errMsg = OnhandRes.getOnhandErro(); + if (results == null) { + for (int i = 0, loop = uiBodys.length; i < loop; i++) { + + if (null == uiBodys[i] + .getAttributeValue(ICPubMetaNameConst.CMATERIALVID)) { + continue; + } + if (!NCBaseTypeUtils.isNullOrZero((UFDouble) uiBodys[i] + .getAttributeValue(ICPubMetaNameConst.NNUM))) { + continue; + } + uiBodys[i].setAttributeValue(ICPubMetaNameConst.VNOTEBODY, errMsg); +// uiBodys[i].setAttributeValue(ICPubMetaNameConst.CROWNO, i); + } + return; + } + + for (int i = 0, loop = uiBodys.length; i < loop; i++) { + ICBillBodyVO[] bodys = results.getPickBodys(i); + if (!ValueCheckUtil.isNullORZeroLength(bodys)) { + continue; + } + + if (null == uiBodys[i].getAttributeValue(ICPubMetaNameConst.CMATERIALVID)) { + continue; + } + if (!NCBaseTypeUtils.isNullOrZero((UFDouble) uiBodys[i] + .getAttributeValue(ICPubMetaNameConst.NNUM))) { + continue; + } + uiBodys[i].setAttributeValue(ICPubMetaNameConst.VNOTEBODY, errMsg); + } + + } + + private void loadInvCalBodyInfo(ICBillVO billvo) { + String pk_org = (String) billvo.getHead().getAttributeValue( + ICPubMetaNameConst.PK_ORG); + ICBillBodyVO[] uiBodys = billvo.getBodys(); + Set invpks = new HashSet(); + for (int i = 0; i < uiBodys.length; i++) { + String cmaterialvid = (String) uiBodys[i] + .getAttributeValue(ICPubMetaNameConst.CMATERIALVID); + if (StringUtil.isSEmptyOrNull(cmaterialvid)) { + continue; + } + invpks.add(cmaterialvid); + } + + if (invpks.size() == 0) { + return; + } + InvBasAndCalInfo[] invInfos = new ICBSContext().getInvInfo() + .getInvBasAndCalInfo(pk_org, invpks.toArray(new String[0])); + if (invInfos == null || invInfos.length == 0) { + return; + } + // this.invcalbodysmap = + // CollectionUtils.hashVOArray(MaterialStockVO.PK_MATERIAL, invInfos); + this.invInfoMap = this.setInvBasInfosToMap(invInfos); + } + + private Map setInvBasInfosToMap( + InvBasAndCalInfo[] invInfos) { + Map infoMap = new HashMap(); + for (InvBasAndCalInfo info : invInfos) { + // BUG:ûз䵽֯ᱨ + if (info == null || info.getInvcalbodyvo() == null) { + continue; + } + String key = info.getInvcalbodyvo().getPk_material(); + infoMap.put(key, info); + } + return infoMap; + } + + /** + * õǷ񸨼ǽ + * + * @return + */ + private void getBAstunitStorebalance(ICBillVO billvo) { + ICBillBodyVO[] bodyvos = billvo.getBodys(); + this.isasunitstore = null; + Set invmeasPkSet = new HashSet(); + List invpks = new ArrayList(); + List measpks = new ArrayList(); + for (int i = 0; i < bodyvos.length; i++) { + String invpk = (String) bodyvos[i] + .getAttributeValue(ICPubMetaNameConst.CMATERIALVID); + if (StringUtil.isSEmptyOrNull(invpk)) { + continue; + } + String measpk = (String) bodyvos[i] + .getAttributeValue(ICPubMetaNameConst.CASTUNITID); + ; + if (StringUtil.isSEmptyOrNull(measpk)) { + continue; + } + String key = invpk + measpk; + if (!invmeasPkSet.contains(key)) { + invmeasPkSet.add(key); + invpks.add(invpk); + measpks.add(measpk); + } + + } + InvMeasVO[] invmeasvos = new ICBSContext().getInvInfo().getInvMeasVO( + invpks.toArray(new String[invpks.size()]), + measpks.toArray(new String[measpks.size()])); + Map bastunitstore = new HashMap(); + if (invmeasvos != null) { + for (InvMeasVO invMeasVO : invmeasvos) { + if (invMeasVO == null) { + // ϿûиϢ + continue; + } + bastunitstore.put(invMeasVO.getPk_material() + invMeasVO.getPk_measdoc(), + invMeasVO.getIsstorebalance()); + } + } + + this.isasunitstore = bastunitstore; + } + + /** + * ͬкŵϢ + * @param billvo + * @param results + * + */ + private void fillSNDocToLocation(ICBillVO billvo, ICBillPickResults results) { + List locs = new ArrayList(); + for (int i = 0, loop = billvo.getBodys().length; i < loop; i++) { + ICBillBodyVO[] bodys = results.getPickBodys(i); + if (ValueCheckUtil.isNullORZeroLength(bodys)) { + continue; + } + for (ICBillBodyVO body : bodys) { + if (body == null) { + continue; + } + CollectionUtils.addArrayToList(locs, body.getLocationVOs()); + } + } + // ͬкϢICSnForLocationFields̳AbstractBatchFieldMapͬϢ + new SnCodeForLocationVOSynchronizer(new ICSnForLocationFields()) + .fillBatchVOtoBill(locs.toArray(new ICLocationVO[0])); + } + +} diff --git a/ic/src/public/nc/vo/ic/onhand/define/ICBillPickResults.java b/ic/src/public/nc/vo/ic/onhand/define/ICBillPickResults.java new file mode 100644 index 0000000..14a2af4 --- /dev/null +++ b/ic/src/public/nc/vo/ic/onhand/define/ICBillPickResults.java @@ -0,0 +1,492 @@ +package nc.vo.ic.onhand.define; + +import java.io.Serializable; +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import nc.bs.ic.pub.env.ICBSContext; +import nc.itf.scmpub.reference.uap.group.SysInitGroupQuery; +import nc.vo.ic.general.define.ICBillBodyVO; +import nc.vo.ic.location.ICLocationVO; +import nc.vo.ic.material.define.InvCalBodyVO; +import nc.vo.ic.onhand.entity.OnhandDimVO; +import nc.vo.ic.onhand.entity.OnhandSNVO; +import nc.vo.ic.onhand.pub.OnhandVOTools; +import nc.vo.ic.pub.define.ICPubMetaNameConst; +import nc.vo.ic.pub.lang.OnhandRes; +import nc.vo.ic.pub.util.CollectionUtils; +import nc.vo.ic.pub.util.NCBaseTypeUtils; +import nc.vo.ic.pub.util.StringUtil; +import nc.vo.ic.pub.util.VOEntityUtil; +import nc.vo.ic.pub.util.ValueCheckUtil; +import nc.vo.pub.VOStatus; +import nc.vo.pub.lang.UFDouble; +import nc.vo.pubapp.scale.ScaleUtils; +import nc.vo.pubapp.util.VORowNoUtils; + +/** + *

+ * ִ + * + * @version 汾 + * @since һ汾 + * @author yangb + * @time 2010-4-16 01:05:00 + */ +public class ICBillPickResults implements Serializable { + + private static final long serialVersionUID = 201008201108000513L; + + // ĵݱVO + private ICBillBodyVO[] curbillbodyvos; + + private Map mapbodyvos; + + // ԭʼȻĶӦϵ + private transient Map> maponhandbalanceresult; + + // ǰĵݱVO + private ICBillBodyVO[] originbillbodyvos; + + // + private List> pickresults; + + // ȵĹ + private transient ScaleUtils scale; + + //ʶǷΪԤ + private boolean isResPick = false; + + /** + * @return the isResPick + */ + public boolean isResPick() { + return isResPick; + } + + /** + * @param isResPick the isResPick to set + */ + public void setResPick(boolean isResPick) { + this.isResPick = isResPick; + } + + /** + * OnhandBalanceResult Ĺ + */ + public ICBillPickResults(boolean isResPick) { + this.isResPick = isResPick; + } + + /** + * ICBillPickResults Ĺ + */ + public ICBillPickResults( + List> pickresults, + ICBillBodyVO[] originbodyvos) { + this.pickresults = pickresults; + this.originbillbodyvos = originbodyvos; + } + + /** + * ȡıICBillBodyVOs + */ + public ICBillBodyVO[] getPickBodys() { + if (this.curbillbodyvos != null) { + return this.curbillbodyvos; + } + List retlist = new ArrayList(); + ICBillBodyVO[] bodyvos = null; + for (int i = 0; i < this.originbillbodyvos.length; i++) { + bodyvos = this.getPickBodys(i); + if (bodyvos == null || bodyvos.length <= 0) { + //ûм𵽣originvoڱעʾִ + this.originbillbodyvos[i].setVnotebody(OnhandRes.getOnhandErro()); + retlist.add(this.originbillbodyvos[i]); + continue; + } + //жӦݣݼĽУbodyvosϵıע + this.processBodyNote(this.originbillbodyvos[i], bodyvos); + CollectionUtils.addArrayToList(retlist, bodyvos); + } + this.curbillbodyvos = CollectionUtils.listToArray(retlist); + // 绻 + this.processBodyData(this.curbillbodyvos); + return this.curbillbodyvos; + } + + /** + * 屸עԭʼӦڶӦܽ棬ִ + * + * @param orivo ԭʼ + * @param curvos + */ + private void processBodyNote(ICBillBodyVO orivo, ICBillBodyVO[] curvos) { + UFDouble shouldNum = orivo.getNshouldnum(); + UFDouble shouldasNum = orivo.getNshouldassistnum(); + UFDouble totalNum = UFDouble.ZERO_DBL; + UFDouble totalasNum = UFDouble.ZERO_DBL; + for (ICBillBodyVO curvo : curvos) { + totalNum = NCBaseTypeUtils.add(totalNum, curvo.getNnum()); + totalasNum = NCBaseTypeUtils.add(totalasNum, curvo.getNassistnum()); + } + + if (NCBaseTypeUtils.isGtZero(NCBaseTypeUtils.sub(shouldNum, totalNum)) + || NCBaseTypeUtils.isGtZero(NCBaseTypeUtils + .sub(shouldasNum, totalasNum))) { + for (ICBillBodyVO curvo : curvos) { + if (StringUtil.isSEmptyOrNull(curvo.getVnotebody())) { + curvo.setVnotebody(OnhandRes.getOnhandErro()); + } + } + } + + } + + /** + * ȡıICBillBodyVO + */ + public ICBillBodyVO[] getPickBodys(int row) { + if (this.mapbodyvos != null + && this.mapbodyvos.containsKey(String.valueOf(row))) { + return this.mapbodyvos.get(String.valueOf(row)); + } + OnhandBalanceResult result = + this.getMapResults().get(String.valueOf(row)); + if (result == null) { + return null; + } + List retlist = new ArrayList(); + if (result.getResults() == null || result.getResults().size() <= 0) { + ICBillBodyVO[] vos = + (ICBillBodyVO[]) Array.newInstance(result.getOnhandReq().getBodyvo() + .getClass(), 1); + vos[0] = result.getOnhandReq().getBodyvo(); + return vos; + } + ICBillBodyVO bodyvo = + (ICBillBodyVO) result.getOnhandReq().getBodyvo().clone(); + result.setResults(prepare(result.getResults(), bodyvo)); + // Ȱִάȷ飬λ+ӦⵥID + Map> mapgroup = + this.groupBalanceOnhandRes(result.getResults()); + int rowCount = 0; + for (List lbalances : mapgroup.values()) { + rowCount = rowCount + 1; + if (retlist.size() > 0) { + bodyvo = (ICBillBodyVO) result.getOnhandReq().getBodyvo().clone(); + bodyvo.setStatus(VOStatus.NEW); + bodyvo.setCgeneralbid(null); + bodyvo.setCrowno(null); + bodyvo.setPseudoColumn(bodyvo.getPseudoColumn()); + //bodyvo.setNshouldnum(null); + //bodyvo.setNshouldassistnum(null); + } + //Ϊʵ,Ҫ + this.synBodyData(bodyvo, lbalances.get(0)); + ICLocationVO[] locs = null; + List listlocs = new ArrayList(); + //Ϊʵԭе + bodyvo.setNnum(null); + bodyvo.setNassistnum(null); + for (BalanceOnhandRes balance : lbalances) { + UFDouble nnum = + NCBaseTypeUtils.add(bodyvo.getNnum(), balance.getNnum()); + UFDouble nassistnum = + NCBaseTypeUtils.add(bodyvo.getNassistnum(), balance.getNastnum()); + bodyvo.setNnum(this.getScale() + .adjustNumScale(nnum, bodyvo.getCunitid())); + bodyvo.setNassistnum(this.getScale().adjustNumScale(nassistnum, + bodyvo.getCastunitid())); + //ë + /*bodyvo.setNgrossnum(NCBaseTypeUtils.add(bodyvo.getNgrossnum(), + balance.getNgrossnum()));*/ + locs = balance.getLocatonVO(bodyvo); + if (locs == null || locs.length <= 0) { + continue; + } + CollectionUtils.addArrayToList(listlocs, locs); + } + //еĻҪղеӦ + if(rowCount > 1) { +// bodyvo.setNshouldnum(null); +// bodyvo.setNshouldassistnum(null); + //78--2025491911--sdlizheng--ʵ䵽Ӧһϼƴ--start + bodyvo.setNshouldnum(retlist.get(0).getNshouldnum()); + bodyvo.setNshouldassistnum(retlist.get(0).getNshouldassistnum()); + //78--2025491911--sdlizheng--ʵ䵽Ӧһϼƴ--start + } + if (listlocs.size() > 0) { + //ظ +// listlocs = clearDuplicatelvo(bodyvo, listlocs); + //޸ʱ Զ ظ Ϊɾݸ ﲹ + ICLocationVO[] originLocationVos = bodyvo.getLocationVOs(); + if (originLocationVos != null && originLocationVos.length > 0) { + for (ICLocationVO lvo: originLocationVos) { + lvo.setStatus(VOStatus.DELETED); + listlocs.add(lvo); + } + } + //޸ʱ Զ ظ Ϊɾݸ ﲹ + bodyvo.setLocationVOs(listlocs.toArray((ICLocationVO[]) Array + .newInstance(listlocs.get(0).getClass(), listlocs.size()))); + // + this.reCalculateNum(bodyvo); + } + retlist.add(bodyvo); + } + ICBillBodyVO[] retvos = CollectionUtils.listToArray(retlist); + + if (this.mapbodyvos == null) { + this.mapbodyvos = new HashMap(); + } + this.mapbodyvos.put(String.valueOf(row), retvos); + return retvos; + } + + /** + * ԤкżȣȻڲǰټȫIJֽ + * @param resList + * @param bodyvo + */ + private List prepare(List resList, ICBillBodyVO bodyvo) { + List ret = new ArrayList(); + String snField = SysInitGroupQuery.isSNEnabled() ? ICPubMetaNameConst.PK_SERIALCODE : OnhandSNVO.VSNCODE; + //ûкŵλΪкŹ + Map mapInvvos = new ICBSContext().getInvInfo().getMapInvCalBodyVO(bodyvo.getPk_org(), + new String[] {bodyvo.getCmaterialvid()}); + if(mapInvvos == null) { + return resList; + } + InvCalBodyVO invvo = mapInvvos.get(bodyvo.getCmaterialvid()); + if(invvo == null || !ValueCheckUtil.isTrue(invvo.getSerialmanaflag())) { + return resList; + } +// if( bodyvo.getCSnunitid() == null) { +// return resList; +// } + //кֶ + String snNumReqField = invvo.getSernumunit() != null && invvo.getSernumunit().equals(bodyvo.getCastunitid()) ? + ICPubMetaNameConst.NSHOULDASSISTNUM : ICPubMetaNameConst.NSHOULDNUM; + //ȡкżкż + Set bySNValues = new HashSet(); + //һѭҳкżк + for(BalanceOnhandRes res : resList) { + if(res.isBySN()) { + List locs = res.getListsnvo(); + if (locs == null || locs.size() <= 0) { + continue; + } + CollectionUtils.addArrayToSet(bySNValues, + (VOEntityUtil.getVOsValueSet(locs.toArray(new OnhandSNVO[0]), snField)).toArray(new String[0])); + } + } + + int needNum = ((UFDouble)bodyvo.getAttributeValue(snNumReqField)).intValue() - bySNValues.size(); + ICLocationVO[] blvos = getLVOsBySNField(bodyvo, snField); + Set bsns = VOEntityUtil.getVOsValueSet(blvos, snField); + int needsnNum = ((UFDouble)bodyvo.getAttributeValue(snNumReqField)).intValue()-blvos.length; + //ڶѭڷкżĽƳекŽսΪգƳ + for(BalanceOnhandRes res : resList) { + if(res.isBySN()) { + ret.add(res); + }else { + List locs = res.getListsnvo(); + if (locs == null || locs.size() <= 0) { + ret.add(res); + continue; + } + List list = new ArrayList(); + String[] lpks = VOEntityUtil.getVOsValuesNotDel(blvos, ICLocationVO.PK_SERIALCODE, String.class); + for(OnhandSNVO lvo : locs) { + if(needsnNum > 0) { + if(lpks != null) { + if(lvo.getAttributeValue(snField) != null && !Arrays.asList(lpks).contains(lvo.getPk_serialcode())) { + list.add(lvo); + needsnNum--; + } + } else { + if(lvo.getAttributeValue(snField) != null) { + list.add(lvo); + needsnNum--; + } + } + } + } + if(list.size() > 0) { + res.setListsnvo(list); + // + UFDouble[] sums = VOEntityUtil.sumVOsFieldValuesNotDel(list.toArray(new OnhandSNVO[0]), + new String[]{OnhandSNVO.NONHANDNUM}); + res.setNastnum(new UFDouble(list.size())); + res.setNnum(sums[0]); + ret.add(res); + }else { + res.setListsnvo(null); + } + } + } + return ret; + } + + /** + * еij̨кŵı룬кŵʱΪûд + * @param bodyvo + * @param snField + * @return + */ + private ICLocationVO[] getLVOsBySNField(ICBillBodyVO bodyvo, String snField) { + if(bodyvo.getLocationVOs() == null) { + return new ICLocationVO[] {}; + } + List list = new ArrayList(); + for(ICLocationVO lvo : bodyvo.getLocationVOs()) { + if(lvo.getAttributeValue(snField) != null && lvo.getStatus() != VOStatus.DELETED) { + list.add(lvo); + } + } + return list.toArray(new ICLocationVO[0]); + } + + private void reCalculateNum(ICBillBodyVO bodyvo) { + ICLocationVO[] locs = bodyvo.getLocationVOs(); + String[] vsns = VOEntityUtil.getVOsValuesNotDel(locs, ICLocationVO.VSERIALCODE, String.class); + if (StringUtil.isSEmptyOrNullForAll(vsns)) { + return; + } + // + UFDouble[] sums = VOEntityUtil.sumVOsFieldValuesNotDel(locs, new String[]{ICLocationVO.NNUM,ICLocationVO.NASSISTNUM}); + bodyvo.setNnum(sums[0]); + bodyvo.setNassistnum(sums[1]); + } + + /** + * + */ + private Map> getMapResults() { + if (this.maponhandbalanceresult == null) { + this.maponhandbalanceresult = + new HashMap>(); + if (this.pickresults != null && this.pickresults.size() > 0) { + for (OnhandBalanceResult result : this.pickresults) { + if(result.getOnhandReq()!= null) { + this.maponhandbalanceresult.put(result.getOnhandReq().getRowno(), + result); + } + } + } + } + return this.maponhandbalanceresult; + } + + /** + * ִάȷ+ӦⵥIDλ + */ + private Map> groupBalanceOnhandRes( + List lbalances) { + String key = null; + Map> mapgroup = + new HashMap>(); + List lbalance = null; + for (BalanceOnhandRes balance : lbalances) { + key = OnhandVOTools.getAstDimContentKey(balance.getOnhanddimvo()); + key = key+balance.getCgeneralbid()+balance.getOnhanddimvo().getClocationid(); + lbalance = mapgroup.get(key); + if (lbalance == null) { + lbalance = new ArrayList(); + mapgroup.put(key, lbalance); + } + lbalance.add(balance); + } + return mapgroup; + } + + /** + * 绻 + */ + private ICBillBodyVO[] processBodyData(ICBillBodyVO[] bodyvos) { + if (bodyvos == null || bodyvos.length <= 0) { + return bodyvos; + } + // к + VORowNoUtils.setVOsRowNoByRule(bodyvos, ICPubMetaNameConst.CROWNO); + // ScaleUtils scaleutils = ScaleUtils.getScaleUtilAtBS(); + // TODO δ ȴ + ICBSContext context = new ICBSContext(); + for (int i = 0; i < bodyvos.length; i++) { + bodyvos[i].setNcostmny(NCBaseTypeUtils.mult(bodyvos[i].getNcostprice(), + bodyvos[i].getNnum())); + bodyvos[i].setNplannedmny(NCBaseTypeUtils.mult( + bodyvos[i].getNplannedprice(), bodyvos[i].getNnum())); + // ʵΪʱҵ + if(bodyvos[i].getNnum() == null && bodyvos[i].getNassistnum() == null){ + continue; + } + // ҵΪյĻ modify by guozhq + if(bodyvos[i].getDbizdate() == null) { + bodyvos[i].setDbizdate(context.getBizDate()); + } + } + return bodyvos; + } + + /** + * üĻλ + */ + // private void synLocData(ICBillBodyVO bodyvo,BalanceOnhandRes + // balance,ICLocationVO locvo) { + // locvo.setCgeneralbid(bodyvo.getCgeneralbid()); + // locvo.setPk_group(bodyvo.getPk_group()); + // locvo.setCorpoid(bodyvo.getCorpoid()); + // locvo.setCorpvid(bodyvo.getCorpvid()); + // locvo.setNinspacenum(balance.getNnum()); + // locvo.setNinspaceassistnum(balance.getNastnum()); + // locvo.setNingrossnum(balance.getNgrossnum()); + // } + /** + * üı + */ + private void synBodyData(ICBillBodyVO bodyvo, BalanceOnhandRes res) { + if (bodyvo == null || res == null) { + return; + } + //ִάȵĵλ͵ݽĸλͬ + String[] onhandDims=StringUtil.getArrayWithOutStr(OnhandDimVO.getDimContentFields(), + OnhandDimVO.CASTUNITID ); + OnhandDimVO handdimvo = res.getOnhanddimvo(); + for (String field : OnhandDimVO.getDimContentFields()) { + if (field.equals(OnhandDimVO.VCHANGERATE)) { + String vchangerate = handdimvo.getVchangerate(); + // ʲǽ棬ͬ + if (StringUtil.isSEmptyOrNull(vchangerate)) { + onhandDims = + StringUtil + .getArrayWithOutStr(onhandDims, OnhandDimVO.VCHANGERATE); + } + break; + } + } + VOEntityUtil.copyVOByVO(bodyvo, onhandDims, + res.getOnhanddimvo(),onhandDims); + + bodyvo.setCcorrespondtype(res.getCbilltype()); + bodyvo.setCcorrespondtranstype(res.getVtrantypecode()); + bodyvo.setCcorrespondcode(res.getVbillcode()); + bodyvo.setCcorrespondhid(res.getCgeneralhid()); + bodyvo.setCcorrespondbid(res.getCgeneralbid()); + bodyvo.setCcorrespondrowno(res.getCrowno()); + } + + private ScaleUtils getScale() { + if (this.scale == null) { + this.scale = ScaleUtils.getScaleUtilAtBS(); + } + return this.scale; + } +}