opt:优化
This commit is contained in:
@@ -96,6 +96,7 @@
|
||||
p.material_code,
|
||||
p.material_name,
|
||||
sum( p.qty ) AS total_num,
|
||||
0 as sign_num,
|
||||
MAX( bs.point_code ) AS point_code,
|
||||
MAX( bs.product_area ) AS product_area,
|
||||
MAX( dict.label ) as product_area_name
|
||||
|
||||
@@ -20,7 +20,9 @@ public class ShowStockView {
|
||||
//管芯名称
|
||||
private String material_name;
|
||||
//数量
|
||||
private String total_num;
|
||||
private Integer total_num;
|
||||
//数量
|
||||
private Integer sign_num;
|
||||
//点位编码
|
||||
private String point_code;
|
||||
//区域
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -218,9 +219,19 @@ public class StockingIvtServiceImpl implements StockingIvtService {
|
||||
JSONObject jo = new JSONObject();
|
||||
String product_area = param.getString("product_area");
|
||||
String material_code = param.getString("material_code");
|
||||
Integer material_qty = param.getInteger("material_qty");
|
||||
List<ShowStockView> list = bstIvtStockingivtMapper.showPapervehicleView(product_area,material_code);
|
||||
log.info("showPapervehicleView数据size:{}", list.size());
|
||||
jo.put("rows", list);
|
||||
List<ShowStockView> newList = new ArrayList<ShowStockView>();
|
||||
for( int i=0;i<list.size();i++){
|
||||
ShowStockView now = list.get(i);
|
||||
if(material_qty>=now.getTotal_num()){
|
||||
material_qty = material_qty - now.getTotal_num();
|
||||
now.setSign_num(now.getTotal_num());
|
||||
}
|
||||
newList.add(now);
|
||||
}
|
||||
log.info("showPapervehicleView数据size:{}", newList.size());
|
||||
jo.put("rows", newList);
|
||||
jo.put("status", HttpStatus.HTTP_OK);
|
||||
jo.put("message", "查询成功!");
|
||||
return jo;
|
||||
@@ -337,7 +348,7 @@ public class StockingIvtServiceImpl implements StockingIvtService {
|
||||
lam.eq( ObjectUtil.isNotEmpty(paper_code),MdPbPaper::getPaper_code,paper_code);
|
||||
MdPbPaper paper = mdPbPaperMapper.selectOne(lam);
|
||||
if(ObjectUtil.isEmpty(paper)){
|
||||
throw new BadRequestException("管芯/纸管记录不存在!");
|
||||
throw new BadRequestException("管芯编码:"+paper_code+"不存在!");
|
||||
}
|
||||
//物料
|
||||
String material_code = paper.getMaterial_code();
|
||||
|
||||
@@ -507,12 +507,19 @@ public class SlitterTaskUtil {
|
||||
// 如果有重复 key,保留第一个(按需调整)
|
||||
(existing, replacement) -> existing
|
||||
));
|
||||
|
||||
Map<String, String> planMap2 = plans.stream()
|
||||
.collect(Collectors.toMap(
|
||||
p -> p.getContainer_name(),
|
||||
p -> p.getLeft_or_right(),
|
||||
// 如果有重复 key,保留第一个(按需调整)
|
||||
(existing, replacement) -> existing
|
||||
));
|
||||
// 2. 遍历 JSONArray
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject item = jsonArray.getJSONObject(i);
|
||||
String containerName = item.getString("container_name");
|
||||
String site = item.getString("site");
|
||||
String left_or_right = item.getString("left_or_right");
|
||||
|
||||
// 3. 检查 Plan 中是否存在对应的 container_name
|
||||
if (!planMap.containsKey(containerName)) {
|
||||
@@ -526,6 +533,14 @@ public class SlitterTaskUtil {
|
||||
+ " 的上下轴位置"
|
||||
+ "与MES分切计划中的上下轴位置" + expectedUpDown + "不一致!");
|
||||
}
|
||||
|
||||
// 4. 比较 left_or_right 和 left_or_right 是否一致
|
||||
String expectedLeftRight = planMap2.get(containerName);
|
||||
if (!expectedLeftRight.equals(left_or_right)) {
|
||||
throw new BadRequestException("校验失败: 子卷号 " + containerName
|
||||
+ " 的左右卷位置"
|
||||
+ "与MES分切计划中的左右卷位置" + expectedLeftRight + "不一致!");
|
||||
}
|
||||
}
|
||||
log.info("分切下卷计划位置校验通过!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user