1.订舱通知单分录变更增删行
This commit is contained in:
ljw 2024-11-06 20:07:18 +08:00
parent 76e8c9d5e7
commit e4b046f5b4

View File

@ -354,39 +354,39 @@ public class ShippingDetailsFormPlugin extends AbstractBillPlugIn implements Bef
} }
String type = this.getModel().getDataEntityType().getName(); String type = this.getModel().getDataEntityType().getName();
if (type.equals("yem_xshippingdetails")) { if (type.equals("yem_xshippingdetails")) {
if ( "yem_es_salesorder_p".equals(name)) { if ("yem_es_salesorder_p".equals(name)) {
RowDataEntity[] rowDataEntities = e.getRowDataEntities(); RowDataEntity[] rowDataEntities = e.getRowDataEntities();
DynamicObjectCollection collects = this.getModel().getEntryEntity("yem_es_salesorder_total"); DynamicObjectCollection collects = this.getModel().getEntryEntity("yem_es_salesorder_total");
for (RowDataEntity rowDataEntitie : rowDataEntities) { for (RowDataEntity rowDataEntitie : rowDataEntities) {
DynamicObject followcar = rowDataEntitie.getDataEntity(); DynamicObject followcar = rowDataEntitie.getDataEntity();
DynamicObject newEntryEntity = collects.addNew(); DynamicObject newEntryEntity = collects.addNew();
newEntryEntity.set("yem_isgifit_tl", true); newEntryEntity.set("yem_isgifit_tl", true);
newEntryEntity.set("yem_classification_tl", "A"); newEntryEntity.set("yem_classification_tl", "A");
if (followcar.getDynamicObject("yem_accessorytype") != null) { if (followcar.getDynamicObject("yem_accessorytype") != null) {
newEntryEntity.set("yem_basicmodel_tl", followcar.getLong("yem_accessorytype.id")); newEntryEntity.set("yem_basicmodel_tl", followcar.getLong("yem_accessorytype.id"));
}
if (StringUtil.isNotEmpty(followcar.getString("yem_volvotype"))) {
newEntryEntity.set("yem_volvotype_tl", followcar.getString("yem_volvotype"));
}
if (followcar.getDynamicObject("yem_accesmaterial") != null) {
newEntryEntity.set("yem_accesmaterial_tl", followcar.getLong("yem_accesmaterial.id"));
newEntryEntity.set("yem_materialname_tl", followcar.getString("yem_accesmaterial.name"));
newEntryEntity.set("yem_materialenname_tl", followcar.getString("yem_accesmaterial.yem_nameen"));
newEntryEntity.set("yem_specification_tl", followcar.getString("yem_accesmaterial.modelnum"));
}
if (followcar.getDynamicObject("yem_acunit") != null) {
newEntryEntity.set("yem_acunit_tl", followcar.getLong("yem_acunit.id"));
newEntryEntity.set("yem_unitfieldbase_tl", followcar.getLong("yem_acunit.id"));
}
if (StringUtil.isNotEmpty(followcar.getString("yem_saleorderno_p"))) {
newEntryEntity.set("yem_constratnb_tl", followcar.getString("yem_saleorderno_p"));
}
newEntryEntity.set("yem_qty_tl", followcar.getBigDecimal("yem_acallqty"));
newEntryEntity.set("yem_qtybase_tl", followcar.getBigDecimal("yem_acallqty"));
newEntryEntity.set("yem_constracteyid_tl", followcar.getLong("yem_constracteyid_p"));
newEntryEntity.set("yem_constractioid_tl", followcar.getLong("id"));
} }
if (StringUtil.isNotEmpty(followcar.getString("yem_volvotype"))) {
newEntryEntity.set("yem_volvotype_tl", followcar.getString("yem_volvotype"));
}
if (followcar.getDynamicObject("yem_accesmaterial") != null) {
newEntryEntity.set("yem_accesmaterial_tl", followcar.getLong("yem_accesmaterial.id"));
newEntryEntity.set("yem_materialname_tl", followcar.getString("yem_accesmaterial.name"));
newEntryEntity.set("yem_materialenname_tl", followcar.getString("yem_accesmaterial.yem_nameen"));
newEntryEntity.set("yem_specification_tl", followcar.getString("yem_accesmaterial.modelnum"));
}
if (followcar.getDynamicObject("yem_acunit") != null) {
newEntryEntity.set("yem_acunit_tl", followcar.getLong("yem_acunit.id"));
newEntryEntity.set("yem_unitfieldbase_tl", followcar.getLong("yem_acunit.id"));
}
if (StringUtil.isNotEmpty(followcar.getString("yem_saleorderno_p"))) {
newEntryEntity.set("yem_constratnb_tl", followcar.getString("yem_saleorderno_p"));
}
newEntryEntity.set("yem_qty_tl", followcar.getBigDecimal("yem_acallqty"));
newEntryEntity.set("yem_qtybase_tl", followcar.getBigDecimal("yem_acallqty"));
newEntryEntity.set("yem_constracteyid_tl", followcar.getLong("yem_constracteyid_p"));
newEntryEntity.set("yem_constractioid_tl", followcar.getLong("id"));
}
} }
} }
super.afterAddRow(e); super.afterAddRow(e);
@ -450,6 +450,12 @@ public class ShippingDetailsFormPlugin extends AbstractBillPlugIn implements Bef
} }
} }
} }
if ("yem_es_materialinfo".equals(name)) {
Boolean aseqty = aseqty();
if (aseqty){
e.setCancel(true);
}
}
} }
@Override @Override
@ -644,187 +650,41 @@ public class ShippingDetailsFormPlugin extends AbstractBillPlugIn implements Bef
case "yem_mincabinetnumbers": case "yem_mincabinetnumbers":
countSmallCabinetQty(model);//汇总表头小柜数量 countSmallCabinetQty(model);//汇总表头小柜数量
break; break;
case "yem_businesssort":
case "yem_qty": case "yem_qty":
case "yem_vehicleno": aseqty();
ase(e);
break;
} }
} }
//1.是否还需要新增行1
//随机资料工具新增是否新增行
private void ase(PropertyChangedArgs e) { private Boolean aseqty() {
ChangeData changeData = e.getChangeSet()[0]; if (this.getModel().getDataEntityType().getName().equals("yem_xshippingdetails")) {
int rowIndex = changeData.getRowIndex(); DynamicObjectCollection yemEsMaterialinfo = this.getModel().getEntryEntity("yem_es_materialinfo");
int parentRowIndex = changeData.getParentRowIndex(); DynamicObjectCollection yemEsSalesorderTotal = this.getModel().getEntryEntity("yem_es_salesorder_total");
DynamicObjectCollection materialinfos = this.getModel().getEntryEntity("yem_es_materialinfo"); long aLong = 0;
BigDecimal yemQty = BigDecimal.ZERO;
DynamicObjectCollection collects = this.getModel().getEntryEntity("yem_es_salesorder_total"); for (DynamicObject dynamicObject : yemEsMaterialinfo) {
if (materialinfos != null) { String yemBusinesssort = dynamicObject.getString("yem_businesssort");
DynamicObject materialinfo = materialinfos.get(rowIndex); if (!yemBusinesssort.equals("Z")) {
if (StringUtil.isNotEmpty(materialinfo.getString("yem_businesssort"))) { aLong = dynamicObject.getLong("yem_materiel.id");
String businesssort = materialinfo.getString("yem_businesssort"); yemQty = dynamicObject.getBigDecimal("yem_qty").add(yemQty);
boolean yemIfgift = materialinfo.getBoolean("yem_ifgift");
if ("Z".equals(businesssort) && !yemIfgift) {
DynamicObjectCollection completemachines = materialinfo.getDynamicObjectCollection("yem_es_salesorder_z");
DynamicObject completemachine = completemachines.get(parentRowIndex);
DynamicObject newEntryEntity = collects.addNew();
newEntryEntity.set("yem_isgifit_tl", yemIfgift);
newEntryEntity.set("yem_classification_tl", businesssort);
if (materialinfo.getDynamicObject("yem_materiel") != null) {
newEntryEntity.set("yem_accesmaterial_tl", materialinfo.getLong("yem_materiel.id"));
}
if (completemachine.getDynamicObject("yem_resourcescode") != null) {
newEntryEntity.set("yem_resource_tl", completemachine.getLong("yem_resourcescode.id"));
}
if (completemachine.getDynamicObject("yem_milltype") != null) {
newEntryEntity.set("yem_basicmodel_tl", completemachine.getLong("yem_milltype.id"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialname"))) {
newEntryEntity.set("yem_materialname_tl", materialinfo.getString("yem_materialname"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialenname"))) {
newEntryEntity.set("yem_materialenname_tl", materialinfo.getString("yem_materialenname"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_specification"))) {
newEntryEntity.set("yem_specification_tl", materialinfo.getString("yem_specification"));
}
if (materialinfo.getDynamicObject("yem_unit") != null) {
newEntryEntity.set("yem_acunit_tl", materialinfo.getLong("yem_unit.id"));
}
newEntryEntity.set("yem_qty_tl", BigDecimal.ONE);
newEntryEntity.set("yem_constractqty_tl", materialinfo.getBigDecimal("yem_needqty"));
//销售单价价格条款
newEntryEntity.set("yem_sapepeclause_tl", materialinfo.getBigDecimal("yem_sapricepriceclause"));
newEntryEntity.set("yem_sapecebase_tl", materialinfo.getBigDecimal("yem_sapriceclausebase"));
//销售金额价格条款
newEntryEntity.set("yem_saamtpecle_tl", materialinfo.getBigDecimal("yem_saamtpriceclause"));
newEntryEntity.set("yem_samtpeceba_tl", materialinfo.getBigDecimal("yem_samtpriceclauseba"));
if (materialinfo.getDynamicObject("yem_baseunit") != null) {
newEntryEntity.set("yem_unitfieldbase_tl", materialinfo.getLong("yem_baseunit.id"));
}
newEntryEntity.set("yem_qtybase_tl", materialinfo.getBigDecimal("yem_baseqty"));
newEntryEntity.set("yem_storageqty_tl", materialinfo.getBigDecimal("yem_storageqty"));
if (StringUtil.isNotEmpty(completemachine.getString("yem_vehicleno"))) {
newEntryEntity.set("yem_zjnumber_tl", completemachine.getString("yem_vehicleno"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_contractno"))) {
newEntryEntity.set("yem_constratnb_tl", materialinfo.getString("yem_contractno"));
}
newEntryEntity.set("yem_constractioid_tl", materialinfo.getLong("id"));
newEntryEntity.set("yem_constracteyid_tl", materialinfo.getLong("yem_sourceentryid"));
// newEntryEntity.set("yem_constracteyid_tl", completemachine.getLong("yem_soureceid"));
// 汇总影响调拨价
newEntryEntity.set("yem_impactprice1", materialinfo.getString("yem_impactprice"));
} }
if ("P".equals(businesssort) && !yemIfgift) { }
DynamicObject newEntryEntity = collects.addNew(); if (yemEsSalesorderTotal.size() > 0) {
for (DynamicObject dynamicObject : yemEsSalesorderTotal) {
newEntryEntity.set("yem_isgifit_tl", yemIfgift); if (dynamicObject.getLong("yem_accesmaterial_tl.id") == aLong) {
newEntryEntity.set("yem_classification_tl", businesssort); BigDecimal yemAllocateqtyTl = dynamicObject.getBigDecimal("yem_allocateqty_tl");
if (materialinfo.getDynamicObject("yem_materiel") != null) { if (yemAllocateqtyTl.compareTo(yemQty) > 0) {
newEntryEntity.set("yem_accesmaterial_tl", materialinfo.getLong("yem_materiel.id")); this.getView().showMessage("删除单已存在下游单,不允许删除!!!");
return true;
} else {
dynamicObject.set("yem_qty_tl", yemQty);
}
} }
if (materialinfo.getDynamicObject("yem_resourcenog") != null) {
newEntryEntity.set("yem_resource_tl", materialinfo.getLong("yem_resourcenog.id"));
}
if (materialinfo.getDynamicObject("yem_productmodel") != null) {
newEntryEntity.set("yem_basicmodel_tl", materialinfo.getLong("yem_productmodel.yem_products.id"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialname"))) {
newEntryEntity.set("yem_materialname_tl", materialinfo.getString("yem_materialname"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialenname"))) {
newEntryEntity.set("yem_materialenname_tl", materialinfo.getString("yem_materialenname"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_specification"))) {
newEntryEntity.set("yem_specification_tl", materialinfo.getString("yem_specification"));
}
if (materialinfo.getDynamicObject("yem_unit") != null) {
newEntryEntity.set("yem_acunit_tl", materialinfo.getLong("yem_unit.id"));
}
newEntryEntity.set("yem_qty_tl", materialinfo.getBigDecimal("yem_qty"));
newEntryEntity.set("yem_constractqty_tl", materialinfo.getBigDecimal("yem_needqty"));
//销售单价价格条款
newEntryEntity.set("yem_sapepeclause_tl", materialinfo.getBigDecimal("yem_sapricepriceclause"));
newEntryEntity.set("yem_sapecebase_tl", materialinfo.getBigDecimal("yem_sapriceclausebase"));
//销售金额价格条款
newEntryEntity.set("yem_saamtpecle_tl", materialinfo.getBigDecimal("yem_saamtpriceclause"));
newEntryEntity.set("yem_samtpeceba_tl", materialinfo.getBigDecimal("yem_samtpriceclauseba"));
if (materialinfo.getDynamicObject("yem_baseunit") != null) {
newEntryEntity.set("yem_unitfieldbase_tl", materialinfo.getLong("yem_baseunit.id"));
}
newEntryEntity.set("yem_qtybase_tl", materialinfo.getBigDecimal("yem_baseqty"));
newEntryEntity.set("yem_storageqty_tl", materialinfo.getBigDecimal("yem_storageqty"));
if (StringUtil.isNotEmpty(materialinfo.getString("yem_contractno"))) {
newEntryEntity.set("yem_constratnb_tl", materialinfo.getString("yem_contractno"));
}
newEntryEntity.set("yem_constractioid_tl", materialinfo.getLong("id"));
newEntryEntity.set("yem_constracteyid_tl", materialinfo.getLong("yem_sourceentryid"));
// 汇总影响调拨价
newEntryEntity.set("yem_impactprice1", materialinfo.getString("yem_impactprice"));
}
if (yemIfgift) {
DynamicObject newEntryEntity = collects.addNew();
newEntryEntity.set("yem_isgifit_tl", yemIfgift);
newEntryEntity.set("yem_classification_tl", businesssort);
if (materialinfo.getDynamicObject("yem_materiel") != null) {
newEntryEntity.set("yem_accesmaterial_tl", materialinfo.getLong("yem_materiel.id"));
}
if (materialinfo.getDynamicObject("yem_resourcenog") != null) {
newEntryEntity.set("yem_resource_tl", materialinfo.getLong("yem_resourcenog.id"));
}
if (materialinfo.getDynamicObject("yem_productmodel") != null) {
newEntryEntity.set("yem_basicmodel_tl", materialinfo.getLong("yem_productmodel.yem_products.id"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialname"))) {
newEntryEntity.set("yem_materialname_tl", materialinfo.getString("yem_materialname"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialenname"))) {
newEntryEntity.set("yem_materialenname_tl", materialinfo.getString("yem_materialenname"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_specification"))) {
newEntryEntity.set("yem_specification_tl", materialinfo.getString("yem_specification"));
}
if (materialinfo.getDynamicObject("yem_unit") != null) {
newEntryEntity.set("yem_acunit_tl", materialinfo.getLong("yem_unit.id"));
}
newEntryEntity.set("yem_qty_tl", materialinfo.getBigDecimal("yem_qty"));
newEntryEntity.set("yem_constractqty_tl", materialinfo.getBigDecimal("yem_needqty"));
//销售单价价格条款
newEntryEntity.set("yem_sapepeclause_tl", materialinfo.getBigDecimal("yem_sapricepriceclause"));
newEntryEntity.set("yem_sapecebase_tl", materialinfo.getBigDecimal("yem_sapriceclausebase"));
//销售金额价格条款
newEntryEntity.set("yem_saamtpecle_tl", materialinfo.getBigDecimal("yem_saamtpriceclause"));
newEntryEntity.set("yem_samtpeceba_tl", materialinfo.getBigDecimal("yem_samtpriceclauseba"));
if (materialinfo.getDynamicObject("yem_baseunit") != null) {
newEntryEntity.set("yem_unitfieldbase_tl", materialinfo.getLong("yem_baseunit.id"));
}
newEntryEntity.set("yem_qtybase_tl", materialinfo.getBigDecimal("yem_baseqty"));
newEntryEntity.set("yem_storageqty_tl", materialinfo.getBigDecimal("yem_storageqty"));
// if (materialinfo.getDynamicObject("yem_materiel")!=null) {
// newEntryEntity.set("yem_zjnumber_tl", materialinfo.getLong("yem_materiel.id"));
// }
if (StringUtil.isNotEmpty(materialinfo.getString("yem_contractno"))) {
newEntryEntity.set("yem_constratnb_tl", materialinfo.getString("yem_contractno"));
}
newEntryEntity.set("yem_constractioid_tl", materialinfo.getLong("id"));
newEntryEntity.set("yem_constracteyid_tl", materialinfo.getLong("yem_sourceentryid"));
// 汇总影响调拨价
newEntryEntity.set("yem_impactprice1", materialinfo.getString("yem_impactprice"));
} }
} }
} }
return null;
} }