1.采购退货保存或提交时删除未选择退货分录
This commit is contained in:
parent
85ebb7cec4
commit
0e9fc7c25a
|
|
@ -10,9 +10,11 @@ import kd.bos.logging.LogFactory;
|
|||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
import tqq9.lc123.cloud.app.plugin.utils.AutoFixLinkUtil;
|
||||
|
||||
import java.util.ListIterator;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -31,11 +33,11 @@ public class PurRefundApplySaveOpPlugin extends AbstractOperationServicePlugIn i
|
|||
super.beforeExecuteOperationTransaction(e);
|
||||
DynamicObject[] dataEntities1 = e.getDataEntities();
|
||||
logger.info("PurRefundApplySaveOpPlugin-start");
|
||||
logger.info("PurRefundApplySaveOpPlugin:单据数量"+dataEntities1.length);
|
||||
logger.info("PurRefundApplySaveOpPlugin:单据数量" + dataEntities1.length);
|
||||
String operationKey = e.getOperationKey();
|
||||
if (dataEntities1.length > 0 && StringUtils.equals("save",operationKey)) {
|
||||
if (dataEntities1.length > 0 && StringUtils.equals("save", operationKey)) {
|
||||
DynamicObject dynamicObject = dataEntities1[0];
|
||||
logger.info("PurRefundApplySaveOpPlugin:单据号"+dynamicObject.getString("billno"));
|
||||
logger.info("PurRefundApplySaveOpPlugin:单据号" + dynamicObject.getString("billno"));
|
||||
DynamicObjectCollection billentry1 = dynamicObject.getDynamicObjectCollection("billentry");
|
||||
if (billentry1.size() > 0) {
|
||||
DynamicObject dynamicObject1 = billentry1.get(0);
|
||||
|
|
@ -54,7 +56,32 @@ public class PurRefundApplySaveOpPlugin extends AbstractOperationServicePlugIn i
|
|||
|
||||
}
|
||||
logger.info("PurRefundApplySaveOpPlugin-end");
|
||||
|
||||
|
||||
if (StringUtils.equals("save", operationKey)) {
|
||||
for (DynamicObject dynamicObject : dataEntities1) {
|
||||
DynamicObjectCollection billentry = dynamicObject.getDynamicObjectCollection("billentry");
|
||||
ListIterator<DynamicObject> iterator = billentry.listIterator();
|
||||
while (iterator.hasNext()) {
|
||||
DynamicObject next = iterator.next();
|
||||
Boolean tqq9_isreturn = next.getBoolean("tqq9_isreturn");
|
||||
if (!tqq9_isreturn) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StringUtils.equals("submit", operationKey)) {
|
||||
for (DynamicObject dynamicObject : dataEntities1) {
|
||||
DynamicObjectCollection billentry = dynamicObject.getDynamicObjectCollection("billentry");
|
||||
ListIterator<DynamicObject> iterator = billentry.listIterator();
|
||||
while (iterator.hasNext()) {
|
||||
DynamicObject next = iterator.next();
|
||||
Boolean tqq9_isreturn = next.getBoolean("tqq9_isreturn");
|
||||
if (!tqq9_isreturn) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
SaveServiceHelper.save(dataEntities1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue