Your Name 3 éve
szülő
commit
235897ed6b
37 módosított fájl, 2504 hozzáadás és 2044 törlés
  1. 23 23
      pom.xml
  2. 1 0
      src/main/java/com/steerinfo/DilApplicationMain.java
  3. 86 7
      src/main/java/com/steerinfo/dil/controller/StatisticalReportController.java
  4. 15 30
      src/main/java/com/steerinfo/dil/controller/TmstruckEnfactoryResultController.java
  5. 21 30
      src/main/java/com/steerinfo/dil/controller/TmstruckLeaveFactoryResultController.java
  6. 16 27
      src/main/java/com/steerinfo/dil/controller/TmstruckLoadResultController.java
  7. 14 26
      src/main/java/com/steerinfo/dil/controller/TmstruckUnloadResultController.java
  8. 24 50
      src/main/java/com/steerinfo/dil/controller/TmstruckWeightResultController.java
  9. 22 0
      src/main/java/com/steerinfo/dil/feign/AmsFeign.java
  10. 15 0
      src/main/java/com/steerinfo/dil/feign/OmsFeign.java
  11. 1 1
      src/main/java/com/steerinfo/dil/mapper/StatisticalReportMapper.java
  12. 1 0
      src/main/java/com/steerinfo/dil/mapper/TmstruckEnfactoryResultMapper.java
  13. 9 0
      src/main/java/com/steerinfo/dil/mapper/TmstruckLeaveFactoryResultMapper.java
  14. 4 1
      src/main/java/com/steerinfo/dil/mapper/UtilsMapper.java
  15. 19 4
      src/main/java/com/steerinfo/dil/model/TmstruckLoadResult.java
  16. 15 0
      src/main/java/com/steerinfo/dil/model/TmstruckUnloadResult.java
  17. 1 1
      src/main/java/com/steerinfo/dil/service/impl/StatisticalReportImpl.java
  18. 15 82
      src/main/java/com/steerinfo/dil/service/impl/TmstruckEnfactoryResultServiceImpl.java
  19. 42 12
      src/main/java/com/steerinfo/dil/service/impl/TmstruckLeaveFactoryResultServiceImpl.java
  20. 17 31
      src/main/java/com/steerinfo/dil/service/impl/TmstruckLoadResultServiceImpl.java
  21. 6 4
      src/main/java/com/steerinfo/dil/service/impl/TmstruckMeasureCommissionServiceImpl.java
  22. 9 19
      src/main/java/com/steerinfo/dil/service/impl/TmstruckUnloadResultServiceImpl.java
  23. 54 38
      src/main/java/com/steerinfo/dil/service/impl/TmstruckWeightResultServiceImpl.java
  24. 14 1
      src/main/java/com/steerinfo/dil/service/impl/UtilsServiceImpl.java
  25. 71 1
      src/main/java/com/steerinfo/dil/util/DataChange.java
  26. 3 1
      src/main/resources/application-dev.yml
  27. 2 0
      src/main/resources/application-prod.yml
  28. 1 1
      src/main/resources/bootstrap.yml
  29. 225 51
      src/main/resources/com/steerinfo/dil/mapper/StatisticalReportMapper.xml
  30. 46 15
      src/main/resources/com/steerinfo/dil/mapper/TmstruckEnfactoryResultMapper.xml
  31. 33 0
      src/main/resources/com/steerinfo/dil/mapper/TmstruckLeaveFactoryResultMapper.xml
  32. 1573 1534
      src/main/resources/com/steerinfo/dil/mapper/TmstruckLoadResultMapper.xml
  33. 1 1
      src/main/resources/com/steerinfo/dil/mapper/TmstruckMeasureCommissionMapper.xml
  34. 1 3
      src/main/resources/com/steerinfo/dil/mapper/TmstruckQualityResultMapper.xml
  35. 64 22
      src/main/resources/com/steerinfo/dil/mapper/TmstruckUnloadResultMapper.xml
  36. 30 28
      src/main/resources/com/steerinfo/dil/mapper/TmstruckWeightResultMapper.xml
  37. 10 0
      src/main/resources/com/steerinfo/dil/mapper/UtilsMapper.xml

+ 23 - 23
pom.xml

@@ -136,29 +136,29 @@
     <build>
         <plugins>
             <!--             自动生成代码文件 -->
-<!--            <plugin>-->
-<!--                <groupId>com.steerinfo</groupId>-->
-<!--                <artifactId>generator-maven-plugin</artifactId>-->
-<!--                <version>3.0</version>-->
-<!--                <configuration>-->
-<!--                    <connUrl>jdbc:oracle:thin:@172.16.33.163:1521:ilsdbpri</connUrl>-->
-<!--                    <user>dil</user>-->
-<!--                    <password>Dil123789</password>-->
-<!--                    &lt;!&ndash;包名&ndash;&gt;-->
-<!--                    <targetPackage>com.steerinfo.dil</targetPackage>-->
-<!--                    <tables>-->
-<!--                        <param></param>-->
-<!--                    </tables>-->
-<!--                </configuration>-->
-<!--                <executions>-->
-<!--                    <execution>-->
-<!--                        <phase>compile</phase>-->
-<!--                        <goals>-->
-<!--                            <goal>steerinfo</goal>-->
-<!--                        </goals>-->
-<!--                    </execution>-->
-<!--                </executions>-->
-<!--            </plugin>-->
+            <plugin>
+                <groupId>com.steerinfo</groupId>
+                <artifactId>generator-maven-plugin</artifactId>
+                <version>3.0</version>
+                <configuration>
+                    <connUrl>jdbc:oracle:thin:@172.16.33.163:1521:ilsdbpri</connUrl>
+                    <user>dil</user>
+                    <password>Dil123789</password>
+                    <!--包名-->
+                    <targetPackage>com.steerinfo.dil</targetPackage>
+                    <tables>
+                        <param>TMSTRUCK_LOAD_RESULT</param>
+                    </tables>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>steerinfo</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>

+ 1 - 0
src/main/java/com/steerinfo/DilApplicationMain.java

@@ -4,6 +4,7 @@ import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.web.servlet.ServletComponentScan;
+import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.scheduling.annotation.EnableScheduling;

+ 86 - 7
src/main/java/com/steerinfo/dil/controller/StatisticalReportController.java

@@ -3,6 +3,7 @@ package com.steerinfo.dil.controller;
 import com.steerinfo.dil.service.impl.StatisticalReportImpl;
 import com.steerinfo.dil.util.BaseRESTfulController;
 import com.steerinfo.dil.util.ColumnDataUtil;
+import com.steerinfo.dil.util.DataChange;
 import com.steerinfo.dil.util.PageListAdd;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.pagehelper.PageHelper;
@@ -15,9 +16,9 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 /**
  * @ author    :TXF
@@ -34,6 +35,9 @@ public class StatisticalReportController extends BaseRESTfulController {
     @Autowired
     ColumnDataUtil columnDataUtil;
 
+    private final SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
+
+    private final SimpleDateFormat sdfDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
     @ApiOperation(value="查询辅料燃料统计报表")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
@@ -47,9 +51,12 @@ public class StatisticalReportController extends BaseRESTfulController {
                                                Integer apiId,
                                                Integer pageNum,
                                                Integer pageSize,
+                                               String startTime,
+                                               String endTime,
                                                Integer orderType
     ){
         mapValue.put("orderTypee", orderType);
+        DataChange.queryDataByDate(startTime, endTime, mapValue, sdfDate);//根据时间段查询数据
         List<Map<String, Object>> allReport =  statisticalReportService.getAllPurchaseFLRLReport(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页数据
@@ -71,6 +78,8 @@ public class StatisticalReportController extends BaseRESTfulController {
                                        Integer apiId,
                                        Integer pageNum,
                                        Integer pageSize,
+                                       String startTime,
+                                       String endTime,
                                        String carrierSsoId
     ){
         if(carrierSsoId != null){
@@ -78,6 +87,7 @@ public class StatisticalReportController extends BaseRESTfulController {
                 mapValue.put("carrierSsoId", carrierSsoId);
             }
         }
+        DataChange.queryDataByTwoDate(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
         List<Map<String, Object>> allReport =  statisticalReportService.getAllSaleReportNum(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页数据
@@ -86,6 +96,37 @@ public class StatisticalReportController extends BaseRESTfulController {
         return success(pageList);
     }
 
+    @ApiOperation(value="查询销售统计报表筛选过后的总净重")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
+            @ApiImplicitParam(name = "apiId(423)", value = "动态表头", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
+    })
+    @PostMapping("/getAllSaleReportTotal")
+    public RESTfulResult getAllSaleReportTotal(@RequestBody(required=false) Map<String,Object> mapValue,
+                                          String startTime,
+                                          String endTime,
+                                          String carrierSsoId
+    ){
+        if(carrierSsoId != null){
+            if(!"null".equals(carrierSsoId)){
+                mapValue.put("carrierSsoId", carrierSsoId);
+            }
+        }
+        DataChange.queryDataByTwoDate(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
+        List<Map<String, Object>> allReport =  statisticalReportService.getAllSaleReportNum(mapValue);
+        //获取销售统计报表筛选过后的总净重
+        BigDecimal AllResultNetWeight = new BigDecimal(0);
+        for (Map<String, Object> stringObjectMap : allReport) {
+            if(stringObjectMap.get("resultNetWeight")!=null) {
+                AllResultNetWeight = AllResultNetWeight.add(new BigDecimal(stringObjectMap.get("resultNetWeight").toString()));
+            }
+        }
+        return success(AllResultNetWeight);
+    }
+
     @ApiOperation(value="查询零星物资进厂统计报表")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
@@ -99,13 +140,32 @@ public class StatisticalReportController extends BaseRESTfulController {
                                           Integer apiId,
                                           Integer pageNum,
                                           Integer pageSize,
-                                          String carrierSsoId
+                                          String startTime,
+                                          String endTime,
+                                          String carrierSsoId,
+                                          String userId,
+                                           String userIds,
+                                           String con,
+                                           Integer orderType
     ){
-        if(carrierSsoId != null){
-            if(!"null".equals(carrierSsoId)){
+        if(carrierSsoId != null) {
+            if (!"null".equals(carrierSsoId)) {
                 mapValue.put("carrierSsoId", carrierSsoId);
             }
         }
+        DataChange.queryDataByDate(startTime, endTime, mapValue, sdfDate);//根据时间段查询数据
+            if (userId!=null){
+                mapValue.put("userId",userId);
+            }
+            if (orderType!=null){
+                mapValue.put("orderType",orderType);
+            }
+            if (userIds!=null){
+                mapValue.put("userIds",userIds);
+            }
+            if (con!=null&&!con.equals("undefined")){
+                mapValue.put("con","%"+con+"%");
+            }
         List<Map<String, Object>> allReport =  statisticalReportService.getSporadicSuppliesReportNum1(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页数据
@@ -127,13 +187,32 @@ public class StatisticalReportController extends BaseRESTfulController {
                                                    Integer apiId,
                                                    Integer pageNum,
                                                    Integer pageSize,
-                                                   String carrierSsoId
+                                                   String startTime,
+                                                   String endTime,
+                                                   String carrierSsoId,
+                                                    String userId,
+                                                    String userIds,
+                                                    String con,
+                                                    Integer orderType
     ){
         if(carrierSsoId != null){
             if(!"null".equals(carrierSsoId)){
                 mapValue.put("carrierSsoId", carrierSsoId);
             }
         }
+        DataChange.queryDataByDate(startTime, endTime, mapValue, sdfDate);//根据时间段查询数据
+        if (con!=null&&!con.equals("undefined")){
+            mapValue.put("con","%"+con+"%");
+        }
+        if (userId!=null){
+            mapValue.put("userId",userId);
+        }
+        if (orderType!=null){
+            mapValue.put("orderType",orderType);
+        }
+        if (userIds!=null){
+            mapValue.put("userIds",userIds);
+        }
         List<Map<String, Object>> allReport =  statisticalReportService.getSporadicSuppliesReportNum2(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页数据

+ 15 - 30
src/main/java/com/steerinfo/dil/controller/TmstruckEnfactoryResultController.java

@@ -57,36 +57,24 @@ public class TmstruckEnfactoryResultController extends BaseRESTfulController {
                                        Integer pageNum,
                                        Integer pageSize,
                                        Integer orderType,
-                                       String con
+                                       String con,
+                                       String userId,
+                                       String userIds
                                        ){
-        mapValue.put("orderTypee", orderType);
-        //框计算
-        if(con != null){
-            if(!"undefined".equals(con)){
-                //设置要查询的索引名称
-                String index="get_enfactory_list";
-                //获取查询结果
-                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));
-            }
+
+        if(con!=null&&con.equals("undefined")){
+            mapValue.put("con","%"+con+"%");
+        }
+        if (userId!=null){
+            mapValue.put("userId",userId);
+        }
+        if (userIds!=null){
+            mapValue.put("userIds",userIds);
         }
-        List<Map<String, Object>> allEnFactoryResult = null;
-        //如果有条件查询则跳过初始化,和创建索引
-        if(mapValue.size() == 1){
-            //将查询结果存入索引中
-            allEnFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index","get_enfactory_list");
-            //添加id
-            map.put("indexId","enFactoryId");
-            allEnFactoryResult.add(map);
-            //新建索引
-            esFeign.insertIndex(allEnFactoryResult);
-            //删除
-            allEnFactoryResult.remove(allEnFactoryResult.size()-1);
+        if (orderType!=null){
+            mapValue.put("orderTypee", orderType);
         }
-        if(allEnFactoryResult == null)
-            allEnFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue);
+        List<Map<String, Object>>  allEnFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue);
         PageHelper.startPage(pageNum,pageSize);
         //分页数据
         List<Map<String, Object>> enFactoryResult = tmstruckEnfactoryResultService.getAllEnFactoryResult(mapValue);
@@ -94,9 +82,6 @@ public class TmstruckEnfactoryResultController extends BaseRESTfulController {
         return success(pageList);
     }
 
-
-
-
     @ApiOperation(value="通过PDA添加进厂实绩")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "mapValue", value = "门岗名称 运输订单号", required = false, dataType = "Map"),

+ 21 - 30
src/main/java/com/steerinfo/dil/controller/TmstruckLeaveFactoryResultController.java

@@ -70,42 +70,33 @@ public class TmstruckLeaveFactoryResultController extends BaseRESTfulController
     })
     @PostMapping("/getLeaveFactoryResult")
     public RESTfulResult getLeaveFactoryResult(@RequestBody(required=false) Map<String,Object> mapValue,
-                                          Integer apiId,
-                                          Integer pageNum,
-                                          Integer pageSize,
-                                          Integer orderType,
-                                          String con, String carrierSsoId){
-        mapValue.put("orderTypee", orderType);
+                                               Integer apiId,
+                                               Integer pageNum,
+                                               Integer pageSize,
+                                               Integer orderType,
+                                               String con,
+                                               String carrierSsoId,
+                                               String userId,
+                                               String userIds){
+
+        if (userId!=null){
+            mapValue.put("userId",userId);
+        }
+        if (userIds!=null){
+            mapValue.put("userIds",userIds);
+        }
+        if (orderType!=null) {
+            mapValue.put("orderTypee", orderType);
+        }
         if(carrierSsoId != null){
             if(!"null".equals(carrierSsoId)){
                 mapValue.put("carrierSsoId", carrierSsoId);
             }
         }
-        //框计算
-        if(con != null){
-            if(!"undefined".equals(con)){
-                String index="get_leavefactory_list";//设置要查询的索引名称
-                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
-            }
-        }
-        List<Map<String, Object>> allLeaveFactoryResult = null;
-        //如果有条件查询则跳过初始化,和创建索引
-        if(mapValue.size() == 1){
-            //将查询结果存入索引中
-            allLeaveFactoryResult = tmstruckLeaveFactoryResultService.getLeaveFactoryResult(mapValue);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index","get_leavefactory_list");
-            //添加id
-            map.put("indexId","leaveFactoryId");
-            allLeaveFactoryResult.add(map);
-            //新建索引
-            esFeign.insertIndex(allLeaveFactoryResult);
-            //删除
-            allLeaveFactoryResult.remove(allLeaveFactoryResult.size()-1);
+        if(con!=null&&con.equals("undefined")){
+            mapValue.put("con","%"+con+"%");
         }
-        if(allLeaveFactoryResult == null)
-            allLeaveFactoryResult = tmstruckLeaveFactoryResultService.getLeaveFactoryResult(mapValue);
+        List<Map<String, Object>>  allLeaveFactoryResult = tmstruckLeaveFactoryResultService.getLeaveFactoryResult(mapValue);
         PageHelper.startPage(pageNum,pageSize);
         //分页数据
         List<Map<String, Object>> leaveFactoryResult = tmstruckLeaveFactoryResultService.getLeaveFactoryResult(mapValue);

+ 16 - 27
src/main/java/com/steerinfo/dil/controller/TmstruckLoadResultController.java

@@ -126,35 +126,24 @@ public class TmstruckLoadResultController extends BaseRESTfulController {
                                         Integer pageSize,
                                         Integer status,
                                         Integer orderType,
-                                        String con){
-        mapValue.put("status", status);
-        mapValue.put("orderTypee", orderType);
-        //框计算
-        if(con != null){
-            if(!"undefined".equals(con)){
-                String index="get_truck_load_list";//设置要查询的索引名称
-                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
-            }
+                                        String con,
+                                        String userId,
+                                        String userIds){
+
+        if (status!=null){
+            mapValue.put("status", status);
         }
-        //不分页筛选数据
-        List<Map<String, Object>> allLoadResult = null;
-        //如果有条件查询则跳过初始化,和创建索引
-        if(mapValue.size() == 2){
-            //将查询结果存入索引中
-            allLoadResult = tmstruckLoadResultService.getAllLoadResult(mapValue);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index","get_truck_load_list");
-            //添加id
-            map.put("indexId","truckLoadId");
-            allLoadResult.add(map);
-            //新建索引
-            esFeign.insertIndex(allLoadResult);
-            //删除
-            allLoadResult.remove(allLoadResult.size()-1);
+        if (orderType!=null){
+            mapValue.put("orderTypee", orderType);
+        }
+        if (userId!=null){
+            mapValue.put("userId",userId);
         }
-        if(allLoadResult == null)
-            allLoadResult = tmstruckLoadResultService.getAllLoadResult(mapValue);
+        if (userIds!=null){
+            mapValue.put("userIds",userIds);
+        }
+        //如果有条件查询则跳过初始化,和创建索引
+        List<Map<String, Object>>   allLoadResult = tmstruckLoadResultService.getAllLoadResult(mapValue);
         PageHelper.startPage(pageNum,pageSize);
         //分页数据
         List<Map<String, Object>> loadResult = tmstruckLoadResultService.getAllLoadResult(mapValue);

+ 14 - 26
src/main/java/com/steerinfo/dil/controller/TmstruckUnloadResultController.java

@@ -57,36 +57,24 @@ public class TmstruckUnloadResultController extends BaseRESTfulController {
                                            Integer apiId,
                                            Integer pageNum,
                                            Integer pageSize,
-                                           Integer orderType,String con
+                                           Integer orderType,
+                                           String con,
+                                           String userId,
+                                           String  userIds
     ){
-        mapValue.put("orderTypee", orderType);
-        //框计算
-        if(con != null){
-            if(!"undefined".equals(con)){
-                String index="get_truck_unload_list";//设置要查询的索引名称
-                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
-            }
+
+        if (orderType!=null){
+            mapValue.put("orderTypee", orderType);
         }
-        //不分页筛选数据
-        List<Map<String, Object>> allUnloadResult = null;
-        //如果有条件查询则跳过初始化,和创建索引
-        if(mapValue.size() == 1){
-            //将查询结果存入索引中
-            allUnloadResult = tmstruckUnloadResultService.getUnloadResult(mapValue);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index","get_truck_unload_list");
-            //添加id
-            map.put("indexId","truckUnloadId");
-            allUnloadResult.add(map);
-            //新建索引
-            esFeign.insertIndex(allUnloadResult);
-            //删除
-            allUnloadResult.remove(allUnloadResult.size()-1);
+        if (userId!=null){
+            mapValue.put("userId",userId);
         }
-        if(allUnloadResult == null){
-            allUnloadResult = tmstruckUnloadResultService.getUnloadResult(mapValue);
+        if (userIds!=null){
+            mapValue.put("userIds",userIds);
         }
+        //不分页筛选数据
+        List<Map<String, Object>> allUnloadResult = null;
+        allUnloadResult = tmstruckUnloadResultService.getUnloadResult(mapValue);
         PageHelper.startPage(pageNum,pageSize);
         //分页数据
         List<Map<String, Object>> unloadResult = tmstruckUnloadResultService.getUnloadResult(mapValue);

+ 24 - 50
src/main/java/com/steerinfo/dil/controller/TmstruckWeightResultController.java

@@ -71,35 +71,22 @@ public class TmstruckWeightResultController extends BaseRESTfulController {
                                                Integer pageNum,
                                                Integer pageSize,
                                                Integer orderType,
-                                               String con
+                                               String con,
+                                               String userId,
+                                               String usersId
     ){
-        mapValue.put("orderTypee", orderType);
-        //框计算
-        if(con != null){
-            if(!"undefined".equals(con)){
-                String index="get_jimao_list";//设置要查询的索引名称
-                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
-            }
+        if (orderType!=null) {
+            mapValue.put("orderTypee", orderType);
         }
-        List<Map<String, Object>> allJiMaoResult = null;
-        //如果有条件查询则跳过初始化,和创建索引
-        if(mapValue.size() == 1){
-            //将查询结果存入索引中
-            allJiMaoResult = tmstruckWeightResultService.getAllJiMaoResult(mapValue);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index","get_jimao_list");
-            //添加id
-            map.put("indexId","jiMaoId");
-            allJiMaoResult.add(map);
-            //新建索引
-            esFeign.insertIndex(allJiMaoResult);
-            //删除
-            allJiMaoResult.remove(allJiMaoResult.size()-1);
+        if (userId!=null){
+            mapValue.put("userId",userId);
         }
-        if(allJiMaoResult == null){
-            allJiMaoResult = tmstruckWeightResultService.getAllJiMaoResult(mapValue);
+        if (usersId!=null){
+            mapValue.put("usersId",usersId);
         }
+        List<Map<String, Object>> allJiMaoResult = null;
+        //如果有条件查询则跳过初始化,和创建索引
+        allJiMaoResult = tmstruckWeightResultService.getAllJiMaoResult(mapValue);
         PageHelper.startPage(pageNum,pageSize);
         //分页数据
         List<Map<String, Object>> jiMaoResult = tmstruckWeightResultService.getAllJiMaoResult(mapValue);
@@ -122,37 +109,24 @@ public class TmstruckWeightResultController extends BaseRESTfulController {
                                            Integer pageNum,
                                            Integer pageSize,
                                            Integer orderType,
-                                           String con
+                                           String con,
+                                           String userId,
+                                           String userIds
     ){
 
-        mapValue.put("orderTypee", orderType);
-        //框计算
-        if(con != null){
-            if(!"undefined".equals(con)){
-                String index="get_jipi_list";//设置要查询的索引名称
-                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
-            }
+        if (orderType!=null) {
+            mapValue.put("orderTypee", orderType);
+        }
+        if (userId!=null) {
+            mapValue.put("userId",userId);
+        }
+        if (userIds!=null) {
+            mapValue.put("usersId", userIds);
         }
         //不分页筛选数据
         List<Map<String, Object>> allJiPiResult = null;
         //如果有条件查询则跳过初始化,和创建索引
-        if(mapValue.size() == 1){
-            //将查询结果存入索引中
-            allJiPiResult = tmstruckWeightResultService.getAllJiPiResult(mapValue);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index","get_jipi_list");
-            //添加id
-            map.put("indexId","jiPiId");
-            allJiPiResult.add(map);
-            //新建索引
-            esFeign.insertIndex(allJiPiResult);
-            //删除
-            allJiPiResult.remove(allJiPiResult.size()-1);
-        }
-        if(allJiPiResult == null){
-            allJiPiResult = tmstruckWeightResultService.getAllJiPiResult(mapValue);
-        }
+        allJiPiResult = tmstruckWeightResultService.getAllJiPiResult(mapValue);
         PageHelper.startPage(pageNum,pageSize);
         //分页数据
         List<Map<String, Object>> jiPiResult = tmstruckWeightResultService.getAllJiPiResult(mapValue);

+ 22 - 0
src/main/java/com/steerinfo/dil/feign/AmsFeign.java

@@ -0,0 +1,22 @@
+package com.steerinfo.dil.feign;
+
+import com.steerinfo.framework.controller.RESTfulResult;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.Map;
+
+/**
+ * @ author    :HJG
+ * @ time      :2022/1/10 14:16
+ */
+
+@FeignClient(value = "dil-ams-api", url = "${openfeign.AmsFeign.url}")
+public interface AmsFeign {
+
+    //销售焦炭自动派单
+    @PostMapping("api/v1/ams/amssaleordermaterials/dispatchTruckOrderByCarrier")
+    RESTfulResult dispatchTruckOrderByCarrier(@RequestBody Map<String, Object> mapValue);
+
+}

+ 15 - 0
src/main/java/com/steerinfo/dil/feign/OmsFeign.java

@@ -4,7 +4,9 @@ import com.steerinfo.framework.controller.RESTfulResult;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
 
+import java.math.BigDecimal;
 import java.util.Map;
 
 /**
@@ -29,6 +31,19 @@ public interface OmsFeign {
     //远程调用推送websocket
     @PostMapping("api/v1/oms/omstruckorderseparates/pushMesToWebsocket")
     RESTfulResult pushMesToWebsocket(@RequestBody(required = false) Map<String, Object> map);
+
     @PostMapping("api/v1/oms/omstruckorders/pushMessageToDriver")
     public RESTfulResult pushMessageToDriver(@RequestBody Map<String,Object> mapValue);
+
+    // 远程调用查询销售订单所有信息
+    @PostMapping("api/v1/oms/omstruckorderseparates/getSaleAllMessages")
+    Map<String,Object> getSaleAllMessages(@RequestParam Integer orderId);
+
+    //跨服务调用新增采购订单接口(一车多趟)
+    @PostMapping("api/v1/oms/omstruckorderseparates/addNewTransportOrder")
+    Map<String,Object> addNewTransportOrder(@RequestParam Integer orderId);
+
+    @PostMapping("api/v1/oms/utilscontroller/addPurInwardOrder")
+    Map<String,Object> addPurInwardOrder(@RequestParam BigDecimal orderId);
+
 }

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

@@ -21,6 +21,6 @@ public interface StatisticalReportMapper {
 //    查询零星物资进厂统计报表
     List<Map<String, Object>> getSporadicSuppliesReport1(Map<String, Object> mapValue);
 
-    //    查询零星物资厂统计报表
+    //    查询零星物资厂统计报表
     List<Map<String, Object>> getSporadicSuppliesReport2(Map<String, Object> mapValue);
 }

+ 1 - 0
src/main/java/com/steerinfo/dil/mapper/TmstruckEnfactoryResultMapper.java

@@ -61,6 +61,7 @@ public interface TmstruckEnfactoryResultMapper extends IBaseMapper<TmstruckEnfac
      //通过运输订单获取零星物资进厂实绩
     List<Map<String, Object>> getSporadicSuppliesEnFactoryResult(Map<String, Object> map);
 
+    //获取采购内转进厂实绩
     List<Map<String, Object>> getCGNZEnFactory(Map<String, Object> map);
 
     List<Map<String, Object>> getCgNzOutFactory(Map<String, Object> map);

+ 9 - 0
src/main/java/com/steerinfo/dil/mapper/TmstruckLeaveFactoryResultMapper.java

@@ -51,6 +51,15 @@ public interface TmstruckLeaveFactoryResultMapper extends IBaseMapper<TmstruckLe
     Map<String, Object> getDeliveryOrder(String orderNumber);
 
     List<Map<String,Object>> getDeliveryOrderMaterial(String orderNumber);
+
     // 查询零星物资出厂列表
     List<Map<String,Object>> getSporadicLeaveFactory(Map<String, Object> mapValue);
+
+    //根据采购订单ID查询是否为一车多趟
+    Integer getIsMoreTripsStatus(BigDecimal orderId);
+
+    int getPlanEnable(BigDecimal orderId);
+
+    Integer getSeq(BigDecimal orderId);
+
 }

+ 4 - 1
src/main/java/com/steerinfo/dil/mapper/UtilsMapper.java

@@ -63,7 +63,7 @@ public interface UtilsMapper {
     //查询最大路段顺序号 以及当前订单路段顺序号(执行到哪一步)
     Map<String, Object> getLineSeqAndOrderSeq(Map<String, Object> map);
 
-    //通过订单ID查询物资ID(针对单拼)
+    //通过订单ID查询物资ID (除了单拼外会有多个)
     List<Integer> getMaterialIdByOrderId(BigDecimal orderId);
 
     //查询订单ID查询第一个计量的物资Id(物资子表)
@@ -74,4 +74,7 @@ public interface UtilsMapper {
 
     //查询订单是否确认
     Integer getDriverConfirmation(BigDecimal orderId);
+
+    //通过路段顺序号和线路ID查找 线路子表的子表的ID 和门岗ID或汽车衡ID
+    List<Integer> getLineSegmentGateCalcId(Map<String, Object> map);
 }

+ 19 - 4
src/main/java/com/steerinfo/dil/model/TmstruckLoadResult.java

@@ -10,13 +10,13 @@ import java.util.Date;
 @ApiModel(value="汽运装货实绩")
 public class TmstruckLoadResult 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=false)
     private BigDecimal resultTotalId;
@@ -40,13 +40,13 @@ public class TmstruckLoadResult implements IBasePO<BigDecimal> {
     private BigDecimal resultLoadDuration;
 
     /**
-     * 装货标准时长id(LOAD_STANDARD_TIME_ID,DECIMAL,38)
+     * 装货标准时长id(LOAD_STANDARD_TIME_ID,DECIMAL,0)
      */
     @ApiModelProperty(value="装货标准时长id",required=false)
     private BigDecimal loadStandardTimeId;
 
     /**
-     * 装卸工ID(LOADER_ID,DECIMAL,38)
+     * 装卸工ID(LOADER_ID,DECIMAL,0)
      */
     @ApiModelProperty(value="装卸工ID",required=false)
     private BigDecimal loaderId;
