入库单优化计量单位隐显逻辑与对应出库单需要优化的逻辑

This commit is contained in:
xuhaihui 2025-11-17 16:07:38 +08:00
parent 5229927bba
commit c575a7886e
3 changed files with 52 additions and 4 deletions

View File

@ -1998,10 +1998,17 @@ public class MaterialInBillEditPluginExt extends AbstractEcmaBillPlugin implemen
this.getModel().setValue("material", resourceItem, curIndex); this.getModel().setValue("material", resourceItem, curIndex);
this.getModel().setValue("measureunit", listings[i].get("measureunit"), curIndex); this.getModel().setValue("measureunit", listings[i].get("measureunit"), curIndex);
//二开添加
Object pkValue = listings[i].getPkValue(); Object pkValue = listings[i].getPkValue();
QFilter filter = new QFilter("listmodelentry.sublistentry.id", QCP.equals, pkValue); QFilter filter = new QFilter("listmodelentry.sublistentry.id", QCP.equals, pkValue);
DynamicObjectCollection ec_out_contract = QueryServiceHelper.query("ec_out_contract", "listmodelentry.sublistentry.zcgj_treeresitemmodel2", new QFilter[]{filter}); DynamicObjectCollection ec_out_contract = QueryServiceHelper.query("ec_out_contract", "listmodelentry.sublistentry.zcgj_treeresitemmodel2", new QFilter[]{filter});
this.getModel().setValue("modelnum", ec_out_contract.get(0).get("listmodelentry.sublistentry.zcgj_treeresitemmodel2"), curIndex);//资源规格型号(二开添加 if (ec_out_contract.size() > 0) {
Object modelnum = ec_out_contract.get(0).get("listmodelentry.sublistentry.zcgj_treeresitemmodel2");
if (modelnum != null) {
this.getModel().setValue("modelnum", modelnum, curIndex);//资源规格型号
}
}
//二开添加
this.getModel().setValue("entrytaxrate", listings[i].get("rateobj"), curIndex);//税率名称 this.getModel().setValue("entrytaxrate", listings[i].get("rateobj"), curIndex);//税率名称
this.getModel().beginInit(); this.getModel().beginInit();
this.getModel().setValue("qty", listings[i].get("totalqty"), curIndex);//数量 this.getModel().setValue("qty", listings[i].get("totalqty"), curIndex);//数量

View File

@ -72,6 +72,18 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
} }
} }
@Override
public void afterCopyData(EventObject e) {
super.afterCopyData(e);
updateMeasureUnitEnableState();
}
@Override
public void afterBindData(EventObject e) {
super.afterBindData(e);
updateMeasureUnitEnableState();
}
@Override @Override
public void afterCreateNewData(EventObject e) { public void afterCreateNewData(EventObject e) {
super.afterCreateNewData(e); super.afterCreateNewData(e);
@ -136,6 +148,7 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
this.getModel().deleteEntryRow("entryentity", index); this.getModel().deleteEntryRow("entryentity", index);
} }
this.getView().updateView("entryentity"); this.getView().updateView("entryentity");
updateMeasureUnitEnableState();
} }
} }
@ -154,9 +167,7 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
this.getModel().setValue("entrytaxrate", bd_taxrate, rowIndex);//入库单明细-税率 this.getModel().setValue("entrytaxrate", bd_taxrate, rowIndex);//入库单明细-税率
} }
} }
} else if ("zcgj_entryentity".equals(entryName)) { updateMeasureUnitEnableState();
//合同进项发票信息发票分录-新增行
System.out.println();
} }
} }
@ -207,6 +218,7 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
if (newValue == null || !newValue.equals(oldValue)) { if (newValue == null || !newValue.equals(oldValue)) {
this.getModel().setValue("zcgj_purchaseapply", null);//清空采购申请 this.getModel().setValue("zcgj_purchaseapply", null);//清空采购申请
} }
updateMeasureUnitEnableState();
} else if ("zcgj_reqperson".equals(key)) { } else if ("zcgj_reqperson".equals(key)) {
//物资申请人 //物资申请人
ChangeData[] changeSet = e.getChangeSet(); ChangeData[] changeSet = e.getChangeSet();
@ -1059,4 +1071,25 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
} }
} }
} }
private void updateMeasureUnitEnableState() {
DynamicObject fiaccountorg = (DynamicObject) this.getModel().getValue("fiaccountorg");
if (fiaccountorg != null) {
QFilter filter = new QFilter("zcgj_companyblentry.zcgj_org.id", QCP.equals, fiaccountorg.getPkValue());
filter.and(new QFilter("number", QCP.equals, "001"));
DynamicObject zcgj_companybelong = QueryServiceHelper.queryOne("zcgj_companybelong", "number,zcgj_companyblentry.zcgj_wareunit", new QFilter[]{filter});
if (zcgj_companybelong != null) {
Boolean zcgj_wareunit = (Boolean) zcgj_companybelong.get("zcgj_companyblentry.zcgj_wareunit");
if (zcgj_wareunit) {
this.getModel().setValue("zcgj_unit_locked", true);//计量单位锁定开发字段勿删
} else {
this.getModel().setValue("zcgj_unit_locked", false);//计量单位锁定开发字段勿删
}
} else {
this.getModel().setValue("zcgj_unit_locked", false);//计量单位锁定开发字段勿删
}
} else {
this.getModel().setValue("zcgj_unit_locked", false);//计量单位锁定开发字段勿删
}
}
} }

