diff --git a/lc123/cloud/app/plugin/operate/sys/SupplierAuditPushFwOp.java b/lc123/cloud/app/plugin/operate/sys/SupplierAuditPushFwOp.java index 44fc5b9..d4f1ba8 100644 --- a/lc123/cloud/app/plugin/operate/sys/SupplierAuditPushFwOp.java +++ b/lc123/cloud/app/plugin/operate/sys/SupplierAuditPushFwOp.java @@ -7,7 +7,9 @@ import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.entity.operate.result.OperationResult; import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.args.AfterOperationArgs; +import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.QueryServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; import org.apache.commons.lang3.StringUtils; import tqq9.lc123.cloud.app.plugin.trd.FWImpl; @@ -31,24 +33,20 @@ public class SupplierAuditPushFwOp extends AbstractOperationServicePlugIn { List successPkIds = operationResult.getSuccessPkIds(); for (Object successPkId : successPkIds) { DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle(successPkId, "bd_supplier"); - DynamicObjectCollection groupArr = dataEntity.getDynamicObjectCollection("entry_groupstandard"); - for (DynamicObject group : groupArr) { - DynamicObject groupid = group.getDynamicObject("groupid"); - if(groupid != null){ - String groupnumber = groupid.getString("number"); - if("002".equals(groupnumber)){ - String resultStr = FWImpl.syncSupplier(dataEntity); - if(StringUtils.isNotBlank(resultStr)){ - JSONObject resultJson = JSONObject.parseObject(resultStr); - String status = resultJson.getString("status"); - if("1".equals(status)){ - dataEntity.set("tqq9_ispushfw", true); - SaveServiceHelper.save(new DynamicObject[]{dataEntity}); - } - } - break; + QFilter f1 = new QFilter("supplier.id", "=", dataEntity.getPkValue()); + QFilter f2 = new QFilter("group.number", "=", "002"); + boolean isPurSupplier = QueryServiceHelper.exists("bd_suppliergroupdetail", new QFilter[]{f1, f2}); + if(isPurSupplier){ + String resultStr = FWImpl.syncSupplier(dataEntity); + if(StringUtils.isNotBlank(resultStr)){ + JSONObject resultJson = JSONObject.parseObject(resultStr); + String status = resultJson.getString("status"); + if("1".equals(status)){ + dataEntity.set("tqq9_ispushfw", true); + SaveServiceHelper.save(new DynamicObject[]{dataEntity}); } } + break; } } diff --git a/lc123/cloud/app/plugin/operate/sys/SupplierSubmitToFwOp.java b/lc123/cloud/app/plugin/operate/sys/SupplierSubmitToFwOp.java index 981e538..d41f774 100644 --- a/lc123/cloud/app/plugin/operate/sys/SupplierSubmitToFwOp.java +++ b/lc123/cloud/app/plugin/operate/sys/SupplierSubmitToFwOp.java @@ -1,12 +1,15 @@ package tqq9.lc123.cloud.app.plugin.operate.sys; import com.alibaba.fastjson.JSONObject; +import kd.bd.master.helper.GroupStandardHelper; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.entity.operate.result.OperationResult; import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.args.AfterOperationArgs; +import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.QueryServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; import org.apache.commons.lang3.StringUtils; import tqq9.lc123.cloud.app.plugin.trd.FWImpl; @@ -26,18 +29,9 @@ public class SupplierSubmitToFwOp extends AbstractOperationServicePlugIn { List successPkIds = operationResult.getSuccessPkIds(); for (Object successPkId : successPkIds) { DynamicObject bill = BusinessDataServiceHelper.loadSingle(successPkId, "bd_supplier"); - DynamicObjectCollection groupstandardColl = bill.getDynamicObjectCollection("entry_groupstandard"); - boolean isPurSupplier = false;//是否是采购供应商 - for (DynamicObject groupstandard : groupstandardColl) { - DynamicObject groupid = groupstandard.getDynamicObject("groupid"); - if(groupid != null){ - String groupNumber = groupid.getString("number"); - if("002".equals(groupNumber)){//002-采购供应商 - isPurSupplier = true; - break; - } - } - } + QFilter f1 = new QFilter("supplier.id", "=", bill.getPkValue()); + QFilter f2 = new QFilter("group.number", "=", "002"); + boolean isPurSupplier = QueryServiceHelper.exists("bd_suppliergroupdetail", new QFilter[]{f1, f2}); if(isPurSupplier){ //是采购供应商 才需要推送泛微 boolean tqq9_issuccess = bill.getBoolean("tqq9_issuccess"); diff --git a/lc123/cloud/app/plugin/trd/FWImpl.java b/lc123/cloud/app/plugin/trd/FWImpl.java index 9d32ec2..d36d91e 100644 --- a/lc123/cloud/app/plugin/trd/FWImpl.java +++ b/lc123/cloud/app/plugin/trd/FWImpl.java @@ -59,7 +59,7 @@ public class FWImpl { mainTable.put("bmbm", bmbm); FWRestfulUtils fwRestfulUtils = new FWRestfulUtils(); - return fwRestfulUtils.pushBaseData(mainTable, tqq9_fwuserid, number, "bd_warehouse", null); + return fwRestfulUtils.pushBaseData(mainTable, tqq9_fwuserid, number, "bd_warehouse"); } @@ -520,7 +520,7 @@ public class FWImpl { mainTable.put("ywgz", ywgz); FWRestfulUtils fwRestfulUtils = new FWRestfulUtils(); - fwRestfulUtils.pushBaseData(mainTable, cjr, gysbh, "bd_supplier", recordsArr1, recordsArr2); + return fwRestfulUtils.pushBaseData(mainTable, cjr, gysbh, "bd_supplier", recordsArr1, recordsArr2); }