From c6b18def7966c90f1e1d2f154b881f8f68fc2916 Mon Sep 17 00:00:00 2001
From: mrz <17966059@qq.com>
Date: Fri, 12 Aug 2022 12:31:45 +0800
Subject: [PATCH] 运单未放行指令记录优化

---
 src/main/java/com/sy/service/CommandLogService.java          | 21 +++++++++++++++++++++
 src/main/java/com/sy/service/impl/CommandLogImpl.java        | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 src/main/java/com/sy/service/impl/ResMessageServiceImpl.java |  6 ++++++
 3 files changed, 77 insertions(+), 1 deletion(-)

diff --git a/src/main/java/com/sy/service/CommandLogService.java b/src/main/java/com/sy/service/CommandLogService.java
index 0716fac..c4bc858 100644
--- a/src/main/java/com/sy/service/CommandLogService.java
+++ b/src/main/java/com/sy/service/CommandLogService.java
@@ -1,7 +1,28 @@
 package com.sy.service;
 
+import com.sy.model.GatherInfo;
+import com.sy.model.LAND_BUSINEESTYPE_LIST_INFO;
+import com.sy.model.LandBusinessTypeList;
 import com.sy.model.commandLog;
 
+import java.util.List;
+
 public interface CommandLogService {
     int insert(commandLog command);
+
+    /**
+     * 根据进出场信息写入日志
+     * @param info 过卡信息
+     * @param check 过卡状态
+     * @param reason 抬杆指令内容
+     * @param land 流转申请信息
+     * @param listInfos 流转单列表
+     * @param selfWt 车辆备案重量
+     * @param inWt 车辆入场重量
+     * @param goodsWt 车辆装载货物重量
+     * @param diffVal 进出场差值
+     */
+    public void commandlog(GatherInfo info, boolean check, String reason, LandBusinessTypeList land, List<LAND_BUSINEESTYPE_LIST_INFO> listInfos,
+                           Double selfWt,Double inWt,Double goodsWt,Double diffVal
+    );
 }
diff --git a/src/main/java/com/sy/service/impl/CommandLogImpl.java b/src/main/java/com/sy/service/impl/CommandLogImpl.java
index 999ef2b..911916b 100644
--- a/src/main/java/com/sy/service/impl/CommandLogImpl.java
+++ b/src/main/java/com/sy/service/impl/CommandLogImpl.java
@@ -1,17 +1,66 @@
 package com.sy.service.impl;
 
 import com.sy.mapper.commandLogMapper;
+import com.sy.model.GatherInfo;
+import com.sy.model.LAND_BUSINEESTYPE_LIST_INFO;
+import com.sy.model.LandBusinessTypeList;
 import com.sy.model.commandLog;
 import com.sy.service.CommandLogService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+import static com.sy.service.impl.ResMessageServiceImpl.toStrArry;
+
 @Service
 public class CommandLogImpl implements CommandLogService {
-    @Autowired
+    @Resource
     commandLogMapper mapper;
     @Override
     public int insert(commandLog command) {
         return mapper.insertSelective(command);
     }
+
+
+    @Override
+    public void commandlog(GatherInfo info, boolean check, String reason, LandBusinessTypeList land, List<LAND_BUSINEESTYPE_LIST_INFO> list_infos,
+                           Double selfWt,Double inWt,Double goodsWt,Double diffVal
+    ){
+        String flag="",type="";
+        commandLog command=new commandLog();
+        command.setId(UUID.randomUUID().toString());
+        command.setBarcode(info.getBarcode());
+        if(land!=null){
+            command.setBusnessType(land.getBusinesstype());
+        }
+        command.setAreaId(info.getAreaid());
+        command.setChnlNo(info.getChnlno());
+        if (check){
+            flag = "00";
+        } else{
+            flag = "11";
+        }
+        if("I".equals(info.getIetype())){
+            type="000000200000000000";
+        }else{
+            type="000000100000000000";
+        }
+        command.setReasonCode(flag+type);
+        command.setReasonText(reason);
+        command.setVeName(info.getVename());
+        command.setVeWeight(selfWt);
+        command.setIeType(info.getIetype());
+        command.setExitGrossWeight(info.getGrosswt().doubleValue());
+        command.setInGrossWeight(inWt);
+        command.setGoodsWeight(goodsWt);
+        command.setActualGoodsWeight(diffVal);
+        if(list_infos.size()>0){
+            command.setMasterList(Arrays.toString(toStrArry(list_infos)));
+        }
+        insert(command);
+    }
 }
diff --git a/src/main/java/com/sy/service/impl/ResMessageServiceImpl.java b/src/main/java/com/sy/service/impl/ResMessageServiceImpl.java
index ea60132..e73d3d1 100644
--- a/src/main/java/com/sy/service/impl/ResMessageServiceImpl.java
+++ b/src/main/java/com/sy/service/impl/ResMessageServiceImpl.java
@@ -4,6 +4,7 @@ import com.sy.mapper.RESMESSAGEMapper;
 import com.sy.model.GatherInfo;
 import com.sy.model.LAND_BUSINEESTYPE_LIST_INFO;
 import com.sy.model.RESMESSAGE;
+import com.sy.service.CommandLogService;
 import com.sy.service.ResMessageService;
 import com.sy.socket.CommandClient;
 import org.apache.log4j.Logger;
@@ -27,6 +28,9 @@ public class ResMessageServiceImpl implements ResMessageService {
     @Autowired
     private RESMESSAGEMapper mapper;
 
+    @Autowired
+    CommandLogService commandLogService;
+
 
     @Override
     public int saveEnter(RESMESSAGE resmessage){
@@ -71,6 +75,8 @@ public class ResMessageServiceImpl implements ResMessageService {
                 }
                 if (!noRelease.isEmpty()) {
                     logger.info(Arrays.toString(noRelease.toArray())+FANGXING);
+                    commandLogService.commandlog(info,false,Arrays.toString(noRelease.toArray())+FANGXING,null,list_infos,
+                            new Double("0.0"),new Double("0.0"),new Double("0.0"),new Double("0.0"));
                     CommandClient.Client(info, Arrays.toString(noRelease.toArray())+FANGXING);
                 }
             }
--
libgit2 0.24.0