付款申请单关闭推送sap和费控接口指向修复

This commit is contained in:
yuxueliang0813 2025-07-11 16:49:02 +08:00
parent c9398aa992
commit 27a5aacbba
2 changed files with 12 additions and 19 deletions

View File

@ -18,12 +18,9 @@ import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.OperationServiceHelper; import kd.bos.servicehelper.operation.OperationServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.bos.util.StringUtils;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.Map;
import static shjh.jhzj7.fi.fi.utils.SapUtils.backpayment_status; import static shjh.jhzj7.fi.fi.utils.SapUtils.backpayment_status;
import static shjh.jhzj7.fi.fi.utils.SapUtils.unlocked_status; import static shjh.jhzj7.fi.fi.utils.SapUtils.unlocked_status;
@ -65,6 +62,7 @@ public class ScheduleListPlugin extends AbstractListPlugin {
} }
} }
} }
private void processRows(String status) { private void processRows(String status) {
ListSelectedRowCollection rows = this.getSelectedRows(); ListSelectedRowCollection rows = this.getSelectedRows();
for (ListSelectedRow row : rows) { for (ListSelectedRow row : rows) {
@ -77,11 +75,11 @@ public class ScheduleListPlugin extends AbstractListPlugin {
DynamicObject payapply = BusinessDataServiceHelper.loadSingle("ap_payapply", DynamicObject payapply = BusinessDataServiceHelper.loadSingle("ap_payapply",
"id,billno,shjh_sourceadjustment", qFilter.toArray()); "id,billno,shjh_sourceadjustment", qFilter.toArray());
if (null != payapply) { if (null != payapply) {
//如果付款申请单不是来源调整单 //如果付款申请单不是来源调整单则触发状态回写至费控和sap
if (!payapply.getBoolean("shjh_sourceadjustment")) { if (!payapply.getBoolean("shjh_sourceadjustment")) {
//来源SAP //来源SAP
String shjhSapuniquevalue = bill.getString("shjh_sapuniquevalue"); String sourcesystem = bill.getString("shjh_sourcesystem");
if (StringUtils.isNotEmpty(shjhSapuniquevalue)) { if ("A".equals(sourcesystem)) {
JSONArray IT_INPUT = createInputJSONArray(bill, status); JSONArray IT_INPUT = createInputJSONArray(bill, status);
JSONObject jsonObjects = unlocked_status(IT_INPUT, bill.getString("billno")); JSONObject jsonObjects = unlocked_status(IT_INPUT, bill.getString("billno"));
String code = jsonObjects.getString("code"); String code = jsonObjects.getString("code");
@ -93,10 +91,8 @@ public class ScheduleListPlugin extends AbstractListPlugin {
closeOrUnauditApply(payapply,"unaudit"); closeOrUnauditApply(payapply,"unaudit");
} }
return; return;
} }else if ("B".equals(sourcesystem)) {
//若来源为费控,调用费控状态修改接口 //若来源为费控,调用费控状态修改接口
String fkbillid = bill.getString("shjh_fkbillid");//获取费控单据表头ID
if (StringUtils.isNotEmpty(fkbillid)) {
//先付后记其他付款劳务报销单SAP会员退卡单回写付款状态 //先付后记其他付款劳务报销单SAP会员退卡单回写付款状态
JSONObject jsonObjects = backpayment_status(createInputJSONArrays(bill),bill.getString("billno")); JSONObject jsonObjects = backpayment_status(createInputJSONArrays(bill),bill.getString("billno"));
String code = (String)jsonObjects.get("code"); String code = (String)jsonObjects.get("code");

View File

@ -59,14 +59,13 @@ public class PayrequestBillOperation extends AbstractOperationServicePlugIn impl
for (DynamicObject bill : dataEntities) { for (DynamicObject bill : dataEntities) {
bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(), bill.getDataEntityType().getName()); bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(), bill.getDataEntityType().getName());
//若来源为SAP,调用SAP状态修改接口 //若来源为SAP,调用SAP状态修改接口
String shjhSapuniquevalue = bill.getString("shjh_sapuniquevalue");//获取SAP唯一值 String sourcesystem = bill.getString("shjh_sourcesystem");
if (shjhSapuniquevalue!= null && !shjhSapuniquevalue.isEmpty()) { if ("A".equals(sourcesystem)) {
//调关闭接口 //调关闭接口
JSONArray IT_INPUT = new JSONArray(); JSONArray IT_INPUT = new JSONArray();
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
String FM_CompanyCode = ""; String FM_CompanyCode = "";
if (null!= bill.getDynamicObject("applyorg")) { if (null != bill.getDynamicObject("applyorg")) {
FM_CompanyCode = bill.getDynamicObject("applyorg").getString("number");//公司编码_申请付款组织 FM_CompanyCode = bill.getDynamicObject("applyorg").getString("number");//公司编码_申请付款组织
} }
jsonObject.put("BUKRS",FM_CompanyCode);//公司代码_申请付款组织 jsonObject.put("BUKRS",FM_CompanyCode);//公司代码_申请付款组织
@ -75,7 +74,7 @@ public class PayrequestBillOperation extends AbstractOperationServicePlugIn impl
jsonObject.put("STATUS", "03");//状态 01锁定02解锁03关闭04退单05作废 jsonObject.put("STATUS", "03");//状态 01锁定02解锁03关闭04退单05作废
jsonObject.put("BUZEI", bill.getString("shjh_voucherentrynum"));//行编号_SAP应付凭证行号 jsonObject.put("BUZEI", bill.getString("shjh_voucherentrynum"));//行编号_SAP应付凭证行号
String cname = ""; String cname = "";
if (null!= bill.getDynamicObject("creator")) { if (null != bill.getDynamicObject("creator")) {
cname = bill.getDynamicObject("creator").getString("number");//创建人工号_申请人 cname = bill.getDynamicObject("creator").getString("number");//创建人工号_申请人
} }
jsonObject.put("CNAME", cname);//创建人工号 jsonObject.put("CNAME", cname);//创建人工号
@ -91,10 +90,8 @@ public class PayrequestBillOperation extends AbstractOperationServicePlugIn impl
}else { }else {
log.info("付款申请单:"+bill.getString("billno")+"状态关闭(SAP)成功"); log.info("付款申请单:"+bill.getString("billno")+"状态关闭(SAP)成功");
} }
} }else if ("B".equals(sourcesystem)) {
//若来源为费控,调用费控状态修改接口 //若来源为费控,调用费控状态修改接口
String fkbillid = bill.getString("shjh_fkbillid");//获取费控单据表头ID
if (fkbillid != null && !fkbillid.isEmpty()) {
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
JSONArray datas = new JSONArray(); JSONArray datas = new JSONArray();
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();