opt: 部分优化
This commit is contained in:
@@ -0,0 +1,183 @@
|
||||
package org.nl.common.enums;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 通用定义类型数据
|
||||
* @Date: 2023/7/13
|
||||
*/
|
||||
public class GeneralDefinition {
|
||||
/**
|
||||
* 默认密码
|
||||
*/
|
||||
public static final String DEFAULT_PASSWORD = "123456";
|
||||
/**
|
||||
* 盐值加密
|
||||
*/
|
||||
public static final String SALT = "salt";
|
||||
/**
|
||||
* 转义点
|
||||
*/
|
||||
public static final String ESCAPE_DOT = "\\.";
|
||||
/**
|
||||
* 点
|
||||
*/
|
||||
public static final String DOT = ".";
|
||||
/**
|
||||
* 日期变量
|
||||
*/
|
||||
public static final String DATE_FORMAT = "yyyy-MM-dd";
|
||||
/**
|
||||
* 时间变量
|
||||
*/
|
||||
public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||
/**
|
||||
* 未知
|
||||
*/
|
||||
public static final String UNKNOWN = "-";
|
||||
// 统一编码定义
|
||||
/**
|
||||
* 窑自动任务开启
|
||||
*/
|
||||
public static final String AUTO_KILN_CALL = "auto_kiln_call";
|
||||
// 是否
|
||||
/**
|
||||
* 是/正确/可用...
|
||||
*/
|
||||
public static final String YES = "1";
|
||||
/**
|
||||
* 否/错误/不可用...
|
||||
*/
|
||||
public static final String NO = "0";
|
||||
// 载具类型
|
||||
/**
|
||||
* 料盅
|
||||
*/
|
||||
public static final String MATERIAL_CUP = "LZ";
|
||||
/**
|
||||
* 钢托盘
|
||||
*/
|
||||
public static final String STEEL_TRAY = "GTP";
|
||||
// 账号定义
|
||||
/**
|
||||
* acs系统
|
||||
*/
|
||||
public static final String ACS_ID = "2";
|
||||
/**
|
||||
* acs系统
|
||||
*/
|
||||
public static final String ACS_NAME = "ACS系统";
|
||||
/**
|
||||
* mes系统
|
||||
*/
|
||||
public static final String MES_ID = "3";
|
||||
/**
|
||||
* mes系统
|
||||
*/
|
||||
public static final String MES_NAME = "MES系统";
|
||||
// 点位类型
|
||||
/**
|
||||
* 设备位
|
||||
*/
|
||||
public static final String DEVICE_POINT = "1";
|
||||
/**
|
||||
* 对接位
|
||||
*/
|
||||
public static final String DOCKING_POINT = "2";
|
||||
/**
|
||||
* 中转位
|
||||
*/
|
||||
public static final String TRANSIT_POSITION = "1";
|
||||
/**
|
||||
* 物料位
|
||||
*/
|
||||
public static final String MATERIAL_POINT = "2";
|
||||
/**
|
||||
* 检测位
|
||||
*/
|
||||
public static final String CHECK_POINT = "4";
|
||||
// 出入口
|
||||
/**
|
||||
* 入口
|
||||
**/
|
||||
public static final String ENTRANCE = "1";
|
||||
/**
|
||||
* 出口
|
||||
**/
|
||||
public static final String EXIT = "2";
|
||||
// 任务生产方式
|
||||
/**
|
||||
* 自动创建
|
||||
**/
|
||||
public static final String AUTO_CREATION = "1";
|
||||
/**
|
||||
* ACS创建
|
||||
**/
|
||||
public static final String ACS_CREATION = "2";
|
||||
// 请求方向
|
||||
/**
|
||||
* ACS->LMS
|
||||
**/
|
||||
public static final String ACS_LMS = "1";
|
||||
/**
|
||||
* LMS->ACS
|
||||
**/
|
||||
public static final String LMS_ACS = "2";
|
||||
/**
|
||||
* MES->LMS
|
||||
**/
|
||||
public static final String MES_LMS = "3";
|
||||
/**
|
||||
* LMS->MES
|
||||
**/
|
||||
public static final String LMS_MES = "4";
|
||||
// 区域定义
|
||||
/**
|
||||
* 料盅睏料线区域
|
||||
*/
|
||||
public static final String LZKLX = "LZKLX";
|
||||
/**
|
||||
* 干燥窑区域
|
||||
*/
|
||||
public static final String GZY = "GZY";
|
||||
public static final String LQY = "LQY";
|
||||
public static final String FJ = "FJ";
|
||||
// 特殊: 1-缓存输送线入口,2-缓存输送线出口,3-上输送线,4-下输送线
|
||||
/**
|
||||
* 上输送线
|
||||
*/
|
||||
public static final String UPPER_CONVEYOR_LINE = "3";
|
||||
/**
|
||||
* 下输送线
|
||||
*/
|
||||
public static final String LOWER_CONVEYOR_LINE = "4";
|
||||
// 参数名称
|
||||
/**
|
||||
* 是否连接
|
||||
*/
|
||||
public static final String IS_CONNECT_ACS = "is_connect_acs";
|
||||
/**
|
||||
* ACS路径
|
||||
*/
|
||||
public static final String ACS_URL = "acs_url";
|
||||
/**
|
||||
* 是否连接
|
||||
*/
|
||||
public static final String IS_CONNECT_MES = "is_connect_mes";
|
||||
/**
|
||||
* MES路径
|
||||
*/
|
||||
public static final String MES_URL = "mes_url";
|
||||
// 完成/取消
|
||||
/**
|
||||
* 任务完成
|
||||
*/
|
||||
public static final String TASK_FINISH = "任务完成";
|
||||
/**
|
||||
* 任务取消
|
||||
*/
|
||||
public static final String TASK_CANCEL = "任务取消";
|
||||
/**
|
||||
* 区域 - 分拣
|
||||
*/
|
||||
public static final String AREA_FJ = "FJ";
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.nl.common.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2023/5/25
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PointStatusEnum {
|
||||
/**
|
||||
* 空位/无货
|
||||
*/
|
||||
EMPTY_POINT("1", "空位/无货"),
|
||||
/**
|
||||
* 有料
|
||||
*/
|
||||
FULL_POINT("3", "有料"),
|
||||
/**
|
||||
* 空载具/有货
|
||||
*/
|
||||
EMPTY_VEHICLE("2", "空载具/有货");
|
||||
|
||||
private final String code;
|
||||
private final String label;
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public class AcsToWmsController {
|
||||
@Autowired
|
||||
private AcsToWmsService acsToWmsService;
|
||||
|
||||
@PostMapping("/status")
|
||||
@PostMapping("/task/status")
|
||||
@Log(value = "ACS给WMS反馈任务状态")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> receiveTaskStatusAcs(@RequestBody String string) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.ext_manage.util;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
@@ -54,7 +55,7 @@ public class AcsUtil {
|
||||
String url = acsUrlParam.getValue() + api;
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(param))
|
||||
.body(JSON.toJSONString(param))
|
||||
.execute().body();
|
||||
// 格式转换
|
||||
JSONObject result = JSONObject.parseObject(resultMsg);
|
||||
|
||||
@@ -36,6 +36,7 @@ public class BaseResponse implements Serializable {
|
||||
* 结果 200成功
|
||||
*/
|
||||
private int code;
|
||||
private int status;
|
||||
|
||||
/**
|
||||
* 信息
|
||||
|
||||
@@ -1521,7 +1521,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
|
||||
.eq(SchBasePoint::getVehicle_code, whereJson.getString("vehicle_code")));
|
||||
|
||||
if(schBasePointList.isEmpty()){
|
||||
return PdaResponse.requestOk();
|
||||
throw new BadRequestException("该托盘没有绑定到卸车区点位,请检查!");
|
||||
}
|
||||
|
||||
JSONObject outJson = new JSONObject();
|
||||
|
||||
@@ -174,7 +174,7 @@ public class PdaJBServiceImpl implements PdaJBService {
|
||||
}
|
||||
GroupPlate groupPlate = groupplateService.getOne(new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getStoragevehicle_code, outStructAttr.getStoragevehicle_code())
|
||||
.eq(GroupPlate::getStatus, "02"));
|
||||
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
|
||||
if (ObjectUtil.isEmpty(groupPlate)) {
|
||||
throw new BadRequestException("托盘[" + outStructAttr.getStoragevehicle_code() + "]组盘信息不存在!");
|
||||
}
|
||||
@@ -185,10 +185,10 @@ public class PdaJBServiceImpl implements PdaJBService {
|
||||
tableData.add(table);
|
||||
insertInvObj.put("stor_id", outStructAttr.getStor_id());
|
||||
insertInvObj.put("stor_code", outStructAttr.getStor_code());
|
||||
insertInvObj.put("bill_status", "10");
|
||||
insertInvObj.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
|
||||
insertInvObj.put("total_qty", workorder.getPlan_weight());
|
||||
insertInvObj.put("detail_count", 1);
|
||||
insertInvObj.put("bill_type", "1012");
|
||||
insertInvObj.put("bill_type", IOSEnum.BILL_TYPE.code("解包出库"));
|
||||
insertInvObj.put("biz_date", DateUtil.format(new Date(), "yyyy-MM-dd"));
|
||||
insertInvObj.put("tableData", tableData);
|
||||
table.put("turnout_struct_code", outStructAttr.getStruct_code());
|
||||
@@ -269,6 +269,10 @@ public class PdaJBServiceImpl implements PdaJBService {
|
||||
public PdaResponse getWeight(JSONObject whereJson) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String pointCode = whereJson.getString("point_code");
|
||||
SchBasePoint point = pointService.getById(pointCode);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
throw new BadRequestException("点位不存在!");
|
||||
}
|
||||
String workorder_id = whereJson.getString("workorder_id");
|
||||
Param param = sysParamService.findByCode(JB_STANDARD_ERROR);
|
||||
if (ObjectUtil.isEmpty(param)) {
|
||||
@@ -296,6 +300,7 @@ public class PdaJBServiceImpl implements PdaJBService {
|
||||
}
|
||||
res.put("org_weight", workorder.getPlan_weight());
|
||||
res.put("stand_error", param.getValue());
|
||||
res.put("vehicle_code", point.getVehicle_code());
|
||||
if (workorder.getPlan_weight().subtract(new BigDecimal(netWeight))
|
||||
.abs().compareTo(new BigDecimal(param.getValue().trim())) > 0) {
|
||||
res.put("flag", "2");
|
||||
@@ -705,7 +710,10 @@ public class PdaJBServiceImpl implements PdaJBService {
|
||||
if (groups.size() > 0) {
|
||||
GroupInfoPdaVo groupInfoPdaVo = groups.get(0);
|
||||
GroupPlate groupPlate = groupplateService.getById(groupInfoPdaVo.getGroup_id());
|
||||
MdMeMaterialbase materialbase = materialbaseService.getByCode(groupPlate.getMaterial_code(), true);
|
||||
MdMeMaterialbase materialbase = materialbaseService.getById(groupPlate.getMaterial_id());
|
||||
if (ObjectUtil.isEmpty(materialbase)) {
|
||||
throw new BadRequestException("物料不存在!");
|
||||
}
|
||||
MdPbStoragevehicleinfo vehicleVo = storagevehicleinfoService.getByCode(groupPlate.getStoragevehicle_code());
|
||||
if (ObjectUtil.isEmpty(vehicleVo)) {
|
||||
throw new BadRequestException("载具" + groupPlate.getStoragevehicle_code() + "不存在!");
|
||||
@@ -724,7 +732,7 @@ public class PdaJBServiceImpl implements PdaJBService {
|
||||
ioStorInv.setStor_code(structattr.getStor_code());
|
||||
ioStorInv.setStor_name(structattr.getStor_name());
|
||||
ioStorInv.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
ioStorInv.setBill_type("0009");
|
||||
ioStorInv.setBill_type(IOSEnum.BILL_TYPE.code("手工出库"));
|
||||
ioStorInv.setIs_delete(BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
ioStorInv.setIs_upload(BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
ioStorInv.setInput_optid(currentUserId);
|
||||
@@ -788,7 +796,6 @@ public class PdaJBServiceImpl implements PdaJBService {
|
||||
groupPlate.setUpdate_time(now);
|
||||
groupplateService.updateById(groupPlate);
|
||||
return PdaResponse.requestOk();
|
||||
// throw new BadRequestException("当前位置是满桶,无法取出,请确认库存信息!");
|
||||
}
|
||||
// 1.3 仓位赋值
|
||||
structattr.setStoragevehicle_code(null);
|
||||
@@ -819,7 +826,7 @@ public class PdaJBServiceImpl implements PdaJBService {
|
||||
.eq(MdPbRegionMember::getInto_member, nickname)
|
||||
.eq(MdPbRegionMember::getRecord_status, "1"), false);
|
||||
if (ObjectUtil.isNotEmpty(pbRegionMember)) {
|
||||
throw new BadRequestException("您已经记录进入该区域,请勿多次进入!");
|
||||
throw new BadRequestException("您已经记录进入该区域,请勿多次登记!");
|
||||
}
|
||||
MdPbRegionMember regionMember = new MdPbRegionMember();
|
||||
regionMember.setRecord_id(IdUtil.getStringId());
|
||||
|
||||
@@ -120,6 +120,7 @@ public class SchBaseTask implements Serializable {
|
||||
|
||||
|
||||
private String form_data_code;
|
||||
private Integer failures;
|
||||
|
||||
|
||||
private String update_time;
|
||||
|
||||
@@ -45,6 +45,8 @@ public abstract class AbstractTask {
|
||||
*/
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
@Autowired
|
||||
private TaskFactory taskFactory;
|
||||
|
||||
/**
|
||||
* 任务创建
|
||||
@@ -96,10 +98,12 @@ public abstract class AbstractTask {
|
||||
SchBaseTask task = taskList.get(0);
|
||||
List<SchBaseTask> nextTasks = taskList.stream()
|
||||
.filter(p -> p.getTask_group_id().equals(task.getTask_group_id())).collect(Collectors.toList());
|
||||
// todo: 获取空闲的车
|
||||
// 整理下发acs参数
|
||||
List<AcsTaskDto> taskDtoList = new ArrayList<>();
|
||||
for (SchBaseTask taskDao : nextTasks) {
|
||||
AcsTaskDto acsTaskDto = this.sendAcsParam(taskDao.getTask_id());
|
||||
AbstractTask task1 = taskFactory.getTask(taskDao.getConfig_code());
|
||||
AcsTaskDto acsTaskDto = task1.sendAcsParam(taskDao.getTask_id());
|
||||
taskDtoList.add(acsTaskDto);
|
||||
}
|
||||
// 下发
|
||||
@@ -134,7 +138,7 @@ public abstract class AbstractTask {
|
||||
resultForAcs.setMessage(e.getMessage());
|
||||
}
|
||||
// 如果下发完毕,就修改状态
|
||||
if (resultForAcs.getCode() == HttpStatus.HTTP_OK) {
|
||||
if (resultForAcs.getStatus() == HttpStatus.HTTP_OK) {
|
||||
// 查询所有任务
|
||||
List<SchBaseTask> taskList = taskService.list(
|
||||
new QueryWrapper<SchBaseTask>().lambda()
|
||||
@@ -148,6 +152,7 @@ public abstract class AbstractTask {
|
||||
JSONArray errArr = resultForAcs.getErrArr();
|
||||
for (SchBaseTask schBaseTask : taskList) {
|
||||
schBaseTask.setTask_status(TaskStatus.ISSUED.getCode());
|
||||
schBaseTask.setRemark("");
|
||||
// 判断是否是出错的任务
|
||||
for (int i = 0; ObjectUtil.isNotEmpty(errArr) && i < errArr.size(); i++) {
|
||||
JSONObject errObj = errArr.getJSONObject(i);
|
||||
@@ -155,6 +160,7 @@ public abstract class AbstractTask {
|
||||
if (taskCode.equals(schBaseTask.getTask_code())) {
|
||||
// 出错的任务就设置出错信息为备注,不是出错就设置下发
|
||||
schBaseTask.setTask_status(TaskStatus.CREATED.getCode());
|
||||
schBaseTask.setFailures(schBaseTask.getFailures() + 1);
|
||||
schBaseTask.setRemark(errObj.getString("message"));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,25 +1,19 @@
|
||||
package org.nl.wms.sch_manage.service.util;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
import org.nl.wms.system_manage.enums.TagNameEnum;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSConstant;
|
||||
import org.reflections.Reflections;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Slf4j
|
||||
@@ -27,6 +21,9 @@ import java.util.Set;
|
||||
@Order(value = 1)
|
||||
public class AutoTask {
|
||||
|
||||
@Resource
|
||||
private TaskHandle taskHandle;
|
||||
|
||||
private static Set<Class<? extends AbstractTask>> subTypes;
|
||||
|
||||
// 类加载时候执行扫描
|
||||
@@ -39,27 +36,7 @@ public class AutoTask {
|
||||
public void run() {
|
||||
MDC.put(TagNameEnum.TAG_NAME.getTag(), TagNameEnum.AUTO_TASK_SEND.getTag());
|
||||
log.info("定时器正在执行下发任务调度...");
|
||||
sendTask();
|
||||
taskHandle.schedule();
|
||||
log.info("定时器执行下发任务调度结束...");
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时下发任务
|
||||
*/
|
||||
private void sendTask() {
|
||||
subTypes.forEach(clz -> {
|
||||
// 调用AbstractAcsTask类的每个子类的schedule()方法
|
||||
try {
|
||||
Object obj = SpringContextHolder.getBean(clz);
|
||||
Method m = obj.getClass().getMethod("schedule");
|
||||
m.invoke(obj);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
log.info("定时器执行失败:{}", e.getTargetException().getMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.info("定时器执行失败:{}", e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.nl.wms.sch_manage.service.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 任务处理类
|
||||
* @author: lyd
|
||||
* @date: 2026/1/5
|
||||
*/
|
||||
@Component
|
||||
public class TaskHandle extends AbstractTask {
|
||||
@Override
|
||||
public String create(JSONObject json) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public AcsTaskDto sendAcsParam(String taskId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateStatus(String task_code, TaskStatus status) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceFinish(String task_code) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_code) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void backMes(String task_code) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -109,6 +109,7 @@ public class VehicleInTask extends AbstractTask {
|
||||
acsTaskDto.setStart_device_code(taskDao.getPoint_code1());
|
||||
acsTaskDto.setNext_device_code(taskDao.getPoint_code2());
|
||||
acsTaskDto.setPriority(taskDao.getPriority());
|
||||
acsTaskDto.setAgv_system_type("1");
|
||||
acsTaskDto.setTask_type("1");
|
||||
return acsTaskDto;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ public class JbBackAgvTask extends AbstractTask {
|
||||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC);
|
||||
}
|
||||
|
||||
private void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark("已完成");
|
||||
@@ -168,7 +168,7 @@ public class JbBackAgvTask extends AbstractTask {
|
||||
pointService.updateBatchById(Arrays.asList(emptyPoint, materialPoint));
|
||||
}
|
||||
|
||||
private void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 取消任务
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark("已取消");
|
||||
|
||||
@@ -134,7 +134,7 @@ public class JbDownAgvTask extends AbstractTask {
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 取消任务
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark("已取消");
|
||||
@@ -150,7 +150,7 @@ public class JbDownAgvTask extends AbstractTask {
|
||||
);
|
||||
}
|
||||
|
||||
private void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 任务完成
|
||||
taskObj.setRemark("该任务已完成,等待最后一条任务完成!");
|
||||
if ("1".equals(taskObj.getTask_group_seq().toString())) {
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDisMappe
|
||||
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
@@ -134,13 +135,15 @@ public class JbUpAgvTask extends AbstractTask {
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 取消任务
|
||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||
taskObj.setRemark("已取消");
|
||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||
taskService.updateById(taskObj);
|
||||
|
||||
// 点位解锁???
|
||||
|
||||
//分配表清除任务
|
||||
ioStorInvDisMapper.update(null, new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getTask_id, null)
|
||||
@@ -151,7 +154,8 @@ public class JbUpAgvTask extends AbstractTask {
|
||||
);
|
||||
}
|
||||
|
||||
private void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||
// 任务完成
|
||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||
taskObj.setRemark("已完成");
|
||||
@@ -171,6 +175,31 @@ public class JbUpAgvTask extends AbstractTask {
|
||||
}
|
||||
// 获取托盘数据
|
||||
MdPbStoragevehicleinfo v1 = storagevehicleinfoService.getByCode(taskObj.getVehicle_code());
|
||||
String pointCode;
|
||||
if (ObjectUtil.isNotEmpty(taskObj.getPoint_code3())) {
|
||||
// 空进满出
|
||||
pointCode = taskObj.getPoint_code1();
|
||||
// 获取托盘数据
|
||||
MdPbStoragevehicleinfo v2 = storagevehicleinfoService.getByCode(taskObj.getVehicle_code2());
|
||||
|
||||
// 仓位设置空托盘
|
||||
structattrService.update(new LambdaUpdateWrapper<Structattr>()
|
||||
.set(Structattr::getStoragevehicle_code, taskObj.getVehicle_code2())
|
||||
.set(Structattr::getStoragevehicle_type, ObjectUtil.isNotEmpty(v2) ? v2.getStoragevehicle_type() : "")
|
||||
.set(Structattr::getOccupancy_state, 2)
|
||||
.eq(Structattr::getStruct_code, taskObj.getPoint_code2()));
|
||||
// 仓位设置空
|
||||
structattrService.update(new LambdaUpdateWrapper<Structattr>()
|
||||
.set(Structattr::getOccupancy_state, 1)
|
||||
.eq(Structattr::getStruct_code, taskObj.getPoint_code3()));
|
||||
} else {
|
||||
// 满出
|
||||
pointCode = taskObj.getPoint_code2();
|
||||
// 仓位设置空
|
||||
structattrService.update(new LambdaUpdateWrapper<Structattr>()
|
||||
.set(Structattr::getOccupancy_state, 1)
|
||||
.eq(Structattr::getStruct_code, taskObj.getPoint_code1()));
|
||||
}
|
||||
// 点位设置值
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
|
||||
@@ -180,31 +209,7 @@ public class JbUpAgvTask extends AbstractTask {
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code2()));
|
||||
if (ObjectUtil.isNotEmpty(taskObj.getPoint_code3())) {
|
||||
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
|
||||
.set(SchBasePoint::getVehicle_code, "")
|
||||
.set(SchBasePoint::getIng_task_code, null)
|
||||
.set(SchBasePoint::getPoint_status, "1")
|
||||
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
|
||||
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
|
||||
.set(SchBasePoint::getUpdate_time, DateUtil.now())
|
||||
.eq(SchBasePoint::getPoint_code, taskObj.getPoint_code3()));
|
||||
// 获取托盘数据
|
||||
MdPbStoragevehicleinfo v2 = storagevehicleinfoService.getByCode(taskObj.getVehicle_code2());
|
||||
|
||||
// 仓位设置空托盘
|
||||
structattrService.update(new LambdaUpdateWrapper<Structattr>()
|
||||
.set(Structattr::getStoragevehicle_code, taskObj.getVehicle_code2())
|
||||
.set(Structattr::getStoragevehicle_type, ObjectUtil.isNotEmpty(v2) ? v2.getStoragevehicle_type() : "")
|
||||
.set(Structattr::getOccupancy_state, 2)
|
||||
.eq(Structattr::getStruct_code, taskObj.getPoint_code4()));
|
||||
} else {
|
||||
// 仓位设置空
|
||||
structattrService.update(new LambdaUpdateWrapper<Structattr>()
|
||||
.set(Structattr::getOccupancy_state, 1)
|
||||
.eq(Structattr::getStruct_code, taskObj.getPoint_code4()));
|
||||
}
|
||||
.eq(SchBasePoint::getPoint_code, pointCode));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.system_manage.service.quartz.config;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.wms.system_manage.service.quartz.ISysQuartzJobService;
|
||||
import org.nl.wms.system_manage.service.quartz.dao.SysQuartzJob;
|
||||
import org.nl.wms.system_manage.service.quartz.utils.QuartzManage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -10,6 +11,8 @@ import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 项目启动时重新激活启用的定时任务
|
||||
@@ -33,5 +36,9 @@ public class JobRunner implements ApplicationRunner {
|
||||
*/
|
||||
@Override
|
||||
public void run(ApplicationArguments applicationArguments) {
|
||||
log.info("--------------------注入定时任务---------------------");
|
||||
List<SysQuartzJob> quartzJobs = quartzJobService.findByIsPauseIsFalse();
|
||||
quartzJobs.forEach(quartzManage::addJob);
|
||||
log.info("--------------------定时任务注入完成---------------------");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.yomahub.tlog.task.quartz.TLogQuartzJobBean;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.nl.common.utils.RedisUtils;
|
||||
import org.nl.common.utils.ThrowableUtil;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.wms.system_manage.service.quartz.ISysQuartzJobService;
|
||||
import org.nl.wms.system_manage.service.quartz.dao.SysQuartzJob;
|
||||
@@ -14,6 +15,7 @@ import org.nl.wms.system_manage.service.quartz.impl.SysQuartzJobServiceImpl;
|
||||
import org.quartz.DisallowConcurrentExecution;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||
@@ -36,10 +38,11 @@ public class ExecutionJob extends TLogQuartzJobBean {
|
||||
/**
|
||||
* 该处仅供参考
|
||||
*/
|
||||
@Resource
|
||||
@Autowired
|
||||
@Qualifier("threadPoolExecutor")
|
||||
private ThreadPoolExecutor EXECUTOR;
|
||||
|
||||
|
||||
@Override
|
||||
public void executeTask(JobExecutionContext context) throws JobExecutionException {
|
||||
SysQuartzJob quartzJob = (SysQuartzJob) context.getMergedJobDataMap().get(SysQuartzJob.JOB_KEY);
|
||||
@@ -51,7 +54,7 @@ public class ExecutionJob extends TLogQuartzJobBean {
|
||||
String uuid = quartzJob.getUuid();
|
||||
|
||||
SysQuartzLog logDto = new SysQuartzLog();
|
||||
logDto.setLog_id(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
logDto.setLog_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||
logDto.setJob_name(quartzJob.getJob_name());
|
||||
logDto.setBean_name(quartzJob.getBean_name());
|
||||
logDto.setMethod_name(quartzJob.getMethod_name());
|
||||
@@ -60,6 +63,8 @@ public class ExecutionJob extends TLogQuartzJobBean {
|
||||
logDto.setCron_expression(quartzJob.getCron_expression());
|
||||
try {
|
||||
// 执行任务
|
||||
System.out.println("--------------------------------------------------------------");
|
||||
System.out.println("任务开始执行,任务名称:" + quartzJob.getJob_name());
|
||||
QuartzRunnable task = new QuartzRunnable(quartzJob.getBean_name(), quartzJob.getMethod_name(),
|
||||
quartzJob.getParams());
|
||||
Future<?> future = EXECUTOR.submit(task);
|
||||
@@ -71,6 +76,8 @@ public class ExecutionJob extends TLogQuartzJobBean {
|
||||
}
|
||||
// 任务状态
|
||||
logDto.setIs_success(true);
|
||||
System.out.println("任务执行完毕,任务名称:" + quartzJob.getJob_name() + ", 执行时间:" + times + "毫秒");
|
||||
System.out.println("--------------------------------------------------------------");
|
||||
// 判断是否存在子任务
|
||||
if (StrUtil.isNotEmpty(quartzJob.getSub_task())) {
|
||||
String[] tasks = quartzJob.getSub_task().split("[,,]");
|
||||
@@ -81,11 +88,13 @@ public class ExecutionJob extends TLogQuartzJobBean {
|
||||
if (StrUtil.isNotEmpty(uuid)) {
|
||||
redisUtils.set(uuid, false);
|
||||
}
|
||||
System.out.println("任务执行失败,任务名称:" + quartzJob.getJob_name());
|
||||
System.out.println("--------------------------------------------------------------");
|
||||
long times = System.currentTimeMillis() - startTime;
|
||||
logDto.setTime(times);
|
||||
// 任务状态 0:成功 1:失败
|
||||
logDto.setIs_success(false);
|
||||
logDto.setException_detail(e.getMessage());
|
||||
logDto.setException_detail(ThrowableUtil.getStackTrace(e));
|
||||
// 任务如果失败了则暂停
|
||||
if (quartzJob.getPause_after_failure() != null && quartzJob.getPause_after_failure()) {
|
||||
quartzJob.setIs_pause(false);
|
||||
@@ -93,7 +102,7 @@ public class ExecutionJob extends TLogQuartzJobBean {
|
||||
quartzJobService.updateIsPause(quartzJob);
|
||||
}
|
||||
//异常时候打印日志
|
||||
log.error(logDto.toString());
|
||||
log.info(logDto.toString());
|
||||
quartzLogMapper.insert(logDto);
|
||||
} finally {
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public enum IOSEnum {
|
||||
BILL_STATUS(MapOf.of("生成", "10", "分配中", "20", "分配完", "30", "完成", "99")),
|
||||
|
||||
// 入库业务类型
|
||||
BILL_TYPE(MapOf.of("生产入库", "0001", "手工入库", "0009")),
|
||||
BILL_TYPE(MapOf.of("生产入库", "0001", "手工入库", "0009", "手工出库", "1009", "解包出库", "1012")),
|
||||
|
||||
//入库分配明细状态
|
||||
INBILL_DIS_STATUS(MapOf.of("未生成", "00", "生成", "01", "执行中", "02", "完成", "99")),
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.enums.PointStatusEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
@@ -22,6 +23,7 @@ import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper;
|
||||
import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto;
|
||||
import org.nl.wms.basedata_manage.service.dto.StrategyStructMaterialVO;
|
||||
@@ -40,6 +42,7 @@ import org.nl.wms.sch_manage.service.util.tasks.zw.DownEmptyUpFullTask;
|
||||
import org.nl.wms.sch_manage.service.util.tasks.zw.SeparateMaterialTask;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.IInBillService;
|
||||
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.IOutBillService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
@@ -113,6 +116,8 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
|
||||
@Autowired
|
||||
private DownEmptyUpFullTask downEmptyUpFullTask;
|
||||
@Resource
|
||||
private IInBillService inBillService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -974,18 +979,14 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
}
|
||||
String task_id = "";
|
||||
for (IOStorInvDis ioStorInvDis:ioStorInvDisList){
|
||||
if ("1012".equals(ioStorInv.getBill_type())) {
|
||||
if (IOSEnum.BILL_TYPE.code("解包出库").equals(ioStorInv.getBill_type())) {
|
||||
// 解包需要单独操作
|
||||
SchBasePoint ckPoint = pointService.getById(point_code);
|
||||
SchBasePoint outPointP = pointService.getById(ckPoint.getParent_point_code());
|
||||
SchBasePoint inPoint = pointService.getNotTaskByDeviceAndType(outPointP.getPoint_code(), "3");
|
||||
SchBasePoint outPoint = pointService.getNotTaskByDeviceAndType(outPointP.getPoint_code(), "4");
|
||||
if (ObjectUtil.isEmpty(inPoint) || ObjectUtil.isEmpty(outPoint)) {
|
||||
if (ObjectUtil.isEmpty(inPoint)) {
|
||||
throw new BadRequestException("解包机输送线点位不存在或者存在任务!");
|
||||
}
|
||||
if (!"1".equals(inPoint.getPoint_status())) {
|
||||
throw new BadRequestException("原料进对接位状态不为空位,请检查确认!");
|
||||
}
|
||||
JSONObject task_form = new JSONObject();
|
||||
task_form.put("task_type", "JbUpAgvTask");
|
||||
task_form.put("order_id", whereJson.getString("order_id"));
|
||||
@@ -993,18 +994,39 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
task_form.put("point_code1", ioStorInvDis.getStruct_code());
|
||||
task_form.put("point_code2", inPoint.getPoint_code());
|
||||
task_form.put("vehicle_code", ioStorInvDis.getStoragevehicle_code());
|
||||
if ("2".equals(outPoint.getPoint_status())) {
|
||||
if (PointStatusEnum.FULL_POINT.getCode().equals(inPoint.getPoint_status())) {
|
||||
Structattr structattr = iStructattrService.getByCode(ioStorInvDis.getStruct_code());
|
||||
// 找一个空点位
|
||||
JSONObject getPointObj = new JSONObject();
|
||||
getPointObj.put("ioType", IOSEnum.IO_TYPE.code("入库"));
|
||||
getPointObj.put("sect_code", ioStorInvDis.getSect_code());
|
||||
getPointObj.put("stor_code", structattr.getStor_code());
|
||||
getPointObj.put("qty", 0);
|
||||
getPointObj.put("material_code", "-");
|
||||
getPointObj.put("is_empty_vehicle", "1");
|
||||
Structattr attrDao = inBillService.getStructattr(getPointObj);
|
||||
// 四点任务
|
||||
task_form.put("point_code3", outPoint.getPoint_code());
|
||||
task_form.put("point_code4", ioStorInvDis.getStruct_code());
|
||||
task_form.put("vehicle_code2", outPoint.getVehicle_code());
|
||||
task_form.put("point_code3", ioStorInvDis.getStruct_code());
|
||||
task_form.put("point_code4", inPoint.getPoint_code());
|
||||
task_form.put("point_code1", inPoint.getPoint_code());
|
||||
task_form.put("point_code2", attrDao.getStruct_code());
|
||||
task_form.put("vehicle_code2", inPoint.getVehicle_code());
|
||||
}
|
||||
task_id = jbUpAgvTask.create(task_form);
|
||||
inPoint.setIng_task_code(task_id);
|
||||
if ("2".equals(outPoint.getPoint_status())) {
|
||||
outPoint.setIng_task_code(task_id);
|
||||
if (PointStatusEnum.FULL_POINT.getCode().equals(inPoint.getPoint_status())) {
|
||||
inPoint.setIng_task_code(task_id);
|
||||
// 更新终点锁定状态
|
||||
JSONObject lock_map = new JSONObject();
|
||||
lock_map.put("struct_code", task_form.getString("point_code2"));
|
||||
lock_map.put("inv_id", null);
|
||||
lock_map.put("inv_code", null);
|
||||
lock_map.put("inv_type", null);
|
||||
lock_map.put("taskdtl_id", task_id);
|
||||
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("入库锁"));
|
||||
iStructattrService.updateStatusByCode("0", lock_map);
|
||||
}
|
||||
pointService.updateBatchById(Arrays.asList(inPoint, outPoint));
|
||||
pointService.updateById(inPoint);
|
||||
} else if (StatusEnum.IOBILL_TYPE_OUT.code("单独上料出库").equals(ioStorInv.getBill_type())) {
|
||||
// 单独上料出库,这个业务中 point_code2是出库点位
|
||||
point_code = whereJson.getString("point_code2");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
server:
|
||||
port: 8011
|
||||
port: 9999
|
||||
#配置数据源
|
||||
spring:
|
||||
main:
|
||||
@@ -9,12 +9,12 @@ spring:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://${DB_HOST:192.168.81.251}:${DB_PORT:3306}/${DB_NAME:zzzw_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
# url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:zzzw_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:zzzw_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
# url: jdbc:mysql://${DB_HOST:10.37.84.130}:${DB_PORT:3306}/${DB_NAME:zzzw_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:P@ssw0rd.}
|
||||
# password: ${DB_PWD:P@ssw0rd.}
|
||||
# password: ${DB_PWD:123456}
|
||||
# password: ${DB_PWD:12356}
|
||||
password: ${DB_PWD:12356}
|
||||
# 初始连接数
|
||||
initial-size: 15
|
||||
# 最小连接数
|
||||
@@ -57,7 +57,7 @@ spring:
|
||||
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:1}
|
||||
database: ${REDIS_DB:5}
|
||||
#host: ${REDIS_HOST:127.0.0.1}
|
||||
host: ${REDIS_HOST:localhost}
|
||||
port: ${REDIS_PORT:6379}
|
||||
|
||||
Reference in New Issue
Block a user