Browse Source

初始化

pancy 1 year ago
commit
6ec066bd53

+ 23 - 0
ic/.classpath

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="ic/classes" path="ic/src/public"/>
+	<classpathentry kind="src" output="ic/classes" path="ic/src/client"/>
+	<classpathentry kind="src" output="ic/classes" path="ic/src/private"/>
+	<classpathentry kind="src" output="ic/classes" path="ic/src/test"/>
+	<classpathentry kind="src" output="ic/classes" path="ic/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Ant_Library"/>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Product_Common_Library"/>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Middleware_Library"/>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Framework_Library"/>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Module_Public_Library"/>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Module_Client_Library"/>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Module_Private_Library">
+		<accessrules>
+			<accessrule kind="accessible" pattern="**"/>
+		</accessrules>
+	</classpathentry>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Module_Lang_Library"/>
+	<classpathentry kind="con" path="com.yonyou.studio.udt.core.container/Generated_EJB"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

+ 25 - 0
ic/.project

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>ic</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.yonyou.studio.udt.core.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>com.yonyou.studio.udt.core.nature</nature>
+		<nature>com.yonyou.studio.ria.core.ModuleProjectNature</nature>
+		<nature>com.yonyou.studio.ria.core.BizCompProjectNature</nature>
+	</natures>
+</projectDescription>

+ 8 - 0
ic/META-INF/ffopenapi.upm

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding='gb2312'?>
+<module name="ic">
+    <public>
+ 	   <component name="transformadd" accessProtected="false"  remote="true" singleton="true" tx="NONE" supportAlias="true">
+       <implementation>nc.bs.ic.impl.TransformAddImpl</implementation>
+ 	   </component>
+    </public>	
+</module>

+ 7 - 0
ic/META-INF/module.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="gb2312"?>
+<module name="ic">
+    <public>
+    </public>
+    <private>
+    </private>
+</module>

+ 23 - 0
ic/bin/.project

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>ic</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.yonyou.studio.udt.core.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>com.yonyou.studio.udt.core.nature</nature>
+	</natures>
+</projectDescription>

+ 7 - 0
ic/bin/META-INF/module.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="gb2312"?>
+<module name="ic">
+    <public>
+    </public>
+    <private>
+    </private>
+</module>

BIN
ic/ic/classes/nc/bs/bd/pfxx/plugin/MaterialPfxxPlugin.class


BIN
ic/ic/classes/nc/bs/ic/general/plugins/GeneralDefdocPlugin.class


BIN
ic/ic/classes/nc/bs/ic/impl/TransformAddImpl.class


BIN
ic/ic/classes/nc/bs/servlet/service/BaseServlet.class


BIN
ic/ic/classes/nc/log/NcLog.class


BIN
ic/ic/classes/nc/pubimpl/so/m30/pfxx/M30PfxxPlugin.class


BIN
ic/ic/classes/nc/pubimpl/so/m4331/pfxx/M4331PfxxPlugin.class


+ 1 - 0
ic/ic/resources/reources.gitkeep

@@ -0,0 +1 @@
+ユシホサキ�

+ 1 - 0
ic/ic/src/client/client.gitkeep

@@ -0,0 +1 @@
+ユシホサキ�

+ 306 - 0
ic/ic/src/private/nc/bs/bd/pfxx/plugin/MaterialPfxxPlugin.java

@@ -0,0 +1,306 @@
+package nc.bs.bd.pfxx.plugin;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import nc.bs.dao.BaseDAO;
+import nc.bs.dao.DAOException;
+import nc.bs.framework.common.NCLocator;
+import nc.bs.logging.Logger;
+import nc.bs.pfxx.ISwapContext;
+import nc.itf.bd.material.assign.IMaterialAssignService;
+import nc.itf.bd.material.baseinfo.IMaterialBaseInfoService;
+import nc.itf.uap.IUAPQueryBS;
+import nc.jdbc.framework.SQLParameter;
+import nc.jdbc.framework.processor.BeanListProcessor;
+import nc.vo.bd.errorlog.ErrLogReturnValue;
+import nc.vo.bd.errorlog.ErrorMsgVO;
+import nc.vo.bd.material.MaterialConvertVO;
+import nc.vo.bd.material.MaterialTaxTypeVO;
+import nc.vo.bd.material.MaterialVO;
+import nc.vo.bd.pub.IPubEnumConst;
+import nc.vo.corg.CostRegionVO;
+import nc.vo.ic.org.OrgVO;
+import nc.vo.pfxx.auxiliary.AggxsysregisterVO;
+import nc.vo.pfxx.util.PfxxPluginUtils;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.VOStatus;
+
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * 物料基本信息外部交互平台导入
+ * 
+ * @author jiangjuna
+ * @since NC6.0
+ */
+public class MaterialPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin {
+
+  private BaseDAO baseDAO = null;
+
+  private IMaterialBaseInfoService service = null;
+  
+  IUAPQueryBS iUAPQueryBS=(IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
+
+  @Override
+  protected Object processBill(Object vo, ISwapContext swapContext,
+      AggxsysregisterVO aggxsysvo) throws BusinessException {
+    String pk = null;
+    try {
+      MaterialVO materialVO = (MaterialVO) vo;
+      String vbillcode = materialVO.getCode();
+      String memo = materialVO.getMemo();
+      List<CostRegionVO> costRegionVO=getCostRegion(iUAPQueryBS, memo);
+      pk =
+          PfxxPluginUtils.queryBillPKBeforeSaveOrUpdate(
+              swapContext.getBilltype(), swapContext.getDocID());
+      if (StringUtils.isBlank(pk)) {
+        materialVO = this.insertMaterialVO(materialVO);
+        PfxxPluginUtils.addDocIDVsPKContrast(swapContext.getBilltype(),
+            swapContext.getDocID(), materialVO.getPrimaryKey());
+        materialVO.setCode(vbillcode);
+        this.getService().updateMaterial(materialVO);
+        orgAssign(materialVO, memo, costRegionVO);
+        return materialVO.getPrimaryKey();
+      }
+      this.getService().updateMaterial(this.getUpdateVO(materialVO, pk));
+    }
+    catch (Exception ex) {
+      Logger.error(ex.getMessage(), ex.getCause());
+      throw new BusinessException(ex.getMessage(), ex.getCause());
+    }
+    return pk;
+  }
+
+  /**
+   * 
+   * @param vo 物料
+   * @param pkorg 业务组织
+   * @param costRegionVO  成本域组织
+	 * @throws Exception 
+   */
+	public  void orgAssign(MaterialVO vo,String pkorg,List<CostRegionVO> costRegionVO) throws Exception{
+		BaseDAO db=new BaseDAO();
+		//获取销售组织信息
+		List<OrgVO>  orgVO=getOrgs(iUAPQueryBS, "SYPF-XS");
+		String pk_salesorg =orgVO.get(0).getPk_org();
+		
+		//新增完成后组织分配
+		IMaterialAssignService	assignService = ((IMaterialAssignService)NCLocator.getInstance().lookup(IMaterialAssignService.class));
+		//assignService.assignMaterialToSelfOrg(vo);//分配至集团下
+		vo.setPk_org(pkorg);
+		assignService.assignMaterialToSelfOrg(vo);//分配至本次业务组织
+		vo.setPk_org(pk_salesorg);
+		assignService.assignMaterialToSelfOrg(vo);//分配销售组织
+		if(costRegionVO.size()!=0){//分配至对应成本域组织
+			for (int i = 0; i < costRegionVO.size(); i++) {
+				vo.setPk_org(costRegionVO.get(i).getPk_costregion());
+				assignService.assignMaterialToSelfOrg(vo);
+			}	
+		}
+		try {
+			//默认设置全月平均
+			String uct ="update bd_materialcostmod set costmode='4'  where pk_material='"+vo.getPk_material()+"'";
+//			iUAPQueryBS.executeQuery(uct,null);
+			db.executeUpdate(uct);
+		} catch (Exception e2) {
+			// TODO: handle exception
+		}
+		//去除自动进行订单可用量检查 
+		try {
+			String uct ="update bd_materialstock set  isautoatpcheck='N',wholemanaflag ='Y'  where pk_material='"+vo.getPk_material()+"'";
+//			iUAPQueryBS.executeQuery(uct,null);
+			db.executeUpdate(uct);
+			
+		} catch (Exception e2) {
+			// TODO: handle exception
+		}	
+		db.executeUpdate("commit;");
+	}
+	
+	//组织 (org_orgs)
+	public static List<OrgVO> getOrgs(IUAPQueryBS iUAPQueryBS,String parameters) throws Exception{
+		try {
+			String sql = "select * From org_orgs  where  pk_org=? and  nvl(dr,0)=0";
+			SQLParameter param = new SQLParameter(); // 构造参数对象
+			param.addParam(parameters);
+			List<OrgVO> list=(List<OrgVO>) iUAPQueryBS.executeQuery(sql, param, new BeanListProcessor(OrgVO.class));
+			if(list.size()==0){
+				String sql1 = "select * from org_orgs where code=? and nvl(dr,0)=0";
+				SQLParameter param1 = new SQLParameter(); // 构造参数对象
+				param1.addParam(parameters);
+				list=(List<OrgVO>) iUAPQueryBS.executeQuery(sql1, param1, new BeanListProcessor(OrgVO.class));
+			}
+			if(list.size()==0){
+				throw new Exception("未找到与参数"+parameters+"有关的数据!");
+			}
+			return 	list;
+		} catch (Exception e) {
+			throw new Exception("获取组织信息失败,"+e);
+		}
+	}
+	
+	//获取组织成本域
+	public static List<CostRegionVO> getCostRegion(IUAPQueryBS iUAPQueryBS,String parameters) throws Exception{
+		try {
+			String sql = "select * From org_costregion  where  pk_org=? and  nvl(dr,0)=0";
+			SQLParameter param = new SQLParameter(); // 构造参数对象
+			param.addParam(parameters);
+			List<CostRegionVO> list=(List<CostRegionVO>) iUAPQueryBS.executeQuery(sql, param, new BeanListProcessor(CostRegionVO.class));
+			if(list.size()==0){
+				throw new Exception("未找到与参数"+parameters+"有关的数据!");
+			}
+			return 	list;
+		} catch (Exception e) {
+			throw new Exception("获取组织成本域信息失败,"+e);
+		}
+
+	}
+	
+  private BaseDAO getBaseDAO() {
+    if (this.baseDAO == null) {
+      this.baseDAO = new BaseDAO();
+    }
+    return this.baseDAO;
+  }
+
+  private MaterialVO getInsertVO(MaterialVO materialVO) throws DAOException {
+    materialVO.setEnablestate(IPubEnumConst.ENABLESTATE_ENABLE);
+    materialVO.setStatus(VOStatus.NEW);
+    materialVO.setMaterialconvert(this.getMaterialConvertVOs(materialVO));
+    materialVO.setMaterialtaxtype(this.getMaterialTaxTypeVOs(materialVO));
+    return materialVO;
+  }
+
+  @SuppressWarnings("unchecked")
+  private MaterialConvertVO[] getMaterialConvertVOs(MaterialVO MaterialVO)
+      throws DAOException {
+    List<MaterialConvertVO> newConverts = new ArrayList<MaterialConvertVO>();
+    if (StringUtils.isNotBlank(MaterialVO.getPrimaryKey())) {
+      Collection<MaterialConvertVO> oldAgentStores =
+          this.getBaseDAO().retrieveByClause(
+              MaterialConvertVO.class,
+              MaterialConvertVO.PK_MATERIAL + " = '"
+                  + MaterialVO.getPrimaryKey() + "'", new String[] {
+                MaterialConvertVO.PK_MATERIALCONVERT
+              });
+      for (MaterialConvertVO agentstore : oldAgentStores) {
+        agentstore.setStatus(VOStatus.DELETED);
+        newConverts.add(agentstore);
+      }
+    }
+    if (MaterialVO.getMaterialconvert()!= null
+        && MaterialVO.getMaterialconvert().length > 0) {
+      for (MaterialConvertVO agentstore : MaterialVO.getMaterialconvert()) {
+        agentstore.setStatus(VOStatus.NEW);
+        newConverts.add(agentstore);
+      }
+    }
+    return newConverts.toArray(new MaterialConvertVO[0]);
+  }
+
+  private MaterialTaxTypeVO[] getMaterialTaxTypeVOs(MaterialVO MaterialVO)
+      throws DAOException {
+    List<MaterialTaxTypeVO> newConverts = new ArrayList<MaterialTaxTypeVO>();
+    if (StringUtils.isNotBlank(MaterialVO.getPrimaryKey())) {
+      Collection<MaterialTaxTypeVO> oldAgentStores =
+          this.getBaseDAO().retrieveByClause(
+              MaterialTaxTypeVO.class,
+              MaterialTaxTypeVO.PK_MATERIAL + " = '"
+                  + MaterialVO.getPrimaryKey() + "'", new String[] {
+                MaterialTaxTypeVO.PK_MATERIALTAXTYPE
+              });
+      for (MaterialTaxTypeVO agentstore : oldAgentStores) {
+        agentstore.setStatus(VOStatus.DELETED);
+        newConverts.add(agentstore);
+      }
+    }
+    if (MaterialVO.getMaterialtaxtype() != null
+        && MaterialVO.getMaterialtaxtype().length > 0) {
+      for (MaterialTaxTypeVO agentstore : MaterialVO.getMaterialtaxtype()) {
+        agentstore.setStatus(VOStatus.NEW);
+        newConverts.add(agentstore);
+      }
+    }
+    return newConverts.toArray(new MaterialTaxTypeVO[0]);
+  }
+
+  private IMaterialBaseInfoService getService() {
+    if (this.service == null) {
+      this.service =
+          NCLocator.getInstance().lookup(IMaterialBaseInfoService.class);
+    }
+    return this.service;
+  }
+
+  private MaterialVO getUpdateVO(MaterialVO materialVO, String pk)
+      throws BusinessException {
+    MaterialVO oldVO =
+        (MaterialVO) this.getBaseDAO().retrieveByPK(
+            MaterialVO.class,
+            pk,
+            new String[] {
+              MaterialVO.CREATOR, MaterialVO.CREATIONTIME,
+              MaterialVO.PK_SOURCE, MaterialVO.VERSION, MaterialVO.LATEST,
+              MaterialVO.ENABLESTATE
+            });
+    if (oldVO == null) {
+      throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
+          .getStrByID("bdpub", "0bdpub0057")
+      /* @res "该数据已被删除" */);
+    }
+    materialVO.setPrimaryKey(pk);
+    materialVO.setCreator(oldVO.getCreator());
+    materialVO.setCreationtime(oldVO.getCreationtime());
+    materialVO.setPk_source(oldVO.getPk_source());
+    materialVO.setVersion(oldVO.getVersion());
+    materialVO.setLatest(oldVO.getLatest());
+    materialVO.setEnablestate(oldVO.getEnablestate());
+    materialVO.setStatus(VOStatus.UPDATED);
+    materialVO.setMaterialconvert(this.getMaterialConvertVOs(materialVO));
+    materialVO.setMaterialtaxtype(this.getMaterialTaxTypeVOs(materialVO));
+    return materialVO;
+  }
+
+  private MaterialVO insertMaterialVO(MaterialVO materialVO)
+      throws BusinessException, DAOException {
+    if (StringUtils.isBlank(materialVO.getPk_source())) {
+      materialVO =
+          this.getService().insertMaterial(this.getInsertVO(materialVO));
+    }
+    else {
+      ErrLogReturnValue value =
+          this.getService().createMaterialVersion(materialVO,
+              materialVO.getPk_source());
+      if (value.getReturnValue() == null
+          || !value.getReturnValue().getClass().isArray()) {
+        return materialVO;
+      }
+      materialVO = (MaterialVO) ((Object[]) value.getReturnValue())[0];
+      this.LogErrorMessage(value);
+    }
+    return materialVO;
+  }
+
+  private void LogErrorMessage(ErrLogReturnValue value) {
+    ErrorMsgVO[] vos = value.getErrLogResult().getErrorMsgs();
+    if (vos != null && vos.length > 0) {
+      String message =
+          nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID(
+              "10140mag",
+              "010140mag0200",
+              null,
+              new String[] {
+                Integer.toString(value.getTotalNum()),
+                Integer.toString(value.getErrLogResult().getErrorMessagegNum())
+              })
+              /* @res "外部交换平台导入物料新版本数据时,分配操作部分成功,共处理了{0}条记录,其中有{1}条处理失败:" */+ "\n";
+      for (int i = 0; i < vos.length; i++) {
+        message += vos[i].getErrormsg() + "\n";
+      }
+      Logger.debug(message);
+    }
+  }
+
+}

+ 260 - 0
ic/ic/src/private/nc/bs/ic/impl/TransformAddImpl.java

@@ -0,0 +1,260 @@
+package nc.bs.ic.impl;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.HashMap;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import nc.bs.dao.BaseDAO;
+import nc.bs.dao.DAOException;
+import nc.bs.framework.adaptor.IHttpServletAdaptor;
+import nc.bs.framework.common.InvocationInfoProxy;
+import nc.bs.framework.common.NCLocator;
+import nc.bs.framework.server.ISecurityTokenCallback;
+import nc.bs.scmpub.pf.PfParameterUtil;
+import nc.bs.servlet.service.BaseServlet;
+import nc.itf.ic.m4n.ITransformMaitain;
+import nc.itf.pu.m21.IOrderMaintain;
+import nc.itf.uap.IUAPQueryBS;
+import nc.itf.uap.pf.IPFBusiAction;
+import nc.jdbc.framework.processor.ColumnProcessor;
+import nc.log.NcLog;
+import nc.vo.ic.m4n.entity.TransformHeadVO;
+import nc.vo.ic.m4n.entity.TransformVO;
+import nc.vo.mmsfc.operationrep.entity.OprepItemVO;
+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.util.CloneUtil;
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+import nc.vo.ic.m4n.entity.TransformBodyVO;
+
+
+public class TransformAddImpl extends BaseServlet implements IHttpServletAdaptor{
+	
+	IUAPQueryBS iuap= (IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
+
+	@Override
+	public void doAction(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+		// TODO Auto-generated method stub
+		InvocationInfoProxy.getInstance().setUserDataSource("SYPTEST20230320");
+		NCLocator.getInstance().lookup(ISecurityTokenCallback.class).token("NCSystem".getBytes(),"pfxx".getBytes());
+        try {
+			String createStr = buildJson(req, resp, this.getClass().getName());
+			JSONObject json = JSONObject.fromObject(createStr);
+			String vbillcode = "";
+			PrintWriter out = resp.getWriter();
+			vbillcode = json.getString("vbillcode");
+			checkJson(json);//非空判断
+			
+			
+			InvocationInfoProxy.getInstance().setGroupId(SqlexecuteQuery("pk_group", "org_group", "code", "0001"));
+			InvocationInfoProxy.getInstance().setUserId(SqlexecuteQuery("cuserid", "sm_user", "user_code", json.getString("creator")));
+			
+			TransformVO[] transformvos = new TransformVO[1];
+			TransformVO transformvo = new TransformVO();
+			transformvos[0] = transformvo;
+			TransformHeadVO transformheadvo = new TransformHeadVO();
+			TransformBodyVO[] transformbodyvos = new TransformBodyVO[json.getJSONArray("cspecialbid").size()];
+			
+			/**
+			 * 封装表头VO
+			 */
+			transformheadvo.setVbillcode(vbillcode);
+			transformheadvo.setPk_group(SqlexecuteQuery("pk_group", "org_group", "code", "0001"));
+			transformheadvo.setPk_org(json.getString("pk_org"));
+			transformheadvo.setPk_org_v(SqlexecuteQuery2("pk_vid", "org_stockorg_v", "pk_stockorg", json.getString("pk_org")));
+			transformheadvo.setCorpoid(json.getString("pk_org"));
+			transformheadvo.setCorpvid(SqlexecuteQuery2("pk_vid", "org_corp", "pk_corp", json.getString("pk_org")));
+			transformheadvo.setDbilldate(new UFDate(json.getString("dbilldate")));
+			transformheadvo.setCtrantypeid(json.getString("ctrantypeid"));
+			transformheadvo.setVtrantypecode(SqlexecuteQuery2("pk_billtypecode", "bd_billtype", "pk_billtypeid", json.getString("ctrantypeid")));
+			transformheadvo.setCreator(SqlexecuteQuery("cuserid", "sm_user", "user_code", json.getString("creator")));
+			transformheadvo.setCreationtime(new UFDateTime(json.getString("dbilldate")));
+			transformheadvo.setBillmaker(SqlexecuteQuery("cuserid", "sm_user", "user_code", json.getString("creator")));
+			transformheadvo.setDmakedate(new UFDate(json.getString("dbilldate")));
+			transformvo.setParentVO(transformheadvo);
+			
+			/**
+			 * 封装表体VO
+			 */
+			JSONArray bodyArray = json.getJSONArray("cspecialbid");
+			int i=0;
+			for (Object Object : bodyArray) {
+				JSONObject bodyObject = JSONObject.fromObject(Object);
+				TransformBodyVO transformbodyvo = new TransformBodyVO();
+				transformbodyvo.setCrowno(bodyObject.getString("crowno"));
+				transformbodyvo.setFbillrowflag(Integer.parseInt(bodyObject.getString("fbillrowflag")));
+				transformbodyvo.setPk_group(SqlexecuteQuery("pk_group", "org_group", "code", "0001"));
+				transformbodyvo.setPk_org(bodyObject.getString("pk_org"));
+				transformbodyvo.setPk_org_v(SqlexecuteQuery2("pk_vid", "org_stockorg_v", "pk_stockorg", bodyObject.getString("pk_org")));
+				transformbodyvo.setCorpoid(bodyObject.getString("pk_org"));
+				transformbodyvo.setCorpvid(SqlexecuteQuery2("pk_vid", "org_corp", "pk_corp", bodyObject.getString("pk_org")));
+				transformbodyvo.setCbodywarehouseid(bodyObject.getString("cbodywarehouseid"));
+				transformbodyvo.setCmaterialoid(bodyObject.getString("cmaterialoid"));
+				transformbodyvo.setCmaterialvid(SqlexecuteQuery2("pk_source", "bd_material", "pk_material", bodyObject.getString("cmaterialoid")));
+				transformbodyvo.setCunitid(SqlexecuteQuery("pk_measdoc", "bd_measdoc", "code", bodyObject.getString("cunitid")));
+				transformbodyvo.setCastunitid(SqlexecuteQuery("pk_measdoc", "bd_measdoc", "code", bodyObject.getString("castunitid")));
+				transformbodyvo.setVchangerate(bodyObject.getString("vchangerate"));
+				transformbodyvo.setNnum(new UFDouble(bodyObject.getString("nnum")));
+				transformbodyvo.setNassistnum(new UFDouble(bodyObject.getString("nassistnum")));
+				transformbodyvo.setNcostprice(new UFDouble(bodyObject.getString("ncostprice")));
+				transformbodyvo.setNcostmny(new UFDouble(bodyObject.getString("ncostmny")));
+				transformbodyvo.setVbatchcode(bodyObject.getString("vbatchcode"));
+				transformbodyvos[i] = transformbodyvo;
+				i++;
+			}
+			transformvo.setChildrenVO(transformbodyvos);
+			
+			ITransformMaitain itransform=(ITransformMaitain)NCLocator.getInstance().lookup(ITransformMaitain.class);
+			itransform.insert(transformvos);
+//			IPFBusiAction service = NCLocator.getInstance().lookup(IPFBusiAction.class);
+//			HashMap<String, Object> pfparam = new HashMap<String, Object>(); // 该参数用于控制自动审批时按钮的审批状态 
+//			pfparam.put(PfParameterUtil.ORIGIN_VO_PARAMETER, CloneUtil.deepClone(transformvos[0]));
+//			service.processAction("APPROVE",
+//	                "4N", null, transformvos[0], null, pfparam);
+			out.print(formatRSJsonData("成功","",vbillcode)); 
+			
+			
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			resp.getWriter().write(formatRSJsonData("失败",
+				     e.getMessage().toString(),"").toString());
+			StringWriter stringWriter = new StringWriter();
+			e.printStackTrace(new PrintWriter(stringWriter));
+			//获取详细信息
+			String msg=stringWriter.getBuffer().toString();
+			NcLog.info("接口返回值提示:"+msg);
+		}
+        
+	}
+	
+	/*
+	 * 非空判断
+	 */
+	private void checkJson(JSONObject json) throws Exception {
+		
+		StringBuffer mags = new StringBuffer();
+		Boolean empty = true;
+		
+		String vbillcode = "vbillcode";//单据号
+		String group = "pk_group";//集团编码
+		String creator = "creator";//创建人
+		
+		String body = "cspecialbid";//表体
+ 
+		String[] HeadKey = {vbillcode,group,creator};
+		
+		for (String as : HeadKey) {
+
+			if (json.getString(as).isEmpty()) {
+				empty = false;
+				mags.append("'" + as + "'");
+			}
+		}
+		
+		if (json.getJSONArray(body)==null) {
+			empty = false;
+			mags.append("表体不存在! ");
+		}
+		
+		JSONArray oprepObjectBs = json.getJSONArray("cspecialbid");
+		
+		if (oprepObjectBs == null || oprepObjectBs.size() == 0) {
+			throw new Exception("表体内容不可为空!");
+		}
+		
+		String cmaterialoid = "cmaterialoid";//物料编码
+		
+		for(int i = 0; i < oprepObjectBs.size(); i++) {
+			
+			JSONObject oprepJsonObjectB = oprepObjectBs.getJSONObject(i);
+			String[] BodyKey = {cmaterialoid};
+			int num = i+1;
+			
+			mags.append("第"+num+"块表体:{");
+			for (String as : BodyKey) {
+
+				if (oprepJsonObjectB.getString(as).isEmpty()) {
+					empty = false;
+					mags.append("'" + as + "' ");
+				}
+			}
+			mags.append("}");
+		}
+		
+		if (!empty) {
+			throw new Exception("以下字段不可为空:"+mags);
+		}
+	}
+	
+	/*
+	 * 数据库查询
+	 */
+	private String SqlexecuteQuery(String out,String table,String key,String value) throws Exception {
+		
+		String sql = "select "+out+" from "+table+" where "+key+" = '"+value+"' and nvl(dr,0)=0";
+		
+		Object object;
+		try {
+			object = iuap.executeQuery(sql, new ColumnProcessor());
+			if (object==null) {
+				throw new Exception("未查询到数据!请检查编码"+value+"是否正确!");
+			}
+			
+			return object.toString();
+		} catch (BusinessException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			return e.getMessage();
+		}
+	}
+	
+	private String SqlexecuteQuery2(String out,String table,String key,String value) throws Exception {
+		
+		String sql = "select "+out+" from "+table+" where "+key+" = '"+value+"' and nvl(dr,0)=0 and enablestate = '2' and pk_group = '0001V5100000000006BX'";
+		
+		Object object;
+		try {
+			object = iuap.executeQuery(sql, new ColumnProcessor());
+			if (object==null) {
+				throw new Exception("未查询到数据!请检查编码"+value+"是否正确!");
+			}
+			
+			return object.toString();
+		} catch (BusinessException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			return e.getMessage();
+		}
+	}
+	
+	/*
+	 * 查询转换类型pk
+	 */
+	private String QueryTrantype(String code,String group) throws Exception {
+		
+		String sql = "select pk_billtypeid from bd_billtype where pk_billtypecode = '"+code+"' and pk_group = '"+group+"' and nvl(dr,0)=0";
+		
+		Object object;
+		try {
+			object = iuap.executeQuery(sql, new ColumnProcessor());
+			if (object==null) {
+				throw new Exception("未查询到数据!请检查编码"+code+"是否正确!");
+			}
+			
+			return object.toString();
+		} catch (BusinessException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			return e.getMessage();
+		}
+	}
+
+}

+ 85 - 0
ic/ic/src/private/nc/bs/servlet/service/BaseServlet.java

@@ -0,0 +1,85 @@
+package nc.bs.servlet.service;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+
+
+import org.codehaus.jettison.json.JSONException;
+
+import uap.json.JSONObject;
+
+/**
+ * 提供一些公共方法
+ * 具体业务请在实际服务类实现
+ */
+public class BaseServlet {
+
+	public static String STATUS_SUCCESS ="success";
+	public static String STATUS_FAILURE ="fail";
+
+	/**
+	 * 格式化传入的数据,JSON化在具体服务类实现
+	 * @param req
+	 * @param resp
+	 * @param 类名
+	 * @return
+	 * @throws ServletException
+	 * @throws IOException
+	 */
+	protected String buildJson(HttpServletRequest req,
+							   HttpServletResponse resp, String classname)
+			throws ServletException, IOException {
+		req.setCharacterEncoding("UTF-8");
+		/* 设置格式为text/json */
+		resp.setContentType("text/json");
+		/* 设置字符集为'UTF-8' */
+		resp.setCharacterEncoding("UTF-8");
+		String reqJsonData = null;
+		// 接收流
+		BufferedReader reader = new BufferedReader(new InputStreamReader(
+				req.getInputStream(), "UTF-8"));
+		StringBuffer jsonStr = new StringBuffer();
+		try {
+			String line = "";
+			while ((line = reader.readLine()) != null) {
+				jsonStr.append(line);
+			}
+			if (jsonStr != null && !"".equals(jsonStr.toString())) {
+				reqJsonData = jsonStr.toString();
+//				PrLogger.error(new UFDateTime(System.currentTimeMillis()).toString()
+//						+ "客户端传入:" + classname + "~~" + reqJsonData);
+			} else {
+				throw new ServletException("传入的数据不合法!");
+			}
+		} catch (IOException e) {
+			throw new IOException("数据读取失败" + e.getMessage());
+		} finally {
+			reader.close();
+		}
+		return reqJsonData;
+	}
+
+
+
+	/**
+	 * 格式返回json数据
+	 *
+	 * @return
+	 * @throws JSONException
+	 * @throws Exception
+	 */
+	public static JSONObject formatRSJsonData(String status,String error,String message){
+		JSONObject rs = new JSONObject();
+		rs.put("status", status);
+		rs.put("message", message);
+		rs.put("error", error);
+		return rs;
+	}
+	
+}

+ 81 - 0
ic/ic/src/private/nc/log/NcLog.java

@@ -0,0 +1,81 @@
+package nc.log;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import nc.bs.framework.common.RuntimeEnv;
+
+import org.apache.log4j.Logger;
+/**
+ * nclog
+ * @author YY
+ * @datetime 2021-9-29 
+ */
+public class NcLog
+{
+  private static final Logger logger = Logger.getLogger(NcLog.class);
+  private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+  private static SimpleDateFormat format$ = new SimpleDateFormat("yyyy-MM-dd");
+
+  public static void info(String str)
+  {
+    String logFilePath = getLogFile();
+    File file = new File(logFilePath);
+    BufferedWriter fos = null;
+    try
+    {
+      fos = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, true)));
+      str = format.format(new Date()) + " " + str + "\r\n";
+      
+      fos.write(str + "\r\n");
+      fos.flush();
+    }
+    catch (Exception localException)
+    {
+      if (fos != null)
+        try
+        {
+          fos.close();
+        }
+        catch (IOException localIOException)
+        {
+        }
+    }
+    finally {
+      if (fos != null)
+        try
+        {
+          fos.close();
+        }
+        catch (IOException localIOException2)
+        {
+        }
+    }
+  }
+
+  private static String getLogFile() {
+    String destFileFolder = RuntimeEnv.getInstance().getNCHome() + File.separator + "mancLog" + File.separator + format$.format(new Date());
+    String destFilePath = destFileFolder + File.separator + "org.log";
+    File destFolder = new File(destFileFolder);
+    if (!destFolder.exists()) {
+      destFolder.mkdirs();
+    }
+    File destFile = new File(destFilePath);
+    if (!destFile.exists()) {
+      try
+      {
+        destFile.createNewFile();
+      }
+      catch (Exception e)
+      {
+        logger.info(e);
+      }
+    }
+    return destFilePath;
+  }
+}

+ 229 - 0
ic/ic/src/private/nc/pubimpl/so/m30/pfxx/M30PfxxPlugin.java

@@ -0,0 +1,229 @@
+package nc.pubimpl.so.m30.pfxx;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import nc.bs.framework.common.InvocationInfoProxy;
+import nc.bs.framework.common.NCLocator;
+import nc.bs.pub.taskmanager.SynTaskTree;
+import nc.impl.pubapp.pattern.data.bill.BillQuery;
+import nc.impl.pubapp.pattern.data.bill.tool.BillConcurrentTool;
+import nc.impl.pubapp.pattern.rule.IRule;
+import nc.impl.so.m30.action.main.InsertSaleOrderAction;
+import nc.impl.so.m30.action.main.UpdateSaleOrderAction;
+import nc.itf.uap.pf.IPFBusiAction;
+import nc.pubimpl.so.pfxx.AbstractSOPfxxPlugin;
+import nc.pubimpl.so.pfxx.check.BillFreeStatusCheckRule;
+import nc.pubimpl.so.pfxx.check.MnyTaxCheckRule;
+import nc.pubimpl.so.pfxx.check.WriteBackInfoCheckRule;
+import nc.pubitf.uapbd.CurrencyRateUtil;
+import nc.vo.pub.AggregatedValueObject;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.lang.UFDouble;
+import nc.vo.pub.pf.workflow.IPFActionName;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+import nc.vo.so.m30.entity.SaleOrderBVO;
+import nc.vo.so.m30.entity.SaleOrderHVO;
+import nc.vo.so.m30.entity.SaleOrderVO;
+import nc.vo.wfengine.pub.WFTask;
+
+public class M30PfxxPlugin extends AbstractSOPfxxPlugin {
+
+  @Override
+  public List<IRule<AggregatedValueObject>> getCheckers() {
+    List<IRule<AggregatedValueObject>> rules =
+        new ArrayList<IRule<AggregatedValueObject>>();
+    // 单据状态检查,非自由态不可以导入
+    rules.add(new BillFreeStatusCheckRule());
+    // 价税合计=无税金额+税额(本币)
+//    rules.add(new MnyTaxCheckRule(SaleOrderBVO.NTAX, SaleOrderBVO.NMNY,
+//        SaleOrderBVO.NTAXMNY));
+    // 累计数量字段
+    rules.add(new WriteBackInfoCheckRule(new String[] {
+      SaleOrderBVO.NTOTALSENDNUM,// 累计发货主数量
+      SaleOrderBVO.NTOTALINVOICENUM,// 累计开票主数量
+      SaleOrderBVO.NTOTALOUTNUM,// 累计出库主数量
+      SaleOrderBVO.NTOTALNOTOUTNUM,// 累计应发未出库主数量
+      SaleOrderBVO.NTOTALSIGNNUM,// 累计签收主数量
+      SaleOrderBVO.NTRANSLOSSNUM,// 累计途损主数量
+      SaleOrderBVO.NTOTALRUSHNUM,// 累计出库对冲主数量
+      SaleOrderBVO.NTOTALESTARNUM,// 累计暂估应收主数量
+      SaleOrderBVO.NTOTALARNUM,// 累计确认应收主数量
+      SaleOrderBVO.NTOTALCOSTNUM,// 累计成本结算主数量
+      SaleOrderBVO.NTOTALESTARMNY,// 累计暂估应收金额
+      SaleOrderBVO.NTOTALARMNY,// 累计确认应收金额
+      SaleOrderBVO.NTOTALPAYMNY,// 累计收款核销金额
+      SaleOrderBVO.NORIGSUBMNY,// 累计冲抵金额
+      SaleOrderBVO.NARRANGESCORNUM,// 累计安排委外订单主数量
+      SaleOrderBVO.NARRANGEPOAPPNUM,// 累计安排请购单主数量
+      SaleOrderBVO.NARRANGETOORNUM,// 累计安排调拨订单主数量
+      SaleOrderBVO.NARRANGETOAPPNUM,// 累计安排调拨申请主数量
+      SaleOrderBVO.NARRANGEMONUM,// 累计安排生产订单主数量
+      SaleOrderBVO.NARRANGEPONUM,// 累计安排采购订单主数量
+      SaleOrderBVO.NTOTALPLONUM,// 累计生成计划订单主数量
+      SaleOrderBVO.NTOTALRETURNNUM,// 累计退货主数量
+      SaleOrderBVO.NTOTALTRADENUM
+    // 累计发出商品主数量
+        }));
+    return rules;
+  }
+
+  @Override
+  protected AggregatedValueObject insert(AggregatedValueObject vo) {
+
+    SaleOrderVO[] insertvo = new SaleOrderVO[] {
+      (SaleOrderVO) vo
+    };
+
+	/*异币种换算金额 */
+	
+	 /**
+     * 根据源币种主键,目的币种主键,查询指定日期的汇率
+     * 
+     * @param src_currency_pk
+     *            源币种主键
+     * @param dest_currency_pk
+     *            目的币种的主键,为null时则认为是默认目的币种主键
+     * @param date
+     * @return
+     * @throws BusinessException
+     */
+	
+    SaleOrderHVO headvo=(SaleOrderHVO) vo.getParentVO();
+ //    if( headvo.getNexchangerate().compareTo(UFDouble.ONE_DBL)!=0){
+ 		String corigcurrencyid= headvo.getCorigcurrencyid();
+ 		CurrencyRateUtil currRateUtil = CurrencyRateUtil
+ 				.getInstanceByOrg(headvo.getPk_org());
+ 		try {
+ 			SaleOrderBVO[]  bodyvos= (SaleOrderBVO[]) vo.getChildrenVO();
+ 			for(SaleOrderBVO bodyvo:bodyvos){
+ 				String ccurrencyid= bodyvo.getCcurrencyid();
+ 				
+ 				if(corigcurrencyid.equals(ccurrencyid)){
+ 					UFDouble nqtorigtaxprice = bodyvo.getNqtorigtaxprice();//含税单价
+ 					UFDouble nqtorigprice = bodyvo.getNqtorigprice();//无税单价
+ 					UFDouble norigmny = bodyvo.getNorigmny();//无税金额
+ 					UFDouble norigtaxmny = bodyvo.getNorigtaxmny();//价税合计
+ 					bodyvo.setNcaltaxmny(norigtaxmny);//计税金额
+ 					bodyvo.setNqttaxprice(nqtorigtaxprice);//本币含税单价
+ 					bodyvo.setNqtprice(nqtorigprice);//本币无税单价
+ 					bodyvo.setNqttaxnetprice(nqtorigtaxprice);//本币含税净价
+ 					bodyvo.setNqtnetprice(nqtorigprice);//本币无税净价
+ 					bodyvo.setNtaxprice(nqtorigtaxprice);//主本币含税单价
+ 					bodyvo.setNpiece(nqtorigprice);//主本币无税单价
+ 					bodyvo.setNtaxnetprice(nqtorigtaxprice);//主本币含税净价
+ 					bodyvo.setNnetprice(nqtorigprice);//主本币无税净价
+ 					bodyvo.setNmny(norigmny);//本币无税金额
+ 					bodyvo.setNtaxmny(norigtaxmny);//本币价税合计
+ 					
+ 					continue;
+ 				}
+ 				
+ 				
+ 				UFDouble foreignrate = currRateUtil.getRate(corigcurrencyid,/*原币*/
+ 	 					ccurrencyid/*本币*/, headvo.getDbilldate());//汇率
+ 				bodyvo.setNexchangerate(foreignrate);
+ 				//norigprice 原币无税单价
+ 				UFDouble norigprice=bodyvo.getNorigtaxprice();//主原币含税单价
+ 				UFDouble foreignAmount=	currRateUtil.getAmountByOpp(corigcurrencyid,
+ 						ccurrencyid, norigprice, foreignrate, headvo.getDbilldate());
+ 				bodyvo.setNtaxprice(foreignAmount);//主本币含税单价
+ 				
+ 				UFDouble ngprice=currRateUtil.getAmountByOpp(corigcurrencyid,
+ 						ccurrencyid, bodyvo.getNorigprice()/*主原币无税单价*/, foreignrate, headvo.getDbilldate());
+ 				
+ 				bodyvo.setNprice(ngprice); // 主本币无税单价
+ 				
+ 				bodyvo.setNqtprice(ngprice); //报价本币无税单价
+ 				
+ 				bodyvo.setNqttaxprice(foreignAmount);//报价本币含税单价
+ 				
+ 				
+ 				UFDouble nmny=currRateUtil.getAmountByOpp(corigcurrencyid,
+ 						ccurrencyid, bodyvo.getNorigmny()/*原币无税金额*/, foreignrate, headvo.getDbilldate());
+ 				
+ 				bodyvo.setNmny(nmny);//本币无税金额  
+ 				
+ 				UFDouble ntaxmny=currRateUtil.getAmountByOpp(corigcurrencyid,
+ 						ccurrencyid, bodyvo.getNorigtaxmny()/*原币价税合计*/, foreignrate, headvo.getDbilldate());
+ 				
+ 				bodyvo.setNtaxmny(ntaxmny);//ntaxmny 本币价税合计
+ 				
+ 				bodyvo.setNcaltaxmny(nmny);//计税金额
+ 				bodyvo.setNqtnetprice(ngprice);//本币无税净价
+ 				bodyvo.setNnetprice(ngprice);//主本币无税净价
+ 				
+ 				bodyvo.setNqttaxnetprice(foreignAmount);//本币含税净价
+ 				bodyvo.setNtaxnetprice(foreignAmount);//主本币含税净价
+
+ 				
+
+ 				bodyvo.setNtax(ntaxmny.sub(nmny));//税额=价税合计-无税金额
+ 			}
+ 			
+ 		} catch (BusinessException e1) {
+ 			 ExceptionUtils.wrappException(e1);
+              return null;
+ 		}
+//	}
+	
+	  try {
+		InsertSaleOrderAction insertact = new InsertSaleOrderAction();
+		    SaleOrderVO[] retvos = insertact.insert(insertvo);
+		    if (null == retvos || retvos.length == 0) {
+		      return null;
+		    }
+		    
+		    
+		
+		//add by ZTH 江门工玻 销售订单审批通过  
+		
+		String pk_org = retvos[0].getParentVO().getPk_org();
+		//0001V510000000002GEH   江门基地				
+		if(pk_org != null && (pk_org.equals("0001V510000000002GDX"))){
+		 IPFBusiAction service = NCLocator.getInstance().lookup(IPFBusiAction.class);
+		 String usdeid=InvocationInfoProxy.getInstance().getUserId();
+		    try {
+				service.processAction(IPFActionName.APPROVE,
+				     "30", null, retvos[0], null, null);
+			} catch (BusinessException e) {
+				// TODO 自动生成的 catch 块
+				ExceptionUtils.wrappBusinessException(e.getMessage());
+			    return null;
+			}
+		}	
+		
+		
+
+  
+		
+		return retvos[0];
+	} catch (Exception e) {
+		// TODO 自动生成的 catch 块
+		e.printStackTrace();
+	}
+	  return null;
+  }
+
+  @Override
+  protected AggregatedValueObject update(AggregatedValueObject vo, String vopk) {
+
+    SaleOrderVO[] updatevo = new SaleOrderVO[] {
+      (SaleOrderVO) vo
+    };
+    BillQuery<SaleOrderVO> billquery =
+        new BillQuery<SaleOrderVO>(SaleOrderVO.class);
+    SaleOrderVO[] origvos = billquery.query(new String[] {
+      vopk
+    });
+    BillConcurrentTool tool = new BillConcurrentTool();
+    tool.lockBill(origvos);
+    UpdateSaleOrderAction insertact = new UpdateSaleOrderAction();
+    SaleOrderVO[] retvos = insertact.update(updatevo, origvos);
+    if (null == retvos || retvos.length == 0) {
+      return null;
+    }
+    return retvos[0];
+  }
+
+}

