add: 烘箱增补
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package org.nl.wms.pdm.ivt.hot.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.pdm.ivt.hot.service.dao.StIvtHotpointivt;
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.nl.wms.pdm.ivt.hot.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.sch.point.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -15,6 +16,8 @@ import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.language.LangProcess;
|
||||
import org.nl.wms.pdm.bi.dao.PdmBiRawfoilworkorder;
|
||||
import org.nl.wms.pdm.bi.service.IpdmBiRawfoilworkorderService;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.point.service.dao.mapper.SchBasePointMapper;
|
||||
@@ -22,13 +25,17 @@ import org.nl.wms.sch.region.service.dao.SchBaseRegion;
|
||||
import org.nl.wms.sch.region.service.dao.mapper.SchBaseRegionMapper;
|
||||
import org.nl.wms.sch.task_manage.core.enums.PointStatusEnum;
|
||||
import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.nl.wms.util.TaskUtils.createVirtualContainer;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @description 服务实现
|
||||
@@ -44,6 +51,9 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
@Autowired
|
||||
private SchBaseRegionMapper regionMapper;
|
||||
|
||||
@Autowired
|
||||
private IpdmBiRawfoilworkorderService rawfoilworkorderService;
|
||||
|
||||
@Override
|
||||
public IPage<SchBasePoint> queryAll(Map whereJson, PageQuery page) {
|
||||
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry"))
|
||||
@@ -156,6 +166,39 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
|
||||
entity.setMaterial_code("");
|
||||
entity.setSource_id("");
|
||||
}
|
||||
|
||||
//手动维护母卷和状态信息
|
||||
if (ObjectUtil.isNotEmpty(pointStatus) && ObjectUtil.isNotEmpty(entity.getRemark()) && (pointStatus.equals(PointStatusEnum.WAIT_SLITTING.getCode())||pointStatus.equals(PointStatusEnum.WAIT_BIND.getCode()))){
|
||||
//查看是否有工单,如果没有新建一个,如果有则更新
|
||||
PdmBiRawfoilworkorder order = rawfoilworkorderService.getByContainerName(entity.getRemark());
|
||||
if (ObjectUtil.isNotEmpty(order)) {
|
||||
order.setUp_coiler_date(DateUtil.now());
|
||||
rawfoilworkorderService.updateById(order);
|
||||
entity.setSource_id(order.getWorkorder_id());
|
||||
entity.setMaterial_code(entity.getRemark());
|
||||
}else {
|
||||
// todo: 写死,创建工单
|
||||
PdmBiRawfoilworkorder rawOrder = new PdmBiRawfoilworkorder();
|
||||
rawOrder.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
rawOrder.setContainer_name(entity.getRemark());
|
||||
rawOrder.setMfg_order_name("$$$$");
|
||||
rawOrder.setProduct_name("锂电");
|
||||
rawOrder.setDescription("锂电");
|
||||
rawOrder.setTheory_height(new BigDecimal(0.00));
|
||||
rawOrder.setProductin_qty(new BigDecimal(0.00));
|
||||
rawOrder.setUp_coiler_date(DateUtil.now());
|
||||
rawOrder.setStatus("01");
|
||||
rawOrder.setWind_roll("10");
|
||||
rawOrder.setResource_name("X");
|
||||
TaskUtils.setRawOrderCreateByDefault(rawOrder);
|
||||
rawOrder.setProduct_area("A1");
|
||||
rawOrder.setOrder_type("1");
|
||||
rawfoilworkorderService.save(rawOrder);
|
||||
entity.setSource_id(rawOrder.getWorkorder_id());
|
||||
entity.setMaterial_code(entity.getRemark());
|
||||
}
|
||||
|
||||
}
|
||||
pointMapper.updateById(entity);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,9 @@ public enum PointStatusEnum {
|
||||
// 有料
|
||||
FULL_POINT("3", "有料"),
|
||||
// 空载具/有货
|
||||
EMPTY_VEHICLE("2", "空载具/有货");
|
||||
EMPTY_VEHICLE("2", "空载具/有货"),
|
||||
WAIT_SLITTING("4", "待分切"),
|
||||
WAIT_BIND("5", "待绑定");
|
||||
|
||||
private final String code;
|
||||
private final String label;
|
||||
|
||||
@@ -5,6 +5,8 @@ import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.RedisUtils;
|
||||
@@ -12,6 +14,7 @@ import org.nl.wms.pdm.bi.dao.PdmBiRawfoilworkorder;
|
||||
import org.nl.wms.pdm.bi.service.IpdmBiRawfoilworkorderService;
|
||||
import org.nl.wms.pdm.ivt.hot.service.IstIvtHotpointivtService;
|
||||
import org.nl.wms.pdm.ivt.hot.service.dao.StIvtHotpointivt;
|
||||
import org.nl.wms.pdm.ivt.hot.service.dao.mapper.StIvtHotpointivtMapper;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
@@ -26,7 +29,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.nl.wms.sch.task_manage.core.constant.RegionConstant.REGION_A1_HXZC;
|
||||
import static org.nl.wms.util.PointUtils.*;
|
||||
@@ -53,6 +60,8 @@ public class InHotTrussTask extends AbstractTask {
|
||||
private RedisUtils redisUtils;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private StIvtHotpointivtMapper stIvtHotpointivtMapper;
|
||||
|
||||
@Override
|
||||
public void create() throws BadRequestException {
|
||||
@@ -75,10 +84,10 @@ public class InHotTrussTask extends AbstractTask {
|
||||
String flag = "0";
|
||||
PdmBiRawfoilworkorder order = rawfoilworkorderService.getByContainerName(orderCode);
|
||||
// TODO: 没有设置是否烘烤、时间、温度、不继续
|
||||
if (GeneralDefinition.NO.equals(order.getIs_baking())){
|
||||
throw new BadRequestException("手持下错任务,必须要烘烤");
|
||||
if (GeneralDefinition.NO.equals(order.getIs_baking())) {
|
||||
throw new BadRequestException("手持下错任务,必须要烘烤");
|
||||
}
|
||||
if (ObjectUtil.isNotNull(order)&&GeneralDefinition.YES.equals(order.getIs_baking())&& StrUtil.isEmpty(isStorage)) {
|
||||
if (ObjectUtil.isNotNull(order) && GeneralDefinition.YES.equals(order.getIs_baking()) && StrUtil.isEmpty(isStorage)) {
|
||||
|
||||
String bakingTemperature = order.getBaking_temperature();
|
||||
requestObj.put("baking_temperature", bakingTemperature);
|
||||
@@ -86,8 +95,9 @@ public class InHotTrussTask extends AbstractTask {
|
||||
// 如果需要烘烤, 先找对应点
|
||||
List<StIvtHotpointivt> hotList = hotpointivtService.getNotTaskHotOven(order.getRoll_type(), "1");
|
||||
if (hotList.size() > 0) {
|
||||
List<StIvtHotpointivt> hotListFilter = multiFilter(hotList);
|
||||
// 查找合适温度的点位
|
||||
for (StIvtHotpointivt hotPoint : hotList) {
|
||||
for (StIvtHotpointivt hotPoint : hotListFilter) {
|
||||
String pointCode = hotPoint.getPoint_code();
|
||||
String pointTemperature = (String) redisUtils.hget(pointCode, "temperature");
|
||||
if (ObjectUtil.isNotEmpty(pointTemperature)) {
|
||||
@@ -122,14 +132,14 @@ public class InHotTrussTask extends AbstractTask {
|
||||
String pointCode = hotPoint.getPoint_code();
|
||||
String pointTemperature = (String) redisUtils.hget(pointCode, "temperature");
|
||||
String isOff = (String) redisUtils.hget(pointCode, "is_off");
|
||||
if (ObjectUtil.isNotEmpty(pointTemperature) && Integer.valueOf(pointTemperature) < 50 && "0".equals(isOff) ) {
|
||||
task.setPoint_code2(pointCode);
|
||||
flag = "1";
|
||||
break;
|
||||
if (ObjectUtil.isNotEmpty(pointTemperature) && Integer.valueOf(pointTemperature) < 50 && "0".equals(isOff)) {
|
||||
task.setPoint_code2(pointCode);
|
||||
flag = "1";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isEmpty(task.getPoint_code2())){
|
||||
throw new BadRequestException("暂时没有可用的烘箱暂存位");
|
||||
if (ObjectUtil.isEmpty(task.getPoint_code2())) {
|
||||
throw new BadRequestException("暂时没有可用的烘箱暂存位");
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -164,6 +174,29 @@ public class InHotTrussTask extends AbstractTask {
|
||||
taskService.save(task);
|
||||
}
|
||||
|
||||
private List<StIvtHotpointivt> multiFilter(List<StIvtHotpointivt> hotList) {
|
||||
// 根据烘箱分组
|
||||
Map<String, List<StIvtHotpointivt>> stIvtHotListMap = hotList.stream().collect(Collectors.groupingBy(StIvtHotpointivt::getGroup_name));
|
||||
// 查找每个组有母卷的点位
|
||||
List<StIvtHotpointivt> stIvtHotpointivts = stIvtHotpointivtMapper.selectList(new QueryWrapper<StIvtHotpointivt>().lambda().in(StIvtHotpointivt::getGroup_name, stIvtHotListMap.keySet())
|
||||
.in(StIvtHotpointivt::getPoint_status, "02", "03", "04"));
|
||||
List<String> groupNames = stIvtHotpointivts.stream().map(StIvtHotpointivt::getGroup_name).collect(Collectors.toList());
|
||||
|
||||
//先筛选烘箱没有母卷的点位
|
||||
for (String groupName : stIvtHotListMap.keySet()) {
|
||||
if (!groupNames.contains(groupName)) {
|
||||
return stIvtHotListMap.get(groupName);
|
||||
}
|
||||
}
|
||||
//再筛选烘箱里母卷少的点位
|
||||
return stIvtHotListMap.values().stream()
|
||||
.filter(Objects::nonNull)
|
||||
.sorted(Comparator.comparingInt(List::size))
|
||||
.limit(1)
|
||||
.collect(Collectors.toList()).get(0);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
|
||||
@@ -119,8 +119,11 @@ public class SlitterUpAGVTask extends AbstractTask {
|
||||
SchBasePoint point1 = pointService.query().eq("point_code", pointCode1).one();
|
||||
point4.setPoint_status("2");
|
||||
pointService.updateById(point4);
|
||||
point1.setPoint_status("1");
|
||||
pointService.updateById(point1);
|
||||
//只有待分切的点位才更新为空
|
||||
if ("4".equals(point1.getPoint_status())) {
|
||||
point1.setPoint_status("1");
|
||||
pointService.updateById(point1);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(taskObj.getPoint_code3())) {
|
||||
// 四点任务,还需要创建收卷辊桁架任务
|
||||
JSONObject taskParam = new JSONObject();
|
||||
|
||||
@@ -7,7 +7,7 @@ lucene:
|
||||
path: D:\lucene\index
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
active: prod
|
||||
autoconfigure:
|
||||
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||
messages:
|
||||
@@ -250,7 +250,7 @@ sa-token:
|
||||
# token 有效期,单位s 默认30天, -1代表永不过期
|
||||
timeout: 2592000
|
||||
# token 临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
|
||||
activity-timeout: -1
|
||||
activity-timeout: 7200
|
||||
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
|
||||
is-concurrent: true
|
||||
# 在多人登录同一账号时,是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
|
||||
|
||||
Reference in New Issue
Block a user