入库单优化采购申请分录-采购申请过滤条件

This commit is contained in:
xuhaihui 2025-11-06 17:04:22 +08:00
parent d7e6a066db
commit b18123694a
1 changed files with 31 additions and 7 deletions

View File

@ -376,8 +376,8 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
List<QFilter> qFilters = new ArrayList<>();
String propertyName = beforeF7SelectEvent.getProperty().getName();
if ("zcgj_purchaseapply".equals(propertyName) || "zcgj_purchaseapply_f7".equals(propertyName)) {
//采购申请采购申请分录-采购申请
if ("zcgj_purchaseapply".equals(propertyName)) {
//采购申请
Object fiaccountorg = this.getModel().getValue("fiaccountorg");//财务记账组织
if (fiaccountorg == null) {
this.getView().showErrorNotification("请先填写财务记账组织!!");
@ -388,6 +388,30 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
qFilters.add(new QFilter("fiaccountorg.id", QCP.in, fiaccountorg1.get("id")));//财务记账组织
qFilters.add(new QFilter("billstatus", QCP.equals, "C"));//单据状态为已审核
}
} else if ("zcgj_purchaseapply_f7".equals(propertyName)) {
//采购申请分录-采购申请
Object fiaccountorg = this.getModel().getValue("fiaccountorg");//财务记账组织
if (fiaccountorg == null) {
this.getView().showErrorNotification("请先填写财务记账组织!!");
beforeF7SelectEvent.setCancel(true);
}
DynamicObject fiaccountorg1 = (DynamicObject) fiaccountorg;//财务记账组织
if (fiaccountorg1 != null) {
qFilters.add(new QFilter("fiaccountorg.id", QCP.in, fiaccountorg1.get("id")));//财务记账组织
qFilters.add(new QFilter("billstatus", QCP.equals, "C"));//单据状态为已审核
}
DynamicObjectCollection purchaseApplyEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_purchaseapplyentry");//采购申请分录
int row = beforeF7SelectEvent.getRow();
for (int i = 0; i < purchaseApplyEntryCollection.size(); i++) {
DynamicObject purchaseApplyEntry = purchaseApplyEntryCollection.get(i);
DynamicObject zcgj_purchaseapply_f7 = purchaseApplyEntry.getDynamicObject("zcgj_purchaseapply_f7");//采购申请
if (zcgj_purchaseapply_f7 != null) {
if (row == i){
continue;
}
qFilters.add(new QFilter("id", QCP.not_equals, zcgj_purchaseapply_f7.get("id")));
}
}
} else if ("zcgj_applidepart".equals(propertyName)) {
//申请人部门
Object zcgj_reqperson = this.getModel().getValue("zcgj_reqperson");//申请人
@ -605,16 +629,16 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
*/
private void handleUnsplitFreightLine(DynamicObjectCollection expenseSummaryCollection) {
DynamicObject newFreightLine = new DynamicObject(expenseSummaryCollection.getDynamicObjectType());
// 设置运费行标识
newFreightLine.set("zcgj_isfreightline", true);
// 使用单据头上的字段汇总值
BigDecimal transSoftTaxAmount = (BigDecimal) getModel().getValue("transoftaxamount"); // 含税运费
BigDecimal transAmount = (BigDecimal) getModel().getValue("transamount"); // 总运费
BigDecimal transtaxAmount = (BigDecimal) getModel().getValue("transtaxamount"); // 运费总税额
DynamicObject taxRate = (DynamicObject) getModel().getValue("taxrate"); // 运费税率
// 设置运费行数据
newFreightLine.set("zcgj_pa_amount", transSoftTaxAmount); // 价税合计-含税总运费
newFreightLine.set("zcgj_amountnotax", transAmount); // 不含税金额-总运费
@ -622,7 +646,7 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
if (taxRate != null) {
newFreightLine.set("zcgj_rateval", taxRate.get("taxrate")); // 税率
}
// 设置固定的运费费用项目
DynamicObject ecbd_resource = BusinessDataServiceHelper.loadSingle("ecbd_resource",
"id,zcgj_expenseitem", new QFilter[]{new QFilter("number", QCP.equals, "ZCKS07")});//清单分类-固定运费
@ -631,7 +655,7 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
newFreightLine.set("zcgj_expenseitem", expenseItem);
newFreightLine.set("zcgj_shippingcostitem", expenseItem); // 运费费用项目
}
// 添加到费用汇总分录
expenseSummaryCollection.add(newFreightLine);
}