mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
混单创建排单逻辑修复
This commit is contained in:
+14
-88
@@ -1479,43 +1479,6 @@ public class PlanServiceImpl implements PlanService {
|
||||
computeOrderInfo(orderIds);
|
||||
}
|
||||
|
||||
public static Map<String, List<Long>> groupByMaterialAndThickness(List<SavePlanPlateList.GoodsItemList> items) {
|
||||
Map<String, List<Long>> groupedItems = new HashMap<>();
|
||||
|
||||
for (SavePlanPlateList.GoodsItemList item : items) {
|
||||
// 将 material 和 thickness 组合成键
|
||||
String key = item.getMaterial() + "|" + item.getThickness();
|
||||
|
||||
// 如果键不存在,初始化一个新的列表
|
||||
groupedItems.putIfAbsent(key, new ArrayList<>());
|
||||
|
||||
// 添加当前项的 id 到对应的分组
|
||||
groupedItems.get(key).add(item.getId());
|
||||
}
|
||||
|
||||
return groupedItems;
|
||||
}
|
||||
|
||||
public static Map<String, List<Long>> groupByThickness(List<SavePlanPlateList.GoodsItemList> items) {
|
||||
Map<String, List<Long>> groupedItems = new HashMap<>();
|
||||
|
||||
for (SavePlanPlateList.GoodsItemList item : items) {
|
||||
// 将 material 和 thickness 组合成键
|
||||
String key = item.getThickness().toString();
|
||||
|
||||
// 如果键不存在,初始化一个新的列表
|
||||
groupedItems.putIfAbsent(key, new ArrayList<>());
|
||||
|
||||
// 添加当前项的 id 到对应的分组
|
||||
groupedItems.get(key).add(item.getId());
|
||||
}
|
||||
|
||||
|
||||
return groupedItems;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static Map<String, List<Long>> groupByMaterialAndThicknessFilterLessThanOne(List<SavePlanPlateList.GoodsItemList> items) {
|
||||
Map<String, List<Long>> groupedItems = new HashMap<>();
|
||||
@@ -1559,35 +1522,18 @@ public class PlanServiceImpl implements PlanService {
|
||||
}
|
||||
|
||||
|
||||
public static Map<String, List<Long>> groupByMaterialAndThicknessEqualToOne(List<SavePlanPlateList.GoodsItemList> items) {
|
||||
/**
|
||||
* 混单情况下不用混单的材质按goodsCode商品编码分组
|
||||
*
|
||||
* @param items
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, List<Long>> groupByGoodsCodeEqualToOne(List<SavePlanPlateList.GoodsItemList> items) {
|
||||
Map<String, List<Long>> groupedItems = new HashMap<>();
|
||||
|
||||
for (SavePlanPlateList.GoodsItemList item : items) {
|
||||
// 将 material 和 thickness 组合成键
|
||||
// String key = item.getMaterial() + "|" + item.getThickness();
|
||||
|
||||
// 如果键不存在,初始化一个新的列表
|
||||
groupedItems.putIfAbsent(item.getId().toString(), new ArrayList<>() {{
|
||||
add(item.getId());
|
||||
}});
|
||||
|
||||
// 添加当前项的 id 到对应的分组
|
||||
// groupedItems.get(key).add(item.getId());
|
||||
}
|
||||
|
||||
// 只留混单的材质
|
||||
// groupedItems.entrySet().removeIf(entry -> entry.getValue().size() > 1);
|
||||
|
||||
return groupedItems;
|
||||
}
|
||||
|
||||
|
||||
public static Map<String, List<Long>> groupByThicknessEqualToOne(List<SavePlanPlateList.GoodsItemList> items) {
|
||||
Map<String, List<Long>> groupedItems = new HashMap<>();
|
||||
|
||||
for (SavePlanPlateList.GoodsItemList item : items) {
|
||||
// 将 material 和 thickness 组合成键
|
||||
String key = item.getThickness().toString();
|
||||
String key = item.getGoodsId();
|
||||
|
||||
// 如果键不存在,初始化一个新的列表
|
||||
groupedItems.putIfAbsent(key, new ArrayList<>());
|
||||
@@ -1596,15 +1542,9 @@ public class PlanServiceImpl implements PlanService {
|
||||
groupedItems.get(key).add(item.getId());
|
||||
}
|
||||
|
||||
// 只留混单的材质
|
||||
groupedItems.entrySet().removeIf(entry -> entry.getValue().size() > 1);
|
||||
|
||||
return groupedItems;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static Map<String, List<Long>> groupByMaterialAndThicknessAndColorAndBrand(List<SavePlanPlateList.GoodsItemList> items) {
|
||||
Map<String, List<Long>> groupedItems = new HashMap<>();
|
||||
|
||||
@@ -1643,36 +1583,22 @@ public class PlanServiceImpl implements PlanService {
|
||||
// 有选实际大板的小板加大板创建排单
|
||||
getCreatePlanMultipleGoodsList(planActualGoodsLists, plateItemList, planDOS, processId, processName, loginUser);
|
||||
|
||||
// 没有选择实际大板的创建排单
|
||||
if(MixConfigTypeEnum.SAMEMATERIALANDTHICKNESS.equals(mixedType)){
|
||||
// 筛选出材质和厚度相同的大板
|
||||
grouped = groupByMaterialAndThicknessEqualToOne(goodsItemList);
|
||||
|
||||
}else {
|
||||
|
||||
grouped = groupByThicknessEqualToOne(goodsItemList);
|
||||
}
|
||||
// 不用混单的材质按goodsCode商品编码分组
|
||||
grouped = groupByGoodsCodeEqualToOne(goodsItemList);
|
||||
|
||||
if (CollUtil.isNotEmpty(grouped)) {
|
||||
createPlanAndPlateDataList(grouped, plateItemList, planDOS, processId, processName, loginUser, PlanTypeEnum.ORDERPLAN.getType());
|
||||
}
|
||||
|
||||
} else {
|
||||
// 不用混单的材质按goodsCode商品编码分组
|
||||
grouped = groupByGoodsCodeEqualToOne(goodsItemList);
|
||||
|
||||
if(MixConfigTypeEnum.SAMEMATERIALANDTHICKNESS.equals(mixedType)){
|
||||
// 筛选出材质和厚度相同的大板
|
||||
grouped = groupByMaterialAndThickness(goodsItemList);
|
||||
|
||||
}else {
|
||||
// 筛选出厚度相同的大板
|
||||
grouped = groupByThickness(goodsItemList);
|
||||
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(grouped)) {
|
||||
createPlanAndPlateDataList(grouped, plateItemList, planDOS, processId, processName, loginUser, PlanTypeEnum.ORDERPLAN.getType());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
planDOS.forEach(f->f.setFilter(f.getType().equals(PlanTypeEnum.MIXEDORDERPLAN.getType()) ? mixedType : 0));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user