- 测试问题优化

--s
This commit is contained in:
weiyunlong 2025-04-22 17:11:57 +08:00
parent 0ebf38acfb
commit bb09ef009f
8 changed files with 47 additions and 32 deletions

View File

@ -105,19 +105,14 @@ public class SappzFormPlugin extends AbstractFormPlugin {
if (null != data && data.containsKey("IT_ITEM")) {
JSONArray IT_ITEMs = (JSONArray) data.get("IT_ITEM");
if (!IT_ITEMs.isEmpty()) {
// int size = IT_ITEMs.size();
// if (IT_ITEMs.size() > 5000) {
// size = 5000;
// }
for (int i = 0; i < IT_ITEMs.size(); i++) {
// for (int i = 0; i < IT_ITEMs.size(); i++) {
JSONObject it_list = (JSONObject) IT_ITEMs.get(i);
DynamicObject add = shjhEntryentity.addNew();
this.getModel().setValue("shjh_orgnumber", it_list.getString("BUKRS"), i);//公司编号,"公司代码
this.getModel().setValue("shjh_vouchernumber", it_list.getString("BELNR"), i);//凭证号,会计凭证编号
this.getModel().setValue("shjh_accountingyear", it_list.getString("GJAHR"), i);//会计年度,会计年度
this.getModel().setValue("shjh_accountingsubject", it_list.getString("SAKNR"), i);//会计科目:1001,总帐科目编号
this.getModel().setValue("shjh_accountingsubjecline", it_list.getString("EBELP"), i);//会计科目行项目号,采购凭证的项目编号
this.getModel().setValue("shjh_accountingsubjecline", it_list.getString("BUZEI"), i);//会计科目行项目号,编号
this.getModel().setValue("shjh_outstandingamount", new BigDecimal(it_list.getString("WRBTR")), i);//未清金额,凭证货币金额
BigDecimal KURSF = new BigDecimal(it_list.getString("KURSF"));
if (KURSF.compareTo(BigDecimal.ZERO) == 0) {
@ -195,7 +190,6 @@ public class SappzFormPlugin extends AbstractFormPlugin {
this.getModel().setValue("shjh_paymenttype", "自动扣款", i);//付款方式
break;
}
this.getModel().setValue("shjh_paymenttypenumber", it_list.getString("ZLSCH"), i);//付款方式
String uuid = it_list.getString("XBLNR");
this.getModel().setValue("shjh_uuid", uuid, i);//单据号
/**
@ -265,6 +259,13 @@ public class SappzFormPlugin extends AbstractFormPlugin {
}else {
log.error("费控单据编号解析类型失败:动态表单拉取SAP");
}
String BLART = it_list.getString("BLART");
this.getModel().setValue("shjh_billtype", BLART, i);//凭证类型(文本)
DynamicObject vouchertype = BusinessDataServiceHelper.loadSingle("gl_vouchertype",
new QFilter[]{new QFilter("number", QCP.equals, BLART)});
if (null != vouchertype) {
this.getModel().setValue("shjh_pztype", vouchertype, i);//凭证类型
}
}
@ -287,7 +288,6 @@ public class SappzFormPlugin extends AbstractFormPlugin {
for (int selectRow : selectRows) {
String fkBillNum = (String) this.getModel().getValue("shjh_vouchernumber", selectRow);//凭证号
// 公司编号
String companyNum = (String) this.getModel().getValue("shjh_orgnumber", selectRow);//公司编号
if (companyNum == null || companyNum.isEmpty()) {
@ -578,6 +578,10 @@ public class SappzFormPlugin extends AbstractFormPlugin {
ap_payapply.set("shjh_voucherentrynum", voucherentrynum);
//SAP应付凭证会计年度
ap_payapply.set("shjh_voucheryear", voucheryear);
//凭证类型
DynamicObject shjh_pztype = (DynamicObject) this.getModel().getValue("shjh_pztype", selectRow);
ap_payapply.set("shjh_documenttype", shjh_pztype);
//SAP凭证来源
//单据号
String uuid = (String) this.getModel().getValue("shjh_uuid", selectRow);
QFilter qq1 = new QFilter("number", QCP.equals, "JH001");//对公

View File

@ -92,7 +92,7 @@ public class ScheduleListPlugin extends AbstractListPlugin {
jsonObject.put("bukrs", FM_CompanyCode);
jsonObject.put("belnr", bill.getString("shjh_credentialnum"));
jsonObject.put("gjahr", bill.getString("shjh_voucheryear"));
jsonObject.put("stasus", status);
jsonObject.put("status", status);
String cname = "";
if (null!= bill.getDynamicObject("creator")) {
cname = bill.getDynamicObject("creator").getString("number");//创建人工号_申请人

View File

@ -44,25 +44,25 @@ public class PayApplyDeleteOperation extends AbstractOperationServicePlugIn impl
if (null!= bill.getDynamicObject("applyorg")) {
FM_CompanyCode = bill.getDynamicObject("applyorg").getString("number");//公司编码_申请付款组织
}
jsonObject.put("bukrs",FM_CompanyCode);//公司代码_申请付款组织
jsonObject.put("belnr", bill.getString("shjh_vouchernum"));//会计凭证编号_SAP应付凭证号
jsonObject.put("gjahr", bill.getString("shjh_voucheryear"));//会计年度_SAP应付凭证会计年度
jsonObject.put("stasus", "02");//状态 01锁定02解锁03关闭04退单05作废
jsonObject.put("BUKRS",FM_CompanyCode);//公司代码_申请付款组织
jsonObject.put("BELNR", bill.getString("shjh_vouchernum"));//会计凭证编号_SAP应付凭证号
jsonObject.put("GJAHR", bill.getString("shjh_voucheryear"));//会计年度_SAP应付凭证会计年度
jsonObject.put("STATUS", "02");//状态 01锁定02解锁03关闭04退单05作废
String cname = "";
if (null!= bill.getDynamicObject("creator")) {
cname = bill.getDynamicObject("creator").getString("number");//创建人工号_申请人
}
jsonObject.put("cname", cname);//创建人工号
jsonObject.put("CNAME", cname);//创建人工号
// jsonObject.put("cname", "GH001657");//创建人工号
jsonObject.put("zjddjid", ""+bill.getPkValue());//金蝶单据ID
jsonObject.put("zjddjbh", bill.getString("billno"));//金蝶单据编号
jsonObject.put("ZJDDJID", ""+bill.getPkValue());//金蝶单据ID
jsonObject.put("ZJDDJBH", bill.getString("billno"));//金蝶单据编号
IT_INPUT.add(jsonObject);
JSONObject jsonObjects = unlocked_status(IT_INPUT,bill.getString("billno"));
String code = (String)jsonObjects.get("code");
if (!"0".equals(code)) {
OperateErrorInfo operateErrorInfo = new OperateErrorInfo();
operateErrorInfo.setMessage("付款申请单:"+bill.getString("billno")+"状态解锁失败:" + jsonObject.get("msg"));
operateErrorInfo.setMessage("付款申请单:"+bill.getString("billno")+"状态解锁失败:" + jsonObjects.get("msg"));
operateErrorInfo.setErrorLevel(ErrorLevel.Error.name());
operateErrorInfo.setPkValue(bill.getPkValue());
this.operationResult.addErrorInfo(operateErrorInfo);

View File

@ -56,7 +56,7 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem
jsonObject.put("BUKRS",FM_CompanyCode);//公司代码_申请付款组织
jsonObject.put("BELNR", bill.getString("shjh_vouchernum"));//会计凭证编号_SAP应付凭证号
jsonObject.put("GJAHR", bill.getString("shjh_voucheryear"));//会计年度_SAP应付凭证会计年度
jsonObject.put("STASUS", "01");//状态 01锁定02解锁03关闭04退单05作废
jsonObject.put("STATUS", "01");//状态 01锁定02解锁03关闭04退单05作废
String cname = "";
if (null!= bill.getDynamicObject("creator")) {
cname = bill.getDynamicObject("creator").getString("number");//创建人工号_申请人

View File

@ -50,7 +50,7 @@ public class PayBillSubmitOperation extends AbstractOperationServicePlugIn imple
if ("A".equals(sourcesystem) && !shjhSapvalidate) {
JSONObject jsonObject = sap_validation(getSapData(bill), bill.getString("billno"));
if (jsonObject.getIntValue("code") != 0) {
String message = jsonObject.getString("message");
String message = jsonObject.getString("msg");
this.addErrorMessage(entity,"SAP校验未通过不能提交:"+message);
}else{
bill.set("shjh_sapvalidate", true);

View File

@ -72,7 +72,7 @@ public class PayrequestBillOperation extends AbstractOperationServicePlugIn impl
jsonObject.put("bukrs",FM_CompanyCode);//公司代码_申请付款组织
jsonObject.put("belnr", bill.getString("shjh_vouchernum"));//会计凭证编号_SAP应付凭证号
jsonObject.put("gjahr", bill.getString("shjh_voucheryear"));//会计年度_SAP应付凭证会计年度
jsonObject.put("stasus", "03");//状态 01锁定02解锁03关闭04退单05作废
jsonObject.put("status", "03");//状态 01锁定02解锁03关闭04退单05作废
String cname = "";
if (null!= bill.getDynamicObject("creator")) {
cname = bill.getDynamicObject("creator").getString("number");//创建人工号_申请人

View File

@ -29,6 +29,7 @@ import java.util.Map;
import static shjh.jhzj7.fi.fi.plugin.form.SappzFormPlugin.*;
import static shjh.jhzj7.fi.fi.utils.SapUtils.vouchers_payable;
import static shjh.jhzj7.fi.fi.webapi.ApplyAdjustBillControler.setPaymentType;
import static shjh.jhzj7.fi.fi.webapi.ApplyBillControler.*;
/**
@ -112,7 +113,7 @@ public class QuerySapCreatePayApplyTask extends AbstractTask {
String fkBillNum = it_list.getString("BELNR");//凭证号
String gjahr = it_list.getString("GJAHR");//会计年度
String accountingsubject = it_list.getString("SAKNR");//会计科目
String ebelp = it_list.getString("EBELP");//会计科目行项目号
String ebelp = it_list.getString("BUZEI");//会计科目行项目号
BigDecimal wrbtr = new BigDecimal(it_list.getString("WRBTR"));//未清金额
//汇率
BigDecimal KURSF = new BigDecimal(it_list.getString("KURSF"));
@ -285,14 +286,6 @@ public class QuerySapCreatePayApplyTask extends AbstractTask {
//表头申请金额
ap_payapply.set("applyamount", amount);
String zlsch = it_list.getString("ZLSCH");//付款方式
// 结算方式(付款方式)
DynamicObject settlementtype = BusinessDataServiceHelper.loadSingle("bd_settlementtype",
new QFilter[]{new QFilter("number", QCP.equals, zlsch)});
if (null != settlementtype) {
ap_payapply_entry.set("e_settlementtype", settlementtype);
}
//付款类型:取值范围对公付款对私付款SAP科目编号1221020200 对私付款费控劳务人员报销单 对私付款其他均赋值为对公付款
if ("1221020200".equals(accountingsubject)) {
QFilter Q9 = new QFilter("name", QCP.equals, "对私付款");
@ -381,7 +374,25 @@ public class QuerySapCreatePayApplyTask extends AbstractTask {
ap_payapply.set("shjh_bookkeepingdate", BUDATs);
//凭证日期
ap_payapply.set("shjh_documentdate", BLDATs);
String zlsch = it_list.getString("ZLSCH");//付款方式
// 结算方式(付款方式)
DynamicObject settlementtype = BusinessDataServiceHelper.loadSingle("bd_settlementtype",
new QFilter[]{new QFilter("number", QCP.equals, zlsch)});
if (null != settlementtype) {
ap_payapply_entry.set("e_settlementtype", settlementtype);
}
String uuid = it_list.getString("XBLNR");//单据号
// 设置付款类型 //付款类型 外部系统单据类型
setPaymentType(ap_payapply, uuid);
//凭证类型
String blart = it_list.getString("BLART");
DynamicObject vouchertype = BusinessDataServiceHelper.loadSingle("gl_vouchertype",
new QFilter[]{new QFilter("number", QCP.equals, blart)});
if (null != vouchertype) {
ap_payapply.set("shjh_documenttype", vouchertype);//凭证类型
}
//基准日期
ap_payapply.set("shjh_basedate", ZFBDTs);
//付款条件

View File

@ -477,7 +477,7 @@ public class ApplyAdjustBillControler {
String vouchertype = it_list.getString("BLART");// 凭证类型_凭证类型
String paymentterms = it_list.getString("ZTERM");// 付款条件_付款条件代码
String refertoinvoicenumber = "";// TODO:参照发票号
String uuid = it_list.getString("XBLNR");//单据号
// 防重校验
QFilter Q5 = new QFilter("shjh_vouchernum", QCP.equals, vouchernum);
@ -548,7 +548,7 @@ public class ApplyAdjustBillControler {
if (StringUtils.isNotEmpty(s1)) {
return s1;
}
String uuid = it_list.getString("XBLNR");//单据号
// 设置付款类型 //付款类型 外部系统单据类型
setPaymentType(ap_payapply, uuid);
@ -701,7 +701,7 @@ public class ApplyAdjustBillControler {
* @param ap_payapply 付款申请单的动态对象
* @param accountingsubject 会计科目
*/
private void setPaymentType(DynamicObject ap_payapply, String uuid) {
public static void setPaymentType(DynamicObject ap_payapply, String uuid) {
// String paymentTypeName = "1221020200".equals(accountingsubject) ? "对私付款" : "对公付款";
// QFilter Q9 = new QFilter("name", QCP.equals, paymentTypeName);
// DynamicObject paytype = BusinessDataServiceHelper.loadSingle(CAS_PAYMENTBILLTYPE, new QFilter[]{Q9});