【收货通知保存&删除插件】 操作完之后,反写上游采购订单【是否可做收货通知】
This commit is contained in:
parent
25ce2a3164
commit
3e200c85e6
|
|
@ -0,0 +1,65 @@
|
||||||
|
package tqq9.lc123.cloud.app.plugin.operate.pm;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.operate.result.OperationResult;
|
||||||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
|
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.botp.BFTrackerServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收货通知单 保存 & 删除插件
|
||||||
|
* 操作后上查采购订单,判断该采购订单是否全部下推收获通知
|
||||||
|
* 如果采购订单明细行的采购数量 != 关联数量,则将采购订单下拉字段【是否可做收获通知 tqq9_sfkzsh】赋值为“true”,否则赋值为“false”
|
||||||
|
*/
|
||||||
|
public class ReceiptNoticeSaveAndDeleteToUpdPurbillOp extends AbstractOperationServicePlugIn {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||||
|
super.afterExecuteOperationTransaction(e);
|
||||||
|
OperationResult operationResult = this.getOperationResult();
|
||||||
|
List<Object> successPkIds = operationResult.getSuccessPkIds();
|
||||||
|
for (Object successPkId : successPkIds) {
|
||||||
|
Long id = (Long) successPkId;
|
||||||
|
Long[] idArr = new Long[]{id};
|
||||||
|
Map<String, HashSet<Long>> map = BFTrackerServiceHelper.findSourceBills("pm_receiptnotice", idArr);
|
||||||
|
for (String s : map.keySet()) {
|
||||||
|
if("pm_purorderbill".equals(s)){
|
||||||
|
HashSet<Long> longs = map.get(s);
|
||||||
|
for (Long aLong : longs) {
|
||||||
|
DynamicObject bill = BusinessDataServiceHelper.loadSingle(aLong, s);
|
||||||
|
DynamicObjectCollection entries = bill.getDynamicObjectCollection("billentry");
|
||||||
|
boolean isEquals = true;//采购订单分录中是否所有行中,采购数量 = 关联数量
|
||||||
|
for (DynamicObject entry : entries) {
|
||||||
|
BigDecimal qty = entry.getBigDecimal("qty");
|
||||||
|
BigDecimal joinqty = entry.getBigDecimal("joinqty");
|
||||||
|
if(qty.compareTo(joinqty) != 0){
|
||||||
|
isEquals = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(isEquals){
|
||||||
|
bill.set("tqq9_sfkzsh", "false");
|
||||||
|
}else{
|
||||||
|
bill.set("tqq9_sfkzsh", "true");
|
||||||
|
}
|
||||||
|
SaveServiceHelper.save(new DynamicObject[]{bill});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue