成本中心同步-設定委託財務組織
阿新 • • 發佈:2021-10-08
FullOrgUnitInfo m = (FullOrgUnitInfo) iter.next(); boolean isBizUnit = false; if (m.isIsLeaf()) { isBizUnit = true; } CostCenterOrgUnitInfo parentCostCenter = new CostCenterOrgUnitInfo(); parentCostCenter.setId(m.getParent().getId()); AdminOrgUnitInfo parentAdmin= new AdminOrgUnitInfo(); parentAdmin.setId(m.getParent().getId()); parentAdmin.setCU(m.getParent().getCU()); // CompanyOrgUnitInfo companyInfo = DbDataSyncBean.getTopCompany(ctx); // m.setOrgTypeStr(m.getOrgTypeStr() + ";CostCenter;");BizParentAndDelegateInfo delValue = new BizParentAndDelegateInfo(); delValue.setParentOrg(OrgType.CostCenter, parentCostCenter); OrgUnitRelationCollection delegateCol = delValue.getDelegateCollection(); if (m.getParent() != null) { OrgUnitRelationInfo costDelegateFIInfo = new OrgUnitRelationInfo(); costDelegateFIInfo.setFromUnit(m); costDelegateFIInfo.setToUnit(m.getParent()); costDelegateFIInfo.put("fromType", OrgType.CostCenter); costDelegateFIInfo.put("toType", OrgType.Company); delegateCol.add(costDelegateFIInfo); } delValue.setParentOrg(OrgType.Admin, parentAdmin); if (m.getParent() != null) { OrgUnitRelationInfo adminDelegateFIInfo = new OrgUnitRelationInfo(); adminDelegateFIInfo.setFromUnit(m); adminDelegateFIInfo.setToUnit(m.getParent()); adminDelegateFIInfo.put("fromType", OrgType.Admin); adminDelegateFIInfo.put("toType", OrgType.Company); delegateCol.add(adminDelegateFIInfo); } if (m.isIsCompanyOrgUnit()) { CompanyOrgUnitInfo parentCompany = new CompanyOrgUnitInfo(); parentCompany.setId(m.getParent().getId()); delValue.setParentOrg(OrgType.Company, parentCompany); } m.put(BizParentAndDelegateInfo.KEY, delValue); // 補充儲存成本中心 OUPartCostCenterInfo existCc = m.getPartCostCenter(); if (existCc == null) { if (m.get("costCenter") == null) { // 新增記錄時,設定成本中心打勾 m.setIsCostOrgUnit(true); CostCenterOrgUnitInfo ccInfo = new CostCenterOrgUnitInfo(); // 輔助生產部門 ccInfo.setCostCenterType(CostCenterType.AssistantProdDept); // 上級成本中心 ccInfo.setParent(parentCostCenter); // 實體成本中心 ccInfo.setIsBizUnit(true); if (isBizUnit) { // 需要設定記賬委託財務組織 bizPromptCostDelegateFI // ccInfo.setCostCenterType(item) } m.put("costCenter", ccInfo); } OUPartCostCenterInfo partInfo = new OUPartCostCenterInfo(); // 輔助生產部門 partInfo.setCostCenterType(CostCenterType.AssistantProdDept); // 上級成本中心 // partInfo.setParent(parentCostCenter); // 實體成本中心 partInfo.setIsBizUnit(isBizUnit); partInfo.setUnit(m.getParent()); m.put("partCostCenter", partInfo); } else if (isBizUnit && existCc.getUnit() == null) { // 設定記賬委託財務組織 existCc.setIsBizUnit(isBizUnit); existCc.setUnit(m.getParent()); } // 補充儲存成本中心 OUPartAdminInfo existAdmin = m.getPartAdmin(); if (existAdmin == null) { } else if (existAdmin.getUnit() == null) { // 設定記賬委託財務組織 existAdmin.setUnit(m.getParent()); } FullOrgUnitFactory.getLocalInstance(ctx).submit(m);