53 lines
2.5 KiB
Java
53 lines
2.5 KiB
Java
|
|
package tqq9.lc123.cloud.app.plugin.operate.pm;
|
||
|
|
|
||
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
||
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||
|
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||
|
|
import kd.bos.entity.plugin.args.BeforeOperationArgs;
|
||
|
|
import kd.bos.logging.Log;
|
||
|
|
import kd.bos.logging.LogFactory;
|
||
|
|
import kd.bos.orm.query.QCP;
|
||
|
|
import kd.bos.orm.query.QFilter;
|
||
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||
|
|
import kd.sdk.plugin.Plugin;
|
||
|
|
import tqq9.lc123.cloud.app.plugin.utils.AutoFixLinkUtil;
|
||
|
|
|
||
|
|
import java.util.stream.Collectors;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 采购入库单保存操作插件
|
||
|
|
*/
|
||
|
|
public class PurInWareSaveOpPlugin extends AbstractOperationServicePlugIn implements Plugin {
|
||
|
|
private final static Log logger = LogFactory.getLog(PurInWareSaveOpPlugin.class);
|
||
|
|
private static String IM_PURINBILL = "im_purinbill";//采购入库单
|
||
|
|
private static String PM_RECEIPTNOTICE = "pm_receiptnotice";//收货通知
|
||
|
|
private static String billentry = "billentry";//分录标识
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public void beforeExecuteOperationTransaction(BeforeOperationArgs e) {
|
||
|
|
super.beforeExecuteOperationTransaction(e);
|
||
|
|
DynamicObject[] dataEntities1 = e.getDataEntities();
|
||
|
|
if (dataEntities1.length > 0) {
|
||
|
|
|
||
|
|
DynamicObject dynamicObject = dataEntities1[0];
|
||
|
|
if (dynamicObject.getBoolean("tqq9_isrebulidlink")) {
|
||
|
|
DynamicObjectCollection billentry1 = dynamicObject.getDynamicObjectCollection("billentry");
|
||
|
|
if (billentry1.size() > 0) {
|
||
|
|
DynamicObject dynamicObject1 = billentry1.get(0);
|
||
|
|
String srcbillentity = dynamicObject1.getString("srcbillentity");
|
||
|
|
String srcbillnumber = dynamicObject1.getString("srcbillnumber");
|
||
|
|
DynamicObject pm_purorderbill = BusinessDataServiceHelper.loadSingle(srcbillentity, new QFilter[]{new QFilter("billno", QCP.equals, srcbillnumber)});
|
||
|
|
DynamicObjectCollection dynamicObjects = new DynamicObjectCollection();
|
||
|
|
dynamicObjects.add(pm_purorderbill);
|
||
|
|
dynamicObjects.stream().collect(Collectors.toList());
|
||
|
|
AutoFixLinkUtil fixLinkHelp = new AutoFixLinkUtil();
|
||
|
|
fixLinkHelp.linkSourceRow(dynamicObject, dynamicObjects.stream().collect(Collectors.toList()), IM_PURINBILL, billentry, "srcbillentryid",
|
||
|
|
srcbillentity, billentry, "", "billentry_lk");
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|