Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
xiaoshi 2025-02-26 16:49:36 +08:00
commit 6a1a850c57
9 changed files with 227 additions and 153 deletions

View File

@ -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");
}
}
}
}

View File

@ -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("请设置成本中心!");
}
}
}
}

View File

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

View File

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

View File

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

View File

@ -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

View File

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

View File

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

View File

@ -0,0 +1,54 @@
package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.context.RequestContext;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.form.field.BasedataEdit;
import kd.bos.form.field.events.BeforeF7SelectEvent;
import kd.bos.form.field.events.BeforeF7SelectListener;
import kd.bos.list.ListShowParameter;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.user.UserServiceHelper;
import kd.sdk.plugin.Plugin;
import java.util.ArrayList;
import java.util.EventObject;
import java.util.List;
public class EcInFinalsettleJusCustPlugin extends AbstractBillPlugIn implements Plugin, BeforeF7SelectListener {
@Override
public void registerListener(EventObject e) {
super.registerListener(e);
BasedataEdit fieldEdit = this.getView().getControl("zcgj_jscustomer");
fieldEdit.addBeforeF7SelectListener(this);
}
@Override
public void beforeF7Select(BeforeF7SelectEvent arg0) {
String name = arg0.getProperty().getName();
if(name.equals("zcgj_jscustomer")){
Object contractObj = this.getModel().getValue("contract");
if(contractObj != null){
DynamicObject contract = (DynamicObject)contractObj;
boolean ismulticontract = contract.getBoolean("ismulticontract");//多方合同
DynamicObject parta = contract.getDynamicObject("parta");
List<Long> ids = new ArrayList<>();
ids.add(parta.getLong("id"));
if(ismulticontract){
DynamicObjectCollection otherpart = contract.getDynamicObjectCollection("otherpart");
for (DynamicObject dynamicObject : otherpart) {
ids.add(dynamicObject.getLong(2));
}
}
List<QFilter> qFilterList = new ArrayList<>();
qFilterList.add(new QFilter("id", QCP.in,ids));
arg0.setCustomQFilters(qFilterList);
}
}
}
}