txf 3 år sedan
förälder
incheckning
122b978a0f

+ 1 - 1
pom.xml

@@ -116,7 +116,7 @@
                     <!--包名-->
                     <targetPackage>com.steerinfo.dil</targetPackage>
                     <tables>
-                        <param>QMS_QUEUE_LIST</param><!--运力-->
+                        <param>QMS_QUEUE_RESULT</param><!--运力-->
                     </tables>
                 </configuration>
                 <executions>

+ 38 - 33
src/main/java/com/steerinfo/dil/controller/QmsQueueListController.java

@@ -4,8 +4,8 @@ package com.steerinfo.dil.controller;
 import com.steerinfo.dil.service.impl.QmsQueueListServiceImpl;
 import com.steerinfo.dil.util.BaseRESTfulController;
 import com.steerinfo.dil.util.ColumnDataUtil;
-import com.steerinfo.dil.util.PageListAdd;
 import com.steerinfo.framework.controller.RESTfulResult;
+import com.steerinfo.framework.service.pagehelper.PageHelper;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
@@ -92,42 +92,42 @@ public class QmsQueueListController extends BaseRESTfulController {
         return success(i);
     }
 
-//    @ApiOperation(value="链表监控")
-//    @ApiImplicitParams({
-//            @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
-//            @ApiImplicitParam(name = "apiId(134)", value = "动态表头", required = false, dataType = "Integer"),
-//            @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
-//            @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
-//            @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
-//    })
-//    @PostMapping("/listMonitor")
-//    public RESTfulResult listMonitor(@RequestBody(required=false) Map<String,Object> mapValue,
-//                                           Integer apiId,
-//                                           Integer pageNum,
-//                                           Integer pageSize,
-//                                           String con
-//    ){
-//        if(con != null && !"".equals(con) && !"null".equals(con)){
-//            mapValue.put("index", con);
-//        }
-//        PageHelper.startPage(pageNum,pageSize);
-//        //分页数据
-//        List<Map<String, Object>> allListMonitor = qmsQueueListService.listMonitor(mapValue);
-//        List<Map<String, Object>> listMonitor = new ArrayList<>(allListMonitor);
-//        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allListMonitor,listMonitor);
-//        return success(pageList);
-//    }
-
-    @ApiOperation(value="仓库排队结束-->修改deleted = 1:运输订单号 或者 网格排队实绩 ID 取一个就行")
+    @ApiOperation(value="链表监控")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "mapValue", value = "运输订单号或者网格排队实绩ID取一个就行", required = false, dataType = "Map"),
+            @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
+            @ApiImplicitParam(name = "apiId(134)", value = "动态表头", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
     })
-    @PostMapping("/queueEndWarehouse")
-    public RESTfulResult queueEndWarehouse(@RequestBody(required=false) Map<String, Object> mapValue){
-        int i = qmsQueueListService.queueEndWarehouse(mapValue);
-        return success(i);
+    @PostMapping("/listMonitor")
+    public RESTfulResult listMonitor(@RequestBody(required=false) Map<String,Object> mapValue,
+                                           Integer apiId,
+                                           Integer pageNum,
+                                           Integer pageSize,
+                                           Integer isSpelling
+    ){
+        PageHelper.startPage(pageNum,pageSize);
+        //分页数据
+        if(isSpelling == 1){
+            //多拼
+            return success(qmsQueueListService.spellingListMonitor(mapValue));
+        }else {
+            //单拼
+            return success(qmsQueueListService.listMonitor(mapValue));
+        }
     }
 
+//    @ApiOperation(value="仓库排队结束-->修改deleted = 1:运输订单号 或者 网格排队实绩 ID 取一个就行")
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name = "mapValue", value = "运输订单号或者网格排队实绩ID取一个就行", required = false, dataType = "Map"),
+//    })
+//    @PostMapping("/queueEndWarehouse")
+//    public RESTfulResult queueEndWarehouse(@RequestBody(required=false) Map<String, Object> mapValue){
+//        int i = qmsQueueListService.queueEndWarehouse(mapValue);
+//        return success(i);
+//    }
+
 
 //    @ApiOperation(value="仓库链表监控")
 //    @ApiImplicitParams({
@@ -195,4 +195,9 @@ public class QmsQueueListController extends BaseRESTfulController {
     public RESTfulResult allowEnFactory(@RequestBody(required=false) Map<String, Object> mapValue){
         return success(qmsQueueListService.allowEnFactory(mapValue));
     }
+
+    @PostMapping("/calculateGatepost")
+    public int calculateGatepost(){
+        return qmsQueueListService.calculateGatepost().intValue();
+    }
 }

+ 2 - 4
src/main/java/com/steerinfo/dil/controller/QmsQueueResultController.java

@@ -181,15 +181,13 @@ public class QmsQueueResultController extends BaseRESTfulController {
             mapValue.put("locationId", locationId);
         if(capacityNumber != null && !"".equals(capacityNumber))
             mapValue.put("capacityNumber", capacityNumber);
+        PageHelper.startPage(pageNum,pageSize);
         if(isSpelling == 1){
             //多拼
             return success(qmsQueueResultService.getQueueListByQueueUpSpelling(mapValue));
         }else {
             //单拼
-            PageHelper.startPage(pageNum,pageSize);
-            //分页数据
-            List<Map<String, Object>> AllQueueList = qmsQueueResultService.getQueueListByQueueUp(mapValue);
-            return success(AllQueueList);
+            return success(qmsQueueResultService.getQueueListByQueueUp(mapValue));
         }
     }
 

+ 12 - 2
src/main/java/com/steerinfo/dil/mapper/QmsQueueListMapper.java

@@ -7,7 +7,9 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 
 @Mapper
 public interface QmsQueueListMapper extends IBaseMapper<QmsQueueList, BigDecimal> {
@@ -27,8 +29,11 @@ public interface QmsQueueListMapper extends IBaseMapper<QmsQueueList, BigDecimal
     //通过链表Id查询当前网格中所有的排队车数 以及最小的顺序号
     Map<String, Object> getQueueNumAndMin(BigDecimal gridId);
 
-    //链表监控
-//    List<Map<String, Object>> listMonitor(Map<String, Object> map);
+    //链表监控 查询全单拼物资排队车数
+    List<Map<String, Object>> listMonitor(Map<String, Object> map);
+
+    //链表监控 查询多拼物资排队车数
+    List<Map<String, Object>> spellingListMonitor(Map<String, Object> map);
 
     //通过运输订单号查询运输订单信息
     Map<String, Object> getOrderMesByOrderNum(String orderNumber);
@@ -59,4 +64,9 @@ public interface QmsQueueListMapper extends IBaseMapper<QmsQueueList, BigDecimal
     Integer getListGridNumber(Map<String, Object> map);
 
     Integer getSpellingGridNumber(Map<String, Object> map);
+
+    List<Map<String, Object>> getGatepostRules();
+
+    @Update("update TMSTRUCK_ENFACTORY_RESULT  set GATEPOST_ID = #{gatepostId} where RESULT_TOTAL_ID = #{resultTotalId}")
+    int udpateEnFactoryGatepostId(@Param("resultTotalId") BigDecimal resultTotalId, @Param("gatepostId") BigDecimal gatepostId);
 }

+ 3 - 0
src/main/java/com/steerinfo/dil/mapper/QueueInterfaceMapper.java

@@ -29,4 +29,7 @@ public interface QueueInterfaceMapper {
 
     @Update("update QMS_SUB_CAPACITY set SUB_STATUS  = 1,UPDATE_TIME = SYSDATE where CAPACITY_NUMBER = #{capacityNumber} and SUB_STATUS = 0")
     int cancelSubCapacity(@Param("capacityNumber")String capacityNumber);
+
+    @Select("select SUB_CAPACITY_ID from QMS_SUB_CAPACITY where CAPACITY_NUMBER = #{capacityNumber} and SUB_STATUS = 0 and rownum = 1")
+    Integer getSubCapacity(@Param("capacityNumber") String capacityNumber);
 }

+ 15 - 0
src/main/java/com/steerinfo/dil/model/QmsQueueResult.java

@@ -153,6 +153,12 @@ public class QmsQueueResult implements IBasePO<BigDecimal> {
     @ApiModelProperty(value="是否拼装 0:不是 1:是",required=false)
     private BigDecimal isSpelling;
 
+    /**
+     * 门岗ID(GATEPOST_ID,DECIMAL,0)
+     */
+    @ApiModelProperty(value="门岗ID",required=false)
+    private BigDecimal gatepostId;
+
     private static final long serialVersionUID = 1L;
 
     @Override
@@ -357,6 +363,14 @@ public class QmsQueueResult implements IBasePO<BigDecimal> {
         this.isSpelling = isSpelling;
     }
 
+    public BigDecimal getGatepostId() {
+        return gatepostId;
+    }
+
+    public void setGatepostId(BigDecimal gatepostId) {
+        this.gatepostId = gatepostId;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -387,6 +401,7 @@ public class QmsQueueResult implements IBasePO<BigDecimal> {
         sb.append(", listId=").append(listId);
         sb.append(", areaId=").append(areaId);
         sb.append(", isSpelling=").append(isSpelling);
+        sb.append(", gatepostId=").append(gatepostId);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");
         return sb.toString();

+ 2 - 2
src/main/java/com/steerinfo/dil/service/IQmsQueueListService.java

@@ -38,13 +38,13 @@ public interface IQmsQueueListService{
     int queueEndByPDA(BigDecimal resultTotalId);
 
     //链表监控
-//    List<Map<String, Object>> listMonitor(Map<String, Object> map);
+    List<Map<String, Object>> listMonitor(Map<String, Object> map);
 
     //发送数据给门禁系统
 //    int sendMessageToGatepost(String orderNumber);
 
     //仓库排队结束接口 :扫描第一件物资吊牌时间
-    int queueEndWarehouse(Map<String, Object> map);
+//    int queueEndWarehouse(Map<String, Object> map);
 
     //仓库链表监控
 //    List<Map<String, Object>> warehouseListMonitor(Map<String, Object> map);

+ 81 - 31
src/main/java/com/steerinfo/dil/service/impl/QmsQueueListServiceImpl.java

@@ -1,6 +1,5 @@
 package com.steerinfo.dil.service.impl;
 
-import com.steerinfo.dil.feign.TmsTruckFeign;
 import com.steerinfo.dil.mapper.QmsQueueResultMapper;
 import com.steerinfo.dil.mapper.QmsQueueSpellingListMapper;
 import com.steerinfo.dil.mapper.QueuingRulesMapper;
@@ -15,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.math.BigDecimal;
 
@@ -48,6 +48,47 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
 
     @Autowired
     private QmsQueueSpellingListMapper qmsQueueSpellingListMapper;
+
+
+    private final SimpleDateFormat gatepostTimeSdf = new SimpleDateFormat("HHmmss");
+    /**
+     * 根据时间计算钢材进厂门岗(钢材只有东门、桥西门能进厂)
+     * @return
+     */
+    public BigDecimal calculateGatepost(){
+        //查询东门,桥西门的进厂时间规则
+        try{
+            List<Map<String, Object>> gatepostRules = qmsQueueListMapper.getGatepostRules();
+            BigDecimal nowTime = DataChange.dataToBigDecimal(gatepostTimeSdf.format(new Date()));//获取当前时间
+            for (Map<String, Object> gatepostRule : gatepostRules) {
+                if(gatepostRule.get("startTime") != null && gatepostRule.get("endTime") != null){
+                    BigDecimal startTime = DataChange.dataToBigDecimal(gatepostRule.get("startTime"));
+                    BigDecimal endTime = DataChange.dataToBigDecimal(gatepostRule.get("endTime"));
+                    int i = startTime.compareTo(endTime);
+                    if(i == 0){
+                        return DataChange.dataToBigDecimal(gatepostRule.get("gatepostId"));
+                    }else{
+                        int j = nowTime.compareTo(startTime); // 1  当前时间大于开始时间
+                        int k = nowTime.compareTo(endTime); // -1   当前时间小于结束时间
+                        if(i > 0 ){ //开始时间比结束时间大 则是跨天
+                            if(j == 1 && k == -1){
+                                return  DataChange.dataToBigDecimal(gatepostRule.get("gatepostId"));
+                            }
+                        }else{ //没有跨天
+                            if(j == 1 && k == -1){
+                                return  DataChange.dataToBigDecimal(gatepostRule.get("gatepostId"));
+                            }
+                        }
+                    }
+                }
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return new BigDecimal(2);//默认桥西门
+    }
+
+
     /**
      * 开始排队  添加 链表排序 司机点击确认
      * @param resultId 排队实绩ID
@@ -57,6 +98,7 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
     public int addQueueList(BigDecimal resultId){
         //通过订单查询有几种物资
         Map<String, Object> mesMap = qmsQueueListMapper.getMaterialNumByOrderId(resultId);
+        //放入排队的门岗
         int materialNum = DataChange.dataToBigDecimal(mesMap.get("materialNum")).intValue();
         if(materialNum == 1){
             //单拼进入链表
@@ -64,13 +106,13 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
             if(qmsQueueListMapper.existsCapacity(mesMap.get("capacityId")) != null){
                 return 0;
             }
-            return addListResult(mesMap);
+            return addListResult(mesMap, calculateGatepost());
         }else {
             //多拼进入排队队列
             if(qmsQueueSpellingListMapper.existsCapacity(mesMap.get("capacityId")) != null){
                 return 0;
             }
-            return addSpellingListResult(mesMap);
+            return addSpellingListResult(mesMap, calculateGatepost());
         }
     }
 
@@ -79,7 +121,7 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
      * @param map
      * @return
      */
-    public int addListResult(Map<String, Object> map){
+    public int addListResult(Map<String, Object> map, BigDecimal gatepostId){
         QmsQueueList qmsQueueList = new QmsQueueList();
         //添加主键ID
         BigDecimal maxId = qmsQueueListMapper.selectMaxId();
@@ -99,7 +141,7 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
         qmsQueueList.setInsertTime(new Date());
         qmsQueueListMapper.insertSelective(qmsQueueList);
         //更新排队实绩表
-        updateQQR(resultId, maxId);
+        updateQQR(resultId, maxId, gatepostId, DataChange.dataToBigDecimal(map.get("resultTotalId")));
         return 1;
     }
 
@@ -108,7 +150,7 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
      * @param map
      * @return
      */
-    public int addSpellingListResult(Map<String, Object> map){
+    public int addSpellingListResult(Map<String, Object> map, BigDecimal gatepostId){
         QmsQueueSpellingList qmsQueueSpellingList = new QmsQueueSpellingList();
         BigDecimal maxId = qmsQueueSpellingListMapper.selectMaxId();
         qmsQueueSpellingList.setId(maxId);
@@ -122,7 +164,7 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
         //新增排序实绩
         qmsQueueSpellingListMapper.insertSelective(qmsQueueSpellingList);
         //更新排队实绩表
-        updateQQR(resultId, maxId);
+        updateQQR(resultId, maxId, gatepostId,DataChange.dataToBigDecimal(map.get("resultTotalId")));
         return 1;
     }
 
@@ -131,10 +173,15 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
      * @param resultId 实绩ID
      * @param listId 链表Id
      */
-    public void updateQQR(BigDecimal resultId, BigDecimal listId) {
+    public void updateQQR(BigDecimal resultId, BigDecimal listId, BigDecimal gatepostId, BigDecimal resultTotalId) {
         QmsQueueResult qmsQueueResult = new QmsQueueResult();
         qmsQueueResult.setListId(listId);
         qmsQueueResult.setResultId(resultId);
+        if(gatepostId != null){
+            qmsQueueResult.setGatepostId(gatepostId); // 门岗ID
+            //更新路段门岗
+            qmsQueueListMapper.udpateEnFactoryGatepostId(resultTotalId, gatepostId);
+        }
         qmsQueueResult.setResultAcceptTime(new Date()); //添加接收时间
         qmsQueueResult.setResultStartTime(new Date()); //添加排队开始时间
         qmsQueueResultMapper.updateByPrimaryKeySelective(qmsQueueResult);
@@ -323,42 +370,45 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
      * @param map
      * @return
      */
-//    @Override
-//    public List<Map<String, Object>> listMonitor(Map<String, Object> map) {
-//        return qmsQueueListMapper.listMonitor(map);
-//    }
+    @Override
+    public List<Map<String, Object>> listMonitor(Map<String, Object> map) {
+        return qmsQueueListMapper.listMonitor(map);
+    }
 
+    public List<Map<String, Object>> spellingListMonitor(Map<String, Object> map) {
+        return qmsQueueListMapper.spellingListMonitor(map);
+    }
 
     /**
      * 修改状态为 1 移出链表队列
      * @param listId
      * @return
      */
-    public int updateQueueListToDie(BigDecimal listId){
-        QmsQueueList qmsQueueList = new QmsQueueList();
-        qmsQueueList.setId(listId);
-        return qmsQueueListMapper.updateByPrimaryKeySelective(qmsQueueList);
-    }
+//    public int updateQueueListToDie(BigDecimal listId){
+//        QmsQueueList qmsQueueList = new QmsQueueList();
+//        qmsQueueList.setId(listId);
+//        return qmsQueueListMapper.updateByPrimaryKeySelective(qmsQueueList);
+//    }
 
     /**
      * 结束仓库排队
      * @param map {orderNumber 运输订单号}
      * @return
      */
-    public int queueEndWarehouse(Map<String, Object> map){
-        //通过运输订单号查询排队实绩ID 链表Id
-        map.putAll(qmsQueueListMapper.getQueueResultByOrderNumber(map));
-        BigDecimal resultId = DataChange.dataToBigDecimal(map.get("resultId")); //实绩Id
-        BigDecimal listId = DataChange.dataToBigDecimal(map.get("listId"));  //链表Id
-        //通过链表id修改链表对应数据 将此数据移出队列 deleted = 1
-        int i = updateQueueListToDie(listId);
-        //给排队实绩中添加数据
-        QmsQueueResult qmsQueueResult = new QmsQueueResult();
-        qmsQueueResult.setResultId(resultId);
-        qmsQueueResult.setResultEndTime(new Date());
-        int i1 = qmsQueueResultMapper.updateByPrimaryKeySelective(qmsQueueResult);
-        return i + i1;
-    }
+//    public int queueEndWarehouse(Map<String, Object> map){
+//        //通过运输订单号查询排队实绩ID 链表Id
+//        map.putAll(qmsQueueListMapper.getQueueResultByOrderNumber(map));
+//        BigDecimal resultId = DataChange.dataToBigDecimal(map.get("resultId")); //实绩Id
+//        BigDecimal listId = DataChange.dataToBigDecimal(map.get("listId"));  //链表Id
+//        //通过链表id修改链表对应数据 将此数据移出队列 deleted = 1
+//        int i = updateQueueListToDie(listId);
+//        //给排队实绩中添加数据
+//        QmsQueueResult qmsQueueResult = new QmsQueueResult();
+//        qmsQueueResult.setResultId(resultId);
+//        qmsQueueResult.setResultEndTime(new Date());
+//        int i1 = qmsQueueResultMapper.updateByPrimaryKeySelective(qmsQueueResult);
+//        return i + i1;
+//    }
 
     /**
      * 仓库排队监控

+ 34 - 16
src/main/java/com/steerinfo/dil/service/impl/QmsQueueResultServiceImpl.java

@@ -52,6 +52,34 @@ public class QmsQueueResultServiceImpl implements IQmsQueueResultService {
     @Autowired
     private QueueInterfaceMapper queueInterfaceMapper;
 
+    /**
+     * 取消订阅方法
+     */
+    public void cancelSub(String capacityNumber){
+        Map<String, Object> map = new HashMap<>();
+        map.put("capacityNumber", capacityNumber.split("_")[0] + "_2");
+        int j = queueInterfaceService.cancelSubsCapacity(map, 0);
+        if(j == -1){
+            System.out.println("取消订阅失败");
+        }else if(j == -2){
+            System.out.println("超过递归次数,取消订阅失败");
+        }else if(j == 1){
+            //修改订阅表 表示已取消订阅
+            queueInterfaceMapper.cancelSubCapacity(capacityNumber.split("_")[0]);
+        }
+    }
+
+    /**
+     * 特殊情况 查询是否订阅过 如订阅过则需要取消订阅
+     */
+    public void judgeCancelSub(String capacityNumber){
+        //查询订阅表是否已经订阅过如订阅过则取消订阅
+        Integer subCapacityId = queueInterfaceMapper.getSubCapacity(capacityNumber.split("_")[0]);
+        if(subCapacityId != null){
+            cancelSub(capacityNumber);
+        }
+    }
+
     /**
      * 新增进厂排队实绩
      * @param  capacityNumber 车牌号
@@ -62,27 +90,17 @@ public class QmsQueueResultServiceImpl implements IQmsQueueResultService {
         //获取传入的车牌号查找最近的运输订单号
         Map<String, Object> mesMap = queuingRulesMapper.getOrderNumberByCapacityNumber(capacityNumber.split("_")[0]);
         if(mesMap == null){
+            judgeCancelSub(capacityNumber); //判断是否需要取消订阅
             return -1;
         }else{
             if(DataChange.dataToBigDecimal(mesMap.get("orderType")).intValue() != 1){
+                judgeCancelSub(capacityNumber); //判断是否需要取消订阅
                 return -3; //非钢材订单不添加排队
             }
-            if(isPDA == null){
-                String insertUpdateRemark = String.valueOf(mesMap.get("insertUpdateRemark"));
-                if("电子围栏订阅成功".equals(insertUpdateRemark)){
-                    //如果是电子围栏调用,取消订阅 无论是否新增成功都取消
-                    Map<String, Object> map = new HashMap<>();
-                    map.put("capacityNumber", capacityNumber.split("_")[0] + "_2");
-                    int j = queueInterfaceService.cancelSubsCapacity(map, 0);
-                    if(j == -1){
-                        System.out.println("取消订阅失败");
-                    }else if(j == -2){
-                        System.out.println("超过递归次数,取消订阅失败");
-                    }else if(j == 1){
-                        //修改订阅表 表示已取消订阅
-                        queueInterfaceMapper.cancelSubCapacity(capacityNumber.split("_")[0]);
-                    }
-                }
+            String insertUpdateRemark = String.valueOf(mesMap.get("insertUpdateRemark"));
+            if("电子围栏订阅成功".equals(insertUpdateRemark)){
+                //如果是电子围栏调用,并且订阅成功了,则取消订阅
+                cancelSub(capacityNumber);
             }
         }
         Integer resultId = queuingRulesMapper.checkoutQQR(mesMap.get("resultTotalId"));

+ 45 - 40
src/main/resources/com/steerinfo/dil/mapper/QmsQueueListMapper.xml

@@ -453,46 +453,40 @@
       and DELETED = 0
   </select>
 
-<!--&lt;!&ndash;  链表监控 查询全部门岗排队车数 &ndash;&gt;-->
-<!--  <select id="listMonitor" resultType="java.util.LinkedHashMap">-->
-<!--    select *-->
-<!--    from (-->
-<!--        select-->
-<!--          RG.GATEPOST_ID "gatepostId",-->
-<!--        (-->
-<!--        select RG2.GATEPOST_NAME from RMS_GATEPOST RG2-->
-<!--        where RG2.GATEPOST_ID = RG.GATEPOST_ID-->
-<!--            ) "gatepostName",-->
-<!--          count(QQL.LIST_NODE_ORDER) "count"-->
-<!--        from RMS_GATEPOST RG-->
-<!--          left join QMS_QUEUE_GRID QQG-->
-<!--          on QQG.QUEUE_LOCATION_ID = RG.GATEPOST_ID and QQG.GRID_TYPE = 3-->
-<!--        LEFT JOIN QMS_QUEUE_LIST QQL-->
-<!--            on QQL.GRID_ID = QQG.GRID_ID and QQL.DELETED = 0-->
-<!--        group by RG.GATEPOST_ID-->
-<!--        ) t-->
-<!--    <where>-->
-<!--      <if test="index != null">-->
-<!--        instr(t."gatepostName", #{index}) > 0-->
-<!--      </if>-->
-<!--      <if test="gatepostName != null">-->
-<!--        and-->
-<!--        <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">-->
-<!--          "gatepostName" like '%${item}%'-->
-<!--        </foreach>-->
-<!--      </if>-->
-<!--      <if test="count != null">-->
-<!--        and-->
-<!--        <foreach collection="count" item="item" open="(" separator="or" close=")">-->
-<!--          "count" like '%${item}%'-->
-<!--        </foreach>-->
-<!--      </if>-->
-<!--    </where>-->
-<!--    <include refid="orderBy"></include>-->
-<!--    <if test="orderField == null  ">-->
-<!--      order by "count" desc, "gatepostId" asc-->
-<!--    </if>-->
-<!--  </select>-->
+<!--  链表监控 查询全单拼物资排队车数 -->
+  <select id="listMonitor" resultType="java.util.LinkedHashMap">
+        select
+               COUNT(QQL.LIST_ID)   "count",
+               QQL.GRID_ID      "gridId",
+               RM.MATERIAL_NAME "materialName",
+               RM.MATERIAL_SPECIFICATION    "materialSpecification",
+               RM.MATERIAL_MODEL    "materialModel"
+        from QMS_QUEUE_LIST QQL
+        left join QMS_QUEUE_GRID QQG on QQL.GRID_ID = QQG.GRID_ID
+        left join RMS_MATERIAL RM on QQG.QUEUE_LOCATION_ID = RM.MATERIAL_ID
+        <where>
+          <if test="materialList != null">
+           and QQG.QUEUE_LOCATION_ID in
+            <foreach collection="materialList" item="item" open="(" separator="," close=")">
+              ${item}
+            </foreach>
+          </if>
+        </where>
+        GROUP BY QQL.GRID_ID,
+                 RM.MATERIAL_NAME,
+                 RM.MATERIAL_SPECIFICATION,
+                 RM.MATERIAL_MODEL
+        order by "count" desc
+  </select>
+
+<!-- 查询多拼物资排队车数 -->
+  <select id="spellingListMonitor" parameterType="string" resultType="map">
+    select COUNT(QQSL.SPELLING_RESULT_ID) "count",
+           QQSL.SPELILING_NUM             "gridId"
+    from QMS_QUEUE_SPELLING_LIST QQSL
+    GROUP BY QQSL.SPELILING_NUM
+    order by "count" desc
+  </select>
 
 <!-- 通过运输订单号查询运输订单信息 -->
   <select id="getOrderMesByOrderNum" parameterType="string" resultType="java.util.Map">
@@ -588,6 +582,7 @@
              OO.CAPACITY_ID     "capacityId",
              QQR.GRID_ID        "gridId",
              QQR.RESULT_ID      "resultId",
+             QQR.RESULT_TOTAL_ID    "resultTotalId",
              (select COUNT(MATERIAL_ID)
               from OMSTRUCK_ORDER_MATERIAL OOM
               where OOM.ORDER_ID = OO.ORDER_ID) "materialNum"
@@ -623,6 +618,7 @@
     WHERE TER.RESULT_TOTAL_ID = #{resultTotalId}
   </update>
 
+
   <select id="getListSequenceNumber" parameterType="map" resultType="int">
     select COUNT(QQL.LIST_ID)
     from QMS_QUEUE_LIST QQL
@@ -658,4 +654,13 @@
     from QMS_QUEUE_SPELLING_LIST
     where SPELILING_NUM = #{gridId}
   </select>
+
+  <select id="getGatepostRules" resultType="map">
+        select GATEPOST_ID  "gatepostId",
+               RULES_GATEPOST_START_TIME    "startTime",
+               RULES_GATEPOST_END_TIME  "endTime"
+        from RMS_GATEPOST_RULES
+        where GATEPOST_ID = 1 or GATEPOST_ID = 2
+  </select>
+
 </mapper>

+ 113 - 109
src/main/resources/com/steerinfo/dil/mapper/QmsQueueResultMapper.xml

@@ -26,20 +26,22 @@
         <result column="LIST_ID" jdbcType="DECIMAL" property="listId" />
         <result column="AREA_ID" jdbcType="VARCHAR" property="areaId" />
         <result column="IS_SPELLING" jdbcType="DECIMAL" property="isSpelling" />
+        <result column="GATEPOST_ID" jdbcType="DECIMAL" property="gatepostId" />
     </resultMap>
     <sql id="columns">
-        RESULT_ID, RESULT_TOTAL_ID, CAPACITY_ID, RESULT_APPLYFOR_TIME, RESULT_APPLYFOR_LOCATION, 
-    GRID_ID, RESULT_DOWN_TIME, RESULT_ACCEPT_TIME, RESULT_START_TIME, RESULT_END_TIME, 
-    RESULT_CANCEL_TIME, RESULT_CANCEL_REASON, RESULT_INSERT_TIME, RESULT_INSERT_REASON, 
-    RESULT_TRANSFER_TIME, RESULT_TRANSFER_REASON, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, 
-    UPDATE_TIME, INSERT_UPDATE_REMARK, LIST_ID, AREA_ID, IS_SPELLING
+        RESULT_ID, RESULT_TOTAL_ID, CAPACITY_ID, RESULT_APPLYFOR_TIME, RESULT_APPLYFOR_LOCATION,
+    GRID_ID, RESULT_DOWN_TIME, RESULT_ACCEPT_TIME, RESULT_START_TIME, RESULT_END_TIME,
+    RESULT_CANCEL_TIME, RESULT_CANCEL_REASON, RESULT_INSERT_TIME, RESULT_INSERT_REASON,
+    RESULT_TRANSFER_TIME, RESULT_TRANSFER_REASON, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
+    UPDATE_TIME, INSERT_UPDATE_REMARK, LIST_ID, AREA_ID, IS_SPELLING, GATEPOST_ID
     </sql>
     <sql id="columns_alias">
-        t.RESULT_ID, t.RESULT_TOTAL_ID, t.CAPACITY_ID, t.RESULT_APPLYFOR_TIME, t.RESULT_APPLYFOR_LOCATION, 
-    t.GRID_ID, t.RESULT_DOWN_TIME, t.RESULT_ACCEPT_TIME, t.RESULT_START_TIME, t.RESULT_END_TIME, 
-    t.RESULT_CANCEL_TIME, t.RESULT_CANCEL_REASON, t.RESULT_INSERT_TIME, t.RESULT_INSERT_REASON, 
-    t.RESULT_TRANSFER_TIME, t.RESULT_TRANSFER_REASON, t.INSERT_USERNAME, t.INSERT_TIME, 
-    t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.LIST_ID, t.AREA_ID, t.IS_SPELLING
+        t.RESULT_ID, t.RESULT_TOTAL_ID, t.CAPACITY_ID, t.RESULT_APPLYFOR_TIME, t.RESULT_APPLYFOR_LOCATION,
+    t.GRID_ID, t.RESULT_DOWN_TIME, t.RESULT_ACCEPT_TIME, t.RESULT_START_TIME, t.RESULT_END_TIME,
+    t.RESULT_CANCEL_TIME, t.RESULT_CANCEL_REASON, t.RESULT_INSERT_TIME, t.RESULT_INSERT_REASON,
+    t.RESULT_TRANSFER_TIME, t.RESULT_TRANSFER_REASON, t.INSERT_USERNAME, t.INSERT_TIME,
+    t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.LIST_ID, t.AREA_ID, t.IS_SPELLING,
+    t.GATEPOST_ID
     </sql>
     <sql id="select">
         SELECT <include refid="columns" /> FROM QMS_QUEUE_RESULT
@@ -121,6 +123,9 @@
             <if test="isSpelling != null">
                 and IS_SPELLING = #{isSpelling}
             </if>
+            <if test="gatepostId != null">
+                and GATEPOST_ID = #{gatepostId}
+            </if>
         </where>
     </sql>
     <sql id="whereLike">
@@ -197,9 +202,12 @@
             <if test="isSpelling != null">
                 and IS_SPELLING = #{isSpelling}
             </if>
+            <if test="gatepostId != null">
+                and GATEPOST_ID = #{gatepostId}
+            </if>
         </where>
     </sql>
-    <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
+    <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
         delete from QMS_QUEUE_RESULT
         where RESULT_ID = #{resultId,jdbcType=DECIMAL}
     </delete>
@@ -275,6 +283,9 @@
         <if test="isSpelling != null">
             or IS_SPELLING = #{isSpelling}
         </if>
+        <if test="gatepostId != null">
+            or GATEPOST_ID = #{gatepostId}
+        </if>
     </delete>
     <insert id="insert" parameterType="com.steerinfo.dil.model.QmsQueueResult">
         insert into QMS_QUEUE_RESULT (RESULT_ID, RESULT_TOTAL_ID, CAPACITY_ID,
@@ -285,8 +296,8 @@
                                       RESULT_INSERT_REASON, RESULT_TRANSFER_TIME,
                                       RESULT_TRANSFER_REASON, INSERT_USERNAME, INSERT_TIME,
                                       UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
-                                      LIST_ID, AREA_ID, IS_SPELLING
-        )
+                                      LIST_ID, AREA_ID, IS_SPELLING,
+                                      GATEPOST_ID)
         values (#{resultId,jdbcType=DECIMAL}, #{resultTotalId,jdbcType=DECIMAL}, #{capacityId,jdbcType=DECIMAL},
                 #{resultApplyforTime,jdbcType=TIMESTAMP}, #{resultApplyforLocation,jdbcType=VARCHAR},
                 #{gridId,jdbcType=DECIMAL}, #{resultDownTime,jdbcType=TIMESTAMP}, #{resultAcceptTime,jdbcType=TIMESTAMP},
@@ -295,8 +306,8 @@
                 #{resultInsertReason,jdbcType=VARCHAR}, #{resultTransferTime,jdbcType=TIMESTAMP},
                 #{resultTransferReason,jdbcType=VARCHAR}, #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
                 #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR},
-                #{listId,jdbcType=DECIMAL}, #{areaId,jdbcType=VARCHAR}, #{isSpelling,jdbcType=DECIMAL}
-               )
+                #{listId,jdbcType=DECIMAL}, #{areaId,jdbcType=VARCHAR}, #{isSpelling,jdbcType=DECIMAL},
+                #{gatepostId,jdbcType=DECIMAL})
     </insert>
     <insert id="insertSelective" parameterType="com.steerinfo.dil.model.QmsQueueResult">
         insert into QMS_QUEUE_RESULT
@@ -373,6 +384,9 @@
             <if test="isSpelling != null">
                 IS_SPELLING,
             </if>
+            <if test="gatepostId != null">
+                GATEPOST_ID,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="resultId != null">
@@ -447,6 +461,9 @@
             <if test="isSpelling != null">
                 #{isSpelling,jdbcType=DECIMAL},
             </if>
+            <if test="gatepostId != null">
+                #{gatepostId,jdbcType=DECIMAL},
+            </if>
         </trim>
     </insert>
     <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.QmsQueueResult">
@@ -473,7 +490,8 @@
             INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
             LIST_ID = #{listId,jdbcType=DECIMAL},
             AREA_ID = #{areaId,jdbcType=VARCHAR},
-            IS_SPELLING = #{isSpelling,jdbcType=DECIMAL}
+            IS_SPELLING = #{isSpelling,jdbcType=DECIMAL},
+            GATEPOST_ID = #{gatepostId,jdbcType=DECIMAL}
         where RESULT_ID = #{resultId,jdbcType=DECIMAL}
     </update>
     <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.QmsQueueResult">
@@ -548,10 +566,13 @@
             <if test="isSpelling != null">
                 IS_SPELLING = #{isSpelling,jdbcType=DECIMAL},
             </if>
+            <if test="gatepostId != null">
+                GATEPOST_ID = #{gatepostId,jdbcType=DECIMAL},
+            </if>
         </set>
         where RESULT_ID = #{resultId,jdbcType=DECIMAL}
     </update>
-    <select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
+    <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
         <include refid="select" />
         where RESULT_ID = #{resultId,jdbcType=DECIMAL}
     </select>
@@ -576,7 +597,7 @@
         INSERT_USERNAME, INSERT_TIME,
         UPDATE_USERNAME, UPDATE_TIME,
         INSERT_UPDATE_REMARK, LIST_ID, AREA_ID,
-        IS_SPELLING)
+        IS_SPELLING, GATEPOST_ID)
         ( <foreach collection="list" item="item" separator="union all">
         select
         #{item.resultId,jdbcType=DECIMAL},
@@ -590,7 +611,7 @@
         #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
         #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
         #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.listId,jdbcType=DECIMAL}, #{item.areaId,jdbcType=VARCHAR},
-        #{item.isSpelling,jdbcType=DECIMAL} from dual
+        #{item.isSpelling,jdbcType=DECIMAL}, #{item.gatepostId,jdbcType=DECIMAL} from dual
     </foreach> )
     </insert>
     <update id="batchUpdate" parameterType="java.util.List">
@@ -692,12 +713,15 @@
         <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.isSpelling,jdbcType=DECIMAL}
         </foreach>
+        ,GATEPOST_ID=
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.gatepostId,jdbcType=DECIMAL}
+        </foreach>
         where RESULT_ID in
         <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
             #{item.resultId,jdbcType=DECIMAL}
         </foreach>
     </update>
-
     <delete id="batchDelete" parameterType="java.util.List">
         delete from QMS_QUEUE_RESULT
         where RESULT_ID in
@@ -823,89 +847,55 @@
 
     <!-- 查询排队开始 -->
     <select id="getQueueListByQueueUp" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
-        SELECT
-        *
-        FROM
-        (
-            SELECT QQR.RESULT_ID        "resultId",
-                   QQR.RESULT_TOTAL_ID  "resultTotalId",
-                   QQR.RESULT_START_TIME    "resultStartTime",
-                   RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "grid",
-                   RM.MATERIAL_ID       "materialId",
-                   RM.MATERIAL_NAME     "materialName",
-                   RM.MATERIAL_SPECIFICATION    "materialSpecification",
-                   RM.MATERIAL_MODEL        "materialModel",
-                   QQL.LIST_ID              "listId",
-                   RC.CAPACITY_NUMBER       "capacityNumber",
-                   RC.CAPACITY_ID           "capacityId",
-                   QQL.ENTRY_SURE_TIME          "sureTime",
-                   OOM.ORDER_MATERIAL_NUMBER    "materialNumber",
-                   OOM.MATERIAL_PRIORITY        "id",
-                   OO.DRIVER_TEL                "driverTel",
-                   OO.ORDER_ID                  "orderId",
-                   (
-                       select COUNT(QQL2.LIST_ID)
-                       from QMS_QUEUE_LIST QQL2
-                       where QQL2.GRID_ID = QQL.GRID_ID
-                             and QQL2.LIST_NODE_ORDER >= QQL.LIST_NODE_ORDER
-                   )    "listNodeOrder"
-            FROM QMS_QUEUE_LIST QQL
-                LEFT JOIN QMS_QUEUE_RESULT QQR ON QQL.QUEUE_RESULT_ID = QQR.RESULT_ID
-                LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON QQR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-                LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM ON TTR.ORDER_ID = OOM.ORDER_ID
-                LEFT JOIN RMS_MATERIAL RM ON OOM.MATERIAL_ID = RM.MATERIAL_ID
-                LEFT JOIN RMS_CAPACITY RC ON QQL.CAPACITY_ID = RC.CAPACITY_ID
-                LEFT JOIN OMSTRUCK_ORDER OO ON TTR.ORDER_ID = OO.ORDER_ID
-            <where>
-                <if test="capacityNumber != null">
-                    instr(RC.CAPACITY_NUMBER, #{capacityNumber}) > 0
-                </if>
-                <if test="materialList != null">
-                    and RM.MATERIAL_ID in
-                    <foreach collection="materialList" item="item" open="(" separator="," close=")">
-                        ${item}
-                    </foreach>
-                </if>
-                <if test="locationId != null">
-                    and QQL.GRID_ID = #{locationId}
-                    ORDER BY QQL.ENTRY_SURE_TIME DESC, "listNodeOrder"
-                </if>
-            </where>
-            <if test="locationId == null">
-                ORDER BY QQL.ENTRY_SURE_TIME DESC, "materialName" DESC, "listNodeOrder"
-            </if>
-        )
+        SELECT QQR.RESULT_ID        "resultId",
+               QQR.RESULT_TOTAL_ID  "resultTotalId",
+               QQR.RESULT_START_TIME    "resultStartTime",
+               RM.MATERIAL_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "grid",
+               RM.MATERIAL_ID       "materialId",
+               RM.MATERIAL_NAME     "materialName",
+               RM.MATERIAL_SPECIFICATION    "materialSpecification",
+               RM.MATERIAL_MODEL        "materialModel",
+               QQL.LIST_ID              "listId",
+               RC.CAPACITY_NUMBER       "capacityNumber",
+               RC.CAPACITY_ID           "capacityId",
+               QQL.ENTRY_SURE_TIME          "sureTime",
+               OOM.ORDER_MATERIAL_NUMBER    "materialNumber",
+               OOM.MATERIAL_PRIORITY        "id",
+               OO.DRIVER_TEL                "driverTel",
+               OO.ORDER_ID                  "orderId",
+               RG.GATEPOST_NAME             "gatepostName",
+               (
+                   select COUNT(QQL2.LIST_ID)
+                   from QMS_QUEUE_LIST QQL2
+                   where QQL2.GRID_ID = QQL.GRID_ID
+                         and QQL2.LIST_NODE_ORDER >= QQL.LIST_NODE_ORDER
+               )    "listNodeOrder"
+        FROM QMS_QUEUE_LIST QQL
+            LEFT JOIN QMS_QUEUE_RESULT QQR ON QQL.QUEUE_RESULT_ID = QQR.RESULT_ID
+            LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON QQR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+            LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM ON TTR.ORDER_ID = OOM.ORDER_ID
+            LEFT JOIN RMS_MATERIAL RM ON OOM.MATERIAL_ID = RM.MATERIAL_ID
+            LEFT JOIN RMS_CAPACITY RC ON QQL.CAPACITY_ID = RC.CAPACITY_ID
+            LEFT JOIN OMSTRUCK_ORDER OO ON TTR.ORDER_ID = OO.ORDER_ID
+            LEFT JOIN RMS_GATEPOST  RG ON QQR.GATEPOST_ID = RG.GATEPOST_ID
         <where>
-            <if test="resultStartTime != null">
-                <foreach collection="resultStartTime" item="item" open="(" separator="or" close=")">
-                    "resultStartTime" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="materialName != null">
-                and
-                <foreach collection="materialName" item="item" open="(" separator="or" close=")">
-                    "materialName" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="materialSpecification != null">
-                and
-                <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
-                    "materialSpecification" like '%${item}%'
-                </foreach>
+            <if test="capacityNumber != null">
+                instr(RC.CAPACITY_NUMBER, #{capacityNumber}) > 0
             </if>
-            <if test="materialModel != null">
-                and
-                <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
-                    "materialModel" like '%${item}%'
+            <if test="materialList != null">
+                and RM.MATERIAL_ID in
+                <foreach collection="materialList" item="item" open="(" separator="," close=")">
+                    ${item}
                 </foreach>
             </if>
-            <if test="listNodeOrder != null">
-                and
-                <foreach collection="listNodeOrder" item="item" open="(" separator="or" close=")">
-                    "listNodeOrder" like '%${item}%'
-                </foreach>
+            <if test="locationId != null">
+                and QQL.GRID_ID = #{locationId}
+                ORDER BY QQL.ENTRY_SURE_TIME DESC, "listNodeOrder"
             </if>
         </where>
+        <if test="locationId == null">
+            ORDER BY QQL.ENTRY_SURE_TIME DESC, "materialName" DESC, "listNodeOrder"
+        </if>
     </select>
 
     <update id="updateCancelResult" parameterType="com.steerinfo.dil.model.QmsQueueResult">
@@ -934,6 +924,7 @@
                OOM.MATERIAL_PRIORITY        "id",
                OO.DRIVER_TEL            "driverTel",
                OO.ORDER_ID              "orderId",
+               RG.GATEPOST_NAME             "gatepostName",
               (
                   select count(QQSL2.SPELLING_RESULT_ID) from QMS_QUEUE_SPELLING_LIST QQSL2
                   where QQSL.SPELILING_NUM = QQSL2.SPELILING_NUM
@@ -948,6 +939,7 @@
             left join OMSTRUCK_ORDER_MATERIAL OOM on TTR.ORDER_ID = OOM.ORDER_ID
             left join RMS_MATERIAL RM on OOM.MATERIAL_ID = RM.MATERIAL_ID
             left join OMSTRUCK_ORDER OO on TTR.ORDER_ID = OO.ORDER_ID
+            LEFT JOIN RMS_GATEPOST  RG ON QQR.GATEPOST_ID = RG.GATEPOST_ID
         <where>
             <if test="capacityNumber != null">
                 instr(RC.CAPACITY_NUMBER, #{capacityNumber}) > 0
@@ -1216,13 +1208,15 @@
                QQR.RESULT_CANCEL_REASON  "resultCancelReason",
                RM.MATERIAL_NAME "materialName",
                RM.MATERIAL_SPECIFICATION    "materialSpecification",
-               RM.MATERIAL_MODEL    "materialModel"
+               RM.MATERIAL_MODEL    "materialModel",
+               RG.GATEPOST_NAME      "gatepostName"
         from QMS_QUEUE_RESULT QQR
         left join TMSTRUCK_TOTAL_RESULT TTR on QQR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
         left join OMSTRUCK_ORDER OO on TTR.ORDER_ID = OO.ORDER_ID
         left join RMS_CAPACITY RC on QQR.CAPACITY_ID = RC.CAPACITY_ID
         left join OMSTRUCK_ORDER_MATERIAL OOM on OO.ORDER_ID = OOM.ORDER_ID
         left join RMS_MATERIAL RM on OOM.MATERIAL_ID = RM.MATERIAL_ID
+        left join RMS_GATEPOST  RG on QQR.GATEPOST_ID = RG.GATEPOST_ID
         where
               QQR.RESULT_CANCEL_TIME > to_date('2022-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss')
             <if test="index != null">
@@ -2139,17 +2133,27 @@
     </select>
 
     <select id="getQueueResultByOrderId" parameterType="java.math.BigDecimal" resultType="java.util.Map">
-        select QQR.RESULT_ID    "resultId",
-               QQR.RESULT_END_TIME  "resultEndTime",
-               QQR.GRID_ID          "gridId",
-               QQR.RESULT_DOWN_TIME "resultDownTime",
-               QQR.RESULT_START_TIME "resultStartTime",
-               QQR.IS_SPELLING  "isSpelling",
-               QQR.RESULT_CANCEL_TIME   "resultCancelTime",
-               QQR.LIST_ID      "listId",
-               TER.INSERT_UPDATE_REMARK "insertUpdateRemark"
-        from  QMS_QUEUE_RESULT QQR
-        left join TMSTRUCK_ENFACTORY_RESULT TER on TER.RESULT_TOTAL_ID = QQR.RESULT_TOTAL_ID
+        select QQR.RESULT_ID          "resultId",
+               QQR.RESULT_END_TIME    "resultEndTime",
+               QQR.GRID_ID            "gridId",
+               QQR.RESULT_DOWN_TIME   "resultDownTime",
+               QQR.RESULT_START_TIME  "resultStartTime",
+               QQR.IS_SPELLING        "isSpelling",
+               QQR.RESULT_CANCEL_TIME "resultCancelTime",
+               QQR.LIST_ID            "listId",
+               RG.GATEPOST_NAME       "gatepostName",
+               (case
+                    when QQR.IS_SPELLING = 0
+                        then (select QQL.ENTRY_SURE_TIME
+                              from QMS_QUEUE_LIST QQL
+                              where QQR.RESULT_ID = QQL.QUEUE_RESULT_ID)
+                    when QQR.IS_SPELLING = 1
+                        then (select QQSL.ENTRY_SURE_TIME
+                              from QMS_QUEUE_SPELLING_LIST QQSL
+                              where QQR.RESULT_ID = QQSL.QUEUE_RESULT_ID)
+                   end)               "entrySureTime"
+        from QMS_QUEUE_RESULT QQR
+                 left join RMS_GATEPOST RG on QQR.GATEPOST_ID = RG.GATEPOST_ID
         where QQR.RESULT_TOTAL_ID = #{resultTotalId}
     </select>