Compare commits
2 Commits
a5b859ebee
...
725c8ce0f6
Author | SHA1 | Date |
---|---|---|
|
725c8ce0f6 | |
|
470be319e0 |
File diff suppressed because it is too large
Load Diff
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue