|
@@ -1,18 +1,16 @@
|
|
|
package com.ruoyi.ams.task.service.impl;
|
|
|
|
|
|
import java.lang.reflect.Method;
|
|
|
-import java.rmi.ServerException;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.extra.spring.SpringUtil;
|
|
|
import com.ruoyi.ams.agv.ndc.domain.AmsTask;
|
|
|
-import com.ruoyi.ams.agv.ndc.entity.CallbackResult;
|
|
|
import com.ruoyi.ams.agv.ndc.service.IAmsTaskService;
|
|
|
import com.ruoyi.ams.box.service.IWmsBoxInfoService;
|
|
|
import com.ruoyi.ams.config.domain.FlowConfigEvent;
|
|
|
import com.ruoyi.ams.config.service.IFlowConfigEventService;
|
|
|
-import com.ruoyi.ams.inv.domain.InvLotAtt;
|
|
|
import com.ruoyi.ams.inv.domain.InvLotLocId;
|
|
|
import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
|
|
|
import com.ruoyi.ams.inv.service.IInvLotAttService;
|
|
@@ -20,6 +18,7 @@ import com.ruoyi.ams.inv.service.IInvLotLocIdService;
|
|
|
import com.ruoyi.ams.task.dto.WcsTaskLocationDTO;
|
|
|
import com.ruoyi.base.constant.Constant;
|
|
|
import com.ruoyi.base.domain.BaseLocationInfo;
|
|
|
+import com.ruoyi.common.core.domain.DeviceLog;
|
|
|
import com.ruoyi.base.service.IBaseLocationInfoService;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.core.redis.RedisCache;
|
|
@@ -407,15 +406,19 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
|
|
|
//叠包机
|
|
|
if ("PM_L".equals(wcsTask.getTaskType().substring(0, 4))) {
|
|
|
plcConnectServiceRunner.getPlcServer(PLCConnectNameEnum.STACKING_MACHINE.getMetadata()).writeBoolean(PLCEnum.STACKING_MACHINE_FEEDING_FINISH.getMetadata(), true);
|
|
|
+ SpringUtil.getApplicationContext().publishEvent(new DeviceLog(PLCConnectNameEnum.STACKING_MACHINE.getMetadata(),PLCConnectNameEnum.STACKING_MACHINE.getMetaName(),"任务完成修改PLC数值,地址:"+PLCEnum.STACKING_MACHINE_FEEDING_FINISH.getMetadata()+"值:true","1"));
|
|
|
}
|
|
|
if (wcsTask.getTaskType().equals(Constant.FLOW_CONFIG_ID.PM_UP_1.name())) {
|
|
|
plcConnectServiceRunner.getPlcServer(PLCConnectNameEnum.PACKING_MACHINE_1.getMetadata()).writeBoolean(PLCEnum.PACKING_MACHINE_UP_EMPTY_Leave_1.getMetadata(), true);
|
|
|
+ SpringUtil.getApplicationContext().publishEvent(new DeviceLog(PLCConnectNameEnum.PACKING_MACHINE_1.getMetadata(),PLCConnectNameEnum.PACKING_MACHINE_1.getMetaName(),"任务完成修改PLC数值,地址:"+PLCEnum.PACKING_MACHINE_UP_EMPTY_Leave_1.getMetadata()+"值:true","1"));
|
|
|
}
|
|
|
if (wcsTask.getTaskType().equals(Constant.FLOW_CONFIG_ID.PM_UP_2.name())) {
|
|
|
plcConnectServiceRunner.getPlcServer(PLCConnectNameEnum.PACKING_MACHINE_2.getMetadata()).writeBoolean(PLCEnum.PACKING_MACHINE_UP_EMPTY_Leave_2.getMetadata(), true);
|
|
|
+ SpringUtil.getApplicationContext().publishEvent(new DeviceLog(PLCConnectNameEnum.PACKING_MACHINE_2.getMetadata(),PLCConnectNameEnum.PACKING_MACHINE_2.getMetaName(),"任务完成修改PLC数值,地址:"+PLCEnum.PACKING_MACHINE_UP_EMPTY_Leave_2.getMetadata()+"值:true","1"));
|
|
|
}
|
|
|
if (wcsTask.getTaskType().equals(Constant.FLOW_CONFIG_ID.PM_UP_3.name())) {
|
|
|
- plcConnectServiceRunner.getPlcServer(PLCConnectNameEnum.PACKING_MACHINE_2.getMetadata()).writeBoolean(PLCEnum.PACKING_MACHINE_UP_EMPTY_Leave_3.getMetadata(), true);
|
|
|
+ plcConnectServiceRunner.getPlcServer(PLCConnectNameEnum.PACKING_MACHINE_3.getMetadata()).writeBoolean(PLCEnum.PACKING_MACHINE_UP_EMPTY_Leave_3.getMetadata(), true);
|
|
|
+ SpringUtil.getApplicationContext().publishEvent(new DeviceLog(PLCConnectNameEnum.PACKING_MACHINE_3.getMetadata(),PLCConnectNameEnum.PACKING_MACHINE_3.getMetaName(),"任务完成修改PLC数值,地址:"+PLCEnum.PACKING_MACHINE_UP_EMPTY_Leave_3.getMetadata()+"值:true","1"));
|
|
|
}
|
|
|
break;
|
|
|
case 3:
|
|
@@ -436,18 +439,17 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
|
|
|
, Constant.WAREHOUSE_ID, updateBy);
|
|
|
// 将起始点库存移动到中间缓存位
|
|
|
moveStartingPointToMiddleCache(wcsTask);
|
|
|
- //释放redis锁
|
|
|
- if (!StringUtils.isEmpty(wcsTask.getExt8())) {
|
|
|
- redisCache.unlockCacheObject(Long.parseLong(wcsTask.getExt8()), wcsTask.getLocationFrom());
|
|
|
- }
|
|
|
if (wcsTask.getTaskType().equals(Constant.FLOW_CONFIG_ID.PM_L_1.name())) {
|
|
|
plcConnectServiceRunner.getPlcServer(PLCConnectNameEnum.PACKING_MACHINE_1.getMetadata()).writeBoolean(PLCEnum.PACKING_MACHINE_UNLOADING_Leave_1.getMetadata(), true);
|
|
|
+ SpringUtil.getApplicationContext().publishEvent(new DeviceLog(PLCConnectNameEnum.PACKING_MACHINE_1.getMetadata(),PLCConnectNameEnum.PACKING_MACHINE_1.getMetaName(),"取货完成修改PLC数值,地址:"+PLCEnum.PACKING_MACHINE_UNLOADING_Leave_1.getMetadata()+"值:true","1"));
|
|
|
}
|
|
|
if (wcsTask.getTaskType().equals(Constant.FLOW_CONFIG_ID.PM_L_2.name())) {
|
|
|
plcConnectServiceRunner.getPlcServer(PLCConnectNameEnum.PACKING_MACHINE_2.getMetadata()).writeBoolean(PLCEnum.PACKING_MACHINE_UNLOADING_Leave_2.getMetadata(), true);
|
|
|
+ SpringUtil.getApplicationContext().publishEvent(new DeviceLog(PLCConnectNameEnum.PACKING_MACHINE_2.getMetadata(),PLCConnectNameEnum.PACKING_MACHINE_2.getMetaName(),"取货完成修改PLC数值,地址:"+PLCEnum.PACKING_MACHINE_UNLOADING_Leave_2.getMetadata()+"值:true","1"));
|
|
|
}
|
|
|
if (wcsTask.getTaskType().equals(Constant.FLOW_CONFIG_ID.PM_L_3.name())) {
|
|
|
plcConnectServiceRunner.getPlcServer(PLCConnectNameEnum.PACKING_MACHINE_3.getMetadata()).writeBoolean(PLCEnum.PACKING_MACHINE_UNLOADING_Leave_3.getMetadata(), true);
|
|
|
+ SpringUtil.getApplicationContext().publishEvent(new DeviceLog(PLCConnectNameEnum.PACKING_MACHINE_3.getMetadata(),PLCConnectNameEnum.PACKING_MACHINE_3.getMetaName(),"取货完成修改PLC数值,地址:"+PLCEnum.PACKING_MACHINE_UNLOADING_Leave_3.getMetadata()+"值:true","1"));
|
|
|
}
|
|
|
break;
|
|
|
case 5:
|
|
@@ -484,8 +486,6 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
|
|
|
baseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationFrom()), Long.parseLong(wcsTask.getLocationTo())
|
|
|
, Constant.WAREHOUSE_ID, updateBy);
|
|
|
}
|
|
|
- // 取消任务删除中间缓存库存
|
|
|
-// cancelTaskDelMiddleCache(wcsTask);
|
|
|
break;
|
|
|
case 8:
|
|
|
log.error("任务异常状态------------" + wcsTask.getTaskNo());
|
|
@@ -496,6 +496,7 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
|
|
|
} catch (Exception e) {
|
|
|
log.info(wcsTask.getTaskNo() + "-----" + "回调状态:" + state + "异常", e);
|
|
|
wcsTask.setRemark("回调状态:" + state + "异常");
|
|
|
+ SpringUtil.getApplicationContext().publishEvent(new DeviceLog(wcsTask.getTaskNo(),"AGV","任务失败,发生异常:"+e.getMessage(),"2"));
|
|
|
throw new RuntimeException();
|
|
|
}
|
|
|
} else {
|