+ 139 - 0
ic/ic/src/private/nc/pubimpl/so/m4331/pfxx/M4331PfxxPlugin.java

@@ -0,0 +1,139 @@
+package nc.pubimpl.so.m4331.pfxx;
+
+import nc.bs.framework.common.NCLocator;
+import nc.impl.pubapp.pattern.data.bill.BillQuery;
+import nc.impl.pubapp.pattern.data.bill.tool.BillConcurrentTool;
+import nc.impl.so.m4331.action.maintain.DeliveryInsertAction;
+import nc.impl.so.m4331.action.maintain.DeliveryUpdateAction;
+import nc.itf.uap.pf.IPFBusiAction;
+import nc.pubitf.uapbd.CurrencyRateUtil;
+import nc.vo.ecpubapp.pattern.exception.ExceptionUtils;
+import nc.vo.pub.AggregatedValueObject;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.lang.UFDouble;
+import nc.vo.so.m4331.entity.DeliveryBVO;
+import nc.vo.so.m4331.entity.DeliveryHVO;
+import nc.vo.so.m4331.entity.DeliveryVO;
+
+/**
+ * <b> 在此处简要描述此类的功能 </b>
+ * 
+ * <p>
+ * 在此处添加此类的描述信息
+ * </p>
+ * 
+ * @author ufsoft
+ * @version Your Project V60
+ */
+public class M4331PfxxPlugin extends nc.pubimpl.so.pfxx.AbstractSOPfxxPlugin {
+  @Override
+  protected AggregatedValueObject insert(AggregatedValueObject vo) {
+    DeliveryVO[] insertvo = new DeliveryVO[] {
+      (DeliveryVO) vo
+    };
+    /**
+     * 根据源币种主键,目的币种主键,查询指定日期的汇率
+     * 
+     * @param src_currency_pk
+     *            源币种主键
+     * @param dest_currency_pk
+     *            目的币种的主键,为null时则认为是默认目的币种主键
+     * @param date
+     * @return
+     * @throws BusinessException
+     */
+    DeliveryVO newvo = insertvo[0];
+    DeliveryHVO headvo = newvo.getParentVO();
+    CurrencyRateUtil currRateUtil = CurrencyRateUtil
+				.getInstanceByOrg(headvo.getPk_org());
+    DeliveryBVO[] bodyvos = newvo.getChildrenVO();
+    for(DeliveryBVO bodyvo:bodyvos){
+    	String corigcurrencyid = bodyvo.getCorigcurrencyid();//原币
+    	String ccurrencyid= bodyvo.getCcurrencyid();//本位币
+    	try {
+			if(corigcurrencyid.equals(ccurrencyid)){
+					UFDouble nqtorigtaxprice = bodyvo.getNqtorigtaxprice();//含税单价
+					UFDouble nqtorigprice = bodyvo.getNqtorigprice();//无税单价
+					UFDouble norigmny = bodyvo.getNorigmny();//无税金额
+					UFDouble norigtaxmny = bodyvo.getNorigtaxmny();//价税合计
+					bodyvo.setNcaltaxmny(norigtaxmny);//计税金额
+					bodyvo.setNqttaxprice(nqtorigtaxprice);//本币含税单价
+					bodyvo.setNqtprice(nqtorigprice);//本币无税单价
+					bodyvo.setNqttaxnetprice(nqtorigtaxprice);//本币含税净价
+					bodyvo.setNqtnetprice(nqtorigprice);//本币无税净价
+					bodyvo.setNtaxprice(nqtorigtaxprice);//主本币含税单价
+					bodyvo.setNpiece(nqtorigprice);//主本币无税单价
+					bodyvo.setNtaxnetprice(nqtorigtaxprice);//主本币含税净价
+					bodyvo.setNnetprice(nqtorigprice);//主本币无税净价
+					bodyvo.setNmny(norigmny);//本币无税金额
+					bodyvo.setNtaxmny(norigtaxmny);//本币价税合计
+					continue;
+				}
+				UFDouble foreignrate = currRateUtil.getRate(corigcurrencyid,/*原币*/
+						ccurrencyid/*本币*/, headvo.getDbilldate());//汇率
+				bodyvo.setNexchangerate(foreignrate);
+				//norigprice 原币无税单价
+				UFDouble norigprice=bodyvo.getNorigtaxprice();//主原币含税单价
+				UFDouble foreignAmount=	currRateUtil.getAmountByOpp(corigcurrencyid,
+						ccurrencyid, norigprice, foreignrate, headvo.getDbilldate());
+				bodyvo.setNtaxprice(foreignAmount);//主本币含税单价
+				UFDouble ngprice=currRateUtil.getAmountByOpp(corigcurrencyid,
+						ccurrencyid, bodyvo.getNorigprice()/*主原币无税单价*/, foreignrate, headvo.getDbilldate());
+				bodyvo.setNprice(ngprice); // 主本币无税单价
+				bodyvo.setNqtprice(ngprice); //报价本币无税单价
+				bodyvo.setNqttaxprice(foreignAmount);//报价本币含税单价
+				UFDouble nmny=currRateUtil.getAmountByOpp(corigcurrencyid,
+						ccurrencyid, bodyvo.getNorigmny()/*原币无税金额*/, foreignrate, headvo.getDbilldate());
+				bodyvo.setNmny(nmny);//本币无税金额  
+				UFDouble ntaxmny=currRateUtil.getAmountByOpp(corigcurrencyid,
+						ccurrencyid, bodyvo.getNorigtaxmny()/*原币价税合计*/, foreignrate, headvo.getDbilldate());
+				bodyvo.setNtaxmny(ntaxmny);//ntaxmny 本币价税合计
+				bodyvo.setNcaltaxmny(nmny);//计税金额
+				bodyvo.setNqtnetprice(ngprice);//本币无税净价
+				bodyvo.setNnetprice(ngprice);//主本币无税净价
+				bodyvo.setNqttaxnetprice(foreignAmount);//本币含税净价
+				bodyvo.setNtaxnetprice(foreignAmount);//主本币含税净价
+				bodyvo.setNtax(ntaxmny.sub(nmny));//税额=价税合计-无税金额
+		} catch (BusinessException e) {
+			// TODO 自动生成的 catch 块
+			ExceptionUtils.wrappBusinessException(e.getMessage());
+		}
+	}
+    
+    
+    DeliveryInsertAction insert = new DeliveryInsertAction();
+    try {
+		DeliveryVO[] ret = insert.insert(insertvo);
+		if (null == ret || ret.length == 0) {
+		  return null;
+		}
+		IPFBusiAction service = NCLocator.getInstance().lookup(IPFBusiAction.class);
+		DeliveryVO[] approvevos = (DeliveryVO[]) service.processAction("APPROVE", "4331", null, ret[0], null, null);
+		return approvevos[0];
+	} catch (Exception e) {
+		// TODO 自动生成的 catch 块
+		ExceptionUtils.wrappBusinessException(e.getMessage());
+	}
+    return null;
+  }
+
+  @Override
+  protected AggregatedValueObject update(AggregatedValueObject vo, String vopk) {
+    DeliveryVO[] updatevo = new DeliveryVO[] {
+      (DeliveryVO) vo
+    };
+    BillQuery<DeliveryVO> billquery =
+        new BillQuery<DeliveryVO>(DeliveryVO.class);
+    DeliveryVO[] origvos = billquery.query(new String[] {
+      vopk
+    });
+    BillConcurrentTool tool = new BillConcurrentTool();
+    tool.lockBill(origvos);
+    DeliveryUpdateAction update = new DeliveryUpdateAction();
+    DeliveryVO[] retvos = update.update(updatevo, origvos);
+    if (null == retvos || retvos.length == 0) {
+      return null;
+    }
+    return retvos[0];
+  }
+}