View File

@ -154,6 +154,7 @@ public class MaterialOutBillPlugin extends AbstractBillPlugIn implements BeforeF
DynamicObject org = (DynamicObject) this.getModel().getValue("org");//事务类型 DynamicObject org = (DynamicObject) this.getModel().getValue("org");//事务类型
DynamicObject material = dataEntity.getDynamicObject("material");//资源编码 DynamicObject material = dataEntity.getDynamicObject("material");//资源编码
String modelnum1 = dataEntity.getString("modelnum");//规格型号 String modelnum1 = dataEntity.getString("modelnum");//规格型号
DynamicObject measureunit = dataEntity.getDynamicObject("measureunit");//计量单位
if (warehouse != null && transType != null && "REDUCE".equals(transType.getString("type")) && org != null && material != null) { if (warehouse != null && transType != null && "REDUCE".equals(transType.getString("type")) && org != null && material != null) {
DynamicObject warehouse1 = (DynamicObject) warehouse;//发货仓库 DynamicObject warehouse1 = (DynamicObject) warehouse;//发货仓库
DynamicObject project = warehouse1.getDynamicObject("project");//发货仓库-项目 DynamicObject project = warehouse1.getDynamicObject("project");//发货仓库-项目
@ -164,6 +165,9 @@ public class MaterialOutBillPlugin extends AbstractBillPlugIn implements BeforeF
qFilters.and(new QFilter("org", QCP.equals, org.getPkValue()));//即时库存-所属组织 qFilters.and(new QFilter("org", QCP.equals, org.getPkValue()));//即时库存-所属组织
qFilters.and(new QFilter("material", QCP.equals, material.getPkValue()));//即时库存-资源名称 qFilters.and(new QFilter("material", QCP.equals, material.getPkValue()));//即时库存-资源名称
qFilters.and(new QFilter("modelnum", QCP.equals, modelnum1));//即时库存-规格型号 qFilters.and(new QFilter("modelnum", QCP.equals, modelnum1));//即时库存-规格型号
if (measureunit != null) {
qFilters.and(new QFilter("measureunit", QCP.equals, measureunit.getPkValue()));//即时库存-计量单位
}
DynamicObject ecma_matinventory = BusinessDataServiceHelper.loadSingle("ecma_matinventory", new QFilter[]{qFilters});//即时库存 DynamicObject ecma_matinventory = BusinessDataServiceHelper.loadSingle("ecma_matinventory", new QFilter[]{qFilters});//即时库存
if (ecma_matinventory != null) { if (ecma_matinventory != null) {
BigDecimal qty = ecma_matinventory.getBigDecimal("qty");//即时库存-可用数量 BigDecimal qty = ecma_matinventory.getBigDecimal("qty");//即时库存-可用数量
@ -227,6 +231,7 @@ public class MaterialOutBillPlugin extends AbstractBillPlugIn implements BeforeF
DynamicObject org = (DynamicObject) this.getModel().getValue("org");//事务类型 DynamicObject org = (DynamicObject) this.getModel().getValue("org");//事务类型
DynamicObject material = dataEntity.getDynamicObject("material");//资源编码 DynamicObject material = dataEntity.getDynamicObject("material");//资源编码
String modelnum1 = dataEntity.getString("modelnum");//规格型号 String modelnum1 = dataEntity.getString("modelnum");//规格型号
DynamicObject measureunit = dataEntity.getDynamicObject("measureunit");//计量单位
if (warehouse != null && transType != null && "REDUCE".equals(transType.getString("type")) && org != null && material != null) { if (warehouse != null && transType != null && "REDUCE".equals(transType.getString("type")) && org != null && material != null) {
DynamicObject warehouse1 = (DynamicObject) warehouse;//发货仓库 DynamicObject warehouse1 = (DynamicObject) warehouse;//发货仓库
DynamicObject project = warehouse1.getDynamicObject("project");//发货仓库-项目 DynamicObject project = warehouse1.getDynamicObject("project");//发货仓库-项目
@ -237,6 +242,9 @@ public class MaterialOutBillPlugin extends AbstractBillPlugIn implements BeforeF
qFilters.and(new QFilter("org", QCP.equals, org.getPkValue()));//即时库存-所属组织 qFilters.and(new QFilter("org", QCP.equals, org.getPkValue()));//即时库存-所属组织
qFilters.and(new QFilter("material", QCP.equals, material.getPkValue()));//即时库存-资源名称 qFilters.and(new QFilter("material", QCP.equals, material.getPkValue()));//即时库存-资源名称
qFilters.and(new QFilter("modelnum", QCP.equals, modelnum1));//即时库存-规格型号 qFilters.and(new QFilter("modelnum", QCP.equals, modelnum1));//即时库存-规格型号
if (measureunit != null) {
qFilters.and(new QFilter("measureunit", QCP.equals, measureunit.getPkValue()));//即时库存-计量单位
}
DynamicObject ecma_matinventory = BusinessDataServiceHelper.loadSingle("ecma_matinventory", new QFilter[]{qFilters});//即时库存 DynamicObject ecma_matinventory = BusinessDataServiceHelper.loadSingle("ecma_matinventory", new QFilter[]{qFilters});//即时库存
if (ecma_matinventory != null) { if (ecma_matinventory != null) {
BigDecimal qty = ecma_matinventory.getBigDecimal("qty");//即时库存-可用数量 BigDecimal qty = ecma_matinventory.getBigDecimal("qty");//即时库存-可用数量