| | |
| | | if (commandObj.getInteger("mode") == 3) { |
| | | //取放货 |
| | | short[] array = new short[4]; |
| | | array[0] = commandObj.getShort("taskNO");//任务号 |
| | | array[1] = commandObj.getShort("mode");//任务模式 |
| | | array[2] = commandObj.getShort("pick");//取货数据 |
| | | array[3] = commandObj.getShort("put");//放货数据 |
| | | array[0] = 1;//任务类型 |
| | | array[1] = commandObj.getShort("pick");//源站 |
| | | array[2] = commandObj.getShort("put");//目标站 |
| | | array[3] = commandObj.getShort("taskNo");//任务号 |
| | | resultData.put("commandData", array); |
| | | |
| | | result = siemensS7Net.Write("DB103.0", array); |
| | | result = siemensS7Net.Write("DB83.0", array); |
| | | if (result.IsSuccess) { |
| | | result2 = siemensS7Net.Write("DB103.8", (short) 1); |
| | | if (result2.IsSuccess) { |
| | | resultData.put("result", "success"); |
| | | } |
| | | resultData.put("result", "success"); |
| | | } |
| | | |
| | | resultData.put("commandResult1", JSON.toJSONString(result)); |
| | | resultData.put("commandResult2", JSON.toJSONString(result2)); |
| | | } else if (commandObj.getInteger("mode") == 4) { |
| | | //小车换层 |
| | | short[] array = new short[4]; |
| | | array[0] = commandObj.getShort("taskNO");//任务号 |
| | | array[1] = commandObj.getShort("mode");//任务模式 |
| | | array[2] = commandObj.getShort("pick");//取货数据 |
| | | array[3] = commandObj.getShort("put");//放货数据 |
| | | array[0] = 2;//任务类型 |
| | | array[1] = commandObj.getShort("pick");//源站 |
| | | array[2] = commandObj.getShort("put");//目标站 |
| | | array[3] = commandObj.getShort("taskNo");//任务号 |
| | | resultData.put("commandData", array); |
| | | |
| | | result = siemensS7Net.Write("DB103.0", array); |
| | | result = siemensS7Net.Write("DB83.0", array); |
| | | if (result.IsSuccess) { |
| | | result2 = siemensS7Net.Write("DB103.8", (short) 1); |
| | | if (result2.IsSuccess) { |
| | | resultData.put("result", "success"); |
| | | } |
| | | resultData.put("result", "success"); |
| | | } |
| | | |
| | | resultData.put("commandResult1", JSON.toJSONString(result)); |
| | | resultData.put("commandResult2", JSON.toJSONString(result2)); |
| | | } else if (commandObj.getInteger("mode") == 5) { |
| | | //提升机移动 |
| | | short[] array = new short[4]; |
| | | array[0] = commandObj.getShort("taskNO");//任务号 |
| | | array[1] = commandObj.getShort("mode");//任务模式 |
| | | array[2] = commandObj.getShort("pick");//取货数据 |
| | | array[3] = commandObj.getShort("put");//放货数据 |
| | | array[0] = 2;//任务类型 |
| | | array[1] = commandObj.getShort("pick");//源站 |
| | | array[2] = commandObj.getShort("put");//目标站 |
| | | array[3] = commandObj.getShort("taskNo");//任务号 |
| | | resultData.put("commandData", array); |
| | | |
| | | result = siemensS7Net.Write("DB103.0", array); |
| | | result = siemensS7Net.Write("DB83.0", array); |
| | | if (result.IsSuccess) { |
| | | result2 = siemensS7Net.Write("DB103.8", (short) 1); |
| | | if (result2.IsSuccess) { |
| | | resultData.put("result", "success"); |
| | | } |
| | | resultData.put("result", "success"); |
| | | } |
| | | |
| | | resultData.put("commandResult1", JSON.toJSONString(result)); |
| | | resultData.put("commandResult2", JSON.toJSONString(result2)); |
| | | } else if (commandObj.getInteger("mode") == 9996) { |
| | | //复位 |
| | | short[] array = new short[1]; |