diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/autotask/CleanDeviceErrorLog.java b/acs/nladmin-system/src/main/java/org/nl/acs/autotask/CleanDeviceErrorLog.java new file mode 100644 index 000000000..1dbc5041c --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/autotask/CleanDeviceErrorLog.java @@ -0,0 +1,36 @@ +package org.nl.acs.autotask; + +/** + * @Author : TuQiang + * @create 2024/5/27 9:45 + */ + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.AcsConfig; +import org.nl.modules.system.service.ParamService; +import org.nl.modules.wql.core.bean.WQLObject; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; + +/** + * 自动清除日志(设备故障)数据 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class CleanDeviceErrorLog { + + private final ParamService paramService; + + public void run() { + //delete from acs_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10; + log.info("开始打印日志"); + int days = Integer.parseInt(paramService.findByCode(AcsConfig.AutoCleanDays).getValue()); + WQLObject logTab = WQLObject.getWQLObject("acs_device_error_log"); + logTab.delete("DATE(error_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))"); + log.info("自动清理日志执行成功...!"); + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java index 5c019438c..9e0081c25 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java @@ -173,12 +173,16 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple logServer.deviceExecuteLog(this.device_code, "", "", "信号door:" + last_door + "->" + door); } if (mode != last_mode) { - //this.setRequireSucess(false); + logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + mode + "->" + last_mode); + } + if(action != last_action){ + logServer.deviceExecuteLog(this.device_code, "", "", "信号action:" + action + "->" + last_action); } if (move != last_move) { if (move == 0) { thingToNothing(); } + logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + mode + "->" + last_mode); } if (error != last_error) { if (error != 0) { @@ -188,6 +192,10 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple dto.setError_info(ErrorUtil.getDictDetail("hx_error_type", String.valueOf(error))); deviceErrorLogService.create(dto); } + logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + error + "->" + last_error); + } + if (error1 != last_error1) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号error1:" + error1 + "->" + last_error1); } if (finish != last_finish) { if (finish == 1) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java index 10f237fb4..d94524c3e 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java @@ -55,6 +55,15 @@ public interface NDCAgvService { */ public byte[] sendAgvTwoModeInst(int phase, int index, int result); + /** + * 下发agv偏移指令 + * @param phase + * @param index + * @param result + * @return + */ + public byte[] sendAgvTwoModeInst(int phase, int index, int result,int offset,int quantity); + /** * 下发一号agv指令 * @param phase diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index 59f633ce6..a28a12359 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java @@ -336,6 +336,40 @@ public class NDCAgvServiceImpl implements NDCAgvService { return b; } + @Override + public byte[] sendAgvTwoModeInst(int phase, int index, int result,int offset,int quantity) { + if (phase < 0 || index < 0) + return null; + byte indexhigh = (byte) IntToHexHigh(index); + byte indexlow = (byte) IntToHexLow(index); + byte phasehigh = (byte) IntToHexHigh(phase); + byte phaselow = (byte) IntToHexLow(phase); + byte offsethigh = (byte) IntToHexHigh(offset); + byte offsetlow = (byte) IntToHexLow(offset); + byte quantityhigh = (byte) IntToHexHigh(quantity); + byte quantitylow = (byte) IntToHexLow(quantity); + + byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, + (byte) 0X00, (byte) 0X08, + (byte) 0X00, (byte) 0X0E, + (byte) 0X00, (byte) 0X01, + (byte) 0X00, (byte) 0X6D, + (byte) 0X00, (byte) 0X0A, + (byte) indexhigh, (byte) indexlow, + (byte) 0X01, (byte) 0X12, + (byte) phasehigh, (byte) phaselow, + (byte) offsethigh, (byte) offsetlow, + (byte) quantityhigh, (byte) quantitylow + }; + + + log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF)+",是否侧移: "+(offset == 1?"侧移":"不测移") + ",偏离量: " + quantity); + + System.out.println("反馈agv动作数据:" + Bytes2HexString(b)); + return b; + } + @Override public byte[] sendAgvOneModeInst(int phase, int index, int result) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java index bbbb8ea35..426488d94 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.agv.ndctwo; +import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; @@ -21,6 +22,7 @@ import org.nl.acs.device_driver.storage.standard_storage.StandardStorageDeviceDr import org.nl.acs.device_driver.driver.AbstractDeviceDriver; import org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.HongXiangStationDeviceDriver; import org.nl.acs.device_driver.two_conveyor.manipulator_agv_station.ManipulatorAgvStationDeviceDriver; +import org.nl.acs.device_driver.two_conveyor.ranging_stations.RangingStationsDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.history.ErrorUtil; @@ -162,6 +164,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic HongXiangStationDeviceDriver hongXiangStationDeviceDriver; //行架-agv对接位 ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver; + //行架-agv对接位 + RangingStationsDeviceDriver rangingStationsDeviceDriver; if (phase == 0x02) { if (ObjectUtil.isEmpty(inst)) { @@ -236,15 +240,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey; logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey); } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } - }else { + } else { log.info("等待LMS系统进行确认允许取货,设备号{},指令号{}", device_code, ikey); message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey; logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey); } - }else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); @@ -256,7 +260,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction() @@ -271,7 +275,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); @@ -284,7 +288,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (hongXiangStationDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() @@ -298,14 +302,27 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (paperTubePickSiteDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() , paperTubePickSiteDeviceDriver.getError(), ikey); } + } else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { + rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver(); + String length1 = rangingStationsDeviceDriver.getLength1(); + Float len = 0.0F; + if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1)) { + len = Float.parseFloat(length1); + } + int roundedNumber = ObjectUtil.isNotEmpty(len) ? NumberUtil.round(len, 0).intValue() : 0; + if (roundedNumber == 0) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); + } } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content("agvphase:" + phase + "反馈:" + data) @@ -371,9 +388,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic && StrUtil.equals("true", this.device.getExtraValue().get("wait").toString()) && StrUtil.equals(task.getTask_type(), "1")) { standardOrdinarySiteDeviceDriver.setOption(0); - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - }else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } this.setPhase(phase); } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { @@ -385,7 +402,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); @@ -398,7 +415,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (hongXiangStationDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() @@ -412,7 +429,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (paperTubePickSiteDeviceDriver.getMove() == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() @@ -427,14 +444,14 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if ((standardInspectSiteDeviceDriver.getMove() != 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction() , standardInspectSiteDeviceDriver.getError(), ikey); } } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content("agvphase:" + phase + "反馈:" + data) @@ -501,15 +518,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey; logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey); } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } } else { log.info("等待LMS系统进行确认允许取货,设备号{},指令号{}", device_code, ikey); message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey; logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code()); } - }else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); @@ -520,7 +537,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); @@ -533,7 +550,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (paperTubePickSiteDeviceDriver.getMove() == 1) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() @@ -547,7 +564,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (hongXiangStationDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() @@ -562,14 +579,27 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction() , standardInspectSiteDeviceDriver.getError(), ikey); } + } else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { + rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver(); + String length1 = rangingStationsDeviceDriver.getLength1(); + Float len = 0.0F; + if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1)) { + len = Float.parseFloat(length1); + } + int roundedNumber = ObjectUtil.isNotEmpty(len) ? NumberUtil.round(len, 0).intValue() : 0; + if (roundedNumber == 0) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); + } } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content("agvphase:" + phase + "反馈:" + data) @@ -625,7 +655,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())) { standardOrdinarySiteDeviceDriver.setOption(0); - }else { + } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); @@ -771,7 +801,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); standardOrdinarySiteDeviceDriver.setAgvphase(phase); standardOrdinarySiteDeviceDriver.setIndex(index); @@ -785,7 +815,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (paperTubePickSiteDeviceDriver.getMove() == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() @@ -800,7 +830,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); @@ -813,7 +843,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (hongXiangStationDeviceDriver.getMove() == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() @@ -823,14 +853,27 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); standardInspectSiteDeviceDriver.writing(1); if ((standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足放货条件"; log.info("设备{}当前光电信号{},动作信号{} ,报警信号{},不满足放货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction() , standardInspectSiteDeviceDriver.getError(), ikey); } + } else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { + rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver(); + String length1 = rangingStationsDeviceDriver.getLength1(); + Float len = 0.0F; + if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1)) { + len = Float.parseFloat(length1); + } + int roundedNumber = ObjectUtil.isNotEmpty(len) ? NumberUtil.round(len, 0).intValue() : 0; + if (roundedNumber == 0) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); + } } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } } //放货完成 @@ -888,7 +931,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic // } else { // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); // } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); this.setPhase(phase); } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); @@ -899,7 +942,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); @@ -912,7 +955,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (hongXiangStationDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() @@ -926,7 +969,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (paperTubePickSiteDeviceDriver.getMove() > 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() @@ -936,10 +979,10 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); standardInspectSiteDeviceDriver.writing(0); if ((standardInspectSiteDeviceDriver.getMove() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } } //到达放货点 @@ -999,7 +1042,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic // } else { // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); // } - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); this.setPhase(phase); } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { @@ -1011,7 +1054,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if ((manipulatorAgvStationDeviceDriver.getAction() == 1)) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + ",动作信号:" + manipulatorAgvStationDeviceDriver.getAction() + "报警信号:" + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{},动作信号{} ,不满足取货条件,指令号{}", device_code, manipulatorAgvStationDeviceDriver.getAction(), ikey); @@ -1024,7 +1067,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (hongXiangStationDeviceDriver.getMove() == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction() @@ -1038,14 +1081,27 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic e.printStackTrace(); } if (paperTubePickSiteDeviceDriver.getMove() == 0) { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } else { message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction() , paperTubePickSiteDeviceDriver.getError(), ikey); } + } else if (device.getDeviceDriver() instanceof RangingStationsDeviceDriver) { + rangingStationsDeviceDriver = (RangingStationsDeviceDriver) device.getDeviceDriver(); + String length1 = rangingStationsDeviceDriver.getLength1(); + Float len = 0.0F; + if (ObjectUtil.isNotEmpty(length1) && !"null".equals(length1)) { + len = Float.parseFloat(length1); + } + int roundedNumber = ObjectUtil.isNotEmpty(len) ? NumberUtil.round(len, 0).intValue() : 0; + if (roundedNumber == 0) { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, roundedNumber); + } else { + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 1, roundedNumber); + } } else { - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); } } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java index eee7ab0a3..9ceca415d 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/BeltConveyorDeviceDriver.java @@ -170,6 +170,9 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements int to_container_type = 0; int last_to_container_type = 0; + int to_height_level = 0; + int last_to_height_level = 0; + String barcode = null; @@ -239,6 +242,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements to_container_no = this.itemProtocol.getContainer_direction(); + if (mode != last_mode) { requireSucess = false; if(mode == 2){ @@ -314,12 +318,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements //申请AGV任务 if (move == 1 && !requireSucess) { applyAgvTask(); - List list1 = new ArrayList(); - Map map = new HashMap(); - map.put("code", "mode"); - map.put("value", 5); - list1.add(map); - this.writing(list1); + } break; @@ -413,6 +412,12 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements } else { if (jo.getInteger("status") == 200) { message = "one_message16"; + List list1 = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_command"); + map.put("value", 8); + list1.add(map); + this.writing(list1); List list = new ArrayList(); while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".to_command").toString() , "8")) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/ItemProtocol.java index f5f7081c4..5ac2e1bc5 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/ItemProtocol.java @@ -66,6 +66,8 @@ public class ItemProtocol { + + private BeltConveyorDeviceDriver driver; public ItemProtocol(BeltConveyorDeviceDriver driver) { @@ -124,7 +126,6 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_to_container_type); } - Boolean isonline; public int getOpcIntegerValue(String protocol) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_inspect_site/StandardInspectSiteDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_inspect_site/StandardInspectSiteDeviceDriver.java index a94354146..3e0932572 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_inspect_site/StandardInspectSiteDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_inspect_site/StandardInspectSiteDeviceDriver.java @@ -30,7 +30,10 @@ import org.nl.acs.utils.ConvertUtil; import org.nl.common.utils.CodeUtil; import org.nl.config.SpringContextHolder; import org.nl.config.language.LangProcess; +import org.nl.config.lucene.service.LuceneExecuteLogService; +import org.nl.config.lucene.service.dto.LuceneLogDto; import org.openscada.opc.lib.da.Server; +import org.springframework.beans.factory.annotation.Autowired; import java.util.Date; import java.util.HashMap; @@ -57,6 +60,9 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp TaskMapper taskMapper; AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); + @Autowired + LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class); + String container; String container_type_desc; @@ -330,13 +336,19 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp public void writing(int command) { String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_command; - - //String opcservcerid = this.getDevice().getOpc_server_id(); -//Server server = ReadUtil.getServer(opcservcerid); Map itemMap = new HashMap(); itemMap.put(to_command, command); - this.control(itemMap); - + try { + this.checkcontrol(itemMap); + } catch (Exception e) { + e.printStackTrace(); + } + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(devicecode) + .content("下发多个电气信号" + itemMap) + .build(); + logDto.setLog_level(3); + luceneExecuteLogService.deviceExecuteLog(logDto); } public void writing(int type, int command) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java index 9774bbaf5..c11987f97 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/BoxStorageOutConveyorDeviceDriver.java @@ -93,8 +93,8 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i int move = 0; int last_move = 0; //托盘方向 - int carrier_direction = 0; - int last_carrier_direction = 0; + int container_direction = 0; + int last_container_direction = 0; //报警信号 int error = 0; int last_error = 0; @@ -179,7 +179,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i device_code = this.getDeviceCode(); mode = this.itemProtocol.getMode(); move = this.itemProtocol.getMove(); - carrier_direction = this.itemProtocol.getCarrier_direction(); + container_direction = this.itemProtocol.getContainer_direction(); error = this.itemProtocol.getError(); task = this.itemProtocol.getTask(); to_command = this.itemProtocol.getTo_command(); @@ -264,7 +264,6 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i } last_mode = mode; last_move = move; - last_carrier_direction = carrier_direction; last_error = error; last_task = task; last_heartbeat = heartbeat; @@ -619,9 +618,9 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i map.put("hasGoods", true); } - if (this.carrier_direction == 1) { + if (this.container_direction == 1) { carrier_direction = LangProcess.msg("universal_forward_rotation"); - } else if (this.carrier_direction == 2) { + } else if (this.container_direction == 2) { carrier_direction = LangProcess.msg("universal_rollback"); } String requireSucess = LangProcess.msg("universal_actionMessage4"); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/ItemProtocol.java index 432f2ba4c..bfe9f3e32 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/ItemProtocol.java @@ -27,7 +27,7 @@ public class ItemProtocol { /** * 托盘方向 */ - public static String item_carrier_direction = "carrier_direction"; + public static String item_container_direction = "container_direction"; /** * 载具类型 @@ -99,8 +99,8 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_move); } - public int getCarrier_direction() { - return this.getOpcIntegerValue(item_carrier_direction); + public int getContainer_direction() { + return this.getOpcIntegerValue(item_container_direction); } public int getError() { @@ -160,7 +160,7 @@ public class ItemProtocol { list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0")); list.add(new ItemDto(item_mode, "工作模式", "DB600.B2")); list.add(new ItemDto(item_move, "光电信号", "DB600.B3")); - list.add(new ItemDto(item_carrier_direction, "托盘方向", "DB600.B4")); + list.add(new ItemDto(item_container_direction, "托盘方向", "DB600.B4")); list.add(new ItemDto(item_action, "动作信号", "DB600.B5")); list.add(new ItemDto(item_error, "报警信号", "DB600.B6")); list.add(new ItemDto(item_container_type, "托盘类型", "DB101.B7")); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java index f407a5dd1..c4f42624d 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/FinishedProductOutBindLableDeviceDriver.java @@ -330,6 +330,12 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr param.put("device_code", device_code); param.put("vehicle_code", inst.getVehicle_code()); param.put("type", AcsToLmsApplyTaskTypeEnum.LABEL_BIND.getType()); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("申请捆扎,请求参数:" + param) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); String response = acsToWmsService.deviceApplyTwo(param); JSONObject jo = JSON.parseObject(response); if (StrUtil.isNotEmpty(jo.getString("body")) || jo.getInteger("status") == 200) { @@ -420,8 +426,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr String bindingTemplate = jo.get("bindingTemplate").toString(); String printDevice = jo.get("printDevice").toString(); String bundleTimes = jo.get("bundleTimes").toString(); - String case1 = jo.get("case").toString(); - String direction = jo.get("direction").toString(); + List list = new ArrayList(); if (mode == 10 || mode == 16) { @@ -529,21 +534,15 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr map12.put("code", "to_labeling_template"); map12.put("value", labelingTemplate); - Map map13 = new HashMap(); - map13.put("code", "to_length"); - map13.put("value", length); - list.add(map13); - Map map14 = new HashMap(); - map14.put("code", "to_width"); - map14.put("value", width); - list.add(map14); - Map map15 = new HashMap(); - map15.put("code", "to_height"); - map15.put("value", height); - list.add(map15); + Map map11 = new HashMap(); + map11.put("code", "to_binding_times"); + map11.put("value", bundleTimes); + list.add(map11); } if(mode == 17){ + String case1 = jo.get("case").toString(); + String direction = jo.get("direction").toString(); Map map = new HashMap(); map.put("code", "to_length"); map.put("value", length); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java index cac9dadcd..bc68e450b 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java @@ -118,6 +118,9 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv int to_container_type = 0; int last_to_container_type = 0; + int to_height_level = 0; + int last_to_height_level = 0; + //托盘类型 int container_type = 0; int last_container_type = 0; @@ -224,6 +227,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv weight = this.itemProtocol.getWeight(); barcode = this.itemProtocol.getBarcode(); material_barcode = this.itemProtocol.getMaterialBarcode(); + to_height_level = this.itemProtocol.getTo_height_level(); if (mode != last_mode) { JSONObject param = new JSONObject(); @@ -236,6 +240,8 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode); } + + if(move !=last_move){ if (ObjectUtil.isNotEmpty(inst)){ if (move==0){ @@ -305,6 +311,10 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (mode == 18 && move == 1 && !requireSucess){ applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode); + } + if (mode == 23 && !requireSucess){ + applyErrorHeight(); + } //申请入库指令、异常位指令 @@ -355,6 +365,60 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv last_barcode = barcode; } + private void applyErrorHeight() { + Date date = new Date(); + if (date.getTime() - this.require_apply_strangulation_time.getTime() + < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; + } else { + try { + JSONObject param = new JSONObject(); + param.put("device_code", device_code); + param.put("vehicle_code", barcode); + param.put("material_barcode", material_barcode); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(device_code) + .content("申请高度等级,参数:" + param) + .build(); + logDto.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto); + String response = acsToWmsService.getBoxInfo(param); + JSONObject jo = JSON.parseObject(response); + if (jo.getInteger("status") == 200) { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(device_code) + .content("申请高度等级,参数,接口返回:" + jo) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + String heightLevel = jo.getString("heightLevel"); + List list1 = new ArrayList(); + Map map = new HashMap(); + map.put("code", "to_height_level"); + map.put("value", heightLevel); + list1.add(map); + this.writing(list1); + List list2 = new ArrayList(); + Map map2 = new HashMap(); + map2.put("code", "to_command"); + map2.put("value", 23); + list2.add(map2); + this.writing(list2); + }else { + LuceneLogDto logDto2 = LuceneLogDto.builder() + .device_code(device_code) + .content("申请高度等级,返回参数:" + jo.getString("body")) + .build(); + logDto2.setLog_level(4); + luceneExecuteLogService.deviceExecuteLog(logDto2); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + private void applyBoxReturnTask(String type, int mode) { Date date = new Date(); if (date.getTime() - this.require_apply_strangulation_time.getTime() diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ItemProtocol.java index 0659db260..7f8d32e29 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ItemProtocol.java @@ -79,6 +79,11 @@ public class ItemProtocol { */ public static String item_to_container_type = "to_container_type"; + /** + * 下发高度等级 + */ + public static String item_to_height_level = "to_height_level"; + private ConveyorWithScannerWeightDeviceDriver driver; public ItemProtocol(ConveyorWithScannerWeightDeviceDriver driver){ @@ -147,7 +152,9 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_to_container_type); } - + public int getTo_height_level(){ + return this.getOpcIntegerValue(item_to_height_level); + } Boolean isonline; @@ -210,6 +217,7 @@ public class ItemProtocol { list.add(new ItemDto(item_to_target, "下发目标站", "DB2.W4")); list.add(new ItemDto(item_to_task, "下发任务号", "DB2.D6")); list.add(new ItemDto(item_to_container_type, "下发托盘类型", "DB2.W8")); + list.add(new ItemDto(item_to_height_level, "下发高度等级", "DB2.W10")); return list; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/ItemProtocol.java index f1b52df4a..909d2492e 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/ItemProtocol.java @@ -27,7 +27,7 @@ public class ItemProtocol { /** * 托盘方向 */ - public static String item_carrier_direction = "carrier_direction"; + public static String item_container_direction = "container_direction"; /** * 物料条码 @@ -139,7 +139,7 @@ public class ItemProtocol { } public int getCarrier_direction() { - return this.getOpcIntegerValue(item_carrier_direction); + return this.getOpcIntegerValue(item_container_direction); } public int getError() { @@ -197,7 +197,7 @@ public class ItemProtocol { list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0")); list.add(new ItemDto(item_mode, "工作模式", "DB600.B2")); list.add(new ItemDto(item_move, "光电信号", "DB600.B3")); - list.add(new ItemDto(item_carrier_direction, "托盘方向", "DB600.B4")); + list.add(new ItemDto(item_container_direction, "托盘方向", "DB600.B4")); list.add(new ItemDto(item_action, "动作信号", "DB600.B5")); list.add(new ItemDto(item_error, "报警信号", "DB600.B6")); list.add(new ItemDto(item_container_type, "托盘类型", "DB101.B7")); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java index 4dee22a8a..d59c58581 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java @@ -16,7 +16,6 @@ import org.nl.acs.device.service.impl.DeviceExtraServiceImpl; import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; -import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver; @@ -179,9 +178,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i to_onset = this.itemProtocol.getTo_onset(); x = this.itemProtocol.getX(); y = this.itemProtocol.getY(); - to_seq = this.itemProtocol.getTo_seq(); to_max_no = this.itemProtocol.getTo_max_no(); - to_direction = this.itemProtocol.getTo_direction(); to_last = this.itemProtocol.getTo_last(); to_len = this.itemProtocol.getTo_len(); @@ -369,8 +366,9 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i Map map8 = new HashMap<>(); Map map9 = new HashMap<>(); Map map10 = new HashMap<>(); + Map map11 = new HashMap<>(); try { - pushPLC(map1, map2, next_addr, map3, start_addr, map4, instruction.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8,map9,map10); + pushPLC(map1, map2, next_addr, map3, start_addr, map4, instruction.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8,map9,map10,map11); } catch (Exception e) { logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:" @@ -453,8 +451,9 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i Map map8 = new HashMap<>(); Map map9 = new HashMap<>(); Map map10 = new HashMap<>(); + Map map11 = new HashMap<>(); try { - pushPLC(map1, map2, next_addr, map3, start_addr, map4, instdto.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8,map9,map10); + pushPLC(map1, map2, next_addr, map3, start_addr, map4, instdto.getInstruction_code(), interactionJsonDTO, map5, map6, map7, map8,map9,map10, map11); } catch (Exception e) { LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) @@ -475,7 +474,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } - private void pushPLC(Map map1, Map map2, String next_addr, Map map3, String start_addr, Map map4, String task, InteractionJsonDTO interactionJsonDTO, Map map5, Map map6, Map map7, Map map8,Map map9,Map map10) { + private void pushPLC(Map map1, Map map2, String next_addr, Map map3, String start_addr, Map map4, String task, InteractionJsonDTO interactionJsonDTO, Map map5, Map map6, Map map7, Map map8,Map map9,Map map10,Map map11) { List list = new ArrayList(); map1.put("code", "to_command"); map1.put("value", 1); @@ -517,6 +516,11 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i map10.put("value", interactionJsonDTO.getLen()); list.add(map10); } + if (ObjectUtil.isNotEmpty(interactionJsonDTO.getHeightLevel())) { + map11.put("code", "to_height_level"); + map11.put("value", interactionJsonDTO.getHeightLevel()); + list.add(map11); + } } this.writing(list); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/InteractionJsonDTO.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/InteractionJsonDTO.java index 5f0622542..3822916f1 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/InteractionJsonDTO.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/InteractionJsonDTO.java @@ -36,4 +36,9 @@ public class InteractionJsonDTO { * 托盘类型 */ private String containerType; + + /** + * 高度等级 + */ + private String heightLevel; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/ItemProtocol.java index 4764e03de..b4c2891f0 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/ItemProtocol.java @@ -83,15 +83,9 @@ public class ItemProtocol { */ public static String item_to_max_no = "to_max_no"; - /** - * 子卷摆放方向 - */ - public static String item_to_direction = "to_direction"; - /** - * 下发木箱工位顺序 - */ - public static String item_to_seq = "to_seq"; + + /** * 下发是否最后子卷 */ @@ -165,15 +159,10 @@ public class ItemProtocol { return this.getOpcFloatValue(item_y); } - public int getTo_seq(){ - return this.getOpcIntegerValue(item_to_seq); - } + public int getTo_max_no(){ return this.getOpcIntegerValue(item_to_max_no); } - public int getTo_direction(){ - return this.getOpcIntegerValue(item_to_direction); - } public int getTo_last(){ return this.getOpcIntegerValue(item_to_last_one); @@ -249,8 +238,6 @@ public class ItemProtocol { list.add(new ItemDto(item_to_target, "下发目标站", "DB2.W4")); list.add(new ItemDto(item_to_task, "下发任务号", "DB2.D6")); list.add(new ItemDto(item_to_max_no, "木箱最大数量", "DB2.D8")); - list.add(new ItemDto(item_to_direction, "子卷摆放方向", "DB2.D10")); - list.add(new ItemDto(item_to_seq, "下发木箱工位顺序", "DB2.W12")); list.add(new ItemDto(item_to_last_one, "下发是否最后子卷", "DB2.W14")); list.add(new ItemDto(item_to_len, "下发子卷长度", "DB2.W16")); list.add(new ItemDto(item_to_barcode, "下发木箱条码", "DB601.STRING1.50")); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java index 6d1193161..4a51e3b4a 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java @@ -473,6 +473,12 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i map10.put("value", interactionJsonDTO.getContainerType()); list.add(map10); } + if (ObjectUtil.isNotEmpty(interactionJsonDTO.getHeightLevel())) { + Map map11 = new HashMap<>(); + map11.put("code", "to_height_level"); + map11.put("value", interactionJsonDTO.getHeightLevel()); + list.add(map11); + } } this.writing(list); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/InteractionJsonDTO.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/InteractionJsonDTO.java index 2bd53e5cf..3804a9cd7 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/InteractionJsonDTO.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/InteractionJsonDTO.java @@ -33,6 +33,11 @@ public class InteractionJsonDTO { */ private String containerType; + /** + * 高度等级 + */ + private String heightLevel; + /** * 是否拔轴 */ diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/ItemProtocol.java index 8f3d8a53b..ed75bc350 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/ItemProtocol.java @@ -96,6 +96,13 @@ public class ItemProtocol { */ public static String item_to_layer = "to_layer"; + /** + *下发高度等级 + */ + public static String item_to_height_level = "to_height_level"; + + + private BoxStorageManipulatorDeviceDriver driver; @@ -230,6 +237,7 @@ public class ItemProtocol { list.add(new ItemDto(item_to_height, "木箱高度", "DB601.W18")); list.add(new ItemDto(item_to_barcode, "下发木箱条码", "DB601.STRING1.50")); list.add(new ItemDto(item_to_layer, "下发木箱层数", "DB601.W22")); + list.add(new ItemDto(item_to_height_level, "下发高度等级", "DB601.W24")); return list; } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/InteractionJsonDTO.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/InteractionJsonDTO.java index 4cac17f62..4ec9266a1 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/InteractionJsonDTO.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/InteractionJsonDTO.java @@ -28,4 +28,9 @@ public class InteractionJsonDTO { */ private String containerType; + /** + * 高度等级 + */ + private String heightLevel; + } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java index 3ace89feb..991d531e0 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ReturnGoodManipulatorDeviceDriver.java @@ -483,6 +483,12 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i map9.put("value", interactionJsonDTO.getContainerType()); list.add(map9); } + if (ObjectUtil.isNotEmpty(interactionJsonDTO.getHeightLevel())) { + Map map11 = new HashMap<>(); + map11.put("code", "to_height_level"); + map11.put("value", interactionJsonDTO.getHeightLevel()); + list.add(map11); + } } this.writing(list); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/ItemProtocol.java index 64a662e07..95d2147f3 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/ItemProtocol.java @@ -52,10 +52,7 @@ public class ItemProtocol { public static String item_y = "y"; - /** - * 下发托盘类型 - */ - public static String item_to_container_type = "to_container_type"; + /** @@ -220,7 +217,6 @@ public class ItemProtocol { list.add(new ItemDto(item_to_target, "下发目标站", "DB2.W4")); list.add(new ItemDto(item_to_task, "下发任务号", "DB2.D6")); list.add(new ItemDto(item_to_onset, "下发起始站", "DB2.W2")); - list.add(new ItemDto(item_to_container_type, "下发托盘类型", "DB102.B8")); list.add(new ItemDto(item_to_length, "木箱长度", "DB601.W10")); list.add(new ItemDto(item_to_width, "木箱宽度", "DB601.W12")); list.add(new ItemDto(item_to_height, "木箱高度", "DB601.W14")); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java index e8f84b53e..3bb2192c3 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/TrappedManipulatorManipulatorDeviceDriver.java @@ -393,7 +393,6 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice try { instructionService.create(instdto); } catch (Exception e) { - notCreateInstMessage = e.getMessage(); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(device_code) .content(device_code+"创建指令时出现异常:" + e.getMessage()) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/RgvDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/RgvDeviceDriver.java index c7f5fc870..0b360c6cb 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/RgvDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/rgv/RgvDeviceDriver.java @@ -207,15 +207,15 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr if (mode == 4 && move == 1 && !requireSucess) { applyTask(); } else { - if (mode == 2) { + if (mode == 4) { //if (!requireSucess) { String remark = ""; ; if (mode != 2) { remark = "universal_remark2"; } - if (move != 0) { - remark = "universal_remark3"; + if (move != 1) { + remark = "universal_no"; } if (task != 0) { remark = LangProcess.msg("universal_remark4"); @@ -226,7 +226,7 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr if (requireSucess) { remark = LangProcess.msg("universal_remark5"); } - this.setNotCreateTaskMessage(remark); + this.setFeedMessage(remark); //} } } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/ItemProtocol.java index 2a8699e3d..e40088514 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/ItemProtocol.java @@ -88,10 +88,7 @@ public class ItemProtocol { */ public static String item_forkCargo = "forkCargo"; - /** - * 货叉位置信号 - */ - public static String item_forkLocation = "forkLocation"; + /** @@ -102,10 +99,7 @@ public class ItemProtocol { * 特殊开关量2 */ public static String item_special2 = "special2"; - /** - * 托盘条码 - */ - public static String item_trayCode = "trayCode"; + /** * 水箱和消防缓存位有无货 */ @@ -235,9 +229,6 @@ public class ItemProtocol { return this.getOpcFloatValue(item_forkCargo); } - public float getItem_forkLocation() { - return this.getOpcFloatValue(item_forkLocation); - } @@ -249,9 +240,6 @@ public class ItemProtocol { return this.getOpcFloatValue(item_special2); } - public int[] getItem_trayCode() { - return this.getOpcIntegerArrayValue(item_trayCode); - } public float getItem_storage_cache() { return this.getOpcFloatValue(item_storage_cache); @@ -350,10 +338,8 @@ public class ItemProtocol { list.add(new ItemDto(item_distancey, "起升激光数值", "DB101.D44")); list.add(new ItemDto(item_cargoError, "载货台超限信号", "DB101.B43")); list.add(new ItemDto(item_forkCargo, "货叉探货信号", "DB101.B48")); - list.add(new ItemDto(item_forkLocation, "货叉位置信号", "DB101.B49")); list.add(new ItemDto(item_special1, "特殊开关量1", "DB101.B10")); list.add(new ItemDto(item_special2, "特殊开关量2", "DB101.B11")); - list.add(new ItemDto(item_trayCode, "托盘条码", "DB101.B30.20")); list.add(new ItemDto(item_storage_cache, "水箱和消防缓存位有无货", "DB101.B50")); list.add(new ItemDto(item_stacker_rpm, "速度(转/分钟)", "DB101.W52")); list.add(new ItemDto(item_stacker_electricCurrent, "电流", "DB101.W54")); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java index dd97f0171..d66581956 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/stacker/standard_stacker/StandardStackerDeviceDriver.java @@ -47,6 +47,7 @@ import org.springframework.beans.factory.annotation.Autowired; import java.util.*; import java.util.regex.Pattern; +import java.util.stream.Collectors; /** * 单工位堆垛机驱动 @@ -93,6 +94,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme */ private boolean stopReceiveTask = false; + /** * 心跳 */ @@ -173,11 +175,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme */ Float forkCargo = 0F; Float last_forkCargo = 0F; - /** - * 货叉位置信号 - */ - Float forkLocation = 0F; - Float last_forkLocation = 0F; + /** * 货叉动作信号 */ @@ -193,11 +191,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme */ Float special2 = 0F; Float last_special2 = 0F; - /** - * 托盘条码 - */ - int[] trayCode; - int[] last_trayCode; + /** * 水箱和消防缓存位有无货 */ @@ -288,6 +282,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme */ Instruction inst = null; + /** + * 同排移库后的出库指令 + */ + Instruction errorInst = null; + /** * 入库异常错误限制 */ @@ -318,10 +317,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme distancey = this.itemProtocol.getItem_distancey(); cargoError = this.itemProtocol.getItem_cargoError(); forkCargo = this.itemProtocol.getItem_forkCargo(); - forkLocation = this.itemProtocol.getItem_forkLocation(); special1 = this.itemProtocol.getItem_special1(); special2 = this.itemProtocol.getItem_special2(); - trayCode = this.itemProtocol.getItem_trayCode(); storage_cache = this.itemProtocol.getItem_storage_cache(); if (!command.equals(last_command)) { @@ -457,17 +454,37 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme break; case 5: message = "universal_releasing_completed"; - if (updateCommand("5")) break; + if (updateCommand("11")) break; Map map = new HashMap<>(); + List list5 = new ArrayList(); map.put("code", "to_command"); map.put("value", 11); - list.add(map); + list5.add(map); + this.writing(list5); Instruction inst = checkInst(); try { - finish_instruction(inst); + if ("3".equals(inst.getPriority()) && errorInst != null) { + //存在同排移库做完后直接出库 + String start_device_code = errorInst.getStart_device_code(); + Device startDevice = deviceAppService.findDeviceByCode(start_device_code); + List listError = new ArrayList(); + pakageCommand(listError, "1", errorInst.getInstruction_code()); + if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name()) && !prohibitOutWarehouse) { + pakagePlc(errorInst, listError); + } + if (ObjectUtil.isNotEmpty(listError)) { + this.writing(listError); + } + finish_instruction(inst); + errorInst = null; + }else { + finish_instruction(inst); + } } catch (Exception e) { e.printStackTrace(); } + + requireSucess = false; break; case 6: @@ -520,24 +537,20 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme last_distancey = distancey; last_cargoError = cargoError; last_forkCargo = forkCargo; - last_forkLocation = forkLocation; last_forkAction = forkAction; last_special1 = special1; last_special2 = special2; - last_trayCode = trayCode; last_storage_cache = storage_cache; - /*last_stacker_rpm = stacker_rpm; - last_stacker_electricCurrent = stacker_electricCurrent; - last_stacker_runing_time = stacker_runing_time; - last_stacker_workingHours = stacker_workingHours; - last_cargo_rpm = cargo_rpm; - last_cargo_electric_Current = cargo_electric_Current; - last_cargo_workingHour = cargo_workingHour; - last_cargo_runingTimes = cargo_runingTimes; - last_fork_rpm = fork_rpm; - last_fork_electric_Current = fork_electric_Current; - last_fork_workingHours = fork_workingHours; - last_fork_runingTimes = fork_runingTimes;*/ + + } + + private void updateEXcuteMessage(String string) { + Instruction instruction0 = checkInst(); + if (ObjectUtil.isEmpty(instruction0)) { + message = "universal_message4"; + } + instruction0.setExecute_message(string); + instructionService.update(instruction0); } private static void packageDevicePoint(Device nextDevice, List list) { @@ -578,21 +591,20 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme message = "universal_message3"; //指定库位满入 if (error == 5 && count < WcsConfig.stacker_error_in_count) { - //清警 - cleanErro(); + updateEXcuteMessage(error.toString()); + applyUpdatePointCode(StandarStirageErroEnum.FILL.getType()); //相同任务时限制加一 if (Objects.equals(task, last_task)) { count++; } - applyUpdatePointCode(StandarStirageErroEnum.FILL.getType()); + } - //空出直接完结指令 + if (error == 6) { - Instruction instruction = checkInst(); try { - finish_instruction(instruction); - //清警 - cleanErro(); + updateEXcuteMessage(error.toString()); + applyUpdatePointCode(StandarStirageErroEnum.VOIDANCE.getType()); + } catch (Exception e) { throw new RuntimeException(e); } @@ -600,19 +612,19 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme //浅货位有货 if (error == 16) { - //清警 - cleanErro(); + updateEXcuteMessage(error.toString()); //放货 - if (cargoMove == 1 && count < WcsConfig.stacker_error_in_count) { + if (forkCargo == 2 && count < WcsConfig.stacker_error_in_count) { //相同任务时限制加一 if (Objects.equals(task, last_task)) { count++; } - applyUpdatePointCode(StandarStirageErroEnum.BLOCK_OUT.getType()); - } else if (cargoMove == 0) { - //取货 applyUpdatePointCode(StandarStirageErroEnum.BLOCK_IN.getType()); + } else if (forkCargo == 0) { + //取货 + applyUpdatePointCode(StandarStirageErroEnum.BLOCK_OUT.getType()); } + } } @@ -650,6 +662,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme JSONObject jo = JSON.parseObject(response); if (StrUtil.isNotEmpty(jo.getString("body")) || jo.getInteger("status") == 200) { try { + //清警 + cleanErro(); LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) .content("申请更新点位,参数,接口返回:" + jo) @@ -657,6 +671,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme logDto2.setLog_level(4); luceneExecuteLogService.deviceExecuteLog(logDto2); String poinCode = jo.getString("point_code"); + String vehicleCode = jo.getString("vehicle_code"); if (StrUtil.isNotEmpty(poinCode)) { String[] split = poinCode.split("-"); Device point = deviceAppService.findDeviceByCode(split[0]); @@ -665,30 +680,32 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } if (type.equals(StandarStirageErroEnum.BLOCK_IN.getType()) || type.equals(StandarStirageErroEnum.FILL.getType())) { - task = task * 1000; - updateData2(poinCode, instruction, point, split, task); + updateData2(poinCode, point, split, vehicleCode); List list = new ArrayList(); String x = point.getExtraValue().get("x").toString(); String y = split[1]; String z = split[2]; pakagePLCData(list, x, y, z, "2", task.toString()); } + if (type.equals(StandarStirageErroEnum.VOIDANCE.getType())) { + updateData1(poinCode, point, split, vehicleCode); + List list = new ArrayList(); + String x = point.getExtraValue().get("x").toString(); + String y = split[1]; + String z = split[2]; + pakagePLCData(list, x, y, z, "1", task.toString()); + } } //取货潜货位阻挡做完移库任务 if (type.equals(StandarStirageErroEnum.BLOCK_OUT.getType())) { - //获取出库指令更新其优先级和状态 - Instruction instruction1 = checkInst(); - instruction1.setPriority("2"); - instruction1.setInstruction_status("0"); - instructionService.update(instruction1); - + errorInst = checkInst(); } } catch (Exception e) { this.requireSucess = true; e.printStackTrace(); } - this.requireSucess = true; +// this.requireSucess = true; } else { LuceneLogDto logDto2 = LuceneLogDto.builder() .device_code(device_code) @@ -700,6 +717,18 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } } + private void updateData1(String poinCode, Device point, String[] split, String vehicleCode) { + Instruction instructionUpdate = checkInst(); + TaskDto taskUpdate = new TaskDto(); + instructionUpdate.setStart_point_code(poinCode); + instructionUpdate.setStart_device_code(split[0]); + taskUpdate.setStart_point_code(poinCode); + taskUpdate.setStart_device_code(split[0]); + taskUpdate.setTask_id(instructionUpdate.getTask_id()); + instructionService.update(instructionUpdate); + taskserver.update(taskUpdate); + } + private void pakagePLCData(List list, String x, String y, String z, String toCommand, String task) { HashMap map1 = new HashMap(); map1.put("code", "to_x"); @@ -754,33 +783,19 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme message = null; } - private void updateData2(String poinCode, Instruction instruction, Device point, String[] split, Integer task) { + private void updateData2(String poinCode, Device point, String[] split, String vehicleCode) { Instruction instructionUpdate = checkInst(); TaskDto taskUpdate = new TaskDto(); instructionUpdate.setNext_point_code(poinCode); instructionUpdate.setNext_device_code(split[0]); - instructionUpdate.setInstruction_code(String.valueOf(task)); taskUpdate.setNext_point_code(poinCode); taskUpdate.setNext_device_code(split[0]); taskUpdate.setTask_id(instructionUpdate.getTask_id()); - pakageData2(instruction, instructionUpdate, point, split, taskUpdate); instructionService.update(instructionUpdate); taskserver.update(taskUpdate); } - private void pakageData2(Instruction instruction, Instruction instructionUpdate, Device starPoint, String[] split, TaskDto taskUpdate) { - instructionUpdate.setTo_x(starPoint.getExtraValue().get("x").toString()); - instructionUpdate.setTo_y(split[1]); - instructionUpdate.setTo_z(split[2]); - instructionUpdate.setInstruction_code(String.valueOf(task)); - taskUpdate.setTo_x(starPoint.getExtraValue().get("x").toString()); - taskUpdate.setTo_y(split[1]); - taskUpdate.setTo_z(split[2]); - taskUpdate.setTask_code(instruction.getTask_code()); - } - - /** * 申请任务 * @@ -795,53 +810,55 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme //维修解警后重新向堆垛机下发指令 Instruction instructionErro = checkInst(); if (ObjectUtil.isNotEmpty(instructionErro) && InstructionStatusEnum.BUSY.getIndex().equals(instructionErro.getInstruction_status()) && StrUtil.isNotEmpty(instructionErro.getExecute_code())) { - String start_device_code = instructionErro.getStart_device_code(); - Device startDevice = deviceAppService.findDeviceByCode(start_device_code); - if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { - //放货完成 - if (forkCargo==0) { - //取货中或者取货完成(分入库出库) - if ("1".equals(instructionErro.getExecute_code())||"2".equals(instructionErro.getExecute_code())) { + if (StrUtil.isEmpty(instructionErro.getExecute_message())) { + String start_device_code = instructionErro.getStart_device_code(); + Device startDevice = deviceAppService.findDeviceByCode(start_device_code); + if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) { + //放货完成 + if (forkCargo == 0) { + //取货中或者取货完成(分入库出库) + if ("1".equals(instructionErro.getExecute_code()) || "2".equals(instructionErro.getExecute_code())) { + List list = new ArrayList(); + String startDeviceCode = instructionErro.getStart_device_code(); + Device startDeviceError = deviceAppService.findDeviceByCode(startDeviceCode); + if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) { + pakagePLCData(list, startDeviceError.getExtraValue().get("x").toString(), startDeviceError.getExtraValue().get("z").toString(), startDeviceError.getExtraValue().get("y").toString(), instructionErro.getExecute_code(), instructionErro.getInstruction_code()); + requireSucess = true; + return true; + } + } + } + //放货中报警 + if ("3".equals(instructionErro.getExecute_code()) && forkCargo == 2) { List list = new ArrayList(); - String startDeviceCode = instructionErro.getStart_device_code(); - Device startDeviceError = deviceAppService.findDeviceByCode(startDeviceCode); if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) { - pakagePLCData(list, startDeviceError.getExtraValue().get("x").toString(), startDeviceError.getExtraValue().get("z").toString(), startDeviceError.getExtraValue().get("y").toString(), instructionErro.getExecute_code(), instructionErro.getInstruction_code()); + pakagePLCData(list, instructionErro.getTo_x(), instructionErro.getTo_y(), instructionErro.getTo_z(), instructionErro.getExecute_code(), instructionErro.getInstruction_code()); requireSucess = true; return true; } } } - //放货中报警 - if ("3".equals(instructionErro.getExecute_code())&&forkCargo==2) { - List list = new ArrayList(); - if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) { - pakagePLCData(list, instructionErro.getTo_x(), instructionErro.getTo_y(), instructionErro.getTo_z(), instructionErro.getExecute_code(), instructionErro.getInstruction_code()); - requireSucess = true; - return true; + //出库报警 + if (startDevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { + //取货报警 + if ("1".equals(instructionErro.getExecute_code()) || "2".equals(instructionErro.getExecute_code())) { + List list = new ArrayList(); + if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name())) { + pakagePLCData(list, instructionErro.getFrom_x(), instructionErro.getFrom_y(), instructionErro.getFrom_z(), instructionErro.getExecute_code(), instructionErro.getInstruction_code()); + requireSucess = true; + return true; + } } - } - } - //出库报警 - if (startDevice.getDeviceDriver() instanceof StandardStorageDeviceDriver) { - //取货报警 - if ("1".equals(instructionErro.getExecute_code())||"2".equals(instructionErro.getExecute_code())) { - List list = new ArrayList(); - if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name())) { - pakagePLCData(list, instructionErro.getFrom_x(), instructionErro.getFrom_y(), instructionErro.getFrom_z(), instructionErro.getExecute_code(), instructionErro.getInstruction_code()); - requireSucess = true; - return true; - } - } - //放货中报警 - if ("3".equals(instructionErro.getExecute_code())&&forkCargo==2) { - String next_device_code = instructionErro.getNext_device_code(); - Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); - List list = new ArrayList(); - if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) { - pakagePLCData(list, nextDevice.getExtraValue().get("x").toString(), nextDevice.getExtraValue().get("z").toString(), nextDevice.getExtraValue().get("y").toString(), instructionErro.getExecute_code(), instructionErro.getInstruction_code()); - requireSucess = true; - return true; + //放货中报警 + if ("3".equals(instructionErro.getExecute_code()) && forkCargo == 2) { + String next_device_code = instructionErro.getNext_device_code(); + Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); + List list = new ArrayList(); + if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name())) { + pakagePLCData(list, nextDevice.getExtraValue().get("x").toString(), nextDevice.getExtraValue().get("z").toString(), nextDevice.getExtraValue().get("y").toString(), instructionErro.getExecute_code(), instructionErro.getInstruction_code()); + requireSucess = true; + return true; + } } } } @@ -854,6 +871,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme this.notCreateInstMessage = "任务暂停"; return false; } + //输入:指令类型多种\ 指令状态多种\ Instruction instruction1 = new Instruction(); instruction1.setInstruction_status("0"); @@ -888,6 +906,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } } } + + if (CollUtil.isEmpty(instructionList) || instructionList.size() < 1) { return false; } @@ -907,28 +927,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme } } List list = new ArrayList(); - pakageCommand(list, "1", inst.getInstruction_code()); - if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name()) && !prohibitInWarehouse) { - if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("z"))) { - HashMap map4 = new HashMap(); - map4.put("code", "to_x"); - map4.put("value", startDevice.getExtraValue().get("z")); - list.add(map4); - } - if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("x"))) { - HashMap map5 = new HashMap(); - map5.put("code", "to_z"); - map5.put("value", startDevice.getExtraValue().get("x")); - list.add(map5); - } - if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("y"))) { - HashMap map6 = new HashMap(); - map6.put("code", "to_y"); - map6.put("value", startDevice.getExtraValue().get("y")); - list.add(map6); - } - } + packagePlcCoordinate(startDevice, list); if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name()) && !prohibitOutWarehouse) { pakagePlc(inst, list); } @@ -941,7 +941,31 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme return true; } - private void pakagePlc(Instruction inst, List list) { + private void packagePlcCoordinate(Device startDevice, List list) { + if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.conveyor.name()) && !prohibitInWarehouse) { + if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("z"))) { + HashMap map4 = new HashMap(); + map4.put("code", "to_x"); + map4.put("value", startDevice.getExtraValue().get("z")); + list.add(map4); + } + if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("x"))) { + HashMap map5 = new HashMap(); + map5.put("code", "to_z"); + map5.put("value", startDevice.getExtraValue().get("x")); + list.add(map5); + } + if (ObjectUtil.isNotEmpty(startDevice.getExtraValue().get("y"))) { + HashMap map6 = new HashMap(); + map6.put("code", "to_y"); + map6.put("value", startDevice.getExtraValue().get("y")); + list.add(map6); + } + } + } + + + private void pakagePlc(Instruction inst, List list) { HashMap map4 = new HashMap(); map4.put("code", "to_y"); map4.put("value", inst.getFrom_z()); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/inflatable_shaft_library/InflatableShaftLibraryDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/inflatable_shaft_library/InflatableShaftLibraryDeviceDriver.java index 7de801752..47c812623 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/inflatable_shaft_library/InflatableShaftLibraryDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/inflatable_shaft_library/InflatableShaftLibraryDeviceDriver.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.two_conveyor.inflatable_shaft_library; +import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; @@ -30,6 +31,7 @@ import org.nl.config.lucene.service.dto.LuceneLogDto; import org.springframework.beans.factory.annotation.Autowired; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; /** @@ -132,7 +134,11 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver Map itemMap = new HashMap(); itemMap.put(to_param, Integer.parseInt(value)); - this.control(itemMap); + try { + this.checkcontrol(itemMap); + } catch (Exception e) { + e.printStackTrace(); + } logServer.deviceExecuteLog(deviceCode, "", "", "下发电气信号设备号:" + deviceCode + ",下发电气:" + to_param + ",下发电气值:" + value); LuceneLogDto logDto = LuceneLogDto.builder() .device_code(deviceCode) @@ -141,6 +147,30 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver luceneExecuteLogService.deviceExecuteLog(logDto); } + public String getToParam() { + return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "."; + } + + public void writing(Map map) throws Exception { + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); + Map itemMap = new LinkedHashMap<>(); + map.forEach((key, value) -> { + if (ObjectUtil.isNotEmpty(value)) { + itemMap.put(getToParam() + key, value); + } + }); + if (ObjectUtil.isNotEmpty(itemMap)) { + this.checkcontrol(itemMap); + logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap); + LuceneLogDto logDto = LuceneLogDto.builder() + .device_code(this.deviceCode) + .content("下发多个电气信号" + itemMap) + .build(); + logDto.setLog_level(3); + luceneExecuteLogService.deviceExecuteLog(logDto); + } + } + @Override public JSONObject feedLmsRealFailedInfo() { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/ItemProtocol.java index a3ce60cd0..2a779a2fe 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/ItemProtocol.java @@ -123,8 +123,6 @@ public class ItemProtocol { public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); if (StrUtil.isBlank(value)) { - //throw new BusinessException("{} : {}", new Object[]{protocol, DeviceErrorProtocol.getMessage(10000)}); - } else { return value; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/ranging_stations/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/ranging_stations/ItemProtocol.java index fd89df48f..1d27ca3b4 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/ranging_stations/ItemProtocol.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/ranging_stations/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.two_conveyor.ranging_stations; +import cn.hutool.core.util.StrUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; @@ -13,7 +14,8 @@ public class ItemProtocol { public static String item_mode = "mode"; - public static String item_length = "length"; + public static String item_length1 = "length1"; + public static String item_length2 = "length2"; public static String item_action = "action"; public static String item_to_command = "to_command"; @@ -26,12 +28,16 @@ public class ItemProtocol { public int getMode() { return this.getOpcIntegerValue(item_mode); } - public int getLength() { - return this.getOpcIntegerValue(item_length); + public String getLength1() { + return this.getOpcStringValue(item_length1); } - public int getAction() { - return this.getOpcIntegerValue(item_action); + public String getLength2() { + return this.getOpcStringValue(item_length2); + } + + public String getAction() { + return this.getOpcStringValue(item_action); } public int getToCommand() { @@ -61,10 +67,29 @@ public class ItemProtocol { } + public String getOpcStringValue(String protocol) { + String value = this.driver.getStringValue(protocol); + if (StrUtil.isBlank(value)) { + } else { + return value; + } + return "0"; + } + + public float getOpcFloatValue(String protocol) { + Float value = this.driver.getDoubleValue(protocol); + if (value == null) { + setIsonline(false); + } + return 0; + + } + public static List getReadableItemDtos() { ArrayList list = new ArrayList(); list.add(new ItemDto(item_mode, "工作模式", "DB600.B2", Boolean.valueOf(true))); - list.add(new ItemDto(item_length, "测距", "DB600.D6")); + list.add(new ItemDto(item_length1, "测距1", "DB600.D6")); + list.add(new ItemDto(item_length2, "测距2", "DB600.D6")); list.add(new ItemDto(item_action, "取放信号", "DB600.D8")); return list; } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/ranging_stations/RangingStationsDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/ranging_stations/RangingStationsDeviceDriver.java index b455f83e1..73abec909 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/ranging_stations/RangingStationsDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/ranging_stations/RangingStationsDeviceDriver.java @@ -2,6 +2,7 @@ package org.nl.acs.device_driver.two_conveyor.ranging_stations; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; import lombok.Data; @@ -77,10 +78,14 @@ public class RangingStationsDeviceDriver extends AbstractOpcDeviceDriver impleme String message = null; Boolean iserror = false; - int length = 0; - int last_length = 0; - int action = 0; - int last_action = 0; + String length1 = ""; + String last_length1 = ""; + + String length2 = ""; + String last_length2 = ""; + + String action = ""; + String last_action = ""; boolean hasVehicle = false; @@ -156,7 +161,8 @@ public class RangingStationsDeviceDriver extends AbstractOpcDeviceDriver impleme try { devicecode = this.getDeviceCode(); mode = this.itemProtocol.getMode(); - length = this.itemProtocol.getLength(); + length1 = this.itemProtocol.getLength1(); + length2 = this.itemProtocol.getLength2(); action = this.itemProtocol.getAction(); if (mode != last_mode) { this.setRequireSucess(false); diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java index f4d083aa8..f7cf38966 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java @@ -190,4 +190,6 @@ public interface AcsToWmsService { * @return */ GetWasteFoilWeightResponse feedbackWeight(GetWasteFoilWeightRequest param); + + String getBoxInfo(JSONObject param); } diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 4cdb503b7..274ca52a7 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -596,6 +596,46 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } } + @Override + public String getBoxInfo(JSONObject param) { + try { + MDC.put(log_file_type, log_type); + log.info("applyTaskToWms-----输入参数{}", param); + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + AddressDto addressDto = addressService.findByCode("getBoxInfo"); + String url = wmsurl + addressDto.getMethods_url(); + HttpResponse result2 = null; + try { + result2 = HttpRequest.post(url) + .header("Authorization", token) + .body(String.valueOf(param)) + .execute(); + } catch (Exception e) { + String msg = e.getMessage(); + log.info("applyTaskToWms-----输出参数{}", msg); + //网络不通 + } + if(ObjectUtil.isEmpty(result2)){ + log.info("applyTaskToWms-----输出参数{}", "返回结果为空"); + return null; + } + String type = ""; + if (result2.getStatus() == 200) { + type = "info"; + } else { + type = "error"; + } + log.info("applyTaskToWms-----输出参数{}", result2.body()); + LuceneLogDto luceneLogDto = new LuceneLogDto(4,"applyTaskToWms", String.valueOf(result2.getStatus()), + JSON.toJSONString(param), String.valueOf(result2.body()), "二期发货申请捆扎、贴标"); + luceneLogService.interfaceExecuteLog(luceneLogDto); + return result2.body(); + + } finally { + MDC.remove(log_file_type); + } + } + @Override public JSONObject queryStationState(Instruction inst) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index e441959ea..01b6a3253 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -68,6 +68,8 @@ import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.mapper.InstructionMapper; import org.nl.common.utils.SecurityUtils; import org.nl.config.language.LangProcess; +import org.nl.config.lucene.service.LuceneExecuteLogService; +import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.system.service.param.ISysParamService; import org.nl.common.utils.CodeUtil; import org.nl.config.SpringContextHolder; @@ -114,6 +116,8 @@ public class InstructionServiceImpl extends CommonServiceImpl instructions = new CopyOnWriteArrayList(); @@ -368,7 +372,7 @@ public class InstructionServiceImpl extends CommonServiceImpl 0 && StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE) && dto.getAgv_system_type().equals(CommonFinalParam.TWO)) { // 0为输送、立库任务 1 1楼叉车系统 2 2楼1区域AGV系统 3 2楼2区域AGV系统 if (!StrUtil.equals(task.getAgv_system_type(), "0") && ObjectUtil.isNotEmpty(task.getAgv_system_type())) { @@ -496,7 +500,7 @@ public class InstructionServiceImpl extends CommonServiceImpl 0 && StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE) && dto.getAgv_system_type().equals(CommonFinalParam.ONE)) { Device deviceByCode = deviceAppService.findDeviceByCode(dto.getStart_device_code()); if (StrUtil.equals(task.getRequest_again_success(), "1")) { //追加订单 @@ -526,8 +530,14 @@ public class InstructionServiceImpl extends CommonServiceImpl queryAll(StorageCellQueryParam query, Pageable pageable) { IPage queryPage = PageUtil.toMybatisPage(pageable); @@ -217,6 +222,13 @@ public class StorageCellServiceImpl extends CommonServiceImpl allStorageCellFromCache = deviceServiceImpl.findAllStorageCellFromCache(); + allStorageCellFromCache.forEach(storageCellDto -> { + if(storageCellDto.getStorage_id().equals(storageCell.getStorage_id())){ + storageCellDto.setAddress(storageCell.getAddress()); + } + }); } @Override diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCleanLucenceLog.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCleanLucenceLog.java new file mode 100644 index 000000000..79bbe93d7 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCleanLucenceLog.java @@ -0,0 +1,56 @@ +package org.nl.system.service.quartz.task; + +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSONObject; +import lombok.extern.slf4j.Slf4j; +import org.apache.lucene.document.Document; +import org.apache.lucene.index.DirectoryReader; +import org.apache.lucene.index.IndexCommit; +import org.apache.lucene.index.IndexWriter; +import org.apache.lucene.index.Term; +import org.apache.lucene.search.*; +import org.apache.lucene.store.FSDirectory; +import org.apache.lucene.util.BytesRef; +import org.nl.acs.AcsConfig; +import org.nl.config.lucene.config.LuceneAppender; +import org.nl.system.service.param.ISysParamService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; +import org.springframework.stereotype.Component; + +import java.nio.file.Paths; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * @Author : TuQiang + * @create 2024/5/24 14:37 + */ +@Slf4j +@Component +public class AutoCleanLucenceLog { + @Autowired + private ISysParamService paramService; + + public void run() throws Exception { + IndexWriter writer = LuceneAppender.indexWriter; + //时间范围删除 + Calendar calendar = Calendar.getInstance(); + calendar.set(1970, 0, 1); + String startDate = DateUtil.format(calendar.getTime(), "yyyy-MM-dd HH:mm:ss.SSS"); + Date date = new Date(); + calendar.setTime(date); + int days = Integer.parseInt(paramService.findByCode(AcsConfig.AutoCleanDays).getValue()); + //取反 + int day = ~days + 1; + calendar.add(Calendar.DATE, day); + String endDate = DateUtil.format(calendar.getTime(), "yyyy-MM-dd HH:mm:ss.SSS"); + TermRangeQuery termRangeQuery = new TermRangeQuery("logTime", new BytesRef(startDate), new BytesRef(endDate), true, true); + writer.deleteDocuments(termRangeQuery); + writer.close(); + } +} diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java index e868fabbd..dd4b80618 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java @@ -120,7 +120,7 @@ public class CreateDDJInst { StandardStackerDeviceDriver standardStackerDeviceDriver; if (deviceByCode.getDeviceDriver() instanceof StandardStackerDeviceDriver) { standardStackerDeviceDriver = (StandardStackerDeviceDriver) deviceByCode.getDeviceDriver(); - if (standardStackerDeviceDriver.getMode() != 3 || standardStackerDeviceDriver.getMove() == 1 || standardStackerDeviceDriver.getCommand() != 0) { + if (standardStackerDeviceDriver.getMode() != 3 || standardStackerDeviceDriver.getForkCargo() == 1 || standardStackerDeviceDriver.getCommand() != 0) { log.error("堆垛机,{}未联机或者在执行中", deviceByCode.getDevice_code()); ((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("堆垛机,{}未联机或者在执行中"); return; @@ -254,38 +254,12 @@ public class CreateDDJInst { instdto.setTo_z(taskDto.getTo_z()); instdto.setTo_y(taskDto.getTo_y()); } - //判断agv系统 - //1、1楼叉车系统 - //2、2楼1区域AGV系统 - //3、2楼2区域AGV系统 -已废弃 - if (!StrUtil.equals(agv_system_type, CommonFinalParam.ONE)) { - // task_type - //1、生箔; Itype=1:取空,取满,放空,放满; - //2、分切 Itype=3取满、取空、放满、放空; - //3、普通任务 Itype=2:取货、放货; - //4、叉车任务 - //5、输送任务 - //6、行架 - //7、立库 - if (StrUtil.equals(task_type, CommonFinalParam.ONE)) { - instdto.setAgv_inst_type(CommonFinalParam.ONE); - } else if (StrUtil.equals(task_type, "3")) { - instdto.setAgv_inst_type("2"); - } else if (StrUtil.equals(task_type, "2")) { - instdto.setAgv_inst_type("3"); - } else if (StrUtil.equals(task_type, "8")) { - instdto.setAgv_inst_type("2"); - } else { - log.info("未找到对应的AGV指令类型,任务号:" + taskDto.getTask_code() + ",task_type:" + taskDto.getTask_type()); - } - } else { - instdto.setAgv_inst_type("4"); - } try { instructionService.create(instdto); } catch (Exception e) { taskDto.setRemark(e.getMessage()); - taskserver.updateByCodeFromCache(taskDto); + taskserver.update(taskDto); + return; } //创建指令后修改任务状态 taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex()); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql index f8df38c80..12adc2f6a 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql @@ -76,11 +76,19 @@ case when plan.paper_tube_or_FRP = '1' then plan.paper_tube_description when plan.paper_tube_or_FRP = '2' then plan.FRP_description end AS paper_name, sub.box_weight, CASE - WHEN DATEDIFF( NOW(), sub.date_of_production ) > '60' - AND DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '2' - WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '1' - WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3' + WHEN SUBSTRING( sub.container_name, 1, 1 ) = 'B' THEN + CASE + WHEN DATEDIFF( NOW(), sub.date_of_production ) > '150' AND DATEDIFF( NOW(), sub.date_of_production ) <= '180' THEN '2' + WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '180' THEN '1' + WHEN DATEDIFF( NOW(), sub.date_of_production ) > '180' THEN '3' + END + WHEN SUBSTRING( sub.container_name, 1, 1 ) <> 'B' THEN + CASE + WHEN DATEDIFF( NOW(), sub.date_of_production ) > '60' AND DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '2' + WHEN DATEDIFF( NOW(), sub.date_of_production ) <= '90' THEN '1' + WHEN DATEDIFF( NOW(), sub.date_of_production ) > '90' THEN '3' + END END AS sub_type, DATEDIFF( NOW(), sub.date_of_production ) AS stock_age diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java index a8e3f3d7e..b96fd7548 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java @@ -366,7 +366,7 @@ public class SapToLmsServiceImpl implements SapToLmsService { JSONObject json = item.getJSONObject(i); lfart = json.getString("LFART"); JSONObject jsonDtl = new JSONObject(); - if (StrUtil.equals(lfart, "ZLF")) { + if (StrUtil.equals(lfart, "ZLF") || StrUtil.equals(lfart, "ZJS")) { // 生成出库单 jsonMst.put("io_type", "1"); jsonMst.put("buss_type", "1001"); @@ -485,8 +485,7 @@ public class SapToLmsServiceImpl implements SapToLmsService { box_rows.add(map); } } - - + // 发货出库 if (StrUtil.equals(lfart, "ZLF")) { jsonMst.put("tableData", tableData); // 调用出库新增并分配 @@ -494,6 +493,17 @@ public class SapToLmsServiceImpl implements SapToLmsService { JSONObject jsonObject = new JSONObject(); jsonObject.put("iostorinv_id", iostorinv_id); } + // 分拣出库 + if (StrUtil.equals(lfart, "ZJS")) { + jsonMst.put("buss_type", "1011"); + jsonMst.put("bill_type", "1011"); + jsonMst.put("tableData", tableData); + // 调用出库新增并分配 + String iostorinv_id = checkOutBillService.insertDtl2(jsonMst); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("iostorinv_id", iostorinv_id); + } + // 退货入库 if (StrUtil.equals(lfart, "ZLR")) { jsonMst.put("tableData", box_rows); //创建退货入库单 diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoSaveIvtExcel.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoSaveIvtExcel.java index 0f09a5ec6..81b4e0ead 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoSaveIvtExcel.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoSaveIvtExcel.java @@ -104,11 +104,11 @@ public class AutoSaveIvtExcel { Date date = new Date(); SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); String nowStr = format.format(date) + "-"; - String path = properties.getPath().getPath() + type + File.separator + nowStr + "库存报表.xls"; + String path = properties.getPath().getPath() + type + File.separator + nowStr + "0库存报表.xls"; FileOutputStream fileOut = new FileOutputStream(path); LocalStorage localStorage = new LocalStorage( - nowStr + "库存报表.xls", - nowStr + "库存报表", + nowStr + "0库存报表.xls", + nowStr + "0库存报表", "xls", path, type, diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoSaveIvtExcelTwo.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoSaveIvtExcelTwo.java new file mode 100644 index 000000000..0bf92d7ed --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoSaveIvtExcelTwo.java @@ -0,0 +1,124 @@ +package org.nl.wms.sch.manage; + + +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.nl.modules.common.config.FileProperties; +import org.nl.modules.common.utils.FileUtil; +import org.nl.modules.tools.domain.LocalStorage; +import org.nl.modules.tools.repository.LocalStorageRepository; +import org.nl.modules.wql.WQL; +import org.redisson.api.RLock; +import org.redisson.api.RedissonClient; +import org.springframework.stereotype.Component; + +import java.io.File; +import java.io.FileOutputStream; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.concurrent.TimeUnit; + +@Slf4j +@Component +@RequiredArgsConstructor +public class AutoSaveIvtExcelTwo { + + private final RedissonClient redissonClient; + + private final FileProperties properties; + + private final LocalStorageRepository localStorageRepository; + + @SneakyThrows + public void run() { + RLock lock = redissonClient.getLock(this.getClass().getName()); + boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS); + try { + if (tryLock) { + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet sheet = workbook.createSheet("TestSheet"); + + HSSFRow row = sheet.createRow(0); + + //设置第一列 + row.createCell(0).setCellValue("仓库"); + row.createCell(1).setCellValue("库区"); + row.createCell(2).setCellValue("木箱码"); + row.createCell(3).setCellValue("物料名称"); + row.createCell(4).setCellValue("子卷号"); + row.createCell(5).setCellValue("客户名称"); + row.createCell(6).setCellValue("销售订单"); + row.createCell(7).setCellValue("业务员"); + row.createCell(8).setCellValue("入库时间"); + row.createCell(9).setCellValue("单箱装卷数"); + row.createCell(10).setCellValue("库龄"); + row.createCell(11).setCellValue("产品规格(幅宽)"); + row.createCell(12).setCellValue("净重"); + row.createCell(13).setCellValue("长度"); + row.createCell(14).setCellValue("物料标准厚度"); + row.createCell(15).setCellValue("管件类型"); + row.createCell(16).setCellValue("管件描述"); + + //查询库存明细 + JSONObject map = new JSONObject(); + map.put("flag", "22"); + + JSONArray resultJSONArray = WQL.getWO("QST_STRUCTIVT001").addParamMap(map).process().getResultJSONArray(0); + + for (int i = 0; i < resultJSONArray.size(); i++) { + HSSFRow row_dtl = sheet.createRow(i+1); + JSONObject dtl = resultJSONArray.getJSONObject(i); + row_dtl.createCell(0).setCellValue(dtl.getString("stor_name")); + row_dtl.createCell(1).setCellValue(dtl.getString("sect_name")); + row_dtl.createCell(2).setCellValue(dtl.getString("package_box_sn")); + row_dtl.createCell(3).setCellValue(dtl.getString("material_name")); + row_dtl.createCell(4).setCellValue(dtl.getString("pcsn")); + row_dtl.createCell(5).setCellValue(dtl.getString("customer_description")); + row_dtl.createCell(6).setCellValue(dtl.getString("sale_order_name")); + row_dtl.createCell(7).setCellValue(dtl.getString("sales_owner")); + row_dtl.createCell(8).setCellValue(dtl.getString("instorage_time")); + row_dtl.createCell(9).setCellValue(dtl.getString("quanlity_in_box")); + row_dtl.createCell(10).setCellValue(dtl.getString("sid_day")); + row_dtl.createCell(11).setCellValue(String.format("%.0f", dtl.getDoubleValue("width"))); + row_dtl.createCell(12).setCellValue(dtl.getString("net_weight")); + row_dtl.createCell(13).setCellValue(dtl.getString("length")); + row_dtl.createCell(14).setCellValue(dtl.getString("thickness_request")); + row_dtl.createCell(15).setCellValue(dtl.getString("paper_type")); + row_dtl.createCell(16).setCellValue(dtl.getString("paper_name")); + } + + + String type = FileUtil.getFileType("xls"); + Date date = new Date(); + SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); + String nowStr = format.format(date) + "-"; + String path = properties.getPath().getPath() + type + File.separator + nowStr + "8库存报表.xls"; + FileOutputStream fileOut = new FileOutputStream(path); + LocalStorage localStorage = new LocalStorage( + nowStr + "8库存报表.xls", + nowStr + "8库存报表", + "xls", + path, + type, + ""); + localStorageRepository.save(localStorage); + workbook.write(fileOut); + + fileOut.close(); + } else { + System.out.println("AutoQueryBillInfo" + DateUtil.now() + "被锁住!!!!"); + } + } finally { + if (tryLock) { + lock.unlock(); + } + } + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/CheckOutBillService.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/CheckOutBillService.java index 445fb3432..3978620d5 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/CheckOutBillService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/CheckOutBillService.java @@ -319,4 +319,13 @@ public interface CheckOutBillService { * @param request、 */ void importExcel(MultipartFile file, HttpServletRequest request); + + /** + * 更新分拣出库重量 + * @param whereJson { + * dtl: 明细数据 + * tabledis: 分配明细集合 + * } + */ + void saveUpdate(JSONObject whereJson); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/rest/CheckOutBillController.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/rest/CheckOutBillController.java index f761acbd9..9e99a9de2 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/rest/CheckOutBillController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/rest/CheckOutBillController.java @@ -320,4 +320,11 @@ public class CheckOutBillController { checkOutBillService.importExcel(file, request); return new ResponseEntity<>(HttpStatus.OK); } + + @PostMapping("/saveUpdate") + @Log("更新分拣出库重量") + public ResponseEntity saveUpdate(@RequestBody JSONObject whereJson) { + checkOutBillService.saveUpdate(whereJson); + return new ResponseEntity<>(HttpStatus.OK); + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java index 6ea477248..cabbfb7e6 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java @@ -1241,6 +1241,72 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { } } + @Override + @Transactional(rollbackFor = Exception.class) + public void saveUpdate(JSONObject whereJson) { + // 分配明细表 + WQLObject disTab = WQLObject.getWQLObject("st_ivt_iostorinvdis"); + // 明细表 + WQLObject dtlTab = WQLObject.getWQLObject("st_ivt_iostorinvdtl"); + // 库存表 + WQLObject ivtTab = WQLObject.getWQLObject("st_ivt_structivt"); + + JSONObject jsonDtl = whereJson.getJSONObject("dtl"); + List disArr = whereJson.getJSONArray("tabledis").toJavaList(JSONObject.class); + + for (int i = 0; i < disArr.size(); i++) { + JSONObject json = disArr.get(i); + + // 输入数量不能为零 + if (json.getDoubleValue("plan_qty") == 0) { + throw new BadRequestException("输入数量不能为0!"); + } + + // 更新冻结库存 + JSONObject jsonIvt = ivtTab.query("pcsn = '" + json.getString("pcsn") + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonIvt)) { + throw new BadRequestException("库存不存在!"+json.getString("pcsn")); + } + + jsonIvt.put("frozen_qty", json.getDoubleValue("plan_qty")); + // 冻结库存不能超过库存数量 + if (jsonIvt.getDoubleValue("frozen_qty") > jsonIvt.getDoubleValue("ivt_qty")) { + throw new BadRequestException("输入数量不能大于库存数量! 当前库存数为:"+jsonIvt.getString("ivt_qty")); + } + + // 更新库存数 + double canuse_qty = NumberUtil.sub(jsonIvt.getDoubleValue("ivt_qty"), jsonIvt.getDoubleValue("frozen_qty")); + jsonIvt.put("canuse_qty",canuse_qty); + + ivtTab.update(jsonIvt); + + // 更新分配明细 + json.put("real_qty", json.getDoubleValue("plan_qty")); + disTab.update(json); + } + + // 更新明细 + double assign_qty = disArr.stream() + .map(row -> row.getDoubleValue("plan_qty")) + .reduce(Double::sum).orElse(0.00); + // 已分配重量 + jsonDtl.put("assign_qty", assign_qty); + + // 未分配重量/明细状态 + double unassign_qty = NumberUtil.sub(jsonDtl.getDoubleValue("plan_qty"), assign_qty); + if (unassign_qty <= 0) { + jsonDtl.put("unassign_qty", 0); + jsonDtl.put("bill_status", "40"); + } else { + jsonDtl.put("unassign_qty", unassign_qty); + jsonDtl.put("bill_status", "30"); + } + dtlTab.update(jsonDtl); + + // 更新主表状态 + updateMststatus(jsonDtl.getString("iostorinv_id")); + } + @Override @Transactional(rollbackFor = Exception.class) public void update(JSONObject whereJson) { @@ -2472,8 +2538,15 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { String iostorinv_id = whereJson.getString("iostorinv_id"); //查询主表信息 JSONObject jo_mst = wo_mst.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0); - // 查询此分配明细下的所有相同箱号的分配明细 - JSONArray diss = wo_dis.query("box_no = '" + whereJson.getString("storagevehicle_code") + "' and iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0); + // 查询此分配明细下的所有相同箱号的分配明细-- 如果为分拣出库则只需要更新当前子卷库存 + JSONArray diss; + if (jo_mst.getString("bill_type").equals("1011")) { + diss = wo_dis.query("pcsn = '" + whereJson.getString("pcsn") + "' and iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0); + + } else { + diss = wo_dis.query("box_no = '" + whereJson.getString("storagevehicle_code") + "' and iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0); + + } for (int i = 0; i < diss.size(); i++) { JSONObject dis = diss.getJSONObject(i); @@ -2544,18 +2617,28 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { map.put("is_delete", "1"); wo_Task.update(map, "task_id='" + dis.getString("task_id") + "'"); } - //解锁起点仓位点位 - JSONObject from_start = new JSONObject(); - from_start.put("struct_id", dis.getString("struct_id")); - from_start.put("lock_type", "1"); - storPublicService.updateStructAndPoint2(from_start); - //解锁终点仓位点位 - if (StrUtil.isNotEmpty(dis.getString("point_code"))) { - JSONObject from_end = new JSONObject(); - from_end.put("point_code", dis.getString("point_code")); - from_end.put("lock_type", "1"); - storPublicService.updateStructAndPoint2(from_end); + //解锁起点仓位点位: 判断此仓位是否还有库存 + List ivtList = WQLObject.getWQLObject("st_ivt_structivt") + .query("struct_id = '" + dis.getString("struct_id") + "'") + .getResultJSONArray(0).toJavaList(JSONObject.class); + + boolean is_zero = ivtList.stream() + .allMatch(row -> row.getDoubleValue("frozen_qty") == 0); + + if (is_zero) { + JSONObject from_start = new JSONObject(); + from_start.put("struct_id", dis.getString("struct_id")); + from_start.put("lock_type", "1"); + storPublicService.updateStructAndPoint2(from_start); + //解锁终点仓位点位 + if (StrUtil.isNotEmpty(dis.getString("point_code"))) { + JSONObject from_end = new JSONObject(); + from_end.put("point_code", dis.getString("point_code")); + from_end.put("lock_type", "1"); + storPublicService.updateStructAndPoint2(from_end); + } } + } else {//仓位载具扔有冻结数,需改任务类型为拣选出库 //任务号不为空 /* if (ObjectUtil.isNotEmpty(dis.getString("task_id"))) { diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/returns/service/impl/InAndOutRetrunServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/returns/service/impl/InAndOutRetrunServiceImpl.java index 00422dfce..9dd91345b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/returns/service/impl/InAndOutRetrunServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/returns/service/impl/InAndOutRetrunServiceImpl.java @@ -660,7 +660,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { } // 销售出库 - if (StrUtil.equals(bill_type, "1001")) { + if (StrUtil.equals(bill_type, "1001") || StrUtil.equals(bill_type, "1011")) { // 1.回传sap JSONArray paramSapMstArr = new JSONArray(); @@ -1284,7 +1284,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { } // 销售出库 - if (StrUtil.equals(bill_type, "1001")) { + if (StrUtil.equals(bill_type, "1001") || StrUtil.equals(bill_type, "1011") ) { // 1.回传sap JSONArray paramSapMstArr = new JSONArray(); diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue b/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue index 8e88a2efb..254b9c61d 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue +++ b/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue @@ -87,7 +87,6 @@ 一键设置 + + 保存修改 + @@ -273,11 +285,16 @@ - + - + + + @@ -655,6 +672,25 @@ export default { this.loadingSetAllPoint = false }) }, + saveUpdate() { + if (this.tabledis.length === 0) { + this.crud.notify('分配明细为空!', CRUD.NOTIFICATION_TYPE.INFO) + return + } + this.loadingSetAllPoint = true + const data = { + 'dtl': this.currentRow, + 'tabledis': this.tabledis + } + checkoutbill.saveUpdate(data).then(res => { + this.queryTableDtl() + this.queryTableDdis(this.currentRow.iostorinvdtl_id) + this.crud.notify('保存成功!', CRUD.NOTIFICATION_TYPE.INFO) + this.loadingSetAllPoint = false + }).catch(() => { + this.loadingSetAllPoint = false + }) + }, allSetPointAllDtl() { if (this.form2.point_code === '') { this.crud.notify('请先选择站点!', CRUD.NOTIFICATION_TYPE.INFO) diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js b/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js index 2aa093377..bc41b9bd2 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js +++ b/lms/nladmin-ui/src/views/wms/st/outbill/checkoutbill.js @@ -255,4 +255,11 @@ export function excelImport(data) { data }) } -export default { add, edit, del, allDiv, allCancel, getOutBillDtl, getOutBillDis, getOutBillDis2, setPoint, oneSetPoint, getOutBillTask, getStructIvt, manualDiv, confirm, issueTask, finishTask, cancleTaskfinish, getInvTypes, paramByCodeType, schAreaType, backConfirm, getOutBillDisDtl, getType, allDivOne, moneySubmit, getDisNum, queryBox, getOutBillTask2, oneCancel, cancelTask, allSetPoint, oneSetPoint2, outReturn, updataIsOverdue, excelImport } +export function saveUpdate(data) { + return request({ + url: '/api/checkoutbill/saveUpdate', + method: 'post', + data + }) +} +export default { add, edit, del, allDiv, allCancel, getOutBillDtl, getOutBillDis, getOutBillDis2, setPoint, oneSetPoint, getOutBillTask, getStructIvt, manualDiv, confirm, issueTask, finishTask, cancleTaskfinish, getInvTypes, paramByCodeType, schAreaType, backConfirm, getOutBillDisDtl, getType, allDivOne, moneySubmit, getDisNum, queryBox, getOutBillTask2, oneCancel, cancelTask, allSetPoint, oneSetPoint2, outReturn, updataIsOverdue, excelImport, saveUpdate }