From 1d8f4f462fc4be2437dbfa7ad9b5b503019a1193 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期二, 28 九月 2021 16:56:20 +0800
Subject: [PATCH] #

---
 src/main/java/zy/cloud/wms/common/service/erp/ErpScheduler.java |   22 +
 src/main/java/zy/cloud/wms/manager/mapper/MatCodeMapper.java    |   12 +
 src/main/java/zy/cloud/wms/manager/entity/MatCode.java          |  575 +++++++++++++++++++++++++++++++++++++++++++++++
 src/main/resources/mapper/MatCodeMapper.xml                     |   48 ++++
 src/main/java/zy/cloud/wms/manager/entity/Mat.java              |   46 +++
 5 files changed, 700 insertions(+), 3 deletions(-)

diff --git a/src/main/java/zy/cloud/wms/common/service/erp/ErpScheduler.java b/src/main/java/zy/cloud/wms/common/service/erp/ErpScheduler.java
index d131876..007dbcf 100644
--- a/src/main/java/zy/cloud/wms/common/service/erp/ErpScheduler.java
+++ b/src/main/java/zy/cloud/wms/common/service/erp/ErpScheduler.java
@@ -17,6 +17,7 @@
 import zy.cloud.wms.common.service.erp.entity.*;
 import zy.cloud.wms.common.utils.VersionUtils;
 import zy.cloud.wms.manager.entity.*;
+import zy.cloud.wms.manager.mapper.MatCodeMapper;
 import zy.cloud.wms.manager.mapper.TagMapper;
 import zy.cloud.wms.manager.service.*;
 import zy.cloud.wms.manager.utils.HttpHandler;
@@ -67,6 +68,9 @@
     private DocLogService docLogService;
     @Autowired
     private RequestLogService requestLogService;
+    @Autowired
+    private MatCodeMapper matCodeMapper;
+
 
     /**
      * 鍟嗗搧涓嬭浇
@@ -170,6 +174,7 @@
                     }
 
                     if (null == mat) {
+                        // 骞充粨
                         mat = new Mat(
                                 String.valueOf(data.getRec()),    // 缂栧彿
                                 null,    // 鎵�灞炲尯鍩�
@@ -195,8 +200,12 @@
                                 updateTime,    // 淇敼鏃堕棿
                                 null    // 澶囨敞
                         );
+
                         matService.insert(mat);
+                        // 绔嬪簱
+
                     } else {
+                        // 骞充粨
                         mat.setUuid(String.valueOf(data.getRec()));
                         mat.setMatnr(data.getUserCode());
                         mat.setMaktx(data.getFullName());
@@ -205,6 +214,8 @@
                         mat.setBarcode(data.getBarcode());
                         mat.setUnit(data.getUnit3());
                         matService.updateById(mat);
+                        // 绔嬪簱
+
                     }
                     log.info("====>> 鏇存柊鐗╂枡锛歿}", data.getUserCode());
                 }
@@ -341,7 +352,11 @@
                                 updateTime,    // 淇敼鏃堕棿
                                 null    // 澶囨敞
                         );
-                        matService.insert(mat);
+                        if (matService.insert(mat)) {
+                            MatCode matCode = mat.beMatCode();
+                            matCodeMapper.insert(matCode);
+                        }
+
                     } else {
                         mat.setUuid(String.valueOf(data.getRec()));
                         mat.setMatnr(data.getUserCode());
@@ -350,7 +365,10 @@
                         mat.setUpdateTime(updateTime);
                         mat.setBarcode(data.getBarcode());
                         mat.setUnit(data.getUnit3());
-                        matService.updateById(mat);
+                        if (matService.updateById(mat)) {
+                            MatCode matCode = mat.beMatCode();
+                            matCodeMapper.updateById(matCode);
+                        }
                     }
                     log.info("====>> 鏇存柊鐗╂枡锛歿}", data.getUserCode());
                 }
diff --git a/src/main/java/zy/cloud/wms/manager/entity/Mat.java b/src/main/java/zy/cloud/wms/manager/entity/Mat.java
index 3d3c4fb..b8004e1 100644
--- a/src/main/java/zy/cloud/wms/manager/entity/Mat.java
+++ b/src/main/java/zy/cloud/wms/manager/entity/Mat.java
@@ -173,6 +173,50 @@
     @ApiModelProperty(value= "澶囨敞")
     private String memo;
 
+    public MatCode beMatCode() {
+        Date date = new Date();
+        return new MatCode(
+                this.matnr,
+            null,    // 鏉$爜
+            this.maktx,    // 鍟嗗搧鍚嶇О
+            this.unit,    // 鐗╂枡鍗曚綅
+            this.specs,    // 瑙勬牸
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    //
+            null,    // 鍒涘缓鑰�
+            null,    // 娣诲姞鏃堕棿
+            null,    // 淇敼浜哄憳
+            date,    // 淇敼鏃堕棿
+            null    //
+        );
+    }
+
     public Mat() {}
 
     public Mat(String uuid,Long nodeId,Long tagId,String matnr,String maktx,String name,String specs,String model,String batch,String unit,String barcode,Long docId,String docNum,String custName,Integer itemNum,Integer count,Double weight,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) {
@@ -219,7 +263,7 @@
 //            null,    // 鍝侀」鏁�
 //            null,    // 搴撳瓨浣欓噺
 //            null,    // 閲嶉噺
-//            null,    // 
+//            null,    //
 //            null,    // 娣诲姞浜哄憳
 //            null,    // 娣诲姞鏃堕棿
 //            null,    // 淇敼浜哄憳
diff --git a/src/main/java/zy/cloud/wms/manager/entity/MatCode.java b/src/main/java/zy/cloud/wms/manager/entity/MatCode.java
new file mode 100644
index 0000000..afa6dda
--- /dev/null
+++ b/src/main/java/zy/cloud/wms/manager/entity/MatCode.java
@@ -0,0 +1,575 @@
+package zy.cloud.wms.manager.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 io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+@TableName("bas_mat_code")
+public class MatCode implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 鍟嗗搧缂栧彿
+     */
+    @ApiModelProperty(value= "鍟嗗搧缂栧彿")
+    @TableId(value = "mat_no", type = IdType.INPUT)
+    @TableField("mat_no")
+    private String matNo;
+
+    /**
+     * 鏉$爜
+     */
+    @ApiModelProperty(value= "鏉″舰鐮�")
+    private String barcode;
+
+    /**
+     * 鍟嗗搧鍚嶇О
+     */
+    @ApiModelProperty(value= "鍟嗗搧鍚嶇О")
+    @TableField("mat_name")
+    private String matName;
+
+    /**
+     * 鐗╂枡鍗曚綅
+     */
+    @ApiModelProperty(value= "鍗曚綅")
+    private String str1;
+
+    @ApiModelProperty(value= "瑙勬牸")
+    private String str2;
+
+    @ApiModelProperty(value= "鍝侀」鏁�")
+    private String str3;
+
+    @ApiModelProperty(value= "瀹㈡埛鍚嶇О")
+    private String str4;
+
+    @ApiModelProperty(value= "鍨嬪彿")
+    private String str5;
+
+    @ApiModelProperty(value= "鎵瑰彿")
+    private String str6;
+
+    @ApiModelProperty(value= "鍗曟嵁缂栧彿")
+    private String str7;
+
+    @ApiModelProperty(value= "")
+    private String str8;
+
+    @ApiModelProperty(value= "")
+    private String str9;
+
+    @ApiModelProperty(value= "")
+    private String str10;
+
+    @ApiModelProperty(value= "")
+    private String str11;
+
+    @ApiModelProperty(value= "")
+    private String str12;
+
+    @ApiModelProperty(value= "")
+    private String str13;
+
+    @ApiModelProperty(value= "")
+    private String str14;
+
+    @ApiModelProperty(value= "")
+    private String str15;
+
+    @ApiModelProperty(value= "")
+    private String str16;
+
+    @ApiModelProperty(value= "")
+    private String str17;
+
+    @ApiModelProperty(value= "")
+    private String str18;
+
+    @ApiModelProperty(value= "")
+    private String str19;
+
+    @ApiModelProperty(value= "")
+    private String str20;
+
+    @ApiModelProperty(value= "")
+    private String str21;
+
+    @ApiModelProperty(value= "")
+    private String str22;
+
+    @ApiModelProperty(value= "")
+    private String str23;
+
+    @ApiModelProperty(value= "閲嶉噺")
+    private Double num1;
+
+    @ApiModelProperty(value= "")
+    private Double num2;
+
+    @ApiModelProperty(value= "")
+    private Double num3;
+
+    @ApiModelProperty(value= "")
+    private Double num4;
+
+    @ApiModelProperty(value= "")
+    private Double num5;
+
+    @ApiModelProperty(value= "")
+    private Double num6;
+
+    @ApiModelProperty(value= "")
+    private Date date1;
+
+    /**
+     * 鍒涘缓鑰�
+     */
+    @ApiModelProperty(value= "鍒涘缓鑰�")
+    @TableField("appe_user")
+    private Long appeUser;
+
+    /**
+     * 娣诲姞鏃堕棿
+     */
+    @ApiModelProperty(value= "娣诲姞鏃堕棿")
+    @TableField("appe_time")
+    private Date appeTime;
+
+    /**
+     * 淇敼浜哄憳
+     */
+    @ApiModelProperty(value= "淇敼浜哄憳")
+    @TableField("modi_user")
+    private Long modiUser;
+
+    /**
+     * 淇敼鏃堕棿
+     */
+    @ApiModelProperty(value= "淇敼鏃堕棿")
+    @TableField("modi_time")
+    private Date modiTime;
+
+    @ApiModelProperty(value= "")
+    private Short status;
+
+    public MatCode() {}
+
+    public MatCode(String matnr, String barcode, String matName, String str1, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10, String str11, String str12, String str13, String str14, String str15, String str16, String str17, String str18, String str19, String str20, String str21, String str22, String str23, Double num1, Double num2, Double num3, Double num4, Double num5, Double num6, Date date1, Long appeUser, Date appeTime, Long modiUser, Date modiTime, Short status) {
+        this.matNo = matnr;
+        this.barcode = barcode;
+        this.matName = matName;
+        this.str1 = str1;
+        this.str2 = str2;
+        this.str3 = str3;
+        this.str4 = str4;
+        this.str5 = str5;
+        this.str6 = str6;
+        this.str7 = str7;
+        this.str8 = str8;
+        this.str9 = str9;
+        this.str10 = str10;
+        this.str11 = str11;
+        this.str12 = str12;
+        this.str13 = str13;
+        this.str14 = str14;
+        this.str15 = str15;
+        this.str16 = str16;
+        this.str17 = str17;
+        this.str18 = str18;
+        this.str19 = str19;
+        this.str20 = str20;
+        this.str21 = str21;
+        this.str22 = str22;
+        this.str23 = str23;
+        this.num1 = num1;
+        this.num2 = num2;
+        this.num3 = num3;
+        this.num4 = num4;
+        this.num5 = num5;
+        this.num6 = num6;
+        this.date1 = date1;
+        this.appeUser = appeUser;
+        this.appeTime = appeTime;
+        this.modiUser = modiUser;
+        this.modiTime = modiTime;
+        this.status = status;
+    }
+
+//    MatCode matCode = new MatCode(
+//            null,    // 鏉$爜
+//            null,    // 鍟嗗搧鍚嶇О
+//            null,    // 鐗╂枡鍗曚綅
+//            null,    // 瑙勬牸
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    //
+//            null,    // 鍒涘缓鑰�
+//            null,    // 娣诲姞鏃堕棿
+//            null,    // 淇敼浜哄憳
+//            null,    // 淇敼鏃堕棿
+//            null    //
+//    );
+
+    public String getMatNo() {
+        return matNo;
+    }
+
+    public void setMatNo(String matNo) {
+        this.matNo = matNo;
+    }
+
+    public String getBarcode() {
+        return barcode;
+    }
+
+    public void setBarcode(String barcode) {
+        this.barcode = barcode;
+    }
+
+    public String getMatName() {
+        return matName;
+    }
+
+    public void setMatName(String matName) {
+        this.matName = matName;
+    }
+
+    public String getStr1() {
+        return str1;
+    }
+
+    public void setStr1(String str1) {
+        this.str1 = str1;
+    }
+
+    public String getStr2() {
+        return str2;
+    }
+
+    public void setStr2(String str2) {
+        this.str2 = str2;
+    }
+
+    public String getStr3() {
+        return str3;
+    }
+
+    public void setStr3(String str3) {
+        this.str3 = str3;
+    }
+
+    public String getStr4() {
+        return str4;
+    }
+
+    public void setStr4(String str4) {
+        this.str4 = str4;
+    }
+
+    public String getStr5() {
+        return str5;
+    }
+
+    public void setStr5(String str5) {
+        this.str5 = str5;
+    }
+
+    public String getStr6() {
+        return str6;
+    }
+
+    public void setStr6(String str6) {
+        this.str6 = str6;
+    }
+
+    public String getStr7() {
+        return str7;
+    }
+
+    public void setStr7(String str7) {
+        this.str7 = str7;
+    }
+
+    public String getStr8() {
+        return str8;
+    }
+
+    public void setStr8(String str8) {
+        this.str8 = str8;
+    }
+
+    public String getStr9() {
+        return str9;
+    }
+
+    public void setStr9(String str9) {
+        this.str9 = str9;
+    }
+
+    public String getStr10() {
+        return str10;
+    }
+
+    public void setStr10(String str10) {
+        this.str10 = str10;
+    }
+
+    public String getStr11() {
+        return str11;
+    }
+
+    public void setStr11(String str11) {
+        this.str11 = str11;
+    }
+
+    public String getStr12() {
+        return str12;
+    }
+
+    public void setStr12(String str12) {
+        this.str12 = str12;
+    }
+
+    public String getStr13() {
+        return str13;
+    }
+
+    public void setStr13(String str13) {
+        this.str13 = str13;
+    }
+
+    public String getStr14() {
+        return str14;
+    }
+
+    public void setStr14(String str14) {
+        this.str14 = str14;
+    }
+
+    public String getStr15() {
+        return str15;
+    }
+
+    public void setStr15(String str15) {
+        this.str15 = str15;
+    }
+
+    public String getStr16() {
+        return str16;
+    }
+
+    public void setStr16(String str16) {
+        this.str16 = str16;
+    }
+
+    public String getStr17() {
+        return str17;
+    }
+
+    public void setStr17(String str17) {
+        this.str17 = str17;
+    }
+
+    public String getStr18() {
+        return str18;
+    }
+
+    public void setStr18(String str18) {
+        this.str18 = str18;
+    }
+
+    public String getStr19() {
+        return str19;
+    }
+
+    public void setStr19(String str19) {
+        this.str19 = str19;
+    }
+
+    public String getStr20() {
+        return str20;
+    }
+
+    public void setStr20(String str20) {
+        this.str20 = str20;
+    }
+
+    public String getStr21() {
+        return str21;
+    }
+
+    public void setStr21(String str21) {
+        this.str21 = str21;
+    }
+
+    public String getStr22() {
+        return str22;
+    }
+
+    public void setStr22(String str22) {
+        this.str22 = str22;
+    }
+
+    public String getStr23() {
+        return str23;
+    }
+
+    public void setStr23(String str23) {
+        this.str23 = str23;
+    }
+
+    public Double getNum1() {
+        return num1;
+    }
+
+    public void setNum1(Double num1) {
+        this.num1 = num1;
+    }
+
+    public Double getNum2() {
+        return num2;
+    }
+
+    public void setNum2(Double num2) {
+        this.num2 = num2;
+    }
+
+    public Double getNum3() {
+        return num3;
+    }
+
+    public void setNum3(Double num3) {
+        this.num3 = num3;
+    }
+
+    public Double getNum4() {
+        return num4;
+    }
+
+    public void setNum4(Double num4) {
+        this.num4 = num4;
+    }
+
+    public Double getNum5() {
+        return num5;
+    }
+
+    public void setNum5(Double num5) {
+        this.num5 = num5;
+    }
+
+    public Double getNum6() {
+        return num6;
+    }
+
+    public void setNum6(Double num6) {
+        this.num6 = num6;
+    }
+
+    public Date getDate1() {
+        return date1;
+    }
+
+    public String getDate1$(){
+        if (Cools.isEmpty(this.date1)){
+            return "";
+        }
+        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.date1);
+    }
+
+    public void setDate1(Date date1) {
+        this.date1 = date1;
+    }
+
+    public Long getAppeUser() {
+        return appeUser;
+    }
+
+
+    public void setAppeUser(Long appeUser) {
+        this.appeUser = appeUser;
+    }
+
+    public Date getAppeTime() {
+        return appeTime;
+    }
+
+    public String getAppeTime$(){
+        if (Cools.isEmpty(this.appeTime)){
+            return "";
+        }
+        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.appeTime);
+    }
+
+    public void setAppeTime(Date appeTime) {
+        this.appeTime = appeTime;
+    }
+
+    public Long getModiUser() {
+        return modiUser;
+    }
+
+
+    public void setModiUser(Long modiUser) {
+        this.modiUser = modiUser;
+    }
+
+    public Date getModiTime() {
+        return modiTime;
+    }
+
+    public String getModiTime$(){
+        if (Cools.isEmpty(this.modiTime)){
+            return "";
+        }
+        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.modiTime);
+    }
+
+    public void setModiTime(Date modiTime) {
+        this.modiTime = modiTime;
+    }
+
+    public Short getStatus() {
+        return status;
+    }
+
+    public void setStatus(Short status) {
+        this.status = status;
+    }
+
+
+}
diff --git a/src/main/java/zy/cloud/wms/manager/mapper/MatCodeMapper.java b/src/main/java/zy/cloud/wms/manager/mapper/MatCodeMapper.java
new file mode 100644
index 0000000..ee2ad12
--- /dev/null
+++ b/src/main/java/zy/cloud/wms/manager/mapper/MatCodeMapper.java
@@ -0,0 +1,12 @@
+package zy.cloud.wms.manager.mapper;
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+import zy.cloud.wms.manager.entity.MatCode;
+
+@Mapper
+@Repository
+public interface MatCodeMapper extends BaseMapper<MatCode> {
+
+}
diff --git a/src/main/resources/mapper/MatCodeMapper.xml b/src/main/resources/mapper/MatCodeMapper.xml
new file mode 100644
index 0000000..586b1a0
--- /dev/null
+++ b/src/main/resources/mapper/MatCodeMapper.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zy.asrs.mapper.MatCodeMapper">
+
+    <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+    <resultMap id="BaseResultMap" type="zy.cloud.wms.manager.entity.MatCode">
+        <result column="mat_no" property="matNo" />
+        <result column="barcode" property="barcode" />
+        <result column="mat_name" property="matName" />
+        <result column="str1" property="str1" />
+        <result column="str2" property="str2" />
+        <result column="str3" property="str3" />
+        <result column="str4" property="str4" />
+        <result column="str5" property="str5" />
+        <result column="str6" property="str6" />
+        <result column="str7" property="str7" />
+        <result column="str8" property="str8" />
+        <result column="str9" property="str9" />
+        <result column="str10" property="str10" />
+        <result column="str11" property="str11" />
+        <result column="str12" property="str12" />
+        <result column="str13" property="str13" />
+        <result column="str14" property="str14" />
+        <result column="str15" property="str15" />
+        <result column="str16" property="str16" />
+        <result column="str17" property="str17" />
+        <result column="str18" property="str18" />
+        <result column="str19" property="str19" />
+        <result column="str20" property="str20" />
+        <result column="str21" property="str21" />
+        <result column="str22" property="str22" />
+        <result column="str23" property="str23" />
+        <result column="num1" property="num1" />
+        <result column="num2" property="num2" />
+        <result column="num3" property="num3" />
+        <result column="num4" property="num4" />
+        <result column="num5" property="num5" />
+        <result column="num6" property="num6" />
+        <result column="date1" property="date1" />
+        <result column="appe_user" property="appeUser" />
+        <result column="appe_time" property="appeTime" />
+        <result column="modi_user" property="modiUser" />
+        <result column="modi_time" property="modiTime" />
+        <result column="status" property="status" />
+
+    </resultMap>
+
+</mapper>

--
Gitblit v1.9.1