@@ -141,6 +141,12 @@ public class TmstruckLoadResult implements IBasePO<BigDecimal> {
     @ApiModelProperty(value="路段顺序号",required=false)
     private BigDecimal segmentSqe;
 
+    /**
+     * 集装箱箱号(CASE_NUMBER,VARCHAR,255)
+     */
+    @ApiModelProperty(value="集装箱箱号",required=false)
+    private String caseNumber;
+
     private static final long serialVersionUID = 1L;
 
     @Override
@@ -329,6 +335,14 @@ public class TmstruckLoadResult implements IBasePO<BigDecimal> {
         this.segmentSqe = segmentSqe;
     }
 
+    public String getCaseNumber() {
+        return caseNumber;
+    }
+
+    public void setCaseNumber(String caseNumber) {
+        this.caseNumber = caseNumber == null ? null : caseNumber.trim();
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -357,6 +371,7 @@ public class TmstruckLoadResult implements IBasePO<BigDecimal> {
         sb.append(", loadingSequence=").append(loadingSequence);
         sb.append(", isdeduct=").append(isdeduct);
         sb.append(", segmentSqe=").append(segmentSqe);
+        sb.append(", caseNumber=").append(caseNumber);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");
         return sb.toString();

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

@@ -111,6 +111,12 @@ public class TmstruckUnloadResult implements IBasePO<BigDecimal> {
     @ApiModelProperty(value="物资ID",required=false)
     private BigDecimal materialId;
 
+    /**
+     * 卸货人(UNLOADER_ID,DECIMAL,0)
+     */
+    @ApiModelProperty(value="卸货人",required=false)
+    private BigDecimal unloaderId;
+
     private static final long serialVersionUID = 1L;
 
     @Override
@@ -259,6 +265,14 @@ public class TmstruckUnloadResult implements IBasePO<BigDecimal> {
         this.materialId = materialId;
     }
 
+    public BigDecimal getUnloaderId() {
+        return unloaderId;
+    }
+
+    public void setUnloaderId(BigDecimal unloaderId) {
+        this.unloaderId = unloaderId;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -282,6 +296,7 @@ public class TmstruckUnloadResult implements IBasePO<BigDecimal> {
         sb.append(", resultUnloadPlaceId=").append(resultUnloadPlaceId);
         sb.append(", segmentSqe=").append(segmentSqe);
         sb.append(", materialId=").append(materialId);
+        sb.append(", unloaderId=").append(unloaderId);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");
         return sb.toString();

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

@@ -104,7 +104,7 @@ public class StatisticalReportImpl implements IStatisticalReportService {
      */
     @Override
     public List<Map<String, Object>> getSporadicSuppliesReportNum2(Map<String, Object> mapValue) {
-        return statisticalReportMapper.getSporadicSuppliesReport1(mapValue);
+        return statisticalReportMapper.getSporadicSuppliesReport2(mapValue);
     }
 
     @Override

+ 15 - 82
src/main/java/com/steerinfo/dil/service/impl/TmstruckEnfactoryResultServiceImpl.java

@@ -53,7 +53,7 @@ public class TmstruckEnfactoryResultServiceImpl implements ITmstruckEnfactoryRes
 
     /**
      * 派单时新增进厂实绩
-     * map: 总实绩Id、线路起点
+     * map: 总实绩Id、线路Id、路段顺序号
      * @param map
      * @return
      */
@@ -61,16 +61,15 @@ public class TmstruckEnfactoryResultServiceImpl implements ITmstruckEnfactoryRes
     public int addEnFactoryResult(Map<String, Object> map) {
         TmstruckEnfactoryResult tmstruckEnfactoryResult = new TmstruckEnfactoryResult();
         BigDecimal resultTotalId = DataChange.dataToBigDecimal(map.get("resultTotalId"));
-        //生成进厂作业主键Id
+        tmstruckEnfactoryResult.setResultTotalId(resultTotalId);
         //添加主键
         tmstruckEnfactoryResult.setResultId(tmstruckEnfactoryResultMapper.selectMaxId());
-        //通过总实绩ID查询订单类型
-        Map<String, Object> mesMap = utilsMapper.getOrderTypeByTotalId(resultTotalId);
-        int gatepostId = rulesService.calculateDxGatepostId(mesMap);
-        //添加门岗ID
+        List<Integer> gatepostIdList = utilsMapper.getLineSegmentGateCalcId(map);
+        gatepostIdList.remove(null);
+        //随机取门岗Id
+        Integer gatepostId = utilsService.randomGetValue(gatepostIdList);
+        //获取门岗ID
         tmstruckEnfactoryResult.setGatepostId(new BigDecimal(gatepostId));
-        //添加实绩总表Id
-        tmstruckEnfactoryResult.setResultTotalId(resultTotalId);
         // 添加路段顺序号
         tmstruckEnfactoryResult.setSegmenSqe(DataChange.dataToBigDecimal(map.get("segmentSqe")));
         return tmstruckEnfactoryResultMapper.insertSelective(tmstruckEnfactoryResult);
@@ -160,47 +159,18 @@ public class TmstruckEnfactoryResultServiceImpl implements ITmstruckEnfactoryRes
         int checkMeasureCommission = 0;
         switch (orderType.intValue()){
             case 1:
-            case 4:
                 //查询未装车实绩
                 List<Map<String, Object>> mapList = rulesService.judgeLastMaterial(DataChange.dataToBigDecimal(map.get("orderId")));
-                if(mapList.size() == 1){
-                    //如果是单拼 不需要走计算 直接走钢材的汽车衡(钢材)
-                    Map<String, Object> mesMap = new HashMap<>();
-                    mesMap.put("materialId",mapList.get(0).get("materialId"));
-                    map.put("materialId", mapList.get(0).get("materialId"));
-                    mesMap.put("nature", 1);
-                    mesMap.put("orderId", orderId);
-                    mesMap.put("orderType", orderType);
-                    //计算计皮汽车衡
-                    int tarePlaceId = rulesService.calculateWeighbridge(mesMap);
-                    mesMap.put("tarePlaceId", tarePlaceId);
-                    //更新汽车衡
-                    i += tmstruckWeightResultService.updateWeightResult(mesMap);
-                }else {
-                    //如果是多拼
-                    Map<String, Object> mesMap = rulesService.calculateMaterial(mapList);
-                    //获取物资ID
-                    HashMap<String, Object> calculateMap = new HashMap<>();
-                    calculateMap.put("orderId", map.get("orderId"));
-                    calculateMap.put("materialId", mesMap.get("materialId"));
-                    calculateMap.put("nature", 1); // 1:进厂秤
-                    //计算计皮汽车衡
-                    int tarePlaceId = rulesService.calculateWeighbridge(calculateMap);
-                    calculateMap.put("tarePlaceId", tarePlaceId);
-                    //更新汽车衡
-                    i += tmstruckWeightResultService.updateWeightResult(calculateMap);
-                }
+                map.put("materialId", mapList.get(0).get("materialId"));
                 checkMeasureCommission = tmstruckMeasureCommissionService.addXSMeasureCommission(map); //添加计皮委托
                 break;
+            case 4:
+                break;
             case 2:
             case 3:
-                Map<String, Object> mesMap = new HashMap<>();
-                mesMap.put("orderId", orderId);
-                mesMap.put("orderType", orderType);
-                int tarePlaceId = rulesService.calculateWeighbridge(mesMap);
-                mesMap.put("tarePlaceId", tarePlaceId);
-                //更新汽车衡
-                i += tmstruckWeightResultService.updateWeightResult(mesMap);
+                //通过物资ID查询订单ID(针对单拼)
+                List<Integer> materialIdList = utilsMapper.getMaterialIdByOrderId(orderId);
+                map.put("materialId", materialIdList.get(0));
                 checkMeasureCommission = tmstruckMeasureCommissionService.addXSMeasureCommission(map); //添加计皮委托
                 break;
             case 5:
@@ -210,31 +180,12 @@ public class TmstruckEnfactoryResultServiceImpl implements ITmstruckEnfactoryRes
             case 9:
             case 17:
             case 18:
-                //计算计毛汽车衡并更新计量实绩 (暂时无法计算汽车衡)  需要写一个单独的方法 先计皮再计毛的
-                HashMap<String, Object> calculateMap56789 = new HashMap<>();
-                calculateMap56789.put("orderId", map.get("orderId"));
-                calculateMap56789.put("orderType", orderType);
-                //计算计量汽车衡
-                int grossPlaceId = rulesService.calculateWeighbridge(calculateMap56789);
-                calculateMap56789.put("grossPlaceId", grossPlaceId);
-                i += tmstruckWeightResultService.updateWeightResult(calculateMap56789);
                 //通过订单ID查询物资Id
-                List<Integer> materialIdList = utilsMapper.getMaterialIdByOrderId(DataChange.dataToBigDecimal(map.get("orderId")));
-                map.put("materialId", materialIdList.get(0));
+                List<Integer> materialIds = utilsMapper.getMaterialIdByOrderId(DataChange.dataToBigDecimal(map.get("orderId")));
+                map.put("materialId", materialIds.get(0));
                 checkMeasureCommission = tmstruckMeasureCommissionService.addMaoMeasureCommission(map); //添加计毛委托 并发送计毛委托
                 break;
             case 10:
-                HashMap<String, Object> calculateMap10 = new HashMap<>();
-                calculateMap10.put("orderId", map.get("orderId"));
-                calculateMap10.put("orderType", orderType);
-                //计算计量汽车衡并更新计量实绩
-                int placeId = rulesService.calculateWeighbridge(calculateMap10);
-                if(placeId == 15){ //第一次计量
-                    calculateMap10.put("tarePlaceId", placeId); //皮重
-                }else {
-                    calculateMap10.put("grossPlaceId", placeId); //毛重
-                }
-                i += tmstruckWeightResultService.updateWeightResult(calculateMap10);
                 checkMeasureCommission = tmstruckMeasureCommissionService.addMaoMeasureCommission(map); //添加计量委托
                 break;
             case 11:
@@ -243,29 +194,11 @@ public class TmstruckEnfactoryResultServiceImpl implements ITmstruckEnfactoryRes
             case 13:
             case 16:
             case 15:
-                //无法确定汽车衡
-                HashMap<String, Object> calculateMap1213 = new HashMap<>();
-                calculateMap1213.put("orderId", map.get("orderId"));
-                calculateMap1213.put("orderType", orderType);
-                //计算计量汽车衡并更新计量实绩
-                int placeId1213 = rulesService.calculateWeighbridge(calculateMap1213);
-                if(orderType.intValue() == 12){
-                    calculateMap1213.put("grossPlaceId", placeId1213);
-                }else {
-                    calculateMap1213.put("tarePlaceId", placeId1213);
-                }
-                i += tmstruckWeightResultService.updateWeightResult(calculateMap1213);
                 //发送计量委托(查询物资顺序第一个装卸货的物资)
                 //拿到需要计量的物资ID
                 Integer materialId = utilsMapper.getLxFirstMaterialId(DataChange.dataToBigDecimal(map.get("orderId")));
                 map.put("materialId", materialId);
                 checkMeasureCommission += tmstruckMeasureCommissionService.addLXMeasureCommission(map);
-<<<<<<< HEAD
-
-=======
-            
->>>>>>> a082ab0bd9cb789ae91ca4beee53c86183d90b93
-
         }
 
         if(checkMeasureCommission == 0){

+ 42 - 12
src/main/java/com/steerinfo/dil/service/impl/TmstruckLeaveFactoryResultServiceImpl.java

@@ -1,5 +1,6 @@
 package com.steerinfo.dil.service.impl;
 
+import com.steerinfo.dil.feign.AmsFeign;
 import com.steerinfo.dil.feign.BmsShipFeign;
 import com.steerinfo.dil.feign.BmsTruckFeign;
 import com.steerinfo.dil.feign.OmsFeign;
@@ -10,16 +11,14 @@ import com.steerinfo.dil.model.TmstruckLeaveFactoryResult;
 import com.steerinfo.dil.service.ITmstruckLeaveFactoryResultService;
 import com.steerinfo.dil.service.IUtilsService;
 import com.steerinfo.dil.util.DataChange;
+import com.steerinfo.framework.controller.RESTfulResult;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * TmstruckLeaveFactoryResult服务实现:
@@ -44,7 +43,7 @@ public class TmstruckLeaveFactoryResultServiceImpl implements ITmstruckLeaveFact
     private TmstruckEnfactoryResultMapper tmstruckEnfactoryResultMapper;
 
     @Autowired
-    private IUtilsService utilsService;
+    private UtilsServiceImpl utilsService;
 
     @Autowired
     private UtilsMapper utilsMapper;
@@ -55,6 +54,9 @@ public class TmstruckLeaveFactoryResultServiceImpl implements ITmstruckLeaveFact
     @Autowired
     OmsFeign omsFeign;
 
+    @Autowired
+    AmsFeign amsFeign;
+
     /**
      * 查看运输线路是否为出厂
      * @param orderNumber
@@ -80,9 +82,11 @@ public class TmstruckLeaveFactoryResultServiceImpl implements ITmstruckLeaveFact
         //添加总实绩ID
         BigDecimal resultTotalId = DataChange.dataToBigDecimal(map.get("resultTotalId"));
         tmstruckLeaveFactoryResult.setResultTotalId(resultTotalId);
-        //通过总实绩ID查询订单类型
-        Map<String, Object> mesMap = utilsMapper.getOrderTypeByTotalId(resultTotalId);
-        int gatepostId = rulesService.calculateDxGatepostId(mesMap);
+        List<Integer> gatepostIdList = utilsMapper.getLineSegmentGateCalcId(map);
+        gatepostIdList.remove(null);
+        //随机取门岗值
+        Integer gatepostId = utilsService.randomGetValue(gatepostIdList);
+        //获取门岗ID
         tmstruckLeaveFactoryResult.setGatepostId(new BigDecimal(gatepostId));
         //添加路段顺序号
         tmstruckLeaveFactoryResult.setSegmentSqe(DataChange.dataToBigDecimal(map.get("segmentSqe")));
@@ -153,6 +157,7 @@ public class TmstruckLeaveFactoryResultServiceImpl implements ITmstruckLeaveFact
      * @param map
      * @return
      */
+    @Transactional
     public int leaveFactoryByPDA(Map<String, Object> map) throws Exception{
         int i = 0;
         String orderNumber = (String) map.get("orderNumber");
@@ -179,12 +184,27 @@ public class TmstruckLeaveFactoryResultServiceImpl implements ITmstruckLeaveFact
                     throw new Exception("请提醒司机确认订单!");
                 }
                 i += utilsService.closeOrderNormally(map);
+                // 判断是否要自动派单
+                Map<String,Object> mapValue = omsFeign.getSaleAllMessages(orderId.intValue());
+                Object closeStatus = mapValue.get("closeStatus");
+                if (closeStatus != null && DataChange.dataToBigDecimal(closeStatus).intValue() == 0) {
+                    amsFeign.dispatchTruckOrderByCarrier(mapValue);
+                }
                 break;
             case 4:
                 break;
-            case 5:
             case 6:
             case 7:
+                //判断出厂路段顺序号是否为最后一个 采购订单关闭订单
+                i += utilsService.closeOrderNormally(map);
+                //查询是否为一车多趟采购订单类型
+                Integer isMoreTripsStatus = tmstruckLeaveFactoryResultMapper.getIsMoreTripsStatus(DataChange.dataToBigDecimal(selectMap.get("orderId")));
+                if(isMoreTripsStatus != null && isMoreTripsStatus == 1){
+                    //如果是一车多趟 则重新下一个运输订单
+                    omsFeign.addNewTransportOrder(orderId.intValue());
+                }
+                break;
+            case 5:
             case 8:
             case 9:
             case 17:
@@ -201,16 +221,26 @@ public class TmstruckLeaveFactoryResultServiceImpl implements ITmstruckLeaveFact
 //                }
                 break;
             case 10:
+                //生成新的采购内转运输订单
+
                 //判断出厂路段顺序号是否为最后一个 采购订单关闭订单
                 i += utilsService.closeOrderNormally(map);
+                //根据运输订单ID查询路段顺序号
+                Integer seq = tmstruckLeaveFactoryResultMapper.getSeq(orderId);
+                if(seq == 10){
+                    //判断是否满足条件--计划是否被启用
+                    Integer j = tmstruckLeaveFactoryResultMapper.getPlanEnable(orderId);
+                    if(j == 1){
+                        //生成新的运输订单
+                        omsFeign.addPurInwardOrder(orderId);
+                    }
+
+                }
                 break;
             case 11:
                 break;
             case 12:
             case 13:
-                //判断出厂路段顺序是否为最后一个零星订单关闭订单
-                i += utilsService.closeOrderNormally(map);
-                break;
             case 15:
             case 16:
                 //生成新的零星订单

+ 17 - 31
src/main/java/com/steerinfo/dil/service/impl/TmstruckLoadResultServiceImpl.java

@@ -60,8 +60,21 @@ public class TmstruckLoadResultServiceImpl implements ITmstruckLoadResultService
     @Autowired
     private TmstruckWeightResultServiceImpl tmstruckWeightResultService;
 
-    @Autowired
-    private TmstruckMeasureCommissionServiceImpl tmstruckMeasureCommissionService;
+    /**
+     * 生成销售装车实绩(虚拟装车实绩)
+     * @param map
+     * @return
+     */
+    public int addLoadResult(Map<String, Object> map){
+        TmstruckLoadResult tmstruckLoadResult = new TmstruckLoadResult();
+        //添加主键Id
+        tmstruckLoadResult.setResultId(tmstruckLoadResultMapper.selectMaxId());
+        //添加总实绩ID
+        tmstruckLoadResult.setResultTotalId(DataChange.dataToBigDecimal(map.get("resultTotalId")));
+        // 添加路段顺序号
+        tmstruckLoadResult.setSegmentSqe(DataChange.dataToBigDecimal(map.get("segmentSqe")));
+        return tmstruckLoadResultMapper.insertSelective(tmstruckLoadResult);
+    }
 
     /**
      * 查询所有装车实绩
@@ -96,7 +109,7 @@ public class TmstruckLoadResultServiceImpl implements ITmstruckLoadResultService
             case 13:
             case 15:
             case 16:
-                 return tmstruckLoadResultMapper.getSporadicSuppliesLoadResult(map); //apiId = 404
+                 return tmstruckLoadResultMapper.getSporadicSuppliesLoadResult(map); //apiId = 430
         }
         return null;
     }
@@ -158,24 +171,6 @@ public class TmstruckLoadResultServiceImpl implements ITmstruckLoadResultService
     }
 
 
-    /**
-     * 生成销售装车实绩(虚拟装车实绩)
-     * @param map
-     * @return
-     */
-    public int addLoadResult(Map<String, Object> map){
-        TmstruckLoadResult tmstruckLoadResult = new TmstruckLoadResult();
-        //添加主键Id
-        tmstruckLoadResult.setResultId(tmstruckLoadResultMapper.selectMaxId());
-        //添加物资Id
-        tmstruckLoadResult.setMaterialId(DataChange.dataToBigDecimal(map.get("materialId")));
-        //添加总实绩ID
-        tmstruckLoadResult.setResultTotalId(DataChange.dataToBigDecimal(map.get("resultTotalId")));
-        // 添加路段顺序号
-        tmstruckLoadResult.setSegmentSqe(DataChange.dataToBigDecimal(map.get("segmentSqe")));
-        return tmstruckLoadResultMapper.insertSelective(tmstruckLoadResult);
-    }
-
     /**
      * 更新装车实绩表
      * @return
@@ -283,17 +278,8 @@ public class TmstruckLoadResultServiceImpl implements ITmstruckLoadResultService
         // 更新装货点
         tmstruckLoadResult.setLoadingId(DataChange.dataToBigDecimal(map.get("warehouseId")));
         tmstruckLoadResult.setInsertUpdateRemark((String) map.get("insertUpdateRemark"));
+        tmstruckLoadResult.setCaseNumber((String) map.get("caseNumber"));
         int i = tmstruckLoadResultMapper.updateByPrimaryKeySelective(tmstruckLoadResult);
-        //装车成功后计算计毛汽车衡(出厂:2)
-        BigDecimal orderType = DataChange.dataToBigDecimal(orderMap.get("orderType"));
-        BigDecimal orderId = DataChange.dataToBigDecimal(map.get("orderId"));
-        Map<String, Object> mesMap = new HashMap<>();
-        mesMap.put("orderType", orderType);
-        mesMap.put("orderId", orderId);
-        int placeId = rulesService.calculateWeighbridge(mesMap);
-        mesMap.put("grossPlaceId", placeId);
-        i += tmstruckWeightResultService.updateWeightResult(mesMap);
-
         //更新路段顺序号
         i += utilsService.updateOrderLineSequence(map);
         //推送消息到websocket

+ 6 - 4
src/main/java/com/steerinfo/dil/service/impl/TmstruckMeasureCommissionServiceImpl.java

@@ -303,6 +303,7 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
                     measureCommission.put("orderSource", measureCommission.get("chooseOrderSource"));
                     measureCommission.put("billType", "0");
                     measureCommission.put("item", measureCommission.get("item") + ",1");
+                    measureCommission.put("goodsName",measureCommission.get("goodsName") + "null");
                 }else {
                     measureCommission.put("orderSource", "0");
                     measureCommission.put("billType", "2");
@@ -327,6 +328,7 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
 //            case 14:
             //零星一车多趟
             case 15:
+            case 16:
                 measureCommission = tmstruckMeasureCommissionMapper.sporadicDXMeasure(map);
                 if(measureCommission == null)
                     return 0;
@@ -337,12 +339,12 @@ public class TmstruckMeasureCommissionServiceImpl implements ITmstruckMeasureCom
                 measureCommission.put("crname", "admin");
                 measureCommission.put("orderSource", "0");
                 measureCommission.put("ended", "0");
-            case 16:
+            
         }
         /*访问接口发送数据*/
-//        return sendMesToDXMeasure(measureCommission);
-        System.out.println(measureCommission);
-        return 1;
+        return sendMesToDXMeasure(measureCommission);
+  //      System.out.println(measureCommission);
+  //    return 1;
     }
 
     /**

+ 9 - 19
src/main/java/com/steerinfo/dil/service/impl/TmstruckUnloadResultServiceImpl.java

@@ -163,33 +163,16 @@ public class TmstruckUnloadResultServiceImpl implements ITmstruckUnloadResultSer
             case 7:
             case 8:
             case 9:
+            case 10:
+            case 15:
             case 17:
             case 18:
-                //计算计皮汽车衡 (当前无法计算汽车衡)
-                int placeId = rulesService.calculateWeighbridge(mesMap);
-                mesMap.put("tarePlaceId", placeId);
-                i += tmstruckWeightResultService.updateWeightResult(mesMap);
-                i += tmstruckReceiptResultService.addReceiptResult(map); //新增完卸车实绩后新增一条收货实绩
-
-                //计算出厂门岗 (暂时定死)
-//                Integer gatepostId = 2;
-                //计皮委托发送后更新出厂门岗
-//                i += tmstruckLeaveFactoryResultService.updateLeaveFactoryGatepostId(resultTotalId.intValue(), gatepostId);
-                break;
-            case 10:
-                //计算计皮汽车衡 (当前无法计算汽车衡)
-                int placeId10 = rulesService.calculateWeighbridge(mesMap);
-                mesMap.put("tarePlaceId", placeId10);
-                i += tmstruckWeightResultService.updateWeightResult(mesMap);
                 i += tmstruckReceiptResultService.addReceiptResult(map); //新增完卸车实绩后新增一条收货实绩
                 break;
             case 11:
                 //判断出厂路段顺序号是否为最后一个
                 i += utilsService.closeOrderNormally(map);
             case 12:
-                int placeId12 = rulesService.calculateWeighbridge(mesMap);
-                mesMap.put("tarePlaceId", placeId12);
-                i += tmstruckWeightResultService.updateWeightResult(mesMap);
                 //判断是否还有物资,如果还有物资就执行发送计量委托
                 materialIdIsNorWeight(map);
                 break;
@@ -216,6 +199,13 @@ public class TmstruckUnloadResultServiceImpl implements ITmstruckUnloadResultSer
         if(map.get("warehouseId") != null){
             tmstruckUnloadResult.setResultUnloadPlaceId(DataChange.dataToBigDecimal(map.get("warehouseId")));
         }
+        if(map.get("personnelSsoId") != null){
+            //通过SSo主键查询人员管理主键
+            Integer personnelId = utilsMapper.getPersonnelIdBySsoId((String) map.get("personnelSsoId"));
+            if(personnelId != null){
+                tmstruckUnloadResult.setUnloaderId(new BigDecimal(personnelId));
+            }
+        }
         //判断物资id是否为空
         if (map.get("materialId") != null){
             tmstruckUnloadResult.setMaterialId(DataChange.dataToBigDecimal(map.get("materialId")));

+ 54 - 38
src/main/java/com/steerinfo/dil/service/impl/TmstruckWeightResultServiceImpl.java

@@ -18,10 +18,7 @@ import java.math.BigDecimal;
 import java.text.DecimalFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * TmstruckWeightResult服务实现:
@@ -48,6 +45,9 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
     @Autowired
     private UtilsServiceImpl utilsService;
 
+    @Autowired
+    private UtilsMapper utilsMapper;
+
     @Autowired
     private RulesServiceImpl rulesService;
 
@@ -55,6 +55,54 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
     @Autowired
     OmsFeign omsFeign;
 
+    /**
+     * 派单时新增计重实绩
+     * 总实绩ID、计皮点、计毛点
+     * @return
+     */
+    @Override
+    public int addWeightResult(Map<String, Object> map) {
+        TmstruckWeightResult tmstruckWeightResult = new TmstruckWeightResult();
+        //生成最大主键ID
+        tmstruckWeightResult.setWeightTaskResultId(tmstruckWeightResultMapper.selectMaxId());
+        BigDecimal resultTotalId = DataChange.dataToBigDecimal(map.get("resultTotalId"));
+        tmstruckWeightResult.setResultTotalId(resultTotalId);
+        // 添加路段顺序号以及汽车衡
+        List<Integer> calculateList = null;
+        Integer calculateId = 0;
+        Object grossSegmentSqe = map.get("grossSegmentSqe");
+        //获取毛重汽车衡
+        if(grossSegmentSqe != null){
+            tmstruckWeightResult.setGrossSegmentSqe(DataChange.dataToBigDecimal(grossSegmentSqe));
+            map.put("segmentSqe", grossSegmentSqe);
+            calculateList = utilsMapper.getLineSegmentGateCalcId(map);
+            //取汽车衡的Id
+            calculateList.remove(null);
+            calculateId = utilsService.randomGetValue(calculateList);
+            tmstruckWeightResult.setResultGrossPlaceId(new BigDecimal(calculateId));
+        }
+        Object tareSegmentSqe = map.get("tareSegmentSqe");
+        if(tareSegmentSqe != null){
+            tmstruckWeightResult.setTareSegmentSqe(DataChange.dataToBigDecimal(tareSegmentSqe));
+            map.put("segmentSqe", tareSegmentSqe);
+            calculateList = utilsMapper.getLineSegmentGateCalcId(map);
+            calculateList.remove(null);
+            calculateId = utilsService.randomGetValue(calculateList);
+            tmstruckWeightResult.setResultTarePlaceId(new BigDecimal(calculateId));
+        }
+        if(map.get("isdeduct") == null){
+            //添加是否需要扣水扣杂
+            //通过总实绩ID查询订单类型
+            Integer orderType = tmstruckWeightResultMapper.getOrderTypeByTotalId(resultTotalId);
+            if("67".contains(orderType.toString()) || orderType == 10){
+                tmstruckWeightResult.setIsdeduct(new BigDecimal(1));
+            }
+        }else {
+            tmstruckWeightResult.setIsdeduct(DataChange.dataToBigDecimal(map.get("isdeduct")));
+        }
+        return tmstruckWeightResultMapper.insertSelective(tmstruckWeightResult);
+    }
+
     /**
      * 查询所有计毛实绩
      * @param map
@@ -123,9 +171,9 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
             case 11:
                 break;
             case 12:
-                return tmstruckWeightResultMapper.getSporadicSuppliesJiPiResult(map);//apiId:392
+//                return tmstruckWeightResultMapper.getSporadicSuppliesJiPiResult(map);//apiId:392
             case 13:
-                return tmstruckWeightResultMapper.getFactorySkinSporadicJIPi(map); //apiId=401
+//                return tmstruckWeightResultMapper.getFactorySkinSporadicJIPi(map); //apiId=401
             case 15:
             case 16:
                 return tmstruckWeightResultMapper.getFactorySkinSporadicWeight(map); //apiId=401
@@ -133,38 +181,6 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
         return null;
     }
 
-    /**
-     * 派单时新增计重实绩
-     * 总实绩ID、计皮点、计毛点
-     * @return
-     */
-    @Override
-    public int addWeightResult(Map<String, Object> map) {
-        TmstruckWeightResult tmstruckWeightResult = new TmstruckWeightResult();
-        //生成最大主键ID
-        tmstruckWeightResult.setWeightTaskResultId(tmstruckWeightResultMapper.selectMaxId());
-        BigDecimal resultTotalId = DataChange.dataToBigDecimal(map.get("resultTotalId"));
-        tmstruckWeightResult.setResultTotalId(resultTotalId);
-        //通过总实绩ID查询订单类型
-        if(map.get("isdeduct") == null){
-            //添加是否需要扣水扣杂
-            Integer orderType = tmstruckWeightResultMapper.getOrderTypeByTotalId(resultTotalId);
-            if("67".contains(orderType.toString()) || orderType == 10){
-                tmstruckWeightResult.setIsdeduct(new BigDecimal(1));
-            }
-        }else {
-            tmstruckWeightResult.setIsdeduct(DataChange.dataToBigDecimal(map.get("isdeduct")));
-        }
-        // 添加物资Id (销售、内转到异地库)
-        if(map.get("materialId") != null)
-            tmstruckWeightResult.setMaterialId(DataChange.dataToBigDecimal(map.get("materialId")));
-        // 添加路段顺序号
-        if(map.get("grossSegmentSqe") != null) //毛重路段顺序号
-            tmstruckWeightResult.setGrossSegmentSqe(DataChange.dataToBigDecimal(map.get("grossSegmentSqe")));
-        if(map.get("tareSegmentSqe") != null) //皮重路段顺序号
-            tmstruckWeightResult.setTareSegmentSqe(DataChange.dataToBigDecimal(map.get("tareSegmentSqe")));
-        return tmstruckWeightResultMapper.insertSelective(tmstruckWeightResult);
-    }
 
     /**
      * 更新计量实绩  计皮点  计毛点  皮重

+ 14 - 1
src/main/java/com/steerinfo/dil/service/impl/UtilsServiceImpl.java

@@ -166,5 +166,18 @@ public class UtilsServiceImpl implements IUtilsService {
     }
 
 
-
+    public int randomGetValue(List<Integer> dataList){
+        if(dataList.size() != 0&&dataList !=null){
+            if(dataList.size() == 1){
+                return dataList.get(0);
+            }else {
+                //如果有多个值则随机取一个
+                Random random = new Random();
+                int i = random.nextInt(dataList.size());
+                return dataList.get(i);
+            }
+        }else {
+            return 0;
+        }
+    }
 }

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

@@ -51,7 +51,7 @@ public class DataChange {
                     try {
                         decimal = new BigDecimal(str);
                     } catch (Exception e) {
-                        e.printStackTrace();
+                        System.out.println(data + ":数据解析失败!返回0");
                         return new BigDecimal(0);
                     }
                 }
@@ -166,4 +166,74 @@ public class DataChange {
         return sb.toString();
     }
 
+    /**
+     * 根据时间段查询数据 支持只选择单个时间
+     * @Author TXF
+     * @Date 2022/1/10 23:21
+     * @param startTime
+     * @param endTime
+     * @param map
+     * @param sdf
+     * @return
+     **/
+    public static void queryDataByDate(String startTime, String endTime, Map<String, Object> map, SimpleDateFormat sdf){
+        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) + 86400000)));
+        } else if (startTime != null && !"null".equals(startTime)) {
+            map.put("oneDate", sdf.format(new Date(Long.parseLong(startTime))));
+        } else if (endTime != null && !"null".equals(endTime)) {
+            map.put("oneDate", sdf.format(new Date(Long.parseLong(endTime))));
+        } else {
+            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 queryDataByTwoDate(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("startTime", dayStartTime + "00:00:00");
+        map.put("endTime", dayEndTime + "00:00:00");
+    }
 }

+ 3 - 1
src/main/resources/application-dev.yml

@@ -37,7 +37,9 @@ openfeign:
   QmsFeign:
     url: ${QMSFEIGN_URL:172.16.33.162:8017}
   ImFeign:
-    url: ${IMFEIGN_URL:172.16.33.162:8055}
+    url: ${IMFEIGN_URL:172.16.33.166:8055}
+  AmsFeign:
+    url: ${AMSFEIGN_URL:172.16.33.162:8015}
 
 server:
   port: 8008

+ 2 - 0
src/main/resources/application-prod.yml

@@ -39,6 +39,8 @@ openfeign:
     url: ${QMSFEIGN_URL:172.16.33.166:8047}
   ImFeign:
     url: ${IMFEIGN_URL:172.16.33.166:8055}
+  AmsFeign:
+    url: ${AMSFEIGN_URL:172.16.33.166:8079}
 
 server:
   port: 8088

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

@@ -1,7 +1,7 @@
 api.version: api/v1/truckTms
 spring:
   profiles:
-    include: ${SPRING_PROFILES:dev
+    include: ${SPRING_PROFILES:prod}
   jackson:
     date-format: yyyy-MM-dd HH:mm:ss
     time-zone: GMT+8

+ 225 - 51
src/main/resources/com/steerinfo/dil/mapper/StatisticalReportMapper.xml

@@ -28,9 +28,11 @@
                      RTCMAO.TRUCK_CALCULATE_NUMBER  "grossCalculateNum",
                      RTCPI.TRUCK_CALCULATE_NUMBER   "tareCalculateNum",
                      TWR.RESULT_GROSS_WEIGHT_TIME   "resultGrossWeightTime",
-                        <if test="orderTypee == 17 or orderTypee == 18">
-                            RS.SUPPLIER_NAME           "supplierName",
-                        </if>
+                     RM.MATERIAL_NAME                     "materialName",
+                     CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode",
+                     APO.PURCHASE_ORDER_NO      "purchaseOrderNo",
+                     RS.SUPPLIER_NAME           "supplierName",
+                     RCON.CONSIGNEE_COMPANY_NAME "receiveName",
                      TWR.RESULT_TARE_WEIGHT_TIME    "resultTareWeightTime"
               from OMSTRUCK_ORDER OO
                        left join TMSTRUCK_TOTAL_RESULT TTR
@@ -43,6 +45,8 @@
                                  on RGEN.GATEPOST_ID = TER.GATEPOST_ID
                        left join OMSTRUCK_ORDER_MATERIAL OOM
                                  on OOM.ORDER_ID = OO.ORDER_ID
+                       left join RMS_MATERIAL RM
+                                 on RM.MATERIAL_ID = OOM.MATERIAL_ID
                        left join TMSTRUCK_WEIGHT_RESULT TWR
                                  on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
                        left join RMS_TRUCK_CALCULATE RTCMAO --毛重汽车衡
@@ -61,14 +65,22 @@
                                  on TRR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
                        left join TMSTRUCK_QUALITY_RESULT TQR
                                  on TQR.TOTAL_RESULT_ID = TTR.RESULT_TOTAL_ID
-                       <if test="orderTypee == 17 or orderTypee == 18">
-                           left join AMS_PURCHASE_ORDER APO
-                                on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
-                           left join RMS_SUPPLIER RS
-                                on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
-                       </if>
+                       left join AMS_PURCHASE_ORDER APO
+                            on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
+                       left join RMS_SUPPLIER RS
+                            on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
+                       left join RMS_CONSIGNEE RCON
+                            on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
+
               where OO.ORDER_STATUS in (5, 8, 9, 1, 2)
                 and OO.ORDER_TYPE = #{orderTypee}
+                    <if test="oneDate != null">
+                        and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
+                    </if>
+                    <if test="startDate != null">
+                        and to_date(#{startDate}, 'yyyy-mm-dd') &lt;= TER.RESULT_ENTRY_GATE_TIME
+                        and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
+                    </if>
              )
         <where>
             <if test="orderNumber != null">
@@ -136,7 +148,7 @@
         select
                *
         from (
-                 select OO.ORDER_NUMBER              "orderNumber",
+                 select DISTINCT OO.ORDER_NUMBER              "orderNumber",
                         RC.CAPACITY_NUMBER           "capacityNumber",
                         TER.RESULT_ENTRY_GATE_TIME   "resultEntryGateTime",
                         TWR.RESULT_TARE_WEIGHT_TIME  "resultTareWeightTime",
@@ -151,7 +163,13 @@
                         RTCPI.TRUCK_CALCULATE_NUMBER        "piCalculate",
                         RGEN.GATEPOST_NAME                  "enGatepostName",
                         RGOUT.GATEPOST_NAME                 "outGatepostName",
-                        RCON.CONSIGNEE_COMPANY_NAME         "receiveName"
+                        RCON.CONSIGNEE_COMPANY_NAME         "receiveName",
+                        RS.SUPPLIER_NAME                    "sendName",
+                        RM.MATERIAL_NAME                     "materialName",
+                        TLR.INSERT_UPDATE_REMARK             "materialRemark",
+                        ASO.SALE_NUMBER                      "saleNumber",
+                        TLR.CASE_NUMBER                      "caseNumber",
+                        CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
                  from OMSTRUCK_ORDER OO
                           left join AMS_SALE_ORDER_MATERIAL ASOM
                                on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
@@ -159,28 +177,34 @@
                                on ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
                           left join RMS_CONSIGNEE RCON
                                on RCON.CONSIGNEE_ID = ASO.RECEIVE_ID
+                          left join RMS_SUPPLIER RS
+                               on RS.SUPPLIER_ID = ASO.SHIPPER_ID
                           join TMSTRUCK_TOTAL_RESULT TTR
                                on TTR.ORDER_ID = OO.ORDER_ID
                           join TMSTRUCK_LOAD_RESULT TLR
                                on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-                          join RMS_WAREHOUSE RW
+                          left join RMS_WAREHOUSE RW
                                on RW.WAREHOUSE_ID = TLR.LOADING_ID
                           join TMSTRUCK_WEIGHT_RESULT TWR
                                on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-                          join RMS_TRUCK_CALCULATE RTCMAO
+                          left join RMS_TRUCK_CALCULATE RTCMAO
                                on TWR.RESULT_GROSS_PLACE_ID = RTCMAO.TRUCK_CALCULATE_ID
-                          join RMS_TRUCK_CALCULATE RTCPI
+                          left join RMS_TRUCK_CALCULATE RTCPI
                                on TWR.RESULT_TARE_PLACE_ID = RTCPI.TRUCK_CALCULATE_ID
                           join TMSTRUCK_ENFACTORY_RESULT TER
                                on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-                          join RMS_GATEPOST RGEN
+                          left join RMS_GATEPOST RGEN
                                on RGEN.GATEPOST_ID = TER.GATEPOST_ID
                           join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
                                on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-                          join RMS_GATEPOST RGOUT
+                          left join RMS_GATEPOST RGOUT
                                on RGOUT.GATEPOST_ID = TLFR.GATEPOST_ID
                           join RMS_CAPACITY RC
                                on RC.CAPACITY_ID = OO.CAPACITY_ID
+                          join OMSTRUCK_ORDER_MATERIAL OOM
+                               on OOM.ORDER_ID = OO.ORDER_ID
+                          join RMS_MATERIAL RM
+                               on RM.MATERIAL_ID = OOM.MATERIAL_ID
                           <if test="carrierSsoId != null">
                               join RMS_CARRIER RCA
                                 on RCA.CARRIER_ID = RC.CARRIER_ID
@@ -189,6 +213,13 @@
                           <if test="carrierSsoId != null">
                               and RCA.CARRIER_SSO_ID = #{carrierSsoId}
                           </if>
+                          <if test="oneDate != null">
+                              and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
+                          </if>
+                          <if test="startDate != null">
+                              and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_GROSS_WEIGHT_TIME
+                              and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_GROSS_WEIGHT_TIME
+                          </if>
              )
         <where>
             <if test="orderNumber != null">
@@ -196,12 +227,45 @@
                     "orderNumber" like '%${item}%'
                 </foreach>
             </if>
+            <if test="enGatepostName != null">
+                <foreach collection="enGatepostName" item="item" open="(" separator="or" close=")">
+                    "enGatepostName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="outGatepostName != null">
+                <foreach collection="outGatepostName" item="item" open="(" separator="or" close=")">
+                    "outGatepostName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="caseNumber != null">
+                <foreach collection="caseNumber" item="item" open="(" separator="or" close=")">
+                    "caseNumber" like '%${item}%'
+                </foreach>
+            </if>
             <if test="capacityNumber != null">
                 and
                 <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
                     "capacityNumber" like '%${item}%'
                 </foreach>
             </if>
+            <if test="receiveName != null">
+                and
+                <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
+                    "receiveName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="materialRemark != null">
+                and
+                <foreach collection="materialRemark" item="item" open="(" separator="or" close=")">
+                    "materialRemark" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="sendName != null">
+                and
+                <foreach collection="sendName" item="item" open="(" separator="or" close=")">
+                    "sendName" like '%${item}%'
+                </foreach>
+            </if>
             <if test="resultEntryGateTime != null">
                 and
                 <foreach collection="resultEntryGateTime" item="item" open="(" separator="or" close=")">
@@ -244,6 +308,12 @@
                     "resultGrossWeight" like '%${item}%'
                 </foreach>
             </if>
+            <if test="materialName != null">
+                and
+                <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+                    "materialName" like '%${item}%'
+                </foreach>
+            </if>
             <if test="resultNetWeight != null">
                 and
                 <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
@@ -285,41 +355,93 @@
 --         计皮汽车衡
         RTC1.TRUCK_CALCULATE_NUMBER "truckTareCalculate",
 --         计毛汽车衡
-        RTC2.TRUCK_CALCULATE_NUMBER "truckCrossCalculate"
+        RTC2.TRUCK_CALCULATE_NUMBER "truckCrossCalculate",
+        RCON.CONSIGNEE_COMPANY_NAME "receiveName",
+        RS.SUPPLIER_NAME            "sendName",
+        RM.MATERIAL_NAME                     "materialName",
+        CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
+
         from OMSTRUCK_ORDER OO
         join TMSTRUCK_TOTAL_RESULT TTR
-        on TTR.ORDER_ID = OO.ORDER_ID
+            on TTR.ORDER_ID = OO.ORDER_ID
         join TMSTRUCK_UNLOAD_RESULT TUR
-        on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-        join RMS_WAREHOUSE RW
-        on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
+            on TUR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        left join RMS_WAREHOUSE RW
+            on RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
         join TMSTRUCK_WEIGHT_RESULT TWR
-        on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-            join RMS_TRUCK_CALCULATE RTC2
+            on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        left join RMS_TRUCK_CALCULATE RTC2
             on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
-            join RMS_TRUCK_CALCULATE RTC1
+        left join RMS_TRUCK_CALCULATE RTC1
             on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
         join TMSTRUCK_ENFACTORY_RESULT TER
-        on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-            join RMS_GATEPOST RG2
+            on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        left join RMS_GATEPOST RG2
             on RG2.GATEPOST_ID =TER.GATEPOST_ID
         join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
-        on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-        join RMS_GATEPOST RG
+            on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        left join RMS_GATEPOST RG
             on TLFR.GATEPOST_ID =RG.GATEPOST_ID
-        join RMS_CAPACITY RC
-        on RC.CAPACITY_ID = OO.CAPACITY_ID
+        left join RMS_CAPACITY RC
+            on RC.CAPACITY_ID = OO.CAPACITY_ID
+        left join AMSTRUCK_SPORADIC_ORDER ASO
+            on ASO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
+        left join RMS_SUPPLIER RS
+            on RS.SUPPLIER_ID = ASO.SEND_UNIT_ID
+        left join RMS_CONSIGNEE RCON
+            on RCON.CONSIGNEE_ID = ASO.RECEIVE_UNIT_ID
+        join OMSTRUCK_ORDER_MATERIAL OOM
+            on OOM.ORDER_ID = OO.ORDER_ID
+        join RMS_MATERIAL RM
+            on RM.MATERIAL_ID = OOM.MATERIAL_ID
         <if test="carrierSsoId != null">
             join RMS_CARRIER RCA
-            on RCA.CARRIER_ID = RC.CARRIER_ID
+                on RCA.CARRIER_ID = RC.CARRIER_ID
         </if>
         where OO.ORDER_TYPE in (12,15)
         <if test="carrierSsoId != null">
             and RCA.CARRIER_SSO_ID = #{carrierSsoId}
         </if>
-        and TO_CHAR(TLFR.RESULT_OUT_GATE_TIME, 'YYYY-MM-DD') = TO_CHAR(SYSDATE, 'YYYY-MM-DD')
+        <if test="oneDate != null">
+            and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
+        </if>
+        <if test="startDate != null">
+            and to_date(#{startDate}, 'yyyy-mm-dd') &lt;= TER.RESULT_ENTRY_GATE_TIME
+            and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
+        </if>
+        <if test="con!=null">
+            where  "receiveName" like #{con} or  "sendName" like #{con} or "materialName" like #{con}
+            or "capacityNumber" like #{con}
+        </if>
+        <if test="userId!=null">
+            and ASO.INSERT_USERNAME=#{userId}
+        </if>
+        <if test="userIds!=null">
+            and ASO.UPDATE_USERNAME=#{userIds}
+        </if>
+        <if test="orderType!=null">
+            and OO.ORDER_TYPE=#{orderType}
+        </if>
         )
         <where>
+            <if test="receiveName != null">
+                and
+                <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
+                    "receiveName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="sendName != null">
+                and
+                <foreach collection="sendName" item="item" open="(" separator="or" close=")">
+                    "sendName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="materialName != null">
+                and
+                <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+                    "materialName" like '%${item}%'
+                </foreach>
+            </if>
             <if test="orderNumber != null">
                 <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
                     "orderNumber" like '%${item}%'
@@ -414,30 +536,45 @@
         --         计皮汽车衡
         RTC1.TRUCK_CALCULATE_NUMBER "truckTareCalculate",
         --         计毛汽车衡
-        RTC2.TRUCK_CALCULATE_NUMBER "truckCrossCalculate"
+        RTC2.TRUCK_CALCULATE_NUMBER "truckCrossCalculate",
+        RCON.CONSIGNEE_COMPANY_NAME "receiveName",
+        RS.SUPPLIER_NAME            "sendName",
+        RM.MATERIAL_NAME                     "materialName",
+        CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
+
         from OMSTRUCK_ORDER OO
         join TMSTRUCK_TOTAL_RESULT TTR
-        on TTR.ORDER_ID = OO.ORDER_ID
+            on TTR.ORDER_ID = OO.ORDER_ID
         join TMSTRUCK_LOAD_RESULT TLR
-        on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-        join RMS_WAREHOUSE RW
-        on RW.WAREHOUSE_ID = TLR.LOADING_ID
+            on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        left join RMS_WAREHOUSE RW
+            on RW.WAREHOUSE_ID = TLR.LOADING_ID
         join TMSTRUCK_WEIGHT_RESULT TWR
-        on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-        join RMS_TRUCK_CALCULATE RTC2
-        on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
-        join RMS_TRUCK_CALCULATE RTC1
-        on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
+            on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        left join RMS_TRUCK_CALCULATE RTC2
+            on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
+        left join RMS_TRUCK_CALCULATE RTC1
+            on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
         join TMSTRUCK_ENFACTORY_RESULT TER
-        on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-        join RMS_GATEPOST RG2
-        on RG2.GATEPOST_ID =TER.GATEPOST_ID
+            on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        left join RMS_GATEPOST RG2
+            on RG2.GATEPOST_ID =TER.GATEPOST_ID
         join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
-        on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-        join RMS_GATEPOST RG
-        on TLFR.GATEPOST_ID =RG.GATEPOST_ID
-        join RMS_CAPACITY RC
-        on RC.CAPACITY_ID = OO.CAPACITY_ID
+            on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        left join RMS_GATEPOST RG
+            on TLFR.GATEPOST_ID =RG.GATEPOST_ID
+        left join RMS_CAPACITY RC
+            on RC.CAPACITY_ID = OO.CAPACITY_ID
+        left join AMSTRUCK_SPORADIC_ORDER ASO
+            on ASO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
+        left join RMS_SUPPLIER RS
+            on RS.SUPPLIER_ID = ASO.SEND_UNIT_ID
+        left join RMS_CONSIGNEE RCON
+            on RCON.CONSIGNEE_ID = ASO.RECEIVE_UNIT_ID
+        join OMSTRUCK_ORDER_MATERIAL OOM
+            on OOM.ORDER_ID = OO.ORDER_ID
+        join RMS_MATERIAL RM
+            on RM.MATERIAL_ID = OOM.MATERIAL_ID
         <if test="carrierSsoId != null">
             join RMS_CARRIER RCA
             on RCA.CARRIER_ID = RC.CARRIER_ID
@@ -446,9 +583,46 @@
         <if test="carrierSsoId != null">
             and RCA.CARRIER_SSO_ID = #{carrierSsoId}
         </if>
-        and TO_CHAR(TLFR.RESULT_OUT_GATE_TIME, 'YYYY-MM-DD') = TO_CHAR(SYSDATE, 'YYYY-MM-DD')
+        <if test="oneDate != null">
+            and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
+        </if>
+        <if test="startDate != null">
+            and to_date(#{startDate}, 'yyyy-mm-dd') &lt;= TER.RESULT_ENTRY_GATE_TIME
+            and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
+        </if>
+        <if test="con!=null">
+            where  "receiveName" like #{con} or  "sendName" like #{con} or "materialName" like #{con}
+           or "capacityNumber" like #{con}
+        </if>
+        <if test="userId!=null">
+            and ASO.INSERT_USERNAME=#{userId}
+        </if>
+        <if test="userIds!=null">
+            and ASO.UPDATE_USERNAME=#{userIds}
+        </if>
+        <if test="orderType!=null">
+            and OO.ORDER_TYPE=#{orderType}
+        </if>
         )
         <where>
+            <if test="receiveName != null">
+                and
+                <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
+                    "receiveName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="sendName != null">
+                and
+                <foreach collection="sendName" item="item" open="(" separator="or" close=")">
+                    "sendName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="materialName != null">
+                and
+                <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+                    "materialName" like '%${item}%'
+                </foreach>
+            </if>
             <if test="orderNumber != null">
                 <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
                     "orderNumber" like '%${item}%'

+ 46 - 15
src/main/resources/com/steerinfo/dil/mapper/TmstruckEnfactoryResultMapper.xml

@@ -1192,7 +1192,17 @@
         on RG.GATEPOST_ID = TER.GATEPOST_ID
         left join RMS_CAPACITY RC
         on RC.CAPACITY_ID = OO.CAPACITY_ID
-        WHERE OO.ORDER_TYPE = #{orderTypee}
+        WHERE OO.ORDER_TYPE = #{orderTypee} and TER.RESULT_ENTRY_GATE_TIME IS NOT NULL
+            <if test="userId!=null">
+               and ASO.INSERT_USERNAME=#{userId}
+            </if>
+            <if test="userIds!=null">
+               and ASO.UPDATE_USERNAME=#{userIds}
+            </if>
+            <if test="con!=null">
+                where "orderNumber" like #{con} or "capacityNumber" like #{con}
+                or "gatepostName" like #{con} or  "materialName" like #{con}
+            </if>
         )
         <where>
             <if test="orderNumber != null">
@@ -1232,18 +1242,16 @@
         select
         *
         from(
-        select TER.RESULT_ID "resultId",
-        APO.PURCHASE_ORDER_NO "purchaseOrderNo",
-        RM.MATERIAL_NAME "materialName",
-        DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
-        OO.ORDER_NUMBER "orderNumber",
-        RC.CAPACITY_NUMBER "capacityNumber",
-        RG.GATEPOST_NAME "gatepostName",
-        TER.RESULT_ENTRY_MODE "resultEntryMode",
-        TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
-        RS.SUPPLIER_NAME "supplierName",
-        OOM.ORDER_MATERIAL_WEIGHT "orderMaterialWeight",
-        TER.INSERT_TIME "insertTime",
+        select TER.RESULT_ID        "resultId",
+        APO.PURCHASE_ORDER_NO       "purchaseOrderNo",
+        RM.MATERIAL_NAME            "materialName",
+        OO.ORDER_NUMBER             "orderNumber",
+        RC.CAPACITY_NUMBER          "capacityNumber",
+        RG.GATEPOST_NAME            "gatepostName",
+        TER.RESULT_ENTRY_MODE       "resultEntryMode",
+        TER.RESULT_ENTRY_GATE_TIME   "resultEntryGateTime",
+        RS.SUPPLIER_NAME            "supplierName",
+        TER.INSERT_TIME             "insertTime",
         RCON.CONSIGNEE_COMPANY_NAME "consigneeCompanyName"
         from TMSTRUCK_ENFACTORY_RESULT TER
         left join TMSTRUCK_TOTAL_RESULT TTR
@@ -1274,6 +1282,9 @@
         on RG.GATEPOST_ID = TER.GATEPOST_ID
         where TER.RESULT_ENTRY_GATE_TIME is not null
         and OO.ORDER_TYPE = 10
+        <if test="userId">
+            and air.INSERT_USERNAME=#{userId}
+        </if>
         )
         <where>
             <if test="purchaseOrderId != null">
@@ -1336,12 +1347,11 @@
         select TLFR.RESULT_ID                     "resultId",
        APO.PURCHASE_ORDER_NO              "purchaseOrderNo",
        RM.MATERIAL_NAME                   "materialName",
-       DB.RESULT_FOREIGN_SHIP_NAME        "resultForeignShipName",
        OO.ORDER_NUMBER                    "orderNumber",
        RC.CAPACITY_NUMBER                 "capacityNumber",
        RG.GATEPOST_NAME                   "gatepostName",
        TLFR.RESULT_OUT_MODE               "resultOutMode",
-       TLFR.RESULT_OUT_GATE_TIME          "resultOutGateTime",
+       TLFR.RESULT_OUT_GATE_TIME    "resultOutGateTime",
        TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture"
   from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
   left join TMSTRUCK_TOTAL_RESULT TTR
@@ -1368,6 +1378,27 @@
     on RG.GATEPOST_ID = TLFR.GATEPOST_ID
  where RESULT_OUT_GATE_TIME is not null
    and OO.ORDER_TYPE = 10
+   <if test="userId !=null">
+      and AIR.INSERT_USERNAME = #{userId}
+   </if>
     order by tlfr.result_out_gate_time
+        <where>
+            <if test="capacityNumber != null">
+                <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
+                    "capacityNumber" like '%${item}%'
+                </foreach>
+            </if>
+             <if test="materialName != null">
+                <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+                    "materialName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="gatepostName != null">
+                <foreach collection="gatepostName" item="item" open="(" separator="or" close=")">
+                    "gatepostName" like '%${item}%'
+                </foreach>
+            </if>
+        </where>
     </select>
+
 </mapper>

+ 33 - 0
src/main/resources/com/steerinfo/dil/mapper/TmstruckLeaveFactoryResultMapper.xml

@@ -1112,6 +1112,16 @@
         on RG.GATEPOST_ID = TLFR.GATEPOST_ID
         where RESULT_OUT_GATE_TIME is not null
         and OO.ORDER_TYPE = #{orderTypee}
+            <if test="userId!=null">
+             AND ASO.INSERT_USERNAME=#{userId}
+            </if>
+            <if test="userIds!=null">
+              AND ASO.UPDATE_USERNAME=#{userIds}
+            </if>
+            <if test="con!=null">
+                where "orderNumber" like #{con} or "capacityNumber" like #{con}
+                or "gatepostName" like #{con}  or  "materialName" like #{con}
+            </if>
         )
         <where>
             <if test="orderNumber != null">
@@ -1152,4 +1162,27 @@
         </where>
         <include refid="orderByOutTime"></include>
     </select>
+
+
+
+    <!--  根据采购订单ID查询是否为一车多趟  -->
+    <select id="getIsMoreTripsStatus" parameterType="java.math.BigDecimal" resultType="java.lang.Integer">
+        select APO.IS_MORE_TRIPS
+        from OMSTRUCK_ORDER OO
+                 left join AMS_PURCHASE_ORDER APO
+                           on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
+        where OO.ORDER_ID = #{orderId}
+    </select>
+
+    <select id="getPlanEnable" resultType="java.lang.Integer">
+        select aip.plan_eable_status
+        from omstruck_order oo
+        left join amstruck_inward_plan aip
+        on aip.plan_id = oo.order_plan_id
+        where oo.order_id = #{orderId}
+    </select>
+    <select id="getSeq" resultType="java.lang.Integer">
+        select oo.order_line_sequence from omstruck_order oo
+        where oo.order_id =#{orderId}
+    </select>
 </mapper>

+ 1573 - 1534
src/main/resources/com/steerinfo/dil/mapper/TmstruckLoadResultMapper.xml

@@ -1,1581 +1,1620 @@
 <?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.TmstruckLoadResultMapper">
-    <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstruckLoadResult">
-        <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
-        <result column="RESULT_TOTAL_ID" jdbcType="DECIMAL" property="resultTotalId" />
-        <result column="RESULT_LOAD_START_TIME" jdbcType="TIMESTAMP" property="resultLoadStartTime" />
-        <result column="RESULT_LOAD_END_TIME" jdbcType="TIMESTAMP" property="resultLoadEndTime" />
-        <result column="RESULT_LOAD_DURATION" jdbcType="DECIMAL" property="resultLoadDuration" />
-        <result column="LOAD_STANDARD_TIME_ID" jdbcType="DECIMAL" property="loadStandardTimeId" />
-        <result column="LOADER_ID" jdbcType="DECIMAL" property="loaderId" />
-        <result column="RESULT_ISCLEAR" jdbcType="VARCHAR" property="resultIsclear" />
-        <result column="DELETE_NAME" jdbcType="VARCHAR" property="deleteName" />
-        <result column="DELETE_TIME" jdbcType="TIMESTAMP" property="deleteTime" />
-        <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="STATUS" jdbcType="DECIMAL" property="status" />
-        <result column="RESULT_MEASURED_TONNAGE" jdbcType="DECIMAL" property="resultMeasuredTonnage" />
-        <result column="LOADING_ID" jdbcType="DECIMAL" property="loadingId" />
-        <result column="MATERIAL_ID" jdbcType="DECIMAL" property="materialId" />
-        <result column="LOADING_SEQUENCE" jdbcType="DECIMAL" property="loadingSequence" />
-        <result column="ISDEDUCT" jdbcType="DECIMAL" property="isdeduct" />
-        <result column="SEGMENT_SQE" jdbcType="DECIMAL" property="segmentSqe" />
-    </resultMap>
-    <sql id="columns">
-        RESULT_ID, RESULT_TOTAL_ID, RESULT_LOAD_START_TIME, RESULT_LOAD_END_TIME, RESULT_LOAD_DURATION,
-    LOAD_STANDARD_TIME_ID, LOADER_ID, RESULT_ISCLEAR, DELETE_NAME, DELETE_TIME, INSERT_USERNAME,
-    INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, STATUS, RESULT_MEASURED_TONNAGE,
-    LOADING_ID, MATERIAL_ID, LOADING_SEQUENCE, ISDEDUCT, SEGMENT_SQE
-    </sql>
-    <sql id="columns_alias">
-        t.RESULT_ID, t.RESULT_TOTAL_ID, t.RESULT_LOAD_START_TIME, t.RESULT_LOAD_END_TIME,
-    t.RESULT_LOAD_DURATION, t.LOAD_STANDARD_TIME_ID, t.LOADER_ID, t.RESULT_ISCLEAR, t.DELETE_NAME,
-    t.DELETE_TIME, t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME,
-    t.INSERT_UPDATE_REMARK, t.STATUS, t.RESULT_MEASURED_TONNAGE, t.LOADING_ID, t.MATERIAL_ID,
-    t.LOADING_SEQUENCE, t.ISDEDUCT, t.SEGMENT_SQE
-    </sql>
-    <sql id="select">
-        SELECT <include refid="columns"/> FROM TMSTRUCK_LOAD_RESULT
-    </sql>
-    <sql id="select_alias">
-        SELECT <include refid="columns_alias"/> FROM TMSTRUCK_LOAD_RESULT t
-    </sql>
-    <sql id="where">
-        <where>
-            <if test="resultId != null">
-                and RESULT_ID = #{resultId}
-            </if>
-            <if test="resultTotalId != null">
-                and RESULT_TOTAL_ID = #{resultTotalId}
-            </if>
-            <if test="resultLoadStartTime != null">
-                and TO_CHAR(RESULT_LOAD_START_TIME,'yyyy-MM-dd') = #{resultLoadStartTime}
-            </if>
-            <if test="resultLoadEndTime != null">
-                and TO_CHAR(RESULT_LOAD_END_TIME,'yyyy-MM-dd') = #{resultLoadEndTime}
-            </if>
-            <if test="resultLoadDuration != null">
-                and RESULT_LOAD_DURATION = #{resultLoadDuration}
-            </if>
-            <if test="loadStandardTimeId != null">
-                and LOAD_STANDARD_TIME_ID = #{loadStandardTimeId}
-            </if>
-            <if test="loaderId != null">
-                and LOADER_ID = #{loaderId}
-            </if>
-            <if test="resultIsclear != null and resultIsclear != ''">
-                and RESULT_ISCLEAR = #{resultIsclear}
-            </if>
-            <if test="deleteName != null and deleteName != ''">
-                and DELETE_NAME = #{deleteName}
-            </if>
-            <if test="deleteTime != null">
-                and TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = #{deleteTime}
-            </if>
-            <if test="insertUsername != null and insertUsername != ''">
-                and INSERT_USERNAME = #{insertUsername}
-            </if>
-            <if test="insertTime != null">
-                and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
-            </if>
-            <if test="updateUsername != null and updateUsername != ''">
-                and UPDATE_USERNAME = #{updateUsername}
-            </if>
-            <if test="updateTime != null">
-                and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
-            </if>
-            <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
-                and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
-            </if>
-            <if test="status != null">
-                and STATUS = #{status}
-            </if>
-            <if test="resultMeasuredTonnage != null">
-                and RESULT_MEASURED_TONNAGE = #{resultMeasuredTonnage}
-            </if>
-            <if test="loadingId != null">
-                and LOADING_ID = #{loadingId}
-            </if>
-            <if test="materialId != null">
-                and MATERIAL_ID = #{materialId}
-            </if>
-            <if test="loadingSequence != null">
-                and LOADING_SEQUENCE = #{loadingSequence}
-            </if>
-            <if test="isdeduct != null">
-                and ISDEDUCT = #{isdeduct}
-            </if>
-            <if test="segmentSqe != null">
-                and SEGMENT_SQE = #{segmentSqe}
-            </if>
-        </where>
-    </sql>
-    <sql id="whereLike">
-        <where>
-            <if test="resultId != null">
-                and RESULT_ID = #{resultId}
-            </if>
-            <if test="resultTotalId != null">
-                and RESULT_TOTAL_ID = #{resultTotalId}
-            </if>
-            <if test="resultLoadStartTime != null">
-                and TO_CHAR(RESULT_LOAD_START_TIME,'yyyy-MM-dd') = #{resultLoadStartTime}
-            </if>
-            <if test="resultLoadEndTime != null">
-                and TO_CHAR(RESULT_LOAD_END_TIME,'yyyy-MM-dd') = #{resultLoadEndTime}
-            </if>
-            <if test="resultLoadDuration != null">
-                and RESULT_LOAD_DURATION = #{resultLoadDuration}
-            </if>
-            <if test="loadStandardTimeId != null">
-                and LOAD_STANDARD_TIME_ID = #{loadStandardTimeId}
-            </if>
-            <if test="loaderId != null">
-                and LOADER_ID = #{loaderId}
-            </if>
-            <if test="resultIsclear != null and resultIsclear != ''">
-                and RESULT_ISCLEAR LIKE '%${resultIsclear}%'
-            </if>
-            <if test="deleteName != null and deleteName != ''">
-                and DELETE_NAME LIKE '%${deleteName}%'
-            </if>
-            <if test="deleteTime != null">
-                and TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = #{deleteTime}
-            </if>
-            <if test="insertUsername != null and insertUsername != ''">
-                and INSERT_USERNAME LIKE '%${insertUsername}%'
-            </if>
-            <if test="insertTime != null">
-                and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
-            </if>
-            <if test="updateUsername != null and updateUsername != ''">
-                and UPDATE_USERNAME LIKE '%${updateUsername}%'
-            </if>
-            <if test="updateTime != null">
-                and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
-            </if>
-            <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
-                and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
-            </if>
-            <if test="status != null">
-                and STATUS = #{status}
-            </if>
-            <if test="resultMeasuredTonnage != null">
-                and RESULT_MEASURED_TONNAGE = #{resultMeasuredTonnage}
-            </if>
-            <if test="loadingId != null">
-                and LOADING_ID = #{loadingId}
-            </if>
-            <if test="materialId != null">
-                and MATERIAL_ID = #{materialId}
-            </if>
-            <if test="loadingSequence != null">
-                and LOADING_SEQUENCE = #{loadingSequence}
-            </if>
-            <if test="isdeduct != null">
-                and ISDEDUCT = #{isdeduct}
-            </if>
-            <if test="segmentSqe != null">
-                and SEGMENT_SQE = #{segmentSqe}
-            </if>
-        </where>
-    </sql>
-    <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
-        delete from TMSTRUCK_LOAD_RESULT
-        where RESULT_ID = #{resultId,jdbcType=DECIMAL}
-    </delete>
-    <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
-        delete from TMSTRUCK_LOAD_RESULT
-        where 1!=1
-        <if test="resultTotalId != null">
-            or RESULT_TOTAL_ID = #{resultTotalId}
-        </if>
-        <if test="resultLoadStartTime != null">
-            or TO_CHAR(RESULT_LOAD_START_TIME,'yyyy-MM-dd') = '#{resultLoadStartTime}'
-        </if>
-        <if test="resultLoadEndTime != null">
-            or TO_CHAR(RESULT_LOAD_END_TIME,'yyyy-MM-dd') = '#{resultLoadEndTime}'
-        </if>
-        <if test="resultLoadDuration != null">
-            or RESULT_LOAD_DURATION = #{resultLoadDuration}
-        </if>
-        <if test="loadStandardTimeId != null">
-            or LOAD_STANDARD_TIME_ID = #{loadStandardTimeId}
-        </if>
-        <if test="loaderId != null">
-            or LOADER_ID = #{loaderId}
-        </if>
-        <if test="resultIsclear != null and resultIsclear != ''">
-            or RESULT_ISCLEAR = #{resultIsclear}
-        </if>
-        <if test="deleteName != null and deleteName != ''">
-            or DELETE_NAME = #{deleteName}
-        </if>
-        <if test="deleteTime != null">
-            or TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = '#{deleteTime}'
-        </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="status != null">
-            or STATUS = #{status}
-        </if>
-        <if test="resultMeasuredTonnage != null">
-            or RESULT_MEASURED_TONNAGE = #{resultMeasuredTonnage}
-        </if>
-        <if test="loadingId != null">
-            or LOADING_ID = #{loadingId}
-        </if>
-        <if test="materialId != null">
-            or MATERIAL_ID = #{materialId}
-        </if>
-        <if test="loadingSequence != null">
-            or LOADING_SEQUENCE = #{loadingSequence}
-        </if>
-        <if test="isdeduct != null">
-            or ISDEDUCT = #{isdeduct}
-        </if>
-        <if test="segmentSqe != null">
-            or SEGMENT_SQE = #{segmentSqe}
-        </if>
-    </delete>
-    <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckLoadResult">
-        insert into TMSTRUCK_LOAD_RESULT (RESULT_ID, RESULT_TOTAL_ID, RESULT_LOAD_START_TIME,
-                                          RESULT_LOAD_END_TIME, RESULT_LOAD_DURATION,
-                                          LOAD_STANDARD_TIME_ID, LOADER_ID, RESULT_ISCLEAR,
-                                          DELETE_NAME, DELETE_TIME, INSERT_USERNAME,
-                                          INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
-                                          INSERT_UPDATE_REMARK, STATUS, RESULT_MEASURED_TONNAGE,
-                                          LOADING_ID, MATERIAL_ID, LOADING_SEQUENCE,
-                                          ISDEDUCT, SEGMENT_SQE)
-        values (#{resultId,jdbcType=DECIMAL}, #{resultTotalId,jdbcType=DECIMAL}, #{resultLoadStartTime,jdbcType=TIMESTAMP},
-                #{resultLoadEndTime,jdbcType=TIMESTAMP}, #{resultLoadDuration,jdbcType=DECIMAL},
-                #{loadStandardTimeId,jdbcType=DECIMAL}, #{loaderId,jdbcType=DECIMAL}, #{resultIsclear,jdbcType=VARCHAR},
-                #{deleteName,jdbcType=VARCHAR}, #{deleteTime,jdbcType=TIMESTAMP}, #{insertUsername,jdbcType=VARCHAR},
-                #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
-                #{insertUpdateRemark,jdbcType=VARCHAR}, #{status,jdbcType=DECIMAL}, #{resultMeasuredTonnage,jdbcType=DECIMAL},
-                #{loadingId,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL}, #{loadingSequence,jdbcType=DECIMAL},
-                #{isdeduct,jdbcType=DECIMAL}, #{segmentSqe,jdbcType=DECIMAL})
-    </insert>
-    <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckLoadResult">
-        insert into TMSTRUCK_LOAD_RESULT
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="resultId != null">
-                RESULT_ID,
-            </if>
-            <if test="resultTotalId != null">
-                RESULT_TOTAL_ID,
-            </if>
-            <if test="resultLoadStartTime != null">
-                RESULT_LOAD_START_TIME,
-            </if>
-            <if test="resultLoadEndTime != null">
-                RESULT_LOAD_END_TIME,
-            </if>
-            <if test="resultLoadDuration != null">
-                RESULT_LOAD_DURATION,
-            </if>
-            <if test="loadStandardTimeId != null">
-                LOAD_STANDARD_TIME_ID,
-            </if>
-            <if test="loaderId != null">
-                LOADER_ID,
-            </if>
-            <if test="resultIsclear != null">
-                RESULT_ISCLEAR,
-            </if>
-            <if test="deleteName != null">
-                DELETE_NAME,
-            </if>
-            <if test="deleteTime != null">
-                DELETE_TIME,
-            </if>
-            <if test="insertUsername != null">
-                INSERT_USERNAME,
-            </if>
-            <if test="insertTime != null">
-                INSERT_TIME,
-            </if>
-            <if test="updateUsername != null">
-                UPDATE_USERNAME,
-            </if>
-            <if test="updateTime != null">
-                UPDATE_TIME,
-            </if>
-            <if test="insertUpdateRemark != null">
-                INSERT_UPDATE_REMARK,
-            </if>
-            <if test="status != null">
-                STATUS,
-            </if>
-            <if test="resultMeasuredTonnage != null">
-                RESULT_MEASURED_TONNAGE,
-            </if>
-            <if test="loadingId != null">
-                LOADING_ID,
-            </if>
-            <if test="materialId != null">
-                MATERIAL_ID,
-            </if>
-            <if test="loadingSequence != null">
-                LOADING_SEQUENCE,
-            </if>
-            <if test="isdeduct != null">
-                ISDEDUCT,
-            </if>
-            <if test="segmentSqe != null">
-                SEGMENT_SQE,
-            </if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="resultId != null">
-                #{resultId,jdbcType=DECIMAL},
-            </if>
-            <if test="resultTotalId != null">
-                #{resultTotalId,jdbcType=DECIMAL},
-            </if>
-            <if test="resultLoadStartTime != null">
-                #{resultLoadStartTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="resultLoadEndTime != null">
-                #{resultLoadEndTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="resultLoadDuration != null">
-                #{resultLoadDuration,jdbcType=DECIMAL},
-            </if>
-            <if test="loadStandardTimeId != null">
-                #{loadStandardTimeId,jdbcType=DECIMAL},
-            </if>
-            <if test="loaderId != null">
-                #{loaderId,jdbcType=DECIMAL},
-            </if>
-            <if test="resultIsclear != null">
-                #{resultIsclear,jdbcType=VARCHAR},
-            </if>
-            <if test="deleteName != null">
-                #{deleteName,jdbcType=VARCHAR},
-            </if>
-            <if test="deleteTime != null">
-                #{deleteTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="insertUsername != null">
-                #{insertUsername,jdbcType=VARCHAR},
-            </if>
-            <if test="insertTime != null">
-                #{insertTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="updateUsername != null">
-                #{updateUsername,jdbcType=VARCHAR},
-            </if>
-            <if test="updateTime != null">
-                #{updateTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="insertUpdateRemark != null">
-                #{insertUpdateRemark,jdbcType=VARCHAR},
-            </if>
-            <if test="status != null">
-                #{status,jdbcType=DECIMAL},
-            </if>
-            <if test="resultMeasuredTonnage != null">
-                #{resultMeasuredTonnage,jdbcType=DECIMAL},
-            </if>
-            <if test="loadingId != null">
-                #{loadingId,jdbcType=DECIMAL},
-            </if>
-            <if test="materialId != null">
-                #{materialId,jdbcType=DECIMAL},
-            </if>
-            <if test="loadingSequence != null">
-                #{loadingSequence,jdbcType=DECIMAL},
-            </if>
-            <if test="isdeduct != null">
-                #{isdeduct,jdbcType=DECIMAL},
-            </if>
-            <if test="segmentSqe != null">
-                #{segmentSqe,jdbcType=DECIMAL},
-            </if>
-        </trim>
-    </insert>
-    <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckLoadResult">
-        update TMSTRUCK_LOAD_RESULT
-        set RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
-            RESULT_LOAD_START_TIME = #{resultLoadStartTime,jdbcType=TIMESTAMP},
-            RESULT_LOAD_END_TIME = #{resultLoadEndTime,jdbcType=TIMESTAMP},
-            RESULT_LOAD_DURATION = #{resultLoadDuration,jdbcType=DECIMAL},
-            LOAD_STANDARD_TIME_ID = #{loadStandardTimeId,jdbcType=DECIMAL},
-            LOADER_ID = #{loaderId,jdbcType=DECIMAL},
-            RESULT_ISCLEAR = #{resultIsclear,jdbcType=VARCHAR},
-            DELETE_NAME = #{deleteName,jdbcType=VARCHAR},
-            DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
-            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},
-            STATUS = #{status,jdbcType=DECIMAL},
-            RESULT_MEASURED_TONNAGE = #{resultMeasuredTonnage,jdbcType=DECIMAL},
-            LOADING_ID = #{loadingId,jdbcType=DECIMAL},
-            MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
-            LOADING_SEQUENCE = #{loadingSequence,jdbcType=DECIMAL},
-            ISDEDUCT = #{isdeduct,jdbcType=DECIMAL},
-            SEGMENT_SQE = #{segmentSqe,jdbcType=DECIMAL}
-        where RESULT_ID = #{resultId,jdbcType=DECIMAL}
-    </update>
-    <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckLoadResult">
-        update TMSTRUCK_LOAD_RESULT
-        <set>
-            <if test="resultTotalId != null">
-                RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
-            </if>
-            <if test="resultLoadStartTime != null">
-                RESULT_LOAD_START_TIME = #{resultLoadStartTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="resultLoadEndTime != null">
-                RESULT_LOAD_END_TIME = #{resultLoadEndTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="resultLoadDuration != null">
-                RESULT_LOAD_DURATION = #{resultLoadDuration,jdbcType=DECIMAL},
-            </if>
-            <if test="loadStandardTimeId != null">
-                LOAD_STANDARD_TIME_ID = #{loadStandardTimeId,jdbcType=DECIMAL},
-            </if>
-            <if test="loaderId != null">
-                LOADER_ID = #{loaderId,jdbcType=DECIMAL},
-            </if>
-            <if test="resultIsclear != null">
-                RESULT_ISCLEAR = #{resultIsclear,jdbcType=VARCHAR},
-            </if>
-            <if test="deleteName != null">
-                DELETE_NAME = #{deleteName,jdbcType=VARCHAR},
-            </if>
-            <if test="deleteTime != null">
-                DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="insertUsername != null">
-                INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
-            </if>
-            <if test="insertTime != null">
-                INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="updateUsername != null">
-                UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
-            </if>
-            <if test="updateTime != null">
-                UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="insertUpdateRemark != null">
-                INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
-            </if>
-            <if test="status != null">
-                STATUS = #{status,jdbcType=DECIMAL},
-            </if>
-            <if test="resultMeasuredTonnage != null">
-                RESULT_MEASURED_TONNAGE = #{resultMeasuredTonnage,jdbcType=DECIMAL},
-            </if>
-            <if test="loadingId != null">
-                LOADING_ID = #{loadingId,jdbcType=DECIMAL},
-            </if>
-            <if test="materialId != null">
-                MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
-            </if>
-            <if test="loadingSequence != null">
-                LOADING_SEQUENCE = #{loadingSequence,jdbcType=DECIMAL},
-            </if>
-            <if test="isdeduct != null">
-                ISDEDUCT = #{isdeduct,jdbcType=DECIMAL},
-            </if>
-            <if test="segmentSqe != null">
-                SEGMENT_SQE = #{segmentSqe,jdbcType=DECIMAL},
-            </if>
-        </set>
-        where RESULT_ID = #{resultId,jdbcType=DECIMAL}
-    </update>
-    <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" 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"/>
-    </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 TMSTRUCK_LOAD_RESULT
-        (RESULT_ID,
-        RESULT_TOTAL_ID, RESULT_LOAD_START_TIME,
-        RESULT_LOAD_END_TIME, RESULT_LOAD_DURATION,
-        LOAD_STANDARD_TIME_ID, LOADER_ID,
-        RESULT_ISCLEAR, DELETE_NAME, DELETE_TIME,
-        INSERT_USERNAME, INSERT_TIME,
-        UPDATE_USERNAME, UPDATE_TIME,
-        INSERT_UPDATE_REMARK, STATUS, RESULT_MEASURED_TONNAGE,
-        LOADING_ID, MATERIAL_ID, LOADING_SEQUENCE,
-        ISDEDUCT, SEGMENT_SQE)
-        ( <foreach collection="list" item="item" separator="union all">
-        select
-        #{item.resultId,jdbcType=DECIMAL},
-        #{item.resultTotalId,jdbcType=DECIMAL}, #{item.resultLoadStartTime,jdbcType=TIMESTAMP},
-        #{item.resultLoadEndTime,jdbcType=TIMESTAMP}, #{item.resultLoadDuration,jdbcType=DECIMAL},
-        #{item.loadStandardTimeId,jdbcType=DECIMAL}, #{item.loaderId,jdbcType=DECIMAL},
-        #{item.resultIsclear,jdbcType=VARCHAR}, #{item.deleteName,jdbcType=VARCHAR}, #{item.deleteTime,jdbcType=TIMESTAMP},
-        #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
-        #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
-        #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.status,jdbcType=DECIMAL}, #{item.resultMeasuredTonnage,jdbcType=DECIMAL},
-        #{item.loadingId,jdbcType=DECIMAL}, #{item.materialId,jdbcType=DECIMAL}, #{item.loadingSequence,jdbcType=DECIMAL},
-        #{item.isdeduct,jdbcType=DECIMAL}, #{item.segmentSqe,jdbcType=DECIMAL} from dual
-    </foreach> )
-    </insert>
-    <update id="batchUpdate" parameterType="java.util.List">
-        update TMSTRUCK_LOAD_RESULT
-        set
-        RESULT_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-            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">
-            when #{item.resultId,jdbcType=DECIMAL} then #{item.resultTotalId,jdbcType=DECIMAL}
-        </foreach>
-        ,RESULT_LOAD_START_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-            when #{item.resultId,jdbcType=DECIMAL} then #{item.resultLoadStartTime,jdbcType=TIMESTAMP}
-        </foreach>
-        ,RESULT_LOAD_END_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-            when #{item.resultId,jdbcType=DECIMAL} then #{item.resultLoadEndTime,jdbcType=TIMESTAMP}
-        </foreach>
-        ,RESULT_LOAD_DURATION=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-            when #{item.resultId,jdbcType=DECIMAL} then #{item.resultLoadDuration,jdbcType=DECIMAL}
-        </foreach>
-        ,LOAD_STANDARD_TIME_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-            when #{item.resultId,jdbcType=DECIMAL} then #{item.loadStandardTimeId,jdbcType=DECIMAL}
-        </foreach>
-        ,LOADER_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-            when #{item.resultId,jdbcType=DECIMAL} then #{item.loaderId,jdbcType=DECIMAL}
-        </foreach>
-        ,RESULT_ISCLEAR=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-            when #{item.resultId,jdbcType=DECIMAL} then #{item.resultIsclear,jdbcType=VARCHAR}
-        </foreach>
-        ,DELETE_NAME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-            when #{item.resultId,jdbcType=DECIMAL} then #{item.deleteName,jdbcType=VARCHAR}
-        </foreach>
-        ,DELETE_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-            when #{item.resultId,jdbcType=DECIMAL} then #{item.deleteTime,jdbcType=TIMESTAMP}
-        </foreach>
-        ,INSERT_USERNAME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-            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">
-            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">
-            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">
-            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">
-            when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
-        </foreach>
-        ,STATUS=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-            when #{item.resultId,jdbcType=DECIMAL} then #{item.status,jdbcType=DECIMAL}
-        </foreach>
-        ,RESULT_MEASURED_TONNAGE=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-            when #{item.resultId,jdbcType=DECIMAL} then #{item.resultMeasuredTonnage,jdbcType=DECIMAL}
+  <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstruckLoadResult">
+    <id column="RESULT_ID" jdbcType="DECIMAL" property="resultId" />
+    <result column="RESULT_TOTAL_ID" jdbcType="DECIMAL" property="resultTotalId" />
+    <result column="RESULT_LOAD_START_TIME" jdbcType="TIMESTAMP" property="resultLoadStartTime" />
+    <result column="RESULT_LOAD_END_TIME" jdbcType="TIMESTAMP" property="resultLoadEndTime" />
+    <result column="RESULT_LOAD_DURATION" jdbcType="DECIMAL" property="resultLoadDuration" />
+    <result column="LOAD_STANDARD_TIME_ID" jdbcType="DECIMAL" property="loadStandardTimeId" />
+    <result column="LOADER_ID" jdbcType="DECIMAL" property="loaderId" />
+    <result column="RESULT_ISCLEAR" jdbcType="VARCHAR" property="resultIsclear" />
+    <result column="DELETE_NAME" jdbcType="VARCHAR" property="deleteName" />
+    <result column="DELETE_TIME" jdbcType="TIMESTAMP" property="deleteTime" />
+    <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="STATUS" jdbcType="DECIMAL" property="status" />
+    <result column="RESULT_MEASURED_TONNAGE" jdbcType="DECIMAL" property="resultMeasuredTonnage" />
+    <result column="LOADING_ID" jdbcType="DECIMAL" property="loadingId" />
+    <result column="MATERIAL_ID" jdbcType="DECIMAL" property="materialId" />
+    <result column="LOADING_SEQUENCE" jdbcType="DECIMAL" property="loadingSequence" />
+    <result column="ISDEDUCT" jdbcType="DECIMAL" property="isdeduct" />
+    <result column="SEGMENT_SQE" jdbcType="DECIMAL" property="segmentSqe" />
+    <result column="CASE_NUMBER" jdbcType="VARCHAR" property="caseNumber" />
+  </resultMap>
+  <sql id="columns">
+    RESULT_ID, RESULT_TOTAL_ID, RESULT_LOAD_START_TIME, RESULT_LOAD_END_TIME, RESULT_LOAD_DURATION, 
+    LOAD_STANDARD_TIME_ID, LOADER_ID, RESULT_ISCLEAR, DELETE_NAME, DELETE_TIME, INSERT_USERNAME, 
+    INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, STATUS, RESULT_MEASURED_TONNAGE, 
+    LOADING_ID, MATERIAL_ID, LOADING_SEQUENCE, ISDEDUCT, SEGMENT_SQE, CASE_NUMBER
+  </sql>
+  <sql id="columns_alias">
+    t.RESULT_ID, t.RESULT_TOTAL_ID, t.RESULT_LOAD_START_TIME, t.RESULT_LOAD_END_TIME, 
+    t.RESULT_LOAD_DURATION, t.LOAD_STANDARD_TIME_ID, t.LOADER_ID, t.RESULT_ISCLEAR, t.DELETE_NAME, 
+    t.DELETE_TIME, t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, 
+    t.INSERT_UPDATE_REMARK, t.STATUS, t.RESULT_MEASURED_TONNAGE, t.LOADING_ID, t.MATERIAL_ID, 
+    t.LOADING_SEQUENCE, t.ISDEDUCT, t.SEGMENT_SQE, t.CASE_NUMBER
+  </sql>
+  <sql id="select">
+    SELECT <include refid="columns" /> FROM TMSTRUCK_LOAD_RESULT
+  </sql>
+  <sql id="select_alias">
+    SELECT <include refid="columns_alias" /> FROM TMSTRUCK_LOAD_RESULT t
+  </sql>
+  <sql id="where">
+    <where> 
+      <if test="resultId != null">
+        and RESULT_ID = #{resultId}
+      </if>
+      <if test="resultTotalId != null">
+        and RESULT_TOTAL_ID = #{resultTotalId}
+      </if>
+      <if test="resultLoadStartTime != null">
+        and TO_CHAR(RESULT_LOAD_START_TIME,'yyyy-MM-dd') = #{resultLoadStartTime}
+      </if>
+      <if test="resultLoadEndTime != null">
+        and TO_CHAR(RESULT_LOAD_END_TIME,'yyyy-MM-dd') = #{resultLoadEndTime}
+      </if>
+      <if test="resultLoadDuration != null">
+        and RESULT_LOAD_DURATION = #{resultLoadDuration}
+      </if>
+      <if test="loadStandardTimeId != null">
+        and LOAD_STANDARD_TIME_ID = #{loadStandardTimeId}
+      </if>
+      <if test="loaderId != null">
+        and LOADER_ID = #{loaderId}
+      </if>
+      <if test="resultIsclear != null and resultIsclear != ''">
+        and RESULT_ISCLEAR = #{resultIsclear}
+      </if>
+      <if test="deleteName != null and deleteName != ''">
+        and DELETE_NAME = #{deleteName}
+      </if>
+      <if test="deleteTime != null">
+        and TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = #{deleteTime}
+      </if>
+      <if test="insertUsername != null and insertUsername != ''">
+        and INSERT_USERNAME = #{insertUsername}
+      </if>
+      <if test="insertTime != null">
+        and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
+      </if>
+      <if test="updateUsername != null and updateUsername != ''">
+        and UPDATE_USERNAME = #{updateUsername}
+      </if>
+      <if test="updateTime != null">
+        and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
+      </if>
+      <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
+        and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
+      </if>
+      <if test="status != null">
+        and STATUS = #{status}
+      </if>
+      <if test="resultMeasuredTonnage != null">
+        and RESULT_MEASURED_TONNAGE = #{resultMeasuredTonnage}
+      </if>
+      <if test="loadingId != null">
+        and LOADING_ID = #{loadingId}
+      </if>
+      <if test="materialId != null">
+        and MATERIAL_ID = #{materialId}
+      </if>
+      <if test="loadingSequence != null">
+        and LOADING_SEQUENCE = #{loadingSequence}
+      </if>
+      <if test="isdeduct != null">
+        and ISDEDUCT = #{isdeduct}
+      </if>
+      <if test="segmentSqe != null">
+        and SEGMENT_SQE = #{segmentSqe}
+      </if>
+      <if test="caseNumber != null and caseNumber != ''">
+        and CASE_NUMBER = #{caseNumber}
+      </if>
+    </where>
+  </sql>
+  <sql id="whereLike">
+    <where> 
+      <if test="resultId != null">
+        and RESULT_ID = #{resultId}
+      </if>
+      <if test="resultTotalId != null">
+        and RESULT_TOTAL_ID = #{resultTotalId}
+      </if>
+      <if test="resultLoadStartTime != null">
+        and TO_CHAR(RESULT_LOAD_START_TIME,'yyyy-MM-dd') = #{resultLoadStartTime}
+      </if>
+      <if test="resultLoadEndTime != null">
+        and TO_CHAR(RESULT_LOAD_END_TIME,'yyyy-MM-dd') = #{resultLoadEndTime}
+      </if>
+      <if test="resultLoadDuration != null">
+        and RESULT_LOAD_DURATION = #{resultLoadDuration}
+      </if>
+      <if test="loadStandardTimeId != null">
+        and LOAD_STANDARD_TIME_ID = #{loadStandardTimeId}
+      </if>
+      <if test="loaderId != null">
+        and LOADER_ID = #{loaderId}
+      </if>
+      <if test="resultIsclear != null and resultIsclear != ''">
+        and RESULT_ISCLEAR LIKE '%${resultIsclear}%'
+      </if>
+      <if test="deleteName != null and deleteName != ''">
+        and DELETE_NAME LIKE '%${deleteName}%'
+      </if>
+      <if test="deleteTime != null">
+        and TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = #{deleteTime}
+      </if>
+      <if test="insertUsername != null and insertUsername != ''">
+        and INSERT_USERNAME LIKE '%${insertUsername}%'
+      </if>
+      <if test="insertTime != null">
+        and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
+      </if>
+      <if test="updateUsername != null and updateUsername != ''">
+        and UPDATE_USERNAME LIKE '%${updateUsername}%'
+      </if>
+      <if test="updateTime != null">
+        and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
+      </if>
+      <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
+        and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
+      </if>
+      <if test="status != null">
+        and STATUS = #{status}
+      </if>
+      <if test="resultMeasuredTonnage != null">
+        and RESULT_MEASURED_TONNAGE = #{resultMeasuredTonnage}
+      </if>
+      <if test="loadingId != null">
+        and LOADING_ID = #{loadingId}
+      </if>
+      <if test="materialId != null">
+        and MATERIAL_ID = #{materialId}
+      </if>
+      <if test="loadingSequence != null">
+        and LOADING_SEQUENCE = #{loadingSequence}
+      </if>
+      <if test="isdeduct != null">
+        and ISDEDUCT = #{isdeduct}
+      </if>
+      <if test="segmentSqe != null">
+        and SEGMENT_SQE = #{segmentSqe}
+      </if>
+      <if test="caseNumber != null and caseNumber != ''">
+        and CASE_NUMBER LIKE '%${caseNumber}%'
+      </if>
+    </where>
+  </sql>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
+    delete from TMSTRUCK_LOAD_RESULT
+    where RESULT_ID = #{resultId,jdbcType=DECIMAL}
+  </delete>
+  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
+    delete from TMSTRUCK_LOAD_RESULT
+    where 1!=1 
+      <if test="resultTotalId != null">
+        or RESULT_TOTAL_ID = #{resultTotalId}
+      </if>
+      <if test="resultLoadStartTime != null">
+        or TO_CHAR(RESULT_LOAD_START_TIME,'yyyy-MM-dd') = '#{resultLoadStartTime}'
+      </if>
+      <if test="resultLoadEndTime != null">
+        or TO_CHAR(RESULT_LOAD_END_TIME,'yyyy-MM-dd') = '#{resultLoadEndTime}'
+      </if>
+      <if test="resultLoadDuration != null">
+        or RESULT_LOAD_DURATION = #{resultLoadDuration}
+      </if>
+      <if test="loadStandardTimeId != null">
+        or LOAD_STANDARD_TIME_ID = #{loadStandardTimeId}
+      </if>
+      <if test="loaderId != null">
+        or LOADER_ID = #{loaderId}
+      </if>
+      <if test="resultIsclear != null and resultIsclear != ''">
+        or RESULT_ISCLEAR = #{resultIsclear}
+      </if>
+      <if test="deleteName != null and deleteName != ''">
+        or DELETE_NAME = #{deleteName}
+      </if>
+      <if test="deleteTime != null">
+        or TO_CHAR(DELETE_TIME,'yyyy-MM-dd') = '#{deleteTime}'
+      </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="status != null">
+        or STATUS = #{status}
+      </if>
+      <if test="resultMeasuredTonnage != null">
+        or RESULT_MEASURED_TONNAGE = #{resultMeasuredTonnage}
+      </if>
+      <if test="loadingId != null">
+        or LOADING_ID = #{loadingId}
+      </if>
+      <if test="materialId != null">
+        or MATERIAL_ID = #{materialId}
+      </if>
+      <if test="loadingSequence != null">
+        or LOADING_SEQUENCE = #{loadingSequence}
+      </if>
+      <if test="isdeduct != null">
+        or ISDEDUCT = #{isdeduct}
+      </if>
+      <if test="segmentSqe != null">
+        or SEGMENT_SQE = #{segmentSqe}
+      </if>
+      <if test="caseNumber != null and caseNumber != ''">
+        or CASE_NUMBER = #{caseNumber}
+      </if>
+  </delete>
+  <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckLoadResult">
+    insert into TMSTRUCK_LOAD_RESULT (RESULT_ID, RESULT_TOTAL_ID, RESULT_LOAD_START_TIME, 
+      RESULT_LOAD_END_TIME, RESULT_LOAD_DURATION, 
+      LOAD_STANDARD_TIME_ID, LOADER_ID, RESULT_ISCLEAR, 
+      DELETE_NAME, DELETE_TIME, INSERT_USERNAME, 
+      INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, 
+      INSERT_UPDATE_REMARK, STATUS, RESULT_MEASURED_TONNAGE, 
+      LOADING_ID, MATERIAL_ID, LOADING_SEQUENCE, 
+      ISDEDUCT, SEGMENT_SQE, CASE_NUMBER
+      )
+    values (#{resultId,jdbcType=DECIMAL}, #{resultTotalId,jdbcType=DECIMAL}, #{resultLoadStartTime,jdbcType=TIMESTAMP}, 
+      #{resultLoadEndTime,jdbcType=TIMESTAMP}, #{resultLoadDuration,jdbcType=DECIMAL}, 
+      #{loadStandardTimeId,jdbcType=DECIMAL}, #{loaderId,jdbcType=DECIMAL}, #{resultIsclear,jdbcType=VARCHAR}, 
+      #{deleteName,jdbcType=VARCHAR}, #{deleteTime,jdbcType=TIMESTAMP}, #{insertUsername,jdbcType=VARCHAR}, 
+      #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, 
+      #{insertUpdateRemark,jdbcType=VARCHAR}, #{status,jdbcType=DECIMAL}, #{resultMeasuredTonnage,jdbcType=DECIMAL}, 
+      #{loadingId,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL}, #{loadingSequence,jdbcType=DECIMAL}, 
+      #{isdeduct,jdbcType=DECIMAL}, #{segmentSqe,jdbcType=DECIMAL}, #{caseNumber,jdbcType=VARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckLoadResult">
+    insert into TMSTRUCK_LOAD_RESULT
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="resultId != null">
+        RESULT_ID,
+      </if>
+      <if test="resultTotalId != null">
+        RESULT_TOTAL_ID,
+      </if>
+      <if test="resultLoadStartTime != null">
+        RESULT_LOAD_START_TIME,
+      </if>
+      <if test="resultLoadEndTime != null">
+        RESULT_LOAD_END_TIME,
+      </if>
+      <if test="resultLoadDuration != null">
+        RESULT_LOAD_DURATION,
+      </if>
+      <if test="loadStandardTimeId != null">
+        LOAD_STANDARD_TIME_ID,
+      </if>
+      <if test="loaderId != null">
+        LOADER_ID,
+      </if>
+      <if test="resultIsclear != null">
+        RESULT_ISCLEAR,
+      </if>
+      <if test="deleteName != null">
+        DELETE_NAME,
+      </if>
+      <if test="deleteTime != null">
+        DELETE_TIME,
+      </if>
+      <if test="insertUsername != null">
+        INSERT_USERNAME,
+      </if>
+      <if test="insertTime != null">
+        INSERT_TIME,
+      </if>
+      <if test="updateUsername != null">
+        UPDATE_USERNAME,
+      </if>
+      <if test="updateTime != null">
+        UPDATE_TIME,
+      </if>
+      <if test="insertUpdateRemark != null">
+        INSERT_UPDATE_REMARK,
+      </if>
+      <if test="status != null">
+        STATUS,
+      </if>
+      <if test="resultMeasuredTonnage != null">
+        RESULT_MEASURED_TONNAGE,
+      </if>
+      <if test="loadingId != null">
+        LOADING_ID,
+      </if>
+      <if test="materialId != null">
+        MATERIAL_ID,
+      </if>
+      <if test="loadingSequence != null">
+        LOADING_SEQUENCE,
+      </if>
+      <if test="isdeduct != null">
+        ISDEDUCT,
+      </if>
+      <if test="segmentSqe != null">
+        SEGMENT_SQE,
+      </if>
+      <if test="caseNumber != null">
+        CASE_NUMBER,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="resultId != null">
+        #{resultId,jdbcType=DECIMAL},
+      </if>
+      <if test="resultTotalId != null">
+        #{resultTotalId,jdbcType=DECIMAL},
+      </if>
+      <if test="resultLoadStartTime != null">
+        #{resultLoadStartTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="resultLoadEndTime != null">
+        #{resultLoadEndTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="resultLoadDuration != null">
+        #{resultLoadDuration,jdbcType=DECIMAL},
+      </if>
+      <if test="loadStandardTimeId != null">
+        #{loadStandardTimeId,jdbcType=DECIMAL},
+      </if>
+      <if test="loaderId != null">
+        #{loaderId,jdbcType=DECIMAL},
+      </if>
+      <if test="resultIsclear != null">
+        #{resultIsclear,jdbcType=VARCHAR},
+      </if>
+      <if test="deleteName != null">
+        #{deleteName,jdbcType=VARCHAR},
+      </if>
+      <if test="deleteTime != null">
+        #{deleteTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="insertUsername != null">
+        #{insertUsername,jdbcType=VARCHAR},
+      </if>
+      <if test="insertTime != null">
+        #{insertTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateUsername != null">
+        #{updateUsername,jdbcType=VARCHAR},
+      </if>
+      <if test="updateTime != null">
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="insertUpdateRemark != null">
+        #{insertUpdateRemark,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=DECIMAL},
+      </if>
+      <if test="resultMeasuredTonnage != null">
+        #{resultMeasuredTonnage,jdbcType=DECIMAL},
+      </if>
+      <if test="loadingId != null">
+        #{loadingId,jdbcType=DECIMAL},
+      </if>
+      <if test="materialId != null">
+        #{materialId,jdbcType=DECIMAL},
+      </if>
+      <if test="loadingSequence != null">
+        #{loadingSequence,jdbcType=DECIMAL},
+      </if>
+      <if test="isdeduct != null">
+        #{isdeduct,jdbcType=DECIMAL},
+      </if>
+      <if test="segmentSqe != null">
+        #{segmentSqe,jdbcType=DECIMAL},
+      </if>
+      <if test="caseNumber != null">
+        #{caseNumber,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckLoadResult">
+    update TMSTRUCK_LOAD_RESULT
+    set RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
+      RESULT_LOAD_START_TIME = #{resultLoadStartTime,jdbcType=TIMESTAMP},
+      RESULT_LOAD_END_TIME = #{resultLoadEndTime,jdbcType=TIMESTAMP},
+      RESULT_LOAD_DURATION = #{resultLoadDuration,jdbcType=DECIMAL},
+      LOAD_STANDARD_TIME_ID = #{loadStandardTimeId,jdbcType=DECIMAL},
+      LOADER_ID = #{loaderId,jdbcType=DECIMAL},
+      RESULT_ISCLEAR = #{resultIsclear,jdbcType=VARCHAR},
+      DELETE_NAME = #{deleteName,jdbcType=VARCHAR},
+      DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
+      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},
+      STATUS = #{status,jdbcType=DECIMAL},
+      RESULT_MEASURED_TONNAGE = #{resultMeasuredTonnage,jdbcType=DECIMAL},
+      LOADING_ID = #{loadingId,jdbcType=DECIMAL},
+      MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
+      LOADING_SEQUENCE = #{loadingSequence,jdbcType=DECIMAL},
+      ISDEDUCT = #{isdeduct,jdbcType=DECIMAL},
+      SEGMENT_SQE = #{segmentSqe,jdbcType=DECIMAL},
+      CASE_NUMBER = #{caseNumber,jdbcType=VARCHAR}
+    where RESULT_ID = #{resultId,jdbcType=DECIMAL}
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckLoadResult">
+    update TMSTRUCK_LOAD_RESULT
+    <set>
+      <if test="resultTotalId != null">
+        RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL},
+      </if>
+      <if test="resultLoadStartTime != null">
+        RESULT_LOAD_START_TIME = #{resultLoadStartTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="resultLoadEndTime != null">
+        RESULT_LOAD_END_TIME = #{resultLoadEndTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="resultLoadDuration != null">
+        RESULT_LOAD_DURATION = #{resultLoadDuration,jdbcType=DECIMAL},
+      </if>
+      <if test="loadStandardTimeId != null">
+        LOAD_STANDARD_TIME_ID = #{loadStandardTimeId,jdbcType=DECIMAL},
+      </if>
+      <if test="loaderId != null">
+        LOADER_ID = #{loaderId,jdbcType=DECIMAL},
+      </if>
+      <if test="resultIsclear != null">
+        RESULT_ISCLEAR = #{resultIsclear,jdbcType=VARCHAR},
+      </if>
+      <if test="deleteName != null">
+        DELETE_NAME = #{deleteName,jdbcType=VARCHAR},
+      </if>
+      <if test="deleteTime != null">
+        DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="insertUsername != null">
+        INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
+      </if>
+      <if test="insertTime != null">
+        INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateUsername != null">
+        UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
+      </if>
+      <if test="updateTime != null">
+        UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="insertUpdateRemark != null">
+        INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        STATUS = #{status,jdbcType=DECIMAL},
+      </if>
+      <if test="resultMeasuredTonnage != null">
+        RESULT_MEASURED_TONNAGE = #{resultMeasuredTonnage,jdbcType=DECIMAL},
+      </if>
+      <if test="loadingId != null">
+        LOADING_ID = #{loadingId,jdbcType=DECIMAL},
+      </if>
+      <if test="materialId != null">
+        MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
+      </if>
+      <if test="loadingSequence != null">
+        LOADING_SEQUENCE = #{loadingSequence,jdbcType=DECIMAL},
+      </if>
+      <if test="isdeduct != null">
+        ISDEDUCT = #{isdeduct,jdbcType=DECIMAL},
+      </if>
+      <if test="segmentSqe != null">
+        SEGMENT_SQE = #{segmentSqe,jdbcType=DECIMAL},
+      </if>
+      <if test="caseNumber != null">
+        CASE_NUMBER = #{caseNumber,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where RESULT_ID = #{resultId,jdbcType=DECIMAL}
+  </update>
+  <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" />
+  </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 TMSTRUCK_LOAD_RESULT 
+      (RESULT_ID, 
+      RESULT_TOTAL_ID, RESULT_LOAD_START_TIME, 
+      RESULT_LOAD_END_TIME, RESULT_LOAD_DURATION, 
+      LOAD_STANDARD_TIME_ID, LOADER_ID, 
+      RESULT_ISCLEAR, DELETE_NAME, DELETE_TIME, 
+      INSERT_USERNAME, INSERT_TIME, 
+      UPDATE_USERNAME, UPDATE_TIME, 
+      INSERT_UPDATE_REMARK, STATUS, RESULT_MEASURED_TONNAGE, 
+      LOADING_ID, MATERIAL_ID, LOADING_SEQUENCE, 
+      ISDEDUCT, SEGMENT_SQE, CASE_NUMBER
+      )
+    ( <foreach collection="list" item="item" separator="union all"> 
+   select  
+      #{item.resultId,jdbcType=DECIMAL}, 
+      #{item.resultTotalId,jdbcType=DECIMAL}, #{item.resultLoadStartTime,jdbcType=TIMESTAMP}, 
+      #{item.resultLoadEndTime,jdbcType=TIMESTAMP}, #{item.resultLoadDuration,jdbcType=DECIMAL}, 
+      #{item.loadStandardTimeId,jdbcType=DECIMAL}, #{item.loaderId,jdbcType=DECIMAL}, 
+      #{item.resultIsclear,jdbcType=VARCHAR}, #{item.deleteName,jdbcType=VARCHAR}, #{item.deleteTime,jdbcType=TIMESTAMP}, 
+      #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP}, 
+      #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP}, 
+      #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.status,jdbcType=DECIMAL}, #{item.resultMeasuredTonnage,jdbcType=DECIMAL}, 
+      #{item.loadingId,jdbcType=DECIMAL}, #{item.materialId,jdbcType=DECIMAL}, #{item.loadingSequence,jdbcType=DECIMAL}, 
+      #{item.isdeduct,jdbcType=DECIMAL}, #{item.segmentSqe,jdbcType=DECIMAL}, #{item.caseNumber,jdbcType=VARCHAR}
+       from dual  
+   </foreach> )
+  </insert>
+  <update id="batchUpdate" parameterType="java.util.List">
+     update TMSTRUCK_LOAD_RESULT
+     set
+       RESULT_ID=
+       <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 close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.resultTotalId,jdbcType=DECIMAL}
+       </foreach>
+       ,RESULT_LOAD_START_TIME=
+       <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.resultLoadStartTime,jdbcType=TIMESTAMP}
+       </foreach>
+       ,RESULT_LOAD_END_TIME=
+       <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.resultLoadEndTime,jdbcType=TIMESTAMP}
+       </foreach>
+       ,RESULT_LOAD_DURATION=
+       <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.resultLoadDuration,jdbcType=DECIMAL}
+       </foreach>
+       ,LOAD_STANDARD_TIME_ID=
+       <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.loadStandardTimeId,jdbcType=DECIMAL}
+       </foreach>
+       ,LOADER_ID=
+       <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.loaderId,jdbcType=DECIMAL}
+       </foreach>
+       ,RESULT_ISCLEAR=
+       <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.resultIsclear,jdbcType=VARCHAR}
+       </foreach>
+       ,DELETE_NAME=
+       <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.deleteName,jdbcType=VARCHAR}
+       </foreach>
+       ,DELETE_TIME=
+       <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.deleteTime,jdbcType=TIMESTAMP}
+       </foreach>
+       ,INSERT_USERNAME=
+       <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 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 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 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 close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
+       </foreach>
+       ,STATUS=
+       <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.status,jdbcType=DECIMAL}
+       </foreach>
+       ,RESULT_MEASURED_TONNAGE=
+       <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.resultMeasuredTonnage,jdbcType=DECIMAL}
+       </foreach>
+       ,LOADING_ID=
+       <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.loadingId,jdbcType=DECIMAL}
+       </foreach>
+       ,MATERIAL_ID=
+       <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.materialId,jdbcType=DECIMAL}
+       </foreach>
+       ,LOADING_SEQUENCE=
+       <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.loadingSequence,jdbcType=DECIMAL}
+       </foreach>
+       ,ISDEDUCT=
+       <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.isdeduct,jdbcType=DECIMAL}
+       </foreach>
+       ,SEGMENT_SQE=
+       <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.segmentSqe,jdbcType=DECIMAL}
+       </foreach>
+       ,CASE_NUMBER=
+       <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+          when #{item.resultId,jdbcType=DECIMAL} then #{item.caseNumber,jdbcType=VARCHAR}
+       </foreach>
+     where RESULT_ID in 
+     <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
+    #{item.resultId,jdbcType=DECIMAL}
+     </foreach> 
+  </update>
+  <delete id="batchDelete" parameterType="java.util.List">
+    delete from TMSTRUCK_LOAD_RESULT
+    where RESULT_ID in 
+    <foreach close=")" collection="list" item="id" open="(" separator=",">
+      #{id}
+    </foreach>
+  </delete>
+  <!-- 友情提示!!!-->
+  <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+  <sql id="orderBy">
+    <if test="orderField != null and orderField != ''">
+      order by "${orderField}"
+      <if test="orderType != null and orderType != ''">
+        ${orderType}
+      </if>
+    </if>
+  </sql>
+
+  <!--  获取所有装车实绩  -->
+  <select id="getCGJKLoadResult" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
+
+    select *
+    from (
+    select TLR.RESULT_ID "resultId",
+    APO.PURCHASE_ORDER_NO "purchaseOrderNo",
+    RM.MATERIAL_NAME "materialName",
+    OO.ORDER_NUMBER "orderNumber",
+    RC.CAPACITY_NUMBER "capacityNumber",
+    TLR.RESULT_MEASURED_TONNAGE "resultMeasuredTonnage",
+    TLR.RESULT_ISCLEAR "resultIsclear",
+    to_char(TLR.RESULT_LOAD_START_TIME, 'yyyy-mm-dd') "resultLoadStartTime",
+    TLR.INSERT_UPDATE_REMARK "insertUpdateRemark",
+    TLR.INSERT_TIME "insertTime",
+    RCON. CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
+    RS.SUPPLIER_NAME "supplierName"
+    from TMSTRUCK_LOAD_RESULT TLR
+    left join TMSTRUCK_TOTAL_RESULT TTR
+    on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+    left join OMSTRUCK_ORDER OO
+    on TTR.ORDER_ID = OO.ORDER_ID
+    left join OMSTRUCK_ORDER_MATERIAL OOM
+    on OO.ORDER_ID = OOM.ORDER_ID
+    left join AMS_PURCHASE_ORDER APO
+    on OO.ORDER_PLAN_ID = APO.PURCHASE_ORDER_ID
+    left join DIL_BATCH DB
+    on DB.BATCH_ID = APO.BATCH_ID
+    left join RMS_MATERIAL RM
+    on OOM.MATERIAL_ID = RM.MATERIAL_ID
+    left join RMS_CAPACITY RC
+    on RC.CAPACITY_ID = OO.CAPACITY_ID
+    left join RMS_SUPPLIER RS
+    on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
+    left join RMS_CONSIGNEE RCON
+    on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
+    where TLR.STATUS = #{status} and OO.ORDER_TYPE = #{orderTypee}
+    )
+    <where>
+      <if test="purchaseOrderId != null">
+        <foreach collection="purchaseOrderId" item="item" open="(" separator="or" close=")">
+          "purchaseOrderId" like '%${item}%'
         </foreach>
-        ,LOADING_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-            when #{item.resultId,jdbcType=DECIMAL} then #{item.loadingId,jdbcType=DECIMAL}
+      </if>
+      <if test="materialName != null">
+        and
+        <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+          "materialName" like '%${item}%'
         </foreach>
-        ,MATERIAL_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-            when #{item.resultId,jdbcType=DECIMAL} then #{item.materialId,jdbcType=DECIMAL}
+      </if>
+      <if test="orderNumber != null">
+        and
+        <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
+          "orderNumber" like '%${item}%'
         </foreach>
-        ,LOADING_SEQUENCE=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-            when #{item.resultId,jdbcType=DECIMAL} then #{item.loadingSequence,jdbcType=DECIMAL}
+      </if>
+      <if test="capacityNumber != null">
+        and
+        <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
+          "capacityNumber" like '%${item}%'
         </foreach>
-        ,ISDEDUCT=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-            when #{item.resultId,jdbcType=DECIMAL} then #{item.isdeduct,jdbcType=DECIMAL}
+      </if>
+      <if test="orderMaterialWeight != null">
+        and
+        <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
+          "orderMaterialWeight" like '%${item}%'
         </foreach>
-        ,SEGMENT_SQE=
-        <foreach collection="list" item="item" index="index" separator=" " open="case RESULT_ID" close="end">
-            when #{item.resultId,jdbcType=DECIMAL} then #{item.segmentSqe,jdbcType=DECIMAL}
+      </if>
+      <if test="resultIsclear != null">
+        and
+        <foreach collection="resultIsclear" item="item" open="(" separator="or" close=")">
+          "resultIsclear" like '%${item}%'
         </foreach>
