From 5eed27267eb379fc8716c21b78f1805db76e309b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E8=B4=B5=E5=BC=BA?= Date: Sat, 15 Mar 2025 17:00:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E7=89=A9=E6=96=99=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=88=86=E7=B1=BB=E5=85=B3=E8=81=94=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContractMaterialImportPlugin.java | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/main/java/shkd/repc/recon/formplugin/ContractMaterialImportPlugin.java b/main/java/shkd/repc/recon/formplugin/ContractMaterialImportPlugin.java index 5a3aa42..cd9dd58 100644 --- a/main/java/shkd/repc/recon/formplugin/ContractMaterialImportPlugin.java +++ b/main/java/shkd/repc/recon/formplugin/ContractMaterialImportPlugin.java @@ -52,6 +52,8 @@ public class ContractMaterialImportPlugin extends AbstractFormPlugin { //只针对物料 if ("bd_material".equals(entityNumber)){ Long materialId = newMaterial(entry.getKey().getSearchValue(),materialList); + //存物料分类 + this.newMaterialType(materialId); basedata.add(materialId); } } else { @@ -83,23 +85,6 @@ public class ContractMaterialImportPlugin extends AbstractFormPlugin { if (null != org) { bd_material.set("createorg",org); } - //物料分类 - DynamicObject materialGroup = BusinessDataServiceHelper.loadSingle("bd_materialgroup",(new QFilter("name", QCP.equals, materialByNumber.getMaterialType())).toArray()); - if (null==materialGroup){ - materialGroup=BusinessDataServiceHelper.loadSingle("bd_materialgroup",(new QFilter("number", QCP.equals, "gc-tlfs")).toArray()); - } - //物料分组 - bd_material.set("group",materialGroup); - //分类标准 - DynamicObjectCollection groupStandard = bd_material.getDynamicObjectCollection("entry_groupstandard"); - DynamicObject newEntry = groupStandard.addNew(); - QFilter qFilter = new QFilter("name", QCP.equals, "物料基本分类标准"); - DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle("bd_materialgroupstandard", qFilter.toArray()); - if (null!=dynamicObject){ - newEntry.set("standardid",dynamicObject); - } - //分类 - newEntry.set("groupid",materialGroup.getLong("id")); //物料单位 QFilter unit = new QFilter("name", QCP.equals, materialByNumber.getMaterialUnit()); DynamicObject measureUnits = BusinessDataServiceHelper.loadSingle("bd_measureunits",unit.toArray()); @@ -121,6 +106,19 @@ public class ContractMaterialImportPlugin extends AbstractFormPlugin { return bd_material.getLong("id"); } + private void newMaterialType(Long materialId){ + DynamicObject materialType = BusinessDataServiceHelper.newDynamicObject("bd_materialgroupdetail"); + //分类标准 + DynamicObject standard = BusinessDataServiceHelper.loadSingle("bd_materialgroupstandard", (new QFilter("number", QCP.equals, "JBFLBZ")).toArray()); + materialType.set("standard",standard); + //分类 + DynamicObject group=BusinessDataServiceHelper.loadSingle("bd_materialgroup",(new QFilter("number", QCP.equals, "waitgroup")).toArray()); + materialType.set("group",group); + //物料 + materialType.set("material",materialId); + SaveServiceHelper.save(new DynamicObject[]{materialType}); + } + @Override public void beforeImportEntry(BeforeImportEntryEventArgs e) { super.beforeImportEntry(e);