导入流程生产订单-序列号V1
This commit is contained in:
		
							parent
							
								
									afca6722ce
								
							
						
					
					
						commit
						24796e96da
					
				|  | @ -0,0 +1,59 @@ | |||
| <?xml version="1.0" encoding='utf-8'?> | ||||
| <ufinterface roottag="bill"> | ||||
|     <record displayName="序列号明细" | ||||
|             aggname="nc.vo.mmpac.pmo.pac0002.entity.PMOSerialNoVO" | ||||
|             areaname="serial_body" | ||||
|             displayNameResid="excel_mmpac_head00001" | ||||
|             metadataid="4bbf97e4-403e-4497-858f-e2aa716bfad5" | ||||
|             stabletag="header" | ||||
|             tablename="mm_pmo_serialno" | ||||
|             tabletag="mm_pmo_serialno" | ||||
|             tabletype="head" | ||||
|             typeName="表头"> | ||||
|         <field desc="组织编码"> | ||||
|             <matchtag>pk_org</matchtag> | ||||
|             <name>pk_org</name> | ||||
|             <type>String</type> | ||||
|             <set>yes</set> | ||||
|             <visual>yes</visual> | ||||
|             <isRequired>no</isRequired> | ||||
|             <checkTranslatedPK>no</checkTranslatedPK> | ||||
|         </field> | ||||
|         <field desc="生产订单单据号"> | ||||
|             <matchtag>vsndef1</matchtag> | ||||
|             <name>vsndef1</name> | ||||
|             <type>String</type> | ||||
|             <set>yes</set> | ||||
|             <visual>yes</visual> | ||||
|             <isRequired>no</isRequired> | ||||
|             <checkTranslatedPK>no</checkTranslatedPK> | ||||
|         </field> | ||||
|         <field desc="生产订单单据行号"> | ||||
|             <matchtag>vsndef2</matchtag> | ||||
|             <name>vsndef2</name> | ||||
|             <type>String</type> | ||||
|             <set>yes</set> | ||||
|             <visual>yes</visual> | ||||
|             <isRequired>no</isRequired> | ||||
|             <checkTranslatedPK>no</checkTranslatedPK> | ||||
|         </field> | ||||
|         <field desc="序列号"> | ||||
|             <matchtag>vsncode</matchtag> | ||||
|             <name>vsncode</name> | ||||
|             <type>String</type> | ||||
|             <set>yes</set> | ||||
|             <visual>yes</visual> | ||||
|             <isRequired>no</isRequired> | ||||
|             <checkTranslatedPK>no</checkTranslatedPK> | ||||
|         </field> | ||||
|         <field desc="数量"> | ||||
|             <matchtag>nsnastnum</matchtag> | ||||
|             <name>nsnastnum</name> | ||||
|             <type>UFDouble</type> | ||||
|             <set>yes</set> | ||||
|             <visual>yes</visual> | ||||
|             <isRequired>no</isRequired> | ||||
|             <checkTranslatedPK>no</checkTranslatedPK> | ||||
|         </field> | ||||
|     </record> | ||||
| </ufinterface> | ||||
|  | @ -0,0 +1,107 @@ | |||
| // | ||||
| // Source code recreated from a .class file by IntelliJ IDEA | ||||
| // (powered by FernFlower decompiler) | ||||
| // | ||||
| 
 | ||||
| package nc.bs.mmpac.pmo.pac0002.pluginpoint; | ||||
| 
 | ||||
| import nc.bs.dao.BaseDAO; | ||||
| import nc.bs.framework.common.InvocationInfoProxy; | ||||
| import nc.bs.trade.business.HYPubBO; | ||||
| import nc.impl.pubapp.pattern.data.bill.BillQuery; | ||||
| import nc.jdbc.framework.processor.MapProcessor; | ||||
| import nc.vo.ml.NCLangRes4VoTransl; | ||||
| import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO; | ||||
| import nc.vo.mmpac.pmo.pac0002.entity.PMOItemVO; | ||||
| import nc.vo.mmpac.pmo.pac0002.entity.PMOSerialNoVO; | ||||
| import nc.vo.pub.BusinessException; | ||||
| import nc.vo.pub.VOStatus; | ||||
| import nc.vo.pub.lang.UFDouble; | ||||
| import nc.vo.pubapp.pattern.exception.ExceptionUtils; | ||||
| import nccloud.baseapp.core.log.NCCForUAPLogger; | ||||
| import nccloud.bs.excel.IXChangeContext; | ||||
| import nccloud.bs.excel.plugin.AbstractImportProceeWithContext; | ||||
| 
 | ||||
| import java.util.Map; | ||||
| 
 | ||||
| /** | ||||
|  * 导入流程生产订单-序列号 | ||||
|  * | ||||
|  * @author mzr | ||||
|  * @date 20250917 | ||||
|  */ | ||||
| public class PmoSerialNoImportProcess extends AbstractImportProceeWithContext { | ||||
|     private static final BaseDAO dao = new BaseDAO(); | ||||
| 
 | ||||
|     protected void processBillWithContext(Object vo, IXChangeContext context) throws BusinessException { | ||||
|         String billtype = context.getSwapContext().getBilltype(); | ||||
|         String appcode = context.getXChangeConfigInfo().getPagetemplet().getAppcode(); | ||||
|         String userid = InvocationInfoProxy.getInstance().getUserId(); | ||||
|         String pk_group = InvocationInfoProxy.getInstance().getGroupId(); | ||||
|         // PMOAggVO pmoAggVo = (PMOAggVO) vo; | ||||
|         PMOSerialNoVO pmoSerialNoVO = (PMOSerialNoVO) vo; | ||||
|         if (pmoSerialNoVO != null) { | ||||
|             String pk_org = pmoSerialNoVO.getPk_org();// 组织编码 | ||||
|             String cmoid = pmoSerialNoVO.getVsndef2();// 订单行号 | ||||
|             String cpmohid = pmoSerialNoVO.getVsndef1();// 订单号 | ||||
|             String vsncode = pmoSerialNoVO.getVsncode();// 序列号 | ||||
|             UFDouble nsnastnum = pmoSerialNoVO.getNsnastnum();// 数量 | ||||
|             // 查询生产订单的主键 | ||||
|             String selSql = " SELECT a.cpmohid,b.cmoid" + | ||||
|                     " FROM mm_mo b" + | ||||
|                     " LEFT JOIN mm_pmo a ON a.cpmohid = b.cpmohid" + | ||||
|                     // " LEFT JOIN org_factory c ON c.pk_factory = b.pk_org " + | ||||
|                     " WHERE" + | ||||
|                     "  a.vbillcode = '[cpmohid]'" + | ||||
|                     "  AND b.vrowno = '[cmoid]'" + | ||||
|                     "  AND b.pk_org = '[pk_org]'"; | ||||
|             selSql = selSql.replace("[cpmohid]", cpmohid); | ||||
|             selSql = selSql.replace("[cmoid]", cmoid); | ||||
|             selSql = selSql.replace("[pk_org]", pk_org); | ||||
|             Map<String, Object> pmoIdMap = (Map<String, Object>) dao.executeQuery(selSql, new MapProcessor()); | ||||
|             String cpmohid1 = "", cmoid1 = ""; | ||||
|             if (pmoIdMap != null && !pmoIdMap.isEmpty()) { | ||||
|                 cpmohid1 = (String) pmoIdMap.get("cpmohid"); | ||||
|                 cmoid1 = (String) pmoIdMap.get("cmoid"); | ||||
|             } else { | ||||
|                 throw new BusinessException("未查询到对应的流程生产订单"); | ||||
|             } | ||||
|             BillQuery<PMOAggVO> query = new BillQuery(PMOAggVO.class); | ||||
|             PMOAggVO[] vos = query.query(new String[]{cpmohid1}); | ||||
|             for (PMOAggVO pmoAggVO : vos) { | ||||
|                 PMOItemVO[] pmoItemVOS = pmoAggVO.getChildrenVO(); | ||||
|                 for (PMOItemVO pmoItemVO : pmoItemVOS) { | ||||
|                     if (cmoid1.equals(pmoItemVO.getCmoid())) { | ||||
|                         PMOSerialNoVO pmoSerialNoVO1 = new PMOSerialNoVO(); | ||||
|                         pmoSerialNoVO1.setCmoid(pmoItemVO.getCmoid()); | ||||
|                         pmoSerialNoVO1.setPk_group(pmoItemVO.getPk_group()); | ||||
|                         pmoSerialNoVO1.setPk_org(pmoItemVO.getPk_org()); | ||||
|                         pmoSerialNoVO1.setPk_org_v(pmoItemVO.getPk_org_v()); | ||||
|                         pmoSerialNoVO1.setVsncode(vsncode); | ||||
|                         pmoSerialNoVO1.setNsnnum(nsnastnum); | ||||
|                         pmoSerialNoVO1.setNsnastnum(nsnastnum); | ||||
|                         // pmoItemVO.setStatus(VOStatus.UPDATED); | ||||
|                         pmoSerialNoVO1.setStatus(VOStatus.NEW); | ||||
|                         pmoSerialNoVO1.setDr(0); | ||||
|                         this.doAddSave(pmoSerialNoVO1); | ||||
|                         // pmoItemVO.setSerialnos(new PMOSerialNoVO[]{pmoSerialNoVO1}); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } else { | ||||
|             throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("5008001_import", "01015362-0002")); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private void doAddSave(PMOSerialNoVO vo) { | ||||
|         try { | ||||
|             HYPubBO hy = new HYPubBO(); | ||||
|             String insert = hy.insert(vo); | ||||
|             NCCForUAPLogger.debug(insert); | ||||
|             // NCLocator.getInstance().lookup(IPMOMaintainService.class).insert(resvo); | ||||
|         } catch (BusinessException e) { | ||||
|             ExceptionUtils.wrappException(e); | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| } | ||||
		Loading…
	
		Reference in New Issue