diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/wcs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index 652a45a9..d0c992d9 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/wcs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java @@ -2,8 +2,6 @@ package org.nl.acs.agv.server.impl; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.AcsConfig; @@ -11,27 +9,20 @@ import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.agv.server.dto.AgvDto; import org.nl.acs.auto.run.NDCSocketConnectionAutoRun; import org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun; -import org.nl.acs.auto.run.TwoNDC2SocketConnectionAutoRun; -import org.nl.acs.auto.run.TwoNDCSocketConnectionAutoRun; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.impl.DeviceServiceImpl; import org.nl.acs.ext.wms.service.AcsToWmsService; -import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.log.LokiLog; import org.nl.acs.log.LokiLogType; import org.nl.acs.log.service.DeviceExecuteLogService; -import org.nl.acs.opc.Device; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppServiceImpl; -import org.nl.acs.opc.DeviceType; -import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.system.service.ParamService; import org.nl.modules.wql.util.SpringContextHolder; import org.springframework.stereotype.Service; import java.util.HashMap; -import java.util.List; import java.util.Map; @Slf4j @@ -72,17 +63,10 @@ public class NDCAgvServiceImpl implements NDCAgvService { (byte) indexhigh, (byte) indexlow, }; log.info("下发删除AGV指令--{}", Bytes2HexString(b)); - - - if (StrUtil.equals(inst.getAgv_system_type(),"1")){ - OneNDCSocketConnectionAutoRun.write(b); - } else if (StrUtil.equals(inst.getAgv_system_type(),"2")){ - TwoNDCSocketConnectionAutoRun.write(b); - } else if (StrUtil.equals(inst.getAgv_system_type(),"3")){ - TwoNDC2SocketConnectionAutoRun.write(b); + if (ObjectUtil.isNotEmpty(b)){ + NDCSocketConnectionAutoRun.write(b); + System.out.println("下发删除agv指令数据:" + Bytes2HexString(b)); } - - System.out.println("下发删除agv指令数据:" + Bytes2HexString(b)); } } @@ -194,11 +178,11 @@ public class NDCAgvServiceImpl implements NDCAgvService { log.info("下发AGV作业指令--{}", str); log.info("下发agv指令数据--{}", Bytes2HexString(b)); - if (StrUtil.equals(agv_system_type,"2")){ - TwoNDCSocketConnectionAutoRun.write(b); - } else if (StrUtil.equals(agv_system_type,"3")){ - TwoNDC2SocketConnectionAutoRun.write(b); - } +// if (StrUtil.equals(agv_system_type,"2")){ +// TwoNDCSocketConnectionAutoRun.write(b); +// } else if (StrUtil.equals(agv_system_type,"3")){ +// TwoNDC2SocketConnectionAutoRun.write(b); +// } } else { String instcode = inst.getInstruction_code(); diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDC2SocketConnectionAutoRun.java b/wcs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDC2SocketConnectionAutoRun.java deleted file mode 100644 index c79eaa70..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDC2SocketConnectionAutoRun.java +++ /dev/null @@ -1,243 +0,0 @@ -package org.nl.acs.auto.run; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.AcsConfig; -import org.nl.acs.agv.server.NDCAgvService; -import org.nl.acs.device.service.DeviceService; -import org.nl.acs.device_driver.basedriver.agv.ndctwo.AgvNdcTwoDeviceDriver; -import org.nl.acs.ext.wms.service.AcsToWmsService; -import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; -import org.nl.acs.instruction.service.impl.InstructionServiceImpl; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceAppService; -import org.nl.modules.system.service.ParamService; -import org.nl.modules.system.service.impl.ParamServiceImpl; -import org.nl.modules.wql.util.SpringContextHolder; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.net.Socket; -import java.util.Date; - -import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString; - - -@Slf4j -@Component -public class TwoNDC2SocketConnectionAutoRun extends AbstractAutoRunnable { - - Socket s; - String ip = "192.168.46.225"; - int port = 1234; - static DataOutputStream dos; - static DataInputStream dis; - private int recordTimeOut = 10000; - private Date recordTime; - String[] ERROR = new String[]{ - "货叉尖部传感器触发", "S300传感器触发", "载货状态改变", "急停按钮触发", "触边开关出发", "需要复位", - "停在充电位", "取货失败", "放货失败", "轮子打滑", "没有动作码不能进入站点", "取货时有货", "丢失定位", - "抬叉停止"}; - boolean bConnected = true; - - boolean isReConnect = false; - - @Autowired - ParamService paramService; - @Autowired - AutoRunService autoRunService; - - - public TwoNDC2SocketConnectionAutoRun() { - this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut); - } - - public String getCode() { - return TwoNDC2SocketConnectionAutoRun.class.getSimpleName(); - } - - public String getName() { - return "2楼2区域AGV系统"; - } - - public void autoRun() { - - try { - System.out.println("2楼2区域AGV系统链接开始"); - ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class); - InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class); - AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); - NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class); - DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); - DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); - ip = paramService.findByCode(AcsConfig.AGVURL22).getValue(); - port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT22).getValue()); - byte[] b = new byte[1028]; - s = new Socket(ip, port); - System.out.println("2楼2区域AGV链接成功"); - dos = new DataOutputStream(s.getOutputStream()); - dis = new DataInputStream(s.getInputStream()); - - while (bConnected) { - int count = dis.read(b); - - if (count == -1) { - break; - } - - int[] arr = new int[count]; - StringBuffer bs = new StringBuffer(); - - for (int i = 0; i < count; i++) { - int temp = b[i]; - if (temp < 0) - temp += 256; - arr[i] = temp; - StringBuffer bs1 = new StringBuffer("0"); - bs.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp)); - } - - System.out.println("收到请求参数:" + bs); - boolean flag = false; - if (arr[8] * 256 + arr[9] == 0x73) { - byte[] data = null; - System.out.println("接收agv上报信息:" + bs); - //执行阶段 - int phase = arr[16] * 256 + arr[17]; - // agv任务号 - int index = arr[12] * 256 + arr[13]; - //任务号 - int ikey = arr[26] * 256 + arr[27]; - //站点号 - int agvaddr = arr[18] * 256 + arr[19]; - //车号 - int carno = arr[20]; - Instruction inst = null; - if (ikey != 0) { - inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); - } - log.info("接收agv上报信息:" + bs); - log.info("接收agv上报信息:" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno); - Device device = null; - String device_code = null; - String old_device_code = null; - String emptyNum = null; - if (agvaddr != 0) { - old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); - if (StrUtil.contains(old_device_code, "-")) { - String[] point = old_device_code.split("-"); - device_code = point[0]; - } else if (StrUtil.contains(old_device_code, ".")) { - String[] point = old_device_code.split("\\."); - device_code = point[0]; - emptyNum = point[1]; - } else { - device_code = old_device_code; - } - device = deviceAppService.findDeviceByCode(device_code); - } - - AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver; - //开始任务 - if (phase == 0x01) { - if (!ObjectUtil.isEmpty(inst)) { - inst.setInstruction_status("1"); - inst.setAgv_jobno(String.valueOf(index)); - inst.setSend_status("1"); - instructionService.update(inst); - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } - flag = true; - } - //任务完毕 - //(无车id及状态) - else if (phase == 0x14) { - if (ObjectUtil.isEmpty(inst)) { - log.info("未找到指令号{}对应的指令", ikey); - break; - } - inst.setInstruction_status("2"); - instructionService.finish(inst); - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } - //请求删除任务 - //(需要WCS反馈) - else if (phase == 0x30) { - if (ObjectUtil.isEmpty(inst)) { - log.info("未找到指令号{}对应的指令", ikey); - break; - } - data = ndcAgvService.sendAgvTwoModeInst(0x8F, index, 0); - } - //任务删除确认 - //(需要WCS反馈) - else if (phase == 0xFF) { - if (ObjectUtil.isEmpty(inst)) { - log.info("未找到指令号{}对应的指令", ikey); - break; - } - instructionService.cancelNOSendAgv(inst.getInstruction_id()); - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else { - //上报异常信息 - //(不需要WCS反馈) - if(phase == 0x67){ - device = deviceAppService.findDeviceByCode(Integer.toString(arr[27])); - } else { - device = deviceAppService.findDeviceByCode(Integer.toString(arr[20])); - } - if (device.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) { - agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) device.getDeviceDriver(); - agvNdcTwoDeviceDriver.processSocket(arr); - } - } - if (!ObjectUtil.isEmpty(data)) { - write(data); - } - - } else { - System.out.println("agv上报不是0073类型动作,不处理"); - } - } - - } catch (Exception e) { - - - } finally { - - - } - - } - - - @Override - public void stop() { - super.after(); - try { - s.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - - public static void write(byte[] b) { - try { - log.info("下发agv数据:" + Bytes2HexString(b)); - System.out.println("下发agv数据:" + Bytes2HexString(b)); - dos.write(b); - dos.flush(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java b/wcs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java deleted file mode 100644 index 3e039c69..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.nl.acs.auto.run; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.AcsConfig; -import org.nl.acs.agv.server.NDCAgvService; -import org.nl.acs.device.service.DeviceService; -import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver; -import org.nl.acs.device_driver.basedriver.agv.ndctwo.AgvNdcTwoDeviceDriver; -import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver; -import org.nl.acs.ext.wms.service.AcsToWmsService; -import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; -import org.nl.acs.instruction.service.impl.InstructionServiceImpl; -import org.nl.acs.log.service.DeviceExecuteLogService; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceAppService; -import org.nl.modules.system.service.ParamService; -import org.nl.modules.system.service.impl.ParamServiceImpl; -import org.nl.modules.wql.util.SpringContextHolder; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.net.Socket; -import java.util.Date; -import java.util.List; - -import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString; - - -@Slf4j -@Component -public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { - - Socket s; - String ip = "192.168.46.225"; - int port = 1234; - static DataOutputStream dos; - static DataInputStream dis; - private int recordTimeOut = 10000; - private Date recordTime; - String[] ERROR = new String[]{ - "货叉尖部传感器触发", "S300传感器触发", "载货状态改变", "急停按钮触发", "触边开关出发", "需要复位", - "停在充电位", "取货失败", "放货失败", "轮子打滑", "没有动作码不能进入站点", "取货时有货", "丢失定位", - "抬叉停止"}; - boolean bConnected = true; - - boolean isReConnect = false; - - @Autowired - ParamService paramService; - @Autowired - AutoRunService autoRunService; - - - public TwoNDCSocketConnectionAutoRun() { - this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut); - } - - public String getCode() { - return TwoNDCSocketConnectionAutoRun.class.getSimpleName(); - } - - public String getName() { - return "2楼1区域AGV系统"; - } - - public void autoRun() throws IOException { - - try { - System.out.println("2楼1区域AGV系统链接开始"); - ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class); - InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class); - AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); - NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class); - DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); - DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); - ip = paramService.findByCode(AcsConfig.AGVURL2).getValue(); - port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT2).getValue()); - byte[] b = new byte[1024]; - s = new Socket(ip, port); - System.out.println("2楼1区域Agv链接成功"); - dos = new DataOutputStream(s.getOutputStream()); - dis = new DataInputStream(s.getInputStream()); - - while (bConnected) { - int count = dis.read(b); - - if (count == -1) { - break; - } - - int[] arr = new int[count]; - StringBuffer bs = new StringBuffer(); - - for (int i = 0; i < count; i++) { - int temp = b[i]; - if (temp < 0) - temp += 256; - arr[i] = temp; - StringBuffer bs1 = new StringBuffer("0"); - bs.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp)); - } - - System.out.println("收到请求参数:" + bs); - boolean flag = false; - if (arr[8] * 256 + arr[9] == 0x73) { - byte[] data = null; - System.out.println("接收agv上报信息:" + bs); - //执行阶段 - int phase = arr[16] * 256 + arr[17]; - // agv任务号 - int index = arr[12] * 256 + arr[13]; - //任务号 - int ikey = arr[26] * 256 + arr[27]; - //站点号 - int agvaddr = arr[18] * 256 + arr[19]; - //车号 - int carno = arr[20]; - Instruction inst = null; - if (ikey != 0) { - inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); - } - log.info("接收agv上报信息:" + bs); - log.info("接收agv上报信息:" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno); - Device device = null; - String device_code = null; - String old_device_code = null; - String emptyNum = null; - //自动门 - StandardAutodoorDeviceDriver standardAutodoorDeviceDriver; - if (agvaddr != 0) { - old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); - if (StrUtil.contains(old_device_code, "-")) { - String[] point = old_device_code.split("-"); - device_code = point[0]; - } else if (StrUtil.contains(old_device_code, ".")) { - String[] point = old_device_code.split("\\."); - device_code = point[0]; - emptyNum = point[1]; - } else { - device_code = old_device_code; - } - device = deviceAppService.findDeviceByCode(device_code); - } - - AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver; - //开始任务 - if (phase == 0x01) { - if (!ObjectUtil.isEmpty(inst)) { - inst.setInstruction_status("1"); - inst.setAgv_jobno(String.valueOf(index)); - inst.setSend_status("1"); - instructionService.update(inst); - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } - flag = true; - } - //任务完毕 - //(无车id及状态) - else if (phase == 0x14) { - if (ObjectUtil.isEmpty(inst)) { - log.info("未找到指令号{}对应的指令", ikey); - } else { - inst.setInstruction_status("2"); - try { - instructionService.finish(inst); - } catch (Exception e) { - e.printStackTrace(); - } - } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } - //请求删除任务 - //(需要WCS反馈) - else if (phase == 0x30) { - data = ndcAgvService.sendAgvTwoModeInst(0x8F, index, 0); - } - //任务删除确认 - //(需要WCS反馈) - else if (phase == 0xFF) { - if (ObjectUtil.isEmpty(inst)) { - log.info("未找到指令号{}对应的指令", ikey); - } else { - instructionService.cancelNOSendAgv(inst.getInstruction_id()); - } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else if (phase == 0x50) { - if (ObjectUtil.isEmpty(device_code)) { - log.info(agvaddr + "对应设备号为空!"); - return; - } - if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { - standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); - - try { - standardAutodoorDeviceDriver.writing("to_open","1"); - standardAutodoorDeviceDriver.writing("to_close","0"); - } catch (Exception e){ - log.info("下发电气信号失败:"+e.getMessage()); - e.printStackTrace(); - } - if(standardAutodoorDeviceDriver.getOpen() == 1){ - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } - } - - } else if (phase == 0x51) { - if (ObjectUtil.isEmpty(device_code)) { - log.info(agvaddr + "对应设备号为空!"); - return; - } - if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { - standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); - try { - standardAutodoorDeviceDriver.writing("to_close","1"); - standardAutodoorDeviceDriver.writing("to_open","0"); - } catch (Exception e){ - log.info("下发电气信号失败:"+e.getMessage()); - e.printStackTrace(); - } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - - } - - } else { - //上报异常信息 - //(不需要WCS反馈) - if(phase == 0x67){ - device = deviceAppService.findDeviceByCode(Integer.toString(arr[27])); - } else { - device = deviceAppService.findDeviceByCode(Integer.toString(arr[20])); - } - if (device.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) { - agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) device.getDeviceDriver(); - agvNdcTwoDeviceDriver.processSocket(arr); - } - } - if (!ObjectUtil.isEmpty(data)) { - write(data); - } - - } else { - System.out.println("agv上报不是0073类型动作,不处理"); - } - } - - } catch (Exception e) { - - - System.out.println("TwoAgv链接异常"); - log.info("TwoAgv链接异常"); - log.error("agv连接出现异常:{}", e); - if(ObjectUtil.isNotEmpty(s)){ - s.close(); - } - System.out.println(e.getMessage()); - e.printStackTrace(); - - } finally { - - - } - - } - - - @Override - public void stop() { - super.after(); - try { - s.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - - public static void write(byte[] b) { - try { - log.info("下发agv数据:" + Bytes2HexString(b)); - System.out.println("下发agv数据:" + Bytes2HexString(b)); - dos.write(b); - dos.flush(); - } catch (IOException e) { - // TODO Auto-generated catch block - log.info("下发agv数据异常:" + e.getMessage()); - e.printStackTrace(); - - } - - } -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/device/wql/task_inst.xls b/wcs/nladmin-system/src/main/java/org/nl/acs/device/wql/task_inst.xls index 9a913ea9..aed1a246 100644 Binary files a/wcs/nladmin-system/src/main/java/org/nl/acs/device/wql/task_inst.xls and b/wcs/nladmin-system/src/main/java/org/nl/acs/device/wql/task_inst.xls differ diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_one/hailiang_engraving_cache/HailiangEngravingCacheDeviceDriver.java b/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_one/hailiang_engraving_cache/HailiangEngravingCacheDeviceDriver.java index 94fe4286..5d936a40 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_one/hailiang_engraving_cache/HailiangEngravingCacheDeviceDriver.java +++ b/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_one/hailiang_engraving_cache/HailiangEngravingCacheDeviceDriver.java @@ -401,11 +401,11 @@ public class HailiangEngravingCacheDeviceDriver extends AbstractOpcDeviceDriver dto.setNext_point_code(next_device_codecode); dto.setUpdate_time(now); dto.setCreate_time(now); - - WQLObject wo = WQLObject.getWQLObject("acs_task"); - JSONObject json = (JSONObject) JSONObject.toJSON(dto); - - wo.insert(json); + try { + taskserver.create(dto); + }catch (Exception e){ + return false; + } requireSucess = false; return true; } diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_one/hailiang_smart_plc_test/HailiangSmartplcTestDefination.java b/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_one/hailiang_smart_plc_test/HailiangSmartplcTestDefination.java deleted file mode 100644 index 73e03b4c..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_one/hailiang_smart_plc_test/HailiangSmartplcTestDefination.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_smart_plc_test; - -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; -import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceType; -import org.springframework.stereotype.Service; - -import java.util.LinkedList; -import java.util.List; - -/** - * 海亮迅捷plc测试 - */ -@Service -public class HailiangSmartplcTestDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "hailiang_smart_plc_test"; - } - - @Override - public String getDriverName() { - return "海亮-西门子plc测试"; - } - - @Override - public String getDriverDescription() { - return "海亮-西门子plc测试"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new HailiangSmartplcTestDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return HailiangSmartplcTestDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.conveyor); - return types; - } - - @Override - public List getReadableItemDtos() { - return ItemProtocol.getReadableItemDtos(); - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_one/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java b/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_one/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java deleted file mode 100644 index 2c79764a..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_one/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java +++ /dev/null @@ -1,302 +0,0 @@ -package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_smart_plc_test; - -import lombok.Data; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.agv.server.AgvService; -import org.nl.acs.device.device_driver.standard_inspect.ReadUtil; -import org.nl.acs.device.service.DeviceService; -import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.RouteableDeviceDriver; -import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; -import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -import org.nl.acs.ext.wms.service.AcsToWmsService; -import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; -import org.nl.acs.log.service.DeviceExecuteLogService; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.order.service.ProduceshiftorderService; -import org.nl.acs.order.service.dto.ProduceshiftorderDto; -import org.nl.acs.route.service.RouteLineService; -import org.nl.acs.task.service.TaskService; -import org.nl.modules.system.service.ParamService; -import org.nl.modules.system.service.impl.ParamServiceImpl; -import org.nl.modules.wql.util.SpringContextHolder; -import org.openscada.opc.lib.da.Server; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -/** - * 海亮清洗机储料仓 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class HailiangSmartplcTestDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { - protected ItemProtocol itemProtocol = new ItemProtocol(this); - @Autowired - DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); - @Autowired - InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); - @Autowired - DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class); - @Autowired - TaskService taskserver = SpringContextHolder.getBean(TaskService.class); - @Autowired - RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); - @Autowired - ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class); - @Autowired - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); - @Autowired - ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean(ProduceshiftorderService.class); - @Autowired - AgvService agvService = SpringContextHolder.getBean(AgvService.class); - - String container; - String container_type_desc; - String last_container_type_desc; - String last_container; - //放货准备锁 - String putReadyLock = null; - //有货标记 - protected boolean has_goods_tag = false; - - int heartbeat = 0; - int mode =0; - int error =0; - int error_num =0; - int open_time =0; - int close_time =0; - int ready_time =0; - int running_time =0; - int error_time =0; - int voltage =0; - int temperature =0; - int current =0; - int material =0; - int lack_material =0; - int full_material =0; - int storage_qty =0; - int feeding_qty =0; - int blanking_qty =0; - int qualified_qty =0; - int unqualified_qty =0; - int finish =0; - int task =0; - int noload_electricity_consumption =0; - int prod_electricity_consumption =0; - int gas_consumption =0; - int water_consumption =0; - int oil_level =0; - int monthly_electricity_consumption =0; - int pause =0; - - - int last_mode =0; - int last_error =0; - int last_error_num =0; - int last_open_time =0; - int last_close_time =0; - int last_ready_time =0; - int last_running_time =0; - int last_error_time =0; - int last_voltage =0; - int last_temperature =0; - int last_current =0; - int last_material =0; - int last_lack_material =0; - int last_full_material =0; - int last_storage_qty =0; - int last_feeding_qty =0; - int last_blanking_qty =0; - int last_qualified_qty =0; - int last_unqualified_qty =0; - int last_finish =0; - int last_task =0; - int last_noload_electricity_consumption =0; - int last_prod_electricity_consumption =0; - int last_gas_consumption =0; - int last_water_consumption =0; - int last_oil_level =0; - int last_monthly_electricity_consumption =0; - int last_pause =0; - - - Boolean isonline = true; - int hasGoods = 0; - String message = null; - Boolean iserror = false; - - - boolean hasVehicle = false; - boolean isReady = false; - protected int instruction_num = 0; - protected int instruction_num_truth = 0; - boolean isFold = false; - private String assemble_check_tag; - - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - private Date instruction_apply_time = new Date(); - private int instruction_require_time_out = 3000; - //请求成功标记 - Boolean requireSucess = false; - //申请指令成功标记 - Boolean applySucess = false; - String inst_message; - - private int instruction_finished_time_out; - - int branchProtocol = 0; - //备注 - String remark; - //数量 - String qty; - - //当前指令 - Instruction inst = null; - //上次指令 - Instruction last_inst = null; - - - //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 - int flag = 0; - - - int agvphase=0; - int index =0; - - String device_code; - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute(){ - device_code = this.getDeviceCode(); - heartbeat = this.itemProtocol.getItem_heartbeat(); - mode = this.itemProtocol.getItem_mode(); - error = this.itemProtocol.getItem_error(); - error_num = this.itemProtocol.getItem_error_num(); - open_time = this.itemProtocol.getItem_open_time(); - close_time = this.itemProtocol.getItem_close_time(); - ready_time = this.itemProtocol.getItem_ready_time(); - running_time = this.itemProtocol.getItem_running_time(); - error_time = this.itemProtocol.getItem_error_time(); - voltage = this.itemProtocol.getItem_voltage(); - temperature = this.itemProtocol.getItem_temperature(); - current = this.itemProtocol.getItem_current(); - material = this.itemProtocol.getItem_material(); - lack_material = this.itemProtocol.getItem_lack_material(); - full_material = this.itemProtocol.getItem_full_material(); - storage_qty = this.itemProtocol.getItem_storage_qty(); - feeding_qty = this.itemProtocol.getItem_feeding_qty(); - blanking_qty = this.itemProtocol.getItem_blanking_qty(); - qualified_qty = this.itemProtocol.getItem_qualified_qty(); - unqualified_qty = this.itemProtocol.getItem_unqualified_qty(); - finish = this.itemProtocol.getItem_finish(); - task = this.itemProtocol.getItem_task(); - noload_electricity_consumption = this.itemProtocol.getItem_noload_electricity_consumption(); - prod_electricity_consumption = this.itemProtocol.getItem_prod_electricity_consumption(); - gas_consumption = this.itemProtocol.getItem_gas_consumption(); - water_consumption = this.itemProtocol.getItem_water_consumption(); - oil_level = this.itemProtocol.getItem_oil_level(); - monthly_electricity_consumption = this.itemProtocol.getItem_monthly_electricity_consumption(); - pause = this.itemProtocol.getItem_pause(); - - if (mode != last_mode) { - this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); - - } - if (error != last_error) { - logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error)); - logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + "->" + error); - } - - if (finish != last_finish) { - logServer.deviceItemValue(this.device_code,"finish" ,String.valueOf(finish)); - logServer.deviceExecuteLog(this.device_code,"","","信号finish:" + last_finish + "->" + finish); - if(finish == 1){ - ProduceshiftorderDto deviceInfo = produceshiftorderService.findOrderByDeviceCode(this.device_code); - deviceInfo.setOrder_status("2"); - produceshiftorderService.updateByOrderCode(deviceInfo); - } - } - last_finish = finish; - } - - public boolean exe_error() { - if (this.error == 0) { - return true; - } else { - log.debug("设备报警"); - return false; - } - } - - protected void thingToNothing() { - log.debug("从有货到无货 清理数据"); - logServer.deviceExecuteLog(this.device_code,"","","光电信号切换,刷新请求标记:"+this.requireSucess); - - this.setRequireSucess(false); - this.setApplySucess(false); - this.set_last_container(container, container_type_desc); - } - - public void set_last_container(String barcode, String type_desc) { - this.setInst_message(null); - this.setContainer(null); - this.set_last_container(barcode); - this.set_last_container_type_desc(type_desc); - } - - public void set_last_container(String barcode) { - } - - public void set_last_container_type_desc(String type) { - } - - - public boolean exe_business() { - return true; - } - - protected void executing(Instruction instruction) { - this.executing(1, instruction, ""); - } - - public void executing(int command, Instruction instruction, String appendMessage) { - - } - - public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); - } - - public void writing(int command) { - - } - - public void writing(String key, String value) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + key; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, value); - ReadUtil.write(itemMap, server); - } -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_one/hailiang_smart_plc_test/ItemProtocol.java b/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_one/hailiang_smart_plc_test/ItemProtocol.java deleted file mode 100644 index ecc8e3d3..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_one/hailiang_smart_plc_test/ItemProtocol.java +++ /dev/null @@ -1,248 +0,0 @@ -package org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_smart_plc_test; - -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; - -import java.util.ArrayList; -import java.util.List; - -@Slf4j -@Data -public class ItemProtocol { - - public static String item_heartbeat = "heartbeat"; - public static String item_mode = "mode"; - public static String item_error = "error"; - public static String item_error_num = "error_num"; - public static String item_open_time = "open_time"; - public static String item_close_time = "close_time"; // - public static String item_ready_time = "ready_time"; // - public static String item_running_time = "running_time"; - public static String item_error_time = "error_time"; - public static String item_voltage = "voltage"; - public static String item_temperature = "temperature"; - public static String item_current = "current"; - public static String item_material = "material"; - public static String item_lack_material = "lack_material"; - public static String item_full_material = "full_material"; - public static String item_storage_qty = "storage_qty"; - public static String item_feeding_qty = "feeding_qty"; - public static String item_blanking_qty = "blanking_qty"; - public static String item_qualified_qty = "qualified_qty"; - public static String item_unqualified_qty = "unqualified_qty"; - public static String item_finish = "finish"; - public static String item_task = "task"; - public static String item_noload_electricity_consumption = "noload_electricity_consumption"; - public static String item_prod_electricity_consumption = "prod_electricity_consumption"; - public static String item_gas_consumption = "gas_consumption"; - public static String item_water_consumption = "water_consumption"; - public static String item_oil_level = "oil_level"; - public static String item_monthly_electricity_consumption = "monthly_electricity_consumption"; - public static String item_pause = "pause"; - - - - public static String item_to_heartbeat = "to_heartbeat";// - public static String item_to_command = "to_command";// - public static String item_to_feeding = "to_feeding";// - public static String item_to_task = "to_task";// - public static String item_to_pause= "to_pause";// - public static String item_to_clear = "to_clear";// - public static String item_to_finish = "to_finish";// - public static String item_to_open = "to_open";// - public static String item_to_close = "to_close";// - public static String item_to_material = "to_material";// - public static String item_to_qty = "to_qty";// - - - private HailiangSmartplcTestDeviceDriver driver; - - public ItemProtocol(HailiangSmartplcTestDeviceDriver driver) { - this.driver = driver; - } - - public int getItem_heartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getItem_mode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getItem_error() { - return this.getOpcIntegerValue(item_error); - } - - public int getItem_error_num() { - return this.getOpcIntegerValue(item_error_num); - } - - public int getItem_open_time() { - return this.getOpcIntegerValue(item_open_time); - } - - public int getItem_close_time() { - return this.getOpcIntegerValue(item_close_time); - } - - public int getItem_ready_time() { - return this.getOpcIntegerValue(item_ready_time); - } - - public int getItem_running_time() { - return this.getOpcIntegerValue(item_running_time); - } - - public int getItem_error_time() { - return this.getOpcIntegerValue(item_error_time); - } - - public int getItem_voltage() { - return this.getOpcIntegerValue(item_voltage); - } - - public int getItem_temperature() { - return this.getOpcIntegerValue(item_temperature); - } - - public int getItem_current() { - return this.getOpcIntegerValue(item_current); - } - - public int getItem_material() { - return this.getOpcIntegerValue(item_material); - } - - public int getItem_lack_material() { - return this.getOpcIntegerValue(item_lack_material); - } - - public int getItem_full_material() { - return this.getOpcIntegerValue(item_full_material); - } - - public int getItem_storage_qty() { - return this.getOpcIntegerValue(item_storage_qty); - } - - public int getItem_feeding_qty() { - return this.getOpcIntegerValue(item_feeding_qty); - } - - public int getItem_blanking_qty() { - return this.getOpcIntegerValue(item_blanking_qty); - } - - public int getItem_qualified_qty() { - return this.getOpcIntegerValue(item_qualified_qty); - } - - public int getItem_unqualified_qty() { - return this.getOpcIntegerValue(item_unqualified_qty); - } - - public int getItem_finish() { - return this.getOpcIntegerValue(item_finish); - } - - public int getItem_task() { - return this.getOpcIntegerValue(item_task); - } - - public int getItem_noload_electricity_consumption() { - return this.getOpcIntegerValue(item_noload_electricity_consumption); - } - - public int getItem_prod_electricity_consumption() { - return this.getOpcIntegerValue(item_prod_electricity_consumption); - } - - public int getItem_gas_consumption() { - return this.getOpcIntegerValue(item_gas_consumption); - } - - public int getItem_water_consumption() { - return this.getOpcIntegerValue(item_water_consumption); - } - - public int getItem_oil_level() { - return this.getOpcIntegerValue(item_oil_level); - } - - public int getItem_monthly_electricity_consumption() { - return this.getOpcIntegerValue(item_monthly_electricity_consumption); - } - - public int getItem_pause() { - return this.getOpcIntegerValue(item_pause); - } - - Boolean isonline; - - public int getOpcIntegerValue(String protocol) { - Integer value = this.driver.getIntegeregerValue(protocol); - if (value == null) { - setIsonline(false); - } else { - setIsonline(true); - return value; - } - return 0; - - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "VW0")); - list.add(new ItemDto(item_mode, "模式", "VW2")); - list.add(new ItemDto(item_error, "故障", "VW4")); - list.add(new ItemDto(item_error_num, "故障次数", "VD6")); - list.add(new ItemDto(item_open_time, "开机时间", "VD8")); - list.add(new ItemDto(item_close_time, "关机时间", "VD12")); - list.add(new ItemDto(item_ready_time, "待机时间", "VD16")); - list.add(new ItemDto(item_running_time, "生产时间", "VD20")); - list.add(new ItemDto(item_error_time, "故障时间", "VD24")); - list.add(new ItemDto(item_temperature, "温度", "VD28")); - list.add(new ItemDto(item_voltage, "电压", "VD32")); - list.add(new ItemDto(item_current, "电流", "VD36")); - list.add(new ItemDto(item_material, "当前生产产品编号", "VD40")); - list.add(new ItemDto(item_lack_material, "生产缺料信号", "VD44")); - list.add(new ItemDto(item_full_material, "生产满料信号", "VD48")); - list.add(new ItemDto(item_storage_qty, "储料斗数量", "VD52")); - list.add(new ItemDto(item_feeding_qty, "上料数量", "VD56")); - list.add(new ItemDto(item_blanking_qty, "下料数量", "VD60")); - list.add(new ItemDto(item_qualified_qty, "当前生产合格品数量", "VD64")); - list.add(new ItemDto(item_unqualified_qty, "当前生产不合格数量", "VD68")); - list.add(new ItemDto(item_finish, "生产完成", "VD72")); - list.add(new ItemDto(item_task, "任务号", "VD76")); - list.add(new ItemDto(item_noload_electricity_consumption, "空载电能耗(未生产时)", "VD80")); - list.add(new ItemDto(item_prod_electricity_consumption, "生产电能耗", "VD84")); - list.add(new ItemDto(item_gas_consumption, "气压能耗", "VD88")); - list.add(new ItemDto(item_water_consumption, "水流量能耗", "VD92")); - list.add(new ItemDto(item_oil_level, "当前液压油位", "VD96")); - list.add(new ItemDto(item_monthly_electricity_consumption, "本月总电能耗", "VD100")); - list.add(new ItemDto(item_pause, "设备暂停", "VD104")); - - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_heartbeat, "心跳", "VW200")); - list.add(new ItemDto(item_to_command, "下发命令", "VW202")); - list.add(new ItemDto(item_to_feeding, "下发命令", "VW204")); - list.add(new ItemDto(item_to_task, "任务号", "VW208")); - list.add(new ItemDto(item_to_pause, "生产暂停", "VW212")); - list.add(new ItemDto(item_to_clear, "当前产量清零", "VW216")); - list.add(new ItemDto(item_to_finish, "强制完成", "VW220")); - list.add(new ItemDto(item_to_open, "设备开机", "VW224")); - list.add(new ItemDto(item_to_close, "设备关机", "VW228")); - list.add(new ItemDto(item_to_material, "当前任务生产物料", "VW232")); - list.add(new ItemDto(item_to_qty, "当前任务生产数量", "VW236")); - return list; - } - - -} - diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java b/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java index 7cf39de5..5aab9b89 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java +++ b/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java @@ -149,15 +149,15 @@ public class HailiangSmartplcTestDeviceDriver extends AbstractOpcDeviceDriver im log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); }else { //向LMS发送请求,发送终点和托盘类型 - jo.put("type", "1"); - jo.put("point_code", device_code); - jo.put("vehicle_num", "1"); - jo.put("vehicle_type", container_type); - String result = acsToWmsService.applyTaskToWms(jo); - JSONObject res_jo = JSONObject.parseObject(result); - if (res_jo.getString("status").equals("200")){ - requireSucess = true; - } +// jo.put("type", "1"); +// jo.put("point_code", device_code); +// jo.put("vehicle_num", "1"); +// jo.put("vehicle_type", container_type); +// String result = acsToWmsService.applyTaskToWms(jo); +// JSONObject res_jo = JSONObject.parseObject(result); +// if (res_jo.getString("status").equals("200")){ +// requireSucess = true; +// } } } break; @@ -169,16 +169,16 @@ public class HailiangSmartplcTestDeviceDriver extends AbstractOpcDeviceDriver im log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); }else { //向LMS发送请求,发送起点 - jo.put("type", "2"); - jo.put("point_code", device_code); - jo.put("vehicle_num", "1"); - jo.put("vehicle_type", container_type); - jo.put("qty", number); - String result = acsToWmsService.applyTaskToWms(jo); - JSONObject res_jo = JSONObject.parseObject(result); - if (res_jo.getString("status").equals("200")){ - requireSucess = true; - } +// jo.put("type", "2"); +// jo.put("point_code", device_code); +// jo.put("vehicle_num", "1"); +// jo.put("vehicle_type", container_type); +// jo.put("qty", number); +// String result = acsToWmsService.applyTaskToWms(jo); +// JSONObject res_jo = JSONObject.parseObject(result); +// if (res_jo.getString("status").equals("200")){ +// requireSucess = true; +// } } } break; diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java b/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java index 2d3b52be..6076a7e0 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java +++ b/wcs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java @@ -18,8 +18,6 @@ import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.ScannerDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest; -import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; @@ -291,10 +289,10 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe } if (move > 0 && !StrUtil.isEmpty(newBarcode) && !requireSucess) { - instruction_require(newBarcode.trim()); +// instruction_require(newBarcode.trim()); } if (move > 0 && !StrUtil.isEmpty(newBarcode) && !applySucess) { - instruction_apply(newBarcode.trim()); +// instruction_apply(newBarcode.trim()); } break; case 5: @@ -312,7 +310,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe } // 申请贴标 if (move > 0 && !StrUtil.isEmpty(newBarcodes) && !requireSucess) { - applyLabeling(newBarcodes); +// applyLabeling(newBarcodes); } break; } @@ -435,9 +433,9 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe this.control(itemMap); } - public boolean instruction_require(String container_code) { - return instruction_require(container_code, WcsConfig.task_container_type_default_desc); - } +// public boolean instruction_require(String container_code) { +// return instruction_require(container_code, WcsConfig.task_container_type_default_desc); +// } public synchronized boolean instruction_apply(String container_code) { Date date = new Date(); @@ -498,307 +496,307 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe /** * 请求指令 * 定点任务时请求这里 - * @param container_code - * @param container_type + * @param + * @param */ - public synchronized boolean instruction_require(String container_code, String container_type) { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - //container_code - TaskDto taskdto = taskserver.findByContainer(container_code); - if (!ObjectUtil.isEmpty(taskdto)) { - if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) { - logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号"+container_code - +"已存在对应任务,不再请求"); - Instruction instdto = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()); - if(!StrUtil.equals(instdto.getStart_device_code(),this.device_code)){ - message ="当前载具号"+container_code+"查找对应指令起点与当前设备不符"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请任务" - +"当前载具号"+container_code+"查找对应指令起点与当前设备不符"); - return false; - } - this.setIserror(false); - if (ObjectUtil.isNotEmpty(instdto)) { - List list = new ArrayList(); - Map map = new HashMap(); - - if (StrUtil.isNotEmpty(taskdto.getTo_z())) { - if (StrUtil.equals(taskdto.getTo_z(), "01")) { - map.put("code", "to_target"); - map.put("value", "102"); - } else if (StrUtil.equals(taskdto.getTo_z(), "02")) { - map.put("code", "to_target"); - map.put("value", "201"); - } else if (StrUtil.equals(taskdto.getTo_z(), "03")) { - map.put("code", "to_target"); - map.put("value", "301"); - } - } - list.add(map); - Map map2 = new HashMap(); - map2.put("code", "to_task"); - map2.put("value", instdto.getInstruction_code()); - list.add(map2); - Map map3 = new HashMap(); - map3.put("code", "to_command"); - map3.put("value", "1"); - list.add(map3); - this.writing(list); - message = "下发电气任务号成功"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号"+container_code - +"已存在对应任务,下发电气信号"); - requireSucess = true; - applySucess = true; - } else { - message = "任务号:" + taskdto.getTask_code() + "未找到指令"; - } - return true; - } else { - //需要判断指令中的指令 再次请求不能生成 - if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(),"1"))) { - { - Instruction instdto = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(),"1"); - if(to_task != Integer.parseInt(instdto.getInstruction_code())){ - List list = new ArrayList(); - Map map = new HashMap(); - if (StrUtil.isNotEmpty(taskdto.getTo_z())) { - if (StrUtil.equals(taskdto.getTo_z(), "01")) { - map.put("code", "to_target"); - map.put("value", "102"); - } else if (StrUtil.equals(taskdto.getTo_z(), "02")) { - map.put("code", "to_target"); - map.put("value", "201"); - } else if (StrUtil.equals(taskdto.getTo_z(), "03")) { - map.put("code", "to_target"); - map.put("value", "301"); - } - } - list.add(map); - Map map2 = new HashMap(); - map2.put("code", "to_task"); - map2.put("value", instdto.getInstruction_code()); - list.add(map2); - Map map3 = new HashMap(); - map3.put("code", "to_command"); - map3.put("value", "1"); - list.add(map3); - this.writing(list); - message = "下发电气任务号成功"; - requireSucess = true; - applySucess = true; - return true; - } else { - logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号" + container_code - + "已存在对应任务"); - requireSucess = true; - applySucess = true; - return true; - } - - } - } - } - - String taskid = taskdto.getTask_id(); - String taskcode = taskdto.getTask_code(); - String vehiclecode = taskdto.getVehicle_code(); - String priority = taskdto.getPriority(); - String start_point_code = taskdto.getStart_point_code(); - String start_device_code = taskdto.getStart_device_code(); - String route_plan_code = taskdto.getRoute_plan_code(); - String next_device_code = ""; - - /** - * 开始平均分配 - */ - String this_coevice_code = taskserver.queryAssignedByDevice(device_code, taskdto.getNext_device_code()); - if (StrUtil.isEmpty(this_coevice_code)) { - List shortPathsList = routeLineService.getShortPathLines(start_device_code, taskdto.getNext_device_code(), route_plan_code); - RouteLineDto routeLineDto = shortPathsList.get(0); - - String path = routeLineDto.getPath(); - String type = routeLineDto.getType(); - String[] str = path.split("->"); -// if (!StrUtil.equals(type, "0")) { +// public synchronized boolean instruction_require(String container_code, String container_type) { +// Date date = new Date(); +// if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { +// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); +// return false; +// } else { +// this.instruction_require_time = date; +// //container_code +// TaskDto taskdto = taskserver.findByContainer(container_code); +// if (!ObjectUtil.isEmpty(taskdto)) { +// if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) { +// logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号"+container_code +// +"已存在对应任务,不再请求"); +// Instruction instdto = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()); +// if(!StrUtil.equals(instdto.getStart_device_code(),this.device_code)){ +// message ="当前载具号"+container_code+"查找对应指令起点与当前设备不符"; +// logServer.deviceExecuteLog(this.device_code, "", "", "申请任务" +// +"当前载具号"+container_code+"查找对应指令起点与当前设备不符"); // return false; // } - List pathlist = Arrays.asList(str); - int index = 0; - for (int m = 0; m < pathlist.size(); m++) { - if (pathlist.get(m).equals(start_device_code)) { - index = m + 1; - break; - } - } - next_device_code = pathlist.get(index); - } else { - next_device_code = this_coevice_code; - } - //校验路由关系 - List shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); - if (ObjectUtils.isEmpty(shortPathsList)) { - throw new RuntimeException("路由不通!"); - } - - Device startdevice = deviceAppservice.findDeviceByCode(start_device_code); - Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code); - String next_point_code; - if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) { - next_point_code = taskdto.getTo_x() + "-" + taskdto.getTo_y() + "-" + taskdto.getTo_z(); - } else { - next_point_code = next_device_code; - } - - if(!StrUtil.equals(taskdto.getStart_device_code(),this.device_code)){ - message ="当前载具号"+container_code+"查找对应指令起点与当前设备不符"; -// List list = new ArrayList(); -// Map map = new HashMap(); -// map.put("code","to_target"); -// map.put("value","1011"); -// list.add(map); -// Map map2 = new HashMap(); -// map2.put("code","to_command"); -// map2.put("value","1"); -// Map map3 = new HashMap(); -// map3.put("code","to_task"); -// map3.put("value","0"); -// list.add(map3); -// this.writing(list); -// this.setRequireSucess(true); -// this.setApplySucess(true); - return false; - } - Instruction instdto = new Instruction(); - instdto.setInstruction_id(IdUtil.simpleUUID()); - instdto.setRoute_plan_code(route_plan_code); - instdto.setRemark(taskdto.getRemark()); - instdto.setMaterial(taskdto.getMaterial()); - instdto.setQuantity(taskdto.getQuantity()); - instdto.setTask_id(taskid); - instdto.setTask_code(taskcode); - instdto.setVehicle_code(vehiclecode); - String now = DateUtil.now(); - instdto.setCreate_time(now); - instdto.setCreate_by("auto"); - instdto.setStart_device_code(start_device_code); - instdto.setNext_device_code(next_device_code); - instdto.setStart_point_code(start_point_code); - instdto.setNext_point_code(next_point_code); - instdto.setPriority(priority); - instdto.setInstruction_status("0"); - instdto.setExecute_device_code(start_point_code); - try { - instructionService.create(instdto); - } catch (Exception e) { - e.printStackTrace(); - log.error("指令创建失败!",e.getMessage()); - return false; - } - //创建指令后修改任务状态 - taskdto.setTask_status("1"); - taskserver.update(taskdto); - - - List list = new ArrayList(); - Map map = new HashMap(); - - if(StrUtil.isNotEmpty(taskdto.getTo_z())){ - if(StrUtil.equals(taskdto.getTo_z(),"01")){ - map.put("code","to_target"); - map.put("value","102"); - } else if(StrUtil.equals(taskdto.getTo_z(),"02")){ - map.put("code","to_target"); - map.put("value","201"); - } else if(StrUtil.equals(taskdto.getTo_z(),"03")){ - map.put("code","to_target"); - map.put("value","301"); - } - } - list.add(map); - Map map2 = new HashMap(); - map2.put("code","to_task"); - map2.put("value",instdto.getInstruction_code()); - list.add(map2); - Map map3 = new HashMap(); - map3.put("code","to_command"); - map3.put("value","1"); - list.add(map3); - this.writing(list); -// if(task != Integer.parseInt(instdto.getInstruction_code()) ){ -// this.writing(list); -// logServer.deviceExecuteLog(device_code, "", "", instdto.getInstruction_code() + "再次下发电气信号"); +// this.setIserror(false); +// if (ObjectUtil.isNotEmpty(instdto)) { +// List list = new ArrayList(); +// Map map = new HashMap(); +// +// if (StrUtil.isNotEmpty(taskdto.getTo_z())) { +// if (StrUtil.equals(taskdto.getTo_z(), "01")) { +// map.put("code", "to_target"); +// map.put("value", "102"); +// } else if (StrUtil.equals(taskdto.getTo_z(), "02")) { +// map.put("code", "to_target"); +// map.put("value", "201"); +// } else if (StrUtil.equals(taskdto.getTo_z(), "03")) { +// map.put("code", "to_target"); +// map.put("value", "301"); +// } +// } +// list.add(map); +// Map map2 = new HashMap(); +// map2.put("code", "to_task"); +// map2.put("value", instdto.getInstruction_code()); +// list.add(map2); +// Map map3 = new HashMap(); +// map3.put("code", "to_command"); +// map3.put("value", "1"); +// list.add(map3); +// this.writing(list); +// message = "下发电气任务号成功"; +// logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号"+container_code +// +"已存在对应任务,下发电气信号"); +// requireSucess = true; +// applySucess = true; +// } else { +// message = "任务号:" + taskdto.getTask_code() + "未找到指令"; +// } +// return true; +// } else { +// //需要判断指令中的指令 再次请求不能生成 +// if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(),"1"))) { +// { +// Instruction instdto = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(),"1"); +// if(to_task != Integer.parseInt(instdto.getInstruction_code())){ +// List list = new ArrayList(); +// Map map = new HashMap(); +// if (StrUtil.isNotEmpty(taskdto.getTo_z())) { +// if (StrUtil.equals(taskdto.getTo_z(), "01")) { +// map.put("code", "to_target"); +// map.put("value", "102"); +// } else if (StrUtil.equals(taskdto.getTo_z(), "02")) { +// map.put("code", "to_target"); +// map.put("value", "201"); +// } else if (StrUtil.equals(taskdto.getTo_z(), "03")) { +// map.put("code", "to_target"); +// map.put("value", "301"); +// } +// } +// list.add(map); +// Map map2 = new HashMap(); +// map2.put("code", "to_task"); +// map2.put("value", instdto.getInstruction_code()); +// list.add(map2); +// Map map3 = new HashMap(); +// map3.put("code", "to_command"); +// map3.put("value", "1"); +// list.add(map3); +// this.writing(list); +// message = "下发电气任务号成功"; +// requireSucess = true; +// applySucess = true; +// return true; +// } else { +// logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号" + container_code +// + "已存在对应任务"); +// requireSucess = true; +// applySucess = true; +// return true; +// } +// +// } +// } // } - requireSucess = true; - applySucess = true; - } else { - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - message = "申请任务中..."; - JSONObject apply = new JSONObject(); - apply.put("vehicle_code", container_code); - apply.put("device_code", device_code); - apply.put("type","1"); - logServer.deviceExecuteLog(this.device_code, "", "", "申请入库,请求参数:"+apply.toString()); - String str = acsToWmsService.applyTaskToWms(apply); - JSONObject jo = JSON.parseObject(str); - logServer.deviceExecuteLog(this.device_code, "", "", "申请入库,返回参数:"+jo.toString()); - if (ObjectUtil.isEmpty(jo)) { - message = "接口不通"; - List list = new ArrayList(); - Map map = new HashMap(); - map.put("code","to_target"); - map.put("value","1011"); - list.add(map); - Map map2 = new HashMap(); - map2.put("code","to_command"); - map2.put("value","1"); - Map map3 = new HashMap(); - map3.put("code","to_task"); - map3.put("value","0"); - list.add(map3); - this.writing(list); - requireSucess = true; - applySucess = true; - message = "申请任务失败接口不通下发退回"; - } else { - if (jo.getInteger("status") == 200) { - message = "申请任务成功"; - requireSucess = true; - applySucess = false; - } else { - if (jo.get("message")!=null){ - message = jo.get("message").toString(); - } - - List list = new ArrayList(); - Map map = new HashMap(); - map.put("code","to_target"); - map.put("value","1011"); - list.add(map); - Map map2 = new HashMap(); - map2.put("code","to_command"); - map2.put("value","1"); - list.add(map2); - Map map3 = new HashMap(); - map3.put("code","to_task"); - map3.put("value","0"); - list.add(map3); - this.writing(list); - message = "申请任务失败下发退回,"+message; - requireSucess = true; - - } - } -// requireSucess = true; -// message = "申请任务成功"; - } - } - return true; - } - } +// +// String taskid = taskdto.getTask_id(); +// String taskcode = taskdto.getTask_code(); +// String vehiclecode = taskdto.getVehicle_code(); +// String priority = taskdto.getPriority(); +// String start_point_code = taskdto.getStart_point_code(); +// String start_device_code = taskdto.getStart_device_code(); +// String route_plan_code = taskdto.getRoute_plan_code(); +// String next_device_code = ""; +// +// /** +// * 开始平均分配 +// */ +// String this_coevice_code = taskserver.queryAssignedByDevice(device_code, taskdto.getNext_device_code()); +// if (StrUtil.isEmpty(this_coevice_code)) { +// List shortPathsList = routeLineService.getShortPathLines(start_device_code, taskdto.getNext_device_code(), route_plan_code); +// RouteLineDto routeLineDto = shortPathsList.get(0); +// +// String path = routeLineDto.getPath(); +// String type = routeLineDto.getType(); +// String[] str = path.split("->"); +//// if (!StrUtil.equals(type, "0")) { +//// return false; +//// } +// List pathlist = Arrays.asList(str); +// int index = 0; +// for (int m = 0; m < pathlist.size(); m++) { +// if (pathlist.get(m).equals(start_device_code)) { +// index = m + 1; +// break; +// } +// } +// next_device_code = pathlist.get(index); +// } else { +// next_device_code = this_coevice_code; +// } +// //校验路由关系 +// List shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); +// if (ObjectUtils.isEmpty(shortPathsList)) { +// throw new RuntimeException("路由不通!"); +// } +// +// Device startdevice = deviceAppservice.findDeviceByCode(start_device_code); +// Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code); +// String next_point_code; +// if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) { +// next_point_code = taskdto.getTo_x() + "-" + taskdto.getTo_y() + "-" + taskdto.getTo_z(); +// } else { +// next_point_code = next_device_code; +// } +// +// if(!StrUtil.equals(taskdto.getStart_device_code(),this.device_code)){ +// message ="当前载具号"+container_code+"查找对应指令起点与当前设备不符"; +//// List list = new ArrayList(); +//// Map map = new HashMap(); +//// map.put("code","to_target"); +//// map.put("value","1011"); +//// list.add(map); +//// Map map2 = new HashMap(); +//// map2.put("code","to_command"); +//// map2.put("value","1"); +//// Map map3 = new HashMap(); +//// map3.put("code","to_task"); +//// map3.put("value","0"); +//// list.add(map3); +//// this.writing(list); +//// this.setRequireSucess(true); +//// this.setApplySucess(true); +// return false; +// } +// Instruction instdto = new Instruction(); +// instdto.setInstruction_id(IdUtil.simpleUUID()); +// instdto.setRoute_plan_code(route_plan_code); +// instdto.setRemark(taskdto.getRemark()); +// instdto.setMaterial(taskdto.getMaterial()); +// instdto.setQuantity(taskdto.getQuantity()); +// instdto.setTask_id(taskid); +// instdto.setTask_code(taskcode); +// instdto.setVehicle_code(vehiclecode); +// String now = DateUtil.now(); +// instdto.setCreate_time(now); +// instdto.setCreate_by("auto"); +// instdto.setStart_device_code(start_device_code); +// instdto.setNext_device_code(next_device_code); +// instdto.setStart_point_code(start_point_code); +// instdto.setNext_point_code(next_point_code); +// instdto.setPriority(priority); +// instdto.setInstruction_status("0"); +// instdto.setExecute_device_code(start_point_code); +// try { +// instructionService.create(instdto); +// } catch (Exception e) { +// e.printStackTrace(); +// log.error("指令创建失败!",e.getMessage()); +// return false; +// } +// //创建指令后修改任务状态 +// taskdto.setTask_status("1"); +// taskserver.update(taskdto); +// +// +// List list = new ArrayList(); +// Map map = new HashMap(); +// +// if(StrUtil.isNotEmpty(taskdto.getTo_z())){ +// if(StrUtil.equals(taskdto.getTo_z(),"01")){ +// map.put("code","to_target"); +// map.put("value","102"); +// } else if(StrUtil.equals(taskdto.getTo_z(),"02")){ +// map.put("code","to_target"); +// map.put("value","201"); +// } else if(StrUtil.equals(taskdto.getTo_z(),"03")){ +// map.put("code","to_target"); +// map.put("value","301"); +// } +// } +// list.add(map); +// Map map2 = new HashMap(); +// map2.put("code","to_task"); +// map2.put("value",instdto.getInstruction_code()); +// list.add(map2); +// Map map3 = new HashMap(); +// map3.put("code","to_command"); +// map3.put("value","1"); +// list.add(map3); +// this.writing(list); +//// if(task != Integer.parseInt(instdto.getInstruction_code()) ){ +//// this.writing(list); +//// logServer.deviceExecuteLog(device_code, "", "", instdto.getInstruction_code() + "再次下发电气信号"); +//// } +// requireSucess = true; +// applySucess = true; +// } else { +// if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { +// message = "申请任务中..."; +// JSONObject apply = new JSONObject(); +// apply.put("vehicle_code", container_code); +// apply.put("device_code", device_code); +// apply.put("type","1"); +// logServer.deviceExecuteLog(this.device_code, "", "", "申请入库,请求参数:"+apply.toString()); +// String str = acsToWmsService.applyTaskToWms(apply); +// JSONObject jo = JSON.parseObject(str); +// logServer.deviceExecuteLog(this.device_code, "", "", "申请入库,返回参数:"+jo.toString()); +// if (ObjectUtil.isEmpty(jo)) { +// message = "接口不通"; +// List list = new ArrayList(); +// Map map = new HashMap(); +// map.put("code","to_target"); +// map.put("value","1011"); +// list.add(map); +// Map map2 = new HashMap(); +// map2.put("code","to_command"); +// map2.put("value","1"); +// Map map3 = new HashMap(); +// map3.put("code","to_task"); +// map3.put("value","0"); +// list.add(map3); +// this.writing(list); +// requireSucess = true; +// applySucess = true; +// message = "申请任务失败接口不通下发退回"; +// } else { +// if (jo.getInteger("status") == 200) { +// message = "申请任务成功"; +// requireSucess = true; +// applySucess = false; +// } else { +// if (jo.get("message")!=null){ +// message = jo.get("message").toString(); +// } +// +// List list = new ArrayList(); +// Map map = new HashMap(); +// map.put("code","to_target"); +// map.put("value","1011"); +// list.add(map); +// Map map2 = new HashMap(); +// map2.put("code","to_command"); +// map2.put("value","1"); +// list.add(map2); +// Map map3 = new HashMap(); +// map3.put("code","to_task"); +// map3.put("value","0"); +// list.add(map3); +// this.writing(list); +// message = "申请任务失败下发退回,"+message; +// requireSucess = true; +// +// } +// } +//// requireSucess = true; +//// message = "申请任务成功"; +// } +// } +// return true; +// } +// } public void writing(String param, String value) { @@ -812,76 +810,76 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe } // 申请贴标 - public synchronized void applyLabeling(String newBarcodes) { - Date date = new Date(); - if (date.getTime() - this.require_apply_labeling_time.getTime() - < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return; - } else { - this.require_apply_labeling_time = date; -// String vehicle_code = ""; - if (weight == 0) { - logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备重量:" + weight + "异常"); - message = "申请贴标电气设备重量:" + weight + "异常"; - throw new RuntimeException("重量为空!"); - } -// if (task > 0) { -// Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); -// if (ObjectUtil.isEmpty(instruction)) { -// instruction = instructionService.findByCode(String.valueOf(task)); -// } -// vehicle_code = instruction.getVehicle_code(); -// } else { -// logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备任务号:" + task + "异常"); -// message = "申请贴标电气设备任务号:" + task + "异常"; -// throw new RuntimeException("任务号为空!"); +// public synchronized void applyLabeling(String newBarcodes) { +// Date date = new Date(); +// if (date.getTime() - this.require_apply_labeling_time.getTime() +// < (long) this.instruction_require_time_out) { +// log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); +// return; +// } else { +// this.require_apply_labeling_time = date; +//// String vehicle_code = ""; +// if (weight == 0) { +// logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备重量:" + weight + "异常"); +// message = "申请贴标电气设备重量:" + weight + "异常"; +// throw new RuntimeException("重量为空!"); // } - if (StrUtil.isEmpty(newBarcodes)) { - logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备载具号为空!"); - message = "申请贴标电气设备载具号为空"; - throw new RuntimeException("载具号为空!"); - } - ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest = - new ApplyLabelingAndBindingRequest(); - JSONObject device_json = - WQLObject.getWQLObject("acs_storage_cell") - .query("storage_code ='" + this.device_code + "'") - .uniqueResult(0); - String start_point_code = null; - if (!ObjectUtil.isEmpty(device_json)) { - start_point_code = - (String) device_json.get("parent_storage_code") == null - ? this.device_code - : (String) device_json.get("parent_storage_code"); - } - applyLabelingAndBindingRequest.setDevice_code(start_point_code); - applyLabelingAndBindingRequest.setType("1"); - applyLabelingAndBindingRequest.setVehicle_code(newBarcodes); - applyLabelingAndBindingRequest.setWeight(String.valueOf((float) weight / 100)); - ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = - acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest); - logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,请求参数:"+JSON.toJSONString(applyLabelingAndBindingRequest)); - - if (applyLabelingAndBindingResponse.getstatus() == 200) { - message = "申请贴标成功"; - List list = new ArrayList(); - Map map = new HashMap(); - map.put("code", "to_command"); - map.put("value", "5"); - list.add(map); - this.writing(list); - this.writing(list); - message = "申请贴标下发电气信号成功"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse)); - requireSucess = true; - } else { - message = "申请贴标失败," + applyLabelingAndBindingResponse.getMessage(); - logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse)); - - } - } - } +//// if (task > 0) { +//// Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); +//// if (ObjectUtil.isEmpty(instruction)) { +//// instruction = instructionService.findByCode(String.valueOf(task)); +//// } +//// vehicle_code = instruction.getVehicle_code(); +//// } else { +//// logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备任务号:" + task + "异常"); +//// message = "申请贴标电气设备任务号:" + task + "异常"; +//// throw new RuntimeException("任务号为空!"); +//// } +// if (StrUtil.isEmpty(newBarcodes)) { +// logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备载具号为空!"); +// message = "申请贴标电气设备载具号为空"; +// throw new RuntimeException("载具号为空!"); +// } +// ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest = +// new ApplyLabelingAndBindingRequest(); +// JSONObject device_json = +// WQLObject.getWQLObject("acs_storage_cell") +// .query("storage_code ='" + this.device_code + "'") +// .uniqueResult(0); +// String start_point_code = null; +// if (!ObjectUtil.isEmpty(device_json)) { +// start_point_code = +// (String) device_json.get("parent_storage_code") == null +// ? this.device_code +// : (String) device_json.get("parent_storage_code"); +// } +// applyLabelingAndBindingRequest.setDevice_code(start_point_code); +// applyLabelingAndBindingRequest.setType("1"); +// applyLabelingAndBindingRequest.setVehicle_code(newBarcodes); +// applyLabelingAndBindingRequest.setWeight(String.valueOf((float) weight / 100)); +// ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = +// acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest); +// logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,请求参数:"+JSON.toJSONString(applyLabelingAndBindingRequest)); +// +// if (applyLabelingAndBindingResponse.getstatus() == 200) { +// message = "申请贴标成功"; +// List list = new ArrayList(); +// Map map = new HashMap(); +// map.put("code", "to_command"); +// map.put("value", "5"); +// list.add(map); +// this.writing(list); +// this.writing(list); +// message = "申请贴标下发电气信号成功"; +// logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse)); +// requireSucess = true; +// } else { +// message = "申请贴标失败," + applyLabelingAndBindingResponse.getMessage(); +// logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse)); +// +// } +// } +// } public void writing(List list) { Map itemMap = new HashMap(); diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/AcsUtil.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/AcsUtil.java deleted file mode 100644 index 39f2037a..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/AcsUtil.java +++ /dev/null @@ -1,55 +0,0 @@ - -package org.nl.acs.ext.wms; - -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpRequest; -import cn.hutool.http.HttpResponse; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.log.LokiLog; -import org.nl.acs.log.LokiLogType; -import org.nl.acs.log.service.DeviceExecuteLogService; -import org.nl.modules.common.exception.BadRequestException; -import org.nl.modules.system.service.ParamService; -import org.nl.modules.system.service.impl.ParamServiceImpl; -import org.nl.modules.wql.util.SpringContextHolder; -import org.springframework.beans.factory.annotation.Autowired; - -/** - * ACS连接外部系统工具类: - */ -@Slf4j -public class AcsUtil { - - - @LokiLog(type = LokiLogType.ACS_TO_LK) - public static String notifyAcs(String api, W requestParam) { - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);; - ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class); - //判断是否连接立库WCS系统 - String isConnect = paramService.findByCode("is_connect_liKu_Wcs").getValue(); - if (StrUtil.equals("0", isConnect)) { - throw new BadRequestException("参数配置表中-is_connect_liKu_Wcs为:0"); - } - String liKu_wcs_url = paramService.findByCode("liKu_wcs_url").getValue(); - try { - logServer.extLog(LokiLogType.ACS_TO_LK.name(),"下发立库任务请求参数:{}"+JSON.toJSONString(requestParam) ); - log.info("下发立库任务请求参数:{}", JSON.toJSONString(requestParam)); - String body = HttpRequest - .post(liKu_wcs_url + api).setConnectionTimeout(3000) - .body(JSON.toJSONString(requestParam)) - .execute() - .body(); - log.info("下发立库任务返回参数:{}", body); - return body; - } catch (Exception e) { - JSONObject result = new JSONObject(); - result.put("result", "false"); - result.put("code", "1"); - result.put("comment", e.getMessage()); - log.info("下发立库任务异常返回参数:{}", String.valueOf(result)); - return String.valueOf(result); - } - } -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/RespUtil.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/RespUtil.java deleted file mode 100644 index 354547fb..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/RespUtil.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.nl.acs.ext.wms; - -import com.alibaba.fastjson.JSONObject; -import org.nl.acs.ext.wms.liKuData.Resp; - -/** - * @author: geng by - * @createDate: 2022/11/24 - */ -public class RespUtil { - public static Resp getResp(String result, T t) { - JSONObject jsonObject = JSONObject.parseObject(result); - Resp resp = new Resp<>(); - resp.setData(t); - resp = JSONObject.toJavaObject(jsonObject, Resp.class); - return resp; - } -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyLabelingAndBindingRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyLabelingAndBindingRequest.java deleted file mode 100644 index 65c5bb58..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyLabelingAndBindingRequest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.nl.acs.ext.wms.data; - -import lombok.Data; - -@Data -public class ApplyLabelingAndBindingRequest extends BaseRequest { - private String vehicle_code; - private String device_code; - /** - * 1:贴标申请 - * 2:捆扎申请 - * 3:烘箱 - */ - private String type; - - private String weight; - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyLabelingAndBindingResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyLabelingAndBindingResponse.java deleted file mode 100644 index cf20c9c1..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyLabelingAndBindingResponse.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.nl.acs.ext.wms.data; - -import com.alibaba.fastjson.JSONObject; -import lombok.Data; - -import java.util.HashMap; -import java.util.Map; - -@Data -public class ApplyLabelingAndBindingResponse extends BaseResponse { - - private Map data = new HashMap(); - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java deleted file mode 100644 index 4533d4e4..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.nl.acs.ext.wms.data; - -import lombok.Data; - -import java.util.HashMap; -import java.util.Map; - -@Data -public class BaseRequest { - private Map parameters = new HashMap(); - private String systemCode; - private String houseCode; - - public String getSystemCode() { - return this.systemCode; - } - - public void setSystemCode(String systemCode) { - this.systemCode = systemCode; - } - - public String getHouseCode() { - return this.houseCode; - } - - public void setHouseCode(String houseCode) { - this.houseCode = houseCode; - } - - public BaseRequest() { - } - - public Map getParameters() { - return this.parameters; - } - - public void setParameters(Map parameters) { - this.parameters = parameters; - } - - public Object getParameter(String key) { - return this.parameters.get(key); - } - - public void putParameter(String key, String object) { - this.parameters.put(key, object); - } -} - diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/BaseResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/BaseResponse.java deleted file mode 100644 index 0920b034..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/BaseResponse.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.nl.acs.ext.wms.data; - -import com.alibaba.fastjson.JSONArray; -import lombok.Data; - -import java.util.HashMap; -import java.util.Map; - -@Data -public class BaseResponse { - - private Integer status = 0; - private String message; - private JSONArray errArr = new JSONArray(); - private Map parameters = new HashMap(); - - public BaseResponse() { - } - - public Integer getstatus() { - return this.status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public String getMessage() { - return this.message; - } - - public void setMessage(String message) { - this.message = message; - } - - public Map getParameters() { - return this.parameters; - } - - public void setParameters(Map parameters) { - this.parameters = parameters; - } - - public Object getParameter(String key) { - return this.parameters.get(key); - } - - public void putParameter(String key, String object) { - this.parameters.put(key, object); - } - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CancelTaskRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CancelTaskRequest.java deleted file mode 100644 index e2aea4c8..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CancelTaskRequest.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.nl.acs.ext.wms.data; - -import lombok.Data; - -import java.util.Map; - -@Data -public class CancelTaskRequest extends BaseRequest { - - /** - * 任务标识 - */ - private String ext_task_id; - - /** - * 任务编号 - */ - private String task_code; - - /** - * 载具号 - */ - String vehicle_code; - - /** - * 扩展属性 - */ - Map params; - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CancelTaskResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CancelTaskResponse.java deleted file mode 100644 index 7a24424d..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CancelTaskResponse.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.nl.acs.ext.wms.data; - -public class CancelTaskResponse extends BaseResponse { - - - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java deleted file mode 100644 index 5ec4d374..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.nl.acs.ext.wms.data; - -import lombok.Data; - -import java.util.Map; - -@Data -public class CreateTaskRequest extends BaseRequest { - - /** - * 任务标识 - */ - private String ext_task_id; - - /** - * 任务编号 - */ - private String task_code; - - - /** - * 取货点1 - */ - String start_device_code; - - /** - * 放货点1 - */ - String next_device_code; - - /** - * 取货点2 - */ - String start_device_code2; - - /** - * 放货点2 - */ - String next_device_code2; - - /** - * 烘箱对接位 - */ - String put_device_code; - - /** - * 优先级 - */ - String priority; - - /** - * 载具号 - */ - String vehicle_code; - - /** - * 载具类型 - */ - String vehicle_type; - - /** - * 路由方案 - */ - String route_plan_code; - - /** - * 1、生箔; - * 2、分切 - * 3、普通任务 - * 4、叉车任务 - * 5、输送任务 - * 6、行架 - * 7、立库 - * 任务类型 - */ - String task_type; - - /** - * 立库任务类型 - * - */ - String dtl_type; - - /** - * Agv系统类型 - * 1:1楼叉车系统 - * 2:2楼1区域AGV系统 - * 3:2楼2区域AGV系统 - */ - String agv_system_type; - - /** - * 备注 - */ - String remark; - - /** - * 烘箱时间 - */ - String oven_time; - - /** - * 烘箱温度 - */ - String temperature; - - /** - * 扩展属性 - */ - Map params; - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskResponse.java deleted file mode 100644 index 40a39188..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskResponse.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.nl.acs.ext.wms.data; - -public class CreateTaskResponse extends BaseResponse { - - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/LiKuApplyTakResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/LiKuApplyTakResponse.java deleted file mode 100644 index 73855488..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/LiKuApplyTakResponse.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.nl.acs.ext.wms.data; - -import lombok.Data; - -@Data -public class LiKuApplyTakResponse extends BaseResponse { - - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/LiKuApplyTaskRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/LiKuApplyTaskRequest.java deleted file mode 100644 index 5eca1953..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/LiKuApplyTaskRequest.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.nl.acs.ext.wms.data; - -import lombok.Data; - -@Data -public class LiKuApplyTaskRequest extends BaseRequest { - private String vehicle_code; - private String device_code; -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/PutActionRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/PutActionRequest.java deleted file mode 100644 index 4f2ddf2b..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/PutActionRequest.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.nl.acs.ext.wms.data; - -import lombok.Data; - -import java.util.Map; - -@Data -public class PutActionRequest extends BaseRequest { - - /** - * 设备号 - */ - String device_code; - - /** - * - */ - String code; - - /** - * - */ - String value; - - /** - * 扩展属性 - */ - Map params; - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/PutActionResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/PutActionResponse.java deleted file mode 100644 index 9fd64b94..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/PutActionResponse.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.nl.acs.ext.wms.data; - -public class PutActionResponse extends BaseResponse { - - - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/UpdateLKTaskRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/UpdateLKTaskRequest.java deleted file mode 100644 index 16dc6e64..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/UpdateLKTaskRequest.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.nl.acs.ext.wms.data; - -import lombok.Data; - -import java.util.Map; - -@Data -public class UpdateLKTaskRequest extends BaseRequest { - - /** - * 任务标识 - */ - private String ext_task_id; - - /** - * 任务编号 - */ - private String task_code; - - /** - * 载具号 - */ - String vehicle_code; - - /** - * 立库任务类型 - */ - String dtl_type; - - /** - * 类型 - */ - String type; - - /** - * 原库位 - */ - String srcLocation; - - /** - * 新库位 - */ - String destLocation; -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/UpdateLKTaskResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/UpdateLKTaskResponse.java deleted file mode 100644 index 3f28cf75..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/UpdateLKTaskResponse.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.nl.acs.ext.wms.data; - -import java.util.Map; - -public class UpdateLKTaskResponse extends BaseResponse { - - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/BaseResponseData.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/BaseResponseData.java deleted file mode 100644 index 01732d7e..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/BaseResponseData.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 响应 data 公共基础类 - * 1、入库任务下发 - * 2、出库任务下发 - * 3、空托盘出库任务下发 - * 4、移库任务下发 - * 5、入库任务调整 - * 6、移库任务调整 - * 7、入库任务上报 - * 8、出库任务上报 - * 9、移库任务上报 - * 10、任务取消 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class BaseResponseData { - public String orderId; -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/BaseStoreReportRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/BaseStoreReportRequest.java deleted file mode 100644 index ed5e9574..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/BaseStoreReportRequest.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 任务上报请求参数基础类 - * 1、入库上报 - * 2、出库上报 - * 3、移库上报 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class BaseStoreReportRequest { - /** - * 任务编号 - * WCS内部任务编号,本次任务的唯一标识 - */ - public String orderId; - /** - * 托盘条码信息 - */ - public String palletCode; - /** - * 原库位号 - * 托盘的存储库位编号。具体库位编号需要双方商定 - */ - public String srcLocation; - /** - * 目的库位号 - * 托盘的目的存储库位编号。具体库位编号需要双方商定 - */ - public String destLocation; - /** - * 入库任务上报 1 已接收 2 开始执行 3执行完成 4 阻挡 5 空洞 - * 出库任务上报 1已接收任务,2开始执行,3执行完成 - * 移库任务上报 1 已接收 2开始执行3 执行完成 4 起点库位有货被阻挡 5目的点库位无货被阻挡 - */ - public String state; - - public String robotId; - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/BaseStoreRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/BaseStoreRequest.java deleted file mode 100644 index 0c6842a8..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/BaseStoreRequest.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 任务下发请求参数基础类 - * 1、入库任务下发 - * 2、出库任务-批量下发 - * 3、空托盘出库任务下发 - * 4、移库任务-批量下发 - * 5、入库任务调整 - * 6、移库任务调整 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class BaseStoreRequest { - /** - * 任务编号 - * WCS内部任务编号,本次任务的唯一标识 - */ - public String orderId; - /** - * 楼层编号 - */ - public int floorNo; - /** - * 托盘条码信息 - */ - public String palletCode; - /** - * 原库位号 - * 托盘的存储库位编号。具体库位编号需要双方商定 - */ - public String srcLocation; - /** - * 目的库位号 - * 托盘的目的存储库位编号。具体库位编号需要双方商定 - */ - public String destLocation; -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/CancelTaskRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/CancelTaskRequest.java deleted file mode 100644 index bea5ccea..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/CancelTaskRequest.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 取消任务请求参数类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class CancelTaskRequest { - /** - * 任务编号 - * WCS内部任务编号,本次任务的唯一标识 - */ - public String orderId; - /** - * 托盘条码信息 - */ - public String palletCode; - /** - * 原库位号 - * 托盘的存储库位编号。具体库位编号需要双方商定 - */ - public String srcLocation; - /** - * 目的库位号 - * 托盘的目的存储库位编号。具体库位编号需要双方商定 - */ - public String destLocation; - /** - * 任务类型 - * 1 入库,2 出库,3 移库,4 空托盘入库,5 空托盘出库 - */ - public int taskType; -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/CancelTaskResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/CancelTaskResponse.java deleted file mode 100644 index b89f4f11..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/CancelTaskResponse.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 取消任务响应参数 Data类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class CancelTaskResponse extends BaseResponseData { -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/DeviceStatusData.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/DeviceStatusData.java deleted file mode 100644 index a2b5c347..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/DeviceStatusData.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -@Data -public class DeviceStatusData { - - String deviceId; - - String x; - - String y; - - //楼层 - String mapId; - - //电量 - String power; - - //托盘 - String pallet; - - //有无货 - String load; - - //报警 - String alarm; - - //任务号 - String taskId; - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/DeviceStatusRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/DeviceStatusRequest.java deleted file mode 100644 index 006bbaa7..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/DeviceStatusRequest.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -@Data -public class DeviceStatusRequest { - - String deviceId; - - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/DeviceStatusResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/DeviceStatusResponse.java deleted file mode 100644 index b50b15be..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/DeviceStatusResponse.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -public class DeviceStatusResponse { - - String result; - - String code; - - String comment; - - DeviceStatusData data; - - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/EmptyVehicleOutStoreRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/EmptyVehicleOutStoreRequest.java deleted file mode 100644 index 207894bc..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/EmptyVehicleOutStoreRequest.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 空托盘出库任务下发 请求参数类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class EmptyVehicleOutStoreRequest extends BaseStoreRequest { -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/EmptyVehicleOutStoreResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/EmptyVehicleOutStoreResponse.java deleted file mode 100644 index d189f410..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/EmptyVehicleOutStoreResponse.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 空托盘任务下发响应参数Data类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class EmptyVehicleOutStoreResponse extends BaseResponseData { -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreReportRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreReportRequest.java deleted file mode 100644 index 70493dcd..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreReportRequest.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 入库任务上报请求参数类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class InStoreReportRequest extends BaseStoreReportRequest { -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreReportResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreReportResponse.java deleted file mode 100644 index e12fb501..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreReportResponse.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 入库任务上报 响应参数Data类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class InStoreReportResponse extends BaseResponseData { - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreRequest.java deleted file mode 100644 index 9d72850b..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreRequest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 入库任务下发请求参数类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class InStoreRequest extends BaseStoreRequest { - /** - * 任务类型 - * 1代表正常载货托盘入库,2代表空托盘入库 - */ - public int type; -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreResetRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreResetRequest.java deleted file mode 100644 index 2d276a21..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreResetRequest.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 入库任务调整请求参数类 - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class InStoreResetRequest extends BaseStoreRequest { -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreResetResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreResetResponse.java deleted file mode 100644 index 525c1424..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreResetResponse.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 入库任务调整 响应参数Data类 - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class InStoreResetResponse extends BaseResponseData { -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreResponse.java deleted file mode 100644 index fb409f6f..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreResponse.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 入库任务下发响应参数 Data类 - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class InStoreResponse extends BaseResponseData { -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreTaskUpdateRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreTaskUpdateRequest.java deleted file mode 100644 index 30a2060f..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreTaskUpdateRequest.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -@Data -public class InStoreTaskUpdateRequest extends BaseResponseData { - - /** - * 任务编号 - * WCS内部任务编号,本次任务的唯一标识 - */ - public String orderId; - /** - * 托盘条码信息 - */ - public String palletCode; - /** - * 原库位号 - * 托盘的存储库位编号。具体库位编号需要双方商定 - */ - public String srcLocation; - /** - * 目的库位号 - * 托盘的目的存储库位编号。具体库位编号需要双方商定 - */ - public String destLocation; - - /** - * 楼层 - */ - public int floorNo; - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreTaskUpdateResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreTaskUpdateResponse.java deleted file mode 100644 index 8dcb1ea7..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/InStoreTaskUpdateResponse.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - - -public class InStoreTaskUpdateResponse extends BaseStoreRequest { - - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreReportRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreReportRequest.java deleted file mode 100644 index 93f933c5..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreReportRequest.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -/** - * 移库上报请求参数类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -public class MoveStoreReportRequest extends BaseStoreReportRequest { -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreReportResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreReportResponse.java deleted file mode 100644 index d338bc65..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreReportResponse.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 移库上报响应参数 Data类 - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class MoveStoreReportResponse extends BaseResponseData { -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreRequest.java deleted file mode 100644 index e2873c63..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreRequest.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -import java.util.List; - -/** - * 移库任务下发请求参数类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class MoveStoreRequest { - /** - * 任务组编号 - * WCS内部任务组编号,本组任务的唯一标识 - */ - public String groupId; - - /** - * 任务信息,可批量下发 - */ - public List orderInfos; -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreResetRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreResetRequest.java deleted file mode 100644 index 48c6ef13..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreResetRequest.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 移库任务调整请求参数类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class MoveStoreResetRequest extends BaseStoreRequest { -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreResetResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreResetResponse.java deleted file mode 100644 index 39b81e31..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreResetResponse.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 移库任务调整响应参数Data类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class MoveStoreResetResponse extends BaseResponseData { -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreResponse.java deleted file mode 100644 index 514303ae..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreResponse.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 移库任务下发响应参数Data类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class MoveStoreResponse extends BaseResponseData { -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreTaskUpdateRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreTaskUpdateRequest.java deleted file mode 100644 index 20b73d8d..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreTaskUpdateRequest.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -@Data -public class MoveStoreTaskUpdateRequest { - - /** - * 任务编号 - * WCS内部任务编号,本次任务的唯一标识 - */ - public String orderId; - /** - * 托盘条码信息 - */ - public String palletCode; - /** - * 原库位号 - * 托盘的存储库位编号。具体库位编号需要双方商定 - */ - public String srcLocation; - /** - * 目的库位号 - * 托盘的目的存储库位编号。具体库位编号需要双方商定 - */ - public String destLocation; - - /** - * 楼层 - */ - public int floorNo; -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreTaskUpdateResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreTaskUpdateResponse.java deleted file mode 100644 index 248ac3df..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/MoveStoreTaskUpdateResponse.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - - -public class MoveStoreTaskUpdateResponse extends BaseStoreRequest { - - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/OutStoreReportRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/OutStoreReportRequest.java deleted file mode 100644 index d0557059..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/OutStoreReportRequest.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 出库任务上报请求参数类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class OutStoreReportRequest extends BaseStoreReportRequest { -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/OutStoreReportResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/OutStoreReportResponse.java deleted file mode 100644 index e22ec421..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/OutStoreReportResponse.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 出库任务上报响应参数Data类 - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class OutStoreReportResponse extends BaseResponseData { -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/OutStoreRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/OutStoreRequest.java deleted file mode 100644 index 3fefe797..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/OutStoreRequest.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -import java.util.List; - -/** - * 出库任务下发请求参数类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class OutStoreRequest { - - /** - * 任务组编号 - * WCS内部任务组编号,本组任务的唯一标识 - */ - public String groupId; - - /** - * 任务信息,可批量下发 - */ - public List orderInfos; - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/OutStoreResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/OutStoreResponse.java deleted file mode 100644 index b1500618..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/OutStoreResponse.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 出库任务下发响应参数Data类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class OutStoreResponse extends BaseResponseData { -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/Resp.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/Resp.java deleted file mode 100644 index 2e9aee84..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/Resp.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 调用立库接口统一返回参数类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class Resp { - /** - * 成功返回true,失败返回false - */ - public String result; - - /** - * 错误码(0表示成功)1代表入库目的位置有货,其他更多情况待定 - */ - public String code; - - /** - * 错误信息,如果成功则为null - */ - public String comment; - - /** - * 报文携带的数据 - */ - public T data; -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/RoadWayIsLockRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/RoadWayIsLockRequest.java deleted file mode 100644 index 7e6852ec..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/RoadWayIsLockRequest.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 巷道锁定解锁请求参数类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class RoadWayIsLockRequest { - /** - * 楼层编号 - */ - public int floorNo; - /** - * 是否锁定 - * true代表锁定,false代表解锁 - */ - public String isLock; - /** - * 巷道编号 - * 需要解锁或锁定的巷道编号。具体巷道编号需要双方商定 - */ - public String roadwayNo; - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/RoadWayIsLockResponse.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/RoadWayIsLockResponse.java deleted file mode 100644 index 6770a9bc..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/RoadWayIsLockResponse.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -/** - * 巷道锁定解锁响应参数Data类 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Data -public class RoadWayIsLockResponse extends BaseResponseData { -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/putEmptyPalletRequest.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/putEmptyPalletRequest.java deleted file mode 100644 index 2d921b86..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/liKuData/putEmptyPalletRequest.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.nl.acs.ext.wms.liKuData; - -import lombok.Data; - -@Data -public class putEmptyPalletRequest { - - String deviceId; - - String orderId; - - String type; - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToLiKuController.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToLiKuController.java deleted file mode 100644 index 494393c0..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToLiKuController.java +++ /dev/null @@ -1,114 +0,0 @@ - -package org.nl.acs.ext.wms.rest; - - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.ext.wms.liKuData.*; -import org.nl.acs.ext.wms.service.AcsToLiKuService; -import org.nl.acs.ext.wms.service.AcsToWmsService; -import org.nl.modules.logging.InterfaceLogType; -import org.nl.modules.logging.annotation.Log; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.Map; - -/** - * @author ludj - * @date 2021-07-21 - **/ -@RestController -@RequiredArgsConstructor -@Api(tags = "立库接口") -@RequestMapping("/api/liku") -@Slf4j -public class AcsToLiKuController { - private final AcsToLiKuService acsToLiKuService; - - @PostMapping("/inStore") - @Log(value = "下发立库入库任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LK) - @ApiOperation("下发立库物料入库任务") - public ResponseEntity inStore(@RequestBody InStoreRequest requestParam) { - return new ResponseEntity<>(acsToLiKuService.inStore(requestParam), HttpStatus.OK); - } - - @PostMapping("/outStore") - @Log(value = "下发立库出库任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LK) - @ApiOperation("下发立库出库任务") - public ResponseEntity outStore(@RequestBody OutStoreRequest requestParam) { - return new ResponseEntity<>(acsToLiKuService.outStore(requestParam), HttpStatus.OK); - } - - @PostMapping("/emptyVehicleOutStore") - @Log(value = "下发立库空盘出库任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LK) - @ApiOperation("下发立库空盘出库任务") - public ResponseEntity emptyVehicleOutStore(@RequestBody EmptyVehicleOutStoreRequest requestParam) { - return new ResponseEntity<>(acsToLiKuService.emptyVehicleOutStore(requestParam), HttpStatus.OK); - } - - @PostMapping("/moveStore") - @Log(value = "下发立库移库任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LK) - @ApiOperation("下发立库移库任务") - public ResponseEntity moveStore(@RequestBody MoveStoreRequest requestParam) { - return new ResponseEntity<>(acsToLiKuService.moveStore(requestParam), HttpStatus.OK); - } - - @PostMapping("/inStoreReset") - @Log(value = "下发立库入库任务调整",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LK) - @ApiOperation("下发立库入库任务调整") - public ResponseEntity inStoreReset(@RequestBody InStoreResetRequest requestParam) { - return new ResponseEntity<>(acsToLiKuService.inStoreReset(requestParam), HttpStatus.OK); - } - - @PostMapping("/moveStoreReset") - @Log(value = "下发立库移库任务调整",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LK) - @ApiOperation("下发立库移库任务调整") - public ResponseEntity moveStoreReset(@RequestBody MoveStoreResetRequest requestParam) { - return new ResponseEntity<>(acsToLiKuService.moveStoreReset(requestParam), HttpStatus.OK); - } - - @PostMapping("/roadWayIsLock") - @Log(value = "下发立库巷道锁定或解锁",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LK) - @ApiOperation("向立库下发巷道锁定或解锁") - public ResponseEntity roadWayIsLock(@RequestBody RoadWayIsLockRequest requestParam) { - return new ResponseEntity<>(acsToLiKuService.roadWayIsLock(requestParam), HttpStatus.OK); - } - - @PostMapping("/cancelTask") - @Log(value = "取消立库任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LK) - @ApiOperation("取消立库任务") - public ResponseEntity cancelTask(@RequestBody CancelTaskRequest requestParam) { - return new ResponseEntity<>(acsToLiKuService.cancelTask(requestParam), HttpStatus.OK); - } - - @PostMapping("/queryCarStatus") - @Log(value = "查询四向车状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LK) - @ApiOperation("查询四向车状态") - public ResponseEntity queryCarStatus(@RequestBody DeviceStatusRequest requestParam) { - return new ResponseEntity<>(acsToLiKuService.queryCarDeviceStatus(requestParam), HttpStatus.OK); - } - - @PostMapping("/queryTsjStatus") - @Log(value = "查询提升机状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LK) - @ApiOperation("查询提升机状态") - public ResponseEntity queryTsjStatus(@RequestBody DeviceStatusRequest requestParam) { - return new ResponseEntity<>(acsToLiKuService.queryTsjDeviceStatus(requestParam), HttpStatus.OK); - } - - @PostMapping("/querySsxStatus") - @Log(value = "查询提升机状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LK) - @ApiOperation("查询提升机状态") - public ResponseEntity querySsxStatus(@RequestBody DeviceStatusRequest requestParam) { - return new ResponseEntity<>(acsToLiKuService.queryTsjDeviceStatus(requestParam), HttpStatus.OK); - } - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java index 35965e4a..b1f50492 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java +++ b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java @@ -8,10 +8,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest; -import org.nl.acs.ext.wms.data.LiKuApplyTaskRequest; import org.nl.acs.ext.wms.service.AcsToWmsService; -import org.nl.modules.logging.InterfaceLogType; import org.nl.modules.logging.annotation.Log; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -35,43 +32,50 @@ public class AcsToWmsController { private final AcsToWmsService acstowmsService; @PostMapping("/applyTask") - @Log(value = "ACS向WMS申请任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS) - @ApiOperation("ACS向WMS申请任务") - public ResponseEntity applyTaskToWms(@RequestBody JSONObject jo) { - return new ResponseEntity<>(acstowmsService.applyTaskToWms(jo), HttpStatus.OK); + @Log("向WMS申请任务") + @ApiOperation("向WMS申请任务") + public ResponseEntity applyTaskToWms(@RequestBody String device_code, String container_code, int height, int weight) { + return new ResponseEntity<>(acstowmsService.applyTaskToWms(device_code, container_code, height, weight), HttpStatus.OK); } @PostMapping("/taskStatusFeedback") - @Log(value = "ACS向WMS反馈任务状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS) - @ApiOperation("ACS向WMS反馈任务状态") + @Log("向WMS反馈任务状态") + @ApiOperation("向WMS反馈任务状态") public ResponseEntity feedbackTaskStatusToWms(@RequestBody Map whereJson) { JSONArray data = JSONArray.parseArray(String.valueOf(whereJson)); return new ResponseEntity<>(acstowmsService.feedbackTaskStatusToWms(data), HttpStatus.OK); } + @PostMapping("/pointStatusFeedback") + @Log("向WMS反馈点位状态") + @ApiOperation("向WMS反馈点位状态") + public ResponseEntity feedbackPointStatusToWms(@RequestBody Map whereJson) { + return new ResponseEntity<>(acstowmsService.feedbackPointStatusToWms(whereJson), HttpStatus.OK); + } + @PostMapping("/feedbackAgvStatus") - @Log(value = "反馈AGV设备状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS) + @Log("反馈AGV设备状态") @ApiOperation("反馈AGV设备状态") public ResponseEntity feedbackAgvStatus(@RequestBody String device_code, String error, String error_message) { return new ResponseEntity<>(acstowmsService.feedbackAgvStatus(device_code, error, error_message), HttpStatus.OK); } @PostMapping("/feedbackAgv") - @Log(value = "反馈AGV设备信息",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS) + @Log("反馈AGV设备信息") @ApiOperation("反馈AGV设备信息") public ResponseEntity feedbackAgv(@RequestBody JSONArray from) { return new ResponseEntity<>(acstowmsService.feedbackAgv(from), HttpStatus.OK); } @PostMapping("/feedbackDeviceStatus") - @Log(value = "反馈设备状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS) + @Log("反馈设备状态") @ApiOperation("反馈设备状态") public ResponseEntity feedbackDeviceStatus(@RequestBody String device_code, String code, String value) { return new ResponseEntity<>(acstowmsService.feedbackDeviceStatus(device_code, code, value), HttpStatus.OK); } @PostMapping("/feedbackOrderStatus") - @Log(value = "ACS强制完成向WMS反馈",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS) + @Log("acs强制完成向wms反馈") @ApiOperation("acs强制完成向wms反馈") public ResponseEntity feedbackOrderStatus(@RequestBody JSONObject param) { return new ResponseEntity<>(acstowmsService.feedbackOrderStatus(param), HttpStatus.OK); @@ -79,30 +83,30 @@ public class AcsToWmsController { @PostMapping("/applyInCacheLineTask") - @Log(value = "ACS申请缓存线入库任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS) + @Log("ACS申请缓存线入库任务") @ApiOperation("ACS申请缓存线入库任务") public ResponseEntity applyInCacheLineTask(@RequestBody JSONObject param) { return new ResponseEntity<>(acstowmsService.applyInCacheLineTask(param), HttpStatus.OK); } @PostMapping("/applyOutCacheLineTask") - @Log(value = "ACS系统申请出库任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS) + @Log("ACS系统申请出库任务") @ApiOperation("ACS系统申请出库任务") public ResponseEntity applyOutCacheLineTask(@RequestBody JSONObject param) { return new ResponseEntity<>(acstowmsService.applyOutCacheLineTask(param), HttpStatus.OK); } - @PostMapping("/applyLabelingAndBindingRequest") - @Log(value = "ACS系统申请贴标、捆扎",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS) - @ApiOperation("ACS系统申请贴标、捆扎") - public ResponseEntity applyLabelingAndBindingRequest(@RequestBody ApplyLabelingAndBindingRequest param) { - return new ResponseEntity<>(acstowmsService.applyLabelingAndBindingRequest(param), HttpStatus.OK); + @PostMapping("/feedDeviceStatusType") + @Log("向wms反馈设备状态") + @ApiOperation("向wms反馈设备状态") + public ResponseEntity feedDeviceStatusType(@RequestBody JSONObject param) { + return new ResponseEntity<>(acstowmsService.feedDeviceStatusType(param), HttpStatus.OK); } - @PostMapping("/liKuApplyTaskRequest") - @Log(value = "立库申请任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS) - @ApiOperation("立库申请任务") - public ResponseEntity liKuApplyTaskRequest(@RequestBody LiKuApplyTaskRequest param) { - return new ResponseEntity<>(acstowmsService.liKuApplyTaskRequest(param), HttpStatus.OK); + @PostMapping("/feedOrderRealQty") + @Log("向wms订单实时数量") + @ApiOperation("向wms订单实时数量") + public ResponseEntity feedOrderRealQty(@RequestBody JSONObject param) { + return new ResponseEntity<>(acstowmsService.feedOrderRealQty(param), HttpStatus.OK); } } diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/LiKuToACSController.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/LiKuToACSController.java deleted file mode 100644 index e140f01b..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/LiKuToACSController.java +++ /dev/null @@ -1,68 +0,0 @@ - -package org.nl.acs.ext.wms.rest; - - -import cn.dev33.satoken.annotation.SaIgnore; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import jdk.nashorn.internal.ir.annotations.Ignore; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.ext.wms.liKuData.*; -import org.nl.acs.ext.wms.service.AcsToLiKuService; -import org.nl.acs.ext.wms.service.LiKuToAcsService; -import org.nl.modules.logging.InterfaceLogType; -import org.nl.modules.logging.annotation.Log; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * @author wangs - * @date 2021-07-21 - **/ -@RestController -@RequiredArgsConstructor -@Api(tags = "立库接口") -@RequestMapping("/api/likuToACS") -@Slf4j -public class LiKuToACSController { - private final LiKuToAcsService liKuToAcsService; - - @SaIgnore - @PostMapping("/inStoreReport") - @Log(value = "立库反馈入库任务状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LK_TO_ACS) - @ApiOperation("立库反馈入库任务状态") - public ResponseEntity inStoreReport(@RequestBody InStoreReportRequest requestParam) throws Exception { - return new ResponseEntity<>(liKuToAcsService.inStoreReport(requestParam), HttpStatus.OK); - } - - @SaIgnore - @PostMapping("/outStoreReport") - @Log(value = "立库反馈出库任务状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LK_TO_ACS) - @ApiOperation("立库反馈出库任务状态") - public ResponseEntity outStoreReport(@RequestBody OutStoreReportRequest requestParam) throws Exception { - return new ResponseEntity<>(liKuToAcsService.outStoreReport(requestParam), HttpStatus.OK); - } - - @SaIgnore - @PostMapping("/moveStoreReport") - @Log(value = "立库反馈移库任务状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LK_TO_ACS) - @ApiOperation("立库反馈移库任务状态") - public ResponseEntity moveStoreReport(@RequestBody MoveStoreReportRequest requestParam) throws Exception { - return new ResponseEntity<>(liKuToAcsService.moveStoreReport(requestParam), HttpStatus.OK); - } - - @SaIgnore - @PostMapping("/putEmptyPallet") - @Log(value = "立库请求放空盘",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LK_TO_ACS) - @ApiOperation("立库请求放空盘") - public ResponseEntity putEmptyPallet(@RequestBody putEmptyPalletRequest requestParam) throws Exception { - return new ResponseEntity<>(liKuToAcsService.putEmptyPallet(requestParam), HttpStatus.OK); - } - - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java index b004859c..2e7479db 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java +++ b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java @@ -2,15 +2,12 @@ package org.nl.acs.ext.wms.rest; -import cn.dev33.satoken.annotation.SaIgnore; import com.alibaba.fastjson.JSONObject; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.nl.acs.ext.wms.data.CreateTaskResponse; import org.nl.acs.ext.wms.service.WmsToAcsService; -import org.nl.modules.logging.InterfaceLogType; import org.nl.modules.logging.annotation.Log; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -32,73 +29,73 @@ public class WmsToAcsController { private final WmsToAcsService wmstoacsService; @PostMapping("/task") - @Log(value = "ACS接收WMS任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) + @Log("接收WMS任务") @ApiOperation("接收WMS任务") - @SaIgnore public ResponseEntity createFromWms(@RequestBody String whereJson) { - return new ResponseEntity<>(wmstoacsService.crateTask(whereJson), HttpStatus.OK); + return new ResponseEntity<>(wmstoacsService.createFromWms(whereJson), HttpStatus.OK); } @PostMapping("/cancelTask") - @Log(value = "WMS取消任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) + @Log("WMS取消任务") @ApiOperation("WMS取消任务") - @SaIgnore public ResponseEntity cancelFromWms(@RequestBody String whereJson) throws Exception { return new ResponseEntity<>(wmstoacsService.cancelFromWms(whereJson), HttpStatus.OK); } @PostMapping("/updateDeviceGoodsFromWms") - @Log(value = "WMS修改点位状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) + @Log("WMS修改点位状态") @ApiOperation("WMS修改点位状态") public ResponseEntity updateDeviceGoodsFromWms(@RequestBody String whereJson) { return new ResponseEntity<>(wmstoacsService.updateDeviceGoodsFromWms(whereJson), HttpStatus.OK); } @PostMapping("/areaControl") - @Log(value = "区域控制",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) + @Log("区域控制") @ApiOperation("区域控制") public ResponseEntity areaControl(@RequestBody JSONObject whereJson) { return new ResponseEntity<>(wmstoacsService.areaControl(whereJson), HttpStatus.OK); } @PostMapping("/action") - @Log(value = "WMS下发点位信号",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) - @ApiOperation("WMS下发点位信号") - @SaIgnore + @Log("下发动作") + @ApiOperation("WMS修改点位状态") public ResponseEntity putAction(@RequestBody String whereJson) throws Exception { return new ResponseEntity<>(wmstoacsService.putAction(whereJson), HttpStatus.OK); } @PostMapping("/querydevice") -// @Log(value = "WMS查询设备状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) - @ApiOperation("WMS查询设备状态") - @SaIgnore + @Log("查询设备状态") + @ApiOperation("查询设备状态") public ResponseEntity queryDevice(@RequestBody String whereJson) throws Exception { return new ResponseEntity<>(wmstoacsService.queryDevice(whereJson), HttpStatus.OK); } + @PostMapping("/order") + @Log("wms下发acs工单") + @ApiOperation("wms下发acs工单") + public ResponseEntity actionOrder(@RequestBody String whereJson){ + return new ResponseEntity<>(wmstoacsService.actionOrder(whereJson), HttpStatus.OK); + } + + @PostMapping("/orderStatusUpdate") + @Log("工单状态变更") + @ApiOperation("工单状态变更") + public ResponseEntity orderStatusUpdate(@RequestBody String whereJson){ + return new ResponseEntity<>(wmstoacsService.orderStatusUpdate(whereJson), HttpStatus.OK); + } + @PostMapping("/queryDeviceDBValue") - @Log(value = "WMS查询设备DB值",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) - @ApiOperation("WMS查询设备DB值") - @SaIgnore + @Log("查询设备DB值") + @ApiOperation("查询设备DB值") public ResponseEntity queryDeviceDBValue(@RequestBody String whereJson){ return new ResponseEntity<>(wmstoacsService.queryDeviceDBValue(whereJson), HttpStatus.OK); } - - @PostMapping("/putPlusPullAction") - @Log(value = "WMS下发插拔轴动作",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) - @ApiOperation("WMS下发插拔轴动作") - @SaIgnore - public ResponseEntity putPlusPullAction(@RequestBody String whereJson){ - return new ResponseEntity<>(wmstoacsService.putPlusPullAction(whereJson), HttpStatus.OK); + @PostMapping("/replaceDevice") + @Log("工单更换设备") + @ApiOperation("工单更换设备") + public ResponseEntity replaceDevice(@RequestBody String whereJson){ + return new ResponseEntity<>(wmstoacsService.replaceDevice(whereJson), HttpStatus.OK); } - @PostMapping("/updateTask") - @Log(value = "WMS更新任务点位状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) - @ApiOperation("WMS更新任务点位状态") - @SaIgnore - public ResponseEntity updateTask(@RequestBody String whereJson){ - return new ResponseEntity<>(wmstoacsService.updateTask(whereJson), HttpStatus.OK); - } } diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToLiKuService.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToLiKuService.java deleted file mode 100644 index 60c427e7..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToLiKuService.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.nl.acs.ext.wms.service; - -import com.alibaba.fastjson.JSONObject; -import org.nl.acs.ext.wms.liKuData.*; -import org.nl.acs.instruction.service.dto.Instruction; - -/** - * @author: geng by - * @createDate: 2022/11/24 - */ -public interface AcsToLiKuService { - - - public Resp sendInst(String type, Instruction inst); - - /** - * 入库任务下发 - * @param requestParam - * @return - */ - public Resp inStore(InStoreRequest requestParam); - - /** - * 出库任务下发 - * @param requestParam - * @return - */ - public Resp outStore(OutStoreRequest requestParam); - - /** - * 空托盘出库任务下发 - * @param requestParam - * @return - */ - public Resp emptyVehicleOutStore(EmptyVehicleOutStoreRequest requestParam); - - - /** - * 移库任务下发 - * @param requestParam - * @return - */ - public Resp moveStore(MoveStoreRequest requestParam); - - - /** - * 入库任务调整 - * @param requestParam - * @return - */ - public Resp inStoreReset(InStoreResetRequest requestParam); - - - /** - * 移库任务调整 - * @param requestParam - * @return - */ - public Resp moveStoreReset(MoveStoreResetRequest requestParam); - - /** - * 巷道锁定与解锁 - * @return - */ - public Resp roadWayIsLock(RoadWayIsLockRequest requestParam); - - - /** - *取消任务 - * @return - */ - public Resp cancelTask(CancelTaskRequest requestParam); - - /** - *查询小车设备状态 - * @return - */ - public Resp queryCarDeviceStatus(DeviceStatusRequest requestParam); - - /** - *查询tsj设备状态 - * @return - */ - public Resp queryTsjDeviceStatus(DeviceStatusRequest requestParam); - - /** - *查询ssx设备状态 - * @return - */ - public Resp querySsxDeviceStatus(DeviceStatusRequest requestParam); -} - - diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java index 62c53390..8f95b8d1 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java +++ b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java @@ -3,14 +3,15 @@ package org.nl.acs.ext.wms.service; import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import org.nl.acs.ext.wms.data.*; + +import java.util.Map; public interface AcsToWmsService { /** * ACS向WMS申请任务 */ - String applyTaskToWms(JSONObject jo); + String applyTaskToWms(String device_code, String container_code, int height, int weight); /** * 向WMS反馈任务状态 @@ -19,9 +20,35 @@ public interface AcsToWmsService { */ public HttpResponse feedbackTaskStatusToWms(JSONArray arr); + /** + * 向WMS反馈点位状态 + * + * @param jsonObject 条件 + * @return Map + */ + Map feedbackPointStatusToWms(Map jsonObject); + + /** + * 向WMS获取设备状态 + * + * @return + */ + JSONArray getDeviceStatusToWms(); + + /** + * 请求信号交互 + * + * @param + * @return + */ + public HttpResponse requestSignalInteraction(String device_code, String vehicle_code, String action); public String requestTaskAgain(String address, String task_id, String vehicle_code); + public String apply_InEmpty(String device_code, String type, String quantity, String pallet); + + public String apply_OutEmpty(String device_code); + /** * 反馈AGV设备状态 * @@ -91,19 +118,12 @@ public interface AcsToWmsService { HttpResponse applyOutCacheLineTask(JSONObject param); /** - * 申请捆扎、贴标 + * 向wms反馈设备状态 * * @param param * @return */ - ApplyLabelingAndBindingResponse applyLabelingAndBindingRequest(ApplyLabelingAndBindingRequest param); - - LiKuApplyTakResponse liKuApplyTaskRequest(LiKuApplyTaskRequest liKuApplyTaskRequest); - - UpdateLKTaskResponse updateLKTaskRequest(UpdateLKTaskRequest updateLKTaskRequest); - - // 输送线有货变成无货时向lms请求 - HttpResponse shipDeviceUpdate(JSONObject param); + HttpResponse feedDeviceStatusType(JSONObject param); /** * 向wms订单实时数量 @@ -112,12 +132,4 @@ public interface AcsToWmsService { * @return */ HttpResponse feedOrderRealQty(JSONObject param); - - /** - * 向wms反馈设备状态 - * - * @param param - * @return - */ - HttpResponse feedDeviceStatusType(JSONObject param); } diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/LiKuToAcsService.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/LiKuToAcsService.java deleted file mode 100644 index b7394808..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/LiKuToAcsService.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.nl.acs.ext.wms.service; - -import org.nl.acs.ext.wms.liKuData.*; - -/** - * @author: wangs - * @createDate: 2022/11/24 - */ -public interface LiKuToAcsService { - - /** - * 入库任务上报 - * @param requestParam - * @return - */ - public Resp inStoreReport(InStoreReportRequest requestParam) throws Exception; - - /** - * 出库任务上报 - * @param requestParam - * @return - */ - public Resp outStoreReport(OutStoreReportRequest requestParam) throws Exception; - - /** - * 移库任务上报 - * @param requestParam - * @return - */ - public Resp moveStoreReport(MoveStoreReportRequest requestParam) throws Exception; - - - /** - * 移库任务上报 - * @param requestParam - * @return - */ - public Resp putEmptyPallet(putEmptyPalletRequest requestParam) throws Exception; - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java index 7890352d..506b7b32 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java +++ b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java @@ -3,28 +3,25 @@ package org.nl.acs.ext.wms.service; import com.alibaba.fastjson.JSONObject; -import org.nl.acs.ext.wms.data.CancelTaskResponse; -import org.nl.acs.ext.wms.data.CreateTaskResponse; -import org.nl.acs.ext.wms.data.PutActionResponse; import java.util.Map; public interface WmsToAcsService { - /** * 创建任务 - * @param whereJson + * + * @param jsonObject 条件 * @return */ - CreateTaskResponse crateTask(String whereJson); - + Map createFromWms(String jsonObject); /** * 取消任务 * * @param jsonObject 条件 + * @return Map */ - CancelTaskResponse cancelFromWms(String jsonObject) throws Exception; + Map cancelFromWms(String jsonObject) throws Exception; /** * 修改设置有无货属性 @@ -48,7 +45,7 @@ public interface WmsToAcsService { * @param jsonObject 条件 * @return Map */ - PutActionResponse putAction(String jsonObject) throws Exception; + Map putAction(String jsonObject) throws Exception; /** * 查询设备状态 @@ -58,6 +55,20 @@ public interface WmsToAcsService { */ Map queryDevice(String jsonObject) throws Exception; + /** + * wms下发工单 + * @param whereJson + * @return + */ + Map actionOrder(String whereJson); + + /** + * 工单状态变更 + * @param whereJson + * @return + */ + Map orderStatusUpdate(String whereJson); + /** * 查询设备DB值 * @param whereJson @@ -65,31 +76,11 @@ public interface WmsToAcsService { */ Map queryDeviceDBValue(String whereJson); - - /** - * ACS系统在获取空的托盘号 + * 工单更换设备 * @param whereJson * @return */ - Map querydevice(String whereJson); - - - /** - * 下发插拔轴动作 - * - * @param whereJson 条件 - * @return Map - */ - Map putPlusPullAction(String whereJson); - - - /** - * 更新任务点位状态 - * - * @param whereJson 条件 - * @return Map - */ - Map updateTask(String whereJson); + Map replaceDevice(String whereJson); } diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToLiKuServiceImpl.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToLiKuServiceImpl.java deleted file mode 100644 index 1bdb2e8e..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToLiKuServiceImpl.java +++ /dev/null @@ -1,289 +0,0 @@ -package org.nl.acs.ext.wms.service.impl; - -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.AcsConfig; -import org.nl.acs.device.address.service.AddressService; -import org.nl.acs.ext.wms.RespUtil; -import org.nl.acs.ext.wms.AcsUtil; -import org.nl.acs.ext.wms.liKuData.*; -import org.nl.acs.ext.wms.service.AcsToLiKuService; -import org.nl.acs.instruction.service.dto.Instruction; -import org.nl.modules.system.service.ParamService; -import org.nl.modules.wql.util.SpringContextHolder; -import org.slf4j.MDC; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; - -/** - * 立库WCS接口 - * - * @author: geng by - * @createDate: 2022/11/24 - */ -@Service -@RequiredArgsConstructor -@Slf4j -public class AcsToLiKuServiceImpl implements AcsToLiKuService { - - private final AddressService addressService; - - private String log_file_type="log_file_type"; - private String log_type="ACS请求立库"; - - - @Override - public Resp inStore(InStoreRequest requestParam) { - try { - MDC.put(log_file_type, log_type); - String api = addressService.findByCode("inStore").getMethods_url(); - log.info("inStore-----输入参数{}", JSON.toJSONString(requestParam)); - String result = AcsUtil.notifyAcs(api, requestParam); - log.info("inStore-----输出参数{}", result); - return RespUtil.getResp(result, new InStoreResponse()); - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public Resp outStore(OutStoreRequest requestParam) { - try { - MDC.put(log_file_type, log_type); - log.info("outStore-----输入参数{}", JSON.toJSONString(requestParam)); - String api = addressService.findByCode("outStore").getMethods_url(); - String result = AcsUtil.notifyAcs(api, requestParam); - log.info("outStore-----输出参数{}", result); - return RespUtil.getResp(result, new OutStoreResponse()); - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public Resp emptyVehicleOutStore(EmptyVehicleOutStoreRequest requestParam) { - try { - MDC.put(log_file_type, log_type); - log.info("emptyVehicleOutStore-----输入参数{}", JSON.toJSONString(requestParam)); - String api = addressService.findByCode("emptyVehicleOutStore").getMethods_url(); - String result = AcsUtil.notifyAcs(api, requestParam); - log.info("emptyVehicleOutStore-----输出参数{}", result); - return RespUtil.getResp(result, new EmptyVehicleOutStoreResponse()); - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public Resp moveStore(MoveStoreRequest requestParam) { - try { - MDC.put(log_file_type, log_type); - log.info("moveStore-----输入参数{}", JSON.toJSONString(requestParam)); - String api = addressService.findByCode("moveStore").getMethods_url(); - String result = AcsUtil.notifyAcs(api, requestParam); - log.info("moveStore-----输出参数{}", result); - return RespUtil.getResp(result, new MoveStoreResponse()); - - } finally { - MDC.remove(log_file_type); - } - } - - @Override - public Resp inStoreReset(InStoreResetRequest requestParam) { - try { - MDC.put(log_file_type, log_type); - log.info("inStoreReset-----输入参数{}", JSON.toJSONString(requestParam)); - String api = addressService.findByCode("inStoreReset").getMethods_url(); - String result = AcsUtil.notifyAcs(api, requestParam); - log.info("inStoreReset-----输出参数{}", result); - return RespUtil.getResp(result, new InStoreResetResponse()); - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public Resp moveStoreReset(MoveStoreResetRequest requestParam) { - try { - MDC.put(log_file_type, log_type); - log.info("moveStoreReset-----输入参数{}", JSON.toJSONString(requestParam)); - String api = addressService.findByCode("moveStoreReset").getMethods_url(); - String result = AcsUtil.notifyAcs(api, requestParam); - log.info("moveStoreReset-----输出参数{}", result); - return RespUtil.getResp(result, new MoveStoreResetResponse()); - - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public Resp roadWayIsLock(RoadWayIsLockRequest requestParam) { - try { - MDC.put(log_file_type, log_type); - log.info("roadWayIsLock-----输入参数{}", JSON.toJSONString(requestParam)); - String api = addressService.findByCode("roadWayIsLock").getMethods_url(); - String result = AcsUtil.notifyAcs(api, requestParam); - log.info("roadWayIsLock-----输出参数{}", result); - return RespUtil.getResp(result, new RoadWayIsLockResponse()); - - } finally { - MDC.remove(log_file_type); - } - - } - - - @Override - public Resp cancelTask(CancelTaskRequest requestParam) { - try { - MDC.put(log_file_type, log_type); - log.info("cancelTask-----输入参数{}", JSON.toJSONString(requestParam)); - String api = addressService.findByCode("cancelTask").getMethods_url(); - String result = AcsUtil.notifyAcs(api, requestParam); - log.info("cancelTask-----输出参数{}", result); - return RespUtil.getResp(result, new CancelTaskResponse()); - - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public Resp queryCarDeviceStatus(DeviceStatusRequest requestParam) { - try { - MDC.put(log_file_type, log_type); - log.info("queryCarDeviceStatus-----输入参数{}", JSON.toJSONString(requestParam)); - String api = addressService.findByCode("queryCarDeviceStatus").getMethods_url(); - String result = AcsUtil.notifyAcs(api, requestParam); - log.info("queryCarDeviceStatus-----输出参数{}", result); - return RespUtil.getResp(result, new DeviceStatusRequest()); - } finally { - MDC.remove(log_file_type); - } - } - - @Override - public Resp queryTsjDeviceStatus(DeviceStatusRequest requestParam) { - try { - MDC.put(log_file_type, log_type); - log.info("queryTsjDeviceStatus-----输入参数{}", JSON.toJSONString(requestParam)); - String api = addressService.findByCode("queryTsjDeviceStatus").getMethods_url(); - String result = AcsUtil.notifyAcs(api, requestParam); - log.info("queryTsjDeviceStatus-----输出参数{}", result); - return RespUtil.getResp(result, new DeviceStatusRequest()); - } finally { - MDC.remove(log_file_type); - } - } - - @Override - public Resp querySsxDeviceStatus(DeviceStatusRequest requestParam) { - try { - MDC.put(log_file_type, log_type); - log.info("querySsxDeviceStatus-----输入参数{}", JSON.toJSONString(requestParam)); - String api = addressService.findByCode("querySsxDeviceStatus").getMethods_url(); - String result = AcsUtil.notifyAcs(api, requestParam); - log.info("querySsxDeviceStatus-----输出参数{}", result); - return RespUtil.getResp(result, new DeviceStatusRequest()); - } finally { - MDC.remove(log_file_type); - } - } - - @Override - public Resp sendInst(String type, Instruction dto){ - AcsToLiKuService acsToLiKuService = SpringContextHolder.getBean(AcsToLiKuService.class); - ParamService paramService = SpringContextHolder.getBean(ParamService.class); - - Resp resp = new Resp(); - String instSendLk = paramService.findByCode(AcsConfig.INSTSENDLK).getValue(); - - try { - if(StrUtil.equals(instSendLk, "1")){ - if(StrUtil.equals(type,"1")){ - InStoreRequest request = new InStoreRequest(); - request.setFloorNo(Integer.parseInt(dto.getTo_z())); - request.setType(1); - request.setPalletCode(dto.getVehicle_code()); - request.setOrderId(dto.getInstruction_code()); - request.setSrcLocation(dto.getStart_point_code()); - request.setDestLocation(dto.getNext_point_code()); - resp = acsToLiKuService.inStore(request); - //空托入库 - } else if (StrUtil.equals(type,"2")){ - InStoreRequest request = new InStoreRequest(); - request.setFloorNo(Integer.parseInt(dto.getTo_z())); - request.setType(2); - request.setPalletCode(dto.getVehicle_code()); - request.setOrderId(dto.getInstruction_code()); - request.setSrcLocation(dto.getStart_point_code()); - request.setDestLocation(dto.getNext_point_code()); - resp = acsToLiKuService.inStore(request); - //出库 - } else if (StrUtil.equals(type,"3")){ - OutStoreRequest outStore = new OutStoreRequest(); - BaseStoreRequest baseReq = new BaseStoreRequest(); - List list = new ArrayList(); - baseReq.setOrderId(dto.getInstruction_code()); - baseReq.setSrcLocation(dto.getStart_point_code()); - baseReq.setDestLocation(dto.getNext_point_code()); - baseReq.setFloorNo(Integer.parseInt(dto.getFrom_z())); - baseReq.setPalletCode(dto.getVehicle_code()); - list.add(baseReq); - outStore.setOrderInfos(list); - outStore.setGroupId(dto.getInstruction_code()); - resp = acsToLiKuService.outStore(outStore); - //空托出库 - } else if (StrUtil.equals(type,"4")) { - EmptyVehicleOutStoreRequest emptyVehicleOutStoreRequest = new EmptyVehicleOutStoreRequest(); - emptyVehicleOutStoreRequest.setOrderId(dto.getInstruction_code()); - emptyVehicleOutStoreRequest.setFloorNo(Integer.parseInt(dto.getFrom_z())); - emptyVehicleOutStoreRequest.setSrcLocation(dto.getStart_point_code()); - emptyVehicleOutStoreRequest.setDestLocation(dto.getNext_point_code()); - emptyVehicleOutStoreRequest.setPalletCode(dto.getVehicle_code()); - resp = acsToLiKuService.emptyVehicleOutStore(emptyVehicleOutStoreRequest); - //转库 - } else if (StrUtil.equals(type,"5")) { - MoveStoreRequest moveStoreRequest = new MoveStoreRequest(); - BaseStoreRequest baseReq = new BaseStoreRequest(); - List list = new ArrayList(); - baseReq.setFloorNo(Integer.parseInt(dto.getFrom_z())); - baseReq.setPalletCode(dto.getVehicle_code()); - baseReq.setOrderId(dto.getInstruction_code()); - baseReq.setSrcLocation(dto.getStart_point_code()); - baseReq.setDestLocation(dto.getNext_point_code()); - list.add(baseReq); - moveStoreRequest.setGroupId(dto.getInstruction_code()); - moveStoreRequest.setOrderInfos(list); - resp = acsToLiKuService.moveStore(moveStoreRequest); - } - } else { - resp.setCode("0"); - resp.setResult("true"); - resp.setComment("ACS模拟下发成功"); - } - - } catch (Exception e) { - resp.setCode("1"); - resp.setResult("false"); - resp.setComment(e.getMessage()); - } - - return resp; - } - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 7416fb50..e4f5e580 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -5,7 +5,6 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; @@ -14,18 +13,23 @@ import org.nl.acs.AcsConfig; import org.nl.acs.device.address.service.AddressService; import org.nl.acs.device.address.service.dto.AddressDto; import org.nl.acs.device.service.DeviceService; -import org.nl.acs.ext.wms.data.*; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.order.service.ProduceshiftorderService; import org.nl.acs.order.service.dto.ProduceshiftorderDto; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; +import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.system.service.ParamService; +import org.nl.modules.wql.core.bean.WQLObject; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; +import java.util.Map; + @Service @RequiredArgsConstructor @Slf4j @@ -47,37 +51,44 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @Autowired DeviceExecuteLogService logServer; - /*@Value("${acsTowms.token}")*/ +// @Value("${acsTowms.token}") public String token; - - private String log_file_type = "log_file_type"; - private String log_type = "ACS请求LMS"; + private String log_file_type="log_file_type"; + private String log_type="ACS请求WMS"; @Override - public String applyTaskToWms(JSONObject jo) { + public String applyTaskToWms(String device_code, String container_code, int height, int weight) { try { MDC.put(log_file_type, log_type); - log.info("applyTaskToWms-----输入参数{}", jo); String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); AddressDto addressDto = addressService.findByCode("applyTaskToWms"); String url = wmsurl + addressDto.getMethods_url(); + JSONObject param = new JSONObject(); + param.put("height", height); + param.put("weight", weight); + String parent_device_code = ""; + JSONObject jo = new JSONObject(); + JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + device_code + "'").uniqueResult(0); + if (!device_json.isEmpty()) { + parent_device_code = (String) device_json.get("parent_storage_cell") == null ? device_code : (String) device_json.get("parent_storage_cell"); + } + jo.put("device_code", parent_device_code); + jo.put("container_code", container_code); + jo.put("param", param); + log.info("applyTaskToWms-----请求参数{}", jo.toString()); HttpResponse result2 = null; try { + //{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"} result2 = HttpRequest.post(url) .header("Authorization", token) .body(String.valueOf(jo)) .execute(); -// ////System.out.println(result2); + System.out.println(result2); } catch (Exception e) { String msg = e.getMessage(); - log.info("applyTaskToWms-----输出参数{}", msg); //网络不通 -// //System.out.println(msg); - } - if (ObjectUtil.isEmpty(result2)) { - log.info("applyTaskToWms-----输出参数{}", "返回结果为空"); - return null; + System.out.println(msg); } String type = ""; if (result2.getStatus() == 200) { @@ -87,16 +98,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } log.info("applyTaskToWms-----输出参数{}", result2.body()); return result2.body(); - - } finally { + }finally { MDC.remove(log_file_type); } - } @Override public HttpResponse feedbackTaskStatusToWms(JSONArray data) { - try { MDC.put(log_file_type, log_type); String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); @@ -118,16 +126,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { result2 = HttpRequest.post(wmsurl + methods_url) .header("Authorization", token).body(String.valueOf(data)) .execute(); -// //System.out.println(result2); + System.out.println(result2); } catch (Exception e) { String msg = e.getMessage(); //网络不通 -// //System.out.println(msg); - log.info("feedbackTaskStatusToWms-----输出参数{}", msg); - + System.out.println(msg); } - String type = ""; if (result2.getStatus() == 200) { type = "info"; @@ -138,7 +143,104 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { JSONObject jo = JSONObject.parseObject(result2.body()); log.info("feedbackTaskStatusToWms-----输出参数{}", jo.toString()); return result2; - } finally { + }finally { + MDC.remove(log_file_type); + } + + } + + @Override + public Map feedbackPointStatusToWms(Map jsonObject) { + try { + MDC.put(log_file_type, log_type); + AddressDto addressDto = addressService.findByCode("feedbackPointStatusToWms"); + String methods_url = addressDto.getMethods_url(); + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + String url = wmsurl + methods_url; + + JSONObject json = new JSONObject(); + json.put("task_uuid", jsonObject.get("device_code")); + json.put("task_code", jsonObject.get("point_status")); + json.put("task_status", jsonObject.get("point_mode")); + json.put("point_error", jsonObject.get("point_error")); + log.info("feedbackPointStatusToWms----请求参数{}", json.toString()); + try { + String result2 = HttpRequest.post(url) + .body(String.valueOf(json)) + .execute().body(); + System.out.println(result2); + } catch (Exception e) { + String msg = e.getMessage(); + //网络不通 + System.out.println(msg); + + } + + JSONObject resultJson = new JSONObject(); + resultJson.put("status", HttpStatus.OK); + resultJson.put("message", "操作成功"); + resultJson.put("data", new JSONArray()); + log.info("feedbackPointStatusToWms----输出参数{}", resultJson.toString()); + return resultJson; + }finally { + MDC.remove(log_file_type); + } + + } + + @Override + public JSONArray getDeviceStatusToWms() { + try { + MDC.put(log_file_type, log_type); + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + AddressDto addressDto = addressService.findByCode("getDeviceStatusToWms"); + String methods_url = addressDto.getMethods_url(); + String url = wmsurl + methods_url; + String result = ""; + try { + result = HttpRequest.get(url) + .execute().body(); + System.out.println(result); + log.info("getTaskStatusToWms----返回参数{}", result); + } catch (Exception e) { + System.out.println(e.getMessage()); + } + JSONArray jsonArray = JSONArray.parseArray(result); + return jsonArray; + }finally { + MDC.remove(log_file_type); + } + } + + @Override + public HttpResponse requestSignalInteraction(String device_code, String vehicle_code, String action) { + try { + MDC.put(log_file_type, log_type); + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + JSONObject json = new JSONObject(); + json.put("device_code", device_code); + json.put("vehicle_code", vehicle_code); + json.put("action", action); + + AddressDto addressDto = addressService.findByCode("requestSignalInteraction"); + String methods_url = addressDto.getMethods_url(); + String url = wmsurl + methods_url; + HttpResponse result = null; + log.info("requestSignalInteraction----请求参数{}", json.toString()); + try { + result = HttpRequest.post(url) + .body(String.valueOf(json)) + .execute(); + System.out.println(result); + log.info("requestSignalInteraction----返回参数{}", result); + } catch (Exception e) { + String msg = e.getMessage(); + //网络不通 + System.out.println(msg); + + } + return result; + }finally { MDC.remove(log_file_type); } @@ -147,433 +249,396 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @Override public String requestTaskAgain(String address, String task_id, String vehicle_code) { - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - String device_code = deviceService.queryDeviceCodeByAddress(Integer.parseInt(address)); - JSONObject jo = new JSONObject(); - jo.put("task_id", task_id); - String result2 = null; - - AddressDto addressDto = addressService.findByCode("requestTaskAgain"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - log.info("requestTaskAgain----请求参数{}", jo); - try { - result2 = HttpRequest.post(url) - .body(String.valueOf(jo)) - .execute().body(); - //System.out.println(result2); - log.info("requestTaskAgain----返回参数{}", result2); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - //System.out.println(msg); + MDC.put(log_file_type, log_type); + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + String device_code = deviceService.queryDeviceCodeByAddress(Integer.parseInt(address)); + JSONObject jo = new JSONObject(); + jo.put("device_code", device_code); + jo.put("task_id", task_id); + jo.put("vehicle_code", vehicle_code); + String result2 = null; + AddressDto addressDto = addressService.findByCode("requestTaskAgain"); + String methods_url = addressDto.getMethods_url(); + String url = wmsurl + methods_url; + log.info("requestTaskAgain----请求参数{}", jo); + + try { + result2 = HttpRequest.post(url) + .body(String.valueOf(jo)) + .execute().body(); + System.out.println(result2); + log.info("requestTaskAgain----返回参数{}", result2); + } catch (Exception e) { + String msg = e.getMessage(); + //网络不通 + System.out.println(msg); + } + return result2; + }finally { + MDC.remove(log_file_type); } - return result2; + + } + + @Override + public String apply_InEmpty(String device_code, String type, String quantity, String container_code) { + try { + MDC.put(log_file_type, log_type); + + + if (StrUtil.isEmpty(container_code)) { + log.info("apply_InEmpty----空盘入库申请校验失败,{}{}", device_code, "设备条码为空"); + throw new BadRequestException("地址对应设备未找到"); + } + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + JSONObject jo = new JSONObject(); + jo.put("device_code", device_code); + jo.put("type", type); + jo.put("quantity", quantity); + jo.put("container_code", container_code); + + String result2 = ""; + + AddressDto addressDto = addressService.findByCode("apply_InEmpty"); + String methods_url = addressDto.getMethods_url(); + String url = wmsurl + methods_url; + log.info("requestTaskAgain----请求参数{}", jo); + + try { + result2 = HttpRequest.post(url) + .header("Authorization", token) + .body(String.valueOf(jo)) + .execute().body(); + System.out.println(result2); + log.info("requestTaskAgain----返回参数{}", result2); + } catch (Exception e) { + String msg = e.getMessage(); + //网络不通 + System.out.println(msg); + } + return result2; + }finally { + MDC.remove(log_file_type); + } + + } + + @Override + public String apply_OutEmpty(String device_code) { + try { + MDC.put(log_file_type, log_type); + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + JSONObject jo = new JSONObject(); + jo.put("device_code", device_code); + String result2 = ""; + + AddressDto addressDto = addressService.findByCode("apply_OutEmpty"); + String methods_url = addressDto.getMethods_url(); + String url = wmsurl + methods_url; + log.info("apply_OutEmpty----请求参数{}", jo); + try { + result2 = HttpRequest.post(url) + .header("Authorization", token) + .body(String.valueOf(jo)) + .execute().body(); + System.out.println(result2); + log.info("apply_OutEmpty----返回参数{}", result2); + } catch (Exception e) { + String msg = e.getMessage(); + //网络不通 + System.out.println(msg); + } + return result2; + }finally { + MDC.remove(log_file_type); + } + } @Override public HttpResponse feedbackAgvStatus(String device_code, String error, String error_message) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - - JSONObject json = new JSONObject(); - json.put("device_code", device_code); - json.put("error", error); - json.put("error_message", error_message); - - AddressDto addressDto = addressService.findByCode("feedbackAgvStatus"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("feedbackAgvStatus----请求参数{}", json); - try { - result = HttpRequest.post(url) - .body(String.valueOf(json)) - .execute(); - System.out.println(result); - log.info("feedbackAgvStatus----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - //System.out.println(msg); - } - return result; - } + MDC.put(log_file_type, log_type); + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - @Override - public HttpResponse feedbackDeviceStatus(String device_code, String code, String value) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - - JSONObject json = new JSONObject(); - json.put("device_code", device_code); - json.put("back_time", DateUtil.format(DateUtil.date(), "yyyyMMddHHmmssSSS")); - JSONArray ja = new JSONArray(); - JSONObject jo = new JSONObject(); - jo.put("code", code); - jo.put("value", value); - ja.add(jo); - json.put("data", ja); - AddressDto addressDto = addressService.findByCode("feedbackDeviceStatus"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("feedbackDeviceStatus----请求参数{}", json); - - try { - result = HttpRequest.post(url) - .body(String.valueOf(json)) - .execute(); - System.out.println(result); - log.info("feedbackDeviceStatus----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - //System.out.println(msg); - } - return result; - } - - @Override - public HttpResponse feedbackAgv(JSONArray from) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - - AddressDto addressDto = addressService.findByCode("feedbackAgv"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("feedbackAgv----请求参数{}", from); - - try { - result = HttpRequest.post(url) - .body(String.valueOf(from)) - .execute(); - System.out.println(result); - log.info("feedbackAgv----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - //System.out.println(msg); - } - return result; - } - - @Override - public HttpResponse applyOpenOrCloseDoor(String device_code, String status) { - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - JSONObject jo = new JSONObject(); - jo.put("device_code", device_code); - jo.put("status", status); - HttpResponse result = null; - log.info("applyOpenOrCloseDoor-----请求参数{}", jo.toString()); - - AddressDto addressDto = addressService.findByCode("applyOpenOrCloseDoor"); - String methods_url = addressDto.getMethods_url(); - try { - result = HttpRequest.post(wmsurl + methods_url) - .body(String.valueOf(jo)) - .execute(); - System.out.println(result); - log.info("applyOpenOrCloseDoor-----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - //System.out.println(msg); - } - return result; - } - - @Override - public HttpResponse queryDoorsStatus() { - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - - HttpResponse result = null; - log.info("queryDoorStatus-----请求"); - AddressDto addressDto = addressService.findByCode("queryDoorsStatus"); - String methods_url = addressDto.getMethods_url(); - try { - result = HttpRequest.get(wmsurl + methods_url) - .body("") - .execute(); - log.info("queryDoorStatus-----输出参数{}", result.body().toString()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - //System.out.println(msg); - - } - return result; - } - - @Override - public HttpResponse feedbackOrderStatus(JSONObject param) { - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - String ext_order_id = param.getString("ext_order_id"); - String status = param.getString("status"); - String type1 = param.getString("type"); JSONObject json = new JSONObject(); - json.put("ext_order_id", ext_order_id); - json.put("status", status); - json.put("type", type1); - AddressDto addressDto = addressService.findByCode("feedbackOrderStatus"); + json.put("device_code", device_code); + json.put("error", error); + json.put("error_message", error_message); + + AddressDto addressDto = addressService.findByCode("feedbackAgvStatus"); String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; + String url = wmsurl + methods_url; HttpResponse result = null; - log.info("feedbackOrderStatus----请求参数{}", json); + log.info("feedbackAgvStatus----请求参数{}", json); + try { result = HttpRequest.post(url) .body(String.valueOf(json)) .execute(); - String type = ""; - if (result.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - - log.info("feedbackOrderStatus----返回参数{}", result); + System.out.println(result); + log.info("feedbackAgvStatus----返回参数{}", result); } catch (Exception e) { String msg = e.getMessage(); //网络不通 - //System.out.println(msg); + System.out.println(msg); } return result; - + }finally { + MDC.remove(log_file_type); } - return null; + + } + + @Override + public HttpResponse feedbackDeviceStatus(String device_code, String code, String value) { + try { + MDC.put(log_file_type, log_type); + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + + JSONObject json = new JSONObject(); + json.put("device_code", device_code); + json.put("back_time", DateUtil.format(DateUtil.date(), "yyyyMMddHHmmssSSS")); + JSONArray ja = new JSONArray(); + JSONObject jo = new JSONObject(); + jo.put("code", code); + jo.put("value", value); + ja.add(jo); + json.put("data", ja); + AddressDto addressDto = addressService.findByCode("feedbackDeviceStatus"); + String methods_url = addressDto.getMethods_url(); + String url = wmsurl + methods_url; + HttpResponse result = null; + log.info("feedbackDeviceStatus----请求参数{}", json); + + try { + result = HttpRequest.post(url) + .body(String.valueOf(json)) + .execute(); + System.out.println(result); + log.info("feedbackDeviceStatus----返回参数{}", result); + } catch (Exception e) { + String msg = e.getMessage(); + //网络不通 + System.out.println(msg); + } + return result; + }finally { + MDC.remove(log_file_type); + } + + } + + @Override + public HttpResponse feedbackAgv(JSONArray from) { + try { + MDC.put(log_file_type, log_type); + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + + AddressDto addressDto = addressService.findByCode("feedbackAgv"); + String methods_url = addressDto.getMethods_url(); + String url = wmsurl + methods_url; + HttpResponse result = null; + log.info("feedbackAgv----请求参数{}", from); + + try { + result = HttpRequest.post(url) + .body(String.valueOf(from)) + .execute(); + System.out.println(result); + log.info("feedbackAgv----返回参数{}", result); + } catch (Exception e) { + String msg = e.getMessage(); + //网络不通 + System.out.println(msg); + } + return result; + }finally { + MDC.remove(log_file_type); + } + + } + + @Override + public HttpResponse applyOpenOrCloseDoor(String device_code, String status) { + try { + MDC.put(log_file_type, log_type); + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + JSONObject jo = new JSONObject(); + jo.put("device_code", device_code); + jo.put("status", status); + HttpResponse result = null; + log.info("applyOpenOrCloseDoor-----请求参数{}", jo.toString()); + + AddressDto addressDto = addressService.findByCode("applyOpenOrCloseDoor"); + String methods_url = addressDto.getMethods_url(); + try { + result = HttpRequest.post(wmsurl + methods_url) + .body(String.valueOf(jo)) + .execute(); + System.out.println(result); + log.info("applyOpenOrCloseDoor-----返回参数{}", result); + } catch (Exception e) { + String msg = e.getMessage(); + //网络不通 + System.out.println(msg); + } + return result; + }finally { + MDC.remove(log_file_type); + } + + } + + @Override + public HttpResponse queryDoorsStatus() { + try { + MDC.put(log_file_type, log_type); + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + + HttpResponse result = null; + log.info("queryDoorStatus-----请求"); + AddressDto addressDto = addressService.findByCode("queryDoorsStatus"); + String methods_url = addressDto.getMethods_url(); + try { + result = HttpRequest.get(wmsurl + methods_url) + .body("") + .execute(); + log.info("queryDoorStatus-----输出参数{}", result.body().toString()); + } catch (Exception e) { + String msg = e.getMessage(); + //网络不通 + System.out.println(msg); + + } + return result; + }finally { + MDC.remove(log_file_type); + } + + } + + @Override + public HttpResponse feedbackOrderStatus(JSONObject param) { + try { + MDC.put(log_file_type, log_type); + if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + String ext_order_id = param.getString("ext_order_id"); + String status = param.getString("status"); + String type1 = param.getString("type"); + JSONObject json = new JSONObject(); + json.put("ext_order_id", ext_order_id); + json.put("status", status); + json.put("type", type1); + AddressDto addressDto = addressService.findByCode("feedbackOrderStatus"); + String methods_url = addressDto.getMethods_url(); + String url = wmsurl + methods_url; + HttpResponse result = null; + log.info("feedbackOrderStatus----请求参数{}", json); + try { + result = HttpRequest.post(url) + .body(String.valueOf(json)) + .execute(); + String type = ""; + if (result.getStatus() == 200) { + type = "info"; + } else { + type = "error"; + } + + log.info("feedbackOrderStatus----返回参数{}", result); + } catch (Exception e) { + String msg = e.getMessage(); + //网络不通 + System.out.println(msg); + } + return result; + + } + return null; + }finally { + MDC.remove(log_file_type); + } + } @Override public HttpResponse applyInCacheLineTask(JSONObject param) { - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - // TODO 还没向地址表中添加 applyInCacheLineTask地址 - AddressDto addressDto = addressService.findByCode("applyInCacheLineTask"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("feedbackOrderStatus----请求参数{}", param); - try { - result = HttpRequest.post(url) - .body(String.valueOf(param)) - .execute(); - String type = ""; - if (result.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } + try { + MDC.put(log_file_type, log_type); + if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { + String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + // TODO 还没向地址表中添加 applyInCacheLineTask地址 + AddressDto addressDto = addressService.findByCode("applyInCacheLineTask"); + String methods_url = addressDto.getMethods_url(); + String url = wmsUrl + methods_url; + HttpResponse result = null; + log.info("feedbackOrderStatus----请求参数{}", param); + try { + result = HttpRequest.post(url) + .body(String.valueOf(param)) + .execute(); + String type = ""; + if (result.getStatus() == 200) { + type = "info"; + } else { + type = "error"; + } - log.info("applyInCacheLineTask----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - //System.out.println(msg); + log.info("applyInCacheLineTask----返回参数{}", result); + } catch (Exception e) { + String msg = e.getMessage(); + //网络不通 + System.out.println(msg); + } + return result; } - return result; + return null; + }finally { + MDC.remove(log_file_type); } - return null; + } @Override public HttpResponse applyOutCacheLineTask(JSONObject param) { - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - // TODO 还没向地址表中添加 applyOutCacheLineTask - AddressDto addressDto = addressService.findByCode("applyOutCacheLineTask"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("feedbackOrderStatus----请求参数{}", param); - try { - result = HttpRequest.post(url) - .body(String.valueOf(param)) - .execute(); - String type = ""; - if (result.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - - log.info("applyOutCacheLineTask----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - //System.out.println(msg); - } - return result; - } - return null; - } - - @Override - public ApplyLabelingAndBindingResponse applyLabelingAndBindingRequest(ApplyLabelingAndBindingRequest param) { try { MDC.put(log_file_type, log_type); - ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = new ApplyLabelingAndBindingResponse(); if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("applyLabelingAndBinding"); + // TODO 还没向地址表中添加 applyOutCacheLineTask + AddressDto addressDto = addressService.findByCode("applyOutCacheLineTask"); String methods_url = addressDto.getMethods_url(); String url = wmsUrl + methods_url; - log.info("ApplyLabelingAndBindingRequest----请求参数{}", param); + HttpResponse result = null; + log.info("feedbackOrderStatus----请求参数{}", param); try { -// String result = ""; - String result = HttpRequest.post(url) - .body(JSON.toJSONString(param)) - .execute().body(); - JSONObject jsonObject = JSONObject.parseObject(result); - log.info("ApplyLabelingAndBindingResponse----返回参数{}", result); - applyLabelingAndBindingResponse = JSONObject.toJavaObject(jsonObject, ApplyLabelingAndBindingResponse.class); - } catch (Exception e) { - JSONObject map = new JSONObject(); - map.put("status", 400); - map.put("message", e.getMessage()); - return JSONObject.toJavaObject(map, ApplyLabelingAndBindingResponse.class); - } - } - return applyLabelingAndBindingResponse; - } finally { - MDC.remove(log_file_type); - } - - - } - - @Override - public LiKuApplyTakResponse liKuApplyTaskRequest(LiKuApplyTaskRequest param) { - try { - MDC.put(log_file_type, log_type); - LiKuApplyTakResponse liKuApplyTakResponse = new LiKuApplyTakResponse(); - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("liKuApplyTask"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - log.info("LiKuApplyTaskRequest----请求参数{}", param); - try { - String result = HttpRequest.post(url) - .body(JSON.toJSONString(param)) - .execute().body(); - JSONObject jsonObject = JSONObject.parseObject(result); - log.info("LiKuApplyTakResponse----返回参数{}", result); - liKuApplyTakResponse = JSONObject.toJavaObject(jsonObject, LiKuApplyTakResponse.class); - } catch (Exception e) { - JSONObject map = new JSONObject(); - map.put("status", 400); - map.put("message", e.getMessage()); - return JSONObject.toJavaObject(map, LiKuApplyTakResponse.class); - } - } - return liKuApplyTakResponse; - } finally { - MDC.remove(log_file_type); - } - - } - - - @Override - public UpdateLKTaskResponse updateLKTaskRequest(UpdateLKTaskRequest param) { - try { - MDC.put(log_file_type, log_type); - log.info("updateLKTaskRequest-----输入参数{}", param); - UpdateLKTaskResponse updateLKTaskResponse = new UpdateLKTaskResponse(); - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("liKuApplyTask"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - try { - String result = HttpRequest.post(url) - .body(JSON.toJSONString(param)) - .execute().body(); - log.info("UpdateLKTaskResponse----返回参数{}", result); - - JSONObject jsonObject = JSONObject.parseObject(result); - updateLKTaskResponse = JSONObject.toJavaObject(jsonObject, UpdateLKTaskResponse.class); - } catch (Exception e) { - JSONObject map = new JSONObject(); - map.put("status", 400); - map.put("message", e.getMessage()); - return JSONObject.toJavaObject(map, UpdateLKTaskResponse.class); - } - } - - return updateLKTaskResponse; - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public HttpResponse shipDeviceUpdate(JSONObject param) { - try { - MDC.put(log_file_type, log_type); -// log.info("shipDeviceUpdate-----输入参数{}", param); - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("shipDeviceUpdate"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - return HttpRequest - .post(url) - .body(param.toString()) - .execute(); - } - } catch (Throwable ignored) { - - } finally { - MDC.remove(log_file_type); - } - return null; - } - - @Override - public HttpResponse feedOrderRealQty(JSONObject param) { - try { - MDC.put(log_file_type, log_type); - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - String order_code = param.getString("order"); - ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCode(order_code); - if (ObjectUtil.isEmpty(produceshiftorderDto)) { - return null; - } - if (!produceshiftorderDto.getOrder_status().equals("2") || !produceshiftorderDto.getOrder_status().equals("3")) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - // TODO 还没向地址表中添加 feedDeviceStatusType - AddressDto addressDto = addressService.findByCode("feedOrderRealQty"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("feedOrderRealQty----请求参数{}", param); - try { - result = HttpRequest.post(url) - .body(String.valueOf(param)) - .execute(); - String type = ""; - if (result.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - log.info("feedOrderRealQty----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); + result = HttpRequest.post(url) + .body(String.valueOf(param)) + .execute(); + String type = ""; + if (result.getStatus() == 200) { + type = "info"; + } else { + type = "error"; } - return result; + + log.info("applyOutCacheLineTask----返回参数{}", result); + } catch (Exception e) { + String msg = e.getMessage(); + //网络不通 + System.out.println(msg); } + return result; } return null; - } finally { + }finally { MDC.remove(log_file_type); } + } @Override @@ -612,4 +677,48 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } } + + @Override + public HttpResponse feedOrderRealQty(JSONObject param) { + try { + MDC.put(log_file_type, log_type); + if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { + String order_code = param.getString("order"); + ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCode(order_code); + if (ObjectUtil.isEmpty(produceshiftorderDto)){ + return null; + } + if (!produceshiftorderDto.getOrder_status().equals("2") || !produceshiftorderDto.getOrder_status().equals("3")){ + String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + // TODO 还没向地址表中添加 feedDeviceStatusType + AddressDto addressDto = addressService.findByCode("feedOrderRealQty"); + String methods_url = addressDto.getMethods_url(); + String url = wmsUrl + methods_url; + HttpResponse result = null; + log.info("feedOrderRealQty----请求参数{}", param); + try { + result = HttpRequest.post(url) + .body(String.valueOf(param)) + .execute(); + String type = ""; + if (result.getStatus() == 200) { + type = "info"; + } else { + type = "error"; + } + log.info("feedOrderRealQty----返回参数{}", result); + } catch (Exception e) { + String msg = e.getMessage(); + //网络不通 + System.out.println(msg); + } + return result; + } + } + return null; + }finally { + MDC.remove(log_file_type); + } + } + } diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/LiKuToAcsServiceImpl.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/LiKuToAcsServiceImpl.java deleted file mode 100644 index 5cd3f9c8..00000000 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/LiKuToAcsServiceImpl.java +++ /dev/null @@ -1,304 +0,0 @@ -package org.nl.acs.ext.wms.service.impl; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.device.address.service.AddressService; -import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver; -import org.nl.acs.ext.wms.AcsUtil; -import org.nl.acs.ext.wms.RespUtil; -import org.nl.acs.ext.wms.data.UpdateLKTaskRequest; -import org.nl.acs.ext.wms.data.UpdateLKTaskResponse; -import org.nl.acs.ext.wms.liKuData.*; -import org.nl.acs.ext.wms.service.AcsToLiKuService; -import org.nl.acs.ext.wms.service.AcsToWmsService; -import org.nl.acs.ext.wms.service.LiKuToAcsService; -import org.nl.acs.instruction.service.InstructionService; -import org.nl.acs.instruction.service.dto.Instruction; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.opc.DeviceAppServiceImpl; -import org.nl.acs.task.service.TaskService; -import org.nl.acs.task.service.dto.TaskDto; -import org.nl.modules.wql.util.SpringContextHolder; -import org.slf4j.MDC; -import org.springframework.stereotype.Service; - -/** - * 立库WCS接口 - * - * @author: wangs - * @createDate: 2022/11/24 - */ -@Service -@RequiredArgsConstructor -@Slf4j -public class LiKuToAcsServiceImpl implements LiKuToAcsService { - - private final AddressService addressService; - - private final TaskService taskService; - - private final InstructionService instructionService; - - private final AcsToWmsService acsToWmsService; - - private final AcsToLiKuService acsToLiKuService; - - - private String log_file_type="log_file_type"; - private String log_type="立库请求ACS"; - - //入库任务状态反馈 - @Override - public Resp inStoreReport(InStoreReportRequest requestParam) throws Exception { - - log.info("入库任务状态反馈-----输入参数{}", JSON.toJSONString(requestParam)); - String inst_code = requestParam.getOrderId(); - String status = requestParam.getState(); - String carNo = requestParam.getRobotId(); - Instruction inst = instructionService.findByCodeFromCache(inst_code); - if (ObjectUtil.isEmpty(inst)) { - InStoreReportResponse inStoreReportResponse = new InStoreReportResponse(); - inStoreReportResponse.setOrderId(inst_code); - JSONObject result = new JSONObject(); - result.put("result", "false"); - result.put("code", "0"); - result.put("comment", "未找到对应指令"); - result.put("data", inStoreReportResponse ); - log.info("入库任务状态反馈-----输出参数{}", result); - return RespUtil.getResp(result.toString(), new InStoreReportResponse()); - } - TaskDto task = taskService.findByCodeFromCache(inst.getTask_code()); - if (ObjectUtil.isEmpty(task)) { - InStoreReportResponse inStoreReportResponse = new InStoreReportResponse(); - inStoreReportResponse.setOrderId(inst_code); - JSONObject result = new JSONObject(); - result.put("result", "false"); - result.put("code", "0"); - result.put("comment", "未找到对应任务"); - result.put("data", inStoreReportResponse ); - log.info("入库任务状态反馈-----输出参数{}", result); - return RespUtil.getResp(result.toString(), new InStoreReportResponse()); - } - // 1 已接收 2 开始执行 3执行完成 4 5 取消 - if(StrUtil.equals(status,"1") || StrUtil.equals(status,"2") ){ - task.setTask_status("1"); - taskService.update(task); - inst.setInstruction_status("1"); - inst.setExecute_device_code(carNo); - inst.setCarno(carNo); - instructionService.update(inst); - } else if(StrUtil.equals(status,"3")){ - inst.setInstruction_status("2"); - instructionService.finish(inst.getInstruction_id()); - } else if(StrUtil.equals(status,"4")) { - - // 5 取消指令 - } else if(StrUtil.equals(status,"5")) { - - instructionService.cancel(inst.getInstruction_id()); - } - InStoreReportResponse inStoreReportResponse = new InStoreReportResponse(); - inStoreReportResponse.setOrderId(inst_code); - JSONObject result = new JSONObject(); - result.put("result", "true"); - result.put("code", "0"); - result.put("comment", ""); - result.put("data", inStoreReportResponse ); - log.info("入库任务状态反馈-----输出参数{}", result); - return RespUtil.getResp(result.toString(), new InStoreReportResponse()); - - } - - @Override - public Resp outStoreReport(OutStoreReportRequest requestParam) throws Exception { - try { - MDC.put(log_file_type, log_type); - log.info("出库任务状态反馈-----输入参数{}", JSON.toJSONString(requestParam)); - String inst_code = requestParam.getOrderId(); - String status = requestParam.getState(); - String carNo = requestParam.getRobotId(); - Instruction inst = instructionService.findByCodeFromCache(inst_code); - if (ObjectUtil.isEmpty(inst)) { - OutStoreReportResponse outStoreReportResponse = new OutStoreReportResponse(); - outStoreReportResponse.setOrderId(inst_code); - JSONObject result = new JSONObject(); - result.put("result", "false"); - result.put("code", "0"); - result.put("comment", "未找到对应指令"); - result.put("data", outStoreReportResponse ); - log.info("出库任务状态反馈-----输出参数{}", result); - return RespUtil.getResp(result.toString(), new OutStoreReportResponse()); - } - TaskDto task = taskService.findByCodeFromCache(inst.getTask_code()); - if (ObjectUtil.isEmpty(task)) { - OutStoreReportResponse outStoreReportResponse = new OutStoreReportResponse(); - outStoreReportResponse.setOrderId(inst_code); - JSONObject result = new JSONObject(); - result.put("result", "false"); - result.put("code", "0"); - result.put("comment", "未找到对应任务"); - result.put("data", outStoreReportResponse ); - log.info("出库任务状态反馈-----输出参数{}", result); - return RespUtil.getResp(result.toString(), new OutStoreReportResponse()); - } - // 1 已接收 2 开始执行 3执行完成 4 阻挡 5 空洞 - if(StrUtil.equals(status,"1") || StrUtil.equals(status,"2") ){ - task.setTask_status("1"); - taskService.update(task); - inst.setInstruction_status("1"); - inst.setExecute_device_code(carNo); - inst.setCarno(carNo); - instructionService.update(inst); - } else if(StrUtil.equals(status,"3")){ -// inst.setInstruction_status("1"); -// instructionService.finish(inst.getInstruction_id()); - - if(StrUtil.equals(task.getTask_type(),"7") && StrUtil.equals(task.getStorage_task_type(),"4")){ - inst.setInstruction_status("2"); - instructionService.finish(inst.getInstruction_id()); - } else { - inst.setRemark("立库已反馈完成,待输送上报任务号"); - instructionService.update(inst); - } - - } else if(StrUtil.equals(status,"4")){ - //5 取消指令 - } else if(StrUtil.equals(status,"5")){ - instructionService.cancel(inst.getInstruction_id()); - - } - OutStoreReportResponse outStoreReportResponse = new OutStoreReportResponse(); - outStoreReportResponse.setOrderId(inst_code); - JSONObject result = new JSONObject(); - result.put("result", "true"); - result.put("code", "0"); - result.put("comment", ""); - result.put("data", outStoreReportResponse ); - log.info("出库任务状态反馈-----输出参数{}", result); - - return RespUtil.getResp(result.toString(), new OutStoreReportResponse()); - } finally { - MDC.remove(log_file_type); - } - - - - - } - - //移库任务上报 - @Override - public Resp moveStoreReport(MoveStoreReportRequest requestParam) throws Exception { - try { - MDC.put(log_file_type, log_type); - log.info("移库任务上报-----输入参数{}", JSON.toJSONString(requestParam)); - String inst_code = requestParam.getOrderId(); - String status = requestParam.getState(); - String carNo = requestParam.getRobotId(); - Instruction inst = instructionService.findByCodeFromCache(inst_code); - if (ObjectUtil.isEmpty(inst)) { - MoveStoreReportResponse moveStoreReportResponse = new MoveStoreReportResponse(); - moveStoreReportResponse.setOrderId(inst_code); - JSONObject result = new JSONObject(); - result.put("result", "false"); - result.put("code", "0"); - result.put("comment", "未找到对应指令"); - result.put("data", moveStoreReportResponse ); - log.info("移库任务状态反馈-----输出参数{}", result); - return RespUtil.getResp(result.toString(), new MoveStoreReportResponse()); - } - TaskDto task = taskService.findByCodeFromCache(inst.getTask_code()); - if (ObjectUtil.isEmpty(task)) { - MoveStoreReportResponse moveStoreReportResponse = new MoveStoreReportResponse(); - moveStoreReportResponse.setOrderId(inst_code); - JSONObject result = new JSONObject(); - result.put("result", "false"); - result.put("code", "0"); - result.put("comment", "未找到对应任务"); - result.put("data", moveStoreReportResponse ); - log.info("移库任务状态反馈-----输出参数{}", result); - return RespUtil.getResp(result.toString(), new MoveStoreReportResponse()); - } // 1 已接收 2 开始执行 3执行完成 4 阻挡 5 空洞 - if(StrUtil.equals(status,"1") || StrUtil.equals(status,"2") ){ - task.setTask_status("1"); - taskService.update(task); - inst.setInstruction_status("1"); - inst.setExecute_device_code(carNo); - inst.setCarno(carNo); - instructionService.update(inst); - - } else if(StrUtil.equals(status,"3")){ - inst.setInstruction_status("2"); - instructionService.finish(inst.getInstruction_id()); - } else if(StrUtil.equals(status,"4")){ - - - } else if(StrUtil.equals(status,"5")){ - instructionService.cancel(inst.getInstruction_id()); - } - MoveStoreReportResponse moveStoreReportResponse = new MoveStoreReportResponse(); - moveStoreReportResponse.setOrderId(inst_code); - JSONObject result = new JSONObject(); - result.put("result", "true"); - result.put("code", "0"); - result.put("comment", ""); - result.put("data", moveStoreReportResponse ); - log.info("移库任务上报-----输出参数{}", result); - - return RespUtil.getResp(result.toString(), new MoveStoreReportResponse()); - } finally { - MDC.remove(log_file_type); - } - - } - - - - - //请求放空盘 - @Override - public Resp putEmptyPallet(putEmptyPalletRequest requestParam) throws Exception { -// try { - MDC.put(log_file_type, log_type); - log.info("请求放空盘-----输入参数{}", JSON.toJSONString(requestParam)); - String device_code = requestParam.getDeviceId(); - String type = requestParam.getType(); - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - Device device = appService.findDeviceByCode(device_code); -// SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; -// JSONObject result = new JSONObject(); -// result.put("code", "0"); -// if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { -// siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver(); -// if(StrUtil.equals(type,"1")){ -//// if((siemensConveyorDeviceDriver.getMode() ==2 || siemensConveyorDeviceDriver.getMode() ==7 )&& siemensConveyorDeviceDriver.getMove() ==0){ -//// result.put("result", "true"); -//// result.put("comment", ""); -//// } else { -//// result.put("result", "false"); -//// result.put("comment", "当前设备光电信号:"+siemensConveyorDeviceDriver.getMove()+",工作模式:"+siemensConveyorDeviceDriver.getMode()); -//// } -// } else if(StrUtil.equals(type,"2")){ -//// siemensConveyorDeviceDriver.writing("to_command","3"); -//// siemensConveyorDeviceDriver.writing("to_command","3"); -// -// result.put("result", "true"); -// result.put("comment", ""); -// } -// -// } -// log.info("请求放空盘-----输出参数{}", result); -// return RespUtil.getResp(result.toString(), new DeviceStatusResponse()); -// } finally { -// MDC.remove(log_file_type); -// } - return null; - - } - -} diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index 4cb0efb0..8abd1072 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -1,9 +1,8 @@ package org.nl.acs.ext.wms.service.impl; -import cn.hutool.core.util.IdUtil; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; @@ -11,32 +10,41 @@ import lombok.extern.slf4j.Slf4j; import org.nl.acs.AcsConfig; import org.nl.acs.common.IDriverService; import org.nl.acs.device.service.DeviceService; +import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_machine.HailiangEngravingMachineDeviceDriver; +import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_packer_station.HailiangPackerStationDeviceDriver; +import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_device.HailiangSpecialDeviceDriver; +import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_stacking_station.HailiangStackingStationDriver; +import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver; +import org.nl.acs.device_driver.basedriver.standard_conveyor_control.StandardCoveyorControlDeviceDriver; +import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_plcscanner.StandardCoveyorControlWithPlcScannerDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver; +import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; -import org.nl.acs.ext.wms.data.*; -import org.nl.acs.ext.wms.liKuData.Resp; -import org.nl.acs.ext.wms.service.AcsToLiKuService; +import org.nl.acs.device_driver.basedriver.standard_scanner.StandardScannerDeviceDriver; import org.nl.acs.ext.wms.service.WmsToAcsService; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.opc.Device; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceExtraManageDto; +import org.nl.acs.order.service.ProduceshiftorderService; +import org.nl.acs.order.service.dto.ProduceshiftorderDto; import org.nl.acs.route.service.RouteLineService; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.system.service.ParamService; +import org.nl.modules.system.service.impl.ParamServiceImpl; +import org.nl.modules.system.util.CodeUtil; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.exception.WDKException; import org.nl.modules.wql.util.SpringContextHolder; -import org.slf4j.MDC; import org.springframework.context.ApplicationContext; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.HashMap; +import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -52,26 +60,152 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { private final DeviceService deviceService; private final DeviceAppService deviceAppService; private final RouteLineService routeLineService; - private final AcsToLiKuService acsToLiKuService; - - - private String log_file_type="log_file_type"; - private String log_type="LMS请求ACS"; + private final ProduceshiftorderService produceshiftorderService; @Override - public CancelTaskResponse cancelFromWms(String param) throws Exception { - ParamService paramService = SpringContextHolder.getBean(ParamService.class); - InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); - JSONArray datas = JSONArray.parseArray(param); - CancelTaskResponse response = new CancelTaskResponse(); - JSONArray errArr = new JSONArray(); - for (int i = 0; i < datas.size(); i++) { - String data = datas.get(i).toString(); - CancelTaskRequest request = JsonUtl.format(param, CancelTaskRequest.class); + public Map createFromWms(String param) { + JSONArray tasks = JSONArray.parseArray(param); + JSONObject resultJson = new JSONObject(); + log.info("createFromWms--------------:输入参数:" + tasks.toString()); + try { + JSONArray errArr = new JSONArray(); + for (int i = 0; i < tasks.size(); i++) { + JSONObject task = tasks.getJSONObject(i); + String task_uuid = task.getString("task_uuid"); + String task_code = task.getString("task_code"); + String start_point_code = task.getString("start_device_code"); + String next_point_code = task.getString("next_device_code"); + String is_send = task.getString("is_send"); + String link_num = task.getString("link_num"); + String start_device_code = ""; + String next_device_code = ""; + if (StrUtil.isEmpty(task_code)) { + throw new WDKException("任务号不能为空"); + } + if (StrUtil.isEmpty(start_point_code)) { + throw new WDKException("起点不能为空"); + } + if (StrUtil.isEmpty(next_point_code)) { + throw new WDKException("终点不能为空"); + } - String task_uuid = request.getExt_task_id(); - String task_code = request.getTask_code(); - String vehicle_code = request.getVehicle_code(); + JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_point_code + "'").uniqueResult(0); + if (!ObjectUtil.isEmpty(start_device_json)) { + start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_point_code : (String) start_device_json.get("storage_code"); + } + JSONObject next_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_point_code + "'").uniqueResult(0); + if (!ObjectUtil.isEmpty(next_device_json)) { + next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code"); + } + String priority = task.getString("priority"); + String vehicle_code = task.getString("vehicle_code"); + String vehicle_type = task.getString("vehicle_type"); + String route_plan_code = task.getString("route_plan_code"); + String task_type = task.getString("task_type"); + String remark = task.getString("remark"); + String params = task.getString("params"); + + if (start_point_code.indexOf("-") > 0) { + String str[] = start_point_code.split("-"); + start_device_code = str[0]; + } else { + start_device_code = start_point_code; + } + + if (next_point_code.indexOf("-") > 0) { + String str[] = next_point_code.split("-"); + next_device_code = str[0]; + } else { + next_device_code = next_point_code; + } + + if (StrUtil.isEmpty(route_plan_code)) { + route_plan_code = "normal"; + } +// List list = RouteLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); +// +// if (ObjectUtil.isEmpty(list)) { +// throw new WDKException("路由不通!"); +// } + TaskDto taskDto = taskService.findByCodeFromCache(task_code); + if (taskDto != null) { + throw new WDKException("不能存在相同的任务号!"); + } + if (!StrUtil.isEmpty(vehicle_code)) { + TaskDto vehicle_dto = taskService.findByContainer(vehicle_code); + if (vehicle_dto != null) { + throw new WDKException("已存在该载具号的任务!"); + } + } + JSONObject jo = new JSONObject(); + jo.put("task_code", task_code); + jo.put("start_point_code", start_point_code); + jo.put("next_point_code", next_point_code); + jo.put("start_parent_code", start_point_code); + jo.put("next_parent_code", next_point_code); + jo.put("start_device_code", start_device_code); + jo.put("next_device_code", next_device_code); + jo.put("priority", priority); + jo.put("is_send", is_send); + jo.put("link_num", link_num); + jo.put("vehicle_code", vehicle_code); + jo.put("vehicle_type", vehicle_type); + jo.put("remark", remark); + jo.put("params", params); + jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type)); + + if (!StrUtil.isEmpty(task_uuid)) { + jo.put("ext_task_id", task_uuid); + } + + TaskDto task_dto = jo.toJavaObject(TaskDto.class); + try { + taskService.create(task_dto); + } catch (Exception e) { + e.printStackTrace(); + JSONObject json = new JSONObject(); + json.put("task_code", task_code); + json.put("task_uuid", task_uuid); + json.put("message", e.getMessage()); + errArr.add(json); + } + } + if (ObjectUtil.isEmpty(errArr)) { + resultJson.put("status", 200); + } else { + resultJson.put("status", 400); + } + resultJson.put("errArr", errArr); + resultJson.put("message", "操作成功"); + resultJson.put("data", new JSONObject()); + log.info("createFromWms--------------:输出参数:" + resultJson.toString()); + + } catch (Exception e) { + resultJson.put("status", 400); + resultJson.put("errArr", e.getMessage()); + resultJson.put("message", e.getMessage()); + resultJson.put("data", new JSONObject()); + log.info("createFromWms--------------:输出参数:" + resultJson.toString()); + } + + + return resultJson; + } + + + @Override + public Map cancelFromWms(String param) throws Exception { + JSONArray tasks = JSONArray.parseArray(param); + ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class); + InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); + log.debug(tasks.toString()); + log.info("cancelFromWms--------------:输入参数" + tasks.toString()); + for (int i = 0; i < tasks.size(); i++) { + JSONObject task = tasks.getJSONObject(i); + String task_uuid = task.getString("task_id"); + String task_code = task.getString("task_code"); + String vehicle_code = task.getString("vehicle_code"); + String params = task.getString("params"); if (StrUtil.isEmpty(task_uuid)) { throw new WDKException("任务标识不能为空"); @@ -92,17 +226,12 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } } - - if (ObjectUtil.isEmpty(errArr)) { - response.setStatus(200); - } else { - response.setStatus(400); - } - response.setMessage("success"); - response.setErrArr(errArr); - log.info("cancelFromWms--------------:输出参数:" + response); - - return response; + JSONObject resultJson = new JSONObject(); + resultJson.put("status", HttpStatus.OK); + resultJson.put("message", "操作成功"); + resultJson.put("data", new JSONObject()); + log.info("cancelFromWms--------------:输出参数" + resultJson.toString()); + return resultJson; } @Override @@ -144,126 +273,457 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } @Override - public PutActionResponse putAction(String jsonObject) throws Exception { - try { - MDC.put(log_file_type, log_type); - log.info("putAction--------------:输出参数" + jsonObject); - JSONArray datas = JSONArray.parseArray(jsonObject); - PutActionResponse response = new PutActionResponse(); - JSONArray errArr = new JSONArray(); - for (int i = 0; i < datas.size(); i++) { - String data = datas.get(i).toString(); - PutActionRequest request = JsonUtl.format(data, PutActionRequest.class); - String device_code = request.getDevice_code(); - String code = request.getCode(); - String value = request.getValue(); - Device device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device)) { - throw new Exception("未找到对应设备:" + device_code); - } -// HongXiangStationDeviceDriver hongXiangStationDeviceDriver; -// LampThreecolorDeviceDriver lampThreecolorDeviceDriver; -// if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { -// hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); -// hongXiangStationDeviceDriver.writing(code, value); -// } -// if (device.getDeviceDriver() instanceof LampThreecolorDeviceDriver) { -// lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) device.getDeviceDriver(); -// lampThreecolorDeviceDriver.writing(code, value); -// } - - + public Map putAction(String jsonObject) throws Exception { + JSONArray datas = JSONArray.parseArray(jsonObject); + log.info("putAction--------------:输入参数" + datas.toString()); + for (int i = 0; i < datas.size(); i++) { + JSONObject data = datas.getJSONObject(i); + String device_code = data.getString("device_code"); + String code = data.getString("code"); + String value = data.getString("value"); + Device device = deviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isEmpty(device)) { + throw new Exception("未找到对应设备:" + device_code); } - response.setStatus(200); - response.setMessage("success"); - log.info("putAction--------------:输出参数:" + response); - return response; - } finally { - MDC.remove(log_file_type); } - + JSONObject resultJson = new JSONObject(); + resultJson.put("status", HttpStatus.OK); + resultJson.put("message", "操作成功"); + resultJson.put("data", new JSONObject()); + log.info("putAction--------------:输出参数" + resultJson.toString()); + return resultJson; } @Override public Map queryDevice(String jsonObject) throws Exception { - try { - MDC.put(log_file_type, log_type); -// log.info("queryDevice--------------:输入参数" + jsonObject.toString()); - JSONArray backja = new JSONArray(); - JSONArray datas = JSONArray.parseArray(jsonObject); + log.info("queryDevice--------------:输入参数" + jsonObject.toString()); + JSONArray backja = new JSONArray(); + JSONArray datas = JSONArray.parseArray(jsonObject); -// //AGV烘箱对接位 -// HongXiangStationDeviceDriver hongXiangStationDeviceDriver; -// //烘箱工位 -// HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; - //货梯对接线-带扫码器 - StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver; + //无光电普通站点 + StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; + //检测站点 + StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver; + //控制点 + StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver; + //控制点-带扫码 + StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver; + //控制点-PLC扫码 + StandardCoveyorControlWithPlcScannerDeviceDriver standardCoveyorControlWithPlcScannerDeviceDriver; + //扫码器 + StandardScannerDeviceDriver standardScannerDeviceDriver; + //自动门 + StandardAutodoorDeviceDriver standardAutodoorDeviceDriver; - if (datas.size() == 0) { - throw new BadRequestException("缺少输入参数!"); - } - - for (int i = 0; i < datas.size(); i++) { + if (datas.size() == 0) { + List list = deviceService.findCacheDevice(); + for (int i = 0, j = list.size(); i < j; i++) { + Device device = list.get(i); + JSONObject obj = new JSONObject(); + String device_code = device.getDevice_code(); JSONObject jo = new JSONObject(); -// JSONObject data = datas.getJSONObject(i); -// String parent_device_code = data.getString("device_code"); -// String device_code = ""; -// JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + parent_device_code + "'").uniqueResult(0); -// if (!ObjectUtil.isEmpty(device_json)) { -// device_code = (String) device_json.get("parent_storage_code") == null ? parent_device_code : (String) device_json.get("storage_code"); -// } -// Device device = deviceAppService.findDeviceByCode(device_code); -// if (ObjectUtil.isEmpty(device)) { -// throw new Exception("未找到对应设备:" + parent_device_code); -// } -// -// if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { -// hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); -// jo.put("device_code", parent_device_code); -// jo.put("mode", hongXiangStationDeviceDriver.getMode()); -// jo.put("move", hongXiangStationDeviceDriver.getMove()); -// -// } else if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { -// hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver(); -// jo.put("device_code", parent_device_code); -// jo.put("mode", hongXiangConveyorDeviceDriver.getMode()); -// jo.put("move", hongXiangConveyorDeviceDriver.getMove()); -// jo.put("countdown_house", hongXiangConveyorDeviceDriver.getCountdown_house()); -// jo.put("countdown_min", hongXiangConveyorDeviceDriver.getCountdown_min()); -// jo.put("countdown_sec", hongXiangConveyorDeviceDriver.getCountdown_sec()); -// //温度需要除以10 -// jo.put("temperature", hongXiangConveyorDeviceDriver.getTo_temperature()/10); -// jo.put("now_temperature", hongXiangConveyorDeviceDriver.getTemperature()/10); -// -// jo.put("door", hongXiangConveyorDeviceDriver.getDoor()); -// jo.put("finish", hongXiangConveyorDeviceDriver.getFinish()); -// jo.put("task", hongXiangConveyorDeviceDriver.getTask()); -// jo.put("error", hongXiangConveyorDeviceDriver.getError()); -// } else if (device.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) { -// standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) device.getDeviceDriver(); -// jo.put("device_code", parent_device_code); + if (ObjectUtil.isNull(device)) { + continue; + } + if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) { + standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver(); + jo.put("device_code", device.getDevice_code()); + jo.put("mode", standardCoveyorControlDeviceDriver.getMode()); + jo.put("move", standardCoveyorControlDeviceDriver.getMove()); + jo.put("hasGoods", standardCoveyorControlDeviceDriver.getHasGoods()); + jo.put("isOnline", standardCoveyorControlDeviceDriver.getIsonline()); + jo.put("error", standardCoveyorControlDeviceDriver.getError()); + jo.put("isError", standardCoveyorControlDeviceDriver.getIserror()); + jo.put("requestSucess", standardCoveyorControlDeviceDriver.getRequireSucess()); + jo.put("applySucess", standardCoveyorControlDeviceDriver.getApplySucess()); + jo.put("message", standardCoveyorControlDeviceDriver.getMessage()); + } else if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { + standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); +// jo.put("device_code", device.getDevice_code()); +// jo.put("mode", standardAutodoorDeviceDriver.getMode()); +// jo.put("action", standardAutodoorDeviceDriver.getAction()); +// jo.put("isOnline", true); +// jo.put("error", standardAutodoorDeviceDriver.getError()); +// jo.put("isError", standardAutodoorDeviceDriver.getIserror()); + } else if (device.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) { + standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) device.getDeviceDriver(); +// jo.put("device_code", device.getDevice_code()); +// jo.put("mode", standardCoveyorControlWithScannerDeviceDriver.getMode()); // jo.put("move", standardCoveyorControlWithScannerDeviceDriver.getMove()); -// jo.put("action", standardCoveyorControlWithScannerDeviceDriver.getAction()); +// jo.put("hasGoods", standardCoveyorControlWithScannerDeviceDriver.getHasGoods()); +// jo.put("isOnline", standardCoveyorControlWithScannerDeviceDriver.getIsonline()); // jo.put("error", standardCoveyorControlWithScannerDeviceDriver.getError()); -// } else { -// jo.put("device_code", parent_device_code); -// } +// jo.put("isError", standardCoveyorControlWithScannerDeviceDriver.getIserror()); +// jo.put("height", standardCoveyorControlWithScannerDeviceDriver.getHeight()); +// jo.put("operation_type", standardCoveyorControlWithScannerDeviceDriver.getOperation_type()); +// jo.put("direction", standardCoveyorControlWithScannerDeviceDriver.getDirection()); +// jo.put("action", standardCoveyorControlWithScannerDeviceDriver.getAction()); +// jo.put("ioaction", standardCoveyorControlWithScannerDeviceDriver.getIoaction()); +// jo.put("container", StrUtil.isEmpty(standardCoveyorControlWithScannerDeviceDriver.barcode()) ? "" : standardCoveyorControlWithScannerDeviceDriver.barcode()); +// jo.put("message", standardCoveyorControlWithScannerDeviceDriver.getMessage()); +// jo.put("requestSucess", standardCoveyorControlWithScannerDeviceDriver.getRequireSucess().toString()); +// jo.put("applySucess", standardCoveyorControlWithScannerDeviceDriver.getApplySucess().toString()); +// jo.put("instruction_message", standardCoveyorControlWithScannerDeviceDriver.getInst_message()); + } else if (device.getDeviceDriver() instanceof StandardCoveyorControlWithPlcScannerDeviceDriver) { + standardCoveyorControlWithPlcScannerDeviceDriver = (StandardCoveyorControlWithPlcScannerDeviceDriver) device.getDeviceDriver(); + jo.put("device_code", device.getDevice_code()); + jo.put("mode", standardCoveyorControlWithPlcScannerDeviceDriver.getMode()); + jo.put("move", standardCoveyorControlWithPlcScannerDeviceDriver.getMove()); + jo.put("hasGoods", standardCoveyorControlWithPlcScannerDeviceDriver.getHasGoods()); + jo.put("isOnline", standardCoveyorControlWithPlcScannerDeviceDriver.getIsonline()); + jo.put("error", standardCoveyorControlWithPlcScannerDeviceDriver.getError()); + jo.put("isError", standardCoveyorControlWithPlcScannerDeviceDriver.getIserror()); + jo.put("height", standardCoveyorControlWithPlcScannerDeviceDriver.getHeight()); + jo.put("operation_type", standardCoveyorControlWithPlcScannerDeviceDriver.getOperation_type()); + jo.put("direction", standardCoveyorControlWithPlcScannerDeviceDriver.getDirection()); + jo.put("action", standardCoveyorControlWithPlcScannerDeviceDriver.getAction()); + jo.put("ioaction", standardCoveyorControlWithPlcScannerDeviceDriver.getIoaction()); + jo.put("container", StrUtil.isEmpty(standardCoveyorControlWithPlcScannerDeviceDriver.getBarcode()) ? "" : standardCoveyorControlWithPlcScannerDeviceDriver.getBarcode()); + jo.put("message", standardCoveyorControlWithPlcScannerDeviceDriver.getMessage()); + jo.put("requestSucess", standardCoveyorControlWithPlcScannerDeviceDriver.getRequireSucess().toString()); + jo.put("applySucess", standardCoveyorControlWithPlcScannerDeviceDriver.getApplySucess().toString()); + jo.put("instruction_message", standardCoveyorControlWithPlcScannerDeviceDriver.getInst_message()); + } + //检测站点 + else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); + jo.put("device_code", device.getDevice_code()); + jo.put("mode", standardInspectSiteDevicedriver.getMode()); + jo.put("move", standardInspectSiteDevicedriver.getMove()); + jo.put("hasGoods", standardInspectSiteDevicedriver.getHasGoods()); + jo.put("isOnline", standardInspectSiteDevicedriver.getIsonline()); + jo.put("error", standardInspectSiteDevicedriver.getError()); + jo.put("isError", standardInspectSiteDevicedriver.getIserror()); + jo.put("container", standardInspectSiteDevicedriver.getContainer()); + jo.put("message", standardInspectSiteDevicedriver.getMessage()); + } + //普通站点 + else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); + jo.put("device_code", device.getDevice_code()); + jo.put("move", standardOrdinarySiteDeviceDriver.getMove()); + jo.put("container", standardOrdinarySiteDeviceDriver.getContainer()); + jo.put("hasGoods", standardOrdinarySiteDeviceDriver.getHasGoods()); + jo.put("isOnline", true); + //点击弹出 + jo.put("is_click", true); + jo.put("device_type", device.getDevice_type()); + jo.put("error", standardOrdinarySiteDeviceDriver.getError()); + jo.put("isError", standardOrdinarySiteDeviceDriver.getIserror()); + jo.put("container", standardOrdinarySiteDeviceDriver.getContainer()); + jo.put("message", standardOrdinarySiteDeviceDriver.getMessage()); + jo.put("material", standardOrdinarySiteDeviceDriver.getMaterial()); + jo.put("batch", standardOrdinarySiteDeviceDriver.getBatch()); + + } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); + jo.put("device_code", device.getDevice_code()); + jo.put("mode", standardInspectSiteDevicedriver.getMode()); + jo.put("move", standardInspectSiteDevicedriver.getMove()); + jo.put("hasGoods", standardInspectSiteDevicedriver.getHasGoods()); + jo.put("isOnline", standardInspectSiteDevicedriver.getIsonline()); + jo.put("error", standardInspectSiteDevicedriver.getError()); + jo.put("isError", standardInspectSiteDevicedriver.getIserror()); + jo.put("container", standardInspectSiteDevicedriver.getContainer()); + jo.put("message", standardInspectSiteDevicedriver.getMessage()); + } else if (device.getDeviceDriver() instanceof StandardScannerDeviceDriver) { + standardScannerDeviceDriver = (StandardScannerDeviceDriver) device.getDeviceDriver(); + jo.put("device_code", device.getDevice_code()); + jo.put("isOnline", true); + jo.put("device_type", device.getDevice_type()); + //点击弹出 + jo.put("is_click", true); + jo.put("ip", standardScannerDeviceDriver.getIp()); + jo.put("container", StrUtil.isEmpty(standardScannerDeviceDriver.readBarcode()) ? "" : standardScannerDeviceDriver.readBarcode()); + } else { + jo.put("device_code", device.getDevice_code()); + } backja.add(jo); } - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK.value()); - resultJson.put("message", "操作成功"); - resultJson.put("data", backja); -// log.info("queryDevice--------------:输出参数" + resultJson.toString()); - return resultJson; + } else { + for (int i = 0; i < datas.size(); i++) { + JSONObject jo = new JSONObject(); + JSONObject data = datas.getJSONObject(i); + String device_code = data.getString("device_code"); + Device device = deviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isEmpty(device)) { + throw new Exception("未找到对应设备:" + device_code); + } - } finally { - MDC.remove(log_file_type); + if (device.getDeviceDriver() instanceof StandardCoveyorControlDeviceDriver) { + standardCoveyorControlDeviceDriver = (StandardCoveyorControlDeviceDriver) device.getDeviceDriver(); + jo.put("device_code", device.getDevice_code()); + jo.put("mode", standardCoveyorControlDeviceDriver.getMode()); + jo.put("move", standardCoveyorControlDeviceDriver.getMove()); + jo.put("hasGoods", standardCoveyorControlDeviceDriver.getHasGoods()); + jo.put("isOnline", standardCoveyorControlDeviceDriver.getIsonline()); + jo.put("error", standardCoveyorControlDeviceDriver.getError()); + jo.put("isError", standardCoveyorControlDeviceDriver.getIserror()); + jo.put("requestSucess", standardCoveyorControlDeviceDriver.getRequireSucess()); + jo.put("applySucess", standardCoveyorControlDeviceDriver.getApplySucess()); + jo.put("message", standardCoveyorControlDeviceDriver.getMessage()); + } else if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { + standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); +// jo.put("device_code", device.getDevice_code()); +// jo.put("mode", standardAutodoorDeviceDriver.getMode()); +// jo.put("action", standardAutodoorDeviceDriver.getAction()); +// jo.put("isOnline", true); +// jo.put("error", standardAutodoorDeviceDriver.getError()); +// jo.put("isError", standardAutodoorDeviceDriver.getIserror()); + } else if (device.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) { + standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) device.getDeviceDriver(); +// jo.put("device_code", device.getDevice_code()); +// jo.put("mode", standardCoveyorControlWithScannerDeviceDriver.getMode()); +// jo.put("move", standardCoveyorControlWithScannerDeviceDriver.getMove()); +// jo.put("hasGoods", standardCoveyorControlWithScannerDeviceDriver.getHasGoods()); +// jo.put("isOnline", standardCoveyorControlWithScannerDeviceDriver.getIsonline()); +// jo.put("error", standardCoveyorControlWithScannerDeviceDriver.getError()); +// jo.put("isError", standardCoveyorControlWithScannerDeviceDriver.getIserror()); +// jo.put("height", standardCoveyorControlWithScannerDeviceDriver.getHeight()); +// jo.put("operation_type", standardCoveyorControlWithScannerDeviceDriver.getOperation_type()); +// jo.put("direction", standardCoveyorControlWithScannerDeviceDriver.getDirection()); +// jo.put("action", standardCoveyorControlWithScannerDeviceDriver.getAction()); +// jo.put("ioaction", standardCoveyorControlWithScannerDeviceDriver.getIoaction()); +// jo.put("container", StrUtil.isEmpty(standardCoveyorControlWithScannerDeviceDriver.barcode()) ? "" : standardCoveyorControlWithScannerDeviceDriver.barcode()); +// jo.put("message", standardCoveyorControlWithScannerDeviceDriver.getMessage()); +// jo.put("requestSucess", standardCoveyorControlWithScannerDeviceDriver.getRequireSucess().toString()); +// jo.put("applySucess", standardCoveyorControlWithScannerDeviceDriver.getApplySucess().toString()); +// jo.put("instruction_message", standardCoveyorControlWithScannerDeviceDriver.getInst_message()); + } else if (device.getDeviceDriver() instanceof StandardCoveyorControlWithPlcScannerDeviceDriver) { + standardCoveyorControlWithPlcScannerDeviceDriver = (StandardCoveyorControlWithPlcScannerDeviceDriver) device.getDeviceDriver(); + jo.put("device_code", device.getDevice_code()); + jo.put("mode", standardCoveyorControlWithPlcScannerDeviceDriver.getMode()); + jo.put("move", standardCoveyorControlWithPlcScannerDeviceDriver.getMove()); + jo.put("hasGoods", standardCoveyorControlWithPlcScannerDeviceDriver.getHasGoods()); + jo.put("isOnline", standardCoveyorControlWithPlcScannerDeviceDriver.getIsonline()); + jo.put("error", standardCoveyorControlWithPlcScannerDeviceDriver.getError()); + jo.put("isError", standardCoveyorControlWithPlcScannerDeviceDriver.getIserror()); + jo.put("height", standardCoveyorControlWithPlcScannerDeviceDriver.getHeight()); + jo.put("operation_type", standardCoveyorControlWithPlcScannerDeviceDriver.getOperation_type()); + jo.put("direction", standardCoveyorControlWithPlcScannerDeviceDriver.getDirection()); + jo.put("action", standardCoveyorControlWithPlcScannerDeviceDriver.getAction()); + jo.put("ioaction", standardCoveyorControlWithPlcScannerDeviceDriver.getIoaction()); + jo.put("container", StrUtil.isEmpty(standardCoveyorControlWithPlcScannerDeviceDriver.getBarcode()) ? "" : standardCoveyorControlWithPlcScannerDeviceDriver.getBarcode()); + jo.put("message", standardCoveyorControlWithPlcScannerDeviceDriver.getMessage()); + jo.put("requestSucess", standardCoveyorControlWithPlcScannerDeviceDriver.getRequireSucess().toString()); + jo.put("applySucess", standardCoveyorControlWithPlcScannerDeviceDriver.getApplySucess().toString()); + jo.put("instruction_message", standardCoveyorControlWithPlcScannerDeviceDriver.getInst_message()); + } + //检测站点 + else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); + jo.put("device_code", device.getDevice_code()); + jo.put("mode", standardInspectSiteDevicedriver.getMode()); + jo.put("move", standardInspectSiteDevicedriver.getMove()); + jo.put("hasGoods", standardInspectSiteDevicedriver.getHasGoods()); + jo.put("isOnline", standardInspectSiteDevicedriver.getIsonline()); + jo.put("error", standardInspectSiteDevicedriver.getError()); + jo.put("isError", standardInspectSiteDevicedriver.getIserror()); + jo.put("container", standardInspectSiteDevicedriver.getContainer()); + jo.put("message", standardInspectSiteDevicedriver.getMessage()); + } + //普通站点 + else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); + jo.put("device_code", device.getDevice_code()); + jo.put("move", standardOrdinarySiteDeviceDriver.getMove()); + jo.put("container", standardOrdinarySiteDeviceDriver.getContainer()); + jo.put("hasGoods", standardOrdinarySiteDeviceDriver.getHasGoods()); + jo.put("isOnline", true); + //点击弹出 + jo.put("is_click", true); + jo.put("device_type", device.getDevice_type()); + jo.put("error", standardOrdinarySiteDeviceDriver.getError()); + jo.put("isError", standardOrdinarySiteDeviceDriver.getIserror()); + jo.put("container", standardOrdinarySiteDeviceDriver.getContainer()); + jo.put("message", standardOrdinarySiteDeviceDriver.getMessage()); + jo.put("material", standardOrdinarySiteDeviceDriver.getMaterial()); + jo.put("batch", standardOrdinarySiteDeviceDriver.getBatch()); + + } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); + jo.put("device_code", device.getDevice_code()); + jo.put("mode", standardInspectSiteDevicedriver.getMode()); + jo.put("move", standardInspectSiteDevicedriver.getMove()); + jo.put("hasGoods", standardInspectSiteDevicedriver.getHasGoods()); + jo.put("isOnline", standardInspectSiteDevicedriver.getIsonline()); + jo.put("error", standardInspectSiteDevicedriver.getError()); + jo.put("isError", standardInspectSiteDevicedriver.getIserror()); + jo.put("container", standardInspectSiteDevicedriver.getContainer()); + jo.put("message", standardInspectSiteDevicedriver.getMessage()); + } else if (device.getDeviceDriver() instanceof StandardScannerDeviceDriver) { + standardScannerDeviceDriver = (StandardScannerDeviceDriver) device.getDeviceDriver(); + jo.put("device_code", device.getDevice_code()); + jo.put("isOnline", true); + jo.put("device_type", device.getDevice_type()); + //点击弹出 + jo.put("is_click", true); + jo.put("ip", standardScannerDeviceDriver.getIp()); + jo.put("container", StrUtil.isEmpty(standardScannerDeviceDriver.readBarcode()) ? "" : standardScannerDeviceDriver.readBarcode()); + } else { + jo.put("device_code", device.getDevice_code()); + } + backja.add(jo); + } } - - + JSONObject resultJson = new JSONObject(); + resultJson.put("status", HttpStatus.OK); + resultJson.put("message", "操作成功"); + resultJson.put("data", backja); + log.info("queryDevice--------------:输出参数" + resultJson.toString()); + return resultJson; } + @Override + @Transactional(rollbackFor = Exception.class) + public Map actionOrder(String whereJson) { + JSONArray datas = JSONArray.parseArray(whereJson); + log.info("actionOrder--------------:输入参数" + datas.toString()); + WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder"); + for (int i = 0; i < datas.size(); i++) { + JSONObject param = datas.getJSONObject(i); + String ext_order_id = param.getString("ext_order_id"); + if (StrUtil.isEmpty(ext_order_id)) { + throw new BadRequestException("外部标识不能为空"); + } + String order_code = param.getString("order_code"); + if (StrUtil.isEmpty(order_code)) { + order_code = CodeUtil.getNewCode("ORDER_NO"); + } else { + JSONObject jsonObject = wo.query("is_deleted = '0' and order_code = '" + order_code + "'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(jsonObject)) { + throw new BadRequestException("工单编码不能重复"); + } + } + String qty = param.getString("qty"); + if (StrUtil.isEmpty(qty)) { + throw new BadRequestException("生产数量不能为空"); + } + String material_uuid = param.getString("material_uuid"); + if (StrUtil.isEmpty(material_uuid)) { + throw new BadRequestException("物料标识不能为空"); + } + String material_code = param.getString("material_code"); + if (StrUtil.isEmpty(material_code)) { + throw new BadRequestException("物料编码不能为空"); + } + String material_name = param.getString("material_name"); + if (StrUtil.isEmpty(material_name)) { + throw new BadRequestException("物料名称不能为空"); + } + String material_spec = param.getString("material_spec"); + String device_code = param.getString("device_code"); + if (StrUtil.isEmpty(device_code)) { + throw new BadRequestException("设备编码不能为空"); + } + String is_needmove = param.getString("is_needmove"); + ProduceshiftorderDto dto = new ProduceshiftorderDto(); + dto.setExt_order_id(ext_order_id); + dto.setOrder_code(order_code); + dto.setQty(BigDecimal.valueOf(Long.parseLong(qty))); + dto.setMaterial_uuid(material_uuid); + dto.setMaterial_code(material_code); + dto.setMaterial_name(material_name); + dto.setMaterial_spec(material_spec); + dto.setDevice_code(device_code); + dto.setIs_needmove(is_needmove); + dto.setCreate_by("mes"); + dto.setUpdate_by("mes"); + produceshiftorderService.create(dto); + } + JSONObject resultJson = new JSONObject(); + resultJson.put("status", HttpStatus.OK); + resultJson.put("message", "操作成功"); + log.info("actionOrder--------------:输出参数" + resultJson.toString()); + return resultJson; + } + + @Override + public Map orderStatusUpdate(String whereJson) { + JSONArray datas = JSONArray.parseArray(whereJson); + log.info("orderStatusUpdate--------------:输入参数" + datas.toString()); + WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder"); + for (int i = 0; i < datas.size(); i++) { + JSONObject jsonObject = datas.getJSONObject(i); + String ext_order_id = jsonObject.getString("ext_order_id"); + String type = jsonObject.getString("type"); + JSONObject json = wo.query("ext_order_id = '" + ext_order_id + "'").uniqueResult(0); + ProduceshiftorderDto obj = JSONObject.toJavaObject(json, ProduceshiftorderDto.class); + Device device = deviceAppService.findDeviceByCode(obj.getDevice_code()); + HailiangSpecialDeviceDriver hailiangSpecialDeviceDriver; + HailiangPackerStationDeviceDriver hailiangPackerStationDeviceDriver; + HailiangEngravingMachineDeviceDriver hailiangEngravingMachineDeviceDriver; + HailiangStackingStationDriver hailiangStackingStationDriver; + if (device.getDeviceDriver() instanceof HailiangSpecialDeviceDriver) { + hailiangSpecialDeviceDriver = (HailiangSpecialDeviceDriver) device.getDeviceDriver(); + //暂停 + if (type.equals("1")) { + hailiangSpecialDeviceDriver.writing("to_pause", "1"); + } + //恢复 + if (type.equals("2")) { + hailiangSpecialDeviceDriver.writing("to_pause", "0"); + } + //强制完成 + if (type.equals("3")) { + obj.setOrder_status("3"); + obj.setUpdate_by("mes"); + obj.setUpdate_time(DateUtil.now()); + produceshiftorderService.update(obj); + } + } + if (device.getDeviceDriver() instanceof HailiangPackerStationDeviceDriver) { + hailiangPackerStationDeviceDriver = (HailiangPackerStationDeviceDriver) device.getDeviceDriver(); + //强制完成 + if (type.equals("3")) { + obj.setOrder_status("3"); + obj.setUpdate_by("mes"); + produceshiftorderService.update(obj); + } + } + if (device.getDeviceDriver() instanceof HailiangEngravingMachineDeviceDriver) { + hailiangEngravingMachineDeviceDriver = (HailiangEngravingMachineDeviceDriver) device.getDeviceDriver(); + //暂停 + if (type.equals("1")) { + hailiangEngravingMachineDeviceDriver.writing("to_pause", "1"); + } + //恢复 + if (type.equals("2")) { + hailiangEngravingMachineDeviceDriver.writing("to_pause", "0"); + } + //强制完成 + if (type.equals("3")) { + obj.setOrder_status("3"); + obj.setUpdate_by("mes"); + obj.setUpdate_time(DateUtil.now()); + produceshiftorderService.update(obj); + } + } + + if (device.getDeviceDriver() instanceof HailiangStackingStationDriver) { + hailiangStackingStationDriver = (HailiangStackingStationDriver) device.getDeviceDriver(); + //暂停 + if (type.equals("1")) { + hailiangStackingStationDriver.writing("to_lane_off", "1"); + } + //恢复 + if (type.equals("2")) { + hailiangStackingStationDriver.writing("to_lane_off", "0"); + } + if (type.equals("3")) { + obj.setOrder_status("3"); + obj.setUpdate_by("mes"); + obj.setUpdate_time(DateUtil.now()); + produceshiftorderService.update(obj); + } + } + } + JSONObject resultJson = new JSONObject(); + resultJson.put("status", HttpStatus.OK); + resultJson.put("message", "操作成功"); + log.info("orderStatusUpdate--------------:输出参数" + resultJson.toString()); + return resultJson; + } @Override public Map queryDeviceDBValue(String whereJson) { @@ -302,502 +762,65 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } @Override - public Map querydevice(String whereJson) { - return null; - } - - - - @Override - public Map putPlusPullAction(String param) { - try { - MDC.put(log_file_type, log_type); - log.info("putPlusPullAction-----输入参数{}", param); - JSONObject jo = JSON.parseObject(param); - String device_code = jo.getString("device_code"); - String size = jo.getString("size"); - String type = jo.getString("type"); - Device device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device)) { - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "未找到对应的设备:"+device_code); - return resultJson; - } -// PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver; -// if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { -// plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver(); -// // 0 穿轴 1拔轴 -// if(StrUtil.equals(type,"1")){ -// -// if(plugPullDeviceSiteDeviceDriver.getMode() == 1){ -// JSONObject resultJson = new JSONObject(); -// resultJson.put("status", HttpStatus.BAD_REQUEST.value()); -// resultJson.put("message", "请求拔轴,当前设备工作模式未自动"); -// return resultJson; -// } -// if(plugPullDeviceSiteDeviceDriver.getAction() == 0){ -// JSONObject resultJson = new JSONObject(); -// resultJson.put("status", HttpStatus.BAD_REQUEST.value()); -// resultJson.put("message", "请求拔轴,当前设备未全自动"); -// return resultJson; -// } -// if(plugPullDeviceSiteDeviceDriver.getStatus() != 0){ -// JSONObject resultJson = new JSONObject(); -// resultJson.put("status", HttpStatus.BAD_REQUEST.value()); -// resultJson.put("message", "请求拔轴,当前设备未待机"); -// return resultJson; -// } -// if(plugPullDeviceSiteDeviceDriver.getControl() != 0){ -// JSONObject resultJson = new JSONObject(); -// resultJson.put("status", HttpStatus.BAD_REQUEST.value()); -// resultJson.put("message", "请求拔轴,当前设备未远程控制"); -// return resultJson; -// } -// if(plugPullDeviceSiteDeviceDriver.getMove() != 0){ -// JSONObject resultJson = new JSONObject(); -// resultJson.put("status", HttpStatus.BAD_REQUEST.value()); -// resultJson.put("message", "请求拔轴,当前设备有轴"); -// return resultJson; -// } -// if(plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() ==1 -// && plugPullDeviceSiteDeviceDriver.getStatus() ==0 && plugPullDeviceSiteDeviceDriver.getMove() ==0 -// && plugPullDeviceSiteDeviceDriver.getControl() ==0 ){ -// -// List list = new ArrayList(); -// Map map = new HashMap(); -// map.put("code","to_size"); -// map.put("value",size); -// list.add(map); -// Map map2 = new HashMap(); -// map2.put("code","to_type"); -// map2.put("value",type); -// list.add(map2); -// Map map3 = new HashMap(); -// map3.put("code","to_command"); -// map3.put("value","1"); -// list.add(map3); -// plugPullDeviceSiteDeviceDriver.writing(list); -// -// } else { -// JSONObject resultJson = new JSONObject(); -// resultJson.put("status", HttpStatus.BAD_REQUEST.value()); -// resultJson.put("message", "当前设备状态不满足下发条件"); -// return resultJson; -// } -// -// } else if (StrUtil.equals(type,"0")){ -// -// if(plugPullDeviceSiteDeviceDriver.getMode() == 1){ -// JSONObject resultJson = new JSONObject(); -// resultJson.put("status", HttpStatus.BAD_REQUEST.value()); -// resultJson.put("message", "请求插轴,当前设备工作模式未自动"); -// return resultJson; -// } -// if(plugPullDeviceSiteDeviceDriver.getAction() == 0){ -// JSONObject resultJson = new JSONObject(); -// resultJson.put("status", HttpStatus.BAD_REQUEST.value()); -// resultJson.put("message", "请求插轴,当前设备未全自动"); -// return resultJson; -// } -// if(plugPullDeviceSiteDeviceDriver.getStatus() != 0){ -// JSONObject resultJson = new JSONObject(); -// resultJson.put("status", HttpStatus.BAD_REQUEST.value()); -// resultJson.put("message", "请求插轴,当前设备未待机"); -// return resultJson; -// } -// if(plugPullDeviceSiteDeviceDriver.getControl() != 0){ -// JSONObject resultJson = new JSONObject(); -// resultJson.put("status", HttpStatus.BAD_REQUEST.value()); -// resultJson.put("message", "请求插轴,当前设备未远程控制"); -// return resultJson; -// } -// if(plugPullDeviceSiteDeviceDriver.getMove() != 1){ -// JSONObject resultJson = new JSONObject(); -// resultJson.put("status", HttpStatus.BAD_REQUEST.value()); -// resultJson.put("message", "请求插轴,当前设备没有轴"); -// return resultJson; -// } -// -// if(plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() ==1 -// && plugPullDeviceSiteDeviceDriver.getStatus() ==0 && plugPullDeviceSiteDeviceDriver.getMove() ==1 -// && plugPullDeviceSiteDeviceDriver.getControl() ==0 ){ -// -// List list = new ArrayList(); -// Map map = new HashMap(); -// map.put("code","to_size"); -// map.put("value",size); -// list.add(map); -// Map map2 = new HashMap(); -// map2.put("code","to_type"); -// map2.put("value",type); -// list.add(map2); -// Map map3 = new HashMap(); -// map3.put("code","to_command"); -// map3.put("value","1"); -// list.add(map3); -// plugPullDeviceSiteDeviceDriver.writing(list); -// -// } else { -// JSONObject resultJson = new JSONObject(); -// resultJson.put("status", HttpStatus.BAD_REQUEST.value()); -// resultJson.put("message", "当前设备状态不满足下发条件"); -// return resultJson; -// } -// } -// } - - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK.value()); - resultJson.put("message", "操作成功"); - log.info("putPlusPullAction--------------:输出参数" + resultJson.toString()); - return resultJson; - - } finally { - MDC.remove(log_file_type); - } - } - - - - @Override - public CreateTaskResponse crateTask(String param) { - try { - MDC.put(log_file_type, log_type); - log.info("crateTask-----输入参数{}", param); - JSONArray datas = JSONArray.parseArray(param); - CreateTaskResponse response = new CreateTaskResponse(); - ParamService paramService = SpringContextHolder.getBean(ParamService.class); - String cancelTaskCheck = paramService.findByCode(AcsConfig.ISALLOWTASK).getValue(); - JSONArray errArr = new JSONArray(); - if(StrUtil.equals(cancelTaskCheck,"0")){ - response.setStatus(400); - response.setMessage("ACS系统需要更新,请稍等"); - response.setErrArr(datas); - return response; - } - for (int i = 0; i < datas.size(); i++) { - String data = datas.get(i).toString(); - CreateTaskRequest request = JsonUtl.format(data, CreateTaskRequest.class); - String ext_task_id = request.getExt_task_id(); - String task_code = request.getTask_code(); - String start_device_code = request.getStart_device_code(); - String start_device_code2 = request.getStart_device_code2(); - String next_device_code = request.getNext_device_code(); - String next_device_code2 = request.getNext_device_code2(); - String put_device_code = request.getPut_device_code(); - String priority = request.getPriority(); - String vehicle_code = request.getVehicle_code(); - String vehicle_type = request.getVehicle_type(); - String route_plan_code = request.getRoute_plan_code(); - String task_type = request.getTask_type(); - String storage_task_type = request.getDtl_type(); - String agv_system_type = request.getAgv_system_type(); - String remark = request.getRemark(); - double oven_time = 0.00d; - if (StrUtil.isNotEmpty(request.getOven_time())) { - oven_time = Double.parseDouble(request.getOven_time()); - } - String temperature = request.getTemperature(); - Map params = request.getParams(); - - String start_point_code = ""; - String start_point_code2 = ""; - String next_point_code = ""; - String next_point_code2 = ""; - String put_point_code = ""; - if (StrUtil.isEmpty(task_code)) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "任务号不能为空"); - errArr.add(json); - continue; - } - if (StrUtil.isEmpty(start_device_code)) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "起点不能为空"); - errArr.add(json); - continue; - } - if (StrUtil.isEmpty(next_device_code)) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "终点不能为空"); - errArr.add(json); - continue; - } - - if(StrUtil.equals(task_type,"8")){ - next_device_code = request.getPut_device_code(); - put_device_code = request.getNext_device_code(); - } - - JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code + "'").uniqueResult(0); - if (!ObjectUtil.isEmpty(start_device_json)) { - start_point_code = (String) start_device_json.get("parent_storage_code") == null ? start_device_code : (String) start_device_json.get("storage_code"); - } - JSONObject next_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_device_code + "'").uniqueResult(0); - if (!ObjectUtil.isEmpty(next_device_json)) { - next_point_code = (String) next_device_json.get("parent_storage_code") == null ? next_point_code : (String) next_device_json.get("storage_code"); - } - JSONObject start_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code2 + "'").uniqueResult(0); - if (!ObjectUtil.isEmpty(start_device_json2)) { - start_point_code2 = (String) start_device_json2.get("parent_storage_code") == null ? start_device_code2 : (String) start_device_json2.get("storage_code"); - } - JSONObject next_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_device_code2 + "'").uniqueResult(0); - if (!ObjectUtil.isEmpty(next_device_json2)) { - next_point_code2 = (String) next_device_json2.get("parent_storage_code") == null ? next_device_code2 : (String) next_device_json2.get("storage_code"); - } - JSONObject put_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + put_device_code + "'").uniqueResult(0); - if (!ObjectUtil.isEmpty(put_device_json)) { - put_point_code = (String) put_device_json.get("parent_storage_code") == null ? put_device_code : (String) put_device_json.get("storage_code"); - } - if (StrUtil.isNotEmpty(start_point_code) && start_point_code.indexOf("-") > 0) { - String str[] = start_point_code.split("-"); - start_device_code = str[0]; - } else { - start_device_code = start_point_code; - } - - if (StrUtil.isNotEmpty(next_point_code) && next_point_code.indexOf("-") > 0) { - String str[] = next_point_code.split("-"); - next_device_code = str[0]; - } else { - next_device_code = next_point_code; - } - - if (StrUtil.isNotEmpty(start_point_code2) && start_point_code2.indexOf("-") > 0) { - String str[] = start_point_code2.split("-"); - start_device_code2 = str[0]; - } else { - start_device_code2 = start_point_code2; - } - - if (StrUtil.isNotEmpty(next_point_code2) && next_point_code2.indexOf("-") > 0) { - String str[] = next_point_code2.split("-"); - next_device_code2 = str[0]; - } else { - next_device_code2 = next_point_code2; - } - - if (StrUtil.isNotEmpty(put_point_code) && put_point_code.indexOf("-") > 0) { - String str[] = put_point_code.split("-"); - put_device_code = str[0]; - } else { - put_device_code = put_point_code; - } - - if (StrUtil.isEmpty(route_plan_code)) { - route_plan_code = "normal"; - } - -// if(StrUtil.equals(task_type,"5")){ -// Device device = deviceAppService.findDeviceByCode(next_device_code); -// SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; -// if(device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { -// siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver(); -// if (ObjectUtil.equal("true", siemensConveyorDeviceDriver.getExtraValue().get("inspect_in_stock"))) { -// if(siemensConveyorDeviceDriver.getMove() == 1) -// { -// JSONObject json = new JSONObject(); -// json.put("task_code", task_code); -// json.put("ext_task_id", ext_task_id); -// json.put("message", "终点"+siemensConveyorDeviceDriver.getDevice_code()+"有货无法生成任务"); -// errArr.add(json); -// continue; -// } -// } -// } -// -// if( taskService.querySameDeviceReadyTask(start_device_code,next_device_code,"0") > 1){ -// JSONObject json = new JSONObject(); -// json.put("task_code", task_code); -// json.put("ext_task_id", ext_task_id); -// json.put("message", "已存在相同的起点:"+start_device_code + "终点:"+ next_device_code + "未执行的输送任务"); -// errArr.add(json); -// continue; -// } -// } - - TaskDto taskDto = taskService.findByCodeFromCache(task_code); - if (taskDto != null) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "不能存在相同的任务号:"+task_code); - errArr.add(json); - continue; - } - if (!StrUtil.isEmpty(vehicle_code)) { - TaskDto vehicle_dto = taskService.findByContainer(vehicle_code); - if (vehicle_dto != null) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", "不能存在相同的托盘号:"+vehicle_code); - errArr.add(json); - continue; - } - } - - if (StrUtil.isEmpty(start_point_code)) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", request.getStart_device_code() + " 该设备号未找到对应点位"); - errArr.add(json); - continue; - } - if (StrUtil.isEmpty(next_point_code)) { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", request.getNext_device_code() + " 该设备号未找到对应点位"); - errArr.add(json); - continue; - } - - JSONObject jo = new JSONObject(); - jo.put("task_id", IdUtil.simpleUUID()); - jo.put("task_code", task_code); - jo.put("start_point_code", start_point_code); - jo.put("next_point_code", next_point_code); - jo.put("start_point_code2", start_point_code2); - jo.put("next_point_code2", next_point_code2); - jo.put("put_point_code", put_point_code); - jo.put("start_parent_code", start_point_code); - jo.put("next_parent_code", next_point_code); - jo.put("start_device_code", start_device_code); - jo.put("next_device_code", next_device_code); - jo.put("start_device_code2", start_device_code2); - jo.put("next_device_code2", next_device_code2); - jo.put("put_device_code", put_device_code); - jo.put("priority", priority); - jo.put("vehicle_code", vehicle_code); - jo.put("vehicle_type", vehicle_type); - jo.put("storage_task_type", storage_task_type); - jo.put("agv_system_type", agv_system_type); - jo.put("oven_time", (int) Math.ceil(oven_time)); - jo.put("remark", remark); - jo.put("params", params); - jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type)); - - if (!StrUtil.isEmpty(ext_task_id)) { - jo.put("ext_task_id", ext_task_id); - } - - TaskDto task_dto = jo.toJavaObject(TaskDto.class); - try { - // task_type=7 则是立库任务需要下刻下发 - if (StrUtil.equals(task_dto.getTask_type(), "7")) { - //创建临时指令 不创建、不生成 - //等立库反馈成功才能创建任务和指令 - Instruction inst = null; - try { - inst = taskService.createTemporaryInst(task_dto); - } catch (Exception e){ - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", e.getMessage()); - errArr.add(json); - continue; - } - Resp resp = acsToLiKuService.sendInst(task_dto.getStorage_task_type(),inst); - - if(StrUtil.equals(resp.result,"true")){ - //创建任务和指令 - taskService.create(task_dto); - inst.setSend_status("1"); - taskService.createInst(inst); - - } else { - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", resp.getComment()); - json.put("code", resp.code); - json.put("data", data); - errArr.add(json); - continue; - } - - } else { - taskService.create(task_dto); - } - } catch (Exception e) { -// e.printStackTrace(); - JSONObject json = new JSONObject(); - json.put("task_code", task_code); - json.put("ext_task_id", ext_task_id); - json.put("message", e.getMessage()); - errArr.add(json); - continue; - } - } - if (ObjectUtil.isEmpty(errArr)) { - response.setStatus(200); - response.setMessage("success"); - } else { - response.setStatus(400); - if(ObjectUtil.isNotEmpty(errArr)){ - response.setMessage(errArr.getJSONObject(0).getString("message")); - } else { - response.setMessage("false"); - } - response.setErrArr(errArr); - } - log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(response)); - - return response; - } finally { - MDC.remove(log_file_type); - } - - } - - - @Override - public Map updateTask(String whereJson) { + public Map replaceDevice(String whereJson) { + String now = DateUtil.now(); JSONArray datas = JSONArray.parseArray(whereJson); - log.info("updateTask--------------:输入参数" + datas.toString()); - JSONArray errArr = new JSONArray(); - if (datas.size() > 0) { - for (int i = 0; i < datas.size(); i++) { - JSONObject jsonObject = datas.getJSONObject(i); - String device_code = jsonObject.getString("device_code"); - String task_code = jsonObject.getString("task_code"); - //1-允许取放; 2-允许离开 - String option = jsonObject.getString("option"); - StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; - Device device_k = deviceAppService.findDeviceByCode(device_code+"_K"); - Device device_m = deviceAppService.findDeviceByCode(device_code+"_M"); - if(device_k.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){ - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_k.getDeviceDriver(); - standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option)); - } - if(device_m.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){ - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_m.getDeviceDriver(); - standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option)); + log.info("replaceDevice工单更换设备--------------:输入参数" + datas.toString()); + for (int i = 0; i < datas.size(); i++) { + JSONObject jsonObject = datas.getJSONObject(i); + String order_code = jsonObject.getString("order_code"); + String new_device_code = jsonObject.getString("device_code"); + ProduceshiftorderDto produceshiftorderDto = produceshiftorderService.findByCode(order_code); + String old_device_code = produceshiftorderDto.getDevice_code(); + Device old_device = deviceAppService.findDeviceByCode(old_device_code); + HailiangSpecialDeviceDriver old_hailiangSpecialDeviceDriver; + HailiangSpecialDeviceDriver new_hailiangSpecialDeviceDriver; + HailiangPackerStationDeviceDriver old_hailiangPackerStationDeviceDriver; + HailiangPackerStationDeviceDriver new_hailiangPackerStationDeviceDriver; + HailiangEngravingMachineDeviceDriver old_hailiangEngravingMachineDeviceDriver; + HailiangEngravingMachineDeviceDriver new_hailiangEngravingMachineDeviceDriver; + if (old_device.getDeviceDriver() instanceof HailiangSpecialDeviceDriver) { + //更换设备前,先判断新设备是否开机 + Device new_device = deviceAppService.findDeviceByCode(new_device_code); + new_hailiangSpecialDeviceDriver = (HailiangSpecialDeviceDriver) new_device.getDeviceDriver(); + if (!new_hailiangSpecialDeviceDriver.getItemProtocol().getIsonline()) { + throw new BadRequestException("更换设备失败,该设备已关机,请开机后重试!"); } + old_hailiangSpecialDeviceDriver = (HailiangSpecialDeviceDriver) old_device.getDeviceDriver(); + //获取更换设备前 老设备生产的数量 + int now_order_prod_num = old_hailiangSpecialDeviceDriver.getNow_order_prod_num(); + //获取订单总量 + int order_prod_allnum = Integer.parseInt(produceshiftorderDto.getQty().toString()); + //获取每箱数量 + int one_qty = Integer.parseInt(produceshiftorderDto.getOne_qty().toString()); + //计算订单数量还需要生产多少个 + int diff = order_prod_allnum - now_order_prod_num; + //更改工单设备号 + produceshiftorderDto.setDevice_code(new_device_code); + produceshiftorderDto.setUpdate_time(now); + produceshiftorderDto.setUpdate_by("mes"); + produceshiftorderService.updateByOrderCode(produceshiftorderDto); + + //将新设备中的报工数量Report_qty更改为上个设备生产的数量 + //将工单数据写入到新生产设备中 + new_hailiangSpecialDeviceDriver.writing("to_clear", "1"); + new_hailiangSpecialDeviceDriver.writing("to_order", order_code); + new_hailiangSpecialDeviceDriver.writing("to_one_box_num", one_qty + ""); + new_hailiangSpecialDeviceDriver.writing("to_order_prod_num", diff + ""); + new_hailiangSpecialDeviceDriver.writing("to_pause", "0"); + //老设备数据清除 + old_hailiangSpecialDeviceDriver.writing("to_order","0"); + old_hailiangSpecialDeviceDriver.writing("to_clear","1"); + } + // TODO其他驱动更换设备还没写 + if (old_device.getDeviceDriver() instanceof HailiangPackerStationDeviceDriver){ } } JSONObject resultJson = new JSONObject(); - if (ObjectUtil.isEmpty(errArr)) { - resultJson.put("status", HttpStatus.OK.value()); - resultJson.put("message", "操作成功"); - } else { - resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "操作失败"); - if(ObjectUtil.isNotEmpty(errArr)){ - resultJson.put("errArr",errArr); - } - } + resultJson.put("status", HttpStatus.OK); + resultJson.put("message", "操作成功"); + resultJson.put("data", new JSONObject()); return resultJson; } diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/wcs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index e8c1a767..4e37d525 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/wcs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -25,8 +25,6 @@ import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_plcsca import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver; -import org.nl.acs.ext.wms.liKuData.*; -import org.nl.acs.ext.wms.service.AcsToLiKuService; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.opc.Device; @@ -83,8 +81,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu RouteLineService routeLineService; @Autowired TaskService taskService; - @Autowired - AcsToLiKuService acsToLiKuService; +// @Autowired +// AcsToLiKuService acsToLiKuService; @Override public void autoInitial() { @@ -1212,28 +1210,28 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu if (flag) { - if (StrUtil.equals(entity.getInstruction_type(), "7")) { - CancelTaskRequest cancelTaskRequest = new CancelTaskRequest(); - cancelTaskRequest.setOrderId(entity.getInstruction_code()); - cancelTaskRequest.setPalletCode(entity.getVehicle_code()); - cancelTaskRequest.setSrcLocation(entity.getStart_point_code()); - cancelTaskRequest.setDestLocation(entity.getNext_point_code()); - // 1 入库,2 出库,3 移库,4 空托盘入库,5 空托盘出库 - int type = 0; - if (StrUtil.equals(task.getStorage_task_type(), "1")) { - type = 1; - } else if (StrUtil.equals(task.getStorage_task_type(), "2")) { - type = 4; - } else if (StrUtil.equals(task.getStorage_task_type(), "3")) { - type = 2; - } else if (StrUtil.equals(task.getStorage_task_type(), "4")) { - type = 5; - } else if (StrUtil.equals(task.getStorage_task_type(), "5")) { - type = 3; - } - cancelTaskRequest.setTaskType(type); - acsToLiKuService.cancelTask(cancelTaskRequest); - } +// if (StrUtil.equals(entity.getInstruction_type(), "7")) { +// CancelTaskRequest cancelTaskRequest = new CancelTaskRequest(); +// cancelTaskRequest.setOrderId(entity.getInstruction_code()); +// cancelTaskRequest.setPalletCode(entity.getVehicle_code()); +// cancelTaskRequest.setSrcLocation(entity.getStart_point_code()); +// cancelTaskRequest.setDestLocation(entity.getNext_point_code()); +// // 1 入库,2 出库,3 移库,4 空托盘入库,5 空托盘出库 +// int type = 0; +// if (StrUtil.equals(task.getStorage_task_type(), "1")) { +// type = 1; +// } else if (StrUtil.equals(task.getStorage_task_type(), "2")) { +// type = 4; +// } else if (StrUtil.equals(task.getStorage_task_type(), "3")) { +// type = 2; +// } else if (StrUtil.equals(task.getStorage_task_type(), "4")) { +// type = 5; +// } else if (StrUtil.equals(task.getStorage_task_type(), "5")) { +// type = 3; +// } +// cancelTaskRequest.setTaskType(type); +// acsToLiKuService.cancelTask(cancelTaskRequest); +// } String currentUsername = SecurityUtils.getCurrentUsername(); String now = DateUtil.now(); @@ -1635,84 +1633,85 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu @Override public boolean createLkInst(String type, Instruction dto) { - Class var3 = TaskInstructionLock.class; - synchronized (TaskInstructionLock.class) { - // 入库 - AcsToLiKuService acsToLiKuService = SpringContextHolder.getBean(AcsToLiKuService.class); - Resp resp = null; - if (StrUtil.equals(type, "1")) { - InStoreRequest request = new InStoreRequest(); - request.setFloorNo(Integer.parseInt(dto.getTo_z())); - request.setType(1); - request.setPalletCode(dto.getVehicle_code()); - request.setOrderId(dto.getInstruction_code()); - request.setSrcLocation(dto.getStart_point_code()); - request.setDestLocation(dto.getNext_point_code()); - resp = acsToLiKuService.inStore(request); - // 空托入库 - } else if (StrUtil.equals(type, "2")) { - InStoreRequest request = new InStoreRequest(); - request.setFloorNo(Integer.parseInt(dto.getTo_z())); - request.setType(2); - request.setPalletCode(dto.getVehicle_code()); - request.setOrderId(dto.getInstruction_code()); - request.setSrcLocation(dto.getStart_point_code()); - request.setDestLocation(dto.getNext_point_code()); - resp = acsToLiKuService.inStore(request); - // 出库 - } else if (StrUtil.equals(type, "3")) { - OutStoreRequest outStore = new OutStoreRequest(); - BaseStoreRequest baseReq = new BaseStoreRequest(); - List list = new ArrayList(); - baseReq.setOrderId(dto.getInstruction_code()); - baseReq.setSrcLocation(dto.getStart_point_code()); - baseReq.setDestLocation(dto.getNext_point_code()); - baseReq.setFloorNo(Integer.parseInt(dto.getFrom_z())); - baseReq.setPalletCode(dto.getVehicle_code()); - list.add(baseReq); - outStore.setOrderInfos(list); - outStore.setGroupId(dto.getInstruction_code()); - resp = acsToLiKuService.outStore(outStore); - // 空托出库 - } else if (StrUtil.equals(type, "4")) { - EmptyVehicleOutStoreRequest emptyVehicleOutStoreRequest = new EmptyVehicleOutStoreRequest(); - emptyVehicleOutStoreRequest.setOrderId(dto.getInstruction_code()); - emptyVehicleOutStoreRequest.setFloorNo(Integer.parseInt(dto.getFrom_z())); - emptyVehicleOutStoreRequest.setSrcLocation(dto.getStart_point_code()); - emptyVehicleOutStoreRequest.setDestLocation(dto.getNext_point_code()); - emptyVehicleOutStoreRequest.setPalletCode(dto.getVehicle_code()); - resp = acsToLiKuService.emptyVehicleOutStore(emptyVehicleOutStoreRequest); - // 转库 - } else if (StrUtil.equals(type, "5")) { - MoveStoreRequest moveStoreRequest = new MoveStoreRequest(); - BaseStoreRequest baseReq = new BaseStoreRequest(); - List list = new ArrayList(); - baseReq.setFloorNo(Integer.parseInt(dto.getFrom_z())); - baseReq.setPalletCode(dto.getVehicle_code()); - baseReq.setOrderId(dto.getInstruction_code()); - baseReq.setSrcLocation(dto.getStart_point_code()); - baseReq.setDestLocation(dto.getNext_point_code()); - list.add(baseReq); - moveStoreRequest.setGroupId(dto.getInstruction_code()); - moveStoreRequest.setOrderInfos(list); - resp = acsToLiKuService.moveStore(moveStoreRequest); - } - - if (ObjectUtil.isNotEmpty(resp)) { - if (StrUtil.equals(resp.getResult(), "true")) { - dto.setSend_status("1"); - } else { - dto.setSend_status("2"); - dto.setRemark(resp.getData().toString()); - return false; - } - } else { - dto.setSend_status("2"); - dto.setRemark("ERROR"); - return false; - } - return true; - } + return false; +// Class var3 = TaskInstructionLock.class; +// synchronized (TaskInstructionLock.class) { +// // 入库 +// AcsToLiKuService acsToLiKuService = SpringContextHolder.getBean(AcsToLiKuService.class); +// Resp resp = null; +// if (StrUtil.equals(type, "1")) { +// InStoreRequest request = new InStoreRequest(); +// request.setFloorNo(Integer.parseInt(dto.getTo_z())); +// request.setType(1); +// request.setPalletCode(dto.getVehicle_code()); +// request.setOrderId(dto.getInstruction_code()); +// request.setSrcLocation(dto.getStart_point_code()); +// request.setDestLocation(dto.getNext_point_code()); +// resp = acsToLiKuService.inStore(request); +// // 空托入库 +// } else if (StrUtil.equals(type, "2")) { +// InStoreRequest request = new InStoreRequest(); +// request.setFloorNo(Integer.parseInt(dto.getTo_z())); +// request.setType(2); +// request.setPalletCode(dto.getVehicle_code()); +// request.setOrderId(dto.getInstruction_code()); +// request.setSrcLocation(dto.getStart_point_code()); +// request.setDestLocation(dto.getNext_point_code()); +// resp = acsToLiKuService.inStore(request); +// // 出库 +// } else if (StrUtil.equals(type, "3")) { +// OutStoreRequest outStore = new OutStoreRequest(); +// BaseStoreRequest baseReq = new BaseStoreRequest(); +// List list = new ArrayList(); +// baseReq.setOrderId(dto.getInstruction_code()); +// baseReq.setSrcLocation(dto.getStart_point_code()); +// baseReq.setDestLocation(dto.getNext_point_code()); +// baseReq.setFloorNo(Integer.parseInt(dto.getFrom_z())); +// baseReq.setPalletCode(dto.getVehicle_code()); +// list.add(baseReq); +// outStore.setOrderInfos(list); +// outStore.setGroupId(dto.getInstruction_code()); +// resp = acsToLiKuService.outStore(outStore); +// // 空托出库 +// } else if (StrUtil.equals(type, "4")) { +// EmptyVehicleOutStoreRequest emptyVehicleOutStoreRequest = new EmptyVehicleOutStoreRequest(); +// emptyVehicleOutStoreRequest.setOrderId(dto.getInstruction_code()); +// emptyVehicleOutStoreRequest.setFloorNo(Integer.parseInt(dto.getFrom_z())); +// emptyVehicleOutStoreRequest.setSrcLocation(dto.getStart_point_code()); +// emptyVehicleOutStoreRequest.setDestLocation(dto.getNext_point_code()); +// emptyVehicleOutStoreRequest.setPalletCode(dto.getVehicle_code()); +// resp = acsToLiKuService.emptyVehicleOutStore(emptyVehicleOutStoreRequest); +// // 转库 +// } else if (StrUtil.equals(type, "5")) { +// MoveStoreRequest moveStoreRequest = new MoveStoreRequest(); +// BaseStoreRequest baseReq = new BaseStoreRequest(); +// List list = new ArrayList(); +// baseReq.setFloorNo(Integer.parseInt(dto.getFrom_z())); +// baseReq.setPalletCode(dto.getVehicle_code()); +// baseReq.setOrderId(dto.getInstruction_code()); +// baseReq.setSrcLocation(dto.getStart_point_code()); +// baseReq.setDestLocation(dto.getNext_point_code()); +// list.add(baseReq); +// moveStoreRequest.setGroupId(dto.getInstruction_code()); +// moveStoreRequest.setOrderInfos(list); +// resp = acsToLiKuService.moveStore(moveStoreRequest); +// } +// +// if (ObjectUtil.isNotEmpty(resp)) { +// if (StrUtil.equals(resp.getResult(), "true")) { +// dto.setSend_status("1"); +// } else { +// dto.setSend_status("2"); +// dto.setRemark(resp.getData().toString()); +// return false; +// } +// } else { +// dto.setSend_status("2"); +// dto.setRemark("ERROR"); +// return false; +// } +// return true; +// } } /* diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java b/wcs/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java index 6d5c6641..f45fd129 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java +++ b/wcs/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java @@ -10,9 +10,9 @@ import org.nl.acs.device.service.DeviceExtraService; import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_cleaning_machine_storage_station.HailiangCleaningMachineStorageStationDeviceDriver; import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_engraving_machine.HailiangEngravingMachineDeviceDriver; import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_packer_station.HailiangPackerStationDeviceDriver; -import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_smart_plc_test.HailiangSmartplcTestDeviceDriver; import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_special_device.HailiangSpecialDeviceDriver; import org.nl.acs.device_driver.basedriver.hailiang_one.hailiang_stacking_station.HailiangStackingStationDriver; +import org.nl.acs.device_driver.basedriver.hailiang_smart_plc_test.HailiangSmartplcTestDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.opc.Device; import org.nl.acs.order.service.ProduceshiftorderService; diff --git a/wcs/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryLKDeviceStatus.java b/wcs/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryLKDeviceStatus.java index 98b5a5f8..edbce2a6 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryLKDeviceStatus.java +++ b/wcs/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryLKDeviceStatus.java @@ -1,3 +1,4 @@ +/* package org.nl.modules.quartz.task; import cn.hutool.core.map.MapUtil; @@ -20,9 +21,11 @@ import org.springframework.stereotype.Component; import java.util.List; +*/ /** * 查询立库设备状态 - */ + *//* + @Slf4j @Component public class QueryLKDeviceStatus { @@ -42,3 +45,4 @@ public class QueryLKDeviceStatus { } } +*/ diff --git a/wcs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/ParamServiceImpl.java b/wcs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/ParamServiceImpl.java index 25d05225..47dc5a9f 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/ParamServiceImpl.java +++ b/wcs/nladmin-system/src/main/java/org/nl/modules/system/service/impl/ParamServiceImpl.java @@ -5,6 +5,7 @@ package org.nl.modules.system.service.impl; import cn.dev33.satoken.stp.StpUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; @@ -59,7 +60,8 @@ public class ParamServiceImpl implements ParamService { public ParamDto findById(String id) { WQLObject wo = WQLObject.getWQLObject("sys_param"); JSONObject json = wo.query("id ='" + id + "'").uniqueResult(0); - final ParamDto obj = json.toJavaObject(ParamDto.class);; + final ParamDto obj = json.toJavaObject(ParamDto.class); + ; return obj; } @@ -67,7 +69,11 @@ public class ParamServiceImpl implements ParamService { public ParamDto findByCode(String code) { WQLObject wo = WQLObject.getWQLObject("sys_param"); JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0); - final ParamDto obj = json.toJavaObject(ParamDto.class);; + if (ObjectUtil.isEmpty(json)) { + return null; + } + final ParamDto obj = json.toJavaObject(ParamDto.class); + ; return obj; } @@ -88,7 +94,7 @@ public class ParamServiceImpl implements ParamService { dto.setCreate_time(now); WQLObject wo = WQLObject.getWQLObject("sys_param"); - JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto)); + JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(dto)); wo.insert(json); } @@ -105,7 +111,7 @@ public class ParamServiceImpl implements ParamService { dto.setUpdate_optname(SecurityUtils.getCurrentNickName()); WQLObject wo = WQLObject.getWQLObject("sys_param"); - JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto)); + JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(dto)); wo.update(json); } diff --git a/wcs/nladmin-system/src/main/resources/config/application-dev.yml b/wcs/nladmin-system/src/main/resources/config/application-dev.yml index a1f56261..82867e69 100644 --- a/wcs/nladmin-system/src/main/resources/config/application-dev.yml +++ b/wcs/nladmin-system/src/main/resources/config/application-dev.yml @@ -13,11 +13,11 @@ spring: driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy # url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true # url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:lzhl_one_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true - url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_one_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true + url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:hl_acs_one_test}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true username: ${DB_USER:root} # password: ${DB_PWD:P@ssw0rd} # password: ${DB_PWD:Root.123456} - password: ${DB_PWD:123456} + password: ${DB_PWD:password} # 初始连接数 initial-size: 5