txf 3 年之前
父節點
當前提交
c1f619f175
共有 26 個文件被更改,包括 1887 次插入552 次删除
  1. 3 4
      pom.xml
  2. 18 6
      src/main/java/com/steerinfo/dil/controller/QmsQueueListController.java
  3. 49 54
      src/main/java/com/steerinfo/dil/controller/QmsQueueResultController.java
  4. 14 0
      src/main/java/com/steerinfo/dil/mapper/QmsQueueListMapper.java
  5. 15 0
      src/main/java/com/steerinfo/dil/mapper/QmsQueueResultMapper.java
  6. 24 0
      src/main/java/com/steerinfo/dil/mapper/QmsQueueSpellingListMapper.java
  7. 28 1
      src/main/java/com/steerinfo/dil/mapper/QueuingRulesMapper.java
  8. 41 10
      src/main/java/com/steerinfo/dil/model/QmsQueueList.java
  9. 38 7
      src/main/java/com/steerinfo/dil/model/QmsQueueResult.java
  10. 184 0
      src/main/java/com/steerinfo/dil/model/QmsQueueSpellingList.java
  11. 78 0
      src/main/java/com/steerinfo/dil/model/WebSocketCapacity.java
  12. 2 2
      src/main/java/com/steerinfo/dil/service/IQmsQueueListService.java
  13. 1 1
      src/main/java/com/steerinfo/dil/service/IQmsQueueResultService.java
  14. 23 0
      src/main/java/com/steerinfo/dil/service/IQmsQueueSpellingListService.java
  15. 17 0
      src/main/java/com/steerinfo/dil/service/impl/QmsQueueGridServiceImpl.java
  16. 143 115
      src/main/java/com/steerinfo/dil/service/impl/QmsQueueListServiceImpl.java
  17. 44 39
      src/main/java/com/steerinfo/dil/service/impl/QmsQueueResultServiceImpl.java
  18. 33 0
      src/main/java/com/steerinfo/dil/service/impl/QmsQueueSpellingListServiceImpl.java
  19. 106 0
      src/main/java/com/steerinfo/dil/service/impl/QueuingRulesServiceImpl.java
  20. 1 1
      src/main/java/com/steerinfo/dil/util/ColumnDataUtil.java
  21. 83 14
      src/main/java/com/steerinfo/dil/util/DataChange.java
  22. 1 1
      src/main/resources/bootstrap.yml
  23. 216 118
      src/main/resources/com/steerinfo/dil/mapper/QmsQueueListMapper.xml
  24. 264 174
      src/main/resources/com/steerinfo/dil/mapper/QmsQueueResultMapper.xml
  25. 365 0
      src/main/resources/com/steerinfo/dil/mapper/QmsQueueSpellingListMapper.xml
  26. 96 5
      src/main/resources/com/steerinfo/dil/mapper/QueuingRulesMapper.xml

+ 3 - 4
pom.xml

@@ -111,13 +111,12 @@
                 <version>3.0</version>
                 <configuration>
                     <connUrl>jdbc:oracle:thin:@172.16.33.163:1521:ilsdbpri</connUrl>
-                    <user>dagang</user>
-                    <password>root123</password>
+                    <user>dil</user>
+                    <password>Dil123789</password>
                     <!--包名-->
                     <targetPackage>com.steerinfo.dil</targetPackage>
                     <tables>
-                        <param>QMS_QUEUE_RESULT</param><!--运力-->
-<!--                        <param>TMSTRUCK_LOAD_RESULT</param>&lt;!&ndash;运力&ndash;&gt;-->
+                        <param>QMS_QUEUE_LIST</param><!--运力-->
                     </tables>
                 </configuration>
                 <executions>

+ 18 - 6
src/main/java/com/steerinfo/dil/controller/QmsQueueListController.java

@@ -2,11 +2,11 @@ package com.steerinfo.dil.controller;
 
 
 import com.steerinfo.dil.feign.ESFeign;
+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.dil.service.IQmsQueueListService;
 import com.steerinfo.framework.service.pagehelper.PageHelper;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -35,7 +35,7 @@ import java.math.BigDecimal;
 public class QmsQueueListController extends BaseRESTfulController {
 
     @Autowired
-    IQmsQueueListService qmsQueueListService;
+    QmsQueueListServiceImpl qmsQueueListService;
 
     @Autowired
     ColumnDataUtil columnDataUtil;
@@ -48,8 +48,11 @@ public class QmsQueueListController extends BaseRESTfulController {
             @ApiImplicitParam(name = "mapValue", value = "", required = false, dataType = "Map"),
     })
     @PostMapping("/addQueueList")
-    public RESTfulResult addQueueList(@RequestBody(required = false) Map<String, Object> mapValue){
-        int i = qmsQueueListService.addQueueList(mapValue);
+    public RESTfulResult addQueueList(String orderId){
+        int i = qmsQueueListService.addQueueList(new BigDecimal(orderId));
+        if(i == 0){
+            return failed("该车已有排队!");
+        }
         return success(i);
     }
 
@@ -88,8 +91,8 @@ public class QmsQueueListController extends BaseRESTfulController {
             @ApiImplicitParam(name = "mapValue", value = "运输订单号或者网格排队实绩ID取一个就行", required = false, dataType = "Map"),
     })
     @PostMapping("/queueEndByPDA")
-    public RESTfulResult queueEnd(@RequestBody(required=false) Map<String, Object> mapValue){
-        int i = qmsQueueListService.queueEndByPDA(mapValue);
+    public RESTfulResult queueEnd(String resultTotalId){
+        int i = qmsQueueListService.queueEndByPDA(new BigDecimal(resultTotalId));
         return success(i);
     }
 
@@ -187,4 +190,13 @@ public class QmsQueueListController extends BaseRESTfulController {
     public RESTfulResult getListQueueMes(@RequestBody(required=false) Map<String, Object> mapValue){
         return success(qmsQueueListService.getListQueueMes(mapValue));
     }
+
+    @ApiOperation(value="钢材科允许进厂")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "mapValue", value = "网格Id", required = false, dataType = "Map"),
+    })
+    @PostMapping("/allowEnFactory")
+    public RESTfulResult allowEnFactory(@RequestBody(required=false) Map<String, Object> mapValue){
+        return success(qmsQueueListService.allowEnFactory(mapValue));
+    }
 }

+ 49 - 54
src/main/java/com/steerinfo/dil/controller/QmsQueueResultController.java

@@ -4,6 +4,9 @@ package com.steerinfo.dil.controller;
 import com.alibaba.fastjson.JSON;
 import com.steerinfo.dil.feign.ESFeign;
 import com.steerinfo.dil.model.QmsQueueResult;
+import com.steerinfo.dil.service.impl.QmsQueueGridServiceImpl;
+import com.steerinfo.dil.service.impl.QmsQueueResultServiceImpl;
+import com.steerinfo.dil.service.impl.QueueInterfaceServiceImpl;
 import com.steerinfo.dil.util.BaseRESTfulController;
 import com.steerinfo.dil.util.ColumnDataUtil;
 import com.steerinfo.dil.util.PageListAdd;
@@ -39,11 +42,14 @@ import java.util.*;
 public class QmsQueueResultController extends BaseRESTfulController {
 
     @Autowired
-    IQmsQueueResultService qmsQueueResultService;
+    QmsQueueResultServiceImpl qmsQueueResultService;
 
     @Autowired
     ColumnDataUtil columnDataUtil;
 
+    @Autowired
+    QueueInterfaceServiceImpl queueInterfaceService;
+
     @Autowired
     ESFeign esFeign;
 
@@ -55,19 +61,35 @@ public class QmsQueueResultController extends BaseRESTfulController {
     })
 
     @PostMapping(value = "/addQueueResult")
-    public RESTfulResult addQueueResult(String vno){
-        Map<String, Object> map = new HashMap<>();
-        map.put("vno",vno);
-        int i = qmsQueueResultService.addQueueResult(map);
+    public RESTfulResult addQueueResult(String vno, String isPDA){
+        int i = qmsQueueResultService.addQueueResult(vno);
         if(i==0) {
             return failed("", "新增失败");
-        }
-        if(i==-1){
+        }else if(i==-1){
             return failed("","车号"+vno+"没有对应的订单");
+        }else if(i == -2){
+            return failed("请勿重复申请排队");
+        }
+        if(isPDA == null){
+            //如果是电子围栏调用,取消订阅
+            Map<String, Object> map = new HashMap<>();
+            map.put("capacityNumber", vno.split("_")[0] + "_2");
+            int j = queueInterfaceService.cancelSubsCapacity(map, 0);
+            if(j == -1){
+                System.out.println("取消订阅失败");
+            }else if(j == -2){
+                System.out.println("超过递归次数,取消订阅失败");
+            }
         }
         return success();
     }
 
+    @ApiOperation(value="APP端司机查看排队信息")
+    @GetMapping("getQueueResultByOrderId")
+    public RESTfulResult getQueueResultByOrderId(String orderId){
+        return success(qmsQueueResultService.getQueueResultByOrderId(orderId));
+    }
+
     @ApiOperation(value="查询排队申请")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
@@ -87,9 +109,7 @@ public class QmsQueueResultController extends BaseRESTfulController {
         }
         PageHelper.startPage(pageNum,pageSize);
         List<Map<String, Object>> allQueueApply = qmsQueueResultService.getQueueApply(mapValue);
-        //分页数据
-        List<Map<String, Object>> listMonitor = new ArrayList<>(allQueueApply);
-        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allQueueApply,listMonitor);
+        PageListAdd pageList = columnDataUtil.tableColumnData(apiId,null, allQueueApply);
         return success(pageList);
     }
 
@@ -110,41 +130,12 @@ public class QmsQueueResultController extends BaseRESTfulController {
                                        Integer status,
                                        String con
     ){
-        if(mapValue == null){
-            mapValue = new HashMap<>();
-        }
         mapValue.put("orderTypee", orderType);
         mapValue.put("orderStatus", status);
-        if(con != null){
-            if(!"undefined".equals(con)){
-                //设置要查询的索引名称
-                String index="get_all_execution";
-                //获取查询结果
-                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));
-            }
-        }
-        List<Map<String, Object>> AllExecutionOrder = null;
-        //如果有条件查询则跳过初始化,和创建索引
-        if(mapValue.size() == 2){
-            //将查询结果存入索引中
-            AllExecutionOrder = qmsQueueResultService.getAllExecutionOrder(mapValue);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index","get_all_execution");
-            //添加id
-            map.put("indexId","executionId");
-            AllExecutionOrder.add(map);
-            //新建索引
-            esFeign.insertIndex(AllExecutionOrder);
-            //删除
-            AllExecutionOrder.remove(AllExecutionOrder.size()-1);
-        }
-        if(AllExecutionOrder == null)
-            AllExecutionOrder = qmsQueueResultService.getAllExecutionOrder(mapValue);
         PageHelper.startPage(pageNum,pageSize);
         //分页数据
         List<Map<String, Object>> executionOrder = qmsQueueResultService.getAllExecutionOrder(mapValue);
-        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, AllExecutionOrder,executionOrder);
+        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, executionOrder);
         return success(pageList);
 
     }
@@ -178,7 +169,7 @@ public class QmsQueueResultController extends BaseRESTfulController {
 
     }
 
-    @ApiOperation(value="查询排队开始 网格Id视情况而给 可不给")
+    @ApiOperation(value="查询单拼排队开始")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
             @ApiImplicitParam(name = "apiId(128)", value = "动态表头", required = false, dataType = "Integer"),
@@ -192,21 +183,25 @@ public class QmsQueueResultController extends BaseRESTfulController {
                                        Integer apiId,
                                        Integer pageNum,
                                        Integer pageSize,
-                                       Integer gridId,
-                                       String con
+                                       Integer locationId,
+                                       String capacityNumber,
+                                       Integer isSpelling
     ){
-        if(gridId != null){
-            mapValue.put("gridId", gridId);
-        }
-        if(con != null && !"".equals(con) && !"null".equals(con)){
-            mapValue.put("index", con);
+        if(locationId != null)
+            mapValue.put("locationId", locationId);
+        if(capacityNumber != null && !"".equals(capacityNumber))
+            mapValue.put("capacityNumber", capacityNumber);
+        if(isSpelling == 1){
+            //多拼
+            return success(qmsQueueResultService.getQueueListByQueueUpSpelling(mapValue));
+        }else {
+            //单拼
+            PageHelper.startPage(pageNum,pageSize);
+            //分页数据
+            List<Map<String, Object>> AllQueueList = qmsQueueResultService.getQueueListByQueueUp(mapValue);
+            PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null, AllQueueList);
+            return success(pageList);
         }
-        PageHelper.startPage(pageNum,pageSize);
-        //分页数据
-        List<Map<String, Object>> AllQueueList = qmsQueueResultService.getQueueListByQueueUp(mapValue);
-        List<Map<String, Object>> queueListByQueueUp = new ArrayList<>(AllQueueList);
-        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, AllQueueList,queueListByQueueUp);
-        return success(pageList);
     }
 
     @ApiOperation(value="查询进厂排队详情")

+ 14 - 0
src/main/java/com/steerinfo/dil/mapper/QmsQueueListMapper.java

@@ -38,4 +38,18 @@ public interface QmsQueueListMapper extends IBaseMapper<QmsQueueList, BigDecimal
 
     //查询某一个队列的车辆排队详情
     List<Map<String, Object>> getListQueueMes(Map<String, Object> map);
+
+
+    //通过订单ID查询该订单下有多少个物资=======================================================
+    Map<String, Object> getMaterialNumByOrderId(BigDecimal orderId);
+
+    Integer existsCapacity(Object capacityId);
+
+    //通过实绩ID删除排队链表
+    Integer deleteByQueueResultId(BigDecimal queueResultId);
+
+    int updateListEnFactory(Map<String, Object> mesMap);
+
+
+    int updateEnFactoryResult(Map<String, Object> mesMap);
 }

+ 15 - 0
src/main/java/com/steerinfo/dil/mapper/QmsQueueResultMapper.java

@@ -132,4 +132,19 @@ public interface QmsQueueResultMapper extends IBaseMapper<QmsQueueResult, BigDec
     // 通过车牌号得到网格id
     BigDecimal getGridIdNotNull(String capacityNumber);
 
+   /*
+   ==================================================2022年4月8日19:39:18========================================
+    */
+    //查询网格Id
+    BigDecimal getGridIdByOrderId(BigDecimal orderId);
+
+    //查询物资ID
+    Integer getMaterialIdByOrderId(BigDecimal orderId);
+
+    Map<String, Object> getQueueResultByOrderId(BigDecimal orderId);
+
+
+    Map<String, Object> getResultMesByTotalId(BigDecimal resultTotalId);
+
+    List<Map<String, Object>> getQueueListByQueueUpSpelling(Map<String, Object> map);
 }

+ 24 - 0
src/main/java/com/steerinfo/dil/mapper/QmsQueueSpellingListMapper.java

@@ -0,0 +1,24 @@
+package com.steerinfo.dil.mapper;
+
+import com.steerinfo.dil.model.QmsQueueSpellingList;
+import com.steerinfo.framework.mapper.IBaseMapper;
+import java.math.*;
+import java.util.Map;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+@Mapper
+public interface QmsQueueSpellingListMapper extends IBaseMapper<QmsQueueSpellingList, BigDecimal> {
+
+    //查询最大主键
+    @Select("select SEQ_QUEUE_SPELLING_LIST.nextval from dual")
+    BigDecimal selectMaxId();
+
+    //删除多拼排序队列
+    Integer deleteByQueueResultId(BigDecimal queueResultId);
+
+    int updateListEnFactory(Map<String, Object> mesMap);
+
+    Integer existsCapacity(Object capacityId);
+}

+ 28 - 1
src/main/java/com/steerinfo/dil/mapper/QueuingRulesMapper.java

@@ -39,5 +39,32 @@ public interface QueuingRulesMapper {
     List<BigDecimal> queryGatepostIdByOrderId(@Param("orderId")BigDecimal orderId);
 
     //通过车牌号查询已接收的订单
-    String getOrderNumberByCapacityNumber(@Param("capacityNumber") String capacityNumber);
+    Map<String, Object> getOrderNumberByCapacityNumber(@Param("capacityNumber") String capacityNumber);
+
+    //查询人员管理名字
+    String getPersonnelNameBySSoId(String ssoId);
+
+    //查询所有已确认进厂的实绩
+    List<Map<String, Object>> getAllSureTimeList();
+    List<Map<String, Object>> getAllSureTimeSpellingList();
+
+    //更新排队实绩表
+    int updateListToLast(@Param("listId") BigDecimal listId, @Param("nodeOrder") Integer nodeOrder);
+
+    //更新进厂实绩
+    int updateEnFactory(@Param("resultTotalId") BigDecimal resultTotalId);
+
+    //更新多拼排序表
+    int updateSpellingListToLast(@Param("spellingResultId") BigDecimal spellingResultId);
+
+    //过时移除排队实绩信息
+    int updateQQRRemoveList(BigDecimal resultId);
+
+    //查询所有单拼还未确认进厂的实绩
+    List<Map<String, Object>> getAllNotSureEnFactoryList();
+
+    //查询所有多拼还未确认进厂的实绩
+    List<Map<String, Object>> getAllNotSureEnFactorySpellingList();
+
+    Integer checkoutQQR(Object resultTotalId);
 }

+ 41 - 10
src/main/java/com/steerinfo/dil/model/QmsQueueList.java

@@ -3,40 +3,41 @@ package com.steerinfo.dil.model;
 import com.steerinfo.framework.model.IBasePO;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+
 import java.math.BigDecimal;
 import java.util.Date;
 
 @ApiModel(value="汽车排队链表")
 public class QmsQueueList implements IBasePO<BigDecimal> {
     /**
-     * 主键ID(LIST_ID,DECIMAL,38)
+     * 主键ID(LIST_ID,DECIMAL,0)
      */
     @ApiModelProperty(value="主键ID",required=true)
     private BigDecimal listId;
 
     /**
-     * 排队网格ID(GRID_ID,DECIMAL,38)
+     * 排队网格ID(GRID_ID,DECIMAL,0)
      */
     @ApiModelProperty(value="排队网格ID",required=false)
     private BigDecimal gridId;
 
     /**
-     * 运力ID(CAPACITY_ID,DECIMAL,38)
+     * 运力ID(CAPACITY_ID,DECIMAL,0)
      */
     @ApiModelProperty(value="运力ID",required=false)
     private BigDecimal capacityId;
 
     /**
-     * 排队链表顺序号(LIST_NODE_ORDER,DECIMAL,38)
+     * 排队链表顺序号(LIST_NODE_ORDER,DECIMAL,0)
      */
     @ApiModelProperty(value="排队链表顺序号",required=false)
     private BigDecimal listNodeOrder;
 
     /**
-     * 逻辑删除(DELETED,VARCHAR,1)
+     * 逻辑删除 0 :正在排队 1:排队结束(DELETED,VARCHAR,1)
      */
-    @ApiModelProperty(value="逻辑删除",required=false)
-    private BigDecimal deleted;
+    @ApiModelProperty(value="逻辑删除 0 :正在排队 1:排队结束",required=false)
+    private String deleted;
 
     /**
      * 记录创建人(INSERT_USERNAME,VARCHAR,20)
@@ -68,6 +69,18 @@ public class QmsQueueList implements IBasePO<BigDecimal> {
     @ApiModelProperty(value="记录创建或修改备注",required=false)
     private String insertUpdateRemark;
 
+    /**
+     * 排队实绩Id(QUEUE_RESULT_ID,DECIMAL,0)
+     */
+    @ApiModelProperty(value="排队实绩Id",required=false)
+    private BigDecimal queueResultId;
+
+    /**
+     * 进厂确认时间(ENTRY_SURE_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="进厂确认时间",required=false)
+    private Date entrySureTime;
+
     private static final long serialVersionUID = 1L;
 
     @Override
@@ -112,12 +125,12 @@ public class QmsQueueList implements IBasePO<BigDecimal> {
         this.listNodeOrder = listNodeOrder;
     }
 
-    public BigDecimal getDeleted() {
+    public String getDeleted() {
         return deleted;
     }
 
-    public void setDeleted(BigDecimal deleted) {
-        this.deleted = deleted;
+    public void setDeleted(String deleted) {
+        this.deleted = deleted == null ? null : deleted.trim();
     }
 
     public String getInsertUsername() {
@@ -160,6 +173,22 @@ public class QmsQueueList implements IBasePO<BigDecimal> {
         this.insertUpdateRemark = insertUpdateRemark == null ? null : insertUpdateRemark.trim();
     }
 
+    public BigDecimal getQueueResultId() {
+        return queueResultId;
+    }
+
+    public void setQueueResultId(BigDecimal queueResultId) {
+        this.queueResultId = queueResultId;
+    }
+
+    public Date getEntrySureTime() {
+        return entrySureTime;
+    }
+
+    public void setEntrySureTime(Date entrySureTime) {
+        this.entrySureTime = entrySureTime;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -176,6 +205,8 @@ public class QmsQueueList implements IBasePO<BigDecimal> {
         sb.append(", updateUsername=").append(updateUsername);
         sb.append(", updateTime=").append(updateTime);
         sb.append(", insertUpdateRemark=").append(insertUpdateRemark);
+        sb.append(", queueResultId=").append(queueResultId);
+        sb.append(", entrySureTime=").append(entrySureTime);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");
         return sb.toString();

+ 38 - 7
src/main/java/com/steerinfo/dil/model/QmsQueueResult.java

@@ -3,25 +3,26 @@ package com.steerinfo.dil.model;
 import com.steerinfo.framework.model.IBasePO;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+
 import java.math.BigDecimal;
 import java.util.Date;
 
 @ApiModel(value="汽车排队实绩")
 public class QmsQueueResult implements IBasePO<BigDecimal> {
     /**
-     * 主键id(RESULT_ID,DECIMAL,38)
+     * 主键id(RESULT_ID,DECIMAL,0)
      */
     @ApiModelProperty(value="主键id",required=true)
     private BigDecimal resultId;
 
     /**
-     * 实绩总表id(RESULT_TOTAL_ID,DECIMAL,38)
+     * 实绩总表id(RESULT_TOTAL_ID,DECIMAL,0)
      */
     @ApiModelProperty(value="实绩总表id",required=true)
     private BigDecimal resultTotalId;
 
     /**
-     * 运力id(CAPACITY_ID,DECIMAL,38)
+     * 运力id(CAPACITY_ID,DECIMAL,0)
      */
     @ApiModelProperty(value="运力id",required=false)
     private BigDecimal capacityId;
@@ -39,7 +40,7 @@ public class QmsQueueResult implements IBasePO<BigDecimal> {
     private String resultApplyforLocation;
 
     /**
-     * 排队网格id(GRID_ID,DECIMAL,38)
+     * 排队网格id(GRID_ID,DECIMAL,0)
      */
     @ApiModelProperty(value="排队网格id",required=false)
     private BigDecimal gridId;
@@ -75,7 +76,7 @@ public class QmsQueueResult implements IBasePO<BigDecimal> {
     private Date resultCancelTime;
 
     /**
-     * 取消排队原因(RESULT_CANCEL_REASON,VARCHAR,100)
+     * 取消排队原因(RESULT_CANCEL_REASON,VARCHAR,250)
      */
     @ApiModelProperty(value="取消排队原因",required=false)
     private String resultCancelReason;
@@ -87,7 +88,7 @@ public class QmsQueueResult implements IBasePO<BigDecimal> {
     private Date resultInsertTime;
 
     /**
-     * 插队原因(RESULT_INSERT_REASON,VARCHAR,100)
+     * 插队原因(RESULT_INSERT_REASON,VARCHAR,250)
      */
     @ApiModelProperty(value="插队原因",required=false)
     private String resultInsertReason;
@@ -99,7 +100,7 @@ public class QmsQueueResult implements IBasePO<BigDecimal> {
     private Date resultTransferTime;
 
     /**
-     * 排队转移原因(RESULT_TRANSFER_REASON,VARCHAR,20)
+     * 排队转移原因(RESULT_TRANSFER_REASON,VARCHAR,250)
      */
     @ApiModelProperty(value="排队转移原因",required=false)
     private String resultTransferReason;
@@ -140,6 +141,18 @@ public class QmsQueueResult implements IBasePO<BigDecimal> {
     @ApiModelProperty(value="链表ID",required=false)
     private BigDecimal listId;
 
+    /**
+     * 电子围栏区域ID(AREA_ID,VARCHAR,200)
+     */
+    @ApiModelProperty(value="电子围栏区域ID",required=false)
+    private String areaId;
+
+    /**
+     * 是否拼装 0:不是 1:是(IS_SPELLING,DECIMAL,0)
+     */
+    @ApiModelProperty(value="是否拼装 0:不是 1:是",required=false)
+    private BigDecimal isSpelling;
+
     private static final long serialVersionUID = 1L;
 
     @Override
@@ -328,6 +341,22 @@ public class QmsQueueResult implements IBasePO<BigDecimal> {
         this.listId = listId;
     }
 
+    public String getAreaId() {
+        return areaId;
+    }
+
+    public void setAreaId(String areaId) {
+        this.areaId = areaId == null ? null : areaId.trim();
+    }
+
+    public BigDecimal getIsSpelling() {
+        return isSpelling;
+    }
+
+    public void setIsSpelling(BigDecimal isSpelling) {
+        this.isSpelling = isSpelling;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -356,6 +385,8 @@ public class QmsQueueResult implements IBasePO<BigDecimal> {
         sb.append(", updateTime=").append(updateTime);
         sb.append(", insertUpdateRemark=").append(insertUpdateRemark);
         sb.append(", listId=").append(listId);
+        sb.append(", areaId=").append(areaId);
+        sb.append(", isSpelling=").append(isSpelling);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");
         return sb.toString();

+ 184 - 0
src/main/java/com/steerinfo/dil/model/QmsQueueSpellingList.java

@@ -0,0 +1,184 @@
+package com.steerinfo.dil.model;
+
+import com.steerinfo.framework.model.IBasePO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@ApiModel(value="null")
+public class QmsQueueSpellingList implements IBasePO<BigDecimal> {
+    /**
+     * 主键ID(SPELLING_RESULT_ID,DECIMAL,0)
+     */
+    @ApiModelProperty(value="主键ID",required=true)
+    private BigDecimal spellingResultId;
+
+    /**
+     * 排队实绩ID(QUEUE_RESULT_ID,DECIMAL,0)
+     */
+    @ApiModelProperty(value="排队实绩ID",required=false)
+    private BigDecimal queueResultId;
+
+    /**
+     * 拼数(也是分类字段)(SPELILING_NUM,DECIMAL,0)
+     */
+    @ApiModelProperty(value="拼数(也是分类字段)",required=false)
+    private BigDecimal spelilingNum;
+
+    /**
+     * 拼装确认时间(SPELLING_SURE_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="拼装确认时间",required=false)
+    private Date spellingSureTime;
+
+    /**
+     * 钢材科勾选进厂时间(ENTRY_SURE_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="钢材科勾选进厂时间",required=false)
+    private Date entrySureTime;
+
+    /**
+     * 新增时间(INSERT_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="新增时间",required=false)
+    private Date insertTime;
+
+    /**
+     * 新增人(INSERT_USERNAME,VARCHAR,50)
+     */
+    @ApiModelProperty(value="新增人",required=false)
+    private String insertUsername;
+
+    /**
+     * 修改人(UPDATE_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="修改人",required=false)
+    private Date updateTime;
+
+    /**
+     * 修改时间(UPDATE_USERNAME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="修改时间",required=false)
+    private Date updateUsername;
+
+    /**
+     * 逻辑删除(DELETED,DECIMAL,0)
+     */
+    @ApiModelProperty(value="逻辑删除",required=false)
+    private BigDecimal deleted;
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public BigDecimal getId() {
+        return this.spellingResultId;
+    }
+
+    @Override
+    public void setId(BigDecimal spellingResultId) {
+        this.spellingResultId = spellingResultId;
+    }
+
+    public BigDecimal getSpellingResultId() {
+        return spellingResultId;
+    }
+
+    public void setSpellingResultId(BigDecimal spellingResultId) {
+        this.spellingResultId = spellingResultId;
+    }
+
+    public BigDecimal getQueueResultId() {
+        return queueResultId;
+    }
+
+    public void setQueueResultId(BigDecimal queueResultId) {
+        this.queueResultId = queueResultId;
+    }
+
+    public BigDecimal getSpelilingNum() {
+        return spelilingNum;
+    }
+
+    public void setSpelilingNum(BigDecimal spelilingNum) {
+        this.spelilingNum = spelilingNum;
+    }
+
+    public Date getSpellingSureTime() {
+        return spellingSureTime;
+    }
+
+    public void setSpellingSureTime(Date spellingSureTime) {
+        this.spellingSureTime = spellingSureTime;
+    }
+
+    public Date getEntrySureTime() {
+        return entrySureTime;
+    }
+
+    public void setEntrySureTime(Date entrySureTime) {
+        this.entrySureTime = entrySureTime;
+    }
+
+    public Date getInsertTime() {
+        return insertTime;
+    }
+
+    public void setInsertTime(Date insertTime) {
+        this.insertTime = insertTime;
+    }
+
+    public String getInsertUsername() {
+        return insertUsername;
+    }
+
+    public void setInsertUsername(String insertUsername) {
+        this.insertUsername = insertUsername == null ? null : insertUsername.trim();
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Date getUpdateUsername() {
+        return updateUsername;
+    }
+
+    public void setUpdateUsername(Date updateUsername) {
+        this.updateUsername = updateUsername;
+    }
+
+    public BigDecimal getDeleted() {
+        return deleted;
+    }
+
+    public void setDeleted(BigDecimal deleted) {
+        this.deleted = deleted;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", spellingResultId=").append(spellingResultId);
+        sb.append(", queueResultId=").append(queueResultId);
+        sb.append(", spelilingNum=").append(spelilingNum);
+        sb.append(", spellingSureTime=").append(spellingSureTime);
+        sb.append(", entrySureTime=").append(entrySureTime);
+        sb.append(", insertTime=").append(insertTime);
+        sb.append(", insertUsername=").append(insertUsername);
+        sb.append(", updateTime=").append(updateTime);
+        sb.append(", updateUsername=").append(updateUsername);
+        sb.append(", deleted=").append(deleted);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 78 - 0
src/main/java/com/steerinfo/dil/model/WebSocketCapacity.java

@@ -0,0 +1,78 @@
+package com.steerinfo.dil.model;
+
+import java.util.Date;
+
+public class WebSocketCapacity {
+
+    private int messageType;
+
+    private String sendPerson;
+
+    private String receivePerson;
+
+    private String messageContent;
+
+    private Date createTime;
+
+    public WebSocketCapacity() {
+    }
+
+    public WebSocketCapacity(int messageType, String sendPerson, String receivePerson, String messageContent, Date createTime) {
+        this.messageType = messageType;
+        this.sendPerson = sendPerson;
+        this.receivePerson = receivePerson;
+        this.messageContent = messageContent;
+        this.createTime = createTime;
+    }
+
+    public int getMessageType() {
+        return messageType;
+    }
+
+    public void setMessageType(int messageType) {
+        this.messageType = messageType;
+    }
+
+    public String getSendPerson() {
+        return sendPerson;
+    }
+
+    public void setSendPerson(String sendPerson) {
+        this.sendPerson = sendPerson;
+    }
+
+    public String getReceivePerson() {
+        return receivePerson;
+    }
+
+    public void setReceivePerson(String receivePerson) {
+        this.receivePerson = receivePerson;
+    }
+
+    public String getMessageContent() {
+        return messageContent;
+    }
+
+    public void setMessageContent(String messageContent) {
+        this.messageContent = messageContent;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    @Override
+    public String toString() {
+        return "WebSocketCapacity{" +
+                "messageType='" + messageType + '\'' +
+                ", sendPerson='" + sendPerson + '\'' +
+                ", receivePerson='" + receivePerson + '\'' +
+                ", messageContent='" + messageContent + '\'' +
+                ", createTime=" + createTime +
+                '}';
+    }
+}

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

@@ -23,7 +23,7 @@ import java.util.Map;
 public interface IQmsQueueListService{
 
     //添加汽车排队链表
-    int addQueueList(Map<String, Object> map);
+    int addQueueList(BigDecimal orderId);
 
     //进厂排队转移(仓库排队转移) 新增一条链表 修改实绩链表Id
     int changeQueue(Map<String, Object> map);
@@ -35,7 +35,7 @@ public interface IQmsQueueListService{
     int queueCutInLine(Map<String, Object> map);
 
     //排队结束 通过扫描二维码获取运输订单号
-    int queueEndByPDA(Map<String, Object> map);
+    int queueEndByPDA(BigDecimal resultTotalId);
 
     //链表监控
     List<Map<String, Object>> listMonitor(Map<String, Object> map);

+ 1 - 1
src/main/java/com/steerinfo/dil/service/IQmsQueueResultService.java

@@ -22,7 +22,7 @@ import java.util.Map;
  */
 public interface IQmsQueueResultService{
     //车辆进入电子围栏自动触发系统新增排队实绩
-    int addQueueResult(Map<String, Object> map);
+    int addQueueResult(String vno);
 
     //新增仓库排队
     int addQueueResultByCk(Map<String, Object> map);

+ 23 - 0
src/main/java/com/steerinfo/dil/service/IQmsQueueSpellingListService.java

@@ -0,0 +1,23 @@
+package com.steerinfo.dil.service;
+
+import com.steerinfo.framework.service.IBaseService;
+import com.steerinfo.dil.model.QmsQueueSpellingList;
+import java.util.Date;
+import java.math.BigDecimal;
+
+/**
+ * QmsQueueSpellingList服务接口:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2022-04-09 03:14
+ * 类描述
+ * 修订历史:
+ * 日期:2022-04-09
+ * 作者:generator
+ * 参考:
+ * 描述:QmsQueueSpellingList服务接口
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+public interface IQmsQueueSpellingListService{
+
+}

+ 17 - 0
src/main/java/com/steerinfo/dil/service/impl/QmsQueueGridServiceImpl.java

@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import java.util.Date;
 import java.math.BigDecimal;
+import java.util.Map;
 
 /**
  * QmsQueueGrid服务实现:
@@ -29,4 +30,20 @@ public class QmsQueueGridServiceImpl implements IQmsQueueGridService {
     @Autowired
     private QmsQueueGridMapper qmsQueueGridMapper;
 
+    /**
+     * 新增仓储网格实绩ID
+     * @param materialId
+     * @return
+     */
+    public BigDecimal addQQR(Integer materialId){
+        QmsQueueGrid qmsQueueGrid = new QmsQueueGrid();
+        BigDecimal maxId = qmsQueueGridMapper.selectMaxId();
+        qmsQueueGrid.setGridId(maxId);
+        qmsQueueGrid.setGridType(new BigDecimal(4));
+        qmsQueueGrid.setQueueLocationId(new BigDecimal(materialId));
+        qmsQueueGrid.setInsertUsername("admin");
+        qmsQueueGrid.setInsertTime(new Date());
+        qmsQueueGridMapper.insertSelective(qmsQueueGrid);
+        return maxId;
+    }
 }

+ 143 - 115
src/main/java/com/steerinfo/dil/service/impl/QmsQueueListServiceImpl.java

@@ -2,7 +2,11 @@ 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;
 import com.steerinfo.dil.model.QmsQueueResult;
+import com.steerinfo.dil.model.QmsQueueSpellingList;
+import com.steerinfo.dil.model.WebSocketCapacity;
 import com.steerinfo.dil.util.DataChange;
 import com.steerinfo.dil.model.QmsQueueList;
 import com.steerinfo.dil.mapper.QmsQueueListMapper;
@@ -11,11 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Date;
+import java.util.*;
 import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
 /**
  * QmsQueueList服务实现:
@@ -43,45 +44,100 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
     private QueuingRulesServiceImpl queuingRulesService;
 
     @Autowired
-    private TmsTruckFeign tmsTruckFeign;
+    private QueuingRulesMapper  queuingRulesMapper;
 
+    @Autowired
+    private QmsQueueSpellingListMapper qmsQueueSpellingListMapper;
     /**
-     * 开始排队  添加 链表排序
-     * @param map 运输订单ID
+     * 开始排队  添加 链表排序 司机点击确认
+     * @param orderId 运输订单ID
      * @return
      */
     @Transactional
-    public int addQueueList(Map<String, Object> map){
+    public int addQueueList(BigDecimal orderId){
+        //通过订单查询有几种物资
+        Map<String, Object> mesMap = qmsQueueListMapper.getMaterialNumByOrderId(orderId);
+        int materialNum = DataChange.dataToBigDecimal(mesMap.get("materialNum")).intValue();
+        if(materialNum == 1){
+            //单拼进入链表
+            //判断单拼链表中是否有已存在此辆车正在排队
+            if(qmsQueueListMapper.existsCapacity(mesMap.get("capacityId")) != null){
+                return 0;
+            }
+            return addListResult(mesMap);
+        }else {
+            //多拼进入排队队列
+            if(qmsQueueSpellingListMapper.existsCapacity(mesMap.get("capacityId")) != null){
+                return 0;
+            }
+            return addSpellingListResult(mesMap);
+        }
+    }
+
+    /**
+     * 添加链表
+     * @param map
+     * @return
+     */
+    public int addListResult(Map<String, Object> map){
         QmsQueueList qmsQueueList = new QmsQueueList();
-        //通过运输订单号查询 实绩中  网格Id 及 运力Id
-        Map<String, Object> listResultMap = qmsQueueListMapper.getQueueResultByOrderNumber(map);
-        map.putAll(listResultMap);
         //添加主键ID
         BigDecimal maxId = qmsQueueListMapper.selectMaxId();
         qmsQueueList.setListId(maxId);
-        //添加网格Id
-        BigDecimal gridId = DataChange.dataToBigDecimal(map.get("gridId"));
-        qmsQueueList.setGridId(gridId);
-        //添加运力Id
+        BigDecimal resultId = DataChange.dataToBigDecimal(map.get("resultId"));
+        qmsQueueList.setQueueResultId(resultId);
+        //添加网格ID、运力ID
+        qmsQueueList.setGridId(DataChange.dataToBigDecimal(map.get("gridId")));
         qmsQueueList.setCapacityId(DataChange.dataToBigDecimal(map.get("capacityId")));
         //查询当前链表还在排队中的 最大序号 + 1
         Integer maxListNodeOrder = qmsQueueListMapper.getMaxListNodeOrder(map);
         int nodeOrder = (maxListNodeOrder == null ? 0 : maxListNodeOrder) + 1;
         //添加排队序号与逻辑删除 0: 正在排队
         qmsQueueList.setListNodeOrder(new BigDecimal(nodeOrder));
-        qmsQueueList.setDeleted(new BigDecimal(0));
-
+        //添加常规字段
         qmsQueueList.setInsertUsername("admin");
         qmsQueueList.setInsertTime(new Date());
-        int i = qmsQueueListMapper.insertSelective(qmsQueueList);
+        qmsQueueListMapper.insertSelective(qmsQueueList);
+        //更新排队实绩表
+        updateQQR(resultId, maxId);
+        return 1;
+    }
+
+    /**
+     * 添加多拼排序
+     * @param map
+     * @return
+     */
+    public int addSpellingListResult(Map<String, Object> map){
+        QmsQueueSpellingList qmsQueueSpellingList = new QmsQueueSpellingList();
+        BigDecimal maxId = qmsQueueSpellingListMapper.selectMaxId();
+        qmsQueueSpellingList.setId(maxId);
+        //排队实绩ID
+        BigDecimal resultId = DataChange.dataToBigDecimal(map.get("resultId"));
+        qmsQueueSpellingList.setQueueResultId(resultId);
+        qmsQueueSpellingList.setSpelilingNum(DataChange.dataToBigDecimal(map.get("materialNum")));
+        qmsQueueSpellingList.setSpellingSureTime(new Date()); //确认时间
+        qmsQueueSpellingList.setInsertTime(new Date());
+        qmsQueueSpellingList.setInsertUsername("admin");
+        //新增排序实绩
+        qmsQueueSpellingListMapper.insertSelective(qmsQueueSpellingList);
         //更新排队实绩表
+        updateQQR(resultId, maxId);
+        return 1;
+    }
+
+    /**
+     *  更新排队实绩表
+     * @param resultId 实绩ID
+     * @param listId 链表Id
+     */
+    public void updateQQR(BigDecimal resultId, BigDecimal listId) {
         QmsQueueResult qmsQueueResult = new QmsQueueResult();
-        qmsQueueResult.setListId(maxId);
-        qmsQueueResult.setResultId(DataChange.dataToBigDecimal(map.get("resultId")));
+        qmsQueueResult.setListId(listId);
+        qmsQueueResult.setResultId(resultId);
         qmsQueueResult.setResultAcceptTime(new Date()); //添加接收时间
-        qmsQueueResult.setResultStartTime(new Date()); //添加排队时间
-        int i1 = qmsQueueResultMapper.updateByPrimaryKeySelective(qmsQueueResult);
-        return i1 + i ;
+        qmsQueueResult.setResultStartTime(new Date()); //添加排队开始时间
+        qmsQueueResultMapper.updateByPrimaryKeySelective(qmsQueueResult);
     }
 
     /**
@@ -93,68 +149,7 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
     @Override
     @Transactional
     public int changeQueue(Map<String, Object> map) {
-        //通过传入的实绩Id查询 链表Id 、运力Id
-        Map<String, Object> mapValue = qmsQueueListMapper.getQueueResultByOrderNumber(map);
-        BigDecimal resultId = DataChange.dataToBigDecimal(map.get("resultId"));
-        //获取链表ID
-        BigDecimal listId = DataChange.dataToBigDecimal(mapValue.get("listId"));
-        //修改原链表状态 1
-        updateQueueListToDie(listId);
-        //获取运力ID
-        BigDecimal capacityId = DataChange.dataToBigDecimal(mapValue.get("capacityId"));
-
-        //判断传入的是门岗 还是 月台 只会传入一个
-        if(map.get("gatepostName") != null || map.get("gatepostId") != null){
-            //如果传入的是门岗名称
-            if(map.get("gatepostName") != null){
-                //通过传入的门岗名称查询门岗ID
-                BigDecimal gatepostId = qmsQueueResultMapper.getGatepostIdByGatepostName((String) map.get("gatepostName"));
-                mapValue.put("queueLocationId", gatepostId);
-            }else {
-                //否则应该传入门岗ID
-                mapValue.put("queueLocationId", map.get("gatepostId"));
-            }
-            mapValue.put("gridType", 3);
-        }else {
-            if(map.get("platformName") != null){
-                //通过传入的月台名称查询月台ID
-                BigDecimal platformId = qmsQueueResultMapper.getPlatformIdByPlatformName((String) map.get("platformName"));
-                mapValue.put("queueLocationId", platformId);
-            }else {
-                //否则应该传入的是月台ID
-                mapValue.put("queueLocationId", map.get("platformId"));
-            }
-            mapValue.put("gridType", 1);
-        }
-
-        //通过门岗ID或者月台ID 和 网格类型 查询对应网格ID
-        BigDecimal gridId = queuingRulesService.getGridIdByGatepostIdAndGridType(mapValue);
-        //查询当前网格链表还在排队中的 最大序号 + 1
-        mapValue.put("gridId", gridId);
-        Integer maxListNodeOrder = qmsQueueListMapper.getMaxListNodeOrder(mapValue);
-        int listNodeOrder = (maxListNodeOrder == null ? 0 : maxListNodeOrder) + 1;
-        //新增一条链表
-        QmsQueueList qmsQueueList = new QmsQueueList();
-        //添加主键ID 新增的链表Id
-        BigDecimal maxId = qmsQueueListMapper.selectMaxId();
-        qmsQueueList.setListId(maxId);
-        //添加排队序号 逻辑删除 正在排队0 添加网格Id 添加运力Id
-        qmsQueueList.setListNodeOrder(new BigDecimal(listNodeOrder));
-        qmsQueueList.setDeleted(new BigDecimal(0));
-        qmsQueueList.setGridId(gridId);
-        qmsQueueList.setCapacityId(capacityId);
-
-        qmsQueueList.setInsertUsername("admin");
-        qmsQueueList.setInsertTime(new Date());
-        int i = qmsQueueListMapper.insertSelective(qmsQueueList);
-        //更新排队实绩表
-        QmsQueueResult qmsQueueResult = new QmsQueueResult();
-        qmsQueueResult.setId(resultId);
-        qmsQueueResult.setListId(maxId); //添加链表ID
-        qmsQueueResult.setResultTransferTime(new Date());   //添加转移时间
-        qmsQueueResult.setResultTransferReason((String) map.get("resultTransferReason")); //添加转移原因
-        int i1 = qmsQueueResultMapper.updateByPrimaryKeySelective(qmsQueueResult);
-        return i + i1;
+        return 1;
     }
 
     /**
@@ -162,23 +157,23 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
      *  传入参数:
      *  运输订单号 或 排队实绩ID
      *  取消原因
-     *  如果是司机:通过运输订单
+     *  如果是司机:通过运输订单ID
      *  如果是调度人员:可通过实绩Id
      * @param map
      * @return
      */
     @Override
+    @Transactional
     public int queueCancel(Map<String, Object> map) {
         int i = 0;
         if(map.get("resultIdList") != null){
-            List<Object> resultIdList = (List) map.get("resultIdList");
-            for (Object resultId : resultIdList) {
-                Map<String, Object> resultMap = new HashMap<>();
-                resultMap.put("resultId", resultId);
-                resultMap.put("resultCancelReason", map.get("resultCancelReason"));
-                i += queueCancelSon(resultMap);
+            Object resultCancelReason = map.get("resultCancelReason");
+            List<Map<String, Object>> resultIdList = (List) map.get("resultIdList");
+            for (Map<String, Object> objectMap : resultIdList) {
+                objectMap.put("resultCancelReason", resultCancelReason);
+                i += queueCancelSon(objectMap);
             }
-        }else if(map.get("orderNumber") != null){
+        }else if(map.get("phone") != null){
             i = queueCancelSon(map);
         }
         return i;
@@ -190,21 +185,16 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
      * @return
      */
     public int queueCancelSon(Map<String, Object> map){
-        BigDecimal resultId;
-        map.putAll(qmsQueueListMapper.getQueueResultByOrderNumber(map));
-        //获取实绩Id
-        resultId = DataChange.dataToBigDecimal(map.get("resultId"));
-        //获取链表Id
-        BigDecimal listId = DataChange.dataToBigDecimal(map.get("listId"));
-        // 更新链表 移出队列
-        int i = updateQueueListToDie(listId);
+        BigDecimal resultId = DataChange.dataToBigDecimal(map.get("resultId"));
+        //移出队列
+        qmsQueueListMapper.deleteByQueueResultId(resultId);
+        qmsQueueSpellingListMapper.deleteByQueueResultId(resultId);
         //更新排队实绩
         QmsQueueResult qmsQueueResult = new QmsQueueResult();
         qmsQueueResult.setResultId(resultId);
         qmsQueueResult.setResultCancelTime(new Date());//设置取消时间
         qmsQueueResult.setResultCancelReason((String) map.get("resultCancelReason"));//设置取消原因
-        int i1 = qmsQueueResultMapper.updateByPrimaryKeySelective(qmsQueueResult);
-        return i + i1;
+        return qmsQueueResultMapper.updateByPrimaryKeySelective(qmsQueueResult);
     }
 
     /**
@@ -245,27 +235,66 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
     /**
      * 进厂排队结束 PDA 形式
      * 运输订单号
-     * @param map
+     * @param resultTotalId
      * @return
      */
     @Override
     @Transactional
-    public int queueEndByPDA(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);
+    public int queueEndByPDA(BigDecimal resultTotalId) {
+        //通过总实绩ID查询排队实绩ID以及是否拼装
+        Map<String, Object> mesMap = qmsQueueResultMapper.getResultMesByTotalId(resultTotalId);
+        BigDecimal resultId = DataChange.dataToBigDecimal(mesMap.get("resultId"));
+        int isSpelling = DataChange.dataToBigDecimal(mesMap.get("isSpelling")).intValue();
+        //将此数据移出队列
+        if(isSpelling == 0){
+            qmsQueueListMapper.deleteByQueueResultId(resultId);
+        }else if(isSpelling == 1){
+            qmsQueueSpellingListMapper.deleteByQueueResultId(resultId);
+        }
         //给排队实绩中添加数据
         QmsQueueResult qmsQueueResult = new QmsQueueResult();
         qmsQueueResult.setResultId(resultId);
-
         qmsQueueResult.setResultEndTime(new Date());
-        int i1 = qmsQueueResultMapper.updateByPrimaryKeySelective(qmsQueueResult);
-        return i + i1;
+        qmsQueueResultMapper.updateByPrimaryKeySelective(qmsQueueResult);
+        return 1;
     }
 
+    /**
+     * 允许车辆进厂
+     * @param map
+     * @return
+     */
+    public int allowEnFactory(Map<String, Object> map){
+        List<Map<String, Object>> mapList = (List<Map<String, Object>>) map.get("mapList"); //获取勾选列表
+        String ssoId = String.valueOf(map.get("ssoId"));
+        String jobName = null;
+        if("null".equals(ssoId)){
+            //通过SSOID在人员表里查询相关人员账号 (唯一)
+            jobName = queuingRulesMapper.getPersonnelNameBySSoId(ssoId);
+        }
+        int count = 0;
+        ArrayList<Object> list = new ArrayList<>();
+        for (Map<String, Object> mesMap : mapList) {
+            if(mesMap.get("sureTime") != null){
+                continue;
+            }
+            mesMap.put("jobName", jobName);
+            if(mesMap.get("listId") != null){ //单拼
+                //更新排队链表
+                count += qmsQueueListMapper.updateListEnFactory(mesMap);
+            }else{
+                //更新排序表
+                count += qmsQueueSpellingListMapper.updateListEnFactory(mesMap);
+            }
+            //更新进厂实绩
+            qmsQueueListMapper.updateEnFactoryResult(mesMap);
+            list.add(new WebSocketCapacity(5 , "system",String.valueOf(mesMap.get("capacityNumber")), "可以进厂" + new Date(), new Date()));
+        }
+        queuingRulesService.pushMesToWebsocket(list);
+        return count;
+    }
+
+
     /**
      * 发送运输订单信息给门岗系统
      * 包含运输订单号,车牌号,门岗名称;
@@ -299,7 +328,6 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
     public int updateQueueListToDie(BigDecimal listId){
         QmsQueueList qmsQueueList = new QmsQueueList();
         qmsQueueList.setId(listId);
-        qmsQueueList.setDeleted(new BigDecimal(1));
         return qmsQueueListMapper.updateByPrimaryKeySelective(qmsQueueList);
     }
 

+ 44 - 39
src/main/java/com/steerinfo/dil/service/impl/QmsQueueResultServiceImpl.java

@@ -41,6 +41,9 @@ public class QmsQueueResultServiceImpl implements IQmsQueueResultService {
     @Autowired
     private QueuingRulesServiceImpl queuingRulesService;
 
+    @Autowired
+    private QmsQueueGridServiceImpl qmsQueueGridService;
+
     @Autowired
     private QueuingRulesMapper queuingRulesMapper;
 
@@ -49,64 +52,63 @@ public class QmsQueueResultServiceImpl implements IQmsQueueResultService {
 
     /**
      * 新增进厂排队实绩
-     * @param map vno 车牌号  plateColor 车牌颜色 areaId 区域Id  areaName 区域名称  type 进区域  utc 时间
+     * @param  capacityNumber 车牌号
      * @return
      */
     @Override
-    public int addQueueResult(Map<String, Object> map) {
-        QmsQueueResult qmsQueueResult = new QmsQueueResult();
-        //生成主键
-        qmsQueueResult.setId(qmsQueueResultMapper.selectMaxId());
+    public int addQueueResult(String capacityNumber) {
         //获取传入的车牌号查找最近的运输订单号
-        String capacityNumber = (String) map.get("vno");
-        String orderNumber = queuingRulesMapper.getOrderNumberByCapacityNumber(capacityNumber.split("_")[0]);
-        if(orderNumber==null){
+        Map<String, Object> mesMap = queuingRulesMapper.getOrderNumberByCapacityNumber(capacityNumber.split("_")[0]);
+        if(mesMap == null){
             return -1;
         }
-
-
-        //查询实绩总表ID 运力Id
-        map.putAll(qmsQueueResultMapper.queryCIdAndTIdByOrderNumber(orderNumber));
-        //查询门岗ID
-        List<BigDecimal> gatepostIdList = queuingRulesMapper.queryGatepostIdByOrderId(DataChange.dataToBigDecimal(map.get("orderId")));
-        Map<String, Object> queryMap = new HashMap<>();
-        queryMap.put("gridType", 3); //3为门岗类型
-        queryMap.put("queueLocationId", gatepostIdList.get(0));
-        BigDecimal gridId = queuingRulesMapper.getGridIdByGatepostIdAndGridType(queryMap);
-        //新增进厂排队实绩 添加申请时间
-        qmsQueueResult.setGridId(gridId);
+        Integer resultId = queuingRulesMapper.checkoutQQR(mesMap.get("resultTotalId"));
+        if(resultId != null){ //预防重复新增排队
+            return -2;
+        }
+        QmsQueueResult qmsQueueResult = new QmsQueueResult();
+        qmsQueueResult.setId(qmsQueueResultMapper.selectMaxId());
+        qmsQueueResult.setResultTotalId(DataChange.dataToBigDecimal(mesMap.get("resultTotalId")));
+        int materialNum = DataChange.dataToBigDecimal(mesMap.get("materialNum")).intValue();
+        BigDecimal grid;
+        if(materialNum == 1){
+            BigDecimal orderId = DataChange.dataToBigDecimal(mesMap.get("orderId"));
+            //单拼添加仓储网格ID 、 通过物资Id查询网格ID
+            grid = qmsQueueResultMapper.getGridIdByOrderId(orderId);
+            if(grid == null){
+                //新增一个仓储网格实绩   通过订单查询物资ID
+                Integer materialId = qmsQueueResultMapper.getMaterialIdByOrderId(orderId);
+                grid = qmsQueueGridService.addQQR(materialId);
+            }
+            qmsQueueResult.setGridId(grid);
+            qmsQueueResult.setIsSpelling(new BigDecimal(0));
+        }else {
+            qmsQueueResult.setGridId(new BigDecimal(materialNum));
+            qmsQueueResult.setIsSpelling(new BigDecimal(1));
+        }
+        //添加排队实绩表
         qmsQueueResult.setResultApplyforTime(new Date());
         //系统自动下发 添加下发时间
         qmsQueueResult.setResultDownTime(new Date());
-        //添加运力ID和总实绩ID
-        qmsQueueResult.setCapacityId(DataChange.dataToBigDecimal(map.get("capacityId")));
-        qmsQueueResult.setResultTotalId(DataChange.dataToBigDecimal(map.get("resultTotalId")));
-
+        qmsQueueResult.setCapacityId(DataChange.dataToBigDecimal(mesMap.get("capacityId")));
+        qmsQueueResult.setResultTotalId(DataChange.dataToBigDecimal(mesMap.get("resultTotalId")));
         qmsQueueResult.setInsertTime(new Date());
         qmsQueueResult.setInsertUsername("admin");
         return qmsQueueResultMapper.insertSelective(qmsQueueResult);
     }
 
-
     /**
-     * 推送消息到websocket
+     * 司机通过订单ID查询当前订单的排队实绩
+     * @param orderId
      * @return
      */
-    public void pushCGMesToWebsocket(Integer orderId, Integer gridId){
-        //通过运输订单ID查询推送给司机的数据
-        Map<String, Object> mesMap = qmsQueueResultMapper.sendEnFactoryMesToWebSocket(orderId);
-        //通过网格Id查询门岗名称
-        mesMap.putAll(qmsQueueResultMapper.queryGatepostNameByGridId(gridId));
-        HashMap<String, Object> sendMap = new HashMap<>();
-        sendMap.put("messageType", 2);
-        sendMap.put("receivePerson", mesMap.get("capacityNumber"));
-        sendMap.put("sendPerson", "system");
-        sendMap.put("messageContent", mesMap);
-        //调用websocket接口
-        imFeign.sendToUser(sendMap);
+    public Map<String, Object> getQueueResultByOrderId(String orderId){
+        Map<String,Object> map = qmsQueueResultMapper.getQueueResultByOrderId(new BigDecimal(orderId));
+        return map;
     }
 
 
+
     /**
      * 新增仓库排队实绩
      * @param map orderNumber运输订单号  loadingId 装车点
@@ -225,6 +227,10 @@ public class QmsQueueResultServiceImpl implements IQmsQueueResultService {
         return qmsQueueResultMapper.getQueueListByQueueUp(map);
     }
 
+    public List<Map<String, Object>> getQueueListByQueueUpSpelling(Map<String, Object> map) {
+        return  qmsQueueResultMapper.getQueueListByQueueUpSpelling(map);
+    }
+
     /**
      * 查询排队详情
      * @param map
@@ -404,7 +410,6 @@ public class QmsQueueResultServiceImpl implements IQmsQueueResultService {
         Map<String, Object> listIdMap = qmsQueueResultMapper.getListIdByResultId(resultId);
         BigDecimal listId = (BigDecimal) listIdMap.get("listId");
         QmsQueueList qmsQueueList = qmsQueueListMapper.selectByPrimaryKey(listId);
-        qmsQueueList.setDeleted(new BigDecimal(1));
         qmsQueueResult.setResultCancelTime(new Date());
         qmsQueueResult.setResultCancelReason(resultCancelReason);
         qmsQueueListMapper.updateByPrimaryKeySelective(qmsQueueList);

+ 33 - 0
src/main/java/com/steerinfo/dil/service/impl/QmsQueueSpellingListServiceImpl.java

@@ -0,0 +1,33 @@
+package com.steerinfo.dil.service.impl;
+
+import com.steerinfo.framework.mapper.IBaseMapper;
+import com.steerinfo.framework.service.impl.BaseServiceImpl;
+import com.steerinfo.dil.model.QmsQueueSpellingList;
+import com.steerinfo.dil.mapper.QmsQueueSpellingListMapper;
+import com.steerinfo.dil.service.IQmsQueueSpellingListService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.util.Date;
+import java.math.BigDecimal;
+import java.util.Map;
+
+/**
+ * QmsQueueSpellingList服务实现:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2022-04-09 03:14
+ * 类描述
+ * 修订历史:
+ * 日期:2022-04-09
+ * 作者:generator
+ * 参考:
+ * 描述:QmsQueueSpellingList服务实现
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+@Service(value = "qmsQueueSpellingListService")
+public class QmsQueueSpellingListServiceImpl implements IQmsQueueSpellingListService {
+
+    @Autowired
+    private QmsQueueSpellingListMapper qmsQueueSpellingListMapper;
+
+}

+ 106 - 0
src/main/java/com/steerinfo/dil/service/impl/QueuingRulesServiceImpl.java

@@ -1,10 +1,16 @@
 package com.steerinfo.dil.service.impl;
 
+import com.steerinfo.dil.feign.IMFeign;
+import com.steerinfo.dil.mapper.QmsQueueListMapper;
 import com.steerinfo.dil.mapper.QmsQueueResultMapper;
+import com.steerinfo.dil.mapper.QmsQueueSpellingListMapper;
 import com.steerinfo.dil.mapper.QueuingRulesMapper;
+import com.steerinfo.dil.model.QmsQueueList;
+import com.steerinfo.dil.model.QmsQueueSpellingList;
 import com.steerinfo.dil.service.IQueuingRulesService;
 import com.steerinfo.dil.util.DataChange;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -24,6 +30,106 @@ public class QueuingRulesServiceImpl implements IQueuingRulesService {
     @Resource
     private QueuingRulesMapper queuingRulesMapper;
 
+    @Autowired
+    private QmsQueueListMapper qmsQueueListMapper;
+
+    @Autowired
+    private QmsQueueSpellingListMapper qmsQueueSpellingListMapper;
+
+    @Autowired
+    private IMFeign imFeign;
+    /**
+     * 定时检查  钢材科已确认进厂之后  30分钟没有结束 自动回滚到队列末尾,移除可进厂时间
+     */
+    @Scheduled(fixedRate = 1000 * 60)
+    public void checkoutQueueList(){
+        long nowTime = System.currentTimeMillis();
+        //查询所有单拼排队网格已经确认进厂的记录
+        List<Map<String, Object>> listListMap = queuingRulesMapper.getAllSureTimeList();
+        for (Map<String, Object> map : listListMap) {
+            if((nowTime - ((Date) map.get("entrySureTime")).getTime()) > 1800000){
+                //如果超过勾选时间30分钟 自动回滚到队列最后
+                BigDecimal listId = DataChange.dataToBigDecimal(map.get("listId"));
+                Integer maxListNodeOrder = qmsQueueListMapper.getMaxListNodeOrder(map);
+                queuingRulesMapper.updateListToLast(listId, maxListNodeOrder + 1);
+                //移除可进厂资格
+                queuingRulesMapper.updateEnFactory(DataChange.dataToBigDecimal(map.get("resultTotalId")));
+                if((nowTime - ((Date) map.get("insertTime")).getTime()) > 86400000){
+                    //如果大于一天则直接删除队列信息
+                    qmsQueueListMapper.deleteByPrimaryKey(listId);
+                    queuingRulesMapper.updateQQRRemoveList(DataChange.dataToBigDecimal(map.get("resultId")));
+                }
+            }
+        }
+        //查询所有多拼排队网格已经确认进厂的记录
+        List<Map<String, Object>> allSureTimeSpellingList = queuingRulesMapper.getAllSureTimeSpellingList();
+        for (Map<String, Object> map : allSureTimeSpellingList) {
+            if ((nowTime - ((Date) map.get("entrySureTime")).getTime()) > 1800000) {
+                BigDecimal spellingResultId = DataChange.dataToBigDecimal(map.get("spellingResultId"));
+                //如果超过勾选时间30分钟 自动回滚到队列最后
+                queuingRulesMapper.updateSpellingListToLast(spellingResultId);
+                //移除可进厂资格
+                queuingRulesMapper.updateEnFactory(DataChange.dataToBigDecimal(map.get("resultTotalId")));
+                if((nowTime - ((Date) map.get("spellingSureTime")).getTime()) > 86400000){
+                    //如果大于一天则直接删除队列信息
+                    qmsQueueSpellingListMapper.deleteByPrimaryKey(spellingResultId);
+                    queuingRulesMapper.updateQQRRemoveList(DataChange.dataToBigDecimal(map.get("resultId")));
+                }
+            }
+        }
+    }
+
+    /**
+     * 遍历排队所有未勾选确认进厂的排队数据,如果已经超过一天则踢出队列
+     */
+    @Scheduled(fixedRate = 1000 * 60 * 30)
+    public void checkoutQueue(){
+        long nowTime = System.currentTimeMillis();
+        List<Map<String, Object>> listMap = queuingRulesMapper.getAllNotSureEnFactoryList();
+        for (Map<String, Object> map : listMap) {
+            if((nowTime - ((Date) map.get("insertTime")).getTime()) > 86400000){
+                //踢出队列
+                qmsQueueListMapper.deleteByPrimaryKey(DataChange.dataToBigDecimal(map.get("listId")));
+                //修改信息
+                queuingRulesMapper.updateQQRRemoveList(DataChange.dataToBigDecimal(map.get("resultId")));
+            }
+        }
+        List<Map<String, Object>> spellingListMap = queuingRulesMapper.getAllNotSureEnFactorySpellingList();
+        for (Map<String, Object> map : spellingListMap) {
+            if((nowTime - ((Date) map.get("spellingSureTime")).getTime()) > 86400000){
+                //如果大于一天则直接删除队列信息
+                qmsQueueSpellingListMapper.deleteByPrimaryKey(DataChange.dataToBigDecimal(map.get("spellingResultId")));
+                queuingRulesMapper.updateQQRRemoveList(DataChange.dataToBigDecimal(map.get("resultId")));
+            }
+        }
+    }
+
+
+    /**
+     * 推送消息给websocket
+     */
+    public void pushMesToWebsocket(ArrayList<Object> list) {
+        HashMap<Object, Object> sendMap = new HashMap<>();
+        sendMap.put("messages", list);
+        imFeign.sendToUser(sendMap);
+    }
+
+    /*
+    //添加消息实体
+        HashMap<Object, Object> mesMap = new HashMap<>();
+        mesMap.put("messageType", 4); //用于进厂后 刷新消息
+        mesMap.put("sendPerson", "system");
+        mesMap.put("receivePerson", capacityNumber);
+        mesMap.put("messageContent", pushMes + new Date());
+        mesMap.put("createTime", new Date());
+        ArrayList<Object> list = new ArrayList<>();
+        list.add(mesMap);
+        //调用websocket接口推送
+        HashMap<Object, Object> sendMap = new HashMap<>();
+        //将消息实体放入list中存到map中
+        sendMap.put("messages", list);
+        imFeign.sendToUser(sendMap);
+     */
     /*=========================进厂排队规则=========================*/
 
     /**

+ 1 - 1
src/main/java/com/steerinfo/dil/util/ColumnDataUtil.java

@@ -29,7 +29,7 @@ public class ColumnDataUtil {
         List<Map<String, Object>> columnDataList = columnDataFeign.getColumnData(apiId);
         for (Map<String, Object> columnData : columnDataList) {
             //每个表头字段的过滤条件
-            columnData.put("filters", setListMap(list, columnData.get("prop").toString()));
+            columnData.put("filters", setListMap(data, columnData.get("prop").toString()));
         }
         PageListAdd pageList = new PageListAdd(data);
         pageList.setColumnData(columnDataList);

+ 83 - 14
src/main/java/com/steerinfo/dil/util/DataChange.java

@@ -7,6 +7,7 @@ import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Pattern;
 
 /**
  * @ author    :TXF
@@ -17,24 +18,45 @@ public class DataChange {
 
 
     /**
-     * 解析前端传来的日期字符串
+     * 时间转换类
+     * 处理了三种类型 yyyy-MM-dd HH:mm:ss  yyyy/MM/dd HH:mm:ss  时间戳类型(带毫秒数时间戳13位)
      * @param vueDate
      * @return
      */
     public static Date dataToDate(Object vueDate){
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-        Date parseDate = null;
-        if (vueDate != null){
+        if(vueDate instanceof Date){
+            return (Date) vueDate;
+        } else {
             try {
-                String date = (String) vueDate;
-                parseDate = sdf.parse(date);
-            } catch (ParseException e) {
-                e.printStackTrace();
+                String str = String.valueOf(vueDate);
+                if(judgeNumber(str) && str.length() == 13){
+                    return new Date(Long.parseLong(str));
+                }else if(str.contains("-")){
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                    return sdf.parse(str);
+                }else if(str.contains("/")){
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+                    return sdf.parse(str);
+                }
+            }catch (Exception e){
+                System.out.println("时间解析错误!返回null");
+                return null;
             }
         }
-        return parseDate;
+        return null;
+    }
+
+    /**
+     * 判断是否纯数字(不带小数点)仅供上面方法使用
+     * @param str
+     * @return
+     */
+    public static boolean judgeNumber(String str){
+        Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
+        return pattern.matcher(str).matches();
     }
 
+
     /**
      * 数据转换成BigDecimal
      * @param data
@@ -72,7 +94,7 @@ public class DataChange {
         if(date == null)
             return null;
         try{
-             changeDate = (Date) date;
+            changeDate = (Date) date;
         }catch (Exception e){
             e.printStackTrace();
         }
@@ -106,19 +128,18 @@ public class DataChange {
      * @param key
      */
     public static void dataTo2Number(List<Map<String, Object>> list, String ...key){
+        DecimalFormat df =  new DecimalFormat("0.00");
         //遍历List
         for (Map<String, Object> map : list) {
             for (String s : key) {
                 //修改数据为带两位小数
                 try {
-                    BigDecimal oldDate = (BigDecimal) map.get(s);
-                    DecimalFormat df =  new DecimalFormat("0.00");
+                    BigDecimal oldDate = dataToBigDecimal(map.get(s));
                     String resultDeduction = df.format(oldDate.doubleValue());
                     map.put(s, resultDeduction);
                 } catch (Exception e) {
                     System.out.println("原料扣减量数据有误");
                 }
-
             }
         }
     }
@@ -167,7 +188,7 @@ public class DataChange {
     }
 
     /**
-     * 根据时间段查询数据
+     * 根据时间段查询数据 支持只选择单个时间
      * @Author TXF
      * @Date 2022/1/10 23:21
      * @param startTime
@@ -188,4 +209,52 @@ public class DataChange {
             map.put("oneDate", sdf.format(new Date()));
         }
     }
+
+    /**
+     * 只支持两个时间查询
+     * @Author TXF
+     * @Date 2022/1/15 9:08
+     * @param startTime
+     * @param endTime
+     * @param sdf
+     * @return
+     **/
+    public static void queryDataByDateTime(String startTime, String endTime, Map<String, Object> map,SimpleDateFormat sdf){
+        SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
+        if (startTime != null && !"null".equals(startTime) && endTime != null && !"null".equals(endTime)) {
+            map.put("startDate", sdf.format(new Date(Long.parseLong(startTime))));
+            map.put("endDate", sdf.format(new Date(Long.parseLong(endTime))));
+        }
+        //如果开始时间和结束时间有且只有一个为空 则只查那天的数据
+        else if((startTime != null && !"null".equals(startTime)) || (endTime != null && !"null".equals(endTime))){
+            if(startTime != null && !"null".equals(startTime)){
+                queryDataByTwoDateSon(map, startTime, sdfDate);
+            }
+            if(endTime != null && !"null".equals(endTime)){
+                queryDataByTwoDateSon(map, endTime, sdfDate);
+            }
+        }else {
+            //如果两者时间都为空,则查询当天数据
+            String nowDate = sdfDate.format(new Date());
+            map.put("oneDate", nowDate + " 00:00:00");
+        }
+    }
+
+    /**
+     * 上面方法的儿子方法 如果只传入了一个时间 则查询那天的数据
+     * @Author TXF
+     * @Date 2022/1/17 16:17
+     * @param map
+     * @param time
+     * @param sdfDate
+     * @return
+     **/
+    private static void queryDataByTwoDateSon(Map<String, Object> map, String time, SimpleDateFormat sdfDate){
+        Date date1 = new Date(Long.parseLong(time));
+        Date date2 = new Date(Long.parseLong(time) + 86400000);
+        String dayStartTime = sdfDate.format(date1);
+        String dayEndTime = sdfDate.format(date2);
+        map.put("startDate", dayStartTime + " 00:00:00");
+        map.put("endDate", dayEndTime + " 00:00:00");
+    }
 }

+ 1 - 1
src/main/resources/bootstrap.yml

@@ -10,7 +10,7 @@ spring:
   mvc:
     static-path-pattern:
   profiles:
-    include: ${SPRING_PROFILES:prod}
+    include: ${SPRING_PROFILES:dev}
 #  cloud:
 #    config:
 #      fail-fast: true

+ 216 - 118
src/main/resources/com/steerinfo/dil/mapper/QmsQueueListMapper.xml

@@ -12,23 +12,26 @@
     <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
     <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
     <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
+    <result column="QUEUE_RESULT_ID" jdbcType="DECIMAL" property="queueResultId" />
+    <result column="ENTRY_SURE_TIME" jdbcType="TIMESTAMP" property="entrySureTime" />
   </resultMap>
   <sql id="columns">
     LIST_ID, GRID_ID, CAPACITY_ID, LIST_NODE_ORDER, DELETED, INSERT_USERNAME, INSERT_TIME, 
-    UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK
+    UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, QUEUE_RESULT_ID, ENTRY_SURE_TIME
   </sql>
   <sql id="columns_alias">
     t.LIST_ID, t.GRID_ID, t.CAPACITY_ID, t.LIST_NODE_ORDER, t.DELETED, t.INSERT_USERNAME, 
-    t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK
+    t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.QUEUE_RESULT_ID, 
+    t.ENTRY_SURE_TIME
   </sql>
   <sql id="select">
-    SELECT <include refid="columns"/> FROM QMS_QUEUE_LIST
+    SELECT <include refid="columns" /> FROM QMS_QUEUE_LIST
   </sql>
   <sql id="select_alias">
-    SELECT <include refid="columns_alias"/> FROM QMS_QUEUE_LIST t
+    SELECT <include refid="columns_alias" /> FROM QMS_QUEUE_LIST t
   </sql>
   <sql id="where">
-    <where> 
+    <where>
       <if test="listId != null">
         and LIST_ID = #{listId}
       </if>
@@ -59,10 +62,16 @@
       <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
         and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
       </if>
+      <if test="queueResultId != null">
+        and QUEUE_RESULT_ID = #{queueResultId}
+      </if>
+      <if test="entrySureTime != null">
+        and TO_CHAR(ENTRY_SURE_TIME,'yyyy-MM-dd') = #{entrySureTime}
+      </if>
     </where>
   </sql>
   <sql id="whereLike">
-    <where> 
+    <where>
       <if test="listId != null">
         and LIST_ID = #{listId}
       </if>
@@ -93,6 +102,12 @@
       <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
         and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
       </if>
+      <if test="queueResultId != null">
+        and QUEUE_RESULT_ID = #{queueResultId}
+      </if>
+      <if test="entrySureTime != null">
+        and TO_CHAR(ENTRY_SURE_TIME,'yyyy-MM-dd') = #{entrySureTime}
+      </if>
     </where>
   </sql>
   <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
@@ -101,44 +116,52 @@
   </delete>
   <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
     delete from QMS_QUEUE_LIST
-    where 1!=1 
-      <if test="gridId != null">
-        or GRID_ID = #{gridId}
-      </if>
-      <if test="capacityId != null">
-        or CAPACITY_ID = #{capacityId}
-      </if>
-      <if test="listNodeOrder != null">
-        or LIST_NODE_ORDER = #{listNodeOrder}
-      </if>
-      <if test="deleted != null and deleted != ''">
-        or DELETED = #{deleted}
-      </if>
-      <if test="insertUsername != null and insertUsername != ''">
-        or INSERT_USERNAME = #{insertUsername}
-      </if>
-      <if test="insertTime != null">
-        or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
-      </if>
-      <if test="updateUsername != null and updateUsername != ''">
-        or UPDATE_USERNAME = #{updateUsername}
-      </if>
-      <if test="updateTime != null">
-        or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
-      </if>
-      <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
-        or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
-      </if>
+    where 1!=1
+    <if test="gridId != null">
+      or GRID_ID = #{gridId}
+    </if>
+    <if test="capacityId != null">
+      or CAPACITY_ID = #{capacityId}
+    </if>
+    <if test="listNodeOrder != null">
+      or LIST_NODE_ORDER = #{listNodeOrder}
+    </if>
+    <if test="deleted != null and deleted != ''">
+      or DELETED = #{deleted}
+    </if>
+    <if test="insertUsername != null and insertUsername != ''">
+      or INSERT_USERNAME = #{insertUsername}
+    </if>
+    <if test="insertTime != null">
+      or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
+    </if>
+    <if test="updateUsername != null and updateUsername != ''">
+      or UPDATE_USERNAME = #{updateUsername}
+    </if>
+    <if test="updateTime != null">
+      or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
+    </if>
+    <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
+      or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
+    </if>
+    <if test="queueResultId != null">
+      or QUEUE_RESULT_ID = #{queueResultId}
+    </if>
+    <if test="entrySureTime != null">
+      or TO_CHAR(ENTRY_SURE_TIME,'yyyy-MM-dd') = '#{entrySureTime}'
+    </if>
   </delete>
   <insert id="insert" parameterType="com.steerinfo.dil.model.QmsQueueList">
-    insert into QMS_QUEUE_LIST (LIST_ID, GRID_ID, CAPACITY_ID, 
-      LIST_NODE_ORDER, DELETED, INSERT_USERNAME, 
-      INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, 
-      INSERT_UPDATE_REMARK)
-    values (#{listId,jdbcType=DECIMAL}, #{gridId,jdbcType=DECIMAL}, #{capacityId,jdbcType=DECIMAL}, 
-      #{listNodeOrder,jdbcType=DECIMAL}, #{deleted,jdbcType=VARCHAR}, #{insertUsername,jdbcType=VARCHAR}, 
-      #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, 
-      #{insertUpdateRemark,jdbcType=VARCHAR})
+    insert into QMS_QUEUE_LIST (LIST_ID, GRID_ID, CAPACITY_ID,
+                                LIST_NODE_ORDER, DELETED, INSERT_USERNAME,
+                                INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
+                                INSERT_UPDATE_REMARK, QUEUE_RESULT_ID, ENTRY_SURE_TIME
+    )
+    values (#{listId,jdbcType=DECIMAL}, #{gridId,jdbcType=DECIMAL}, #{capacityId,jdbcType=DECIMAL},
+            #{listNodeOrder,jdbcType=DECIMAL}, #{deleted,jdbcType=VARCHAR}, #{insertUsername,jdbcType=VARCHAR},
+            #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
+            #{insertUpdateRemark,jdbcType=VARCHAR}, #{queueResultId,jdbcType=DECIMAL}, #{entrySureTime,jdbcType=TIMESTAMP}
+           )
   </insert>
   <insert id="insertSelective" parameterType="com.steerinfo.dil.model.QmsQueueList">
     insert into QMS_QUEUE_LIST
@@ -173,6 +196,12 @@
       <if test="insertUpdateRemark != null">
         INSERT_UPDATE_REMARK,
       </if>
+      <if test="queueResultId != null">
+        QUEUE_RESULT_ID,
+      </if>
+      <if test="entrySureTime != null">
+        ENTRY_SURE_TIME,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="listId != null">
@@ -205,19 +234,27 @@
       <if test="insertUpdateRemark != null">
         #{insertUpdateRemark,jdbcType=VARCHAR},
       </if>
+      <if test="queueResultId != null">
+        #{queueResultId,jdbcType=DECIMAL},
+      </if>
+      <if test="entrySureTime != null">
+        #{entrySureTime,jdbcType=TIMESTAMP},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.QmsQueueList">
     update QMS_QUEUE_LIST
     set GRID_ID = #{gridId,jdbcType=DECIMAL},
-      CAPACITY_ID = #{capacityId,jdbcType=DECIMAL},
-      LIST_NODE_ORDER = #{listNodeOrder,jdbcType=DECIMAL},
-      DELETED = #{deleted,jdbcType=VARCHAR},
-      INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
-      INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
-      UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
-      UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
-      INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR}
+        CAPACITY_ID = #{capacityId,jdbcType=DECIMAL},
+        LIST_NODE_ORDER = #{listNodeOrder,jdbcType=DECIMAL},
+        DELETED = #{deleted,jdbcType=VARCHAR},
+        INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
+        INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
+        UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
+        UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
+        INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
+        QUEUE_RESULT_ID = #{queueResultId,jdbcType=DECIMAL},
+        ENTRY_SURE_TIME = #{entrySureTime,jdbcType=TIMESTAMP}
     where LIST_ID = #{listId,jdbcType=DECIMAL}
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.QmsQueueList">
@@ -250,92 +287,111 @@
       <if test="insertUpdateRemark != null">
         INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
       </if>
+      <if test="queueResultId != null">
+        QUEUE_RESULT_ID = #{queueResultId,jdbcType=DECIMAL},
+      </if>
+      <if test="entrySureTime != null">
+        ENTRY_SURE_TIME = #{entrySureTime,jdbcType=TIMESTAMP},
+      </if>
     </set>
     where LIST_ID = #{listId,jdbcType=DECIMAL}
   </update>
   <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
-    <include refid="select"/>
+    <include refid="select" />
     where LIST_ID = #{listId,jdbcType=DECIMAL}
   </select>
   <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
-    <include refid="select"/>
-    <include refid="where"/>
+    <include refid="select" />
+    <include refid="where" />
   </select>
   <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
-    <include refid="select"/>
-    <include refid="whereLike"/>
+    <include refid="select" />
+    <include refid="whereLike" />
   </select>
   <insert id="batchInsert" parameterType="java.util.List">
-    insert into QMS_QUEUE_LIST 
-      (LIST_ID, 
-      GRID_ID, CAPACITY_ID, LIST_NODE_ORDER, 
-      DELETED, INSERT_USERNAME, INSERT_TIME, 
-      UPDATE_USERNAME, UPDATE_TIME, 
-      INSERT_UPDATE_REMARK)
-    ( <foreach collection="list" item="item" separator="union all"> 
-   select  
-      #{item.listId,jdbcType=DECIMAL}, 
-      #{item.gridId,jdbcType=DECIMAL}, #{item.capacityId,jdbcType=DECIMAL}, #{item.listNodeOrder,jdbcType=DECIMAL}, 
-      #{item.deleted,jdbcType=VARCHAR}, #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP}, 
-      #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP}, 
-      #{item.insertUpdateRemark,jdbcType=VARCHAR} from dual  
-   </foreach> )
+    insert into QMS_QUEUE_LIST
+    (LIST_ID,
+    GRID_ID, CAPACITY_ID, LIST_NODE_ORDER,
+    DELETED, INSERT_USERNAME, INSERT_TIME,
+    UPDATE_USERNAME, UPDATE_TIME,
+    INSERT_UPDATE_REMARK, QUEUE_RESULT_ID,
+    ENTRY_SURE_TIME)
+    ( <foreach collection="list" item="item" separator="union all">
+    select
+    #{item.listId,jdbcType=DECIMAL},
+    #{item.gridId,jdbcType=DECIMAL}, #{item.capacityId,jdbcType=DECIMAL}, #{item.listNodeOrder,jdbcType=DECIMAL},
+    #{item.deleted,jdbcType=VARCHAR}, #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
+    #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
+    #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.queueResultId,jdbcType=DECIMAL},
+    #{item.entrySureTime,jdbcType=TIMESTAMP} from dual
+  </foreach> )
   </insert>
   <update id="batchUpdate" parameterType="java.util.List">
-     update QMS_QUEUE_LIST
-     set
-       LIST_ID=
-       <foreach collection="list" item="item" index="index" separator=" " open="case LIST_ID" close="end">
-          when #{item.listId,jdbcType=DECIMAL} then #{item.listId,jdbcType=DECIMAL}
-       </foreach>
-       ,GRID_ID=
-       <foreach collection="list" item="item" index="index" separator=" " open="case LIST_ID" close="end">
-          when #{item.listId,jdbcType=DECIMAL} then #{item.gridId,jdbcType=DECIMAL}
-       </foreach>
-       ,CAPACITY_ID=
-       <foreach collection="list" item="item" index="index" separator=" " open="case LIST_ID" close="end">
-          when #{item.listId,jdbcType=DECIMAL} then #{item.capacityId,jdbcType=DECIMAL}
-       </foreach>
-       ,LIST_NODE_ORDER=
-       <foreach collection="list" item="item" index="index" separator=" " open="case LIST_ID" close="end">
-          when #{item.listId,jdbcType=DECIMAL} then #{item.listNodeOrder,jdbcType=DECIMAL}
-       </foreach>
-       ,DELETED=
-       <foreach collection="list" item="item" index="index" separator=" " open="case LIST_ID" close="end">
-          when #{item.listId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=VARCHAR}
-       </foreach>
-       ,INSERT_USERNAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case LIST_ID" close="end">
-          when #{item.listId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
-       </foreach>
-       ,INSERT_TIME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case LIST_ID" close="end">
-          when #{item.listId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
-       </foreach>
-       ,UPDATE_USERNAME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case LIST_ID" close="end">
-          when #{item.listId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
-       </foreach>
-       ,UPDATE_TIME=
-       <foreach collection="list" item="item" index="index" separator=" " open="case LIST_ID" close="end">
-          when #{item.listId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
-       </foreach>
-       ,INSERT_UPDATE_REMARK=
-       <foreach collection="list" item="item" index="index" separator=" " open="case LIST_ID" close="end">
-          when #{item.listId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
-       </foreach>
-     where LIST_ID in 
-     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
-    #{item.listId,jdbcType=DECIMAL}
-     </foreach> 
+    update QMS_QUEUE_LIST
+    set
+    LIST_ID=
+    <foreach close="end" collection="list" index="index" item="item" open="case LIST_ID" separator=" ">
+      when #{item.listId,jdbcType=DECIMAL} then #{item.listId,jdbcType=DECIMAL}
+    </foreach>
+    ,GRID_ID=
+    <foreach close="end" collection="list" index="index" item="item" open="case LIST_ID" separator=" ">
+      when #{item.listId,jdbcType=DECIMAL} then #{item.gridId,jdbcType=DECIMAL}
+    </foreach>
+    ,CAPACITY_ID=
+    <foreach close="end" collection="list" index="index" item="item" open="case LIST_ID" separator=" ">
+      when #{item.listId,jdbcType=DECIMAL} then #{item.capacityId,jdbcType=DECIMAL}
+    </foreach>
+    ,LIST_NODE_ORDER=
+    <foreach close="end" collection="list" index="index" item="item" open="case LIST_ID" separator=" ">
+      when #{item.listId,jdbcType=DECIMAL} then #{item.listNodeOrder,jdbcType=DECIMAL}
+    </foreach>
+    ,DELETED=
+    <foreach close="end" collection="list" index="index" item="item" open="case LIST_ID" separator=" ">
+      when #{item.listId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=VARCHAR}
+    </foreach>
+    ,INSERT_USERNAME=
+    <foreach close="end" collection="list" index="index" item="item" open="case LIST_ID" separator=" ">
+      when #{item.listId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
+    </foreach>
+    ,INSERT_TIME=
+    <foreach close="end" collection="list" index="index" item="item" open="case LIST_ID" separator=" ">
+      when #{item.listId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
+    </foreach>
+    ,UPDATE_USERNAME=
+    <foreach close="end" collection="list" index="index" item="item" open="case LIST_ID" separator=" ">
+      when #{item.listId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
+    </foreach>
+    ,UPDATE_TIME=
+    <foreach close="end" collection="list" index="index" item="item" open="case LIST_ID" separator=" ">
+      when #{item.listId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
+    </foreach>
+    ,INSERT_UPDATE_REMARK=
+    <foreach close="end" collection="list" index="index" item="item" open="case LIST_ID" separator=" ">
+      when #{item.listId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
+    </foreach>
+    ,QUEUE_RESULT_ID=
+    <foreach close="end" collection="list" index="index" item="item" open="case LIST_ID" separator=" ">
+      when #{item.listId,jdbcType=DECIMAL} then #{item.queueResultId,jdbcType=DECIMAL}
+    </foreach>
+    ,ENTRY_SURE_TIME=
+    <foreach close="end" collection="list" index="index" item="item" open="case LIST_ID" separator=" ">
+      when #{item.listId,jdbcType=DECIMAL} then #{item.entrySureTime,jdbcType=TIMESTAMP}
+    </foreach>
+    where LIST_ID in
+    <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
+      #{item.listId,jdbcType=DECIMAL}
+    </foreach>
   </update>
   <delete id="batchDelete" parameterType="java.util.List">
     delete from QMS_QUEUE_LIST
-    where LIST_ID in 
-    <foreach collection="list" item="id" open="(" close=")" separator=",">
+    where LIST_ID in
+    <foreach close=")" collection="list" item="id" open="(" separator=",">
       #{id}
     </foreach>
   </delete>
+  <!-- 友情提示!!!-->
+  <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+
   <!-- 友情提示!!!-->
   <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
   <!--   排序 -->
@@ -354,7 +410,6 @@
     select max(QQL.LIST_NODE_ORDER)
     from QMS_QUEUE_LIST QQL
     where QQL.GRID_ID = #{gridId}
-      and QQL.DELETED = 0
   </select>
 
 <!--  通过运输订单号 或实绩Id 关联 实绩总表 查询 排队实绩 -->
@@ -526,4 +581,47 @@
         and QQL.GRID_ID = #{gridId}
       </if>
  </select>
+
+    <select id="getMaterialNumByOrderId" parameterType="java.math.BigDecimal" resultType="map">
+
+      select
+             OO.CAPACITY_ID     "capacityId",
+             QQR.GRID_ID        "gridId",
+             QQR.RESULT_ID      "resultId",
+             (select COUNT(MATERIAL_ID)
+              from OMSTRUCK_ORDER_MATERIAL OOM
+              where OOM.ORDER_ID = OO.ORDER_ID) "materialNum"
+      from OMSTRUCK_ORDER OO
+        left join TMSTRUCK_TOTAL_RESULT TTR on OO.ORDER_ID = TTR.ORDER_ID
+        left join QMS_QUEUE_RESULT  QQR on TTR.RESULT_TOTAL_ID = QQR.RESULT_TOTAL_ID
+      where OO.ORDER_ID = #{orderId}
+    </select>
+
+  <select id="existsCapacity" resultType="java.lang.Integer">
+        select QQL.LIST_ID from QMS_QUEUE_LIST QQL where CAPACITY_ID = #{capacityId}
+  </select>
+
+
+  <delete id="deleteByQueueResultId" parameterType="java.math.BigDecimal">
+    delete from QMS_QUEUE_LIST where QUEUE_RESULT_ID = #{queueResultId}
+  </delete>
+
+
+  <update id="updateListEnFactory" parameterType="map">
+    UPDATE QMS_QUEUE_LIST SET ENTRY_SURE_TIME = SYSDATE, DELETED = 2
+    <if test="jobName != null">
+      , UPDATE_USERNAME  = #{jobName}
+    </if>
+    WHERE LIST_ID = #{listId}
+  </update>
+
+  <update id="updateEnFactoryResult" parameterType="map">
+    UPDATE TMSTRUCK_ENFACTORY_RESULT TER SET UPDATE_TIME = SYSDATE, INSERT_UPDATE_REMARK = 'OK'
+    <if test="jobName != null">
+      , UPDATE_USERNAME = #{jobName}
+    </if>
+    WHERE TER.RESULT_TOTAL_ID = #{resultTotalId}
+  </update>
+
+
 </mapper>

+ 264 - 174
src/main/resources/com/steerinfo/dil/mapper/QmsQueueResultMapper.xml

@@ -2,52 +2,50 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.steerinfo.dil.mapper.QmsQueueResultMapper">
     <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.QmsQueueResult">
-        <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId"/>
-        <result column="RESULT_TOTAL_ID" jdbcType="DECIMAL" property="resultTotalId"/>
-        <result column="CAPACITY_ID" jdbcType="DECIMAL" property="capacityId"/>
-        <result column="RESULT_APPLYFOR_TIME" jdbcType="TIMESTAMP" property="resultApplyforTime"/>
-        <result column="RESULT_APPLYFOR_LOCATION" jdbcType="VARCHAR" property="resultApplyforLocation"/>
-        <result column="GRID_ID" jdbcType="DECIMAL" property="gridId"/>
-        <result column="RESULT_DOWN_TIME" jdbcType="TIMESTAMP" property="resultDownTime"/>
-        <result column="RESULT_ACCEPT_TIME" jdbcType="TIMESTAMP" property="resultAcceptTime"/>
-        <result column="RESULT_START_TIME" jdbcType="TIMESTAMP" property="resultStartTime"/>
-        <result column="RESULT_END_TIME" jdbcType="TIMESTAMP" property="resultEndTime"/>
-        <result column="RESULT_CANCEL_TIME" jdbcType="TIMESTAMP" property="resultCancelTime"/>
-        <result column="RESULT_CANCEL_REASON" jdbcType="VARCHAR" property="resultCancelReason"/>
-        <result column="RESULT_INSERT_TIME" jdbcType="TIMESTAMP" property="resultInsertTime"/>
-        <result column="RESULT_INSERT_REASON" jdbcType="VARCHAR" property="resultInsertReason"/>
-        <result column="RESULT_TRANSFER_TIME" jdbcType="TIMESTAMP" property="resultTransferTime"/>
-        <result column="RESULT_TRANSFER_REASON" jdbcType="VARCHAR" property="resultTransferReason"/>
-        <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername"/>
-        <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime"/>
-        <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername"/>
-        <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
-        <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark"/>
-        <result column="LIST_ID" jdbcType="DECIMAL" property="listId"/>
+        <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
+        <result column="RESULT_TOTAL_ID" jdbcType="DECIMAL" property="resultTotalId" />
+        <result column="CAPACITY_ID" jdbcType="DECIMAL" property="capacityId" />
+        <result column="RESULT_APPLYFOR_TIME" jdbcType="TIMESTAMP" property="resultApplyforTime" />
+        <result column="RESULT_APPLYFOR_LOCATION" jdbcType="VARCHAR" property="resultApplyforLocation" />
+        <result column="GRID_ID" jdbcType="DECIMAL" property="gridId" />
+        <result column="RESULT_DOWN_TIME" jdbcType="TIMESTAMP" property="resultDownTime" />
+        <result column="RESULT_ACCEPT_TIME" jdbcType="TIMESTAMP" property="resultAcceptTime" />
+        <result column="RESULT_START_TIME" jdbcType="TIMESTAMP" property="resultStartTime" />
+        <result column="RESULT_END_TIME" jdbcType="TIMESTAMP" property="resultEndTime" />
+        <result column="RESULT_CANCEL_TIME" jdbcType="TIMESTAMP" property="resultCancelTime" />
+        <result column="RESULT_CANCEL_REASON" jdbcType="VARCHAR" property="resultCancelReason" />
+        <result column="RESULT_INSERT_TIME" jdbcType="TIMESTAMP" property="resultInsertTime" />
+        <result column="RESULT_INSERT_REASON" jdbcType="VARCHAR" property="resultInsertReason" />
+        <result column="RESULT_TRANSFER_TIME" jdbcType="TIMESTAMP" property="resultTransferTime" />
+        <result column="RESULT_TRANSFER_REASON" jdbcType="VARCHAR" property="resultTransferReason" />
+        <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
+        <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
+        <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
+        <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
+        <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
+        <result column="LIST_ID" jdbcType="DECIMAL" property="listId" />
+        <result column="AREA_ID" jdbcType="VARCHAR" property="areaId" />
+        <result column="IS_SPELLING" jdbcType="DECIMAL" property="isSpelling" />
     </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
+    UPDATE_TIME, INSERT_UPDATE_REMARK, LIST_ID, AREA_ID, IS_SPELLING
     </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.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.LIST_ID, t.AREA_ID, t.IS_SPELLING
     </sql>
     <sql id="select">
-        SELECT
-        <include refid="columns"/>
-        FROM QMS_QUEUE_RESULT
+        SELECT <include refid="columns" /> FROM QMS_QUEUE_RESULT
     </sql>
     <sql id="select_alias">
-        SELECT
-        <include refid="columns_alias"/>
-        FROM QMS_QUEUE_RESULT t
+        SELECT <include refid="columns_alias" /> FROM QMS_QUEUE_RESULT t
     </sql>
     <sql id="where">
         <where>
@@ -117,6 +115,12 @@
             <if test="listId != null">
                 and LIST_ID = #{listId}
             </if>
+            <if test="areaId != null and areaId != ''">
+                and AREA_ID = #{areaId}
+            </if>
+            <if test="isSpelling != null">
+                and IS_SPELLING = #{isSpelling}
+            </if>
         </where>
     </sql>
     <sql id="whereLike">
@@ -187,11 +191,16 @@
             <if test="listId != null">
                 and LIST_ID = #{listId}
             </if>
+            <if test="areaId != null and areaId != ''">
+                and AREA_ID LIKE '%${areaId}%'
+            </if>
+            <if test="isSpelling != null">
+                and IS_SPELLING = #{isSpelling}
+            </if>
         </where>
     </sql>
-    <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
-        delete
-        from QMS_QUEUE_RESULT
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
+        delete from QMS_QUEUE_RESULT
         where RESULT_ID = #{resultId,jdbcType=DECIMAL}
     </delete>
     <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
@@ -260,6 +269,12 @@
         <if test="listId != null">
             or LIST_ID = #{listId}
         </if>
+        <if test="areaId != null and areaId != ''">
+            or AREA_ID = #{areaId}
+        </if>
+        <if test="isSpelling != null">
+            or IS_SPELLING = #{isSpelling}
+        </if>
     </delete>
     <insert id="insert" parameterType="com.steerinfo.dil.model.QmsQueueResult">
         insert into QMS_QUEUE_RESULT (RESULT_ID, RESULT_TOTAL_ID, CAPACITY_ID,
@@ -270,20 +285,18 @@
                                       RESULT_INSERT_REASON, RESULT_TRANSFER_TIME,
                                       RESULT_TRANSFER_REASON, INSERT_USERNAME, INSERT_TIME,
                                       UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
-                                      LIST_ID)
+                                      LIST_ID, AREA_ID, IS_SPELLING
+        )
         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},
-                #{resultStartTime,jdbcType=TIMESTAMP}, #{resultEndTime,jdbcType=TIMESTAMP},
-                #{resultCancelTime,jdbcType=TIMESTAMP},
+                #{gridId,jdbcType=DECIMAL}, #{resultDownTime,jdbcType=TIMESTAMP}, #{resultAcceptTime,jdbcType=TIMESTAMP},
+                #{resultStartTime,jdbcType=TIMESTAMP}, #{resultEndTime,jdbcType=TIMESTAMP}, #{resultCancelTime,jdbcType=TIMESTAMP},
                 #{resultCancelReason,jdbcType=VARCHAR}, #{resultInsertTime,jdbcType=TIMESTAMP},
                 #{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})
+                #{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}
+               )
     </insert>
     <insert id="insertSelective" parameterType="com.steerinfo.dil.model.QmsQueueResult">
         insert into QMS_QUEUE_RESULT
@@ -354,6 +367,12 @@
             <if test="listId != null">
                 LIST_ID,
             </if>
+            <if test="areaId != null">
+                AREA_ID,
+            </if>
+            <if test="isSpelling != null">
+                IS_SPELLING,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="resultId != null">
@@ -422,31 +441,39 @@
             <if test="listId != null">
                 #{listId,jdbcType=DECIMAL},
             </if>
+            <if test="areaId != null">
+                #{areaId,jdbcType=VARCHAR},
+            </if>
+            <if test="isSpelling != null">
+                #{isSpelling,jdbcType=DECIMAL},
+            </if>
         </trim>
     </insert>
     <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.QmsQueueResult">
         update QMS_QUEUE_RESULT
-        set RESULT_TOTAL_ID          = #{resultTotalId,jdbcType=DECIMAL},
-            CAPACITY_ID              = #{capacityId,jdbcType=DECIMAL},
-            RESULT_APPLYFOR_TIME     = #{resultApplyforTime,jdbcType=TIMESTAMP},
+        set RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
+            CAPACITY_ID = #{capacityId,jdbcType=DECIMAL},
+            RESULT_APPLYFOR_TIME = #{resultApplyforTime,jdbcType=TIMESTAMP},
             RESULT_APPLYFOR_LOCATION = #{resultApplyforLocation,jdbcType=VARCHAR},
-            GRID_ID                  = #{gridId,jdbcType=DECIMAL},
-            RESULT_DOWN_TIME         = #{resultDownTime,jdbcType=TIMESTAMP},
-            RESULT_ACCEPT_TIME       = #{resultAcceptTime,jdbcType=TIMESTAMP},
-            RESULT_START_TIME        = #{resultStartTime,jdbcType=TIMESTAMP},
-            RESULT_END_TIME          = #{resultEndTime,jdbcType=TIMESTAMP},
-            RESULT_CANCEL_TIME       = #{resultCancelTime,jdbcType=TIMESTAMP},
-            RESULT_CANCEL_REASON     = #{resultCancelReason,jdbcType=VARCHAR},
-            RESULT_INSERT_TIME       = #{resultInsertTime,jdbcType=TIMESTAMP},
-            RESULT_INSERT_REASON     = #{resultInsertReason,jdbcType=VARCHAR},
-            RESULT_TRANSFER_TIME     = #{resultTransferTime,jdbcType=TIMESTAMP},
-            RESULT_TRANSFER_REASON   = #{resultTransferReason,jdbcType=VARCHAR},
-            INSERT_USERNAME          = #{insertUsername,jdbcType=VARCHAR},
-            INSERT_TIME              = #{insertTime,jdbcType=TIMESTAMP},
-            UPDATE_USERNAME          = #{updateUsername,jdbcType=VARCHAR},
-            UPDATE_TIME              = #{updateTime,jdbcType=TIMESTAMP},
-            INSERT_UPDATE_REMARK     = #{insertUpdateRemark,jdbcType=VARCHAR},
-            LIST_ID                  = #{listId,jdbcType=DECIMAL}
+            GRID_ID = #{gridId,jdbcType=DECIMAL},
+            RESULT_DOWN_TIME = #{resultDownTime,jdbcType=TIMESTAMP},
+            RESULT_ACCEPT_TIME = #{resultAcceptTime,jdbcType=TIMESTAMP},
+            RESULT_START_TIME = #{resultStartTime,jdbcType=TIMESTAMP},
+            RESULT_END_TIME = #{resultEndTime,jdbcType=TIMESTAMP},
+            RESULT_CANCEL_TIME = #{resultCancelTime,jdbcType=TIMESTAMP},
+            RESULT_CANCEL_REASON = #{resultCancelReason,jdbcType=VARCHAR},
+            RESULT_INSERT_TIME = #{resultInsertTime,jdbcType=TIMESTAMP},
+            RESULT_INSERT_REASON = #{resultInsertReason,jdbcType=VARCHAR},
+            RESULT_TRANSFER_TIME = #{resultTransferTime,jdbcType=TIMESTAMP},
+            RESULT_TRANSFER_REASON = #{resultTransferReason,jdbcType=VARCHAR},
+            INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
+            INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
+            UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
+            UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
+            INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
+            LIST_ID = #{listId,jdbcType=DECIMAL},
+            AREA_ID = #{areaId,jdbcType=VARCHAR},
+            IS_SPELLING = #{isSpelling,jdbcType=DECIMAL}
         where RESULT_ID = #{resultId,jdbcType=DECIMAL}
     </update>
     <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.QmsQueueResult">
@@ -515,20 +542,26 @@
             <if test="listId != null">
                 LIST_ID = #{listId,jdbcType=DECIMAL},
             </if>
+            <if test="areaId != null">
+                AREA_ID = #{areaId,jdbcType=VARCHAR},
+            </if>
+            <if test="isSpelling != null">
+                IS_SPELLING = #{isSpelling,jdbcType=DECIMAL},
+            </if>
         </set>
         where RESULT_ID = #{resultId,jdbcType=DECIMAL}
     </update>
-    <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
-        <include refid="select"/>
+    <select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
+        <include refid="select" />
         where RESULT_ID = #{resultId,jdbcType=DECIMAL}
     </select>
     <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
-        <include refid="select"/>
-        <include refid="where"/>
+        <include refid="select" />
+        <include refid="where" />
     </select>
     <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
-        <include refid="select"/>
-        <include refid="whereLike"/>
+        <include refid="select" />
+        <include refid="whereLike" />
     </select>
     <insert id="batchInsert" parameterType="java.util.List">
         insert into QMS_QUEUE_RESULT
@@ -542,12 +575,12 @@
         RESULT_TRANSFER_TIME, RESULT_TRANSFER_REASON,
         INSERT_USERNAME, INSERT_TIME,
         UPDATE_USERNAME, UPDATE_TIME,
-        INSERT_UPDATE_REMARK, LIST_ID)
+        INSERT_UPDATE_REMARK, LIST_ID, AREA_ID,
+        IS_SPELLING)
         ( <foreach collection="list" item="item" separator="union all">
         select
         #{item.resultId,jdbcType=DECIMAL},
-        #{item.resultTotalId,jdbcType=DECIMAL}, #{item.capacityId,jdbcType=DECIMAL},
-        #{item.resultApplyforTime,jdbcType=TIMESTAMP},
+        #{item.resultTotalId,jdbcType=DECIMAL}, #{item.capacityId,jdbcType=DECIMAL}, #{item.resultApplyforTime,jdbcType=TIMESTAMP},
         #{item.resultApplyforLocation,jdbcType=VARCHAR}, #{item.gridId,jdbcType=DECIMAL},
         #{item.resultDownTime,jdbcType=TIMESTAMP}, #{item.resultAcceptTime,jdbcType=TIMESTAMP},
         #{item.resultStartTime,jdbcType=TIMESTAMP}, #{item.resultEndTime,jdbcType=TIMESTAMP},
@@ -556,109 +589,118 @@
         #{item.resultTransferTime,jdbcType=TIMESTAMP}, #{item.resultTransferReason,jdbcType=VARCHAR},
         #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
         #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
-        #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.listId,jdbcType=DECIMAL} from dual
+        #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.listId,jdbcType=DECIMAL}, #{item.areaId,jdbcType=VARCHAR},
+        #{item.isSpelling,jdbcType=DECIMAL} from dual
     </foreach> )
     </insert>
     <update id="batchUpdate" parameterType="java.util.List">
         update QMS_QUEUE_RESULT
         set
         RESULT_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.resultId,jdbcType=DECIMAL}
         </foreach>
         ,RESULT_TOTAL_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.resultTotalId,jdbcType=DECIMAL}
         </foreach>
         ,CAPACITY_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.capacityId,jdbcType=DECIMAL}
         </foreach>
         ,RESULT_APPLYFOR_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.resultApplyforTime,jdbcType=TIMESTAMP}
         </foreach>
         ,RESULT_APPLYFOR_LOCATION=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.resultApplyforLocation,jdbcType=VARCHAR}
         </foreach>
         ,GRID_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.gridId,jdbcType=DECIMAL}
         </foreach>
         ,RESULT_DOWN_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.resultDownTime,jdbcType=TIMESTAMP}
         </foreach>
         ,RESULT_ACCEPT_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.resultAcceptTime,jdbcType=TIMESTAMP}
         </foreach>
         ,RESULT_START_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.resultStartTime,jdbcType=TIMESTAMP}
         </foreach>
         ,RESULT_END_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.resultEndTime,jdbcType=TIMESTAMP}
         </foreach>
         ,RESULT_CANCEL_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.resultCancelTime,jdbcType=TIMESTAMP}
         </foreach>
         ,RESULT_CANCEL_REASON=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.resultCancelReason,jdbcType=VARCHAR}
         </foreach>
         ,RESULT_INSERT_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.resultInsertTime,jdbcType=TIMESTAMP}
         </foreach>
         ,RESULT_INSERT_REASON=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.resultInsertReason,jdbcType=VARCHAR}
         </foreach>
         ,RESULT_TRANSFER_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.resultTransferTime,jdbcType=TIMESTAMP}
         </foreach>
         ,RESULT_TRANSFER_REASON=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.resultTransferReason,jdbcType=VARCHAR}
         </foreach>
         ,INSERT_USERNAME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
         </foreach>
         ,INSERT_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
         </foreach>
         ,UPDATE_USERNAME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
         </foreach>
         ,UPDATE_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
         </foreach>
         ,INSERT_UPDATE_REMARK=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
         </foreach>
         ,LIST_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.listId,jdbcType=DECIMAL}
         </foreach>