+ 854 - 0
ic/ic/src/public/nc/bs/ic/general/plugins/GeneralDefdocPlugin.java

@@ -0,0 +1,854 @@
+package nc.bs.ic.general.plugins;
+
+import java.util.ArrayList;
+import java.util.Map;
+
+import nc.bs.framework.common.NCLocator;
+import nc.bs.ic.pub.env.ICBSContext;
+import nc.bs.logging.Logger;
+import nc.bs.pfxx.ISwapContext;
+import nc.bs.pfxx.plugin.AbstractPfxxPlugin;
+import nc.impl.ic.util.DateCalUtil;
+import nc.impl.pubapp.pattern.data.vo.VOQuery;
+import nc.itf.mmpac.pmo.pac0002.IPMOMaintainService;
+import nc.itf.mmpac.pmo.pac0002.IPMOTransTypeQueryService;
+import nc.itf.scmpub.reference.uap.pf.PfServiceScmUtil;
+import nc.itf.uap.IUAPQueryBS;
+import nc.itf.uap.pf.IPFBusiAction;
+import nc.jdbc.framework.processor.ArrayListProcessor;
+import nc.jdbc.framework.processor.ColumnProcessor;
+import nc.pubitf.uapbd.CurrencyRateUtil;
+import nc.vo.ia.mi4.entity.I4BillVO;
+import nc.vo.ia.mi4.entity.I4ItemVO;
+import nc.vo.ic.general.define.ICBillBodyVO;
+import nc.vo.ic.general.define.ICBillFlag;
+import nc.vo.ic.general.define.ICBillHeadVO;
+import nc.vo.ic.general.define.ICBillVO;
+import nc.vo.ic.general.define.MetaNameConst;
+import nc.vo.ic.general.util.InOutHelp;
+import nc.vo.ic.m45.entity.PurchaseInBodyVO;
+import nc.vo.ic.m45.entity.PurchaseInHeadVO;
+import nc.vo.ic.m45.entity.PurchaseInVO;
+import nc.vo.ic.m46.entity.FinProdInBodyVO;
+import nc.vo.ic.m46.entity.FinProdInHeadVO;
+import nc.vo.ic.m46.entity.FinProdInVO;
+import nc.vo.ic.m4a.entity.GeneralInBodyVO;
+import nc.vo.ic.m4a.entity.GeneralInHeadVO;
+import nc.vo.ic.m4a.entity.GeneralInVO;
+import nc.vo.ic.m4c.entity.SaleOutBodyVO;
+import nc.vo.ic.m4c.entity.SaleOutHeadVO;
+import nc.vo.ic.m4c.entity.SaleOutVO;
+import nc.vo.ic.m4d.entity.MaterialOutBodyVO;
+import nc.vo.ic.m4d.entity.MaterialOutHeadVO;
+import nc.vo.ic.m4d.entity.MaterialOutVO;
+import nc.vo.ic.m4i.entity.GeneralOutBodyVO;
+import nc.vo.ic.m4i.entity.GeneralOutHeadVO;
+import nc.vo.ic.m4i.entity.GeneralOutVO;
+import nc.vo.ic.m4k.entity.WhsTransBillBodyVO;
+import nc.vo.ic.m4k.entity.WhsTransBillHeaderVO;
+import nc.vo.ic.m4k.entity.WhsTransBillVO;
+import nc.vo.ic.m4q.entity.LocAdjustBodyVO;
+import nc.vo.ic.m4q.entity.LocAdjustHeadVO;
+import nc.vo.ic.m4q.entity.LocAdjustVO;
+import nc.vo.ic.pub.define.ICBillTableInfo;
+import nc.vo.ic.pub.define.ICPubMetaNameConst;
+import nc.vo.ic.pub.util.StringUtil;
+import nc.vo.ic.pub.util.ValueCheckUtil;
+import nc.vo.pfxx.auxiliary.AggxsysregisterVO;
+import nc.vo.pfxx.util.PfxxPluginUtils;
+import nc.vo.pub.AggregatedValueObject;
+import nc.vo.pub.BusinessException;
+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.pub.pf.workflow.IPFActionName;
+import nc.vo.pubapp.calculator.CalculatorUtil;
+import nc.vo.pubapp.calculator.formula.SummnyMoneyTaxFormula;
+import nc.vo.pubapp.pattern.data.ValueUtils;
+import nc.vo.pubapp.pattern.exception.ExceptionUtils;
+import nc.vo.pubapp.pattern.pub.SqlBuilder;
+import nc.vo.pubapp.scale.ScaleUtils;
+import nc.vo.pubapp.util.VORowNoUtils;
+import nc.vo.to.m5x.entity.BillHeaderVO;
+import nc.vo.to.m5x.entity.BillItemVO;
+import nc.vo.to.m5x.entity.BillVO;
+
+/**
+ * 外部交换平台,导入外部普通单数据处理类
+ * 
+ * @since 6.0
+ * @version 2011-4-25 下午04:07:36
+ * @author wanghna
+ */
+public class GeneralDefdocPlugin extends AbstractPfxxPlugin {
+   
+  @Override
+  protected Object processBill(Object vo, ISwapContext swapContext,
+      AggxsysregisterVO aggxsysvo) throws BusinessException {
+
+    if (vo == null)
+      throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
+          .getStrByID("4008001_0", "04008001-0137")/*@res "转换后的vo数据为空"*/);
+    /**
+     * 销售出库
+     */
+    if(vo instanceof SaleOutVO){
+    	SaleOutVO saleoutvo = (SaleOutVO) vo;
+    	SaleOutHeadVO headvo = saleoutvo.getHead();
+    	SaleOutBodyVO[] bodyvos = saleoutvo.getBodys();
+    	CurrencyRateUtil currRateUtil = CurrencyRateUtil
+				.getInstanceByOrg(headvo.getPk_org());
+    	for(SaleOutBodyVO bodyvo : bodyvos){
+    		String corigcurrencyid = bodyvo.getCorigcurrencyid();//原币
+        	String ccurrencyid= bodyvo.getCcurrencyid();//本位币
+        	try {
+    			if(corigcurrencyid.equals(ccurrencyid)){
+    					UFDouble nqtorigtaxprice = bodyvo.getNqtorigtaxprice();//含税单价
+    					UFDouble nqtorigprice = bodyvo.getNqtorigprice();//无税单价
+    					UFDouble norigmny = bodyvo.getNorigmny();//无税金额
+    					UFDouble norigtaxmny = bodyvo.getNorigtaxmny();//价税合计
+    					bodyvo.setNcaltaxmny(norigtaxmny);//计税金额
+    					bodyvo.setNqttaxprice(nqtorigtaxprice);//本币含税单价
+    					bodyvo.setNqtprice(nqtorigprice);//本币无税单价
+    					bodyvo.setNqttaxnetprice(nqtorigtaxprice);//本币含税净价
+    					bodyvo.setNqtnetprice(nqtorigprice);//本币无税净价
+    					bodyvo.setNtaxprice(nqtorigtaxprice);//主本币含税单价
+    					bodyvo.setNpiece(nqtorigprice);//主本币无税单价
+    					bodyvo.setNtaxnetprice(nqtorigtaxprice);//主本币含税净价
+    					bodyvo.setNnetprice(nqtorigprice);//主本币无税净价
+    					bodyvo.setNmny(norigmny);//本币无税金额
+    					bodyvo.setNtaxmny(norigtaxmny);//本币价税合计
+    					continue;
+    				}
+    				UFDouble foreignrate = currRateUtil.getRate(corigcurrencyid,/*原币*/
+    						ccurrencyid/*本币*/, headvo.getDbilldate());//汇率
+    				bodyvo.setNchangestdrate(foreignrate);
+    				//norigprice 原币无税单价
+    				UFDouble norigprice=bodyvo.getNorigtaxprice();//主原币含税单价
+    				UFDouble foreignAmount=	currRateUtil.getAmountByOpp(corigcurrencyid,
+    						ccurrencyid, norigprice, foreignrate, headvo.getDbilldate());
+    				bodyvo.setNtaxprice(foreignAmount);//主本币含税单价
+    				UFDouble ngprice=currRateUtil.getAmountByOpp(corigcurrencyid,
+    						ccurrencyid, bodyvo.getNorigprice()/*主原币无税单价*/, foreignrate, headvo.getDbilldate());
+    				bodyvo.setNprice(ngprice); // 主本币无税单价
+    				bodyvo.setNqtprice(ngprice); //报价本币无税单价
+    				bodyvo.setNqttaxprice(foreignAmount);//报价本币含税单价
+    				UFDouble nmny=currRateUtil.getAmountByOpp(corigcurrencyid,
+    						ccurrencyid, bodyvo.getNorigmny()/*原币无税金额*/, foreignrate, headvo.getDbilldate());
+    				bodyvo.setNmny(nmny);//本币无税金额  
+    				UFDouble ntaxmny=currRateUtil.getAmountByOpp(corigcurrencyid,
+    						ccurrencyid, bodyvo.getNorigtaxmny()/*原币价税合计*/, foreignrate, headvo.getDbilldate());
+    				bodyvo.setNtaxmny(ntaxmny);//ntaxmny 本币价税合计
+    				bodyvo.setNcaltaxmny(nmny);//计税金额
+    				bodyvo.setNqtnetprice(ngprice);//本币无税净价
+    				bodyvo.setNnetprice(ngprice);//主本币无税净价
+    				bodyvo.setNqttaxnetprice(foreignAmount);//本币含税净价
+    				bodyvo.setNtaxnetprice(foreignAmount);//主本币含税净价
+    				bodyvo.setNtax(ntaxmny.sub(nmny));//税额=价税合计-无税金额
+    		} catch (BusinessException e) {
+    			// TODO 自动生成的 catch 块
+    			ExceptionUtils.wrappBusinessException(e.getMessage());
+    		}
+    	}
+    }
+    /**
+     * add by ZTH
+     * 2021-07-16
+     *  
+     */
+    if(vo instanceof FinProdInVO ){  //产成品入库
+    	FinProdInVO finvo=(FinProdInVO) vo;
+    	FinProdInBodyVO [] bodyvos=(FinProdInBodyVO[]) finvo.getChildrenVO();
+    	FinProdInHeadVO  headvo=(FinProdInHeadVO) finvo.getParentVO();
+    	for(FinProdInBodyVO byvo: bodyvos){
+    		UFDate dproducedate=byvo.getDproducedate();//生产日期
+    		Object qualityNumpbj=getbzjinfo(byvo.getCmaterialoid(),byvo.getPk_org());
+    		Object rack = bodytranslaterack(headvo.getCwarehouseid() , byvo.getPk_org(), byvo.getClocationid());
+    		Object materialvid = disposeMaterialVersions(byvo.getCmaterialvid());
+    		Object materialoid = disposeMaterialVersions2(byvo.getCmaterialoid());
+    		Object cfirstbillhid = setCbmoid(byvo.getVfirstbillcode());//生产订单表头
+      		Object cfirstbillbid = setCbmobid(byvo.getVfirstbillcode());//生产订单表体
+    		Object csourcebillhid = setMm_wrPK(byvo.getVsourcebillcode());//生产报告
+    		Object csourcebillbid = setMm_wr_productPK(byvo.getVsourcebillcode());//生产报告
+    		byvo.setCfirstbillhid((String) cfirstbillhid);
+    		byvo.setCfirstbillbid((String) cfirstbillbid);
+    		byvo.setCsourcebillhid((String) csourcebillhid);
+    		byvo.setCsourcebillbid((String) csourcebillbid);
+    		byvo.setCmaterialvid((String) materialvid);//物料多版本
+    		byvo.setCmaterialoid((String) materialoid);//物料单版本
+    		byvo.setCproductid((String) materialoid);//产成品
+    		byvo.setClocationid((String) rack);//货位
+    		if(null!=qualityNumpbj&&null!=dproducedate){
+    			Integer qualityNum=(Integer) qualityNumpbj;
+    			UFDate dvalidate =
+    	       	          DateCalUtil.calDvalidate(dproducedate, qualityNum, 2);
+    	    		 byvo.setDvalidate(dvalidate);
+    		}
+    	}
+     }else if(vo instanceof PurchaseInVO ){		//采购入库
+    	PurchaseInVO  finvo=(PurchaseInVO) vo;
+    	PurchaseInBodyVO  [] bodyvos=(PurchaseInBodyVO[]) finvo.getChildrenVO();
+    	PurchaseInHeadVO headvo = (PurchaseInHeadVO) finvo.getParentVO();
+    	for(PurchaseInBodyVO byvo: bodyvos){
+    		UFDate dproducedate=byvo.getDproducedate();//生产日期   
+    		UFDouble ntaxmny = bodydisposenorigtaxmny(byvo.getPk_group(), byvo.getNqtorigtaxprice(), byvo.getNassistnum(), byvo.getCorigcurrencyid());
+    		UFDouble nmny = bodydisposenorigmny(byvo.getPk_group(), byvo.getNqtorigtaxprice(), byvo.getNtaxrate(), byvo.getNassistnum(), byvo.getCorigcurrencyid());
+    		byvo.setNtaxmny(ntaxmny);//本币价税合计
+    		byvo.setNorigtaxmny(ntaxmny);//价税合计
+    		byvo.setNmny(nmny);//本币无税金额
+    		byvo.setNorigmny(nmny);//无税金额
+    		byvo.setNcalcostmny(nmny);//计成本金额
+    		byvo.setNtax(CalculatorUtil.sub(ntaxmny,nmny));//本币税额
+    		byvo.setNcaltaxmny(CalculatorUtil.sub(ntaxmny,nmny));//计税税额
+    		Object rack = bodytranslaterack(headvo.getCwarehouseid() , byvo.getPk_org(), byvo.getClocationid());
+    		Object qualityNumpbj=getbzjinfo(byvo.getCmaterialoid(),byvo.getPk_org());
+    		Object material = disposeMaterialVersions(byvo.getCmaterialvid());
+    		byvo.setCmaterialvid((String) material);//物料多版本
+    		//add by ZTH 2022-09-22 修改物料编码主键为老版本主键
+    		byvo.setCmaterialoid((String) disposeMaterialVersions2(byvo.getCmaterialvid()));
+    		
+    		
+    		byvo.setClocationid((String) rack);//货位
+    		if(null!=qualityNumpbj&&null!=dproducedate){
+    			Integer qualityNum=(Integer) qualityNumpbj;
+    			UFDate dvalidate =
+    	       	          DateCalUtil.calDvalidate(dproducedate, qualityNum, 2);
+    	    		 byvo.setDvalidate(dvalidate);
+    		}
+    	}
+     }else if(vo instanceof GeneralInVO ){   //其它入库  ic_generalin_h
+    	GeneralInVO  finvo=(GeneralInVO ) vo;
+    	GeneralInBodyVO  [] bodyvos=(GeneralInBodyVO[]) finvo.getChildrenVO();
+    	GeneralInHeadVO headvo = (GeneralInHeadVO) finvo.getParentVO();
+    	for(GeneralInBodyVO byvo: bodyvos){
+    		UFDate dproducedate=byvo.getDproducedate();//生产日期
+    		Object qualityNumpbj=getbzjinfo(byvo.getCmaterialoid(),byvo.getPk_org());
+    		Object rack = bodytranslaterack(headvo.getCwarehouseid() , byvo.getPk_org(), byvo.getClocationid());
+    		byvo.setClocationid((String) rack);//货位
+    		if(null!=qualityNumpbj&&null!=dproducedate){
+    			Integer qualityNum=(Integer) qualityNumpbj;
+    			UFDate dvalidate =
+    	       	          DateCalUtil.calDvalidate(dproducedate, qualityNum, 2);
+    	    		 byvo.setDvalidate(dvalidate);
+    		}
+    	}
+      }else if(vo instanceof GeneralOutVO ){  //其它出库   ic_generalout_h
+    	 GeneralOutVO  finvo=(GeneralOutVO) vo;
+    	 GeneralOutBodyVO [] bodyvos=(GeneralOutBodyVO[]) finvo.getChildrenVO();
+    	 GeneralOutHeadVO headvo = (GeneralOutHeadVO) finvo.getParentVO();
+  		 for(GeneralOutBodyVO byvo: bodyvos){
+     		UFDate dproducedate=byvo.getDproducedate();//生产日期
+     		Object qualityNumpbj=getbzjinfo(byvo.getCmaterialoid(),byvo.getPk_org());
+     		Object rack = bodytranslaterack(headvo.getCwarehouseid() , byvo.getPk_org(), byvo.getClocationid());
+    		byvo.setClocationid((String) rack);//货位
+     		if(null!=qualityNumpbj&&null!=dproducedate){
+     			Integer qualityNum=(Integer) qualityNumpbj;
+     			UFDate dvalidate =
+     	       	          DateCalUtil.calDvalidate(dproducedate, qualityNum, 2);
+     	    		 byvo.setDvalidate(dvalidate);
+     		}
+  		 }
+     }else if(vo instanceof MaterialOutVO ){  //材料出库
+    	 MaterialOutVO  finvo=(MaterialOutVO) vo;
+    	 MaterialOutBodyVO [] bodyvos=(MaterialOutBodyVO[]) finvo.getChildrenVO();
+    	 MaterialOutHeadVO headvo = (MaterialOutHeadVO) finvo.getParentVO();
+    	 for(MaterialOutBodyVO byvo: bodyvos){
+      		UFDate dproducedate=byvo.getDproducedate();//生产日期
+      		Object qualityNumpbj=getbzjinfo(byvo.getCmaterialoid(),byvo.getPk_org());
+      		Object rack = bodytranslaterack(headvo.getCwarehouseid() , byvo.getPk_org(), byvo.getClocationid());
+      		Object cfirstbillhid = setCbmoid(byvo.getVfirstbillcode());//生产订单表头
+      		Object cfirstbillbid = setCbmobid(byvo.getVfirstbillcode());//生产订单表体
+      		Object mm_pickmpk = setMm_pickmPK(byvo.getVfirstbillcode());//备料计划表体PK
+      		Object pickmvbillcode = setPickmvbillcode(byvo.getVfirstbillcode());//备料计划号
+      		Object pickmvbusitype = setPickmvbusitype(byvo.getVfirstbillcode());//备料计划交易类型
+      		Object pickm_bpk = setPickm_bPK(byvo.getVfirstbillcode());//备料计划表体PK
+      		Object pickm_bvrowno = setPickm_bvrowno(byvo.getVfirstbillcode());//备料计划表体行号
+      		byvo.setCsourcebillhid((String) mm_pickmpk);
+      		byvo.setVsourcebillcode((String) pickmvbillcode);
+      		byvo.setCsourcetranstype((String) pickmvbusitype);
+      		byvo.setCsourcebillbid((String) pickm_bpk);
+      		byvo.setVsourcerowno((String) pickm_bvrowno);
+      		byvo.setCfirstbillhid((String) cfirstbillhid);
+      		byvo.setCfirstbillbid((String) cfirstbillbid);
+    		byvo.setClocationid((String) rack);//货位
+    		//add by PCY 2022-11-25 修改物料编码主键为老版本主键
+    		byvo.setCmaterialoid((String) disposeMaterialVersions2(byvo.getCmaterialvid()));
+      		if(null!=qualityNumpbj&&null!=dproducedate){
+      			Integer qualityNum=(Integer) qualityNumpbj;
+      			UFDate dvalidate =
+      	       	          DateCalUtil.calDvalidate(dproducedate, qualityNum, 2);
+      	    		 byvo.setDvalidate(dvalidate);
+      		}
+    	 }
+    	 
+     }else if(vo instanceof WhsTransBillVO ){  //转库单
+    	 WhsTransBillVO finvo=(WhsTransBillVO) vo;
+    	 WhsTransBillBodyVO  [] bodyvos=(WhsTransBillBodyVO[]) finvo.getChildrenVO();
+    	 WhsTransBillHeaderVO headvo = (WhsTransBillHeaderVO) finvo.getParentVO();
+    	 for(WhsTransBillBodyVO byvo: bodyvos){
+       		UFDate dproducedate=byvo.getDproducedate();//生产日期
+       		Object qualityNumpbj=getbzjinfo(byvo.getCmaterialoid(),byvo.getPk_org());
+       		Object rack = bodytranslaterack(headvo.getCwarehouseid() , byvo.getPk_org(), byvo.getClocationid());
+    		byvo.setClocationid((String) rack);//货位
+       		if(null!=qualityNumpbj&&null!=dproducedate){
+       			Integer qualityNum=(Integer) qualityNumpbj;
+       			UFDate dvalidate =
+       	       	          DateCalUtil.calDvalidate(dproducedate, qualityNum, 2);
+       	    		 byvo.setDvalidate(dvalidate);
+       		}
+    	 }
+     }
+    
+    String vopk =
+        PfxxPluginUtils.queryBillPKBeforeSaveOrUpdate(
+            swapContext.getBilltype(), swapContext.getDocID(),
+            swapContext.getOrgPk());
+
+    if (!StringUtil.isSEmptyOrNull(vopk) && !this.canUpdate())
+      throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
+          .getStrByID("4008001_0", "04008001-0138")/*@res "当前单据以前被导入过"*/);
+    // TODO 如果存在是否允许更新
+    // PfxxPluginUtils.checkBillCanBeUpdate(UfinterfaceVO swapContext);
+
+    ICBillVO icbill = (ICBillVO) vo;
+    icbill.getHead().setCgeneralhid(vopk);
+
+    ICBillVO[] icbills = null;
+    if (ValueUtils.getBoolean(swapContext.getReplace()))
+      icbills = this.doUpdate(swapContext, icbill);
+    else
+      icbills = this.doSave(swapContext, icbill);
+
+    return icbills[0].getHead().getCgeneralhid();
+  }
+
+  /**
+   * 新增
+   * 
+   * @param swapContext
+   * @param icbill
+   * @return
+   * @throws BusinessException
+   */
+  private ICBillVO[] doSave(ISwapContext swapContext, ICBillVO icbill)
+      throws BusinessException {
+    //检查是否允许保存
+    this.checkCanInster(icbill);
+    Logger.info("保存新单据前处理...");
+    this.processBeforeSave(icbill);
+
+    // TODO 单据设置有辅助信息,aggxsysvo为用户配置的具体辅助信息
+
+    Logger.info("保存新单据...");
+    IPFBusiAction service = NCLocator.getInstance().lookup(IPFBusiAction.class);
+    ICBillVO[] icbills =
+        (ICBillVO[]) service.processAction(IPFActionName.WRITE,
+            swapContext.getBilltype(), null, icbill, null, null);
+    
+    
+/*    //add by ZTH 江门工玻单据审批通过   
+	String pk_org = icbills[0].getParentVO().getPk_org();
+	//0001V510000000001XCM   上海耀皮工程玻璃有限公司
+	//0001V510000000002GFN   重庆耀皮工程玻璃有限公司
+	//0001V510000000002GF2      天津耀皮工程玻璃有限公司
+	//0001V510000000002GEH   江门耀皮工程玻璃有限公司					
+	if(pk_org != null && (pk_org.equals("0001V510000000001XCM") 
+			|| pk_org.equals("0001V510000000002GFN")
+			|| pk_org.equals("0001V510000000002GF2")
+			|| pk_org.equals("0001V510000000002GEH"))){
+		if(swapContext.getBilltype().equals("46")){
+			icbills =
+		            (ICBillVO[]) service.processAction("SIGN",
+		                "46", null, icbill, null, null);
+		}
+		else if(swapContext.getBilltype().equals("4C")){
+			icbills =
+		            (ICBillVO[]) service.processAction("SIGN",
+		                "4C", null, icbill, null, null);
+		}
+		else{
+			icbills =
+		            (ICBillVO[]) service.processAction(IPFActionName.APPROVE,
+		                swapContext.getBilltype(), null, icbill, null, null);
+		}
+	}	*/
+    
+    
+
+    Logger.info("保存新单据完成...");
+
+    Logger.info("保存新单据后处理...");
+    this.processAfterSave(icbill);
+
+    if (ValueCheckUtil.isNullORZeroLength(icbills))
+      return null;
+
+    if (this.canUpdate())
+      PfxxPluginUtils.addDocIDVsPKContrast(swapContext.getBilltype(),
+          swapContext.getDocID(), swapContext.getOrgPk(), icbills[0].getHead()
+              .getCgeneralhid());
+    
+    
+    
+    
+    
+    return icbills;
+  }
+
+  /**
+   * 修改:先删除,后新增
+   * 
+   * @param swapContext
+   * @param icbill
+   * @return
+   * @throws BusinessException
+   */
+  private ICBillVO[] doUpdate(ISwapContext swapContext, ICBillVO icbill)
+      throws BusinessException {
+    ICBillVO bill = getOriBillVO(icbill, swapContext.getBilltype());
+    if (bill != null) {
+      IPFBusiAction service =
+          NCLocator.getInstance().lookup(IPFBusiAction.class);
+      service.processAction(IPFActionName.DEL_DELETE,
+          swapContext.getBilltype(), null, bill, null, null);
+    }
+    return this.doSave(swapContext, icbill);
+  }
+
+  /**
+   * 根据单据号获得已存在的vo
+   * 
+   * @param icbill
+   * @param billtype
+   * @return
+   */
+  private ICBillVO getOriBillVO(ICBillVO icbill, String billtype) {
+    if (StringUtil.isSEmptyOrNull(icbill.getHead().getVbillcode()))
+      return null;
+    SqlBuilder where = new SqlBuilder();
+    where.append(" and ");
+    where.append(ICPubMetaNameConst.VBILLCODE, icbill.getHead().getVbillcode());
+    where.append(" and ");
+    where.append(ICPubMetaNameConst.PK_GROUP, icbill.getHead().getPk_group());
+    // where.append(" and ");
+    // where.append(ICPubMetaNameConst.PK_ORG,icbill.getHead().getPk_org());
+
+    ICBillTableInfo billinfo =
+        ICBillTableInfo.getICBillTableInfo(InOutHelp.getICBillType(billtype));
+    VOQuery<ICBillHeadVO> query =
+        new VOQuery<ICBillHeadVO>(billinfo.getHeadClass(), new String[] {
+          MetaNameConst.CGENERALHID, ICPubMetaNameConst.TS
+        });
+    ICBillHeadVO[] heads = query.query(where.toString(), null);
+    if (ValueCheckUtil.isNullORZeroLength(heads))
+      return null;
+    where = new SqlBuilder();
+    where.append(" and ");
+    where.append(MetaNameConst.CGENERALHID, heads[0].getCgeneralhid());
+    VOQuery<ICBillBodyVO> bodyquery =
+        new VOQuery<ICBillBodyVO>(billinfo.getBodyClass(), new String[] {
+          MetaNameConst.CGENERALHID, MetaNameConst.CGENERALBID,
+          ICPubMetaNameConst.TS
+        });
+    ICBillBodyVO[] bodys = bodyquery.query(where.toString(), null);
+    if (ValueCheckUtil.isNullORZeroLength(bodys))
+      return null;
+
+    ICBillVO bill = billinfo.createBillVO();
+    bill.setParent(heads[0]);
+    bill.setChildrenVO(bodys);
+    return bill;
+  }
+
+  /**
+   * 单据保存前处理
+   * 
+   * @param vo
+   */
+  protected void processBeforeSave(ICBillVO vo) throws BusinessException {
+
+    if (null == vo)
+      throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
+          .getStrByID("4008001_0", "04008001-0139")/*@res "单据不能为空"*/);
+
+    // this.checkNullValue(vo);
+    // 表头组织翻译后没有赋值,需要重表体字段重新取一边
+      if(StringUtil.isSEmptyOrNull(vo.getParentVO().getPk_org()))
+      vo.getParentVO().setPk_org(vo.getBodys()[0].getPk_org());
+      if(StringUtil.isSEmptyOrNull(vo.getParentVO().getPk_org_v()))
+      vo.getParentVO().setPk_org_v(vo.getBodys()[0].getPk_org_v());
+      if(StringUtil.isSEmptyOrNull(vo.getParentVO().getCwarehouseid()))
+      vo.getParentVO().setCwarehouseid(vo.getBodys()[0].getCbodywarehouseid());
+
+    ICBSContext context = new ICBSContext();
+    this.headVOProcess(vo.getHead(), context);
+    this.bodyVOProcess(vo, context);
+  }
+
+  /**
+   * 单据保存后处理
+   * 
+   * @param vo
+   */
+  protected void processAfterSave(ICBillVO vo) throws BusinessException {
+    if (null == vo)
+      throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
+          .getStrByID("4008001_0", "04008001-0140")/*@res "单据保存失败"*/);
+  }
+
+  /**
+   * 表头处理,处理默认值,公司,单据日期,单据状态,打印次数,集团
+   * 
+   * @param vo
+   */
+  private void headVOProcess(ICBillHeadVO vo, ICBSContext context) {
+    vo.setStatus(VOStatus.NEW);
+    // 集团
+    if (StringUtil.isSEmptyOrNull(vo.getPk_group()))
+      vo.setPk_group(context.getPk_group());
+    // 打印次数
+    if (vo.getIprintcount() == null)
+      vo.setIprintcount(Integer.valueOf(0));
+    // 单据状态
+    if (vo.getFbillflag() == null)
+      vo.setFbillflag((Integer) ICBillFlag.FREE.value());
+    // 单据日期
+    if (vo.getDbilldate() == null)
+      vo.setDbilldate(context.getBizDate());
+    // 公司
+    if (StringUtil.isSEmptyOrNull(vo.getCorpoid())
+        || StringUtil.isSEmptyOrNull(vo.getCorpvid())) {
+      vo.setCorpoid(context.getOrgInfo().getCorpIDByCalBodyID(vo.getPk_org()));
+      vo.setCorpvid(context.getOrgInfo().getCorpVIDByCalBodyID(vo.getPk_org()));
+    }
+
+    if (StringUtil.isSEmptyOrNull(vo.getCtrantypeid())) {
+      // uap不支持单据类型的翻译,暂时以交易类型code查询id的方式补交易类型
+      String vtrantypecode = vo.getVtrantypecode();
+      Map<String, String> map =
+          PfServiceScmUtil.getTrantypeidByCode(new String[] {
+            vtrantypecode
+          });
+      vo.setCtrantypeid(map == null ? null : map.get(vtrantypecode));
+    }
+
+  }
+
+  /**
+   * 单据表体处理
+   * 
+   * @param vo
+   * @param context
+   * @throws BusinessException
+   */
+  private void bodyVOProcess(ICBillVO vo, ICBSContext context)
+      throws BusinessException {
+    ICBillBodyVO[] vos = vo.getBodys();
+    if (ValueCheckUtil.isNullORZeroLength(vos))
+      throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
+          .getStrByID("4008001_0", "04008001-0141")/*@res "单据表体不能为空"*/);
+
+    VORowNoUtils.setVOsRowNoByRule(vos, ICPubMetaNameConst.CROWNO);// 行号处理
+
+    ICBillHeadVO head = vo.getHead();
+    for (ICBillBodyVO body : vos) {
+      body.setStatus(VOStatus.NEW);
+      if (StringUtil.isSEmptyOrNull(body.getCmaterialoid())
+          || StringUtil.isSEmptyOrNull(body.getCmaterialvid()))
+        throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes()
+            .getStrByID("4008001_0", "04008001-0142")/*@res "单据表体物料不能为空"*/);
+
+      body.setBbarcodeclose(UFBoolean.FALSE);// 单据行是否条码关闭
+      body.setBonroadflag(UFBoolean.FALSE);// 是否在途
+      if (body.getDbizdate() == null)
+        body.setDbizdate(context.getBizDate());// 业务日期
+      // 辅单位
+      if (StringUtil.isSEmptyOrNull(body.getCastunitid()))
+        body.setCastunitid(context.getInvInfo()
+            .getInvBasVO(body.getCmaterialvid()).getPk_stockmeas());
+
+      bodyVOCopyFromHeadVO(body, head);
+
+    }
+
+  }
+
+  /**
+   * 根据表头设置表体默认值,表体集团,库存组织,公司,仓库,交易类型
+   * 
+   * @param body
+   * @param head
+   */
+  private void bodyVOCopyFromHeadVO(ICBillBodyVO body, ICBillHeadVO head) {
+    body.setPk_group(head.getPk_group());
+    body.setPk_org(head.getPk_org());
+    body.setPk_org_v(head.getPk_org_v());
+    body.setCorpoid(head.getCorpoid());
+    body.setCorpvid(head.getCorpvid());
+    body.setCbodywarehouseid(head.getCwarehouseid());
+    body.setCbodytranstypecode(head.getVtrantypecode());
+  }
+
+  /**
+   * 是否允许更新
+   * 
+   * @return
+   */
+  protected boolean canUpdate() {
+    return false;
+  }
+  
+  /**
+   * 检验vo是否可更新
+   * 
+   * @param vo
+   */
+  protected void checkCanInster(AggregatedValueObject vo) {
+    this.checkBillFlag(vo);
+    new CheckMnyUtil().checkMny(vo);
+    new CheckScaleUtil().checkScale(vo);
+  }
+
+  
+  /**
+   * 检验vo状态
+   * 
+   * @param vo
+   */
+  private void checkBillFlag(AggregatedValueObject vo) {
+    if (!Integer.valueOf(ICBillFlag.getFreeFlag()).equals(
+        vo.getParentVO().getAttributeValue(this.getBillStatusKey()))) {
+      ExceptionUtils.wrappBusinessException(nc.vo.ml.NCLangRes4VoTransl
+          .getNCLangRes().getStrByID("4008001_0", "04008001-0816")/*
+                                                                   * @res
+                                                                   * "非自由态的单据不允许导入!"
+                                                                   */);
+    }
+  }
+  
+  protected String getBillStatusKey() {
+    return ICPubMetaNameConst.FBILLFLAG;
+  }
+
+  /**
+   * 
+   * 查询保质期
+   * 
+   * @param pk_material
+   * @return
+   * @throws BusinessException
+   */
+  private  Object  getbzjinfo(String pk_material,String pk_org) throws BusinessException{
+	StringBuilder sb=new StringBuilder();  
+	sb.append("  select qualitynum  from  bd_materialstock where  pk_material ='" + pk_material + "'  and pk_org ='" + pk_org + "' ");
+	return obtaindb(sb.toString());
+	  
+  }
+  
+  public Object obtaindb(String sql) {
+	  IUAPQueryBS iuapbs=(IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
+	  Object als = null;
+		if ((sql != null) && (!sql.equals(""))) {
+			try {
+				als = iuapbs.executeQuery(sql, new ColumnProcessor());
+			} catch (BusinessException e) {
+				e.printStackTrace();
+			}
+		}
+		return als;
+	}
+  
+  /**
+   * 重算价税合计
+   * @param pk_group 集团主键
+   * @param nqtorigtaxprices 含税单价
+   * @param nassistnum 辅数量
+   * @param corigcurrencyid 币种主键
+   * @return
+   */
+  public UFDouble bodydisposenorigtaxmny(String pk_group,UFDouble nqtorigtaxprices,UFDouble nassistnum,String corigcurrencyid){
+	  ScaleUtils scale = new ScaleUtils(pk_group);
+	  UFDouble nqtorigtaxprice = nqtorigtaxprices;//含税单价
+	  UFDouble num = nassistnum;//辅数量
+	  UFDouble norigtaxmny = CalculatorUtil.multiply(nqtorigtaxprice, num);
+	  String curr = corigcurrencyid;//币种
+	  norigtaxmny = scale.adjustMnyScale(norigtaxmny, curr);
+	  return norigtaxmny;
+  }
+  
+  /**
+   * 重算无税金额
+   * @param pk_group 集团主键
+   * @param nqtorigtaxprices 含税单价
+   * @param ntaxrate 税率
+   * @param nassistnum 辅数量
+   * @param corigcurrencyid 币种主键
+   * @return
+   */
+  public UFDouble bodydisposenorigmny(String pk_group,UFDouble nqtorigtaxprices,UFDouble ntaxrate,UFDouble nassistnum,String corigcurrencyid){
+	  UFDouble value = null;
+	  ScaleUtils scale = new ScaleUtils(pk_group);
+	  UFDouble norigtaxmny = bodydisposenorigtaxmny(pk_group, nqtorigtaxprices, nassistnum, corigcurrencyid);//价税合计
+	  value = ntaxrate;//税率
+	  value = CalculatorUtil.div(value, new UFDouble(100.0));
+	  UFDouble d = UFDouble.ONE_DBL;
+	  d = CalculatorUtil.add(d, value);
+	  value = CalculatorUtil.div(norigtaxmny, d);
+	  String curr = corigcurrencyid;//币种
+	  value = scale.adjustMnyScale(value, curr);
+	  return value;
+  }
+  
+  /**
+   * 处理采购入库物料版本不一致
+   * @param pk_material 物料主键
+   * @return
+   */
+  public Object disposeMaterialVersions(String pk_material){
+	  StringBuffer sb = new StringBuffer();
+	  sb.append("select pk_material from bd_material where latest = 'Y' and code in (select code from bd_material where pk_material = '"+pk_material+"')");
+	  return obtaindb(sb.toString());
+  }
+  
+  /**
+   * 处理采购入库物料版本不一致
+   * @param pk_material 物料主键
+   * @return
+   */
+  public Object disposeMaterialVersions2(String pk_material){
+	  StringBuffer sb = new StringBuffer();
+	  sb.append("select pk_source from bd_material where latest = 'Y' and code in (select code from bd_material where pk_material = '"+pk_material+"')");
+	  return obtaindb(sb.toString());
+  }
+  
+  /**
+   * 处理货位翻译问题
+   * @param pk_stordoc 仓库主键
+   * @param pk_org	组织主键
+   * @param pk_rack	货位主键
+   * @return
+   */
+  public Object bodytranslaterack(String pk_stordoc,String pk_org,String pk_rack)throws BusinessException{
+	  StringBuffer sb = new StringBuffer();
+	  sb.append("select pk_rack from bd_rack where pk_stordoc = '"+pk_stordoc+"' and pk_org = '"+pk_org+"' and code in (select code from bd_rack where  pk_rack = '"+pk_rack+"' and pk_org = '"+pk_org+"')");
+	  return obtaindb(sb.toString());
+  }
+  
+  /**
+   * 获取生产订单PK
+   * @param vbillcode 订单号
+   * @return
+   */
+  public Object setCbmoid(String vbillcode){
+  	StringBuffer sb = new StringBuffer();
+    	sb.append(" select cpmohid from mm_pmo where vbillcode = '"+vbillcode+"'");
+  	sb.append(" and nvl(dr,0) = 0");
+  	return this.obtaindb(sb.toString());
+  }
+  
+  /**
+   * 获取生产订单行PK
+   * @param vbillcode 订单号
+   * @return
+   */
+  public Object setCbmobid(String vbillcode){
+  	StringBuffer sb = new StringBuffer();
+    	sb.append(" select cmoid from mm_mo where cpmohid ");
+    	sb.append(" in (select cpmohid from mm_pmo where vbillcode = '"+vbillcode+"' and nvl(dr,0) = 0) ");
+  	sb.append(" and nvl(dr,0) = 0");
+  	return this.obtaindb(sb.toString());
+  }
+  
+  /*
+  * 获取备料计划表头主键
+  * @param vbillcode 订单号
+  * @return
+  */
+ public Object setMm_pickmPK(String vbillcode){
+ 	StringBuffer sb = new StringBuffer();
+   	sb.append(" select cpickmid from mm_pickm ");
+   	sb.append(" where vfirstmoid in (select cpmohid from mm_pmo where vbillcode = '"+vbillcode+"' and nvl(dr,0) = 0)");
+ 	sb.append(" and nvl(dr,0) = 0");
+ 	return this.obtaindb(sb.toString());
+ }
+ 
+ /*
+  * 获取备料计划单号
+  * @param vbillcode 订单号
+  * @return
+  */
+ public Object setPickmvbillcode(String vbillcode){
+ 	StringBuffer sb = new StringBuffer();
+   	sb.append(" select vbillcode from mm_pickm ");
+   	sb.append(" where vfirstmoid in (select cpmohid from mm_pmo where vbillcode = '"+vbillcode+"' and nvl(dr,0) = 0)");
+ 	sb.append(" and nvl(dr,0) = 0");
+ 	return this.obtaindb(sb.toString());
+ }
+ 
+ /*
+  * 获取备料计划交易类型编码
+  * @param vbillcode 订单号
+  * @return
+  */
+ public Object setPickmvbusitype(String vbillcode){
+ 	StringBuffer sb = new StringBuffer();
+   	sb.append(" select vbusitypeid from mm_pickm ");
+   	sb.append(" where vfirstmoid in (select cpmohid from mm_pmo where vbillcode = '"+vbillcode+"' and nvl(dr,0) = 0)");
+ 	sb.append(" and nvl(dr,0) = 0");
+ 	return this.obtaindb(sb.toString());
+ }
+  
+ /*
+  * 获取备料计划表体主键
+  * @param vbillcode 订单号
+  * @return
+  */
+ public Object setPickm_bPK(String vbillcode){
+ 	StringBuffer sb = new StringBuffer();
+   	sb.append(" select cpickm_bid from mm_pickm_b where");
+   	sb.append(" cpickmid in (select cpickmid from mm_pickm where ");
+   	sb.append(" vfirstmoid in (select cpmohid from mm_pmo where vbillcode = '"+vbillcode+"' and nvl(dr,0) = 0)) ");
+ 	sb.append(" and nvl(dr,0) = 0");
+ 	return this.obtaindb(sb.toString());
+ }
+ 
+ /*
+  * 获取备料计划表体行号
+  * @param vbillcode 订单号
+  * @return
+  */
+ public Object setPickm_bvrowno(String vbillcode){
+ 	StringBuffer sb = new StringBuffer();
+   	sb.append(" select vrowno from mm_pickm_b where");
+   	sb.append(" cpickmid in (select cpickmid from mm_pickm where ");
+   	sb.append(" vfirstmoid in (select cpmohid from mm_pmo where vbillcode = '"+vbillcode+"' and nvl(dr,0) = 0)) ");
+ 	sb.append(" and nvl(dr,0) = 0");
+ 	return this.obtaindb(sb.toString());
+ }
+ 
+ /*
+  * 获取生产报告表头主键
+  * @param vbillcode 订单号
+  * @return
+  */
+ public Object setMm_wrPK(String vbillcode){
+ 	StringBuffer sb = new StringBuffer();
+   	sb.append(" select pk_wr from mm_wr where vbillcode = '"+vbillcode+"' and nvl(dr,0) = 0");
+ 	return this.obtaindb(sb.toString());
+ }
+ 
+ /*
+  * 获取生产报告表体主键
+  * @param vbillcode 订单号
+  * @return
+  */
+ public Object setMm_wr_productPK(String vbillcode){
+ 	StringBuffer sb = new StringBuffer();
+   	sb.append(" select pk_wr_product from mm_wr_product");
+   	sb.append(" where pk_wr in (select pk_wr from mm_wr where vbillcode = '"+vbillcode+"' and nvl(dr,0) = 0)");
+ 	return this.obtaindb(sb.toString());
+ }
+ 
+  
+}

+ 1 - 0
ic/ic/src/test/test.gitkeep

@@ -0,0 +1 @@
+ユシホサキ�

+ 21 - 0
ic/manifest.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Manifest>
+  <BusinessComponet name="ic" dispname="ic">
+    <public>
+      <src name="src/public"/>
+    </public>
+    <client>
+      <src name="src/client"/>
+    </client>
+    <private>
+      <src name="src/private"/>
+    </private>
+    <test>
+      <src name="src/test"/>
+    </test>
+    <resource>
+      <src name="resources"/>
+    </resource>
+    <funnodes/>
+  </BusinessComponet>
+</Manifest>