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();
if (type.equals("yem_xshippingdetails")) {
if ( "yem_es_salesorder_p".equals(name)) {
if ("yem_es_salesorder_p".equals(name)) {
RowDataEntity[] rowDataEntities = e.getRowDataEntities();
DynamicObjectCollection collects = this.getModel().getEntryEntity("yem_es_salesorder_total");
for (RowDataEntity rowDataEntitie : rowDataEntities) {
DynamicObject followcar = rowDataEntitie.getDataEntity();
DynamicObject newEntryEntity = collects.addNew();
newEntryEntity.set("yem_isgifit_tl", true);
newEntryEntity.set("yem_classification_tl", "A");
if (followcar.getDynamicObject("yem_accessorytype") != null) {
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"));
newEntryEntity.set("yem_isgifit_tl", true);
newEntryEntity.set("yem_classification_tl", "A");
if (followcar.getDynamicObject("yem_accessorytype") != null) {
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"));
}
}
}
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
@ -644,187 +650,41 @@ public class ShippingDetailsFormPlugin extends AbstractBillPlugIn implements Bef
case "yem_mincabinetnumbers":
countSmallCabinetQty(model);//汇总表头小柜数量
break;
case "yem_businesssort":
case "yem_qty":
case "yem_vehicleno":
ase(e);
break;
aseqty();
}
}
//1.是否还需要新增行1
//随机资料工具新增是否新增行
private void ase(PropertyChangedArgs e) {
ChangeData changeData = e.getChangeSet()[0];
int rowIndex = changeData.getRowIndex();
int parentRowIndex = changeData.getParentRowIndex();
DynamicObjectCollection materialinfos = this.getModel().getEntryEntity("yem_es_materialinfo");
DynamicObjectCollection collects = this.getModel().getEntryEntity("yem_es_salesorder_total");
if (materialinfos != null) {
DynamicObject materialinfo = materialinfos.get(rowIndex);
if (StringUtil.isNotEmpty(materialinfo.getString("yem_businesssort"))) {
String businesssort = materialinfo.getString("yem_businesssort");
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"));
private Boolean aseqty() {
if (this.getModel().getDataEntityType().getName().equals("yem_xshippingdetails")) {
DynamicObjectCollection yemEsMaterialinfo = this.getModel().getEntryEntity("yem_es_materialinfo");
DynamicObjectCollection yemEsSalesorderTotal = this.getModel().getEntryEntity("yem_es_salesorder_total");
long aLong = 0;
BigDecimal yemQty = BigDecimal.ZERO;
for (DynamicObject dynamicObject : yemEsMaterialinfo) {
String yemBusinesssort = dynamicObject.getString("yem_businesssort");
if (!yemBusinesssort.equals("Z")) {
aLong = dynamicObject.getLong("yem_materiel.id");
yemQty = dynamicObject.getBigDecimal("yem_qty").add(yemQty);
}
if ("P".equals(businesssort) && !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 (yemEsSalesorderTotal.size() > 0) {
for (DynamicObject dynamicObject : yemEsSalesorderTotal) {
if (dynamicObject.getLong("yem_accesmaterial_tl.id") == aLong) {
BigDecimal yemAllocateqtyTl = dynamicObject.getBigDecimal("yem_allocateqty_tl");
if (yemAllocateqtyTl.compareTo(yemQty) > 0) {
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;
}