rev:修改手动叫料

This commit is contained in:
zhangzq
2023-12-11 15:42:33 +08:00
parent 2bb22a03fa
commit 20c01e934d
3 changed files with 49 additions and 38 deletions

View File

@@ -32,7 +32,9 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
@@ -380,6 +382,17 @@ public class HandNewMaterialServiceImpl implements HandNewMaterialService {
mst_jo.put("syscompanyid", deptId + "");
io_mst.insert(mst_jo);
//批量查询桶:
List<String> bucketuniqueCollenct = new ArrayList<>();
for (HashMap row : rows) {
bucketuniqueCollenct.add(String.valueOf(row.get("bucketunique")));
}
Map<String, JSONObject> buckqMap = bucket_wql.query("bucketunique in ('" + bucketuniqueCollenct.stream().collect(Collectors.joining("','")) + "')")
.getResultJSONArray(0).stream().collect(HashMap::new, (map, buckq) -> {
JSONObject jo = (JSONObject) buckq;
map.put("key_"+jo.getString("bucketunique")+jo.getString("material_id") + jo.getString("pcsn"), jo);
}, HashMap::putAll);
for (int i = 0; i < rows.size(); i++) {
String iostorinvdtl_id = "";
String iostorinvdis_id = "";
@@ -388,47 +401,45 @@ public class HandNewMaterialServiceImpl implements HandNewMaterialService {
if (flag.equals("5") && row.containsKey("is_new") && row.get("is_new").equals("0")) {
continue;
}
JSONObject bucket_jo = buckqMap.get("key_" + row.get("bucketunique") + row.get("material_id") + row.get("pcsn"));
//校验桶状态
JSONObject bucket_jo = bucket_wql.query("bucketunique = '" + row.get("bucketunique") + "' AND material_id = '" + row.get("material_id") + "' AND pcsn = '" + row.get("pcsn") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(bucket_jo)) {
throw new PdaRequestException("桶号:"+row.get("bucketunique")+"查不到对应物料批次记录!");
}
if (!ObjectUtil.isEmpty(bucket_jo) && !bucket_jo.getString("status").equals("01")) {
//如果为软废采购入库,判断是否为新加,不是新加的不需要判断是否组盘
if (!flag.equals("5") && row.containsKey("is_new") && row.get("is_new").equals("0")) {
throw new PdaRequestException("" + bucket_jo.getString("bucketunique") + "已经组盘!");
check:{ //校验桶状态
if (ObjectUtil.isEmpty(bucket_jo)) {
throw new PdaRequestException("桶号:" + row.get("bucketunique") + "查不到对应物料批次记录!");
}
}
if (flag.equals("1")) {
if (StrUtil.isNotEmpty(material_id) && StrUtil.isNotEmpty(pcsn)) {
if (!row.get("material_id").equals(material_id) || !pcsn.equals(row.get("pcsn"))) {
throw new PdaRequestException("存在不同物料、批次的明细");
if (!ObjectUtil.isEmpty(bucket_jo) && !bucket_jo.getString("status").equals("01")) {
//如果为软废采购入库,判断是否为新加,不是新加的不需要判断是否组盘
if (!flag.equals("5") && row.containsKey("is_new") && row.get("is_new").equals("0")) {
throw new PdaRequestException("" + bucket_jo.getString("bucketunique") + "已经组盘");
}
}
if (flag.equals("1")) {
if (StrUtil.isNotEmpty(material_id) && StrUtil.isNotEmpty(pcsn)) {
if (!row.get("material_id").equals(material_id) || !pcsn.equals(row.get("pcsn"))) {
throw new PdaRequestException("存在不同物料、批次的明细!");
}
}
}
//工序返工入库校验、零头粉入库
if (flag.equals("3") || flag.equals("6")) {
//物料为PG粉
boolean is_pgf = materialbaseService.isAlongMaterType(MaterOptTypeEnum.PGF.getCode(), bucket_jo.getString("material_id"), null);
//桶内物料必须为PG粉
if (!is_pgf) {
throw new PdaRequestException("桶内物料不为PG粉");
}
}
if (flag.equals("5") || flag.equals("7")) {
//物料为软废
boolean is_rf = materialbaseService.isAlongMaterType(MaterOptTypeEnum.RF.getCode(), bucket_jo.getString("material_id"), null);
//桶内物料必须为软废;
if (!is_rf) {
throw new PdaRequestException("桶内物料不为软废!");
}
}
}
//工序返工入库校验、零头粉入库
if (flag.equals("3") || flag.equals("6")) {
//物料为PG粉
boolean is_pgf = materialbaseService.isAlongMaterType(MaterOptTypeEnum.PGF.getCode(), bucket_jo.getString("material_id"), null);
//桶内物料必须为PG粉
if (!is_pgf) {
throw new PdaRequestException("桶内物料不为PG粉");
}
}
if (flag.equals("5") || flag.equals("7")) {
//物料为软废
boolean is_rf = materialbaseService.isAlongMaterType(MaterOptTypeEnum.RF.getCode(), bucket_jo.getString("material_id"), null);
//桶内物料必须为软废;
if (!is_rf) {
throw new PdaRequestException("桶内物料不为软废!");
}
}
//查询该桶记录是否存在
if (ObjectUtil.isEmpty(bucket_jo) || !"01,02,03".contains(bucket_jo.getString("status"))) {
//插入一条桶记录
@@ -438,10 +449,8 @@ public class HandNewMaterialServiceImpl implements HandNewMaterialService {
row.put("flag", flag);
this.insertBucket(row);
}
//立库返工入库校验
if (flag.equals("4")) {
bucket_jo = bucket_wql.query("bucketunique = '" + row.get("bucketunique") + "' AND material_id = '" + row.get("material_id") + "' AND pcsn = '" + row.get("pcsn") + "'").uniqueResult(0);
//物料为PG粉
boolean is_pgf = materialbaseService.isAlongMaterType(MaterOptTypeEnum.PGF.getCode(), bucket_jo.getString("material_id"), null);
//桶内物料必须为PG粉

View File

@@ -66,7 +66,7 @@
IF 输入.flag = "11"
QUERY
SELECT
IOStorInvDisDtl.*
IOStorInvDisDtl.storagevehicle_code
FROM
ST_IVT_IOStorInvDisDtl IOStorInvDisDtl
LEFT JOIN st_ivt_iostorinvdtl iostorinvdtl ON iostorinvdtl.iostorinvdtl_id = IOStorInvDisDtl.iostorinvdtl_id

View File

@@ -130,6 +130,8 @@ https://juejin.cn/post/6844903775631572999
<logger name="org.springframework" level="ERROR" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="org.nl.wql.core.engine.object.WP" level="off">
</logger>
<logger name="org.hibernate" level="ERROR" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>