Merge branch 'refs/heads/b_lms' into master_merge
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.b_lms.pdm.subpackagerelation.service.impl;
|
package org.nl.b_lms.pdm.subpackagerelation.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@@ -26,6 +27,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.system.service.param.ISysParamService;
|
import org.nl.system.service.param.ISysParamService;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
@@ -34,6 +37,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +60,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
private ISysParamService iSysParamService;
|
private ISysParamService iSysParamService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DjqTask djqTask;
|
private DjqTask djqTask;
|
||||||
@Resource
|
@Resource
|
||||||
@@ -84,6 +88,9 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
private TaskQueueManager taskQueueManager;
|
private TaskQueueManager taskQueueManager;
|
||||||
@Resource
|
@Resource
|
||||||
private TaskQueue taskQueue;
|
private TaskQueue taskQueue;
|
||||||
|
@Resource
|
||||||
|
@Qualifier("threadPoolExecutor")
|
||||||
|
private ThreadPoolExecutor pool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据分页
|
* 查询数据分页
|
||||||
@@ -101,11 +108,10 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
@Override
|
@Override
|
||||||
public IPage<PdmBiSubpackagerelation> queryContainerization(Map whereJson, PageQuery pageable) {
|
public IPage<PdmBiSubpackagerelation> queryContainerization(Map whereJson, PageQuery pageable) {
|
||||||
Page<PdmBiSubpackagerelation> pageObject = new Page<>(pageable.getPage(), pageable.getSize());
|
Page<PdmBiSubpackagerelation> pageObject = new Page<>(pageable.getPage(), pageable.getSize());
|
||||||
return pdmBiSubpackagerelationMapper.selectGroupedSubPackageRelation(pageObject,(String)whereJson.get("sale_order_name"),(String)whereJson.get("customer_name"),(String)whereJson.get("customer_description"),(String)whereJson.get("status"));
|
return pdmBiSubpackagerelationMapper.selectGroupedSubPackageRelation(pageObject, (String) whereJson.get("sale_order_name"), (String) whereJson.get("customer_name"), (String) whereJson.get("customer_description"), (String) whereJson.get("status"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询订单装箱信息
|
* 查询订单装箱信息
|
||||||
*
|
*
|
||||||
@@ -140,10 +146,6 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据订单号查询子卷信息
|
* 根据订单号查询子卷信息
|
||||||
*
|
*
|
||||||
@@ -405,15 +407,12 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
if (isOutBox.size() > 0) {
|
if (isOutBox.size() > 0) {
|
||||||
throw new BadRequestException("标记为黄色的子卷号已分配木箱,请重新选择未分配木箱的子卷");
|
throw new BadRequestException("标记为黄色的子卷号已分配木箱,请重新选择未分配木箱的子卷");
|
||||||
}
|
}
|
||||||
List<String> entityList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class).stream()
|
JSONArray jsonArray = whereJson.getJSONArray("tableMater");
|
||||||
.map(PdmBiSubpackagerelation::getWorkorder_id)
|
if (jsonArray == null || jsonArray.size() == 0) {
|
||||||
.map(String::valueOf)
|
throw new BadRequestException("无选中子卷信息");
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (entityList.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
List<PdmBiSubpackagerelation> pdmBiSubpackagerelationList = pdmBiSubpackagerelationMapper
|
List<PdmBiSubpackagerelation> pdmBiSubpackagerelationList = pdmBiSubpackagerelationMapper
|
||||||
.selectList(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getSale_order_name, whereJson.getString("sale_order_name")));
|
.selectList(new LambdaQueryWrapper<PdmBiSubpackagerelation>().eq(PdmBiSubpackagerelation::getSale_order_name, jsonArray.getJSONObject(0).getString("sale_order_name")));
|
||||||
Integer maxBoxGroup = pdmBiSubpackagerelationList.stream()
|
Integer maxBoxGroup = pdmBiSubpackagerelationList.stream()
|
||||||
.map(PdmBiSubpackagerelation::getBox_group)
|
.map(PdmBiSubpackagerelation::getBox_group)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
@@ -421,6 +420,13 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
.max(Integer::compareTo)
|
.max(Integer::compareTo)
|
||||||
.orElse(0) + 1;
|
.orElse(0) + 1;
|
||||||
try {
|
try {
|
||||||
|
List<String> entityList = JSONObject.parseArray(whereJson.getJSONArray("tableMater").toJSONString(), PdmBiSubpackagerelation.class).stream()
|
||||||
|
.map(PdmBiSubpackagerelation::getWorkorder_id)
|
||||||
|
.map(String::valueOf)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (entityList.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// code:终点,material_code:木箱规格,num: 子卷数
|
// code:终点,material_code:木箱规格,num: 子卷数
|
||||||
UpdateWrapper<PdmBiSubpackagerelation> updateWrapper = new UpdateWrapper<>();
|
UpdateWrapper<PdmBiSubpackagerelation> updateWrapper = new UpdateWrapper<>();
|
||||||
String boxType = whereJson.getString("checked");
|
String boxType = whereJson.getString("checked");
|
||||||
@@ -440,8 +446,38 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
* 空木箱出库
|
* 空木箱出库
|
||||||
*/
|
*/
|
||||||
private void outBox(List<String> entityList, List<PdmBiSubpackagerelation> packagerelationList, String boxType) {
|
private void outBox(List<String> entityList, List<PdmBiSubpackagerelation> packagerelationList, String boxType) {
|
||||||
|
//均衡获取装箱对接位
|
||||||
|
//String deviceCode= getPointCode();
|
||||||
|
String deviceCode = "ZXQ_1_1";
|
||||||
JSONObject boxInfo = new JSONObject();
|
JSONObject boxInfo = new JSONObject();
|
||||||
String deviceCode;
|
//确定装箱区终点
|
||||||
|
boxInfo.put("device_code", deviceCode);
|
||||||
|
boxInfo.put("material_code", boxType);
|
||||||
|
boxInfo.put("num", entityList.size());
|
||||||
|
String boxSn = outBoxManageService.outBox(boxInfo);
|
||||||
|
if (StringUtils.isBlank(boxSn)) {
|
||||||
|
throw new BadRequestException("库位 -> 装箱对接位,木箱码不能为空!");
|
||||||
|
}
|
||||||
|
//更新子卷包装关系更新木箱号
|
||||||
|
CompletableFuture.runAsync(() -> {
|
||||||
|
try {
|
||||||
|
updateBoxInfo(entityList, boxSn);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("异常信息:" + e);
|
||||||
|
}
|
||||||
|
}, pool);
|
||||||
|
//待检区->装箱区agv任务
|
||||||
|
String finalDeviceCode = deviceCode;
|
||||||
|
CompletableFuture.runAsync(() -> {
|
||||||
|
try {
|
||||||
|
agvTransfer(packagerelationList, finalDeviceCode, boxSn);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("异常信息:" + e);
|
||||||
|
}
|
||||||
|
}, pool);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getPointCode() {
|
||||||
//均衡获取木箱出库终点
|
//均衡获取木箱出库终点
|
||||||
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = bstIvtPackageinfoivtMapper.selectList(new LambdaQueryWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getPoint_status, "5").eq(BstIvtPackageinfoivt::getIs_used, "1").orderByAsc(BstIvtPackageinfoivt::getPoint_code));
|
List<BstIvtPackageinfoivt> bstIvtPackageinfoivtList = bstIvtPackageinfoivtMapper.selectList(new LambdaQueryWrapper<BstIvtPackageinfoivt>().eq(BstIvtPackageinfoivt::getPoint_status, "5").eq(BstIvtPackageinfoivt::getIs_used, "1").orderByAsc(BstIvtPackageinfoivt::getPoint_code));
|
||||||
if (CollectionUtils.isEmpty(bstIvtPackageinfoivtList)) {
|
if (CollectionUtils.isEmpty(bstIvtPackageinfoivtList)) {
|
||||||
@@ -476,23 +512,15 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
Optional<String> minPointCode = result.stream()
|
Optional<String> minPointCode = result.stream()
|
||||||
.min(Comparator.comparingInt(map -> map.entrySet().iterator().next().getValue()))
|
.min(Comparator.comparingInt(map -> map.entrySet().iterator().next().getValue()))
|
||||||
.map(map -> map.keySet().iterator().next());
|
.map(map -> map.keySet().iterator().next());
|
||||||
deviceCode = minPointCode.orElseGet(() -> bstIvtPackageinfoivtList.get(0).getPoint_code());
|
return minPointCode.orElseGet(() -> bstIvtPackageinfoivtList.get(0).getPoint_code());
|
||||||
//确定装箱区终点
|
}
|
||||||
boxInfo.put("device_code", deviceCode);
|
|
||||||
boxInfo.put("material_code", boxType);
|
|
||||||
boxInfo.put("num", entityList.size());
|
protected void updateBoxInfo(List<String> entityList, String boxSn) {
|
||||||
String boxSn = outBoxManageService.outBox(boxInfo);
|
UpdateWrapper<PdmBiSubpackagerelation> updateWrapper = new UpdateWrapper<>();
|
||||||
//String boxSn = "MX61401";
|
updateWrapper.set("package_box_sn", boxSn);
|
||||||
if (StringUtils.isBlank(boxSn)) {
|
updateWrapper.in("workorder_id", entityList);
|
||||||
throw new BadRequestException("库位 -> 装箱对接位,木箱码不能为空!");
|
pdmBiSubpackagerelationMapper.update(null, updateWrapper);
|
||||||
}
|
|
||||||
//更新子卷包装关系更新木箱号
|
|
||||||
UpdateWrapper<PdmBiSubpackagerelation> updateWrapper1 = new UpdateWrapper<>();
|
|
||||||
updateWrapper1.set("package_box_sn", boxSn);
|
|
||||||
updateWrapper1.in("workorder_id", entityList);
|
|
||||||
pdmBiSubpackagerelationMapper.update(null, updateWrapper1);
|
|
||||||
//待检区->装箱区agv任务
|
|
||||||
agvTransfer(packagerelationList, deviceCode, boxSn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -539,7 +567,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void agvTransfer(List<PdmBiSubpackagerelation> packagerelationList, String deviceCode, String boxSn) {
|
protected void agvTransfer(List<PdmBiSubpackagerelation> packagerelationList, String deviceCode, String boxSn) {
|
||||||
//待检区点位
|
//待检区点位
|
||||||
List<BstIvtPackageinfoivt> djqPointList = packageinfoivtService
|
List<BstIvtPackageinfoivt> djqPointList = packageinfoivtService
|
||||||
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
.list(new LambdaUpdateWrapper<BstIvtPackageinfoivt>()
|
||||||
@@ -571,7 +599,7 @@ public class PdmBiSubpackagerelationServiceImpl extends ServiceImpl<PdmBiSubpack
|
|||||||
schBaseTaskList.add(task);
|
schBaseTaskList.add(task);
|
||||||
});
|
});
|
||||||
//taskQueueManager.addTasksToQueue(groupId, schBaseTaskList);
|
//taskQueueManager.addTasksToQueue(groupId, schBaseTaskList);
|
||||||
taskQueue.addTasksToQueue(groupId, schBaseTaskList);
|
// taskQueue.addTasksToQueue(groupId, schBaseTaskList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ public class MzhcwTask extends AbstractAcsTask {
|
|||||||
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
|
||||||
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位"))
|
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位"))
|
||||||
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("空载具"))
|
.eq(BstIvtPackageinfoivt::getIvt_status, PackageInfoIvtEnum.IVT_STATUS.code("空载具"))
|
||||||
.orderByAsc(BstIvtPackageinfoivt::getSort_seq));
|
.orderByDesc(BstIvtPackageinfoivt::getSort_seq));
|
||||||
JSONObject toSsxTask = new JSONObject();
|
JSONObject toSsxTask = new JSONObject();
|
||||||
toSsxTask.put("acs_task_type", PackageInfoIvtEnum.ACS_TASK_TYPE.code("桁架任务"));
|
toSsxTask.put("acs_task_type", PackageInfoIvtEnum.ACS_TASK_TYPE.code("桁架任务"));
|
||||||
toSsxTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("放空(空载具缓存位->输送线)"));
|
toSsxTask.put("task_type", PackageInfoIvtEnum.TASK_TYPE.code("放空(空载具缓存位->输送线)"));
|
||||||
|
|||||||
@@ -37,4 +37,6 @@ public class AsyncTaskProperties {
|
|||||||
private int keepAliveSeconds;
|
private int keepAliveSeconds;
|
||||||
|
|
||||||
private int queueCapacity;
|
private int queueCapacity;
|
||||||
|
|
||||||
|
private int awaitTerminationSeconds;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ public class MaterialbaseServiceImpl implements MaterialbaseService {
|
|||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||||
String search = MapUtil.getStr(whereJson, "search");
|
String search = MapUtil.getStr(whereJson, "search");
|
||||||
|
//只查询木箱
|
||||||
|
String box = MapUtil.getStr(whereJson, "box");
|
||||||
//物料限制的时候使用,初始化页面
|
//物料限制的时候使用,初始化页面
|
||||||
String class_idStr = MapUtil.getStr(whereJson, "class_idStr");
|
String class_idStr = MapUtil.getStr(whereJson, "class_idStr");
|
||||||
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
|
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
|
||||||
@@ -60,6 +62,13 @@ public class MaterialbaseServiceImpl implements MaterialbaseService {
|
|||||||
}
|
}
|
||||||
map.put("search", "%" + search + "%");
|
map.put("search", "%" + search + "%");
|
||||||
}
|
}
|
||||||
|
if (!StrUtil.isEmpty(box)) {
|
||||||
|
//处理转义字符
|
||||||
|
if (box.contains("\\")) {
|
||||||
|
box = box.replace("\\", "\\\\\\");
|
||||||
|
}
|
||||||
|
map.put("box", "%" + box + "%");
|
||||||
|
}
|
||||||
|
|
||||||
//处理物料当前节点的所有子节点
|
//处理物料当前节点的所有子节点
|
||||||
if (!StrUtil.isEmpty(material_type_id)) {
|
if (!StrUtil.isEmpty(material_type_id)) {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#################################################
|
#################################################
|
||||||
输入.flag TYPEAS s_string
|
输入.flag TYPEAS s_string
|
||||||
输入.search TYPEAS s_string
|
输入.search TYPEAS s_string
|
||||||
|
输入.box TYPEAS s_string
|
||||||
输入.class_code TYPEAS s_string
|
输入.class_code TYPEAS s_string
|
||||||
输入.idssql TYPEAS f_string
|
输入.idssql TYPEAS f_string
|
||||||
输入.classIds TYPEAS f_string
|
输入.classIds TYPEAS f_string
|
||||||
@@ -59,6 +60,11 @@
|
|||||||
mb.material_name like 输入.search
|
mb.material_name like 输入.search
|
||||||
)
|
)
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
|
OPTION 输入.box <> ""
|
||||||
|
(
|
||||||
|
mb.material_name like 输入.box
|
||||||
|
)
|
||||||
|
ENDOPTION
|
||||||
ENDSELECT
|
ENDSELECT
|
||||||
ENDPAGEQUERY
|
ENDPAGEQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|||||||
Reference in New Issue
Block a user