-        where RESULT_ID in
-        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
-            #{item.resultId,jdbcType=DECIMAL}
+      </if>
+      <if test="resultLoadStartTime != null">
+        and
+        <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
+          "resultLoadStartTime" like '%${item}%'
         </foreach>
-    </update>
-    <delete id="batchDelete" parameterType="java.util.List">
-        delete from TMSTRUCK_LOAD_RESULT
-        where RESULT_ID in
-        <foreach collection="list" item="id" open="(" close=")" separator=",">
-            #{id}
+      </if>
+      <if test="insertUpdateRemark != null">
+        and
+        <foreach collection="insertUpdateRemark" item="item" open="(" separator="or" close=")">
+          "insertUpdateRemark" like '%${item}%'
         </foreach>
-    </delete>
-    <!-- 友情提示!!!-->
-    <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
-    <sql id="orderBy">
-        <if test="orderField != null and orderField != ''">
-            order by "${orderField}"
-            <if test="orderType != null and orderType != ''">
-                ${orderType}
-            </if>
-        </if>
-    </sql>
+      </if>
+    </where>
+    <include refid="orderBy"></include>
+    <if test="orderField == null  ">
+      order by "resultLoadStartTime" desc
+    </if>
+  </select>
 
-    <!--  获取所有装车实绩  -->
-    <select id="getCGJKLoadResult" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
 
