parent
4761a107f1
commit
53950f5809
|
|
@ -6,6 +6,7 @@ import kd.bos.entity.ExtendedDataEntity;
|
|||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||
import kd.bos.entity.plugin.args.BeforeOperationArgs;
|
||||
import kd.bos.entity.validate.AbstractValidator;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
|
|
@ -18,7 +19,7 @@ import java.math.BigDecimal;
|
|||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 排程单据合并
|
||||
* 排程单据合并/解除
|
||||
* 元:shjh_psd_schedulebill_ext
|
||||
* 操作标识:shjh_pcbillhb
|
||||
*/
|
||||
|
|
@ -73,10 +74,38 @@ public class SchedulebillMergeOperation extends AbstractOperationServicePlugIn i
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeExecuteOperationTransaction(BeforeOperationArgs e) {
|
||||
super.beforeExecuteOperationTransaction(e);
|
||||
//重新排程前,将合并状态置为false,并将合并批次号置空(若为二开干预的合并排程单)
|
||||
String operationKey = e.getOperationKey();
|
||||
if ("afreshsche".equals(operationKey)) {
|
||||
DynamicObject[] dataEntities = e.getDataEntities();
|
||||
// 提前加载所有 bill 对象
|
||||
DynamicObject[] loadedBills = loadAllBills(dataEntities);
|
||||
for (DynamicObject loadedBill : loadedBills) {
|
||||
boolean shjhIshb = loadedBill.getBoolean("shjh_ishb");//是否进行排查单据合并
|
||||
if (shjhIshb) {
|
||||
//通过批次号查找所有同一批的排程单
|
||||
String batchnum = loadedBill.getString("batchnum");
|
||||
if (!batchnum.isEmpty()) {
|
||||
DynamicObject[] sameBills = BusinessDataServiceHelper.load("psd_schedulebill","id,batchnum,shjh_ishb",
|
||||
new QFilter[]{new QFilter("batchnum", "=", batchnum)});
|
||||
for (DynamicObject sameBill : sameBills) {
|
||||
sameBill.set("batchnum", "");
|
||||
sameBill.set("shjh_ishb", false);
|
||||
SaveServiceHelper.save(new DynamicObject[]{sameBill});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||
super.afterExecuteOperationTransaction(e);
|
||||
//排程任务池列表界面上增加一键合并按钮,点击后,将来源系统为sap的按照合并规则进行合并
|
||||
//排程任务池列表界面上增加一键合并按钮,点击后,将来源系统为sap的按照合并规则进行合并 并将合并状态置为true
|
||||
String operationKey = e.getOperationKey();
|
||||
if ("shjh_pcbillhb".equals(operationKey)) {
|
||||
DynamicObject[] dataEntities = e.getDataEntities();
|
||||
|
|
@ -107,6 +136,28 @@ public class SchedulebillMergeOperation extends AbstractOperationServicePlugIn i
|
|||
assignBatchNumbersAndSave(map);
|
||||
}
|
||||
}
|
||||
// 合并解除:若合并批次号不为空,且为二开干预的合并排程单,则将合并批次号置空,并将合并状态置为false
|
||||
if ("shjh_pcbilljchb".equals(operationKey)) {
|
||||
DynamicObject[] dataEntities = e.getDataEntities();
|
||||
// 提前加载所有 bill 对象
|
||||
DynamicObject[] loadedBills = loadAllBills(dataEntities);
|
||||
for (DynamicObject loadedBill : loadedBills) {
|
||||
boolean shjhIshb = loadedBill.getBoolean("shjh_ishb");//是否进行排查单据合并
|
||||
if (shjhIshb) {
|
||||
//通过批次号查找所有同一批的排程单
|
||||
String batchnum = loadedBill.getString("batchnum");
|
||||
if (!batchnum.isEmpty()) {
|
||||
DynamicObject[] sameBills = BusinessDataServiceHelper.load("psd_schedulebill","id,batchnum,shjh_ishb",
|
||||
new QFilter[]{new QFilter("batchnum", "=", batchnum)});
|
||||
for (DynamicObject sameBill : sameBills) {
|
||||
sameBill.set("batchnum", "");
|
||||
sameBill.set("shjh_ishb", false);
|
||||
SaveServiceHelper.save(new DynamicObject[]{sameBill});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -143,6 +194,7 @@ public class SchedulebillMergeOperation extends AbstractOperationServicePlugIn i
|
|||
long l = System.currentTimeMillis();
|
||||
for (DynamicObject bill : v) {
|
||||
bill.set("batchnum", "" + l);
|
||||
bill.set("shjh_ishb", true);
|
||||
}
|
||||
SaveServiceHelper.save(v.toArray(new DynamicObject[0]));
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue