浏览代码

材料出库删除接口

liyr 1 年之前
父节点
当前提交
a8792c76a7

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

@@ -18,4 +18,10 @@
        <implementation>nc.bs.ic.impl.BatchCodeAddImpl</implementation>
  	   </component>
     </public>
+    <!--²ÄÁϳö¿âɾ³ý-->
+     <public>
+ 	   <component name="deleteicmaterialout" accessProtected="false"  remote="true" singleton="true" tx="NONE" supportAlias="true">
+       <implementation>nc.bs.servlet.service.DeleteIcMaterialOutServlet</implementation>
+ 	   </component>
+    </public>
 </module>

+ 4 - 0
ic/ic/classes/.gitignore

@@ -0,0 +1,4 @@
+/client.gitkeep
+/nc
+/reources.gitkeep
+/test.gitkeep

二进制
ic/ic/classes/nc/bs/bd/pfxx/plugin/MaterialPfxxPlugin.class


二进制
ic/ic/classes/nc/bs/ic/general/plugins/GeneralDefdocPlugin.class


二进制
ic/ic/classes/nc/bs/ic/impl/TransformAddImpl.class


二进制
ic/ic/classes/nc/log/NcLog.class


二进制
ic/ic/classes/nc/pubimpl/so/m30/pfxx/M30PfxxPlugin.class


二进制
ic/ic/classes/nc/pubimpl/so/m4331/pfxx/M4331PfxxPlugin.class


+ 65 - 0
ic/ic/src/private/nc/bs/ic/impl/DeleteIcMaterialOutImpl.java

@@ -0,0 +1,65 @@
+package nc.bs.ic.impl;
+
+import java.util.List;
+
+import nc.bs.framework.common.NCLocator;
+import nc.itf.ic.m4d.IMaterialOutMaintain;
+import nc.itf.uap.IUAPQueryBS;
+import nc.itf.uap.pf.IPFBusiAction;
+import nc.jdbc.framework.SQLParameter;
+import nc.jdbc.framework.processor.BeanListProcessor;
+import nc.vo.ic.m4d.entity.MaterialOutBodyVO;
+import nc.vo.ic.m4d.entity.MaterialOutHeadVO;
+import nc.vo.ic.m4d.entity.MaterialOutVO;
+import nc.vo.pub.workflownote.WorkflownoteVO;
+import net.sf.json.JSONObject;
+
+
+public class DeleteIcMaterialOutImpl implements IDeleteIcMaterialOut{
+	
+	private IUAPQueryBS iuap=(IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
+
+	@Override
+	public void DeleteIcMaterialOut_RequiresNew(JSONObject json) throws Exception {
+		String vbillcode = "";
+		vbillcode = json.getString("vbillcode");
+	
+		MaterialOutVO mo = new MaterialOutVO();
+		MaterialOutHeadVO s1 = new MaterialOutHeadVO();
+		
+		//获取主表数据
+		String mhSql  = "select*From ic_material_h where vbillcode=? and nvl(dr,0)=0";
+		SQLParameter mhParam = new SQLParameter(); // 构造参数对象
+		mhParam.addParam(vbillcode);
+		List<MaterialOutHeadVO> mhlist=(List<MaterialOutHeadVO>) iuap.executeQuery(mhSql, mhParam, new BeanListProcessor(MaterialOutHeadVO.class));
+		// 此处定义主表
+		mo=new MaterialOutVO();
+		s1=new MaterialOutHeadVO();
+		if(mhlist.size()==0){
+			  throw new Exception("单据号:" + vbillcode + "不存在!");
+		}else{
+			s1=mhlist.get(0);
+			//获取子表数据
+			String mbSql  = "select*From ic_material_b where cgeneralhid=? and nvl(dr,0)=0";
+			SQLParameter mbParam = new SQLParameter(); // 构造参数对象
+			mbParam.addParam(s1.getCgeneralhid());
+			List<MaterialOutBodyVO> mbList=(List<MaterialOutBodyVO>) iuap.executeQuery(mbSql, mbParam, new BeanListProcessor(MaterialOutBodyVO.class));
+			
+			MaterialOutBodyVO[] mbArray = new MaterialOutBodyVO[mbList.size()];
+			for (int u = 0; u < mbArray.length; u++) {
+				mbArray[u] = mbList.get(u);
+			}
+		    mo.setParent(s1);
+		    mo.setChildrenVO(mbArray);  
+		}
+		//如果单据已签字,先取消签字
+		IMaterialOutMaintain iMaterialOutMaintain = (IMaterialOutMaintain) NCLocator.getInstance().lookup(IMaterialOutMaintain.class);
+		MaterialOutVO [] materialOutVOs = new MaterialOutVO [1];
+		materialOutVOs[0] = mo;
+			if(s1.getFbillflag()==3){
+				iMaterialOutMaintain.cancelSign(materialOutVOs);
+			}
+			iMaterialOutMaintain.delete(materialOutVOs);	
+	}
+
+}

+ 15 - 32
ic/ic/src/private/nc/bs/ic/impl/TransformAddImpl.java

@@ -80,14 +80,12 @@ public class TransformAddImpl extends BaseServlet implements IHttpServletAdaptor
 			transformheadvo.setCorpoid(json.getString("pk_org"));
 			transformheadvo.setCorpvid(SqlexecuteQuery2("pk_vid", "org_corp", "pk_corp", json.getString("pk_org")));
 			transformheadvo.setDbilldate(new UFDate(json.getString("dbilldate")));
-			transformheadvo.setCtrantypeid(SqlexecuteQuery("pk_billtypeid", "bd_billtype", "pk_billtypecode", json.getString("ctrantypeid")));
-			transformheadvo.setVtrantypecode(json.getString("ctrantypeid"));
+			transformheadvo.setCtrantypeid(json.getString("ctrantypeid"));
+			transformheadvo.setVtrantypecode(SqlexecuteQuery2("pk_billtypecode", "bd_billtype", "pk_billtypeid", json.getString("ctrantypeid")));
 			transformheadvo.setCreator(SqlexecuteQuery("cuserid", "sm_user", "user_code", json.getString("creator")));
 			transformheadvo.setCreationtime(new UFDateTime(json.getString("dbilldate")));
 			transformheadvo.setBillmaker(SqlexecuteQuery("cuserid", "sm_user", "user_code", json.getString("creator")));
 			transformheadvo.setDmakedate(new UFDate(json.getString("dbilldate")));
-			transformheadvo.setCdptid(json.getString("cdptid"));
-			transformheadvo.setCdptvid(SqlexecuteQuery2("pk_vid", "org_dept", "pk_dept", json.getString("cdptid")));
 			transformvo.setParentVO(transformheadvo);
 			
 			/**
@@ -106,18 +104,16 @@ public class TransformAddImpl extends BaseServlet implements IHttpServletAdaptor
 				transformbodyvo.setCorpoid(bodyObject.getString("pk_org"));
 				transformbodyvo.setCorpvid(SqlexecuteQuery2("pk_vid", "org_corp", "pk_corp", bodyObject.getString("pk_org")));
 				transformbodyvo.setCbodywarehouseid(bodyObject.getString("cbodywarehouseid"));
-				transformbodyvo.setCmaterialoid(SqlexecuteQuery2("pk_material", "bd_material", "code", bodyObject.getString("cmaterialoid")));
-				transformbodyvo.setCmaterialvid(SqlexecuteQuery2("pk_source", "bd_material", "code", bodyObject.getString("cmaterialoid")));
-				transformbodyvo.setCunitid(bodyObject.getString("cunitid"));
-				transformbodyvo.setCastunitid(bodyObject.getString("castunitid"));
-				transformbodyvo.setVchangerate(SqlexecuteQuery("measrate", "V_CD_VIEW_BD_MATERIAL_MEASDOC", "code", bodyObject.getString("cmaterialoid")));
+				transformbodyvo.setCmaterialoid(bodyObject.getString("cmaterialoid"));
+				transformbodyvo.setCmaterialvid(SqlexecuteQuery2("pk_source", "bd_material", "pk_material", bodyObject.getString("cmaterialoid")));
+				transformbodyvo.setCunitid(SqlexecuteQuery("pk_measdoc", "bd_measdoc", "code", bodyObject.getString("cunitid")));
+				transformbodyvo.setCastunitid(SqlexecuteQuery("pk_measdoc", "bd_measdoc", "code", bodyObject.getString("castunitid")));
+				transformbodyvo.setVchangerate(bodyObject.getString("vchangerate"));
 				transformbodyvo.setNnum(new UFDouble(bodyObject.getString("nnum")));
 				transformbodyvo.setNassistnum(new UFDouble(bodyObject.getString("nassistnum")));
-//				transformbodyvo.setNcostprice(new UFDouble(bodyObject.getString("ncostprice")));
-//				transformbodyvo.setNcostmny(new UFDouble(bodyObject.getString("ncostmny")));
-				if(bodyObject.getString("vbatchcode")!=null){
-					transformbodyvo.setVbatchcode(bodyObject.getString("vbatchcode"));
-				}
+				transformbodyvo.setNcostprice(new UFDouble(bodyObject.getString("ncostprice")));
+				transformbodyvo.setNcostmny(new UFDouble(bodyObject.getString("ncostmny")));
+				transformbodyvo.setVbatchcode(bodyObject.getString("vbatchcode"));
 				transformbodyvos[i] = transformbodyvo;
 				i++;
 			}
@@ -155,15 +151,12 @@ public class TransformAddImpl extends BaseServlet implements IHttpServletAdaptor
 		Boolean empty = true;
 		
 		String vbillcode = "vbillcode";//单据号
-		String pk_org = "pk_org";//组织编码
+		String group = "pk_group";//集团编码
 		String creator = "creator";//创建人
-		String dbilldate = "dbilldate";//单据日期
-		String ctrantypeid = "ctrantypeid";//转换类型
-		String cdptid = "cdptid";//部门
 		
 		String body = "cspecialbid";//表体
  
-		String[] HeadKey = {vbillcode,pk_org,creator,dbilldate,ctrantypeid,cdptid};
+		String[] HeadKey = {vbillcode,group,creator};
 		
 		for (String as : HeadKey) {
 
@@ -185,26 +178,16 @@ public class TransformAddImpl extends BaseServlet implements IHttpServletAdaptor
 		}
 		
 		String cmaterialoid = "cmaterialoid";//物料编码
-		String fbillrowflag = "fbillrowflag";//行状态
-		String pk_org_b = "pk_org";//组织
-		String cbodywarehouseid = "cbodywarehouseid";//仓库
-		String cunitid = "cunitid";//主单位
-		String castunitid = "castunitid";//辅单位
-//		String vchangerate = "vchangerate";//换算率
-		String nnum = "nnum";//主数量
-		String nassistnum = "nassistnum";//辅数量
-//		String ncostprice = "ncostprice";//单价
-//		String ncostmny = "ncostmny";//金额
-		
 		
 		for(int i = 0; i < oprepObjectBs.size(); i++) {
 			
 			JSONObject oprepJsonObjectB = oprepObjectBs.getJSONObject(i);
-			String[] BodyKey = {cmaterialoid,fbillrowflag,pk_org_b,cbodywarehouseid,cunitid,castunitid,nnum,nassistnum};
+			String[] BodyKey = {cmaterialoid};
 			int num = i+1;
 			
 			mags.append("第"+num+"块表体:{");
 			for (String as : BodyKey) {
+
 				if (oprepJsonObjectB.getString(as).isEmpty()) {
 					empty = false;
 					mags.append("'" + as + "' ");
@@ -242,7 +225,7 @@ public class TransformAddImpl extends BaseServlet implements IHttpServletAdaptor
 	
 	private String SqlexecuteQuery2(String out,String table,String key,String value) throws Exception {
 		
-		String sql = "select "+out+" from "+table+" where "+key+" = '"+value+"' and nvl(dr,0)=0 and enablestate = '2'";
+		String sql = "select "+out+" from "+table+" where "+key+" = '"+value+"' and nvl(dr,0)=0 and enablestate = '2' and pk_group = '0001V5100000000006BX'";
 		
 		Object object;
 		try {

+ 54 - 0
ic/ic/src/private/nc/bs/servlet/service/DeleteIcMaterialOutServlet.java

@@ -0,0 +1,54 @@
+package nc.bs.servlet.service;
+
+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.framework.adaptor.IHttpServletAdaptor;
+import nc.bs.framework.common.NCLocator;
+import nc.bs.framework.server.ISecurityTokenCallback;
+import nc.bs.ic.impl.DeleteIcMaterialOutImpl;
+import nc.bs.ic.impl.IDeleteIcMaterialOut;
+import nc.itf.uap.pf.IPFBusiAction;
+import nc.log.NcLog;
+import nc.pub.util.DataSourceUtil;
+import nc.vo.ic.m4d.entity.MaterialOutHeadVO;
+import nc.vo.pub.workflownote.WorkflownoteVO;
+import net.sf.json.JSONObject;
+
+public class DeleteIcMaterialOutServlet extends BaseServlet implements IHttpServletAdaptor{
+
+	@Override
+	public void doAction(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+		try {
+			//设置数据源
+			DataSourceUtil.setDataSource();
+			
+			String createStr = buildJson(req, resp, this.getClass().getName());
+			JSONObject json = JSONObject.fromObject(createStr);
+			NcLog.info("请求json:" + json);
+			ISecurityTokenCallback sc = (ISecurityTokenCallback) NCLocator.getInstance().lookup(ISecurityTokenCallback.class);
+			sc.token("NCSystem".getBytes(), "pfxx".getBytes());
+		
+			IDeleteIcMaterialOut iDeleteIcMaterialOut = new DeleteIcMaterialOutImpl();
+			iDeleteIcMaterialOut.DeleteIcMaterialOut_RequiresNew(json);
+			resp.getWriter().write(formatRSJsonData("0",STATUS_SUCCESS,"材料出库单删除成功!").toString());			
+			
+		} catch (Exception e) {
+			//前端控制台打印xml数据
+			resp.getWriter().write(formatRSJsonData("1",STATUS_FAILURE,e.getMessage()).toString());
+			StringWriter stringWriter = new StringWriter();
+			//e.printStackTrace(new PrintWriter(stringWriter));
+			e.printStackTrace();
+			//获取详细信息
+			String msg=stringWriter.getBuffer().toString();
+			NcLog.info("接口返回值提示:"+msg);
+		}
+   }
+	
+
+}

+ 9 - 0
ic/ic/src/public/nc/bs/ic/impl/IDeleteIcMaterialOut.java

@@ -0,0 +1,9 @@
+package nc.bs.ic.impl;
+
+import net.sf.json.JSONObject;
+
+public interface IDeleteIcMaterialOut {
+
+	void DeleteIcMaterialOut_RequiresNew(JSONObject json) throws Exception;
+
+}