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);