From ebbffc61f4cd7a992e1f4cd1d6156f0f40e2f050 Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Fri, 27 Jan 2023 10:37:38 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SiemensConveyorDeviceDriver.java | 51 ++----------------- ...CoveyorControlWithScannerDeviceDriver.java | 1 + 2 files changed, 4 insertions(+), 48 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java index b472065ad..55a00f3f4 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java @@ -192,45 +192,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task); } -// if (task > 0) { -// Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); -// if (ObjectUtil.isNotEmpty(instruction)) { -// -// if (StrUtil.equals(this.getDeviceCode(), instruction.getStart_device_code())) { -// -// if (StrUtil.equals(instruction.getInstruction_status(), "0")) { -// instruction.setInstruction_status("1"); -// instructionService.update(instruction); -// } -// -// String next_device_code = instruction.getNext_device_code(); -// Device device = deviceAppservice.findDeviceByCode(next_device_code); -// if (ObjectUtil.isEmpty(device)) { -// logServer.deviceExecuteLog(this.device_code, "", "", "任务号:" + task + "输送线任务未完成,目标站设备为空!"); -// return; -// } -// SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; -// if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { -// if(mode ==2 ){ -// siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver(); -// int nextTask = siemensConveyorDeviceDriver.getTask(); -// if (nextTask == task) { -// inst_message = "指令号:" + instruction.getInstruction_code() + " " + instruction.getStart_point_code() + "->" + instruction.getNext_point_code() + " 载具号:" + instruction.getVehicle_code(); -// if (StrUtil.equals(instruction.getInstruction_status(), "1")) { -// inst = instruction; -// finish_instruction(); -// this.clearWrite(); -// } -// } -// } -// -// } -// } -// -// } -// -// } - if (mode == 2 && move != 0 && task > 0) { //inst_message inst = instructionService.findByCodeFromCache(String.valueOf(task)); @@ -238,12 +199,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code(); if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) { vehicle_code = inst.getVehicle_code(); -// Device device = deviceAppservice.findDeviceByCode("BCR1"); -// StandardScannerDeviceDriver standardScannerDeviceDriver; -// if (device.getDeviceDriver() instanceof ScannerDeviceDriver) { -// standardScannerDeviceDriver = (StandardScannerDeviceDriver) device.getDeviceDriver(); -// standardScannerDeviceDriver.writeBarcode(vehicle_code); -// } finish_instruction(); } if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) { @@ -873,16 +828,16 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme public synchronized void applyAgvTask() { Date date = new Date(); - if (date.getTime() - this.require_empty_out_time.getTime() < (long) this.instruction_require_time_out) { + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); return; } else { - this.require_empty_out_time = date; + this.instruction_require_time = date; if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { message = "申请AGV搬运任务中..."; JSONObject apply = new JSONObject(); apply.put("device_code", device_code); - apply.put("type","4"); + apply.put("type","1"); String str = acsToWmsService.applyTaskToWms(apply); JSONObject jo = JSON.parseObject(str); if (ObjectUtil.isEmpty(jo)) { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java index 087162f8c..32a3ea317 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java @@ -684,6 +684,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe jo.put("hasGoods", true); } jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("driver_type", "standard_conveyor_control_with_scanner"); jo.put("mode", mode); jo.put("move", move); jo.put("action", action); From 187a05563c9ceffb4c3e7e2acb43d4c2b10d16a8 Mon Sep 17 00:00:00 2001 From: liuxy Date: Fri, 27 Jan 2023 10:53:29 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CheckOutBillServiceImpl.java | 1 + .../org/nl/wms/st/outbill/wql/ST_OUTIVT04.wql | 5 +++ .../src/views/wms/st/outbill/DivDialog.vue | 42 +++++++++++++++---- 3 files changed, 41 insertions(+), 7 deletions(-) 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 99b2e5ac7..92dea019b 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 @@ -2522,6 +2522,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { JSONArray allRowArr = WQL.getWO("ST_OUTIVT04") .addParam("flag", "1") .addParam("iostorinvdtl_id", iostorinvdtl_id) + .addParam("iostorinv_id", iostorinv_id) .process() .getResultJSONArray(0); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/ST_OUTIVT04.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/ST_OUTIVT04.wql index aa2072d28..e361b9231 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/ST_OUTIVT04.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/ST_OUTIVT04.wql @@ -14,6 +14,7 @@ ## 表字段对应输入参数 ################################################# 输入.flag TYPEAS s_string + 输入.iostorinv_id TYPEAS s_string 输入.iostorinvdtl_id TYPEAS s_string 输入.block_num TYPEAS s_string 输入.row_num TYPEAS s_string @@ -58,6 +59,10 @@ dis.iostorinvdtl_id = 输入.iostorinvdtl_id ENDOPTION + OPTION 输入.iostorinv_id <> "" + dis.iostorinv_id = 输入.iostorinv_id + ENDOPTION + group by attr.block_num,attr.row_num order by attr.row_num ASC 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 d34361475..dfb7e11bb 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue +++ b/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue @@ -92,6 +92,17 @@ > 手工分配 + + 一键设置 + @@ -116,7 +127,7 @@ - + @@ -165,7 +176,7 @@ - + + + com.plumelog + plumelog-lite-spring-boot-starter + 3.5.3 + + + plumelog-core + com.plumelog + + + + + + com.plumelog + plumelog-trace + 3.5.2 + + + + org.reflections reflections diff --git a/lms/nladmin-system/src/main/java/org/nl/config/WebSocketConfig.java b/lms/nladmin-system/src/main/java/org/nl/config/WebSocketConfig.java index 28a447c96..78684351c 100644 --- a/lms/nladmin-system/src/main/java/org/nl/config/WebSocketConfig.java +++ b/lms/nladmin-system/src/main/java/org/nl/config/WebSocketConfig.java @@ -12,17 +12,20 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ + *//* + package org.nl.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.socket.server.standard.ServerEndpointExporter; +*/ /** * @author ZhangHouYing * @date 2019-08-24 15:44 - */ + *//* + @Configuration public class WebSocketConfig { @@ -31,3 +34,4 @@ public class WebSocketConfig { return new ServerEndpointExporter(); } } +*/ diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/loki/rest/LokiController.java b/lms/nladmin-system/src/main/java/org/nl/modules/loki/rest/LokiController.java deleted file mode 100644 index e498cb664..000000000 --- a/lms/nladmin-system/src/main/java/org/nl/modules/loki/rest/LokiController.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.nl.modules.loki.rest; - -import com.alibaba.fastjson.JSONObject; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.modules.common.annotation.RateLimiter; -import org.nl.modules.loki.service.LokiService; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -/** - * @Author: lyd - * @Description: 日志监控 - * @Date: 2022-08-15 - */ -@RestController -@RequiredArgsConstructor -@Api(tags = "日志监控") -@RequestMapping("/api/loki") -@Slf4j -public class LokiController { - - private final LokiService lokiService; - - @GetMapping("/labels/values") - @ApiOperation("获取标签") - public ResponseEntity labelsValues() { - return new ResponseEntity<>(lokiService.getLabelsValues(), HttpStatus.OK); - } - - @PostMapping("/logs") - @ApiOperation("获取日志") - @RateLimiter(value = 1, timeout = 300) // 限流 - public ResponseEntity getLogData(@RequestBody JSONObject json) { - return new ResponseEntity<>(lokiService.getLogData(json), HttpStatus.OK); - } -} diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/loki/service/LokiService.java b/lms/nladmin-system/src/main/java/org/nl/modules/loki/service/LokiService.java deleted file mode 100644 index 10101c914..000000000 --- a/lms/nladmin-system/src/main/java/org/nl/modules/loki/service/LokiService.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.nl.modules.loki.service; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; - -/** - * @Author: lyd - * @Description: 服务类 - * @Date: 2022-08-15 - */ -public interface LokiService { - - /** - * 获取日志信息 - * @param json - * @return - */ - JSONObject getLogData(JSONObject json); - - /** - * 获取labels和values树 - * @return - */ - JSONArray getLabelsValues(); -} diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/loki/service/impl/LokiServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/modules/loki/service/impl/LokiServiceImpl.java deleted file mode 100644 index f6eeb49c0..000000000 --- a/lms/nladmin-system/src/main/java/org/nl/modules/loki/service/impl/LokiServiceImpl.java +++ /dev/null @@ -1,113 +0,0 @@ -package org.nl.modules.loki.service.impl; - -import cn.hutool.core.util.CharsetUtil; -import cn.hutool.http.HttpUtil; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import lombok.RequiredArgsConstructor; -import org.nl.modules.loki.service.LokiService; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; - -/** - * @Author: lyd - * @Description: 实现类 - * @Date: 2022-08-15 - */ -@Service -@RequiredArgsConstructor -public class LokiServiceImpl implements LokiService { - - @Value("${loki.url}") - private String lokiUrl; - - @Value("${loki.systemName}") - private String systemName; - - @Override - public JSONObject getLogData(JSONObject json) { - String logLabel = ""; - String logLabelValue = ""; - Long start = 0L; - Long end = 0L; - String text = ""; - String limit = "100"; - String direction = "backward"; - if (json.get("logLabel") != null) logLabel = json.getString("logLabel"); - if (json.get("logLabelValue") != null) logLabelValue = json.getString("logLabelValue"); - if (json.get("text") != null) text = json.getString("text"); - if (json.get("start") != null) start = json.getLong("start"); - if (json.get("end") != null) end = json.getLong("end"); - if (json.get("limits") != null) limit = json.getString("limits"); - if (json.get("direction") != null) direction = json.getString("direction"); - /** - * 组织参数 - * 纳秒数 - * 1660037391880000000 - * 1641453208415000000 - * http://localhost:3100/loki/api/v1/query_range?query={host="localhost"} |= ``&limit=1500&start=1641453208415000000&end=1660027623419419002 - */ - JSONObject parse = null; - String query = lokiUrl + "/query_range?query={system=\"" + systemName + "\", " + logLabel + "=\"" + logLabelValue + "\"} |= `" + text + "`"; - String result = ""; - if (start==0L) { - result = HttpUtil.get(query + "&limit=" + limit + "&direction=" + direction, CharsetUtil.CHARSET_UTF_8); - } else { - result = HttpUtil.get(query + "&limit=" + limit + "&start=" + start + "&end=" + end + "&direction=" + direction, CharsetUtil.CHARSET_UTF_8); - } - try { - parse = (JSONObject) JSONObject.parse(result); - } catch (Exception e) { -// reslut的值可能为:too many outstanding requests,无法转化成Json - System.out.println("reslut:" + result); -// e.printStackTrace(); - } - return parse; - } - - /** - * 获取labels和values树 - * - * @return - */ - @Override - public JSONArray getLabelsValues() { - /** - * [{ - * label: - * value: - * children:[{ - * label - * value - * }] - * }] - */ - JSONArray result = new JSONArray(); - // 获取所有标签 - String labelString = HttpUtil.get(lokiUrl + "/labels", CharsetUtil.CHARSET_UTF_8); - JSONObject parse = (JSONObject) JSONObject.parse(labelString); - JSONArray labels = parse.getJSONArray("data"); - for (int i=0; i - - - 1000 - - ${LOKI_URL}/push - - - - - ${log.pattern} - - true - + + lms + + /plumelog/lite + + 15 + sleuth @@ -85,7 +77,7 @@ https://juejin.cn/post/6844903775631572999 - + @@ -131,55 +123,55 @@ https://juejin.cn/post/6844903775631572999 - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/lms/nladmin-ui/src/views/wms/sch/point/index.vue b/lms/nladmin-ui/src/views/wms/sch/point/index.vue index 6f986c5b2..3b2b05fd6 100644 --- a/lms/nladmin-ui/src/views/wms/sch/point/index.vue +++ b/lms/nladmin-ui/src/views/wms/sch/point/index.vue @@ -188,7 +188,7 @@ > 解锁 - 仓位同步 - + --> Date: Fri, 27 Jan 2023 12:53:12 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/device_driver/DriverTypeEnum.java | 4 +- .../SiemensConveyorDeviceDriver.java | 35 +- .../ItemProtocol.java | 134 +++ .../SiemensConveyorLabelingDefination.java | 64 ++ .../SiemensConveyorLabelingDeviceDriver.java | 864 ++++++++++++++++++ .../ItemProtocol.java | 52 +- ...CoveyorControlWithScannerDeviceDriver.java | 23 +- .../data/ApplyLabelingAndBindingRequest.java | 3 + .../service/impl/InstructionServiceImpl.java | 12 +- .../nl/acs/opc/DeviceOpcProtocolRunable.java | 2 +- .../src/views/acs/device/config.vue | 4 +- .../driver/siemens_conveyor_labeling.vue | 513 +++++++++++ 12 files changed, 1660 insertions(+), 50 deletions(-) create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/ItemProtocol.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDefination.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java create mode 100644 acs/nladmin-ui/src/views/acs/device/driver/siemens_conveyor_labeling.vue diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java index 366772ae0..893c1e309 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java @@ -39,7 +39,9 @@ public enum DriverTypeEnum { INSPECT_CONVEYOR_CONTROL_WITH_SCANNER(14, "standard_conveyor_control_with_scanner", "标准版-输送机-控制点-关联扫码", "conveyor"), - PLUG_PULL_DEVICE_SITE(15, "plug_pull_device_site", "插拔轴站点", "conveyor"); + PLUG_PULL_DEVICE_SITE(15, "plug_pull_device_site", "插拔轴站点", "conveyor"), + + SIEMENS_CONVEYOR_LABELING(16, "siemens_conveyor_labeling", "西门子-输送机驱动-贴标", "conveyor"); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java index 55a00f3f4..5438f8074 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java @@ -149,26 +149,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme requireApplyLaStrangulationSuccess =false; requireEmptyInSuccess =false; requireEmptyOutSuccess =false; - if (mode == 2) { - logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为requireSucess:" + requireSucess); - logServer.deviceExecuteLog(device_code, "", "", "请求标记复位成功`此时请求标记值为requireSucess:" + requireSucess); - } - if (mode == 4) { - logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为requireApplyLabelingSuccess:" + requireApplyLabelingSuccess); - logServer.deviceExecuteLog(device_code, "", "", "请求标记复位成功`此时请求标记值为requireApplyLabelingSuccess:" + requireApplyLabelingSuccess); - } - if (mode == 5) { - logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为requireApplyLaStrangulationSuccess:" + requireApplyLaStrangulationSuccess); - logServer.deviceExecuteLog(device_code, "", "", "请求标记复位成功`此时请求标记值为requireApplyLaStrangulationSuccess:" + requireApplyLaStrangulationSuccess); - } - if (mode == 6) { - logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为requireEmptyInSuccess:" + requireEmptyInSuccess); - logServer.deviceExecuteLog(device_code, "", "", "请求标记复位成功`此时请求标记值为requireEmptyInSuccess:" + requireEmptyInSuccess); - } - if (mode == 7) { - logServer.deviceExecuteLog(device_code, "", "", "开始请求标记复位`此时请求标记值为requireEmptyOutSuccess:" + requireEmptyOutSuccess); - logServer.deviceExecuteLog(device_code, "", "", "请求标记复位成功`此时请求标记值为requireEmptyOutSuccess:" + requireEmptyOutSuccess); - } logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode)); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode); } @@ -424,8 +404,13 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme if (this.getMove() == 0) { move = "无货"; + jo.put("hasGoods", false); } else if (this.getMove() == 1) { move = "有货"; + jo.put("hasGoods", true); + } else if (this.getMove() == 2) { + move = "有托盘有货"; + jo.put("hasGoods", true); } if (this.carrier_direction == 1) { @@ -493,13 +478,13 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme return false; } else { this.instruction_require_time = date; - //container_code + //判断是否存在起点相同 任务状态就绪的任务 TaskDto taskdto = taskserver.findByStartCodeAndReady(device_code); if (!ObjectUtil.isEmpty(taskdto)) { // if (!ObjectUtils.isEmpty(instructionService.findByBarcodeFromCache(container_code))) { // return false; // } - + //需要判断当前设备是否已经存在就绪的指令 如果存在就直接下发 不存在则创建 Instruction inst = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()); if(ObjectUtil.isNotEmpty(inst)){ List list = new ArrayList(); @@ -536,6 +521,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme return true; } + // type 5 输送任务 if(!StrUtil.equals(taskdto.getTask_type(),"5")){ return false; } @@ -559,9 +545,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme String path = routeLineDto.getPath(); String type = routeLineDto.getType(); String[] str = path.split("->"); -// if (!StrUtil.equals(type, "0")) { -// return false; -// } + List pathlist = Arrays.asList(str); int index = 0; for (int m = 0; m < pathlist.size(); m++) { @@ -633,6 +617,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); } } else { + //如果不存在则直接找对应指令 Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code); if(ObjectUtil.isEmpty(inst)){ return false; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/ItemProtocol.java new file mode 100644 index 000000000..baa5e9a75 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/ItemProtocol.java @@ -0,0 +1,134 @@ +package org.nl.acs.device_driver.basedriver.siemens_conveyor_labeling; + +import cn.hutool.core.util.StrUtil; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +@Data +public class ItemProtocol { + + //心跳 + public static String item_heartbeat = "heartbeat"; + //工作模式 + public static String item_mode = "mode"; + //光电信号 + public static String item_move = "move"; + //托盘方向 + public static String item_carrier_direction = "carrier_direction"; + //报警 + public static String item_error = "error"; + //任务号 + public static String item_task = "task"; + //重量 + public static String item_weight = "weight"; + + //下发命令 + public static String item_to_command = "to_command"; + //下发目标站 + public static String item_to_target = "to_target"; + //下发托盘类型 + public static String item_to_container_type = "to_container_type"; + //下发任务号 + public static String item_to_task = "to_task"; + //困扎次数 + public static String item_to_strap_times = "to_strap_times"; + //木箱长度 + public static String item_to_length = "to_length"; + //木箱宽度 + public static String item_to_weight = "to_weight"; + //木箱高度 + public static String item_to_height = "to_height"; + + + private SiemensConveyorLabelingDeviceDriver driver; + + public ItemProtocol(SiemensConveyorLabelingDeviceDriver driver) { + this.driver = driver; + } + + public int getHeartbeat() { + return this.getOpcIntegerValue(item_heartbeat); + } + + public int getMode() { + return this.getOpcIntegerValue(item_mode); + } + + public int getMove() { + return this.getOpcIntegerValue(item_move); + } + + public int getCarrier_direction() { + return this.getOpcIntegerValue(item_carrier_direction); + } + + public int getError() { + return this.getOpcIntegerValue(item_error); + } + + public int getTask() { + return this.getOpcIntegerValue(item_task); + } + + public int getWeight() { + return this.getOpcIntegerValue(item_weight); + } + + + Boolean isonline; + + public int getOpcIntegerValue(String protocol) { + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } + + public String getOpcStringValue(String protocol) { + String value = this.driver.getStringValue(protocol); + if (StrUtil.isEmpty(value)) { + + } else { + return value; + } + return "0"; + } + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_heartbeat, "心跳", "DB101.B0")); + list.add(new ItemDto(item_mode, "工作模式", "DB101.B152")); + list.add(new ItemDto(item_move, "光电信号", "DB101.B153")); + list.add(new ItemDto(item_carrier_direction, "托盘方向", "DB101.B154")); + list.add(new ItemDto(item_error, "报警信号", "DB101.B156")); + list.add(new ItemDto(item_task, "任务号", "DB101.D160")); + list.add(new ItemDto(item_weight, "重量", "DB101.D160")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_to_command, "下发命令", "DB102.W152")); + list.add(new ItemDto(item_to_target, "下发目标站", "DB601.W154")); + list.add(new ItemDto(item_to_task, "下发任务号", "DB102.D158")); + return list; + } + + @Override + public String toString() { + return ""; + } + +} + diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDefination.java new file mode 100644 index 000000000..20f246cce --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDefination.java @@ -0,0 +1,64 @@ +package org.nl.acs.device_driver.basedriver.siemens_conveyor_labeling; + +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceType; +import org.springframework.stereotype.Service; + +import java.util.LinkedList; +import java.util.List; + +/** + * 西门子-输送机驱动-贴标 + * + */ +@Service +public class SiemensConveyorLabelingDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "siemens_conveyor_labeling"; + } + + @Override + public String getDriverName() { + return "西门子-输送机驱动-贴标"; + } + + @Override + public String getDriverDescription() { + return "西门子-输送机驱动-贴标"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new SiemensConveyorLabelingDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public Class getDeviceDriverType() { + return SiemensConveyorLabelingDeviceDriver.class; + } + + @Override + public List getFitDeviceTypes() { + List types = new LinkedList(); + types.add(DeviceType.station); + return types; + } + + @Override + public List getReadableItemDtos() { + return ItemProtocol.getReadableItemDtos(); + } + + + + @Override + public List getWriteableItemDtos() { + return ItemProtocol.getWriteableItemDtos(); + } + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java new file mode 100644 index 000000000..0070ca18a --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java @@ -0,0 +1,864 @@ +package org.nl.acs.device_driver.basedriver.siemens_conveyor_labeling; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; +import org.nl.acs.AcsConfig; +import org.nl.acs.agv.server.NDCAgvService; +import org.nl.acs.device.device_driver.standard_inspect.ReadUtil; +import org.nl.acs.device.service.DeviceService; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.RouteableDeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest; +import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse; +import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.log.service.DeviceExecuteLogService; +import org.nl.acs.monitor.DeviceStageMonitor; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceAppService; +import org.nl.acs.route.service.RouteLineService; +import org.nl.acs.route.service.dto.RouteLineDto; +import org.nl.acs.task.service.TaskService; +import org.nl.acs.task.service.dto.TaskDto; +import org.nl.modules.system.service.ParamService; +import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.modules.wql.util.SpringContextHolder; +import org.openscada.opc.lib.da.Server; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.*; + +/** + * 西门子-输送机驱动-贴标 + */ +@Slf4j +@Data +@RequiredArgsConstructor +public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + @Autowired + InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); + @Autowired + DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class); + @Autowired + RouteLineService routelineserver = SpringContextHolder.getBean(RouteLineService.class); + @Autowired + TaskService taskserver = SpringContextHolder.getBean(TaskService.class); + @Autowired + DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); + @Autowired + RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); + @Autowired + ParamService paramService = SpringContextHolder.getBean(ParamService.class); + @Autowired + AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsService.class); + @Autowired + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); + @Autowired + NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class); + //当前指令 + Instruction inst = null; + + //工作模式 + int mode = 0; + int last_mode = 0; + //光电信号 + int move = 0; + int last_move = 0; + //托盘方向 + int carrier_direction = 0; + int last_carrier_direction = 0; + //报警信号 + int error = 0; + int last_error = 0; + //任务号 + int task = 0; + int weight = 0; + int last_task = 0; + int agvphase = 0; + + int phase = 0; + int index = 0; + Boolean isonline = true; + int hasGoods = 0; + String message = null; + Boolean iserror = false; + + Integer heartbeat_tag; + private Date instruction_require_time = new Date(); + private Date require_apply_labeling_time = new Date(); + private Date require_apply_strangulation_time = new Date(); + private Date require_empty_in_time = new Date(); + private Date require_empty_out_time = new Date(); + + private int instruction_require_time_out; + //行架机械手申请任务成功标识 + boolean requireSucess = false; + boolean requireApplyLabelingSuccess = false; + boolean requireApplyLaStrangulationSuccess = false; + boolean requireEmptyInSuccess = false; + boolean requireEmptyOutSuccess = false; + private int instruction_finished_time_out; + + int branchProtocol = 0; + String inst_message; + + //当前指令 + + //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 + int flag; + + String device_code; + + String vehicle_code; + + + @Override + public Device getDevice() { + return this.device; + } + + + @Override + public void execute() throws Exception { + String message = null; + try { + device_code = this.getDeviceCode(); + mode = this.itemProtocol.getMode(); + move = this.itemProtocol.getMove(); + carrier_direction = this.itemProtocol.getCarrier_direction(); + error = this.itemProtocol.getError(); + task = this.itemProtocol.getTask(); + weight = this.itemProtocol.getWeight(); + if (mode != last_mode) { + requireSucess = false; + requireApplyLabelingSuccess = false; + requireApplyLaStrangulationSuccess =false; + requireEmptyInSuccess =false; + requireEmptyOutSuccess =false; + logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode); + } + if (move != last_move) { + if(move == 0 ){ + this.clearWrite(); + } + logServer.deviceItemValue(this.device_code, "move", String.valueOf(move)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move); + } + if (carrier_direction != last_carrier_direction) { + logServer.deviceItemValue(this.device_code, "carrier_direction", String.valueOf(carrier_direction)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号carrier_direction:" + last_carrier_direction + "->" + carrier_direction); + } + if (error != last_error) { + logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error); + } + if (task != last_task) { + logServer.deviceItemValue(this.device_code, "task", String.valueOf(task)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task); + } + + if (mode == 2 && move != 0 && task > 0) { + //inst_message + inst = instructionService.findByCodeFromCache(String.valueOf(task)); + if (inst != null) { + inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code(); + if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) { + vehicle_code = inst.getVehicle_code(); + finish_instruction(); + } + if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) { + inst.setInstruction_status("1"); + instructionService.update(inst); + } + } + } + + } catch (Exception var17) { + inst_message = var17.getMessage(); + logServer.deviceExecuteLog(this.getDevice_code(), "", "", "读取信号值时出现异常:" + var17.getMessage()); + return; + } + +// if (!this.itemProtocol.getIsonline()) { +// this.setIsonline(false); +// this.setIserror(true); +// message = "信号量同步异常"; +// //未联机 +// } else + if (mode == 0) { + this.setIsonline(false); + this.setIserror(true); + message = "未联机"; + //有报警 +// } else if (error != 0) { +// this.setIsonline(false); +// this.setIserror(true); +// message = "有报警"; +// //无报警 + } else { + this.setIsonline(true); + this.setIserror(false); + message = ""; + Instruction instruction = null; + List toInstructions; + + + switch (mode) { + case 1: + log.debug("设备运转模式:等待工作"); + break; + case 2: + //申请任务 + if (move > 0 && !requireSucess) { + instruction_require(); + } + break; + case 4: + //申请捆扎 + if (move > 0 && !requireApplyLaStrangulationSuccess) { + applyLaStrangulation(); + } + break; + case 5: + //申请贴标 + if (move > 0 && !requireApplyLabelingSuccess) { + applyLabeling(); + + } + break; + case 6: + //空托盘满垛入库申请 + if (move > 0 && !requireEmptyInSuccess) { + emptyIn(); + } + if (move > 0 && !requireSucess) { + instruction_require(); + } + break; + case 7: + //空盘出库申请 + if (move == 0 && !requireEmptyOutSuccess) { + emptyOut(); + } + break; + case 8: + //申请AGV任务 + if (move == 0 && !requireSucess) { + applyAgvTask(); + } + break; + + } + } + last_mode = mode; + last_move = move; + last_carrier_direction = carrier_direction; + last_error = error; + last_task = task; + } + + + public boolean exe_error() { + if (this.error == 0) { + return true; + } else { + log.debug("设备报警"); + return false; + } + } + + public void clearWrite() { + + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code","to_target"); + map.put("value","0"); + list.add(map); + Map map2 = new HashMap(); + map2.put("code","to_task"); + map2.put("value","0"); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code","to_command"); + map3.put("value","0"); + list.add(map3); + Map map4 = new HashMap(); + map4.put("code","to_strap_times"); + map4.put("value","0"); + list.add(map4); + Map map5 = new HashMap(); + map5.put("code","to_length"); + map5.put("value","0"); + list.add(map5); + Map map6 = new HashMap(); + map6.put("code","to_weight"); + map6.put("value","0"); + list.add(map6); + Map map7 = new HashMap(); + map7.put("code","to_height"); + map7.put("value","0"); + list.add(map7); + this.writing(list); + message = null; + vehicle_code = null; + } + + public boolean exe_business() { + return true; + } + + public synchronized boolean finish_instruction() throws Exception { + instructionService.finish(inst); +// requireSucess = false; + return true; + } + + + protected void thingToNothing() throws Exception { + requireSucess = false; + } + + + public void writing(String param, String value) { + + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + param; + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + + itemMap.put(to_param, Integer.parseInt(value)); +// itemMap.put(to_param, Integer.parseInt(value)); + ReadUtil.write(itemMap, server); + logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value); + } + + public void executing(Server server, Map itemMap) { + ReadUtil.write(itemMap, server); + } + + public void writing(int command) { + + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + ReadUtil.write(itemMap, server); + + } + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String mode = ""; + String move = ""; + String carrier_direction = ""; + if (this.getMode() == 0) { + mode = "脱机"; + } else if (this.getMode() == 1) { + mode = "单机"; + } else if (this.getMode() == 2) { + mode = "待机"; + } else if (this.getMode() == 3) { + mode = "运行中"; + } else if (this.getMode() == 4) { + mode = "申请捆扎中"; + } else if (this.getMode() == 5) { + mode = "申请贴标中"; + } else if (this.getMode() == 6) { + mode = "申请空盘入库中"; + } else if (this.getMode() == 7) { + mode = "申请空盘出库中"; + } else if (this.getMode() == 8) { + mode = "申请AGV任务中"; + } + + if (this.getMove() == 0) { + move = "无货"; + jo.put("hasGoods", false); + } else if (this.getMove() == 1) { + move = "有货"; + jo.put("hasGoods", true); + } else if (this.getMove() == 2) { + move = "有托盘有货"; + jo.put("hasGoods", true); + } + + if (this.carrier_direction == 1) { + carrier_direction = "正转"; + } else if (this.carrier_direction == 2) { + carrier_direction = "反转"; + } + String requireSucess = "0"; + if (this.requireSucess) { + requireSucess = "1"; + } + + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("mode", mode); + jo.put("move", move); + jo.put("carrier_direction", carrier_direction); + jo.put("task", task); + jo.put("isOnline", this.getIsonline()); + jo.put("error", this.getError()); + jo.put("isError", this.getIserror()); + jo.put("message", this.getMessage()); + jo.put("is_click", true); + jo.put("requireSucess", requireSucess); + jo.put("driver_type", "siemens_conveyor"); + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + String requestSucess = data.getString("requireSucess"); + if (StrUtil.equals(requestSucess, "0")) { + this.requireSucess = false; + } else if(StrUtil.equals(requestSucess, "1")) { + this.requireSucess = true; + } + } + + public void writing(List list) { + + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + for (int i = 0; i < list.size(); i++) { + Object ob = list.get(i); + JSONObject json = (JSONObject) JSONObject.toJSON(ob); + if (!StrUtil.isEmpty(json.getString("value"))) { + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + json.getString("code"); + itemMap.put(to_param, json.getString("value")); + } + } + logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap); + ReadUtil.write(itemMap, server); + + } + + + /** + * 请求指令 + */ + public synchronized boolean instruction_require() throws Exception { + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return false; + } else { + this.instruction_require_time = date; + //判断是否存在起点相同 任务状态就绪的任务 + TaskDto taskdto = taskserver.findByStartCodeAndReady(device_code); + if (!ObjectUtil.isEmpty(taskdto)) { +// if (!ObjectUtils.isEmpty(instructionService.findByBarcodeFromCache(container_code))) { +// return false; +// } + //需要判断当前设备是否已经存在就绪的指令 如果存在就直接下发 不存在则创建 + Instruction inst = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()); + if(ObjectUtil.isNotEmpty(inst)){ + List list = new ArrayList(); + Map map = new HashMap(); + + if(StrUtil.isNotEmpty(taskdto.getTo_z())){ + if(StrUtil.equals(taskdto.getTo_z(),"01")){ + map.put("code","to_target"); + map.put("value","102"); + } else if(StrUtil.equals(taskdto.getTo_z(),"02")){ + map.put("code","to_target"); + map.put("value","201"); + } else if(StrUtil.equals(taskdto.getTo_z(),"03")){ + map.put("code","to_target"); + map.put("value","301"); + } + } + list.add(map); + Map map2 = new HashMap(); + map2.put("code","to_task"); + map2.put("value",inst.getInstruction_code()); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code","to_command"); + map3.put("value","1"); + list.add(map3); + this.writing(list); + if( task != Integer.parseInt(inst.getInstruction_code())){ + this.writing(list); + logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); + } + message = "下发电气任务号成功"; + requireSucess = true; + return true; + } + + // type 5 输送任务 + if(!StrUtil.equals(taskdto.getTask_type(),"5")){ + return false; + } + String taskid = taskdto.getTask_id(); + String taskcode = taskdto.getTask_code(); + String vehiclecode = taskdto.getVehicle_code(); + String priority = taskdto.getPriority(); + String start_point_code = taskdto.getStart_point_code(); + String start_device_code = taskdto.getStart_device_code(); + String route_plan_code = taskdto.getRoute_plan_code(); + String next_device_code = ""; + + /** + * 开始平均分配 + */ + String this_coevice_code = taskserver.queryAssignedByDevice(device_code, taskdto.getNext_device_code()); + if (StrUtil.isEmpty(this_coevice_code)) { + List shortPathsList = routeLineService.getShortPathLines(start_device_code, taskdto.getNext_device_code(), route_plan_code); + RouteLineDto routeLineDto = shortPathsList.get(0); + + String path = routeLineDto.getPath(); + String type = routeLineDto.getType(); + String[] str = path.split("->"); + + List pathlist = Arrays.asList(str); + int index = 0; + for (int m = 0; m < pathlist.size(); m++) { + if (pathlist.get(m).equals(start_device_code)) { + index = m + 1; + break; + } + } + next_device_code = pathlist.get(index); + } else { + next_device_code = this_coevice_code; + } + //校验路由关系 + List shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); + if (ObjectUtils.isEmpty(shortPathsList)) { + throw new RuntimeException("路由不通!"); + } + + Device startdevice = deviceAppservice.findDeviceByCode(start_device_code); + Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code); + String next_point_code; + if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) { + next_point_code = taskdto.getTo_x() + "-" + taskdto.getTo_y() + "-" + taskdto.getTo_z(); + } else { + next_point_code = next_device_code; + } + Instruction instdto = new Instruction(); + instdto.setInstruction_id(IdUtil.simpleUUID()); + instdto.setRoute_plan_code(route_plan_code); + instdto.setRemark(taskdto.getRemark()); + instdto.setMaterial(taskdto.getMaterial()); + instdto.setQuantity(taskdto.getQuantity()); + instdto.setTask_id(taskid); + instdto.setTask_code(taskcode); + instdto.setVehicle_code(vehiclecode); + String now = DateUtil.now(); + instdto.setCreate_time(now); + instdto.setCreate_by("auto"); + instdto.setStart_device_code(start_device_code); + instdto.setNext_device_code(next_device_code); + instdto.setStart_point_code(start_point_code); + instdto.setNext_point_code(next_point_code); + instdto.setPriority(priority); + instdto.setInstruction_status("0"); + instdto.setExecute_device_code(start_point_code); + instructionService.create(instdto); + //创建指令后修改任务状态 + taskdto.setTask_status("1"); + taskserver.update(taskdto); + requireSucess = true; + String next_addr = nextdevice.getExtraValue().get("address").toString(); + + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code","to_target"); + map.put("value",next_addr); + list.add(map); + Map map2 = new HashMap(); + map2.put("code","to_task"); + map2.put("value",instdto.getInstruction_code()); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code","to_command"); + map3.put("value","1"); + list.add(map3); + this.writing(list); + if( task != Integer.parseInt(inst.getInstruction_code())){ + this.writing(list); + logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); + } + } else { + //如果不存在则直接找对应指令 + Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code); + if(ObjectUtil.isEmpty(inst)){ + return false; + } + //当起点为行架任务的时候不需要请求下发 + if(StrUtil.equals(inst.getInstruction_type(),"6")){ + return false; + } + Device nextdevice = deviceAppservice.findDeviceByCode(inst.getNext_device_code()); + String next_addr = nextdevice.getExtraValue().get("address").toString(); + + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code","to_target"); + map.put("value",next_addr); + list.add(map); + Map map2 = new HashMap(); + map2.put("code","to_task"); + map2.put("value",inst.getInstruction_code()); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code","to_command"); + map3.put("value","1"); + list.add(map3); + this.writing(list); + if( task != Integer.parseInt(inst.getInstruction_code())){ + this.writing(list); + logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); + } + } + return true; + } + } + + //申请贴标 + public synchronized void applyLabeling() { + Date date = new Date(); + if (date.getTime() - this.require_apply_labeling_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; + } else { + this.require_apply_labeling_time = date; + String vehicle_code = ""; + if(weight == 0 ){ + logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备重量:"+weight+"异常"); + message = "申请贴标电气设备重量:"+weight+"异常"; + throw new RuntimeException("重量为空!"); + } + if(task >0 ){ + Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); + vehicle_code = instruction.getVehicle_code(); + } else { + logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备任务号:"+task+"异常"); + message = "申请贴标电气设备任务号:"+task+"异常"; + throw new RuntimeException("任务号为空!"); + } + if(StrUtil.isEmpty(vehicle_code)){ + logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备任务号:"+task+"未找到载具号"); + message = "申请贴标电气设备任务号:"+task+"未找到载具号"; + throw new RuntimeException("载具号为空!"); + } + ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest = + new ApplyLabelingAndBindingRequest(); + JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + this.device_code + "'").uniqueResult(0); + String start_point_code = null; + if (!ObjectUtil.isEmpty(device_json)) { + start_point_code = (String) device_json.get("parent_storage_code") == null ? this.device_code : (String) device_json.get("parent_storage_code"); + } + applyLabelingAndBindingRequest.setDevice_code(start_point_code); + applyLabelingAndBindingRequest.setType("1"); + applyLabelingAndBindingRequest.setVehicle_code(vehicle_code); + applyLabelingAndBindingRequest.setWeight(String.valueOf(weight/10)); + ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest); + + if(applyLabelingAndBindingResponse.getstatus() == 200){ + message ="申请贴标成功"; + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code","to_command"); + map.put("value","5"); + list.add(map); + this.writing(list); + this.writing(list); + message ="申请贴标下发电气信号成功"; + requireApplyLabelingSuccess = true; + } else { + message = "申请贴标失败,"+applyLabelingAndBindingResponse.getMessage(); + } + } + } + + //申请捆扎 + public synchronized void applyLaStrangulation() { + 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 { + this.require_apply_strangulation_time = date; + String vehicle_code = ""; + if(task >0 ){ + Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); + vehicle_code = instruction.getVehicle_code(); + } else { + logServer.deviceExecuteLog(device_code, "", "", "申请捆扎电气设备任务号:"+task+"异常"); + message = "申请捆扎电气设备任务号:"+task+"异常"; + throw new RuntimeException("任务号为空!"); + } + if(StrUtil.isEmpty(vehicle_code)){ + logServer.deviceExecuteLog(device_code, "", "", "申请捆扎电气设备任务号:"+task+"未找到载具号"); + message = "申请捆扎电气设备任务号:"+task+"未找到载具号"; + throw new RuntimeException("载具号为空!"); + } + ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest = + new ApplyLabelingAndBindingRequest(); + JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + this.device_code + "'").uniqueResult(0); + String start_point_code = null; + if (!ObjectUtil.isEmpty(device_json)) { + start_point_code = (String) device_json.get("parent_storage_code") == null ? this.device_code : (String) device_json.get("parent_storage_code"); + } + applyLabelingAndBindingRequest.setDevice_code(start_point_code); + applyLabelingAndBindingRequest.setType("2"); + applyLabelingAndBindingRequest.setVehicle_code(vehicle_code); + ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest); + if(applyLabelingAndBindingResponse.getstatus() == 200) { + if(ObjectUtil.isNotEmpty( applyLabelingAndBindingResponse.getData())){ + Map datas = applyLabelingAndBindingResponse.getData(); + String length = datas.get("box_length").toString(); + String width = datas.get("box_width").toString(); + String box_high = datas.get("box_high").toString(); + String bundle_times = datas.get("bundle_times").toString(); + + List list = new ArrayList(); + Map map = new HashMap(); + map.put("code","to_length"); + map.put("value",length); + list.add(map); + Map map2 = new HashMap(); + map2.put("code","to_weight"); + map2.put("value",width); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code","to_height"); + map3.put("value",box_high); + list.add(map3); + Map map4 = new HashMap(); + map4.put("code","to_strap_times"); + map4.put("value",bundle_times); + list.add(map4); + Map map5 = new HashMap(); + map5.put("code","to_command"); + map5.put("value","4"); + list.add(map5); + this.writing(list); + this.writing(list); + message ="申请贴标成功"; + requireApplyLaStrangulationSuccess = true; + } else { + message = "未返回尺寸信息"; + } + + } else { + message = applyLabelingAndBindingResponse.getMessage(); + } + + } + } + + public synchronized void emptyIn() { + Date date = new Date(); + if (date.getTime() - this.require_empty_in_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; + } else { + this.require_empty_in_time = date; + + if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { + message = "申请空盘入库任务中..."; + JSONObject apply = new JSONObject(); + apply.put("device_code", device_code); + apply.put("type","2"); + String str = acsToWmsService.applyTaskToWms(apply); + JSONObject jo = JSON.parseObject(str); + if (ObjectUtil.isEmpty(jo)) { + message = "申请空盘入库接口不通"; + } else { + if (jo.getInteger("status") == 200) { + message = "申请空盘入库成功"; + requireEmptyInSuccess = true; + } else { + requireEmptyInSuccess = false; + message = "申请空盘入库失败,"+jo.get("message").toString(); + } + } + + } + } + } + + public synchronized void applyAgvTask() { + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; + } else { + this.instruction_require_time = date; + if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { + message = "申请AGV搬运任务中..."; + JSONObject apply = new JSONObject(); + apply.put("device_code", device_code); + apply.put("type","1"); + String str = acsToWmsService.applyTaskToWms(apply); + JSONObject jo = JSON.parseObject(str); + if (ObjectUtil.isEmpty(jo)) { + message = "申请AGV搬运任务接口不通"; + } else { + if (jo.getInteger("status") == 200) { + message = "申请AGV搬运任务成功"; + requireEmptyOutSuccess = true; + } else { + requireEmptyOutSuccess = false; + message = "申请AGV搬运任务失败,"+jo.get("message").toString(); + } + } + + } + } + } + + public synchronized void emptyOut() { + Date date = new Date(); + if (date.getTime() - this.require_empty_out_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; + } else { + this.require_empty_out_time = date; + if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { + message = "申请空盘出库任务中..."; + JSONObject apply = new JSONObject(); + apply.put("device_code", device_code); + apply.put("type","3"); + String str = acsToWmsService.applyTaskToWms(apply); + JSONObject jo = JSON.parseObject(str); + if (ObjectUtil.isEmpty(jo)) { + message = "申请空盘出库接口不通"; + } else { + if (jo.getInteger("status") == 200) { + message = "申请空盘出库成功"; + requireEmptyOutSuccess = true; + } else { + requireEmptyOutSuccess = false; + message = "申请空盘出库失败,"+jo.get("message").toString(); + } + } + + } + } + } + + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/ItemProtocol.java index 4242ed5ed..99ec030a5 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/ItemProtocol.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner; +import cn.hutool.core.util.StrUtil; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; @@ -24,6 +25,11 @@ public class ItemProtocol { public static String item_error = "error"; //任务号 public static String item_task = "task"; + //条码长度 + public static String item_barcode_length = "barcode_length"; + //条码 + public static String item_barcode = "barcode"; + //下发命令 public static String item_to_command = "to_command"; @@ -73,6 +79,14 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_task); } + public int getBarCode_length() { + return this.getOpcIntegerValue(item_barcode_length); + } + + public String getplcBarCode() { + return this.getOpcStringValue(item_barcode); + } + Boolean isonline; @@ -89,27 +103,39 @@ public class ItemProtocol { } + public String getOpcStringValue(String protocol) { + String value = this.driver.getStringValue(protocol); + if (StrUtil.isEmpty(value)) { + + } else { + return value; + } + return "0"; + } public static List getReadableItemDtos() { ArrayList list = new ArrayList(); - 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_error, "报警信号", "DB600.B6")); - list.add(new ItemDto(item_task, "任务号", "DB600.D10")); + list.add(new ItemDto(item_heartbeat, "心跳", "DB101.B0")); + list.add(new ItemDto(item_mode, "工作模式", "DB101.B252")); + list.add(new ItemDto(item_move, "光电信号", "DB101.B253")); + list.add(new ItemDto(item_carrier_direction, "托盘方向", "DB101.B254")); + list.add(new ItemDto(item_error, "报警信号", "DB101.B256")); + list.add(new ItemDto(item_task, "任务号", "DB101.D260")); + list.add(new ItemDto(item_barcode_length, "条码长度", "DB101.B800")); + list.add(new ItemDto(item_barcode, "条码", "DB101.STRING802.50")); + return list; } public static List getWriteableItemDtos() { ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发命令", "DB601.W2")); - list.add(new ItemDto(item_to_target, "下发目标站", "DB601.W4")); - list.add(new ItemDto(item_to_task, "下发任务号", "DB601.D8")); - list.add(new ItemDto(item_to_strap_times, "捆扎次数", "DB601.W12")); - list.add(new ItemDto(item_to_length, "木箱长度", "DB601.W14")); - list.add(new ItemDto(item_to_weight, "木箱宽度", "DB601.W16")); - list.add(new ItemDto(item_to_height, "木箱高度", "DB601.W18")); + list.add(new ItemDto(item_to_command, "下发命令", "DB102.W252")); + list.add(new ItemDto(item_to_target, "下发目标站", "DB102.W254")); + list.add(new ItemDto(item_to_task, "下发任务号", "DB102.D258")); +// list.add(new ItemDto(item_to_strap_times, "捆扎次数", "DB102.W12")); +// list.add(new ItemDto(item_to_length, "木箱长度", "DB102.W14")); +// list.add(new ItemDto(item_to_weight, "木箱宽度", "DB102.W16")); +// list.add(new ItemDto(item_to_height, "木箱高度", "DB102.W18")); return list; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java index 32a3ea317..6a4451a62 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java @@ -84,6 +84,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe int action = 0; int error = 0; int task = 0; + String plcbarcode = null; + int plcbarcode_length = 0; Boolean isonline = true; @@ -178,6 +180,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe move = this.itemProtocol.getMove(); error = this.itemProtocol.getError(); task = this.itemProtocol.getTask(); + plcbarcode = this.itemProtocol.getplcBarCode(); + plcbarcode_length = this.itemProtocol.getBarCode_length(); if (mode != last_mode) { this.setRequireSucess(false); @@ -230,11 +234,22 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe break; case 2: //申请任务 - if (move > 0 && !StrUtil.isEmpty(barcode()) && !requireSucess) { - instruction_require(barcode()); + String newBarcode = null; + if(!StrUtil.equals(plcbarcode,"0")){ + newBarcode = plcbarcode; + } else { + if(!StrUtil.isEmpty(barcode())){ + newBarcode = barcode(); + } else { + break; + } } - if (move > 0 && !StrUtil.isEmpty(barcode()) && !applySucess) { - instruction_apply(barcode()); + + if (move > 0 && !StrUtil.isEmpty(newBarcode) && !requireSucess) { + instruction_require(newBarcode); + } + if (move > 0 && !StrUtil.isEmpty(newBarcode) && !applySucess) { + instruction_apply(newBarcode); } } switch (flag) { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyLabelingAndBindingRequest.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyLabelingAndBindingRequest.java index f68fe71f8..65c5bb58e 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyLabelingAndBindingRequest.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyLabelingAndBindingRequest.java @@ -12,4 +12,7 @@ public class ApplyLabelingAndBindingRequest extends BaseRequest { * 3:烘箱 */ private String type; + + private String weight; + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 8be54f0b5..1cb72140a 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -231,11 +231,13 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu @Override public Instruction findByTaskcodeAndStatus(String code) { - WQLObject wo = WQLObject.getWQLObject("acs_instruction"); - JSONObject json = wo.query("task_code ='" + code + "' and instruction_status = '0'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(json)){ - final Instruction obj = json.toJavaObject(Instruction.class); - return obj; + Iterator var3 = instructions.iterator(); + while (var3.hasNext()) { + Instruction instruction = (Instruction) var3.next(); + if (StrUtil.equals(instruction.getTask_code(), code) + && StrUtil.equals(instruction.getInstruction_status(), "0")) { + return instruction; + } } return null; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java index d29e71f9a..2b118bb52 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java @@ -117,7 +117,7 @@ public class DeviceOpcProtocolRunable implements Runnable { log.trace("{} 读取耗时:{}", tag, duration); if (duration > 1000L) { if (!time_out) { - log.warn("{} 读取超时 : {}", tag, duration); + log.warn(" {} 读取超时 : {} ", tag, duration); } time_out = true; diff --git a/acs/nladmin-ui/src/views/acs/device/config.vue b/acs/nladmin-ui/src/views/acs/device/config.vue index 41477dcc5..8877dfa29 100644 --- a/acs/nladmin-ui/src/views/acs/device/config.vue +++ b/acs/nladmin-ui/src/views/acs/device/config.vue @@ -93,6 +93,7 @@ import slit_two_manipulator from '@/views/acs/device/driver/slit_two_manipulator import hongxiang_device from '@/views/acs/device/driver/hongxiang_device' import hongxiang_conveyor from '@/views/acs/device/driver/hongxiang_conveyor' import plug_pull_device_site from '@/views/acs/device/driver/plug_pull_device_site' +import siemens_conveyor_labeling from '@/views/acs/device/driver/siemens_conveyor_labeling' export default { name: 'DeviceConfig', @@ -116,7 +117,8 @@ export default { oven_manipulator, siemens_conveyor, slit_two_manipulator, - plug_pull_device_site + plug_pull_device_site, + siemens_conveyor_labeling }, dicts: ['device_type'], mixins: [crud], diff --git a/acs/nladmin-ui/src/views/acs/device/driver/siemens_conveyor_labeling.vue b/acs/nladmin-ui/src/views/acs/device/driver/siemens_conveyor_labeling.vue new file mode 100644 index 000000000..8b75aad93 --- /dev/null +++ b/acs/nladmin-ui/src/views/acs/device/driver/siemens_conveyor_labeling.vue @@ -0,0 +1,513 @@ + + + + + From 61822e95fb0512e48d6d56c6e4c02936943e2d51 Mon Sep 17 00:00:00 2001 From: zhangzhiqiang Date: Fri, 27 Jan 2023 12:59:16 +0800 Subject: [PATCH 07/15] =?UTF-8?q?=E5=85=B3=E9=97=ADmybatislog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lms/nladmin-system/src/main/resources/config/application.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/nladmin-system/src/main/resources/config/application.yml b/lms/nladmin-system/src/main/resources/config/application.yml index a9a79722e..a8984232c 100644 --- a/lms/nladmin-system/src/main/resources/config/application.yml +++ b/lms/nladmin-system/src/main/resources/config/application.yml @@ -110,7 +110,7 @@ sa-token: mybatis-plus: configuration: map-underscore-to-camel-case: true - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl +# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl mapper-locations: - classpath:org.nl.**.mapper/*.xml global-config: From fe2e015bd4f8e71fbce6497f6221618341d5b7a4 Mon Sep 17 00:00:00 2001 From: ludj Date: Fri, 27 Jan 2023 15:14:09 +0800 Subject: [PATCH 08/15] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/param/SysParamController.java | 2 +- .../basedata/master/interfaceback/index.vue | 2 +- .../src/views/wms/sch/task/index.vue | 19 +++++++++++++------ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/system/controller/param/SysParamController.java b/lms/nladmin-system/src/main/java/org/nl/system/controller/param/SysParamController.java index a1f8fa9ca..c255155e4 100644 --- a/lms/nladmin-system/src/main/java/org/nl/system/controller/param/SysParamController.java +++ b/lms/nladmin-system/src/main/java/org/nl/system/controller/param/SysParamController.java @@ -10,6 +10,7 @@ import org.nl.common.domain.query.PageQuery; import org.nl.modules.logging.annotation.Log; import org.nl.system.service.param.ISysParamService; import org.nl.system.service.param.dao.Param; +import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; @@ -33,7 +34,6 @@ import java.util.Map; @RequestMapping("/api/param") @RequiredArgsConstructor class SysParamController { - private final ISysParamService paramService; @GetMapping @Log("查询系统参数") diff --git a/lms/nladmin-ui/src/views/wms/basedata/master/interfaceback/index.vue b/lms/nladmin-ui/src/views/wms/basedata/master/interfaceback/index.vue index a605991b8..81b833eb6 100644 --- a/lms/nladmin-ui/src/views/wms/basedata/master/interfaceback/index.vue +++ b/lms/nladmin-ui/src/views/wms/basedata/master/interfaceback/index.vue @@ -84,7 +84,7 @@ - + diff --git a/lms/nladmin-ui/src/views/wms/sch/task/index.vue b/lms/nladmin-ui/src/views/wms/sch/task/index.vue index aadf8ab29..9820cf94d 100644 --- a/lms/nladmin-ui/src/views/wms/sch/task/index.vue +++ b/lms/nladmin-ui/src/views/wms/sch/task/index.vue @@ -112,7 +112,7 @@ @selection-change="crud.selectionChangeHandler" > - + @@ -161,11 +161,11 @@ width="30%" > - + />--> 取 消 确 定 @@ -200,7 +200,7 @@ export default { sort: 'task_id,desc', crudMethod: { ...crudTask }, query: { - task_code: '', vehicle_code: '', start_point_code: '', next_point_code: '', task_type: '', finished_type: '', task_status: '' + task_code: '', vehicle_code: '', start_point_code: '', next_point_code: '', task_type: '', finished_type: '', task_status: ['-1'] }, optShow: { add: false, @@ -236,10 +236,14 @@ export default { crudTask.getFinishType().then(data => { this.finishTypeList = data }) - this.crud.query.task_status = ['-1'] - this.crud.toQuery() + // this.crud.query.task_status = ['-1'] + // this.crud.toQuery() }, methods: { + // 钩子:在获取表格数据之前执行,false 则代表不获取数据 + [CRUD.HOOK.beforeRefresh]() { + return true + }, initClass1() { const param = { parent_class_code: 'task_type' @@ -263,6 +267,7 @@ export default { // 获取子节点数据 loadChildNodes({ action, parentNode, callback }) { if (action === LOAD_CHILDREN_OPTIONS) { + debugger crudClassstandard.getClass({ pid: parentNode.id }).then(res => { parentNode.children = res.content.map(function(obj) { if (obj.hasChildren) { @@ -277,9 +282,11 @@ export default { } }, hand(value) { + debugger this.crud.toQuery() }, handTaskStatus(value) { + debugger if (value) { this.query.task_status = this.task_status.toString() } From b1fc30d1f06d532bd5c7fc37631a33a8ae6bdd69 Mon Sep 17 00:00:00 2001 From: liuxy Date: Fri, 27 Jan 2023 17:46:13 +0800 Subject: [PATCH 09/15] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nl/wms/pda/st/service/impl/ProductionOutServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductionOutServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductionOutServiceImpl.java index 1ac059917..e322502c7 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductionOutServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductionOutServiceImpl.java @@ -71,7 +71,7 @@ public class ProductionOutServiceImpl implements ProductionOutService { * 生产区确认 * a.解锁出库点位、清除木箱号 */ - jsonPoint.put("point_status", "00"); + jsonPoint.put("point_status", "1"); jsonPoint.put("lock_type", "1"); jsonPoint.put("vehicle_code", ""); jsonPoint.put("vehicle_type", ""); From 1488621cd0f0f9efc3bd2243bd9af26975a456f7 Mon Sep 17 00:00:00 2001 From: "ZHOUZ\\Noble'lift" <1014987728@qq.com> Date: Fri, 27 Jan 2023 18:25:19 +0800 Subject: [PATCH 10/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/service/impl/MesToLmsServiceImpl.java | 6 ++++ .../mps/service/impl/ShippingServiceImpl.java | 6 ++-- .../impl/RawAssistIStorServiceImpl.java | 33 ++++++++++++++----- .../src/views/wms/st/inbill/TaskDialog.vue | 2 +- .../src/views/wms/st/inbill/ViewDialog.vue | 8 ++--- 5 files changed, 38 insertions(+), 17 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java index 57913953f..fc4b747d8 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java @@ -821,6 +821,12 @@ public class MesToLmsServiceImpl implements MesToLmsService { String thickness_request = detail.getString("Attribute2");//物料主数据厚度 String width_standard = detail.getString("Attribute3");//要求幅宽 + //查询库内是否存在相同的子卷号 + JSONObject container_jo = WQLObject.getWQLObject("PDM_BI_SubPackageRelation").query("container_name = '"+ContainerName+"'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(container_jo)){ + throw new BadRequestException("LMS系统中已存在子卷号:"+ContainerName+",请检查!"); + } + JSONObject jo = new JSONObject(); jo.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId()); jo.put("package_box_sn", PackageBoxSN); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/ShippingServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/ShippingServiceImpl.java index eb5b0d952..2a7e1ecbe 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/ShippingServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/ShippingServiceImpl.java @@ -171,7 +171,7 @@ public class ShippingServiceImpl implements ShippingService { throw new BadRequestException("未查询到可用的空点位!"); } - /*//如果为左边点位判断右边是否存在未完成的任务,如果有则提示不能下发 + //如果为左边点位判断右边是否存在未完成的任务,如果有则提示不能下发 //判断输送出来的任务起点是否靠近分切机,如果靠近分切机且远离分切机的点位上存在载具且不存在任务进行载具横移 char dtl_type = empty_point.getString("point_code").charAt(empty_point.getString("point_code").length() - 1); if (Integer.valueOf(String.valueOf(dtl_type)) % 2 != 0) { @@ -179,9 +179,9 @@ public class ShippingServiceImpl implements ShippingService { //判断是否存在任务 JSONObject task_jo = WQLObject.getWQLObject("sch_base_task").query("point_code1 = '"+right_point.getString("point_code")+"' OR point_code2 = '"+right_point.getString("point_code")+"' AND task_status < '07' AND is_delete = '0'").uniqueResult(0); if (ObjectUtil.isNotEmpty(task_jo)){ - throw new BadRequestException("当前一截输送线存在未完成的任务,请稍等几分钟后进行下发!"); + throw new BadRequestException(empty_point.getString("point_code")+"所在一截输送线存在未完成的任务,请稍等几分钟后进行下发!"); } - }*/ + } //下发输送线任务 JSONObject form = new JSONObject(); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java index 8a6be2653..0fe07da1f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java @@ -186,7 +186,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { JSONObject material = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + row.get("product_name") + "'").uniqueResult(0); row.put("material_id", material.getString("material_id")); row.put("pcsn", row.get("container_name")); - row.put("bill_status", "30"); + row.put("bill_status", "10"); row.put("quality_scode", "01"); row.put("qty_unit_id", material.getString("base_unit_id")); JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + material.getString("base_unit_id") + "'").uniqueResult(0); @@ -356,7 +356,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { JSONObject material = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + row.get("product_name") + "'").uniqueResult(0); row.put("material_id", material.getString("material_id")); row.put("pcsn", row.get("container_name")); - row.put("bill_status", "30"); + row.put("bill_status", "10"); row.put("quality_scode", "01"); row.put("qty_unit_id", material.getString("base_unit_id")); JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("measure_unit_id = '" + material.getString("base_unit_id") + "'").uniqueResult(0); @@ -472,7 +472,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { HashMap map = rows.get(0); Boolean auto_div = false; - if (whereJson2.containsKey("auto_div")){ + if (whereJson2.containsKey("auto_div")) { auto_div = whereJson2.getBoolean("auto_div"); } //判断该载具是否已经分配货位或者起点 @@ -605,9 +605,8 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { i_form.put("qty_unit_name", dis_jo.getString("qty_unit_name")); storPublicService.IOStor(i_form, "31"); + JSONObject dtl_jo = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinvdtl_id = '" + dis_jo.getString("iostorinvdtl_id") + "'").uniqueResult(0); if (StrUtil.isNotEmpty(ios_dis.getString("point_id")) || is_virtual) { - //更新明细表状态 - JSONObject dtl_jo = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinvdtl_id = '" + dis_jo.getString("iostorinvdtl_id") + "'").uniqueResult(0); if (dtl_jo.getDoubleValue("unassign_qty") == 0) { //判断该明细下是否还存在未分配货位的分配明细 JSONArray disdiv_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinvdtl_id = '" + dis_jo.getString("iostorinvdtl_id") + "' AND (struct_id = '' OR struct_id is null) AND (point_id = '' OR point_id is null)").getResultJSONArray(0); @@ -622,9 +621,23 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { mst_jo.put("dis_optname", nickName); mst_jo.put("dis_time", now); WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst_jo); + } else { + mst_jo.put("bill_status", "30"); + mst_jo.put("dis_optid", currentUserId); + mst_jo.put("dis_optname", nickName); + mst_jo.put("dis_time", now); + WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst_jo); } } } + } else { + dtl_jo.put("bill_status", "30"); + WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").update(dtl_jo); + mst_jo.put("bill_status", "30"); + mst_jo.put("dis_optid", currentUserId); + mst_jo.put("dis_optname", nickName); + mst_jo.put("dis_time", now); + WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst_jo); } } //如果是虚拟区,直接更新完成分配任务 @@ -696,9 +709,11 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { WQLObject.getWQLObject("ST_IVT_IOStorInvDis").update(map, "iostorinv_id = '" + mst_jo.get("iostorinv_id") + "' AND box_no = '" + whereJson.get("box_no") + "'"); //修改明细状态 + JSONObject dtl_jo = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinvdtl_id = '" + dis_rows.getJSONObject(0).getString("iostorinvdtl_id") + "'").uniqueResult(0); + HashMap dtl_map = new HashMap<>(); - map.put("bill_status", "30"); - WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").update(map, "iostorinv_id = '" + mst_jo.get("iostorinv_id") + "' AND box_no = '" + whereJson.get("box_no") + "'"); + dtl_map.put("bill_status", "10"); + WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").update(dtl_map, "iostorinv_id = '" + mst_jo.get("iostorinv_id") + "' AND box_no = '" + whereJson.get("box_no") + "'"); //更新主表状态 JSONArray dtl_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinv_id = '" + mst_jo.get("iostorinv_id") + "' AND bill_status IN ('20','30')").getResultJSONArray(0); @@ -1059,7 +1074,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { //修改明细状态 HashMap dtl_map = new HashMap<>(); - map.put("bill_status", "30"); + map.put("bill_status", "10"); WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").update(map, "iostorinv_id = '" + mst_jo.get("iostorinv_id") + "' AND box_no = '" + whereJson.get("box_no") + "'"); //更新主表状态 @@ -1077,7 +1092,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { public void reIssueTask(Map whereJson) { String task_id = (String) whereJson.get("task_id"); //判断指令状态,只能下发生成、执行中状态的任务 - JSONObject task_jo = WQLObject.getWQLObject("sch_base_task").query("task_id = '"+task_id+"'").uniqueResult(0); + JSONObject task_jo = WQLObject.getWQLObject("sch_base_task").query("task_id = '" + task_id + "'").uniqueResult(0); if (ObjectUtil.isEmpty(task_jo)) { throw new BadRequestException("请输入正确的任务号!"); } diff --git a/lms/nladmin-ui/src/views/wms/st/inbill/TaskDialog.vue b/lms/nladmin-ui/src/views/wms/st/inbill/TaskDialog.vue index 2833b1168..937516cbc 100644 --- a/lms/nladmin-ui/src/views/wms/st/inbill/TaskDialog.vue +++ b/lms/nladmin-ui/src/views/wms/st/inbill/TaskDialog.vue @@ -216,7 +216,7 @@ export default { this.crud.notify('请选择一条任务项', CRUD.NOTIFICATION_TYPE.INFO) return } - if (this.dis_row.work_status !== '01') { + if (this.dis_row.work_status !== '04') { this.crud.notify('只能对状态为生成的任务进行删除!', CRUD.NOTIFICATION_TYPE.INFO) return } diff --git a/lms/nladmin-ui/src/views/wms/st/inbill/ViewDialog.vue b/lms/nladmin-ui/src/views/wms/st/inbill/ViewDialog.vue index 507a5f415..ad64f674a 100644 --- a/lms/nladmin-ui/src/views/wms/st/inbill/ViewDialog.vue +++ b/lms/nladmin-ui/src/views/wms/st/inbill/ViewDialog.vue @@ -109,7 +109,8 @@ - + + @@ -135,7 +136,8 @@ > - + + @@ -151,8 +153,6 @@ import { crud } from '@crud/crud' import checkoutbill from '@/views/wms/st/outbill/checkoutbill' -import crudStorattr from '@/views/wms/basedata/st/stor/storattr' -import crudRawAssist from '@/views/wms/st/inbill/rawassist' import crudUserStor from '@/views/wms/basedata/st/userStor/userStor' export default { From 37a2f84e0125481955ed1533830cedfbf00ac943 Mon Sep 17 00:00:00 2001 From: liuxy Date: Fri, 27 Jan 2023 18:41:08 +0800 Subject: [PATCH 11/15] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pda/st/rest/ProductInstorController.java | 7 +++++++ .../pda/st/service/ProductInstorService.java | 2 ++ .../service/impl/ProductInstorServiceImpl.java | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/ProductInstorController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/ProductInstorController.java index 23f5bdbbd..eaec5b22f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/ProductInstorController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/ProductInstorController.java @@ -44,4 +44,11 @@ public class ProductInstorController { return new ResponseEntity<>(productInstorService.confirm(whereJson),HttpStatus.OK); } + @PostMapping("/mendCode") + @Log("补码") + @ApiOperation("补码") + public ResponseEntity mendCode(@RequestBody JSONObject whereJson){ + return new ResponseEntity<>(productInstorService.mendCode(whereJson),HttpStatus.OK); + } + } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/ProductInstorService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/ProductInstorService.java index e18ec0059..52945d3e5 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/ProductInstorService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/ProductInstorService.java @@ -19,4 +19,6 @@ public interface ProductInstorService { JSONObject boxQuery(JSONObject whereJson); JSONObject confirm(JSONObject whereJson); + + JSONObject mendCode(JSONObject whereJson); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java index aed094440..2d95ae011 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java @@ -16,6 +16,7 @@ import org.nl.modules.wql.WQL; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.WqlUtil; +import org.nl.wms.ext.acs.service.impl.AcsToWmsServiceImpl; import org.nl.wms.pda.st.service.CoolInService; import org.nl.wms.pda.st.service.ProductInstorService; import org.nl.wms.sch.manage.AbstractAcsTask; @@ -248,4 +249,21 @@ public class ProductInstorServiceImpl implements ProductInstorService { jo.put("message", "确认成功!"); return jo; } + + @Override + public JSONObject mendCode(JSONObject whereJson) { + String vehicle_code = whereJson.getString("box_no"); + if (ObjectUtil.isEmpty(vehicle_code)) throw new BadRequestException("木箱号不能为空"); + + JSONObject param = new JSONObject(); + param.put("vehicle_code",vehicle_code); + param.put("type","1"); + + AcsToWmsServiceImpl bean = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); + bean.deviceApply(param); + + JSONObject jo = new JSONObject(); + jo.put("message", "补码成功!"); + return jo; + } } From 9c74e9ebe3fbd0df7892a2e431d8af78b18b2ffb Mon Sep 17 00:00:00 2001 From: ludj Date: Fri, 27 Jan 2023 22:36:58 +0800 Subject: [PATCH 12/15] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mps/service/impl/BakingServiceImpl.java | 2 +- .../java/org/nl/wms/pda/mps/wql/PDA_02.wql | 2 +- lms/nladmin-ui/src/views/wms/pdm/bi/index.vue | 2 +- .../wms/statistics/sendReceiveQuery/index.vue | 20 ++++++++++--------- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java index a6fb9e766..b3d456381 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java @@ -115,7 +115,7 @@ public class BakingServiceImpl implements BakingService { hotParam.put("workorder_id", jsonRaw.getString("workorder_id")); hotParam.put("material_id", jsonMater.getString("material_id")); hotParam.put("qty", jsonRaw.get("productin_qty")); - hotParam.put("io_type", "1"); + hotParam.put("io_type", "0"); hotParam.put("qty_unit_id", jsonMater.getString("base_unit_id")); hotParam.put("task_id", task_id); hotParam.put("start_point_code", point_code1); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_02.wql b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_02.wql index 7d96249aa..dda1d48c1 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_02.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_02.wql @@ -89,7 +89,7 @@ PDM_BI_SlittingProductionPlan plan LEFT JOIN st_ivt_cutpointivt ivt ON ivt.ext_code = plan.resource_name WHERE - plan.STATUS < 09 + plan.STATUS <> '09' AND is_child_tz_ok = 0 AND diff --git a/lms/nladmin-ui/src/views/wms/pdm/bi/index.vue b/lms/nladmin-ui/src/views/wms/pdm/bi/index.vue index cc21488a1..d8b374444 100644 --- a/lms/nladmin-ui/src/views/wms/pdm/bi/index.vue +++ b/lms/nladmin-ui/src/views/wms/pdm/bi/index.vue @@ -425,7 +425,7 @@ + :min-width="flexWidth('un_plan_product_property1',crud.data,'子卷的物性值1',-220)"/> + + + + - - - + Date: Sat, 28 Jan 2023 09:30:16 +0800 Subject: [PATCH 13/15] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pda/st/rest/ProductInstorController.java | 7 ++++ .../pda/st/service/ProductInstorService.java | 2 + .../impl/ProductInstorServiceImpl.java | 42 +++++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/ProductInstorController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/ProductInstorController.java index eaec5b22f..a6c507c25 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/ProductInstorController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/ProductInstorController.java @@ -51,4 +51,11 @@ public class ProductInstorController { return new ResponseEntity<>(productInstorService.mendCode(whereJson),HttpStatus.OK); } + @PostMapping("/bale") + @Log("捆扎") + @ApiOperation("捆扎") + public ResponseEntity bale(@RequestBody JSONObject whereJson){ + return new ResponseEntity<>(productInstorService.bale(whereJson),HttpStatus.OK); + } + } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/ProductInstorService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/ProductInstorService.java index 52945d3e5..abdab87fe 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/ProductInstorService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/ProductInstorService.java @@ -21,4 +21,6 @@ public interface ProductInstorService { JSONObject confirm(JSONObject whereJson); JSONObject mendCode(JSONObject whereJson); + + JSONObject bale(JSONObject whereJson); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java index 2d95ae011..40bbca334 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductInstorServiceImpl.java @@ -6,6 +6,7 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; @@ -17,6 +18,7 @@ import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.WqlUtil; import org.nl.wms.ext.acs.service.impl.AcsToWmsServiceImpl; +import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl; import org.nl.wms.pda.st.service.CoolInService; import org.nl.wms.pda.st.service.ProductInstorService; import org.nl.wms.sch.manage.AbstractAcsTask; @@ -251,6 +253,7 @@ public class ProductInstorServiceImpl implements ProductInstorService { } @Override + @Transactional(rollbackFor = Exception.class) public JSONObject mendCode(JSONObject whereJson) { String vehicle_code = whereJson.getString("box_no"); if (ObjectUtil.isEmpty(vehicle_code)) throw new BadRequestException("木箱号不能为空"); @@ -266,4 +269,43 @@ public class ProductInstorServiceImpl implements ProductInstorService { jo.put("message", "补码成功!"); return jo; } + + @Override + @Transactional(rollbackFor = Exception.class) + public JSONObject bale(JSONObject whereJson) { + String vehicle_code = whereJson.getString("box_no"); + String point_code = whereJson.getString("point_code"); + + if (StrUtil.isEmpty(vehicle_code)) { + throw new BadRequestException("木箱码不能为空!"); + } + if (StrUtil.isEmpty(point_code)) { + throw new BadRequestException("点位不能为空!"); + } + + JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + vehicle_code + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(sub_jo)) { + throw new BadRequestException("未查询到该木箱对应的包装关系!"); + } + + String box_length = sub_jo.getString("box_length"); + String box_width = sub_jo.getString("box_width"); + String box_high = sub_jo.getString("box_high"); + + JSONArray array = new JSONArray(); + + JSONObject jsonLength = new JSONObject(); + jsonLength.put("device_code", point_code); + jsonLength.put("code", ""); + jsonLength.put("value", box_length); + array.add(jsonLength); + + // 调用接口返回数据 + WmsToAcsServiceImpl wmsToAcsServiceImpl = SpringContextHolder.getBean(WmsToAcsServiceImpl.class); + wmsToAcsServiceImpl.action(array); + + JSONObject jo = new JSONObject(); + jo.put("message", "捆扎成功!"); + return jo; + } } From 33ac8957fb2bfffa364fbb54351e971a8442c433 Mon Sep 17 00:00:00 2001 From: liuxy Date: Sat, 28 Jan 2023 16:30:08 +0800 Subject: [PATCH 14/15] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../st/service/impl/PdaCheckServiceImpl.java | 4 +++ .../java/org/nl/wms/pda/st/wql/PDA_CHECK.wql | 25 +++++++++++++++++-- .../instor/service/impl/CheckServiceImpl.java | 6 +++++ .../nl/wms/st/instor/wql/QST_IVT_CHECK.wql | 2 +- .../views/wms/st/inStor/check/CheckDialog.vue | 1 + 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PdaCheckServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PdaCheckServiceImpl.java index c17caa8bf..a89fedd10 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PdaCheckServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PdaCheckServiceImpl.java @@ -55,9 +55,13 @@ public class PdaCheckServiceImpl implements PdaCheckService { @Override public JSONObject checkQueryDtl(JSONObject whereJson) { + String box_no = whereJson.getString("box_no"); + JSONObject map = new JSONObject(); map.put("flag", "2"); map.put("check_code", whereJson.getString("check_code")); + if (ObjectUtil.isNotEmpty(box_no)) map.put("storagevehicle_code","%"+box_no+"%"); + JSONArray resultJSONArray = WQL.getWO("PDA_CHECK").addParamMap(map).process().getResultJSONArray(0); JSONObject jo = new JSONObject(); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_CHECK.wql b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_CHECK.wql index f3e33c2fe..e90986cc5 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_CHECK.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_CHECK.wql @@ -116,8 +116,8 @@ dtl.storagevehicle_code, mater.material_code, mater.material_name, - ROUND(dtl.base_qty) AS base_qty, - ROUND(dtl.fac_qty) AS fac_qty, + ROUND(dtl.base_qty,3) AS net_qty, + ROUND(dtl.fac_qty,3) AS fac_qty, dtl.qty_unit_name, ( CASE @@ -142,6 +142,10 @@ dtl.check_code = 输入.check_code ENDOPTION + OPTION 输入.storagevehicle_code <> "" + dtl.storagevehicle_code like 输入.storagevehicle_code + ENDOPTION + ENDSELECT ENDQUERY ENDIF @@ -186,3 +190,20 @@ ENDSELECT ENDQUERY ENDIF + + IF 输入.flag = "4" + QUERY + SELECT + SUM(net_weight) AS net_weight + FROM + pdm_bi_subpackagerelation + WHERE + 1=1 + + OPTION 输入.storagevehicle_code <> "" + package_box_sn = 输入.storagevehicle_code + ENDOPTION + + ENDSELECT + ENDQUERY + ENDIF diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/CheckServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/CheckServiceImpl.java index ef7ec4c14..231b3f948 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/CheckServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/service/impl/CheckServiceImpl.java @@ -187,6 +187,9 @@ public class CheckServiceImpl implements CheckService { jsonDtl.put("qty_unit_id", json.getLongValue("measure_unit_id")); jsonDtl.put("qty_unit_name", json.getString("qty_unit_name")); jsonDtl.put("status", "1"); + + JSONObject jsonSub = WQL.getWO("PDA_CHECK").addParam("flag", "4").addParam("storagevehicle_code", json.getString("storagevehicle_code")).process().uniqueResult(0); + jsonDtl.put("base_qty", jsonSub.getDoubleValue("net_weight")); dtlTab.insert(jsonDtl); } } @@ -286,6 +289,9 @@ public class CheckServiceImpl implements CheckService { jsonDtl.put("qty_unit_name", json.getString("qty_unit_name")); jsonDtl.put("status", "1"); jsonDtl.put("fac_qty", json.getDoubleValue("fac_qty")); + + JSONObject jsonSub = WQL.getWO("PDA_CHECK").addParam("flag", "4").addParam("storagevehicle_code", json.getString("storagevehicle_code")).process().uniqueResult(0); + jsonDtl.put("base_qty", jsonSub.getDoubleValue("net_weight")); dtlTab.insert(jsonDtl); } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_CHECK.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_CHECK.wql index 55b0f1299..350ae9f07 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_CHECK.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/instor/wql/QST_IVT_CHECK.wql @@ -341,7 +341,7 @@ CheckDtl.storagevehicle_id, CheckDtl.storagevehicle_code, CheckDtl.material_id, - CheckDtl.base_qty, + ROUND(CheckDtl.base_qty,3) AS base_qty, CheckDtl.qty_unit_id, CheckDtl.qty_unit_name, CheckDtl.STATUS, diff --git a/lms/nladmin-ui/src/views/wms/st/inStor/check/CheckDialog.vue b/lms/nladmin-ui/src/views/wms/st/inStor/check/CheckDialog.vue index 2e5855b06..5432c2387 100644 --- a/lms/nladmin-ui/src/views/wms/st/inStor/check/CheckDialog.vue +++ b/lms/nladmin-ui/src/views/wms/st/inStor/check/CheckDialog.vue @@ -108,6 +108,7 @@ + @@ -125,10 +127,11 @@ import { get } from '@/api/system/dictDetail' import { selectOpcList } from '@/api/acs/device/opc' import { download } from '@/api/data' import { downloadFile } from '@/utils' +import pagination from '@crud/Pagination' export default { name: 'Protocol', - components: { crudOperation, rrOperation }, + components: { crudOperation, rrOperation, pagination }, mixins: [presenter(), header(), crud()], cruds() { return CRUD({ diff --git a/acs/nladmin-ui/src/views/acs/instruction/index.vue b/acs/nladmin-ui/src/views/acs/instruction/index.vue index 7d5c0ed88..2b2ef30b4 100644 --- a/acs/nladmin-ui/src/views/acs/instruction/index.vue +++ b/acs/nladmin-ui/src/views/acs/instruction/index.vue @@ -110,7 +110,7 @@ - + @@ -133,13 +133,13 @@ - - - - - - - + + + + + + + @@ -169,6 +169,7 @@ + @@ -178,6 +179,7 @@ import crudInstruction from '@/api/acs/instruction/instruction' import CRUD, { presenter, header, form, crud } from '@crud/crud' import crudOperation from '@crud/CRUD.operation' import { getDicts } from '@/api/system/dict' +import pagination from '@crud/Pagination' const defaultForm = { instruction_id: null, @@ -218,7 +220,7 @@ const defaultForm = { export default { dicts: ['task_status'], name: 'Instruction', - components: { crudOperation }, + components: { crudOperation, pagination }, mixins: [presenter(), header(), form(defaultForm), crud()], cruds() { return CRUD({