Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
77b964a148
File diff suppressed because it is too large
Load Diff
|
|
@ -40,7 +40,7 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入库单发票导入插件+事物类型默认为空+是否主材隐显
|
* 入库单发票导入插件+ 事物类型默认为空(废弃+是否主材隐显(废弃
|
||||||
*/
|
*/
|
||||||
public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn implements Plugin {
|
public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
private static final Log log = LogFactory.getLog(MaterialInbFinaceConfirmeInvoicePlugin.class);
|
private static final Log log = LogFactory.getLog(MaterialInbFinaceConfirmeInvoicePlugin.class);
|
||||||
|
|
@ -48,7 +48,7 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
@Override
|
@Override
|
||||||
public void afterCreateNewData(EventObject e) {
|
public void afterCreateNewData(EventObject e) {
|
||||||
super.afterCreateNewData(e);
|
super.afterCreateNewData(e);
|
||||||
this.getModel().setValue("transtype", null);//事务类型默认为空
|
// this.getModel().setValue("transtype", null);//事务类型默认为空
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -57,20 +57,20 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
||||||
String key = e.getProperty().getName();
|
String key = e.getProperty().getName();
|
||||||
if (key.equals("transtype")) {
|
if (key.equals("transtype")) {
|
||||||
//事务类型
|
//事务类型
|
||||||
ChangeData[] changeSet = e.getChangeSet();
|
// ChangeData[] changeSet = e.getChangeSet();
|
||||||
ChangeData changeData = changeSet[0];
|
// ChangeData changeData = changeSet[0];
|
||||||
DynamicObject transtype = (DynamicObject) changeData.getNewValue();//新值
|
// DynamicObject transtype = (DynamicObject) changeData.getNewValue();//新值
|
||||||
if (transtype != null) {
|
// if (transtype != null) {
|
||||||
String number = transtype.getString("number");
|
// String number = transtype.getString("number");
|
||||||
if (number.equals("jrjc")) {
|
// if (number.equals("jrjc")) {
|
||||||
//事务类型为即入即出时隐藏是否主材
|
// //事务类型为即入即出时隐藏是否主材
|
||||||
this.getView().setVisible(false, "ismainmaterial");//是否主材
|
// this.getView().setVisible(false, "ismainmaterial");//是否主材
|
||||||
} else {
|
// } else {
|
||||||
this.getView().setVisible(true, "ismainmaterial");//是否主材
|
// this.getView().setVisible(true, "ismainmaterial");//是否主材
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
this.getView().setVisible(true, "ismainmaterial");//是否主材
|
// this.getView().setVisible(true, "ismainmaterial");//是否主材
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,124 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.algo.DataSet;
|
||||||
|
import kd.bos.algo.JoinDataSet;
|
||||||
|
import kd.bos.algo.JoinType;
|
||||||
|
import kd.bos.algo.Row;
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.dataentity.resource.ResManager;
|
||||||
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
|
import kd.bos.entity.EntityMetadataCache;
|
||||||
|
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
||||||
|
import kd.bos.form.*;
|
||||||
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||||
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||||
|
import kd.bos.form.events.ClosedCallBackEvent;
|
||||||
|
import kd.bos.form.operate.FormOperate;
|
||||||
|
import kd.bos.list.ListShowParameter;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.QueryServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库单表单插件:入库单点击选择采购申请按钮后弹出对应采购申请分录内容,后通过选择弹出的采购申请分录行赋值给入库单中
|
||||||
|
*/
|
||||||
|
public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
|
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||||
|
super.beforeDoOperation(args);
|
||||||
|
FormOperate operate = (FormOperate) args.getSource();
|
||||||
|
if ("purchaseapply".equals(operate.getOperateKey())) {
|
||||||
|
//选择采购申请单
|
||||||
|
this.doPurchaseApply();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doPurchaseApply() {
|
||||||
|
DynamicObject purchaseApply = (DynamicObject) this.getModel().getValue("zcgj_purchaseapply");//采购申请单
|
||||||
|
if (purchaseApply == null) {
|
||||||
|
this.getView().showTipNotification(ResManager.loadKDString("请先选择采购申请。", "MaterialInBillEditPlugin_0", "ec-ecma-formplugin", new Object[0]));
|
||||||
|
} else {
|
||||||
|
FormShowParameter formShowParameter = new FormShowParameter();
|
||||||
|
HashMap<String, Object> paramters = new HashMap<>();
|
||||||
|
DynamicObjectCollection entryEntityCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("entryentity");//入库单分录
|
||||||
|
List<Long> entryIds = new ArrayList<>();
|
||||||
|
List<Long> entryIds2 = new ArrayList<>();
|
||||||
|
for (DynamicObject entryEntity : entryEntityCollection) {
|
||||||
|
Long entryEntityId = entryEntity.getLong("listingid");//合同清单id
|
||||||
|
entryIds.add(entryEntityId);
|
||||||
|
entryIds2.add(entryEntityId);
|
||||||
|
}
|
||||||
|
|
||||||
|
long purchaseApplyId = purchaseApply.getLong("id");//采购申请单id
|
||||||
|
QFilter[] qFilte = new QFilter[]{new QFilter("zcgj_purchaseapply.id", QCP.equals, purchaseApplyId)};
|
||||||
|
DynamicObject[] ecma_materialInBills = BusinessDataServiceHelper.load("ecma_materialinbill","entryentity,entryentity.listingid", qFilte);//入库单
|
||||||
|
for (DynamicObject materialInBill : ecma_materialInBills) {
|
||||||
|
DynamicObjectCollection entryEntityCollection1 = materialInBill.getDynamicObjectCollection("entryentity");//入库单分录
|
||||||
|
for (DynamicObject entryEntity : entryEntityCollection1) {
|
||||||
|
long entryEntityId = entryEntity.getLong("listingid");//入库单分录-合同清单id
|
||||||
|
if (materialInBill.get("id").equals(this.getModel().getValue("id"))){
|
||||||
|
if (!entryIds2.contains(entryEntityId)){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
entryIds.add(entryEntityId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
paramters.put("purchaseApplyId", purchaseApplyId);
|
||||||
|
paramters.put("entryIds", entryIds);
|
||||||
|
formShowParameter.setCustomParams(paramters);
|
||||||
|
formShowParameter.setCaption("采购申请分录列表");
|
||||||
|
formShowParameter.setFormId("zcgj_purchaseapplyentry");
|
||||||
|
formShowParameter.setCloseCallBack(new CloseCallBack(this, "zcgj_selectpurchaseapply"));
|
||||||
|
|
||||||
|
StyleCss styleCss = new StyleCss();
|
||||||
|
styleCss.setWidth("900");
|
||||||
|
styleCss.setHeight("545");
|
||||||
|
OpenStyle openStyle = formShowParameter.getOpenStyle();
|
||||||
|
openStyle.setShowType(ShowType.Modal);
|
||||||
|
openStyle.setInlineStyleCss(styleCss);
|
||||||
|
this.getView().showForm(formShowParameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) {
|
||||||
|
super.closedCallBack(closedCallBackEvent);
|
||||||
|
String actionId = closedCallBackEvent.getActionId();
|
||||||
|
DynamicObjectCollection returnDataCollection = (DynamicObjectCollection) closedCallBackEvent.getReturnData();
|
||||||
|
if (returnDataCollection == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ("zcgj_selectpurchaseapply".equals(actionId) && returnDataCollection.size() > 0) {
|
||||||
|
for (DynamicObject returnData : returnDataCollection) {
|
||||||
|
int curIndex = this.getModel().createNewEntryRow("entryentity");
|
||||||
|
this.getModel().updateCache();
|
||||||
|
this.getView().setEnable(false, curIndex, new String[]{"oftaxamount", "notaxamount", "taxamount", "taxprice"});
|
||||||
|
|
||||||
|
long zcgj_bigintfield = returnData.getLong("zcgj_bigintfield");//采购申请单id
|
||||||
|
QFilter filter = new QFilter("purchaseentry.id", QCP.equals, zcgj_bigintfield);
|
||||||
|
DynamicObjectCollection purchaseApply = QueryServiceHelper.query("ecma_purchaseapply",
|
||||||
|
"purchaseentry,purchaseentry.material,purchaseentry.purchaseqty,purchaseentry.entrytaxrate,purchaseentry.price,purchaseentry.id,purchaseentry.remarks",
|
||||||
|
new QFilter[]{filter});//采购申请单
|
||||||
|
|
||||||
|
long material = purchaseApply.get(0).getLong("purchaseentry.material");//采购申请分录-资源编码
|
||||||
|
Object purchaseQty = purchaseApply.get(0).get("purchaseentry.purchaseqty");//采购申请分录-采购数量
|
||||||
|
Object entryTaxRate = purchaseApply.get(0).get("purchaseentry.entrytaxrate");//采购申请分录-税率
|
||||||
|
Object price = purchaseApply.get(0).get("purchaseentry.price");//采购申请分录-预估单价
|
||||||
|
Object purchaseEntryId = purchaseApply.get(0).get("purchaseentry.id");//采购申请分录-预估单价
|
||||||
|
Object remarks = purchaseApply.get(0).get("purchaseentry.remarks");//采购申请分录-备注
|
||||||
|
this.getModel().setValue("material", material, curIndex);//资源编码
|
||||||
|
this.getModel().setValue("entrytaxrate", entryTaxRate, curIndex);//税率名称
|
||||||
|
this.getModel().setValue("qty", purchaseQty, curIndex);//数量
|
||||||
|
this.getModel().setValue("price", price, curIndex);//入库单价
|
||||||
|
this.getModel().setValue("listingid", purchaseEntryId, curIndex);//合同清单id
|
||||||
|
this.getModel().setValue("note", remarks, curIndex);//备注
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -217,10 +217,10 @@ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements Bef
|
||||||
|
|
||||||
protected void carryHeadData(DynamicObject applyBill) {
|
protected void carryHeadData(DynamicObject applyBill) {
|
||||||
this.getModel().beginInit();
|
this.getModel().beginInit();
|
||||||
DynamicObject transType = applyBill.getDynamicObject("transtype");
|
// DynamicObject transType = applyBill.getDynamicObject("transtype");
|
||||||
if (transType != null) {
|
// if (transType != null) {
|
||||||
this.getModel().setValue("transtype", transType.getPkValue());
|
// this.getModel().setValue("transtype", transType.getPkValue());
|
||||||
}
|
// }//二开去除:无需携带上游单据的事务类型至出库单
|
||||||
|
|
||||||
DynamicObject supplier = applyBill.getDynamicObject("supplier");
|
DynamicObject supplier = applyBill.getDynamicObject("supplier");
|
||||||
if (supplier != null) {
|
if (supplier != null) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,375 @@
|
||||||
|
//
|
||||||
|
// Source code recreated from a .class file by IntelliJ IDEA
|
||||||
|
// (powered by FernFlower decompiler)
|
||||||
|
//
|
||||||
|
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.dataentity.resource.ResManager;
|
||||||
|
import kd.bos.dataentity.utils.ArrayUtils;
|
||||||
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
|
import kd.bos.form.IFormView;
|
||||||
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.ec.basedata.business.model.cont.OutTreeListingConstant;
|
||||||
|
import kd.ec.material.common.enums.PoundTransTypeEnum;
|
||||||
|
import kd.ec.material.formplugin.MaterialInBillEditPlugin;
|
||||||
|
|
||||||
|
public class PoundAutoFetchBizExt {
|
||||||
|
private final MaterialInBillEditPluginExt plugin;
|
||||||
|
|
||||||
|
public PoundAutoFetchBizExt(MaterialInBillEditPluginExt plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doFetchPound(BeforeDoOperationEventArgs args, IFormView formView) {
|
||||||
|
String matInSource = (String)formView.getModel().getValue("matinsource");
|
||||||
|
if (!StringUtils.isEmpty(matInSource)) {
|
||||||
|
switch (matInSource) {
|
||||||
|
case "1":
|
||||||
|
this.doFetchForContract(args, formView);
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
this.doFetchForPurchase(args, formView);
|
||||||
|
break;
|
||||||
|
case "4":
|
||||||
|
this.doFetchForResource(args, formView);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doFetchForContract(BeforeDoOperationEventArgs args, IFormView formView) {
|
||||||
|
DynamicObject transType = (DynamicObject)formView.getModel().getValue("transtype");
|
||||||
|
if (transType == null) {
|
||||||
|
args.setCancel(true);
|
||||||
|
formView.showTipNotification(ResManager.loadKDString("请先选择事务类型", "PoundAutoFetchBiz_3", "ec-ecma-formplugin", new Object[0]));
|
||||||
|
} else {
|
||||||
|
DynamicObject contract = (DynamicObject)formView.getModel().getValue("contract");
|
||||||
|
if (contract == null) {
|
||||||
|
args.setCancel(true);
|
||||||
|
formView.showTipNotification(ResManager.loadKDString("请先选择合同。", "PoundAutoFetchBiz_0", "ec-ecma-formplugin", new Object[0]));
|
||||||
|
} else {
|
||||||
|
int rowCount = formView.getModel().getEntryRowCount("entryentity");
|
||||||
|
if (rowCount > 0) {
|
||||||
|
formView.getModel().deleteEntryData("entryentity");
|
||||||
|
formView.updateView("entryentity");
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean editUnit = false;
|
||||||
|
DynamicObject project = (DynamicObject)formView.getModel().getValue("project");
|
||||||
|
DynamicObject unitProject = (DynamicObject)formView.getModel().getValue("unitprojectpro");
|
||||||
|
if (project != null) {
|
||||||
|
editUnit = project.getBoolean("editonunit");
|
||||||
|
}
|
||||||
|
|
||||||
|
Long contId = contract.getLong("id");
|
||||||
|
QFilter contFilter = new QFilter("contractid", "=", contId);
|
||||||
|
QFilter resourceFilter = new QFilter("resourceitem", "!=", 0);
|
||||||
|
if (editUnit && unitProject != null) {
|
||||||
|
resourceFilter = resourceFilter.and(new QFilter("listunitproject", "in", new Object[]{unitProject.getPkValue(), 0}));
|
||||||
|
}
|
||||||
|
|
||||||
|
String selectProperties = "resourceitem,measureunit,totalqty,curtaxprice,currentprice,lstoftaxamount,rateobj,cbsnumber,boqnumber";
|
||||||
|
DynamicObject[] treeListingEntities = BusinessDataServiceHelper.load("ec_outtreelisting", selectProperties, new QFilter[]{contFilter, resourceFilter});
|
||||||
|
if (!ArrayUtils.isEmpty(treeListingEntities)) {
|
||||||
|
Map<Long, DynamicObject> resourceGroup = (Map)Stream.of(treeListingEntities).filter((dynamicObject) -> {
|
||||||
|
return Optional.ofNullable(dynamicObject.getDynamicObject("resourceitem")).isPresent();
|
||||||
|
}).collect(Collectors.toMap((dynamicObject) -> {
|
||||||
|
DynamicObject resourceItem = dynamicObject.getDynamicObject("resourceitem");
|
||||||
|
return resourceItem.getLong("id");
|
||||||
|
}, Function.identity(), (k1, k2) -> {
|
||||||
|
return k1;
|
||||||
|
}));
|
||||||
|
Set<Long> resourceIds = resourceGroup.keySet();
|
||||||
|
DynamicObject org = (DynamicObject)formView.getModel().getValue("org");
|
||||||
|
QFilter orgFilter = new QFilter("org", "=", org.getPkValue());
|
||||||
|
if (project != null) {
|
||||||
|
orgFilter = orgFilter.and(new QFilter("project", "=", project.getPkValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Long transTypeId = transType.getLong("id");
|
||||||
|
QFilter transTypeFilter = null;
|
||||||
|
if (transTypeId.equals(PoundTransTypeEnum.POUND_IN.getDefaultId())) {
|
||||||
|
transTypeFilter = new QFilter("transtype", "in", Sets.newHashSet(new Long[]{PoundTransTypeEnum.POUND_IN.getDefaultId()}));
|
||||||
|
} else if (transTypeId.equals(PoundTransTypeEnum.POUND_IN_THEN_OUT.getDefaultId())) {
|
||||||
|
transTypeFilter = new QFilter("transtype", "in", Sets.newHashSet(new Long[]{PoundTransTypeEnum.POUND_IN_THEN_OUT.getDefaultId()}));
|
||||||
|
}
|
||||||
|
|
||||||
|
QFilter depotStatusFilter = new QFilter("depotstatus", "=", Boolean.FALSE);
|
||||||
|
QFilter optTypeFilter = new QFilter("opt_type", "!=", "2");
|
||||||
|
QFilter poundResourceFilter = new QFilter("material", "in", resourceIds);
|
||||||
|
DynamicObject[] poundEntities = BusinessDataServiceHelper.load("ecma_poundbill", "id ,billno ,material ,actualweight", new QFilter[]{orgFilter, transTypeFilter, depotStatusFilter, optTypeFilter, poundResourceFilter});
|
||||||
|
DynamicObject[] var24 = poundEntities;
|
||||||
|
int var25 = poundEntities.length;
|
||||||
|
|
||||||
|
for(int var26 = 0; var26 < var25; ++var26) {
|
||||||
|
DynamicObject poundEntity = var24[var26];
|
||||||
|
DynamicObject resource = poundEntity.getDynamicObject("material");
|
||||||
|
DynamicObject resourceListEntity = (DynamicObject)resourceGroup.get((Long)resource.getPkValue());
|
||||||
|
if (resourceListEntity != null) {
|
||||||
|
Map<String, Object> poundDataMap = Maps.newHashMap();
|
||||||
|
poundDataMap.put("poundid", poundEntity.getPkValue());
|
||||||
|
poundDataMap.put("poundno", poundEntity.getString("billno"));
|
||||||
|
poundDataMap.put("qty", poundEntity.getString("actualweight"));
|
||||||
|
this.fillEntryByContListing(new DynamicObject[]{resourceListEntity}, formView, poundDataMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.plugin.fieldLockLogic();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillEntryByContListing(DynamicObject[] listings, IFormView formView, Map<String, Object> poundDataMap) {
|
||||||
|
for(int i = 0; i < listings.length; ++i) {
|
||||||
|
int curIndex = formView.getModel().createNewEntryRow("entryentity");
|
||||||
|
formView.getModel().updateCache();
|
||||||
|
formView.setEnable(false, curIndex, new String[]{"material", "measureunit", "contprice"});
|
||||||
|
DynamicObject resourceItem = listings[i].getDynamicObject("resourceitem");
|
||||||
|
if (resourceItem != null && resourceItem.get("model") != null && StringUtils.isNotBlank(resourceItem.get("model"))) {
|
||||||
|
formView.setEnable(false, curIndex, new String[]{"modelnum"});
|
||||||
|
}
|
||||||
|
|
||||||
|
formView.getModel().setValue("material", resourceItem, curIndex);
|
||||||
|
formView.getModel().setValue("measureunit", listings[i].get("measureunit"), curIndex);
|
||||||
|
formView.getModel().beginInit();
|
||||||
|
formView.getModel().setValue("qty", poundDataMap.get("qty"), curIndex);
|
||||||
|
formView.getModel().setValue("price", listings[i].get("currentprice"), curIndex);
|
||||||
|
formView.getModel().setValue("contprice", listings[i].get("curtaxprice"), curIndex);
|
||||||
|
formView.getModel().endInit();
|
||||||
|
formView.getModel().setValue("entrytaxrate", listings[i].get("rateobj"), curIndex);
|
||||||
|
formView.updateView("qty", curIndex);
|
||||||
|
formView.updateView("price", curIndex);
|
||||||
|
formView.updateView("contprice", curIndex);
|
||||||
|
formView.updateView("entrytaxrate", curIndex);
|
||||||
|
formView.getModel().setValue("poundid", poundDataMap.get("poundid"), curIndex);
|
||||||
|
formView.getModel().setValue("poundno", poundDataMap.get("poundno"), curIndex);
|
||||||
|
DynamicObject mattaxrateObj = ((DynamicObject)formView.getModel().getEntryEntity("entryentity").get(curIndex)).getDynamicObject("entrytaxrate");
|
||||||
|
BigDecimal taxrate = new BigDecimal(0);
|
||||||
|
if (mattaxrateObj != null) {
|
||||||
|
taxrate = mattaxrateObj.getBigDecimal("taxrate");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.plugin.initContAndOrderData(curIndex, taxrate);
|
||||||
|
formView.getModel().setValue("listingid", listings[i].get(OutTreeListingConstant.ID_ENTITY_PK), curIndex);
|
||||||
|
formView.getModel().setValue("procbs", listings[i].get("cbsnumber"), curIndex);
|
||||||
|
formView.getModel().setValue("proboq", listings[i].get("boqnumber"), curIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doFetchForPurchase(BeforeDoOperationEventArgs args, IFormView formView) {
|
||||||
|
DynamicObject transType = (DynamicObject)formView.getModel().getValue("transtype");
|
||||||
|
if (transType == null) {
|
||||||
|
args.setCancel(true);
|
||||||
|
formView.showTipNotification(ResManager.loadKDString("请先选择事务类型", "PoundAutoFetchBiz_3", "ec-ecma-formplugin", new Object[0]));
|
||||||
|
} else {
|
||||||
|
DynamicObject order = (DynamicObject)formView.getModel().getValue("purchaseorder");
|
||||||
|
if (order == null) {
|
||||||
|
args.setCancel(true);
|
||||||
|
formView.showTipNotification(ResManager.loadKDString("请选择采购订单。", "PoundAutoFetchBiz_1", "ec-ecma-formplugin", new Object[0]));
|
||||||
|
} else {
|
||||||
|
int rowCount = formView.getModel().getEntryRowCount("entryentity");
|
||||||
|
if (rowCount > 0) {
|
||||||
|
formView.getModel().deleteEntryData("entryentity");
|
||||||
|
formView.updateView("entryentity");
|
||||||
|
}
|
||||||
|
|
||||||
|
Long orderId = order.getLong("id");
|
||||||
|
QFilter orderEntryIdFilter = new QFilter("orderentryid", "=", orderId);
|
||||||
|
QFilter orderQtyFilter = new QFilter("surplusqty", ">", 0);
|
||||||
|
String purchaseOrderProperties = "material,surplusqty,modelnum,measureunit,oftaxprice,price,entrytaxrate";
|
||||||
|
DynamicObject[] purchaseOrderEntities = BusinessDataServiceHelper.load("ecma_purchaseorderentry", purchaseOrderProperties, new QFilter[]{orderEntryIdFilter, orderQtyFilter});
|
||||||
|
if (!ArrayUtils.isEmpty(purchaseOrderEntities)) {
|
||||||
|
Map<Long, DynamicObject> resourceGroup = (Map)Stream.of(purchaseOrderEntities).filter((dynamicObject) -> {
|
||||||
|
return Optional.ofNullable(dynamicObject.getDynamicObject("material")).isPresent();
|
||||||
|
}).collect(Collectors.toMap((dynamicObject) -> {
|
||||||
|
return dynamicObject.getDynamicObject("material").getLong("id");
|
||||||
|
}, Function.identity(), (k1, k2) -> {
|
||||||
|
return k1;
|
||||||
|
}));
|
||||||
|
Set<Long> resourceIds = resourceGroup.keySet();
|
||||||
|
DynamicObject org = (DynamicObject)formView.getModel().getValue("org");
|
||||||
|
QFilter orgFilter = new QFilter("org", "=", org.getPkValue());
|
||||||
|
DynamicObject project = (DynamicObject)formView.getModel().getValue("project");
|
||||||
|
if (project != null) {
|
||||||
|
orgFilter = orgFilter.and(new QFilter("project", "=", project.getPkValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
Long transTypeId = transType.getLong("id");
|
||||||
|
QFilter transTypeFilter = null;
|
||||||
|
if (transTypeId.equals(PoundTransTypeEnum.POUND_IN.getDefaultId())) {
|
||||||
|
transTypeFilter = new QFilter("transtype", "in", Sets.newHashSet(new Long[]{PoundTransTypeEnum.POUND_IN.getDefaultId()}));
|
||||||
|
} else if (transTypeId.equals(PoundTransTypeEnum.POUND_IN_THEN_OUT.getDefaultId())) {
|
||||||
|
transTypeFilter = new QFilter("transtype", "in", Sets.newHashSet(new Long[]{PoundTransTypeEnum.POUND_IN_THEN_OUT.getDefaultId()}));
|
||||||
|
}
|
||||||
|
|
||||||
|
QFilter depotStatusFilter = new QFilter("depotstatus", "=", Boolean.FALSE);
|
||||||
|
QFilter optTypeFilter = new QFilter("opt_type", "!=", "2");
|
||||||
|
QFilter poundResourceFilter = new QFilter("material", "in", resourceIds);
|
||||||
|
DynamicObject[] poundEntities = BusinessDataServiceHelper.load("ecma_poundbill", "id ,billno ,material ,actualweight", new QFilter[]{orgFilter, transTypeFilter, depotStatusFilter, optTypeFilter, poundResourceFilter});
|
||||||
|
DynamicObject[] var22 = poundEntities;
|
||||||
|
int var23 = poundEntities.length;
|
||||||
|
|
||||||
|
for(int var24 = 0; var24 < var23; ++var24) {
|
||||||
|
DynamicObject poundEntity = var22[var24];
|
||||||
|
DynamicObject resource = poundEntity.getDynamicObject("material");
|
||||||
|
DynamicObject resourceListEntity = (DynamicObject)resourceGroup.get((Long)resource.getPkValue());
|
||||||
|
if (resourceListEntity != null) {
|
||||||
|
Map<String, Object> poundDataMap = Maps.newHashMap();
|
||||||
|
poundDataMap.put("poundid", poundEntity.getPkValue());
|
||||||
|
poundDataMap.put("poundno", poundEntity.getString("billno"));
|
||||||
|
poundDataMap.put("qty", poundEntity.getBigDecimal("actualweight"));
|
||||||
|
this.fillEntryByOrderListing(new DynamicObject[]{resourceListEntity}, formView, poundDataMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillEntryByOrderListing(DynamicObject[] orderEntries, IFormView formView, Map<String, Object> poundDataMap) {
|
||||||
|
this.plugin.getPageCache().put("entrysourcecache", "purChaseOrderSource");
|
||||||
|
DynamicObject[] var4 = orderEntries;
|
||||||
|
int var5 = orderEntries.length;
|
||||||
|
|
||||||
|
for(int var6 = 0; var6 < var5; ++var6) {
|
||||||
|
DynamicObject o = var4[var6];
|
||||||
|
if (o.getBigDecimal("surplusqty").compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
int row = formView.getModel().createNewEntryRow("entryentity");
|
||||||
|
formView.getModel().updateCache();
|
||||||
|
if (o.getDynamicObject("material") != null) {
|
||||||
|
this.plugin.getView().getModel().setValue("material", o.getDynamicObject("material").getPkValue(), row);
|
||||||
|
}
|
||||||
|
|
||||||
|
formView.getModel().setValue("modelnum", o.get("modelnum"), row);
|
||||||
|
if (o.getDynamicObject("measureunit") != null) {
|
||||||
|
formView.getModel().setValue("measureunit", o.getDynamicObject("measureunit").getPkValue(), row);
|
||||||
|
} else {
|
||||||
|
formView.getModel().setValue("measureunit", (Object)null, row);
|
||||||
|
}
|
||||||
|
|
||||||
|
formView.getModel().beginInit();
|
||||||
|
formView.getModel().setValue("qty", poundDataMap.get("qty"), row);
|
||||||
|
formView.getModel().setValue("contprice", o.get("price"), row);
|
||||||
|
formView.getModel().setValue("price", o.get("oftaxprice"), row);
|
||||||
|
formView.getModel().endInit();
|
||||||
|
formView.getModel().setValue("entrytaxrate", o.get("entrytaxrate"), row);
|
||||||
|
formView.updateView("qty", row);
|
||||||
|
formView.updateView("price", row);
|
||||||
|
formView.updateView("contprice", row);
|
||||||
|
formView.updateView("entrytaxrate", row);
|
||||||
|
formView.getModel().setValue("poundid", poundDataMap.get("poundid"), row);
|
||||||
|
formView.getModel().setValue("poundno", poundDataMap.get("poundno"), row);
|
||||||
|
DynamicObject mattaxrateObj = ((DynamicObject)formView.getModel().getEntryEntity("entryentity").get(row)).getDynamicObject("entrytaxrate");
|
||||||
|
BigDecimal taxrate = new BigDecimal(0);
|
||||||
|
if (mattaxrateObj != null) {
|
||||||
|
taxrate = mattaxrateObj.getBigDecimal("taxrate");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.plugin.initContAndOrderData(row, taxrate);
|
||||||
|
formView.getModel().setValue("orderentryid", o.getPkValue(), row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doFetchForResource(BeforeDoOperationEventArgs args, IFormView formView) {
|
||||||
|
int rowCount = formView.getModel().getEntryRowCount("entryentity");
|
||||||
|
if (rowCount > 0) {
|
||||||
|
formView.getModel().deleteEntryData("entryentity");
|
||||||
|
formView.updateView("entryentity");
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicObject transType = (DynamicObject)formView.getModel().getValue("transtype");
|
||||||
|
if (transType == null) {
|
||||||
|
args.setCancel(true);
|
||||||
|
formView.showTipNotification(ResManager.loadKDString("请先选择事务类型", "PoundAutoFetchBiz_3", "ec-ecma-formplugin", new Object[0]));
|
||||||
|
} else {
|
||||||
|
DynamicObject org = (DynamicObject)formView.getModel().getValue("org");
|
||||||
|
QFilter orgFilter = new QFilter("org", "=", org.getPkValue());
|
||||||
|
DynamicObject project = (DynamicObject)formView.getModel().getValue("project");
|
||||||
|
if (project != null) {
|
||||||
|
orgFilter = orgFilter.and(new QFilter("project", "=", project.getPkValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicObject supplier = (DynamicObject)formView.getModel().getValue("supplier");
|
||||||
|
if (supplier != null) {
|
||||||
|
orgFilter = orgFilter.and(new QFilter("supplier", "=", supplier.getPkValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicObject warehouse = (DynamicObject)formView.getModel().getValue("warehouse");
|
||||||
|
if (warehouse != null) {
|
||||||
|
orgFilter = orgFilter.and(new QFilter("in_depot", "in", Sets.newHashSet(new Object[]{0L, warehouse.getPkValue()})));
|
||||||
|
}
|
||||||
|
|
||||||
|
Long transTypeId = transType.getLong("id");
|
||||||
|
QFilter transTypeFilter = null;
|
||||||
|
if (transTypeId.equals(PoundTransTypeEnum.POUND_IN.getDefaultId())) {
|
||||||
|
transTypeFilter = new QFilter("transtype", "in", Sets.newHashSet(new Long[]{PoundTransTypeEnum.POUND_IN.getDefaultId()}));
|
||||||
|
} else if (transTypeId.equals(PoundTransTypeEnum.POUND_IN_THEN_OUT.getDefaultId())) {
|
||||||
|
transTypeFilter = new QFilter("transtype", "in", Sets.newHashSet(new Long[]{PoundTransTypeEnum.POUND_IN_THEN_OUT.getDefaultId()}));
|
||||||
|
}
|
||||||
|
|
||||||
|
QFilter depotStatusFilter = new QFilter("depotstatus", "=", Boolean.FALSE);
|
||||||
|
QFilter optTypeFilter = new QFilter("opt_type", "!=", "2");
|
||||||
|
DynamicObject[] poundEntities = BusinessDataServiceHelper.load("ecma_poundbill", "id ,billno ,material ,actualweight", new QFilter[]{orgFilter, transTypeFilter, depotStatusFilter, optTypeFilter});
|
||||||
|
if (!ArrayUtils.isEmpty(poundEntities)) {
|
||||||
|
DynamicObject defaultTaxRate = (DynamicObject)formView.getModel().getValue("mataxrate");
|
||||||
|
BigDecimal taxRate = new BigDecimal(0);
|
||||||
|
if (defaultTaxRate != null) {
|
||||||
|
taxRate = defaultTaxRate.getBigDecimal("taxrate");
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicObjectCollection entryEntity = formView.getModel().getEntryEntity("entryentity");
|
||||||
|
DynamicObject[] var18 = poundEntities;
|
||||||
|
int var19 = poundEntities.length;
|
||||||
|
|
||||||
|
for(int var20 = 0; var20 < var19; ++var20) {
|
||||||
|
DynamicObject poundEntity = var18[var20];
|
||||||
|
DynamicObject row = entryEntity.addNew();
|
||||||
|
row.set("poundid", poundEntity.getPkValue());
|
||||||
|
row.set("poundno", poundEntity.getString("billno"));
|
||||||
|
row.set("qty", poundEntity.getBigDecimal("actualweight"));
|
||||||
|
DynamicObject material = poundEntity.getDynamicObject("material");
|
||||||
|
if (material != null) {
|
||||||
|
row.set("material", material);
|
||||||
|
if (defaultTaxRate != null) {
|
||||||
|
row.set("entrytaxrate", defaultTaxRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal price = material.getBigDecimal("price");
|
||||||
|
row.set("price", price);
|
||||||
|
row.set("measureunit", material.get("measureunit"));
|
||||||
|
BigDecimal taxPrice = price.multiply(BigDecimal.ONE.add(taxRate.divide(BigDecimal.valueOf(100L))));
|
||||||
|
row.set("taxprice", taxPrice);
|
||||||
|
BigDecimal ofTaxAmount = poundEntity.getBigDecimal("actualweight").multiply(taxPrice);
|
||||||
|
row.set("oftaxamount", ofTaxAmount);
|
||||||
|
BigDecimal noTaxAmount = poundEntity.getBigDecimal("actualweight").multiply(price);
|
||||||
|
row.set("notaxamount", noTaxAmount);
|
||||||
|
row.set("taxamount", ofTaxAmount.subtract(noTaxAmount));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
formView.getModel().updateEntryCache(entryEntity);
|
||||||
|
formView.updateView("entryentity");
|
||||||
|
this.plugin.fieldLockLogic();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
|
||||||
|
import java.util.EventObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购申请单表单插件:初始默认采购组织等于所属组织
|
||||||
|
*/
|
||||||
|
public class PurchaseAppBillPlugin extends AbstractBillPlugIn {
|
||||||
|
@Override
|
||||||
|
public void afterCreateNewData(EventObject e) {
|
||||||
|
super.afterCreateNewData(e);
|
||||||
|
Object org = this.getModel().getValue("org");//所属组织
|
||||||
|
this.getModel().setValue("purchaseorg", org);//采购组织
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.form.control.Button;
|
||||||
|
import kd.bos.form.control.Control;
|
||||||
|
import kd.bos.form.control.EntryGrid;
|
||||||
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.EventObject;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 采购申请单物料列表插件:返回入库单点击选择采购申请信息
|
||||||
|
*/
|
||||||
|
public class PurchaseApplyEntryPlugin extends AbstractFormPlugin implements Plugin {
|
||||||
|
@Override
|
||||||
|
public void registerListener(EventObject e) {
|
||||||
|
super.registerListener(e);
|
||||||
|
Button btnok = this.getControl("btnok");//确定
|
||||||
|
btnok.addClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void click(EventObject evt) {
|
||||||
|
super.click(evt);
|
||||||
|
Control source = (Control) evt.getSource();
|
||||||
|
if ("btnok".equals(source.getKey())) {
|
||||||
|
EntryGrid entryGrid = this.getControl("zcgj_entryentity");
|
||||||
|
int[] selectRows = entryGrid.getSelectRows();
|
||||||
|
int count = selectRows.length;
|
||||||
|
//分录行数只有一条的时候才能通过接下来两个if
|
||||||
|
if (count == 0) {
|
||||||
|
this.getView().showErrorNotification("请选择一条分录信息!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DynamicObjectCollection qeug_entryentity = getModel().getEntryEntity("zcgj_entryentity");//分录
|
||||||
|
DynamicObjectCollection collection = new DynamicObjectCollection();
|
||||||
|
for (int selectRow : selectRows) {
|
||||||
|
collection.add(qeug_entryentity.get(selectRow));
|
||||||
|
}
|
||||||
|
this.getView().returnDataToParent(collection);//返回所选数据给父级
|
||||||
|
this.getView().close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterCreateNewData(EventObject e) {
|
||||||
|
super.afterCreateNewData(e);
|
||||||
|
Map<String, Object> customParams = this.getView().getFormShowParameter().getCustomParams();
|
||||||
|
Long purchaseApplyId = (Long) customParams.get("purchaseApplyId");//采购申请单ID
|
||||||
|
if (purchaseApplyId != null) {
|
||||||
|
List<Long> entryIds = (List<Long>) customParams.get("entryIds");
|
||||||
|
DynamicObject ecma_purchaseApply = BusinessDataServiceHelper.loadSingle(purchaseApplyId, "ecma_purchaseapply");//采购申请单
|
||||||
|
DynamicObjectCollection purchaseEntryCollection = ecma_purchaseApply.getDynamicObjectCollection("purchaseentry");//采购明细单据体
|
||||||
|
DynamicObjectCollection entryEntityCollection = this.getModel().getEntryEntity("zcgj_entryentity");//分录
|
||||||
|
for (DynamicObject purchaseEntry : purchaseEntryCollection) {
|
||||||
|
Long id = (Long) purchaseEntry.get("id");
|
||||||
|
if (entryIds != null && entryIds.contains(id)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
DynamicObject entryEntityNew = entryEntityCollection.addNew();
|
||||||
|
entryEntityNew.set("zcgj_bigintfield", id);//分录id
|
||||||
|
entryEntityNew.set("zcgj_material", purchaseEntry.get("material"));//物料
|
||||||
|
entryEntityNew.set("zcgj_modelnum", purchaseEntry.getDynamicObject("material").get("model"));//规格型号
|
||||||
|
entryEntityNew.set("zcgj_measureunit", purchaseEntry.get("unit"));//计量单位
|
||||||
|
entryEntityNew.set("zcgj_qty", purchaseEntry.get("purchaseqty"));//数量
|
||||||
|
entryEntityNew.set("zcgj_price", purchaseEntry.get("oftaxprice"));//合同单价(含税)
|
||||||
|
entryEntityNew.set("zcgj_oftaxamt", purchaseEntry.get("oftaxamount"));//本次订单金额(含税)
|
||||||
|
entryEntityNew.set("zcgj_description", purchaseEntry.get("remarks"));//备注
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,68 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
|
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库单保存删除插件:保存、删除时,将入库单数量反写至采购申请单
|
||||||
|
*/
|
||||||
|
public class PurchaseReqBackWriteOp extends AbstractOperationServicePlugIn {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||||
|
super.afterExecuteOperationTransaction(e);
|
||||||
|
|
||||||
|
String operationKey = e.getOperationKey();//操作标识
|
||||||
|
DynamicObject[] dataEntities = e.getDataEntities();
|
||||||
|
List<DynamicObject> modifiedEntities = new ArrayList<>();
|
||||||
|
|
||||||
|
for (DynamicObject model : dataEntities) {
|
||||||
|
long id = model.getLong("id");
|
||||||
|
QFilter f1 = new QFilter("id", "=", id);
|
||||||
|
DynamicObject ecma_MaterialInBill = BusinessDataServiceHelper.loadSingle("ecma_materialinbill", new QFilter[]{f1});//入库单
|
||||||
|
String matInSource = ecma_MaterialInBill.getString("matinsource");//入库来源
|
||||||
|
DynamicObject zcgj_purchaseApply = ecma_MaterialInBill.getDynamicObject("zcgj_purchaseapply");//采购申请
|
||||||
|
if ("6".equals(matInSource) && zcgj_purchaseApply != null) {
|
||||||
|
//为采购申请单时反写数量
|
||||||
|
DynamicObject ecma_purchaseApply = BusinessDataServiceHelper.loadSingle("ecma_purchaseapply",
|
||||||
|
new QFilter[]{new QFilter("id", "=", zcgj_purchaseApply.getLong("id"))});//采购申请单
|
||||||
|
DynamicObjectCollection purchaseEntryCollection = ecma_purchaseApply.getDynamicObjectCollection("purchaseentry");//采购明细单据体
|
||||||
|
DynamicObjectCollection entryEntityCollection = ecma_MaterialInBill.getDynamicObjectCollection("entryentity");//入库单分录
|
||||||
|
for (DynamicObject entryEntity : entryEntityCollection) {
|
||||||
|
String listingId = entryEntity.getString("listingid");//入库单分录-合同清单id
|
||||||
|
|
||||||
|
for (DynamicObject purchaseEntry : purchaseEntryCollection) {
|
||||||
|
String purchaseEntryId = purchaseEntry.getString("id");//采购明细单据体-id
|
||||||
|
if (purchaseEntryId != null && purchaseEntryId.equals(listingId)) {
|
||||||
|
BigDecimal qty = entryEntity.getBigDecimal("qty");//入库单分录-数量
|
||||||
|
BigDecimal inCount = purchaseEntry.getBigDecimal("zcgj_incount");//采购明细单据体-已入库数量
|
||||||
|
if ("save".equals(operationKey)) {
|
||||||
|
purchaseEntry.set("zcgj_incount", inCount.add(qty));//采购明细单据体-已入库数量
|
||||||
|
} else {
|
||||||
|
purchaseEntry.set("zcgj_incount", inCount.subtract(qty));//采购明细单据体-已入库数量
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
modifiedEntities.add(ecma_purchaseApply);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!modifiedEntities.isEmpty()) {
|
||||||
|
try {
|
||||||
|
SaveServiceHelper.save(modifiedEntities.toArray(new DynamicObject[0]));
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue