feat: 烘烤确定的业务
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package org.nl.wms.pda.mps.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pda.mps.service.BakingService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 手持烘烤相关
|
||||
* @Date: 2024/8/12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/pda/baking")
|
||||
@Slf4j
|
||||
@SaIgnore
|
||||
public class BakingController {
|
||||
|
||||
@Autowired
|
||||
private BakingService bakingService;
|
||||
|
||||
@PostMapping("/bakingQuality")
|
||||
@Log("烘烤质检")
|
||||
public ResponseEntity<Object> bakingQuality(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(bakingService.bakingQuality(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.nl.wms.pda.mps.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2024/8/12
|
||||
*/
|
||||
public interface BakingService {
|
||||
/**
|
||||
* 质检
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject bakingQuality(JSONObject param);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package org.nl.wms.pda.mps.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.pda.mps.service.BakingService;
|
||||
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.util.PointUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2024/8/12
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class BakingServiceImpl implements BakingService {
|
||||
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
private IpdmBiRawfoilworkorderService rawfoilworkorderService;
|
||||
@Override
|
||||
public JSONObject bakingQuality(JSONObject param) {
|
||||
log.info("手持操作烘烤质检:{}", param);
|
||||
// param: point_code, vehicle_code,quality(1: 合格,0: 不合格)
|
||||
String quality = param.getString("quality");
|
||||
String pointCode = param.getString("point_code");
|
||||
String vehicleCode = param.getString("vehicle_code");
|
||||
Assert.notBlank(pointCode, "点位不能为空!");
|
||||
Assert.notBlank(vehicleCode, "收卷辊不能为空!");
|
||||
SchBasePoint hotZcPoint = pointService.getById(pointCode);
|
||||
if (ObjectUtil.isEmpty(hotZcPoint)) {
|
||||
throw new BadRequestException("点位 [" + pointCode + "] 不存在!");
|
||||
}
|
||||
List<PdmBiRawfoilworkorder> rawOrderList = rawfoilworkorderService.getOrderByVehicleAndStatus(vehicleCode, "04");
|
||||
if (rawOrderList.size() > 1) {
|
||||
throw new BadRequestException("收卷辊 [" + vehicleCode + "] 对应的生箔工单存在多条,请将其他多余工单结束!");
|
||||
}
|
||||
if (rawOrderList.size() == 0) {
|
||||
throw new BadRequestException("收卷辊 [" + vehicleCode + "] 对应的生箔工单不存在!");
|
||||
}
|
||||
if ("0".equals(quality)) {
|
||||
// 重复烘烤
|
||||
hotZcPoint.setPoint_status("2");
|
||||
} else {
|
||||
// 质检合格
|
||||
hotZcPoint.setPoint_status("4");
|
||||
}
|
||||
PointUtils.setUpdateByPC(hotZcPoint);
|
||||
pointService.updateById(hotZcPoint);
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("message", "操作成功!");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,13 @@ public interface IpdmBiRawfoilworkorderService extends IService<PdmBiRawfoilwork
|
||||
*/
|
||||
void confirm(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 获取载具编码+状态筛选出来的生箔工单
|
||||
* @param vehicleCode 载具号
|
||||
* @param status 状态
|
||||
* @return /
|
||||
*/
|
||||
List<PdmBiRawfoilworkorder> getOrderByVehicleAndStatus(String vehicleCode, String status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -234,5 +234,13 @@ public class PdmBiRawfoilworkorderServiceImpl extends ServiceImpl<PdmBiRawfoilwo
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PdmBiRawfoilworkorder> getOrderByVehicleAndStatus(String vehicleCode, String status) {
|
||||
LambdaQueryWrapper<PdmBiRawfoilworkorder> lam = new LambdaQueryWrapper<>();
|
||||
lam.eq(PdmBiRawfoilworkorder::getWind_roll, vehicleCode)
|
||||
.eq(PdmBiRawfoilworkorder::getStatus, status);
|
||||
return list(lam);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -13,5 +13,5 @@ public interface BakingOperationService {
|
||||
* @param param /
|
||||
* @return /
|
||||
*/
|
||||
public JSONObject acsRequestOutHotTask(JSONObject param);
|
||||
JSONObject acsRequestOutHotTask(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import static org.nl.wms.util.TaskUtils.checkTaskOptionStatus;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 自动创建入烘箱任务
|
||||
* @Description: 自动创建入烘箱任务 (统一调度执行,不合适则换定时任务)
|
||||
* @Date: 2024/8/9
|
||||
*/
|
||||
@Slf4j
|
||||
@@ -102,6 +102,7 @@ public class AutoInHotTrussTask extends AbstractTask {
|
||||
task.setVehicle_code(hotPoint.getVehicle_code());
|
||||
task.setRequest_param(JSONObject.toJSONString(param));
|
||||
task.setTask_status(TaskStatus.START_AND_POINT.getCode());
|
||||
task.setHandle_status(THIS_CLASS);
|
||||
TaskUtils.setCreateByPda(task);
|
||||
taskService.save(task);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package org.nl.wms.sch.task_manage.tasks.auto;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask;
|
||||
import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.core.enums.TaskFinishedTypeEnum;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.nl.wms.sch.task_manage.tasks.hot.OutHotTrussTask;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Date: 2024/8/12
|
||||
* @Description: 自动出烘箱任务,最终调用 {@link OutHotTrussTask} 来创建任务
|
||||
* <p>todo: 业务需求待定!!!</p>
|
||||
* @see OutHotTrussTask
|
||||
*/
|
||||
@Slf4j
|
||||
@Component(value = "AutoOutHotTrussTask")
|
||||
public class AutoOutHotTrussTask extends AbstractTask {
|
||||
private final String THIS_CLASS = AutoOutHotTrussTask.class.getName();
|
||||
public final static String CONFIG_CODE = "OutHotTrussTask";
|
||||
@Override
|
||||
public void create() throws BadRequestException {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动创建任务
|
||||
* @see OutHotTrussTask#createCompletion(SchBaseTask)
|
||||
*/
|
||||
@Override
|
||||
protected void autoCreate() {
|
||||
// 查找暂存中的点位,根据
|
||||
}
|
||||
|
||||
/**
|
||||
* @see OutHotTrussTask#finishTask(SchBaseTask, TaskFinishedTypeEnum)
|
||||
* @param taskObj 任务数据
|
||||
* @param taskFinishedType 完成枚举
|
||||
*/
|
||||
@Override
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 不在此业务
|
||||
}
|
||||
|
||||
/**
|
||||
* @see OutHotTrussTask#cancelTask(SchBaseTask, TaskFinishedTypeEnum)
|
||||
* @param taskObj 任务数据
|
||||
* @param taskFinishedType 完成枚举
|
||||
*/
|
||||
@Override
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 不在此业务
|
||||
}
|
||||
}
|
||||
@@ -57,12 +57,17 @@ public class InHotTrussTask extends AbstractTask {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* todo: 烘烤时间与烘烤温度是否需要下发ACS?
|
||||
* @param task /
|
||||
*/
|
||||
@Override
|
||||
public void createCompletion(SchBaseTask task) {
|
||||
// 查找烘箱同大卷小卷
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject requestObj = JSONObject.parseObject(requestParam);
|
||||
String workorderId = requestObj.getString("workorder_id");
|
||||
String flag = "0";
|
||||
PdmBiRawfoilworkorder order = rawfoilworkorderService.getById(workorderId);
|
||||
if ("1".equals(order.getIs_baking())) {
|
||||
String bakingTemperature = order.getBaking_temperature();
|
||||
@@ -103,17 +108,21 @@ public class InHotTrussTask extends AbstractTask {
|
||||
|
||||
}
|
||||
// 如果都没有位置, 就去未开启的烘箱的空位,也是区分大小卷
|
||||
// todo: (有可能是待烘烤、也有可能是不需要烘烤做为暂存)
|
||||
if (ObjectUtil.isEmpty(task.getPoint_code2())) {
|
||||
List<StIvtHotpointivt> notTaskHotOven = hotpointivtService.getNotTaskHotOven(order.getRoll_type(), "0");
|
||||
if (notTaskHotOven.size() == 0) {
|
||||
throw new BadRequestException("未找到可用货位!");
|
||||
}
|
||||
// 代表是暂存
|
||||
flag = "1";
|
||||
StIvtHotpointivt stIvtHotpointivt = notTaskHotOven.get(0);
|
||||
task.setPoint_code2(stIvtHotpointivt.getPoint_code());
|
||||
}
|
||||
// 保存任务参数
|
||||
task.setHandle_class(THIS_CLASS);
|
||||
task.setTask_status(TaskStatus.START_AND_POINT.getCode());
|
||||
requestObj.put("caching", flag);
|
||||
setUpdateByPC(task);
|
||||
taskService.save(task);
|
||||
}
|
||||
@@ -126,6 +135,7 @@ public class InHotTrussTask extends AbstractTask {
|
||||
String requestParam = taskObj.getRequest_param();
|
||||
JSONObject requestObj = JSONObject.parseObject(requestParam);
|
||||
String workorderId = requestObj.getString("workorder_id");
|
||||
String caching = requestObj.getString("caching");
|
||||
String endPointCode = taskObj.getPoint_code2();
|
||||
SchBasePoint hotDjwPoint = pointService.getById(endPointCode);
|
||||
StIvtHotpointivt hotpointivt = hotpointivtService.getPointByCode(endPointCode, false);
|
||||
@@ -145,7 +155,8 @@ public class InHotTrussTask extends AbstractTask {
|
||||
hotpointivt.setWorkorder_id(order.getWorkorder_id());
|
||||
hotpointivt.setInstorage_time(DateUtil.now());
|
||||
hotpointivt.setFull_vehicle_code(taskObj.getVehicle_code());
|
||||
hotpointivt.setPoint_status("1".equals(order.getIs_baking()) ? "02" : "03");
|
||||
// 02:烘烤中,03:暂存中
|
||||
hotpointivt.setPoint_status("0".equals(caching) ? "02" : "03");
|
||||
// todo: 更新温度和倒计时
|
||||
setHxUpdateByType(hotpointivt, taskFinishedType);
|
||||
hotpointivtService.updateById(hotpointivt);
|
||||
|
||||
@@ -13,15 +13,17 @@ import org.nl.wms.sch.task_manage.AbstractTask;
|
||||
import org.nl.wms.sch.task_manage.TaskStatus;
|
||||
import org.nl.wms.sch.task_manage.core.constant.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.core.enums.TaskFinishedTypeEnum;
|
||||
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.List;
|
||||
|
||||
import static org.nl.wms.util.PointUtils.hotClearPoint;
|
||||
import static org.nl.wms.util.PointUtils.setUpdateByType;
|
||||
import static org.nl.wms.util.TaskUtils.checkTaskOptionStatus;
|
||||
import static org.nl.wms.util.TaskUtils.setUpdateByPC;
|
||||
import static org.nl.wms.util.TaskUtils.setUpdateByType;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
@@ -69,7 +71,20 @@ public class OutHotTrussTask extends AbstractTask {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
checkTaskOptionStatus(taskObj);
|
||||
// 出烘箱后,终点状态应改成04:待分切
|
||||
String startPointCode = taskObj.getPoint_code1();
|
||||
String endPointCode = taskObj.getPoint_code2();
|
||||
StIvtHotpointivt startPoint = hotpointivtService.getPointByCode(startPointCode, false);
|
||||
SchBasePoint endPoint = pointService.getById(endPointCode);
|
||||
// 终点设置值
|
||||
endPoint.setVehicle_code(startPoint.getFull_vehicle_code());
|
||||
endPoint.setGroup_id(startPoint.getWorkorder_id());
|
||||
endPoint.setPoint_status("04");
|
||||
setUpdateByType(endPoint, taskFinishedType);
|
||||
pointService.updateById(endPoint);
|
||||
// 起点清空
|
||||
hotClearPoint(startPoint, taskFinishedType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,7 +95,7 @@ public class OutHotTrussTask extends AbstractTask {
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,16 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.wms.pdm.ivt.dao.StIvtHotpointivt;
|
||||
import org.nl.wms.pdm.ivt.service.IstIvtHotpointivtService;
|
||||
import org.nl.wms.pdm.ivt.service.impl.StIvtHotpointivtServiceImpl;
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch.point.service.impl.SchBasePointServiceImpl;
|
||||
import org.nl.wms.sch.task_manage.core.constant.GeneralDefinition;
|
||||
import org.nl.wms.sch.task_manage.core.enums.PointStatusEnum;
|
||||
import org.nl.wms.sch.task_manage.core.enums.TaskFinishedTypeEnum;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 点位工具类
|
||||
@@ -57,6 +61,27 @@ public class PointUtils {
|
||||
setUpdateByType(point, taskFinishedType);
|
||||
pointService.updateById(point);
|
||||
}
|
||||
/**
|
||||
* 烘箱清空点位
|
||||
* 会直接更新数据,使用时候不需要在update
|
||||
* @param point
|
||||
*/
|
||||
public static void hotClearPoint(StIvtHotpointivt point, TaskFinishedTypeEnum taskFinishedType) {
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
return; // 空直接退出
|
||||
}
|
||||
IstIvtHotpointivtService pointService = SpringContextHolder.getBean(StIvtHotpointivtServiceImpl.class);
|
||||
point.setPoint_status(PointStatusEnum.EMPTY_POINT.getCode());
|
||||
point.setContainer_name("");
|
||||
point.setFull_vehicle_code("");
|
||||
point.setWorkorder_id("");
|
||||
point.setInstorage_time("");
|
||||
point.setWorkorder_id("");
|
||||
point.setTemperature(BigDecimal.valueOf(0));
|
||||
point.setLast_time("");
|
||||
setHxUpdateByType(point, taskFinishedType);
|
||||
pointService.updateById(point);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空点位
|
||||
|
||||
Reference in New Issue
Block a user