From c796b96dbc431fb51a3685450196e60f49ab98cf Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Fri, 29 Jul 2022 15:15:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nl/acs/common/AbstractDriverService.java | 4 +- .../java/org/nl/acs/device/wql/task_inst.xls | Bin 155648 -> 155648 bytes .../driver/AbstractOpcDeviceDriver.java | 125 ++++++------------ .../StandardConveyorLineDeviceDriver.java | 79 ++++++++--- .../service/impl/AcsToWmsZDServiceImpl.java | 2 +- .../wms/service/impl/AgvToAcsServiceImpl.java | 35 +++-- .../modules/quartz/task/AutoCreateInst.java | 1 - .../src/main/java/org/nl/start/Init.java | 1 - 8 files changed, 130 insertions(+), 117 deletions(-) diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/common/AbstractDriverService.java b/hd/nladmin-system/src/main/java/org/nl/acs/common/AbstractDriverService.java index 6551da2..f427228 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/common/AbstractDriverService.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/common/AbstractDriverService.java @@ -163,7 +163,7 @@ public class AbstractDriverService implements DriverDeviceService { Method methodMode = driverClass.getMethod("getMode"); Integer nowMode = (Integer) methodMode.invoke(driver); Integer nowMove = (Integer) methodMove.invoke(driver); - if (nowMode != mode || nowMove != move) { + if (nowMove != move) { log.info("指令创建失败,起点mode或move不满足条件! 任务号:" + taskDto.getTask_code() + ",终点:" + startDeviceCode); taskDto.setRemark("指令创建失败,起点mode或move不满足条件! 起点:" + startDeviceCode); taskService.updateByCodeFromCache(taskDto); @@ -187,7 +187,7 @@ public class AbstractDriverService implements DriverDeviceService { Method methodMode = driverClass.getMethod("getMode"); Integer nowMode = (Integer) methodMode.invoke(driver); Integer nowMove = (Integer) methodMove.invoke(driver); - if (nowMode != mode || nowMove != move) { + if (nowMove != move) { log.info("指令创建失败,终点mode或move不满足条件! 任务号:" + taskDto.getTask_code() + ",终点:" + nextDeviceCode); taskDto.setRemark("指令创建失败,终点mode或move不满足条件! 终点:" + nextDeviceCode); taskService.updateByCodeFromCache(taskDto); diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device/wql/task_inst.xls b/hd/nladmin-system/src/main/java/org/nl/acs/device/wql/task_inst.xls index 59b80ac1d8d9b9087f0424a889214b4bd772c2d3..f3629c13aad9643499d27f362a21e75eaee52ad8 100644 GIT binary patch delta 1256 zcmZXUe@v8h9LL|^=bk(7p19-g;G~l>(CNk;D`qR*n%yRdcqCIY1=)y@L{_`1xNCmyUV*Tn5xVM%&9Z02TVE3;pdS$|Zz##vinSiPS+l0kd+d|%J^{dqpW zp6_Q*IPM6?9mhB6&beJ*_teKOi^p%>xY{V2^bRo~$MtK@@VBE^8~@W)!g|`UJcwmd zxz`GtvUy(DgeH$m3_*Z$joA2sWsPUKBv~CqS}0~X80Yz5|1a4 z6Uc!U&lzFIix@+|FYn9C)q?@|b+s<*-#u@aueu#+ z*d9&3g_fG;26JCqhR0?X~dSLA18V+pXCpToL}Crj=ipE3Y<5HRilB)ONYC)@HZ>yAlsaPcQp%g0Yl__vz)`ZFbU(&|W^ZICeCV1DjFZ2UrR#weS-@HHG`V;Kkbfue z7THG@RshTVz?)<*8LR|~=CBEJjO=I3Xf}|oK5YCV%{bV=P}|wt4jGNSt%_R9?bc`u za7-PF{4`6B#thd&e)oerfu>HD+r`)7@?75%Ro$)G^;(od)xCDz;bc$XA>kq33uN!} zKJPr-jdWQ29JJ)HaopNt4RTM!Ff3Fa=w^pK4A(332P)ORm(Odi`PA+Efe(1rM-Q2) z)VaPv!?pJ?P<)&X$63m->7()o!ZvYI9eel2To)duUx2rnyxL6et4t-gfkVOqY`k<` zUjA~65&W2^b%|r}^JMNSReb4FyFP>}q5M}i`-M%mjpe!A;5^aQ&C6<)C&p^D>|c{5 zeK+pWdL}kGM}`y0|4ovSrisC(3DI0ST^>xV)cVuylYb_Qyr|DV5Z|EP%s7AR)DQ8I W&o6*eh<9$Dxi;K4c%edDZ2K2|=1Hvp delta 1225 zcmZXUe@vBC7{|Zo<>mhJ-V0am73i0j+?-@e%nWp)cLio?vb>rS{uus9@rsETX9an2 zjBH{>_ar*4D<-x!H;0{qKXh_s)#gv6IhQRLo3%O7P1H7^EB1Z4Bth@HozFSX_dL&e zp7%L>tE1NHsI_^G?&$Wu_^t22FQR_?)Vu;&uJ05FWS`#c@LiphSMb%4UG*fk*%D?U zN2=t7B2k%K`!yltp_J5gp^3U;e_=M<_zmD#F9>`nWamir4y_MEk5u6v<*Ole*f)E$ zD)2l`YD1ArMysIuDDr3jS6##E>5;0Dm1S7%ai_Ab_?Y1_=JD}Ac2(+WNJ;kqxh|K_ z>+=FpZx`!+mXQRkGA%Phe<{53n##+}N>=-3L_DFu1|xBPv1P0F)*=}dL1V3pooiRG zzhCEk+pq;HXsO`8KJms^V&_TE2|8f6TgNHTY^~s(bFGzR@TCf;>h4G zRFnh*#`?)0z;&{R zteOMtG6B`E(8ml+p9{Qf0Zx-0WYMd@IxF{*56Km;F@_C@k+v~FXddt}Suh{)+Y!PY zP6n7k@O5B^gLBgE1io1Sw2*m)z`P{j2&u^FZ}31Duyr9&GZr{UUL{}f1NkYy3Gxi- zS_F)D1Eu6Pa)7k6Lk)|8CNf6a#uc-YH(ALz;7{@%nY#p-lL{Os+sN@tfhlRg9`Z2x zToEuU9SD<+WX@Zx<}u(V*-O?lX5?|etUAknw%ck04D}9BwnZK~)+jsr?5e2JZ%N!$ z0qj@DYyL3HNR3VU4(g^IRlwry+}5x18_#OaiR_2J8kqbkPYDmXdsW%)nHK#7mI-zA z^IKMtB=~aZ extends AbstractDeviceDriver implements } //信号值与上次值不一致时的日志 - public void writeLogInfo(String device_code,String name, int lastNumber, int nowNumber) { + public void writeLogInfo(String device_code, String name, int lastNumber, int nowNumber) { if (lastNumber != nowNumber) { this.execute_log.setResource(device_code, this.device.getDevice_name()); this.execute_log.log("设备:" + device_code + ",last_'" + name + "' -> '" + name + "':" + lastNumber + "->" + nowNumber); @@ -36,7 +37,7 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements } //判断信号是否异常 - public synchronized void signalIsException(T sonDriver){ + public synchronized void signalIsException(T sonDriver) { Class sonDriverClass = sonDriver.getClass(); try { Method methodItemProtocol = sonDriverClass.getMethod("getItemProtocol"); @@ -48,31 +49,31 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements for (Field field : fields) { //获取属性名字 String fieldName = field.getName(); - if (fieldName.contains("item_")){ - if (!fieldName.contains("to_")){ + if (fieldName.contains("item_")) { + if (!fieldName.contains("to_")) { String fieldValue = (String) field.get(fieldName); Method methodGet = null; try { methodGet = itemProtocol.getClass().getMethod("get" + initialUpperCase(fieldValue)); - }catch (Exception e){ + } catch (Exception e) { } Integer itemValue = 0; - if (ObjectUtil.isNotEmpty(methodGet)){ + if (ObjectUtil.isNotEmpty(methodGet)) { itemValue = (Integer) methodGet.invoke(itemProtocol); } - if (!fieldValue.equals("heartbeat")){ - Method methodSet =null; + if (!fieldValue.equals("heartbeat")) { + Method methodSet = null; try { methodSet = sonDriverClass.getMethod("set" + initialUpperCase(fieldValue), int.class); - } catch (Exception e){ + } catch (Exception e) { } - if (ObjectUtil.isNotEmpty(methodSet)){ + if (ObjectUtil.isNotEmpty(methodSet)) { try { - methodSet.invoke(sonDriver,itemValue); + methodSet.invoke(sonDriver, itemValue); Integer last_Number = (Integer) sonDriverClass.getMethod("getLast_" + fieldValue).invoke(sonDriver); Method writeLogInfo = sonDriverClass.getMethod("writeLogInfo", String.class, String.class, int.class, int.class); - writeLogInfo.invoke(sonDriver,deviceCode,fieldValue,last_Number,itemValue); - }catch (Exception e){ + writeLogInfo.invoke(sonDriver, deviceCode, fieldValue, last_Number, itemValue); + } catch (Exception e) { } } } @@ -80,41 +81,41 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements } } - Method methodIsonline = sonDriverClass.getMethod("setIsonline",Boolean.class); - Method methodIserror = sonDriverClass.getMethod("setIserror",Boolean.class); - Method methodMessage = sonDriverClass.getMethod("setMessage",String.class); + Method methodIsonline = sonDriverClass.getMethod("setIsonline", Boolean.class); + Method methodIserror = sonDriverClass.getMethod("setIserror", Boolean.class); + Method methodMessage = sonDriverClass.getMethod("setMessage", String.class); Method methodMode = sonDriverClass.getMethod("getMode"); Method methodError = sonDriverClass.getMethod("getError"); Integer mode = (Integer) methodMode.invoke(sonDriver); Integer error = (Integer) methodError.invoke(sonDriver); Boolean isonline = (Boolean) itemProtocol.getClass().getMethod("getIsonline").invoke(itemProtocol); - if (!isonline){ - methodIsonline.invoke(sonDriver,false); - methodIserror.invoke(sonDriver,true); - methodMessage.invoke(sonDriver,"信号量同步异常"); - }else if (mode == 0){ - methodIsonline.invoke(sonDriver,false); - methodIserror.invoke(sonDriver,true); - methodMessage.invoke(sonDriver,"未联机"); - }else if (error != 0){ - methodIsonline.invoke(sonDriver,false); - methodIserror.invoke(sonDriver,true); - methodMessage.invoke(sonDriver,"有报警"); + if (!isonline) { + methodIsonline.invoke(sonDriver, false); + methodIserror.invoke(sonDriver, true); + methodMessage.invoke(sonDriver, "信号量同步异常"); + } else if (mode == 0) { + methodIsonline.invoke(sonDriver, false); + methodIserror.invoke(sonDriver, true); + methodMessage.invoke(sonDriver, "未联机"); + } else if (error != 0) { + methodIsonline.invoke(sonDriver, false); + methodIserror.invoke(sonDriver, true); + methodMessage.invoke(sonDriver, "有报警"); } else { - methodIsonline.invoke(sonDriver,true); - methodIserror.invoke(sonDriver,false); + methodIsonline.invoke(sonDriver, true); + methodIserror.invoke(sonDriver, false); //判断是否符合生成任务的条件 Method methodIsSatisfyCreateTask = sonDriverClass.getMethod("isSatisfyCreateTask"); String methodName = (String) methodIsSatisfyCreateTask.invoke(sonDriver); - if (StrUtil.isNotEmpty(methodName)){ + if (StrUtil.isNotEmpty(methodName)) { Method methodTask = null; try { methodTask = sonDriverClass.getMethod(methodName); - }catch (Exception e){ + } catch (Exception e) { } - if (ObjectUtil.isNotEmpty(methodTask)){ + if (ObjectUtil.isNotEmpty(methodTask)) { methodTask.invoke(sonDriver); } //sonDriverClass.getMethod(methodName).invoke(sonDriver); @@ -125,12 +126,12 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements for (Field declaredField : declaredFields) { String fieldName = declaredField.getName(); Class fieldType = declaredField.getType(); - if (fieldType == int.class || fieldType == Integer.class){ - if (fieldName.contains("last_")){ + if (fieldType == int.class || fieldType == Integer.class) { + if (fieldName.contains("last_")) { Method method = null; try { - method = sonDriverClass.getMethod("set" + initialUpperCase(fieldName),int.class); - }catch(Exception e){ + method = sonDriverClass.getMethod("set" + initialUpperCase(fieldName), int.class); + } catch (Exception e) { } int index = fieldName.indexOf("last_"); @@ -138,15 +139,15 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Method methodSub = null; try { methodSub = sonDriverClass.getMethod("get" + initialUpperCase(subName)); - }catch(Exception e){ + } catch (Exception e) { } int nowItemValue = 0; - if (ObjectUtil.isNotEmpty(methodSub)){ + if (ObjectUtil.isNotEmpty(methodSub)) { nowItemValue = (int) methodSub.invoke(sonDriver); } - if (ObjectUtil.isNotEmpty(method)){ - method.invoke(sonDriver,nowItemValue); + if (ObjectUtil.isNotEmpty(method)) { + method.invoke(sonDriver, nowItemValue); } } } @@ -156,46 +157,8 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements } } - public void commonCreateTask(T driver){ - - } - //首字母转大写 - public String initialUpperCase(String str){ - return str.substring(0,1).toUpperCase() + str.substring(1,str.length()); - } - - public void writing(int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command; - - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); - - } - - public void writing(int type, int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_task; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - if (type == 1) { - itemMap.put(to_command, command); - } else if (type == 2) { - itemMap.put(to_target, command); - - } else if (type == 3) { - itemMap.put(to_task, command); - } - ReadUtil.write(itemMap, server); - + public String initialUpperCase(String str) { + return str.substring(0, 1).toUpperCase() + str.substring(1, str.length()); } } diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_line/StandardConveyorLineDeviceDriver.java b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_line/StandardConveyorLineDeviceDriver.java index 7e89fa2..cd225cf 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_line/StandardConveyorLineDeviceDriver.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_line/StandardConveyorLineDeviceDriver.java @@ -4,12 +4,14 @@ import cn.hutool.core.util.ObjectUtil; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.nl.acs.common.aspect.TaskAnnotation; 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.device_driver.driver.OpcDeviceDriver; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.opc.Device; @@ -17,7 +19,11 @@ import org.nl.acs.route.service.RouteLineService; import org.nl.acs.task.service.TaskService; import org.nl.utils.SpringContextHolder; import org.openscada.opc.lib.da.Server; +import org.springframework.aop.framework.AopContext; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; import java.util.Date; import java.util.HashMap; @@ -39,6 +45,7 @@ public class StandardConveyorLineDeviceDriver extends AbstractOpcDeviceDriver im RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl"); @Autowired TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl"); + String container; String container_type_desc; String last_container_type_desc; @@ -122,7 +129,7 @@ public class StandardConveyorLineDeviceDriver extends AbstractOpcDeviceDriver im } //判断是否符合生成任务的条件 - public String isSatisfyCreateTask(){ + public String isSatisfyCreateTask() { switch (flag) { //取货完成 case 1: @@ -134,9 +141,11 @@ public class StandardConveyorLineDeviceDriver extends AbstractOpcDeviceDriver im return null; } - return null; + return "createTask"; } + + public boolean exe_business() { return true; } @@ -171,32 +180,64 @@ public class StandardConveyorLineDeviceDriver extends AbstractOpcDeviceDriver im ReadUtil.write(itemMap, server); } + public void writing(int command) { + String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + ItemProtocol.item_to_command; + + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + itemMap.put(to_command, command); + ReadUtil.write(itemMap, server); + } + + public void writing(int type, int command) { + String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + ItemProtocol.item_to_command; + String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + ItemProtocol.item_to_target; + String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + ItemProtocol.item_to_task; + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + if (type == 1) { + itemMap.put(to_command, command); + } else if (type == 2) { + itemMap.put(to_target, command); + + } else if (type == 3) { + itemMap.put(to_task, command); + } + ReadUtil.write(itemMap, server); + + } - public void writeLogInfo(String device_code,String name, int lastNumber, int nowNumber) { - super.writeLogInfo(device_code,name,lastNumber,nowNumber); + public void writeLogInfo(String device_code, String name, int lastNumber, int nowNumber) { + super.writeLogInfo(device_code, name, lastNumber, nowNumber); if (lastNumber != nowNumber) { - if (name.equals("mode")){ + if (name.equals("mode")) { this.setRequireSucess(false); } } } - public String getStringValue(String key,int value){ - Map> map = new HashMap<>(); - Map modeMap = new HashMap<>(); - modeMap.put(0,"脱机"); - modeMap.put(1,""); - modeMap.put(2,"待机"); - map.put("mode",modeMap); - Map moveMap = new HashMap<>(); - moveMap.put(0,"无货"); - moveMap.put(1,"有货"); - map.put("move",moveMap); + public String getStringValue(String key, int value) { + Map> map = new HashMap<>(); + Map modeMap = new HashMap<>(); + modeMap.put(0, "脱机"); + modeMap.put(1, ""); + modeMap.put(2, "待机"); + map.put("mode", modeMap); + Map moveMap = new HashMap<>(); + moveMap.put(0, "无货"); + moveMap.put(1, "有货"); + map.put("move", moveMap); Map valuesMap = map.get(key); - if (ObjectUtil.isNotEmpty(valuesMap)){ - for(Map.Entry entry:valuesMap.entrySet()){ - if (value == (Integer)entry.getKey()){ + if (ObjectUtil.isNotEmpty(valuesMap)) { + for (Map.Entry entry : valuesMap.entrySet()) { + if (value == (Integer) entry.getKey()) { return (String) entry.getValue(); } } diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsZDServiceImpl.java b/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsZDServiceImpl.java index e46ab17..e03d9ad 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsZDServiceImpl.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsZDServiceImpl.java @@ -178,7 +178,7 @@ public class AcsToWmsZDServiceImpl implements AcsToWmsZDService { String taskCode = (String) whereJson.get("task_code"); String vehicle_code = (String) whereJson.get("carId"); HttpResponse result = null; - AddressDto addressDto = addressService.findByCode("feedbackTask"); + AddressDto addressDto = addressService.findByCode("taskFeedback"); String wcsurl = acsConfigService.findConfigFromCache().get(AcsConfig.WCSURL); String methods_url = addressDto.getMethods_url(); String url = wcsurl + methods_url; diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AgvToAcsServiceImpl.java b/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AgvToAcsServiceImpl.java index a3946a1..3fb70aa 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AgvToAcsServiceImpl.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AgvToAcsServiceImpl.java @@ -64,6 +64,7 @@ public class AgvToAcsServiceImpl implements AgvToAcsService { private final TaskService taskService; private final DeviceAppService deviceAppService; private final AcsToWmsZDServiceImpl acsToWmsZDService; + private final InstructionService instructionService; @Autowired LogServer logServer; @@ -71,25 +72,26 @@ public class AgvToAcsServiceImpl implements AgvToAcsService { @Override public Map waitpointRequest(JSONObject param) { // TODO 待定 - String task_code = param.getString("task_code"); + String inst_code = param.getString("task_code"); String car_id = param.getString("device_code"); String address = param.getString("address"); StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; StandardConveyorLineDeviceDriver standardConveyorLineDeviceDriver; - TaskDto taskDto = taskService.findByCode(task_code); + Instruction instructionDto = instructionService.findByCode(inst_code); + String task_code = instructionDto.getTask_code(); Map map = new HashMap<>(); Map feedMap = new HashMap(); feedMap.put("taskCode", task_code); feedMap.put("carId", car_id); - feedMap.put("taskType", taskDto.getTask_type()); - if (ObjectUtil.isEmpty(taskDto)) { + feedMap.put("taskType", instructionDto.getInstruction_type()); + if (ObjectUtil.isEmpty(instructionDto)) { map.put("status", 400); map.put("message", "操作失败"); return map; } String type = ""; - String start_device_code = taskDto.getStart_device_code(); - String next_device_code = taskDto.getNext_device_code(); + String start_device_code = instructionDto.getStart_device_code(); + String next_device_code = instructionDto.getNext_device_code(); if (address.contains("IN")) { String deviceCodeNow = address.substring(0, address.length() - 2); Device deviceNow = deviceAppService.findDeviceByCode(deviceCodeNow); @@ -99,14 +101,16 @@ public class AgvToAcsServiceImpl implements AgvToAcsService { if (standardConveyorLineDeviceDriver.getMove() == 1) { feedMap.put("feedbackStatus", "applyTake"); Map feedback = acsToWmsZDService.taskFeedback(feedMap); - int responseCode = (int) feedback.get("responseCode"); + int responseCode = Integer.parseInt((String) feedback.get("responseCode")); String responseMessage = (String) feedback.get("responseMessage"); if (responseCode == 0) { + feedback.put("feedbackStatus","“taking"); + acsToWmsZDService.taskFeedback(feedMap); map.put("status", 200); map.put("message", "操作成功"); type = "info"; } else { - logServer.log(task_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", car_id); + logServer.log(inst_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", car_id); map.put("status", 400); map.put("message", "操作失败"); type = "erro"; @@ -124,14 +128,16 @@ public class AgvToAcsServiceImpl implements AgvToAcsService { } else { feedMap.put("feedbackStatus", "applyPut"); Map feedback = acsToWmsZDService.taskFeedback(feedMap); - int responseCode = (int) feedback.get("responseCode"); + int responseCode = Integer.parseInt((String) feedback.get("responseCode")) ; String responseMessage = (String) feedback.get("responseMessage"); if (responseCode == 0) { + feedback.put("feedbackStatus","puting"); + acsToWmsZDService.taskFeedback(feedMap); map.put("status", 200); map.put("message", "操作成功"); type = "info"; } else { - logServer.log(task_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", car_id); + logServer.log(inst_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", car_id); map.put("status", 400); map.put("message", "操作失败"); type = "erro"; @@ -140,6 +146,7 @@ public class AgvToAcsServiceImpl implements AgvToAcsService { } } + return map; } if (address.contains("OUT")) { String deviceCodeNow = address.substring(0, address.length() - 3); @@ -158,7 +165,7 @@ public class AgvToAcsServiceImpl implements AgvToAcsService { map.put("message", "操作成功"); type = "info"; } else { - logServer.log(task_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", car_id); + logServer.log(inst_code, "waitpointRequest", "waitpointRequest", param.toString(), feedback.toString(), responseCode + "", "", car_id); map.put("status", 400); map.put("message", "操作失败"); type = "erro"; @@ -166,13 +173,14 @@ public class AgvToAcsServiceImpl implements AgvToAcsService { } else { map.put("status", 400); map.put("message", "操作失败"); + type = "erro"; } } else if (next_device_code.equals(deviceCodeNow)) { if (standardConveyorLineDeviceDriver.getMove() == 0) { map.put("status", 400); map.put("message", "操作失败"); type = "info"; - logServer.log(task_code, "waitpointRequest", type, param.toString(), "取货完成时,光电信号为0", "400", "waitpointRequest", car_id); + logServer.log(inst_code, "waitpointRequest", type, param.toString(), "取货完成时,光电信号为0", "400", "waitpointRequest", car_id); } else { //standardConveyorLineDeviceDriver.writing(1,2); feedMap.put("feedbackStatus", "putFinish"); @@ -191,7 +199,10 @@ public class AgvToAcsServiceImpl implements AgvToAcsService { } } } + return map; } + map.put("status",400); + map.put("message","操作失败,IN OUT 站点错误!"); return map; } } diff --git a/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java b/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java index 9f5eff7..0f31790 100644 --- a/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java +++ b/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java @@ -125,7 +125,6 @@ public class AutoCreateInst { instdto.setTask_id(taskid); instdto.setTask_code(taskcode); instdto.setVehicle_code(vehiclecode); - instdto.setRoute_plan_code(route_plan_code); String now = DateUtil.now(); instdto.setCreate_time(now); instdto.setCreate_by("auto"); diff --git a/hd/nladmin-system/src/main/java/org/nl/start/Init.java b/hd/nladmin-system/src/main/java/org/nl/start/Init.java index 6a63249..39a3100 100644 --- a/hd/nladmin-system/src/main/java/org/nl/start/Init.java +++ b/hd/nladmin-system/src/main/java/org/nl/start/Init.java @@ -36,7 +36,6 @@ public class Init implements ApplicationRunner { //初始化WQL initWql(); //随线程启动 - Thread.sleep(1000); initApplicationAutoInitialExecuter(); initWebAutoInitialExecuter(); //初始化任务调度