fix:外销合同保存效验
This commit is contained in:
parent
2b328be8ea
commit
53fda19d54
@ -1,7 +1,11 @@
|
||||
package com.yem.wm.es.salesorder.op;
|
||||
|
||||
import com.yem.wm.es.salesorder.validator.SalesOrderSaveValidator;
|
||||
import com.yem.wm.es.salesorder.validator.SalesOrderUnAuditValidator;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||||
import kd.bos.entity.plugin.args.EndOperationTransactionArgs;
|
||||
import kd.bos.i18n.mservice.I18nServiceHelper;
|
||||
import kd.bos.i18n.mservice.utils.AmountConvertResult;
|
||||
@ -10,6 +14,7 @@ import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.yem.wm.syn.cmmp.addnew.OrderProReqBillWMI.getDownList;
|
||||
@ -21,6 +26,12 @@ import static com.yem.wm.syn.cmmp.addnew.OrderProReqBillWMI.getDownList;
|
||||
* 保存时贸易术语赋值
|
||||
*/
|
||||
public class SalesOrderSaveOp extends AbstractOperationServicePlugIn {
|
||||
@Override
|
||||
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||
super.onPreparePropertys(e);
|
||||
List<String> fieldKeys = e.getFieldKeys();
|
||||
fieldKeys.addAll(this.billEntityType.getAllFields().keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endOperationTransaction(EndOperationTransactionArgs e) {
|
||||
@ -42,4 +53,9 @@ public class SalesOrderSaveOp extends AbstractOperationServicePlugIn {
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||
super.onAddValidators(e);
|
||||
e.addValidator(new SalesOrderSaveValidator());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
package com.yem.wm.es.salesorder.validator;
|
||||
|
||||
import com.grapecity.documents.excel.L;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.ExtendedDataEntity;
|
||||
import kd.bos.entity.validate.AbstractValidator;
|
||||
import scala.Int;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author ljw
|
||||
* @date 2024/9/12 19:01
|
||||
* @description SalesOrderSaveValidator
|
||||
*/
|
||||
public class SalesOrderSaveValidator extends AbstractValidator {
|
||||
@Override
|
||||
public void validate() {
|
||||
ExtendedDataEntity[] dataEntities = this.getDataEntities();
|
||||
for (ExtendedDataEntity dataEntitie : dataEntities) {
|
||||
DynamicObject dataEntity = dataEntitie.getDataEntity();
|
||||
DynamicObjectCollection yemEsMaterialinfo = dataEntity.getDynamicObjectCollection("yem_es_materialinfo");
|
||||
Map<Long, String> map = new HashMap<>();
|
||||
Map<Long, String> maps = new HashMap<>();
|
||||
for (DynamicObject dynamicObject : yemEsMaterialinfo) {
|
||||
DynamicObject yemMateriel = dynamicObject.getDynamicObject("yem_materiel");
|
||||
if (yemMateriel != null) {
|
||||
String seq = dynamicObject.getString("seq");
|
||||
Long aLong = yemMateriel.getLong("id");
|
||||
if (map.get(aLong) == null) {
|
||||
map.put(aLong, seq);
|
||||
} else {
|
||||
if (maps.get(aLong) == null) {
|
||||
maps.put(aLong, map.get(aLong) + "," + seq);
|
||||
} else {
|
||||
maps.put(aLong, maps.get(aLong) + "," + seq);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
for (Long key : maps.keySet()) {
|
||||
this.addErrorMessage(dataEntitie, "商品明细:第" + maps.get(key) + "行物料编码重复");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user