浏览代码

增加新增、审批事务处理

yaoyu 2 年之前
父节点
当前提交
368dbda6ec

+ 14 - 10
xh/META-INF/xhopenapi.upm

@@ -1,11 +1,15 @@
-<?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>	
+<?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>
+ 	   <component remote="true" singleton="true" tx="CMT">
+            <interface>nc.itf.xh.m4n.IUtilMaintain</interface>
+            <implementation>nc.bs.xh.impl.UtilMaintainImpl</implementation>
+        </component>
+    </public>	
 </module>

+ 21 - 5
xh/xh/src/private/nc/bs/xh/impl/TransformAddImpl.java

@@ -19,6 +19,7 @@ import nc.itf.ic.m4n.ITransformMaitain;
 import nc.itf.pu.m21.IOrderMaintain;
 import nc.itf.uap.IUAPQueryBS;
 import nc.itf.uap.pf.IPFBusiAction;
+import nc.itf.xh.m4n.IUtilMaintain;
 import nc.jdbc.framework.processor.ColumnProcessor;
 import nc.log.NcLog;
 import nc.vo.ic.m4n.entity.TransformHeadVO;
@@ -102,16 +103,20 @@ public class TransformAddImpl extends BaseServlet implements IHttpServletAdaptor
 				transformbodyvo.setNassistnum(new UFDouble(bodyObject.getString("nassistnum")));
 				transformbodyvo.setNcostprice(new UFDouble(bodyObject.getString("ncostprice")));
 				transformbodyvo.setNcostmny(new UFDouble(bodyObject.getString("ncostmny")));
+				transformbodyvo.setVbatchcode(bodyObject.getString("vbatchcode"));//批次号
+				transformbodyvo.setPk_batchcode(QueryBatchCode(transformbodyvo.getCmaterialoid(),transformbodyvo.getVbatchcode()));//批次主键
 				transformbodyvos[i] = transformbodyvo;
 				i++;
 			}
 			transformvo.setChildrenVO(transformbodyvos);
 			
-			ITransformMaitain itransform=(ITransformMaitain)NCLocator.getInstance().lookup(ITransformMaitain.class);
-			itransform.insert(transformvos);
-			IPFBusiAction service = NCLocator.getInstance().lookup(IPFBusiAction.class);
-			service.processAction("APPROVE",
-	                "4N", null, transformvos[0], null, null);
+//			ITransformMaitain itransform=(ITransformMaitain)NCLocator.getInstance().lookup(ITransformMaitain.class);
+//			itransform.insert(transformvos);
+//			IPFBusiAction service = NCLocator.getInstance().lookup(IPFBusiAction.class);
+//			service.processAction("APPROVE",
+//	                "4N", null, transformvos[0], null, null);
+			IUtilMaintain iUtilMaintain = NCLocator.getInstance().lookup(IUtilMaintain.class);
+			iUtilMaintain.ZK_RequiresNew(transformvo);
 			out.print(formatRSJsonData("成功","",vbillcode)); 
 			
 		} catch (Exception e) {
@@ -202,6 +207,17 @@ public class TransformAddImpl extends BaseServlet implements IHttpServletAdaptor
 			return object.toString();
 	}
 	
+	public String QueryBatchCode(String cmaterialoid,String vbillcode) throws Exception {
+		String sql = "select pk_batchcode from scm_batchcode where cmaterialoid = '"+cmaterialoid+"' and vbatchcode = '"+vbillcode+"' and dr=0";
+		Object object;
+		object = iuap.executeQuery(sql, new ColumnProcessor());
+		if (object==null) {
+			return null;
+		}else {
+			return object.toString();
+		}
+	}
+	
 	/*
 	 * 查询转换类型pk
 	 */

+ 21 - 0
xh/xh/src/private/nc/bs/xh/impl/UtilMaintainImpl.java

@@ -0,0 +1,21 @@
+package nc.bs.xh.impl;
+
+import nc.bs.framework.common.NCLocator;
+import nc.itf.ic.m4n.ITransformMaitain;
+import nc.itf.uap.pf.IPFBusiAction;
+import nc.itf.xh.m4n.IUtilMaintain;
+import nc.vo.ic.m4n.entity.TransformVO;
+
+public class UtilMaintainImpl implements IUtilMaintain{
+
+	@Override
+	public void ZK_RequiresNew(TransformVO TransformVO) throws Exception {
+		ITransformMaitain itransform=(ITransformMaitain)NCLocator.getInstance().lookup(ITransformMaitain.class);
+		itransform.insert(new TransformVO[] {TransformVO});
+		IPFBusiAction service = NCLocator.getInstance().lookup(IPFBusiAction.class);
+		service.processAction("APPROVE",
+                "4N", null, TransformVO, null, null);
+		
+	}
+
+}

+ 9 - 0
xh/xh/src/public/nc/itf/xh/m4n/IUtilMaintain.java

@@ -0,0 +1,9 @@
+package nc.itf.xh.m4n;
+
+import nc.vo.ic.m4n.entity.TransformVO;
+
+public interface IUtilMaintain {
+	
+	void ZK_RequiresNew(TransformVO TransformVO) throws Exception;
+
+}