-        select *
-        from (
-        select TLR.RESULT_ID "resultId",
-        APO.PURCHASE_ORDER_NO "purchaseOrderNo",
-        RM.MATERIAL_NAME "materialName",
-        OO.ORDER_NUMBER "orderNumber",
-        RC.CAPACITY_NUMBER "capacityNumber",
-        TLR.RESULT_MEASURED_TONNAGE "resultMeasuredTonnage",
-        TLR.RESULT_ISCLEAR "resultIsclear",
-        to_char(TLR.RESULT_LOAD_START_TIME, 'yyyy-mm-dd') "resultLoadStartTime",
-        TLR.INSERT_UPDATE_REMARK "insertUpdateRemark",
-        TLR.INSERT_TIME "insertTime",
-        RCON. CONSIGNEE_COMPANY_NAME "consigneeCompanyName",
-        RS.SUPPLIER_NAME "supplierName"
-        from TMSTRUCK_LOAD_RESULT TLR
-        left join TMSTRUCK_TOTAL_RESULT TTR
-        on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-        left join OMSTRUCK_ORDER OO
-        on TTR.ORDER_ID = OO.ORDER_ID
-        left join OMSTRUCK_ORDER_MATERIAL OOM
-        on OO.ORDER_ID = OOM.ORDER_ID
-        left join AMS_PURCHASE_ORDER APO
-        on OO.ORDER_PLAN_ID = APO.PURCHASE_ORDER_ID
-        left join DIL_BATCH DB
-        on DB.BATCH_ID = APO.BATCH_ID
-        left join RMS_MATERIAL RM
-        on OOM.MATERIAL_ID = RM.MATERIAL_ID
-        left join RMS_CAPACITY RC
-        on RC.CAPACITY_ID = OO.CAPACITY_ID
-        left join RMS_SUPPLIER RS
-        on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
-        left join RMS_CONSIGNEE RCON
-        on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
-        where TLR.STATUS = #{status} and OO.ORDER_TYPE = #{orderTypee}
-        )
-        <where>
-            <if test="purchaseOrderId != null">
-                <foreach collection="purchaseOrderId" item="item" open="(" separator="or" close=")">
-                    "purchaseOrderId" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="materialName != null">
-                and
-                <foreach collection="materialName" item="item" open="(" separator="or" close=")">
-                    "materialName" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="orderNumber != null">
-                and
-                <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
-                    "orderNumber" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="capacityNumber != null">
-                and
-                <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
-                    "capacityNumber" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="orderMaterialWeight != null">
-                and
-                <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
-                    "orderMaterialWeight" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="resultIsclear != null">
-                and
-                <foreach collection="resultIsclear" item="item" open="(" separator="or" close=")">
-                    "resultIsclear" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="resultLoadStartTime != null">
-                and
-                <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
-                    "resultLoadStartTime" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="insertUpdateRemark != null">
-                and
-                <foreach collection="insertUpdateRemark" item="item" open="(" separator="or" close=")">
-                    "insertUpdateRemark" like '%${item}%'
-                </foreach>
-            </if>
-        </where>
-        <include refid="orderBy"></include>
-        <if test="orderField == null  ">
-            order by "resultLoadStartTime" desc
-        </if>
-    </select>
+  <!--  通过Id获取装车实绩 数据 用于修改-->
+  <select id="getLoadResultById" parameterType="int" resultType="java.util.LinkedHashMap">
+    select TLR.RESULT_ISCLEAR         "resultIsclear",
+           TLR.RESULT_LOAD_START_TIME "resultLoadStartTime",
+           TLR.INSERT_UPDATE_REMARK   "insertUpdateRemark"
+    from TMSTRUCK_LOAD_RESULT TLR
+    where RESULT_ID = #{resultId}
+  </select>
 
+  <!--  通过发站查询所属港口 -->
+  <select id="getPortIdBySendStationId" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
+    select RAS.OWNED_PORT_ID
+    from RMSTRAIN_ARRIVAL_SEND RAS
+    where RAS.ARRIVAL_ID = #{sendStationId}
+  </select>
 
-    <!--  通过Id获取装车实绩 数据 用于修改-->
-    <select id="getLoadResultById" parameterType="int" resultType="java.util.LinkedHashMap">
-        select TLR.RESULT_ISCLEAR         "resultIsclear",
-               TLR.RESULT_LOAD_START_TIME "resultLoadStartTime",
-               TLR.INSERT_UPDATE_REMARK   "insertUpdateRemark"
-        from TMSTRUCK_LOAD_RESULT TLR
-        where RESULT_ID = #{resultId}
-    </select>
+  <!--  通过运输订单查询批次 -->
+  <select id="getBatchIdByOrderId" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
+    select APO.BATCH_ID
+    from OMSTRUCK_ORDER OO
+           left join AMS_PURCHASE_ORDER APO
+                     on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
+    where OO.ORDER_ID = #{orderId}
+  </select>
 
-    <!--  通过发站查询所属港口 -->
-    <select id="getPortIdBySendStationId" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
-        select RAS.OWNED_PORT_ID
-        from RMSTRAIN_ARRIVAL_SEND RAS
-        where RAS.ARRIVAL_ID = #{sendStationId}
-    </select>
+  <!--通过运输订单号查找运输订单类型-->
+  <select id="selectOrderTypeByOrderNumber" resultType="java.lang.Integer" parameterType="java.lang.String">
+    select OO.ORDER_TYPE "orderType"
+    from OMSTRUCK_ORDER OO
+    where OO.ORDER_NUMBER = #{oderNumber}
+  </select>
 
-    <!--  通过运输订单查询批次 -->
-    <select id="getBatchIdByOrderId" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
-        select APO.BATCH_ID
-        from OMSTRUCK_ORDER OO
-                 left join AMS_PURCHASE_ORDER APO
-                           on APO.PURCHASE_ORDER_ID = OO.ORDER_PLAN_ID
-        where OO.ORDER_ID = #{orderId}
-    </select>
+  <!--  通过运输订单号查询 出库实绩 最小Id(第一件扫描时间)  0 成功  1 失败-->
+  <select id="getMinScanIdByOrderNum" parameterType="java.util.Map" resultType="java.util.Map">
+    select *
+    from (
+           select WOSR.RESULT_ID "resultId",
+                  WOSR.LOAD_ID   "loadId"
+           from WMSP_OUTBOUND_RESULT WOR
+                  left join WMSP_OUTBOUND_SCAN_RESULT WOSR
+                            on WOSR.OUTBOUND_RESULT_ID = WOR.RESULT_ID
+                  left join OMSTRUCK_ORDER OO
+                            on OO.ORDER_ID = WOR.BILL_LADING_ID
+           WHERE OO.ORDER_NUMBER = #{orderNumber}
+             and WOR.MATERIAL_ID = #{materialId}
+             and WOSR.RESULT_CHECK = 0
+           ORDER BY WOSR.RESULT_LOAD_TIME
 
-    <!--通过运输订单号查找运输订单类型-->
-    <select id="selectOrderTypeByOrderNumber" resultType="java.lang.Integer" parameterType="java.lang.String">
-        select OO.ORDER_TYPE "orderType"
-        from OMSTRUCK_ORDER OO
-        where OO.ORDER_NUMBER = #{oderNumber}
-    </select>
+         )
+    where rownum = 1
+  </select>
 
-<!--  通过运输订单号查询 出库实绩 最小Id(第一件扫描时间)  0 成功  1 失败-->
-    <select id="getMinScanIdByOrderNum" parameterType="java.util.Map" resultType="java.util.Map">
-        select *
-        from (
-                 select WOSR.RESULT_ID "resultId",
-                        WOSR.LOAD_ID   "loadId"
-                 from WMSP_OUTBOUND_RESULT WOR
-                          left join WMSP_OUTBOUND_SCAN_RESULT WOSR
-                                    on WOSR.OUTBOUND_RESULT_ID = WOR.RESULT_ID
-                          left join OMSTRUCK_ORDER OO
-                                    on OO.ORDER_ID = WOR.BILL_LADING_ID
-                 WHERE OO.ORDER_NUMBER = #{orderNumber}
-                   and WOR.MATERIAL_ID = #{materialId}
-                   and WOSR.RESULT_CHECK = 0
-                 ORDER BY WOSR.RESULT_LOAD_TIME
+  <!-- 根据运输订单号查找 -->
+  <select id="selectResultIdByOrderNumber" resultType="java.lang.Integer" parameterType="java.lang.String">
+    select WOSR.RESULT_ID "resultId"
 
-             )
-        where rownum = 1
-    </select>
+    from OMSTRUCK_ORDER OO
+           left join WMSP_OUTBOUND_RESULT WOR
+                     on OO.ORDER_ID = WOR.BILL_LADING_ID
+           left join WMSP_OUTBOUND_SCAN_RESULT WOSR
+                     on WOSR.OUTBOUND_RESULT_ID = WOR.RESULT_ID
+    WHERE OO.ORDER_NUMBER = #{orderNumber}
+      and WOSR.RESULT_CHECK = 0
+  </select>
 
-    <!-- 根据运输订单号查找 -->
-    <select id="selectResultIdByOrderNumber" resultType="java.lang.Integer" parameterType="java.lang.String">
-        select WOSR.RESULT_ID "resultId"
+  <!-- 根据实绩id查找扫描时间 -->
+  <select id="selectLoadTimeByResultId" resultType="java.util.Date" parameterType="java.math.BigDecimal">
+    select WOSR.RESULT_LOAD_TIME "loadTime"
+    from WMSP_OUTBOUND_SCAN_RESULT WOSR
+    where WOSR.RESULT_ID = #{resultId}
+  </select>
 
-        from OMSTRUCK_ORDER OO
-                 left join WMSP_OUTBOUND_RESULT WOR
-                           on OO.ORDER_ID = WOR.BILL_LADING_ID
-                 left join WMSP_OUTBOUND_SCAN_RESULT WOSR
-                           on WOSR.OUTBOUND_RESULT_ID = WOR.RESULT_ID
-        WHERE OO.ORDER_NUMBER = #{orderNumber}
-          and WOSR.RESULT_CHECK = 0
-    </select>
+  <!-- 根据扫描实绩id查询装卸工id -->
+  <select id="selecLoadIdByresultId" resultType="java.lang.Integer">
+    select WOSR.LOAD_ID "loadId"
+    from WMSP_OUTBOUND_SCAN_RESULT WOSR
+    where WOSR.RESULT_ID = #{resultId}
+  </select>
 
-    <!-- 根据实绩id查找扫描时间 -->
-    <select id="selectLoadTimeByResultId" resultType="java.util.Date" parameterType="java.math.BigDecimal">
-        select WOSR.RESULT_LOAD_TIME "loadTime"
-        from WMSP_OUTBOUND_SCAN_RESULT WOSR
-        where WOSR.RESULT_ID = #{resultId}
-    </select>
+  <!-- 销售装车实绩查询-->
+  <select id="selectLoadResultForSale" resultType="java.util.Map" parameterType="java.lang.Integer">
+    SELECT (SELECT ORDER_MATERIAL_NUMBER
+            FROM OMSTRUCK_ORDER_MATERIAL OOM
+            WHERE OOM.ORDER_ID = OO.ORDER_ID
+              AND TLR.MATERIAL_ID = OOM.MATERIAL_ID) "orderMaterialNumber",
+           TLR.RESULT_LOAD_START_TIME                "startTime",
+           TLR.RESULT_LOAD_END_TIME                  "endTime",
+           TLR.RESULT_LOAD_DURATION                  "loadDuration",
+           RM.MATERIAL_NAME                          "materialName",
+           RP.PERSONNEL_NAME                         "name",
+           RMS.MATERIAL_THEORETICAL_WEIGHT           "theoreticalWeight",
+           OO.ORDER_NUMBER                           "orderNumber",
+           ASO.SALE_NUMBER                           "saleNumber",
+           RC.CAPACITY_NUMBER                        "capacityNumber"
+    FROM TMSTRUCK_LOAD_RESULT TLR
+           LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
+           LEFT JOIN OMSTRUCK_ORDER OO ON OO.ORDER_ID = TTR.ORDER_ID
+           LEFT JOIN RMS_MATERIAL_STEEL RMS ON RMS.MATERIAL_STEEL_ID = TLR.MATERIAL_ID
+           LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID = RMS.MATERIAL_ID
+           LEFT JOIN RMS_PERSONNEL RP ON TLR.LOADER_ID = RP.PERSONNEL_ID
+           LEFT JOIN AMS_SALE_ORDER ASO ON OO.ORDER_PLAN_ID = ASO.SALE_ORDER_ID
+           LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
+           LEFT JOIN RMS_CAPACITY RC ON RC.CAPACITY_ID = OO.CAPACITY_ID
+    where TLR.STATUS = #{status}
+      and OO.ORDER_TYPE = 1
+  </select>
 
-    <!-- 根据扫描实绩id查询装卸工id -->
-    <select id="selecLoadIdByresultId" resultType="java.lang.Integer">
-        select WOSR.LOAD_ID "loadId"
-        from WMSP_OUTBOUND_SCAN_RESULT WOSR
-        where WOSR.RESULT_ID = #{resultId}
-    </select>
+  <!--通过运输订单号查找物资id-->
+  <select id="selectMaterialIdByOrderNumber" parameterType="java.lang.String" resultType="java.util.Map">
+    SELECT
+    OOM.MATERIAL_ID "materialId"
+    FROM
+    OMSTRUCK_ORDER OO
+    LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM ON OO.ORDER_ID = OOM.ORDER_ID
+    WHERE
+    <if test="orderNumber != null">
+      OO.ORDER_NUMBER = #{orderNumber}
+    </if>
+    <if test="orderId != null">
+      and OO.ORDER_ID = #{orderId}
+    </if>
+  </select>
 
-    <!-- 销售装车实绩查询-->
-    <select id="selectLoadResultForSale" resultType="java.util.Map" parameterType="java.lang.Integer">
-        SELECT (SELECT ORDER_MATERIAL_NUMBER
-                FROM OMSTRUCK_ORDER_MATERIAL OOM
-                WHERE OOM.ORDER_ID = OO.ORDER_ID
-                  AND TLR.MATERIAL_ID = OOM.MATERIAL_ID) "orderMaterialNumber",
-               TLR.RESULT_LOAD_START_TIME                "startTime",
-               TLR.RESULT_LOAD_END_TIME                  "endTime",
-               TLR.RESULT_LOAD_DURATION                  "loadDuration",
-               RM.MATERIAL_NAME                          "materialName",
-               RP.PERSONNEL_NAME                         "name",
-               RMS.MATERIAL_THEORETICAL_WEIGHT           "theoreticalWeight",
-               OO.ORDER_NUMBER                           "orderNumber",
-               ASO.SALE_NUMBER                           "saleNumber",
-               RC.CAPACITY_NUMBER                        "capacityNumber"
-        FROM TMSTRUCK_LOAD_RESULT TLR
-                 LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
-                 LEFT JOIN OMSTRUCK_ORDER OO ON OO.ORDER_ID = TTR.ORDER_ID
-                 LEFT JOIN RMS_MATERIAL_STEEL RMS ON RMS.MATERIAL_STEEL_ID = TLR.MATERIAL_ID
-                 LEFT JOIN RMS_MATERIAL RM ON RM.MATERIAL_ID = RMS.MATERIAL_ID
-                 LEFT JOIN RMS_PERSONNEL RP ON TLR.LOADER_ID = RP.PERSONNEL_ID
-                 LEFT JOIN AMS_SALE_ORDER ASO ON OO.ORDER_PLAN_ID = ASO.SALE_ORDER_ID
-                 LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
-                 LEFT JOIN RMS_CAPACITY RC ON RC.CAPACITY_ID = OO.CAPACITY_ID
-        where TLR.STATUS = #{status}
-          and OO.ORDER_TYPE = 1
-    </select>
+  <!--  通过订单ID 和物资Id 查询装车实绩ID 可能会有多条-->
+  <select id="getLoadResultId" parameterType="java.util.Map" resultType="java.lang.Integer">
+    select TLR.RESULT_ID
+    from OMSTRUCK_ORDER OO
+           left join TMSTRUCK_TOTAL_RESULT TTR
+                     on TTR.ORDER_ID = OO.ORDER_ID
+           left join TMSTRUCK_LOAD_RESULT TLR
+                     on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+    where OO.ORDER_ID = #{orderId}
+      and TLR.MATERIAL_ID = #{materialId}
+  </select>
 
-    <!--通过运输订单号查找物资id-->
-    <select id="selectMaterialIdByOrderNumber" parameterType="java.lang.String" resultType="java.util.Map">
-        SELECT
-        OOM.MATERIAL_ID "materialId"
-        FROM
-        OMSTRUCK_ORDER OO
-        LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM ON OO.ORDER_ID = OOM.ORDER_ID
-        WHERE
-        <if test="orderNumber != null">
-            OO.ORDER_NUMBER = #{orderNumber}
-        </if>
-        <if test="orderId != null">
-            and OO.ORDER_ID = #{orderId}
-        </if>
-    </select>
+  <!--通过运输订单号查找装车实绩id-->
+  <select id="selectLoadResultIdByOrderNumber" resultType="java.lang.Integer" parameterType="java.util.Map">
+    SELECT TLR.RESULT_ID              "loadResultId",
+           TLR.RESULT_LOAD_START_TIME "startTime"
+    FROM OMSTRUCK_ORDER OO
+           LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
+                     ON OO.ORDER_ID = TTR.ORDER_ID
+           LEFT JOIN TMSTRUCK_LOAD_RESULT TLR
+                     ON TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+    WHERE OO.ORDER_NUMBER = #{orderNumber}
+  </select>
 
-    <!--  通过订单ID 和物资Id 查询装车实绩ID 可能会有多条-->
-    <select id="getLoadResultId" parameterType="java.util.Map" resultType="java.lang.Integer">
-        select TLR.RESULT_ID
-        from OMSTRUCK_ORDER OO
-                 left join TMSTRUCK_TOTAL_RESULT TTR
-                           on TTR.ORDER_ID = OO.ORDER_ID
-                 left join TMSTRUCK_LOAD_RESULT TLR
-                           on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-        where OO.ORDER_ID = #{orderId}
-          and TLR.MATERIAL_ID = #{materialId}
-    </select>
+  <!--内转物流查询汽车装车实绩 -->
+  <select id="selectLoadResultForConverted" resultType="java.util.LinkedHashMap">
+    select APO.PURCHASE_ORDER_NO       "orderNo",
+           TLR.INSERT_TIME             "insertTime",
+           RC.CAPACITY_NUMBER          "capacityNumber",
+           TLR.RESULT_MEASURED_TONNAGE "toggage",
+           RAS.ARRIVAL_NAME            "arrivelName",
+           DB.RESULT_FOREIGN_SHIP_NAME "foreignShipName",
+           OO.ORDER_NUMBER             "orderNumber",
+           RM.MATERIAL_NAME            "materialName"
 
-    <!--通过运输订单号查找装车实绩id-->
-    <select id="selectLoadResultIdByOrderNumber" resultType="java.lang.Integer" parameterType="java.util.Map">
-        SELECT TLR.RESULT_ID              "loadResultId",
-               TLR.RESULT_LOAD_START_TIME "startTime"
-        FROM OMSTRUCK_ORDER OO
-                 LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
-                           ON OO.ORDER_ID = TTR.ORDER_ID
-                 LEFT JOIN TMSTRUCK_LOAD_RESULT TLR
-                           ON TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-        WHERE OO.ORDER_NUMBER = #{orderNumber}
-    </select>
+    from TMSTRUCK_LOAD_RESULT TLR
+           LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
+                     ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
+           LEFT JOIN OMSTRUCK_ORDER OO
+                     ON OO.ORDER_ID = TTR.ORDER_ID
+           left join AMS_PURCHASE_ORDER APO
+                     ON oo.ORDER_PLAN_ID = APO.PURCHASE_ORDER_ID
+           LEFT JOIN DIL_BATCH DB
+                     ON DB.BATCH_ID = APO.BATCH_ID
+           LEFT JOIN RMS_MATERIAL RM
+                     ON RM.MATERIAL_ID = TLR.MATERIAL_ID
+           LEFT JOIN RMS_CAPACITY RC
+                     ON OO.CAPACITY_ID = RC.CAPACITY_ID
+           LEFT JOIN TMSTRAIN_LOADING_RESULT TLR2
+                     ON TLR2.PURCHASE_ORDER_RAIL_PLAN_ID = OO.ORDER_PLAN_ID
+           LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS
+                     ON RAS.ARRIVAL_ID = TLR.LOADING_ID
 
-    <!--内转物流查询汽车装车实绩 -->
-    <select id="selectLoadResultForConverted" resultType="java.util.LinkedHashMap">
-        select APO.PURCHASE_ORDER_NO       "orderNo",
-               TLR.INSERT_TIME             "insertTime",
-               RC.CAPACITY_NUMBER          "capacityNumber",
-               TLR.RESULT_MEASURED_TONNAGE "toggage",
-               RAS.ARRIVAL_NAME            "arrivelName",
-               DB.RESULT_FOREIGN_SHIP_NAME "foreignShipName",
-               OO.ORDER_NUMBER             "orderNumber",
-               RM.MATERIAL_NAME            "materialName"
+  </select>
 
-        from TMSTRUCK_LOAD_RESULT TLR
-                 LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
-                           ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
-                 LEFT JOIN OMSTRUCK_ORDER OO
-                           ON OO.ORDER_ID = TTR.ORDER_ID
-                 left join AMS_PURCHASE_ORDER APO
-                           ON oo.ORDER_PLAN_ID = APO.PURCHASE_ORDER_ID
-                 LEFT JOIN DIL_BATCH DB
-                           ON DB.BATCH_ID = APO.BATCH_ID
-                 LEFT JOIN RMS_MATERIAL RM
-                           ON RM.MATERIAL_ID = TLR.MATERIAL_ID
-                 LEFT JOIN RMS_CAPACITY RC
-                           ON OO.CAPACITY_ID = RC.CAPACITY_ID
-                 LEFT JOIN TMSTRAIN_LOADING_RESULT TLR2
-                           ON TLR2.PURCHASE_ORDER_RAIL_PLAN_ID = OO.ORDER_PLAN_ID
-                 LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS
-                           ON RAS.ARRIVAL_ID = TLR.LOADING_ID
+  <!-- 根据实绩id渲染数据 -->
+  <select id="selectLoadResultByResultId" resultType="java.lang.Integer">
+    SELECT TLR.LOADING_ID      "loadingId",
+           TLR.MATERIAL_ID     "materialId",
+           TLR.RESULT_TOTAL_ID "totalId"
+    FROM TMSTRUCK_LOAD_RESULT TLR
+    WHERE TLR.RESULT_ID = #{resultId}
+  </select>
 
-    </select>
+  <!--通过车牌号号查找物资id和运力id以及总实绩id-->
+  <select id="selectMaterialIdAndCapacityId" resultType="java.util.Map" parameterType="java.lang.Integer">
+    select OOM.MATERIAL_ID     "materialId",
+           OO.CAPACITY_ID      "capacityId",
+           TTR.RESULT_TOTAL_ID "resultTotalId"
+    from TMSTRUCK_TOTAL_RESULT TTR
+           left join OMSTRUCK_ORDER OO
+                     on OO.ORDER_ID = TTR.ORDER_ID
+           left join OMSTRUCK_ORDER_MATERIAL OOM
+                     on OOM.ORDER_ID = OO.ORDER_ID
+           LEFT JOIN RMS_CAPACITY RC
+                     ON RC.CAPACITY_ID = OO.CAPACITY_ID
+    where RC.CAPACITY_NUMBER = #{capacityNumber}
+  </select>
+  <!--根据id查找用户名    -->
+  <select id="selectPersonNameByPersonnelId" resultType="java.lang.String" parameterType="java.lang.Integer">
+    select RP.PERSONNEL_NAME "personnelName"
+    from RMS_PERSONNEL RP
+    where RP.PERSONNEL_ID = #{personnelId}
+  </select>
+  <select id="selectMaterialTypeByMaterialId" parameterType="java.lang.Integer" resultType="java.lang.Integer">
+    select RMT.MATERIAL_TYPE_ID "materialTypeId"
+    FROM RMS_MATERIAL RM
+           LEFT JOIN RMS_MATERIAL_TYPE RMT
+                     ON RMT.MATERIAL_TYPE_ID = RM.MATERIAL_TYPE_ID
+    where RM.MATERIAL_ID = #{materialId}
+  </select>
 
-    <!-- 根据实绩id渲染数据 -->
-    <select id="selectLoadResultByResultId" resultType="java.lang.Integer">
-        SELECT TLR.LOADING_ID      "loadingId",
-               TLR.MATERIAL_ID     "materialId",
-               TLR.RESULT_TOTAL_ID "totalId"
-        FROM TMSTRUCK_LOAD_RESULT TLR
-        WHERE TLR.RESULT_ID = #{resultId}
-    </select>
+  <!--  查询销售装车实绩  -->
+  <select id="getXSLoadResult" parameterType="java.util.Map" resultType="java.util.Map">
+    SELECT *
+    FROM (
+    SELECT OO.ORDER_NUMBER "orderNumber",
+    RC.CAPACITY_NUMBER "capacityNumber",
+    TLR.RESULT_LOAD_START_TIME "resultLoadStartTime",
+    TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
+    TLR.RESULT_LOAD_DURATION "resultLoadDuration",
+    RP.PERSONNEL_NAME "personnelName",
+    RM.MATERIAL_THEORETICAL_WEIGHT "materialTheoreticalWeight",
+    RM.MATERIAL_NAME "materialName",
+    ASO.SALE_NUMBER  "no",
+    (CASE WHEN  OOM.ORDER_MATERIAL_NUMBER is not null
+    THEN OOM.ORDER_MATERIAL_NUMBER
+    ELSE OOM.ORDER_MATERIAL_WEIGHT
+    END) "materialNumWei",
+    TLR.INSERT_UPDATE_REMARK "insertUpdateRemark",
+    TLR.CASE_NUMBER "caseNumber"
+    FROM TMSTRUCK_LOAD_RESULT TLR
+    LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
+    ON TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+    LEFT JOIN OMSTRUCK_ORDER OO
+    ON OO.ORDER_ID = TTR.ORDER_ID
+    LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
+    ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
+    LEFT JOIN AMS_SALE_ORDER ASO
+    ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
+    LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
+    ON OOM.ORDER_ID = OO.ORDER_ID
+    LEFT JOIN RMS_MATERIAL RM
+    ON RM.MATERIAL_ID = OOM.MATERIAL_ID
+    LEFT JOIN RMS_CAPACITY RC
+    ON RC.CAPACITY_ID = OO.CAPACITY_ID
+    LEFT JOIN RMS_PERSONNEL RP
+    ON TLR.LOADER_ID = RP.PERSONNEL_ID
+    where
+    OO.ORDER_TYPE in (1, 2, 3)
+    and TLR.STATUS = #{status}
+    )
+    <where>
+      <if test="orderNumber != null">
+        <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
+          "orderNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="materialName != null">
+        and
+        <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+          "materialName" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="no != null">
+        and
+        <foreach collection="no" item="item" open="(" separator="or" close=")">
+          "no" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="materialNumWei != null">
+        and
+        <foreach collection="materialNumWei" item="item" open="(" separator="or" close=")">
+          "materialNumWei" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="materialTheoreticalWeight != null">
+        and
+        <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
+          "materialTheoreticalWeight" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="capacityNumber != null">
+        and
+        <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
+          "capacityNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="resultLoadStartTime != null">
+        and
+        <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
+          "resultLoadStartTime" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="resultLoadEndTime != null">
+        and
+        <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
+          "resultLoadEndTime" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="resultLoadDuration != null">
+        and
+        <foreach collection="resultLoadDuration" item="item" open="(" separator="or" close=")">
+          "resultLoadDuration" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="standardDataMax != null">
+        and
+        <foreach collection="standardDataMax" item="item" open="(" separator="or" close=")">
+          "standardDataMax" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="personnelName != null">
+        and
+        <foreach collection="personnelName" item="item" open="(" separator="or" close=")">
+          "personnelName" like '%${item}%'
+        </foreach>
+      </if>
+    </where>
+    <include refid="orderBy"></include>
+    <if test="orderField == null  ">
+      order by "resultLoadStartTime" desc
+    </if>
+  </select>
 
-    <!--通过车牌号号查找物资id和运力id以及总实绩id-->
-    <select id="selectMaterialIdAndCapacityId" resultType="java.util.Map" parameterType="java.lang.Integer">
-        select OOM.MATERIAL_ID     "materialId",
-               OO.CAPACITY_ID      "capacityId",
-               TTR.RESULT_TOTAL_ID "resultTotalId"
-        from TMSTRUCK_TOTAL_RESULT TTR
-                 left join OMSTRUCK_ORDER OO
-                           on OO.ORDER_ID = TTR.ORDER_ID
-                 left join OMSTRUCK_ORDER_MATERIAL OOM
-                           on OOM.ORDER_ID = OO.ORDER_ID
-                 LEFT JOIN RMS_CAPACITY RC
-                           ON RC.CAPACITY_ID = OO.CAPACITY_ID
-        where RC.CAPACITY_NUMBER = #{capacityNumber}
-    </select>
-    <!--根据id查找用户名    -->
-    <select id="selectPersonNameByPersonnelId" resultType="java.lang.String" parameterType="java.lang.Integer">
-        select RP.PERSONNEL_NAME "personnelName"
-        from RMS_PERSONNEL RP
-        where RP.PERSONNEL_ID = #{personnelId}
-    </select>
-    <select id="selectMaterialTypeByMaterialId" parameterType="java.lang.Integer" resultType="java.lang.Integer">
-        select RMT.MATERIAL_TYPE_ID "materialTypeId"
-        FROM RMS_MATERIAL RM
-                 LEFT JOIN RMS_MATERIAL_TYPE RMT
-                           ON RMT.MATERIAL_TYPE_ID = RM.MATERIAL_TYPE_ID
-        where RM.MATERIAL_ID = #{materialId}
-    </select>
+  <!--  通过港口ID获取仓库ID  -->
+  <select id="getWarehouseIdByPortId" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
+    select RW.WAREHOUSE_ID
+    from RMS_WAREHOUSE RW
+    where RW.WAREHOUSE_TYPE_ID = 4 and RW.PORT_ID = #{portId}
+  </select>
 
