Merge remote-tracking branch 'origin/master_merge' into master_merge

This commit is contained in:
2024-07-10 18:54:44 +08:00
78 changed files with 3265 additions and 1330 deletions

View File

@@ -91,135 +91,6 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
return bstIvtPackageinfoivtMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()), queryWrapper);
}
/**
* 查询没有搬运任务的空的目标点位
* @param ivtType 点位类型
* @param ivtStatus 库存状态
* @param pointCode 取货还是放货
* @param sortType 点位排序规则1升序2降序
* @param taskType 任务类型
* @return List<BstIvtPackageinfoivt>
*/
@Override
public List<BstIvtPackageinfoivt> checkEndPointTask(String ivtType, String ivtStatus, String pointCode, String sortType, String taskType) {
List<BstIvtPackageinfoivt> packageinfoivtList = getBstIvtPackageinfoivts(ivtType, ivtStatus, sortType);
Set<String> pointIds = packageinfoivtList.stream()
.map(BstIvtPackageinfoivt::getPoint_code)
.collect(Collectors.toSet());
if (CollectionUtils.isEmpty(pointIds)) {
return Collections.emptyList();
}
if (pointCode == null) {
return packageinfoivtList;
}
List<SchBaseTask> taskList;
Set<String> pointSets;
if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货任务")) || pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务"))) {
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, pointIds, null, null);
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货分配"))) {
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, pointIds, pointIds, null);
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货分配"))) {
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, pointIds, null, pointIds);
}
else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("四个点任务放货"))) {
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, null, pointIds, null);
}
else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货任务取货分配"))) {
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, pointIds, pointIds, pointIds);
} else {
return packageinfoivtList;
}
// 过滤未完成任务的任务
if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货任务")) || pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务"))) {
pointSets = taskList.stream()
// 对每个任务应用映射操作将point_code字段添加到Stream中
.flatMap(task -> Stream.of(
task.getPoint_code1(),
task.getPoint_code2()
))
.filter(Objects::nonNull)
.collect(Collectors.toSet());
} else {
pointSets = taskList.stream()
.flatMap(task -> Stream.of(
task.getPoint_code1(),
task.getPoint_code2(),
task.getPoint_code3(),
task.getPoint_code4()
))
.filter(Objects::nonNull)
.collect(Collectors.toSet());
}
return packageinfoivtList.stream()
.filter(p -> !pointSets.contains(p.getPoint_code()))
.collect(Collectors.toList());
}
private List<BstIvtPackageinfoivt> getBstIvtPackageinfoivts(String ivtType, String ivtStatus, String sortType) {
LambdaQueryWrapper<BstIvtPackageinfoivt> queryWrapper = new LambdaQueryWrapper<BstIvtPackageinfoivt>()
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
.eq(BstIvtPackageinfoivt::getPoint_status, ivtType);
if (StringUtils.isNotEmpty(ivtStatus)) {
queryWrapper.eq(BstIvtPackageinfoivt::getIvt_status, ivtStatus);
}
if (PackageInfoIvtEnum.SORT_TYPE.code("升序").equals(sortType)) {
queryWrapper.orderByAsc(BstIvtPackageinfoivt::getSort_seq);
} else if (PackageInfoIvtEnum.SORT_TYPE.code("降序").equals(sortType)) {
queryWrapper.orderByDesc(BstIvtPackageinfoivt::getSort_seq);
} else {
queryWrapper.orderByAsc(BstIvtPackageinfoivt::getSort_seq);
}
return bstIvtPackageinfoivtMapper.selectList(queryWrapper);
}
public List<BstIvtPackageinfoivt> checkEndPointTask1(String ivtType, String ivtStatus, String pointCode, String sortType, String taskType) {
List<BstIvtPackageinfoivt> packageinfoivtList = getBstIvtPackageinfoivts(ivtType, ivtStatus, sortType);
Set<String> pointIds = packageinfoivtList.stream().map(BstIvtPackageinfoivt::getPoint_code).collect(Collectors.toSet());
if (CollectionUtils.isEmpty(pointIds)) {
return null;
}
if (pointCode.equals("1")) {
List<SchBaseTask> taskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>()
//起点未完成任务
.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
.eq(taskType != null && !taskType.equals(""), SchBaseTask::getTask_type, taskType)
.and(
r -> r.in(SchBaseTask::getPoint_code1, pointIds)
));
return packageinfoivtList.stream().filter(r -> !taskList.stream().map(SchBaseTask::getPoint_code1).collect(Collectors.toSet()).contains(r.getPoint_code())).collect(Collectors.toList());
} else {
List<SchBaseTask> taskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>()
//终点未完成任务
.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
.eq(taskType != null && !taskType.equals(""), SchBaseTask::getTask_type, taskType)
.and(
r -> r.in(SchBaseTask::getPoint_code2, pointIds)
));
return packageinfoivtList.stream().filter(r -> !taskList.stream().map(SchBaseTask::getPoint_code2).collect(Collectors.toSet()).contains(r.getPoint_code())).collect(Collectors.toList());
}
}
/**
* 获取等待点
*/
@Override
public String getWaitPoint(String block, String waitPointType) {
List<BstIvtPackageinfoivt> waitPointList = bstIvtPackageinfoivtMapper.selectList(new LambdaQueryWrapper<BstIvtPackageinfoivt>()
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("等待点"))
.eq(BstIvtPackageinfoivt::getBlock, block));
if (CollectionUtils.isEmpty(waitPointList)) {
throw new BadRequestException("找不到等待点!");
}
List<BstIvtPackageinfoivt> waitPoints = waitPointList.stream().filter(r -> r.getPoint_location().equals(waitPointType)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(waitPoints)) {
throw new BadRequestException("找不到等待点!");
}
return waitPoints.get(0).getPoint_code();
}
/**
* @param taskCode 任务编码唯一ID
@@ -315,8 +186,12 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
}
}
}
newPoint = checkIvtSBlock();
newPoint = checkIvtSBlock(baseTask);
} else {
if (baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("满轴缓存位->待检区"))) {
//放满轴任务不判断终点是否有任务
taskPointType = PackageInfoIvtEnum.TASK_POINT_TYPE.code("四个点任务放货");
}
newPoint = getBstIvtPackageinfoivt(actionType, taskPointType, baseTask);
}
if (StringUtils.isNotBlank(newPoint.getPoint_code())) {
@@ -334,11 +209,171 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
taskService.updateById(baseTask);
return newPoint.getPoint_code();
} else {
throw new BadRequestException("点位外层有载具阻挡或暂无点位资源");
throw new BadRequestException("存在未完成的取放货任务或点位外层有载具阻挡!");
}
}
/**
* 查询没有搬运任务的空的目标点位
* @param ivtType 点位类型
* @param ivtStatus 库存状态
* @param pointCode 取货还是放货
* @param sortType 点位排序规则1升序2降序
* @param taskType 任务类型
* @return List<BstIvtPackageinfoivt>
*/
@Override
public List<BstIvtPackageinfoivt> checkEndPointTask(String ivtType, String ivtStatus, String pointCode, String sortType, String taskType) {
List<BstIvtPackageinfoivt> packageinfoivtList = getBstIvtPackageinfoivts(ivtType, ivtStatus, sortType);
Set<String> pointIds = packageinfoivtList.stream()
.map(BstIvtPackageinfoivt::getPoint_code)
.collect(Collectors.toSet());
if (CollectionUtils.isEmpty(pointIds)) {
return Collections.emptyList();
}
if (pointCode == null) {
return packageinfoivtList;
}
List<SchBaseTask> taskList;
Set<String> pointSets;
if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货任务")) || pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务"))) {
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, pointIds, null, null);
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货分配"))) {
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, pointIds, pointIds, null);
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货分配"))) {
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, pointIds, null, pointIds);
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("四个点任务放货"))) {
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, null, pointIds, null);
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货任务取货分配"))) {
taskList = bstIvtPackageinfoivtMapper.getTaskList(pointIds, pointIds, pointIds, pointIds);
} else {
return packageinfoivtList;
}
// 过滤未完成任务的任务
if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("四个点任务放货"))) {
pointSets = taskList.stream()
.flatMap(task -> Stream.of(
task.getPoint_code1()
))
.filter(Objects::nonNull)
.collect(Collectors.toSet());
} else if (pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货任务")) || pointCode.equals(PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务"))) {
pointSets = taskList.stream()
.flatMap(task -> Stream.of(
task.getPoint_code1(),
task.getPoint_code2()
))
.filter(Objects::nonNull)
.collect(Collectors.toSet());
} else {
pointSets = taskList.stream()
.flatMap(task -> Stream.of(
task.getPoint_code1(),
task.getPoint_code2(),
task.getPoint_code3(),
task.getPoint_code4()
))
.filter(Objects::nonNull)
.collect(Collectors.toSet());
}
List<BstIvtPackageinfoivt> ivtList = packageinfoivtList.stream()
.filter(p -> !pointSets.contains(p.getPoint_code()))
.collect(Collectors.toList());
//送空载具到空载具缓存位任务,需要判断是否存在已分配的且未完成的送空载具任务,如果存在,判断存在是否阻挡
if (taskType.equals(PackageInfoIvtEnum.TASK_TYPE.code("补空(待检区->空载具缓存位)")) || taskType.equals(PackageInfoIvtEnum.TASK_TYPE.code("补空(管制区->空载具缓存位)"))) {
Set<String> taskPointSet = taskList.stream().filter(r->!r.getPoint_code2().equals("ZXQ_01_1")).map(SchBaseTask::getPoint_code2).collect(Collectors.toSet());
List<BstIvtPackageinfoivt> pointList = new ArrayList<>();
if (CollectionUtils.isEmpty(taskPointSet)) {
List<BstIvtPackageinfoivt> vehicleList = ivtList.stream()
.filter(n -> n.getIvt_status().equals(PackageInfoIvtEnum.IVT_STATUS.code("空载具")))
.sorted(Comparator.comparing(BstIvtPackageinfoivt::getSort_seq))
.collect(Collectors.toList());
pointList.add(getBstIvtPackageinfoivt(vehicleList,ivtList));
return pointList;
} else {
List<BstIvtPackageinfoivt> existPointList = bstIvtPackageinfoivtMapper.selectList(new LambdaQueryWrapper<BstIvtPackageinfoivt>().in(BstIvtPackageinfoivt::getPoint_code, taskPointSet));
existPointList = existPointList.stream().peek(r -> r.setIvt_status(PackageInfoIvtEnum.IVT_STATUS.code("空载具"))).collect(Collectors.toList());
pointList.add(getBstIvtPackageinfoivt(existPointList, ivtList));
return pointList;
}
} else {
return ivtList;
}
}
/**
* 根据点位类型查询库存
*/
private List<BstIvtPackageinfoivt> getBstIvtPackageinfoivts(String ivtType, String ivtStatus, String sortType) {
LambdaQueryWrapper<BstIvtPackageinfoivt> queryWrapper = new LambdaQueryWrapper<BstIvtPackageinfoivt>()
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
.eq(BstIvtPackageinfoivt::getPoint_status, ivtType);
if (StringUtils.isNotEmpty(ivtStatus)) {
queryWrapper.eq(BstIvtPackageinfoivt::getIvt_status, ivtStatus);
}
if (PackageInfoIvtEnum.SORT_TYPE.code("升序").equals(sortType)) {
queryWrapper.orderByAsc(BstIvtPackageinfoivt::getSort_seq);
} else if (PackageInfoIvtEnum.SORT_TYPE.code("降序").equals(sortType)) {
queryWrapper.orderByDesc(BstIvtPackageinfoivt::getSort_seq);
} else {
queryWrapper.orderByAsc(BstIvtPackageinfoivt::getSort_seq);
}
return bstIvtPackageinfoivtMapper.selectList(queryWrapper);
}
public List<BstIvtPackageinfoivt> checkEndPointTask1(String ivtType, String ivtStatus, String pointCode, String sortType, String taskType) {
List<BstIvtPackageinfoivt> packageinfoivtList = getBstIvtPackageinfoivts(ivtType, ivtStatus, sortType);
Set<String> pointIds = packageinfoivtList.stream().map(BstIvtPackageinfoivt::getPoint_code).collect(Collectors.toSet());
if (CollectionUtils.isEmpty(pointIds)) {
return null;
}
if (pointCode.equals("1")) {
List<SchBaseTask> taskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>()
//起点未完成任务
.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
.eq(taskType != null && !taskType.equals(""), SchBaseTask::getTask_type, taskType)
.and(
r -> r.in(SchBaseTask::getPoint_code1, pointIds)
));
return packageinfoivtList.stream().filter(r -> !taskList.stream().map(SchBaseTask::getPoint_code1).collect(Collectors.toSet()).contains(r.getPoint_code())).collect(Collectors.toList());
} else {
List<SchBaseTask> taskList = taskService.list(new LambdaUpdateWrapper<SchBaseTask>()
//终点未完成任务
.lt(SchBaseTask::getTask_status, TaskStatusEnum.FINISHED.getCode())
.eq(taskType != null && !taskType.equals(""), SchBaseTask::getTask_type, taskType)
.and(
r -> r.in(SchBaseTask::getPoint_code2, pointIds)
));
return packageinfoivtList.stream().filter(r -> !taskList.stream().map(SchBaseTask::getPoint_code2).collect(Collectors.toSet()).contains(r.getPoint_code())).collect(Collectors.toList());
}
}
/**
* 获取等待点
*/
@Override
public String getWaitPoint(String block, String waitPointType) {
List<BstIvtPackageinfoivt> waitPointList = bstIvtPackageinfoivtMapper.selectList(new LambdaQueryWrapper<BstIvtPackageinfoivt>()
.eq(BstIvtPackageinfoivt::getIs_used, PackageInfoIvtEnum.IS_USED.code("启用"))
.eq(BstIvtPackageinfoivt::getPoint_status, PackageInfoIvtEnum.POINT_STATUS.code("等待点"))
.eq(BstIvtPackageinfoivt::getBlock, block));
if (CollectionUtils.isEmpty(waitPointList)) {
throw new BadRequestException("找不到等待点!");
}
List<BstIvtPackageinfoivt> waitPoints = waitPointList.stream().filter(r -> r.getPoint_location().equals(waitPointType)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(waitPoints)) {
throw new BadRequestException("找不到等待点!");
}
return waitPoints.get(0).getPoint_code();
}
/**
* 更新点位状态
*
@@ -427,23 +462,23 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
*/
private BstIvtPackageinfoivt getBstIvtPackageinfoivt(String actionType, String taskPointType, SchBaseTask baseTask) {
BstIvtPackageinfoivt newPoint;
String targetPoint ="";
//1取货任务2放货任务
LambdaQueryWrapper<BstIvtPackageinfoivt> queryWrapper = new LambdaQueryWrapper<>();
if (PackageInfoIvtEnum.TASK_ACTION_TYPE.code("取货分配").equals(actionType)) {
queryWrapper.eq(BstIvtPackageinfoivt::getPoint_code, baseTask.getPoint_code3());
taskPointType = PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货任务");
targetPoint = PackageInfoIvtEnum.TASK_POINT_TYPE.code("取货任务");
} else if (PackageInfoIvtEnum.TASK_ACTION_TYPE.code("放货分配").equals(actionType)) {
queryWrapper.eq(BstIvtPackageinfoivt::getPoint_code, baseTask.getPoint_code4());
taskPointType = PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务");
} else if (baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("输送线四个点任务")) || baseTask.getTask_type().equals(PackageInfoIvtEnum.TASK_TYPE.code("输送线->满轴缓存位"))) {
//放满轴任务不判断终点是否有任务
taskPointType = PackageInfoIvtEnum.TASK_POINT_TYPE.code("四个点任务放货");
targetPoint = PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务");
}
if (StringUtils.isNotBlank(taskPointType)) {
targetPoint = taskPointType;
}
BstIvtPackageinfoivt bstIvtPackageinfoivt = bstIvtPackageinfoivtMapper.selectOne(queryWrapper);
//根据任务类型返回点位分配规则
BstIvtPackageinfoivt ivtInfo = getIvtInfoFromRegion(baseTask.getTask_type(), actionType);
List<BstIvtPackageinfoivt> newPointList = packageinfoivtService.checkEndPointTask(bstIvtPackageinfoivt.getPoint_status(), ivtInfo.getIvt_status(), taskPointType, ivtInfo.getSort_seq().toString(), "");
List<BstIvtPackageinfoivt> newPointList = packageinfoivtService.checkEndPointTask(bstIvtPackageinfoivt.getPoint_status(), ivtInfo.getIvt_status(), targetPoint, ivtInfo.getSort_seq().toString(), "");
if (CollectionUtils.isEmpty(newPointList)) {
throw new BadRequestException("暂无点位资源!");
}
@@ -454,19 +489,23 @@ public class BstIvtPackageinfoivtServiceImpl extends ServiceImpl<BstIvtPackagein
/**
* 获取不阻挡的空载具缓存点位
*/
public BstIvtPackageinfoivt checkIvtSBlock() {
public BstIvtPackageinfoivt checkIvtSBlock(SchBaseTask baseTask) {
BstIvtPackageinfoivt newPoint = new BstIvtPackageinfoivt();
List<BstIvtPackageinfoivt> kzjIvtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位"), null, PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务"), PackageInfoIvtEnum.SORT_TYPE.code("降序"), "");
if (CollectionUtils.isEmpty(kzjIvtList)) {
List<BstIvtPackageinfoivt> kzjIvtList = packageinfoivtService.checkEndPointTask(PackageInfoIvtEnum.POINT_STATUS.code("空载具缓存位"), null, PackageInfoIvtEnum.TASK_POINT_TYPE.code("放货任务"), PackageInfoIvtEnum.SORT_TYPE.code("降序"), baseTask.getTask_type());
if (CollectionUtils.isNotEmpty(kzjIvtList)) {
return kzjIvtList.get(0);
} else {
return newPoint;
}
}
/**
* 判断点位是否有外层阻挡
*/
private static BstIvtPackageinfoivt getBstIvtPackageinfoivt(List<BstIvtPackageinfoivt> vehicleList,List<BstIvtPackageinfoivt> kzjIvtList) {
boolean hasEmptyVehicle;
//判断有空载具
List<BstIvtPackageinfoivt> vehicleList = kzjIvtList.stream()
.filter(n -> n.getIvt_status().equals(PackageInfoIvtEnum.IVT_STATUS.code("空载具")))
.sorted(Comparator.comparing(BstIvtPackageinfoivt::getSort_seq))
.collect(Collectors.toList());
//判断空载具点位外层是否有空载具
BstIvtPackageinfoivt newPoint = new BstIvtPackageinfoivt();
if (CollectionUtils.isNotEmpty(vehicleList)) {
BigDecimal sortSeq = vehicleList.get(0).getSort_seq();
hasEmptyVehicle = kzjIvtList.stream()

View File

@@ -394,6 +394,11 @@ public class SendOutManageServiceImpl implements SendOutManageService {
String point_code4 = "";
// 判断是否已经分配过一次防止acs多次申请
if (ObjectUtil.isEmpty(taskJson.getString("point_code4"))) {
return taskJson.getString("point_code2");
}
// 所有发货区点位
List<SchBasePoint> pointDaoList = ischBasePointService.list(
new QueryWrapper<SchBasePoint>().lambda()

View File

@@ -21,6 +21,7 @@ import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.ext.acs.service.impl.AcsToWmsServiceImpl;
import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl;
import org.nl.wms.ext.mes.service.LmsToMesService;
import org.nl.wms.pda.st.service.ProductInstorService;
import org.nl.wms.sch.tasks.CutConveyorTask;
import org.nl.wms.st.inbill.service.RawAssistIStorService;
@@ -31,6 +32,7 @@ import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -59,6 +61,8 @@ public class ProductInstorServiceImpl implements ProductInstorService {
private final WmsToAcsService wmsToAcsService;
private final LmsToMesService lmsToMesService;
@Override
public JSONObject boxQuery(JSONObject whereJson) {
String box_no = whereJson.getString("box_no");
@@ -194,6 +198,25 @@ public class ProductInstorServiceImpl implements ProductInstorService {
throw new BadRequestException("二期仓库木箱,请进行虚拟入库!");
}
// 重量阈值系统参数
double weight_sys = Double.parseDouble(SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("weight_sys").getValue());
// 木箱系统重量
double box_weight = sub_jo.getDoubleValue("box_weight");
// 木箱实称重重量
double real_weight = sub_jo.getDoubleValue("real_weight");
if (ObjectUtil.isEmpty(sub_jo.getString("real_weight"))) {
throw new BadRequestException("请先进行木箱称重校验!");
}
// 判断木箱毛重是否超标
if (NumberUtil.sub(box_weight, weight_sys) <= real_weight && NumberUtil.add(box_weight, weight_sys) >= real_weight) {
} else {
// 将木箱重量告知飞书
notifyMes(sub_jo);
throw new BadRequestException("重量不合格!系统重量浮动超过"+weight_sys+"KG,当前木称重重量:"+real_weight);
}
//判断是该包装计划是否存在长宽高
Double box_length = sub_jo.getDoubleValue("box_length");
Double box_width = sub_jo.getDoubleValue("box_width");
@@ -292,6 +315,7 @@ public class ProductInstorServiceImpl implements ProductInstorService {
throw new BadRequestException("请扫描内包间入库点位!");
}
}
//创建二楼去一楼的任务
JSONObject form = new JSONObject();
form.put("point_code1", point_code);
@@ -574,19 +598,71 @@ public class ProductInstorServiceImpl implements ProductInstorService {
JSONObject data = jsonObject.getJSONArray("data").getJSONObject(0);
double weight_now = NumberUtil.div(data.getDoubleValue("weight"), 10);
// 获取系统参数
// 获取系统参数1
double weight_sys = Double.parseDouble(SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("weight_sys").getValue());
// 获取系统参数2
double weight_sys_2 = Double.parseDouble(SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("weight_sys_2").getValue());
// 查询子卷包装关系
JSONObject jsonSub = subTab.query("package_box_sn = '" + box_no + "'").uniqueResult(0);
double box_weight = jsonSub.getDoubleValue("box_weight");
if (NumberUtil.sub(box_weight, weight_sys) <= weight_now && NumberUtil.add(box_weight, weight_sys) >= weight_now) {
jo.put("message", "重量合格!当前称重重量:"+weight_now);
// 校验重量上下付浮动是否超过2
if (NumberUtil.sub(box_weight, weight_sys_2) <= weight_now && NumberUtil.add(box_weight, weight_sys_2) >= weight_now) {
jo.put("message", "重量合格!当前称重重量:"+weight_now);
} else {
jo.put("message", "重量警告!系统重量浮动超过"+weight_sys_2+"KG,当前称重重量:"+weight_now);
}
} else {
jo.put("message", "重量不合格当前称重重量"+weight_now);
}
jo.put("message", "重量不合格!系统重量浮动超过"+weight_sys+"KG,当前称重重量:"+weight_now);
}
// 更新当前木箱实际重量
JSONObject json = new JSONObject();
json.put("real_weight",weight_now);
subTab.update(json,"package_box_sn = '"+box_no+"'");
return jo;
}
/**
* 生成输送任务时通知木箱重量不合格
* @param sub_jo {子卷包装关系对象}
*/
private void notifyMes(JSONObject sub_jo) {
JSONObject param = new JSONObject();
// 飞书用户集合
JSONArray UserList = new JSONArray();
// 系统参数
String userList = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("USER_LIST_FEISHU_2").getValue();
String[] split = userList.split(",");
if (split.length > 0) {
for (String s : split) {
JSONObject jo = new JSONObject();
jo.put("User", s);
UserList.add(jo);
}
} else {
JSONObject jo = new JSONObject();
jo.put("User", "");
UserList.add(jo);
}
param.put("UserList", UserList);
// 标签code
param.put("Code", "ctp_AA65DNXr3svo");
// 组织标签内容
JSONObject content = new JSONObject();
double box_weight = NumberUtil.round(sub_jo.getDoubleValue("box_weight"), 2).doubleValue();
double real_weight = NumberUtil.round(sub_jo.getDoubleValue("real_weight"), 2).doubleValue();
content.put("title", "【LMS通知】木箱超重警告");
content.put("Message", "木箱号:"+sub_jo.getString("package_box_sn")+",系统木箱重量:"+box_weight+"KG,实际木箱重量:"+real_weight+"KG");
param.put("card", content);
// 调用mes接口
lmsToMesService.proudDayData(param);
}
}

View File

@@ -253,11 +253,8 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
JSONArray disArr = WQL.getWO("QST_IVT_INANDOUTRETRUN").addParam("flag", "2").addParam("iostorinv_id", jo_mst.getString("iostorinv_id")).process().getResultJSONArray(0);
for (int j = 0; j < disArr.size(); j++) {
JSONObject json = disArr.getJSONObject(j);
//查询对应的包装关系有没有删除没有删除,进行提示
JSONArray box_size = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + json.getString("box_no") + "'").getResultJSONArray(0);
if (box_size.size() > 0) {
throw new BadRequestException("木箱:" + json.getString("box_no") + "对应的包装关系未删除!");
}
// 删除对应的包装关系
WQLObject.getWQLObject("pdm_bi_subpackagerelation").delete("package_box_sn = '"+json.getString("box_no") +"'");
}
for (int j = 0; j < disArr.size(); j++) {
JSONObject param = new JSONObject();
@@ -364,11 +361,9 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
JSONArray disArr = WQL.getWO("QST_IVT_INANDOUTRETRUN").addParam("flag", "2").addParam("iostorinv_id", jo_mst.getString("iostorinv_id")).process().getResultJSONArray(0);
for (int j = 0; j < disArr.size(); j++) {
JSONObject json = disArr.getJSONObject(j);
//查询对应的包装关系有没有删除没有删除,进行提示
JSONArray box_size = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + json.getString("box_no") + "'").getResultJSONArray(0);
if (box_size.size() > 0) {
throw new BadRequestException("木箱:" + json.getString("box_no") + "对应的包装关系未删除!");
}
// 删除对应的包装关系
WQLObject.getWQLObject("pdm_bi_subpackagerelation").delete("package_box_sn = '"+json.getString("box_no") +"'");
}
for (int j = 0; j < disArr.size(); j++) {
JSONObject param = new JSONObject();
@@ -1483,11 +1478,8 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
JSONArray disArr = WQL.getWO("QST_IVT_INANDOUTRETRUN").addParam("flag", "2").addParam("iostorinv_id", jo_mst.getString("iostorinv_id")).process().getResultJSONArray(0);
for (int j = 0; j < disArr.size(); j++) {
JSONObject json = disArr.getJSONObject(j);
//查询对应的包装关系有没有删除没有删除,进行提示
JSONArray box_size = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + json.getString("box_no") + "'").getResultJSONArray(0);
if (box_size.size() > 0) {
throw new BadRequestException("木箱:" + json.getString("box_no") + "对应的包装关系未删除!");
}
// 删除对应的包装关系
WQLObject.getWQLObject("pdm_bi_subpackagerelation").delete("package_box_sn = '"+json.getString("box_no") +"'");
}
for (int j = 0; j < disArr.size(); j++) {
JSONObject param = new JSONObject();
@@ -1524,11 +1516,8 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService {
JSONArray disArr = WQL.getWO("QST_IVT_INANDOUTRETRUN").addParam("flag", "2").addParam("iostorinv_id", jo_mst.getString("iostorinv_id")).process().getResultJSONArray(0);
for (int j = 0; j < disArr.size(); j++) {
JSONObject json = disArr.getJSONObject(j);
//查询对应的包装关系有没有删除没有删除,进行提示
JSONArray box_size = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + json.getString("box_no") + "'").getResultJSONArray(0);
if (box_size.size() > 0) {
throw new BadRequestException("木箱:" + json.getString("box_no") + "对应的包装关系未删除!");
}
// 删除对应的包装关系
WQLObject.getWQLObject("pdm_bi_subpackagerelation").delete("package_box_sn = '"+json.getString("box_no") +"'");
}
for (int j = 0; j < disArr.size(); j++) {
JSONObject param = new JSONObject();

View File

@@ -116,6 +116,7 @@ public class InBillQueryServiceImpl implements InBillQueryService {
String sale_order_name = MapUtil.getStr(whereJson, "sale_order_name");
String is_all = MapUtil.getStr(whereJson, "is_all");
String pcsn = MapUtil.getStr(whereJson, "pcsn");
String sap_pcsn = MapUtil.getStr(whereJson, "sap_pcsn");
String thickness_request = MapUtil.getStr(whereJson, "thickness_request");
JSONObject map = new JSONObject();
@@ -132,6 +133,7 @@ public class InBillQueryServiceImpl implements InBillQueryService {
map.put("sale_order_name", sale_order_name);
map.put("classes", classes);
map.put("thickness_request", thickness_request);
map.put("sap_pcsn", sap_pcsn);
// 处理时间
if (ObjectUtil.isNotEmpty(begin_time) && ObjectUtil.isNotEmpty(end_time)) {
@@ -363,6 +365,7 @@ public class InBillQueryServiceImpl implements InBillQueryService {
String classes = MapUtil.getStr(map, "classes");
String sale_order_name = MapUtil.getStr(map, "sale_order_name");
String pcsn = MapUtil.getStr(map, "pcsn");
String sap_pcsn = MapUtil.getStr(map, "sap_pcsn");
String is_all = MapUtil.getStr(map, "is_all");
String thickness_request = MapUtil.getStr(map, "thickness_request");
@@ -380,6 +383,7 @@ public class InBillQueryServiceImpl implements InBillQueryService {
mapParam.put("is_virtual", is_virtual);
mapParam.put("classes", classes);
mapParam.put("thickness_request", thickness_request);
mapParam.put("sap_pcsn", sap_pcsn);
// 处理时间
if (ObjectUtil.isNotEmpty(begin_time) && ObjectUtil.isNotEmpty(end_time)) {
@@ -447,6 +451,7 @@ public class InBillQueryServiceImpl implements InBillQueryService {
}
mp.put("毛重合计", NumberUtil.round(StrUtil.isEmpty(json.getString("box_weight")) ? "0" : json.getString("box_weight"), 1));
mp.put("小卷号", json.getString("pcsn"));
mp.put("sap批次号", json.getString("sap_pcsn"));
mp.put("净重KG", NumberUtil.round(StrUtil.isEmpty(json.getString("net_weight")) ? "0" : json.getString("net_weight"), 1));
mp.put("卷数", json.getString("quanlity_in_box"));
mp.put("品级", "A");

View File

@@ -2,6 +2,7 @@ package org.nl.wms.stat.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
@@ -23,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author Liuxy
@@ -113,6 +115,29 @@ public class OutBillQueryServiceImpl implements OutBillQueryService {
}
JSONObject json = WQL.getWO("ST_IVT_OUTBILLQUERY").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.input_time DESC,dis.box_no");
// 查询此子卷转单之前的销售订单号
List<JSONObject> content = json.getJSONArray("content").toJavaList(JSONObject.class);
String pcsn_in = content.stream()
.map(row -> row.getString("pcsn"))
.collect(Collectors.joining("','"));
List<JSONObject> subList = WQLObject.getWQLObject("pdm_bi_subpackagerelationrecord")
.query("container_name IN ('" + pcsn_in + "') AND io_type = '0' ORDER BY insert_time")
.getResultJSONArray(0).toJavaList(JSONObject.class);
// 查询所有子卷最早的入库时间
for (JSONObject item : content) {
JSONObject jsonSub = subList.stream()
.filter(row -> row.getString("container_name").equals(item.getString("pcsn")))
.min(Comparator.comparing(row -> row.getString("insert_time")))
.orElse(null);
item.put("old_sale_order_name", ObjectUtil.isEmpty(jsonSub) ? item.getString("sale_order_name") : jsonSub.getString("sale_order_name"));
}
json.put("content", content);
return json;
}
@@ -279,6 +304,11 @@ public class OutBillQueryServiceImpl implements OutBillQueryService {
JSONObject json = resultJSONArray.getJSONObject(i);
Map<String, Object> mp = new LinkedHashMap<>();
// 查询第一次入库的源销售订单
JSONObject jsonSub = WQLObject.getWQLObject("pdm_bi_subpackagerelationrecord")
.query("container_name = '" + json.getString("pcsn") + "' AND io_type = '0' ORDER BY insert_time")
.uniqueResult(0);
mp.put("仓库", json.getString("stor_name"));
if (ObjectUtil.isNotEmpty(bill_type) && "1004".equals(bill_type)) {
mp.put("移入仓库", json.getString("in_stor_name"));
@@ -310,6 +340,15 @@ public class OutBillQueryServiceImpl implements OutBillQueryService {
mp.put("销售订单", json.getString("sale_order_name"));
mp.put("行号", "");
}
// 原销售订单
try {
mp.put("原销售订单", jsonSub.getString("sale_order_name").substring(0, jsonSub.getString("sale_order_name").indexOf("-")));
mp.put("原行号", jsonSub.getString("sale_order_name").substring(jsonSub.getString("sale_order_name").indexOf("-") + 1, jsonSub.getString("sale_order_name").length()));
} catch (Exception e) {
mp.put("原销售订单", jsonSub.getString("sale_order_name"));
mp.put("原行号", "");
}
mp.put("业务员", json.getString("sales_owner"));
mp.put("出库日期", json.getString("input_time"));
mp.put("产品规格", String.format("%.0f", json.getDoubleValue("width")));

View File

@@ -24,6 +24,7 @@
输入.is_virtual TYPEAS s_string
输入.classes TYPEAS s_string
输入.thickness_request TYPEAS s_string
输入.sap_pcsn TYPEAS s_string
输入.areas TYPEAS f_string
@@ -791,6 +792,10 @@
sub.sale_order_name = 输入.sale_order_name
ENDOPTION
OPTION 输入.sap_pcsn <> ""
sub.sap_pcsn = 输入.sap_pcsn
ENDOPTION
OPTION 输入.bill_type = "0007"
sub.sub_type = '2'
ENDOPTION