diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/PayApplySaveOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/PayApplySaveOperation.java index 00dc56f..efe93ef 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/operate/PayApplySaveOperation.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/PayApplySaveOperation.java @@ -89,14 +89,18 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem private DynamicObject xdMembersubject(DynamicObject bill){ //SAP应付凭证生成付款申请单后,系统自动根据配置表(shjh_request_account)带出资金计划科目 - QFilter qFilter = new QFilter("id",QCP.is_notnull,null); + QFilter qFilter = new QFilter("shjh_biztype", QCP.equals,"A");//业务类型:付款 + qFilter.and(new QFilter("enable", QCP.equals, "1"));//启用 + qFilter.and(new QFilter("status", QCP.equals, "C"));//审核 //公司范围_多选基础资料 && 不包含公司 DynamicObject applyorg = bill.getDynamicObject("applyorg"); if (null != applyorg) { Long orgid = applyorg.getLong("id"); QFilter q1 = new QFilter("shjh_companys.fbasedataid", QCP.equals, orgid); QFilter q2 = new QFilter("shjh_companys.fbasedataid", QCP.equals, null);//in 或者配置表公司为空 - qFilter = qFilter.and(q1.or(q2)); + QFilter q3 = new QFilter("shjh_bbhzz.fbasedataid", QCP.equals, orgid); + QFilter q4 = new QFilter("shjh_bbhzz.fbasedataid", QCP.equals, null);//不包含不包含公司 + qFilter = qFilter.and(q1.or(q2)).and(q3.or(q4)); } //业务大类 && 不包含业务大类 @@ -108,6 +112,9 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem QFilter q3 = new QFilter("shjh_bbhywdl.fbasedataid", QCP.equals, shjhBizbigid);//不包含业务大类 QFilter q4 = new QFilter("shjh_bbhywdl.fbasedataid", QCP.equals, null); qFilter = qFilter.and(q1.or(q2)).and(q3.or(q4)); + }else { + QFilter q2 = new QFilter("shjh_bizbig.fbasedataid", QCP.equals, null); + qFilter = qFilter.and(q2); } //业务小类 DynamicObject shjhbizsmall = bill.getDynamicObject("shjh_basedatafield"); @@ -116,14 +123,21 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem QFilter q1 = new QFilter("shjh_bizsmall.fbasedataid", QCP.equals, shjhbizsmallid); QFilter q2 = new QFilter("shjh_bizsmall.fbasedataid", QCP.equals, null); qFilter = qFilter.and(q1.or(q2)); + }else { + QFilter q2 = new QFilter("shjh_bizsmall.fbasedataid", QCP.equals, null); + qFilter = qFilter.and(q2); } //原因码_多选基础资料 DynamicObject shjhYym = bill.getDynamicObject("shjh_yym"); if (null != shjhYym) { Long yymid = shjhYym.getLong("id"); - QFilter q9 = new QFilter("shjh_yym.fbasedataid", QCP.equals, yymid); - qFilter = qFilter.and(q9); + QFilter q1 = new QFilter("shjh_yym.fbasedataid", QCP.equals, yymid); + QFilter q2 = new QFilter("shjh_yym.fbasedataid", QCP.equals, null); + qFilter = qFilter.and(q1.or(q2)); + }else { + QFilter q2 = new QFilter("shjh_yym.fbasedataid", QCP.equals, null); + qFilter = qFilter.and(q2); } //是否充值类 @@ -150,6 +164,9 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem QFilter q6 = new QFilter("shjh_division.fbasedataid", QCP.equals, divisionid); QFilter q7 = new QFilter("shjh_division.fbasedataid", QCP.equals, null); qFilter = qFilter.and(q6.or(q7)); + }else { + QFilter q7 = new QFilter("shjh_division.fbasedataid", QCP.equals, null); + qFilter = qFilter.and(q7); } } } @@ -158,8 +175,12 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem DynamicObject shjhSapkjkm = bill.getDynamicObject("shjh_sapkjkm"); if (null != shjhSapkjkm) { Long kjkmid = shjhSapkjkm.getLong("id"); - QFilter q10 = new QFilter("shjh_kjkm.fbasedataid", QCP.equals, kjkmid); - qFilter = qFilter.and(q10); + QFilter q6 = new QFilter("shjh_kjkm.fbasedataid", QCP.equals, kjkmid); + QFilter q7 = new QFilter("shjh_kjkm.fbasedataid", QCP.equals, null); + qFilter = qFilter.and(q6.or(q7)); + }else { + QFilter q7 = new QFilter("shjh_kjkm.fbasedataid", QCP.equals, null); + qFilter = qFilter.and(q7); } //供应商_多选基础资料 分录 @@ -177,6 +198,9 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem QFilter q33 = new QFilter("shjh_bbhgys.fbasedataid", QCP.equals, eAsstactid);//不包含供应商 QFilter q44 = new QFilter("shjh_bbhgys.fbasedataid", QCP.equals, null); qFilter = qFilter.and(q11.or(q22)).and(q33.or(q44)); + }else { + QFilter q22 = new QFilter("shjh_supplier.fbasedataid", QCP.equals, null); + qFilter = qFilter.and(q22); } } //客户(bd_customer)||供应商(bd_supplier) @@ -190,6 +214,9 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem QFilter q33 = new QFilter("shjh_bbhkh.fbasedataid", QCP.equals, eAsstactid);//不包含客户 QFilter q44 = new QFilter("shjh_bbhkh.fbasedataid", QCP.equals, null); qFilter = qFilter.and(q11.or(q22)).and(q33.or(q44)); + }else { + QFilter q22 = new QFilter("shjh_kh.fbasedataid", QCP.equals, null); + qFilter = qFilter.and(q22); } } } @@ -205,6 +232,9 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem QFilter q33 = new QFilter("shjh_bbhcgz.fbasedataid", QCP.equals, cgzid);//不包含采购粗 QFilter q44 = new QFilter("shjh_bbhcgz.fbasedataid", QCP.equals, null); qFilter = qFilter.and(q11.or(q22)).and(q33.or(q44)); + }else { + QFilter q22 = new QFilter("shjh_cgz.fbasedataid", QCP.equals, null); + qFilter = qFilter.and(q22); } @@ -216,6 +246,9 @@ public class PayApplySaveOperation extends AbstractOperationServicePlugIn implem QFilter q6 = new QFilter("shjh_bbhdjlx", QCP.like, "%"+shjhExternalsystemdocume+"%"); QFilter q7 = new QFilter("shjh_bbhdjlx", QCP.equals, null); qFilter = qFilter.and(q4.or(q5)).and(q6.or(q7)); + }else { + QFilter q5 = new QFilter("shjh_billtype", QCP.equals, null); + qFilter = qFilter.and(q5); } //不包含币种 currency diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/PayBillSaveOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/PayBillSaveOperation.java index 5bff86f..5a8cca3 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/operate/PayBillSaveOperation.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/PayBillSaveOperation.java @@ -50,6 +50,8 @@ public class PayBillSaveOperation extends AbstractOperationServicePlugIn impleme private DynamicObject xdMembersubject(DynamicObject bill){ //付款单,系统自动根据配置表(shjh_pay_account)带出资金计划科目 QFilter qFilter = new QFilter("shjh_biztype", QCP.equals,"A");//业务类型:付款 + qFilter.and(new QFilter("enable", QCP.equals, "1"));//启用 + qFilter.and(new QFilter("status", QCP.equals, "C"));//审核 //公司范围_多选基础资料 && 不包含公司范围 DynamicObject openorg = bill.getDynamicObject("openorg"); if (null != openorg) { @@ -69,6 +71,9 @@ public class PayBillSaveOperation extends AbstractOperationServicePlugIn impleme QFilter q3 = new QFilter("shjh_bbhywdl.fbasedataid", QCP.equals, shjhBizbigid);//不包含业务大类 QFilter q4 = new QFilter("shjh_bbhywdl.fbasedataid", QCP.equals, null); qFilter = qFilter.and(q1.or(q2)).and(q3.or(q4)); + }else { + QFilter q2 = new QFilter("shjh_companys.fbasedataid", QCP.equals, null);//包含业务大类 + qFilter = qFilter.and(q2); } //业务小类 DynamicObject shjhbizsmall = bill.getDynamicObject("shjh_bizsmall"); @@ -77,6 +82,9 @@ public class PayBillSaveOperation extends AbstractOperationServicePlugIn impleme QFilter q1 = new QFilter("shjh_bizsmall.fbasedataid", QCP.equals, shjhbizsmallid); QFilter q2 = new QFilter("shjh_bizsmall.fbasedataid", QCP.equals, null); qFilter = qFilter.and(q1.or(q2)); + }else { + QFilter q2 = new QFilter("shjh_bizsmall.fbasedataid", QCP.equals, null); + qFilter = qFilter.and(q2); } //成本中心 shjh_costcenter DynamicObject shjhCostcenter = bill.getDynamicObject("shjh_costcenter"); @@ -85,6 +93,9 @@ public class PayBillSaveOperation extends AbstractOperationServicePlugIn impleme QFilter q1 = new QFilter("shjh_cc.fbasedataid", QCP.equals, costcenterid); QFilter q2 = new QFilter("shjh_cc.fbasedataid", QCP.equals, null); qFilter = qFilter.and(q1.or(q2)); + }else { + QFilter q2 = new QFilter("shjh_cc.fbasedataid", QCP.equals, null); + qFilter = qFilter.and(q2); } //客户(bd_customer)||供应商(bd_supplier) 收款人id:payee String payeetype = bill.getString("payeetype");//收款人类型 @@ -98,6 +109,9 @@ public class PayBillSaveOperation extends AbstractOperationServicePlugIn impleme QFilter q3 = new QFilter("shjh_bbhkh.fbasedataid", QCP.equals, customerOrSupplierLong);//不包含客户 QFilter q4 = new QFilter("shjh_bbhkh.fbasedataid", QCP.equals, null); qFilter = qFilter.and(q1.or(q2)).and(q3.or(q4)); + }else { + QFilter q2 = new QFilter("shjh_bhkh.fbasedataid", QCP.equals, null); + qFilter = qFilter.and(q2); } } if ("bd_supplier".equals(payeetype)) { @@ -110,6 +124,9 @@ public class PayBillSaveOperation extends AbstractOperationServicePlugIn impleme QFilter q3 = new QFilter("shjh_bbhgys.fbasedataid", QCP.equals, customerOrSupplierLong);//不包含供应商 QFilter q4 = new QFilter("shjh_bbhgys.fbasedataid", QCP.equals, null); qFilter = qFilter.and(q1.or(q2)).and(q3.or(q4)); + }else { + QFilter q2 = new QFilter("shjh_bhgys.fbasedataid", QCP.equals, null); + qFilter = qFilter.and(q2); } } //不包含币种 currency @@ -125,21 +142,27 @@ public class PayBillSaveOperation extends AbstractOperationServicePlugIn impleme DynamicObjectCollection entrys = bill.getDynamicObjectCollection("entry");//付款明细 if (!entrys.isEmpty()) { DynamicObject entry = entrys.get(0); - //会计科目 shjh_sapkjkm + //原因码 shjh_yym DynamicObject shjhYym = entry.getDynamicObject("shjh_yym"); if (null != shjhYym) { Long yymid = shjhYym.getLong("id"); QFilter q1 = new QFilter("shjh_yym.fbasedataid", QCP.equals, yymid); QFilter q2 = new QFilter("shjh_yym.fbasedataid", QCP.equals, null); qFilter = qFilter.and(q1.or(q2)); + }else { + QFilter q2 = new QFilter("shjh_yym.fbasedataid", QCP.equals, null); + qFilter = qFilter.and(q2); } - //原因码 shjh_yym + //会计科目 shjh_sapkjkm DynamicObject shjhSapkjkm = entry.getDynamicObject("shjh_sapkjkm"); if (null != shjhSapkjkm) { Long kjkmid = shjhSapkjkm.getLong("id"); QFilter q1 = new QFilter("shjh_kjkm.fbasedataid", QCP.equals, kjkmid); QFilter q2 = new QFilter("shjh_kjkm.fbasedataid", QCP.equals, null); qFilter = qFilter.and(q1.or(q2)); + }else{ + QFilter q2 = new QFilter("shjh_kjkm.fbasedataid", QCP.equals, null); + qFilter = qFilter.and(q2); } //采购组shjh_procurementteam && 不包含采购组 String shjhBhcgz = entry.getString("shjh_procurementteam"); @@ -152,6 +175,9 @@ public class PayBillSaveOperation extends AbstractOperationServicePlugIn impleme QFilter q3 = new QFilter("shjh_bbhcgz.fbasedataid", QCP.equals, cgzid);//不包含采购粗 QFilter q4 = new QFilter("shjh_bbhcgz.fbasedataid", QCP.equals, null); qFilter = qFilter.and(q1.or(q2)).and(q3.or(q4)); + }else{ + QFilter q2 = new QFilter("shjh_bhcgz.fbasedataid", QCP.equals, null); + qFilter = qFilter.and(q2); } }