物料带出分类
This commit is contained in:
parent
ad8767652a
commit
884a97272f
|
@ -5,9 +5,15 @@ import kd.bos.dataentity.entity.DynamicObject;
|
|||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.dataentity.utils.StringUtils;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.form.control.Toolbar;
|
||||
import kd.bos.form.control.events.ItemClickEvent;
|
||||
import kd.bos.form.field.RefBillEdit;
|
||||
import kd.bos.form.field.events.AfterF7SelectEvent;
|
||||
import kd.bos.form.field.events.AfterF7SelectListener;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.EventObject;
|
||||
|
||||
/**
|
||||
* 单据界面插件
|
||||
|
@ -15,6 +21,11 @@ import java.math.BigDecimal;
|
|||
public class ReConBillSplitEditRulePlugin extends AbstractBillPlugIn implements Plugin {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 计算表头已占用金额
|
||||
* @param e
|
||||
*/
|
||||
@Override
|
||||
public void propertyChanged(PropertyChangedArgs e) {
|
||||
super.propertyChanged(e);
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
package shkd.repc.recos.formplugin;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.form.control.EntryGrid;
|
||||
import kd.bos.form.control.TreeEntryGrid;
|
||||
import kd.bos.form.control.events.ListboxClickListener;
|
||||
import kd.bos.form.control.events.SearchEnterListener;
|
||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||
import kd.repc.recos.formplugin.split.base.ReSelectConPlanTreeF7FormPlugin;
|
||||
|
||||
import java.util.EventObject;
|
||||
|
||||
public class ReSelectConPlanTreeF7FromPluginExt extends AbstractFormPlugin {
|
||||
|
||||
|
||||
@Override
|
||||
public void afterBindData(EventObject e) {
|
||||
super.afterBindData(e);
|
||||
DynamicObjectCollection entryEntity = this.getModel().getEntryEntity("entrylist");
|
||||
if (entryEntity!=null&&entryEntity.size()!=0){
|
||||
//默认选中第一行名称焦点
|
||||
TreeEntryGrid treeEntryGrid = (TreeEntryGrid)this.getView().getControl("entrylist");
|
||||
treeEntryGrid.focusCell(0,"entry_name");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,125 +0,0 @@
|
|||
package shkd.repc.repe.formplugin;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.dataentity.resource.ResManager;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.repc.repe.formplugin.order.OrderFormEdit;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
//继承OrderFormEdit,去除自动计算材料单价功能
|
||||
public class OrderFormEditNewPlugin extends OrderFormEdit {
|
||||
|
||||
|
||||
@Override
|
||||
protected void calculatePrice(int rowIndex, String fieldKey, PropertyChangedArgs e) {
|
||||
DynamicObject orderForm = this.getModel().getDataEntity(true);
|
||||
DynamicObjectCollection orderformEntryColl = orderForm.getDynamicObjectCollection("orderformentry");
|
||||
DynamicObject orderFormEntry = (DynamicObject)orderformEntryColl.get(rowIndex);
|
||||
DynamicObject material = orderFormEntry.getDynamicObject("material");
|
||||
if (material != null) {
|
||||
BigDecimal orderCount = orderFormEntry.getBigDecimal("ordercount");
|
||||
BigDecimal unitPrice;
|
||||
BigDecimal transportPrice;
|
||||
BigDecimal installPrice;
|
||||
if (fieldKey.equals("ordercount") && this.getNpFlag(orderForm)) {
|
||||
unitPrice = this.getContractOrderCount(orderForm, material.getPkValue());
|
||||
transportPrice = ((DynamicObject)orderForm.getDynamicObjectCollection("orderformentry").get(rowIndex)).getBigDecimal("contractnum");
|
||||
installPrice = transportPrice.subtract(unitPrice);
|
||||
if (orderCount.compareTo(installPrice) > 0) {
|
||||
this.getView().showTipNotification(ResManager.loadKDString("本次订货数量只可填≤合同剩余数量的值", "OrderFormEdit_25", "repc-repe-formplugin", new Object[0]));
|
||||
orderFormEntry.set("ordercount", 0);
|
||||
}
|
||||
|
||||
orderFormEntry.set("contractremainnum", installPrice.subtract(orderCount));
|
||||
this.getView().setEnable(Boolean.FALSE, rowIndex, new String[]{"brand", "model", "contractnum", "unitprice", "transportprice", "installprice", "taxprice", "taxrate", "description"});
|
||||
}
|
||||
|
||||
unitPrice = orderFormEntry.getBigDecimal("unitprice").setScale(4, 1);
|
||||
transportPrice = orderFormEntry.getBigDecimal("transportprice").setScale(4, 1);
|
||||
installPrice = orderFormEntry.getBigDecimal("installprice").setScale(4, 1);
|
||||
DynamicObject taxRate = orderFormEntry.getDynamicObject("taxrate");
|
||||
BigDecimal totalPrice;
|
||||
BigDecimal noTaxTotalPrice;
|
||||
if (fieldKey.equals("taxprice")) {
|
||||
totalPrice = orderFormEntry.getBigDecimal("taxprice");
|
||||
if (null != taxRate) {
|
||||
noTaxTotalPrice = taxRate.getBigDecimal("taxrate");
|
||||
totalPrice = totalPrice.divide(BigDecimal.ONE.add(noTaxTotalPrice.divide(new BigDecimal("100"))), 4, 4).setScale(4, 4);
|
||||
}
|
||||
|
||||
unitPrice = totalPrice.subtract(transportPrice).subtract(installPrice);
|
||||
// orderFormEntry.set("unitprice", unitPrice);
|
||||
}
|
||||
|
||||
totalPrice = transportPrice.add(unitPrice).add(installPrice);
|
||||
noTaxTotalPrice = orderCount.multiply(totalPrice).setScale(4, 4);
|
||||
BigDecimal taxPrice = totalPrice;
|
||||
BigDecimal taxTotalPrice = noTaxTotalPrice;
|
||||
BigDecimal taxAmount = BigDecimal.ZERO;
|
||||
if (taxRate != null) {
|
||||
BigDecimal rate = taxRate.getBigDecimal("taxrate");
|
||||
taxPrice = totalPrice.multiply(BigDecimal.ONE.add(rate.divide(new BigDecimal("100")))).setScale(4, 4);
|
||||
taxTotalPrice = noTaxTotalPrice.multiply(BigDecimal.ONE.add(rate.divide(new BigDecimal("100")))).setScale(4, 4);
|
||||
taxAmount = noTaxTotalPrice.multiply(rate.divide(new BigDecimal(100))).setScale(4, 4);
|
||||
}
|
||||
|
||||
orderFormEntry.set("totalprice", totalPrice);
|
||||
orderFormEntry.set("notaxtotalprice", noTaxTotalPrice);
|
||||
orderFormEntry.set("taxprice", taxPrice);
|
||||
orderFormEntry.set("taxamount", taxAmount);
|
||||
orderFormEntry.set("taxtotalprice", taxTotalPrice);
|
||||
this.getView().updateView("orderformentry");
|
||||
this.setTotalAmoTaxAndNotTax(orderformEntryColl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private BigDecimal getContractOrderCount(DynamicObject orderForm, Object pkValue) {
|
||||
DynamicObject insideNprContract = orderForm.getDynamicObject("insidenprcontract");
|
||||
String entityName = orderForm.getDynamicObjectType().getName();
|
||||
List<QFilter> qFilters = new ArrayList();
|
||||
qFilters.add(new QFilter("insidenprcontract", "=", insideNprContract.getPkValue()));
|
||||
qFilters.add(new QFilter("isfrom", "=", true));
|
||||
qFilters.add(new QFilter("id", "!=", orderForm.getPkValue()));
|
||||
if ("repe_orderform_change".equals(entityName)) {
|
||||
DynamicObject relatedorderform = orderForm.getDynamicObject("relatedorderform");
|
||||
if (relatedorderform != null) {
|
||||
qFilters.add(new QFilter("id", "!=", relatedorderform.getPkValue()));
|
||||
}
|
||||
}
|
||||
|
||||
DynamicObject[] orderForms = BusinessDataServiceHelper.load("repe_orderform", "material,ordercount", (QFilter[])qFilters.toArray(new QFilter[0]));
|
||||
BigDecimal totalCount = new BigDecimal(0);
|
||||
if (orderForms != null && orderForms.length > 0) {
|
||||
DynamicObject[] var8 = orderForms;
|
||||
int var9 = orderForms.length;
|
||||
|
||||
for(int var10 = 0; var10 < var9; ++var10) {
|
||||
DynamicObject order = var8[var10];
|
||||
DynamicObjectCollection entrys = order.getDynamicObjectCollection("orderformentry");
|
||||
Map<Object, DynamicObject> map = (Map)entrys.stream().collect(Collectors.toMap((item) -> {
|
||||
return item.getDynamicObject("material").getPkValue();
|
||||
}, (item) -> {
|
||||
return item;
|
||||
}, (v1, v2) -> {
|
||||
return v1;
|
||||
}));
|
||||
if (map.containsKey(pkValue)) {
|
||||
BigDecimal ordercount = ((DynamicObject)map.get(pkValue)).getBigDecimal("ordercount");
|
||||
totalCount = totalCount.add(ordercount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return totalCount;
|
||||
}
|
||||
|
||||
}
|
|
@ -109,6 +109,20 @@ public class RepeOrderFormPlugin extends AbstractFormPlugin {
|
|||
this.getModel().setValue("goodsinfo", qeugOrderformentry.get("qeug_goodsinfo"), row1);//商品信息
|
||||
this.getModel().setValue("description", qeugOrderformentry.get("qeug_description"), row1);//备注
|
||||
|
||||
//-----新增字段:2025/5/15--李贵强
|
||||
DynamicObject dynamicObject = qeugOrderformentry.getDynamicObject("qeug_material");
|
||||
if (dynamicObject!=null){
|
||||
DynamicObject groupStandard = BusinessDataServiceHelper.loadSingle("bd_materialgroupdetail", new QFilter("material.id", QCP.equals, dynamicObject.getLong("id")).toArray());
|
||||
if (groupStandard != null) {
|
||||
DynamicObject group = groupStandard.getDynamicObject("group");
|
||||
if (group != null) {
|
||||
this.getModel().setValue("qeug_materialtypeid", group, row1);//物料分类
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue