فهرست منبع

拆包机bug修复

zhangxin 1 سال پیش
والد
کامیت
44408ed7b3

+ 4 - 22
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/ams/WcsTaskController.java

@@ -12,7 +12,6 @@ import com.ruoyi.ams.task.form.AddTaskForm;
 import com.ruoyi.base.constant.Constant;
 import com.ruoyi.base.utils.IdSequenceUtils;
 import com.ruoyi.common.core.domain.model.LoginUser;
-import com.ruoyi.common.utils.StringUtils;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -108,32 +107,15 @@ public class WcsTaskController extends BaseController {
         return toAjax(wcsTaskService.deleteWcsTaskByTaskNos(taskNos));
     }
 
-    @Log(title = "取货任务完成", businessType = BusinessType.INSERT)
-    @PutMapping(value = "/taskPickupComplete/{taskNo}")
-    public AjaxResult taskPickupComplete(@PathVariable("taskNo") String taskNo) {
-        int agvNo = 9999;
-        WcsTask wcsTask = wcsTaskService.selectWcsTaskByTaskNo(taskNo);
-        if (wcsTask == null) {
-            return AjaxResult.error("任务回调失败");
-        }
-        if (StringUtils.isNotEmpty(wcsTask.getAgvNo())) {
-            agvNo = Integer.parseInt(wcsTask.getAgvNo());
-        }
-        return wcsTaskService.callBack(wcsTask.getTaskNo(), 4, agvNo);
-    }
-
-    @Log(title = "卸货任务完成", businessType = BusinessType.INSERT)
+    @Log(title = "任务完成", businessType = BusinessType.INSERT)
     @PutMapping(value = "/taskComplete/{taskNo}")
     public AjaxResult taskComplete(@PathVariable("taskNo") String taskNo) {
-        int agvNo = 9999;
         WcsTask wcsTask = wcsTaskService.selectWcsTaskByTaskNo(taskNo);
         if (wcsTask == null) {
-           return AjaxResult.error("任务回调失败");
-        }
-        if (StringUtils.isNotEmpty(wcsTask.getAgvNo())) {
-            agvNo = Integer.parseInt(wcsTask.getAgvNo());
+            AjaxResult.error("任务回调失败");
         }
-        return wcsTaskService.callBack(wcsTask.getTaskNo(), 4, agvNo);
+        wcsTaskService.callBackTaskComplete(wcsTask);
+        return AjaxResult.success("任务回调完成");
     }
 
     @Log(title = "任务取消", businessType = BusinessType.INSERT)

+ 16 - 11
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/test/ChargingMachineTestController.java

