From 4164a587278c9799a33411a3b3dbe9fff47e1999 Mon Sep 17 00:00:00 2001 From: liuxy Date: Wed, 30 Nov 2022 14:36:23 +0800 Subject: [PATCH 1/3] =?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/StructivtServiceImpl.java | 4 ++++ .../nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql | 5 +++++ .../wms/pda/st/service/impl/PrintServiceImpl.java | 9 ++++----- .../service/impl/CheckOutBillServiceImpl.java | 14 +++++++++++--- .../nl/wms/st/outbill/wql/QST_IVT_CHECKOUTBILL.wql | 8 +++++++- .../src/views/wms/basedata/st/ivt/index.vue | 10 ++++++++++ lms/nladmin-ui/src/views/wms/st/outbill/AddDtl.vue | 10 ++++++++++ lms/nladmin-ui/src/views/wms/st/outbill/index.vue | 3 ++- 8 files changed, 53 insertions(+), 10 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructivtServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructivtServiceImpl.java index c676ee25d..14cf7e5a1 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructivtServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/StructivtServiceImpl.java @@ -44,6 +44,7 @@ public class StructivtServiceImpl implements StructivtService { String struct = MapUtil.getStr(whereJson, "struct"); String stor_id = MapUtil.getStr(whereJson, "stor_id"); String pcsn = MapUtil.getStr(whereJson, "pcsn"); + String sap_pcsn = MapUtil.getStr(whereJson, "sap_pcsn"); JSONObject map = new JSONObject(); map.put("flag", "1"); map.put("stor_id", stor_id); @@ -56,6 +57,9 @@ public class StructivtServiceImpl implements StructivtService { if (StrUtil.isNotEmpty(pcsn)) { map.put("pcsn", "%" + pcsn + "%"); } + if (StrUtil.isNotEmpty(sap_pcsn)) { + map.put("sap_pcsn", "%" + sap_pcsn + "%"); + } JSONObject jsonObject = WQL.getWO("QST_STRUCTIVT001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ivt.instorage_time desc"); return jsonObject; } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql index 7f0bd4cb4..ac60f54b1 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/QST_STRUCTIVT001.wql @@ -18,6 +18,7 @@ 输入.material TYPEAS s_string 输入.stor_id TYPEAS s_string 输入.pcsn TYPEAS s_string + 输入.sap_pcsn TYPEAS s_string [临时表] --这边列出来的临时表就会在运行期动态创建 @@ -82,6 +83,10 @@ ivt.pcsn like 输入.pcsn ENDOPTION + OPTION 输入.sap_pcsn <> "" + sub.sap_pcsn like 输入.sap_pcsn + ENDOPTION + OPTION 输入.stor_id <> "" attr.stor_id = 输入.stor_id ENDOPTION diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PrintServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PrintServiceImpl.java index 1c38bc4bb..328a06ee0 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PrintServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PrintServiceImpl.java @@ -19,9 +19,7 @@ import org.nl.wms.st.inbill.service.CheckOutBillService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; +import java.io.*; /** * @author liuxy @@ -107,7 +105,8 @@ public class PrintServiceImpl implements PrintService { file.createNewFile(); } fw = new FileWriter(filePath); - BufferedWriter bw = new BufferedWriter(fw); + OutputStreamWriter write = new OutputStreamWriter(new FileOutputStream(file), "utf-8"); + BufferedWriter bw = new BufferedWriter(write); bw.write("package_box_sn1,package_box_sn2,sale_order_name,product_description,product_name,width,pcsn,date_of_FG_inbound,box_weight,date_of_production,quanlity_in_box,quality_guaran_period,nspector,storage_conditions,weight\n"); bw.write(package_box_sn1 + "," @@ -128,6 +127,7 @@ public class PrintServiceImpl implements PrintService { ); bw.close(); + jo.put("message", "打印成功!"); } catch (Exception e) { jo.put("message", "打印失败!"+e.getMessage()); } finally { @@ -137,7 +137,6 @@ public class PrintServiceImpl implements PrintService { jo.put("message", "打印失败!"+e.getMessage()); } } - jo.put("message", "打印成功!"); return jo; } 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 5da90c5cd..98a2862b1 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 @@ -88,6 +88,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { map.put("flag", "7"); map.put("begin_time", MapUtil.getStr(whereJson, "begin_time")); map.put("end_time", MapUtil.getStr(whereJson, "end_time")); + map.put("sap_pcsn", MapUtil.getStr(whereJson, "sap_pcsn")); map.put("canuse_qty", "0"); if (StrUtil.isNotEmpty(map.get("material_code"))) { @@ -96,6 +97,9 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { if (StrUtil.isNotEmpty(map.get("pcsn"))) { map.put("pcsn", "%" + map.get("pcsn") + "%"); } + if (StrUtil.isNotEmpty(map.get("sap_pcsn"))) { + map.put("sap_pcsn", "%" + map.get("sap_pcsn") + "%"); + } JSONObject jo = WQL.getWO("QST_IVT_CHECKOUTBILL").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ivt.struct_code ASC"); return jo; } @@ -1838,7 +1842,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { } //判断是否存在未确认状态的分配记录 - JSONObject task = wo_dis.query("work_status <>'99' and iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0); + /* JSONObject task = wo_dis.query("work_status <>'99' and iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0); if (ObjectUtil.isNotEmpty(task)) { JSONArray ja00 = wo_dis.query("work_status ='00' and iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0); JSONArray jatotal = wo_dis.query("iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0); @@ -1847,7 +1851,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { } else { throw new BadRequestException("存在未确认状态的出库分配记录,不允许强制确认!"); } - } + }*/ //查询生成和未分配完的明细 JSONArray dtls = WQL.getWO("QST_IVT_CHECKOUTBILL") @@ -2450,7 +2454,11 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { // 订单号 String source_bill_code = jsonDtl.getString("source_bill_code"); if (ObjectUtil.isNotEmpty(source_bill_code)) { - oneMap.put("order_no",source_bill_code.substring(0,source_bill_code.indexOf("-"))); + try { + oneMap.put("order_no",source_bill_code.substring(0,source_bill_code.indexOf("-"))); + } catch (Exception e) { + oneMap.put("order_no",source_bill_code); + } } } String pageNow = String.valueOf(j + 1); // 页码 diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/QST_IVT_CHECKOUTBILL.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/QST_IVT_CHECKOUTBILL.wql index c807887ae..db2b2607e 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/QST_IVT_CHECKOUTBILL.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/QST_IVT_CHECKOUTBILL.wql @@ -45,6 +45,7 @@ 输入.sale_order_name TYPEAS s_string 输入.box_no TYPEAS s_string 输入.canuse_qty TYPEAS s_string + 输入.sap_pcsn TYPEAS s_string [临时表] --这边列出来的临时表就会在运行期动态创建 @@ -456,7 +457,8 @@ mater.material_name, mater.material_code, unit.unit_name AS qty_unit_name, - attr.storagevehicle_code AS box_no + attr.storagevehicle_code AS box_no, + sub.sap_pcsn FROM ST_IVT_StructIvt ivt LEFT JOIN md_me_materialbase mater ON mater.material_id = ivt.material_id @@ -472,6 +474,10 @@ mater.material_name like 输入.material_code) ENDOPTION + OPTION 输入.sap_pcsn <> "" + sub.sap_pcsn like 输入.sap_pcsn + ENDOPTION + OPTION 输入.pcsn <> "" ivt.pcsn like 输入.pcsn ENDOPTION diff --git a/lms/nladmin-ui/src/views/wms/basedata/st/ivt/index.vue b/lms/nladmin-ui/src/views/wms/basedata/st/ivt/index.vue index 414286d76..575e81342 100644 --- a/lms/nladmin-ui/src/views/wms/basedata/st/ivt/index.vue +++ b/lms/nladmin-ui/src/views/wms/basedata/st/ivt/index.vue @@ -57,6 +57,16 @@ class="filter-item" /> + + + diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/AddDtl.vue b/lms/nladmin-ui/src/views/wms/st/outbill/AddDtl.vue index 5e79d1508..22f846578 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/AddDtl.vue +++ b/lms/nladmin-ui/src/views/wms/st/outbill/AddDtl.vue @@ -31,6 +31,15 @@ class="filter-item" @keyup.enter.native="crud.toQuery" /> + @@ -50,6 +59,7 @@ + diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/index.vue b/lms/nladmin-ui/src/views/wms/st/outbill/index.vue index 13c952a0f..daa79da85 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/index.vue +++ b/lms/nladmin-ui/src/views/wms/st/outbill/index.vue @@ -331,7 +331,7 @@ export default { } else { this.work_flag = true } - if (current.bill_status === '50' || current.bill_status === '40') { + if (current.bill_status === '50' || current.bill_status === '40' || current.bill_status === '30') { this.confirm_flag = false } else { this.confirm_flag = true @@ -375,6 +375,7 @@ export default { confirm() { checkoutbill.confirm({ 'iostorinv_id': this.currentRow.iostorinv_id }).then(res => { this.querytable() + this.crud.notify('出库成功!', CRUD.NOTIFICATION_TYPE.SUCCESS) }) }, querytable() { From 1bcf3bd93ff46c02e0f4bc17c5decbf046832e20 Mon Sep 17 00:00:00 2001 From: liuxy Date: Wed, 30 Nov 2022 15:37:14 +0800 Subject: [PATCH 2/3] =?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/SectattrServiceImpl.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/SectattrServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/SectattrServiceImpl.java index 37d554e3a..c766ea2c7 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/SectattrServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/service/impl/SectattrServiceImpl.java @@ -85,10 +85,11 @@ public class SectattrServiceImpl implements SectattrService { @Transactional(rollbackFor = Exception.class) public void create(SectattrDto dto) { String sect_code = dto.getSect_code(); - SectattrDto sectattrDto = this.findByCode(sect_code); - if (sectattrDto != null && sectattrDto.getIs_delete().equals("0")) { - throw new BadRequestException("存在相同的库区编号"); - } + + WQLObject tab = WQLObject.getWQLObject("st_ivt_sectattr"); + JSONObject json2 = tab.query("sect_code = '" + sect_code + "' and stor_id = '" + dto.getStor_id() + "'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(json2)) throw new BadRequestException("存在相同仓库的库区编号"); + Long currentUserId = SecurityUtils.getCurrentUserId(); String nickName = SecurityUtils.getCurrentNickName(); String now = DateUtil.now(); @@ -116,11 +117,14 @@ public class SectattrServiceImpl implements SectattrService { throw new BadRequestException("被删除或无权限,操作失败!"); } - String sect_code = dto.getSect_code(); + /* String sect_code = dto.getSect_code(); SectattrDto sectattrDto = this.findByCode(sect_code); if (sectattrDto != null && !dto.getSect_id().equals(sectattrDto.getSect_id()) && sectattrDto.getIs_delete().equals("0")) { throw new BadRequestException("存在相同的库区编号"); - } + }*/ + String sect_code = dto.getSect_code(); + + WQLObject tab = WQLObject.getWQLObject("st_ivt_sectattr"); Long currentUserId = SecurityUtils.getCurrentUserId(); String nickName = SecurityUtils.getCurrentNickName(); @@ -135,6 +139,9 @@ public class SectattrServiceImpl implements SectattrService { WQLObject wo = WQLObject.getWQLObject("st_ivt_sectattr"); JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); wo.update(json); + + JSONArray resultJSONArray = tab.query("sect_code = '" + sect_code + "' and stor_id = '" + dto.getStor_id() + "'").getResultJSONArray(0); + if (resultJSONArray.size() > 1) throw new BadRequestException("存在相同仓库的库区编号"); } @Override From 56369014a937c560fa32c641c466797c94a00250 Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Wed, 30 Nov 2022 20:13:33 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- acs/nladmin-system/pom.xml | 50 +++---- .../run/TwoNDC2SocketConnectionAutoRun.java | 2 +- .../run/TwoNDCSocketConnectionAutoRun.java | 2 +- .../service/impl/DeviceServiceImpl.java | 47 +++++-- .../OvenGantryManipulatorDeviceDriver.java | 59 +++++--- .../SlitTwoManipulatorDeviceDriver.java | 132 +++++++++++------- .../service/impl/InstructionServiceImpl.java | 16 ++- 7 files changed, 200 insertions(+), 108 deletions(-) diff --git a/acs/nladmin-system/pom.xml b/acs/nladmin-system/pom.xml index 4349d76c0..264114491 100644 --- a/acs/nladmin-system/pom.xml +++ b/acs/nladmin-system/pom.xml @@ -45,21 +45,21 @@ commons-io 2.8.0 - - - - - - - - - - - - - - - + + org.apache.poi + poi + 4.1.2 + + + org.apache.poi + poi-ooxml + 4.1.2 + + + org.apache.poi + poi-ooxml-schemas + 4.1.2 + org.openscada.jinterop org.openscada.jinterop.core @@ -341,16 +341,16 @@ - - org.apache.poi - poi - 3.17 - - - org.apache.poi - poi-ooxml - 3.17 - + + + + + + + + + + xerces xercesImpl diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDC2SocketConnectionAutoRun.java b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDC2SocketConnectionAutoRun.java index 2b57b3488..c79eaa70b 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDC2SocketConnectionAutoRun.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDC2SocketConnectionAutoRun.java @@ -182,7 +182,7 @@ public class TwoNDC2SocketConnectionAutoRun extends AbstractAutoRunnable { log.info("未找到指令号{}对应的指令", ikey); break; } - instructionService.cancel(inst.getInstruction_id()); + instructionService.cancelNOSendAgv(inst.getInstruction_id()); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } else { //上报异常信息 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java index f63dcc685..9224c1503 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java @@ -184,7 +184,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { log.info("未找到指令号{}对应的指令", ikey); break; } - instructionService.cancel(inst.getInstruction_id()); + instructionService.cancelNOSendAgv(inst.getInstruction_id()); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } else { //上报异常信息 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java index 930c0b3e3..905e54c37 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java @@ -1590,16 +1590,23 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial Integer deviceCode = device_code + i; for (int j = 0; j <= rss.size(); j++) { Map map = new ListOrderedMap<>(); - if (j == rss.size()){ - map.put("设备编码",""); - map.put("读取地址",""); - map.put("读取意义",""); - map.put("",""); - map.put("写入地址",""); - map.put("写入意义",""); - list.add(map); - continue; + if (wss.size() > rss.size()){ + if (j == rss.size()){ + continue; + } + } else { + if (j == rss.size()){ + map.put("设备编码",""); + map.put("读取地址",""); + map.put("读取意义",""); + map.put("",""); + map.put("写入地址",""); + map.put("写入意义",""); + list.add(map); + continue; + } } + if (i == 0 && j ==0){ map.put("设备编码",""); }else { @@ -1627,6 +1634,28 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial list.add(map); System.out.println(map); } + if (wss.size() > rss.size()){ + int s = wss.size() - rss.size(); + for (int l = 0; l <= s + 1; l++) { + Map map = new ListOrderedMap<>(); + if (l == s + 1){ + map.put("设备编码",""); + map.put("读取地址",""); + map.put("读取意义",""); + map.put("",""); + map.put("写入地址",""); + map.put("写入意义",""); + list.add(map); + continue; + } + map.put("设备编码",deviceCode); + map.put("读取地址",""); + map.put("读取意义",""); + Map value = getValue(wss, rss.size() + l, dbInterval,i); + map.putAll(value); + list.add(map); + } + } } }else if (type.equals("v")){ for (int i = 0; i < numberSize; i++) { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java index c6db64740..771fa8be7 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -27,6 +27,7 @@ import org.nl.acs.opc.DeviceAppServiceImpl; import org.nl.acs.route.service.RouteLineService; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; +import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.wql.util.SpringContextHolder; import org.openscada.opc.lib.da.Server; import org.springframework.beans.factory.annotation.Autowired; @@ -54,7 +55,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i @Autowired AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); @Autowired - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); + DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); //工作模式 int mode = 0; @@ -168,7 +169,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task)); if (ObjectUtil.isNotEmpty(inst2)) { String start_device_code = inst2.getStart_device_code(); - Device device = appService.findDeviceByCode(start_device_code); + Device device = deviceAppService.findDeviceByCode(start_device_code); HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver(); @@ -186,7 +187,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i if (mode == 3 && action == 3 && move == 1 && task > 0) { Instruction instructionDto = instructionService.findByCode(String.valueOf(task)); String next_device_code = instructionDto.getNext_device_code(); - Device nextDevice = appService.findDeviceByCode(next_device_code); + Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver(); @@ -218,8 +219,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i acsToWmsService.feedbackTaskStatusToWms(array); String next_device_code = taskDto.getNext_device_code(); String start_device_code = taskDto.getStart_device_code(); - Device startDevice = appService.findDeviceByCode(start_device_code); - Device nextDevice = appService.findDeviceByCode(next_device_code); + Device startDevice = deviceAppService.findDeviceByCode(start_device_code); + Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; if (startDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startDevice.getDeviceDriver(); @@ -314,12 +315,24 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i instruction.setInstruction_status("1"); instruction.setUpdate_time(DateUtil.now()); instructionService.update(instruction); - int start_addrIndex = getDeviceCodeList.indexOf(instruction.getStart_device_code()); - int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code()); - writing("to_onset", String.valueOf(start_addrIndex + 1)); - writing("to_target", String.valueOf(next_addrIndex + 1)); - writing("to_task", instruction.getInstruction_code()); - writing("to_command", "1"); +// int start_addrIndex = getDeviceCodeList.indexOf(instruction.getStart_device_code()); +// int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code()); +// writing("to_onset", String.valueOf(start_addrIndex + 1)); +// writing("to_target", String.valueOf(next_addrIndex + 1)); + Device startDevice = deviceAppService.findDeviceByCode(instruction.getStart_device_code()); + Device nextDevice = deviceAppService.findDeviceByCode(instruction.getNext_device_code()); + if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))){ + throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); + } + if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))){ + throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); + } + String start_addr = startDevice.getExtraValue().get("address").toString(); + String next_addr = nextDevice.getExtraValue().get("address").toString(); + this.writing("to_onset", start_addr); + this.writing("to_target", next_addr); + this.writing("to_task", instruction.getInstruction_code()); + this.writing("to_command", "1"); this.setRequireSucess(true); return true; } else { @@ -371,12 +384,24 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i task.setUpdate_time(DateUtil.now()); taskserver.update(task); //根据获取托盘信息返回的结果 得到对应抓取工位/放货工位设备编码所在的索引位置 - int start_addrIndex = getDeviceCodeList.indexOf(start_device_code); - int next_addrIndex = putDeviceCodeList.indexOf(next_device_code); - writing("to_onset", String.valueOf(start_addrIndex + 1)); - writing("to_target", String.valueOf(next_addrIndex + 1)); - writing("to_task", instdto.getInstruction_code()); - writing("to_command", "1"); +// int start_addrIndex = getDeviceCodeList.indexOf(start_device_code); +// int next_addrIndex = putDeviceCodeList.indexOf(next_device_code); +// writing("to_onset", String.valueOf(start_addrIndex + 1)); +// writing("to_target", String.valueOf(next_addrIndex + 1)); + Device startDevice = deviceAppService.findDeviceByCode(instdto.getStart_device_code()); + Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code()); + if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))){ + throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); + } + if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))){ + throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); + } + String start_addr = startDevice.getExtraValue().get("address").toString(); + String next_addr = nextDevice.getExtraValue().get("address").toString(); + this.writing("to_onset", start_addr); + this.writing("to_target", next_addr); + this.writing("to_task", instdto.getInstruction_code()); + this.writing("to_command", "1"); this.setRequireSucess(true); } return true; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java index 92cff3cc8..26aa4facf 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java @@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -27,6 +28,7 @@ import org.nl.acs.opc.DeviceAppServiceImpl; import org.nl.acs.route.service.RouteLineService; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; +import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.wql.util.SpringContextHolder; import org.openscada.opc.lib.da.Server; import org.springframework.beans.factory.annotation.Autowired; @@ -54,11 +56,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl @Autowired DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - //当前指令1 - Instruction inst1 = null; - //当前指令2 - Instruction inst2 = null; - DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); //工作模式 @@ -138,6 +135,10 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl task2 = this.itemProtocol.getTask2(); if (mode != last_mode) { + if (mode == 2) { + this.setRequireHeadSucess(false); + this.setRequireBackSucess(false); + } logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode)); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode); } @@ -245,11 +246,10 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl if (StrUtil.equals(inst2.getInstruction_status(), "1")) { finish_instruction(inst2); JSONArray array = new JSONArray(); - TaskDto taskDto = taskserver.findByCode(inst1.getTask_code()); + TaskDto taskDto = taskserver.findByCode(inst2.getTask_code()); JSONObject map = new JSONObject(); map.put("task_id", taskDto.getExt_task_id()); map.put("task_status", "2"); - map.put("finished_type", "1"); array.add(map); acsToWmsService.feedbackTaskStatusToWms(array); writing("to_command2", "0"); @@ -260,9 +260,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl } } - //双任务 - 前工位取货时判断取货位光电信号 - if (mode == 3 && action1 == 1 && move1 == 0 && task1 > 0 && task2 > 0) { - Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1)); + //双任务 - 后工位取货时判断取货位光电信号 + if (mode == 3 && action2 == 1 && move2 == 0 && task1 > 0 && task2 > 0) { + Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task2)); String start_device_code = inst1.getStart_device_code(); Device startDevice = deviceAppservice.findDeviceByCode(start_device_code); SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; @@ -278,24 +278,24 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl } } - //单任务 - 前工位直接允许取货 - if (mode == 3 && action1 == 1 && move1 == 0 && task1 > 0 && task2 == 0) { + //单任务 - 后工位直接允许取货 + if (mode == 3 && action2 == 1 && move2 == 0 && task2 > 0 && task1 == 0) { this.writing("to_command1", "2"); } + //后工位允许放货 + if (mode == 3 && action2 == 3 && move2 == 1 && task2 > 0) { + this.writing("to_command1", "3"); + } + + //前工位允许放货 + if (mode == 3 && action1 == 1 && move1 == 0 && task1 > 0) { + this.writing("to_command2", "2"); + } + //前工位放货时判断放货位光电信号 if (mode == 3 && action1 == 3 && move1 == 1 && task1 > 0) { - this.writing("to_command1", "3"); - } - - //后工位取货时判断取货位光电信号 - if (mode == 3 && action2 == 2 && move2 == 0 && task2 > 0) { - this.writing("to_command2", "2"); - } - - //后工位放货时判断放货位光电信号 - if (mode == 3 && action2 == 3 && move2 == 1 && task2 > 0) { - Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task2)); + Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1)); String next_device_code = inst1.getNext_device_code(); Device nextDevice = deviceAppservice.findDeviceByCode(next_device_code); SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; @@ -306,7 +306,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl if (move == 0 && mode == 2) { this.writing("to_command2", "3"); } else { - log.warn("后工位放货位有货,放货位:{},mode:{},moce:{}", next_device_code, mode, move); + log.warn("后工位放货位有货,放货位:{},mode:{},move:{}", next_device_code, mode, move); } } } @@ -342,22 +342,26 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl return; case 2: //后工位申请任务 取空放空 - if (move2 == 0 && action2 == 0 && task2 == 0 && !requireHeadSucess) { + //mode == 2 && move2 == 0 && action2 == 0 && !requireBackSucess + if (move2 == 0 && action2 == 0 && !requireBackSucess) { instruction_require2(); logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move1:" + move1 + ",action1:" + action1 + ",move2:" + move2 + ",task1:" + task1 + ",requireHeadSucess:" + requireHeadSucess); } //前工位申请任务 取满放满 - if (move1 == 0 && action1 == 0 && task1 == 0 && move2 == 0 && task2 > 0 && !requireBackSucess) { + //mode == 2 && move2 == 0 && action2 == 0 && task2 == 0 && move1 == 0 && !requireHeadSucess + if (move1 == 0 && action1 == 0 && !requireHeadSucess) { instruction_require(); logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move2:" + move2 + ",action2:" + action2 + ",move1:" + move1 + ",task2:" + task2 + ",requireBackSucess:" + requireBackSucess); } break; case 3: //前工位申请任务 取满放满 - if (task2 > 0 && move2 == 1 && action2 == 1 && move1 == 0 && action1 == 0 && !requireBackSucess) { - instruction_require(); - logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move2:" + move2 + ",action2:" + action2 + ",move1:" + move1 + ",task2:" + task2 + ",requireBackSucess:" + requireBackSucess); - } + //mode == 3 && move2 == 1 && action2 == 1 && move1 == 0 && !requireHeadSucess +// if (mode == 3 && move2 == 1 && action2 == 1 && move1 == 0 && !requireHeadSucess) { +// instruction_require(); +// logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move2:" + move2 + ",action2:" + action2 + ",move1:" + move1 + ",task2:" + task2 + ",requireBackSucess:" + requireBackSucess); +// } + break; } } @@ -395,10 +399,18 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl instruction.setInstruction_status("1"); instruction.setUpdate_time(DateUtil.now()); instructionService.update(instruction); - int start_addrIndex = getDeviceCodeList.indexOf(instruction.getStart_device_code()); - int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code()); - this.writing("to_onset1", String.valueOf(start_addrIndex + 1)); - this.writing("to_target1", String.valueOf(next_addrIndex + 1)); + Device startDevice = deviceAppservice.findDeviceByCode(instruction.getStart_device_code()); + Device nextDevice = deviceAppservice.findDeviceByCode(instruction.getNext_device_code()); + if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { + throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); + } + if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) { + throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); + } + String start_addr = startDevice.getExtraValue().get("address").toString(); + String next_addr = nextDevice.getExtraValue().get("address").toString(); + this.writing("to_onset1", start_addr); + this.writing("to_target1", next_addr); this.writing("to_task1", instruction.getInstruction_code()); this.writing("to_command1", "1"); requireHeadSucess = true; @@ -454,11 +466,19 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl task.setUpdate_time(DateUtil.now()); taskserver.update(task); - //根据查询的任务起始点位 得出取放工位的索引值 写入后工位电气中 - int start_addrIndex = getDeviceCodeList.indexOf(start_device_code); - int next_addrIndex = putDeviceCodeList.indexOf(next_device_code); - this.writing("to_onset1", String.valueOf(start_addrIndex + 1)); - this.writing("to_target1", String.valueOf(next_addrIndex + 1)); + //根据查询的任务起始点位 得出取放工位的电气值 写入后工位电气中 + Device startDevice = deviceAppservice.findDeviceByCode(instdto.getStart_device_code()); + Device nextDevice = deviceAppservice.findDeviceByCode(instdto.getNext_device_code()); + if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { + throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); + } + if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) { + throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); + } + String start_addr = startDevice.getExtraValue().get("address").toString(); + String next_addr = nextDevice.getExtraValue().get("address").toString(); + this.writing("to_onset1", start_addr); + this.writing("to_target1", next_addr); this.writing("to_task1", instdto.getInstruction_code()); this.writing("to_command1", "1"); requireHeadSucess = true; @@ -491,10 +511,18 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl instruction.setInstruction_status("1"); instruction.setUpdate_time(DateUtil.now()); instructionService.update(instruction); - int start_addrIndex = getDeviceCodeList.indexOf(instruction.getStart_device_code()); - int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code()); - this.writing("to_onset2", String.valueOf(start_addrIndex + 1)); - this.writing("to_target2", String.valueOf(next_addrIndex + 1)); + Device startDevice = deviceAppservice.findDeviceByCode(instruction.getStart_device_code()); + Device nextDevice = deviceAppservice.findDeviceByCode(instruction.getNext_device_code()); + if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { + throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); + } + if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) { + throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); + } + String start_addr = startDevice.getExtraValue().get("address").toString(); + String next_addr = nextDevice.getExtraValue().get("address").toString(); + this.writing("to_onset2", start_addr); + this.writing("to_target2", next_addr); this.writing("to_task2", instruction.getInstruction_code()); this.writing("to_command2", "1"); requireBackSucess = true; @@ -549,11 +577,19 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl task.setTask_status("1"); taskserver.update(task); - //根据查询的任务起始点位 得出取放工位的索引值 写入后工位电气中 - int start_addrIndex = getDeviceCodeList.indexOf(start_device_code); - int next_addrIndex = putDeviceCodeList.indexOf(next_device_code); - this.writing("to_onset2", String.valueOf(start_addrIndex + 1)); - this.writing("to_target2", String.valueOf(next_addrIndex + 1)); + //根据查询的任务起始点位 得出取放工位的电气值 写入后工位电气中 + Device startDevice = deviceAppservice.findDeviceByCode(instdto.getStart_device_code()); + Device nextDevice = deviceAppservice.findDeviceByCode(instdto.getNext_device_code()); + if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) { + throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!"); + } + if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) { + throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!"); + } + String start_addr = startDevice.getExtraValue().get("address").toString(); + String next_addr = nextDevice.getExtraValue().get("address").toString(); + this.writing("to_onset2", start_addr); + this.writing("to_target2", next_addr); this.writing("to_task2", instdto.getInstruction_code()); this.writing("to_command2", "1"); requireBackSucess = true; 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 c80d93248..034ec9285 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 @@ -366,8 +366,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu } try { - String start_device_code = task.getStart_device_code(); - String next_device_code = task.getNext_device_code(); + String start_device_code = dto.getStart_device_code(); + String next_device_code = dto.getNext_device_code(); String route_plan_code = task.getRoute_plan_code(); List shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); RouteLineDto route = null; @@ -383,12 +383,14 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu if (ObjectUtil.isEmpty(route)) { throw new BadRequestException("未查询到相关路由!"); } - String agvType = paramService.findByCode("agvType").getValue(); - if (StrUtil.equals(agvType, "2")) { - NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class); - ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(),dto); - } + if (StrUtil.equals(shortPathsList.get(0).getType(), "1")){ + String agvType = paramService.findByCode("agvType").getValue(); + if (StrUtil.equals(agvType, "2")) { + NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class); + ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(),dto); + } + } } catch (Exception e) { dto.setSend_status("2"); e.printStackTrace();