Revert "fix:"

This reverts commit 1576c2e54c.
This commit is contained in:
ljw 2025-01-21 11:33:02 +08:00
parent 817541ae4c
commit 33a44d9821

View File

@ -5,6 +5,7 @@ import com.alibaba.druid.support.logging.Log;
import com.alibaba.druid.support.logging.LogFactory; import com.alibaba.druid.support.logging.LogFactory;
import com.alibaba.druid.util.StringUtils; import com.alibaba.druid.util.StringUtils;
import com.yem.wm.bc.companytitle.form.CompanyTitleEdit; import com.yem.wm.bc.companytitle.form.CompanyTitleEdit;
import com.yem.wm.es.Util.ZJUtils;
import com.yem.wm.es.contractamtlist.util.FunUtil; import com.yem.wm.es.contractamtlist.util.FunUtil;
import com.yem.wm.es.shippingdetails.util.PaymentControlUtil; import com.yem.wm.es.shippingdetails.util.PaymentControlUtil;
import com.yem.wm.utils.FunctionalCommon; import com.yem.wm.utils.FunctionalCommon;
@ -28,6 +29,7 @@ import kd.bos.form.control.Control;
import kd.bos.form.control.EntryGrid; import kd.bos.form.control.EntryGrid;
import kd.bos.form.events.AfterDoOperationEventArgs; import kd.bos.form.events.AfterDoOperationEventArgs;
import kd.bos.form.events.BeforeDoOperationEventArgs; import kd.bos.form.events.BeforeDoOperationEventArgs;
import kd.bos.form.events.ClientCallBackEvent;
import kd.bos.form.field.BasedataEdit; import kd.bos.form.field.BasedataEdit;
import kd.bos.form.field.TextEdit; import kd.bos.form.field.TextEdit;
import kd.bos.form.field.events.BeforeF7SelectEvent; import kd.bos.form.field.events.BeforeF7SelectEvent;
@ -179,7 +181,10 @@ public class ShippingDetailsFormPlugin extends AbstractBillPlugIn implements Bef
map.put("flag", "B"); map.put("flag", "B");
FunUtil.viewForm("yem_contractamtlistoccupy", map, view); FunUtil.viewForm("yem_contractamtlistoccupy", map, view);
} }
if (key.equals("getmachine")) {
ZJUtils.renewMachineProductInfo(view, model);
// renewMachineProductInfo();
}
//回填海关编码 //回填海关编码
if ("backcustomscode".equals(key) && e.getOperationResult().isSuccess()) { if ("backcustomscode".equals(key) && e.getOperationResult().isSuccess()) {
//回填海关编码 //回填海关编码
@ -433,7 +438,6 @@ public class ShippingDetailsFormPlugin extends AbstractBillPlugIn implements Bef
} }
} }
} }
} }
@Override @Override
@ -473,6 +477,8 @@ public class ShippingDetailsFormPlugin extends AbstractBillPlugIn implements Bef
this.getView().showMessage("删除单已存在下游单,不允许删除!!!"); this.getView().showMessage("删除单已存在下游单,不允许删除!!!");
e.setCancel(true); e.setCancel(true);
} }
qtys(rowIndexs);
} }
if ("yem_es_salesorder_p".equals(name)) { if ("yem_es_salesorder_p".equals(name)) {
Boolean aseqty = aseqty(rowIndexs); Boolean aseqty = aseqty(rowIndexs);
@ -482,6 +488,40 @@ public class ShippingDetailsFormPlugin extends AbstractBillPlugIn implements Bef
} }
} }
private void qtys(int[] rowIndexs) {
Map<Long, BigDecimal> map = new HashMap<>();
for (int rowIndex : rowIndexs) {
DynamicObject yemProductmodel = (DynamicObject) this.getModel().getValue("yem_productmodel", rowIndex);
BigDecimal yemQty = (BigDecimal) this.getModel().getValue("yem_qty", rowIndex);
if (yemProductmodel != null) {
long aLong = yemProductmodel.getDynamicObject("yem_products").getLong("id");
map.merge(aLong, yemQty, (a, b) -> b.add(a));
}
}
DynamicObjectCollection yemEsSalesorderP = this.getModel().getEntryEntity("yem_es_salesorder_p");
if (!yemEsSalesorderP.isEmpty()) {
List<Integer> ints = new ArrayList<>();
for (int i = 0; i < yemEsSalesorderP.size(); i++) {
DynamicObject yemAccessorytype = yemEsSalesorderP.get(i).getDynamicObject("yem_accessorytype");
if (yemAccessorytype != null) {
long aLong = yemAccessorytype.getLong("id");
BigDecimal yemPcstype = yemEsSalesorderP.get(i).getBigDecimal("yem_pcstype");
if (map.get(aLong) != null) {
if (yemPcstype.compareTo(map.get(aLong)) == 0) {
ints.add(i);
} else {
this.getModel().setValue("yem_pcstype", yemPcstype.subtract(map.get(aLong)), i);
}
}
}
}
int[] intArray = ints.stream().mapToInt(Integer::intValue).toArray();
if (intArray.length > 0) {
this.getModel().deleteEntryRows("yem_es_salesorder_p", intArray);
}
}
}
@Override @Override
public void click(EventObject evt) { public void click(EventObject evt) {
Control source = (Control) evt.getSource(); Control source = (Control) evt.getSource();
@ -492,29 +532,43 @@ public class ShippingDetailsFormPlugin extends AbstractBillPlugIn implements Bef
int currentRowIndex = this.getModel().getEntryCurrentRowIndex("yem_es_materialinfo"); int currentRowIndex = this.getModel().getEntryCurrentRowIndex("yem_es_materialinfo");
String yemsourcebilltype = (String) this.getModel().getValue("yem_sourcebilltype"); String yemsourcebilltype = (String) this.getModel().getValue("yem_sourcebilltype");
if ("yem_es_salesorder".equals(yemsourcebilltype)) { if ("yem_es_salesorder".equals(yemsourcebilltype)) {
String yemsourcebillno = (String) this.getModel().getValue("yem_sourcebillno"); DynamicObjectCollection dynamicObjectCollection = this.getModel().getEntryEntity("yem_es_materialinfo");
if (YEM.isNotEmpty(yemsourcebillno)) { if (!dynamicObjectCollection.isEmpty()) {
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle("yem_es_salesorder", "", new QFilter[]{ List<String> list = new ArrayList<>();
new QFilter("billno", QCP.equals, yemsourcebillno), DynamicObject yemEsMaterialinfo = dynamicObjectCollection.get(currentRowIndex);
new QFilter("billstatus", QCP.equals, "C") long yemCoreentryid = yemEsMaterialinfo.getLong("yem_coreentryid");
}); DynamicObjectCollection yemEsSalesorderZ = yemEsMaterialinfo.getDynamicObjectCollection("yem_es_salesorder_z");
if (dynamicObject != null) { if (!yemEsSalesorderZ.isEmpty()){
dynamicObject = BusinessDataServiceHelper.loadSingle(dynamicObject.getPkValue(), dynamicObject.getDynamicObjectType().getName()); for (DynamicObject dynamicObject : yemEsSalesorderZ) {
DynamicObjectCollection dynamicObjectCollection = dynamicObject.getDynamicObjectCollection("yem_es_materialinfo"); String yemVehicleno = dynamicObject.getString("yem_vehicleno");
if (dynamicObjectCollection != null && dynamicObjectCollection.size() > 0) { list.add(yemVehicleno);
DynamicObject dynamicObject1 = dynamicObjectCollection.get(currentRowIndex); }
if (dynamicObject1 != null) { }
DynamicObjectCollection yem_es_salesorder_z = dynamicObject1.getDynamicObjectCollection("yem_es_salesorder_z"); String yemsourcebillno = (String) this.getModel().getValue("yem_sourcebillno");
Map<String, Object> datas = new HashMap(); if (YEM.isNotEmpty(yemsourcebillno)) {
List<DynamicObject> zjNumberList = new ArrayList(); DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle("yem_es_salesorder", "", new QFilter[]{
for (DynamicObject temp : yem_es_salesorder_z) { new QFilter("billno", QCP.equals, yemsourcebillno),
boolean yemIfdelivered = temp.getBoolean("yem_ifdelivered"); new QFilter("billstatus", QCP.equals, "C")
if (!yemIfdelivered) { });
zjNumberList.add(temp); if (dynamicObject != null) {
dynamicObject = BusinessDataServiceHelper.loadSingle(dynamicObject.getPkValue(), dynamicObject.getDynamicObjectType().getName());
DynamicObjectCollection dynamicObject1 = dynamicObject.getDynamicObjectCollection("yem_es_materialinfo");
for (DynamicObject object : dynamicObject1) {
long aLong = object.getLong("id");
if (yemCoreentryid == aLong) {
DynamicObjectCollection yem_es_salesorder_z = object.getDynamicObjectCollection("yem_es_salesorder_z");
Map<String, Object> datas = new HashMap();
List<DynamicObject> zjNumberList = new ArrayList();
for (DynamicObject temp : yem_es_salesorder_z) {
boolean yemIfdelivered = temp.getBoolean("yem_ifdelivered");
String yem_vehicleno = temp.getString("yem_vehicleno");
if (!yemIfdelivered && !list.contains(yem_vehicleno)) {
zjNumberList.add(temp);
}
} }
datas.put("yem_vehicleno", zjNumberList);
parameter.setCustomParams(datas);
} }
datas.put("yem_vehicleno", zjNumberList);
parameter.setCustomParams(datas);
} }
} }
} }
@ -658,16 +712,9 @@ public class ShippingDetailsFormPlugin extends AbstractBillPlugIn implements Bef
break; break;
// case "yem_qty": // case "yem_qty":
case "yem_offeramount": case "yem_offeramount":
DynamicObjectCollection collection = dataEntity.getDynamicObjectCollection("yem_es_salescontrac_s"); this.getView().addClientCallBack("offeramountchanged");
// for (DynamicObject dynamicObject : collection) {
//
// }
for (int i = 0; i < collection.size(); i++) {
BigDecimal raprate = collection.get(i).getBigDecimal("yem_raprate");
BigDecimal offeramount = dataEntity.getBigDecimal("yem_offeramount");
this.getModel().setValue("yem_rapamt", PaymentControlUtil.getAdvancePayment(offeramount, raprate),i);
}
// this.getView().invokeOperation("save");
break; break;
case "yem_bigcabinetnumbers": case "yem_bigcabinetnumbers":
countBigCabinetQty(model);//汇总表头大柜数量 countBigCabinetQty(model);//汇总表头大柜数量
@ -689,7 +736,7 @@ public class ShippingDetailsFormPlugin extends AbstractBillPlugIn implements Bef
// } else { // } else {
// ies.add(i1); // ies.add(i1);
// } // }
}else { } else {
ies.add(i1); ies.add(i1);
} }
} }
@ -700,6 +747,7 @@ public class ShippingDetailsFormPlugin extends AbstractBillPlugIn implements Bef
this.getView().showMessage("数量不允许低于关联调拨数量;,请重新填写"); this.getView().showMessage("数量不允许低于关联调拨数量;,请重新填写");
this.getModel().setValue("yem_qty", e.getChangeSet()[0].getOldValue()); this.getModel().setValue("yem_qty", e.getChangeSet()[0].getOldValue());
} }
extracted1();
case "yem_isdismantlecar": case "yem_isdismantlecar":
extracted(); extracted();
break; break;
@ -710,6 +758,50 @@ public class ShippingDetailsFormPlugin extends AbstractBillPlugIn implements Bef
} }
} }
private void extracted1() {
Map<Long, BigDecimal> map = new HashMap<>();
DynamicObjectCollection yemEsMaterialinfo = this.getModel().getEntryEntity("yem_es_materialinfo");
if (!yemEsMaterialinfo.isEmpty()) {
for (DynamicObject dynamicObject : yemEsMaterialinfo) {
DynamicObject yemProductmodel = dynamicObject.getDynamicObject("yem_productmodel");
if (yemProductmodel != null) {
long aLong = yemProductmodel.getDynamicObject("yem_products").getLong("id");
// long aLong = yemProductmodel.getLong("id");
BigDecimal yemQty = dynamicObject.getBigDecimal("yem_qty");
map.merge(aLong, yemQty, (a, b) -> b.add(a));
}
}
DynamicObjectCollection yemEsSalesorderP = this.getModel().getEntryEntity("yem_es_salesorder_p");
for (int i = 0; i < yemEsSalesorderP.size(); i++) {
DynamicObject dynamicObject = yemEsSalesorderP.get(i);
DynamicObject yemAccessorytype = dynamicObject.getDynamicObject("yem_accessorytype");
if (yemAccessorytype != null) {
long aLong = yemAccessorytype.getLong("id");
if (map.get(aLong) != null) {
this.getModel().setValue("yem_pcstype", map.get(aLong), i);
}
}
}
}
}
@Override
public void clientCallBack(ClientCallBackEvent e) {
super.clientCallBack(e);
String name = e.getName();
if ("offeramountchanged".equals(name)) {
DynamicObject dataEntity = this.getModel().getDataEntity(true);
BigDecimal offeramount = dataEntity.getBigDecimal("yem_offeramount");
DynamicObjectCollection collection = dataEntity.getDynamicObjectCollection("yem_es_salescontrac_s");
for (int i = 0; i < collection.size(); i++) {
BigDecimal raprate = collection.get(i).getBigDecimal("yem_raprate");
this.getModel().setValue("yem_rapamt", PaymentControlUtil.getAdvancePayment(offeramount, raprate), i);
}
// this.getView().invokeOperation("save");
}
}
private void extracted() { private void extracted() {
String value = ((DynamicObject) this.getModel().getValue("yem_billtype")).getString("number"); String value = ((DynamicObject) this.getModel().getValue("yem_billtype")).getString("number");