Przeglądaj źródła

Merge branch 'dev' of https://git.steerinfo.com/DAL-DAZHOU1/DAL-TMS-TRUCK-API into dev

HUJIANGUO 3 lat temu
rodzic
commit
85455090e0

+ 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;

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

@@ -17,10 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @ author    :TXF
@@ -37,8 +34,9 @@ public class StatisticalReportController extends BaseRESTfulController {
     @Autowired
     ColumnDataUtil columnDataUtil;
 
-    private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+    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"),
@@ -57,7 +55,7 @@ public class StatisticalReportController extends BaseRESTfulController {
                                                Integer orderType
     ){
         mapValue.put("orderTypee", orderType);
-        DataChange.queryDataByDate(startTime, endTime, mapValue, sdf);//根据时间段查询数据
+        DataChange.queryDataByDate(startTime, endTime, mapValue, sdfDate);//根据时间段查询数据
         List<Map<String, Object>> allReport =  statisticalReportService.getAllPurchaseFLRLReport(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页数据
@@ -88,7 +86,7 @@ public class StatisticalReportController extends BaseRESTfulController {
                 mapValue.put("carrierSsoId", carrierSsoId);
             }
         }
-        DataChange.queryDataByDate(startTime, endTime, mapValue, sdf);//根据时间段查询数据
+        DataChange.queryDataByTwoDate(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
         List<Map<String, Object>> allReport =  statisticalReportService.getAllSaleReportNum(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页数据
@@ -123,7 +121,7 @@ public class StatisticalReportController extends BaseRESTfulController {
                 mapValue.put("carrierSsoId", carrierSsoId);
             }
         }
-        DataChange.queryDataByDate(startTime, endTime, mapValue, sdf);//根据时间段查询数据
+        DataChange.queryDataByDate(startTime, endTime, mapValue, sdfDate);//根据时间段查询数据
             if (userId!=null){
                 mapValue.put("userId",userId);
             }
@@ -170,7 +168,7 @@ public class StatisticalReportController extends BaseRESTfulController {
                 mapValue.put("carrierSsoId", carrierSsoId);
             }
         }
-        DataChange.queryDataByDate(startTime, endTime, mapValue, sdf);//根据时间段查询数据
+        DataChange.queryDataByDate(startTime, endTime, mapValue, sdfDate);//根据时间段查询数据
         if (con!=null&&!con.equals("undefined")){
             mapValue.put("con","%"+con+"%");
         }

+ 0 - 3
src/main/java/com/steerinfo/dil/controller/TmstruckEnfactoryResultController.java

@@ -109,9 +109,6 @@ public class TmstruckEnfactoryResultController extends BaseRESTfulController {
         return success(pageList);
     }
 
-
-
-
     @ApiOperation(value="通过PDA添加进厂实绩")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "mapValue", value = "门岗名称 运输订单号", required = false, dataType = "Map"),

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

@@ -6,6 +6,7 @@ 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;
 
 /**
@@ -30,10 +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 - 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);

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

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

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

@@ -65,6 +65,7 @@ public class TmstruckEnfactoryResultServiceImpl implements ITmstruckEnfactoryRes
         //添加主键
         tmstruckEnfactoryResult.setResultId(tmstruckEnfactoryResultMapper.selectMaxId());
         List<Integer> gatepostIdList = utilsMapper.getLineSegmentGateCalcId(map);
+        gatepostIdList.remove(null);
         //随机取门岗Id
         Integer gatepostId = utilsService.randomGetValue(gatepostIdList);
         //获取门岗ID

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

@@ -83,6 +83,7 @@ public class TmstruckLeaveFactoryResultServiceImpl implements ITmstruckLeaveFact
         BigDecimal resultTotalId = DataChange.dataToBigDecimal(map.get("resultTotalId"));
         tmstruckLeaveFactoryResult.setResultTotalId(resultTotalId);
         List<Integer> gatepostIdList = utilsMapper.getLineSegmentGateCalcId(map);
+        gatepostIdList.remove(null);
         //随机取门岗值
         Integer gatepostId = utilsService.randomGetValue(gatepostIdList);
         //获取门岗ID
@@ -156,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");
@@ -191,9 +193,18 @@ public class TmstruckLeaveFactoryResultServiceImpl implements ITmstruckLeaveFact
                 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:
@@ -210,8 +221,21 @@ 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;

+ 2 - 0
src/main/java/com/steerinfo/dil/service/impl/TmstruckWeightResultServiceImpl.java

@@ -77,6 +77,7 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
             map.put("segmentSqe", grossSegmentSqe);
             calculateList = utilsMapper.getLineSegmentGateCalcId(map);
             //取汽车衡的Id
+            calculateList.remove(null);
             calculateId = utilsService.randomGetValue(calculateList);
             tmstruckWeightResult.setResultGrossPlaceId(new BigDecimal(calculateId));
         }
@@ -85,6 +86,7 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
             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));
         }

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

@@ -167,7 +167,7 @@ public class UtilsServiceImpl implements IUtilsService {
 
 
     public int randomGetValue(List<Integer> dataList){
-        if(dataList.size() != 0){
+        if(dataList.size() != 0&&dataList !=null){
             if(dataList.size() == 1){
                 return dataList.get(0);
             }else {

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

@@ -167,7 +167,7 @@ public class DataChange {
     }
 
     /**
-     * 根据时间段查询数据
+     * 根据时间段查询数据 支持只选择单个时间
      * @Author TXF
      * @Date 2022/1/10 23:21
      * @param startTime
@@ -188,4 +188,25 @@ public class DataChange {
             map.put("oneDate", sdf.format(new Date()));
         }
     }
+
+    /**
+     * 只支持两个时间查询
+     * @Author TXF
+     * @Date 2022/1/15 9:08
+     * @param startTime
+     * @param endTime
+     * @param sdf
+     * @return
+     **/
+    public static void queryDataByTwoDate(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))));
+        }else {
+            //如果两者时间都为空,则查询当天数据
+            SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
+            String nowDate = sdfDate.format(new Date());
+            map.put("oneDate", nowDate + " 00:00:00");
+        }
+    }
 }

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

@@ -215,11 +215,11 @@
                               and RCA.CARRIER_SSO_ID = #{carrierSsoId}
                           </if>
                           <if test="oneDate != null">
-                              and to_char(TER.RESULT_ENTRY_GATE_TIME, 'YYYY-MM-DD') = #{oneDate}
+                              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') &lt;= TER.RESULT_ENTRY_GATE_TIME
-                              and to_date(#{endDate}, 'yyyy-mm-dd') >= TER.RESULT_ENTRY_GATE_TIME
+                              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>

+ 35 - 14
src/main/resources/com/steerinfo/dil/mapper/TmstruckEnfactoryResultMapper.xml

@@ -1238,18 +1238,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",
+        to_char(TER.RESULT_ENTRY_GATE_TIME, 'yyyy-mm-dd hh:mm:ss')   "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
@@ -1280,6 +1278,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">
@@ -1342,12 +1343,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",
+       to_char(TLFR.RESULT_OUT_GATE_TIME, 'yyyy-mm-dd hh:mm:ss')    "resultOutGateTime",
        TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture"
   from TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
   left join TMSTRUCK_TOTAL_RESULT TTR
@@ -1374,6 +1374,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>

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

@@ -1158,4 +1158,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>

+ 22 - 19
src/main/resources/com/steerinfo/dil/mapper/TmstruckLoadResultMapper.xml

@@ -1288,16 +1288,16 @@
 <!-- 查询内转进口矿/国产矿装车实绩   -->
     <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"
+        to_char(TLR.RESULT_LOAD_START_TIME, 'yyyy-mm-dd hh:mm:ss')   "resultLoadStartTime",
+        RW.WAREHOUSE_NAME           "warehouseName",
+        to_char(TLR.RESULT_LOAD_END_TIME, 'yyyy-mm-dd hh:mm:ss')  "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
@@ -1321,10 +1321,13 @@
         ON RC.CAPACITY_ID = OO.CAPACITY_ID
         LEFT JOIN RMS_WAREHOUSE RW
         ON RW.WAREHOUSE_ID = TLR.LOADING_ID
-        WHERE OO.ORDER_TYPE =#{orderTypee}
+        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=")">
@@ -1337,12 +1340,6 @@
                     "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=")">
@@ -1355,24 +1352,30 @@
                     "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="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  ">

+ 18 - 10
src/main/resources/com/steerinfo/dil/mapper/TmstruckUnloadResultMapper.xml

@@ -763,12 +763,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"
+        to_char(TUR.RESULT_END_TIME, 'yyyy-mm-dd hh:mm:ss')   "resultEndTime"
         FROM TMSTRUCK_UNLOAD_RESULT TUR
         LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
         ON TTR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID
@@ -778,14 +778,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 +802,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 +819,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=")">

+ 8 - 23
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">