-    <!--  查询销售装车实绩  -->
-    <select id="getXSLoadResult" parameterType="java.util.Map" resultType="java.util.Map">
-        SELECT *
-        FROM (
-            SELECT OO.ORDER_NUMBER "orderNumber",
-                   RC.CAPACITY_NUMBER "capacityNumber",
-                   TLR.RESULT_LOAD_START_TIME "resultLoadStartTime",
-                   TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
-                   TLR.RESULT_LOAD_DURATION "resultLoadDuration",
-                   RP.PERSONNEL_NAME "personnelName",
-                   RM.MATERIAL_THEORETICAL_WEIGHT "materialTheoreticalWeight",
-                   RM.MATERIAL_NAME "materialName",
-                   ASO.SALE_NUMBER  "no",
-                   (CASE WHEN  OOM.ORDER_MATERIAL_NUMBER is not null
-                         THEN OOM.ORDER_MATERIAL_NUMBER
-                         ELSE OOM.ORDER_MATERIAL_WEIGHT
-                     END) "materialNumWei",
-                   TLR.INSERT_UPDATE_REMARK "insertUpdateRemark"
-            FROM TMSTRUCK_LOAD_RESULT TLR
-            LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
-                ON TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-            LEFT JOIN OMSTRUCK_ORDER OO
-                ON OO.ORDER_ID = TTR.ORDER_ID
-            LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
-                ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
-            LEFT JOIN AMS_SALE_ORDER ASO
-                ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
-            LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
-                ON OOM.ORDER_ID = OO.ORDER_ID
-            LEFT JOIN RMS_MATERIAL RM
-                ON RM.MATERIAL_ID = OOM.MATERIAL_ID
-            LEFT JOIN RMS_CAPACITY RC
-                ON RC.CAPACITY_ID = OO.CAPACITY_ID
-            LEFT JOIN RMS_PERSONNEL RP
-                ON TLR.LOADER_ID = RP.PERSONNEL_ID
-            where
-                  OO.ORDER_TYPE in (1, 2, 3)
-              and TLR.STATUS = #{status}
-        )
-        <where>
-            <if test="orderNumber != null">
-                <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
-                    "orderNumber" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="materialName != null">
-                and
-                <foreach collection="materialName" item="item" open="(" separator="or" close=")">
-                    "materialName" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="no != null">
-                and
-                <foreach collection="no" item="item" open="(" separator="or" close=")">
-                    "no" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="materialNumWei != null">
-                and
-                <foreach collection="materialNumWei" item="item" open="(" separator="or" close=")">
-                    "materialNumWei" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="materialTheoreticalWeight != null">
-                and
-                <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
-                    "materialTheoreticalWeight" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="capacityNumber != null">
-                and
-                <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
-                    "capacityNumber" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="resultLoadStartTime != null">
-                and
-                <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
-                    "resultLoadStartTime" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="resultLoadEndTime != null">
-                and
-                <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
-                    "resultLoadEndTime" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="resultLoadDuration != null">
-                and
-                <foreach collection="resultLoadDuration" item="item" open="(" separator="or" close=")">
-                    "resultLoadDuration" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="standardDataMax != null">
-                and
-                <foreach collection="standardDataMax" item="item" open="(" separator="or" close=")">
-                    "standardDataMax" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="personnelName != null">
-                and
-                <foreach collection="personnelName" item="item" open="(" separator="or" close=")">
-                    "personnelName" like '%${item}%'
-                </foreach>
-            </if>
-        </where>
-        <include refid="orderBy"></include>
-        <if test="orderField == null  ">
-            order by "resultLoadStartTime" desc
-        </if>
-    </select>
+  <!--  通过物资ID和总实绩Id查询唯一的装车实绩Id  -->
+  <select id="getLoadResultIdByMIdAndTotalId" parameterType="int" resultType="java.util.Map">
+    select TLR.RESULT_ID "resultId",
+    TLR.SEGMENT_SQE "segmentSqe"
+    from TMSTRUCK_LOAD_RESULT TLR
+    <where>
+      TLR.RESULT_TOTAL_ID = #{resultTotalId}
+      <if test="materialId != null">
+        and TLR.MATERIAL_ID = #{materialId}
+      </if>
+    </where>
+  </select>
 
-<!--  通过港口ID获取仓库ID  -->
-    <select id="getWarehouseIdByPortId" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
-        select RW.WAREHOUSE_ID
-        from RMS_WAREHOUSE RW
-        where RW.WAREHOUSE_TYPE_ID = 4 and RW.PORT_ID = #{portId}
-    </select>
+  <!--    通过物资唯一编码 查找物资ID -->
+  <select id="getMaterialIdByMaterialCode" parameterType="string" resultType="java.math.BigDecimal">
+    select MATERIAL_ID
+    from RMS_MATERIAL_STEEL
+    where MATERIAL_ONLY_CODE = #{materialOnlyCode}
+  </select>
 
-<!--  通过物资ID和总实绩Id查询唯一的装车实绩Id  -->
-    <select id="getLoadResultIdByMIdAndTotalId" parameterType="int" resultType="java.util.Map">
-        select TLR.RESULT_ID "resultId",
-               TLR.SEGMENT_SQE "segmentSqe"
-        from TMSTRUCK_LOAD_RESULT TLR
-        <where>
-            TLR.RESULT_TOTAL_ID = #{resultTotalId}
-            <if test="materialId != null">
-                and TLR.MATERIAL_ID = #{materialId}
-            </if>
-        </where>
-    </select>
+  <!--   查询所有正在进行进厂排队的销售订单  -->
+  <select id="getSaleOrderOnQueue" parameterType="java.util.Map" resultType="java.util.Map">
+    select *
+    from (
+    select OO.ORDER_ID        "orderId",
+    OO.ORDER_NUMBER    "orderNumber",
+    ASO.SALE_NUMBER    "saleNumber",
+    RC.CAPACITY_NUMBER "capacityNumber",
+    OO.ORDER_ISSUE_TIME "orderIssueTime"
+    from OMSTRUCK_ORDER OO
+    left join AMS_SALE_ORDER_MATERIAL ASOM
+    on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
+    left join AMS_SALE_ORDER ASO
+    on ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
+    left join RMS_CAPACITY RC
+    on OO.CAPACITY_ID = RC.CAPACITY_ID
+    where OO.ORDER_ID in (select OO.ORDER_ID
+    from QMS_QUEUE_RESULT QQR
+    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
+    where QQR.RESULT_START_TIME is not null
+    and QQR.RESULT_END_TIME is null
+    and OO.ORDER_TYPE = 1)
+    )
+    <where>
+      <if test="orderNumber != null">
+        <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
+          "orderNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="saleNumber != null">
+        and
+        <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
+          "saleNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="driverName != null">
+        and
+        <foreach collection="driverName" item="item" open="(" separator="or" close=")">
+          "driverName" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="capacityNumber != null">
+        and
+        <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
+          "capacityNumber" like '%${item}%'
+        </foreach>
+      </if>
+    </where>
+    <include refid="orderBy"></include>
+    <if test="orderField == null  ">
+      order by "orderIssueTime" desc
+    </if>
+  </select>
 
-<!--    通过物资唯一编码 查找物资ID -->
-    <select id="getMaterialIdByMaterialCode" parameterType="string" resultType="java.math.BigDecimal">
-        select MATERIAL_ID
-        from RMS_MATERIAL_STEEL
-        where MATERIAL_ONLY_CODE = #{materialOnlyCode}
-    </select>
+  <!--    通过订单Id和物资Id确定唯一的装车实绩Id -->
+  <select id="getLoadIdByOrderIdAndMId" parameterType="java.util.Map" resultType="java.lang.Integer">
+    select TLR.RESULT_ID
+    from OMSTRUCK_ORDER OO
+           left join TMSTRUCK_TOTAL_RESULT TTR
+                     on TTR.ORDER_ID = OO.ORDER_ID
+           left join TMSTRUCK_LOAD_RESULT TLR
+                     on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+    where OO.ORDER_ID = #{orderId}
+      and TLR.MATERIAL_ID = #{materialId}
+  </select>
 
-<!--   查询所有正在进行进厂排队的销售订单  -->
-    <select id="getSaleOrderOnQueue" parameterType="java.util.Map" resultType="java.util.Map">
-        select *
-        from (
-                 select OO.ORDER_ID        "orderId",
-                        OO.ORDER_NUMBER    "orderNumber",
-                        ASO.SALE_NUMBER    "saleNumber",
-                        RC.CAPACITY_NUMBER "capacityNumber",
-                        OO.ORDER_ISSUE_TIME "orderIssueTime"
-                 from OMSTRUCK_ORDER OO
-                          left join AMS_SALE_ORDER_MATERIAL ASOM
-                                    on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
-                          left join AMS_SALE_ORDER ASO
-                                    on ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
-                          left join RMS_CAPACITY RC
-                                    on OO.CAPACITY_ID = RC.CAPACITY_ID
-                 where OO.ORDER_ID in (select OO.ORDER_ID
-                                       from QMS_QUEUE_RESULT QQR
-                                                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
-                                       where QQR.RESULT_START_TIME is not null
-                                         and QQR.RESULT_END_TIME is null
-                                         and OO.ORDER_TYPE = 1)
-             )
-        <where>
-            <if test="orderNumber != null">
-                <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
-                    "orderNumber" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="saleNumber != null">
-                and
-                <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
-                    "saleNumber" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="driverName != null">
-                and
-                <foreach collection="driverName" item="item" open="(" separator="or" close=")">
-                    "driverName" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="capacityNumber != null">
-                and
-                <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
-                    "capacityNumber" like '%${item}%'
-                </foreach>
-            </if>
-        </where>
-        <include refid="orderBy"></include>
-        <if test="orderField == null  ">
-            order by "orderIssueTime" desc
+  <!--  查询内转钢材到异地库装车实绩  -->
+  <select id="getSteelNzLoadResult" parameterType="java.util.Map" resultType="java.util.Map">
+    SELECT *
+    FROM (
+    select TLR.RESULT_ID                  "resultId",
+    AROD.DAYPLAN_NO                "dayplanNo",
+    OO.ORDER_NUMBER                "orderNumber",
+    RC.CAPACITY_NUMBER             "capacityNumber",
+    TLR.RESULT_LOAD_START_TIME     "resultLoadStartTime",
+    TLR.RESULT_LOAD_END_TIME       "resultLoadEndTime",
+    TLR.RESULT_LOAD_DURATION       "resultLoadDuration",
+    RSD.STANDARD_DATA_MIN          "standardDataMin",
+    RM.MATERIAL_NAME               "materialName",
+    OOM.ORDER_MATERIAL_NUMBER      "orderMaterialNumber",
+    RM.MATERIAL_THEORETICAL_WEIGHT "materialTheoreticalWeight",
+    RP.PERSONNEL_NAME              "personnelName"
+    from TMSTRUCK_LOAD_RESULT TLR
+    left join TMSTRUCK_TOTAL_RESULT TTR
+    ON TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+    LEFT JOIN OMSTRUCK_ORDER OO
+    ON OO.ORDER_ID = TTR.ORDER_ID
+    LEFT JOIN AMS_RAIL_OFFSET_DAYPLAN AROD
+    ON AROD.DAYPLAN_ID = OO.ORDER_PLAN_ID
+    LEFT JOIN RMS_CAPACITY RC
+    ON RC.CAPACITY_ID = OO.CAPACITY_ID
+    LEFT JOIN RMS_PERSONNEL RP
+    ON RP.PERSONNEL_ID = TLR.LOADER_ID
+    LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
+    ON OO.ORDER_ID = OOM.ORDER_ID AND OOM.MATERIAL_ID = TLR.MATERIAL_ID
+    LEFT JOIN RMS_MATERIAL RM
+    ON RM.MATERIAL_ID = OOM.MATERIAL_ID
+    LEFT JOIN RMS_STANDARD_DATA RSD
+    ON RSD.STANDARD_DATA_ID = TLR.LOAD_STANDARD_TIME_ID
+    WHERE OO.ORDER_TYPE = 4
+    AND TLR.RESULT_LOAD_START_TIME IS NOT NULL
+    AND TLR.STATUS = 0
+    )
+    <where>
+      <if test="dayplanNo != null">
+        <foreach collection="dayplanNo" item="item" open="(" separator="or" close=")">
+          "dayplanNo" like '%${item}%'
+        </foreach>
+        <if test="orderNumber != null">
+          and
+          <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
+            "orderNumber" like '%${item}%'
+          </foreach>
         </if>
-    </select>
-
-<!--    通过订单Id和物资Id确定唯一的装车实绩Id -->
-    <select id="getLoadIdByOrderIdAndMId" parameterType="java.util.Map" resultType="java.lang.Integer">
-        select TLR.RESULT_ID
-        from OMSTRUCK_ORDER OO
-        left join TMSTRUCK_TOTAL_RESULT TTR
-        on TTR.ORDER_ID = OO.ORDER_ID
-        left join TMSTRUCK_LOAD_RESULT TLR
-        on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-        where OO.ORDER_ID = #{orderId}
-          and TLR.MATERIAL_ID = #{materialId}
-    </select>
-
-<!--  查询内转钢材到异地库装车实绩  -->
-    <select id="getSteelNzLoadResult" parameterType="java.util.Map" resultType="java.util.Map">
-        SELECT *
-        FROM (
-                 select TLR.RESULT_ID                  "resultId",
-                        AROD.DAYPLAN_NO                "dayplanNo",
-                        OO.ORDER_NUMBER                "orderNumber",
-                        RC.CAPACITY_NUMBER             "capacityNumber",
-                        TLR.RESULT_LOAD_START_TIME     "resultLoadStartTime",
-                        TLR.RESULT_LOAD_END_TIME       "resultLoadEndTime",
-                        TLR.RESULT_LOAD_DURATION       "resultLoadDuration",
-                        RSD.STANDARD_DATA_MIN          "standardDataMin",
-                        RM.MATERIAL_NAME               "materialName",
-                        OOM.ORDER_MATERIAL_NUMBER      "orderMaterialNumber",
-                        RM.MATERIAL_THEORETICAL_WEIGHT "materialTheoreticalWeight",
-                        RP.PERSONNEL_NAME              "personnelName"
-                 from TMSTRUCK_LOAD_RESULT TLR
-                          left join TMSTRUCK_TOTAL_RESULT TTR
-                                    ON TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-                          LEFT JOIN OMSTRUCK_ORDER OO
-                                    ON OO.ORDER_ID = TTR.ORDER_ID
-                          LEFT JOIN AMS_RAIL_OFFSET_DAYPLAN AROD
-                                    ON AROD.DAYPLAN_ID = OO.ORDER_PLAN_ID
-                          LEFT JOIN RMS_CAPACITY RC
-                                    ON RC.CAPACITY_ID = OO.CAPACITY_ID
-                          LEFT JOIN RMS_PERSONNEL RP
-                                    ON RP.PERSONNEL_ID = TLR.LOADER_ID
-                          LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
-                                    ON OO.ORDER_ID = OOM.ORDER_ID AND OOM.MATERIAL_ID = TLR.MATERIAL_ID
-                          LEFT JOIN RMS_MATERIAL RM
-                                    ON RM.MATERIAL_ID = OOM.MATERIAL_ID
-                          LEFT JOIN RMS_STANDARD_DATA RSD
-                                    ON RSD.STANDARD_DATA_ID = TLR.LOAD_STANDARD_TIME_ID
-                 WHERE OO.ORDER_TYPE = 4
-                   AND TLR.RESULT_LOAD_START_TIME IS NOT NULL
-                   AND TLR.STATUS = 0
-             )
-        <where>
-            <if test="dayplanNo != null">
-                <foreach collection="dayplanNo" item="item" open="(" separator="or" close=")">
-                    "dayplanNo" like '%${item}%'
-                </foreach>
-                <if test="orderNumber != null">
-                    and
-                    <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
-                        "orderNumber" like '%${item}%'
-                    </foreach>
-                </if>
-                <if test="capacityNumber != null">
-                    and
-                    <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
-                        "capacityNumber" like '%${item}%'
-                    </foreach>
-                </if>
-                <if test="resultLoadStartTime != null">
-                    and
-                    <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
-                        "resultLoadStartTime" like '%${item}%'
-                    </foreach>
-                </if>
-                <if test="resultLoadEndTime != null">
-                    and
-                    <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
-                        "resultLoadEndTime" like '%${item}%'
-                    </foreach>
-                </if>
-                <if test="resultLoadDuration != null">
-                    and
-                    <foreach collection="resultLoadDuration" item="item" open="(" separator="or" close=")">
-                        "resultLoadDuration" like '%${item}%'
-                    </foreach>
-                </if>
-                <if test="standardDataMin != null">
-                    and
-                    <foreach collection="standardDataMin" item="item" open="(" separator="or" close=")">
-                        "standardDataMin" like '%${item}%'
-                    </foreach>
-                </if>
-                <if test="materialName != null">
-                    and
-                    <foreach collection="materialName" item="item" open="(" separator="or" close=")">
-                        "materialName" like '%${item}%'
-                    </foreach>
-                </if>
-                <if test="orderMaterialNumber != null">
-                    and
-                    <foreach collection="orderMaterialNumber" item="item" open="(" separator="or" close=")">
-                        "orderMaterialNumber" like '%${item}%'
-                    </foreach>
-                </if>
-                <if test="materialTheoreticalWeight != null">
-                    and
-                    <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
-                        "materialTheoreticalWeight" like '%${item}%'
-                    </foreach>
-                </if>
-                <if test="personnelName != null">
-                    and
-                    <foreach collection="personnelName" item="item" open="(" separator="or" close=")">
-                        "personnelName" like '%${item}%'
-                    </foreach>
-                </if>
-            </if>
-        </where>
-        <include refid="orderBy"></include>
-        <if test="orderField == null  ">
-            order by "resultLoadStartTime" desc
+        <if test="capacityNumber != null">
+          and
+          <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
+            "capacityNumber" like '%${item}%'
+          </foreach>
         </if>
-    </select>
-
-<!-- 查询内转进口矿/国产矿装车实绩   -->
-    <select id="getImportedDomesticNzLoadResult" parameterType="java.util.Map" resultType="java.util.Map">
-        SELECT
-               *
-        FROM (
-        SELECT APO.PURCHASE_ORDER_NO       "purchaseOrderNo",
-        RM.MATERIAL_NAME            "materialName",
-        DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
-        OO.ORDER_NUMBER             "orderNumber",
-        RC.CAPACITY_NUMBER          "capacityNumber",
-        OOM.ORDER_MATERIAL_WEIGHT   "orderMaterialWeight",
-        TLR.RESULT_LOAD_START_TIME  "resultLoadStartTime",
-        RW.WAREHOUSE_NAME           "warehouseName"
-        FROM TMSTRUCK_LOAD_RESULT TLR
-        LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
-        ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
-        LEFT JOIN OMSTRUCK_ORDER OO
-        ON OO.ORDER_ID = TTR.ORDER_ID
-        left join amstruck_inward_plan aip
-        on aip.plan_id = oo.order_plan_id
-        left join amstruck_requirement_plan arp
-        on arp.plan_id = aip.plan_id
-        left join amstruck_inward_requirement air
-        on air.requirement_id = arp.requirement_id
-        LEFT JOIN AMS_PURCHASE_ORDER APO
-        ON APO.PURCHASE_ORDER_ID = air.PURCHASE_ORDER_ID
-        LEFT JOIN DIL_BATCH DB
-        ON DB.BATCH_ID = APO.BATCH_ID
-        LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
-        ON OOM.ORDER_ID = OO.ORDER_ID
-        LEFT JOIN RMS_MATERIAL RM
-        ON RM.MATERIAL_ID = OOM.MATERIAL_ID
-        LEFT JOIN RMS_CAPACITY RC
-        ON RC.CAPACITY_ID = OO.CAPACITY_ID
-        LEFT JOIN RMS_WAREHOUSE RW
-        ON RW.WAREHOUSE_ID = TLR.LOADING_ID
-        WHERE OO.ORDER_TYPE =#{orderTypee}
-        AND TLR.RESULT_LOAD_START_TIME IS NOT NULL
-        order by tlr.result_load_end_time
-             )
-        <where>
-            <if test="purchaseOrderNo != null">
-                <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
-                    "purchaseOrderNo" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="materialName != null">
-                and
-                <foreach collection="materialName" item="item" open="(" separator="or" close=")">
-                    "materialName" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="resultForeignShipName != null">
-                and
-                <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
-                    "resultForeignShipName" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="orderNumber != null">
-                and
-                <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
-                    "orderNumber" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="capacityNumber != null">
-                and
-                <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
-                    "capacityNumber" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="orderMaterialWeight != null">
-                and
-                <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
-                    "orderMaterialWeight" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="resultLoadStartTime != null">
-                and
-                <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
-                    "resultLoadStartTime" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="warehouseName != null">
-                and
-                <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
-                    "warehouseName" like '%${item}%'
-                </foreach>
-            </if>
-        </where>
-        <include refid="orderBy"></include>
-        <if test="orderField == null  ">
-            order by "resultLoadStartTime" desc
+        <if test="resultLoadStartTime != null">
+          and
+          <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
+            "resultLoadStartTime" like '%${item}%'
+          </foreach>
+        </if>
+        <if test="resultLoadEndTime != null">
+          and
+          <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
+            "resultLoadEndTime" like '%${item}%'
+          </foreach>
+        </if>
+        <if test="resultLoadDuration != null">
+          and
+          <foreach collection="resultLoadDuration" item="item" open="(" separator="or" close=")">
+            "resultLoadDuration" like '%${item}%'
+          </foreach>
+        </if>
+        <if test="standardDataMin != null">
+          and
+          <foreach collection="standardDataMin" item="item" open="(" separator="or" close=")">
+            "standardDataMin" like '%${item}%'
+          </foreach>
+        </if>
+        <if test="materialName != null">
+          and
+          <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+            "materialName" like '%${item}%'
+          </foreach>
+        </if>
+        <if test="orderMaterialNumber != null">
+          and
+          <foreach collection="orderMaterialNumber" item="item" open="(" separator="or" close=")">
+            "orderMaterialNumber" like '%${item}%'
+          </foreach>
+        </if>
+        <if test="materialTheoreticalWeight != null">
+          and
+          <foreach collection="materialTheoreticalWeight" item="item" open="(" separator="or" close=")">
+            "materialTheoreticalWeight" like '%${item}%'
+          </foreach>
+        </if>
+        <if test="personnelName != null">
+          and
+          <foreach collection="personnelName" item="item" open="(" separator="or" close=")">
+            "personnelName" like '%${item}%'
+          </foreach>
         </if>
-    </select>
+      </if>
+    </where>
+    <include refid="orderBy"></include>
+    <if test="orderField == null  ">
+      order by "resultLoadStartTime" desc
+    </if>
+  </select>
 
-<!--  查询内转厂内物资装车实绩  -->
-    <select id="getInFactoryLoadResult" parameterType="java.util.Map" resultType="java.util.Map">
+  <!-- 查询内转进口矿/国产矿装车实绩   -->
+  <select id="getImportedDomesticNzLoadResult" parameterType="java.util.Map" resultType="java.util.Map">
+    SELECT
+    *
+    FROM (
+    SELECT APO.PURCHASE_ORDER_NO       "purchaseOrderNo",
+    RM.MATERIAL_NAME            "materialName",
+    OO.ORDER_NUMBER             "orderNumber",
+    RC.CAPACITY_NUMBER          "capacityNumber",
+    TLR.RESULT_LOAD_START_TIME   "resultLoadStartTime",
+    RW.WAREHOUSE_NAME           "warehouseName",
+    TLR.RESULT_LOAD_END_TIME   "resultLoadEndTime",
+    TLR.RESULT_LOAD_DURATION  "loadDuration"
+    FROM TMSTRUCK_LOAD_RESULT TLR
+    LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
+    ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
+    LEFT JOIN OMSTRUCK_ORDER OO
+    ON OO.ORDER_ID = TTR.ORDER_ID
+    left join amstruck_inward_plan aip
+    on aip.plan_id = oo.order_plan_id
+    left join amstruck_requirement_plan arp
+    on arp.plan_id = aip.plan_id
+    left join amstruck_inward_requirement air
+    on air.requirement_id = arp.requirement_id
+    LEFT JOIN AMS_PURCHASE_ORDER APO
+    ON APO.PURCHASE_ORDER_ID = air.PURCHASE_ORDER_ID
+    LEFT JOIN DIL_BATCH DB
+    ON DB.BATCH_ID = APO.BATCH_ID
+    LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
+    ON OOM.ORDER_ID = OO.ORDER_ID
+    LEFT JOIN RMS_MATERIAL RM
+    ON RM.MATERIAL_ID = OOM.MATERIAL_ID
+    LEFT JOIN RMS_CAPACITY RC
+    ON RC.CAPACITY_ID = OO.CAPACITY_ID
+    LEFT JOIN RMS_WAREHOUSE RW
+    ON RW.WAREHOUSE_ID = TLR.LOADING_ID
+    WHERE OO.ORDER_TYPE =10
+    AND TLR.RESULT_LOAD_START_TIME IS NOT NULL
+    <if test="userId !=null">
+      and AIR.INSERT_USERNAME = #{userId}
+    </if>
+    order by tlr.result_load_end_time
+    )
+    <where>
+      <if test="purchaseOrderNo != null">
+        <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
+          "purchaseOrderNo" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="materialName != null">
+        and
+        <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+          "materialName" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="orderNumber != null">
+        and
+        <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
+          "orderNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="capacityNumber != null">
+        and
+        <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
+          "capacityNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="resultLoadStartTime != null">
+        and
+        <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
+          "resultLoadStartTime" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="resultLoadEndTime != null">
+        and
+        <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
+          "resultLoadEndTime" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="warehouseName != null">
+        and
+        <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
+          "warehouseName" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="loadDuration != null">
+        and
+        <foreach collection="loadDuration" item="item" open="(" separator="or" close=")">
+          "loadDuration" like '%${item}%'
+        </foreach>
+      </if>
+    </where>
+    <include refid="orderBy"></include>
+    <if test="orderField == null  ">
+      order by "resultLoadStartTime" desc
+    </if>
+  </select>
 
-        SELECT *
-        FROM (
-                 SELECT RM.MATERIAL_NAME           "materialName",
-                        OO.ORDER_NUMBER            "orderNumber",
-                        RC.CAPACITY_NUMBER         "capacityNumber",
-                        OOM.ORDER_MATERIAL_NUMBER  "orderMaterialNumber",
-                        TLR.RESULT_LOAD_START_TIME "resultLoadStartTime",
-                        TLR.RESULT_LOAD_END_TIME   "resultLoadEndTime",
-                        TLR.RESULT_LOAD_DURATION   "resultLoadDuration",
-                        RW.WAREHOUSE_NAME          "warehouseName"
-                 FROM TMSTRUCK_LOAD_RESULT TLR
-                          LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
-                                    ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
-                          LEFT JOIN OMSTRUCK_ORDER OO
-                                    ON OO.ORDER_ID = TTR.ORDER_ID
-                          LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
-                                    ON OOM.ORDER_ID = OO.ORDER_ID
-                          LEFT JOIN RMS_MATERIAL RM
-                                    ON RM.MATERIAL_ID = OOM.MATERIAL_ID
-                          LEFT JOIN RMS_CAPACITY RC
-                                    ON RC.CAPACITY_ID = OO.CAPACITY_ID
-                          LEFT JOIN RMS_WAREHOUSE RW
-                                    ON RW.WAREHOUSE_ID = TLR.LOADING_ID
-                 WHERE OO.ORDER_TYPE = 11
-                   AND TLR.RESULT_LOAD_START_TIME IS NOT NULL
-        )
-        <where>
-            <if test="resultLoadEndTime != null">
-                <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
-                    "resultLoadEndTime" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="materialName != null">
-                and
-                <foreach collection="materialName" item="item" open="(" separator="or" close=")">
-                    "materialName" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="resultLoadDuration != null">
-                and
-                <foreach collection="resultLoadDuration" item="item" open="(" separator="or" close=")">
-                    "resultLoadDuration" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="orderNumber != null">
-                and
-                <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
-                    "orderNumber" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="capacityNumber != null">
-                and
-                <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
-                    "capacityNumber" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="orderMaterialWeight != null">
-                and
-                <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
-                    "orderMaterialWeight" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="resultLoadStartTime != null">
-                and
-                <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
-                    "resultLoadStartTime" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="warehouseName != null">
-                and
-                <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
-                    "warehouseName" like '%${item}%'
-                </foreach>
-            </if>
-        </where>
-        <include refid="orderBy"></include>
-        <if test="orderField == null  ">
-            order by "resultLoadStartTime" desc
-        </if>
+  <!--  查询内转厂内物资装车实绩  -->
+  <select id="getInFactoryLoadResult" parameterType="java.util.Map" resultType="java.util.Map">
+
+    SELECT *
+    FROM (
+    SELECT RM.MATERIAL_NAME           "materialName",
+    OO.ORDER_NUMBER            "orderNumber",
+    RC.CAPACITY_NUMBER         "capacityNumber",
+    OOM.ORDER_MATERIAL_NUMBER  "orderMaterialNumber",
+    TLR.RESULT_LOAD_START_TIME "resultLoadStartTime",
+    TLR.RESULT_LOAD_END_TIME   "resultLoadEndTime",
+    TLR.RESULT_LOAD_DURATION   "resultLoadDuration",
+    RW.WAREHOUSE_NAME          "warehouseName"
+    FROM TMSTRUCK_LOAD_RESULT TLR
+    LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
+    ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
+    LEFT JOIN OMSTRUCK_ORDER OO
+    ON OO.ORDER_ID = TTR.ORDER_ID
+    LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
+    ON OOM.ORDER_ID = OO.ORDER_ID
+    LEFT JOIN RMS_MATERIAL RM
+    ON RM.MATERIAL_ID = OOM.MATERIAL_ID
+    LEFT JOIN RMS_CAPACITY RC
+    ON RC.CAPACITY_ID = OO.CAPACITY_ID
+    LEFT JOIN RMS_WAREHOUSE RW
+    ON RW.WAREHOUSE_ID = TLR.LOADING_ID
+    WHERE OO.ORDER_TYPE = 11
+    AND TLR.RESULT_LOAD_START_TIME IS NOT NULL
+    )
+    <where>
+      <if test="resultLoadEndTime != null">
+        <foreach collection="resultLoadEndTime" item="item" open="(" separator="or" close=")">
+          "resultLoadEndTime" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="materialName != null">
+        and
+        <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+          "materialName" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="resultLoadDuration != null">
+        and
+        <foreach collection="resultLoadDuration" item="item" open="(" separator="or" close=")">
+          "resultLoadDuration" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="orderNumber != null">
+        and
+        <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
+          "orderNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="capacityNumber != null">
+        and
+        <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
+          "capacityNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="orderMaterialWeight != null">
+        and
+        <foreach collection="orderMaterialWeight" item="item" open="(" separator="or" close=")">
+          "orderMaterialWeight" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="resultLoadStartTime != null">
+        and
+        <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
+          "resultLoadStartTime" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="warehouseName != null">
+        and
+        <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
+          "warehouseName" like '%${item}%'
+        </foreach>
+      </if>
+    </where>
+    <include refid="orderBy"></include>
+    <if test="orderField == null  ">
+      order by "resultLoadStartTime" desc
+    </if>
 
-    </select>
-    <select id="getResultId" resultType="java.math.BigDecimal" parameterType="DeCimal">
-        select tlr.result_id "resultId" from tmstruck_load_result tlr
-        where tlr.result_total_id=#{totalId}
-    </select>
+  </select>
+  <select id="getResultId" resultType="java.math.BigDecimal" parameterType="DeCimal">
+    select tlr.result_id "resultId" from tmstruck_load_result tlr
+    where tlr.result_total_id=#{totalId}
+  </select>
 
-        <select id="getOrderType" resultType="java.lang.Integer">
-                select oo.order_type
-          from tmstruck_total_result ttr
-          left join omstruck_order oo
-            on oo.order_id = ttr.order_id
-         where ttr.result_total_id = #{totalId}
-        </select>
+  <select id="getOrderType" resultType="java.lang.Integer">
+    select oo.order_type
+    from tmstruck_total_result ttr
+           left join omstruck_order oo
+                     on oo.order_id = ttr.order_id
+    where ttr.result_total_id = #{totalId}
+  </select>
 
-    <!--    根据订单id查询所有的零星物资出厂实绩-->
-    <select id="getSporadicSuppliesLoadResult" resultType="java.util.Map">
-        select *
-        from (
-        select
-        TLR.RESULT_ID "resultId",
-        OO.ORDER_NUMBER "orderNumber",
-        RC.CAPACITY_NUMBER "capacityNumber",
-        TLR.RESULT_MEASURED_TONNAGE "resultMeasuredTonnage",
-        TLR.RESULT_ISCLEAR "resultIsclear",
-        to_char(TLR.RESULT_LOAD_START_TIME, 'yyyy-mm-dd') "resultLoadStartTime",
-        TLR.INSERT_UPDATE_REMARK "insertUpdateRemark",
-        TLR.INSERT_TIME "insertTime",
-        RM.MATERIAL_NAME "materialName",
-        OOM.ORDER_MATERIAL_NUMBER "materialNumber",
-        OOM.ORDER_MATERIAL_WEIGHT "materialWeight",
-        TWR.RESULT_NET_WEIGHT "netWeight"
-        from TMSTRUCK_LOAD_RESULT TLR
-        left join TMSTRUCK_TOTAL_RESULT TTR
-        on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-        left join TMSTRUCK_WEIGHT_RESULT TWR
-        on TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
-        left join OMSTRUCK_ORDER OO
-        on TTR.ORDER_ID = OO.ORDER_ID
-        left join OMSTRUCK_ORDER_MATERIAL OOM
-        on OOM.ORDER_ID=OO.ORDER_ID
-        left join RMS_MATERIAL RM
-        on RM.MATERIAL_ID = OOM.MATERIAL_ID
-        left join AMSTRUCK_SPORADIC_ORDER ASO
-        on OO.ORDER_PLAN_ID = ASO.SPORADIC_ORDER_ID
-        left join RMS_CAPACITY RC
-        on RC.CAPACITY_ID = OO.CAPACITY_ID
-        where TLR.STATUS = #{status} and OO.ORDER_TYPE = #{orderTypee}
-        )
-        <where>
-            <if test="orderNumber != null">
-                and
-                <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
-                    "orderNumber" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="capacityNumber != null">
-                and
-                <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
-                    "capacityNumber" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="resultIsclear != null">
-                and
-                <foreach collection="resultIsclear" item="item" open="(" separator="or" close=")">
-                    "resultIsclear" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="resultLoadStartTime != null">
-                and
-                <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
-                    "resultLoadStartTime" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="insertUpdateRemark != null">
-                and
-                <foreach collection="insertUpdateRemark" item="item" open="(" separator="or" close=")">
-                    "insertUpdateRemark" like '%${item}%'
-                </foreach>
-            </if>
-        </where>
-        <include refid="orderBy"></include>
-        <if test="orderField == null  ">
-            order by "resultLoadStartTime" desc
-        </if>
-    </select>
-<!--  获取采购内转装车实绩  -->
-    <select id="getCgNzLoadingResult" resultType="java.util.Map" parameterType="java.lang.Integer">
-          select *from ( select OO.ORDER_NUMBER              "orderNumber",
-                       OOM.ORDER_MATERIAL_WEIGHT    "orderMaterialWeight",
-                       OO.ORDER_RECEIVE_REFUSE_TIME "orderReceiveRefuseTime",
-                       RW.WAREHOUSE_NAME            "warehouseName",
-                       RM.MATERIAL_NAME             "materialName",
-                       RC.CAPACITY_NUMBER           "capacityNumber",
-                       RW2.WAREHOUSE_NAME           "warehouseName2",
-                       OO.INSERT_UPDATE_REMARK      "insertUpdateRemark",
-                       TTR.RESULT_TOTAL_ID          "resultTotalId"
-                  from OMSTRUCK_ORDER OO
-                  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 RMS_MATERIAL RM
-                    on RM.MATERIAL_ID = OOM.MATERIAL_ID
-                  left join RMS_WAREHOUSE RW
-                    on RW.WAREHOUSE_ID = OO.UNLOAD_POINT_ID
-                  left join TMSTRUCK_TOTAL_RESULT TTR
-                    on TTR.ORDER_ID = OO.ORDER_ID
-                  left join TMSTRUCK_LOAD_RESULT TLR
-                    on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-                  left join RMS_WAREHOUSE RW2
-                    on RW2.WAREHOUSE_ID = TLR.LOADING_ID
-                 where OO.ORDER_STATUS = #{orderStatus}
-                   and TLR.RESULT_LOAD_END_TIME IS NULL
-                   and OO.ORDER_TYPE = #{orderType})
-    </select>
+  <!--    根据订单id查询所有的零星物资出厂实绩-->
+  <select id="getSporadicSuppliesLoadResult" resultType="java.util.Map">
+    select *
+    from (
+    select
+    TLR.RESULT_ID "resultId",
+    OO.ORDER_NUMBER "orderNumber",
+    RC.CAPACITY_NUMBER "capacityNumber",
+    TLR.RESULT_MEASURED_TONNAGE "resultMeasuredTonnage",
+    TLR.RESULT_ISCLEAR "resultIsclear",
+    to_char(TLR.RESULT_LOAD_START_TIME, 'yyyy-mm-dd') "resultLoadStartTime",
+    TLR.INSERT_UPDATE_REMARK "insertUpdateRemark",
+    TLR.INSERT_TIME "insertTime",
+    RM.MATERIAL_NAME "materialName",
+    OOM.ORDER_MATERIAL_NUMBER "materialNumber",
+    OOM.ORDER_MATERIAL_WEIGHT "materialWeight",
+    TWR.RESULT_NET_WEIGHT "netWeight"
+    from TMSTRUCK_LOAD_RESULT TLR
+    left join TMSTRUCK_TOTAL_RESULT TTR
+    on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+    left join TMSTRUCK_WEIGHT_RESULT TWR
+    on TWR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
+    left join OMSTRUCK_ORDER OO
+    on TTR.ORDER_ID = OO.ORDER_ID
+    left join OMSTRUCK_ORDER_MATERIAL OOM
+    on OOM.ORDER_ID=OO.ORDER_ID
+    left join RMS_MATERIAL RM
+    on RM.MATERIAL_ID = OOM.MATERIAL_ID
+    left join AMSTRUCK_SPORADIC_ORDER ASO
+    on OO.ORDER_PLAN_ID = ASO.SPORADIC_ORDER_ID
+    left join RMS_CAPACITY RC
+    on RC.CAPACITY_ID = OO.CAPACITY_ID
+    where TLR.STATUS = #{status} and OO.ORDER_TYPE = #{orderTypee}
+    and TLR.RESULT_LOAD_START_TIME IS NOT NULL
+    <if test="userId!=null">
+      AND  ASO.INSERT_USERNAME=#{userId}
+    </if>
+    <if test="userIds!=null">
+      and ASO.UPDATE_USERNAME = #{userIds}
+    </if>
+    )
+    <where>
+      <if test="orderNumber != null">
+        and
+        <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
+          "orderNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="capacityNumber != null">
+        and
+        <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
+          "capacityNumber" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="resultIsclear != null">
+        and
+        <foreach collection="resultIsclear" item="item" open="(" separator="or" close=")">
+          "resultIsclear" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="resultLoadStartTime != null">
+        and
+        <foreach collection="resultLoadStartTime" item="item" open="(" separator="or" close=")">
+          "resultLoadStartTime" like '%${item}%'
+        </foreach>
+      </if>
+      <if test="insertUpdateRemark != null">
+        and
+        <foreach collection="insertUpdateRemark" item="item" open="(" separator="or" close=")">
+          "insertUpdateRemark" like '%${item}%'
+        </foreach>
+      </if>
+    </where>
+    <include refid="orderBy"></include>
+    <if test="orderField == null  ">
+      order by "resultLoadStartTime" desc
+    </if>
+  </select>
+  <!--  获取采购内转装车实绩  -->
+  <select id="getCgNzLoadingResult" resultType="java.util.Map" parameterType="java.lang.Integer">
+    select *from ( select OO.ORDER_NUMBER              "orderNumber",
+                          OOM.ORDER_MATERIAL_WEIGHT    "orderMaterialWeight",
+                          OO.ORDER_RECEIVE_REFUSE_TIME "orderReceiveRefuseTime",
+                          RW.WAREHOUSE_NAME            "warehouseName",
+                          RM.MATERIAL_NAME             "materialName",
+                          RC.CAPACITY_NUMBER           "capacityNumber",
+                          RW2.WAREHOUSE_NAME           "warehouseName2",
+                          OO.INSERT_UPDATE_REMARK      "insertUpdateRemark",
+                          TTR.RESULT_TOTAL_ID          "resultTotalId"
+                   from OMSTRUCK_ORDER OO
+                          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 RMS_MATERIAL RM
+                                    on RM.MATERIAL_ID = OOM.MATERIAL_ID
+                          left join RMS_WAREHOUSE RW
+                                    on RW.WAREHOUSE_ID = OO.UNLOAD_POINT_ID
+                          left join TMSTRUCK_TOTAL_RESULT TTR
+                                    on TTR.ORDER_ID = OO.ORDER_ID
+                          left join TMSTRUCK_LOAD_RESULT TLR
+                                    on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+                          left join RMS_WAREHOUSE RW2
+                                    on RW2.WAREHOUSE_ID = TLR.LOADING_ID
+                   where OO.ORDER_STATUS = #{orderStatus}
+                     and TLR.RESULT_LOAD_END_TIME IS NULL
+                     and OO.ORDER_TYPE = #{orderType})
+  </select>
 </mapper>

+ 1 - 1
src/main/resources/com/steerinfo/dil/mapper/TmstruckMeasureCommissionMapper.xml

@@ -802,7 +802,7 @@
                    )                                                                          "receiverNo",
                RM.MATERIAL_ID || ''                                                                "item",
                RM.MATERIAL_CODE                                                               "goodsNo",
-               CONCAT(RM.MATERIAL_NAME, CONCAT(RM.MATERIAL_SPECIFICATION, RM.MATERIAL_MODEL)) "goodsName",
+               CONCAT(RM.MATERIAL_NAME, CONCAT(RM.MATERIAL_SPECIFICATION, RM.MATERIAL_MODEL),'null') "goodsName",
                (case
                    when OOM.ORDER_MATERIAL_WEIGHT  is null
                     then 0

+ 1 - 3
src/main/resources/com/steerinfo/dil/mapper/TmstruckQualityResultMapper.xml

@@ -553,10 +553,8 @@
     on OO.ORDER_ID = TTR.ORDER_ID
     left join tmstruck_weight_result twr
     on twr.result_total_id = ttr.result_total_id
-    left join rms_driver_capacity rdc
-    on rdc.driver_capacity_id = OO.driver_capacity_id
     left join rms_capacity rc
-    on rc.capacity_id = rdc.capacity_id
+    on rc.capacity_id = oo.capacity_id
     left join amstruck_inward_plan aip
     on aip.plan_id = oo.order_plan_id
     left join amstruck_requirement_plan arp

+ 64 - 22
src/main/resources/com/steerinfo/dil/mapper/TmstruckUnloadResultMapper.xml

@@ -19,17 +19,18 @@
         <result column="RESULT_UNLOAD_PLACE_ID" jdbcType="DECIMAL" property="resultUnloadPlaceId" />
         <result column="SEGMENT_SQE" jdbcType="DECIMAL" property="segmentSqe" />
         <result column="MATERIAL_ID" jdbcType="DECIMAL" property="materialId" />
+        <result column="UNLOADER_ID" jdbcType="DECIMAL" property="unloaderId" />
     </resultMap>
     <sql id="columns">
-        RESULT_ID, RESULT_NUMBER, RESULT_TOTAL_ID, RESULT_START_TIME, RESULT_END_TIME, RESULT_DURATION,
-    UNLOAD_STATUS, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
-    DELETE_NAME, DELETE_TIME, RESULT_UNLOAD_PLACE_ID, SEGMENT_SQE, MATERIAL_ID
+        RESULT_ID, RESULT_NUMBER, RESULT_TOTAL_ID, RESULT_START_TIME, RESULT_END_TIME, RESULT_DURATION, 
+    UNLOAD_STATUS, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, 
+    DELETE_NAME, DELETE_TIME, RESULT_UNLOAD_PLACE_ID, SEGMENT_SQE, MATERIAL_ID, UNLOADER_ID
     </sql>
     <sql id="columns_alias">
-        t.RESULT_ID, t.RESULT_NUMBER, t.RESULT_TOTAL_ID, t.RESULT_START_TIME, t.RESULT_END_TIME,
-    t.RESULT_DURATION, t.UNLOAD_STATUS, t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME,
-    t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.DELETE_NAME, t.DELETE_TIME, t.RESULT_UNLOAD_PLACE_ID,
-    t.SEGMENT_SQE, t.MATERIAL_ID
+        t.RESULT_ID, t.RESULT_NUMBER, t.RESULT_TOTAL_ID, t.RESULT_START_TIME, t.RESULT_END_TIME, 
+    t.RESULT_DURATION, t.UNLOAD_STATUS, t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, 
+    t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.DELETE_NAME, t.DELETE_TIME, t.RESULT_UNLOAD_PLACE_ID, 
+    t.SEGMENT_SQE, t.MATERIAL_ID, t.UNLOADER_ID
     </sql>
     <sql id="select">
         SELECT <include refid="columns" /> FROM TMSTRUCK_UNLOAD_RESULT
@@ -90,6 +91,9 @@
             <if test="materialId != null">
                 and MATERIAL_ID = #{materialId}
             </if>
+            <if test="unloaderId != null">
+                and UNLOADER_ID = #{unloaderId}
+            </if>
         </where>
     </sql>
     <sql id="whereLike">
@@ -145,6 +149,9 @@
             <if test="materialId != null">
                 and MATERIAL_ID = #{materialId}
             </if>
+            <if test="unloaderId != null">
+                and UNLOADER_ID = #{unloaderId}
+            </if>
         </where>
     </sql>
     <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
@@ -202,6 +209,9 @@
         <if test="materialId != null">
             or MATERIAL_ID = #{materialId}
         </if>
+        <if test="unloaderId != null">
+            or UNLOADER_ID = #{unloaderId}
+        </if>
     </delete>
     <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckUnloadResult">
         insert into TMSTRUCK_UNLOAD_RESULT (RESULT_ID, RESULT_NUMBER, RESULT_TOTAL_ID,
@@ -209,13 +219,15 @@
                                             UNLOAD_STATUS, INSERT_USERNAME, INSERT_TIME,
                                             UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
                                             DELETE_NAME, DELETE_TIME, RESULT_UNLOAD_PLACE_ID,
-                                            SEGMENT_SQE, MATERIAL_ID)
+                                            SEGMENT_SQE, MATERIAL_ID, UNLOADER_ID
+        )
         values (#{resultId,jdbcType=DECIMAL}, #{resultNumber,jdbcType=VARCHAR}, #{resultTotalId,jdbcType=DECIMAL},
                 #{resultStartTime,jdbcType=TIMESTAMP}, #{resultEndTime,jdbcType=TIMESTAMP}, #{resultDuration,jdbcType=DECIMAL},
                 #{unloadStatus,jdbcType=VARCHAR}, #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
                 #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR},
                 #{deleteName,jdbcType=VARCHAR}, #{deleteTime,jdbcType=TIMESTAMP}, #{resultUnloadPlaceId,jdbcType=DECIMAL},
-                #{segmentSqe,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL})
+                #{segmentSqe,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL}, #{unloaderId,jdbcType=DECIMAL}
+               )
     </insert>
     <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckUnloadResult">
         insert into TMSTRUCK_UNLOAD_RESULT
@@ -271,6 +283,9 @@
             <if test="materialId != null">
                 MATERIAL_ID,
             </if>
+            <if test="unloaderId != null">
+                UNLOADER_ID,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="resultId != null">
@@ -324,6 +339,9 @@
             <if test="materialId != null">
                 #{materialId,jdbcType=DECIMAL},
             </if>
+            <if test="unloaderId != null">
+                #{unloaderId,jdbcType=DECIMAL},
+            </if>
         </trim>
     </insert>
     <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckUnloadResult">
@@ -343,7 +361,8 @@
             DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
             RESULT_UNLOAD_PLACE_ID = #{resultUnloadPlaceId,jdbcType=DECIMAL},
             SEGMENT_SQE = #{segmentSqe,jdbcType=DECIMAL},
-            MATERIAL_ID = #{materialId,jdbcType=DECIMAL}
+            MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
+            UNLOADER_ID = #{unloaderId,jdbcType=DECIMAL}
         where RESULT_ID = #{resultId,jdbcType=DECIMAL}
     </update>
     <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckUnloadResult">
@@ -397,6 +416,9 @@
             <if test="materialId != null">
                 MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
             </if>
+            <if test="unloaderId != null">
+                UNLOADER_ID = #{unloaderId,jdbcType=DECIMAL},
+            </if>
         </set>
         where RESULT_ID = #{resultId,jdbcType=DECIMAL}
     </update>
@@ -422,7 +444,8 @@
         UPDATE_USERNAME, UPDATE_TIME,
         INSERT_UPDATE_REMARK, DELETE_NAME,
         DELETE_TIME, RESULT_UNLOAD_PLACE_ID,
-        SEGMENT_SQE, MATERIAL_ID)
+        SEGMENT_SQE, MATERIAL_ID, UNLOADER_ID
+        )
         ( <foreach collection="list" item="item" separator="union all">
         select
         #{item.resultId,jdbcType=DECIMAL},
@@ -433,7 +456,8 @@
         #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
         #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.deleteName,jdbcType=VARCHAR},
         #{item.deleteTime,jdbcType=TIMESTAMP}, #{item.resultUnloadPlaceId,jdbcType=DECIMAL},
-        #{item.segmentSqe,jdbcType=DECIMAL}, #{item.materialId,jdbcType=DECIMAL} from dual
+        #{item.segmentSqe,jdbcType=DECIMAL}, #{item.materialId,jdbcType=DECIMAL}, #{item.unloaderId,jdbcType=DECIMAL}
+        from dual
     </foreach> )
     </insert>
     <update id="batchUpdate" parameterType="java.util.List">
@@ -507,6 +531,10 @@
         <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
             when #{item.resultId,jdbcType=DECIMAL} then #{item.materialId,jdbcType=DECIMAL}
         </foreach>
+        ,UNLOADER_ID=
+        <foreach close="end" collection="list" index="index" item="item" open="case RESULT_ID" separator=" ">
+            when #{item.resultId,jdbcType=DECIMAL} then #{item.unloaderId,jdbcType=DECIMAL}
+        </foreach>
         where RESULT_ID in
         <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
             #{item.resultId,jdbcType=DECIMAL}
@@ -763,12 +791,12 @@
     <select id="getImportedDomesticNzUnload2Result" parameterType="java.util.Map" resultType="java.util.Map">
         SELECT *
         FROM (     SELECT TUR.RESULT_ID         "resultId",
+        APO.PURCHASE_ORDER_NO "purchaseOrderNo",
         OO.ORDER_NUMBER       "orderNumber",
         RC.CAPACITY_NUMBER    "capacityNumber",
         RM.MATERIAL_NAME      "materialName",
-        TWR.RESULT_NET_WEIGHT "resultNetWeight",
         RW.WAREHOUSE_NAME     "warehouseName",
-        TUR.RESULT_END_TIME "resultEndTime"
+        TUR.RESULT_END_TIME   "resultEndTime"
         FROM TMSTRUCK_UNLOAD_RESULT TUR
         LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
         ON TTR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID
@@ -778,14 +806,23 @@
         ON RC.CAPACITY_ID = OO.CAPACITY_ID
         LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
         ON OOM.ORDER_ID = OO.ORDER_ID
+        left join amstruck_inward_plan aip
+        on aip.plan_id = oo.order_plan_id
+        left join amstruck_requirement_plan arp
+        on arp.plan_id = aip.plan_id
+        left join amstruck_inward_requirement air
+        on air.requirement_id = arp.requirement_id
+        LEFT JOIN AMS_PURCHASE_ORDER APO
+        ON APO.PURCHASE_ORDER_ID = air.PURCHASE_ORDER_ID
         LEFT JOIN RMS_MATERIAL RM
         ON RM.MATERIAL_ID = OOM.MATERIAL_ID
-        LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
-        ON TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
         LEFT JOIN RMS_WAREHOUSE RW
         ON RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
         WHERE TUR.RESULT_END_TIME IS NOT NULL
         AND OO.ORDER_TYPE = 10
+        <if test="userId !=null">
+            AND AIR.INSERT_USERNAME = #{userId}
+        </if>
         )
         <where>
             <if test="orderNumber != null">
@@ -793,6 +830,11 @@
                     "orderNumber" like '%${item}%'
                 </foreach>
             </if>
+            <if test="purchaseOrderNo != null">
+                <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
+                    "purchaseOrderNo" like '%${item}%'
+                </foreach>
+            </if>
             <if test="capacityNumber != null">
                 and
                 <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
@@ -805,12 +847,6 @@
                     "materialName" like '%${item}%'
                 </foreach>
             </if>
-            <if test="resultNetWeight != null">
-                and
-                <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
-                    "resultNetWeight" like '%${item}%'
-                </foreach>
-            </if>
             <if test="warehouseName != null">
                 and
                 <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
@@ -945,6 +981,12 @@
         ON RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
         WHERE TUR.RESULT_END_TIME IS NOT NULL
         AND OO.ORDER_TYPE = #{orderTypee}
+         <if test="userId != null">
+             and ASO.INSERT_USERNAME=#{userId}
+         </if>
+         <if test="userIds!=null">
+              and ASO.UPDATE_USERNAME=#{userIds}
+         </if>
         )
         <where>
             <if test="orderNumber != null">

+ 30 - 28
src/main/resources/com/steerinfo/dil/mapper/TmstruckWeightResultMapper.xml

@@ -1866,13 +1866,11 @@
         OO.ORDER_NUMBER              "orderNumber",
         RC.CAPACITY_NUMBER           "capacityNumber",
         RTC.TRUCK_CALCULATE_NUMBER   "truckCalculateNumber",
-        TWR.RESULT_GROSS_WEIGHT      "resultGrossWeight",
-        TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
-        DB.RESULT_FOREIGN_SHIP_NAME  "resultForeignShipName",
         TWR.RESULT_TARE_WEIGHT       "resultTareWeight",
         TWR.RESULT_TARE_WEIGHT_TIME  "resultTareWeightTime",
         TWR.RESULT_NET_WEIGHT        "resultNetWeight",
-        TWR.RESULT_POUND_NO          "resultPoundNo"
+        TWR.RESULT_POUND_NO          "resultPoundNo",
+        TWR.RESULT_NET_WEIGHT "netWeight"
         from TMSTRUCK_WEIGHT_RESULT TWR
         left join TMSTRUCK_TOTAL_RESULT TTR
         on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
@@ -1898,6 +1896,9 @@
         on RM.MATERIAL_ID = OOM.MATERIAL_ID
         where RESULT_TARE_WEIGHT_TIME is not null
         and OO.ORDER_TYPE = 10
+        <if test="userId!=null">
+            AND  air.INSERT_USERNAME =#{userId}
+        </if>
         )
         <where>
             <if test="purchaseOrderNo != null">
@@ -1929,24 +1930,6 @@
                     "truckCalculateNumber" like '%${item}%'
                 </foreach>
             </if>
-            <if test="resultGrossWeight != null">
-                and
-                <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
-                    "resultGrossWeight" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="resultForeignShipName != null">
-                and
-                <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
-                    "resultForeignShipName" like '%${item}%'
-                </foreach>
-            </if>
-            <if test="resultGrossWeightTime != null">
-                and
-                <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
-                    "resultGrossWeightTime" like '%${item}%'
-                </foreach>
-            </if>
             <if test="resultTareWeight != null">
                 and
                 <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
@@ -1986,7 +1969,6 @@
         APO.PURCHASE_ORDER_NO        "purchaseOrderNo",
         RM.MATERIAL_NAME             "materialName",
         OO.ORDER_NUMBER              "orderNumber",
-        DB.RESULT_FOREIGN_SHIP_NAME  "resultForeignShipName",
         RC.CAPACITY_NUMBER           "capacityNumber",
         RTC.TRUCK_CALCULATE_NUMBER   "truckCalculateNumber",
         TWR.RESULT_GROSS_WEIGHT      "resultGrossWeight",
@@ -2022,6 +2004,9 @@
         on rsr.shipper_id = APO.RECEIVE_UNIT_ID
         where RESULT_GROSS_WEIGHT_TIME is not null
         and OO.ORDER_TYPE = 10
+        <if test="userId !=null">
+            AND AIR.INSERT_USERNAME = #{userId}
+        </if>
         )
         <where>
             <if test="purchaseOrderNo != null">
@@ -2218,7 +2203,16 @@
         OO.ORDER_TYPE = #{orderType}
 =======
         OO.ORDER_TYPE = #{orderTypee}
+<<<<<<< HEAD
 >>>>>>> a082ab0bd9cb789ae91ca4beee53c86183d90b93
+=======
+            <if test="userId!=null">
+                and ASO.INSERT_USERNAME=#{userId}
+            </if>
+            <if test="usersId!=null">
+                and ASO.UPDATE_USERNAME=#{usersId}
+            </if>
+>>>>>>> 7bd59e0cef7eee5baa9af988be3ce17021536453
         )
         <where>
             <if test="purchaseOrderNo != null">
@@ -2295,7 +2289,8 @@
         on OOM.ORDER_ID = OO.ORDER_ID
         left join RMS_MATERIAL RM
         on RM.MATERIAL_ID = OOM.MATERIAL_ID
-        where RESULT_TARE_WEIGHT_TIME is not null and OO.ORDER_TYPE = 12
+        where RESULT_TARE_WEIGHT_TIME is not null
+              and OO.ORDER_TYPE = 12
         )
         <where>
             <if test="purchaseOrderNo != null">
@@ -2381,7 +2376,7 @@
         from (
         select
         TWR.WEIGHT_TASK_RESULT_ID "weightTaskResultId",
-        APO.SPORADIC_ORDER_NO "purchaseOrderNo",
+        ASO.SPORADIC_ORDER_NO "purchaseOrderNo",
         RM.MATERIAL_NAME "materialName",
         OO.ORDER_NUMBER "orderNumber",
         RC.CAPACITY_NUMBER "capacityNumber",
@@ -2397,8 +2392,8 @@
         on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
         left join OMSTRUCK_ORDER OO
         on TTR.ORDER_ID = OO.ORDER_ID
-        left join AMSTRUCK_SPORADIC_ORDER APO
-        on APO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
+        left join AMSTRUCK_SPORADIC_ORDER ASO
+        on ASO.SPORADIC_ORDER_ID = OO.ORDER_PLAN_ID
         left join RMS_CAPACITY RC
         on RC.CAPACITY_ID = OO.CAPACITY_ID
         left join RMS_TRUCK_CALCULATE RTC
@@ -2407,7 +2402,14 @@
         on OOM.ORDER_ID = OO.ORDER_ID
         left join RMS_MATERIAL RM
         on RM.MATERIAL_ID = OOM.MATERIAL_ID
-        where RESULT_TARE_WEIGHT_TIME is not null and OO.ORDER_TYPE = #{orderTypee}
+        where RESULT_TARE_WEIGHT_TIME is not null
+              and OO.ORDER_TYPE = #{orderTypee}
+        <if test="userId!=null">
+            and ASO.INSERT_USERNAME=#{userId}
+        </if>
+        <if test="userIds!=null">
+            and ASO.UPDATE_USERNAME=#{userIds}
+        </if>
         )
         <where>
             <if test="purchaseOrderNo != null">

+ 10 - 0
src/main/resources/com/steerinfo/dil/mapper/UtilsMapper.xml

@@ -168,4 +168,14 @@
         from OMSTRUCK_ORDER OO
         where OO.ORDER_ID = #{orderId}
     </select>
+
+    <!--  通过路段顺序号和线路ID查找 线路子表的子表的ID 和门岗ID或汽车衡ID   -->
+    <select id="getLineSegmentGateCalcId" parameterType="map" resultType="java.lang.Integer">
+        select
+            RLGC.GATE_CAL_ID "gateCalId"
+        from RMS_LINE_SEGEMNT RLS
+                 left join RMS_LINE_GATEPOST_CALCULATE RLGC
+                           on RLGC.SEGMENT_ID = RLS.SEGMENT_ID
+        where RLS.LINE_ID = #{lineId} and RLS.SEGMENT_SQE = #{segmentSqe}
+    </select>
 </mapper>