rev:更新
This commit is contained in:
@@ -232,17 +232,17 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>3.17</version>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>3.17</version>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>3.17</version>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
|
||||
@@ -73,4 +73,10 @@ public class BigScreenController {
|
||||
return new ResponseEntity<>(bigScreenService.todayLoadingAndUnloadingStatistics(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getAllBigScreen")
|
||||
@Log("获取所有大屏信息")
|
||||
public ResponseEntity<Object> getAllBigScreen() {
|
||||
return new ResponseEntity<>(bigScreenService.getAllBigScreen(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.bigScreen.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -66,4 +67,6 @@ public interface BigScreenService {
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> inventoryIOAnalysis();
|
||||
|
||||
JSONObject getAllBigScreen();
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.bigScreen.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.bigScreen.service.BigScreenService;
|
||||
import org.nl.wms.bigScreen.service.mapper.BigScreenMapper;
|
||||
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||
@@ -74,4 +75,18 @@ public class BigScreenServiceImpl implements BigScreenService {
|
||||
List<Map<String, Object>> res = bigScreenMapper.inventoryIOAnalysis();
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getAllBigScreen() {
|
||||
JSONObject resp = new JSONObject();
|
||||
resp.put("inventoryAnalysis", this.inventoryAnalysis());
|
||||
resp.put("agvInfo", this.agvInfo());
|
||||
resp.put("rgvInfo", this.rgvInfo());
|
||||
resp.put("todayProduceStatistic", this.todayProduceStatistic());
|
||||
resp.put("todayLoadingAndUnloadingStatistics", this.todayLoadingAndUnloadingStatistics());
|
||||
resp.put("todayTask", this.todayTask());
|
||||
resp.put("historyInventoryIOAnalysis", this.historyInventoryIOAnalysis());
|
||||
resp.put("inventoryIOAnalysis", this.inventoryIOAnalysis());
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.database.material.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 cn.hutool.poi.excel.ExcelReader;
|
||||
@@ -26,6 +27,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -138,11 +140,64 @@ public class MdBaseMaterialServiceImpl extends ServiceImpl<MdBaseMaterialMapper,
|
||||
}
|
||||
// 调用用 hutool 方法读取数据 默认调用第一个sheet
|
||||
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||
int rowCount = excelReader.getRowCount();
|
||||
System.out.println(rowCount);
|
||||
// 从第二行开始获取数据 excelReader.read的结果是一个2纬的list,外层是行,内层是行对应的所有列
|
||||
List<List<Object>> read = excelReader.read(1, excelReader.getRowCount());
|
||||
// 循环获取的数据
|
||||
MdBaseMaterial mdBaseMaterial = null;
|
||||
List<MdBaseMaterial> list = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < read.size(); i++) {
|
||||
mdBaseMaterial = new MdBaseMaterial();
|
||||
|
||||
List<Object> material = read.get(i);
|
||||
Object materialCode = material.get(0);
|
||||
Assert.notNull(materialCode);
|
||||
Object materialName = material.get(1);
|
||||
Assert.notNull(materialName);
|
||||
Object specification = material.get(2);
|
||||
Assert.notNull(specification);
|
||||
Object model = material.get(3);
|
||||
mdBaseMaterial.setMaterial_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
mdBaseMaterial.setMaterial_code(materialCode.toString());
|
||||
mdBaseMaterial.setMaterial_name(materialName.toString());
|
||||
mdBaseMaterial.setMaterial_spec(specification.toString());
|
||||
mdBaseMaterial.setMaterial_model(model + "");
|
||||
mdBaseMaterial.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
mdBaseMaterial.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
mdBaseMaterial.setCreate_time(DateUtil.now());
|
||||
// mdBaseMaterialMapper.insert(mdBaseMaterial);
|
||||
list.add(mdBaseMaterial);
|
||||
}
|
||||
// ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||
// List<Map<String, Object>> readAll = excelReader.readAll();
|
||||
// List<MdBaseMaterial> list = new ArrayList<>();
|
||||
// // 3.处理读取到的数据
|
||||
// MdBaseMaterial mdBaseMaterial = null;
|
||||
// for (Map<String, Object> row : readAll) {
|
||||
// mdBaseMaterial = new MdBaseMaterial();
|
||||
// // 这里可以对每一行数据进行处理
|
||||
// String materialCode = (String) row.get("物料编码");
|
||||
// String materialName = (String) row.get("物料名称");
|
||||
// String specification = (String) row.get("规格");
|
||||
// String model = (String) row.get("型号");
|
||||
// String materialCategory = (String) row.get("物料分类");
|
||||
// String productSeries = (String) row.get("产品系列");
|
||||
// String unit = (String) row.get("单位");
|
||||
// Double weight = row.get("单重") != null ? Double.parseDouble(row.get("单重").toString()) : null;
|
||||
// String originalMaterialInfo = (String) row.get("原始物料信息");
|
||||
// mdBaseMaterial.setMaterial_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
// mdBaseMaterial.setMaterial_code(materialCode);
|
||||
// mdBaseMaterial.setCreate_name(materialName);
|
||||
// mdBaseMaterial.setMaterial_spec(specification);
|
||||
// mdBaseMaterial.setMaterial_model(model);
|
||||
// list.add(mdBaseMaterial);
|
||||
// }
|
||||
this.saveBatch(list);
|
||||
// 4.关闭资源
|
||||
excelReader.close();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -102,6 +102,18 @@ public class PdaController {
|
||||
return new ResponseEntity<>(pdaService.callEmptyVehicle(requestParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/lmzbCallEmptyVehicle")
|
||||
@Log("蜡模制备区呼叫空托盘")
|
||||
public ResponseEntity<PdaResponseVo> lmzbCallEmptyVehicle(@Validated @RequestBody CommonPointQueryDto requestParam) {
|
||||
return new ResponseEntity<>(pdaService.lmzbCallEmptyVehicle(requestParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/sendEmptyVehicle")
|
||||
@Log("型壳焙烧区空托位送空托盘")
|
||||
public ResponseEntity<PdaResponseVo> sendEmptyVehicle(@Validated @RequestBody CommonPointQueryDto requestParam) {
|
||||
return new ResponseEntity<>(pdaService.sendEmptyVehicle(requestParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/emptyInStore")
|
||||
@Log("空托盘入库")
|
||||
public ResponseEntity<PdaResponseVo> emptyInStore(@Validated @RequestBody VehicleInStoreDto requestParam) {
|
||||
|
||||
@@ -386,4 +386,8 @@ public interface PdaService {
|
||||
* @return
|
||||
*/
|
||||
List<VehicleLinkVo> queryExistGroup();
|
||||
|
||||
PdaResponseVo lmzbCallEmptyVehicle(CommonPointQueryDto requestParam);
|
||||
|
||||
PdaResponseVo sendEmptyVehicle(CommonPointQueryDto requestParam);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.pda.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
@@ -222,6 +223,12 @@ public class PdaServiceImpl implements PdaService {
|
||||
if (!PointStatusEnum.FULL_POINT.getCode().equals(point.getPoint_status())) {
|
||||
throw new BadRequestException("点位:" + point_code + ",状态不是有料状态!");
|
||||
}
|
||||
LambdaQueryWrapper<SchBasePoint> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_VEHICLE.getCode());
|
||||
List<SchBasePoint> list = pointService.list(lqw);
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
throw new BadRequestException("原材料库中没有空载具!");
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", point_code);
|
||||
param.put("config_code", "ZPRKTask");
|
||||
@@ -276,6 +283,52 @@ public class PdaServiceImpl implements PdaService {
|
||||
return PdaResponseVo.pdaResultOk("空托盘出库请求成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponseVo lmzbCallEmptyVehicle(CommonPointQueryDto requestParam) {
|
||||
Assert.notNull(requestParam, "参数不能为空!");
|
||||
String point_code = requestParam.getPoint_code();
|
||||
SchBasePoint point = pointService.getById(point_code);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("点位:" + point_code + ",对应的点位信息不存在!");
|
||||
}
|
||||
if (!point.getPoint_status().equals(PointStatusEnum.EMPTY_POINT.getCode())) {
|
||||
throw new BadRequestException("点位:" + point_code + ",点位状态不为空位!");
|
||||
}
|
||||
if (!RegionEnum.LMZB.getRegion_code().equals(point.getRegion_code()) || !PointTypeEnum.FULL_POINT.getCode().equals(point.getPoint_type())) {
|
||||
throw new BadRequestException("点位:" + point_code + ",不属于蜡模制备区域满托位,无法呼叫空托盘!");
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", requestParam.getPoint_code());
|
||||
param.put("config_code", "LMZBQKTask");
|
||||
param.put("requestNo", IdUtil.simpleUUID());
|
||||
param.put("user_id", "1");
|
||||
taskService.apply(param);
|
||||
return PdaResponseVo.pdaResultOk("蜡模制备区呼叫空托盘请求成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponseVo sendEmptyVehicle(CommonPointQueryDto requestParam) {
|
||||
Assert.notNull(requestParam, "参数不能为空!");
|
||||
String point_code = requestParam.getPoint_code();
|
||||
SchBasePoint point = pointService.getById(point_code);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("点位:" + point_code + ",对应的点位信息不存在!");
|
||||
}
|
||||
if (!point.getPoint_status().equals(PointStatusEnum.EMPTY_VEHICLE.getCode())) {
|
||||
throw new BadRequestException("点位:" + point_code + ",点位状态不为空载具!");
|
||||
}
|
||||
if (!RegionEnum.XKBS.getRegion_code().equals(point.getRegion_code()) || !PointTypeEnum.FULL_POINT.getCode().equals(point.getPoint_type())) {
|
||||
throw new BadRequestException("点位:" + point_code + ",不属于型壳焙烧区满托位,无法送空托盘!");
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", requestParam.getPoint_code());
|
||||
param.put("config_code", "XKBSSKTask");
|
||||
param.put("requestNo", IdUtil.simpleUUID());
|
||||
param.put("user_id", "1");
|
||||
taskService.apply(param);
|
||||
return PdaResponseVo.pdaResultOk("型壳焙烧区空托位送空托请求成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public PdaResponseVo emptyInStore(VehicleInStoreDto requestParam) {
|
||||
Assert.notNull(requestParam, "参数不能为空!");
|
||||
@@ -328,6 +381,9 @@ public class PdaServiceImpl implements PdaService {
|
||||
List<VehicleLinkVo> vehicleLinkVoList = new ArrayList<>();
|
||||
for (SchBaseVehiclematerialgroup group : list) {
|
||||
SchBasePoint point = pointService.getById(group.getPoint_code());
|
||||
if (point == null) {
|
||||
continue;
|
||||
}
|
||||
if (!RegionEnum.YCL.getRegion_code().equals(point.getRegion_code())) {
|
||||
continue;
|
||||
}
|
||||
@@ -527,6 +583,20 @@ public class PdaServiceImpl implements PdaService {
|
||||
public PdaResponseVo createP2pTask(FullVehicleOutDto requestParam) {
|
||||
Assert.notNull(requestParam, "参数不能为空!");
|
||||
this.checkNextPoint(requestParam.getPoint_code1(), requestParam.getPoint_code2());
|
||||
SchBasePoint point1 = pointService.getById(requestParam.getPoint_code1());
|
||||
if (point1 == null) {
|
||||
throw new BadRequestException("起点不存在!");
|
||||
}
|
||||
if (PointStatusEnum.EMPTY_POINT.getCode().equals(point1.getPoint_status())) {
|
||||
throw new BadRequestException("起点无货!");
|
||||
}
|
||||
SchBasePoint point2 = pointService.getById(requestParam.getPoint_code2());
|
||||
if (point2 == null) {
|
||||
throw new BadRequestException("终点不存在!");
|
||||
}
|
||||
if (!PointStatusEnum.EMPTY_POINT.getCode().equals(point2.getPoint_status())) {
|
||||
throw new BadRequestException("终点有货!");
|
||||
}
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("device_code", requestParam.getPoint_code1());
|
||||
param.put("device_code2", requestParam.getPoint_code2());
|
||||
|
||||
@@ -64,9 +64,9 @@ public class LMZBQKTask extends AbstractTask {
|
||||
SchBasePoint point = findStartPoint(startRegionStr);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("空托缓存2区暂无空托盘!", TASK_CONFIG_CODE + task.getPoint_code2(),
|
||||
noticeService.createNotice("暂无空托盘!", TASK_CONFIG_CODE + task.getPoint_code2(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("空托缓存2区暂无空托盘!");
|
||||
throw new BadRequestException("暂无空托盘!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code1(point.getPoint_code());
|
||||
@@ -101,12 +101,12 @@ public class LMZBQKTask extends AbstractTask {
|
||||
.eq(SchBasePoint::getIs_used, true);
|
||||
List<SchBasePoint> schBasePoints = pointService.list(lam);
|
||||
SchBasePoint start_point = schBasePoints.stream()
|
||||
.filter(point -> RegionEnum.BCXKZB.getRegion_code().equals(point.getRegion_code()))
|
||||
.filter(point -> RegionEnum.LMZB.getRegion_code().equals(point.getRegion_code()))
|
||||
.filter(point -> PointTypeEnum.EMPTY_POINT.getCode().equals(point.getPoint_type()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (ObjectUtil.isEmpty(start_point)) {
|
||||
start_point = schBasePoints.stream().filter(point -> RegionEnum.KTPHC2.getRegion_code().equals(point.getRegion_code()))
|
||||
start_point = schBasePoints.stream().filter(point -> RegionEnum.KTPHC1.getRegion_code().equals(point.getRegion_code()))
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
return ObjectUtil.isNotEmpty(start_point) ? start_point : null;
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
package org.nl.wms.sch.task_manage.task.tasks.xkbs;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.region.service.RegionEnum;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.enums.PointStatusEnum;
|
||||
import org.nl.wms.sch.task_manage.enums.PointTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.task.TaskType;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 型壳焙烧区空托位送空托盘到空托盘缓存1区或者蜡模制备空托位
|
||||
*
|
||||
* @author onepiece
|
||||
*/
|
||||
@Component(value = "XKBSSKTask")
|
||||
@TaskType("XKBSSKTask")
|
||||
public class XKBSSKTask extends AbstractTask {
|
||||
private static final String TASK_CONFIG_CODE = "XKBSSKTask";
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
|
||||
@Override
|
||||
public void create() throws BadRequestException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createCompletion(SchBaseTask task) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
// 找终点
|
||||
SchBasePoint point = findEndPoint(nextRegionStr);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("空托盘缓存1区或者蜡模制备区空托位未找到终点空位!", TASK_CONFIG_CODE + task.getPoint_code2(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("空托盘缓存1区或者蜡模制备区空托位未找到终点空位!");
|
||||
}
|
||||
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(point.getPoint_code());
|
||||
String point_code1 = task.getPoint_code1();
|
||||
SchBasePoint point1 = pointService.getById(point_code1);
|
||||
if (point1 != null) {
|
||||
task.setVehicle_code(point1.getVehicle_code());
|
||||
task.setVehicle_type(point1.getVehicle_type());
|
||||
}
|
||||
task.setRemark("");
|
||||
task.setVehicle_qty(1);
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setCreate_mode(GeneralDefinition.HAND_CREATION);
|
||||
taskService.save(task);
|
||||
// 点位更新
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
}
|
||||
|
||||
/**
|
||||
* 找空位
|
||||
*
|
||||
* @param nextRegionStr
|
||||
* @return
|
||||
*/
|
||||
private SchBasePoint findEndPoint(List<String> nextRegionStr) {
|
||||
LambdaQueryWrapper<SchBasePoint> lam = new LambdaQueryWrapper<>();
|
||||
// 默认一直都有载具
|
||||
lam.in(SchBasePoint::getRegion_code, nextRegionStr)
|
||||
// 点位状态是空位
|
||||
.eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_POINT.getCode())
|
||||
// 当前执行的任务为空或者NULL,有数据表示锁住
|
||||
.and(la -> la.isNull(SchBasePoint::getIng_task_code)
|
||||
.or()
|
||||
.eq(SchBasePoint::getIng_task_code, ""))
|
||||
.eq(SchBasePoint::getIs_used, true);
|
||||
List<SchBasePoint> schBasePoints = pointService.list(lam);
|
||||
SchBasePoint next_point = schBasePoints.stream()
|
||||
.filter(point -> RegionEnum.LMZB.getRegion_code().equals(point.getRegion_code()))
|
||||
.filter(point -> PointTypeEnum.EMPTY_POINT.getCode().equals(point.getPoint_type()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (ObjectUtil.isEmpty(next_point)) {
|
||||
next_point = schBasePoints.stream().filter(point -> RegionEnum.KTPHC1.getRegion_code().equals(point.getRegion_code()))
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
return ObjectUtil.isNotEmpty(schBasePoints) ? next_point : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateStatus(String task_code, TaskStatus status) {
|
||||
// 校验任务
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) {
|
||||
throw new BadRequestException("该任务已完成!");
|
||||
}
|
||||
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) {
|
||||
throw new BadRequestException("该任务已取消!");
|
||||
}
|
||||
// 根据传来的类型去对任务进行操作
|
||||
if (status.equals(TaskStatus.EXECUTING)) {
|
||||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode());
|
||||
taskObj.setRemark("执行中");
|
||||
TaskUtils.setUpdateByAcs(taskObj);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
if (status.equals(TaskStatus.FINISHED)) {
|
||||
this.finishTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS);
|
||||
}
|
||||
if (status.equals(TaskStatus.CANCELED)) {
|
||||
this.cancelTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_code) {
|
||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||
if (ObjectUtil.isEmpty(taskObj)) {
|
||||
throw new BadRequestException("该任务不存在");
|
||||
}
|
||||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
SchBasePoint startPointObj = pointService.getById(taskObj.getPoint_code1());
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(startPointObj)) {
|
||||
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
|
||||
PointUtils.clearPoint(startPointObj);
|
||||
pointService.updateById(startPointObj);
|
||||
}
|
||||
//更新终点的点位信息
|
||||
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
|
||||
if (ObjectUtil.isNotEmpty(endPointObj)) {
|
||||
endPointObj.setIng_task_code("");
|
||||
endPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
|
||||
endPointObj.setVehicle_code(taskObj.getVehicle_code());
|
||||
endPointObj.setVehicle_type(taskObj.getVehicle_type());
|
||||
endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
|
||||
endPointObj.setUpdate_time(DateUtil.now());
|
||||
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
|
||||
pointService.updateById(endPointObj);
|
||||
}
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
SchBasePoint endPointObj = pointService.getById(taskObj.getPoint_code2());
|
||||
// 终点解锁
|
||||
if (ObjectUtil.isNotEmpty(endPointObj)) {
|
||||
endPointObj.setIng_task_code("");
|
||||
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
|
||||
pointService.updateById(endPointObj);
|
||||
}
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
|
||||
import org.nl.wms.sch.group.service.impl.SchBaseVehiclematerialgroupServiceImpl;
|
||||
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,8 +25,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -58,34 +59,53 @@ public class ZPRKTask extends AbstractTask {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createCompletion(SchBaseTask task) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
// 找终点
|
||||
SchBasePoint point = findEndPoint(nextRegionStr);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("原材料库未找到终点空位!", TASK_CONFIG_CODE + task.getPoint_code2(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("原材料库未找到终点空位!");
|
||||
synchronized (ZPRKTask.class) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
// 找终点
|
||||
SchBasePoint point = findEndPoint(nextRegionStr);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("原材料库未找到终点空位!", TASK_CONFIG_CODE + task.getPoint_code1(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("原材料库未找到终点空位!");
|
||||
}
|
||||
SchBasePoint point3 = findStartPoint(startRegionStr);
|
||||
if (ObjectUtil.isEmpty(point3)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("原材料库未找到起点空载具!", TASK_CONFIG_CODE + task.getPoint_code1(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("原材料库未找到起点空载具!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(point.getPoint_code());
|
||||
task.setPoint_code3(point3.getPoint_code());
|
||||
task.setPoint_code4(task.getPoint_code1());
|
||||
task.setRemark("");
|
||||
SchBasePoint startPointObj = pointService.getById(task.getPoint_code1());
|
||||
task.setVehicle_qty(startPointObj.getVehicle_qty());
|
||||
task.setVehicle_type(startPointObj.getVehicle_type());
|
||||
task.setVehicle_code(startPointObj.getVehicle_code());
|
||||
task.setVehicle_code2(point3.getVehicle_code());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setCreate_mode(GeneralDefinition.HAND_CREATION);
|
||||
taskService.save(task);
|
||||
// 点位更新
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
|
||||
point3.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point3);
|
||||
pointService.updateById(point3);
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(point.getPoint_code());
|
||||
task.setRemark("");
|
||||
SchBasePoint startPointObj = pointService.getById(task.getPoint_code1());
|
||||
task.setVehicle_qty(startPointObj.getVehicle_qty());
|
||||
task.setVehicle_type(startPointObj.getVehicle_type());
|
||||
task.setVehicle_code(startPointObj.getVehicle_code());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setCreate_mode(GeneralDefinition.HAND_CREATION);
|
||||
taskService.save(task);
|
||||
// 点位更新
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,6 +126,32 @@ public class ZPRKTask extends AbstractTask {
|
||||
.eq(SchBasePoint::getIng_task_code, ""))
|
||||
.eq(SchBasePoint::getIs_used, true);
|
||||
List<SchBasePoint> schBasePoints = pointService.list(lam);
|
||||
List<SchBasePoint> list = Optional.ofNullable(schBasePoints)
|
||||
.orElse(new ArrayList<>())
|
||||
.stream()
|
||||
.filter(point -> !point.getPoint_code().endsWith("03"))
|
||||
.collect(Collectors.toList());
|
||||
return ObjectUtil.isNotEmpty(list) ? list.get(0) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从原材料库找空载具
|
||||
*
|
||||
* @param startRegionStr
|
||||
* @return
|
||||
*/
|
||||
private SchBasePoint findStartPoint(List<String> startRegionStr) {
|
||||
LambdaQueryWrapper<SchBasePoint> lam = new LambdaQueryWrapper<>();
|
||||
// 默认一直都有载具
|
||||
lam.in(SchBasePoint::getRegion_code, startRegionStr)
|
||||
// 点位状态是空位
|
||||
.eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_VEHICLE.getCode())
|
||||
// 当前执行的任务为空或者NULL,有数据表示锁住
|
||||
.and(la -> la.isNull(SchBasePoint::getIng_task_code)
|
||||
.or()
|
||||
.eq(SchBasePoint::getIng_task_code, ""))
|
||||
.eq(SchBasePoint::getIs_used, true);
|
||||
List<SchBasePoint> schBasePoints = pointService.list(lam);
|
||||
return ObjectUtil.isNotEmpty(schBasePoints) ? schBasePoints.get(0) : null;
|
||||
}
|
||||
|
||||
@@ -175,8 +221,8 @@ public class ZPRKTask extends AbstractTask {
|
||||
pointService.updateById(endPointObj);
|
||||
|
||||
LambdaQueryWrapper<SchBaseVehiclematerialgroup> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code,taskObj.getVehicle_code())
|
||||
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status,GroupBindMaterialStatusEnum.BOUND.getValue());
|
||||
lqw.eq(SchBaseVehiclematerialgroup::getVehicle_code, taskObj.getVehicle_code())
|
||||
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue());
|
||||
SchBaseVehiclematerialgroup vehiclematerialgroup = vehiclematerialgroupService.getOne(lqw);
|
||||
vehiclematerialgroup.setPoint_code(endPointObj.getPoint_code());
|
||||
vehiclematerialgroup.setPoint_name(endPointObj.getPoint_name());
|
||||
@@ -186,6 +232,29 @@ public class ZPRKTask extends AbstractTask {
|
||||
vehiclematerialgroup.setUpdate_time(DateUtil.now());
|
||||
vehiclematerialgroupService.update(vehiclematerialgroup);
|
||||
}
|
||||
|
||||
// 获取参数
|
||||
SchBasePoint startPointObj2 = pointService.getById(taskObj.getPoint_code3());
|
||||
String vehicle_code2 = startPointObj2.getVehicle_code();
|
||||
// 起点2清空
|
||||
if (ObjectUtil.isNotEmpty(startPointObj2)) {
|
||||
startPointObj2.setIng_task_code("");
|
||||
PointUtils.setUpdateByType(startPointObj2, taskFinishedType);
|
||||
PointUtils.clearPoint(startPointObj2);
|
||||
pointService.updateById(startPointObj2);
|
||||
}
|
||||
|
||||
//更新终点的点位信息
|
||||
SchBasePoint endPointObj2 = pointService.getById(taskObj.getPoint_code4());
|
||||
if (ObjectUtil.isNotEmpty(endPointObj2)) {
|
||||
endPointObj2.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
|
||||
endPointObj2.setVehicle_code(vehicle_code2);
|
||||
endPointObj2.setVehicle_type(taskObj.getVehicle_type());
|
||||
endPointObj2.setVehicle_qty(taskObj.getVehicle_qty());
|
||||
endPointObj2.setUpdate_time(DateUtil.now());
|
||||
PointUtils.setUpdateByType(endPointObj2, taskFinishedType);
|
||||
pointService.updateById(endPointObj2);
|
||||
}
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
||||
@@ -204,6 +273,15 @@ public class ZPRKTask extends AbstractTask {
|
||||
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
|
||||
pointService.updateById(endPointObj);
|
||||
}
|
||||
|
||||
// 获取参数
|
||||
SchBasePoint startPointObj2 = pointService.getById(taskObj.getPoint_code3());
|
||||
// 解锁
|
||||
if (ObjectUtil.isNotEmpty(startPointObj2)) {
|
||||
startPointObj2.setIng_task_code("");
|
||||
PointUtils.setUpdateByType(startPointObj2, taskFinishedType);
|
||||
pointService.updateById(startPointObj2);
|
||||
}
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
|
||||
Reference in New Issue
Block a user