@@ -61,41 +61,46 @@ public class ChargingMachineTestController {
 
     /**
      * 开启充电机
+     *
+     * @param con true代表三向车 false代表迷你堆垛
      */
     @ApiOperation("开启充电机")
     @PostMapping("/sendOpen")
-    public Boolean sendOpen(int site) {
-        return chargingMachineClient.operation(ChargingMachineClient.CHARGER_ADDRESS_MEANING.START
-                , ChargingMachineClient.MACHINE_NO.getByNo(site));
+    public Boolean sendOpen(Boolean con) {
+        return chargingMachineClient.operation(ChargingMachineClient.CHARGER_ADDRESS_MEANING.START, con);
     }
 
     /**
      * 关闭充电机
+     *
+     * @param con true代表三向车 false代表迷你堆垛
      */
     @ApiOperation("关闭充电机")
     @PostMapping("/sendClose")
-    public Boolean sendClose(int site) {
-        return chargingMachineClient.operation(ChargingMachineClient.CHARGER_ADDRESS_MEANING.STOP
-                , ChargingMachineClient.MACHINE_NO.getByNo(site));
+    public Boolean sendClose(Boolean con) {
+        return chargingMachineClient.operation(ChargingMachineClient.CHARGER_ADDRESS_MEANING.STOP, con);
     }
 
     /**
      * 放电充电机
+     *
+     * @param con true代表三向车 false代表迷你堆垛
      */
     @ApiOperation("放电充电机")
     @PostMapping("/sendCharge")
-    public Boolean sendCharge(int site) {
-        return chargingMachineClient.operation(ChargingMachineClient.CHARGER_ADDRESS_MEANING.DISCHARGE
-                , ChargingMachineClient.MACHINE_NO.getByNo(site));
+    public Boolean sendCharge(Boolean con) {
+        return chargingMachineClient.operation(ChargingMachineClient.CHARGER_ADDRESS_MEANING.DISCHARGE, con);
     }
 
     /**
      * 查询充电机状态
+     *
+     * @param con true代表三向车 false代表迷你堆垛
      */
     @ApiOperation("查询充电机状态")
     @PostMapping("/readSts")
-    public Map<String, Boolean> readSts(int site) {
-        Map<String, Boolean> statusNameMapping = chargingMachineClient.getStatusNameMapping(ChargingMachineClient.MACHINE_NO.getByNo(site));
+    public Map<String, Boolean> readSts(Boolean con) {
+        Map<String, Boolean> statusNameMapping = chargingMachineClient.getStatusNameMapping(con);
         if (statusNameMapping != null) {
             log.info("查询充电机状态:" + JSONUtil.toJsonStr(statusNameMapping));
         }

+ 2 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/test/WcsTaskResponseController.java

@@ -31,7 +31,8 @@ public class WcsTaskResponseController {
     @ApiOperation("WcsTask任务反馈")
     @PostMapping("/responseState")
     public AjaxResult responseState(String taskNo, Integer state, Integer carNo) {
-        return iWcsTaskService.callBack(taskNo, state, carNo);
+        iWcsTaskService.callBack(taskNo, state, carNo);
+        return AjaxResult.success();
     }
 
 

+ 0 - 1
ruoyi-admin/src/main/resources/application-dev.yml

@@ -80,7 +80,6 @@ spring:
 
 # 日志配置
 logging:
-    config: classpath:logback-test.xml
     level:
         com.ruoyi: info
         org.springframework: info

+ 0 - 1
ruoyi-admin/src/main/resources/application-prod.yml

@@ -80,7 +80,6 @@ spring:
 
 # 日志配置
 logging:
-    config: classpath:logback.xml
     level:
         com.ruoyi: info
         org.springframework: info

+ 1 - 9
ruoyi-ui/src/api/ams/wcsTask.js

@@ -43,15 +43,7 @@ export function delWcsTask(taskNo) {
   })
 }
 
-//取货完成任务
-export function pickupCompleteWcsTask(taskNo) {
-  return request({
-    url: '/ams/wcsTask/taskPickupComplete/' + taskNo,
-    method: 'put'
-  })
-}
-
-//卸货完成任务
+//完成任务
 export function completeWcsTask(taskNo) {
   return request({
     url: '/ams/wcsTask/taskComplete/' + taskNo,

+ 21 - 50
ruoyi-ui/src/views/ams/task/index.vue

@@ -148,15 +148,15 @@
           v-hasPermi="['ams:wcsTask:add']"
         >新增</el-button>
       </el-col>
-<!--      <el-col :span="1.5">-->
-<!--        <el-button-->
-<!--          type="primary"-->
-<!--          plain-->
-<!--          icon="el-icon-plus"-->
-<!--          size="mini"-->
-<!--          @click="handleCharge"-->
-<!--        >充电任务</el-button>-->
-<!--      </el-col>-->
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleCharge"
+        >充电任务</el-button>
+      </el-col>
       <!--<el-col :span="1.5">
         <el-button
           type="success"
@@ -236,17 +236,11 @@
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
-            v-if="scope.row.state !== 4 && scope.row.state !== 2 && scope.row.state !== 11 && scope.row.state !== 12"
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handlePickupCompleted(scope.row)">取货完成</el-button>
-          <el-button
-            v-if="(scope.row.state == 4) || (scope.row.state !== 2 && scope.row.state !== 11 && scope.row.state !== 12)"
+            v-if="scope.row.state !== 7 && scope.row.state !== 2 && scope.row.state !== 11 && scope.row.state !== 12"
             size="mini"
             type="text"
             icon="el-icon-edit"
-            @click="handleComplete(scope.row)">卸货完成</el-button>
+            @click="handleComplete(scope.row)">完成</el-button>
           <el-button
             v-if="scope.row.state !== 7 && scope.row.state !== 2 && scope.row.state !== 11 && scope.row.state !== 12"
             size="mini"
@@ -282,7 +276,7 @@
             ></el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="是否转发" prop="taskType">
+        <el-form-item label="是否转发" prop="businessType">
           <el-select v-model="form.taskType" placeholder="请选择" clearable size="small" style="width: 100%">
             <el-option
               v-for="dict in taskTypeCombo"
@@ -433,7 +427,7 @@
     <!--充电-->
     <el-dialog :title="title" :visible.sync="chaegeOpen" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="车号" prop="agvNo">
+        <el-form-item label="车号" prop="businessType">
           <el-select v-model="form.agvNo" placeholder="请选择车辆" clearable size="small" style="width: 100%">
             <el-option
               v-for="dict in chargeCombo"
@@ -461,7 +455,6 @@ import {
   updateWcsTask,
   addTestTask,
   completeWcsTask,
-  pickupCompleteWcsTask,
   taskCancel,
   invDisposition,
   addChargeTask
@@ -607,7 +600,7 @@ export default {
     reset() {
       this.form = {
         taskNo: null,
-        businessType: "01",
+        businessType: null,
         whTypeFrom: null,
         whNoFrom: null,
         whTypeTo: null,
@@ -627,7 +620,7 @@ export default {
         createDate: null,
         updateUser: null,
         updateDate: null,
-        taskType: "Y",
+        taskType: null,
         shopId: null,
         startTime: null,
         endTime: null,
@@ -728,36 +721,14 @@ export default {
         ...this.queryParams
       }, `wcsTask_${new Date().getTime()}.xlsx`)
     },
-    handlePickupCompleted (row) {
-      const taskNos = row.taskNo
-      let vue = this
-      this.$modal.confirm('是否确认取货完成"' + taskNos + '"的任务?').then(function() {
-        pickupCompleteWcsTask(taskNos).then(response => {
-          console.log(response)
-          if (response.code == 200) {
-            vue.getList();
-            vue.$modal.msgSuccess(response.msg);
-          } else {
-            vue.getList();
-            vue.$modal.msgError(response.msg);
-          }
-        });
-      });
-    },
     handleComplete (row) {
       const taskNos = row.taskNo
-      const vue = this
-      this.$modal.confirm('是否确认卸货完成"' + taskNos + '"的任务?').then(function() {
-        completeWcsTask(taskNos).then(response => {
-          if (response.code === 200) {
-            vue.getList();
-            vue.$modal.msgSuccess(response.msg);
-          } else {
-            vue.getList();
-            vue.$modal.msgError(response.msg);
-          }
-        });
-      });
+      this.$modal.confirm('是否确认要完成"' + taskNos + '"的任务?').then(function() {
+        return completeWcsTask(taskNos);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("执行成功");
+      }).catch(() => {});
     },
     handleCancel (row) {
       const taskNos = row.taskNo

+ 1 - 1
ruoyi-ui/src/views/base/locationZone/index.vue

@@ -74,7 +74,7 @@
 
     <el-table v-loading="loading" :data="locationZoneList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="库区ID" align="center" prop="zoneId" />
+      <!--<el-table-column label="库区ID" align="center" prop="zoneId" />-->
       <el-table-column label="库区名称" align="center" prop="zoneName" />
       <el-table-column label="所属仓库" align="center" prop="warehouseName" />
       <el-table-column label="状态" align="center" prop="status">

+ 26 - 25
warewms-ams/src/main/java/com/ruoyi/ams/agv/ndc/AciService.java

@@ -2,7 +2,6 @@ package com.ruoyi.ams.agv.ndc;
 
 import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.thread.ThreadUtil;
 import com.alibaba.fastjson.JSON;
 import com.ruoyi.ams.agv.ndc.common.Aci;
 import com.ruoyi.ams.agv.ndc.common.ByteUtil;
@@ -142,29 +141,31 @@ public class AciService {
                             continue;
                         }
 //                        try {
-                        String order = amsHexdefineDetailService.concatOrder(t, basTask);
-                        log.info("writeOrder:" + order);
-                        if (t.getBusinessType().equals("01")) {
-
-                            buffer.put(ByteUtil.hexString2ByteArray(order));
-                            buffer.flip();
-                            socketChannel.write(buffer);
-                            buffer.clear();
-                            if (DateUtil.between(t.getAddtime(), new Date(), DateUnit.MINUTE) > 2) {
-                                t.setAciAccept(2);
-                                t.setRoadway("下发超时2分钟未接收自动取消");
+                            String order = amsHexdefineDetailService.concatOrder(t, basTask);
+                            log.info("writeOrder:" + order);
+                            if (t.getBusinessType().equals("m") ||
+                                    t.getBusinessType().equals("01")
+                            ) {
+
+                                buffer.put(ByteUtil.hexString2ByteArray(order));
+                                buffer.flip();
+                                socketChannel.write(buffer);
+                                buffer.clear();
+                                if (DateUtil.between(t.getAddtime(), new Date(), DateUnit.MINUTE) > 2) {
+                                    t.setAciAccept(2);
+                                    t.setRoadway("下发超时2分钟未接收自动取消");
+                                    amsTaskService.updateAmsTask(t);
+                                }
+                            } else {
+                                buffer.put(ByteUtil.hexString2ByteArray(order));
+                                buffer.flip();
+                                socketChannel.write(buffer);
+                                buffer.clear();
+                                // 修改已发送
+                                t.setAciAccept(1);
+                                t.setRoadway("TS请求反馈任务发送成功!");
                                 amsTaskService.updateAmsTask(t);
                             }
-                        } else {
-                            buffer.put(ByteUtil.hexString2ByteArray(order));
-                            buffer.flip();
-                            socketChannel.write(buffer);
-                            buffer.clear();
-                            // 修改已发送
-                            t.setAciAccept(1);
-                            t.setRoadway("TS请求反馈任务发送成功!");
-                            amsTaskService.updateAmsTask(t);
-                        }
 //                        } catch (Exception e) {
 //                            e.printStackTrace();
 //                            t.setServerAck(0);
@@ -219,14 +220,14 @@ public class AciService {
                     e.printStackTrace();
                 }
 
-            } catch (IOException i) {
-                log.error("NDC通讯异常!", i);
+            }catch (IOException i) {
+                log.error("NDC通讯异常!" ,i);
                 try {
                     socketChannel.close();
                 } catch (Exception exception) {
                     i.printStackTrace();
                 }
-            } catch (Exception e) {
+            }catch (Exception e) {
                 e.printStackTrace();
                 try {
                     socketChannel.close();

+ 2 - 10
warewms-ams/src/main/java/com/ruoyi/ams/agv/ndc/service/IAmsTaskService.java

@@ -1,9 +1,9 @@
 package com.ruoyi.ams.agv.ndc.service;
 
-import java.util.List;
-
 import com.ruoyi.ams.agv.ndc.domain.AmsTask;
 
+import java.util.List;
+
 /**
  * ams任务列表Service接口
  *
@@ -35,14 +35,6 @@ public interface IAmsTaskService {
      */
     AmsTask selectAmsTaskByModel(AmsTask amsTask);
 
-    /**
-     * 根据index号查询
-     *
-     * @param aciIndex
-     * @return
-     */
-    AmsTask selectAmsTaskByModel(Integer aciIndex);
-
     /**
      * 新增ams任务列表
      *

+ 5 - 11
warewms-ams/src/main/java/com/ruoyi/ams/agv/ndc/service/impl/AmsTaskServiceImpl.java

@@ -1,11 +1,12 @@
 package com.ruoyi.ams.agv.ndc.service.impl;
 
-import java.util.List;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.ruoyi.ams.agv.ndc.mapper.AmsTaskMapper;
 import com.ruoyi.ams.agv.ndc.domain.AmsTask;
+import com.ruoyi.ams.agv.ndc.mapper.AmsTaskMapper;
 import com.ruoyi.ams.agv.ndc.service.IAmsTaskService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
 
 /**
  * ams任务列表Service业务层处理
@@ -60,13 +61,6 @@ public class AmsTaskServiceImpl implements IAmsTaskService
         }
     }
 
-    @Override
-    public AmsTask selectAmsTaskByModel(Integer aciIndex) {
-        AmsTask amsTaskQuery = new AmsTask();
-        amsTaskQuery.setAciIndex(aciIndex);
-        return this.selectAmsTaskByModel(amsTaskQuery);
-    }
-
     /**
      * 新增ams任务列表
      *

+ 2 - 2
warewms-ams/src/main/resources/mapper/ams/FlowConfigHeaderMapper.xml

@@ -104,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>
             <if test="flowName != null  and flowName != ''"> and flow_name like concat('%', #{flowName}, '%')</if>
         </where>
-        order by id
+        order by create_time desc
     </select>
 
     <select id="selectFlowConfigHeaderDict" parameterType="Long" resultMap="FlowConfigHeaderResult">
@@ -265,4 +265,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectFlowConfigHeaderVo"/>
         where root_flow = #{headerId}
     </select>
-</mapper>
+</mapper>

+ 7 - 12
warewms-base/src/main/java/com/ruoyi/base/service/impl/BaseLocationInfoServiceImpl.java

@@ -19,9 +19,7 @@ import com.ruoyi.common.utils.StringUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
-import org.springframework.util.CollectionUtils;
 
 import java.util.ArrayList;
 import java.util.Date;
@@ -467,26 +465,23 @@ public class BaseLocationInfoServiceImpl implements IBaseLocationInfoService {
                         baseLocationInfo.setLocationNo(baseLocationInfo.getRowNo() + "-" + StringUtils.addZero(baseLocationInfo.getColNo(), 2) + "-" + StringUtils.addZero(baseLocationInfo.getColIndex().toString(), 2));
                     }
                 }
-                baseLocationInfo.setLocationNo(baseLocationInfo.getLocationNo().replaceAll("\t",""));
                 BaseLocationInfo b = baseLocationInfoMapper.selectBaseLocationInfoByLocationNo(baseLocationInfo.getLocationNo(), Constant.WAREHOUSE_ID);
                 if (b == null) {
                     //BeanValidators.validateWithException(validator, stu);
-                    baseLocationInfo.setStockStatus(Constant.STOCK_STATUS.STOCK00.getValue());
-                    baseLocationInfo.setIsEmpty(Constant.IS_YES.Y.name());
-                    baseLocationInfo.setWarehouseId(Constant.WAREHOUSE_ID);
                     baseLocationInfo.setCreateBy(opname);
                     baseLocationInfo.setCreateTime(new Date());
+                    baseLocationInfo.setStockStatus("00");
+                    baseLocationInfo.setIsEmpty("Y");
+                    baseLocationInfo.setWarehouseId(Constant.WAREHOUSE_ID);
+                    baseLocationInfo.setColNo(baseLocationInfo.getColNo());
                     this.insertBaseLocationInfo(baseLocationInfo);
                     successNum++;
                     successMsg.append("<br/>" + successNum + "、库位 " + baseLocationInfo.getLocationNo() + " 导入成功");
                 } else if (updateSupport) {
                     //BeanValidators.validateWithException(validator, stu);
-                    baseLocationInfo.setId(b.getId());
-                    baseLocationInfo.setStockStatus(null);
-                    baseLocationInfo.setIsEmpty(null);
-                    baseLocationInfo.setUpdateBy(opname);
-                    baseLocationInfo.setUpdateTime(new Date());
-                    this.updateBaseLocationInfo(baseLocationInfo);
+                    b.setUpdateBy(opname);
+                    b.setUpdateTime(new Date());
+                    this.updateBaseLocationInfo(b);
                     successNum++;
                     successMsg.append("<br/>" + successNum + "、库位 " + b.getLocationNo() + " 更新成功");
                 } else {

+ 15 - 78
warewms-hard/src/main/java/com/ruoyi/hard/ChargingMachineClient.java

@@ -8,9 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 
-import javax.annotation.PostConstruct;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
@@ -42,78 +40,13 @@ public class ChargingMachineClient {
     @Qualifier("modbusTcpMasterTemplateFifth")
     private ModbusTcpMasterTemplate modbusTcpMasterTemplateFifth;
 
-    private Map<String, ModbusTcpMasterTemplate> tcpMasterTemplateMap;
-
-    @PostConstruct
-    public void initMap() {
-        tcpMasterTemplateMap = new HashMap<>();
-        tcpMasterTemplateMap.put(MACHINE_NO.A.name(), modbusTcpMasterTemplateFourth);
-        tcpMasterTemplateMap.put(MACHINE_NO.B.name(), modbusTcpMasterTemplateFifth);
-    }
-
-    public ModbusMasterUtil getModbusMasterUtil(MACHINE_NO machineNo) {
-        return tcpMasterTemplateMap.get(machineNo.name()).getModbusMasterUtil();
-    }
-
-    /**
-     * 机器编号
-     */
-    public enum MACHINE_NO {
-        A("1",1),
-        B("2",2);
-
-        private String value;
-        private int no;
-
-        MACHINE_NO(String value,Integer no) {
-            this.value = value;
-            this.no = no;
-        }
-
-        public String getValue() {
-            return value;
-        }
-        public int getNo() {
-            return no;
-        }
-
-        /**
-         * 根据值获得枚举类型 switch
-         *
-         * @param value
-         * @return
-         */
-        public static MACHINE_NO getByValue(String value) {
-            for (MACHINE_NO code : values()) {
-                if (code.getValue().equals(value)) {
-                    return code;
-                }
-            }
-            return null;
-        }
-        /**
-         * 根据值获得枚举类型 switch
-         *
-         * @param no
-         * @return
-         */
-        public static MACHINE_NO getByNo(int no) {
-            for (MACHINE_NO code : values()) {
-                if (code.getNo() == no) {
-                    return code;
-                }
-            }
-            return null;
-        }
-    }
-
     /**
      * 充电机操作
      *
      * @param operation
      * @return
      */
-    public boolean operation(CHARGER_ADDRESS_MEANING operation, MACHINE_NO con) {
+    public boolean operation(CHARGER_ADDRESS_MEANING operation, boolean con) {
         switch (operation) {
             // 启动
             case START:
@@ -135,7 +68,7 @@ public class ChargingMachineClient {
      *
      * @return
      */
-    public Map<CHARGER_STATUS, Boolean> getStatusMapping(MACHINE_NO con) {
+    public Map<CHARGER_STATUS, Boolean> getStatusMapping(boolean con) {
         return ChargingMachineClient.CHARGER_STATUS.getMapping(getStatus(con));
     }
 
@@ -144,7 +77,7 @@ public class ChargingMachineClient {
      *
      * @return
      */
-    public Map<String, Boolean> getStatusNameMapping(MACHINE_NO con) {
+    public Map<String, Boolean> getStatusNameMapping(boolean con) {
         return ChargingMachineClient.CHARGER_STATUS.getNameMapping(getStatus(con));
     }
 
@@ -155,8 +88,9 @@ public class ChargingMachineClient {
      * 假设3个字节为:00000110 00000101 00000100
      * 则最终返回的数组:[0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
      */
-    public boolean[] getStatus(MACHINE_NO con) {
-        ModbusMasterUtil modbusMasterUtil = getModbusMasterUtil(con);
+    public boolean[] getStatus(boolean con) {
+        ModbusMasterUtil modbusMasterUtil = con ? modbusTcpMasterTemplateFourth.getModbusMasterUtil()
+                : modbusTcpMasterTemplateFifth.getModbusMasterUtil();
         ReadResponse read = modbusMasterUtil.readCoils(1, CHARGER_STATUS.getOffset(), CHARGER_STATUS.getCommand());
         if (read == null || read.getBooleanData() == null) {
             log.error("获取充电机状态为空!");
@@ -174,8 +108,9 @@ public class ChargingMachineClient {
      *
      * @return
      */
-    private boolean start(MACHINE_NO con) {
-        ModbusMasterUtil modbusMasterUtil = getModbusMasterUtil(con);
+    private boolean start(boolean con) {
+        ModbusMasterUtil modbusMasterUtil = con ? modbusTcpMasterTemplateFourth.getModbusMasterUtil()
+                : modbusTcpMasterTemplateFifth.getModbusMasterUtil();
         return modbusMasterUtil.writeCoil(1, START.getOffset(), START.getCommand());
     }
 
@@ -184,8 +119,9 @@ public class ChargingMachineClient {
      *
      * @return
      */
-    private boolean stop(MACHINE_NO con) {
-        ModbusMasterUtil modbusMasterUtil = getModbusMasterUtil(con);
+    private boolean stop(boolean con) {
+        ModbusMasterUtil modbusMasterUtil = con ? modbusTcpMasterTemplateFourth.getModbusMasterUtil()
+                : modbusTcpMasterTemplateFifth.getModbusMasterUtil();
         return modbusMasterUtil.writeCoil(1, STOP.getOffset(), STOP.getCommand());
     }
 
@@ -194,8 +130,9 @@ public class ChargingMachineClient {
      *
      * @return
      */
-    private boolean discharge(MACHINE_NO con) {
-        ModbusMasterUtil modbusMasterUtil = getModbusMasterUtil(con);
+    private boolean discharge(boolean con) {
+        ModbusMasterUtil modbusMasterUtil = con ? modbusTcpMasterTemplateFourth.getModbusMasterUtil()
+                : modbusTcpMasterTemplateFifth.getModbusMasterUtil();
         return modbusMasterUtil.writeCoil(1, DISCHARGE.getOffset(), DISCHARGE.getCommand());
     }