From 4007e1bc1a1943d93bbe6e92c69198ad24c55b94 Mon Sep 17 00:00:00 2001 From: lihao Date: Thu, 30 Oct 2025 10:28:08 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E3=80=81?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95=E3=80=81?= =?UTF-8?q?=E5=A4=87=E6=96=99=E8=AE=A1=E5=88=92=E5=8D=95=E6=8D=AE=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E9=AB=98=E5=8E=8Bmes=E7=9B=B8=E5=85=B3=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E7=BD=AE=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mmpac/pickm/action/PickmCopyAction.java | 320 ++++++++++++++++++ .../web/mmpac/pmo/action/PmoCopyAction.java | 268 +++++++++++++++ .../action/SaleOrderCopyBillAction.java | 112 ++++++ 3 files changed, 700 insertions(+) create mode 100644 mmpac/src/client/nccloud/web/mmpac/pickm/action/PickmCopyAction.java create mode 100644 mmpac/src/client/nccloud/web/mmpac/pmo/action/PmoCopyAction.java create mode 100644 so/src/client/nccloud/web/so/saleorder/action/SaleOrderCopyBillAction.java diff --git a/mmpac/src/client/nccloud/web/mmpac/pickm/action/PickmCopyAction.java b/mmpac/src/client/nccloud/web/mmpac/pickm/action/PickmCopyAction.java new file mode 100644 index 00000000..44ec3e23 --- /dev/null +++ b/mmpac/src/client/nccloud/web/mmpac/pickm/action/PickmCopyAction.java @@ -0,0 +1,320 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nccloud.web.mmpac.pickm.action; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import nc.itf.mmpac.pickm.IPickmQueryService; +import nc.itf.mmpac.pickm.IPickmTransTypeService; +import nc.util.mmf.busi.measure.MeasureHelper; +import nc.util.mmf.framework.base.MMNumberUtil; +import nc.util.mmf.framework.base.MMStringUtil; +import nc.util.mmf.framework.base.MMValueCheck; +import nc.vo.ml.NCLangRes4VoTransl; +import nc.vo.mmpac.pickm.entity.AggPickmVO; +import nc.vo.mmpac.pickm.entity.PickmHeadVO; +import nc.vo.mmpac.pickm.entity.PickmItemVO; +import nc.vo.mmpac.pickm.entity.PickmTransTypeVO; +import nc.vo.mmpac.pickm.enumeration.FbillstatusEnum; +import nc.vo.mmpac.pickm.enumeration.FpickmtypeEnum; +import nc.vo.mmpac.pickm.enumeration.FreplaceinfoEnum; +import nc.vo.mmpac.pickm.enumeration.FsourcetypeEnum; +import nc.vo.mmpac.pickm.enumeration.FsupplytypeEnum; +import nc.vo.mmpac.pickm.util.PickmSortUtil; +import nc.vo.mmpub.util.MMSagasUtil; +import nc.vo.pub.BusinessException; +import nc.vo.pub.ISuperVO; +import nc.vo.pub.lang.UFBoolean; +import nc.vo.pub.lang.UFDate; +import nc.vo.pub.lang.UFDateTime; +import nc.vo.pub.lang.UFDouble; +import nccloud.dto.mmpac.pickm.pub.entity.PickmQueryInfoDTO; +import nccloud.framework.core.exception.ExceptionUtils; +import nccloud.framework.core.json.IJson; +import nccloud.framework.service.ServiceLocator; +import nccloud.framework.web.action.itf.ICommonAction; +import nccloud.framework.web.container.IRequest; +import nccloud.framework.web.json.JsonFactory; +import nccloud.framework.web.ui.pattern.billcard.BillCard; +import nccloud.framework.web.ui.pattern.billcard.BillCardOperator; +import nccloud.web.mmpac.pickm.util.PickmScaleUtil; + +public class PickmCopyAction implements ICommonAction { + public PickmCopyAction() { + } + + public Object doAction(IRequest request) { + String read = request.read(); + IJson json = JsonFactory.create(); + PickmQueryInfoDTO query = (PickmQueryInfoDTO)json.fromJson(read, PickmQueryInfoDTO.class); + + try { + IPickmQueryService service = (IPickmQueryService)ServiceLocator.find(IPickmQueryService.class); + AggPickmVO[] vos = service.queryBillsByPks(new String[]{query.getCpickmid()}); + if (null == vos || vos.length == 0) { + ExceptionUtils.wrapBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("5008100_0", "05008100-0005")); + } + + AggPickmVO billVO = (AggPickmVO)vos[0].clone(); + this.initialHead(billVO.getParentVO()); + this.filterItems(billVO); + Map orgAndDeptMap = this.getVidForOrgandDept(billVO); + if (MMValueCheck.isNotEmpty(orgAndDeptMap)) { + if (MMValueCheck.isNotEmpty(billVO.getParentVO().getPk_org()) && orgAndDeptMap.containsKey("O" + billVO.getParentVO().getPk_org())) { + billVO.getParentVO().setPk_org_v((String)orgAndDeptMap.get("O" + billVO.getParentVO().getPk_org())); + } + + if (MMValueCheck.isNotEmpty(billVO.getParentVO().getCdeptid()) && orgAndDeptMap.containsKey("D" + billVO.getParentVO().getCdeptid())) { + billVO.getParentVO().setCdeptvid((String)orgAndDeptMap.get("D" + billVO.getParentVO().getCdeptid())); + } + } + + this.initialItems((PickmItemVO[])billVO.getChildrenVO(), billVO.getParentVO(), orgAndDeptMap); + if (MMValueCheck.isNotEmpty(billVO.getChildrenVO())) { + billVO.setChildrenVO(PickmSortUtil.sortItemsByRowNo((PickmItemVO[])billVO.getChildrenVO())); + } + + BillCardOperator operator = new BillCardOperator(query.getPageid()); + BillCard billCard = operator.toCard(billVO); + this.afterProcess(billCard); + if (MMValueCheck.isNotEmpty(billVO.getParentVO().getVbusitypeid())) { + boolean isWW = this.getIsWW(billVO.getParentVO().getVbusitypeid()); + Map returnMap = new HashMap(); + if (MMValueCheck.isNotEmpty(isWW) && MMValueCheck.isTrue(isWW)) { + returnMap.put("isWW", true); + billCard.setUserjson(json.toJson(returnMap)); + } + } + + return billCard; + } catch (BusinessException ex) { + ExceptionUtils.wrapBusinessException(ex.getMessage()); + return null; + } + } + + private boolean getIsWW(String busitypeid) { + if (MMValueCheck.isEmpty(busitypeid)) { + return false; + } else { + IPickmTransTypeService service = (IPickmTransTypeService)ServiceLocator.find(IPickmTransTypeService.class); + + try { + PickmTransTypeVO typevo = service.queryTransTypeVO(busitypeid); + if (MMValueCheck.isEmpty(typevo)) { + return false; + } + + if (!FpickmtypeEnum.PRODUCT.equalsValue(typevo.getFpickmtype())) { + return true; + } + } catch (BusinessException e) { + ExceptionUtils.wrapException(e); + } + + return false; + } + } + + private Map getVidForOrgandDept(AggPickmVO billVO) { + List orgIDs = new ArrayList(); + List deptIDs = new ArrayList(); + PickmHeadVO head = billVO.getParentVO(); + if (MMValueCheck.isNotEmpty(head.getPk_org())) { + orgIDs.add(head.getPk_org()); + } + + if (MMValueCheck.isNotEmpty(head.getCdeptid())) { + deptIDs.add(head.getCdeptid()); + } + + if (MMValueCheck.isNotEmpty(billVO.getChildren(PickmItemVO.class))) { + for(PickmItemVO item : (PickmItemVO[])billVO.getChildren(PickmItemVO.class)) { + String deliverypk_org = item.getCdeliverorgid(); + if (!MMStringUtil.isEmpty(deliverypk_org)) { + orgIDs.add(deliverypk_org); + } + + String supllypk_org = item.getCsupplyorgid(); + if (!MMStringUtil.isEmpty(supllypk_org)) { + orgIDs.add(supllypk_org); + } + } + } + + return MMValueCheck.isEmpty(orgIDs) && MMValueCheck.isEmpty(deptIDs) ? null : this.getVidByOidForOrgAndDept(orgIDs, deptIDs); + } + + private void filterItems(AggPickmVO billVO) { + PickmItemVO[] oldItems = (PickmItemVO[])billVO.getChildrenVO(); + if (!MMValueCheck.isEmpty(oldItems)) { + List newItems = new ArrayList(); + + for(PickmItemVO item : oldItems) { + if (MMValueCheck.isEmpty(item.getCreplacesrcid())) { + newItems.add(item); + } + } + + billVO.setChildren(PickmItemVO.class, (ISuperVO[])newItems.toArray(new PickmItemVO[0])); + } + } + + public Map getVidByOidForOrgAndDept(List orgids, List deptids) { + IPickmQueryService query = (IPickmQueryService)ServiceLocator.find(IPickmQueryService.class); + + try { + return query.queryVidByOidForOrgAndDept(orgids, deptids); + } catch (BusinessException e) { + ExceptionUtils.wrapException(e); + return null; + } + } + + private void initialHead(PickmHeadVO head) { + head.setCpickmid((String)null); + head.setVbillcode((String)null); + head.setCreator((String)null); + head.setCreationtime((UFDateTime)null); + head.setModifier((String)null); + head.setModifiedtime((UFDateTime)null); + head.setApprover((String)null); + head.setApprovertime((UFDate)null); + head.setBillmaker((String)null); + head.setDmakedate((UFDate)null); + if (!MMValueCheck.isEmpty(head.getCffileid())) { + head.setVpbomversion((String)null); + head.setVpbomversionnumber((String)null); + head.setVbomversion((String)null); + head.setVbomversionnumber((String)null); + head.setVrtversion((String)null); + head.setVrtversionnumber((String)null); + head.setCffileid((String)null); + } + + head.setCsourcebillid((String)null); + head.setCsourcebillrowid((String)null); + head.setVsourcebillrowno((String)null); + head.setCsource2billhid((String)null); + head.setCsource2billbid((String)null); + head.setVsourcebillcode((String)null); + head.setVsourcebilltype((String)null); + head.setVsrctrantype((String)null); + head.setVsrctrantypeid((String)null); + head.setVsource2billcode((String)null); + head.setVsalebillcode((String)null); + head.setCfirstbillid((String)null); + head.setCfirstbillrowid((String)null); + head.setVfirstbillrowno((String)null); + head.setVfirstbillcode((String)null); + head.setVfirstbilltype((String)null); + head.setVfirsttrantype((String)null); + head.setVfirsttrantypeid((String)null); + head.setVsourcemocode((String)null); + head.setVsourcemoid((String)null); + head.setVsourcemorowid((String)null); + head.setVsourcemorowcode((String)null); + head.setVsourcemorowid((String)null); + head.setVfirstmocode((String)null); + head.setVfirstmoid((String)null); + head.setVfirstmorowid((String)null); + head.setVfirstmorowcode((String)null); + head.setVfirstmorowid((String)null); + head.setPk_batchcode((String)null); + head.setVbatchcode((String)null); + head.setVmoprocid((String)null); + head.setVmoprocno((String)null); + head.setVstdprocid((String)null); + head.setVnote((String)null); + + head.setVdef19((String)null); + head.setFbillstatus(FbillstatusEnum.PLAN_STATE.toInteger()); + head.setFsourcetype(FsourcetypeEnum.HAND_STATE.toInteger()); + MMSagasUtil.cleanSagasField(head); + } + + private void initialItems(PickmItemVO[] items, PickmHeadVO head, Map orgAndDeptMap) { + if (!MMValueCheck.isEmpty(items)) { + for(PickmItemVO item : items) { + UFDouble nunitusenum = UFDouble.ZERO_DBL; + UFDouble nunituseastnum = UFDouble.ZERO_DBL; + if (FsupplytypeEnum.RATIONDELIVERY.equalsValue(item.getFsupplytype())) { + nunitusenum = item.getNplanoutnum(); + nunituseastnum = item.getNplanoutastnum(); + } else if (MMNumberUtil.isNotNullAndNotZero(head.getNnumber())) { + nunitusenum = MMNumberUtil.div(item.getNplanoutnum(), new UFDouble[]{head.getNnumber()}); + nunituseastnum = MMNumberUtil.div(MeasureHelper.getAssNum(item.getNplanoutnum(), item.getVbchangerate()), new UFDouble[]{MeasureHelper.getAssNum(head.getNnumber(), head.getVchangerate())}); + } + + item.setNunitusenum(nunitusenum); + item.setNunituseastnum(nunituseastnum); + item.setCpickm_bid((String)null); + item.setCpickmid((String)null); + item.setNaccoutnum((UFDouble)null); + item.setNaccoutastnum((UFDouble)null); + item.setNshouldnum((UFDouble)null); + item.setNshouldastnum((UFDouble)null); + item.setNatpnum((UFDouble)null); + item.setNatpastnum((UFDouble)null); + item.setNoverreqnum((UFDouble)null); + item.setNoverreqastnum((UFDouble)null); + item.setNaccbackastnum((UFDouble)null); + item.setNaccbacknum((UFDouble)null); + item.setNpickdemandnum((UFDouble)null); + item.setNtransastnum((UFDouble)null); + item.setNtransnum((UFDouble)null); + item.setNtransinastnum((UFDouble)null); + item.setNtransinnum((UFDouble)null); + item.setNbsetpartsnum((UFDouble)null); + if (MMValueCheck.isTrue(item.getBcanreplace())) { + item.setFreplaceinfo(Integer.valueOf(FreplaceinfoEnum.NOTREPLACE.value().toString())); + } else { + item.setFreplaceinfo(Integer.valueOf(FreplaceinfoEnum.CANNOTREPLACE.value().toString())); + } + + item.setVreplacequotiety((String)null); + item.setPk_realsubs((String)null); + item.setCreplacesrcid((String)null); + item.setNreplaceorder((Integer)null); + item.setFreplacetype((Integer)null); + item.setVpmoprocessno((String)null); + item.setVprocesscode((String)null); + item.setVprocessno((String)null); + item.setVdmoprocessno((String)null); + item.setCrtopacid((String)null); + item.setOpacprocessno((String)null); + item.setNpscastnum((UFDouble)null); + item.setNpscnum((UFDouble)null); + item.setNsumcheckastnum((UFDouble)null); + item.setNsumchecknum((UFDouble)null); + item.setVpscsrcpickmbid((String)null); + item.setVbnote((String)null); + item.setBcontroll(UFBoolean.FALSE); + item.setBreqpickm(UFBoolean.FALSE); + item.setPk_org_v(head.getPk_org_v()); + if (MMValueCheck.isNotEmpty(orgAndDeptMap)) { + String deliverypk_org = item.getCdeliverorgid(); + String supllypk_org = item.getCsupplyorgid(); + if (MMValueCheck.isNotEmpty(deliverypk_org) && orgAndDeptMap.containsKey("O" + deliverypk_org)) { + item.setCdeliverorgvid((String)orgAndDeptMap.get("O" + deliverypk_org)); + } + + if (MMValueCheck.isNotEmpty(supllypk_org) && orgAndDeptMap.containsKey("O" + supllypk_org)) { + item.setCsupplyorgvid((String)orgAndDeptMap.get("O" + supllypk_org)); + } + } + } + + } + } + + public void afterProcess(BillCard card) { + PickmScaleUtil scaleUtil = new PickmScaleUtil(); + scaleUtil.processBillCard(card); + } +} diff --git a/mmpac/src/client/nccloud/web/mmpac/pmo/action/PmoCopyAction.java b/mmpac/src/client/nccloud/web/mmpac/pmo/action/PmoCopyAction.java new file mode 100644 index 00000000..35a29b46 --- /dev/null +++ b/mmpac/src/client/nccloud/web/mmpac/pmo/action/PmoCopyAction.java @@ -0,0 +1,268 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nccloud.web.mmpac.pmo.action; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import nc.itf.mmpac.pmo.pac0002.IPMOQueryService; +import nc.pubitf.org.cache.IOrgUnitPubService_C; +import nc.util.mmf.busi.measure.MeasureHelper; +import nc.util.mmf.framework.base.MMArrayUtil; +import nc.util.mmf.framework.base.MMStringUtil; +import nc.util.mmf.framework.base.MMValueCheck; +import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO; +import nc.vo.mmpac.pmo.pac0002.entity.PMOHeadVO; +import nc.vo.mmpac.pmo.pac0002.entity.PMOItemVO; +import nc.vo.mmpac.pmo.pac0002.entity.PMOPlanOutputVO; +import nc.vo.mmpac.pmo.pac0002.entity.PMOTaskDetailVO; +import nc.vo.mmpac.pmo.pac0002.enumeration.PMOFBillstatusEnum; +import nc.vo.mmpac.pmo.pac0002.enumeration.PMOFItemStatusEnum; +import nc.vo.mmpac.pmo.pac0002.enumeration.PMOFSrcMoOperTypeEnum; +import nc.vo.mmpac.pmo.parameter.ParamcopybillQuery; +import nc.vo.mmpub.util.MMSagasUtil; +import nc.vo.pub.BusinessException; +import nc.vo.pub.lang.UFDate; +import nc.vo.pub.lang.UFDateTime; +import nc.vo.pub.lang.UFDouble; +import nc.vo.pubapp.pattern.exception.ExceptionUtils; +import nccloud.framework.core.json.IJson; +import nccloud.framework.service.ServiceLocator; +import nccloud.framework.web.container.IRequest; +import nccloud.framework.web.json.JsonFactory; +import nccloud.framework.web.ui.pattern.billcard.BillCard; +import nccloud.framework.web.ui.pattern.billcard.BillCardOperator; +import nccloud.mmpac.pmo.pub.entity.QueryInfoPmo; +import nccloud.web.mmpac.pmo.util.PMOUICalUtil4NCC; +import nccloud.web.mmpac.pmo.util.PmoScaleUtil; + +public class PmoCopyAction extends PMOCommonAction { + public PmoCopyAction() { + } + + public Object doAction(IRequest request) { + String read = request.read(); + IJson json = JsonFactory.create(); + QueryInfoPmo query = (QueryInfoPmo)json.fromJson(read, QueryInfoPmo.class); + + try { + IPMOQueryService service = (IPMOQueryService)ServiceLocator.find(IPMOQueryService.class); + PMOAggVO[] vos = service.queryByPks(new String[]{query.getKeyword()}); + if (null == vos || vos.length == 0) { + this.afterError(); + } + + PMOAggVO vo = vos[0]; + this.setHeadValue(vo); + this.setItemValue(vo); + BillCardOperator operator = new BillCardOperator(query.getPageid()); + BillCard billCard = operator.toCard(vo); + this.afterProcess(billCard); + Object[] returnObj = new Object[3]; + returnObj[0] = billCard; + + return returnObj; + } catch (BusinessException ex) { + ExceptionUtils.wrappBusinessException(ex.getMessage()); + return null; + } + } + + public void afterProcess(BillCard card) { + PmoScaleUtil stoUtil = new PmoScaleUtil(); + stoUtil.processBillCard(card); + } + + private void setDelaultItemValue(PMOItemVO item, Map retrMap) { + item.setFsrcmooper(Integer.valueOf(PMOFSrcMoOperTypeEnum.NORMAL.getEnumValue().getValue())); + item.setNmmnum(item.getNnum()); + item.setNmmastnum(item.getNastnum()); + item.setNplanputnum(PMOUICalUtil4NCC.getNumByNrwxis(item.getPk_group(), item.getNnum(), item.getNrwxis(), item.getCunitid())); + UFDouble planputastnum = MeasureHelper.getAssNum(item.getNplanputnum(), item.getVchangerate()); + item.setNplanputastnum(planputastnum); + item.setFitemstatus(Integer.valueOf(PMOFItemStatusEnum.PLAN.getEnumValue().getValue())); + item.setPlanoutputs((PMOPlanOutputVO[])null); + item.setTaskdetails((PMOTaskDetailVO[])null); + item.setVsrctrantypeid((String)null); + item.setVsrctrantype((String)null); + item.setVsrctype((String)null); + item.setVsrcid((String)null); + item.setVsrccode((String)null); + item.setVsrcbid((String)null); + item.setVsrcrowno((String)null); + item.setVfirsttrantypeid((String)null); + item.setVfirsttrantype((String)null); + item.setVfirsttype((String)null); + item.setVfirstid((String)null); + item.setVfirstcode((String)null); + item.setVfirstbid((String)null); + item.setVfirstrowno((String)null); + item.setVparentbillid((String)null); + item.setVparentbillcode((String)null); + item.setCparentmobid((String)null); + item.setVparentmorowno((String)null); + item.setVfromid((String)null); + item.setVfromcode((String)null); + item.setCsrcmobid((String)null); + item.setVsrcmorowno((String)null); + item.setCfirstmoid((String)null); + item.setVfirstmocode((String)null); + item.setCfirstmobid((String)null); + item.setVfirstmorowno((String)null); + item.setVsalebillcode((String)null); + item.setCbatchid((String)null); + item.setVbatchcode((String)null); + item.setVbatchnote((String)null); + item.setVbatchdef1((String)null); + item.setVbatchdef2((String)null); + item.setVbatchdef3((String)null); + item.setVbatchdef4((String)null); + item.setVbatchdef5((String)null); + item.setVbatchdef6((String)null); + item.setVbatchdef7((String)null); + item.setVbatchdef8((String)null); + item.setVbatchdef9((String)null); + item.setVbatchdef10((String)null); + item.setVbatchdef11((String)null); + item.setVbatchdef12((String)null); + item.setVbatchdef13((String)null); + item.setVbatchdef14((String)null); + item.setVbatchdef15((String)null); + item.setVbatchdef16((String)null); + item.setVbatchdef17((String)null); + item.setVbatchdef18((String)null); + item.setVbatchdef19((String)null); + item.setVbatchdef20((String)null); + item.setNwrastnum((UFDouble)null); + item.setNwrnum((UFDouble)null); + item.setNinastnum((UFDouble)null); + item.setNinnum((UFDouble)null); + item.setNreastnum((UFDouble)null); + item.setNrenum((UFDouble)null); + item.setNrwastnum((UFDouble)null); + item.setNrwnum((UFDouble)null); + item.setNrebillastnum((UFDouble)null); + item.setNrebillnum((UFDouble)null); + item.setNrwbillastnum((UFDouble)null); + item.setNrwbillnum((UFDouble)null); + item.setNrejectastnum((UFDouble)null); + item.setNrejectnum((UFDouble)null); + item.setVecncode((String)null); + item.setCecnid((String)null); + item.setNholdastnum((UFDouble)null); + item.setNholdnum((UFDouble)null); + item.setTactstarttime((UFDateTime)null); + item.setTactendtime((UFDateTime)null); + item.setNzcgastnum((UFDouble)null); + item.setNzcgnum((UFDouble)null); + item.setNzwwastnum((UFDouble)null); + item.setNzwwnum((UFDouble)null); + item.setNzdbastnum((UFDouble)null); + item.setNzdbnum((UFDouble)null); + item.setCparentprocedureid((String)null); + item.setMocloser((String)null); + item.setTmoclosedtime((UFDateTime)null); + if (MMValueCheck.isNotEmpty(item.getCffileid())) { + item.setCffileid((String)null); + item.setCbomversionid((String)null); + item.setVbomversion((String)null); + item.setCrtversionid((String)null); + item.setVrtversion((String)null); + item.setCpackbomid((String)null); + item.setVpackbomversion((String)null); + } + + item.setTs((UFDateTime)null); + if (MMValueCheck.isNotEmpty(retrMap.get(item.getCmoid()))) { + item.setCdeptvid(((ParamcopybillQuery)retrMap.get(item.getCmoid())).getRecdeptvid()); + if (!MMValueCheck.isEmpty(((ParamcopybillQuery)retrMap.get(item.getCmoid())).getRetsupplytime())) { + item.setTsupplytime(((ParamcopybillQuery)retrMap.get(item.getCmoid())).getRetsupplytime()); + item.setTrequiredate(((ParamcopybillQuery)retrMap.get(item.getCmoid())).getRetsupplytime()); + } + } + + item.setCmoid((String)null); + item.setAttributeValue("vdef30",null); + + item.setCpmohid((String)null); + } + + private void setHeadValue(PMOAggVO billVO) { + if (null != billVO) { + PMOHeadVO head = billVO.getParentVO(); + if (null != head) { + head.setCpmohid((String)null); + Set orgids = new HashSet(); + orgids.add(head.getPk_org()); + if (MMStringUtil.isNotEmpty(head.getCplanfactoryid()) && !head.getPk_org().equals(head.getCplanfactoryid())) { + orgids.add(head.getCplanfactoryid()); + } + + try { + Map orgvrgMap = ((IOrgUnitPubService_C)ServiceLocator.find(IOrgUnitPubService_C.class)).getNewVIDSByOrgIDS((String[])orgids.toArray(new String[0])); + head.setPk_org_v((String)orgvrgMap.get(head.getPk_org())); + if (MMStringUtil.isNotEmpty(head.getCplanfactoryid()) && !head.getPk_org().equals(head.getCplanfactoryid())) { + head.setCplanfactoryvid((String)orgvrgMap.get(head.getCplanfactoryid())); + } else { + head.setCplanfactoryid(head.getPk_org()); + head.setCplanfactoryvid(head.getPk_org_v()); + } + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + + head.setVbillcode((String)null); + head.setFbillstatus(Integer.valueOf(PMOFBillstatusEnum.FREE.getEnumValue().getValue().toString())); + head.setCreator((String)null); + head.setCreationtime((UFDateTime)null); + head.setModifier((String)null); + head.setModifiedtime((UFDateTime)null); + head.setApprover((String)null); + head.setApprovertime((UFDate)null); + head.setBillmaker((String)null); + head.setDmakedate((UFDate)null); + head.setVersion("1.0"); + MMSagasUtil.cleanSagasField(head); + } + } + } + + private void setItemValue(PMOAggVO billVO) { + if (null != billVO) { + String pk_org = billVO.getParentVO().getPk_org(); + PMOItemVO[] items = billVO.getChildrenVO(); + if (!MMArrayUtil.isEmpty(items)) { + List params = new ArrayList(); + + for(PMOItemVO item : items) { + ParamcopybillQuery param = new ParamcopybillQuery(); + param.setCdeptid(item.getCdeptid()); + param.setCmaterialvid(item.getCmaterialvid()); + param.setPk_org(pk_org); + param.setCpmobid(item.getCmoid()); + param.setTplanendtime(item.getTplanendtime()); + params.add(param); + } + + Map retrMap = new HashMap(); + + try { + retrMap = ((IPMOQueryService)ServiceLocator.find(IPMOQueryService.class)).copybillqueryData((ParamcopybillQuery[])params.toArray(new ParamcopybillQuery[0])); + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + } + + for(PMOItemVO item : items) { + this.setDelaultItemValue(item, retrMap); + } + + } + } + } +} diff --git a/so/src/client/nccloud/web/so/saleorder/action/SaleOrderCopyBillAction.java b/so/src/client/nccloud/web/so/saleorder/action/SaleOrderCopyBillAction.java new file mode 100644 index 00000000..72974b28 --- /dev/null +++ b/so/src/client/nccloud/web/so/saleorder/action/SaleOrderCopyBillAction.java @@ -0,0 +1,112 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package nccloud.web.so.saleorder.action; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import nc.vo.ct.saledaily.entity.CtSalebillViewVO; +import nc.vo.pub.BusinessException; +import nc.vo.pubapp.pattern.exception.ExceptionUtils; +import nc.vo.scmpub.util.BillBodySortUtils; +import nc.vo.so.m30.entity.SaleOrderVO; +import nccloud.dto.so.pub.entity.SimpleQueryInfo; +import nccloud.framework.core.json.IJson; +import nccloud.framework.service.ServiceLocator; +import nccloud.framework.web.action.itf.ICommonAction; +import nccloud.framework.web.container.IRequest; +import nccloud.framework.web.json.JsonFactory; +import nccloud.framework.web.processor.template.GridConvertProcessor; +import nccloud.framework.web.ui.pattern.billcard.BillCard; +import nccloud.framework.web.ui.pattern.billcard.BillCardOperator; +import nccloud.framework.web.ui.pattern.grid.Grid; +import nccloud.framework.web.ui.pattern.grid.GridOperator; +import nccloud.pubitf.so.saleorder.service.ISaleOrderBusiProcessWebService; +import nccloud.web.scmpub.pub.action.TempletQueryAction; +import nccloud.web.scmpub.pub.event.BillCardEventResult; +import nccloud.web.so.pub.tool.BatchCodeTranslatorUtils; +import nccloud.web.so.saleorder.action.scale.CtSaleScaleProcessor; +import nccloud.web.so.saleorder.calproperty.SaleOrderCalPropertyProcess; +import nccloud.web.so.saleorder.scale.SaleOrderScaleProcess; + +public class SaleOrderCopyBillAction implements ICommonAction { + public SaleOrderCopyBillAction() { + } + + public Object doAction(IRequest request) { + try { + String read = request.read(); + IJson json = JsonFactory.create(); + SimpleQueryInfo info = (SimpleQueryInfo)json.fromJson(read, SimpleQueryInfo.class); + ISaleOrderBusiProcessWebService service = (ISaleOrderBusiProcessWebService)ServiceLocator.find(ISaleOrderBusiProcessWebService.class); + Map userObject = info.getUserObject(); + this.doBeforeForUserObject(userObject); + if (userObject == null) { + userObject = new HashMap(); + } + + SaleOrderVO saleorderVO = service.copyBill(info.getPk(), userObject); + saleorderVO.getParentVO().setVdef26((String)null); + BillBodySortUtils.sort(new SaleOrderVO[]{saleorderVO}); + this.doAfterForUserObject(userObject); + BillCardOperator operator = new BillCardOperator(info.getPageId()); + BillCard billCard = operator.toCard(saleorderVO); + BillCardEventResult result = new BillCardEventResult(); + SaleOrderCalPropertyProcess.process(billCard); + SaleOrderScaleProcess.process(billCard); + BatchCodeTranslatorUtils.proBatchCode(billCard); + result.setBillCard(billCard); + result.setUserObject(userObject); + return result; + } catch (BusinessException e) { + ExceptionUtils.wrappException(e); + return null; + } + } + + protected Map doBeforeForUserObject(Map userObject) { + if (userObject == null) { + return userObject; + } else { + String key = "relateCTVO"; + if (userObject.containsKey(key)) { + IJson json = JsonFactory.create(); + Grid ctviewgrid = (Grid)json.fromJson((String)userObject.get(key), Grid.class); + GridConvertProcessor processor = new GridConvertProcessor(); + CtSalebillViewVO[] vos = (CtSalebillViewVO[])processor.fromGrid(ctviewgrid); + userObject.put(key, vos); + } + + key = "relateCTROWS"; + if (userObject.containsKey(key)) { + List relateCTrowsList = (List)userObject.get(key); + int[] relateCTrows = new int[relateCTrowsList.size()]; + + for(int i = 0; i < relateCTrows.length; ++i) { + relateCTrows[i] = Integer.valueOf((String)relateCTrowsList.get(i)); + } + + userObject.put(key, relateCTrows); + } + + return userObject; + } + } + + protected Map doAfterForUserObject(Map userObject) { + String key = "relateCTVO"; + if (userObject.containsKey(key)) { + CtSalebillViewVO[] vos = (CtSalebillViewVO[])userObject.get(key); + String templateid = TempletQueryAction.getTempletIdByAppCode("400600400", "400600400_relatCT"); + GridOperator go = new GridOperator(templateid, "400600400_relatCT"); + Grid grid = go.toGrid(vos); + CtSaleScaleProcessor.processGrid(grid); + userObject.put(key, grid); + } + + return userObject; + } +}