diff --git a/main/java/shkd/repc/task/DobeDWorgRelationTask.java b/main/java/shkd/repc/task/DobeDWorgRelationTask.java index 141ab3b..1b25bfd 100644 --- a/main/java/shkd/repc/task/DobeDWorgRelationTask.java +++ b/main/java/shkd/repc/task/DobeDWorgRelationTask.java @@ -28,6 +28,7 @@ public class DobeDWorgRelationTask extends AbstractTask implements Plugin { private static Log log = LogFactory.getLog(DobeDWorgRelationTask.class); private static final String entityName = "qeug_recon_orgrelation";//供应链库 表名 tk_qeug_recon_orgrelation + private static final String developerName = "qeug_recon_developer";//供应链库 表名 tk_qeug_recon_developer private static final String orgEntityName = "bos_org";//系统库 表名 t_ORG_ORG private static final String dw_menthod = "mdm_orgcorp"; @@ -93,6 +94,7 @@ public class DobeDWorgRelationTask extends AbstractTask implements Plugin { String paynumber = null; String taxno = null; DynamicObject yworginfo = null; + DynamicObject devepinfo = null; for (int i = 0; i < detailsJson.size(); i++) { json_body = detailsJson.getJSONObject(i); @@ -152,6 +154,21 @@ public class DobeDWorgRelationTask extends AbstractTask implements Plugin { yworginfo.set("uniformsocialcreditcode", taxno);//业务单元-统一社会信用代码 SaveServiceHelper.update(yworginfo); } + //根据财务组织编号和名称判断甲方是否需要新增和修改 + devepinfo = BusinessDataServiceHelper.loadSingle(developerName,new QFilter[]{new QFilter("number","=",companyNumber)}); + if(devepinfo == null){ + devepinfo = BusinessDataServiceHelper.newDynamicObject(developerName); + devepinfo.set("number", companyNumber); + devepinfo.set("name", companyName); + devepinfo.set("enable", 1); + devepinfo.set("status", "C");//单据状态 A保存 B已提交 C已审核 + devepinfo.set("creator", 43007523L);//创建人默认指定为金小蝶 + //保存数据:直接保存入库,不走操作校验 + SaveServiceHelper.save(new DynamicObject[]{devepinfo}); + }else if(!companyName.equals(devepinfo.getString("name"))){ + devepinfo.set("name", companyName); + SaveServiceHelper.update(devepinfo); + } } }