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 829893b..2ae12d7 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 @@ -2,6 +2,7 @@ package org.nl.acs.device_driver.lnsh.lnsh_mixing_mill; 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 cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSONObject; @@ -276,16 +277,19 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen } else { this.instruction_require_time = date; HttpResponse result = acsToWmsService.enterOrder(json); - if (result.getStatus() == 200) { - this.writing(this.mode); - ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No); - if (this.mode == 4) { - dto.setOrder_status("2"); - } else if (this.mode == 3){ - dto.setOrder_status("0"); + if (ObjectUtil.isNotEmpty(result)) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { + ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No); + if (this.mode == 3) { + dto.setOrder_status("1"); + } else if (this.mode == 4) { + dto.setOrder_status("2"); + } + produceshiftorderService.update(dto); + this.writing(this.mode); + this.setRequireSucess(true); } - produceshiftorderService.update(dto); - requireSucess = true; } return true; } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDeviceDriver.java index d28d767..306baf9 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDeviceDriver.java @@ -31,10 +31,7 @@ import org.nl.wql.core.bean.WQLObject; import org.openscada.opc.lib.da.Server; import org.springframework.beans.factory.annotation.Autowired; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 晟华码垛机械手 @@ -599,12 +596,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri return; } - if (!this.itemProtocol.getIsonline()) { - this.setIsonline(false); - this.setIserror(true); - message = "信号量同步异常"; - //未联机 - } else if (mode == 0) { + if (mode == 0) { this.setIsonline(false); this.setIserror(true); message = "未联机"; @@ -882,9 +874,9 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri this.writing("to_one_qty",one_qty); this.writing("to_two_qty",two_qty); this.writing("to_tool_coordinate",tool_coordinate); - - } requireSucess = true; + + } return true; } } @@ -902,7 +894,11 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri } else { this.instruction_require_time = date; JSONObject json = new JSONObject(); - json.put("device_code",this.device_code); + String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); + String demosub = linkobj.substring(1,linkobj.length()-1); + String demoArray[] = demosub.split(","); + List demoList = Arrays.asList(demoArray); + json.put("device_code",demoList.get(put_station-1).replace("\"","")); json.put("qty",encoder_qty); json.put("vehicle_code",barcode); json.put("is_full","1"); @@ -968,8 +964,8 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); if (result.getStatus() == 200) { this.writing(this.mode); + requireSucess = true; } - requireSucess = true; return true; } } @@ -1053,8 +1049,9 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); if (result.getStatus() == 200) { this.writing(this.mode); + requireSucess = true; + } - requireSucess = true; return true; } } @@ -1072,16 +1069,20 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri } else { this.instruction_require_time = date; JSONObject json = new JSONObject(); - json.put("device_code",this.device_code); + String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); + String demosub = linkobj.substring(1,linkobj.length()-1); + String demoArray[] = demosub.split(","); + List demoList = Arrays.asList(demoArray); + json.put("device_code",demoList.get(put_station-1).replace("\"","")); json.put("type","4"); json.put("qty",encoder_qty); json.put("vehicle_code",barcode); HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); if (result.getStatus() == 200) { this.writing(this.mode); + requireSucess = true; } - requireSucess = true; return true; } } 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 4fb9b81..a8a7cf4 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 @@ -2,6 +2,7 @@ package org.nl.acs.device_driver.lnsh.lnsh_press; 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 cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSONObject; @@ -197,12 +198,8 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De return; } - if (!this.itemProtocol.getIsonline()) { - this.setIsonline(false); - this.setIserror(true); - message = "信号量同步异常"; //未联机 - } else if (mode == 0) { + if (mode == 0) { this.setIsonline(false); this.setIserror(true); message = "未联机"; @@ -303,17 +300,20 @@ public class LnshPressDeviceDriver extends AbstractOpcDeviceDriver implements De } else { this.instruction_require_time = date; HttpResponse result = acsToWmsService.enterOrder(json); - if (result.getStatus() == 200) { - this.writing(this.mode); - ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No); - if (this.mode == 4) { - dto.setOrder_status("2"); - } else if (this.mode == 3){ - dto.setOrder_status("0"); + if (ObjectUtil.isNotEmpty(result)) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { + ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No); + if (this.mode == 3) { + dto.setOrder_status("1"); + } else if (this.mode == 4) { + dto.setOrder_status("2"); + } + produceshiftorderService.update(dto); + this.writing(this.mode); + this.setRequireSucess(true); } - produceshiftorderService.update(dto); } - requireSucess = true; return true; } } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java index 71eb005..737f3bc 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java @@ -181,11 +181,6 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements //急停 if (this.isStop()) { - //未在线无心跳 - } else if (!this.itemProtocol.getIsonline()) { - this.setIsonline(false); - this.setIserror(true); - message = "信号量同步异常"; //未联机 } else if (mode == 0) { this.setIsonline(false); @@ -227,6 +222,12 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements putStorage(); } break; + case 7: + //申请出窑分配 + if (!requireSucess && this.move != 0) { + applyOuttoKiln(); + } + break; } switch (flag) { @@ -294,13 +295,12 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements json.put("type","2"); json.put("weight",weight); json.put("vehicle_code",barcode); - json.put("is_full","0"); + json.put("is_full","1"); HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); if (result.getStatus() == 200) { this.writing(this.mode); + requireSucess = true; } - - requireSucess = true; return true; } } @@ -334,6 +334,34 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements } + /** + * 申请出窑去包装 + * + * @param + */ + public synchronized boolean applyOuttoKiln() { + 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; + JSONObject json = new JSONObject(); + json.put("device_code",this.device_code); + json.put("vehicle_code",barcode); + HttpResponse result = acsToWmsService.applyOuttoKiln(json); + if (result.getStatus() == 200) { + JSONObject jo = JSONObject.parseObject(result.body()); + String is_package = jo.getString("is_package"); + this.writing(2,Integer.parseInt(is_package)); + this.writing(this.mode); + requireSucess = true; + } + + return true; + } + } + public boolean exe_error() { if (this.error == 0) { return true; diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java index 1280d63..687c749 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java @@ -25,6 +25,13 @@ public interface AcsToWmsService { */ HttpResponse applyIntoKiln(JSONObject json); + /** + * 申请出窑去包装 + * @param json + * @return + */ + HttpResponse applyOuttoKiln(JSONObject json); + /** * ACS向WMS申请机械手任务 */ diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 6b2237f..43c0806 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -142,7 +142,46 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } + @Override + public HttpResponse applyOuttoKiln(JSONObject json) { + try { + MDC.put(log_file_type, log_type); + String wmsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WMSURL); + AddressDto addressDto = addressService.findByCode("ispackage"); + String url = wmsurl + addressDto.getMethods_url(); + String device_code = json.getString("device_code"); + + String parent_device_code = ""; + JSONObject jo = new JSONObject(); + JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + device_code + "'").uniqueResult(0); + if (!device_json.isEmpty()) { + parent_device_code = (String) device_json.get("parent_storage_cell") == null ? device_code : (String) device_json.get("parent_storage_cell"); + } + jo.put("device_code", parent_device_code); + jo.putAll(json); + + log.info("applyOuttoKiln-----请求参数{}", jo.toString()); + HttpResponse result2 = null; + try { + //{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"} + result2 = HttpRequest.post(url) + .header("Authorization", token) + .body(String.valueOf(jo)) + .execute(); + System.out.println(result2); + } catch (Exception e) { + String msg = e.getMessage(); + //网络不通 + System.out.println(msg); + } + log.info("applyOuttoKiln-----输出参数{}", result2.body()); + return result2; + } finally { + MDC.remove(log_file_type); + } + + } @Override public HttpResponse applyIntoKiln(JSONObject json) { @@ -185,6 +224,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } + + @Override public HttpResponse lnshApplyTaskToWms(JSONObject json) { try { diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index e137894..e4bb4d5 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -12,9 +12,11 @@ import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine.LnshLaminatingMachineDeviceDriver; import org.nl.acs.device_driver.lnsh.lnsh_kiln_lane.LnshKilnLaneDeviceDriver; import org.nl.acs.device_driver.lnsh.lnsh_labeling_machine.LnshLabelingMachineDeviceDriver; +import org.nl.acs.device_driver.lnsh.lnsh_mixing_mill.LnshMixingMillDeviceDriver; import org.nl.acs.device_driver.lnsh.lnsh_package_pallet_manipulator.LnshPackagePalletManipulatorDeviceDriver; import org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator.LnshPalletizingManipulatorDeviceDriver; import org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.LnshPalletizingManipulatorSiteDeviceDriver; +import org.nl.acs.device_driver.lnsh.lnsh_press.LnshPressDeviceDriver; import org.nl.acs.device_driver.lnsh.lnsh_rgv.LnshRGVDeviceDriver; import org.nl.acs.device_driver.lnsh.lnsh_split_manipulator.LnshSplitManipulatorDeviceDriver; import org.nl.acs.device_driver.lnsh.lnsh_station.LnshStationDeviceDriver; @@ -254,109 +256,104 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { @Override public Map createOrder(String param) throws Exception { - try { - MDC.put(log_file_type, log_type); - JSONArray orders = JSONArray.parseArray(param); - log.info("createOrder--------------:输入参数:" + orders.toString()); - - for (int i = 0; i < orders.size(); i++) { - Boolean is_flag = false; - - JSONObject json = orders.getJSONObject(i); - String producetask_code = json.getString("producetask_code"); - String device_code = json.getString("device_code"); - String product_code = json.getString("product_code"); - String material_code = json.getString("material_code"); - String material_name = json.getString("material_name"); - String cust_code = json.getString("cust_code"); - String cust_name = json.getString("cust_name"); - String model = json.getString("model"); - String molten_pool = json.getString("molten_pool"); - String weight = json.getString("weight"); - String qty = json.getString("plan_qty"); - - if (StrUtil.isEmpty(producetask_code)) { - throw new WDKException("工单号不能为空"); - } + JSONArray orders = JSONArray.parseArray(param); + log.info("createOrder--------------:输入参数:" + orders.toString()); + + for (int i = 0; i < orders.size(); i++) { + Boolean is_flag = false; + + JSONObject json = orders.getJSONObject(i); + String producetask_code = json.getString("producetask_code"); + String device_code = json.getString("device_code"); + String material_code = json.getString("material_code"); + String material_name = json.getString("material_name"); + String cust_code = json.getString("cust_code"); + String cust_name = json.getString("cust_name"); + String model = json.getString("model"); + String molten_pool = json.getString("molten_pool"); + String weight = json.getString("weight"); + String qty = json.getString("plan_qty"); + String product_code = json.getString("product_code"); + + if (StrUtil.isEmpty(producetask_code)) { + throw new WDKException("工单号不能为空"); + } - Device device = DeviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device)) { - throw new Exception("未找到对应设备:" + device_code); - } + Device device = DeviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isEmpty(device)) { + throw new Exception("未找到对应设备:" + device_code); + } - LnshPackagePalletManipulatorDeviceDriver lnshPackagePalletManipulatorDeviceDriver; - LnshPalletizingManipulatorDeviceDriver lnshPalletizingManipulatorDeviceDriver; - RljnPackagePalletSplitManipulatorDeviceDriver rljnPackagePalletSplitManipulatorDeviceDriver; - if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorDeviceDriver) { - lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver(); - if (StrUtil.isEmpty(qty)) { - throw new WDKException("数量不能为空"); - } - if (StrUtil.isEmpty(material_code)) { - throw new WDKException("物料编号不能为空!"); - } - lnshPalletizingManipulatorDeviceDriver.writing("to_order_No", producetask_code); - lnshPalletizingManipulatorDeviceDriver.writing("to_material_qty", qty); - lnshPalletizingManipulatorDeviceDriver.writing("to_material_code", material_code); - is_flag = true; + LnshMixingMillDeviceDriver lnshMixingMillDeviceDriver; + LnshPressDeviceDriver lnshPressDeviceDriver; + LnshPackagePalletManipulatorDeviceDriver lnshPackagePalletManipulatorDeviceDriver; + if (device.getDeviceDriver() instanceof LnshMixingMillDeviceDriver) { + lnshMixingMillDeviceDriver = (LnshMixingMillDeviceDriver) device.getDeviceDriver(); + if (StrUtil.isEmpty(qty)) { + throw new WDKException("重量不能为空"); } - if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) { - lnshPackagePalletManipulatorDeviceDriver = (LnshPackagePalletManipulatorDeviceDriver) device.getDeviceDriver(); - if (StrUtil.isEmpty(qty)) { - throw new WDKException("数量不能为空"); - } - if (StrUtil.isEmpty(material_code)) { - throw new WDKException("物料编号不能为空!"); - } - lnshPackagePalletManipulatorDeviceDriver.writing("to_order_No", producetask_code); - lnshPackagePalletManipulatorDeviceDriver.writing("to_material_qty", qty); - lnshPackagePalletManipulatorDeviceDriver.writing("to_material_code", material_code); - is_flag = true; + if (StrUtil.isEmpty(material_code)) { + throw new WDKException("物料编号不能为空!"); } - - if (device.getDeviceDriver() instanceof RljnPackagePalletSplitManipulatorDeviceDriver) { - rljnPackagePalletSplitManipulatorDeviceDriver = (RljnPackagePalletSplitManipulatorDeviceDriver) device.getDeviceDriver(); - if (StrUtil.isEmpty(qty)) { - throw new WDKException("数量不能为空"); - } - if (StrUtil.isEmpty(material_code)) { - throw new WDKException("物料编号不能为空!"); - } - rljnPackagePalletSplitManipulatorDeviceDriver.writing("to_order_No", producetask_code); - rljnPackagePalletSplitManipulatorDeviceDriver.writing("to_material_qty", qty); - rljnPackagePalletSplitManipulatorDeviceDriver.writing("to_material_code", material_code); - is_flag = true; + lnshMixingMillDeviceDriver.writing("to_order_No",producetask_code); + lnshMixingMillDeviceDriver.writing("to_weight",qty); + lnshMixingMillDeviceDriver.writing("to_material_code",material_code); + is_flag = true; + } + if (device.getDeviceDriver() instanceof LnshPressDeviceDriver) { + lnshPressDeviceDriver = (LnshPressDeviceDriver) device.getDeviceDriver(); + if (StrUtil.isEmpty(qty)) { + throw new WDKException("数量不能为空"); + } + if (StrUtil.isEmpty(material_code)) { + throw new WDKException("物料编号不能为空!"); } - //下发成功后,写入工单信息表记录 - ProduceshiftorderDto dto = new ProduceshiftorderDto(); - dto.setOrder_code(producetask_code); - dto.setProduct_code(product_code); - dto.setDevice_code(device_code); - dto.setOrder_status("1"); - dto.setMaterial_code(material_code); - dto.setMaterial_name(material_name); - dto.setCust_code(cust_code); - dto.setCust_name(cust_name); - dto.setModel(model); - dto.setMolten_pool(molten_pool); - dto.setWeight(weight); - dto.setQty(qty); - produceshiftorderService.create(dto); + lnshPressDeviceDriver.writing("to_order_No",producetask_code); + lnshPressDeviceDriver.writing("to_qty",qty); + lnshPressDeviceDriver.writing("to_material_code",material_code); + is_flag = true; } + if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) { + lnshPackagePalletManipulatorDeviceDriver = (LnshPackagePalletManipulatorDeviceDriver) device.getDeviceDriver(); + if (StrUtil.isEmpty(qty)) { + throw new WDKException("数量不能为空"); + } + if (StrUtil.isEmpty(material_code)) { + throw new WDKException("物料编号不能为空!"); + } + lnshPackagePalletManipulatorDeviceDriver.writing("to_order_No",producetask_code); + lnshPackagePalletManipulatorDeviceDriver.writing("to_material_qty",qty); + lnshPackagePalletManipulatorDeviceDriver.writing("to_material_code",material_code); + is_flag = true; + } + //下发成功后,写入工单信息表记录 + + ProduceshiftorderDto dto = new ProduceshiftorderDto(); + dto.setDevice_code(device_code); + dto.setOrder_code(producetask_code); + dto.setOrder_status("1"); + dto.setMaterial_code(material_code); + dto.setMaterial_name(material_name); + dto.setCust_code(cust_code); + dto.setCust_name(cust_name); + dto.setModel(model); + dto.setMolten_pool(molten_pool); + dto.setWeight(weight); + dto.setQty(qty); + dto.setProduct_code(product_code); + produceshiftorderService.create(dto); - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK); - resultJson.put("message", "操作成功"); - resultJson.put("data", new JSONObject()); - log.info("createOrder--------------:输出参数" + resultJson.toString()); - return resultJson; - - } finally { - MDC.remove(log_file_type); } + JSONObject resultJson = new JSONObject(); + resultJson.put("status", HttpStatus.OK); + resultJson.put("message", "操作成功"); + resultJson.put("data", new JSONObject()); + log.info("createOrder--------------:输出参数" + resultJson.toString()); + return resultJson; } + @Override public Map updateDeviceGoodsFromWms(String param) { try { diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java index 5031423..33ded01 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java @@ -178,7 +178,7 @@ public class DeviceOpcProtocolRunable implements Runnable { } //设置值 - // accessor_value.setValue(item.getId(), value); + accessor_value.setValue(item.getId(), value); RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class); redisUtils.set(item.getId(), value); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcSynchronizeAutoRun.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcSynchronizeAutoRun.java index c703a1c..1ca65ab 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcSynchronizeAutoRun.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcSynchronizeAutoRun.java @@ -39,10 +39,10 @@ public class DeviceOpcSynchronizeAutoRun extends AbstractAutoRunnable { Map servers = this.opcServerManageService.queryAllServerMap(); Map>> pros; - do{ - Thread.sleep(1000L); - pros = this.deviceAppService.findAllFormatProtocolFromDriver(); - }while (ObjectUtil.isEmpty(pros)); + do{ + Thread.sleep(1000L); + pros = this.deviceAppService.findAllFormatProtocolFromDriver(); + }while (ObjectUtil.isEmpty(pros)); Set keys = pros.keySet(); Iterator var4 = keys.iterator(); System.out.println("test:" + var4.hasNext()); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index cd3010b..12f3429 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -335,105 +335,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { dto.setMaterial(startdevice.getMaterial_type()); StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; - if (StrUtil.equals(createTaskCheck, "1")) { - //判断起点为输送设备 - if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) { - if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { - standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() == 0) { - throw new Exception("任务起点需满足待机有货!"); - } - if (!StrUtil.isEmpty(standardInspectSiteDeviceDriver.getMaterial())) { - dto.setMaterial(standardInspectSiteDeviceDriver.getMaterial()); - } - } - if (startdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) startdevice.getDeviceDriver(); - if (startdevice.getHas_goods() == 0) { - throw new Exception("任务起点需满足有货!"); - } - if (!StrUtil.isEmpty(standardOrdinarySiteDeviceDriver.getMaterial())) { - dto.setMaterial(standardOrdinarySiteDeviceDriver.getMaterial()); - } - } - } - if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) { - if (nextdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) nextdevice.getDeviceDriver(); - if (nextdevice.getHas_goods() != 0) { - throw new Exception("任务终点需满足无货!"); - } - } - if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { - standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() != 0) { - throw new Exception("任务终点需满足待机无货!"); - } - } - } - } else { - //判断起点为输送设备 - if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) { - if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { - standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() == 0) { - throw new Exception("任务起点需满足待机有货!"); - } - if (!StrUtil.isEmpty(standardInspectSiteDeviceDriver.getMaterial())) { - dto.setMaterial(standardInspectSiteDeviceDriver.getMaterial()); - } - - } - - } - - if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) { -// if (nextdevice.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { -// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) nextdevice.getDeviceDriver(); -// if (nextdevice.getHas_goods() != 0) { -// throw new Exception("任务终点需满足无货!"); -// } -// } - - if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { - standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMode() != 2 || standardInspectSiteDeviceDriver.getMove() != 0) { - throw new Exception("任务终点需满足待机无货!"); - } - } - - JSONObject jo = new JSONObject(); - JSONObject jo2 = new JSONObject(); - if (!StrUtil.isEmpty(dto.getMaterial())) { - if (!StrUtil.equals(dto.getMaterial(), "1")) { - jo.put("hasGoodStatus", "2"); - jo.put("material_type", dto.getMaterial()); - } else { - jo.put("hasGoodStatus", "1"); - jo.put("material_type", "1"); - } - - } else { - jo.put("hasGoodStatus", "1"); - jo.put("material_type", "1"); - } - jo.put("device_code", dto.getStart_device_code()); - jo.put("quantity", dto.getQuantity()); - jo.put("remark", dto.getRemark()); - jo.put("batch", startdevice.getBatch()); - jo.put("islock", "true"); - deviceService.changeDeviceStatus(jo); - Device deviceByCode = deviceAppService.findDeviceByCode(dto.getNext_device_code()); - jo2.put("device_code", dto.getNext_device_code()); - jo2.put("hasGoodStatus", deviceByCode.getHas_goods()); - jo2.put("quantity", deviceByCode.getQuantity()); - jo2.put("remark", deviceByCode.getRemark()); - jo2.put("material_type", deviceByCode.getMaterial_type()); - jo2.put("batch", deviceByCode.getBatch()); - jo2.put("islock", "true"); - deviceService.changeDeviceStatus(jo2); - } - } WQLObject wo = WQLObject.getWQLObject("acs_task"); JSONObject json = (JSONObject) JSONObject.toJSON(dto); diff --git a/acs/hd/nladmin-system/src/main/resources/logback-spring.xml b/acs/hd/nladmin-system/src/main/resources/logback-spring.xml index 1ddd1bd..250d7bc 100644 --- a/acs/hd/nladmin-system/src/main/resources/logback-spring.xml +++ b/acs/hd/nladmin-system/src/main/resources/logback-spring.xml @@ -84,7 +84,7 @@ https://juejin.cn/post/6844903775631572999 - +