From d6c3595fccb13ccf96b68d84e4192296260b4253 Mon Sep 17 00:00:00 2001 From: loujf Date: Tue, 2 Aug 2022 09:35:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=8D=95=E5=8F=B7=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lnsh/lnsh_mixing_mill/ItemProtocol.java | 4 +-- .../LnshMixingMillDeviceDriver.java | 6 ++--- .../ItemProtocol.java | 8 +++--- ...hPackagePalletManipulatorDeviceDriver.java | 14 +++++----- .../lnsh/lnsh_press/ItemProtocol.java | 8 +++--- .../lnsh_press/LnshPressDeviceDriver.java | 14 +++++----- .../impl/ProduceshiftorderServiceImpl.java | 27 +++++++++++++++++++ 7 files changed, 54 insertions(+), 27 deletions(-) diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/ItemProtocol.java index 01b8992..08a5b28 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/ItemProtocol.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/ItemProtocol.java @@ -88,8 +88,8 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_to_error); } - public int getTo_order_No() { - return this.getOpcIntegerValue(item_to_order_No); + public String getTo_order_No() { + return this.getOpcStringValue(item_to_order_No); } public int getTo_command() { diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDeviceDriver.java index d643779..c18f31a 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDeviceDriver.java @@ -171,8 +171,8 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen logServer.deviceLog(this.device_code,"material" ,String.valueOf(material)); logServer.deviceLogToacs(this.device_code,"","","信号material:" + last_material + "->" + material); } - if (StrUtil.equals(order_No,last_order_No)) { - logServer.deviceLog(this.device_code,"order_No" ,String.valueOf(order_No)); + if (!StrUtil.equals(order_No,last_order_No)) { + logServer.deviceLog(this.device_code,"order_No" ,order_No); logServer.deviceLogToacs(this.device_code,"","","信号order_No:" + last_order_No + "->" + order_No); } if (mix_num != last_mix_num) { @@ -277,7 +277,7 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen HttpResponse result = acsToWmsService.enterOrder(json); if (result.getStatus() == 200) { this.writing(this.mode); - ProduceshiftorderDto dto = produceshiftorderService.findByCode(String.valueOf(order_No)); + ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No); if (this.mode == 4) { dto.setOrder_status("2"); } else if (this.mode == 3){ diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/ItemProtocol.java index 055c917..463336d 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/ItemProtocol.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/ItemProtocol.java @@ -208,8 +208,8 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_error_time); } - public int getOrder_No() { - return this.getOpcIntegerValue(item_order_No); + public String getOrder_No() { + return this.getOpcStringValue(item_order_No); } public int getProduct_code() { @@ -468,8 +468,8 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_to_material_code); } - public int getTo_order_No() { - return this.getOpcIntegerValue(item_to_order_No); + public String getTo_order_No() { + return this.getOpcStringValue(item_to_order_No); } public int getToProduct_code() { diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java index 3462b82..11e73e0 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java @@ -109,8 +109,8 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD String last_barcode; String material; String last_material; - int order_No = 0; - int last_order_No = 0; + String order_No = "0"; + String last_order_No = "0"; int qty = 0; int last_qty = 0; @@ -361,8 +361,8 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD logServer.deviceLog(this.device_code,"qty" ,String.valueOf(qty)); logServer.deviceLogToacs(this.device_code,"","","信号qty:" + last_qty + "->" + qty); } - if (order_No != last_order_No) { - logServer.deviceLog(this.device_code,"order_No" ,String.valueOf(order_No)); + if (!StrUtil.equals(order_No,last_order_No)) { + logServer.deviceLog(this.device_code,"order_No" ,order_No); logServer.deviceLogToacs(this.device_code,"","","信号order_No:" + last_order_No + "->" + order_No); } if (product_code != last_product_code) { @@ -631,7 +631,7 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD break; case 4: //排产单确认 - if (!requireSucess && order_No != 0) { + if (!requireSucess && !order_No.equals("0")) { JSONObject json = new JSONObject(); json.put("producetask_code",order_No); json.put("device_code",this.device_code); @@ -666,7 +666,7 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD } case 9: //工单完成 - if (!requireSucess && order_No != 0) { + if (!requireSucess && !order_No.equals("0")) { JSONObject json = new JSONObject(); json.put("producetask_code",order_No); json.put("device_code",this.device_code); @@ -788,7 +788,7 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD HttpResponse result = acsToWmsService.enterOrder(json); if (result.getStatus() == 200) { this.writing(this.mode); - ProduceshiftorderDto dto = produceshiftorderService.findByCode(String.valueOf(order_No)); + ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No); if (this.mode == 4) { dto.setOrder_status("0"); } else if (this.mode == 9){ diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/ItemProtocol.java index 9b08a7a..c0af21e 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/ItemProtocol.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/ItemProtocol.java @@ -90,8 +90,8 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_unqualified); } - public int getOrder_No() { - return this.getOpcIntegerValue(item_order_No); + public String getOrder_No() { + return this.getOpcStringValue(item_order_No); } public int getTo_command() { @@ -102,8 +102,8 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_to_error); } - public int getTo_order_No() { - return this.getOpcIntegerValue(item_to_order_No); + public String getTo_order_No() { + return this.getOpcStringValue(item_to_order_No); } public int getTo_qty() { diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDeviceDriver.java index 4e275a1..ab7d647 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_press/LnshPressDeviceDriver.java @@ -110,8 +110,8 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De int last_qualified = 0; int unqualified = 0; int last_unqualified = 0; - int order_No = 0; - int last_order_No = 0; + String order_No = "0"; + String last_order_No = "0"; @Override public Device getDevice() { @@ -187,8 +187,8 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De logServer.deviceLog(this.device_code,"unqualified" ,String.valueOf(unqualified)); logServer.deviceLogToacs(this.device_code,"","","信号unqualified:" + last_unqualified + "->" + unqualified); } - if (order_No != last_order_No) { - logServer.deviceLog(this.device_code,"order_No" ,String.valueOf(order_No)); + if (!StrUtil.equals(order_No,last_order_No)) { + logServer.deviceLog(this.device_code,"order_No" ,order_No); logServer.deviceLogToacs(this.device_code,"","","信号order_No:" + last_order_No + "->" + order_No); } @@ -225,7 +225,7 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De break; case 3: //排产单确认 - if (!requireSucess && order_No != 0) { + if (!requireSucess && !order_No.equals("0")) { JSONObject json = new JSONObject(); json.put("producetask_code",order_No); json.put("device_code",this.device_code); @@ -238,7 +238,7 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De break; case 4: //工单完成反馈 - if (!requireSucess && order_No != 0) { + if (!requireSucess && !order_No.equals("0")) { JSONObject json = new JSONObject(); json.put("producetask_code",order_No); json.put("device_code",this.device_code); @@ -304,7 +304,7 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De HttpResponse result = acsToWmsService.enterOrder(json); if (result.getStatus() == 200) { this.writing(this.mode); - ProduceshiftorderDto dto = produceshiftorderService.findByCode(String.valueOf(order_No)); + ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No); if (this.mode == 4) { dto.setOrder_status("2"); } else if (this.mode == 3){ diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java index 127ece0..89872a7 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java @@ -4,10 +4,14 @@ package org.nl.acs.order.service.impl; import cn.hutool.core.util.StrUtil; import lombok.RequiredArgsConstructor; +import org.nl.acs.config.AcsConfig; +import org.nl.acs.config.server.AcsConfigService; +import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.order.service.ProduceshiftorderService; import org.nl.acs.order.service.dto.ProduceshiftorderDto; import org.nl.exception.BadRequestException; import org.nl.wql.WQL; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -38,6 +42,12 @@ import lombok.extern.slf4j.Slf4j; @Slf4j public class ProduceshiftorderServiceImpl implements ProduceshiftorderService { + @Autowired + AcsToWmsService acsToWmsService; + + @Autowired + AcsConfigService acsConfigService; + @Override public Map queryAll(Map whereJson, Pageable page) { HashMap map = new HashMap<>(); @@ -151,7 +161,24 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService { @Override public void finish(String ids) { ProduceshiftorderDto dto = this.findById(ids); + if (dto == null) throw new BadRequestException("被删除或无权限,操作失败!"); + String currentUsername = SecurityUtils.getCurrentUsername(); + String now = DateUtil.now(); + dto.setUpdate_time(now); + dto.setUpdate_by(currentUsername); dto.setOrder_status("3"); this.update(dto); + + //判断是否为wms下发的排产单 + String hasWms = acsConfigService.findConfigFromCache().get(AcsConfig.HASWMS); + if (dto.getProduct_code().equals("wms") && hasWms.equals("1")) { + JSONObject json = new JSONObject(); + json.put("producetask_code",dto.getOrder_code()); + json.put("device_code",dto.getDevice_code()); + json.put("material_code",dto.getMaterial_code()); + json.put("qty",dto.getQty()); + json.put("type","3"); + acsToWmsService.enterOrder(json); + } } }