From bf28baa00838879c15a22decf314b6e76eb6e89b Mon Sep 17 00:00:00 2001
From: zyx <zyx123456>
Date: 星期四, 11 四月 2024 13:59:44 +0800
Subject: [PATCH] 输送线扫码时更细站点信息

---
 src/main/java/com/zy/core/thread/BarcodeThread.java               |   11 +
 src/main/java/com/zy/asrs/entity/AgvBasDevp.java                  |  309 ++++++++++++++++++++++++++++++++++++++++++++
 src/main/java/com/zy/asrs/service/impl/AgvBasDevpServiceImpl.java |   16 ++
 src/main/java/com/zy/asrs/mapper/AgvBasDevpMapper.java            |   17 ++
 src/main/java/com/zy/asrs/service/AgvBasDevpService.java          |   13 +
 5 files changed, 366 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/zy/asrs/entity/AgvBasDevp.java b/src/main/java/com/zy/asrs/entity/AgvBasDevp.java
new file mode 100644
index 0000000..99eb207
--- /dev/null
+++ b/src/main/java/com/zy/asrs/entity/AgvBasDevp.java
@@ -0,0 +1,309 @@
+package com.zy.asrs.entity;
+
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+import com.baomidou.mybatisplus.enums.IdType;
+import com.core.common.Cools;
+import com.core.common.SpringUtils;
+import com.zy.system.entity.User;
+import com.zy.system.service.UserService;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+@Data
+@TableName("agv_bas_devp")
+public class AgvBasDevp implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 缂栧彿
+     */
+    @ApiModelProperty(value= "缂栧彿")
+    @TableId(value = "dev_no", type = IdType.INPUT)
+    @TableField("dev_no")
+    private String devNo;
+
+    /**
+     * 宸ヤ綔绔欑紪鐮�
+     */
+    @ApiModelProperty(value= "缂栧彿")
+    @TableId(value = "station_code", type = IdType.INPUT)
+    @TableField("station_code")
+    private String stationCode;
+
+    /**
+     * 璁惧鎻忚堪
+     */
+    @ApiModelProperty(value= "璁惧鎻忚堪")
+    @TableField("dec_desc")
+    private String decDesc;
+
+    /**
+     * 澶囨敞
+     */
+    @ApiModelProperty(value= "澶囨敞")
+    @TableField("dev_mk")
+    private String devMk;
+
+    /**
+     * 鍙叆
+     */
+    @ApiModelProperty(value= "鍙叆")
+    @TableField("in_enable")
+    private String inEnable;
+
+    /**
+     * 鍙嚭
+     */
+    @ApiModelProperty(value= "鍙嚭")
+    @TableField("out_enable")
+    private String outEnable;
+
+    /**
+     * 鑷姩
+     */
+    @ApiModelProperty(value= "鑷姩")
+    private String autoing;
+
+    /**
+     * 鏈夌墿
+     */
+    @ApiModelProperty(value= "鏈夌墿")
+    private String loading;
+
+    /**
+     * 鑳藉叆
+     */
+    @ApiModelProperty(value= "鑳藉叆")
+    private String canining;
+
+    /**
+     * 鑳藉嚭
+     */
+    @ApiModelProperty(value= "鑳藉嚭")
+    private String canouting;
+
+    @ApiModelProperty(value= "")
+    private String fronting;
+
+    @ApiModelProperty(value= "")
+    private String rearing;
+
+    @ApiModelProperty(value= "")
+    private String uping;
+
+    @ApiModelProperty(value= "")
+    private String downing;
+
+    /**
+     * 闇�姹�1
+     */
+    @ApiModelProperty(value= "璐т綅鐘舵��")
+    private String locSts;
+
+    /**
+     * 鏄惁涓虹紦瀛樿揣鏋�
+     */
+    @ApiModelProperty(value= "鏄惁涓虹紦瀛樿揣鏋�")
+    private String cacheShelves;
+
+    /**
+     * 宸ヤ綔鍙�
+     */
+    @ApiModelProperty(value= "宸ヤ綔鍙�")
+    @TableField("wrk_no")
+    private Integer wrkNo;
+
+    /**
+     * 妤�
+     */
+    @ApiModelProperty(value= "妤�")
+    @TableField("floor")
+    private Integer floor;
+
+    /**
+     * 瀹瑰櫒绫诲瀷
+     */
+    @ApiModelProperty(value= "瀹瑰櫒绫诲瀷")
+    @TableField("ctn_type")
+    private Integer ctnType;
+
+    /**
+     * 鏉″舰鐮�
+     */
+    @ApiModelProperty(value= "鏉″舰鐮�")
+    private String barcode;
+
+    @ApiModelProperty(value= "")
+    @TableField("in_qty")
+    private Integer inQty;
+
+    @ApiModelProperty(value= "")
+    private Integer row1;
+
+    @ApiModelProperty(value= "")
+    @TableField("io_time")
+    private Date ioTime;
+
+    @ApiModelProperty(value= "")
+    private String area;
+
+    @ApiModelProperty(value= "")
+    @TableField("in_ok")
+    private String inOk;
+
+    @ApiModelProperty(value= "")
+    @TableField("out_ok")
+    private String outOk;
+
+    @ApiModelProperty(value= "楂樹綆绫诲瀷{0:鏈煡,1:浣庡簱浣�,2:楂樺簱浣峿")
+    @TableField("loc_type1")
+    private Short locType1;
+
+    @ApiModelProperty(value= "瀹界獎绫诲瀷{0:鏈煡,1:绐勫簱浣�,2:瀹藉簱浣峿")
+    @TableField("loc_type2")
+    private Short locType2;
+
+    @ApiModelProperty(value= "杞婚噸绫诲瀷{0:鏈煡,1:杞诲簱浣�,2:閲嶅簱浣峿")
+    @TableField("loc_type3")
+    private Short locType3;
+
+    /**
+     * 淇敼浜哄憳
+     */
+    @ApiModelProperty(value= "淇敼浜哄憳")
+    @TableField("modi_user")
+    private Long modiUser;
+
+    /**
+     * 淇敼鏃堕棿
+     */
+    @ApiModelProperty(value= "淇敼鏃堕棿")
+    @TableField("modi_time")
+    private Date modiTime;
+
+    /**
+     * 鍒涘缓鑰�
+     */
+    @ApiModelProperty(value= "鍒涘缓鑰�")
+    @TableField("appe_user")
+    private Long appeUser;
+
+    /**
+     * 娣诲姞鏃堕棿
+     */
+    @ApiModelProperty(value= "娣诲姞鏃堕棿")
+    @TableField("appe_time")
+    private Date appeTime;
+
+    @ApiModelProperty(value= "")
+    @TableField("std_qty")
+    private Double stdQty;
+
+    @ApiModelProperty(value= "")
+    @TableField("min_wt")
+    private Double minWt;
+
+    @ApiModelProperty(value= "")
+    @TableField("max_wt")
+    private Double maxWt;
+
+    /**
+     * 閲嶉噺
+     */
+    @ApiModelProperty(value= "閲嶉噺")
+    @TableField("gross_wt")
+    private Double grossWt;
+
+    @ApiModelProperty(value= "")
+    @TableField("cart_pos")
+    private Integer cartPos;
+
+    public String getIoTime$(){
+        if (Cools.isEmpty(this.ioTime)){
+            return "";
+        }
+        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.ioTime);
+    }
+
+    public String getLocType1$() {
+        if (null == this.locType1){ return null; }
+        switch (this.locType1){
+            case 0:
+                return "鏈煡";
+            case 1:
+                return "浣庡簱浣�";
+            case 2:
+                return "楂樺簱浣�";
+            default:
+                return String.valueOf(this.locType1);
+        }
+    }
+
+    public String getLocType2$() {
+        if (null == this.locType2){ return null; }
+        switch (this.locType2){
+            case 0:
+                return "鏈煡";
+            case 1:
+                return "绐勫簱浣�";
+            case 2:
+                return "瀹藉簱浣�";
+            default:
+                return String.valueOf(this.locType2);
+        }
+    }
+
+    public String getLocType3$() {
+        if (null == this.locType3){ return null; }
+        switch (this.locType3){
+            case 0:
+                return "鏈煡";
+            case 1:
+                return "杞诲簱浣�";
+            case 2:
+                return "閲嶅簱浣�";
+            default:
+                return String.valueOf(this.locType3);
+        }
+    }
+
+    public String getModiUser$(){
+        UserService service = SpringUtils.getBean(UserService.class);
+        User user = service.selectById(this.modiUser);
+        if (!Cools.isEmpty(user)){
+            return String.valueOf(user.getUsername());
+        }
+        return null;
+    }
+
+    public String getModiTime$(){
+        if (Cools.isEmpty(this.modiTime)){
+            return "";
+        }
+        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.modiTime);
+    }
+
+    public String getAppeUser$(){
+        UserService service = SpringUtils.getBean(UserService.class);
+        User user = service.selectById(this.appeUser);
+        if (!Cools.isEmpty(user)){
+            return String.valueOf(user.getUsername());
+        }
+        return null;
+    }
+
+    public String getAppeTime$(){
+        if (Cools.isEmpty(this.appeTime)){
+            return "";
+        }
+        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.appeTime);
+    }
+
+}
diff --git a/src/main/java/com/zy/asrs/mapper/AgvBasDevpMapper.java b/src/main/java/com/zy/asrs/mapper/AgvBasDevpMapper.java
new file mode 100644
index 0000000..93f79c3
--- /dev/null
+++ b/src/main/java/com/zy/asrs/mapper/AgvBasDevpMapper.java
@@ -0,0 +1,17 @@
+package com.zy.asrs.mapper;
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.zy.asrs.entity.AgvBasDevp;
+import org.apache.ibatis.annotations.*;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+@Repository
+public interface AgvBasDevpMapper extends BaseMapper<AgvBasDevp> {
+
+    @Update("update agv_bas_devp set barcode = #{barcode} where dev_no = #{devNo}")
+    public void updateBarcode(@Param("devNo") String devNo, @Param("barcode") String barcode);
+}
diff --git a/src/main/java/com/zy/asrs/service/AgvBasDevpService.java b/src/main/java/com/zy/asrs/service/AgvBasDevpService.java
new file mode 100644
index 0000000..72d2777
--- /dev/null
+++ b/src/main/java/com/zy/asrs/service/AgvBasDevpService.java
@@ -0,0 +1,13 @@
+package com.zy.asrs.service;
+
+import com.baomidou.mybatisplus.service.IService;
+import com.zy.asrs.entity.AgvBasDevp;
+
+import java.util.List;
+import java.util.Map;
+
+public interface AgvBasDevpService extends IService<AgvBasDevp> {
+
+    void updateBarcode(String devNo, String barcode);
+
+}
diff --git a/src/main/java/com/zy/asrs/service/impl/AgvBasDevpServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/AgvBasDevpServiceImpl.java
new file mode 100644
index 0000000..73151db
--- /dev/null
+++ b/src/main/java/com/zy/asrs/service/impl/AgvBasDevpServiceImpl.java
@@ -0,0 +1,16 @@
+package com.zy.asrs.service.impl;
+
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.zy.asrs.entity.AgvBasDevp;
+import com.zy.asrs.mapper.AgvBasDevpMapper;
+import com.zy.asrs.service.AgvBasDevpService;
+import org.springframework.stereotype.Service;
+
+@Service
+public class AgvBasDevpServiceImpl extends ServiceImpl<AgvBasDevpMapper, AgvBasDevp> implements AgvBasDevpService {
+
+    @Override
+    public void updateBarcode(String devNo, String barcode) {
+        this.baseMapper.updateBarcode(devNo,barcode);
+    }
+}
diff --git a/src/main/java/com/zy/core/thread/BarcodeThread.java b/src/main/java/com/zy/core/thread/BarcodeThread.java
index 2a8a648..8f4d102 100644
--- a/src/main/java/com/zy/core/thread/BarcodeThread.java
+++ b/src/main/java/com/zy/core/thread/BarcodeThread.java
@@ -3,12 +3,14 @@
 import com.alibaba.fastjson.JSONObject;
 import com.core.common.Cools;
 import com.core.common.DateUtils;
+import com.zy.asrs.service.AgvBasDevpService;
 import com.zy.core.News;
 import com.zy.core.Slave;
 import com.zy.core.ThreadHandler;
 import com.zy.core.cache.OutputQueue;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
@@ -34,6 +36,9 @@
     private DataInputStream dataInputStream;
     public Integer connCount = 0;
 
+    @Autowired
+    private AgvBasDevpService agvBasDevpService;
+
     public BarcodeThread(Slave slave) {
         this.slave = slave;
     }
@@ -47,6 +52,7 @@
         this.barcode.append(barcode);
         if(!Cools.isEmpty(barcode)) {
             News.info("{}鍙锋潯鐮佸櫒锛屾绱㈡暟鎹細{}", slave.getId(), this.barcode);
+
             JSONObject jsonObject = new JSONObject();
             jsonObject.put("time", DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmss_F));
             jsonObject.put("barcode", barcode);
@@ -55,6 +61,11 @@
                 OutputQueue.BARCODE.poll();
             }
             OutputQueue.BARCODE.offer(jsonObject);
+
+            String devNo = slave.getId() == 13 ? "310-1" : slave.getId() == 15 ? "312-2" : slave.getId() == 17 ? "314-1" : slave.getId() == 19 ? "316-1" : null;
+            if(!Cools.isEmpty(devNo)){
+                agvBasDevpService.updateBarcode(devNo,barcode);
+            }
         }
     }
 

--
Gitblit v1.9.1