This commit is contained in:
hefengkai 2024-10-18 09:18:39 +08:00
parent cdecf6a25c
commit 7957bb46b4
6 changed files with 251 additions and 0 deletions

View File

@ -0,0 +1,46 @@
package nc.bs.pub.action;
import java.util.Hashtable;
import nc.bs.framework.common.NCLocator;
import nc.bs.pub.compiler.AbstractCompiler2;
import nc.itf.ic.m45.self.IPurchaseInMaintain;
import nc.pubitf.ic.egap.INCCForEGAPIntf;
import nc.vo.ic.m45.entity.PurchaseInVO;
import nc.vo.ml.NCLangRes4VoTransl;
import nc.vo.pub.BusinessException;
import nc.vo.pub.compiler.PfParameterVO;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
public class N_45_CANCELSIGN extends AbstractCompiler2 {
private Hashtable m_methodReturnHas = new Hashtable();
private Hashtable m_keyHas = null;
public Object runComClass(PfParameterVO vo) throws BusinessException {
try {
super.m_tmpVo = vo;
PurchaseInVO[] inVOs = (PurchaseInVO[]) ((PurchaseInVO[]) this.getVos());
inVOs=((IPurchaseInMaintain) NCLocator.getInstance().lookup(IPurchaseInMaintain.class)).cancelSign(inVOs);
((INCCForEGAPIntf)NCLocator.getInstance().lookup(INCCForEGAPIntf.class)).unSign45(inVOs[0]);
return inVOs;
} catch (Exception var3) {
ExceptionUtils.marsh(var3);
return null;
}
}
public String getCodeRemark() {
return NCLangRes4VoTransl.getNCLangRes().getStrByID("4008002_0", "04008002-0076");
}
private void setParameter(String key, Object val) {
if (this.m_keyHas == null) {
this.m_keyHas = new Hashtable();
}
if (val != null) {
this.m_keyHas.put(key, val);
}
}
}

View File

@ -0,0 +1,68 @@
/* */ package nc.bs.pub.action;
/* */
/* */ import java.util.Hashtable;
/* */ import nc.bs.framework.common.NCLocator;
/* */ import nc.bs.pub.compiler.AbstractCompiler2;
/* */ import nc.itf.ic.m45.self.IPurchaseInMaintain;
import nc.pubitf.ic.egap.INCCForEGAPIntf;
/* */ import nc.vo.ic.m45.entity.PurchaseInVO;
/* */ import nc.vo.ml.NCLangRes4VoTransl;
/* */ import nc.vo.pub.BusinessException;
/* */ import nc.vo.pub.compiler.PfParameterVO;
/* */ import nc.vo.pubapp.pattern.exception.ExceptionUtils;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class N_45_SIGN extends AbstractCompiler2 {
/* */ private Hashtable m_methodReturnHas = new Hashtable();
/* */ private Hashtable m_keyHas = null;
/* */
/* */ public Object runComClass(PfParameterVO vo) throws BusinessException {
/* */ try {
/* 31 */ super.m_tmpVo = vo;
/* */
/* 33 */ PurchaseInVO[] inVOs = (PurchaseInVO[])((PurchaseInVO[])this.getVos());
/* */
/* */
/* 36 */ inVOs = ((IPurchaseInMaintain)NCLocator.getInstance().lookup(IPurchaseInMaintain.class)).sign(inVOs);
/* */
((INCCForEGAPIntf)NCLocator.getInstance().lookup(INCCForEGAPIntf.class)).sign45(inVOs[0]);
/* */
/* 40 */ return inVOs;
/* */
/* 42 */ } catch (Exception var3) {
/* 43 */ ExceptionUtils.marsh(var3);
/* */
/* 45 */ return null;
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */ public String getCodeRemark() {
/* 53 */ return NCLangRes4VoTransl.getNCLangRes().getStrByID("4008002_0", "04008002-0076");
/* */ }
/* */
/* */
/* */
/* */
/* */ private void setParameter(String key, Object val) {
/* 60 */ if (this.m_keyHas == null) {
/* 61 */ this.m_keyHas = new Hashtable();
/* */ }
/* 63 */ if (val != null) {
/* 64 */ this.m_keyHas.put(key, val);
/* */ }
/* 66 */ }
/* */ }

View File

@ -0,0 +1,137 @@
package nc.bs.pub.egap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import nc.bd.itf.tools.EGAPParam;
import nc.bs.dao.BaseDAO;
import nc.bs.framework.common.NCLocator;
import nc.vo.ic.m45.entity.PurchaseInVO;
import nc.vo.pub.BusinessException;
import nc.jdbc.framework.processor.*;
import nc.pubitf.ic.egap.INCCForEGAPIntf;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
public class EGAPGenJsonBO {
public BaseDAO dao=null;
public BaseDAO getDao() {
if(dao==null) {
dao=new BaseDAO();
}
return dao;
}
public INCCForEGAPIntf iNCCForEGAPIntf =null;
public INCCForEGAPIntf getiNCCForEGAPIntf() {
if(iNCCForEGAPIntf == null) {
iNCCForEGAPIntf = (INCCForEGAPIntf)NCLocator.getInstance().lookup(INCCForEGAPIntf.class.getName());
}
return iNCCForEGAPIntf;
}
public void gen45JsonForSign(PurchaseInVO inVOs) throws BusinessException {
// {
// "token":"D6467205-7A71-4CF6-BD8C-3F9968BF0826",
// "podata":{
// "bill":{
// "erpid":"testfid002",
// "ccompany":"华丰安丘公司",
// "cincode":"RK20240307005",
// "copname":"李金剑",
// "cwhcode":"",
// "cwhname":"",
// "ddate":"2024-09-18 00:00:00",
// "cvencode":"",
// "cvenname":"",
// "cremark":""
// },
// "billdetail":[{
// "cinvcode":"14030096",
// "cinvenginnerno":"14030096",
// "cinvname":"滤清器",
// "cinvstd":"V-0.3/7",
// "cunit":"",
// "isnullin":"0",
// "iqty":"50",
// "cbatchcode":"",
// "cqualityinfo":"合格",
// "cnote":"",
// "cerpsubid":"test37811",
// "cordercode":"",
// "cfcode":""
// }]
// }
// }
//主表
String sql=" select h.vbillcode cincode,org.name ccompany,psn.name copname,ck.code cwhcode,ck.name cwhname, " +
" h.dbilldate ddate,gys.name cvenname,gys.code cvencode,h.cgeneralhid erpid,h.vnote cremark " +
" from ic_purchasein_h h " +
" left join org_purchaseorg org on h.cpurorgoid=org.pk_purchaseorg " +
" left join bd_psndoc psn on psn.pk_psndoc=h.cbizid " +
" left join bd_stordoc ck on ck.pk_stordoc=h.cwarehouseid " +
" left join bd_supplier gys on gys.pk_supplier=h.cvendorid " +
" where h.cgeneralhid='"+inVOs.getParentVO().getCgeneralhid()+"' ";
HashMap<String,Object> lists=(HashMap<String, Object>) getDao().executeQuery(sql, new MapProcessor());
JSONObject hojson=new JSONObject();
hojson.put("token", EGAPParam.EGAPTOKEN);
JSONObject ohjson=new JSONObject();
JSONObject ojson=new JSONObject();
Iterator<Entry<String, Object>> iterator = lists.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, Object> entry = iterator.next();
ojson.put(entry.getKey(), entry.getValue());
}
ohjson.put("bill", ojson);
hojson.put("podata", ohjson);
//子表
sql=" select b.cgeneralbid cerpsubid,wl.code cinvcode,wl.name cinvname,wl.code cinvenginnerno " +
",wl.materialspec cinvstd,mes.code cunit,b.nassistnum iqty " +
",case when b.cvmivenderid <> '~' then 1 else 0 end as isnullin, b.vbatchcode cbatchcode,b.vnotebody cnote,b.vfirstbillcode cordercode,b.vsourcebillcode cfcode " +
" from ic_purchasein_b b " +
"inner join bd_material wl on b.cmaterialoid=wl.pk_material " +
"inner join bd_measdoc mes on wl.pk_measdoc=mes.pk_measdoc " +
"where " +
" b.cgeneralhid='"+inVOs.getParentVO().getCgeneralhid()+"' and b.dr=0 ";
JSONArray arraj=new JSONArray();
ArrayList<HashMap<String,Object>> blists=(ArrayList<HashMap<String, Object>>) getDao().executeQuery(sql, new MapListProcessor());
if(lists!=null&&lists.size()>0) {
for (HashMap<String,Object> map:blists) {
Iterator<Entry<String, Object>> biterator = map.entrySet().iterator();
JSONObject bojson=new JSONObject();
while (biterator.hasNext()) {
Entry<String, Object> entry = biterator.next();
bojson.put(entry.getKey(), entry.getValue());
}
arraj.add(bojson);
}
}
ohjson.put("billdetail", arraj);
getiNCCForEGAPIntf().sendEGAP(hojson.toJSONString(), EGAPParam.HFNCCINF036, inVOs.getPrimaryKey());
}
public void gen45JsonForUnSign(PurchaseInVO inVOs) throws BusinessException {
// {
// "token":"D6467205-7A71-4CF6-BD8C-3F9968BF0826",
// "ERPID":""
// }
JSONObject ojson=new JSONObject();
ojson.put("token", EGAPParam.EGAPTOKEN);
ojson.put("ERPID", inVOs.getPrimaryKey());
getiNCCForEGAPIntf().sendEGAP(ojson.toJSONString(), EGAPParam.HFNCCINF037, inVOs.getPrimaryKey());
}
}