Compare commits
3 Commits
e2d3be798e
...
6db339b94f
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6db339b94f | ||
75850fd0e1 | |||
e524223637 |
@ -6,6 +6,7 @@ package com.yem.wm.es.salesorder.op;/*
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import com.yem.wm.es.salesorder.utils.SalesOrderUtils;
|
import com.yem.wm.es.salesorder.utils.SalesOrderUtils;
|
||||||
|
import com.yem.wm.es.salesorder.validator.NewSalesOrderSubmitAnnexValidator;
|
||||||
import com.yem.wm.es.salesorder.validator.NewSalesOrderSubmitValidator;
|
import com.yem.wm.es.salesorder.validator.NewSalesOrderSubmitValidator;
|
||||||
import com.yem.wm.es.salesorder.validator.SalesOrderSubmitValidator;
|
import com.yem.wm.es.salesorder.validator.SalesOrderSubmitValidator;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
@ -72,6 +73,7 @@ public class SalesOrderSubmitOp extends AbstractOperationServicePlugIn {
|
|||||||
fieldKeys.add("yem_color");
|
fieldKeys.add("yem_color");
|
||||||
fieldKeys.add("yem_marketraiseprice");
|
fieldKeys.add("yem_marketraiseprice");
|
||||||
fieldKeys.add("yem_currency");
|
fieldKeys.add("yem_currency");
|
||||||
|
fieldKeys.add("yem_attsum");
|
||||||
fieldKeys.add("yem_cnperson");
|
fieldKeys.add("yem_cnperson");
|
||||||
fieldKeys.add("yem_suminsured");
|
fieldKeys.add("yem_suminsured");
|
||||||
fieldKeys.add("yem_internationalrate");
|
fieldKeys.add("yem_internationalrate");
|
||||||
@ -85,6 +87,7 @@ public class SalesOrderSubmitOp extends AbstractOperationServicePlugIn {
|
|||||||
super.onAddValidators(e);
|
super.onAddValidators(e);
|
||||||
e.addValidator(new SalesOrderSubmitValidator());
|
e.addValidator(new SalesOrderSubmitValidator());
|
||||||
e.addValidator(new NewSalesOrderSubmitValidator());
|
e.addValidator(new NewSalesOrderSubmitValidator());
|
||||||
|
e.addValidator(new NewSalesOrderSubmitAnnexValidator());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.yem.wm.es.salesorder.validator;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.entity.ExtendedDataEntity;
|
||||||
|
import kd.bos.entity.validate.AbstractValidator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ljw
|
||||||
|
* @date 2024/9/9 16:57
|
||||||
|
* @description NewSalesOrderSubmitAnnexValidator
|
||||||
|
*/
|
||||||
|
public class NewSalesOrderSubmitAnnexValidator extends AbstractValidator {
|
||||||
|
@Override
|
||||||
|
public void validate() {
|
||||||
|
ExtendedDataEntity[] dataEntities = this.getDataEntities();
|
||||||
|
for (ExtendedDataEntity dataEntitie : dataEntities) {
|
||||||
|
DynamicObject mechanical = dataEntitie.getDataEntity();
|
||||||
|
String attachments = mechanical.getString("yem_attsum");
|
||||||
|
if ("0".equals(attachments)){
|
||||||
|
this.addErrorMessage(dataEntitie, "附件未上传或未保存!!!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -150,6 +150,7 @@ public class SalesOrderSubmitValidator extends AbstractValidator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 信保合同提交时,消息提醒:【请确认,信保通中该客户的信保额度是否有效,如果点击是,继续下一步,点击否取消操作】。
|
* 信保合同提交时,消息提醒:【请确认,信保通中该客户的信保额度是否有效,如果点击是,继续下一步,点击否取消操作】。
|
||||||
|
*
|
||||||
* @param dataEntity
|
* @param dataEntity
|
||||||
* @param dataEntitie
|
* @param dataEntitie
|
||||||
*/
|
*/
|
||||||
@ -163,6 +164,7 @@ public class SalesOrderSubmitValidator extends AbstractValidator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据信保明细检查是否信保合同
|
* 根据信保明细检查是否信保合同
|
||||||
|
*
|
||||||
* @param dataEntity
|
* @param dataEntity
|
||||||
* @param dataEntitie
|
* @param dataEntitie
|
||||||
*/
|
*/
|
||||||
@ -204,6 +206,7 @@ public class SalesOrderSubmitValidator extends AbstractValidator {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否是变更合同
|
* 是否是变更合同
|
||||||
|
*
|
||||||
* @param dataEntity 外销合同
|
* @param dataEntity 外销合同
|
||||||
*/
|
*/
|
||||||
private boolean isChangeContract(DynamicObject dataEntity) {
|
private boolean isChangeContract(DynamicObject dataEntity) {
|
||||||
@ -217,11 +220,16 @@ public class SalesOrderSubmitValidator extends AbstractValidator {
|
|||||||
/**
|
/**
|
||||||
* 根据贷记单使用币别+贷记单类型+借贷业务类型+集团客户,匹配对应配件资金池,
|
* 根据贷记单使用币别+贷记单类型+借贷业务类型+集团客户,匹配对应配件资金池,
|
||||||
* 【贷记单使用金额】不能超过其对应分录【实际来源金额-预计去向金额】
|
* 【贷记单使用金额】不能超过其对应分录【实际来源金额-预计去向金额】
|
||||||
|
* <p>
|
||||||
|
* 2024-09-09增加 通过配置进行判断允许超额
|
||||||
|
*
|
||||||
* @param dataEntity
|
* @param dataEntity
|
||||||
* @param dataEntitie
|
* @param dataEntitie
|
||||||
*/
|
*/
|
||||||
private void checkUsedAmount(DynamicObject dataEntity, ExtendedDataEntity dataEntitie) {
|
private void checkUsedAmount(DynamicObject dataEntity, ExtendedDataEntity dataEntitie) {
|
||||||
if (isChangeContract(dataEntity)) {return;}
|
if (isChangeContract(dataEntity)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 资金使用类型
|
// 资金使用类型
|
||||||
String fundusetype = dataEntity.getString("yem_fundusetype");
|
String fundusetype = dataEntity.getString("yem_fundusetype");
|
||||||
if (!"B".equals(fundusetype)) return;
|
if (!"B".equals(fundusetype)) return;
|
||||||
@ -262,6 +270,45 @@ public class SalesOrderSubmitValidator extends AbstractValidator {
|
|||||||
entryCreditype == debcredtype &&
|
entryCreditype == debcredtype &&
|
||||||
groupcustomers == entryCustomer
|
groupcustomers == entryCustomer
|
||||||
) {
|
) {
|
||||||
|
// // 实际来源总金额
|
||||||
|
// BigDecimal sumtotalamount = object.getBigDecimal("yem_sumtotalamount");
|
||||||
|
// // 预计去向总金额
|
||||||
|
// BigDecimal sumtowardamt = object.getBigDecimal("yem_sumtowardamt");
|
||||||
|
// if (debcuseamt.compareTo(sumtotalamount.subtract(sumtowardamt)) > 0) {
|
||||||
|
// sb.append(String.format("配件资金使用明细第 [ %s ] 行,贷记单使用金额 [ %s ] 超过其对应配件资金池 [ %s ] 分录第 [ %s ] 行,实际来源金额 [ %s ] - 预计去向金额 [ %s ] = [ %s ] !!\r\n",
|
||||||
|
// index + 1,
|
||||||
|
// debcuseamt.setScale(2, RoundingMode.HALF_UP),
|
||||||
|
// single.getString("billno"),
|
||||||
|
// subIdx + 1,
|
||||||
|
// sumtotalamount.setScale(2, RoundingMode.HALF_UP),
|
||||||
|
// sumtowardamt.setScale(2, RoundingMode.HALF_UP),
|
||||||
|
// sumtotalamount.subtract(sumtowardamt).setScale(2, RoundingMode.HALF_UP)
|
||||||
|
// ));
|
||||||
|
// }
|
||||||
|
String yem_billtype = dataEntity.getString("yem_billtype.number");//单据类型
|
||||||
|
QFilter qFilter1 = new QFilter("yem_contracttype", QCP.equals, yem_billtype);//合同类型
|
||||||
|
String yem_accamtusetype = dataEntity.getString("yem_accamtusetype");//配件资金使用方式
|
||||||
|
String yem_billbusstype = dataEntity.getString("yem_billbusstype.number");//单据业务类型
|
||||||
|
qFilter1.and(new QFilter("yem_accamtusetype", QCP.equals, yem_accamtusetype));
|
||||||
|
qFilter1.and(new QFilter("yem_billbusstype.number", QCP.equals, yem_billbusstype));
|
||||||
|
qFilter1.and(new QFilter("enable", QCP.equals, "1"));
|
||||||
|
String selectfield = DynamicObjectUtil.getSelectfields("yem_bd_credittypeconfig", false);
|
||||||
|
String selectfields = DynamicObjectUtil.getEntrySelectfields(selectfield, "yem_bd_credittypeconfig", "yem_credittypeentry", false);
|
||||||
|
Map<Long, Boolean> map = new HashMap<>();
|
||||||
|
DynamicObjectCollection data = QueryServiceHelper.query("yem_bd_credittypeconfig",
|
||||||
|
selectfields, new QFilter[]{qFilter1}, null);
|
||||||
|
if (data.size() > 0) {
|
||||||
|
for (int i = 0; i < data.size(); i++) {
|
||||||
|
DynamicObject object1 = data.get(i);
|
||||||
|
long aLong = object1.getLong("yem_credittypeentry.yem_credittype");
|
||||||
|
if (!map.containsKey(aLong)) {
|
||||||
|
map.put(aLong, object1.getBoolean("yem_credittypeentry.yem_isoverage"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (map.containsKey(debcredtype)) {
|
||||||
|
Boolean aBoolean = map.get(debcredtype);
|
||||||
|
if (!aBoolean) {
|
||||||
// 实际来源总金额
|
// 实际来源总金额
|
||||||
BigDecimal sumtotalamount = object.getBigDecimal("yem_sumtotalamount");
|
BigDecimal sumtotalamount = object.getBigDecimal("yem_sumtotalamount");
|
||||||
// 预计去向总金额
|
// 预计去向总金额
|
||||||
@ -277,6 +324,24 @@ public class SalesOrderSubmitValidator extends AbstractValidator {
|
|||||||
sumtotalamount.subtract(sumtowardamt).setScale(2, RoundingMode.HALF_UP)
|
sumtotalamount.subtract(sumtowardamt).setScale(2, RoundingMode.HALF_UP)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// 实际来源总金额
|
||||||
|
BigDecimal sumtotalamount = object.getBigDecimal("yem_sumtotalamount");
|
||||||
|
// 预计去向总金额
|
||||||
|
BigDecimal sumtowardamt = object.getBigDecimal("yem_sumtowardamt");
|
||||||
|
if (debcuseamt.compareTo(sumtotalamount.subtract(sumtowardamt)) < 0) {
|
||||||
|
sb.append(String.format("配件资金使用明细第 [ %s ] 行,贷记单使用金额 [ %s ] 超过其对应配件资金池 [ %s ] 分录第 [ %s ] 行,实际来源金额 [ %s ] - 预计去向金额 [ %s ] = [ %s ] !!\r\n",
|
||||||
|
index + 1,
|
||||||
|
debcuseamt.setScale(2, RoundingMode.HALF_UP),
|
||||||
|
single.getString("billno"),
|
||||||
|
subIdx + 1,
|
||||||
|
sumtotalamount.setScale(2, RoundingMode.HALF_UP),
|
||||||
|
sumtowardamt.setScale(2, RoundingMode.HALF_UP),
|
||||||
|
sumtotalamount.subtract(sumtowardamt).setScale(2, RoundingMode.HALF_UP)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,6 +128,35 @@ public class DebCredNewAuditValidatorOp extends AbstractValidator {
|
|||||||
"未获取到满足条件的配件资金池,无法生成《转换贷记单》,请修改后重试");
|
"未获取到满足条件的配件资金池,无法生成《转换贷记单》,请修改后重试");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DynamicObject getaccamtusetype = getaccamtusetype(dataEntity);
|
||||||
|
Map<Long, Boolean> isoveragemap = new HashMap<>();
|
||||||
|
DynamicObjectCollection data11 = null;
|
||||||
|
if (YEM.isNotEmpty(getaccamtusetype)) {
|
||||||
|
QFilter qFilter1 = new QFilter("yem_contracttype", QCP.equals, getaccamtusetype.getString("yem_billtype.number"));//合同类型
|
||||||
|
qFilter1.and(new QFilter("yem_accamtusetype", QCP.equals, getaccamtusetype.getString("yem_fundusetype")));
|
||||||
|
qFilter1.and(new QFilter("yem_billbusstype.number", QCP.equals, getaccamtusetype.getString("yem_billbusstype.number")));
|
||||||
|
qFilter1.and(new QFilter("enable", QCP.equals, "1"));
|
||||||
|
String selectfield1 = DynamicObjectUtil.getSelectfields("yem_bd_credittypeconfig", false);
|
||||||
|
String selectfields1 = DynamicObjectUtil.getEntrySelectfields(selectfield1, "yem_bd_credittypeconfig", "yem_credittypeentry", false);
|
||||||
|
data11 = QueryServiceHelper.query("yem_bd_credittypeconfig",
|
||||||
|
selectfields1, new QFilter[]{qFilter1}, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (YEM.isNotEmpty(data11)) {
|
||||||
|
for (int i = 0; i < data11.size(); i++) {
|
||||||
|
DynamicObject object1 = data11.get(i);
|
||||||
|
long aLong = object1.getLong("yem_credittypeentry.yem_credittype");
|
||||||
|
if (!isoveragemap.containsKey(aLong)) {
|
||||||
|
isoveragemap.put(aLong, object1.getBoolean("yem_credittypeentry.yem_isoverage"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Boolean isoverage = false;
|
||||||
|
long credittypeid = yem_credittype.getLong("id");
|
||||||
|
if (isoveragemap.containsKey(credittypeid)) {
|
||||||
|
isoverage = true;
|
||||||
|
}
|
||||||
//贷记单
|
//贷记单
|
||||||
if (yem_billtype.equals("yem_debcrednote_d")) {
|
if (yem_billtype.equals("yem_debcrednote_d")) {
|
||||||
DynamicObjectCollection data = quespcapitalpool(dataEntity);
|
DynamicObjectCollection data = quespcapitalpool(dataEntity);
|
||||||
@ -150,12 +179,12 @@ public class DebCredNewAuditValidatorOp extends AbstractValidator {
|
|||||||
BigDecimal yem_amount = dataEntity.getBigDecimal("yem_amount");//配件资金池增加金额
|
BigDecimal yem_amount = dataEntity.getBigDecimal("yem_amount");//配件资金池增加金额
|
||||||
BigDecimal yem_amount_sub = dataEntity.getBigDecimal("yem_amount_sub");//配件资金池扣减金额
|
BigDecimal yem_amount_sub = dataEntity.getBigDecimal("yem_amount_sub");//配件资金池扣减金额
|
||||||
if (yem_currency.equals("CNY")) {
|
if (yem_currency.equals("CNY")) {
|
||||||
|
|
||||||
BigDecimal bigDecimal = BigDecimal.ZERO;
|
BigDecimal bigDecimal = BigDecimal.ZERO;
|
||||||
if (map1.containsKey(currency)) {
|
if (map1.containsKey(currency)) {
|
||||||
bigDecimal = map1.get(currency);
|
bigDecimal = map1.get(currency);
|
||||||
}
|
}
|
||||||
BigDecimal sumamount = yem_amount.add(bigDecimal);
|
BigDecimal sumamount = yem_amount.add(bigDecimal);
|
||||||
|
if (!isoverage) {
|
||||||
if (sumamount.compareTo(yem_amount_sub) == -1) {
|
if (sumamount.compareTo(yem_amount_sub) == -1) {
|
||||||
this.addErrorMessage(dataEntitie, "根据客户【" + customername + "】、" +
|
this.addErrorMessage(dataEntitie, "根据客户【" + customername + "】、" +
|
||||||
"产品类型【" + productsname + "】、借/贷类型【" + debcredtype + "】、" +
|
"产品类型【" + productsname + "】、借/贷类型【" + debcredtype + "】、" +
|
||||||
@ -165,6 +194,17 @@ public class DebCredNewAuditValidatorOp extends AbstractValidator {
|
|||||||
"小于去向汇总金额【" + yem_amount_sub.setScale(2, BigDecimal.ROUND_HALF_UP) + "】" +
|
"小于去向汇总金额【" + yem_amount_sub.setScale(2, BigDecimal.ROUND_HALF_UP) + "】" +
|
||||||
",请修改后重试");
|
",请修改后重试");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (sumamount.compareTo(yem_amount_sub) == 1) {
|
||||||
|
this.addErrorMessage(dataEntitie, "根据客户【" + customername + "】、" +
|
||||||
|
"产品类型【" + productsname + "】、借/贷类型【" + debcredtype + "】、" +
|
||||||
|
"借贷业务类型【" + yem_credittype.getString("name") + "】" +
|
||||||
|
"查询到【人民币】预计剩余金额【" + bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP) + "】" +
|
||||||
|
"加上本次来源金额汇总【" + yem_amount.setScale(2, BigDecimal.ROUND_HALF_UP) + "】" +
|
||||||
|
"小于去向汇总金额【" + yem_amount_sub.setScale(2, BigDecimal.ROUND_HALF_UP) + "】" +
|
||||||
|
",请修改后重试");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (yem_currency.equals("USD")) {
|
if (yem_currency.equals("USD")) {
|
||||||
BigDecimal bigDecimal = BigDecimal.ZERO;
|
BigDecimal bigDecimal = BigDecimal.ZERO;
|
||||||
@ -172,6 +212,7 @@ public class DebCredNewAuditValidatorOp extends AbstractValidator {
|
|||||||
bigDecimal = map1.get(currency);
|
bigDecimal = map1.get(currency);
|
||||||
}
|
}
|
||||||
BigDecimal sumamount = yem_amount.add(bigDecimal);
|
BigDecimal sumamount = yem_amount.add(bigDecimal);
|
||||||
|
if (!isoverage) {
|
||||||
if (sumamount.compareTo(yem_amount_sub) == -1) {
|
if (sumamount.compareTo(yem_amount_sub) == -1) {
|
||||||
this.addErrorMessage(dataEntitie, "根据客户【" + customername + "】、" +
|
this.addErrorMessage(dataEntitie, "根据客户【" + customername + "】、" +
|
||||||
"产品类型【" + productsname + "】、借/贷类型【" + debcredtype + "】、" +
|
"产品类型【" + productsname + "】、借/贷类型【" + debcredtype + "】、" +
|
||||||
@ -181,6 +222,17 @@ public class DebCredNewAuditValidatorOp extends AbstractValidator {
|
|||||||
"小于去向汇总金额【" + yem_amount_sub.setScale(2, BigDecimal.ROUND_HALF_UP) + "】" +
|
"小于去向汇总金额【" + yem_amount_sub.setScale(2, BigDecimal.ROUND_HALF_UP) + "】" +
|
||||||
",请修改后重试");
|
",请修改后重试");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (sumamount.compareTo(yem_amount_sub) == 1) {
|
||||||
|
this.addErrorMessage(dataEntitie, "根据客户【" + customername + "】、" +
|
||||||
|
"产品类型【" + productsname + "】、借/贷类型【" + debcredtype + "】、" +
|
||||||
|
"借贷业务类型【" + yem_credittype.getString("name") + "】" +
|
||||||
|
"查询到【美元】预计剩余金额【" + bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP) + "】" +
|
||||||
|
"加上本次来源金额汇总【" + yem_amount.setScale(2, BigDecimal.ROUND_HALF_UP) + "】" +
|
||||||
|
"小于去向汇总金额【" + yem_amount_sub.setScale(2, BigDecimal.ROUND_HALF_UP) + "】" +
|
||||||
|
",请修改后重试");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,6 +280,12 @@ public class DebCredNewAuditValidatorOp extends AbstractValidator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配件资金池额度
|
||||||
|
*
|
||||||
|
* @param dataEntity
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public DynamicObjectCollection quespcapitalpool(DynamicObject dataEntity) {
|
public DynamicObjectCollection quespcapitalpool(DynamicObject dataEntity) {
|
||||||
//组织
|
//组织
|
||||||
DynamicObject org = dataEntity.getDynamicObject("org");
|
DynamicObject org = dataEntity.getDynamicObject("org");
|
||||||
@ -265,4 +323,21 @@ public class DebCredNewAuditValidatorOp extends AbstractValidator {
|
|||||||
DynamicObjectCollection data = QueryServiceHelper.query("yem_spcapitalpool", selectfields, new QFilter[]{qFilter}, "billno");
|
DynamicObjectCollection data = QueryServiceHelper.query("yem_spcapitalpool", selectfields, new QFilter[]{qFilter}, "billno");
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取合同配件资金使用方式
|
||||||
|
*
|
||||||
|
* @param dataEntity
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public DynamicObject getaccamtusetype(DynamicObject dataEntity) {
|
||||||
|
DynamicObject value = null;
|
||||||
|
String yem_sourcebillno = dataEntity.getString("yem_sourcebillno");
|
||||||
|
QFilter qFilter = new QFilter("billno", QCP.equals, yem_sourcebillno);
|
||||||
|
DynamicObject billType = BusinessDataServiceHelper.loadSingle("yem_es_salesorder", "id,yem_fundusetype", qFilter.toArray());
|
||||||
|
if (billType != null) {
|
||||||
|
value = BusinessDataServiceHelper.loadSingle(billType.getString("id"), "yem_es_salesorder");
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user