Browse Source

代码初始化

yaoyu 2 years ago
commit
9da091b344
70 changed files with 3195 additions and 0 deletions
  1. 52 0
      xh/.classpath
  2. 29 0
      xh/.project
  3. 7 0
      xh/META-INF/module.xml
  4. 11 0
      xh/META-INF/xhopenapi.upm
  5. 1 0
      xh/bin/.gitignore
  6. 23 0
      xh/bin/.project
  7. 7 0
      xh/bin/META-INF/module.xml
  8. 1 0
      xh/hrhi/classes/.gitignore
  9. BIN
      xh/hrhi/classes/nc/impl/hi/psndoc/PsndocUAPToHRServiceImpl.class
  10. 3 0
      xh/hrhi/component.xml
  11. 1 0
      xh/hrhi/resources/xhpublic.gitkeep
  12. 1 0
      xh/hrhi/src/client/xhpublic.gitkeep
  13. 1178 0
      xh/hrhi/src/private/nc/impl/hi/psndoc/PsndocUAPToHRServiceImpl.java
  14. 1 0
      xh/hrhi/src/public/xhpublic.gitkeep
  15. 1 0
      xh/hrhi/src/test/xhpublic.gitkeep
  16. 3 0
      xh/ic/classes/.gitignore
  17. 3 0
      xh/ic/component.xml
  18. 1 0
      xh/ic/resources/xhpublic.gitkeep
  19. 1 0
      xh/ic/src/client/xhpublic.gitkeep
  20. 412 0
      xh/ic/src/private/nc/bs/ic/general/plugins/GeneralDefdocPlugin.java
  21. 1 0
      xh/ic/src/public/xhpublic.gitkeep
  22. 1 0
      xh/ic/src/test/xhpublic.gitkeep
  23. 1 0
      xh/sc/classes/.gitignore
  24. BIN
      xh/sc/classes/nc/bs/sc/pfxx/plugin/SCorderPfxxPlugin.class
  25. 3 0
      xh/sc/component.xml
  26. 1 0
      xh/sc/resources/xhpublic.gitkeep
  27. 1 0
      xh/sc/src/client/xhpublic.gitkeep
  28. 97 0
      xh/sc/src/private/nc/bs/sc/pfxx/plugin/SCorderPfxxPlugin.java
  29. 1 0
      xh/sc/src/public/xhpublic.gitkeep
  30. 1 0
      xh/sc/src/test/xhpublic.gitkeep
  31. 2 0
      xh/so/classes/.gitignore
  32. 3 0
      xh/so/component.xml
  33. 1 0
      xh/so/resources/xhpublic.gitkeep
  34. 1 0
      xh/so/src/client/xhpublic.gitkeep
  35. 62 0
      xh/so/src/private/nc/pubimpl/so/m30/pfxx/M30PfxxPlugin.java
  36. 1 0
      xh/so/src/public/xhpublic.gitkeep
  37. 1 0
      xh/so/src/test/xhpublic.gitkeep
  38. 1 0
      xh/uapbd/classes/.gitignore
  39. BIN
      xh/uapbd/classes/nc/bs/bd/pfxx/plugin/PsndocPfxxPlugin.class
  40. 3 0
      xh/uapbd/component.xml
  41. 1 0
      xh/uapbd/resources/xhpublic.gitkeep
  42. 1 0
      xh/uapbd/src/client/xhpublic.gitkeep
  43. 108 0
      xh/uapbd/src/private/nc/bs/bd/pfxx/plugin/PsndocPfxxPlugin.java
  44. 1 0
      xh/uapbd/src/public/xhpublic.gitkeep
  45. 1 0
      xh/uapbd/src/test/xhpublic.gitkeep
  46. BIN
      xh/xh/classes/nc/bs/servlet/service/BaseServlet.class
  47. BIN
      xh/xh/classes/nc/bs/xh/impl/TransformAddImpl.class
  48. BIN
      xh/xh/classes/nc/bs/xh/servlet/XhDeleteApiServlet.class
  49. BIN
      xh/xh/classes/nc/impl/xh/api/DeltBusnesDcmentsImpl.class
  50. BIN
      xh/xh/classes/nc/impl/xh/report/inoutledger/InFactorDelegator.class
  51. 26 0
      xh/xh/classes/nc/impl/xh/report/inoutledger/attributereference.txt
  52. BIN
      xh/xh/classes/nc/log/NcLog.class
  53. BIN
      xh/xh/classes/xh/test/DemoGit.class
  54. 1 0
      xh/xh/classes/xhcl.gitkeep
  55. 1 0
      xh/xh/classes/xhpublic.gitkeep
  56. 1 0
      xh/xh/classes/xhre.gitkeep
  57. 1 0
      xh/xh/classes/xhtest.gitkeep
  58. 3 0
      xh/xh/component.xml
  59. 1 0
      xh/xh/resources/xhre.gitkeep
  60. 1 0
      xh/xh/src/client/xhcl.gitkeep
  61. 85 0
      xh/xh/src/private/nc/bs/servlet/service/BaseServlet.java
  62. 227 0
      xh/xh/src/private/nc/bs/xh/impl/TransformAddImpl.java
  63. 62 0
      xh/xh/src/private/nc/bs/xh/servlet/XhDeleteApiServlet.java
  64. 571 0
      xh/xh/src/private/nc/impl/xh/api/DeltBusnesDcmentsImpl.java
  65. 66 0
      xh/xh/src/private/nc/impl/xh/report/inoutledger/InFactorDelegator.java
  66. 26 0
      xh/xh/src/private/nc/impl/xh/report/inoutledger/attributereference.txt
  67. 81 0
      xh/xh/src/private/nc/log/NcLog.java
  68. 1 0
      xh/xh/src/public/xhpublic.gitkeep
  69. 10 0
      xh/xh/src/test/xh/test/DemoGit.java
  70. 1 0
      xh/xh/src/test/xhtest.gitkeep

+ 52 - 0
xh/.classpath

@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="so/classes" path="so/src/public"/>
+	<classpathentry kind="src" output="so/classes" path="so/src/client"/>
+	<classpathentry kind="src" output="so/classes" path="so/src/private"/>
+	<classpathentry kind="src" output="so/classes" path="so/src/test"/>
+	<classpathentry kind="src" output="so/classes" path="so/resources"/>
+	<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="src" output="hrhi/classes" path="hrhi/src/public"/>
+	<classpathentry kind="src" output="hrhi/classes" path="hrhi/src/client"/>
+	<classpathentry kind="src" output="hrhi/classes" path="hrhi/src/private"/>
+	<classpathentry kind="src" output="hrhi/classes" path="hrhi/src/test"/>
+	<classpathentry kind="src" output="hrhi/classes" path="hrhi/resources"/>
+	<classpathentry kind="src" output="uapbd/classes" path="uapbd/src/public"/>
+	<classpathentry kind="src" output="uapbd/classes" path="uapbd/src/client"/>
+	<classpathentry kind="src" output="uapbd/classes" path="uapbd/src/private"/>
+	<classpathentry kind="src" output="uapbd/classes" path="uapbd/src/test"/>
+	<classpathentry kind="src" output="uapbd/classes" path="uapbd/resources"/>
+	<classpathentry kind="src" output="sc/classes" path="sc/src/public"/>
+	<classpathentry kind="src" output="sc/classes" path="sc/src/client"/>
+	<classpathentry kind="src" output="sc/classes" path="sc/src/private"/>
+	<classpathentry kind="src" output="sc/classes" path="sc/src/test"/>
+	<classpathentry kind="src" output="sc/classes" path="sc/resources"/>
+	<classpathentry kind="src" output="xh/classes" path="xh/src/public"/>
+	<classpathentry kind="src" output="xh/classes" path="xh/src/client"/>
+	<classpathentry kind="src" output="xh/classes" path="xh/src/private"/>
+	<classpathentry kind="src" output="xh/classes" path="xh/src/test"/>
+	<classpathentry kind="src" output="xh/classes" path="xh/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">
+		<accessrules>
+			<accessrule kind="accessible" pattern="**"/>
+		</accessrules>
+	</classpathentry>
+	<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>

+ 29 - 0
xh/.project

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>xh</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>
+		<buildCommand>
+			<name>com.yonyou.ria.g2.riabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>com.yonyou.studio.udt.core.nature</nature>
+		<nature>com.yonyou.ria.g2.rianature</nature>
+	</natures>
+</projectDescription>

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

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

+ 11 - 0
xh/META-INF/xhopenapi.upm

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

+ 1 - 0
xh/bin/.gitignore

@@ -0,0 +1 @@
+/bin/

+ 23 - 0
xh/bin/.project

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>xh</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
xh/bin/META-INF/module.xml

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

+ 1 - 0
xh/hrhi/classes/.gitignore

@@ -0,0 +1 @@
+/xhpublic.gitkeep

BIN
xh/hrhi/classes/nc/impl/hi/psndoc/PsndocUAPToHRServiceImpl.class


+ 3 - 0
xh/hrhi/component.xml

@@ -0,0 +1,3 @@
+<component name="hrhi" displayname="hrhi">
+  <dependencies/>
+</component>

+ 1 - 0
xh/hrhi/resources/xhpublic.gitkeep

@@ -0,0 +1 @@
+梩弇睫

+ 1 - 0
xh/hrhi/src/client/xhpublic.gitkeep

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

+ 1178 - 0
xh/hrhi/src/private/nc/impl/hi/psndoc/PsndocUAPToHRServiceImpl.java

@@ -0,0 +1,1178 @@
+package nc.impl.hi.psndoc;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import nc.bs.dao.BaseDAO;
+import nc.bs.dao.DAOException;
+import nc.bs.framework.common.InvocationInfoProxy;
+import nc.bs.framework.common.NCLocator;
+import nc.bs.framework.core.util.ObjectCreator;
+import nc.hr.frame.persistence.SimpleDocServiceTemplate;
+import nc.hr.utils.InSQLCreator;
+import nc.hr.utils.PubEnv;
+import nc.hr.utils.ResHelper;
+import nc.itf.bd.psn.psndoc.IPsndocService;
+import nc.itf.hi.IPersonRecordService;
+import nc.itf.hr.frame.IPersistenceRetrieve;
+import nc.itf.om.IAOSQueryService;
+import nc.md.persist.framework.MDPersistenceService;
+import nc.pub.tools.HiSQLHelper;
+import nc.pub.tools.VOUtils;
+import nc.vo.bd.psn.PsndocExtend;
+import nc.vo.bd.psn.PsndocVO;
+import nc.vo.bd.psn.PsnjobVO;
+import nc.vo.hi.psndoc.CertVO;
+import nc.vo.hi.psndoc.PartTimeVO;
+import nc.vo.hi.psndoc.PsnChgVO;
+import nc.vo.hi.psndoc.PsnJobVO;
+import nc.vo.hi.psndoc.PsnOrgVO;
+import nc.vo.hi.psndoc.PsndocAggVO;
+import nc.vo.hi.pub.HICommonValue;
+import nc.vo.hi.pub.HiEventValueObject;
+import nc.vo.hi.pub.IHiEventType;
+import nc.vo.hr.infoset.DefineMap;
+import nc.vo.hrcm.make.ConttypeStateVO;
+import nc.vo.om.pub.SuperVOHelper;
+import nc.vo.org.JobVO;
+import nc.vo.org.OrgVO;
+import nc.vo.org.PostVO;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.VOStatus;
+import nc.vo.pub.lang.UFBoolean;
+import nc.vo.pub.lang.UFLiteralDate;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * 分组织启用HR,双向同步,HR实现类
+ * 
+ * @author fengwei
+ */
+public class PsndocUAPToHRServiceImpl implements IPsndocService
+{
+    
+    /**
+     * UAP开发模块号
+     */
+    public static final String uapMoudle = "baseapp";
+    
+    /**
+     * UAP实现类
+     */
+    public static final String uapImplClass = "nc.impl.bd.psn.psndoc.PsndocServiceImpl";
+    
+    private SimpleDocServiceTemplate serviceTemplate;
+    
+    private BaseDAO baseDAO;
+    
+    @Override
+    public PsndocVO insertPsndoc(PsndocVO vo, boolean isCheckRepeat) throws BusinessException
+    {
+        IPsndocService service = (IPsndocService) ObjectCreator.newInstance(uapMoudle, uapImplClass);
+        if (!PubEnv.isModuleStarted(null, PubEnv.MODULE_HRHI))
+        {
+            return service.insertPsndoc(vo, isCheckRepeat);
+        }
+        nc.vo.hi.psndoc.PsndocVO doc = nc.vo.om.aos.SuperVOHelper.createSuperVOFromSuperVO(vo, nc.vo.hi.psndoc.PsndocVO.class);
+        PsndocAggVO agg = NCLocator.getInstance().lookup(nc.itf.hi.IPsndocService.class).checkPsnUnique(doc, false);
+        if (agg != null && !agg.getParentVO().getIsuapmanage().booleanValue() && agg.getParentVO().getPsnOrgVO() != null
+            && agg.getParentVO().getPsnOrgVO().getEndflag() != null && !agg.getParentVO().getPsnOrgVO().getEndflag().booleanValue())
+        {
+            throw new BusinessException(ResHelper.getString("6007psn", "06007psn0479")/* "当前人员是HR系统管理的在职人员,不能再非HR管理的行政组织入职。" */);
+        }
+        
+        // 首先调用UAP实现方法
+        PsndocVO uapPsnVO = service.insertPsndoc(vo, isCheckRepeat);
+        
+        // 根据uap人员信息同步hr人员信息
+        if (uapPsnVO.getDataoriginflag() != null && (uapPsnVO.getDataoriginflag() == 1 || uapPsnVO.getDataoriginflag() == 2))
+        {
+            // 如果是上级下发或下级上传的不处理
+            return uapPsnVO;
+        }
+        
+        // HR同步UAP新增人员
+        doInsertHRPsndoc(uapPsnVO, true, 1);
+        
+        return MDPersistenceService.lookupPersistenceQueryService().queryBillOfVOByPK(PsndocVO.class, uapPsnVO.getPk_psndoc(), false);
+    }
+    
+    /**
+     * HR同步UAP新增人员</p>
+     * <ol>
+     * <li>同步基本信息自定义项</li>
+     * <li>同步证件子集</li>
+     * <li>同步生成新的组织关系</li>
+     * <li>将UAP的工作信息同步到HR的工作信息表</li>
+     * <li>同步流动情况
+     * </ol>
+     * 
+     * @param uapPsnVO
+     * @throws BusinessException
+     */
+    private void doInsertHRPsndoc(PsndocVO uapPsnVO, boolean isSyncCert, int orgrelaid) throws BusinessException
+    {
+        PsnjobVO[] uapJobVO = uapPsnVO.getPsnjobs();
+        // 如果没有工作记录,直接返回
+        if (uapJobVO == null || uapJobVO.length == 0)
+        {
+            return;
+        }
+        
+        // 1.同步基本信息自定义项
+        syncDefineAtrrs(uapPsnVO);
+        
+        if (isSyncCert)
+        {
+            // 2.同步证件子集
+            syncCertVO(uapPsnVO);
+        }
+        
+        // 3.同步生成新的组织关系
+        // String pk_psnorg = SyncCreateOrg(uapJobVO, orgrelaid);
+        PsnOrgVO orgVO = SyncCreateOrg(uapJobVO, orgrelaid);
+        
+        // 4.将UAP的工作信息同步到HR的工作信息表
+        List<PsnJobVO> jobList = syncHRPsnjobs(orgVO, uapJobVO);
+        
+        PsnJobVO mainJobVO = null;
+        // 5.同步流动情况
+        for (PsnJobVO psnJobVO : jobList)
+        {
+            if (psnJobVO.getIsmainjob() == null || !psnJobVO.getIsmainjob().booleanValue())
+            {
+                continue;
+            }
+            mainJobVO = psnJobVO;
+            NCLocator.getInstance().lookup(IPersonRecordService.class).addPsnChgWhenIntoDoc(psnJobVO);
+            break;
+        }
+        
+        // 6.同步生成一条合同状态记录
+        if (PubEnv.isModuleStarted(PubEnv.getPk_group(), PubEnv.MODULE_HRCM))
+        {
+            
+            ConttypeStateVO stateVO = new ConttypeStateVO();
+            stateVO.setAssgid(mainJobVO.getAssgid());
+            stateVO.setContstate(1/* HRCMCommonValue.contstate_nomake */);
+            stateVO.setConttype("hi_psndoc_ctrt");
+            stateVO.setPk_psndoc(uapPsnVO.getPk_psndoc());
+            stateVO.setPk_psnorg(orgVO.getPk_psnorg());
+            getServiceTemplate().insert(stateVO);
+        }
+        
+    }
+    
+    @Override
+    public PsndocVO updatePsndoc(PsndocVO vo, boolean isCheckRepeat) throws BusinessException
+    {
+        IPsndocService service = (IPsndocService) ObjectCreator.newInstance(uapMoudle, uapImplClass);
+        if (!PubEnv.isModuleStarted(null, PubEnv.MODULE_HRHI))
+        {
+            return service.updatePsndoc(vo, isCheckRepeat);
+        }
+        
+        // 调用此方法,可能是uap返聘业务,所以要跟普通的修改保存区分
+        nc.vo.hi.psndoc.PsndocVO doc = nc.vo.om.aos.SuperVOHelper.createSuperVOFromSuperVO(vo, nc.vo.hi.psndoc.PsndocVO.class);
+        //
+        PsndocAggVO agg = NCLocator.getInstance().lookup(nc.itf.hi.IPsndocService.class).checkPsnUnique(doc, false);
+        
+        //对人员状态不作修改     否则会导致UAP停用不了人员   add by jiazhtb 2016.01.27
+        //vo.setEnablestate(IPubEnumConst.ENABLESTATE_ENABLE);   
+        // 首先调用UAP实现方法
+        PsndocVO uapPsnVO = service.updatePsndoc(vo, isCheckRepeat);
+        
+        if (uapPsnVO.getDataoriginflag() != null && (uapPsnVO.getDataoriginflag() == 1 || uapPsnVO.getDataoriginflag() == 2))
+        {
+            // 如果是上级下发或下级上传的不处理
+            return uapPsnVO;
+        }
+       
+        //由于人员离职,可以不停用人员,判断是否再聘,不能通过Enablestate来判断  add by jiazhtb 2015.01.27
+    	if (agg != null && !agg.getParentVO().getIsuapmanage().booleanValue()
+    			&& agg.getParentVO().getPsnOrgVO().getEndflag().booleanValue())
+        {
+            // uap返聘业务
+            doInsertHRPsndocWhenRehire(uapPsnVO, false, agg.getParentVO().getPsnOrgVO().getOrgrelaid() + 1);
+        }
+        else
+        {
+            // HR同步UAP修改人员
+            doUpdateHRPsndoc(uapPsnVO);
+        }
+        return MDPersistenceService.lookupPersistenceQueryService().queryBillOfVOByPK(PsndocVO.class, uapPsnVO.getPk_psndoc(), false);
+        
+    }
+    
+    /**
+     * HR同步UAP修改人员
+     * <ol>
+     * <li>更新HR工作记录</li>
+     * <li>同步基本信息自定义项</li>
+     * <li>更新证件子集</li>
+     * <li>更新组织关系</li>
+     * <li>更新流动情况</li>
+     * <li>所有任职记录的异动时间为入职</li>
+     * <li>将信息同步到HR</li>
+     * </ol>
+     * 
+     * @param uapPsnVO
+     * @throws BusinessException
+     */
+    private void doUpdateHRPsndoc(PsndocVO uapPsnVO) throws BusinessException
+    {
+        // UAP所有工作记录
+        PsnjobVO[] uapJobVOs = uapPsnVO.getPsnjobs();
+        
+        // 当前有效的组织关系
+        String strcondition = PsnOrgVO.PK_PSNDOC + " = '" + uapPsnVO.getPk_psndoc() + "' and " + PsnOrgVO.LASTFLAG + " = 'Y' ";
+        PsnOrgVO[] orgVOs = getServiceTemplate().queryByCondition(PsnOrgVO.class, strcondition);
+        
+        //UAP传递的工作记录中,有无效数据,必须剔除
+        uapJobVOs = deleteInvalidJobVO(uapJobVOs,orgVOs[0]);
+        
+        
+        // 根据人员主键查出HR人员信息
+        PsndocAggVO psnAggVO = getServiceTemplate().queryByPk(PsndocAggVO.class, uapPsnVO.getPk_psndoc());
+        
+        // 更新HR工作记录
+        updateHRJobVO(uapJobVOs, orgVOs, psnAggVO);
+        
+        // 同步基本信息自定义项
+        syncDefineAtrrs(uapPsnVO);
+        
+        // 更新证件子集
+        CertVO[] cert = (CertVO[]) psnAggVO.getTableVO(CertVO.getDefaultTableName());
+        if (cert != null && cert.length > 0)
+        {
+            cert[0].setIdtype(psnAggVO.getParentVO().getIdtype());
+            cert[0].setId(psnAggVO.getParentVO().getId());
+            cert[0].setStatus(VOStatus.UPDATED);
+            
+            getServiceTemplate().update(cert[0], false);
+        }
+        
+        // 更新psnorg,可能psnorg中没有设置hrorg
+        PsnJobVO mainJob = psnAggVO.getParentVO().getPsnJobVO();
+        
+        orgVOs[0].setPk_group(mainJob.getPk_hrgroup());
+        orgVOs[0].setPk_org(mainJob.getPk_org());
+        orgVOs[0].setPk_hrorg(mainJob.getPk_hrorg());
+        orgVOs[0].setBegindate(mainJob.getBegindate());
+        // orgVOs[0].setEndflag(UFBoolean.FALSE);
+        orgVOs[0].setStatus(VOStatus.UPDATED);
+        getServiceTemplate().update(orgVOs[0], false);
+        psnAggVO.getParentVO().setPsnOrgVO(orgVOs[0]);
+        
+        // 用最新工作记录更新流动情况
+        PsnChgVO[] psnchg = (PsnChgVO[]) psnAggVO.getTableVO(PsnChgVO.getDefaultTableName());
+        if (psnchg != null && psnchg.length > 0)
+        {
+            String pk_newcorp = HiSQLHelper.getPkCorpByPkOrg(mainJob.getPk_org());
+            
+            // 公司发生变化
+            psnchg[0].setPk_corp(pk_newcorp);
+            psnchg[0].setBegindate(mainJob.getBegindate());
+            psnchg[0].setStatus(VOStatus.UPDATED);
+            
+            getServiceTemplate().update(psnchg[0], false);
+        }
+        
+        // 所有任职记录的异动时间为入职
+        // SuperVO[] jobs = psnAggVO.getTableVO(PsnJobVO.getDefaultTableName());
+        // for (int i = 0; jobs != null && i < jobs.length; i++) {
+        // jobs[i].setAttributeValue(PsnJobVO.TRNSEVENT, 1);// 入职
+        // }
+        
+        // 将信息同步到HR
+        // NCLocator.getInstance().lookup(nc.itf.hi.IPsndocService.class)
+        // .savePsndoc(psnAggVO, true);
+    }
+    
+    @Override
+    public void deletePsndoc(PsndocVO vo) throws BusinessException
+    {
+        IPsndocService service = (IPsndocService) ObjectCreator.newInstance(uapMoudle, uapImplClass);
+        if (!PubEnv.isModuleStarted(null, PubEnv.MODULE_HRHI))
+        {
+            service.deletePsndoc(vo);
+        }
+        else
+        {
+            String pk_psndoc = vo.getPk_psndoc();
+            // 首先调用UAP实现方法
+            service.deletePsndoc(vo);
+            
+            // HR同步删除人员
+            doDeleteHRPsndoc(pk_psndoc);
+        }
+    }
+    
+    private void doDeleteHRPsndoc(String pk_psndoc) throws BusinessException
+    {
+        String condition = PsnJobVO.PK_PSNDOC + "= '" + pk_psndoc + "'";
+        // 根据人员信息主键,查出HR所有工作记录和组织关系、证件信息
+        PsnJobVO[] jobVOs = getServiceTemplate().queryByCondition(PsnJobVO.class, condition);
+        
+        PsnJobVO mainjob = null;
+        if (jobVOs == null || jobVOs.length == 0)
+        {
+            return;
+        }
+        for (PsnJobVO job : jobVOs)
+        {
+            if (job.getIsmainjob() != null && job.getIsmainjob().booleanValue())
+            {
+                mainjob = job;
+            }
+        }
+        
+        // 删除前事件
+        HiEventValueObject.fireEvent(mainjob, null, mainjob.getPk_hrorg(), HICommonValue.MD_ID_PSNDOC, IHiEventType.DELETE_EMPLOYEE_BEFORE);
+        
+        PsnOrgVO[] orgVOs = getServiceTemplate().queryByCondition(PsnOrgVO.class, condition);
+        CertVO[] certVOs = getServiceTemplate().queryByCondition(CertVO.class, condition);
+        PsnChgVO[] psnchgVOs = getServiceTemplate().queryByCondition(PsnChgVO.class, condition);
+        
+        // 删除所有组织关系
+        MDPersistenceService.lookupPersistenceService().deleteBillFromDB(orgVOs);
+        // 删除所有任职记录
+        MDPersistenceService.lookupPersistenceService().deleteBillFromDB(jobVOs);
+        // 删除所有证件信息
+        MDPersistenceService.lookupPersistenceService().deleteBillFromDB(certVOs);
+        // 删除流动情况信息
+        MDPersistenceService.lookupPersistenceService().deleteBillFromDB(psnchgVOs);
+        
+        // 删除后事件
+        HiEventValueObject.fireEvent(mainjob, null, mainjob.getPk_hrorg(), HICommonValue.MD_ID_PSNDOC, IHiEventType.DELETE_EMPLOYEE_AFTER);
+        HiEventValueObject.fireDataPermChangeEvent(HICommonValue.MD_ID_PSNJOB);
+    }
+    
+    @Override
+    public PsndocVO disEnablePsndoc(PsndocVO vo) throws BusinessException
+    {
+        // 首先调用UAP实现方法
+        IPsndocService service = (IPsndocService) ObjectCreator.newInstance(uapMoudle, uapImplClass);
+        PsndocVO returnVO = service.disEnablePsndoc(vo);
+        return returnVO;
+    }
+    
+    @Override
+    public PsndocVO enablePsndoc(PsndocVO vo) throws BusinessException
+    {
+        // 首先调用UAP实现方法
+        IPsndocService service = (IPsndocService) ObjectCreator.newInstance(uapMoudle, uapImplClass);
+        PsndocVO returnVO = service.enablePsndoc(vo);
+        return returnVO;
+    }
+    
+    // public PsndocVO transferPsndoc(PsndocVO vo, boolean keepSrcJob) throws BusinessException
+    public PsndocVO transferPsndoc(PsndocVO vo) throws BusinessException
+    {
+        IPsndocService service = (IPsndocService) ObjectCreator.newInstance(uapMoudle, uapImplClass);
+        if (!PubEnv.isModuleStarted(null, PubEnv.MODULE_HRHI))
+        {
+            // return service.transferPsndoc(vo, keepSrcJob);
+            return service.transferPsndoc(vo);
+        }
+        
+        // 首先调用UAP实现方法
+        // PsndocVO uapPsnVO = service.transferPsndoc(vo, keepSrcJob);
+        PsndocVO uapPsnVO = service.transferPsndoc(vo);
+        
+        if (uapPsnVO.getDataoriginflag() != null && (uapPsnVO.getDataoriginflag() == 1 || uapPsnVO.getDataoriginflag() == 2))
+        {
+            // 如果是上级下发或下级上传的不处理
+            return uapPsnVO;
+        }
+        
+        // HR同步UAP调动人员
+        // 逻辑与更新相同
+        doUpdateHRPsndoc(uapPsnVO);
+        
+        return uapPsnVO;
+    }
+    
+    @Override
+    public PsndocVO deletePsnJob(PsndocVO vo, String pk_org) throws BusinessException
+    {
+        // 首先调用UAP实现方法
+        IPsndocService service = (IPsndocService) ObjectCreator.newInstance(uapMoudle, uapImplClass);
+        PsndocVO returnVO = service.deletePsnJob(vo, pk_org);
+        return returnVO;
+    }
+    
+    /**
+     * 更新HR工作记录,主职和兼职都不保留历史记录。
+     * <ol>
+     * <li>删除原HR所有任职记录(包括主职和兼职)</li>
+     * <li>同步工作信息到HR任职记录</li>
+     * <li>处理工作记录中的一些信息,将主职和兼职分别放入到psnAggVO中</li>
+     * </ol>
+     * 
+     * @param uapJobVOs
+     * @param orgVOs
+     * @param psnAggVO
+     * @return
+     * @throws DAOException
+     * @throws BusinessException
+     */
+    private PsndocAggVO updateHRJobVO(PsnjobVO[] uapJobVOs, PsnOrgVO[] orgVOs, PsndocAggVO psnAggVO) throws DAOException, BusinessException
+    {
+        // 删除UAP同步生成组织关系的所有HR任职记录(包括主职和兼职)
+        List<PsnJobVO> delMainJobVOList = new ArrayList<PsnJobVO>();
+        PsnJobVO[] oldMainJobVOs = (PsnJobVO[]) psnAggVO.getTableVO(PsnJobVO.getDefaultTableName());// 主职
+        
+        if (!ArrayUtils.isEmpty(oldMainJobVOs))
+        {
+            for (int i = 0; i < oldMainJobVOs.length; i++)
+            {
+                if (oldMainJobVOs[i].getPk_psnorg().equals(orgVOs[0].getPk_psnorg()))
+                {
+                    delMainJobVOList.add(oldMainJobVOs[i]);
+                }
+            }
+            if (!delMainJobVOList.isEmpty())
+            {
+                getBaseDAO().deleteVOArray(delMainJobVOList.toArray(new PsnJobVO[0]));
+            }
+        }
+        
+        List<PartTimeVO> delPartJobVOList = new ArrayList<PartTimeVO>();
+        PartTimeVO[] oldParttimeVOs = (PartTimeVO[]) psnAggVO.getTableVO(PartTimeVO.getDefaultTableName());// 兼职
+        if (!ArrayUtils.isEmpty(oldParttimeVOs))
+        {
+            for (int i = 0; i < oldParttimeVOs.length; i++)
+            {
+                if (oldParttimeVOs[i].getPk_psnorg().equals(orgVOs[0].getPk_psnorg()))
+                {
+                    delPartJobVOList.add(oldParttimeVOs[i]);
+                }
+            }
+            if (!delPartJobVOList.isEmpty())
+            {
+                getBaseDAO().deleteVOArray(delPartJobVOList.toArray(new PsnJobVO[0]));
+            }
+        }
+        // 同步工作信息到HR任职记录
+        // List<PsnJobVO> jobList = syncHRPsnjobs(orgVOs[0].getPk_psnorg(), uapJobVOs);
+        List<PsnJobVO> jobList = syncHRPsnjobs(orgVOs[0], uapJobVOs);
+        
+        // 处理工作记录中的一些信息,将主职和兼职分别放入到psnAggVO中
+        List<PsnJobVO> mainJobList = new ArrayList<PsnJobVO>();
+        List<PsnJobVO> parttimeList = new ArrayList<PsnJobVO>();
+        PsnJobVO mainJob = new PsnJobVO();
+        for (PsnJobVO psnJobVO : jobList)
+        {
+            if (psnJobVO.getIsmainjob().booleanValue())
+            {// 主职
+                mainJob = psnJobVO;
+                mainJobList.add(psnJobVO);
+            }
+            else
+            {// 兼职
+                parttimeList.add(psnJobVO);
+            }
+        }
+        
+        psnAggVO.setTableVO(PsnJobVO.getDefaultTableName(), mainJobList.toArray(new PsnJobVO[0]));
+        PartTimeVO[] partTimeVOs = SuperVOHelper.createSuperVOsFromSuperVOs(parttimeList.toArray(new PsnJobVO[0]), PartTimeVO.class);
+        psnAggVO.setTableVO(PartTimeVO.getDefaultTableName(), partTimeVOs);
+        
+        psnAggVO.getParentVO().setPsnJobVO(mainJob);
+        
+        return psnAggVO;
+    }
+    
+    /**
+     * 根据任职记录生成新的HR工作记录,并插入数据库
+     * 
+     * @param pk_psnorg 新生成的组织关系主键
+     * @param uapJobVOs UAP任职记录
+     * 
+     * @return
+     * @throws BusinessException
+     */
+    // private List<PsnJobVO> syncHRPsnjobs(String pk_psnorg, PsnjobVO[] uapJobVOs) throws BusinessException
+    private List<PsnJobVO> syncHRPsnjobs(PsnOrgVO orgVO, PsnjobVO[] uapJobVOs) throws BusinessException
+    {
+        String pk_psnorg = orgVO.getPk_psnorg();
+        
+        // 同步工作信息自定义项
+        PsnJobVO[] psnJobVOs = syncJobDefine(uapJobVOs);
+        // 生成HR任职记录
+        List<PsnJobVO> jobList = new ArrayList<PsnJobVO>();
+        int assgid = 2;
+        
+        /**
+         * add by yanglt 2015-05-26 处理UAP传递给HR的人员工作记录数据,进行数据处理:
+         * 如果只有1条数据,判断是否有结束日期,有则再生成一条新的离职记录数据(开始日期为结束日期加1,异动事件为离职,原有的数据异动事件为入职),
+         * 如果有多条数据,选取开始日期最早的一条的异动事件定义为入职,其余数据的异动事件均为调配,找出开始日期最大的数据(针对这条数据进行同上处理)
+         * 
+         * */
+        List<Object> list = handleHRPsnjobs(psnJobVOs);
+        List<UFLiteralDate> listdates = (List<UFLiteralDate>) list.get(0);
+        PsnJobVO Maxpsnjobvo = (PsnJobVO) list.get(1);
+        PsnJobVO Minpsnjobvo = (PsnJobVO) list.get(2);
+        // 处理需要生成的离职数据
+        if (Maxpsnjobvo.getEnddate() != null)
+        {
+            PsnJobVO newpsnjobvo = (PsnJobVO) Maxpsnjobvo.clone();
+            PsnJobVO psnjobquitvo = getQuitData(newpsnjobvo, assgid, pk_psnorg);
+            jobList.add(psnjobquitvo);
+            
+            orgVO.setEndflag(UFBoolean.TRUE);
+            orgVO.setEnddate(Maxpsnjobvo.getEnddate());
+        }
+        
+        for (PsnJobVO psnJobVO : psnJobVOs)
+        {
+            if (psnJobVO.getBegindate() == null)
+            {
+                throw new BusinessException(ResHelper.getString("6007psn", "06007psn0300")/*
+                                                                                           * @res
+                                                                                           * "人员任职记录的到职日期为空"
+                                                                                           */);
+            }
+            if (psnJobVO.getIsmainjob().booleanValue())
+            {
+                psnJobVO.setAssgid(Integer.valueOf(1));
+            }
+            else
+            {
+                psnJobVO.setAssgid(assgid);
+                assgid++;
+            }
+            
+            if (psnJobVO.getPk_job() != null)
+            {
+                psnJobVO.setSeries(getPKJobType(psnJobVO.getPk_job()));
+            }
+            
+            if (psnJobVO.getPk_post() != null)
+            {
+                psnJobVO.setPk_postseries(getPKPostSeries(psnJobVO.getPk_post()));
+            }
+            
+            psnJobVO.setPk_hrgroup(psnJobVO.getPk_group());
+            // pk_hrorg永远是最新的
+            psnJobVO.setPk_hrorg(getPkHrorg(psnJobVO.getPk_org()));
+            psnJobVO.setPk_psnorg(pk_psnorg);
+            psnJobVO.setPsntype(0);
+            List<PsnJobVO> mainjobs = new ArrayList<PsnJobVO>();
+            for (int i = 0; i < psnJobVOs.length; i++)
+            {
+                PsnJobVO job = psnJobVOs[i];
+                if (job.getIsmainjob().booleanValue())
+                {
+                    mainjobs.add(job);
+                }
+                
+            }
+            
+            if (psnJobVO.getIsmainjob().booleanValue())
+            {// 这里只处理主职,兼职不处理
+                if (mainjobs.size() == 1)
+                {// 只有一条数据时
+                    psnJobVO.setLastflag(Maxpsnjobvo.getEnddate() == null ? UFBoolean.TRUE : UFBoolean.FALSE);
+                    psnJobVO.setEndflag(Maxpsnjobvo.getEnddate() == null ? UFBoolean.FALSE : UFBoolean.TRUE);
+                    psnJobVO.setRecordnum(Maxpsnjobvo.getEnddate() == null ? Integer.valueOf(listdates.size() - 1) : Integer
+                        .valueOf(listdates.size()));
+                    psnJobVO.setPoststat(Maxpsnjobvo.getEnddate() == null ? UFBoolean.TRUE : UFBoolean.FALSE);
+                    psnJobVO.setTrnsevent(1);// 入职
+                }
+                else
+                {// 多条数据
+                    if (psnJobVO.getBegindate().equals(Minpsnjobvo.getBegindate()))
+                    {// 最早的一条数据
+                        psnJobVO.setLastflag(UFBoolean.FALSE);
+                        psnJobVO.setEndflag(Minpsnjobvo.getEnddate() == null ? UFBoolean.FALSE : UFBoolean.TRUE);
+                        psnJobVO.setRecordnum(Maxpsnjobvo.getEnddate() == null ? Integer.valueOf(listdates.size() - 1) : Integer
+                            .valueOf(listdates.size()));
+                        psnJobVO.setTrnsevent(1);// 入职
+                        psnJobVO.setPoststat(UFBoolean.FALSE);
+                    }
+                    else if (psnJobVO.getBegindate().equals(Maxpsnjobvo.getBegindate()))
+                    {// 最大的一条数据
+                        psnJobVO.setLastflag(Maxpsnjobvo.getEnddate() == null ? UFBoolean.TRUE : UFBoolean.FALSE);
+                        psnJobVO.setEndflag(Maxpsnjobvo.getEnddate() == null ? UFBoolean.FALSE : UFBoolean.TRUE);
+                        psnJobVO.setRecordnum(Maxpsnjobvo.getEnddate() == null ? Integer.valueOf(0) : Integer.valueOf(1));
+                        psnJobVO.setTrnsevent(3);// 调配
+                        psnJobVO.setPoststat(Maxpsnjobvo.getEnddate() == null ? UFBoolean.TRUE : UFBoolean.FALSE);
+                    }
+                    else
+                    {// 中间的数据
+                        psnJobVO.setLastflag(UFBoolean.FALSE);
+                        psnJobVO.setEndflag(Maxpsnjobvo.getEnddate() == null ? UFBoolean.FALSE : UFBoolean.TRUE);
+                        for (int i = 0; i < listdates.size(); i++)
+                        {
+                            if (psnJobVO.getBegindate().equals(listdates.get(i)))
+                            {
+                                psnJobVO.setRecordnum(Integer.valueOf(listdates.size() - i - 1));
+                            }
+                        }
+                        psnJobVO.setTrnsevent(3);// 调配
+                        psnJobVO.setPoststat(UFBoolean.FALSE);
+                    }
+                }
+            }
+            else
+            {	
+            	//兼职处理
+            	if(psnJobVO.getEnddate()==null){
+            		//如果兼职没有结束日期,则生成一条兼职的离职记录
+                    psnJobVO.setLastflag(UFBoolean.TRUE);
+                    psnJobVO.setEndflag(UFBoolean.FALSE);
+                    psnJobVO.setTrnsevent(1);// 离职
+                    psnJobVO.setPoststat(UFBoolean.TRUE);
+                }else{
+                	psnJobVO.setLastflag(UFBoolean.FALSE);
+                    psnJobVO.setEndflag(UFBoolean.TRUE);
+                    psnJobVO.setTrnsevent(4);// 离职
+                    psnJobVO.setPoststat(UFBoolean.FALSE);
+                }
+            	psnJobVO.setRecordnum(Integer.valueOf(0));
+            }
+            
+            int showorder = psnJobVO.getShoworder() == null ? 9999999 : psnJobVO.getShoworder();
+            psnJobVO.setShoworder(showorder);
+            if (StringUtils.isNotBlank(psnJobVO.getClerkcode()))
+            {
+                psnJobVO.setClerkcode(psnJobVO.getClerkcode().trim());
+            }
+            
+            
+            jobList.add(psnJobVO);
+        }
+        
+        // 如果UAP人员有任职结束日期,则在此就将其组织关系也结束了
+        getServiceTemplate().update(orgVO, false);
+        
+        getBaseDAO().insertVOArrayWithPK(jobList.toArray(new PsnJobVO[jobList.size()]));
+        
+        return jobList;
+    }
+    
+    /**
+     * add by yanglt 2015-05-26 处理UAP传递给HR的人员工作记录数据,进行数据处理:
+     * 如果只有1条数据,判断是否有结束日期,有则再生成一条新的离职记录数据(开始日期为结束日期加1,异动事件为离职,原有的数据异动事件为入职),
+     * 如果有多条数据,选取开始日期最早的一条的异动事件定义为入职,其余数据的异动事件均为调配,找出开始日期最大的数据(针对这条数据进行同上处理)
+     * 
+     * */
+    public List<Object> handleHRPsnjobs(PsnJobVO[] psnJobVOs) throws BusinessException
+    {
+        List<Object> list = new ArrayList<Object>();
+        List<UFLiteralDate> listdates = new ArrayList<UFLiteralDate>();
+        PsnJobVO Maxpsnjobvo = new PsnJobVO();
+        PsnJobVO Minpsnjobvo = new PsnJobVO();
+        
+        for (int i = 0; i < psnJobVOs.length; i++)
+        {
+            if (psnJobVOs[i].getIsmainjob().booleanValue()) 
+            	listdates.add(psnJobVOs[i].getBegindate());
+        }
+        Collections.sort(listdates);
+        
+        for (int j = 0; j < psnJobVOs.length; j++)
+        {
+            if (psnJobVOs[j].getIsmainjob().booleanValue())
+            {
+                if (psnJobVOs[j].getBegindate().equals(listdates.get(0)))
+                {
+                    Minpsnjobvo = psnJobVOs[j];
+                }
+                
+                if (psnJobVOs[j].getBegindate().equals(listdates.get(listdates.size() - 1)))
+                {
+                    Maxpsnjobvo = psnJobVOs[j];
+                }
+            }
+        }
+        list.add(listdates);
+        list.add(Maxpsnjobvo);
+        list.add(Minpsnjobvo);
+        return list;
+    }
+    
+    // 生成离职的数据
+    public PsnJobVO getQuitData(PsnJobVO Maxpsnjobvo, int assgid, String pk_psnorg) throws BusinessException
+    {
+        if (Maxpsnjobvo.getEnddate() != null)
+        {
+            if (Maxpsnjobvo.getBegindate() == null)
+            {
+                throw new BusinessException(ResHelper.getString("6007psn", "06007psn0300")/*
+                                                                                           * @res
+                                                                                           * "人员任职记录的到职日期为空"
+                                                                                           */);
+            }
+            if (Maxpsnjobvo.getIsmainjob().booleanValue())
+            {
+                Maxpsnjobvo.setAssgid(Integer.valueOf(1));
+            }
+            else
+            {
+                Maxpsnjobvo.setAssgid(assgid);
+                assgid++;
+            }
+            
+            if (Maxpsnjobvo.getPk_job() != null)
+            {
+                Maxpsnjobvo.setSeries(getPKJobType(Maxpsnjobvo.getPk_job()));
+            }
+            
+            if (Maxpsnjobvo.getPk_post() != null)
+            {
+                Maxpsnjobvo.setPk_postseries(getPKPostSeries(Maxpsnjobvo.getPk_post()));
+            }
+            
+            Maxpsnjobvo.setBegindate(Maxpsnjobvo.getEnddate().getDateAfter(1));
+            Maxpsnjobvo.setEnddate(null);
+            Maxpsnjobvo.setPk_hrgroup(Maxpsnjobvo.getPk_group());
+            // pk_hrorg永远是最新的
+            Maxpsnjobvo.setPk_hrorg(getPkHrorg(Maxpsnjobvo.getPk_org()));
+            Maxpsnjobvo.setPk_psnorg(pk_psnorg);
+            Maxpsnjobvo.setPsntype(0);
+            Maxpsnjobvo.setLastflag(UFBoolean.TRUE);
+            Maxpsnjobvo.setEndflag(UFBoolean.TRUE);
+            Maxpsnjobvo.setRecordnum(Integer.valueOf(0));
+            Maxpsnjobvo.setTrnsevent(4);// 离职
+            Maxpsnjobvo.setPoststat(UFBoolean.FALSE);
+            Maxpsnjobvo.setPk_psnjob(null);
+            int showorder = Maxpsnjobvo.getShoworder() == null ? 9999999 : Maxpsnjobvo.getShoworder();
+            Maxpsnjobvo.setShoworder(showorder);
+            if (StringUtils.isNotBlank(Maxpsnjobvo.getClerkcode()))
+            {
+                Maxpsnjobvo.setClerkcode(Maxpsnjobvo.getClerkcode().trim());
+            }
+            
+        }
+        return Maxpsnjobvo;
+    }
+    
+    /**
+     * 根据任职记录生成最新的组织关系
+     * 
+     * @param uapJobVOs
+     * @param orgrelaid
+     * @return
+     * @throws BusinessException
+     */
+    private PsnOrgVO SyncCreateOrg(PsnjobVO[] uapJobVOs, int orgrelaid) throws BusinessException
+    {
+        PsnOrgVO orgVO = null;
+        InSQLCreator isc = new InSQLCreator();
+        ArrayList<String> pk_psndoc_List = new ArrayList<String>();
+        
+        for (PsnjobVO psnjobVO : uapJobVOs)
+        {
+            if (psnjobVO.getIsmainjob().booleanValue())
+            {
+                orgVO = SuperVOHelper.createSuperVOFromSuperVO(psnjobVO, PsnOrgVO.class);
+                orgVO.setOrgrelaid(orgrelaid);
+                orgVO.setPsntype(0);
+                orgVO.setBegindate(psnjobVO.getIndutydate());
+                orgVO.setIndocflag(UFBoolean.TRUE);
+                orgVO.setLastflag(UFBoolean.TRUE);
+                orgVO.setEndflag(UFBoolean.FALSE);
+                if (orgVO.getPk_hrorg() == null)
+                {
+                    orgVO.setPk_hrorg(getPkHrorg(orgVO.getPk_org()));
+                }
+                pk_psndoc_List.add(psnjobVO.getPk_psndoc());
+            }
+        }
+        if (pk_psndoc_List.size() > 0)
+        {
+            String strInSql = isc.getInSQL(pk_psndoc_List.toArray(new String[0]));
+            // 修改时先把该人员的私有组织关系的lastflag设置成‘N’,后面保存组织关系的时候会通过VO中的值重新设置
+            String strSQL =
+                "update " + PsnOrgVO.getDefaultTableName() + " set " + PsnOrgVO.LASTFLAG + "='" + UFBoolean.FALSE + "' where "
+                    + PsnOrgVO.PK_PSNDOC + " in (" + strInSql + ") ";
+            
+            getBaseDAO().executeUpdate(strSQL);
+        }
+        orgVO = getServiceTemplate().insert(orgVO);
+        // return orgVO.getPk_psnorg();
+        return orgVO;
+    }
+    
+    private String getPkHrorg(String pkOrg) throws BusinessException
+    {
+        OrgVO org = NCLocator.getInstance().lookup(IAOSQueryService.class).queryHROrgByOrgPK(pkOrg);
+        if (org == null)
+        {
+            String orgName = VOUtils.getDocName(OrgVO.class, pkOrg);
+            throw new BusinessException(ResHelper.getString("6007psn", "06007psn0301"/*
+                                                                                      * @res
+                                                                                      * "业务单元[{0}]不在其所属集团的行政组织体系下,无法作为人员的任职业务单元."
+                                                                                      */, orgName));
+        }
+        return org.getPk_org();
+    }
+    
+    private String getPKJobType(String pk_job) throws BusinessException
+    {
+        String pk_jobtype = "";
+        JobVO jobVO = getServiceTemplate().queryByPk(JobVO.class, pk_job);
+        pk_jobtype = jobVO.getPk_jobtype();
+        
+        return pk_jobtype;
+    }
+    
+    private String getPKPostSeries(String pk_post) throws BusinessException
+    {
+        String pk_postseries = "";
+        PostVO postVO = getServiceTemplate().queryByPk(PostVO.class, pk_post);
+        pk_postseries = postVO.getPk_postseries();
+        
+        return pk_postseries;
+    }
+    
+    /**
+     * 同步证件子集
+     * 
+     * @param uapPsnVO
+     * @throws BusinessException
+     */
+    private void syncCertVO(PsndocVO uapPsnVO) throws BusinessException
+    {
+        nc.vo.hi.psndoc.PsndocVO psnVO = getServiceTemplate().queryByPk(nc.vo.hi.psndoc.PsndocVO.class, uapPsnVO.getPk_psndoc(), true);
+        
+        if (StringUtils.isNotBlank(psnVO.getCode()))
+        {
+            psnVO.setCode(psnVO.getCode().trim());
+        }
+        if (StringUtils.isNotBlank(psnVO.getName()))
+        {
+            psnVO.setName(psnVO.getName().trim());
+        }
+        if (StringUtils.isNotBlank(psnVO.getName2()))
+        {
+            psnVO.setName2(psnVO.getName2().trim());
+        }
+        if (StringUtils.isNotBlank(psnVO.getName3()))
+        {
+            psnVO.setName3(psnVO.getName3().trim());
+        }
+        if (StringUtils.isNotBlank(psnVO.getName4()))
+        {
+            psnVO.setName4(psnVO.getName4().trim());
+        }
+        if (StringUtils.isNotBlank(psnVO.getName5()))
+        {
+            psnVO.setName5(psnVO.getName5().trim());
+        }
+        if (StringUtils.isNotBlank(psnVO.getName6()))
+        {
+            psnVO.setName6(psnVO.getName6().trim());
+        }
+        getServiceTemplate().update(psnVO, false);
+        
+        CertVO cert = new CertVO();
+        cert.setPk_psndoc(psnVO.getPk_psndoc());
+        cert.setIdtype(psnVO.getIdtype());
+        cert.setId(psnVO.getId());
+        cert.setIseffect(UFBoolean.TRUE);
+        cert.setIsstart(UFBoolean.TRUE);
+        cert.setStatus(VOStatus.NEW);
+        cert.setPk_group(psnVO.getPk_group());
+        cert.setPk_org(psnVO.getPk_org());
+        getServiceTemplate().insert(cert);
+    }
+    
+    /**
+     * 同步基本信息自定义项
+     * 
+     * @param uapPsnVO
+     * @throws DAOException
+     * @throws BusinessException
+     */
+    private void syncDefineAtrrs(PsndocVO uapPsnVO) throws DAOException, BusinessException
+    {
+        @SuppressWarnings("unchecked")
+        Collection<DefineMap> c = getBaseDAO().retrieveByClause(DefineMap.class, DefineMap.UAP_TABLENAME + " = 'bd_psndoc'");
+        if (c != null && !c.isEmpty())
+        {
+            String[] srcExtraAttrs = new String[c.size()];
+            String[] desExtraAttrs = new String[c.size()];
+            DefineMap[] defineMaps = c.toArray(new DefineMap[0]);
+            for (int i = 0; i < defineMaps.length; i++)
+            {
+                srcExtraAttrs[i] = defineMaps[i].getPropindex();
+                desExtraAttrs[i] = defineMaps[i].getHr_fieldname();
+            }
+            nc.vo.hi.psndoc.PsndocVO docVO = new nc.vo.hi.psndoc.PsndocVO();
+            SuperVOHelper.copySuperVOAttributes(new PsndocVO[]{uapPsnVO}, new nc.vo.hi.psndoc.PsndocVO[]{docVO}, srcExtraAttrs,
+                desExtraAttrs, false);
+            getServiceTemplate().update(docVO, false);
+        }
+    }
+    
+    /**
+     * 同步工作信息自定义项
+     * 
+     * @param uapJobVOs
+     * @return
+     * @throws DAOException
+     */
+    private PsnJobVO[] syncJobDefine(PsnjobVO[] uapJobVOs) throws DAOException
+    {
+        // 将UAP工作记录转换成HR工作记录(包括主职和兼职)
+        @SuppressWarnings("unchecked")
+        Collection<DefineMap> c = getBaseDAO().retrieveByClause(DefineMap.class, DefineMap.UAP_TABLENAME + " = 'bd_psnjob'");
+        String[] srcExtraAttrs = new String[c.size() + 3];
+        String[] desExtraAttrs = new String[c.size() + 3];
+        srcExtraAttrs[0] = "psncode";
+        srcExtraAttrs[1] = "indutydate";
+        srcExtraAttrs[2] = "enddutydate";
+        desExtraAttrs[0] = "clerkcode";
+        desExtraAttrs[1] = "begindate";
+        desExtraAttrs[2] = "enddate";
+        if (c != null && !c.isEmpty())
+        {
+            DefineMap[] defineMaps = c.toArray(new DefineMap[0]);
+            for (int i = 0; i < defineMaps.length; i++)
+            {
+                srcExtraAttrs[i + 3] = defineMaps[i].getPropindex();
+                desExtraAttrs[i + 3] = defineMaps[i].getHr_fieldname();
+            }
+        }
+        PsnJobVO[] psnJobVOs = SuperVOHelper.createSuperVOsFromSuperVOs(uapJobVOs, PsnJobVO.class, srcExtraAttrs, desExtraAttrs, false);
+        return psnJobVOs;
+    }
+    
+    private SimpleDocServiceTemplate getServiceTemplate()
+    {
+        if (serviceTemplate == null)
+        {
+            serviceTemplate = new SimpleDocServiceTemplate("SyncUAPDataToHRImpl");
+        }
+        return serviceTemplate;
+    }
+    
+    public BaseDAO getBaseDAO()
+    {
+        if (baseDAO == null)
+        {
+            baseDAO = new BaseDAO();
+        }
+        return baseDAO;
+    }
+    
+    @Override
+    public boolean isHREnabled(String pk_org) throws BusinessException
+    {
+        // 由服务类名判断是否UAP节点进入,如果是HR节点则不进行校验 zhangqiano 2015-9-2
+        String busiAction = InvocationInfoProxy.getInstance().getServiceName();
+        
+        // UAP接口需要判断组织是否启用HR职能,如果启用则不允许生成用户
+        if (null != busiAction && busiAction.equalsIgnoreCase("nc.itf.bd.psn.psndoc.IPsndocService"))
+        {
+            if (PubEnv.isModuleStarted(null, PubEnv.MODULE_HRHI))
+            {
+                int count =
+                    NCLocator.getInstance().lookup(IPersistenceRetrieve.class)
+                        .getCountByCondition("org_admin_enable", " pk_adminorg ='" + pk_org + "' ");
+                return count > 0;
+            }
+        }
+        
+        return false;
+    }
+    
+    @Override
+    public void transferUser(PsndocVO vo, boolean innerGroup) throws BusinessException
+    {
+        // 首先调用UAP实现方法
+        IPsndocService service = (IPsndocService) ObjectCreator.newInstance(uapMoudle, uapImplClass);
+        service.transferUser(vo, innerGroup);
+        
+    }
+    
+    public Map<String, UFBoolean> isHREnabled(String[] pk_orgs) throws BusinessException
+    {
+        if (!PubEnv.isModuleStarted(null, PubEnv.MODULE_HRHI))
+        {
+            IPsndocService service = (IPsndocService) ObjectCreator.newInstance(uapMoudle, uapImplClass);
+            return service.isHREnabled(pk_orgs);
+        }
+        
+        Map<String, UFBoolean> map = new HashMap<String, UFBoolean>();
+        for (String pk_org : pk_orgs)
+        {
+            map.put(pk_org, UFBoolean.valueOf(isHREnabled(pk_org)));
+        }
+        return map;
+    }
+    
+    @Override
+    public PsndocExtend[] createUser(PsndocExtend[] vo, String pk_userGroup, String passwordStrategy) throws BusinessException
+    {
+        // 首先调用UAP实现方法
+        IPsndocService service = (IPsndocService) ObjectCreator.newInstance(uapMoudle, uapImplClass);
+        PsndocExtend[] vos = service.createUser(vo, pk_userGroup, passwordStrategy);
+        return vos;
+    }
+    
+    @Override
+    public void transferUserCrossGroup(PsndocVO vo, boolean ParamValue) throws BusinessException
+    {
+        IPsndocService service = (IPsndocService) ObjectCreator.newInstance(uapMoudle, uapImplClass);
+        service.transferUserCrossGroup(vo, ParamValue);
+    }
+    
+    /**
+     * UAP 人员返聘
+     * @param uapPsnVO
+     * @param isSyncCert
+     * @param orgrelaid
+     * @throws BusinessException
+     */
+    private void doInsertHRPsndocWhenRehire(PsndocVO uapPsnVO, boolean isSyncCert, int orgrelaid) throws BusinessException
+    {
+        PsnjobVO[] uapJobVO = uapPsnVO.getPsnjobs();
+        
+        //除去第一条工作记录  jiazhtb
+        uapJobVO=deleteFirstJobVO(uapJobVO);
+        
+        // 如果没有工作记录,直接返回
+        if (uapJobVO == null || uapJobVO.length == 0)
+        {
+            return;
+        }
+        
+        // 1.同步基本信息自定义项
+        syncDefineAtrrs(uapPsnVO);
+        
+        if (isSyncCert)
+        {
+            // 2.同步证件子集
+            syncCertVO(uapPsnVO);
+        }
+        
+        // 3.同步生成新的组织关系
+        // String pk_psnorg = SyncCreateOrg(uapJobVO, orgrelaid);
+        PsnOrgVO orgVO = SyncCreateOrg(uapJobVO, orgrelaid);
+        
+        // 4.将UAP的工作信息同步到HR的工作信息表
+        List<PsnJobVO> jobList = syncHRPsnjobs(orgVO, uapJobVO);
+        
+        PsnJobVO mainJobVO = null;
+        // 5.同步流动情况
+        for (PsnJobVO psnJobVO : jobList)
+        {
+            if (psnJobVO.getIsmainjob() == null || !psnJobVO.getIsmainjob().booleanValue())
+            {
+                continue;
+            }
+            mainJobVO = psnJobVO;
+            NCLocator.getInstance().lookup(IPersonRecordService.class).addPsnChgWhenIntoDoc(psnJobVO);
+            break;
+        }
+        
+        // 6.同步生成一条合同状态记录
+        if (PubEnv.isModuleStarted(PubEnv.getPk_group(), PubEnv.MODULE_HRCM))
+        {
+            
+            ConttypeStateVO stateVO = new ConttypeStateVO();
+            stateVO.setAssgid(mainJobVO.getAssgid());
+            stateVO.setContstate(1/* HRCMCommonValue.contstate_nomake */);
+            stateVO.setConttype("hi_psndoc_ctrt");
+            stateVO.setPk_psndoc(uapPsnVO.getPk_psndoc());
+            stateVO.setPk_psnorg(orgVO.getPk_psnorg());
+            getServiceTemplate().insert(stateVO);
+        }
+        
+    }
+    
+    /**
+     * UAP人员返聘,会将HR上次组织关系下的离职记录带过来
+     * 该方法将离职记录从数据除去
+     * @author jiazhtb
+     * 
+     * @param uapJobVOs  uap传过来的工作记录
+     * @return  除去第一条工作记录后的数组
+     */
+    private PsnjobVO [] deleteFirstJobVO(PsnjobVO[] uapJobVOs) throws BusinessException{
+    	
+    	String pk_psndoc=uapJobVOs[0].getPk_psndoc() ;
+    	//对生成的HR工作记录进行 处理,确定是更新还是插入   jiazhtb 2016.01.19
+        List<PsnjobVO> insertJobs = new ArrayList<PsnjobVO>();
+        
+    	String condition=" pk_psndoc= '"+pk_psndoc+"' ";
+    	PsnJobVO [] hrJobVOs;
+    	try {
+    		hrJobVOs= getServiceTemplate().queryByCondition(PsnJobVO.class, condition);
+		} catch (BusinessException e) {
+			throw new BusinessException(e.getMessage());
+		}
+    	//根据主键和HR的工作记录,去掉HR已经存在的工作记录
+    	if(hrJobVOs!=null&&hrJobVOs.length>0){
+    		List<String>  pk_hrPsnjobs=new ArrayList<String>();
+    		for(int i=0;i<hrJobVOs.length;i++){
+    			pk_hrPsnjobs.add(((PsnJobVO)hrJobVOs[i]).getPk_psnjob());
+			}
+    		for(int i=0;i<uapJobVOs.length;i++){
+    			
+    			PsnjobVO psnjobVO=uapJobVOs[i];
+    			String pk_psnjob=psnjobVO.getPk_psnjob();
+    			if(!pk_hrPsnjobs.contains(pk_psnjob)){
+    				
+    				insertJobs.add(psnjobVO);
+    			}
+    		}
+    		return insertJobs.toArray(new PsnjobVO[0]);
+    	}
+    	
+    	return uapJobVOs;
+    }
+    
+    /**
+     * UAP更新人员时,传递过来的工作记录有问题需要将无效记录剔除掉
+     * 剔除的对象:非HR最新组织关系下的工作记录
+     * @author jiazhtb
+     * @param uapJobVOs UAP的工作记录
+     * @param orgVO HR最新的组织关系
+     */
+    private PsnjobVO [] deleteInvalidJobVO(PsnjobVO[] uapJobVOs,PsnOrgVO psnOrgVO) throws BusinessException{
+    	
+    	String pk_psndoc=uapJobVOs[0].getPk_psndoc() ;
+    	String condition=" pk_psndoc= '"+pk_psndoc+"' and pk_psnorg != '"+psnOrgVO.getPk_psnorg()+"' ";
+    	
+    	//对生成的HR工作记录进行 处理,确定是更新还是插入   jiazhtb 2016.01.19
+        List<PsnjobVO> insertJobs = new ArrayList<PsnjobVO>();
+        
+    	PsnJobVO [] hrJobVOs;
+    	try {
+    		hrJobVOs= getServiceTemplate().queryByCondition(PsnJobVO.class, condition);
+		} catch (BusinessException e) {
+			throw new BusinessException(e.getMessage());
+		}
+    	//根据主键和HR的工作记录,去掉HR已经存在的工作记录
+    	if(hrJobVOs!=null&&hrJobVOs.length>0){
+    		List<String>  pk_hrPsnjobs=new ArrayList<String>();
+    		for(int i=0;i<hrJobVOs.length;i++){
+    			pk_hrPsnjobs.add(((PsnJobVO)hrJobVOs[i]).getPk_psnjob());
+			}
+    		for(int i=0;i<uapJobVOs.length;i++){
+    			
+    			PsnjobVO psnjobVO=uapJobVOs[i];
+    			String pk_psnjob=psnjobVO.getPk_psnjob();
+    			if(!pk_hrPsnjobs.contains(pk_psnjob)){
+    				
+    				insertJobs.add(psnjobVO);
+    			}
+    		}
+    		return insertJobs.toArray(new PsnjobVO[0]);
+    	}
+    	
+    	return uapJobVOs;
+    }
+}

