报销单切换费用承担公司报错问题修复
This commit is contained in:
		
							parent
							
								
									effc1455f0
								
							
						
					
					
						commit
						040f25551f
					
				| 
						 | 
				
			
			@ -27,34 +27,36 @@ public class AutoCalWorkingDaysPlugin extends AbstractBillPlugIn implements Plug
 | 
			
		|||
        //costcompany
 | 
			
		||||
        Object company = this.getModel().getValue("costcompany");//核算组织(费用承担公司)
 | 
			
		||||
        Long currentOrgId = RequestContext.get().getOrgId();
 | 
			
		||||
        DynamicObject companyObj = (DynamicObject)company;
 | 
			
		||||
        Long companyId = companyObj.getLong("id");
 | 
			
		||||
        if(OrgCheckUtils.isKS(companyId)){
 | 
			
		||||
            String name = e.getProperty().getName();
 | 
			
		||||
            if(name.equals("zcgj_startdate") ||name.equals("zcgj_enddate")){
 | 
			
		||||
                ChangeData[] changeSet = e.getChangeSet();
 | 
			
		||||
                int rowIndex = changeSet[0].getRowIndex();
 | 
			
		||||
                int count = calHomeentityDay(rowIndex);
 | 
			
		||||
                this.getModel().setValue("zcgj_kccbdays",count);
 | 
			
		||||
            }else if("zcgj_holiday_start_time".equals(name) || "zcgj_holiday_end_time".equals(name)){
 | 
			
		||||
                boolean isVisit = (boolean)this.getModel().getValue("zcgj_is_visit");
 | 
			
		||||
                if(isVisit){
 | 
			
		||||
                    calVisitDay();
 | 
			
		||||
                }
 | 
			
		||||
            }else if(name.equals("zcgj_is_home") ){
 | 
			
		||||
                boolean isHome = (boolean)this.getModel().getValue("zcgj_is_home");
 | 
			
		||||
                if(isHome){
 | 
			
		||||
                    calHomeentityDay();
 | 
			
		||||
                }else{
 | 
			
		||||
                    this.getModel().setValue("zcgj_kccbdays",null);
 | 
			
		||||
                    this.getModel().deleteEntryData("zcgj_homeentity");
 | 
			
		||||
                }
 | 
			
		||||
            }else if(name.equals("zcgj_is_visit")){
 | 
			
		||||
                boolean isVisit = (boolean)this.getModel().getValue("zcgj_is_visit");
 | 
			
		||||
                if(isVisit){
 | 
			
		||||
                    calVisitDay();
 | 
			
		||||
                }else{
 | 
			
		||||
                    this.getModel().deleteEntryData("zcgj_homeentity");
 | 
			
		||||
        if(company != null){
 | 
			
		||||
            DynamicObject companyObj = (DynamicObject)company;
 | 
			
		||||
            Long companyId = companyObj.getLong("id");
 | 
			
		||||
            if(OrgCheckUtils.isKS(companyId)){
 | 
			
		||||
                String name = e.getProperty().getName();
 | 
			
		||||
                if(name.equals("zcgj_startdate") ||name.equals("zcgj_enddate")){
 | 
			
		||||
                    ChangeData[] changeSet = e.getChangeSet();
 | 
			
		||||
                    int rowIndex = changeSet[0].getRowIndex();
 | 
			
		||||
                    int count = calHomeentityDay(rowIndex);
 | 
			
		||||
                    this.getModel().setValue("zcgj_kccbdays",count);
 | 
			
		||||
                }else if("zcgj_holiday_start_time".equals(name) || "zcgj_holiday_end_time".equals(name)){
 | 
			
		||||
                    boolean isVisit = (boolean)this.getModel().getValue("zcgj_is_visit");
 | 
			
		||||
                    if(isVisit){
 | 
			
		||||
                        calVisitDay();
 | 
			
		||||
                    }
 | 
			
		||||
                }else if(name.equals("zcgj_is_home") ){
 | 
			
		||||
                    boolean isHome = (boolean)this.getModel().getValue("zcgj_is_home");
 | 
			
		||||
                    if(isHome){
 | 
			
		||||
                        calHomeentityDay();
 | 
			
		||||
                    }else{
 | 
			
		||||
                        this.getModel().setValue("zcgj_kccbdays",null);
 | 
			
		||||
                        this.getModel().deleteEntryData("zcgj_homeentity");
 | 
			
		||||
                    }
 | 
			
		||||
                }else if(name.equals("zcgj_is_visit")){
 | 
			
		||||
                    boolean isVisit = (boolean)this.getModel().getValue("zcgj_is_visit");
 | 
			
		||||
                    if(isVisit){
 | 
			
		||||
                        calVisitDay();
 | 
			
		||||
                    }else{
 | 
			
		||||
                        this.getModel().deleteEntryData("zcgj_homeentity");
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -122,7 +122,6 @@ public class CostcompanyDefaultPlugin  extends AbstractBillPlugIn implements Plu
 | 
			
		|||
    @Override
 | 
			
		||||
    public void itemClick(ItemClickEvent evt) {
 | 
			
		||||
        //费用项目设置为默认
 | 
			
		||||
 | 
			
		||||
        Object company = this.getModel().getValue("costcompany");//核算组织
 | 
			
		||||
        if (company!=null && evt.getItemKey().equals("addloancheck1")) {
 | 
			
		||||
            DynamicObject companyObj = (DynamicObject)company;
 | 
			
		||||
| 
						 | 
				
			
			@ -163,33 +162,36 @@ public class CostcompanyDefaultPlugin  extends AbstractBillPlugIn implements Plu
 | 
			
		|||
        Long currentOrgId = RequestContext.get().getOrgId();
 | 
			
		||||
        //当前所在的组织是属于矿山下的  costcompany
 | 
			
		||||
        //costcompany 费用承担公司
 | 
			
		||||
        DynamicObject costcompany =  (DynamicObject)this.getModel().getValue("costcompany");
 | 
			
		||||
        long costcompanyId = costcompany.getLong("id");
 | 
			
		||||
        if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){
 | 
			
		||||
            EntryProp entryProp = e.getEntryProp();
 | 
			
		||||
            DynamicProperty compareProp = entryProp.getCompareProp();
 | 
			
		||||
            if("expenseentryentity".equals(compareProp.getName())){
 | 
			
		||||
                RowDataEntity[] rowDatas = e.getRowDataEntities();
 | 
			
		||||
                String companyNumber = costcompany.getString("number");
 | 
			
		||||
                if (rowDatas.length > 0) {
 | 
			
		||||
                    int rowIndex = rowDatas[0].getRowIndex();
 | 
			
		||||
                    DynamicObject costcompanyObj  = null;
 | 
			
		||||
                    //如果费用承担公司是五家本部公司
 | 
			
		||||
                    if(OrgCheckUtils.testCompanyNumberSet.contains(companyNumber) || OrgCheckUtils.ksNumber.equals(companyNumber)){
 | 
			
		||||
                        //费用承担部门带入到成本中心
 | 
			
		||||
                        costcompanyObj=  (DynamicObject)this.getModel().getValue("costdept");
 | 
			
		||||
                    }else{
 | 
			
		||||
                        //费用承担公司带入到成本中心
 | 
			
		||||
                        costcompanyObj=  (DynamicObject)this.getModel().getValue("costcompany");
 | 
			
		||||
                    }
 | 
			
		||||
                    if(costcompanyObj!=null){
 | 
			
		||||
                        //bos_costcenter
 | 
			
		||||
                        QFilter numberFilter = new QFilter("number",QCP.equals,costcompanyObj.getString("number"));
 | 
			
		||||
                        DynamicObject[] dynamicObjectAccItem = BusinessDataServiceHelper.load("bos_costcenter", "number,name", new QFilter[]{numberFilter});
 | 
			
		||||
                        if(dynamicObjectAccItem!=null && dynamicObjectAccItem.length >0){
 | 
			
		||||
                            this.getModel().setValue("std_entrycostcenter", dynamicObjectAccItem[0], rowIndex);
 | 
			
		||||
        Object costcompanyObjVal = this.getModel().getValue("costcompany");
 | 
			
		||||
        if(costcompanyObjVal!=null){
 | 
			
		||||
            DynamicObject costcompany =  (DynamicObject)costcompanyObjVal;
 | 
			
		||||
            long costcompanyId = costcompany.getLong("id");
 | 
			
		||||
            if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){
 | 
			
		||||
                EntryProp entryProp = e.getEntryProp();
 | 
			
		||||
                DynamicProperty compareProp = entryProp.getCompareProp();
 | 
			
		||||
                if("expenseentryentity".equals(compareProp.getName())){
 | 
			
		||||
                    RowDataEntity[] rowDatas = e.getRowDataEntities();
 | 
			
		||||
                    String companyNumber = costcompany.getString("number");
 | 
			
		||||
                    if (rowDatas.length > 0) {
 | 
			
		||||
                        int rowIndex = rowDatas[0].getRowIndex();
 | 
			
		||||
                        DynamicObject costcompanyObj  = null;
 | 
			
		||||
                        //如果费用承担公司是五家本部公司
 | 
			
		||||
                        if(OrgCheckUtils.testCompanyNumberSet.contains(companyNumber) || OrgCheckUtils.ksNumber.equals(companyNumber)){
 | 
			
		||||
                            //费用承担部门带入到成本中心
 | 
			
		||||
                            costcompanyObj=  (DynamicObject)this.getModel().getValue("costdept");
 | 
			
		||||
                        }else{
 | 
			
		||||
                            this.getView().showErrorNotification("请设置成本中心!");
 | 
			
		||||
                            //费用承担公司带入到成本中心
 | 
			
		||||
                            costcompanyObj=  (DynamicObject)this.getModel().getValue("costcompany");
 | 
			
		||||
                        }
 | 
			
		||||
                        if(costcompanyObj!=null){
 | 
			
		||||
                            //bos_costcenter
 | 
			
		||||
                            QFilter numberFilter = new QFilter("number",QCP.equals,costcompanyObj.getString("number"));
 | 
			
		||||
                            DynamicObject[] dynamicObjectAccItem = BusinessDataServiceHelper.load("bos_costcenter", "number,name", new QFilter[]{numberFilter});
 | 
			
		||||
                            if(dynamicObjectAccItem!=null && dynamicObjectAccItem.length >0){
 | 
			
		||||
                                this.getModel().setValue("std_entrycostcenter", dynamicObjectAccItem[0], rowIndex);
 | 
			
		||||
                            }else{
 | 
			
		||||
                                this.getView().showErrorNotification("请设置成本中心!");
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -73,16 +73,19 @@ public class DailyloanbillExpAccPlugin extends AbstractBillPlugIn implements Plu
 | 
			
		|||
        Long currentOrgId = RequestContext.get().getOrgId();
 | 
			
		||||
        //当前所在的组织是属于矿山下的  costcompany
 | 
			
		||||
        //costcompany 费用承担公司
 | 
			
		||||
        DynamicObject costcompany =  (DynamicObject)this.getModel().getValue("costcompany");
 | 
			
		||||
        long costcompanyId = costcompany.getLong("id");
 | 
			
		||||
        if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){
 | 
			
		||||
            BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM);
 | 
			
		||||
            fieldEdit.addBeforeF7SelectListener(this);
 | 
			
		||||
            fieldEdit.addAfterF7SelectListener(this);
 | 
			
		||||
        Object costcompanyObj = this.getModel().getValue("costcompany");
 | 
			
		||||
        if(costcompanyObj!=null){
 | 
			
		||||
            DynamicObject costcompany =  (DynamicObject)this.getModel().getValue("costcompany");
 | 
			
		||||
            long costcompanyId = costcompany.getLong("id");
 | 
			
		||||
            if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){
 | 
			
		||||
                BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM);
 | 
			
		||||
                fieldEdit.addBeforeF7SelectListener(this);
 | 
			
		||||
                fieldEdit.addAfterF7SelectListener(this);
 | 
			
		||||
 | 
			
		||||
            BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM);
 | 
			
		||||
            fieldEditExpense.addBeforeF7SelectListener(this);
 | 
			
		||||
            fieldEditExpense.addAfterF7SelectListener(this);
 | 
			
		||||
                BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM);
 | 
			
		||||
                fieldEditExpense.addBeforeF7SelectListener(this);
 | 
			
		||||
                fieldEditExpense.addAfterF7SelectListener(this);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,16 +67,19 @@ public class DailyreimbursExpAccPlugin extends AbstractBillPlugIn implements Plu
 | 
			
		|||
        Long currentOrgId = RequestContext.get().getOrgId();
 | 
			
		||||
        //当前所在的组织是属于矿山下的
 | 
			
		||||
        //costcompany 费用承担公司
 | 
			
		||||
        DynamicObject costcompany =  (DynamicObject)this.getModel().getValue("costcompany");
 | 
			
		||||
        long costcompanyId = costcompany.getLong("id");
 | 
			
		||||
        if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){
 | 
			
		||||
            BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM);
 | 
			
		||||
            fieldEdit.addBeforeF7SelectListener(this);
 | 
			
		||||
            fieldEdit.addAfterF7SelectListener(this);
 | 
			
		||||
        Object costcompanyObj = this.getModel().getValue("costcompany");
 | 
			
		||||
        if(costcompanyObj != null){
 | 
			
		||||
            DynamicObject costcompany =  (DynamicObject)costcompanyObj;
 | 
			
		||||
            long costcompanyId = costcompany.getLong("id");
 | 
			
		||||
            if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){
 | 
			
		||||
                BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM);
 | 
			
		||||
                fieldEdit.addBeforeF7SelectListener(this);
 | 
			
		||||
                fieldEdit.addAfterF7SelectListener(this);
 | 
			
		||||
 | 
			
		||||
            BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM);
 | 
			
		||||
            fieldEditExpense.addBeforeF7SelectListener(this);
 | 
			
		||||
            fieldEditExpense.addAfterF7SelectListener(this);
 | 
			
		||||
                BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM);
 | 
			
		||||
                fieldEditExpense.addBeforeF7SelectListener(this);
 | 
			
		||||
                fieldEditExpense.addAfterF7SelectListener(this);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,33 +32,36 @@ public class DefaultExpenseItemPlugin  extends AbstractBillPlugIn implements Plu
 | 
			
		|||
        //通过费用承担公司找到行政组织,获取长名称,排除编码为'10006447','10007186','10006476','10006461','10006939'的
 | 
			
		||||
        String rootOrgCode = "10006431";
 | 
			
		||||
        super.afterCreateNewData(e);
 | 
			
		||||
        DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany");
 | 
			
		||||
        long id = costcompany.getLong("id");
 | 
			
		||||
        Object costcompany1 = this.getModel().getValue("costcompany");
 | 
			
		||||
        if(costcompany1!=null){
 | 
			
		||||
            DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany");
 | 
			
		||||
            long id = costcompany.getLong("id");
 | 
			
		||||
 | 
			
		||||
        List<String> orgNumList = new ArrayList<>();
 | 
			
		||||
        orgNumList.add("10006447");
 | 
			
		||||
        orgNumList.add("10007186");
 | 
			
		||||
        orgNumList.add("10006476");
 | 
			
		||||
        orgNumList.add("10006461");
 | 
			
		||||
        orgNumList.add("10006939");
 | 
			
		||||
        QFilter filterOrgDepId = new QFilter("number", QCP.in,orgNumList);
 | 
			
		||||
        DynamicObject[] adminOrg1 = BusinessDataServiceHelper.load("bos_org", "number,name,fullname", new QFilter[]{filterOrgDepId});
 | 
			
		||||
        Set<Long> idSet = Arrays.stream(adminOrg1).map(data -> data.getLong("id")).collect(Collectors.toSet());
 | 
			
		||||
        //判断是不是在几家总部
 | 
			
		||||
        if(!idSet.contains(id)){
 | 
			
		||||
            QFilter filterOrgId = new QFilter("number", QCP.equals,rootOrgCode);//中材矿山建设有限公司
 | 
			
		||||
            DynamicObject adminOrg = BusinessDataServiceHelper.loadSingle("bos_org", "number,name,fullname", new QFilter[]{filterOrgId});
 | 
			
		||||
            long orgId = adminOrg.getLong("id");
 | 
			
		||||
            List<Long> orgIds = new ArrayList<>(1);
 | 
			
		||||
            //orgIds.add(1692204547985902592L);
 | 
			
		||||
            orgIds.add(orgId);
 | 
			
		||||
            List<Long> subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true);
 | 
			
		||||
            Set<Long> collect = subOrgIds.stream().filter(data -> !idSet.contains(id)).collect(Collectors.toSet());
 | 
			
		||||
            List<String> orgNumList = new ArrayList<>();
 | 
			
		||||
            orgNumList.add("10006447");
 | 
			
		||||
            orgNumList.add("10007186");
 | 
			
		||||
            orgNumList.add("10006476");
 | 
			
		||||
            orgNumList.add("10006461");
 | 
			
		||||
            orgNumList.add("10006939");
 | 
			
		||||
            QFilter filterOrgDepId = new QFilter("number", QCP.in,orgNumList);
 | 
			
		||||
            DynamicObject[] adminOrg1 = BusinessDataServiceHelper.load("bos_org", "number,name,fullname", new QFilter[]{filterOrgDepId});
 | 
			
		||||
            Set<Long> idSet = Arrays.stream(adminOrg1).map(data -> data.getLong("id")).collect(Collectors.toSet());
 | 
			
		||||
            //判断是不是在几家总部
 | 
			
		||||
            if(!idSet.contains(id)){
 | 
			
		||||
                QFilter filterOrgId = new QFilter("number", QCP.equals,rootOrgCode);//中材矿山建设有限公司
 | 
			
		||||
                DynamicObject adminOrg = BusinessDataServiceHelper.loadSingle("bos_org", "number,name,fullname", new QFilter[]{filterOrgId});
 | 
			
		||||
                long orgId = adminOrg.getLong("id");
 | 
			
		||||
                List<Long> orgIds = new ArrayList<>(1);
 | 
			
		||||
                //orgIds.add(1692204547985902592L);
 | 
			
		||||
                orgIds.add(orgId);
 | 
			
		||||
                List<Long> subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true);
 | 
			
		||||
                Set<Long> collect = subOrgIds.stream().filter(data -> !idSet.contains(id)).collect(Collectors.toSet());
 | 
			
		||||
 | 
			
		||||
            if(collect.contains(id)){
 | 
			
		||||
                QFilter nameQFilterAccItem = new QFilter("number", QCP.equals,"FYXM004.999");
 | 
			
		||||
                DynamicObject dynamicObjectAccItem = BusinessDataServiceHelper.loadSingle("er_expenseitemedit", "number,name", new QFilter[]{nameQFilterAccItem});
 | 
			
		||||
                this.getModel().setValue("expenseitem",dynamicObjectAccItem,0);
 | 
			
		||||
                if(collect.contains(id)){
 | 
			
		||||
                    QFilter nameQFilterAccItem = new QFilter("number", QCP.equals,"FYXM004.999");
 | 
			
		||||
                    DynamicObject dynamicObjectAccItem = BusinessDataServiceHelper.loadSingle("er_expenseitemedit", "number,name", new QFilter[]{nameQFilterAccItem});
 | 
			
		||||
                    this.getModel().setValue("expenseitem",dynamicObjectAccItem,0);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,18 +70,20 @@ public class PrepaybillExpAccPlugin extends AbstractBillPlugIn implements Plugin
 | 
			
		|||
        Long currentOrgId = RequestContext.get().getOrgId();
 | 
			
		||||
        //当前所在的组织是属于矿山下的 costcompany
 | 
			
		||||
        //costcompany 费用承担公司
 | 
			
		||||
        DynamicObject costcompany =  (DynamicObject)this.getModel().getValue("costcompany");
 | 
			
		||||
        long costcompanyId = costcompany.getLong("id");
 | 
			
		||||
        if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){
 | 
			
		||||
            BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM);
 | 
			
		||||
            fieldEdit.addBeforeF7SelectListener(this);
 | 
			
		||||
            fieldEdit.addAfterF7SelectListener(this);
 | 
			
		||||
        Object costcompanyObj = this.getModel().getValue("costcompany");
 | 
			
		||||
        if(costcompanyObj!=null){
 | 
			
		||||
            DynamicObject costcompany =  (DynamicObject)costcompanyObj;
 | 
			
		||||
            long costcompanyId = costcompany.getLong("id");
 | 
			
		||||
            if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){
 | 
			
		||||
                BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM);
 | 
			
		||||
                fieldEdit.addBeforeF7SelectListener(this);
 | 
			
		||||
                fieldEdit.addAfterF7SelectListener(this);
 | 
			
		||||
 | 
			
		||||
            BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM);
 | 
			
		||||
            fieldEditExpense.addBeforeF7SelectListener(this);
 | 
			
		||||
            fieldEditExpense.addAfterF7SelectListener(this);
 | 
			
		||||
                BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM);
 | 
			
		||||
                fieldEditExpense.addBeforeF7SelectListener(this);
 | 
			
		||||
                fieldEditExpense.addAfterF7SelectListener(this);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -71,16 +71,19 @@ public class PublicreimbursebillExpAccPlugin extends AbstractBillPlugIn implemen
 | 
			
		|||
        Long currentOrgId = RequestContext.get().getOrgId();
 | 
			
		||||
        //当前所在的组织是属于矿山下的 costcompany
 | 
			
		||||
        //costcompany 费用承担公司
 | 
			
		||||
        DynamicObject costcompany =  (DynamicObject)this.getModel().getValue("costcompany");
 | 
			
		||||
        long costcompanyId = costcompany.getLong("id");
 | 
			
		||||
        if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){
 | 
			
		||||
            BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM);
 | 
			
		||||
            fieldEdit.addBeforeF7SelectListener(this);
 | 
			
		||||
            fieldEdit.addAfterF7SelectListener(this);
 | 
			
		||||
        Object costcompanyObj = this.getModel().getValue("costcompany");
 | 
			
		||||
        if(costcompanyObj!=null){
 | 
			
		||||
            DynamicObject costcompany =  (DynamicObject)costcompanyObj;
 | 
			
		||||
            long costcompanyId = costcompany.getLong("id");
 | 
			
		||||
            if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){
 | 
			
		||||
                BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM);
 | 
			
		||||
                fieldEdit.addBeforeF7SelectListener(this);
 | 
			
		||||
                fieldEdit.addAfterF7SelectListener(this);
 | 
			
		||||
 | 
			
		||||
            BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM);
 | 
			
		||||
            fieldEditExpense.addBeforeF7SelectListener(this);
 | 
			
		||||
            fieldEditExpense.addAfterF7SelectListener(this);
 | 
			
		||||
                BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM);
 | 
			
		||||
                fieldEditExpense.addBeforeF7SelectListener(this);
 | 
			
		||||
                fieldEditExpense.addAfterF7SelectListener(this);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,43 +29,45 @@ public class TriprAutoCalWorkingDaysPlugin extends AbstractBillPlugIn implements
 | 
			
		|||
        //当前切换选择的组织
 | 
			
		||||
        Object company = this.getModel().getValue("costcompany");//核算组织(费用承担公司)
 | 
			
		||||
        Long currentOrgId = RequestContext.get().getOrgId();
 | 
			
		||||
        DynamicObject companyObj = (DynamicObject)company;
 | 
			
		||||
        Long companyId = companyObj.getLong("id");
 | 
			
		||||
        if(OrgCheckUtils.isKS(companyId)){
 | 
			
		||||
            String name = e.getProperty().getName();
 | 
			
		||||
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
 | 
			
		||||
             if(name.equals("zcgj_startdate") ||name.equals("zcgj_enddate")){
 | 
			
		||||
                ChangeData[] changeSet = e.getChangeSet();
 | 
			
		||||
                int rowIndex = changeSet[0].getRowIndex();
 | 
			
		||||
                calHomeentityDay(rowIndex);
 | 
			
		||||
                 Set<LocalDate> allSet = new HashSet<>();
 | 
			
		||||
                 Set<LocalDate> localDates1 = calHomeentityDay();
 | 
			
		||||
                 Set<LocalDate> localDates2 = calTripentryDay();
 | 
			
		||||
                 allSet.addAll(localDates1);
 | 
			
		||||
                 allSet.addAll(localDates2);
 | 
			
		||||
                 this.getModel().setValue("zcgj_kccbdays",allSet.size());
 | 
			
		||||
            } else if(name.equals("startdate") ||name.equals("enddate")){
 | 
			
		||||
                 // 计算结果
 | 
			
		||||
                 Set<LocalDate> allSet = new HashSet<>();
 | 
			
		||||
                 Set<LocalDate> localDates1 = calHomeentityDay();
 | 
			
		||||
                 Set<LocalDate> localDates2 = calTripentryDay();
 | 
			
		||||
                 allSet.addAll(localDates1);
 | 
			
		||||
                 allSet.addAll(localDates2);
 | 
			
		||||
                 this.getModel().setValue("zcgj_kccbdays",allSet.size());
 | 
			
		||||
             }else if(name.equals("zcgj_is_include_home")){
 | 
			
		||||
                 boolean isHome = (boolean)this.getModel().getValue("zcgj_is_include_home");
 | 
			
		||||
                 if(!isHome){
 | 
			
		||||
                     this.getModel().deleteEntryData("zcgj_homeentity");
 | 
			
		||||
                 }
 | 
			
		||||
                 Set<LocalDate> allSet = new HashSet<>();
 | 
			
		||||
                 Set<LocalDate> localDates1 = calHomeentityDay();
 | 
			
		||||
                 Set<LocalDate> localDates2 = calTripentryDay();
 | 
			
		||||
                 allSet.addAll(localDates1);
 | 
			
		||||
                 allSet.addAll(localDates2);
 | 
			
		||||
                 this.getModel().setValue("zcgj_kccbdays",allSet.size());
 | 
			
		||||
                 getView().updateView();
 | 
			
		||||
             }
 | 
			
		||||
        if(company!=null){
 | 
			
		||||
            DynamicObject companyObj = (DynamicObject)company;
 | 
			
		||||
            Long companyId = companyObj.getLong("id");
 | 
			
		||||
            if(OrgCheckUtils.isKS(companyId)){
 | 
			
		||||
                String name = e.getProperty().getName();
 | 
			
		||||
                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
 | 
			
		||||
                if(name.equals("zcgj_startdate") ||name.equals("zcgj_enddate")){
 | 
			
		||||
                    ChangeData[] changeSet = e.getChangeSet();
 | 
			
		||||
                    int rowIndex = changeSet[0].getRowIndex();
 | 
			
		||||
                    calHomeentityDay(rowIndex);
 | 
			
		||||
                    Set<LocalDate> allSet = new HashSet<>();
 | 
			
		||||
                    Set<LocalDate> localDates1 = calHomeentityDay();
 | 
			
		||||
                    Set<LocalDate> localDates2 = calTripentryDay();
 | 
			
		||||
                    allSet.addAll(localDates1);
 | 
			
		||||
                    allSet.addAll(localDates2);
 | 
			
		||||
                    this.getModel().setValue("zcgj_kccbdays",allSet.size());
 | 
			
		||||
                } else if(name.equals("startdate") ||name.equals("enddate")){
 | 
			
		||||
                    // 计算结果
 | 
			
		||||
                    Set<LocalDate> allSet = new HashSet<>();
 | 
			
		||||
                    Set<LocalDate> localDates1 = calHomeentityDay();
 | 
			
		||||
                    Set<LocalDate> localDates2 = calTripentryDay();
 | 
			
		||||
                    allSet.addAll(localDates1);
 | 
			
		||||
                    allSet.addAll(localDates2);
 | 
			
		||||
                    this.getModel().setValue("zcgj_kccbdays",allSet.size());
 | 
			
		||||
                }else if(name.equals("zcgj_is_include_home")){
 | 
			
		||||
                    boolean isHome = (boolean)this.getModel().getValue("zcgj_is_include_home");
 | 
			
		||||
                    if(!isHome){
 | 
			
		||||
                        this.getModel().deleteEntryData("zcgj_homeentity");
 | 
			
		||||
                    }
 | 
			
		||||
                    Set<LocalDate> allSet = new HashSet<>();
 | 
			
		||||
                    Set<LocalDate> localDates1 = calHomeentityDay();
 | 
			
		||||
                    Set<LocalDate> localDates2 = calTripentryDay();
 | 
			
		||||
                    allSet.addAll(localDates1);
 | 
			
		||||
                    allSet.addAll(localDates2);
 | 
			
		||||
                    this.getModel().setValue("zcgj_kccbdays",allSet.size());
 | 
			
		||||
                    getView().updateView();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        super.propertyChanged(e);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue