feat:生成贷记单逻辑
This commit is contained in:
parent
73fe7c9407
commit
5155e7aab2
@ -3,6 +3,7 @@ package com.yem.wm.im.debcrednotenew.op;
|
||||
import com.yem.wm.im.debcrednotenew.utils.DebCredUtils;
|
||||
import kd.bos.dataentity.OperateOption;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.operate.result.IOperateInfo;
|
||||
import kd.bos.entity.operate.result.OperationResult;
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
@ -38,38 +39,54 @@ public class PlaceexaMineNewAuditOp extends AbstractOperationServicePlugIn {
|
||||
qFilter.and(new QFilter("billno", QCP.equals, yem_contractnumber));
|
||||
DynamicObject yem_es_salesorder = BusinessDataServiceHelper.loadSingle("yem_es_salesorder", "id,billno,yem_partscredit,yem_isgiftgiveparts", new QFilter[]{qFilter});
|
||||
if (yem_es_salesorder != null) {
|
||||
//配件贷记额度生效节点
|
||||
String yem_partscredit = yem_es_salesorder.getString("yem_partscredit");
|
||||
//是否配件赠送
|
||||
String yem_isgiftgiveparts = yem_es_salesorder.getString("yem_isgiftgiveparts");
|
||||
if (yem_partscredit.equals("A") && yem_isgiftgiveparts.equals("A")) {
|
||||
DynamicObject object = BusinessDataServiceHelper.loadSingle(yem_es_salesorder.getLong("id"), "yem_es_salesorder");
|
||||
DynamicObject debcrednote = DebCredUtils.AddQXGenerate(object, temp);
|
||||
OperationResult Operate = OperationServiceHelper.executeOperate("save", debcrednote.getDynamicObjectType().getName(), new DynamicObject[]{debcrednote}, OperateOption.create());
|
||||
if (Operate.isSuccess()) {
|
||||
OperationResult submitResult = OperationServiceHelper.executeOperate("submit", "yem_debcrednote", new Object[]{debcrednote.getPkValue()}, OperateOption.create());
|
||||
if (submitResult.isSuccess()) {
|
||||
OperationResult auditResult = OperationServiceHelper.executeOperate("audit", "yem_debcrednote", new Object[]{debcrednote.getPkValue()}, OperateOption.create());
|
||||
if (auditResult.isSuccess()) {
|
||||
//只有整机行生成贷记单
|
||||
Boolean isbusinesssort = false;
|
||||
DynamicObjectCollection yem_es_materialinfo = temp.getDynamicObjectCollection("yem_es_materialinfo");
|
||||
for (int i = 0; i < yem_es_materialinfo.size(); i++) {
|
||||
DynamicObject dynamicObject = yem_es_materialinfo.get(i);
|
||||
String yem_businesssort = dynamicObject.getString("yem_businesssort");
|
||||
if (yem_businesssort.equals("Z")) {
|
||||
isbusinesssort = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//生成贷记单
|
||||
if (isbusinesssort) {
|
||||
DynamicObject debcrednote = DebCredUtils.AddQXGenerate(object, temp);
|
||||
OperationResult Operate = OperationServiceHelper.executeOperate("save", debcrednote.getDynamicObjectType().getName(), new DynamicObject[]{debcrednote}, OperateOption.create());
|
||||
if (Operate.isSuccess()) {
|
||||
OperationResult submitResult = OperationServiceHelper.executeOperate("submit", "yem_debcrednote", new Object[]{debcrednote.getPkValue()}, OperateOption.create());
|
||||
if (submitResult.isSuccess()) {
|
||||
OperationResult auditResult = OperationServiceHelper.executeOperate("audit", "yem_debcrednote", new Object[]{debcrednote.getPkValue()}, OperateOption.create());
|
||||
if (auditResult.isSuccess()) {
|
||||
// //切换正式需去掉
|
||||
// OperationResult estimatedResult = OperationServiceHelper.executeOperate("zyestimated", "yem_debcrednote", new Object[]{debcrednote.getPkValue()}, OperateOption.create());
|
||||
// if (estimatedResult.isSuccess()) {
|
||||
temp.set("yem_debcreditno", debcrednote.getString("billno"));
|
||||
temp.set("yem_debcreditid", debcrednote.getString("id"));
|
||||
SaveServiceHelper.update(temp);
|
||||
temp.set("yem_debcreditno", debcrednote.getString("billno"));
|
||||
temp.set("yem_debcreditid", debcrednote.getString("id"));
|
||||
SaveServiceHelper.update(temp);
|
||||
// }
|
||||
} else {
|
||||
List<IOperateInfo> allErrorOrValidateInfo = auditResult.getAllErrorOrValidateInfo();
|
||||
String message = auditResult.getMessage();
|
||||
throw new KDBizException("贷记单审核失败," + message + "," + allErrorOrValidateInfo);
|
||||
}
|
||||
} else {
|
||||
List<IOperateInfo> allErrorOrValidateInfo = auditResult.getAllErrorOrValidateInfo();
|
||||
String message = auditResult.getMessage();
|
||||
throw new KDBizException("贷记单审核失败," + message + "," + allErrorOrValidateInfo);
|
||||
List<IOperateInfo> allErrorOrValidateInfo = submitResult.getAllErrorOrValidateInfo();
|
||||
String message = submitResult.getMessage();
|
||||
throw new KDBizException("贷记单提交失败," + message + "," + allErrorOrValidateInfo);
|
||||
}
|
||||
} else {
|
||||
List<IOperateInfo> allErrorOrValidateInfo = submitResult.getAllErrorOrValidateInfo();
|
||||
String message = submitResult.getMessage();
|
||||
throw new KDBizException("贷记单提交失败," + message + "," + allErrorOrValidateInfo);
|
||||
List<IOperateInfo> allErrorOrValidateInfo = Operate.getAllErrorOrValidateInfo();
|
||||
String message = Operate.getMessage();
|
||||
throw new KDBizException("贷记单保存失败," + message + "," + allErrorOrValidateInfo);
|
||||
}
|
||||
} else {
|
||||
List<IOperateInfo> allErrorOrValidateInfo = Operate.getAllErrorOrValidateInfo();
|
||||
String message = Operate.getMessage();
|
||||
throw new KDBizException("贷记单保存失败," + message + "," + allErrorOrValidateInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user