51 lines
2.2 KiB
Java
51 lines
2.2 KiB
Java
|
package tqq9.lc123.cloud.app.plugin.operate.im;
|
||
|
|
||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||
|
import kd.bos.entity.ExtendedDataEntity;
|
||
|
import kd.bos.entity.ExtendedDataEntitySet;
|
||
|
import kd.bos.entity.botp.plugin.AbstractConvertPlugIn;
|
||
|
import kd.bos.entity.botp.plugin.args.AfterConvertEventArgs;
|
||
|
import kd.bos.entity.botp.plugin.args.AfterCreateTargetEventArgs;
|
||
|
import kd.bos.entity.botp.plugin.args.AfterFieldMappingEventArgs;
|
||
|
import kd.bos.entity.botp.plugin.args.BeforeCreateTargetEventArgs;
|
||
|
import kd.bos.logging.Log;
|
||
|
import kd.bos.logging.LogFactory;
|
||
|
import kd.sdk.plugin.Plugin;
|
||
|
|
||
|
import java.math.BigDecimal;
|
||
|
import java.util.Map;
|
||
|
|
||
|
/**
|
||
|
* 采购订单转换插件
|
||
|
* 退货补货数量修改
|
||
|
*/
|
||
|
public class PurOrderPushReceiptNoticePlugin extends AbstractConvertPlugIn implements Plugin {
|
||
|
private final static Log logger = LogFactory.getLog(PurOrderPushReceiptNoticePlugin.class);
|
||
|
private static String RECEIPTNOTICE = "pm_receiptnotice";
|
||
|
|
||
|
@Override
|
||
|
public void afterConvert(AfterConvertEventArgs e) {
|
||
|
super.afterConvert(e);
|
||
|
ExtendedDataEntitySet targetExtDataEntitySet = e.getTargetExtDataEntitySet();
|
||
|
ExtendedDataEntity[] extendedDataEntities = targetExtDataEntitySet.FindByEntityKey(RECEIPTNOTICE);
|
||
|
Map<String, String> variables = this.getOption().getVariables();
|
||
|
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
||
|
//收货通知单
|
||
|
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
|
||
|
DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection("billentry");
|
||
|
for (DynamicObject dynamicObject : dynamicObjectCollection) {
|
||
|
String mainbillentryid = dynamicObject.getString("mainbillentryid");
|
||
|
//核心单据号一致,修改补货数量
|
||
|
if (variables.containsKey(mainbillentryid)) {
|
||
|
String qty = variables.get(mainbillentryid);
|
||
|
BigDecimal entry_qty = new BigDecimal(qty).negate();
|
||
|
dynamicObject.set("qty", entry_qty);//数量
|
||
|
dynamicObject.set("baseqty", entry_qty);//基本数量
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|