sap生成付款申请单的会计科目过滤条件优化
This commit is contained in:
parent
d3e75f778e
commit
edc0c190d2
|
|
@ -21,6 +21,7 @@ import kd.bos.orm.query.QCP;
|
|||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.OperationServiceHelper;
|
||||
import shjh.jhzj7.fi.fi.utils.EsbUtils;
|
||||
import shjh.jhzj7.fi.fi.utils.JhzjUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -467,7 +468,14 @@ public class SappzFormPlugin extends AbstractFormPlugin {
|
|||
String accountingsubject = (String) this.getModel().getValue("shjh_accountingsubject", selectRow);//会计科目
|
||||
if (accountingsubject != null && !accountingsubject.isEmpty()) {
|
||||
QFilter Q8 = new QFilter("number", QCP.equals, accountingsubject);
|
||||
DynamicObject accountview = BusinessDataServiceHelper.loadSingle(BD_ACCOUNTVIEW, new QFilter[]{Q8});
|
||||
Q8.and("createorg.id", QCP.equals, org.getPkValue());//当前公司ID
|
||||
//如果当前数据中心是测试的则使用测试库科目表ID,否则用正式的
|
||||
if("2162562979827025920".equals(RequestContext.get().getAccountId())){
|
||||
Q8.and("accounttable.id", QCP.equals, 2125524820924832768L);//测试科目表
|
||||
}else{
|
||||
Q8.and("accounttable.id", QCP.equals, EsbUtils.ACCTABLE);//正式科目表
|
||||
}
|
||||
DynamicObject accountview = BusinessDataServiceHelper.loadSingle(BD_ACCOUNTVIEW, Q8.toArray());
|
||||
if (null == accountview) {
|
||||
handleError("同步失败,凭证号:" + fkBillNum + "的会计科目不存在", fkBillNum, apimenthod, null);
|
||||
this.getView().showMessage("同步失败,凭证号:" + fkBillNum + "的会计科目不存在");
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import kd.bos.orm.query.QFilter;
|
|||
import kd.bos.schedule.executor.AbstractTask;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.OperationServiceHelper;
|
||||
import shjh.jhzj7.fi.fi.utils.EsbUtils;
|
||||
import shjh.jhzj7.fi.fi.utils.JhzjUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -214,9 +215,25 @@ public class QuerySapCreatePayApplyTask extends AbstractTask {
|
|||
|
||||
//SAP会计科目
|
||||
if (accountingsubject != null && !accountingsubject.isEmpty()) {
|
||||
QFilter Q8 = new QFilter("number", QCP.equals, accountingsubject);
|
||||
DynamicObject accountview = BusinessDataServiceHelper.loadSingle(BD_ACCOUNTVIEW, new QFilter[]{Q8});
|
||||
QFilter Q8 = new QFilter("number", QCP.equals, accountingsubject);//会计科目编号
|
||||
Q8.and("createorg.id", QCP.equals, org.getPkValue());//当前公司ID
|
||||
//如果当前数据中心是测试的则使用测试库科目表ID,否则用正式的
|
||||
if("2162562979827025920".equals(RequestContext.get().getAccountId())){
|
||||
Q8.and("accounttable.id", QCP.equals, 2125524820924832768L);//测试科目表
|
||||
}else{
|
||||
Q8.and("accounttable.id", QCP.equals, EsbUtils.ACCTABLE);//正式科目表
|
||||
}
|
||||
DynamicObject accountview = BusinessDataServiceHelper.loadSingle(BD_ACCOUNTVIEW, Q8.toArray());
|
||||
if(accountview == null){
|
||||
logger.error("同步失败,凭证号:" + fkBillNum + "的SAP会计科目在金蝶中未找到对应科目");
|
||||
JhzjUtils.saveLog(fkBillNum, apimenthod, it_list.toJSONString(), "同步失败,SAP会计科目在金蝶中未找到对应科目", false, "API");
|
||||
continue;
|
||||
}
|
||||
ap_payapply.set("shjh_sapkjkm", accountview);
|
||||
}else{
|
||||
logger.error("同步失败,凭证号:" + fkBillNum + "的SAP会计科目为空");
|
||||
JhzjUtils.saveLog(fkBillNum, apimenthod, it_list.toJSONString(), "同步失败,SAP会计科目为空", false, "API");
|
||||
continue;
|
||||
}
|
||||
|
||||
//请款事由
|
||||
|
|
@ -244,6 +261,7 @@ public class QuerySapCreatePayApplyTask extends AbstractTask {
|
|||
KURSF = KURSF.setScale(5, RoundingMode.HALF_UP);
|
||||
ap_payapply.set("exchangerate", KURSF);
|
||||
} catch (NumberFormatException e) {
|
||||
logger.error("同步失败,凭证号:" + fkBillNum + "的汇率处理异常");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -252,6 +270,7 @@ public class QuerySapCreatePayApplyTask extends AbstractTask {
|
|||
dmbtr = dmbtr.setScale(2, RoundingMode.HALF_UP);
|
||||
ap_payapply.set("appseleamount", dmbtr);
|
||||
} catch (NumberFormatException e) {
|
||||
logger.error("同步失败,凭证号:" + fkBillNum + "的申请金额折结算币别处理异常");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONArray;
|
|||
import com.alibaba.fastjson.JSONException;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.drew.lang.annotations.NotNull;
|
||||
import kd.bos.api.client.ApiResult;
|
||||
import kd.bos.context.RequestContext;
|
||||
import kd.bos.dataentity.OperateOption;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
|
|
@ -26,9 +25,9 @@ import kd.bos.orm.query.QCP;
|
|||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.OperationServiceHelper;
|
||||
import shjh.jhzj7.fi.fi.utils.EsbUtils;
|
||||
import shjh.jhzj7.fi.fi.utils.JhzjUtils;
|
||||
import shjh.jhzj7.fi.fi.webapi.model.ApiResultPayAdjustExt;
|
||||
import shjh.jhzj7.fi.fi.webapi.model.ApiResultPayApplyExt;
|
||||
import shjh.jhzj7.fi.fi.webapi.model.ApplyAdjustBillModel;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
|
@ -517,7 +516,7 @@ public class ApplyAdjustBillControler {
|
|||
|
||||
// 设置SAP会计科目
|
||||
if (!accountingsubject.isEmpty()) {
|
||||
DynamicObject accountview = loadAccountViewByNumber(accountingsubject);
|
||||
DynamicObject accountview = loadAccountViewByNumber(accountingsubject,org);
|
||||
if (accountview == null) {
|
||||
handleError("同步失败,调整单号:" + fkBillNum + "的会计科目不存在", fkBillNum, null);
|
||||
return "同步失败,调整单号:" + fkBillNum + "的会计科目不存在";
|
||||
|
|
@ -598,9 +597,16 @@ public class ApplyAdjustBillControler {
|
|||
* @param number 会计科目编号
|
||||
* @return 会计科目信息的动态对象
|
||||
*/
|
||||
private DynamicObject loadAccountViewByNumber(String number) {
|
||||
QFilter Q9 = new QFilter("number", QCP.equals, number);
|
||||
return BusinessDataServiceHelper.loadSingle(BD_ACCOUNTVIEW, new QFilter[]{Q9});
|
||||
private DynamicObject loadAccountViewByNumber(String number,DynamicObject org) {
|
||||
QFilter Q8 = new QFilter("number", QCP.equals, number);
|
||||
Q8.and("createorg.id", QCP.equals, org.getPkValue());//当前公司ID
|
||||
//如果当前数据中心是测试的则使用测试库科目表ID,否则用正式的
|
||||
if("2162562979827025920".equals(RequestContext.get().getAccountId())){
|
||||
Q8.and("accounttable.id", QCP.equals, 2125524820924832768L);//测试科目表
|
||||
}else{
|
||||
Q8.and("accounttable.id", QCP.equals, EsbUtils.ACCTABLE);//正式科目表
|
||||
}
|
||||
return BusinessDataServiceHelper.loadSingle(BD_ACCOUNTVIEW, Q8.toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue