Przeglądaj źródła

Merge branch 'master' of https://git.steerinfo.com/DAL-DAZHOU1/DAL-QMS-API

liyg 2 lat temu
rodzic
commit
20250f63ed

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

@@ -0,0 +1,31 @@
+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 org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ author    :TXF
+ * @ time      :2021/10/8 19:07
+ */
+
+
+@FeignClient(value = "DIL-AMS-API-DEV", url = "${openfeign.AmsFeign.url}")
+public interface AmsFeign {
+
+    @PostMapping(value = "/api/v1/ams/amssaleorders/getHaveCarTruckNoList")
+    RESTfulResult getHaveCarTruckNoList(@RequestBody(required = false) Map<String, Object> mapValue,
+                                        @RequestParam Integer apiId,
+                                        @RequestParam Integer pageNum,
+                                        @RequestParam Integer pageSize,
+                                        @RequestParam String con,
+                                        @RequestParam String startTime,
+                                        @RequestParam String endTime);
+
+
+}

+ 25 - 0
src/main/java/com/steerinfo/dil/feign/DaZhouFeign.java

@@ -0,0 +1,25 @@
+package com.steerinfo.dil.feign;
+
+import com.steerinfo.framework.controller.RESTfulResult;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.Map;
+
+/**
+ * @ author    :TXF
+ * @ time      :2021/10/8 19:07
+ */
+
+
+@FeignClient(value = "DIL-DAZHOU-API-DEV", url = "${openfeign.DaZhouFeign.url}")
+public interface DaZhouFeign {
+
+    @GetMapping("/api/v1/uc/getSteelOrderNum")
+    RESTfulResult getSteelOrderNum();
+
+
+}

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

@@ -59,6 +59,11 @@ public interface QmsQueueListMapper extends IBaseMapper<QmsQueueList, BigDecimal
 
     Integer getListSequenceNumber(Map<String, Object> map);
 
+    //未扎/已轧
+    Map<String, Object> getSteelOrderMessageToApp(Integer orderId);
+
+    Integer getOrderId(String resultTotalId);
+
     Integer getSpellingSequenceNumber(Map<String, Object> map);
 
     Integer getListGridNumber(Map<String, Object> map);

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

@@ -177,4 +177,20 @@ public interface QmsQueueResultMapper extends IBaseMapper<QmsQueueResult, BigDec
      * @Description:查询已出厂数量(钢材)
      */
     int queryLeaveFactoryNumber();
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-10-27
+     * @Description:复刻出厂数
+    */
+    List<Map<String, Object>>   getCapacityByDefend(Map<String, Object> map);
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-10-28
+     * @Description:复刻进厂数
+    */
+    int getSteelOrderNum();
 }

+ 6 - 2
src/main/java/com/steerinfo/dil/service/impl/QmsQueueListServiceImpl.java

@@ -1,5 +1,6 @@
 package com.steerinfo.dil.service.impl;
 
+import com.steerinfo.dil.feign.AmsFeign;
 import com.steerinfo.dil.feign.LargeScreenFeign;
 import com.steerinfo.dil.mapper.*;
 import com.steerinfo.dil.model.QmsQueueResult;
@@ -57,6 +58,9 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
     @Autowired
     LargeScreenFeign largeScreenFeign;
 
+    @Autowired
+    AmsFeign amsFeign;
+
     @Autowired
     private QmsModelUnrooledMapper qmsModelUnrooledMapper;
 
@@ -443,7 +447,7 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
      * @Date:
      * @Description:做一个定时任务向两块大屏赋予值
      */
-    @Scheduled(cron = "0 */10 * * * ?")
+    @Scheduled(cron = "0 */5 * * * ?")
     public void sendDataToLargeCreen(){
         Map<String,Object> mapValue=new HashMap<>();
         List<Map<String, Object>> datalist =new ArrayList<>();
@@ -455,7 +459,7 @@ public class QmsQueueListServiceImpl implements IQmsQueueListService {
         HashSet<Map<String,Object>> set=new HashSet<>(queueListByQueueUpSpelling);
         //queueListByQueueUp=queueListByQueueUp.stream().distinct().collect(Collectors.toList());
         datalist.addAll(queueListByQueueUp);
-        queueListByQueueUpSpelling=queueListByQueueUpSpelling.stream().distinct().collect(Collectors.toList());
+        //queueListByQueueUpSpelling=queueListByQueueUpSpelling.stream().distinct().collect(Collectors.toList());
         datalist.addAll(set);
         System.out.println(datalist.toString());
         //更新大屏(钢材科与东门)

+ 68 - 11
src/main/java/com/steerinfo/dil/service/impl/QmsQueueResultServiceImpl.java

@@ -1,6 +1,7 @@
 package com.steerinfo.dil.service.impl;
 
 import com.steerinfo.dil.controller.QmsQueueResultController;
+import com.steerinfo.dil.feign.AmsFeign;
 import com.steerinfo.dil.feign.IMFeign;
 import com.steerinfo.dil.feign.LargeScreenFeign;
 import com.steerinfo.dil.mapper.QmsQueueListMapper;
@@ -13,9 +14,12 @@ import com.steerinfo.dil.mapper.QmsQueueResultMapper;
 import com.steerinfo.dil.service.IQmsQueueResultService;
 import com.steerinfo.dil.util.ElectronicFenceUtils;
 import com.steerinfo.framework.controller.RESTfulResult;
+import oracle.sql.DATE;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
+
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.math.BigDecimal;
 
@@ -56,6 +60,9 @@ public class QmsQueueResultServiceImpl implements IQmsQueueResultService {
     @Autowired
     private IMFeign imFeign;
 
+    @Autowired
+    AmsFeign amsFeign;
+
     @Autowired
     private QueueInterfaceMapper queueInterfaceMapper;
 
@@ -183,7 +190,16 @@ public class QmsQueueResultServiceImpl implements IQmsQueueResultService {
             }else {
                 num = qmsQueueListMapper.getSpellingSequenceNumber(map); //当前多拼队列排队人数
             }
-            map.put("orderSeqNum", num);
+            //获取是否已审批或者未轧/已轧
+            try{
+                //根据实绩主键去查询出运单主键
+                Integer orderId = qmsQueueListMapper.getOrderId(resultTotalId);
+                Map<String, Object> steelOrderMessageToApp = qmsQueueListMapper.getSteelOrderMessageToApp(orderId);
+                String capacityMessage = (String) steelOrderMessageToApp.get("capacityMessage");
+                map.put("orderSeqNum", num+capacityMessage);
+            }catch (Exception e){
+                e.printStackTrace();
+            }
             map.put("status", 2);
         }else {
             //还未排队
@@ -233,16 +249,57 @@ public class QmsQueueResultServiceImpl implements IQmsQueueResultService {
     */
     public Map<String,Object> getnumber(){
         Map<String,Object> map=new HashMap<>();
-        //查询出销售钢材的派车数
-        int SentCarNumber = qmsQueueResultMapper.querySentCarNumber();
-        //查询出销售钢材的进厂数
-        int IntoFactoryNumber=qmsQueueResultMapper.queryIntoFactoryNumber();
-        //查询出销售钢材的出厂数
-        int LeaveFactoryNumber=qmsQueueResultMapper.queryLeaveFactoryNumber();
-        map.put("sentCarNumber",SentCarNumber);
-        map.put("intoFactoryNumber",IntoFactoryNumber);
-        map.put("leaveFactoryNumber",LeaveFactoryNumber);
-        map.put("waitIntoFactoryNumber",SentCarNumber-IntoFactoryNumber);
+        try{
+            //查询出销售钢材的派车数
+            //1.先把时间状态改为时分秒清零的状态
+            Date now=new Date();
+            Calendar call=Calendar.getInstance();
+            call.setTime(now);
+            call.set(Calendar.HOUR_OF_DAY,0);
+            call.set(Calendar.MINUTE,0);
+            call.set(Calendar.SECOND,0);
+            call.set(Calendar.MILLISECOND,0);
+            Date date=call.getTime();
+            Map<String,Object> map1=new HashMap<>();
+            map1.put("oneDate",date);
+            map1.put("entity",date);
+            RESTfulResult haveCarTruckNoList = amsFeign.getHaveCarTruckNoList(map1, 466, null, null, null, null, null);
+            Map<String,Object> data = (Map<String, Object>) haveCarTruckNoList.getData();
+            List<Map<String,Object>> data1 = (List<Map<String, Object>>) data.get("list");
+            int SentCarNumber=0;
+            try {
+                for (int i=0;i<data1.size();i++){
+                    for (int j=i+1;j<data1.size();j++){
+                        if (data1.get(i).get("capacityNumber").equals(data1.get(j).get("capacityNumber"))){
+                            data1.remove(j);
+                            j--;
+                        }
+                    }
+                }
+                SentCarNumber=data1.size();
+            }catch (Exception e){
+                e.printStackTrace();
+            }
+            //int SentCarNumber = qmsQueueResultMapper.querySentCarNumber();
+            //int IntoFactoryNumber=qmsQueueResultMapper.queryIntoFactoryNumber();
+            //查询出销售钢材的进厂数(由于呼叫进厂页面的数据不止)
+            int IntoFactoryNumber = qmsQueueResultMapper.getSteelOrderNum();
+            //查询出销售钢材的出厂数
+            //先把时间格式化
+            SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String format = simpleDateFormat.format(date);
+            Map<String,Object> map2=new HashMap<>();
+            map2.put("oneDate",format);
+            List<Map<String, Object>> capacityByDefend = qmsQueueResultMapper.getCapacityByDefend(map2);
+            int LeaveFactoryNumber = capacityByDefend.size();
+            //int LeaveFactoryNumber=qmsQueueResultMapper.queryLeaveFactoryNumber();
+            map.put("sentCarNumber",SentCarNumber);
+            map.put("intoFactoryNumber",IntoFactoryNumber);
+            map.put("leaveFactoryNumber",LeaveFactoryNumber);
+            map.put("waitIntoFactoryNumber",SentCarNumber-IntoFactoryNumber-LeaveFactoryNumber);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
         return map;
     }
 

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

@@ -19,6 +19,10 @@ openfeign:
     url: ${IMFEIGN_URL:172.16.33.166:8055}
   LargeScreen:
     url: ${LARGESCREEN_URL:172.16.33.160:8064}
+  AmsFeign:
+    url: ${AMSFEIGN_URL:172.16.33.166:8079}
+  DaZhouFeign:
+    url: ${BMSTRUCKFEIGN_URL:172.16.33.166:8080}
 
 mvc:
   async:

+ 57 - 0
src/main/resources/com/steerinfo/dil/mapper/QmsQueueListMapper.xml

@@ -654,6 +654,63 @@
     )
   </select>
 
+  <select id="getSteelOrderMessageToApp" resultType="map">
+    SELECT
+    OO.ORDER_ID "orderId",
+    OO.ORDER_TYPE "orderType",
+    OO.ORDER_LINE_SEQUENCE "orderLineSequence",
+    OO.ORDER_NUMBER "orderNumber",
+    CASE
+    WHEN TEMP."orderId" IS NOT NULL
+    THEN '('|| decode(ASO.SALE_ORDER_STATUS,4,'订单已审核','订单未审核') || ':未轧' ||')'
+    WHEN TEMP."orderId" IS NULL
+    THEN '('|| decode(ASO.SALE_ORDER_STATUS,4,'订单已审核','订单未审核') || ':已轧' || ')'
+    END
+    "capacityMessage",
+    RC.CAPACITY_TEL "capacityTel",
+    RS.SHIPPER_NAME "shipperName",
+    ASOM.SALE_ORDER_CONSIGNEE_TEL "consigneeTel",
+    ASOM.SALE_DATE_OF_RECEIPT "saleDateOfReceipt",
+    RC2.CONSIGNEE_COMPANY_NAME "consigneeCompanyNames",
+    CONCAT(CONCAT( CONCAT( CONCAT( RDA.ADDRESS_PROVINCE, RDA.ADDRESS_DISTRICT ), RDA.ADDRESS_TOWN ),RDA.ADDRESS_DELIVERY_ADDRESS ),RRP.ADDRESS_DELIVERY_ADDRESS) "receiveAddressName",
+    TTR.RESULT_TOTAL_ID "resultTotalId",
+    OO.CAN_WORK "canWork",
+    OO.ORDER_STATUS "orderStatus",
+    ASO.SALE_ORDER_ID   "saleOrderId",
+    OO.DELETED  "orderDeleted"
+    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_SHIPPER RS ON RS.SHIPPER_ID = ASO.SHIPPER_ID
+    LEFT JOIN RMS_CONSIGNEE RC2 ON ASO.RECEIVE_ID = RC2.CONSIGNEE_ID
+    LEFT JOIN RMS_CAPACITY RC ON RC.CAPACITY_ID = OO.CAPACITY_ID
+    LEFT JOIN RMS_RECEIVE_PLACE RRP ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
+    LEFT JOIN RMS_RECEIVE_ADDRESS RDA ON RDA.ADDRESS_ID = RRP.ADDRESS_ID
+    LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON OO.ORDER_ID = TTR.ORDER_ID
+    LEFT JOIN (
+    select OO.ORDER_ID "orderId"
+        from OMSTRUCK_ORDER OO
+        left join OMSTRUCK_ORDER_MATERIAL OOM ON OO.ORDER_ID=OOM.ORDER_ID
+        left join RMS_MATERIAL RM ON OOM.MATERIAL_ID = RM.MATERIAL_ID
+        where OO.ORDER_STATUS in (4,5)
+        and (OOM.MATERIAL_PRIORITY !=71 OR OOM.MATERIAL_PRIORITY is null)
+        and
+        RM.MATERIAL_ID||'' in (select SPECTIONS_MODEL from QMS_MODEL_UNROOLED)
+    ) TEMP ON TEMP."orderId"=OO.ORDER_ID
+    WHERE
+    OO.ORDER_ID = #{orderId}
+    AND ASO.DELETED = 0
+    AND rownum =1
+  </select>
+
+  <select id="getOrderId" resultType="java.lang.Integer">
+     select OO.ORDER_ID from TMSTRUCK_TOTAL_RESULT TTR
+     LEFT JOIN OMSTRUCK_ORDER OO
+     ON OO.ORDER_ID=TTR.ORDER_ID
+     where TTR.RESULT_TOTAL_ID=#{resultTotalId}
+  </select>
+
   <select id="getSpellingSequenceNumber" parameterType="map" resultType="int">
     select COUNT(QQSL.SPELLING_RESULT_ID)
     from QMS_QUEUE_SPELLING_LIST QQSL

+ 68 - 11
src/main/resources/com/steerinfo/dil/mapper/QmsQueueResultMapper.xml

@@ -903,13 +903,12 @@
         </if>
         <if test="locationId != null">
             and QQL.GRID_ID = #{locationId}
-            ORDER BY QQL.ENTRY_SURE_TIME DESC, QQL.IS_VIP, "listNodeOrder"
+            ORDER BY "listNodeOrder",QQL.ENTRY_SURE_TIME DESC, QQL.IS_VIP
         </if>
         <if test="locationId == null">
-            ORDER BY QQL.ENTRY_SURE_TIME DESC, QQR.RESULT_START_TIME
+            ORDER BY "listNodeOrder",QQL.ENTRY_SURE_TIME DESC, QQL.IS_VIP ,QQR.RESULT_START_TIME
         </if>
         ) P0
-
     </select>
 
     <!--查询已派车车数-->
@@ -956,6 +955,57 @@
        and to_char(trunc(sysdate,'dd')+23/24+59/24/60+59/24/60/60,'yyyy-mm-dd hh24:mi:ss')
     </select>
 
+    <select id="getSteelOrderNum" resultType="java.lang.Integer">
+        SELECT
+            COUNT( * )
+        FROM
+            OMSTRUCK_ORDER OO
+                LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR.ORDER_ID = OO.ORDER_ID
+                LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR ON TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        WHERE
+            OO.ORDER_LINE_SEQUENCE >= 1
+          AND OO.ORDER_STATUS = 5
+          AND TLFR.RESULT_OUT_GATE_TIME IS NULL
+          AND OO.ORDER_TYPE = 1
+    </select>
+
+    <select id="getCapacityByDefend" resultType="java.util.Map" parameterType="java.util.Map">
+        select distinct * from(
+        select rc.CAPACITY_NUMBER "capacityNumber",
+        rc.CAPACITY_TEL "capacityTel",
+        oo.ORDER_NUMBER "orderNumber",
+        ter.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
+        rg1.GATEPOST_NAME "gatepostName1",
+        tlfr.RESULT_OUT_GATE_TIME "resultOutGateTime",
+        rg2.GATEPOST_NAME "gatepostName2",
+        rm.material_name "materialName"
+        from OMSTRUCK_ORDER oo
+        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 TMSTRUCK_TOTAL_RESULT ttr
+        on ttr.ORDER_ID = oo.ORDER_ID
+        left join TMSTRUCK_ENFACTORY_RESULT ter
+        on ter.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
+        left join RMS_GATEPOST rg1
+        on rg1.GATEPOST_ID = ter.GATEPOST_ID
+        left join TMSTRUCK_LEAVE_FACTORY_RESULT tlfr
+        on tlfr.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
+        left join RMS_GATEPOST rg2
+        on rg2.GATEPOST_ID = tlfr.GATEPOST_ID
+        <where>
+            <if test="oneDate != null">
+                and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = tlfr.RESULT_OUT_GATE_TIME
+                and oo.order_type=1
+            </if>
+        </where>
+        order by ter.RESULT_ENTRY_GATE_TIME desc
+        )
+    </select>
+
     <!--查询待进厂车数-->
     <update id="updateCancelResult" parameterType="com.steerinfo.dil.model.QmsQueueResult">
         update QMS_QUEUE_RESULT
@@ -1005,12 +1055,19 @@
             where oo.ORDER_STATUS = 5
               AND ASO.SALE_ORDER_STATUS = 4
               AND OO.ORDER_ID NOT IN (
-                    select OO.ORDER_ID
-                    from OMSTRUCK_ORDER OO
-                    left join OMSTRUCK_ORDER_MATERIAL OOM ON OO.ORDER_ID=OOM.ORDER_ID
-                    left join RMS_MATERIAL RM ON OOM.MATERIAL_ID = RM.MATERIAL_ID
-                    where OO.ORDER_STATUS=5 and
-                    RM.MATERIAL_ID||'' in (select SPECTIONS_MODEL from QMS_MODEL_UNROOLED)
+                     select
+                     OO.ORDER_ID
+                     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_MATERIAL ASM
+                     ON ASM.SALE_ORDER_ID=ASOM.SALE_ORDER_ID
+                     LEFT JOIN RMS_MATERIAL RM
+                     ON RM.MATERIAL_ID=ASM.MATERIAL_ID
+                     WHERE ASM.DELETED  != 0 or  ASM.DELETED is null
+                     AND OO.ORDER_TYPE=1
+                     AND OO.ORDER_STATUS=5
+                     and RM.MATERIAL_ID||'' in (select SPECTIONS_MODEL from QMS_MODEL_UNROOLED)
                   )
             <if test="capacityNumber != null">
                 and instr(RC.CAPACITY_NUMBER, #{capacityNumber}) > 0
@@ -1028,10 +1085,10 @@
             </if>
             <if test="locationId != null">
                 and QQSL.SPELILING_NUM  = #{locationId}
-                ORDER BY  QQSL.ENTRY_SURE_TIME DESC, QQSL.IS_VIP,  "listNodeOrder"
+                ORDER BY  "listNodeOrder", QQSL.ENTRY_SURE_TIME DESC, QQSL.IS_VIP
             </if>
             <if test="locationId == null">
-                ORDER BY QQSL.ENTRY_SURE_TIME DESC, QQR.RESULT_START_TIME
+                ORDER BY "listNodeOrder",QQSL.ENTRY_SURE_TIME DESC, QQR.RESULT_START_TIME,QQSL.IS_VIP
             </if>
     </select>