Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
1849dbaac9
|
@ -0,0 +1,91 @@
|
|||
package zcgj.zcdev.zcdev.fs.plugin.operate;
|
||||
|
||||
import kd.bos.context.RequestContext;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.ExtendedDataEntity;
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||||
import kd.bos.entity.validate.AbstractValidator;
|
||||
import kd.bos.servicehelper.user.UserServiceHelper;
|
||||
import kd.bos.util.StringUtils;
|
||||
import zcgj.zcdev.zcdev.fs.utils.OrgCheckUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 无合同付预付单(预付单)校验插件
|
||||
*/
|
||||
public class PrepaybillNoContractCkOp extends AbstractOperationServicePlugIn {
|
||||
|
||||
@Override
|
||||
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||
super.onPreparePropertys(e);
|
||||
e.getFieldKeys().add("costcompany");
|
||||
e.getFieldKeys().add("zcgj_isec");
|
||||
e.getFieldKeys().add("zcgj_invoiceremark");//特殊说明
|
||||
e.getFieldKeys().add("zcgj_nocontract");//合同付款类型 无合同付款 NOCONTRACT , 合同付款 CONTRACT
|
||||
e.getFieldKeys().add("contractentry");//关联合同
|
||||
e.getFieldKeys().add("zcgj_bizype");//业务类型
|
||||
e.getFieldKeys().add("zcgj_maintenanceackentry");//设备维修
|
||||
e.getFieldKeys().add("zcgj_materialinbillentry");//入库单
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||
super.onAddValidators(e);
|
||||
Long currentUserId = UserServiceHelper.getCurrentUserId();
|
||||
// 当前用户所属组织
|
||||
Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId);
|
||||
//当前切换选择的组织
|
||||
Long currentOrgId = RequestContext.get().getOrgId();
|
||||
//当前所在的组织是属于矿山下的
|
||||
//if(OrgCheckUtils.isKS(currentOrgId)){
|
||||
e.getValidators().add(new ValidatorExt());
|
||||
//}
|
||||
}
|
||||
|
||||
class ValidatorExt extends AbstractValidator {
|
||||
@Override
|
||||
public void validate() {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
|
||||
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
|
||||
Map<Long, Map<String,Object>> allMap = new HashMap<>();
|
||||
//当前提交的探亲单据id集合
|
||||
Map<Long, List<Long>> currentBillIdListMap = new HashMap<>();
|
||||
|
||||
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
||||
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
|
||||
Object costcompanyObj = dataEntity.get("costcompany");
|
||||
Object costdeptObj = dataEntity.get("costdept");
|
||||
if(costcompanyObj!=null && costdeptObj != null){
|
||||
DynamicObject costcompany = (DynamicObject)costcompanyObj;
|
||||
long costcompanyId = costcompany.getLong("id");
|
||||
if(OrgCheckUtils.isKS(costcompanyId)){
|
||||
boolean isec = dataEntity.getBoolean("zcgj_isec");
|
||||
if(isec){
|
||||
String bisType = dataEntity.getString("zcgj_bizype");
|
||||
//物资采购 WZCG
|
||||
if("WZCG".equals(bisType)){
|
||||
DynamicObjectCollection entry = dataEntity.getDynamicObjectCollection("zcgj_materialinbillentry"); //入库单
|
||||
if((entry == null || entry.isEmpty())){
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("业务类型为物资采购时,入库单分录不能为空!"));
|
||||
}
|
||||
}else if("SBWX".equals(bisType)){//设备维修 SBWX
|
||||
DynamicObjectCollection entry = dataEntity.getDynamicObjectCollection("zcgj_maintenanceackentry"); //入库单
|
||||
if((entry == null || entry.isEmpty())){
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("业务类型为设备维修时,维修确认单分录不能为空!"));
|
||||
}
|
||||
}
|
||||
//其他工程款 QTGCK 不交易
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 无合同付款申请单(对公报销单)合同必录校验
|
||||
* 无合同付款申请单(对公报销单)入库单和
|
||||
*/
|
||||
public class PublicBillContractCkOp extends AbstractOperationServicePlugIn {
|
||||
|
||||
|
@ -31,6 +31,8 @@ public class PublicBillContractCkOp extends AbstractOperationServicePlugIn {
|
|||
e.getFieldKeys().add("zcgj_nocontract");//合同付款类型 无合同付款 NOCONTRACT , 合同付款 CONTRACT
|
||||
e.getFieldKeys().add("contractentry");//关联合同
|
||||
e.getFieldKeys().add("zcgj_bizype");//业务类型
|
||||
e.getFieldKeys().add("zcgj_maintenanceackentry");//设备维修
|
||||
e.getFieldKeys().add("zcgj_materialinbillentry");//入库单
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -87,8 +87,8 @@ public class TripreimbursebillIsInvoiceDateCheckOp extends AbstractOperationServ
|
|||
for (DynamicObject invoice : invoiceentry) {
|
||||
i++;
|
||||
String invoicetype = invoice.getString("invoicetype");
|
||||
if("9".equals(invoicetype) || "10".equals(invoicetype)){ // 火车/飞机发票
|
||||
Date carrierDate = invoice.getDate("carrierdate"); // 乘车日期
|
||||
Date carrierDate = invoice.getDate("carrierdate"); // 乘车日期
|
||||
if(carrierDate != null){
|
||||
// 校验1: 是否在行程时间范围内
|
||||
boolean inTripRange = false;
|
||||
for (DynamicObject trip : tripentry) {
|
||||
|
@ -116,28 +116,6 @@ public class TripreimbursebillIsInvoiceDateCheckOp extends AbstractOperationServ
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*if(writeoffapply!=null&&writeoffapply.size()==1){
|
||||
DynamicObject writeoffapplyObj = writeoffapply.get(0);
|
||||
Date zcgjGlsqAuditdate = writeoffapplyObj.getDate("zcgj_glsq_auditdate");
|
||||
DynamicObjectCollection invoiceentry = dataEntity.getDynamicObjectCollection("invoiceentry");
|
||||
Map<String, LocalDate> invoiceDateMap = new HashMap<>();
|
||||
for (DynamicObject invoiceentryObject : invoiceentry) {
|
||||
if (invoiceentryObject.getDate("invoicedate") != null && invoiceentryObject.getString("invoiceno") != null &&
|
||||
!StringUtils.isEmpty(invoiceentryObject.getString("invoiceno"))) {
|
||||
invoiceDateMap.put(invoiceentryObject.getString("invoiceno"),dateToLocalDate(invoiceentryObject.getDate("invoicedate")));
|
||||
}
|
||||
}
|
||||
for (String invoiceno : invoiceDateMap.keySet()) {
|
||||
LocalDate invoiceDate = invoiceDateMap.get(invoiceno);
|
||||
if (zcgjGlsqAuditdate!=null && invoiceDate.isBefore(dateToLocalDate(zcgjGlsqAuditdate))) {
|
||||
// System.out.println("date1 比 date2 早");
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("发票号码为:%s的发票,开票日期不能早于关联申请的审核时间!",invoiceno));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue