rev: 混碾下料任务修改、物料修改、工单修改
This commit is contained in:
@@ -26,9 +26,15 @@ public class MdBaseMaterial implements Serializable {
|
||||
@ApiModelProperty(value = "物料标识")
|
||||
private String material_id;
|
||||
|
||||
@ApiModelProperty(value = "物料编码")
|
||||
@ApiModelProperty(value = "成品物料编码")
|
||||
private String material_code;
|
||||
|
||||
@ApiModelProperty(value = "半成品物料编码")
|
||||
private String half_material_code;
|
||||
|
||||
@ApiModelProperty(value = "原材料物料编码")
|
||||
private String raw_material_code;
|
||||
|
||||
@ApiModelProperty(value = "物料名称 ")
|
||||
private String material_name;
|
||||
|
||||
@@ -41,6 +47,9 @@ public class MdBaseMaterial implements Serializable {
|
||||
@ApiModelProperty(value = "静置时间(分钟)")
|
||||
private Integer standing_time;
|
||||
|
||||
@ApiModelProperty(value = "冷却时间(分钟)")
|
||||
private Integer cooling_time;
|
||||
|
||||
@ApiModelProperty(value = "车间编码")
|
||||
private String workshop_code;
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ import lombok.Data;
|
||||
@Data
|
||||
public class SignalData {
|
||||
|
||||
private String code;
|
||||
private String code; // to_command
|
||||
|
||||
private String value;
|
||||
private String value; // 1
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.MapOf;
|
||||
@@ -47,6 +48,8 @@ import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
import org.nl.wms.util.CommonUtils;
|
||||
import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.redisson.api.RLock;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -54,6 +57,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
@@ -87,6 +91,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
private IMdBaseMaterialService materialService;
|
||||
@Autowired
|
||||
private IPdmBdProductionProcessTrackingService processTrackingService;
|
||||
@Autowired
|
||||
private RedissonClient redissonClient;
|
||||
|
||||
@Override
|
||||
public BaseResponse acsApply(JSONObject param) {
|
||||
@@ -116,86 +122,171 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
/** 任务:申请补满料盅托盘(叫料) */
|
||||
/**
|
||||
* 任务:申请补满料盅托盘(叫料)
|
||||
* @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest
|
||||
* @param param: ApplyTaskRequest的json形式
|
||||
* @return
|
||||
*/
|
||||
@SneakyThrows
|
||||
public ApplyTaskResponse applyPutFullVehicle(JSONObject param) {
|
||||
// 找到当前的设备
|
||||
String deviceCode = param.getString("device_code");
|
||||
SchBasePoint basePoint = pointService.getById(deviceCode);
|
||||
if (ObjectUtil.isEmpty(basePoint)) {
|
||||
throw new BadRequestException("点位错误!");
|
||||
}
|
||||
String requestNo = param.getString("requestNo");
|
||||
String configCode = basePoint.getRegion_code() + "QLTask";
|
||||
// 组织参数
|
||||
param.put("config_code", configCode);
|
||||
taskService.apply(param);
|
||||
RLock lock = redissonClient.getLock(deviceCode);
|
||||
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
SchBasePoint basePoint = pointService.getById(deviceCode);
|
||||
if (ObjectUtil.isEmpty(basePoint)) {
|
||||
throw new BadRequestException("点位错误!");
|
||||
}
|
||||
String configCode = basePoint.getRegion_code() + "QLTask";
|
||||
// 组织参数
|
||||
param.put("config_code", configCode);
|
||||
taskService.apply(param);
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
return ApplyTaskResponse.responseOk(requestNo);
|
||||
}
|
||||
|
||||
/** 任务:申请补空料盅托盘(叫空盘) */
|
||||
/**
|
||||
* 任务:申请补空料盅托盘(叫空盘)
|
||||
* @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest
|
||||
* @param param: ApplyTaskRequest的json形式
|
||||
* @return
|
||||
*/
|
||||
@SneakyThrows
|
||||
public ApplyTaskResponse applyPutEmptyVehicle(JSONObject param) {
|
||||
// 找到当前的设备
|
||||
String deviceCode = param.getString("device_code");
|
||||
SchBasePoint basePoint = pointService.getById(deviceCode);
|
||||
if (ObjectUtil.isEmpty(basePoint)) {
|
||||
throw new BadRequestException("点位错误!");
|
||||
}
|
||||
String requestNo = param.getString("requestNo");
|
||||
String configCode = basePoint.getRegion_code() + "QKTask";
|
||||
// 组织参数
|
||||
param.put("config_code", configCode);
|
||||
taskService.apply(param);
|
||||
RLock lock = redissonClient.getLock(deviceCode);
|
||||
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
SchBasePoint basePoint = pointService.getById(deviceCode);
|
||||
if (ObjectUtil.isEmpty(basePoint)) {
|
||||
throw new BadRequestException("点位错误!");
|
||||
}
|
||||
String configCode = basePoint.getRegion_code() + "QKTask";
|
||||
// 组织参数
|
||||
param.put("config_code", configCode);
|
||||
taskService.apply(param);
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
return ApplyTaskResponse.responseOk(requestNo);
|
||||
}
|
||||
|
||||
/** 任务:申请取走空料盅托盘(送空盘) */
|
||||
/**
|
||||
* 任务:申请取走空料盅托盘(送空盘)
|
||||
* @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest
|
||||
* @param param: ApplyTaskRequest的json形式
|
||||
* @return
|
||||
*/
|
||||
@SneakyThrows
|
||||
public ApplyTaskResponse applyTakeEmptyVehicle(JSONObject param) {
|
||||
// 找到当前的设备
|
||||
String deviceCode = param.getString("device_code");
|
||||
SchBasePoint basePoint = pointService.getById(deviceCode);
|
||||
if (ObjectUtil.isEmpty(basePoint)) {
|
||||
throw new BadRequestException("点位错误!");
|
||||
}
|
||||
String requestNo = param.getString("requestNo");
|
||||
String configCode = basePoint.getRegion_code() + "SKTask";
|
||||
// 组织参数
|
||||
param.put("config_code", configCode);
|
||||
taskService.apply(param);
|
||||
RLock lock = redissonClient.getLock(deviceCode);
|
||||
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
SchBasePoint basePoint = pointService.getById(deviceCode);
|
||||
if (ObjectUtil.isEmpty(basePoint)) {
|
||||
throw new BadRequestException("点位错误!");
|
||||
}
|
||||
String configCode = basePoint.getRegion_code() + "SKTask";
|
||||
// 组织参数
|
||||
param.put("config_code", configCode);
|
||||
taskService.apply(param);
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
return ApplyTaskResponse.responseOk(requestNo);
|
||||
}
|
||||
|
||||
/** 任务:申请取走满料盅托盘(入库) */
|
||||
/**
|
||||
* 任务:申请取走满料盅托盘(入库)
|
||||
* @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest
|
||||
* @param param: ApplyTaskRequest的json形式
|
||||
* @return
|
||||
*/
|
||||
@SneakyThrows
|
||||
public ApplyTaskResponse applyTakeFullVehicle(JSONObject param) {
|
||||
// 找到当前的设备
|
||||
String deviceCode = param.getString("device_code");
|
||||
SchBasePoint basePoint = pointService.getById(deviceCode);
|
||||
if (ObjectUtil.isEmpty(basePoint)) {
|
||||
throw new BadRequestException("点位错误!");
|
||||
}
|
||||
String requestNo = param.getString("requestNo");
|
||||
String configCode = basePoint.getRegion_code() + "MLTask";
|
||||
// 组织参数
|
||||
param.put("config_code", configCode);
|
||||
taskService.apply(param);
|
||||
RLock lock = redissonClient.getLock(deviceCode);
|
||||
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
SchBasePoint basePoint = pointService.getById(deviceCode);
|
||||
if (ObjectUtil.isEmpty(basePoint)) {
|
||||
throw new BadRequestException("点位错误!");
|
||||
}
|
||||
String configCode = basePoint.getRegion_code() + "MLTask";
|
||||
// 组织参数
|
||||
param.put("config_code", configCode);
|
||||
taskService.apply(param);
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
return ApplyTaskResponse.responseOk(requestNo);
|
||||
}
|
||||
|
||||
/** 申请强制取走满料盅托盘(强制入库) */
|
||||
/**
|
||||
* 任务:申请强制取走满料盅托盘(强制入库)
|
||||
* @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest
|
||||
* @param param: ApplyTaskRequest的json形式
|
||||
* @return
|
||||
*/
|
||||
@SneakyThrows
|
||||
public ApplyTaskResponse applyForceTakeFullVehicle(JSONObject param) {
|
||||
String deviceCode = param.getString("device_code");
|
||||
SchBasePoint basePoint = pointService.getById(deviceCode);
|
||||
if (ObjectUtil.isEmpty(basePoint)) {
|
||||
throw new BadRequestException("点位错误!");
|
||||
}
|
||||
String requestNo = param.getString("requestNo");
|
||||
String configCode = basePoint.getRegion_code() + "QZRKTask";
|
||||
// 组织参数
|
||||
param.put("config_code", configCode);
|
||||
taskService.apply(param);
|
||||
RLock lock = redissonClient.getLock(deviceCode);
|
||||
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS);
|
||||
try {
|
||||
if (tryLock) {
|
||||
SchBasePoint basePoint = pointService.getById(deviceCode);
|
||||
if (ObjectUtil.isEmpty(basePoint)) {
|
||||
throw new BadRequestException("点位错误!");
|
||||
}
|
||||
String configCode = basePoint.getRegion_code() + "QZRKTask";
|
||||
// 组织参数
|
||||
param.put("config_code", configCode);
|
||||
taskService.apply(param);
|
||||
}
|
||||
} finally {
|
||||
if (tryLock) {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
return ApplyTaskResponse.responseOk(requestNo);
|
||||
}
|
||||
|
||||
/** 申请强制满托入缓存 todo: 暂时 */
|
||||
/**
|
||||
* 任务:申请强制满托入缓存 todo: 暂时
|
||||
* @see org.nl.wms.ext.acs.service.dto.to.wms.ApplyTaskRequest
|
||||
* @param param: ApplyTaskRequest的json形式
|
||||
* @return
|
||||
*/
|
||||
public ApplyTaskResponse applyForceTakeFullVehicleInStorage(JSONObject param) {
|
||||
// 找到当前的设备
|
||||
String deviceCode = param.getString("device_code");
|
||||
@@ -290,8 +381,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
case GeneralDefinition.GZY: // 如果是入窑口就是记录数据
|
||||
return this.recordKilnTime(baseRequest); // 直接返回
|
||||
default:
|
||||
return (ApplyTaskResponse) ApplyTaskResponse.responseError(baseRequest.getRequestNo(),
|
||||
"参数错误");
|
||||
return (ApplyTaskResponse) ApplyTaskResponse.responseError(baseRequest.getRequestNo(),"参数错误");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -384,6 +474,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public BaseResponse pressRequestMaterial(JSONObject param) { // (公共接口进来)只是给我一个下料位(中间位置)
|
||||
String requestNo = param.getString("requestNo");
|
||||
@@ -405,7 +496,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
// 获取原材料物料
|
||||
PdmBdRequestMaterialRecord requestMaterialRecord = new PdmBdRequestMaterialRecord();
|
||||
requestMaterialRecord.setRecord_id(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
requestMaterialRecord.setMaterial_id(workOrder.getRaw_material_id());
|
||||
// requestMaterialRecord.setMaterial_id(workOrder.getRaw_material_id());
|
||||
requestMaterialRecord.setWorkorder_id(workOrder.getWorkorder_id());
|
||||
requestMaterialRecord.setDevice_code(parentPointCode);
|
||||
requestMaterialRecord.setCreate_time(DateUtil.now());
|
||||
|
||||
@@ -2,8 +2,8 @@ package org.nl.wms.ext.record.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||
import org.nl.wms.ext.record.service.dao.SysInteractRecord;
|
||||
|
||||
@@ -46,5 +46,5 @@ public interface ISysInteractRecordService extends IService<SysInteractRecord> {
|
||||
/**
|
||||
* 创建记录
|
||||
*/
|
||||
void saveRecord(JSONObject param, BaseResponse response, String direction);
|
||||
void saveRecord(Object request, BaseResponse response, String direction);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class SysInteractRecordServiceImpl extends ServiceImpl<SysInteractRecordM
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveRecord(JSONObject param, BaseResponse response, String direction) {
|
||||
public void saveRecord(Object param, BaseResponse response, String direction) {
|
||||
SysInteractRecord entity = new SysInteractRecord();
|
||||
entity.setInteract_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
entity.setInteract_code(response.getRequestNo());
|
||||
|
||||
@@ -40,7 +40,7 @@ public class PdmBdWorkorder implements Serializable {
|
||||
private String material_id;
|
||||
|
||||
@ApiModelProperty(value = "原材料物料标识")
|
||||
private String raw_material_id;
|
||||
private String raw_material_code;
|
||||
|
||||
@ApiModelProperty(value = "载具类型")
|
||||
private String vehicle_type;
|
||||
@@ -122,11 +122,7 @@ public class PdmBdWorkorder implements Serializable {
|
||||
|
||||
@TableField(exist = false)
|
||||
private String material_spec;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String raw_material_name;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String raw_material_code;
|
||||
private String half_material_code;
|
||||
|
||||
}
|
||||
|
||||
@@ -6,11 +6,9 @@
|
||||
,ma.material_name
|
||||
,ma.material_code
|
||||
,ma.material_spec
|
||||
,ma2.material_name AS raw_material_name
|
||||
,ma2.material_code AS raw_material_code
|
||||
,ma.half_material_code
|
||||
FROM pdm_bd_workorder wo
|
||||
LEFT JOIN md_base_material ma ON ma.material_id = wo.material_id
|
||||
LEFT JOIN md_base_material ma2 ON ma2.material_id = wo.raw_material_id
|
||||
<where>
|
||||
<if test="query.more_order_status != null and query.more_order_status != ''">
|
||||
workorder_status IN
|
||||
|
||||
@@ -31,6 +31,9 @@ public class SchBaseVehiclematerialgroup implements Serializable {
|
||||
@ApiModelProperty(value = "物料标识")
|
||||
private String material_id;
|
||||
|
||||
@ApiModelProperty(value = "冗余-半成品/泥料")
|
||||
private String redundance_material_code;
|
||||
|
||||
@ApiModelProperty(value = "载具类型")
|
||||
private String vehicle_type;
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ public class GeneralDefinition {
|
||||
/** 窑自动任务开启 */
|
||||
public static final String AUTO_KILN_CALL = "auto_kiln_call";
|
||||
// 是否
|
||||
/**是 */
|
||||
/**是/正确/可用... */
|
||||
public static final String YES = "1";
|
||||
/** 否 */
|
||||
/** 否/错误/不可用... */
|
||||
public static final String NO = "0";
|
||||
// 载具类型
|
||||
/** 料盅 */
|
||||
@@ -57,4 +57,9 @@ public class GeneralDefinition {
|
||||
public static final String LZKLX = "LZKLX";
|
||||
/** 干燥窑区域 */
|
||||
public static final String GZY = "GZY";
|
||||
// 特殊: 1-缓存输送线入口,2-缓存输送线出口,3-上输送线,4-下输送线
|
||||
/** 上输送线 */
|
||||
public static final String UPPER_CONVEYOR_LINE = "3";
|
||||
/** 下输送线 */
|
||||
public static final String LOWER_CONVEYOR_LINE = "4";
|
||||
}
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
|
||||
package org.nl.wms.sch.task_manage.task;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.ext.record.service.ISysInteractRecordService;
|
||||
import org.nl.wms.ext.record.service.impl.SysInteractRecordServiceImpl;
|
||||
import org.nl.wms.sch.task_manage.AcsTaskDto;
|
||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -19,9 +24,21 @@ import java.util.List;
|
||||
*/
|
||||
@Slf4j
|
||||
public class AcsUtil {
|
||||
public static JSONObject notifyAcs(String api, List<AcsTaskDto> list) {
|
||||
/**
|
||||
* 统一多数据入口
|
||||
* @param api
|
||||
* @param list
|
||||
* @return
|
||||
* @param <T>
|
||||
*/
|
||||
public static <T> JSONObject notifyAcs(String api, List<T> list) {
|
||||
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class);
|
||||
//判断是否连接ACS系统
|
||||
String isConnect = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("IS_CONNECT_ACS").getValue();
|
||||
Param isConnectAcs = sysParamService.findByCode("IS_CONNECT_ACS");
|
||||
if (ObjectUtil.isEmpty(isConnectAcs)) {
|
||||
throw new BadRequestException("参数表中:IS_CONNECT_ACS不存在");
|
||||
}
|
||||
String isConnect = isConnectAcs.getValue();
|
||||
JSONObject result = new JSONObject();
|
||||
if (StrUtil.equals(GeneralDefinition.NO, isConnect)) {
|
||||
result.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
@@ -30,8 +47,11 @@ public class AcsUtil {
|
||||
return result;
|
||||
}
|
||||
//ACS地址:127.0.0.1:8010
|
||||
String acsUrl = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("ACS_URL").getValue();
|
||||
|
||||
Param acsUrlObj = sysParamService.findByCode("ACS_URL");
|
||||
if (ObjectUtil.isEmpty(acsUrlObj)) {
|
||||
throw new BadRequestException("参数表中:ACS_URL不存在");
|
||||
}
|
||||
String acsUrl = acsUrlObj.getValue();
|
||||
String url = acsUrl + api;
|
||||
log.info("下发acs任务的参数为:{}", list.toString());
|
||||
try {
|
||||
@@ -50,4 +70,36 @@ public class AcsUtil {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public static <T> JSONObject notifyAcs(String api, T object) {
|
||||
//判断是否连接ACS系统
|
||||
String isConnect = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("IS_CONNECT_ACS").getValue();
|
||||
JSONObject result = new JSONObject();
|
||||
if (StrUtil.equals(GeneralDefinition.NO, isConnect)) {
|
||||
result.put("status", HttpStatus.BAD_REQUEST.value());
|
||||
result.put("message", "未连接ACS!");
|
||||
result.put("data", new JSONObject());
|
||||
return result;
|
||||
}
|
||||
//ACS地址:127.0.0.1:8010
|
||||
String acsUrl = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("ACS_URL").getValue();
|
||||
|
||||
String url = acsUrl + api;
|
||||
log.info("下发acs任务的参数为:{}", object.toString());
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(object))
|
||||
.execute().body();
|
||||
result = JSONObject.parseObject(resultMsg);
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//ConnectException: Connection refused: connect
|
||||
//网络不通
|
||||
log.error("连接失败:{}", msg);
|
||||
result.put("status", HttpStatus.BAD_REQUEST);
|
||||
result.put("message", "网络不通,操作失败!");
|
||||
result.put("data", new JSONObject());
|
||||
}
|
||||
// 记录交互表
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
//package org.nl.wms.sch.task_manage.task.tasks.auto;
|
||||
//
|
||||
//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.param.ISysParamService;
|
||||
//import org.nl.system.service.param.dao.Param;
|
||||
//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;
|
||||
//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.task.TaskType;
|
||||
//import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.util.Arrays;
|
||||
//import java.util.List;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
///**
|
||||
// * @Author: lyd
|
||||
// * @Description: 混料压制物料输送任务
|
||||
// * @Date: 2023/7/27
|
||||
// */
|
||||
//@Component
|
||||
//@TaskType("HLYZTask")
|
||||
//public class HLYZTask extends AbstractTask {
|
||||
// private static String TASK_CONFIG_CODE = "HLYZTask";
|
||||
// @Autowired
|
||||
// private ISchBasePointService pointService;
|
||||
// @Autowired
|
||||
// private ISchBaseTaskService taskService;
|
||||
// @Autowired
|
||||
// private ISchBaseTaskconfigService taskConfigService;
|
||||
// @Autowired
|
||||
// private ISysParamService paramService;
|
||||
// @Override
|
||||
// protected void create() throws BadRequestException {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void autoCreate() {
|
||||
// // 自动创建任务
|
||||
//// Param autoKilnCall = paramService.findByCode(GeneralDefinition.AUTO_KILN_CALL);
|
||||
//// if (autoKilnCall.getValue().equals(GeneralDefinition.NO)) {
|
||||
//// return;
|
||||
//// }
|
||||
// // 判断当前点位有没有任务执行
|
||||
// List<SchBaseTask> unFinishTasksByTaskConfig = taskService.findUnFinishTasksByTaskConfig(TASK_CONFIG_CODE);
|
||||
// if (unFinishTasksByTaskConfig.size() > 0) {
|
||||
// // 有任务在执行就不创建
|
||||
// return;
|
||||
// }
|
||||
// // 获取任务配置
|
||||
// SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
// .eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
// // 创建任务
|
||||
// SchBaseTask task = new SchBaseTask(); // 任务实体
|
||||
// // 2、创建申请任务
|
||||
// task.setConfig_code(TASK_CONFIG_CODE);
|
||||
// task.setCreate_mode(GeneralDefinition.AUTO_CREATION);
|
||||
// task.setTask_status(TaskStatus.APPLY.getCode());
|
||||
// task.setWorkshop_code(taskConfig.getWorkshop_code()); // 车间编码
|
||||
// // 设置起/终点
|
||||
// this.setTaskPoint(taskConfig, task, "***");
|
||||
// // 找起点
|
||||
// List<String> nextRegionStr = Arrays
|
||||
// .stream(taskConfig.getNext_region_str().split(","))
|
||||
// .collect(Collectors.toList());
|
||||
// SchBasePoint point = findNextPoint(nextRegionStr);
|
||||
// if (ObjectUtil.isEmpty(point)) {
|
||||
// task.setRemark("未找到所需点位!");
|
||||
// taskService.create(task);
|
||||
// // 消息通知
|
||||
// return;
|
||||
// }
|
||||
// // 设置终点并修改创建成功状态
|
||||
// task.setPoint_code2(point.getPoint_code());
|
||||
// task.setRemark("");
|
||||
// task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
// taskService.create(task);
|
||||
// point.setIng_task_code(task.getTask_code());
|
||||
// pointService.update(point);
|
||||
// //下发
|
||||
//// this.renotifyAcs(task);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void updateStatus(String task_code, TaskStatus status) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void forceFinish(String task_code) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void cancel(String task_code) {
|
||||
//
|
||||
// }
|
||||
//}
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.task.service.ISchBaseTaskService;
|
||||
@@ -12,11 +13,14 @@ 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.enums.NoticeTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.enums.PointStatusEnum;
|
||||
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.sch.task_manage.task.tasks.dtk.mapper.DTKMapper;
|
||||
import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -40,6 +44,8 @@ public class CTQKTask extends AbstractTask {
|
||||
@Autowired
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
private DTKMapper dtkMapper;
|
||||
@Override
|
||||
protected void create() throws BadRequestException {
|
||||
@@ -49,15 +55,15 @@ public class CTQKTask extends AbstractTask {
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
for (SchBaseTask task : tasks) {
|
||||
TaskUtils.setUpdateByAcs(task); // 修改修改者
|
||||
List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(",")).collect(Collectors.toList());
|
||||
// 找起点
|
||||
String extGroupData = task.getExt_group_data();
|
||||
JSONObject jsonObject = JSONObject.parseObject(extGroupData);
|
||||
SchBasePoint point = findStartPoint(startRegionStr);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
task.setRemark("未找到所需点位!");
|
||||
taskService.update(task);
|
||||
task.setRemark("暂无托盘!");
|
||||
taskService.updateById(task);
|
||||
// 消息通知
|
||||
noticeService.createNotice(task.getRemark(), TASK_CONFIG_CODE + task.getTask_code(), NoticeTypeEnum.WARN.getCode());
|
||||
continue;
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
@@ -65,13 +71,15 @@ public class CTQKTask extends AbstractTask {
|
||||
task.setRemark("");
|
||||
task.setVehicle_qty(point.getVehicle_qty());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
taskService.update(task);
|
||||
taskService.updateById(task);
|
||||
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
pointService.update(point);
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
|
||||
//下发
|
||||
// this.renotifyAcs(task);
|
||||
this.renotifyAcs(task);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +89,7 @@ public class CTQKTask extends AbstractTask {
|
||||
* @return
|
||||
*/
|
||||
private SchBasePoint findStartPoint(List<String> startRegionStr) {
|
||||
// 钢托盘缓存区域的空盘是1 状态不同
|
||||
List<SchBasePoint> points = dtkMapper.findPointForCTQK(startRegionStr);
|
||||
return ObjectUtil.isNotEmpty(points) ? points.get(0) : null;
|
||||
}
|
||||
@@ -95,48 +104,78 @@ public class CTQKTask extends AbstractTask {
|
||||
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);
|
||||
}
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
String startPoint = taskObj.getPoint_code1(); // 获取起点
|
||||
String endPoint = taskObj.getPoint_code2(); // 获取起点
|
||||
SchBasePoint startPointObj = pointService.getById(startPoint);
|
||||
SchBasePoint endPointObj = pointService.getById(endPoint);
|
||||
// 根据传来的类型去对任务进行操作
|
||||
if (status.equals(TaskStatus.EXECUTING)) { // 执行中
|
||||
taskObj.setTask_status(TaskStatus.EXECUTING.getCode());
|
||||
taskObj.setRemark("执行中");
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(startPointObj)) {
|
||||
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
|
||||
PointUtils.clearPoint(startPointObj);
|
||||
endPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
|
||||
endPointObj.setVehicle_type("2");
|
||||
endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
|
||||
endPointObj.setUpdate_time(DateUtil.now());
|
||||
PointUtils.setUpdateByType(endPointObj, taskFinishedType);
|
||||
pointService.updateById(endPointObj);
|
||||
}
|
||||
if (status.equals(TaskStatus.FINISHED)) { // 完成
|
||||
// 起点清空
|
||||
if (ObjectUtil.isNotEmpty(startPointObj)) {
|
||||
PointUtils.clearPoint(startPointObj);
|
||||
endPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
|
||||
endPointObj.setVehicle_type("2");
|
||||
endPointObj.setVehicle_qty(taskObj.getVehicle_qty());
|
||||
endPointObj.setUpdate_time(DateUtil.now());
|
||||
pointService.updateById(endPointObj);
|
||||
}
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark("任务完成");
|
||||
}
|
||||
if (status.equals(TaskStatus.CANCELED)) { // 取消
|
||||
// 起点解锁
|
||||
if (ObjectUtil.isNotEmpty(startPointObj)) {
|
||||
startPointObj.setIng_task_code("");
|
||||
pointService.update(startPointObj);
|
||||
}
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
}
|
||||
taskService.update(taskObj);
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark("任务完成");
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_code) {
|
||||
this.updateStatus(task_code, TaskStatus.FINISHED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_code) {
|
||||
this.updateStatus(task_code, TaskStatus.CANCELED);
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 获取参数
|
||||
String startPoint = taskObj.getPoint_code1(); // 获取起点
|
||||
SchBasePoint startPointObj = pointService.getById(startPoint);
|
||||
// 起点解锁
|
||||
if (ObjectUtil.isNotEmpty(startPointObj)) {
|
||||
startPointObj.setIng_task_code("");
|
||||
PointUtils.setUpdateByType(startPointObj, taskFinishedType);
|
||||
pointService.updateById(startPointObj);
|
||||
}
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark("任务取消");
|
||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class DTSKTask extends AbstractTask {
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
private DTKMapper dtkMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void create() throws BadRequestException {
|
||||
@@ -81,7 +81,7 @@ public class DTSKTask extends AbstractTask {
|
||||
pointService.updateById(point);
|
||||
|
||||
//下发
|
||||
// this.renotifyAcs(task);
|
||||
this.renotifyAcs(task);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,10 @@
|
||||
<select id="findPointForCTQK" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint">
|
||||
SELECT p.*
|
||||
FROM `sch_base_point` p
|
||||
WHERE (p.point_type = '3' OR p.point_type IS NULL OR p.point_type = '')
|
||||
WHERE (
|
||||
(p.point_type = '3' AND p.region_code = #{regionCode[0]}) OR
|
||||
(p.point_type = '1' AND p.region_code = #{regionCode[1]})
|
||||
)
|
||||
AND (p.ing_task_code = '' OR p.ing_task_code IS NULL)
|
||||
AND p.point_status = '2'
|
||||
AND p.is_used = 1
|
||||
|
||||
@@ -82,6 +82,11 @@ public class FJMKTask extends AbstractTask {
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
continue;
|
||||
}
|
||||
task.setPoint_code2(packagePoint.getPoint_code()); // 包装线
|
||||
// todo: 校验是否够码满一托
|
||||
// 1 获取点位相应数量
|
||||
// 2 获取库存数量
|
||||
// 3 木托盘需要多少块
|
||||
SchBasePoint LaminatePoint = findStartPoint(startRegionStr, jsonObject);
|
||||
if (ObjectUtil.isEmpty(LaminatePoint)) {
|
||||
task.setRemark("覆膜区不可用!");
|
||||
@@ -94,7 +99,6 @@ public class FJMKTask extends AbstractTask {
|
||||
// 生产木托盘编码
|
||||
String vehicleCode = CodeUtil.getNewCode("VEHICLE_CODE");
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(packagePoint.getPoint_code());
|
||||
task.setPoint_code3(LaminatePoint.getParent_point_code());
|
||||
task.setPoint_code4(task.getPoint_code1());
|
||||
task.setVehicle_code2(vehicleCode);
|
||||
@@ -112,7 +116,7 @@ public class FJMKTask extends AbstractTask {
|
||||
pointService.updateById(basePoint);
|
||||
|
||||
//下发
|
||||
// this.renotifyAcs(task);
|
||||
this.renotifyAcs(task);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ 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.TaskFinishedTypeEnum;
|
||||
import org.nl.wms.sch.task_manage.task.AcsUtil;
|
||||
import org.nl.wms.sch.task_manage.task.TaskType;
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||
import org.nl.wms.sch.task_manage.task.tasks.fj.mapper.FJMapper;
|
||||
@@ -48,7 +49,7 @@ public class FJQKTask extends AbstractTask {
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private IPdmBdWorkorderService workorderService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
@@ -94,7 +95,7 @@ public class FJQKTask extends AbstractTask {
|
||||
pointService.updateById(basePoint);
|
||||
|
||||
//下发
|
||||
// this.renotifyAcs(task);
|
||||
this.renotifyAcs(task);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,6 +120,7 @@ public class FJQKTask extends AbstractTask {
|
||||
SchBasePoint endPointObj = fjMapper.findPointForFJQK(startRegionStr, new JSONObject()
|
||||
.fluentPut("vehicleType", vehicleType).fluentPut("pointType", GeneralDefinition.DEVICE_POINT));
|
||||
// todo: 请求ACS释放一个木托盘
|
||||
// AcsUtil.notifyAcs("", )
|
||||
// 这个点的父点位为起点
|
||||
return ObjectUtil.isNotEmpty(endPointObj) ? endPointObj : null;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class FJQLTask extends AbstractTask {
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
private FJMapper fjMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IPdmBdProductionProcessTrackingService processTrackingService;
|
||||
@Override
|
||||
@@ -97,7 +97,7 @@ public class FJQLTask extends AbstractTask {
|
||||
pointService.updateById(point);
|
||||
|
||||
//下发
|
||||
// this.renotifyAcs(task);
|
||||
this.renotifyAcs(task);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public class FJQLTask extends AbstractTask {
|
||||
: null;
|
||||
Assert.notNull(workOrder, "工单不能为空!");
|
||||
// 从所选区域中,选择满料位、无锁、可用的点位
|
||||
List<SchBasePoint> points = fjMapper.findPointForFJQL(startRegionStr, workOrder.getRaw_material_id());
|
||||
List<SchBasePoint> points = fjMapper.findPointForFJQL(startRegionStr, workOrder.getRaw_material_code());
|
||||
return ObjectUtil.isNotEmpty(points) ? points.get(0) : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class FJRKTask extends AbstractTask {
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IPdmBdWorkorderService workorderService;
|
||||
@Autowired
|
||||
@@ -85,7 +85,7 @@ public class FJRKTask extends AbstractTask {
|
||||
pointService.updateById(point);
|
||||
|
||||
//下发
|
||||
// this.renotifyAcs(task);
|
||||
this.renotifyAcs(task);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class FJSKTask extends AbstractTask {
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private FJMapper fjMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
@@ -86,7 +86,7 @@ public class FJSKTask extends AbstractTask {
|
||||
pointService.updateById(point);
|
||||
|
||||
//下发
|
||||
// this.renotifyAcs(task);
|
||||
this.renotifyAcs(task);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class FJSLTask extends AbstractTask {
|
||||
private IPdmBdWorkorderService workorderService;
|
||||
@Autowired
|
||||
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Override
|
||||
@@ -89,7 +89,7 @@ public class FJSLTask extends AbstractTask {
|
||||
pointService.updateById(point);
|
||||
|
||||
//下发
|
||||
// this.renotifyAcs(task);
|
||||
this.renotifyAcs(task);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,15 @@
|
||||
vg.group_id
|
||||
FROM
|
||||
`sch_base_point` p
|
||||
LEFT JOIN sch_base_vehiclematerialgroup vg ON p.vehicle_code = vg.vehicle_code AND p.vehicle_type = vg.vehicle_type AND vg.group_bind_material_status = '2'
|
||||
LEFT JOIN sch_base_vehiclematerialgroup vg ON p.vehicle_code = vg.vehicle_code AND p.vehicle_type = vg.vehicle_type AND vg.group_bind_material_status = '2'
|
||||
LEFT JOIN md_base_material ma ON ma.material_id = vg.material_id
|
||||
WHERE (p.ing_task_code = '' OR p.ing_task_code IS NULL)
|
||||
AND p.is_used = 1
|
||||
AND p.point_status = '3'
|
||||
AND vg.is_firing = true
|
||||
AND vg.material_id = #{materialId}
|
||||
AND p.region_code IN
|
||||
AND p.is_used = 1
|
||||
AND p.point_status = '3'
|
||||
AND vg.is_firing = true
|
||||
AND vg.material_id = #{materialId}
|
||||
AND TIMESTAMPDIFF(MINUTE, vg.instorage_time, NOW()) > ma.cooling_time
|
||||
AND p.region_code IN
|
||||
<foreach collection="regionCode" item="code" separator="," open="(" close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
|
||||
@@ -66,7 +66,7 @@ public class HNMLTask extends AbstractTask {
|
||||
private IMdBaseMaterialService materialService;
|
||||
@Autowired
|
||||
private HNMapper hnMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -110,14 +110,14 @@ public class HNMLTask extends AbstractTask {
|
||||
// 找终点
|
||||
SchBasePoint point = findNextPoint(nextRegionStr, jsonObject);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
task.setRemark("未找到所需点位!");
|
||||
task.setRemark("未存在生产该料的压机!");
|
||||
taskService.updateById(task);
|
||||
// 消息通知
|
||||
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(), NoticeTypeEnum.WARN.getCode());
|
||||
noticeService.createNotice(task.getRemark(), TASK_CONFIG_CODE + task.getTask_code(), NoticeTypeEnum.WARN.getCode());
|
||||
continue;
|
||||
}
|
||||
// 叫料完成
|
||||
requestMaterialRecordService.callMaterialFinish(point.getRecord_id());// todo: 加个组盘标识
|
||||
// requestMaterialRecordService.callMaterialFinish(point.getRecord_id());
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(point.getPoint_code());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
@@ -136,13 +136,13 @@ public class HNMLTask extends AbstractTask {
|
||||
pointService.updateById(point);
|
||||
|
||||
//下发
|
||||
// this.renotifyAcs(task);
|
||||
this.renotifyAcs(task);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据提前要料表的物料与混料入库请求的物料相同
|
||||
* 根据压机工单的原料编码以及点位的更新时间
|
||||
*
|
||||
* @param nextRegionStr
|
||||
* @param requestParam
|
||||
@@ -150,12 +150,12 @@ public class HNMLTask extends AbstractTask {
|
||||
*/
|
||||
private SchBasePoint findNextPoint(List<String> nextRegionStr, JSONObject requestParam) {
|
||||
// *: 混碾无工单
|
||||
String materialCode = requestParam.getString("material_code");
|
||||
String materialCode = requestParam.getString("material_code"); // 混碾编码
|
||||
Assert.notNull(materialCode, "物料编码不能为空!");
|
||||
MdBaseMaterial baseMaterialObj = materialService.findByCode(materialCode);
|
||||
Assert.notNull(materialCode, "物料: " + materialCode + "未找到!");
|
||||
Assert.notNull(baseMaterialObj, "物料: " + materialCode + "未找到!");
|
||||
// 根据工单物料标识寻找点位
|
||||
List<SchBasePoint> points = hnMapper.findPointForHNML(nextRegionStr, baseMaterialObj.getMaterial_id());
|
||||
List<SchBasePoint> points = hnMapper.findPointForHNMLAndWorkOrder(nextRegionStr, baseMaterialObj.getMaterial_id());
|
||||
return ObjectUtil.isNotEmpty(points) ? points.get(0) : null;
|
||||
}
|
||||
|
||||
@@ -224,6 +224,10 @@ public class HNMLTask extends AbstractTask {
|
||||
groupEntity.setPoint_code(endPointObj.getPoint_code()); // 当前位置
|
||||
groupEntity.setPoint_name(endPointObj.getPoint_name());
|
||||
groupEntity.setMove_way(groupEntity.getMove_way() + " -> " + endPointObj.getPoint_code());
|
||||
groupEntity.setMaterial_id(one.getMaterial_id());
|
||||
// *根据压机的工单物料标识查找静置时间
|
||||
MdBaseMaterial mdBaseMaterial = materialService.getById(one.getMaterial_id());
|
||||
groupEntity.setStanding_time(mdBaseMaterial.getStanding_time());
|
||||
}
|
||||
}
|
||||
// 更新组盘数据
|
||||
@@ -264,9 +268,10 @@ public class HNMLTask extends AbstractTask {
|
||||
// LMS组盘时生成混料批次:压制工单+混砂机号+碾次
|
||||
String vehicleCode = param.getString("vehicle_code");
|
||||
String vehicleType = param.getString("vehicle_type");
|
||||
String materialCode = param.getString("material_code");
|
||||
// 泥料物料对应不出物料标识
|
||||
String materialCode = param.getString("material_code"); // 泥料编码
|
||||
String mixTimes = param.getString("bag_number"); // 碾次
|
||||
|
||||
// 载具类型默认料盅
|
||||
if (vehicleType == null) {
|
||||
vehicleType = GeneralDefinition.MATERIAL_CUP;
|
||||
}
|
||||
@@ -278,25 +283,16 @@ public class HNMLTask extends AbstractTask {
|
||||
if (vehicleCode == null) {
|
||||
throw new BadRequestException("载具编码不能为空");
|
||||
}
|
||||
MdBaseMaterial material = materialService.findByCode(materialCode);
|
||||
if (ObjectUtil.isEmpty(material)) {
|
||||
throw new BadRequestException("物料[" + materialCode + "]不存在");
|
||||
}
|
||||
// 找到相同组盘信息就直接返回id,避免任务取消组盘信息还存在,重复插入
|
||||
SchBaseVehiclematerialgroup groupObject = vehiclematerialgroupService.getGroupInfo(vehicleCode, vehicleType,
|
||||
GroupBindMaterialStatusEnum.WAIT_BIND.getValue(), material.getMaterial_id());
|
||||
GroupBindMaterialStatusEnum.WAIT_BIND.getValue());
|
||||
if (groupObject != null) {
|
||||
return groupObject.getGroup_id();
|
||||
}
|
||||
// 要把数据存到组盘表
|
||||
SchBaseVehiclematerialgroup groupEntity = new SchBaseVehiclematerialgroup();
|
||||
groupEntity.setGroup_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
groupEntity.setMaterial_id(ObjectUtil.isNotEmpty(material)
|
||||
? material.getMaterial_id()
|
||||
: "");
|
||||
groupEntity.setStanding_time(ObjectUtil.isNotEmpty(material) // 静置时间维护到物料
|
||||
? material.getStanding_time()
|
||||
: 0);
|
||||
groupEntity.setRedundance_material_code(materialCode);
|
||||
groupEntity.setCreate_id(GeneralDefinition.ACS_ID);
|
||||
groupEntity.setCreate_name(GeneralDefinition.ACS_NAME);
|
||||
groupEntity.setCreate_time(DateUtil.now());
|
||||
|
||||
@@ -13,4 +13,5 @@ import java.util.List;
|
||||
*/
|
||||
public interface HNMapper extends BaseMapper<JSONObject> {
|
||||
List<SchBasePoint> findPointForHNML(List<String> regionCode, String materialId);
|
||||
List<SchBasePoint> findPointForHNMLAndWorkOrder(List<String> regionCode, String materialId);
|
||||
}
|
||||
|
||||
@@ -21,4 +21,25 @@
|
||||
</foreach>
|
||||
ORDER BY r.create_time
|
||||
</select>
|
||||
<select id="findPointForHNMLAndWorkOrder" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint">
|
||||
SELECT
|
||||
p.*
|
||||
FROM
|
||||
`sch_base_point` p
|
||||
WHERE
|
||||
p.point_type = '5'
|
||||
AND p.point_status = '1'
|
||||
AND (p.ing_task_code = '' OR p.ing_task_code IS NULL)
|
||||
AND p.parent_point_code LIKE CONCAT('%',
|
||||
(SELECT p2.point_code FROM sch_base_point p2
|
||||
WHERE p2.point_code IN (
|
||||
SELECT w.point_code FROM pdm_bd_workorder w WHERE w.material_id = #{materialId} AND w.workorder_status = '3'
|
||||
)
|
||||
AND p2.point_status = '1'
|
||||
ORDER BY p2.update_time LIMIT 1), '%')
|
||||
AND p.region_code IN
|
||||
<foreach collection="regionCode" item="code" separator="," open="(" close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -51,7 +51,7 @@ public class CYZCTask extends AbstractTask {
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
@@ -94,7 +94,7 @@ public class CYZCTask extends AbstractTask {
|
||||
pointService.updateById(point);
|
||||
|
||||
//下发
|
||||
// this.renotifyAcs(task);
|
||||
this.renotifyAcs(task);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class GZYQLTask extends AbstractTask {
|
||||
private ISchBaseTaskService taskService;
|
||||
@Autowired
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Override
|
||||
@@ -82,7 +82,7 @@ public class GZYQLTask extends AbstractTask {
|
||||
pointService.updateById(point);
|
||||
|
||||
//下发
|
||||
// this.renotifyAcs(task);
|
||||
this.renotifyAcs(task);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class YZQKTask extends AbstractTask {
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
protected void create() {
|
||||
@@ -83,7 +83,7 @@ public class YZQKTask extends AbstractTask {
|
||||
pointService.updateById(point);
|
||||
|
||||
//下发
|
||||
// this.renotifyAcs(task);
|
||||
this.renotifyAcs(task);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ import java.util.stream.Collectors;
|
||||
@TaskType("LZKLXSKTask")
|
||||
public class YZSKTask extends AbstractTask {
|
||||
private static String TASK_CONFIG_CODE = "LZKLXSKTask";
|
||||
|
||||
@Autowired
|
||||
private ISchBasePointService pointService;
|
||||
@Autowired
|
||||
@@ -49,7 +48,7 @@ public class YZSKTask extends AbstractTask {
|
||||
private ISchBaseTaskconfigService taskConfigService;
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -89,7 +88,7 @@ public class YZSKTask extends AbstractTask {
|
||||
pointService.updateById(point);
|
||||
|
||||
//下发
|
||||
// this.renotifyAcs(task);
|
||||
this.renotifyAcs(task);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.config.MapOf;
|
||||
import org.nl.system.service.notice.ISysNoticeService;
|
||||
import org.nl.wms.database.brick.service.IMdBaseBrickInfoService;
|
||||
import org.nl.wms.pdm.track.service.IPdmBdProductionProcessTrackingService;
|
||||
@@ -60,7 +60,7 @@ public class YZSLTask extends AbstractTask {
|
||||
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService;
|
||||
@Autowired
|
||||
private YZMapper yzMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
@Autowired
|
||||
@@ -104,7 +104,7 @@ public class YZSLTask extends AbstractTask {
|
||||
pointService.updateById(point);
|
||||
|
||||
//下发
|
||||
// this.renotifyAcs(task);
|
||||
this.renotifyAcs(task);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,10 +143,23 @@ public class YZSLTask extends AbstractTask {
|
||||
regionCode = nextRegionStr.get(0);
|
||||
}
|
||||
}
|
||||
// todo: 双层缓存货架的一上一下的区分
|
||||
List<SchBasePoint> pointForYZSL = yzMapper.findPointForYZSL(new JSONObject(
|
||||
MapOf.of("regionCode", regionCode, "pointType", GeneralDefinition.ENTRANCE)));
|
||||
return ObjectUtil.isNotEmpty(pointForYZSL) ? pointForYZSL.get(0) : null;
|
||||
// 双层缓存货架的一上一下的区分
|
||||
// 计算缓存上和缓存下的空位数量决定是使用desc还是asc
|
||||
int countUp = yzMapper.countConveyorLine(nextRegionStr.get(0), GeneralDefinition.UPPER_CONVEYOR_LINE,
|
||||
PointStatusEnum.EMPTY_POINT.getCode());
|
||||
int countLower = yzMapper.countConveyorLine(nextRegionStr.get(0), GeneralDefinition.LOWER_CONVEYOR_LINE,
|
||||
PointStatusEnum.EMPTY_POINT.getCode());
|
||||
LambdaQueryWrapper<SchBasePoint> lam = new QueryWrapper<SchBasePoint>().lambda();
|
||||
lam.eq(SchBasePoint::getRegion_code, regionCode)
|
||||
.eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_POINT.getCode())
|
||||
.eq(SchBasePoint::getPoint_type, GeneralDefinition.ENTRANCE) // 对接位
|
||||
.and(la -> la.isNull(SchBasePoint::getIng_task_code) // 当前执行的任务为空或者NULL,有数据表示锁住
|
||||
.or()
|
||||
.eq(SchBasePoint::getIng_task_code, ""))
|
||||
.eq(SchBasePoint::getIs_used, true)
|
||||
.orderBy(true, countUp > countLower, SchBasePoint::getPoint_code);
|
||||
List<SchBasePoint> schBasePoints = pointService.list(lam);
|
||||
return ObjectUtil.isNotEmpty(schBasePoints) ? schBasePoints.get(0) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -189,6 +202,10 @@ public class YZSLTask extends AbstractTask {
|
||||
vehicleType = GeneralDefinition.STEEL_TRAY;
|
||||
}
|
||||
String deviceCode = param.getString("device_code");
|
||||
String isFull = param.getString("is_full");
|
||||
if (isFull == null) {
|
||||
isFull = GeneralDefinition.YES;
|
||||
}
|
||||
// 砖块数量
|
||||
Integer qty = param.getInteger("qty");
|
||||
SchBasePoint basePoint = pointService.getById(deviceCode);
|
||||
@@ -230,6 +247,7 @@ public class YZSLTask extends AbstractTask {
|
||||
groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.WAIT_BIND.getValue()); // 待绑定
|
||||
groupEntity.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。
|
||||
groupEntity.setIs_delete(false);
|
||||
groupEntity.setIs_full(isFull.equals(GeneralDefinition.YES) ? true : false);
|
||||
vehiclematerialgroupService.save(groupEntity);
|
||||
// 将所有当前位置的砖块设置组盘标识
|
||||
baseBrickInfoService.setGroupByCurrentAllBrick(deviceCode, groupEntity.getGroup_id());
|
||||
|
||||
@@ -12,5 +12,14 @@ import java.util.List;
|
||||
*/
|
||||
public interface YZMapper {
|
||||
List<SchBasePoint> findPointForYZQL(List<String> regionCode, String materialId);
|
||||
@Deprecated
|
||||
List<SchBasePoint> findPointForYZSL(JSONObject param);
|
||||
|
||||
/**
|
||||
* 统计输送线数量
|
||||
* @param regionCode
|
||||
* @param pointType
|
||||
* @return
|
||||
*/
|
||||
int countConveyorLine(String regionCode, String pointType, String pointStatus);
|
||||
}
|
||||
|
||||
@@ -31,4 +31,14 @@
|
||||
AND p.is_used = TRUE
|
||||
AND ( t.task_code IS NULL OR t.task_code = '')
|
||||
</select>
|
||||
<select id="countConveyorLine" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
sch_base_point p2
|
||||
WHERE
|
||||
p2.region_code = #{regionCode}
|
||||
AND p2.point_type = #{pointType}
|
||||
AND p2.point_status = #{pointStatus}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -58,6 +58,17 @@ spring:
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
redisson:
|
||||
config: |
|
||||
threads: 4
|
||||
nettyThreads: 4
|
||||
singleServerConfig:
|
||||
connectionMinimumIdleSize: 8
|
||||
connectionPoolSize: 8
|
||||
address: redis://127.0.0.1:6379
|
||||
idleConnectionTimeout: 10000
|
||||
timeout: 3000
|
||||
|
||||
|
||||
# 登录相关配置
|
||||
login:
|
||||
|
||||
@@ -57,8 +57,16 @@ spring:
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
#连接超时时间
|
||||
timeout: 5000
|
||||
redisson:
|
||||
config: |
|
||||
threads: 4
|
||||
nettyThreads: 4
|
||||
singleServerConfig:
|
||||
connectionMinimumIdleSize: 8
|
||||
connectionPoolSize: 8
|
||||
address: redis://127.0.0.1:6379
|
||||
idleConnectionTimeout: 10000
|
||||
timeout: 3000
|
||||
# 登录相关配置
|
||||
login:
|
||||
# 登录缓存
|
||||
|
||||
@@ -12,7 +12,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
<contextName>nlAdmin</contextName>
|
||||
<property name="log.charset" value="utf-8"/>
|
||||
<property name="log.pattern"
|
||||
value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %gray(%msg%n)"/>
|
||||
value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %cyan(%msg%n)"/>
|
||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!--引入默认的一些设置-->
|
||||
|
||||
Reference in New Issue
Block a user