diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/form/RecBillFromPlugin.java b/main/java/shjh/jhzj7/fi/fi/plugin/form/RecBillFromPlugin.java index 221bafa..7a27c8f 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/form/RecBillFromPlugin.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/form/RecBillFromPlugin.java @@ -182,6 +182,7 @@ public class RecBillFromPlugin extends AbstractFormPlugin implements Plugin { if (null != bizSmall) { String string = bizSmall.getString("shjh_qzfs");//业务小类中的清账方式 DynamicObjectCollection entryEntity = this.getModel().getEntryEntity("entry"); + DynamicObject currentorg = (DynamicObject) this.getModel().getValue("org");//单据所属当前公司 //当收款单【业务小类】清账方式字段=全部金蝶清账 if ("qbjdqz".equals(string)) { //判断收款单中的客户信息,是否在《结构性清账客户映射表》中 @@ -195,9 +196,11 @@ public class RecBillFromPlugin extends AbstractFormPlugin implements Plugin { this.getModel().setValue("shjh_closingstatus", "A", i);//无需金蝶清账 } if (null != value && "bd_customer".equals(this.getModel().getValue(RecFieldsInfo.PAYER_TYPE))) { - DynamicObject customerObj = BusinessDataServiceHelper.loadSingle(value, "bd_customer"); - QFilter number = new QFilter("shjh_customer.number", QCP.equals, customerObj.getString("number")); - DynamicObject mappingObj = BusinessDataServiceHelper.loadSingle("shjh_jgqzcust", number.toArray()); +// DynamicObject customerObj = BusinessDataServiceHelper.loadSingle(value, "bd_customer"); + QFilter mapnumber = new QFilter("shjh_customer.id", QCP.equals, value); + mapnumber.and("enable", QCP.equals, "1");//是否可用 + mapnumber.and("shjh_org.id", QCP.equals, currentorg.getLong("id"));//公司 + DynamicObject mappingObj = BusinessDataServiceHelper.loadSingle("shjh_jgqzcust", mapnumber.toArray()); if (null != mappingObj) { for (int i = 0; i < entryEntity.size(); i++) { this.getModel().setValue("shjh_needpushbill", true, i);//需要下推清账单 @@ -213,8 +216,10 @@ public class RecBillFromPlugin extends AbstractFormPlugin implements Plugin { }else{ //当客户拆分=是,以分录客户来判断 for (int i = 0; i < entryEntity.size(); i++) { - QFilter number = new QFilter("shjh_customer.number", QCP.equals, entryEntity.get(i).getString("shjh_entrycustomer.number")); - DynamicObject mappingObj = BusinessDataServiceHelper.loadSingle("shjh_jgqzcust", number.toArray()); + QFilter mapnumber = new QFilter("shjh_customer.number", QCP.equals, entryEntity.get(i).getString("shjh_entrycustomer.number")); + mapnumber.and("enable", QCP.equals, "1");//是否可用 + mapnumber.and("shjh_org.id", QCP.equals, currentorg.getLong("id"));//公司 + DynamicObject mappingObj = BusinessDataServiceHelper.loadSingle("shjh_jgqzcust", mapnumber.toArray()); if (null != mappingObj) { this.getModel().setValue("shjh_needpushbill", true, i); }else{ @@ -263,10 +268,13 @@ public class RecBillFromPlugin extends AbstractFormPlugin implements Plugin { } DynamicObjectCollection entryEntity = this.getModel().getEntryEntity("entry"); if(iskdqbqz){ + DynamicObject currentorg = (DynamicObject) this.getModel().getValue("org");//单据所属当前公司 //业务小类是全部金蝶清账,再判断结构性客户 for (int i = 0; i < entryEntity.size(); i++) { - QFilter number = new QFilter("shjh_customer.number", QCP.equals, entryEntity.get(i).getString("shjh_entrycustomer.number")); - DynamicObject mappingObj = BusinessDataServiceHelper.loadSingle("shjh_jgqzcust", number.toArray()); + QFilter mapnumber = new QFilter("shjh_customer.number", QCP.equals, entryEntity.get(i).getString("shjh_entrycustomer.number")); + mapnumber.and("enable", QCP.equals, "1");//是否可用 + mapnumber.and("shjh_org.id", QCP.equals, currentorg.getLong("id"));//公司 + DynamicObject mappingObj = BusinessDataServiceHelper.loadSingle("shjh_jgqzcust", mapnumber.toArray()); if (null != mappingObj) { this.getModel().setValue("shjh_needpushbill", true, i);//需要下推清账单 this.getModel().setValue("shjh_closingstatus", "B", i);//待清账 diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/operate/RecBillSaveOperation.java b/main/java/shjh/jhzj7/fi/fi/plugin/operate/RecBillSaveOperation.java index 0062416..5a5157d 100644 --- a/main/java/shjh/jhzj7/fi/fi/plugin/operate/RecBillSaveOperation.java +++ b/main/java/shjh/jhzj7/fi/fi/plugin/operate/RecBillSaveOperation.java @@ -199,7 +199,9 @@ public class RecBillSaveOperation extends AbstractOperationServicePlugIn impleme bill.set("shjh_qzzt", "A");//无需金蝶清账 }else{ //根据收款单付款人id判断,此时的付款类型是客户 - QFilter mapnumber = new QFilter("shjh_customer.id", QCP.equals, bill.getLong("payer")); + QFilter mapnumber = new QFilter("shjh_customer.id", QCP.equals, bill.getLong("payer"));//客户 + mapnumber.and("enable", QCP.equals, "1");//是否可用 + mapnumber.and("shjh_org.id", QCP.equals, org.getLong("id"));//公司 DynamicObject mappingObj = BusinessDataServiceHelper.loadSingle("shjh_jgqzcust", mapnumber.toArray()); if(mappingObj != null){ //结构性清账客户映射表中有值