物料对称修改

This commit is contained in:
lvleigang 2025-04-22 14:53:49 +08:00
parent d785e49f84
commit 1ddb754e5d
1 changed files with 34 additions and 19 deletions

View File

@ -31,6 +31,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors;
/*** /***
@ -583,9 +584,7 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
**/ **/
private JsonResultEntity checkData(List<ZjMaterielSynchronizationEventEntity> list, boolean flag,List<InventoryEntity> inventoryEntities) { private JsonResultEntity checkData(List<ZjMaterielSynchronizationEventEntity> list, boolean flag,List<InventoryEntity> inventoryEntities) {
StringBuffer str = new StringBuffer(); StringBuffer str = new StringBuffer();
Map<String, Integer> elementCountMap = new HashMap<>();
Integer num = 0;
Integer num1 = 0;
/* /*
1必填校验发起 1必填校验发起
物料中类货品编码修改必填 物料中类货品编码修改必填
@ -606,13 +605,14 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
str.append("序号为"+entity.getField0004()+"明细行的物料中类为空。"); str.append("序号为"+entity.getField0004()+"明细行的物料中类为空。");
//return BaseResult.getFailureMessageEntity("序号为"+entity.getField0004()+"明细行的物料中类为空"); //return BaseResult.getFailureMessageEntity("序号为"+entity.getField0004()+"明细行的物料中类为空");
}else { }else {
elementCountMap.put(entity.getField0043code(), elementCountMap.getOrDefault(entity.getField0043code(), 0) + 1);
//判断存货分类里面如果有6或7有一个必须有另一个 //判断存货分类里面如果有6或7有一个必须有另一个
if(entity.getField0043code().startsWith("6")){ //if(entity.getField0043code().startsWith("6")){
num++; // num++;
} //}
if(entity.getField0043code().startsWith("7")){ //if(entity.getField0043code().startsWith("7")){
num1++; // num1++;
} //}
} }
//if(entity.getField0018code() == null || "".equals(entity.getField0018code())){ //if(entity.getField0018code() == null || "".equals(entity.getField0018code())){
// return BaseResult.getFailureMessageEntity("序号为"+entity.getField0004()+"明细行的申请原因为空"); // return BaseResult.getFailureMessageEntity("序号为"+entity.getField0004()+"明细行的申请原因为空");
@ -696,18 +696,33 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
} }
} }
Map<String,String> stringMap = new HashMap<>();
//判断存货分类里面如果有6或7有一个必须有另一个 //判断存货分类里面如果有6或7有一个必须有另一个
if(num > 0){ if(elementCountMap != null && elementCountMap.size() > 0){
if(num1 == 0){ for (Map.Entry<String, Integer> entry : elementCountMap.entrySet()) {
str.append("存货分类存在6不存在7"+""); String key = entry.getKey();
Integer value = entry.getValue();
if(key.startsWith("6")){
Integer o = elementCountMap.getOrDefault("7"+key.substring(1),0);
if(value != o){
stringMap.put(key+""+"7"+key.substring(1),"1");
}
}
if(key.startsWith("7")){
Integer o = elementCountMap.getOrDefault("6"+key.substring(1),0);
if(value != o){
stringMap.put("6"+key.substring(1)+""+key,"1");
}
}
}
}
if(stringMap != null && stringMap.size() > 0){
String result = stringMap.keySet().stream()
.collect(Collectors.joining(","));
str.append(result+"不是成对出现。");
}
}
}
if(num1 > 0){
if(num == 0){
str.append("存货分类存在7不存在6"+"");
}
}
//查询u8物料 //查询u8物料
ZjMaterielSynchronizationEventDto querywl = new ZjMaterielSynchronizationEventDto(); ZjMaterielSynchronizationEventDto querywl = new ZjMaterielSynchronizationEventDto();
querywl.setDataSourceCode(zju8); querywl.setDataSourceCode(zju8);