2025-10-31 10:14:18 +00:00
|
|
|
package tqq9.lc123.cloud.app.plugin.operate.pm;
|
|
|
|
|
|
|
|
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
|
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
2025-11-07 04:42:48 +00:00
|
|
|
import kd.bos.entity.botp.runtime.BFRow;
|
2025-10-31 10:14:18 +00:00
|
|
|
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;
|
2025-11-07 04:42:48 +00:00
|
|
|
import kd.bos.servicehelper.botp.BFTrackerServiceHelper;
|
2025-10-31 10:14:18 +00:00
|
|
|
import kd.sdk.plugin.Plugin;
|
|
|
|
|
import tqq9.lc123.cloud.app.plugin.utils.AutoFixLinkUtil;
|
|
|
|
|
|
2025-11-07 04:42:48 +00:00
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
2025-10-31 10:14:18 +00:00
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 其他入库单保存操作插件
|
|
|
|
|
*/
|
|
|
|
|
public class OtherInWareSaveOpPlugin extends AbstractOperationServicePlugIn implements Plugin {
|
|
|
|
|
private final static Log logger = LogFactory.getLog(OtherInWareSaveOpPlugin.class);
|
|
|
|
|
private static String IM_OTHERINBILL = "im_otherinbill";//其他入库
|
|
|
|
|
private static String TQQ9_OTHERINAPPLY = "tqq9_otherinapply";//其他入库申请
|
|
|
|
|
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];
|
2025-11-07 04:42:48 +00:00
|
|
|
Map<Long, List<BFRow>> id = BFTrackerServiceHelper.findDirtSourceBills(TQQ9_OTHERINAPPLY, new Long[]{dynamicObject.getLong("id")});
|
2025-11-07 10:09:49 +00:00
|
|
|
if (id.size()>0) {
|
2025-10-31 10:14:18 +00:00
|
|
|
DynamicObjectCollection billentry1 = dynamicObject.getDynamicObjectCollection("billentry");
|
|
|
|
|
if (billentry1.size() > 0) {
|
|
|
|
|
DynamicObject dynamicObject1 = billentry1.get(0);
|
|
|
|
|
String srcbillnumber = dynamicObject1.getString("srcbillnumber");
|
|
|
|
|
DynamicObject pm_purorderbill = BusinessDataServiceHelper.loadSingle(TQQ9_OTHERINAPPLY, 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_OTHERINBILL, billentry, "srcbillentryid",
|
|
|
|
|
TQQ9_OTHERINAPPLY, billentry, "", "billentry_lk");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|