+ 1 - 0
xh/hrhi/src/public/xhpublic.gitkeep

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

+ 1 - 0
xh/hrhi/src/test/xhpublic.gitkeep

@@ -0,0 +1 @@
+欖貫륜

+ 3 - 0
xh/ic/classes/.gitignore

@@ -0,0 +1,3 @@
+/xh/
+/nc/
+/xhpublic.gitkeep

+ 3 - 0
xh/ic/component.xml

@@ -0,0 +1,3 @@
+<component name="ic" displayname="ic">
+  <dependencies/>
+</component>

+ 1 - 0
xh/ic/resources/xhpublic.gitkeep

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

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

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

+ 412 - 0
xh/ic/src/private/nc/bs/ic/general/plugins/GeneralDefdocPlugin.java

@@ -0,0 +1,412 @@
+package nc.bs.ic.general.plugins;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import nc.bs.framework.common.NCLocator;
+import nc.bs.ic.pub.env.ICBSContext;
+import nc.bs.logging.Logger;
+import nc.bs.pfxx.ISwapContext;
+import nc.bs.pfxx.plugin.AbstractPfxxPlugin;
+import nc.impl.pubapp.pattern.data.vo.VOQuery;
+import nc.itf.scmpub.reference.uap.pf.PfServiceScmUtil;
+import nc.itf.uap.pf.IPFBusiAction;
+import nc.pubitf.scmf.ic.mbatchcode.IBatchcodePubService;
+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.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.pf.workflow.IPFActionName;
+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.util.VORowNoUtils;
+import nc.vo.scmf.ic.mbatchcode.BatchcodeVO;
+
+import org.apache.commons.lang.StringUtils;
+
+/**
+ * 外部交换平台,导入外部普通单数据处理类
+ * 
+ * @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数据为空"*/);
+
+    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);
+    //zth   
+    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());
+    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());
+    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();
+    Map<String, BatchcodeVO> batchmap = this.getBatchcodeVO(vos);
+    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.getNnum()!=null &&body.getNassistnum()!=null&&body.getDbizdate() == null)
+        body.setDbizdate(context.getBizDate());// 业务日期
+      // 辅单位
+      if (StringUtil.isSEmptyOrNull(body.getCastunitid()))
+        body.setCastunitid(context.getInvInfo()
+            .getInvBasVO(body.getCmaterialvid()).getPk_stockmeas());
+
+      // 有批次号但无批次主键时, 需要补全批次主键,有必要时(保质期管理)补全生产日期和失效日期
+      if (!StringUtils.isEmpty(body.getVbatchcode())
+          && StringUtils.isEmpty(body.getPk_batchcode())) {
+        BatchcodeVO batchvo =
+            batchmap.get(body.getCmaterialvid() + body.getVbatchcode());
+        if (batchvo != null) {
+          body.setPk_batchcode(batchvo.getPk_batchcode());
+          body.setDproducedate(batchvo.getDproducedate());
+          body.setDvalidate(batchvo.getDvalidate());
+        }
+      }
+      bodyVOCopyFromHeadVO(body, head);
+    }
+  }
+
+  /**
+   * 获取批次号档案
+   * 
+   * @param vos
+   * @return Map<String(cmaterialvid+vbatchcode), BatchcodeVO批次档案>
+   */
+  private Map<String, BatchcodeVO> getBatchcodeVO(ICBillBodyVO[] vos) {
+    List<String> cmaterialvidList = new ArrayList<String>();
+    List<String> vbatchcodeList = new ArrayList<String>();
+    Set<String> materialbatch = new HashSet<String>();
+    for (ICBillBodyVO body : vos) {
+      if (body.getCmaterialvid() != null && body.getVbatchcode() != null) {
+        if (materialbatch.contains(body.getCmaterialvid()
+            + body.getVbatchcode())) {
+          continue;
+        }
+        cmaterialvidList.add(body.getCmaterialvid());
+        vbatchcodeList.add(body.getVbatchcode());
+        materialbatch.add(body.getCmaterialvid() + body.getVbatchcode());
+      }
+    }
+    if (materialbatch.size() == 0) {
+      return new HashMap<String, BatchcodeVO>();
+    }
+    IBatchcodePubService batchservice =
+        NCLocator.getInstance().lookup(IBatchcodePubService.class);
+    BatchcodeVO[] batchvos = null;
+    try {
+      batchvos =
+          batchservice.queryBatchVOs(cmaterialvidList.toArray(new String[0]),
+              vbatchcodeList.toArray(new String[0]));
+    }
+    catch (BusinessException e) {
+      ExceptionUtils.wrappException(e);
+    }
+
+    if (batchvos == null || batchvos.length == 0) {
+      return new HashMap<String, BatchcodeVO>();
+    }
+    Map<String, BatchcodeVO> batchmap = new HashMap<String, BatchcodeVO>();
+    for (BatchcodeVO batchvo : batchvos) {
+      batchmap
+          .put(batchvo.getCmaterialvid() + batchvo.getVbatchcode(), batchvo);
+    }
+    return batchmap;
+  }
+
+  /**
+   * 根据表头设置表体默认值,表体集团,库存组织,公司,仓库,交易类型
+   * 
+   * @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;
+  }
+
+}

+ 1 - 0
xh/ic/src/public/xhpublic.gitkeep

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

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

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

+ 1 - 0
xh/sc/classes/.gitignore

@@ -0,0 +1 @@
+/xhpublic.gitkeep

BIN
xh/sc/classes/nc/bs/sc/pfxx/plugin/SCorderPfxxPlugin.class


+ 3 - 0
xh/sc/component.xml

@@ -0,0 +1,3 @@
+<component name="sc" displayname="sc">
+  <dependencies/>
+</component>

+ 1 - 0
xh/sc/resources/xhpublic.gitkeep

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

+ 1 - 0
xh/sc/src/client/xhpublic.gitkeep

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

+ 97 - 0
xh/sc/src/private/nc/bs/sc/pfxx/plugin/SCorderPfxxPlugin.java

@@ -0,0 +1,97 @@
+package nc.bs.sc.pfxx.plugin;
+
+import nc.bs.framework.common.NCLocator;
+import nc.bs.logging.Logger;
+import nc.itf.sc.m61.ISCOrderMaintain;
+import nc.itf.uap.pf.IPFBusiAction;
+import nc.itf.uap.pfxx.IPFxxEJBService;
+import nc.md.persist.framework.IMDPersistenceQueryService;
+import nc.vo.pfxx.util.FileUtils;
+import nc.vo.pfxx.util.PfxxPluginUtils;
+import nc.bs.pfxx.ISwapContext;
+import nc.vo.pfxx.auxiliary.AggxsysregisterVO;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.VOStatus;
+import nc.vo.pub.workflownote.WorkflownoteVO;
+import nc.vo.pubapp.pattern.pub.PubAppTool;
+import nc.vo.sc.m61.entity.SCOrderHeaderVO;
+import nc.vo.sc.m61.entity.SCOrderItemVO;
+import nc.vo.sc.m61.entity.SCOrderVO;
+import nc.vo.sc.m61.entity.context.SCOrderContxt;
+
+
+
+
+/**
+ * <b> 在此处简要描述此类的功能 </b>
+ *
+ * <p>
+ *     在此处添加此类的描述信息
+ * </p>
+ *
+ * @author ufsoft
+ * @version Your Project V60
+ */
+public class SCorderPfxxPlugin extends nc.bs.pfxx.plugin.AbstractPfxxPlugin  {	
+	
+	/**
+	 * 将由XML转换过来的VO导入NC系统。业务插件实现此方法即可。<br>
+	 * 请注意,业务方法的校验一定要充分
+	 * 
+	 * @param vo
+	 *            转换后的vo数据,在NC系统中可能为ValueObject,SuperVO,AggregatedValueObject,IExAggVO等。
+	 * @param swapContext
+	 *            各种交换参数,组织,接受方,发送方,帐套等等
+	 * @param aggxsysvo
+	 *            辅助信息vo
+	 * @return
+	 * @throws BusinessException
+	 */
+	protected Object processBill(Object vo, ISwapContext swapContext, AggxsysregisterVO aggxsysvo) throws BusinessException {
+
+		//1.得到转换后的VO数据,取决于向导第一步注册的VO信息
+ 		SCOrderVO resvo = (SCOrderVO)vo;
+ 
+ 		//2.查询此单据是否已经被导入过,有两个方法,具体使用哪一个请参考方法说明javadoc
+ 		String vopk = PfxxPluginUtils.queryBillPKBeforeSaveOrUpdate(swapContext.getBilltype(),swapContext.getDocID());
+ 		//2) String vopk = PfxxPluginUtils.queryBillPKBeforeSaveOrUpdate(swapContext.getBilltype(),swapContext.getDocID(),swapContext.getOrgPk());
+ 		
+ 		//3. 如果单据设置有辅助信息,aggxsysvo为用户配置的具体辅助信息
+ 		
+ 		//4.如果此单据没有导入过,那么准备保存新单据,保存单据前请进行必要的数据检查,并给出明确的业务异常...
+ 		//TODO
+ 		Logger.info("如果此单据没有导入过,保存新单据...");
+ 		if (PubAppTool.isNull(vopk)) {
+ 			SCOrderItemVO[] sCOrderHeaderVO=resvo.getChildrenVO();
+ 			for (SCOrderItemVO scOrderItemVO : sCOrderHeaderVO) {
+ 				scOrderItemVO.setStatus(2);
+			}
+ 			resvo.getParentVO().setStatus(2);
+ 			//WorkflownoteVO Workflownote = new WorkflownoteVO();
+ 			//IPFBusiAction ipf = NCLocator.getInstance().lookup(IPFBusiAction.class);
+			//ipf.processAction("SAVEBASE", "61", Workflownote, resvo, null, null);
+ 			ISCOrderMaintain is = NCLocator.getInstance().lookup(ISCOrderMaintain.class);
+ 			is.save(new SCOrderVO[]{resvo},new SCOrderContxt(), null);
+ 		}
+ 		
+ 		//5.如果此单据已经导入过,请调用PfxxPluginUtils.checkBillCanBeUpdate(UfinterfaceVO swapContext)检查单据是否允许更新
+ 		//  如果不允许更新,此方法会抛出业务异常
+ 		//TODO
+ 		Logger.info("如果单据已经导入过则进行单据更新...");
+
+
+ 		 		
+ 		
+ 		
+ 		//6.如果希望单据将来可以更新,请调用下列接口插入文档流水号与生成PK的对照关系
+ 		//  第2步查询对照关系相对应,也有两个个方法,具体请看javadoc
+ 		//1)PfxxPluginUtils.addDocIDVsPKContrast(swapContext.getBilltype(),swapContext.getDocID(),pk);
+ 		//2)PfxxPluginUtils.addDocIDVsPKContrast(swapContext.getBilltype(),swapContext.getDocID(),swapContext.getOrgPk(),pk);
+ 		
+		//7.准备返回值,此函数的返回值,最终会以字符串的形式返回给外系统,
+		//  对于普通单据可以返回NC系统生成的PK值,对于凭证可能返回凭证号,具体视单据而定
+		//  对于查询插件要求返回org.w3c.dom.Node[]数组 或者org.w3c.dom.Node
+		return "业务插件返回值";
+	}
+	
+}

+ 1 - 0
xh/sc/src/public/xhpublic.gitkeep

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

+ 1 - 0
xh/sc/src/test/xhpublic.gitkeep

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

+ 2 - 0
xh/so/classes/.gitignore

@@ -0,0 +1,2 @@
+/nc/
+/xhpublic.gitkeep

+ 3 - 0
xh/so/component.xml

@@ -0,0 +1,3 @@
+<component name="so" displayname="so">
+  <dependencies/>
+</component>

+ 1 - 0
xh/so/resources/xhpublic.gitkeep

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

+ 1 - 0
xh/so/src/client/xhpublic.gitkeep

@@ -0,0 +1 @@
+梩弇睫

+ 62 - 0
xh/so/src/private/nc/pubimpl/so/m30/pfxx/M30PfxxPlugin.java

@@ -0,0 +1,62 @@
+package nc.pubimpl.so.m30.pfxx;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.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.vo.pub.AggregatedValueObject;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.pf.workflow.IPFActionName;
+import nc.vo.so.m30.entity.SaleOrderVO;
+
+public class M30PfxxPlugin extends AbstractSOPfxxPlugin {
+	public List<IRule<AggregatedValueObject>> getCheckers() {
+		List<IRule<AggregatedValueObject>> rules = new ArrayList();
+		rules.add(new BillFreeStatusCheckRule());
+		rules.add(new MnyTaxCheckRule("ntax", "nmny", "ntaxmny"));
+		rules.add(new WriteBackInfoCheckRule(new String[]{"ntotalsendnum", "ntotalinvoicenum", "ntotaloutnum",
+				"ntotalnotoutnum", "ntotalsignnum", "ntranslossnum", "ntotalrushnum", "ntotalestarnum", "ntotalarnum",
+				"ntotalcostnum", "ntotalestarmny", "ntotalarmny", "ntotalpaymny", "norigsubmny", "narrangescornum",
+				"narrangepoappnum", "narrangetoornum", "narrangetoappnum", "narrangemonum", "narrangeponum",
+				"ntotalplonum", "ntotalreturnnum", "ntotaltradenum"}));
+		return rules;
+	}
+
+	protected AggregatedValueObject insert(AggregatedValueObject vo) {
+		SaleOrderVO[] insertvo = new SaleOrderVO[]{(SaleOrderVO) vo};
+		InsertSaleOrderAction insertact = new InsertSaleOrderAction();
+		SaleOrderVO[] retvos = insertact.insert(insertvo);
+		
+	    //add by ZTH 销售订单审批
+	    IPFBusiAction service = NCLocator.getInstance().lookup(IPFBusiAction.class);
+	    try {
+			service.processAction(IPFActionName.APPROVE,
+			     "30", null, retvos[0], null, null);
+		} catch (BusinessException e) {
+			// TODO 自动生成的 catch 块
+			e.printStackTrace();
+		}
+		return null != retvos && retvos.length != 0 ? retvos[0] : null;
+	}
+
+	protected AggregatedValueObject update(AggregatedValueObject vo, String vopk) {
+		SaleOrderVO[] updatevo = new SaleOrderVO[]{(SaleOrderVO) vo};
+		BillQuery<SaleOrderVO> billquery = new BillQuery(SaleOrderVO.class);
+		SaleOrderVO[] origvos = (SaleOrderVO[]) billquery.query(new String[]{vopk});
+		BillConcurrentTool tool = new BillConcurrentTool();
+		tool.lockBill(origvos);
+		UpdateSaleOrderAction insertact = new UpdateSaleOrderAction();
+		SaleOrderVO[] retvos = insertact.update(updatevo, origvos);
+		return null != retvos && retvos.length != 0 ? retvos[0] : null;
+	}
+}

+ 1 - 0
xh/so/src/public/xhpublic.gitkeep

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

+ 1 - 0
xh/so/src/test/xhpublic.gitkeep

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

+ 1 - 0
xh/uapbd/classes/.gitignore

@@ -0,0 +1 @@
+/xhpublic.gitkeep

BIN
xh/uapbd/classes/nc/bs/bd/pfxx/plugin/PsndocPfxxPlugin.class


+ 3 - 0
xh/uapbd/component.xml

@@ -0,0 +1,3 @@
+<component name="uapbd" displayname="uapbd">
+  <dependencies/>
+</component>

+ 1 - 0
xh/uapbd/resources/xhpublic.gitkeep

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

+ 1 - 0
xh/uapbd/src/client/xhpublic.gitkeep

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

+ 108 - 0
xh/uapbd/src/private/nc/bs/bd/pfxx/plugin/PsndocPfxxPlugin.java

@@ -0,0 +1,108 @@
+package nc.bs.bd.pfxx.plugin;
+
+import java.util.ArrayList;
+import java.util.List;
+import nc.bs.framework.common.NCLocator;
+import nc.bs.pfxx.ISwapContext;
+import nc.bs.pfxx.plugin.AbstractPfxxPlugin;
+import nc.itf.bd.psn.psndoc.IPsndocService;
+import nc.md.data.access.NCObject;
+import nc.md.model.MetaDataException;
+import nc.md.persist.framework.IMDPersistenceQueryService;
+import nc.vo.bd.psn.PsndocVO;
+import nc.vo.bd.psn.PsnjobVO;
+import nc.vo.ml.NCLangRes4VoTransl;
+import nc.vo.pfxx.auxiliary.AggxsysregisterVO;
+import nc.vo.pfxx.util.PfxxPluginUtils;
+import nc.vo.pub.BusinessException;
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
+
+public class PsndocPfxxPlugin extends AbstractPfxxPlugin {
+	private IPsndocService service = null;
+	private IMDPersistenceQueryService queryService = null;
+
+	protected Object processBill(Object vo, ISwapContext swapContext, AggxsysregisterVO aggxsysvo)
+			throws BusinessException {
+		PsndocVO resvo = (PsndocVO) vo;
+		this.checkBeforeImport(resvo);
+		String vopk = PfxxPluginUtils.queryBillPKBeforeSaveOrUpdate(swapContext.getBilltype(), swapContext.getDocID(),
+				swapContext.getOrgPk());
+		resvo = this.getPsndocVOForSave(resvo, vopk);
+		if (StringUtils.isBlank(vopk)) {
+			resvo = this.getPsndocService().insertPsndoc(resvo, false);
+			PfxxPluginUtils.addDocIDVsPKContrast(swapContext.getBilltype(), swapContext.getDocID(),
+					swapContext.getOrgPk(), resvo.getPrimaryKey());
+		} else {
+			this.getPsndocService().updatePsndoc(resvo, false);
+		}
+
+		return vopk;
+	}
+
+	private void checkBeforeImport(PsndocVO resvo) throws BusinessException {
+		if (ArrayUtils.isEmpty(resvo.getPsnjobs())) {
+			throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("10140psn", "010140psn0059"));
+		}
+	}
+
+	private PsndocVO getPsndocVOForSave(PsndocVO resvo, String vopk) throws MetaDataException, BusinessException {
+		List<PsnjobVO> list = new ArrayList();
+		this.addPsnjobVOToList(resvo, list, 2);
+		if (StringUtils.isEmpty(vopk)) {
+			resvo.setStatus(2);
+		} else {
+			PsndocVO oldvo = this.queryOldPSndovCO(vopk);
+			resvo.setPrimaryKey(vopk);
+			resvo.setStatus(1);
+			resvo.setCreationtime(oldvo.getCreationtime());
+			resvo.setCreator(oldvo.getCreator());
+			this.addPsnjobVOToList(oldvo, list, 3);
+		}
+
+		resvo.setPsnjobs((PsnjobVO[]) list.toArray(new PsnjobVO[0]));
+		return resvo;
+	}
+
+	private void addPsnjobVOToList(PsndocVO resvo, List<PsnjobVO> list, int status) {
+		PsnjobVO[] jobvos = resvo.getPsnjobs();
+		if (jobvos != null) {
+			PsnjobVO[] arr$ = jobvos;
+			int len$ = jobvos.length;
+
+			for (int i$ = 0; i$ < len$; ++i$) {
+				PsnjobVO jobvo = arr$[i$];
+				jobvo.setStatus(status);
+				list.add(jobvo);
+			}
+		}
+
+	}
+
+	private PsndocVO queryOldPSndovCO(String vopk) throws MetaDataException, BusinessException {
+		NCObject obj = this.getIPsndocQueryService().queryBillOfNCObjectByPK(PsndocVO.class, vopk);
+		if (obj == null) {
+			throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("10140psn", "110140psn0026"));
+		} else {
+			PsndocVO oldvo = (PsndocVO) obj.getContainmentObject();
+			return oldvo;
+		}
+	}
+
+	private IPsndocService getPsndocService() {
+		if (this.service == null) {
+			this.service = (IPsndocService) NCLocator.getInstance().lookup(IPsndocService.class);
+		}
+
+		return this.service;
+	}
+
+	private IMDPersistenceQueryService getIPsndocQueryService() {
+		if (this.queryService == null) {
+			this.queryService = (IMDPersistenceQueryService) NCLocator.getInstance()
+					.lookup(IMDPersistenceQueryService.class);
+		}
+
+		return this.queryService;
+	}
+}

+ 1 - 0
xh/uapbd/src/public/xhpublic.gitkeep

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

+ 1 - 0
xh/uapbd/src/test/xhpublic.gitkeep

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

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


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


BIN
xh/xh/classes/nc/bs/xh/servlet/XhDeleteApiServlet.class


BIN
xh/xh/classes/nc/impl/xh/api/DeltBusnesDcmentsImpl.class


BIN
xh/xh/classes/nc/impl/xh/report/inoutledger/InFactorDelegator.class


+ 26 - 0
xh/xh/classes/nc/impl/xh/report/inoutledger/attributereference.txt

@@ -0,0 +1,26 @@
+{
+	"po_order": "DltPo_order",
+	"ic_purchasein": "DltIc_purchasein",
+	"ic_saleout": "DltIc_saleout",
+	"ic_transform": "DltIc_transform",
+	"ic_whstrans": "DltIc_whstrans",
+	"ic_material": "DltIc_material",
+	"ic_generalin": "DltIc_generalin",
+	"ic_generalout": "DltIc_generalout",
+	"ar_gatheritemExpected": "DltAr_gatheritemExpected",
+	"ar_gatheritem": "DltAr_gatheritem",
+	"mm_pmo": "DltMm_pmo",
+	"ic_materialget": "DltIc_materialget",
+	"ic_materialout": "DltIc_materialout",
+	"ic_finprodin": "DltIc_finprodin",
+	"sc_order": "DltSc_order",
+	"material": "DltMaterial",
+	"subcontin": "DltSubcontin",
+	"ap_paybill": "DltAp_paybill",
+	"purchasein_h": "Dltpurchasein_h",
+	"so_saleorder": "Dltso_saleorder",
+	"saleout_h":"Dltsaleout_h",
+	"so_saleinvoice": "Dltso_saleinvoice",
+	"ap_payablebill": "DltAp_payablebill",
+	"po_invoice": "DltPo_invoice"
+}

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


BIN
xh/xh/classes/xh/test/DemoGit.class


+ 1 - 0
xh/xh/classes/xhcl.gitkeep

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

+ 1 - 0
xh/xh/classes/xhpublic.gitkeep

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

+ 1 - 0
xh/xh/classes/xhre.gitkeep

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

+ 1 - 0
xh/xh/classes/xhtest.gitkeep

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

+ 3 - 0
xh/xh/component.xml

@@ -0,0 +1,3 @@
+<component name="xh" displayname="xh">
+  <dependencies/>
+</component>

+ 1 - 0
xh/xh/resources/xhre.gitkeep

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

+ 1 - 0
xh/xh/src/client/xhcl.gitkeep

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

+ 85 - 0
xh/xh/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;
+	}
+	
+}

+ 227 - 0
xh/xh/src/private/nc/bs/xh/impl/TransformAddImpl.java

@@ -0,0 +1,227 @@
+package nc.bs.xh.impl;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+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.servlet.service.BaseServlet;
+import nc.itf.ic.m4n.ITransformMaitain;
+import nc.itf.pu.m21.IOrderMaintain;
+import nc.itf.uap.IUAPQueryBS;
+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 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
+		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", json.getString("pk_group")));
+			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", json.getString("pk_group")));
+			transformheadvo.setPk_org(SqlexecuteQuery("pk_stockorg", "org_stockorg", "code", json.getString("pk_org")));
+			transformheadvo.setPk_org_v(SqlexecuteQuery("pk_vid", "org_stockorg_v", "code", json.getString("pk_org")));
+			transformheadvo.setCorpoid(SqlexecuteQuery("pk_corp", "org_corp", "code", json.getString("corpoid")));
+			transformheadvo.setCorpvid(SqlexecuteQuery("pk_vid", "org_corp", "code", json.getString("corpoid")));
+			transformheadvo.setDbilldate(new UFDate(json.getString("dbilldate")));
+			transformheadvo.setVtrantypecode(json.getString("vtrantypecode"));
+			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")));
+			transformheadvo.setCtrantypeid(QueryTrantype(json.getString("vtrantypecode"),SqlexecuteQuery("pk_group", "org_group", "code", json.getString("pk_group"))));
+			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", bodyObject.getString("pk_group")));
+				transformbodyvo.setPk_org(SqlexecuteQuery("pk_stockorg", "org_stockorg", "code", bodyObject.getString("pk_org")));
+				transformbodyvo.setPk_org_v(SqlexecuteQuery("pk_vid", "org_stockorg_v", "code", bodyObject.getString("pk_org")));
+				transformbodyvo.setCorpoid(SqlexecuteQuery("pk_corp", "org_corp", "code", bodyObject.getString("corpoid")));
+				transformbodyvo.setCorpvid(SqlexecuteQuery("pk_vid", "org_corp", "code", bodyObject.getString("corpoid")));
+				transformbodyvo.setCbodywarehouseid(SqlexecuteQuery("pk_stordoc", "bd_stordoc", "code", bodyObject.getString("cbodywarehouseid")));
+				transformbodyvo.setCmaterialoid(SqlexecuteQuery("pk_source", "bd_material_v", "code", bodyObject.getString("cmaterialoid")));
+				transformbodyvo.setCmaterialvid(SqlexecuteQuery("pk_material", "bd_material", "code", 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")));
+				transformbodyvos[i] = transformbodyvo;
+				i++;
+			}
+			transformvo.setChildrenVO(transformbodyvos);
+			
+			ITransformMaitain itransform=(ITransformMaitain)NCLocator.getInstance().lookup(ITransformMaitain.class);
+			itransform.insert(transformvos);
+			out.print(formatRSJsonData("成功","",vbillcode));
+			
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			resp.getWriter().write(formatRSJsonData("失败",
+					e.getCause().getMessage()==null?e.getCause().toString():e.getCause().getMessage(),"").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 DAOException {
+		
+		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 DAOException("未查询到数据!请检查编码"+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 DAOException {
+		
+		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 DAOException("未查询到数据!请检查编码"+code+"是否正确!");
+			}
+			
+			return object.toString();
+		} catch (BusinessException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			return e.getMessage();
+		}
+	}
+
+}

+ 62 - 0
xh/xh/src/private/nc/bs/xh/servlet/XhDeleteApiServlet.java

@@ -0,0 +1,62 @@
+package nc.bs.xh.servlet;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.Map;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import net.sf.json.JSONObject;
+import nc.bs.framework.adaptor.IHttpServletAdaptor;
+import nc.bs.framework.common.NCLocator;
+import nc.bs.framework.server.ISecurityTokenCallback;
+import nc.bs.servlet.service.BaseServlet;
+import nc.impl.xh.report.inoutledger.InFactorDelegator;
+import nc.log.NcLog;
+
+/**
+ * 
+ * 业务单据删除接口入口类
+ * @author ZTH
+ *
+ */
+public class XhDeleteApiServlet extends BaseServlet implements IHttpServletAdaptor{
+	@Override
+	public void doAction(HttpServletRequest req, HttpServletResponse resp)
+			                                             throws ServletException, IOException {
+		try {
+			String createStr = buildJson(req, resp, this.getClass().getName());
+			JSONObject json = JSONObject.fromObject(createStr);
+			NcLog.info("请求json:"+json);
+			String datatype=json.getString("datatype");	//单据类型	
+			ISecurityTokenCallback sc = (ISecurityTokenCallback)NCLocator.getInstance().lookup(
+				    ISecurityTokenCallback.class);
+			sc.token("NCSystem".getBytes(),"pfxx".getBytes());
+			
+			InFactorDelegator infdor=new InFactorDelegator();
+			Map<String,String> map=infdor.initDataBase();
+			String methodName=map.get(datatype);
+			String className = "nc.impl.xh.api.DeltBusnesDcmentsImpl";
+			Class clz = Class.forName(className);
+			Object obj = clz.newInstance();	
+			Method m =obj.getClass().getDeclaredMethod(methodName,JSONObject.class);//反射机制获取方法名
+			String vbillcode=(String) m.invoke(obj, json);		
+			resp.getWriter().write(formatRSJsonData("成功","",vbillcode).toString());
+			
+		} catch (Exception e) {
+			//前端控制台打印xml数据
+			resp.getWriter().write(formatRSJsonData("失败",
+					e.getCause().getMessage()==null?e.getCause().toString():e.getCause().getMessage(),"").toString());
+			StringWriter stringWriter = new StringWriter();
+			e.printStackTrace(new PrintWriter(stringWriter));
+			//获取详细信息
+			String msg=stringWriter.getBuffer().toString();
+			NcLog.info("接口返回值提示:"+msg);
+		}
+		
+	}
+
+}

+ 571 - 0
xh/xh/src/private/nc/impl/xh/api/DeltBusnesDcmentsImpl.java

@@ -0,0 +1,571 @@
+package nc.impl.xh.api;
+
+import nc.bs.framework.common.InvocationInfoProxy;
+import nc.bs.framework.common.NCLocator;
+import nc.itf.ic.m45.self.IPurchaseInMaintain;
+import nc.itf.ic.m46.IProductInMaitain;
+import nc.itf.ic.m4a.IGeneralInMaintain;
+import nc.itf.ic.m4c.self.ISaleOutMaintain;
+import nc.itf.ic.m4d.IMaterialOutMaintain;
+import nc.itf.ic.m4i.IGeneralOutMaintain;
+import nc.itf.ic.m4k.IWhsTransMaintain;
+import nc.itf.ic.m4n.ITransformMaitain;
+import nc.itf.mmpac.pmo.pac0002.IPMOMaintainService;
+import nc.itf.pu.m21.IOrderMaintain;
+import nc.itf.uap.IUAPQueryBS;
+import nc.itf.uap.pf.IPFBusiAction;
+import nc.jdbc.framework.processor.BeanProcessor;
+import nc.jdbc.framework.processor.ColumnProcessor;
+import nc.md.persist.framework.IMDPersistenceQueryService;
+import nc.vo.ic.m45.entity.PurchaseInHeadVO;
+import nc.vo.ic.m45.entity.PurchaseInVO;
+import nc.vo.ic.m46.entity.FinProdInVO;
+import nc.vo.ic.m47.entity.SubcontInHeadVO;
+import nc.vo.ic.m47.entity.SubcontInVO;
+import nc.vo.ic.m4a.entity.GeneralInVO;
+import nc.vo.ic.m4c.entity.SaleOutHeadVO;
+import nc.vo.ic.m4c.entity.SaleOutVO;
+import nc.vo.ic.m4d.entity.MaterialOutHeadVO;
+import nc.vo.ic.m4d.entity.MaterialOutVO;
+import nc.vo.ic.m4i.entity.GeneralOutVO;
+import nc.vo.ic.m4k.entity.WhsTransBillVO;
+import nc.vo.ic.m4n.entity.TransformVO;
+import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
+import nc.vo.pu.m21.entity.OrderHeaderVO;
+import nc.vo.pu.m21.entity.OrderVO;
+import nc.vo.pu.m25.entity.InvoiceHeaderVO;
+import nc.vo.pu.m25.entity.InvoiceVO;
+import nc.vo.pub.BusinessException;
+import nc.vo.pub.workflownote.WorkflownoteVO;
+import nc.vo.sc.m61.entity.SCOrderHeaderVO;
+import nc.vo.sc.m61.entity.SCOrderVO;
+import nc.vo.so.m30.entity.SaleOrderHVO;
+import nc.vo.so.m30.entity.SaleOrderVO;
+import nc.vo.so.m32.entity.SaleInvoiceHVO;
+import nc.vo.so.m32.entity.SaleInvoiceVO;
+import nc.vo.arap.pay.PayBillVO;
+import nc.vo.arap.gathering.AggGatheringBillVO;
+import nc.vo.arap.pay.AggPayBillVO;
+import nc.vo.arap.payable.PayableBillVO;
+import nc.vo.arap.payable.AggPayableBillVO;
+import net.sf.json.JSONObject;
+
+/**
+ *
+ * 业务单据删除类
+ * @author ZTH
+ *
+ */
+public class DeltBusnesDcmentsImpl {
+	private IUAPQueryBS iuap=(IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());	
+	private IMDPersistenceQueryService service = NCLocator.getInstance().lookup(IMDPersistenceQueryService.class);
+	private WorkflownoteVO Workflownote = new WorkflownoteVO();
+	private IPFBusiAction ipf = NCLocator.getInstance().lookup(IPFBusiAction.class);
+	
+   /**
+    * 
+    * 1.采购订单删除
+    * 
+    */
+	public String DltPo_order(JSONObject json) throws BusinessException {
+	   String vbillcode = json.getString("vbillcode");	//删除的单据号
+	   //根据订单号查询表VO
+	   String sql="select * from po_order where vbillcode ='"+vbillcode+"' and nvl(dr,0)=0";	
+	   OrderHeaderVO orderheaderVO=(OrderHeaderVO)iuap.executeQuery(sql, new BeanProcessor(OrderHeaderVO.class));
+	   if(orderheaderVO == null) {
+			throw new BusinessException("采购订单编号:" + vbillcode + "不存在!");
+	   }
+	    //根据主键查询AggVO
+		//根据VO查主键gatheringBillVO.getPk_gatherbill()
+	    OrderVO orderVO=(OrderVO)service.queryBillOfNCObjectByPKWithDR(OrderHeaderVO.class,orderheaderVO.getPk_order(),true).getContainmentObject();
+	    IOrderMaintain iodm=(IOrderMaintain)NCLocator.getInstance().lookup(IOrderMaintain.class);
+	    OrderVO[] arr={orderVO};
+	    iodm.delete(arr,null);
+		return vbillcode;
+	}
+	
+	/**
+	 * 2.采购入库单删除
+	 * @author LP
+	 * @throws BusinessException 
+	 */
+	public String DltIc_purchasein(JSONObject json) throws BusinessException {
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());
+		String vbillcode = json.getString("vbillcode");
+		if (vbillcode==null) {
+			throw new BusinessException("采购入库单据号是必输项!");
+		}
+		String sql="select * from ic_purchasein_h where vbillcode ='"+vbillcode+"' and nvl(dr,0)=0";
+		PurchaseInVO purchaseInVO = (PurchaseInVO)iuap.executeQuery(sql, new BeanProcessor(PurchaseInVO.class));
+		if(purchaseInVO == null) {
+			throw new BusinessException("采购入库单据号:" + vbillcode + "不存在!");
+		}
+		((IPurchaseInMaintain) NCLocator.getInstance().lookup(IPurchaseInMaintain.class)).delete(new PurchaseInVO[] {purchaseInVO});
+		return vbillcode;
+	}
+	
+	/**
+	 * 3.销售出库单删除
+	 * @author LP
+	 * @throws BusinessException 
+	 */
+	public String DltIc_saleout(JSONObject json) throws BusinessException {
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());
+		String vbillcode = json.getString("vbillcode");
+		if (vbillcode==null) {
+			throw new BusinessException("销售出库单据号是必输项!");
+		}
+		String sql="select * from ic_saleout_h where vbillcode ='"+vbillcode+"' and nvl(dr,0)=0";
+		SaleOutVO saleOutVO = (SaleOutVO)iuap.executeQuery(sql, new BeanProcessor(SaleOutVO.class));
+		if(saleOutVO == null) {
+			throw new BusinessException("销售出库单据号:" + vbillcode + "不存在!");
+		}
+		((ISaleOutMaintain)NCLocator.getInstance().lookup(ISaleOutMaintain.class)).delete(new SaleOutVO[] {saleOutVO});
+		return vbillcode;
+	}
+	
+	/**
+	 * 4.形态转换单删除
+	 * @author LP
+	 * @throws BusinessException 
+	 */
+	public String DltIc_transform(JSONObject json) throws BusinessException {
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());
+		String vbillcode = json.getString("vbillcode");
+		if (vbillcode==null) {
+			throw new BusinessException("形态转换单据号是必输项!");
+		}
+		String sql="select * from ic_transform_h where vbillcode ='"+vbillcode+"' and nvl(dr,0)=0";
+		TransformVO transformVO = (TransformVO)iuap.executeQuery(sql, new BeanProcessor(TransformVO.class));
+		if(transformVO == null) {
+			throw new BusinessException("形态转换单据号:" + vbillcode + "不存在!");
+		}
+		((ITransformMaitain)NCLocator.getInstance().lookup(ITransformMaitain.class)).delete(new TransformVO[] {transformVO});
+		return vbillcode;
+	}
+	
+	/**
+	 * 5.转库单删除
+	 * @author LP
+	 * @throws BusinessException 
+	 */
+	public String DltIc_whstrans(JSONObject json) throws BusinessException {
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());
+		String vbillcode = json.getString("vbillcode");
+		if (vbillcode==null) {
+			throw new BusinessException("转库单据号是必输项!");
+		}
+		String sql="select * from ic_whstrans_h where vbillcode ='"+vbillcode+"' and nvl(dr,0)=0";
+		WhsTransBillVO whsTransBillVO = (WhsTransBillVO)iuap.executeQuery(sql, new BeanProcessor(WhsTransBillVO.class));
+		if(whsTransBillVO == null) {
+			throw new BusinessException("转库单据号:" + vbillcode + "不存在!");
+		}
+		((IWhsTransMaintain)NCLocator.getInstance().lookup(IWhsTransMaintain.class)).delete(new WhsTransBillVO[] {whsTransBillVO});
+		return vbillcode;
+	}
+	
+	/**
+	 * 6.其它领料删除
+	 * @author LP
+	 * @throws BusinessException 
+	 */
+	public String DltIc_material(JSONObject json) throws BusinessException {
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());
+		String vbillcode = json.getString("vbillcode");
+		if (vbillcode==null) {
+			throw new BusinessException("材料出库单据号是必输项!");
+		}
+		String sql="select * from ic_material_h where vbillcode ='"+vbillcode+"' and nvl(dr,0)=0";
+		MaterialOutVO materialOutVO = (MaterialOutVO)iuap.executeQuery(sql, new BeanProcessor(MaterialOutVO.class));
+		if(materialOutVO == null) {
+			throw new BusinessException("材料出库单据号:" + vbillcode + "不存在!");
+		}
+		((IMaterialOutMaintain)NCLocator.getInstance().lookup(IMaterialOutMaintain.class)).delete(new MaterialOutVO[] {materialOutVO});
+		return vbillcode;
+	}
+	
+	/**
+	 * 7.其他入库单删除
+	 * @author LP
+	 * @throws BusinessException 
+	 */
+	public String DltIc_generalin(JSONObject json) throws BusinessException {
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());
+		String vbillcode = json.getString("vbillcode");
+		if (vbillcode==null) {
+			throw new BusinessException("其他入库单单据号是必输项!");
+		}
+		String sql="select * from ic_generalin_h where vbillcode ='"+vbillcode+"' and nvl(dr,0)=0";
+		GeneralInVO generalInVO = (GeneralInVO)iuap.executeQuery(sql, new BeanProcessor(GeneralInVO.class));
+		if(generalInVO == null) {
+			throw new BusinessException("其他入库单单据号:" + vbillcode + "不存在!");
+		}
+		((IGeneralInMaintain)NCLocator.getInstance().lookup(IGeneralInMaintain.class)).delete(new GeneralInVO[] {generalInVO});
+		return vbillcode;
+	}
+	
+	/**
+	 * 8.其他出库单删除
+	 * @author LP
+	 * @throws BusinessException 
+	 */
+	public String DltIc_generalout(JSONObject json) throws BusinessException {
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());
+		String vbillcode = json.getString("vbillcode");
+		if (vbillcode==null) {
+			throw new BusinessException("其他出库单单据号是必输项!");
+		}
+		String sql="select * from ic_generalout_h where vbillcode ='"+vbillcode+"' and nvl(dr,0)=0";
+		GeneralOutVO generalOutVO = (GeneralOutVO)iuap.executeQuery(sql, new BeanProcessor(GeneralOutVO.class));
+		if(generalOutVO == null) {
+			throw new BusinessException("其他出库单单据号:" + vbillcode + "不存在!");
+		}
+		((IGeneralOutMaintain)NCLocator.getInstance().lookup(IGeneralOutMaintain.class)).delete(new GeneralOutVO[] {generalOutVO});
+		return vbillcode;
+	}
+	
+	/**
+	 * 9.预收款(已关联销售订单)删除
+	 * @author LP
+	 * @throws BusinessException 
+	 */
+	public String DltAr_gatheritemExpected(JSONObject json) throws BusinessException {
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());
+		String vbillcode = json.getString("vbillcode");
+		if (vbillcode==null) {
+			throw new BusinessException("收款单单据号是必输项!");
+		}
+		String sql="select * from ar_gatherbill where billno ='"+vbillcode+"' and nvl(dr,0)=0";
+		AggGatheringBillVO aggGatheringBillVO = (AggGatheringBillVO)iuap.executeQuery(sql, new BeanProcessor(AggGatheringBillVO.class));
+		if(aggGatheringBillVO == null) {
+			throw new BusinessException("收款单单据号:" + vbillcode + "不存在!");
+		}
+		ipf.processAction("DELETE", "F2", Workflownote, aggGatheringBillVO, null, null);
+		return vbillcode;
+	}
+	
+	/**
+	 * 10.收款单(已关联销售订单)删除
+	 * @author LP
+	 * @throws BusinessException 
+	 */
+	public String DltAr_gatheritem(JSONObject json) throws BusinessException {
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());
+		String vbillcode = json.getString("vbillcode");
+		if (vbillcode==null) {
+			throw new BusinessException("收款单单据号是必输项!");
+		}
+		String sql="select * from ar_gatherbill where billno ='"+vbillcode+"' and nvl(dr,0)=0";
+		AggGatheringBillVO aggGatheringBillVO = (AggGatheringBillVO)iuap.executeQuery(sql, new BeanProcessor(AggGatheringBillVO.class));
+		if(aggGatheringBillVO == null) {
+			throw new BusinessException("收款单单据号:" + vbillcode + "不存在!");
+		}
+		ipf.processAction("DELETE", "F2", Workflownote, aggGatheringBillVO, null, null);
+		return vbillcode;
+	}
+	
+	/**
+	 * 11.生产订单删除
+	 * @author LP
+	 * @throws BusinessException 
+	 */
+	public String DltMm_pmo(JSONObject json) throws BusinessException {
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());
+		String vbillcode = json.getString("vbillcode");
+		if (vbillcode==null) {
+			throw new BusinessException("生产订单单据号是必输项!");
+		}
+		String sql="select * from mm_pmo where vbillcode ='"+vbillcode+"' and nvl(dr,0)=0";
+		PMOAggVO pmoAggVO = (PMOAggVO)iuap.executeQuery(sql, new BeanProcessor(PMOAggVO.class));
+		if(pmoAggVO == null) {
+			throw new BusinessException("生产订单单据号:" + vbillcode + "不存在!");
+		}
+		((IPMOMaintainService)NCLocator.getInstance().lookup(IPMOMaintainService.class)).delete(new PMOAggVO[] {pmoAggVO});
+		return vbillcode;
+	}
+	
+	/**
+	 * 12.生产领料删除
+	 * @author LP
+	 * @throws BusinessException 
+	 */
+	public String DltIc_materialget(JSONObject json) throws BusinessException {
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());
+		String vbillcode = json.getString("vbillcode");
+		if (vbillcode==null) {
+			throw new BusinessException("材料出库单据号是必输项!");
+		}
+		String sql="select * from ic_material_h where vbillcode ='"+vbillcode+"' and nvl(dr,0)=0";
+		MaterialOutVO materialOutVO = (MaterialOutVO)iuap.executeQuery(sql, new BeanProcessor(MaterialOutVO.class));
+		if(materialOutVO == null) {
+			throw new BusinessException("材料出库单据号:" + vbillcode + "不存在!");
+		}
+		((IMaterialOutMaintain)NCLocator.getInstance().lookup(IMaterialOutMaintain.class)).delete(new MaterialOutVO[] {materialOutVO});
+		return vbillcode;
+	}
+	
+	/**
+	 * 13.生产退料删除
+	 * @author LP
+	 * @throws BusinessException 
+	 */
+	public String DltIc_materialout(JSONObject json) throws BusinessException {
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());
+		String vbillcode = json.getString("vbillcode");
+		if (vbillcode==null) {
+			throw new BusinessException("材料出库单据号是必输项!");
+		}
+		String sql="select * from ic_material_h where vbillcode ='"+vbillcode+"' and nvl(dr,0)=0";
+		MaterialOutVO materialOutVO = (MaterialOutVO)iuap.executeQuery(sql, new BeanProcessor(MaterialOutVO.class));
+		if(materialOutVO == null) {
+			throw new BusinessException("材料出库单据号:" + vbillcode + "不存在!");
+		}
+		((IMaterialOutMaintain)NCLocator.getInstance().lookup(IMaterialOutMaintain.class)).delete(new MaterialOutVO[] {materialOutVO});
+		return vbillcode;
+	}
+	
+	/**
+	 * 14.生产入库删除
+	 * @author LP
+	 * @throws BusinessException 
+	 */
+	public String DltIc_finprodin(JSONObject json) throws BusinessException {
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());
+		String vbillcode = json.getString("vbillcode");
+		if (vbillcode==null) {
+			throw new BusinessException("产成品入库单单据号是必输项!");
+		}
+		String sql="select * from ic_finprodin_h where vbillcode ='"+vbillcode+"' and nvl(dr,0)=0";
+		FinProdInVO finProdInVO = (FinProdInVO)iuap.executeQuery(sql, new BeanProcessor(FinProdInVO.class));
+		if(finProdInVO == null) {
+			throw new BusinessException("产成品入库单单据号:" + vbillcode + "不存在!");
+		}
+		((IProductInMaitain)NCLocator.getInstance().lookup(IProductInMaitain.class)).delete(new FinProdInVO[] {finProdInVO});
+		return vbillcode;
+	}
+	
+	/**
+	 * 15.委外订单
+	 * @author Yaoy
+	 * @param json
+	 * @return
+	 * @throws BusinessException
+	 */
+	public String DltSc_order(JSONObject json) throws BusinessException {
+		String vbillcode = json.getString("vbillcode");	//删除的单据号
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());//指定集团pk
+		String sql = "select  pk_order from sc_order where  vdef1='"+vbillcode+"' and nvl(dr,0)=0";
+		SCOrderHeaderVO  sCOrderHeaderVO = (SCOrderHeaderVO) iuap.executeQuery(sql, new BeanProcessor(SCOrderHeaderVO.class));
+		if(sCOrderHeaderVO == null) {
+			throw new BusinessException("委外订单编号:" + vbillcode + "不存在!");
+		}
+		SCOrderVO  sCOrderVO = (SCOrderVO) service.queryBillOfNCObjectByPKWithDR(SCOrderVO.class,sCOrderHeaderVO.getPk_order(),true).getContainmentObject();
+		ipf.processAction("DELETE", "61", Workflownote, sCOrderVO, null, null);
+		return vbillcode;
+	}
+	
+	/**
+	 * 16.材料出库
+	 * @author Yaoy
+	 * @param json
+	 * @return
+	 * @throws BusinessException
+	 */
+	public String DltMaterial(JSONObject json) throws BusinessException {
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());//指定集团pk
+		String vbillcode = json.getString("vbillcode");	//删除的单据号
+		String sql = "select cgeneralhid from ic_material_h  where vdef1='"+vbillcode+"' and nvl(dr,0)=0";
+		MaterialOutHeadVO materialOutHeadVO = (MaterialOutHeadVO) iuap.executeQuery(sql, new BeanProcessor(MaterialOutHeadVO.class));
+		if(materialOutHeadVO == null) {
+			throw new BusinessException("材料出库编号:" + vbillcode + "不存在!");
+		}
+		MaterialOutVO materialOutVO = (MaterialOutVO) service.queryBillOfNCObjectByPKWithDR(MaterialOutVO.class,materialOutHeadVO.getCgeneralhid(),true).getContainmentObject();
+		ipf.processAction("DELETE", "4D", Workflownote, materialOutVO, null, null);
+		return vbillcode;
+	}
+	
+	/**
+	 * 17.委托加工入库
+	 * @author Yaoy
+	 * @param json
+	 * @throws BusinessException
+	 */
+	public String DltSubcontin(JSONObject json) throws BusinessException {
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());//指定集团pk
+		String vbillcode = json.getString("vbillcode");	//删除的单据号
+		String sql = "select cgeneralhid  from ic_subcontin_h  where vdef1='"+vbillcode+"' and nvl(dr,0)=0";
+		SubcontInHeadVO subcontInHeadVO = (SubcontInHeadVO) iuap.executeQuery(sql, new BeanProcessor(SubcontInHeadVO.class));
+		if(subcontInHeadVO == null) {
+			throw new BusinessException("委托加工入库编号:" + vbillcode + "不存在!");
+		}
+		SubcontInVO subcontInVO = (SubcontInVO) service.queryBillOfNCObjectByPKWithDR(SubcontInVO.class,subcontInHeadVO.getCgeneralhid(),true).getContainmentObject();
+		ipf.processAction("DELETE", "47", Workflownote, subcontInVO, null, null);
+		return vbillcode;
+	}
+	
+	/**
+	 * 18付款单
+	 * @author pancy
+	 * @param json
+	 * @return
+	 * @throws BusinessException
+	 */
+	public String DltAp_paybill(JSONObject json) throws BusinessException {
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());//指定集团pk
+		String vbillcode = json.getString("vbillcode");	//删除的单据号
+		if (vbillcode.equals("")) {
+			throw new BusinessException("请填写要删除的单据号!");
+		}
+		String sql = "select pk_paybill from ap_paybill where billno ='"+vbillcode+"' and nvl(dr,0)=0";
+		PayBillVO paybillVO = (PayBillVO) iuap.executeQuery(sql, new BeanProcessor(PayBillVO.class));
+		if(paybillVO == null) {
+			throw new BusinessException("付款单:" + vbillcode + "不存在!");
+		}
+		AggPayBillVO aggpaybillVO = (AggPayBillVO) service.queryBillOfNCObjectByPKWithDR(AggPayBillVO.class,paybillVO.getPk_paybill(),true).getContainmentObject();
+		ipf.processAction("DELETE", "F3", Workflownote, aggpaybillVO, null, null);
+		return vbillcode;
+	}
+	/**
+	 * @author hej
+	 * 19.采购退货单
+	 * 
+	 * 
+	**/
+	public String Dltpurchasein_h(JSONObject json)throws BusinessException{
+		String vbillcode = json.getString("vbillcode");	//删除得单据号
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());//指定集团pk
+		   //根据订单号查询表VO
+		   String sql="select * from ic_purchasein_h where vbillcode ='"+vbillcode+"' and nvl(dr,0)=0";	
+		   PurchaseInHeadVO   pciVO=(PurchaseInHeadVO)iuap.executeQuery(sql, new BeanProcessor(PurchaseInHeadVO.class));
+		  if(pciVO == null) {
+				throw new BusinessException("单据号:" + vbillcode + "不存在!");
+		   }
+		//根据主键查询AggVO
+			//根据VO查主键gatheringBillVO.getPk_gatherbill()
+		  PurchaseInVO  AggpciVO=(PurchaseInVO)service.queryBillOfNCObjectByPKWithDR(PurchaseInHeadVO.class,pciVO.getCgeneralhid(),true).getContainmentObject();		  
+		  IPurchaseInMaintain ipmt=(IPurchaseInMaintain)NCLocator.getInstance().lookup(IPurchaseInMaintain.class);
+		  PurchaseInVO[] brr={AggpciVO};
+		  ipmt.delete(brr);		  
+		  return vbillcode+"删除成功";
+	}
+		 
+	/**
+	 * @author hej
+	 * 20.销售订单
+	 * 
+	 * 
+	 * **/	  
+	public String Dltso_saleorder(JSONObject json)throws BusinessException{
+		String vbillcode = json.getString("vbillcode");	//删除得单据号
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());//指定集团pk
+		   //根据订单号查询表VO
+		   String sql="select * from so_saleorder where vbillcode ='"+vbillcode+"' and nvl(dr,0)=0";	
+		   SaleOrderHVO soVO=(SaleOrderHVO)iuap.executeQuery(sql, new BeanProcessor(SaleOrderHVO.class));
+		  if(soVO == null) {
+				throw new BusinessException("单据号:" + vbillcode + "不存在!");
+		   }
+		//根据主键查询AggVO
+			//根据VO查主键gatheringBillVO.getPk_gatherbill()
+		  SaleOrderVO salVO=(SaleOrderVO )service.queryBillOfNCObjectByPKWithDR(SaleOrderHVO.class,soVO.getCsaleorderid(),true).getContainmentObject();		  
+		 ipf.processAction("DELETE", "m30", Workflownote, salVO, null, null);	  
+		  return vbillcode+"删除成功";
+	
+	}	
+	/**
+	 * @author hej
+	 * 21.销售出库/退货
+	 * 
+	 * 
+	 * **/	  
+	public String Dltsaleout_h(JSONObject json)throws BusinessException{
+		String vbillcode = json.getString("vbillcode");	//删除得单据号
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());//指定集团pk
+		   //根据订单号查询表VO
+		   String sql="select * from ic_saleout_h where vbillcode ='"+vbillcode+"' and nvl(dr,0)=0";	
+		   SaleOutHeadVO  sohVO=(SaleOutHeadVO )iuap.executeQuery(sql, new BeanProcessor(SaleOutHeadVO .class));
+		  if(sohVO == null) {
+				throw new BusinessException("单据号:" + vbillcode + "不存在!");
+		   }
+		//根据主键查询AggVO
+			//根据VO查主键gatheringBillVO.getPk_gatherbill()
+		  SaleOutVO  saloVO=(SaleOutVO )service.queryBillOfNCObjectByPKWithDR(SaleOutHeadVO.class,sohVO.getCgeneralhid(),true).getContainmentObject();		  
+		 ipf.processAction("DELETE", "m4c", Workflownote, saloVO, null, null);	  
+		  return vbillcode+"删除成功";
+	
+	}	
+	/**
+	 * @author hej
+	 * 22.销售发票
+	 * 
+	 * 
+	 * **/	  
+	public String Dltso_saleinvoice(JSONObject json)throws BusinessException{
+		String vbillcode = json.getString("vbillcode");	//删除得单据号
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());//指定集团pk
+		   //根据订单号查询表VO
+		   String sql="select * from so_saleinvoice where vbillcode ='"+vbillcode+"' and nvl(dr,0)=0";	
+		   SaleInvoiceHVO  sicVO=(SaleInvoiceHVO)iuap.executeQuery(sql, new BeanProcessor(SaleInvoiceHVO.class));
+		  if(sicVO == null) {
+				throw new BusinessException("单据号:" + vbillcode + "不存在!");
+		   }
+		//根据主键查询AggVO
+			//根据VO查主键gatheringBillVO.getPk_gatherbill()
+		  SaleInvoiceVO salVO=(SaleInvoiceVO )service.queryBillOfNCObjectByPKWithDR(SaleInvoiceHVO.class,sicVO.getCsaleinvoiceid(),true).getContainmentObject();		  
+		 ipf.processAction("DELETE", "m32", Workflownote, salVO, null, null);	  
+		  return vbillcode+"删除成功";
+	
+	}	
+	
+	
+	/**
+	 * 23应付单
+	 * @author pancy
+	 * @param json
+	 * @return
+	 * @throws BusinessException
+	 */
+	public String DltAp_payablebill(JSONObject json) throws BusinessException {
+		InvocationInfoProxy.getInstance().setGroupId(QueryGroup());//指定集团pk
+		String vbillcode = json.getString("vbillcode");	//删除的单据号
+		if (vbillcode.equals("")) {
+			throw new BusinessException("请填写要删除的单据号!");
+		}
+		String sql = "select pk_payablebill  from ap_payablebill where billno ='"+vbillcode+"' and nvl(dr,0)=0";
+		PayableBillVO payablebillVO = (PayableBillVO) iuap.executeQuery(sql, new BeanProcessor(PayableBillVO.class));
+		if(payablebillVO == null) {
+			throw new BusinessException("付款单:" + vbillcode + "不存在!");
+		}
+		AggPayableBillVO aggpayablebillVO = (AggPayableBillVO) service.queryBillOfNCObjectByPKWithDR(AggPayableBillVO.class,payablebillVO.getPk_payablebill(),true).getContainmentObject();
+		ipf.processAction("DELETE", "F1", Workflownote, aggpayablebillVO, null, null);
+		return vbillcode;
+	}
+	
+	/**
+	 * 24采购发票删除
+	 * @author lyr
+	 * @param json
+	 * @return
+	 * @throws BusinessException
+	 */
+	public String DltPo_invoice(JSONObject json) throws BusinessException {
+	   InvocationInfoProxy.getInstance().setGroupId(QueryGroup());//指定集团
+	   String vbillcode = json.getString("vbillcode"); //删除得单据号
+	   String sql="select * from po_invoice where vbillcode ='"+vbillcode+"' and nvl(dr,0)=0"; 
+	   InvoiceHeaderVO invoiceHeaderVO = (InvoiceHeaderVO)iuap.executeQuery(sql, new BeanProcessor(InvoiceHeaderVO.class));
+	   if(invoiceHeaderVO == null) {
+	    throw new BusinessException("采购发票:" + vbillcode + "不存在!");
+	   }
+	   InvoiceVO invoiceVO=(InvoiceVO)service.queryBillOfNCObjectByPKWithDR(InvoiceHeaderVO.class,invoiceHeaderVO.getPk_invoice(),true).getContainmentObject();
+	   ipf.processAction("DELETE", "25", Workflownote, invoiceVO, null, null);
+	   return vbillcode;
+	  }
+	
+	public String QueryGroup() throws BusinessException {
+		String sql = "select pk_group from org_group where code='ZJC' and nvl(dr,0)=0";
+		String pk_group = (String) iuap.executeQuery(sql, new ColumnProcessor());
+		return pk_group;
+	}
+	
+	
+}
+

+ 66 - 0
xh/xh/src/private/nc/impl/xh/report/inoutledger/InFactorDelegator.java

@@ -0,0 +1,66 @@
+package nc.impl.xh.report.inoutledger;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import nc.bs.framework.common.InvocationInfoProxy;
+import net.sf.json.JSONObject;
+/**
+ * 
+ * 处理单据类型和类方法类对照关系
+ * key:json单据类型  value:类方法名
+ * @author ZTH
+ *
+ */
+public class InFactorDelegator {
+
+	public Map<String,String> initDataBase() throws Exception {
+	  Map<String,String> map=new HashMap<String,String>();
+	  JSONObject defdata = JSONObject.fromObject(getDeftData());
+	  Iterator it=defdata.keys();
+	  while (it.hasNext()){
+		  String key=(String) it.next();
+		  String value=defdata.getString(key);
+		  map.put(key, value);
+		  System.out.print("[key="+key+" val="+value+"]");
+	  }
+	  
+	  return map;
+		
+	}
+
+	private static String getDeftData() throws Exception {
+		try {
+			String file = InFactorDelegator.class.getResource("").getFile();
+			//String file = "/D:/U8C/workspace/njbdx/gl/classes/nc/pub/servlet/service/";
+			System.out.println(file);
+			
+			File  deffile  =    new File(file+"\\attributereference.txt");
+			if(!deffile.exists()){
+				throw new Exception("配置文件不存在!");
+			}
+			FileInputStream filedata = new FileInputStream(deffile);
+			BufferedReader reader = new BufferedReader(new InputStreamReader(filedata));
+			StringBuffer jsonStr = new StringBuffer();
+			String line = "";
+			while ((line = reader.readLine()) != null) {
+				jsonStr.append(line);
+			}
+			if (jsonStr != null) {
+				return jsonStr.toString();
+			}
+		} catch (FileNotFoundException e) {
+			throw e;
+		} catch (IOException e) {
+			throw e;
+		}
+		return "";
+	}
+}

+ 26 - 0
xh/xh/src/private/nc/impl/xh/report/inoutledger/attributereference.txt

@@ -0,0 +1,26 @@
+{
+	"po_order": "DltPo_order",
+	"ic_purchasein": "DltIc_purchasein",
+	"ic_saleout": "DltIc_saleout",
+	"ic_transform": "DltIc_transform",
+	"ic_whstrans": "DltIc_whstrans",
+	"ic_material": "DltIc_material",
+	"ic_generalin": "DltIc_generalin",
+	"ic_generalout": "DltIc_generalout",
+	"ar_gatheritemExpected": "DltAr_gatheritemExpected",
+	"ar_gatheritem": "DltAr_gatheritem",
+	"mm_pmo": "DltMm_pmo",
+	"ic_materialget": "DltIc_materialget",
+	"ic_materialout": "DltIc_materialout",
+	"ic_finprodin": "DltIc_finprodin",
+	"sc_order": "DltSc_order",
+	"material": "DltMaterial",
+	"subcontin": "DltSubcontin",
+	"ap_paybill": "DltAp_paybill",
+	"purchasein_h": "Dltpurchasein_h",
+	"so_saleorder": "Dltso_saleorder",
+	"saleout_h":"Dltsaleout_h",
+	"so_saleinvoice": "Dltso_saleinvoice",
+	"ap_payablebill": "DltAp_payablebill",
+	"po_invoice": "DltPo_invoice"
+}

+ 81 - 0
xh/xh/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;
+  }
+}

+ 1 - 0
xh/xh/src/public/xhpublic.gitkeep

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

+ 10 - 0
xh/xh/src/test/xh/test/DemoGit.java

@@ -0,0 +1,10 @@
+package xh.test;
+
+public class DemoGit {
+
+	public static void main(String[] args) {
+		System.out.print("½ñÌìÌìÆøÕæºÃѽ£¡");
+
+	}
+
+}

+ 1 - 0
xh/xh/src/test/xhtest.gitkeep

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