+        ,AREA_ID=
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.areaId,jdbcType=VARCHAR}
+        </foreach>
+        ,IS_SPELLING=
+        <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>
         where RESULT_ID in
-        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+        <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
-        <foreach collection="list" item="id" open="(" close=")" separator=",">
+        <foreach close=")" collection="list" item="id" open="(" separator=",">
             #{id}
         </foreach>
     </delete>
@@ -780,93 +822,72 @@
 
     <!-- 查询排队开始 -->
     <select id="getQueueListByQueueUp" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
-        select
+        SELECT
         *
-        from(
-        select
-        QQR.RESULT_ID "resultId",
+        FROM
         (
-        case
-            when OO.ORDER_TYPE in (5, 6, 7, 8) then
-            (
-                select APO.PURCHASE_ORDER_NO from AMS_PURCHASE_ORDER APO
-                where APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
-            )
-            when OO.ORDER_TYPE in (1, 2, 3) then
-            (
-                select ASO.SALE_NUMBER from AMS_SALE_ORDER ASO
-                where ASO.SALE_ORDER_ID = OO.ORDER_PLAN_ID
-            )
-        end
-        ) "orderNo",
-        OO.ORDER_NUMBER "orderNumber",
-        RC.CAPACITY_NUMBER "capacityNumber",
-        QQR.RESULT_START_TIME "resultStartTime",
-        RG.GATEPOST_NAME "gatepostName",
-        (
-        <![CDATA[
-                select
-                    count(*)
-                from
-                    QMS_QUEUE_LIST QQL2
-                        join QMS_QUEUE_GRID QQG2
-                             on QQG2.GRID_ID = QQL2.GRID_ID
-                where
-                    QQL2.LIST_NODE_ORDER <= QQL.list_node_order
-                  and QQL2.GRID_ID = QQL.GRID_ID
-                  and QQL2.DELETED = 0
-        ]]>
-        ) "listNodeOrder",
-        RC.CAPACITY_VIP "capacityVip"
-
-        from QMS_QUEUE_RESULT QQR
-        left join QMS_QUEUE_LIST QQL
-        on QQR.LIST_ID = QQL.LIST_ID
-        left join QMS_QUEUE_GRID QQG
-        on QQG.GRID_ID = QQL.GRID_ID
-        left join RMS_GATEPOST RG
-        on RG.GATEPOST_ID = QQG.QUEUE_LOCATION_ID
-        left join TMSTRUCK_TOTAL_RESULT TTR
-        on TTR.RESULT_TOTAL_ID = QQR.RESULT_TOTAL_ID
-        left join OMSTRUCK_ORDER OO
-        on OO.ORDER_ID = TTR.ORDER_ID
-        left join RMS_CAPACITY RC
-        on QQR.CAPACITY_ID = RC.CAPACITY_ID
-
-        where QQR.RESULT_START_TIME is not null
-        and QQL.DELETED = 0
-        <if test="gridId != null">
-            and QQL.GRID_ID = #{gridId}
-        </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",
+                   OO.DRIVER_TEL                "driverTel",
+                   (
+                       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="locationId != null">
+                    and QQL.GRID_ID = #{locationId}
+                    ORDER BY "listNodeOrder"
+                </if>
+            </where>
+            <if test="locationId == null">
+                ORDER BY "materialName" DESC, "listNodeOrder"
+            </if>
         )
         <where>
-            <if test="purchaseOrderNo != null">
-                <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
-                    "purchaseOrderNo" like '%${item}%'
+            <if test="resultStartTime != null">
+                <foreach collection="resultStartTime" item="item" open="(" separator="or" close=")">
+                    "resultStartTime" like '%${item}%'
                 </foreach>
             </if>
-            <if test="orderNumber != null">
+            <if test="materialName != null">
                 and
-                <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
-                    "orderNumber" like '%${item}%'
+                <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+                    "materialName" like '%${item}%'
                 </foreach>
             </if>
-            <if test="capacityNumber != null">
+            <if test="materialSpecification != null">
                 and
-                <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
-                    "capacityNumber" like '%${item}%'
+                <foreach collection="materialSpecification" item="item" open="(" separator="or" close=")">
+                    "materialSpecification" like '%${item}%'
                 </foreach>
             </if>
-            <if test="resultStartTime != null">
+            <if test="materialModel != null">
                 and
-                <foreach collection="resultStartTime" item="item" open="(" separator="or" close=")">
-                    "resultStartTime" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="gatepostName != null">
-                and
-                <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
-                    "gatepostName" like '%${item}%'
+                <foreach collection="materialModel" item="item" open="(" separator="or" close=")">
+                    "materialModel" like '%${item}%'
                 </foreach>
             </if>
             <if test="listNodeOrder != null">
@@ -876,12 +897,53 @@
                 </foreach>
             </if>
         </where>
-        <include refid="orderBy"></include>
-        <if test="orderField == null  ">
-            order by "resultStartTime" desc
+    </select>
+
+
+    <select id="getQueueListByQueueUpSpelling" parameterType="map" resultType="java.util.LinkedHashMap">
+        select QQR.RESULT_ID        "resultId",
+               QQR.RESULT_TOTAL_ID  "resultTotalId",
+               QQR.RESULT_START_TIME    "resultStartTime",
+               RC.CAPACITY_NUMBER       "capacityNumber",
+               QQSL.SPELILING_NUM       "grid",
+               QQSL.SPELLING_RESULT_ID  "spellingResultId",
+                RM.MATERIAL_ID       "materialId",
+                RM.MATERIAL_NAME     "materialName",
+                RM.MATERIAL_SPECIFICATION    "materialSpecification",
+                RC.CAPACITY_ID           "capacityId",
+                RM.MATERIAL_MODEL        "materialModel",
+               QQSL.ENTRY_SURE_TIME      "sureTime",
+                OOM.ORDER_MATERIAL_NUMBER    "materialNumber",
+               OO.DRIVER_TEL            "driverTel",
+              (
+                  select count(QQSL2.SPELLING_RESULT_ID) from QMS_QUEUE_SPELLING_LIST QQSL2
+                  where QQSL.SPELILING_NUM = QQSL2.SPELILING_NUM
+                   and QQSL.SPELLING_SURE_TIME &lt;= QQSL2.SPELLING_SURE_TIME
+
+              )     "listNodeOrder"
+
+        from QMS_QUEUE_SPELLING_LIST QQSL
+            left join QMS_QUEUE_RESULT  QQR ON QQSL.QUEUE_RESULT_ID = QQR.RESULT_ID
+            left join RMS_CAPACITY RC ON QQR.CAPACITY_ID = RC.CAPACITY_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 OMSTRUCK_ORDER OO on TTR.ORDER_ID = OO.ORDER_ID
+        <where>
+            <if test="capacityNumber != null">
+                instr(RC.CAPACITY_NUMBER, #{capacityNumber}) > 0
+            </if>
+            <if test="locationId != null">
+                and QQSL.SPELILING_NUM  = #{locationId}
+                ORDER BY "listNodeOrder"
+            </if>
+        </where>
+        <if test="locationId == null">
+            order by QQSL.SPELILING_NUM DESC, "listNodeOrder"
         </if>
     </select>
 
+
     <!--  查看进厂排队详情  -->
     <select id="getQueueMes" resultType="java.util.Map" parameterType="java.util.Map">
         select *
@@ -2252,4 +2314,32 @@
         where QQG.GRID_ID = #{gridId}
     </select>
 
+<!--  通过订单Id查询物资下面的仓储网格ID  -->
+    <select id="getGridIdByOrderId" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
+        select QQR.GRID_ID  "grid"
+        from OMSTRUCK_ORDER_MATERIAL OOM
+        left join QMS_QUEUE_GRID QQR on OOM.MATERIAL_ID = QQR.QUEUE_LOCATION_ID
+        where OOM.ORDER_ID = #{orderId} and QQR.GRID_TYPE = 4
+    </select>
+
+    <select id="getMaterialIdByOrderId" parameterType="java.math.BigDecimal" resultType="java.lang.Integer">
+        select OOM.MATERIAL_ID from OMSTRUCK_ORDER_MATERIAL OOM where OOM.ORDER_ID = #{orderId}
+    </select>
+
+    <select id="getQueueResultByOrderId" parameterType="java.math.BigDecimal" resultType="java.util.Map">
+        select QQR.RESULT_ID    "resultId",
+               QQR.RESULT_DOWN_TIME "resultDownTime"
+        from TMSTRUCK_TOTAL_RESULT TTR
+                 left join QMS_QUEUE_RESULT QQR on TTR.RESULT_TOTAL_ID = QQR.RESULT_TOTAL_ID
+        where TTR.ORDER_ID = #{orderId}
+    </select>
+
+    <select id="getResultMesByTotalId" parameterType="java.math.BigDecimal" resultType="java.util.Map">
+        select QQR.RESULT_ID "resultId",
+               QQR.IS_SPELLING  "isSpelling"
+        from QMS_QUEUE_RESULT QQR
+        where QQR.RESULT_TOTAL_ID = #{resultTotalId}
+    </select>
+
+
 </mapper>

+ 365 - 0
src/main/resources/com/steerinfo/dil/mapper/QmsQueueSpellingListMapper.xml

@@ -0,0 +1,365 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.steerinfo.dil.mapper.QmsQueueSpellingListMapper">
+  <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.QmsQueueSpellingList">
+    <id column="SPELLING_RESULT_ID" jdbcType="DECIMAL" property="spellingResultId" />
+    <result column="QUEUE_RESULT_ID" jdbcType="DECIMAL" property="queueResultId" />
+    <result column="SPELILING_NUM" jdbcType="DECIMAL" property="spelilingNum" />
+    <result column="SPELLING_SURE_TIME" jdbcType="TIMESTAMP" property="spellingSureTime" />
+    <result column="ENTRY_SURE_TIME" jdbcType="TIMESTAMP" property="entrySureTime" />
+    <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
+    <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
+    <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="UPDATE_USERNAME" jdbcType="TIMESTAMP" property="updateUsername" />
+    <result column="DELETED" jdbcType="DECIMAL" property="deleted" />
+  </resultMap>
+  <sql id="columns">
+    SPELLING_RESULT_ID, QUEUE_RESULT_ID, SPELILING_NUM, SPELLING_SURE_TIME, ENTRY_SURE_TIME, 
+    INSERT_TIME, INSERT_USERNAME, UPDATE_TIME, UPDATE_USERNAME, DELETED
+  </sql>
+  <sql id="columns_alias">
+    t.SPELLING_RESULT_ID, t.QUEUE_RESULT_ID, t.SPELILING_NUM, t.SPELLING_SURE_TIME, t.ENTRY_SURE_TIME, 
+    t.INSERT_TIME, t.INSERT_USERNAME, t.UPDATE_TIME, t.UPDATE_USERNAME, t.DELETED
+  </sql>
+  <sql id="select">
+    SELECT <include refid="columns" /> FROM QMS_QUEUE_SPELLING_LIST
+  </sql>
+  <sql id="select_alias">
+    SELECT <include refid="columns_alias" /> FROM QMS_QUEUE_SPELLING_LIST t
+  </sql>
+  <sql id="where">
+    <where> 
+      <if test="spellingResultId != null">
+        and SPELLING_RESULT_ID = #{spellingResultId}
+      </if>
+      <if test="queueResultId != null">
+        and QUEUE_RESULT_ID = #{queueResultId}
+      </if>
+      <if test="spelilingNum != null">
+        and SPELILING_NUM = #{spelilingNum}
+      </if>
+      <if test="spellingSureTime != null">
+        and TO_CHAR(SPELLING_SURE_TIME,'yyyy-MM-dd') = #{spellingSureTime}
+      </if>
+      <if test="entrySureTime != null">
+        and TO_CHAR(ENTRY_SURE_TIME,'yyyy-MM-dd') = #{entrySureTime}
+      </if>
+      <if test="insertTime != null">
+        and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
+      </if>
+      <if test="insertUsername != null and insertUsername != ''">
+        and INSERT_USERNAME = #{insertUsername}
+      </if>
+      <if test="updateTime != null">
+        and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
+      </if>
+      <if test="updateUsername != null">
+        and TO_CHAR(UPDATE_USERNAME,'yyyy-MM-dd') = #{updateUsername}
+      </if>
+      <if test="deleted != null">
+        and DELETED = #{deleted}
+      </if>
+    </where>
+  </sql>
+  <sql id="whereLike">
+    <where> 
+      <if test="spellingResultId != null">
+        and SPELLING_RESULT_ID = #{spellingResultId}
+      </if>
+      <if test="queueResultId != null">
+        and QUEUE_RESULT_ID = #{queueResultId}
+      </if>
+      <if test="spelilingNum != null">
+        and SPELILING_NUM = #{spelilingNum}
+      </if>
+      <if test="spellingSureTime != null">
+        and TO_CHAR(SPELLING_SURE_TIME,'yyyy-MM-dd') = #{spellingSureTime}
+      </if>
+      <if test="entrySureTime != null">
+        and TO_CHAR(ENTRY_SURE_TIME,'yyyy-MM-dd') = #{entrySureTime}
+      </if>
+      <if test="insertTime != null">
+        and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
+      </if>
+      <if test="insertUsername != null and insertUsername != ''">
+        and INSERT_USERNAME LIKE '%${insertUsername}%'
+      </if>
+      <if test="updateTime != null">
+        and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
+      </if>
+      <if test="updateUsername != null">
+        and TO_CHAR(UPDATE_USERNAME,'yyyy-MM-dd') = #{updateUsername}
+      </if>
+      <if test="deleted != null">
+        and DELETED = #{deleted}
+      </if>
+    </where>
+  </sql>
+  <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
+    delete from QMS_QUEUE_SPELLING_LIST
+    where SPELLING_RESULT_ID = #{spellingResultId,jdbcType=DECIMAL}
+  </delete>
+  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
+    delete from QMS_QUEUE_SPELLING_LIST
+    where 1!=1 
+      <if test="queueResultId != null">
+        or QUEUE_RESULT_ID = #{queueResultId}
+      </if>
+      <if test="spelilingNum != null">
+        or SPELILING_NUM = #{spelilingNum}
+      </if>
+      <if test="spellingSureTime != null">
+        or TO_CHAR(SPELLING_SURE_TIME,'yyyy-MM-dd') = '#{spellingSureTime}'
+      </if>
+      <if test="entrySureTime != null">
+        or TO_CHAR(ENTRY_SURE_TIME,'yyyy-MM-dd') = '#{entrySureTime}'
+      </if>
+      <if test="insertTime != null">
+        or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
+      </if>
+      <if test="insertUsername != null and insertUsername != ''">
+        or INSERT_USERNAME = #{insertUsername}
+      </if>
+      <if test="updateTime != null">
+        or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
+      </if>
+      <if test="updateUsername != null">
+        or TO_CHAR(UPDATE_USERNAME,'yyyy-MM-dd') = '#{updateUsername}'
+      </if>
+      <if test="deleted != null">
+        or DELETED = #{deleted}
+      </if>
+  </delete>
+  <insert id="insert" parameterType="com.steerinfo.dil.model.QmsQueueSpellingList">
+    insert into QMS_QUEUE_SPELLING_LIST (SPELLING_RESULT_ID, QUEUE_RESULT_ID, 
+      SPELILING_NUM, SPELLING_SURE_TIME, ENTRY_SURE_TIME, 
+      INSERT_TIME, INSERT_USERNAME, UPDATE_TIME, 
+      UPDATE_USERNAME, DELETED)
+    values (#{spellingResultId,jdbcType=DECIMAL}, #{queueResultId,jdbcType=DECIMAL}, 
+      #{spelilingNum,jdbcType=DECIMAL}, #{spellingSureTime,jdbcType=TIMESTAMP}, #{entrySureTime,jdbcType=TIMESTAMP}, 
+      #{insertTime,jdbcType=TIMESTAMP}, #{insertUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, 
+      #{updateUsername,jdbcType=TIMESTAMP}, #{deleted,jdbcType=DECIMAL})
+  </insert>
+  <insert id="insertSelective" parameterType="com.steerinfo.dil.model.QmsQueueSpellingList">
+    insert into QMS_QUEUE_SPELLING_LIST
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="spellingResultId != null">
+        SPELLING_RESULT_ID,
+      </if>
+      <if test="queueResultId != null">
+        QUEUE_RESULT_ID,
+      </if>
+      <if test="spelilingNum != null">
+        SPELILING_NUM,
+      </if>
+      <if test="spellingSureTime != null">
+        SPELLING_SURE_TIME,
+      </if>
+      <if test="entrySureTime != null">
+        ENTRY_SURE_TIME,
+      </if>
+      <if test="insertTime != null">
+        INSERT_TIME,
+      </if>
+      <if test="insertUsername != null">
+        INSERT_USERNAME,
+      </if>
+      <if test="updateTime != null">
+        UPDATE_TIME,
+      </if>
+      <if test="updateUsername != null">
+        UPDATE_USERNAME,
+      </if>
+      <if test="deleted != null">
+        DELETED,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="spellingResultId != null">
+        #{spellingResultId,jdbcType=DECIMAL},
+      </if>
+      <if test="queueResultId != null">
+        #{queueResultId,jdbcType=DECIMAL},
+      </if>
+      <if test="spelilingNum != null">
+        #{spelilingNum,jdbcType=DECIMAL},
+      </if>
+      <if test="spellingSureTime != null">
+        #{spellingSureTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="entrySureTime != null">
+        #{entrySureTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="insertTime != null">
+        #{insertTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="insertUsername != null">
+        #{insertUsername,jdbcType=VARCHAR},
+      </if>
+      <if test="updateTime != null">
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateUsername != null">
+        #{updateUsername,jdbcType=TIMESTAMP},
+      </if>
+      <if test="deleted != null">
+        #{deleted,jdbcType=DECIMAL},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.QmsQueueSpellingList">
+    update QMS_QUEUE_SPELLING_LIST
+    set QUEUE_RESULT_ID = #{queueResultId,jdbcType=DECIMAL},
+      SPELILING_NUM = #{spelilingNum,jdbcType=DECIMAL},
+      SPELLING_SURE_TIME = #{spellingSureTime,jdbcType=TIMESTAMP},
+      ENTRY_SURE_TIME = #{entrySureTime,jdbcType=TIMESTAMP},
+      INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
+      INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
+      UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
+      UPDATE_USERNAME = #{updateUsername,jdbcType=TIMESTAMP},
+      DELETED = #{deleted,jdbcType=DECIMAL}
+    where SPELLING_RESULT_ID = #{spellingResultId,jdbcType=DECIMAL}
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.QmsQueueSpellingList">
+    update QMS_QUEUE_SPELLING_LIST
+    <set>
+      <if test="queueResultId != null">
+        QUEUE_RESULT_ID = #{queueResultId,jdbcType=DECIMAL},
+      </if>
+      <if test="spelilingNum != null">
+        SPELILING_NUM = #{spelilingNum,jdbcType=DECIMAL},
+      </if>
+      <if test="spellingSureTime != null">
+        SPELLING_SURE_TIME = #{spellingSureTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="entrySureTime != null">
+        ENTRY_SURE_TIME = #{entrySureTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="insertTime != null">
+        INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="insertUsername != null">
+        INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
+      </if>
+      <if test="updateTime != null">
+        UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateUsername != null">
+        UPDATE_USERNAME = #{updateUsername,jdbcType=TIMESTAMP},
+      </if>
+      <if test="deleted != null">
+        DELETED = #{deleted,jdbcType=DECIMAL},
+      </if>
+    </set>
+    where SPELLING_RESULT_ID = #{spellingResultId,jdbcType=DECIMAL}
+  </update>
+  <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
+    <include refid="select" />
+    where SPELLING_RESULT_ID = #{spellingResultId,jdbcType=DECIMAL}
+  </select>
+  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+    <include refid="select" />
+    <include refid="where" />
+  </select>
+  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+    <include refid="select" />
+    <include refid="whereLike" />
+  </select>
+  <insert id="batchInsert" parameterType="java.util.List">
+    insert into QMS_QUEUE_SPELLING_LIST 
+      (SPELLING_RESULT_ID, 
+      QUEUE_RESULT_ID, SPELILING_NUM, 
+      SPELLING_SURE_TIME, ENTRY_SURE_TIME, 
+      INSERT_TIME, INSERT_USERNAME, 
+      UPDATE_TIME, UPDATE_USERNAME, 
+      DELETED)
+    ( <foreach collection="list" item="item" separator="union all"> 
+   select  
+      #{item.spellingResultId,jdbcType=DECIMAL}, 
+      #{item.queueResultId,jdbcType=DECIMAL}, #{item.spelilingNum,jdbcType=DECIMAL}, 
+      #{item.spellingSureTime,jdbcType=TIMESTAMP}, #{item.entrySureTime,jdbcType=TIMESTAMP}, 
+      #{item.insertTime,jdbcType=TIMESTAMP}, #{item.insertUsername,jdbcType=VARCHAR}, 
+      #{item.updateTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=TIMESTAMP}, 
+      #{item.deleted,jdbcType=DECIMAL} from dual  
+   </foreach> )
+  </insert>
+  <update id="batchUpdate" parameterType="java.util.List">
+     update QMS_QUEUE_SPELLING_LIST
+     set
+       SPELLING_RESULT_ID=
+       <foreach close="end" collection="list" index="index" item="item" open="case SPELLING_RESULT_ID" separator=" ">
+          when #{item.spellingResultId,jdbcType=DECIMAL} then #{item.spellingResultId,jdbcType=DECIMAL}
+       </foreach>
+       ,QUEUE_RESULT_ID=
+       <foreach close="end" collection="list" index="index" item="item" open="case SPELLING_RESULT_ID" separator=" ">
+          when #{item.spellingResultId,jdbcType=DECIMAL} then #{item.queueResultId,jdbcType=DECIMAL}
+       </foreach>
+       ,SPELILING_NUM=
+       <foreach close="end" collection="list" index="index" item="item" open="case SPELLING_RESULT_ID" separator=" ">
+          when #{item.spellingResultId,jdbcType=DECIMAL} then #{item.spelilingNum,jdbcType=DECIMAL}
+       </foreach>
+       ,SPELLING_SURE_TIME=
+       <foreach close="end" collection="list" index="index" item="item" open="case SPELLING_RESULT_ID" separator=" ">
+          when #{item.spellingResultId,jdbcType=DECIMAL} then #{item.spellingSureTime,jdbcType=TIMESTAMP}
+       </foreach>
+       ,ENTRY_SURE_TIME=
+       <foreach close="end" collection="list" index="index" item="item" open="case SPELLING_RESULT_ID" separator=" ">
+          when #{item.spellingResultId,jdbcType=DECIMAL} then #{item.entrySureTime,jdbcType=TIMESTAMP}
+       </foreach>
+       ,INSERT_TIME=
+       <foreach close="end" collection="list" index="index" item="item" open="case SPELLING_RESULT_ID" separator=" ">
+          when #{item.spellingResultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
+       </foreach>
+       ,INSERT_USERNAME=
+       <foreach close="end" collection="list" index="index" item="item" open="case SPELLING_RESULT_ID" separator=" ">
+          when #{item.spellingResultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
+       </foreach>
+       ,UPDATE_TIME=
+       <foreach close="end" collection="list" index="index" item="item" open="case SPELLING_RESULT_ID" separator=" ">
+          when #{item.spellingResultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
+       </foreach>
+       ,UPDATE_USERNAME=
+       <foreach close="end" collection="list" index="index" item="item" open="case SPELLING_RESULT_ID" separator=" ">
+          when #{item.spellingResultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=TIMESTAMP}
+       </foreach>
+       ,DELETED=
+       <foreach close="end" collection="list" index="index" item="item" open="case SPELLING_RESULT_ID" separator=" ">
+          when #{item.spellingResultId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
+       </foreach>
+     where SPELLING_RESULT_ID in 
+     <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
+    #{item.spellingResultId,jdbcType=DECIMAL}
+     </foreach> 
+  </update>
+  <delete id="batchDelete" parameterType="java.util.List">
+    delete from QMS_QUEUE_SPELLING_LIST
+    where SPELLING_RESULT_ID in 
+    <foreach close=")" collection="list" item="id" open="(" separator=",">
+      #{id}
+    </foreach>
+  </delete>
+
+  <!-- 友情提示!!!-->
+  <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+
+  <delete id="deleteByQueueResultId" parameterType="java.math.BigDecimal">
+    DELETE FROM QMS_QUEUE_SPELLING_LIST WHERE QUEUE_RESULT_ID = #{queueResultId}
+  </delete>
+
+  <update id="updateListEnFactory" parameterType="map">
+    UPDATE QMS_QUEUE_SPELLING_LIST QQSL
+        SET QQSL.ENTRY_SURE_TIME = SYSDATE,DELETED = 2
+    <if test="jobName != null">
+      , UPDATE_USERNAME = #{jobName}
+    </if>
+    WHERE SPELLING_RESULT_ID = #{spellingResultId}
+  </update>
+
+  <select id="existsCapacity" resultType="java.lang.Integer">
+    select QQSL.SPELLING_RESULT_ID
+    from QMS_QUEUE_SPELLING_LIST QQSL
+    left join QMS_QUEUE_RESULT QQR on QQSL.QUEUE_RESULT_ID = QQR.RESULT_ID
+    where QQR.CAPACITY_ID = #{capacityId}
+  </select>
+
+</mapper>

+ 96 - 5
src/main/resources/com/steerinfo/dil/mapper/QueuingRulesMapper.xml

@@ -115,13 +115,104 @@
     </select>
 
 <!--   通过车牌号查询已接收的订单 -->
-    <select id="getOrderNumberByCapacityNumber" parameterType="string" resultType="java.lang.String">
-        select OO.ORDER_NUMBER
+    <select id="getOrderNumberByCapacityNumber" parameterType="string" resultType="java.util.Map">
+        select OO.ORDER_NUMBER        "orderNumber",
+               OO.ORDER_ID            "orderId",
+               COUNT(OOM.MATERIAL_ID) "materialNum",
+               RC.CAPACITY_ID         "capacityId",
+               TTR.RESULT_TOTAL_ID    "resultTotalId"
         from OMSTRUCK_ORDER OO
-        left join RMS_CAPACITY RC
-            on RC.CAPACITY_ID = OO.CAPACITY_ID
-        where RC.CAPACITY_NUMBER = #{capacityNumber} and OO.ORDER_STATUS = 5
+                 left join RMS_CAPACITY RC
+                           on RC.CAPACITY_ID = OO.CAPACITY_ID
+                 left join OMSTRUCK_ORDER_MATERIAL OOM
+                           on OOM.ORDER_ID = OO.ORDER_ID
+                 left join TMSTRUCK_TOTAL_RESULT TTR
+                           on OO.ORDER_ID = TTR.ORDER_ID
+        where RC.CAPACITY_NUMBER = #{capacityNumber}
+          and OO.ORDER_STATUS = 5
+        group by OO.ORDER_NUMBER, OO.ORDER_ID, RC.CAPACITY_ID, TTR.RESULT_TOTAL_ID
+    </select>
+
+    <select id="getPersonnelNameBySSoId" parameterType="string" resultType="java.lang.String">
+        select RP.PERSONNEL_JOB_NUMBER from RMS_PERSONNEL RP where RP.PERSONNEL_SSO_ID = #{ssoId}
+    </select>
+
+    <select id="getAllSureTimeList" resultType="java.util.Map">
+        select QQL.LIST_ID  "listId",
+               QQL.GRID_ID  "gridId",
+               QQL.ENTRY_SURE_TIME "entrySureTime",
+               QQL.INSERT_TIME  "insertTime",
+               QQL.LIST_NODE_ORDER  "listNodeOrder",
+               QQR.RESULT_TOTAL_ID  "resultTotalId",
+               QQR.RESULT_ID    "resultId"
+        from QMS_QUEUE_LIST QQL
+        left join QMS_QUEUE_RESULT QQR on QQL.QUEUE_RESULT_ID =  QQR.RESULT_ID
+        where QQL.ENTRY_SURE_TIME is not null
     </select>
 
+    <select id="getAllSureTimeSpellingList" resultType="java.util.Map">
+        select QQSL.SPELLING_RESULT_ID  "spellingResultId",
+               QQSL.SPELILING_NUM   "spelilingNum",
+               QQSL.SPELLING_SURE_TIME  "spellingSureTime",
+               QQSL.ENTRY_SURE_TIME  "entrySureTime",
+               QQR.RESULT_TOTAL_ID  "resultTotalId",
+               QQR.RESULT_ID    "resultId"
+        from QMS_QUEUE_SPELLING_LIST QQSL
+        left join QMS_QUEUE_RESULT QQR on QQSL.QUEUE_RESULT_ID = QQR.RESULT_ID
+        where QQSL.ENTRY_SURE_TIME is not null
+    </select>
+
+
+    <update id="updateListToLast">
+        update QMS_QUEUE_LIST QQL
+        set QQL.DELETED         = 0,
+            QQL.ENTRY_SURE_TIME = null,
+            QQL.LIST_NODE_ORDER = #{nodeOrder}
+        where LIST_ID = #{listId}
+    </update>
+
+    <update id="updateEnFactory">
+        update TMSTRUCK_ENFACTORY_RESULT TER
+        set TER.INSERT_UPDATE_REMARK = null,
+            TER.UPDATE_USERNAME = null
+        where RESULT_TOTAL_ID = #{resultTotalId}
+    </update>
 
+    <update id="updateSpellingListToLast">
+        update QMS_QUEUE_SPELLING_LIST QQSL
+        set QQSL.DELETED            = null,
+            QQSL.SPELLING_SURE_TIME = SYSDATE,
+            QQSL.ENTRY_SURE_TIME    = null
+        where QQSL.SPELLING_RESULT_ID = #{spellingResultId}
+    </update>
+
+    <update id="updateQQRRemoveList">
+        update QMS_QUEUE_RESULT
+        set
+            LIST_ID           = null,
+            RESULT_START_TIME = null,
+            RESULT_ACCEPT_TIME = null
+        where RESULT_ID = #{resultId}
+    </update>
+
+    <select id="getAllNotSureEnFactoryList" resultType="java.util.Map">
+        select QQL.LIST_ID  "listId",
+               QQL.QUEUE_RESULT_ID  "resultId",
+               QQL.INSERT_TIME  "insertTime"
+        from QMS_QUEUE_LIST QQL
+        where ENTRY_SURE_TIME is null
+    </select>
+
+
+    <select id="getAllNotSureEnFactorySpellingList" resultType="java.util.Map">
+        select QQSL.SPELLING_RESULT_ID  "spellingResultId",
+               QQSL.QUEUE_RESULT_ID "resultId",
+               QQSL.SPELLING_SURE_TIME  "spellingSureTime"
+        from QMS_QUEUE_SPELLING_LIST QQSL
+        where ENTRY_SURE_TIME is null
+    </select>
+
+    <select id="checkoutQQR" resultType="int">
+        select QQR.RESULT_ID from QMS_QUEUE_RESULT QQR where QQR.RESULT_TOTAL_ID = #{resultTotalId}
+    </select>
 </mapper>