瀏覽代碼

修改内转

Your Name 3 年之前
父節點
當前提交
36d97aa318

+ 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"),

+ 5 - 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;
 
 /**
@@ -36,4 +37,8 @@ public interface OmsFeign {
     // 远程调用查询销售订单所有信息
     @PostMapping("api/v1/oms/omstruckorderseparates/getSaleAllMessages")
     Map<String,Object> getSaleAllMessages(@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);

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

@@ -54,4 +54,9 @@ public interface TmstruckLeaveFactoryResultMapper extends IBaseMapper<TmstruckLe
 
     // 查询零星物资出厂列表
     List<Map<String,Object>> getSporadicLeaveFactory(Map<String, Object> mapValue);
+
+    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

+ 14 - 0
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
@@ -210,8 +211,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 {

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

@@ -39,7 +39,7 @@ openfeign:
   ImFeign:
     url: ${IMFEIGN_URL:172.16.33.166:8055}
   AmsFeign:
-    url: ${AMSFEIGN_URL:172.16.33.162:8015}
+    url: ${AMSFEIGN_URL:localhost:8015}
 
 server:
   port: 8008

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

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

+ 37 - 16
src/main/resources/com/steerinfo/dil/mapper/TmstruckEnfactoryResultMapper.xml

@@ -1193,9 +1193,9 @@
         left join RMS_CAPACITY RC
         on RC.CAPACITY_ID = OO.CAPACITY_ID
         WHERE OO.ORDER_TYPE = #{orderTypee} and TER.RESULT_ENTRY_GATE_TIME IS NOT NULL
-            <if test="userId">
+            `<if test="userId">
                and ASO.INSERT_USERNAME=#{userId}
-            </if>
+            </if>`
             <if test="userIds">
                and ASO.UPDATE_USERNAME=#{userIds}
             </if>
@@ -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>

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

@@ -1158,4 +1158,15 @@
         </where>
         <include refid="orderByOutTime"></include>
     </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">