销售订单、流程生产订单、备料计划单据复制高压mes相关字段置空
This commit is contained in:
		
							parent
							
								
									b5978fd55f
								
							
						
					
					
						commit
						4007e1bc1a
					
				|  | @ -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<String, String> 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<String, Object> 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<String, String> getVidForOrgandDept(AggPickmVO billVO) { | ||||||
|  |         List<String> orgIDs = new ArrayList(); | ||||||
|  |         List<String> 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<PickmItemVO> 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<String, String> getVidByOidForOrgAndDept(List<String> orgids, List<String> 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<String, String> 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); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | @ -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<String, ParamcopybillQuery> 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<String> 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<String, String> 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<ParamcopybillQuery> 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<String, ParamcopybillQuery> 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); | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | @ -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<String, Object> 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<String, Object> doBeforeForUserObject(Map<String, Object> 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<String> 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<String, Object> doAfterForUserObject(Map<String, Object> 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; | ||||||
|  |     } | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue