质检报告修改接口
This commit is contained in:
parent
cdd49483ac
commit
4da31c1648
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding='gb2312'?>
|
||||
<module>
|
||||
<rest>
|
||||
<resource classname="nc.api.qc.resource.QcconclusionRestResource" exinfo="澗운데" />
|
||||
</rest>
|
||||
</module>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding='gb2312'?>
|
||||
<module displayname="qc" name="qc">
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
</module>
|
|
@ -0,0 +1,315 @@
|
|||
package nc.api.qc.resource;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.internal.LinkedTreeMap;
|
||||
import nc.api.arap.util.ArapAPIUtil;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.logging.Logger;
|
||||
import nc.itf.arap.fieldmap.IBillFieldGet;
|
||||
import nc.itf.arap.pub.IArapBillService;
|
||||
import nc.vo.arap.basebill.BaseAggVO;
|
||||
import nc.vo.arap.openapi.ArapBillOpenApiVO;
|
||||
import nc.vo.arap.openapi.ArapF0EstiOpenApiVO;
|
||||
import nc.vo.arap.openapi.ArapF1EstiOpenApiVO;
|
||||
import nc.vo.arap.verify.ArapVerifyVO;
|
||||
import nc.vo.ml.NCLangRes4VoTransl;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.BusinessRuntimeException;
|
||||
import nc.vo.pub.lang.UFBoolean;
|
||||
import nc.vo.pub.lang.UFDate;
|
||||
import nc.vo.pub.lang.UFDouble;
|
||||
import nccloud.api.rest.utils.NCCRestUtils;
|
||||
import nccloud.api.rest.utils.ResultMessageUtil;
|
||||
import nccloud.impl.platform.common.util.StringUtils;
|
||||
import nccloud.pubitf.arap.openapi.IARAPOpenAPIService;
|
||||
import nccloud.pubitf.arap.openapi.IBillOpenService;
|
||||
import nccloud.ws.rest.resource.AbstractNCCRestResource;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.json.JSONString;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class QcBaseRestResource extends AbstractNCCRestResource {
|
||||
public String getModule() {
|
||||
return "qc";
|
||||
}
|
||||
|
||||
protected <T> T fromJson(String json, Type clazz) {
|
||||
return (T) (new Gson()).fromJson(json, clazz);
|
||||
}
|
||||
|
||||
public BaseAggVO fromJsonToAggVO(String json, String billtype) {
|
||||
ArapBillOpenApiVO apivo = (ArapBillOpenApiVO) fromJson(json, ArapBillOpenApiVO.class);
|
||||
return apivo.toAggVO(billtype);
|
||||
}
|
||||
|
||||
public ArapF1EstiOpenApiVO fromJsonToAggVOForSP(String json, String billtype) {
|
||||
return (ArapF1EstiOpenApiVO) fromJson(json, ArapF1EstiOpenApiVO.class);
|
||||
}
|
||||
|
||||
public ArapF0EstiOpenApiVO fromJsonToF0AggVOForSP(String json, String billtype) {
|
||||
return (ArapF0EstiOpenApiVO) fromJson(json, ArapF0EstiOpenApiVO.class);
|
||||
}
|
||||
|
||||
public ArapVerifyVO fromJsonToArapVerifyVO(String json) {
|
||||
return (ArapVerifyVO) fromJson(json, ArapVerifyVO.class);
|
||||
}
|
||||
|
||||
public JSONString unCommitAndDelBill(JSONString str, String keyItem, String pk_billtype) throws BusinessException {
|
||||
NCCRestUtils.initInvocationInfo();
|
||||
String json = str.toJSONString();
|
||||
Map<String, String> billMap = (Map) fromJson(json, Map.class);
|
||||
String[] pk_bills = null;
|
||||
IBillOpenService service = (IBillOpenService) NCLocator.getInstance()
|
||||
.lookup(ArapAPIUtil.getClassName(pk_billtype));
|
||||
if (StringUtils.isEmpty((String) billMap.get(keyItem))) {
|
||||
try {
|
||||
List<String> returnMap = service.getPkBySrc(billMap);
|
||||
if (returnMap == null) {
|
||||
return ResultMessageUtil.exceptionToJSON(
|
||||
NCLangRes4VoTransl.getNCLangRes().getStrByID("2006pub_0", "02006pub-0970"), "filed");
|
||||
}
|
||||
|
||||
pk_bills = (String[]) returnMap.toArray(new String[returnMap.size()]);
|
||||
} catch (Exception e) {
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
}
|
||||
} else {
|
||||
String pk_bill = (String) billMap.get(keyItem);
|
||||
pk_bills = pk_bill.split(",");
|
||||
}
|
||||
|
||||
try {
|
||||
UFBoolean[] checkHasFlowBills = new UFBoolean[0];
|
||||
IArapBillService sservice = (IArapBillService) NCLocator.getInstance().lookup(IArapBillService.class);
|
||||
checkHasFlowBills = sservice.checkHasFlowBills(pk_bills, pk_billtype);
|
||||
if (!ArrayUtils.isEmpty(checkHasFlowBills) && checkHasFlowBills[0].booleanValue()) {
|
||||
String mess = NCLangRes4VoTransl.getNCLangRes().getStrByID("2006pub_0", "02006pub-1680");
|
||||
throw new BusinessException(mess);
|
||||
}
|
||||
|
||||
Map<String, Object> returnMap = service.unCommitAndDelBill(pk_bills);
|
||||
if (returnMap == null) {
|
||||
return ResultMessageUtil.exceptionToJSON(
|
||||
NCLangRes4VoTransl.getNCLangRes().getStrByID("2006pub_0", "02006pub-0970"), "filed");
|
||||
}
|
||||
|
||||
return ResultMessageUtil.toJSON(returnMap);
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected JSONString queryBill(JSONString str, String pk_billtype) {
|
||||
NCCRestUtils.initInvocationInfo();
|
||||
String json = str.toJSONString();
|
||||
Map<String, String> conditionMap = (Map) fromJson(json, Map.class);
|
||||
try {
|
||||
IBillOpenService service = (IBillOpenService) NCLocator.getInstance()
|
||||
.lookup(ArapAPIUtil.getClassName(pk_billtype));
|
||||
List<Map<String, Object>> bills = service.queryBill(conditionMap);
|
||||
if (CollectionUtils.isEmpty(bills)) {
|
||||
bills = new ArrayList<Map<String, Object>>();
|
||||
}
|
||||
return ResultMessageUtil.toJSON(bills);
|
||||
} catch (Exception e) {
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected JSONString updateBill(JSONString str, String pk_billtype) {
|
||||
NCCRestUtils.initInvocationInfo();
|
||||
String json = str.toJSONString();
|
||||
Map<String, Object> billMap = (Map) fromJson(json, Map.class);
|
||||
|
||||
try {
|
||||
IBillOpenService service = (IBillOpenService) NCLocator.getInstance()
|
||||
.lookup(ArapAPIUtil.getClassName(pk_billtype));
|
||||
Map<String, String> returnMap = service.updateBill(billMap);
|
||||
return ResultMessageUtil.toJSON(returnMap);
|
||||
} catch (Exception e) {
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
}
|
||||
}
|
||||
|
||||
public JSONString deleteBill(JSONString str, String keyItem, String pk_billtype) throws BusinessException {
|
||||
NCCRestUtils.initInvocationInfo();
|
||||
String json = str.toJSONString();
|
||||
Map<String, String> billMap = (Map) fromJson(json, Map.class);
|
||||
String[] pk_bills = null;
|
||||
if (StringUtils.isEmpty((String) billMap.get(keyItem))) {
|
||||
try {
|
||||
IBillOpenService service = (IBillOpenService) NCLocator.getInstance()
|
||||
.lookup(ArapAPIUtil.getClassName(pk_billtype));
|
||||
List<String> returnMap = service.getPkBySrc(billMap);
|
||||
if (returnMap == null) {
|
||||
return ResultMessageUtil.exceptionToJSON(
|
||||
NCLangRes4VoTransl.getNCLangRes().getStrByID("2006pub_0", "02006pub-0970"), "filed");
|
||||
}
|
||||
|
||||
pk_bills = (String[]) returnMap.toArray(new String[returnMap.size()]);
|
||||
} catch (Exception e) {
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
}
|
||||
} else {
|
||||
String pk_recbill = (String) billMap.get(keyItem);
|
||||
pk_bills = pk_recbill.split(",");
|
||||
}
|
||||
|
||||
try {
|
||||
IArapBillService service = (IArapBillService) NCLocator.getInstance().lookup(IArapBillService.class);
|
||||
BaseAggVO[] bills = service.queryArapBillByPKs(pk_bills, pk_billtype);
|
||||
if (ArrayUtils.isEmpty(bills)) {
|
||||
return ResultMessageUtil.exceptionToJSON(
|
||||
NCLangRes4VoTransl.getNCLangRes().getStrByID("2006pub_0", "02006pub-0970"), "filed");
|
||||
}
|
||||
|
||||
for (BaseAggVO aggVo : bills) {
|
||||
aggVo.getParentVO().setAttributeValue("operate", "API");
|
||||
}
|
||||
((IARAPOpenAPIService) NCLocator.getInstance().lookup(IARAPOpenAPIService.class)).executeBatchPM("DELETE",
|
||||
bills);
|
||||
Map<String, String> returnMap = new HashMap<String, String>();
|
||||
returnMap.put("successful", "Y");
|
||||
return ResultMessageUtil.toJSON(returnMap);
|
||||
} catch (Exception e) {
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected JSONString isclose(Map<String, String> conditionMap, String moduleID) {
|
||||
if (conditionMap == null || conditionMap.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
NCCRestUtils.initInvocationInfo();
|
||||
|
||||
try {
|
||||
Map<String, String> res = ((IARAPOpenAPIService) NCLocator.getInstance().lookup(IARAPOpenAPIService.class))
|
||||
.queryIscloseOrIsendaccStatus(conditionMap, moduleID);
|
||||
return ResultMessageUtil.toJSON(res);
|
||||
} catch (Exception e) {
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected JSONString commitBill(JSONString str, String keyItem, String pk_billtype) throws BusinessException {
|
||||
return commitUnCommitBill(str, keyItem, pk_billtype, "COMMIT");
|
||||
}
|
||||
|
||||
protected JSONString unCommitBill(JSONString str, String keyItem, String pk_billtype) throws BusinessException {
|
||||
return commitUnCommitBill(str, keyItem, pk_billtype, "UNCOMMIT");
|
||||
}
|
||||
|
||||
private JSONString commitUnCommitBill(JSONString str, String keyItem, String pk_billtype, String actioncode) {
|
||||
NCCRestUtils.initInvocationInfo();
|
||||
String json = str.toJSONString();
|
||||
Map<String, String> billMap = (Map) fromJson(json, Map.class);
|
||||
String[] pk_bills = null;
|
||||
if (StringUtils.isEmpty((String) billMap.get(keyItem))) {
|
||||
try {
|
||||
List<String> returnMap = ((IBillOpenService) NCLocator.getInstance().lookup(IBillOpenService.class))
|
||||
.getPkBySrc(billMap);
|
||||
|
||||
if (returnMap == null) {
|
||||
return ResultMessageUtil.exceptionToJSON(
|
||||
NCLangRes4VoTransl.getNCLangRes().getStrByID("2006pub_0", "02006pub-0970"), "filed");
|
||||
}
|
||||
pk_bills = (String[]) returnMap.toArray(new String[returnMap.size()]);
|
||||
} catch (Exception e) {
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
}
|
||||
} else {
|
||||
String pk_bill = (String) billMap.get(keyItem);
|
||||
pk_bills = pk_bill.split(",");
|
||||
}
|
||||
try {
|
||||
Map<String, Object> returnMap = ((IARAPOpenAPIService) NCLocator.getInstance()
|
||||
.lookup(IARAPOpenAPIService.class)).doBatchCommit(pk_bills, pk_billtype, actioncode);
|
||||
if (Integer.parseInt(returnMap.get("failNum").toString()) == 0) {
|
||||
return ResultMessageUtil.toJSON(returnMap.get("message"));
|
||||
}
|
||||
if (Integer.parseInt(returnMap.get("successNum").toString()) == 0) {
|
||||
return ResultMessageUtil.exceptionToJSON((String) returnMap.get("message"), "false");
|
||||
}
|
||||
return ResultMessageUtil.toJSON(returnMap.get("message"));
|
||||
} catch (Exception e) {
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换Map为VO
|
||||
*/
|
||||
public static Object fromJsonToVO(Map<?, ?> map, Type t) {
|
||||
Object obj = null;
|
||||
Class<?> clazz = (Class<?>) t;
|
||||
try {
|
||||
obj = clazz.newInstance();
|
||||
Method[] methods = clazz.getMethods();
|
||||
if (methods != null) {
|
||||
for (Method method : methods) {
|
||||
if (method.getName().startsWith("set")) {// set方法
|
||||
String key = (method.getName().replace("set", "")).toLowerCase();
|
||||
Object value = map.get(key);
|
||||
// 说明文档里。收款银行账户,付款银行账户字段拼接了ap或ar,导致此处可能获取不到值
|
||||
if (value == null && (IBillFieldGet.PAYACCOUNT.equals(key)
|
||||
|| IBillFieldGet.RECACCOUNT.equals(key) || IBillFieldGet.PK_PAYTERM.equals(key))) {
|
||||
List<LinkedTreeMap<String, Object>> link = (List<LinkedTreeMap<String, Object>>) map
|
||||
.get("items");
|
||||
if (CollectionUtils.isEmpty(link)) {
|
||||
String oldkey = key;
|
||||
key = "ap_" + key;
|
||||
if (map.get(key) == null) {
|
||||
key = "ar_" + oldkey;
|
||||
}
|
||||
value = map.get(key);
|
||||
} else {
|
||||
LinkedTreeMap<String, Object> linkedMap = link.get(0);
|
||||
String oldkey = key;
|
||||
key = "ap_" + key;
|
||||
if (linkedMap.get(key) == null) {
|
||||
key = "ar_" + oldkey;
|
||||
}
|
||||
value = linkedMap.get(key);
|
||||
}
|
||||
|
||||
}
|
||||
if (value == null || StringUtils.isEmpty(value.toString()))
|
||||
continue;
|
||||
|
||||
Class<?>[] parameterTypes = method.getParameterTypes();
|
||||
if (IBillFieldGet.PREPAY.equals(key)) {
|
||||
method.invoke(obj,
|
||||
(NCLangRes4VoTransl.getNCLangRes().getStrByID("2006pub_0", "02006pub-0997")
|
||||
/* @res "预付款" */.equals(value)
|
||||
|| NCLangRes4VoTransl.getNCLangRes()
|
||||
.getStrByID("2006pub_0", "02006pub-0388")
|
||||
/* @res "预收款" */.equals(value)) ? 1 : 0);
|
||||
} else if (parameterTypes[0] == UFBoolean.class) {
|
||||
method.invoke(obj, UFBoolean.valueOf(value.toString()));
|
||||
} else if (parameterTypes[0] == UFDouble.class) {
|
||||
method.invoke(obj, new UFDouble(value.toString()));
|
||||
} else if (parameterTypes[0] == Integer.class) {
|
||||
method.invoke(obj, new Integer(value.toString()));
|
||||
} else if (parameterTypes[0] == UFDate.class) {
|
||||
method.invoke(obj, new UFDate(value.toString()));
|
||||
} else {
|
||||
method.invoke(obj, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.getMessage(), e);
|
||||
throw new BusinessRuntimeException(e.getMessage());
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,182 @@
|
|||
package nc.api.qc.resource;
|
||||
|
||||
import nc.bs.framework.common.InvocationInfoProxy;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.trade.business.HYSuperDMO;
|
||||
import nc.impl.qc.c003.maintain.ReportMaintainImpl;
|
||||
import nc.itf.qc.c003.maintain.IReportMaintain;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.VOStatus;
|
||||
import nc.vo.pub.lang.UFDouble;
|
||||
import nc.vo.pubapp.pattern.model.transfer.bill.ClientBillCombinServer;
|
||||
import nc.vo.qc.c003.entity.ReportItemVO;
|
||||
import nc.vo.qc.c003.entity.ReportVO;
|
||||
import nc.vo.qc.c003.util.ReportVOInfoUtils;
|
||||
import nc.vo.scmpub.res.billtype.QCBillType;
|
||||
import nc.vo.scmpub.util.ArrayUtil;
|
||||
import nc.vo.scmpub.util.CollectionUtils;
|
||||
import nccloud.api.rest.utils.NCCRestUtils;
|
||||
import nccloud.api.rest.utils.ResultMessageUtil;
|
||||
import nccloud.base.exception.ExceptionUtils;
|
||||
import nccloud.framework.service.ServiceLocator;
|
||||
import nccloud.pubitf.arap.arappub.IArapBillPubUtilService;
|
||||
import nccloud.pubitf.riart.pflow.CloudPFlowContext;
|
||||
import nccloud.pubitf.riart.pflow.ICloudScriptPFlowService;
|
||||
import nccloud.pubitf.scmpub.pub.service.ISCMPubQueryService;
|
||||
import org.json.JSONString;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* QMS将检验结果回传至ERP质检报告中
|
||||
*/
|
||||
@Path("qc/qcconclusion")
|
||||
public class QcconclusionRestResource extends QcBaseRestResource {
|
||||
|
||||
HYSuperDMO dmo = null;
|
||||
|
||||
public HYSuperDMO getSuperDMO() {
|
||||
if (dmo == null) {
|
||||
dmo = new HYSuperDMO();
|
||||
}
|
||||
return dmo;
|
||||
}
|
||||
|
||||
/**
|
||||
* QMS将检验结果回传至ERP质检报告中
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
|
||||
@POST
|
||||
@Path("/updateByqms")
|
||||
@Consumes({"application/json"})
|
||||
@Produces({"application/json"})
|
||||
public JSONString updateByqms(JSONString str) throws BusinessException {
|
||||
InvocationInfoProxy.getInstance().setGroupId("0001A110000000000677");
|
||||
NCCRestUtils.initInvocationInfo();
|
||||
String json = str.toJSONString();
|
||||
Map<String, Object> billMap = (Map) fromJson(json, Map.class);
|
||||
// List<ReportVO> list = (List<ReportVO>) billMap.get("list");
|
||||
//获取全部质检报告
|
||||
List<Map<String, Object>> itemMaps = (List) billMap.get("items");
|
||||
List<String> list=new ArrayList<String>();
|
||||
for (Map<String, Object> itemMap : itemMaps) {
|
||||
list.add((String) itemMap.get("id"));
|
||||
}
|
||||
ReportVO[] vos = (ReportVO[])((ISCMPubQueryService) NCLocator.getInstance().lookup(ISCMPubQueryService.class)).billquery(ReportVO.class, list.toArray(new String[list.size()]));
|
||||
// 1. 创建新数组(长度与原数组一致)
|
||||
ReportVO[] updatevos = new ReportVO[vos.length];
|
||||
|
||||
// 2. 遍历原数组,对每个元素进行深度克隆
|
||||
for (int i = 0; i < vos.length; i++) {
|
||||
if (vos[i] != null) {
|
||||
// 假设ReportVO重写了clone()方法,实现深度克隆
|
||||
updatevos[i] = (ReportVO) vos[i].clone();
|
||||
}
|
||||
}
|
||||
for (ReportVO vo : vos) {
|
||||
for (Map<String, Object> itemMap : itemMaps) {
|
||||
if(itemMap.get("id").equals(vo.getHVO().getPk_reportbill())){
|
||||
//nchecknum 检验主数量
|
||||
//ncheckastnum 检验数量
|
||||
//neliginum 合格主数量
|
||||
//neligiastnum 合格数量
|
||||
//nuneliginum 不合格主数量
|
||||
//nuneligiastnum 不合格数量
|
||||
vo.getHVO().setStatus(VOStatus.UPDATED);
|
||||
// 检验主数量
|
||||
vo.getHVO().setNchecknum(new UFDouble((Double)itemMap.get("nchecknum")));
|
||||
// 检验数量
|
||||
vo.getHVO().setNcheckastnum(new UFDouble((Double) itemMap.get("ncheckastnum")));
|
||||
// 合格主数量
|
||||
vo.getHVO().setNeliginum(new UFDouble((Double) itemMap.get("neliginum")));
|
||||
// 合格数量
|
||||
vo.getHVO().setNeligiastnum(new UFDouble((Double)itemMap.get("neligiastnum")));
|
||||
// 不合格主数量
|
||||
vo.getHVO().setNuneliginum(new UFDouble((Double) itemMap.get("nuneliginum")));
|
||||
// 不合格数量
|
||||
vo.getHVO().setNuneligiastnum(new UFDouble((Double)itemMap.get("nuneligiastnum")));
|
||||
this.appendPseudoColumn(vo);
|
||||
List<Map<String, Object>> mapList = (List<Map<String, Object>>) itemMap.get("children");
|
||||
if(!mapList.isEmpty()){
|
||||
for (int i = 0; i < vo.getBVO().length; i++) {
|
||||
for (Map<String, Object> childMap : mapList) {
|
||||
if(vo.getBVO()[i].getCrowno().equals(childMap.get("crowno"))){
|
||||
vo.getBVO()[i].setNnum(new UFDouble((Double)childMap.get("nnum")));
|
||||
vo.getBVO()[i].setFprocessjudge(((Double)childMap.get("fprocessjudge")).intValue());
|
||||
vo.getBVO()[i].setStatus(VOStatus.UPDATED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// this.doSaveAndCombine(vos);
|
||||
IReportMaintain reportMaintain=((IReportMaintain) NCLocator.getInstance().lookup(IReportMaintain.class));
|
||||
ReportVO[] resultVos= reportMaintain.saveBase(vos,new Object(),updatevos);
|
||||
//质检报告更新
|
||||
Map<String, Object> returnMap = new HashMap<String, Object>();
|
||||
returnMap.put("data", resultVos);
|
||||
returnMap.put("success", true);
|
||||
return ResultMessageUtil.toJSON(returnMap);
|
||||
}
|
||||
|
||||
private void doSaveAndCombine(ReportVO[] billVos) {
|
||||
CloudPFlowContext context = new CloudPFlowContext();
|
||||
context.setBillType(QCBillType.ReportBill.getCode());
|
||||
context.setTrantype(billVos[0].getHVO().getVtrantypecode());
|
||||
context.setBillVos(billVos);
|
||||
context.setActionName("SAVEBASE");
|
||||
ICloudScriptPFlowService service = (ICloudScriptPFlowService) NCLocator.getInstance().lookup(ICloudScriptPFlowService.class);
|
||||
ReportVO[] retVOs = null;
|
||||
try {
|
||||
Object ret = service.exeScriptPFlow(context);
|
||||
if (ret instanceof ReportVO[]) {
|
||||
retVOs = (ReportVO[]) ret;
|
||||
} else {
|
||||
retVOs = (ReportVO[]) ((Object[]) ret)[0];
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionUtils.wrapException(e);
|
||||
}
|
||||
if (!ArrayUtil.isEmpty(retVOs)) {
|
||||
ClientBillCombinServer<ReportVO> util = new ClientBillCombinServer();
|
||||
this.processDelBody(billVos);
|
||||
util.combine(billVos, retVOs);
|
||||
retVOs = ReportVOInfoUtils.synchBatchCodeData(billVos);
|
||||
}
|
||||
|
||||
}
|
||||
private void processDelBody(ReportVO[] vos) {
|
||||
ReportItemVO[] bodys = vos[0].getBVO();
|
||||
List<ReportItemVO> realbody = new ArrayList();
|
||||
|
||||
for(ReportItemVO body : bodys) {
|
||||
if (body.getStatus() != 3) {
|
||||
realbody.add(body);
|
||||
}
|
||||
}
|
||||
|
||||
vos[0].setBVO((ReportItemVO[]) CollectionUtils.listToArray(realbody));
|
||||
}
|
||||
private void appendPseudoColumn(ReportVO vo) {
|
||||
ReportItemVO[] bodyvos = vo.getBVO();
|
||||
if (bodyvos != null && bodyvos.length > 0) {
|
||||
for(int i = 0; i < bodyvos.length; ++i) {
|
||||
bodyvos[i].setAttributeValue("pseudocolumn", i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue