付款申请单费用项目过滤问题处理
This commit is contained in:
parent
8321bb3b40
commit
e370c05eba
|
@ -5,6 +5,7 @@ import kd.bos.bill.BillShowParameter;
|
|||
import kd.bos.bill.OperationStatus;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.datamodel.events.ChangeData;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.form.field.BasedataEdit;
|
||||
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
||||
|
@ -14,6 +15,7 @@ import kd.bos.mvc.bill.BillView;
|
|||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.QueryServiceHelper;
|
||||
import kd.bos.util.StringUtils;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -58,64 +60,20 @@ public class PaymentapplyGeneralPlugin extends AbstractBillPlugIn implements Plu
|
|||
@Override
|
||||
public void propertyChanged(PropertyChangedArgs e) {
|
||||
super.propertyChanged(e);
|
||||
String billFormId = ((BillView) this.getView()).getFormId();//单据标识
|
||||
if("ec_paymentapply".equals(billFormId)) {//付款申请单
|
||||
String name = e.getProperty().getName();
|
||||
/*if("person".equals(name)){
|
||||
ChangeData changeData = e.getChangeSet()[0];//获取改变的数据
|
||||
DynamicObject oldValue = (DynamicObject) changeData.getOldValue();
|
||||
DynamicObject newValue = (DynamicObject) changeData.getNewValue();
|
||||
if(newValue !=null){
|
||||
long userid = newValue.getLong("id");
|
||||
long mainOrgId = UserServiceHelper.getUserMainOrgId(userid);
|
||||
List<Long> orgsUserJoin = UserServiceHelper.getOrgsUserJoin(userid);
|
||||
DynamicObject org = (DynamicObject) this.getModel().getValue("fiaccountorg");
|
||||
if(org!=null && orgsUserJoin!=null && !orgsUserJoin.isEmpty()){
|
||||
Set<Long> collect = new HashSet<>(orgsUserJoin);
|
||||
if(collect.contains(org.getLong("id"))){
|
||||
this.getModel().setValue("zcgj_persondepart", org.getLong("id"));
|
||||
this.getView().updateView("zcgj_persondepart");
|
||||
}else{
|
||||
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
||||
this.getView().updateView("zcgj_persondepart");
|
||||
if("paymenttype".equals(name)){
|
||||
int rowIndex = e.getChangeSet()[0].getRowIndex();
|
||||
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
||||
DynamicObjectCollection entryentity = (DynamicObjectCollection)dataEntity.get("entryentity");
|
||||
if(entryentity != null){
|
||||
entryentity.get(rowIndex).set("zcgj_expenseitem", null);
|
||||
this.getView().updateView("zcgj_expenseitem",rowIndex);
|
||||
}
|
||||
}else{
|
||||
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
||||
this.getView().updateView("zcgj_persondepart");
|
||||
}
|
||||
}else{
|
||||
this.getView().showErrorNotification("申请人不能为空");
|
||||
}
|
||||
}*/
|
||||
/*else if("fiaccountorg".equals(name)){
|
||||
ChangeData changeData = e.getChangeSet()[0];//获取改变的数据
|
||||
DynamicObject oldValue = (DynamicObject) changeData.getOldValue();
|
||||
DynamicObject newValue = (DynamicObject) changeData.getNewValue();
|
||||
if(newValue !=null){
|
||||
DynamicObject person = this.getModel().getDataEntity().getDynamicObject("person");
|
||||
long userid = person.getLong("id");
|
||||
long mainOrgId = UserServiceHelper.getUserMainOrgId(userid);
|
||||
List<Long> orgsUserJoin = UserServiceHelper.getOrgsUserJoin(userid);
|
||||
List<Long> allDepartment = UserServiceHelper.getAllDepartmentByUserId(userid);
|
||||
HasPermOrgResult userHasPermOrgs = PermissionServiceHelper.getUserHasPermOrgs(userid,false);
|
||||
List<Long> hasPermOrgs = userHasPermOrgs.getHasPermOrgs();
|
||||
List<Long> userDepartment = UserServiceHelper.getUserDepartment(userid, false);
|
||||
if(hasPermOrgs!=null && !hasPermOrgs.isEmpty()){
|
||||
Set<Long> collect = new HashSet<>(hasPermOrgs);
|
||||
if(collect.contains(newValue.getLong("id"))){
|
||||
this.getModel().setValue("zcgj_persondepart", newValue.getLong("id"));
|
||||
this.getView().updateView("zcgj_persondepart");
|
||||
}else{
|
||||
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
||||
this.getView().updateView("zcgj_persondepart");
|
||||
}
|
||||
}else{
|
||||
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
||||
this.getView().updateView("zcgj_persondepart");
|
||||
}
|
||||
}else{
|
||||
this.getView().showErrorNotification("所属组织不能为空!");
|
||||
}
|
||||
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -139,14 +97,18 @@ public class PaymentapplyGeneralPlugin extends AbstractBillPlugIn implements Plu
|
|||
DynamicObjectCollection dynamicObjectCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("entryentity");
|
||||
if (dynamicObjectCollection != null) {
|
||||
String paymenttype = dynamicObjectCollection.get(row).getString("paymenttype");//支付类型
|
||||
List<String> numbers = new ArrayList<>();
|
||||
QFilter biztypefilter = null;
|
||||
if("PREPAYMENT".equals(paymenttype)){
|
||||
QFilter biztypefilter = new QFilter("zcgj_biztype", QCP.equals, "50"); //过滤业务单据为支出财务确认单
|
||||
biztypefilter= new QFilter("zcgj_biztype", QCP.equals, "50");
|
||||
}else{
|
||||
biztypefilter = new QFilter("zcgj_biztype", QCP.not_equals, "50");
|
||||
}
|
||||
//分录过滤
|
||||
//使用BusinessDataServiceHelper.load查出来的数据,返回的是符合条件的整单,即使只有分录中的某一行符合条件,也会返回整张单包括其他分录行的数据
|
||||
//使用 QueryServiceHelper.query查出来的数据只会包含符合条件的分录行,不含其他行数据
|
||||
DynamicObjectCollection accountfeeEntries = QueryServiceHelper.query("zcgj_accountfee",
|
||||
"zcgj_entryentity.zcgj_fee.number", new QFilter[]{biztypefilter});//费用与科目分类单
|
||||
List<String> numbers = new ArrayList<>();
|
||||
if (accountfeeEntries != null) {
|
||||
for (DynamicObject dynamicObject : accountfeeEntries) {
|
||||
String zcgjAccounttypeNumber = dynamicObject.getString("zcgj_entryentity.zcgj_fee.number");
|
||||
|
@ -158,7 +120,6 @@ public class PaymentapplyGeneralPlugin extends AbstractBillPlugIn implements Plu
|
|||
QFilter qFilter = new QFilter("number", QCP.in, numbers);
|
||||
ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
|
||||
formShowParameter.getListFilterParameter().getQFilters().add(qFilter);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue