ChenYang 1 vuosi sitten
vanhempi
commit
95def0feed
45 muutettua tiedostoa jossa 1272 lisäystä ja 322 poistoa
  1. BIN
      lib/RXTXcomm.jar
  2. BIN
      lib/jssc-2.8.0.jar
  3. BIN
      lib/modbus4j-3.0.5.jar
  4. BIN
      lib/rxtxParallel.dll
  5. BIN
      lib/rxtxSerial.dll
  6. 8 9
      pom.xml
  7. 56 33
      ruoyi-admin/pom.xml
  8. 0 10
      ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
  9. 14 17
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/base/BaseLocationInfoController.java
  10. 37 14
      ruoyi-admin/src/main/resources/application-dev.yml
  11. 34 14
      ruoyi-admin/src/main/resources/application-prod.yml
  12. 31 36
      ruoyi-admin/src/main/resources/application.yml
  13. 7 22
      ruoyi-admin/src/main/resources/banner.txt
  14. 20 0
      ruoyi-admin/src/test/java/com/ruoyi/admin/test/base/ExcelLocLotModel.java
  15. 202 0
      ruoyi-admin/src/test/java/com/ruoyi/admin/test/base/ProcessLocationTest.java
  16. 20 1
      ruoyi-common/pom.xml
  17. 55 0
      ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
  18. 5 1
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java
  19. 52 0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/ConvertUtils.java
  20. 18 0
      ruoyi-framework/pom.xml
  21. 2 3
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java
  22. 0 132
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java
  23. 33 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java
  24. 12 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/dao/BaseDao.java
  25. 109 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/service/BaseService.java
  26. 27 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/service/CrudService.java
  27. 35 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/service/bean/PageData.java
  28. 210 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/service/impl/BaseServiceImpl.java
  29. 72 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/service/impl/CrudServiceImpl.java
  30. 0 12
      warewms-ams/pom.xml
  31. 2 0
      warewms-ams/src/main/java/com/ruoyi/ams/inv/domain/InvLotAtt.java
  32. 2 3
      warewms-ams/src/main/java/com/ruoyi/ams/inv/mapper/InvLotLocIdMapper.java
  33. 7 0
      warewms-ams/src/main/java/com/ruoyi/ams/inv/service/IInvLotAttService.java
  34. 32 6
      warewms-ams/src/main/java/com/ruoyi/ams/inv/service/IInvLotLocIdService.java
  35. 20 0
      warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotAttServiceImpl.java
  36. 49 1
      warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotLocIdServiceImpl.java
  37. 2 2
      warewms-base/pom.xml
  38. 14 0
      warewms-base/src/main/java/com/ruoyi/base/domain/form/BaseLocationForm.java
  39. 2 1
      warewms-base/src/main/java/com/ruoyi/base/mapper/BaseLocationInfoMapper.java
  40. 3 1
      warewms-base/src/main/java/com/ruoyi/base/mapper/BaseSkuMapper.java
  41. 7 0
      warewms-base/src/main/java/com/ruoyi/base/service/IBaseLocationInfoService.java
  42. 7 0
      warewms-base/src/main/java/com/ruoyi/base/service/IBaseSkuService.java
  43. 14 2
      warewms-base/src/main/java/com/ruoyi/base/service/impl/BaseLocationInfoServiceImpl.java
  44. 8 0
      warewms-base/src/main/java/com/ruoyi/base/service/impl/BaseSkuServiceImpl.java
  45. 44 2
      warewms-hard/pom.xml

BIN
lib/RXTXcomm.jar


BIN
lib/jssc-2.8.0.jar


BIN
lib/modbus4j-3.0.5.jar


BIN
lib/rxtxParallel.dll


BIN
lib/rxtxSerial.dll


+ 8 - 9
pom.xml

@@ -23,8 +23,8 @@
         <bitwalker.version>1.21</bitwalker.version>
         <swagger.version>3.0.0</swagger.version>
         <kaptcha.version>2.3.2</kaptcha.version>
-        <mybatis-spring-boot.version>2.2.0</mybatis-spring-boot.version>
-        <pagehelper.boot.version>1.4.0</pagehelper.boot.version>
+        <mybatisplus.version>3.5.2</mybatisplus.version>
+        <pagehelper.boot.version>1.3.0</pagehelper.boot.version>
         <fastjson.version>1.2.79</fastjson.version>
         <oshi.version>5.8.6</oshi.version>
         <jna.version>5.10.0</jna.version>
@@ -50,6 +50,12 @@
                 <scope>import</scope>
             </dependency>
 
+            <dependency>
+                <groupId>com.baomidou</groupId>
+                <artifactId>mybatis-plus-boot-starter</artifactId>
+                <version>${mybatisplus.version}</version>
+            </dependency>
+
             <!-- 阿里数据库连接池 -->
             <dependency>
                 <groupId>com.alibaba</groupId>
@@ -64,13 +70,6 @@
                 <version>${bitwalker.version}</version>
             </dependency>
 
-            <!-- SpringBoot集成mybatis框架 -->
-            <dependency>
-                <groupId>org.mybatis.spring.boot</groupId>
-                <artifactId>mybatis-spring-boot-starter</artifactId>
-                <version>${mybatis-spring-boot.version}</version>
-            </dependency>
-
             <!-- pagehelper 分页插件 -->
             <dependency>
                 <groupId>com.github.pagehelper</groupId>

+ 56 - 33
ruoyi-admin/pom.xml

@@ -15,6 +15,11 @@
         web服务入口
     </description>
 
+    <properties>
+        <project.name>${project.artifactId}-release-${project.parent.version}</project.name>
+        <project.build.libUrl>${project.build.directory}/${project.name}/${project.name}/lib</project.build.libUrl>
+    </properties>
+
     <dependencies>
 
         <!-- spring-boot-devtools -->
@@ -92,35 +97,35 @@
 
     </dependencies>
 
-<!--    <build>-->
-<!--        <plugins>-->
-<!--            <plugin>-->
-<!--                <groupId>org.springframework.boot</groupId>-->
-<!--                <artifactId>spring-boot-maven-plugin</artifactId>-->
-<!--                <version>2.1.1.RELEASE</version>-->
-<!--                <configuration>-->
-<!--                    <fork>true</fork> &lt;!&ndash; 如果没有该配置,devtools不会生效 &ndash;&gt;-->
-<!--                </configuration>-->
-<!--                <executions>-->
-<!--                    <execution>-->
-<!--                        <goals>-->
-<!--                            <goal>repackage</goal>-->
-<!--                        </goals>-->
-<!--                    </execution>-->
-<!--                </executions>-->
-<!--            </plugin>-->
-<!--            <plugin>-->
-<!--                <groupId>org.apache.maven.plugins</groupId>-->
-<!--                <artifactId>maven-war-plugin</artifactId>-->
-<!--                <version>3.1.0</version>-->
-<!--                <configuration>-->
-<!--                    <failOnMissingWebXml>false</failOnMissingWebXml>-->
-<!--                    <warName>${project.artifactId}</warName>-->
-<!--                </configuration>-->
-<!--            </plugin>-->
-<!--        </plugins>-->
-<!--        <finalName>${project.artifactId}</finalName>-->
-<!--    </build>-->
+    <!--<build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.1.1.RELEASE</version>
+                <configuration>
+                    <fork>true</fork> &lt;!&ndash; 如果没有该配置,devtools不会生效 &ndash;&gt;
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <version>3.1.0</version>
+                <configuration>
+                    <failOnMissingWebXml>false</failOnMissingWebXml>
+                    <warName>${project.artifactId}</warName>
+                </configuration>
+            </plugin>
+        </plugins>
+        <finalName>${project.artifactId}</finalName>
+    </build>-->
 
     <build>
         <plugins>
@@ -161,6 +166,24 @@
                 </configuration>
             </plugin>
 
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <version>2.10</version>
+                <executions>
+                    <execution>
+                        <id>copy-dependencies</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${project.build.libUrl}</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
             <!-- 使用 mvn clean package 打包 更多配置可参考官司方文档:http://maven.apache.org/plugins/maven-assembly-plugin/single-mojo.html -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -176,11 +199,11 @@
 
                         <configuration>
                             <!-- 打包生成的文件名 -->
-                            <finalName>${project.artifactId}</finalName>
+                            <finalName>${project.name}</finalName>
                             <!-- jar 等压缩文件在被打包进入 zip、tar.gz 时是否压缩,设置为 false 可加快打包速度 -->
                             <recompressZippedFiles>false</recompressZippedFiles>
-                            <!-- 打包生成的文件是否要追加 release.xml 中定义的 id 值 -->
-                            <appendAssemblyId>true</appendAssemblyId>
+                            <!-- 打包生成的文件是否要追加 package.xml 中定义的 id 值 -->
+                            <appendAssemblyId>false</appendAssemblyId>
                             <!-- 指向打包描述文件 package.xml -->
                             <descriptors>
                                 <descriptor>package.xml</descriptor>
@@ -204,4 +227,4 @@
         </plugins>
     </build>
 
-</project>
+</project>

+ 0 - 10
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java

@@ -16,15 +16,5 @@ public class RuoYiApplication
     {
         // System.setProperty("spring.devtools.restart.enabled", "false");
         SpringApplication.run(RuoYiApplication.class, args);
-        System.out.println("(♥◠‿◠)ノ゙  若依启动成功   ლ(´ڡ`ლ)゙  \n" +
-                " .-------.       ____     __        \n" +
-                " |  _ _   \\      \\   \\   /  /    \n" +
-                " | ( ' )  |       \\  _. /  '       \n" +
-                " |(_ o _) /        _( )_ .'         \n" +
-                " | (_,_).' __  ___(_ o _)'          \n" +
-                " |  |\\ \\  |  ||   |(_,_)'         \n" +
-                " |  | \\ `'   /|   `-'  /           \n" +
-                " |  |  \\    /  \\      /           \n" +
-                " ''-'   `'-'    `-..-'              ");
     }
 }

+ 14 - 17
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/base/BaseLocationInfoController.java

@@ -1,25 +1,24 @@
 package com.ruoyi.web.controller.warewms.base;
 
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-import javax.websocket.server.PathParam;
-
-import com.ruoyi.base.domain.form.BasLocationForm;
+import com.ruoyi.base.domain.BaseLocationInfo;
+import com.ruoyi.base.domain.form.BaseLocationForm;
 import com.ruoyi.base.mapper.BaseLocationInfoMapper;
-import org.springframework.beans.BeanUtils;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import com.ruoyi.base.service.IBaseLocationInfoService;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.base.domain.BaseLocationInfo;
-import com.ruoyi.base.service.IBaseLocationInfoService;
 import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.page.TableDataInfo;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
 /**
  * 库位信息Controller
  *
@@ -72,12 +71,10 @@ public class BaseLocationInfoController extends BaseController {
     @PreAuthorize("@ss.hasPermi('base:locationInfo:add')")
     @Log(title = "库位信息", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody BasLocationForm basLocationForm) {
+    public AjaxResult add(@RequestBody BaseLocationForm baseLocationForm) {
         BaseLocationInfo baseLocationInfo = new BaseLocationInfo();
-        BeanUtils.copyProperties(basLocationForm, baseLocationInfo);
-        if (basLocationForm.getBindSku() != null) {
-            baseLocationInfo.setBindSku(String.join(",", basLocationForm.getBindSku()));
-        }
+        BeanUtils.copyProperties(baseLocationForm, baseLocationInfo);
+        baseLocationInfo.setBindSku(baseLocationForm.getSku());
         List<BaseLocationInfo> list = baseLocationInfoMapper.checkIsRepeat(baseLocationInfo);
         if (list != null && list.size() > 0) {
             return AjaxResult.error("库位编码不能重复");

+ 37 - 14
ruoyi-admin/src/main/resources/application-dev.yml

@@ -9,6 +9,7 @@ spring:
                 url: jdbc:mysql://47.100.220.92:3306/warewms-xuankuang?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
                 username: warewms
                 password: warewms123
+                driverClassName: com.mysql.cj.jdbc.Driver
             # 从库数据源
             slave:
                 # 从数据源开关/默认关闭
@@ -55,6 +56,28 @@ spring:
                 wall:
                     config:
                         multi-statement-allow: true
+    # redis 配置
+    redis:
+        # 地址
+        host: 154.12.20.200
+        # 端口,默认为6379
+        port: 6379
+        # 数据库索引
+        database: 0
+        # 密码
+        password:
+        # 连接超时时间
+        timeout: 10s
+        lettuce:
+            pool:
+                # 连接池中的最小空闲连接
+                min-idle: 0
+                # 连接池中的最大空闲连接
+                max-idle: 8
+                # 连接池的最大数据库连接数
+                max-active: 8
+                # #连接池最大阻塞等待时间(使用负值表示没有限制)
+                max-wait: -1ms
 
 # 日志配置
 logging:
@@ -68,17 +91,17 @@ init-task:
     aciservice: false # ndc通讯
 
 # modbus-tcp
-modbus:
-    tcp-master:
-        first: # 搅拌槽
-            open: true
-            host: localhost
-            port: 502
-        second: # 拆包机
-            open: false
-            host: localhost
-            port: 8080
-        third:
-            open: false
-            host: 192.168.100.71
-            port: 502
+#modbus:
+#    tcp-master:
+#        first: # 搅拌槽
+#            open: true
+#            host: localhost
+#            port: 502
+#        second: # 拆包机
+#            open: false
+#            host: localhost
+#            port: 8080
+#        third:
+#            open: false
+#            host: 192.168.100.71
+#            port: 502

+ 34 - 14
ruoyi-admin/src/main/resources/application-prod.yml

@@ -55,6 +55,34 @@ spring:
                 wall:
                     config:
                         multi-statement-allow: true
+    # redis 配置
+    redis:
+        # 地址
+        host: localhost
+        # 端口,默认为6379
+        port: 6379
+        # 数据库索引
+        database: 0
+        # 密码
+        password:
+        # 连接超时时间
+        timeout: 10s
+        lettuce:
+            pool:
+                # 连接池中的最小空闲连接
+                min-idle: 0
+                # 连接池中的最大空闲连接
+                max-idle: 8
+                # 连接池的最大数据库连接数
+                max-active: 8
+                # #连接池最大阻塞等待时间(使用负值表示没有限制)
+                max-wait: -1ms
+
+# 是否开启服务
+testtag:
+    autosend: true
+    aciservice: true
+    gsService: true
 
 # 日志配置
 logging:
@@ -62,26 +90,18 @@ logging:
         com.ruoyi: info
         org.springframework: info
 
-# 是否开启服务
-init-task:
-    autosend: true # 自动下发任务
-    aciservice: true # ndc通讯
-
 # modbus-tcp
 modbus:
     tcp-master:
         first: # 搅拌槽
             open: true
-            host: 192.168.100.130
+            host: localhost
             port: 502
         second: # 拆包机
-            open: true
-            host: 192.168.100.136
-            port: 502
+            open: false
+            host: localhost
+            port: 8080
         third:
-            open: true
+            open: false
             host: 192.168.100.71
-            port: 502
-
-
-
+            port: 502

+ 31 - 36
ruoyi-admin/src/main/resources/application.yml

@@ -3,7 +3,7 @@ ruoyi:
   # 名称
   name: RuoYi
   # 版本
-  version: 3.7.0
+  version: 3.8.1
   # 版权年份
   copyrightYear: 2021
   # 实例演示开关
@@ -50,46 +50,41 @@ spring:
     restart:
       # 热部署开关
       enabled: true
-  # redis 配置
-  redis:
-    # 地址
-    host: localhost
-    # 端口,默认为6379
-    port: 6379
-    # 数据库索引
-    database: 0
-    # 密码
-    password:
-    # 连接超时时间
-    timeout: 10s
-    lettuce:
-      pool:
-        # 连接池中的最小空闲连接
-        min-idle: 0
-        # 连接池中的最大空闲连接
-        max-idle: 8
-        # 连接池的最大数据库连接数
-        max-active: 8
-        # #连接池最大阻塞等待时间(使用负值表示没有限制)
-        max-wait: -1ms
+
 
 # token配置
 token:
-  # 令牌自定义标识
-  header: Authorization
-  # 令牌密钥
-  secret: abcdefghijklmnopqrstuvwxyz
-  # 令牌有效期(默认30分钟)
-  expireTime: 3000
+    # 令牌自定义标识
+    header: Authorization
+    # 令牌密钥
+    secret: abcdefghijklmnopqrstuvwxyz
+    # 令牌有效期(默认30分钟)
+    expireTime: 3000
 
 # MyBatis配置
-mybatis:
-  # 搜索指定包别名
-  typeAliasesPackage: com.ruoyi.**.domain
-  # 配置mapper的扫描,找到所有的mapper.xml映射文件
-  mapperLocations: classpath*:mapper/**/*Mapper.xml
-  # 加载全局的配置文件
-  configLocation: classpath:mybatis/mybatis-config.xml
+#mybatis
+mybatis-plus:
+  mapper-locations: classpath*:/mapper/**/*.xml,classpath:/META-INF/modeler-mybatis-mappings/*.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.ruoyi.**.entity,com.ruoyi.**.domain
+  global-config:
+    #数据库相关配置
+    db-config:
+      #主键类型
+      id-type: ASSIGN_ID
+    banner: false
+  #原生配置
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+    call-setters-on-nulls: true
+    jdbc-type-for-null: 'null'
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #开启sql日志
+  configuration-properties:
+    prefix:
+    blobType: BLOB
+    boolValue: TRUE
+
 
 # PageHelper分页插件
 pagehelper:

+ 7 - 22
ruoyi-admin/src/main/resources/banner.txt

@@ -1,24 +1,9 @@
 Application Version: ${ruoyi.version}
 Spring Boot Version: ${spring-boot.version}
-////////////////////////////////////////////////////////////////////
-//                          _ooOoo_                               //
-//                         o8888888o                              //
-//                         88" . "88                              //
-//                         (| ^_^ |)                              //
-//                         O\  =  /O                              //
-//                      ____/`---'\____                           //
-//                    .'  \\|     |//  `.                         //
-//                   /  \\|||  :  |||//  \                        //
-//                  /  _||||| -:- |||||-  \                       //
-//                  |   | \\\  -  /// |   |                       //
-//                  | \_|  ''\---/''  |   |                       //
-//                  \  .-\__  `-`  ___/-. /                       //
-//                ___`. .'  /--.--\  `. . ___                     //
-//              ."" '<  `.___\_<|>_/___.'  >'"".                  //
-//            | | :  `- \`.;`\ _ /`;.`/ - ` : | |                 //
-//            \  \ `-.   \_ __\ /__ _/   .-` /  /                 //
-//      ========`-.____`-.___\_____/___.-`____.-'========         //
-//                           `=---='                              //
-//      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        //
-//             佛祖保佑       永不宕机      永无BUG               //
-////////////////////////////////////////////////////////////////////
+ __   __  ___       __        _______    _______      __   __  ___  ___      ___   ________
+|"  |/  \|  "|     /""\      /"      \  /"     "|    |"  |/  \|  "||"  \    /"  | /"       )
+|'  /    \:  |    /    \    |:        |(: ______)    |'  /    \:  | \   \  //   |(:   \___/
+|: /'        |   /' /\  \   |_____/   ) \/    |      |: /'        | /\\  \/.    | \___  \
+ \//  /\'    |  //  __'  \   //      /  // ___)_      \//  /\'    ||: \.        |  __/  \\
+ /   /  \\   | /   /  \\  \ |:  __   \ (:      "|     /   /  \\   ||.  \    /:  | /" \   :)
+|___/    \___|(___/    \___)|__|  \___) \_______)    |___/    \___||___|\__/|___|(_______/

+ 20 - 0
ruoyi-admin/src/test/java/com/ruoyi/admin/test/base/ExcelLocLotModel.java

@@ -0,0 +1,20 @@
+package com.ruoyi.admin.test.base;
+
+
+import com.ruoyi.common.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class ExcelLocLotModel implements Serializable {
+
+    @Excel(name = "库位号(例:A-01-02)")
+    private String locationNo;
+
+    @Excel(name = "绑定的物料号(例:C4H9O2PSSNH4)")
+    private String bindSku;
+
+    @Excel(name = "数量(例:50.00)")
+    private String quantity;
+}

+ 202 - 0
ruoyi-admin/src/test/java/com/ruoyi/admin/test/base/ProcessLocationTest.java

@@ -0,0 +1,202 @@
+package com.ruoyi.admin.test.base;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.comparator.CompareUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.datatype.jsr310.DecimalUtils;
+import com.ruoyi.RuoYiApplication;
+import com.ruoyi.ams.inv.domain.InvLotLocId;
+import com.ruoyi.ams.inv.service.IInvLotAttService;
+import com.ruoyi.ams.inv.service.IInvLotLocIdService;
+import com.ruoyi.base.domain.BaseLocationInfo;
+import com.ruoyi.base.domain.BaseSku;
+import com.ruoyi.base.service.IBaseLocationInfoService;
+import com.ruoyi.base.service.IBaseSkuService;
+import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.utils.StringUtils;
+import io.netty.util.internal.StringUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.compress.utils.Lists;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.util.Assert;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: andy.qu
+ * Date: 2022/2/9
+ */
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = RuoYiApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@Slf4j
+public class ProcessLocationTest {
+
+    private static final String FREE = "00";
+    @Autowired
+    private IBaseLocationInfoService baseLocationInfoService;
+
+
+    @Autowired
+    private IInvLotAttService invLotAttService;
+
+    @Autowired
+    private IInvLotLocIdService invLotLocIdService;
+
+
+    @Autowired
+    private IBaseSkuService baseSkuService;
+
+    //仓库ID的默认值
+    private static final Long WAREHOUSE_ID = 1L;
+
+
+    /**
+     * 选矿项目调整库存专用脚本
+     *
+     * @author ChenYang
+     */
+    @Test
+    public void handleLoacationInventory() throws Exception {
+
+        //1.获取物料号(sku)和物料类型(type)的映射
+        List<BaseSku> skuList = baseSkuService.querySkuList();
+        Map<String, String> skuTypeMapping = skuList.stream().filter(item -> StringUtils.isNotBlank(item.getSku())).collect(Collectors.toMap(BaseSku::getSku, BaseSku::getSkuType));
+        Assert.isTrue(CollectionUtil.isNotEmpty(skuTypeMapping), "skuTypeMapping is empty");
+
+        //2.到Excel中查询数据
+        //TODO
+        /*MultipartFile multipartFile = null;
+        ExcelUtil<ExcelLocLotModel> locLotModelExcelUtil = new ExcelUtil<ExcelLocLotModel>(ExcelLocLotModel.class);
+        List<ExcelLocLotModel> ExcelLocLotList = locLotModelExcelUtil.importExcel(multipartFile.getInputStream());*/
+
+
+        String LocLotJsonInfo = "[{\"locationNo\":\"A-01-04\",\"bindSku\":\"EMP_TRAY_BAG\",\"quantity\":2},{\"locationNo\":\"A-01-08\"},{\"locationNo\":\"A-05-03\",\"bindSku\":\"EMP_TRAY_BUC\"},{\"locationNo\":\"A-02-08\",\"bindSku\":\"(NH4)2SO4\",\"quantity\":10}]";
+        List<ExcelLocLotModel> ExcelLocLotList = JSONObject.parseArray(LocLotJsonInfo, ExcelLocLotModel.class);
+        List<ExcelLocLotModel> errorLocLotList = Lists.newArrayList();
+        for(ExcelLocLotModel locLotModel : ExcelLocLotList){
+            try {
+                String count = locLotModel.getQuantity();
+                BigDecimal quantity = StringUtils.isNotBlank(count) ? new BigDecimal(count) : null;
+                //所需的sku,库位号locationNo以及数量即可操作、
+                String locationNo = handleLocationNo(locLotModel.getLocationNo());
+                redressInventory(locationNo, locLotModel.getBindSku(), quantity, skuTypeMapping);
+            }catch (RuntimeException ex){
+                log.warn("ex is {}", ex);
+                errorLocLotList.add(locLotModel);
+                continue;
+            }
+        }
+        System.err.println(JSONObject.toJSONString(errorLocLotList));
+
+    }
+
+
+
+
+    /**
+     * 重置一个库的库位库存信息
+     * @param locationNo 库位号
+     * @param bindSku
+     * @param quantity
+     * @param skuTypeMapping
+     */
+    private void redressInventory(String locationNo, String bindSku, BigDecimal quantity, Map<String, String> skuTypeMapping) {
+        //1.通过库位号获得库位的ID
+        BaseLocationInfo baseLocationInfo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationNo, WAREHOUSE_ID);
+        if (ObjectUtil.isNull(baseLocationInfo)) return;
+        if(StringUtils.isBlank(bindSku) && ObjectUtil.isNotNull(quantity)) return;
+
+
+        //2.1 如果当前库位是空的,或者库位数量是空的,则删除inv_lot_loc_id中的库存数据并重置库位数据
+        if((ObjectUtil.isNull(quantity) || CompareUtil.compare(quantity, BigDecimal.ZERO)<=0)){
+            invLotLocIdService.deleteInvLotLocList(baseLocationInfo.getId());
+            reSetLocationInfo(baseLocationInfo, bindSku, Constants.YES, skuTypeMapping);
+            return;
+        }
+
+        if(StringUtils.isNotBlank(bindSku)
+                && ObjectUtil.isNotNull(quantity)
+                && CompareUtil.compare(quantity, BigDecimal.ZERO) > 0){
+            //查出原先的库存情况,如果当前库存SKU不符合,则生成新的批次记录
+            List<InvLotLocId> invLotLocList = invLotLocIdService.getInvLotLocList(baseLocationInfo.getId());
+            if(CollectionUtil.isNotEmpty(invLotLocList)){
+                //此时数据是错的都要重新生成库存
+                List<String> skuList = invLotLocList.stream().map(item -> item.getSku()).collect(Collectors.toList());
+                if(CollectionUtil.isEmpty(skuList) || skuList.size() > 1 || !StringUtils.equals(skuList.get(0), bindSku)){
+                    //生成新的批次记录
+                    String lotnum = invLotAttService.insertInvLotAtt(bindSku);
+                    //删除原先的库存记录,生成新的库存记录
+                    invLotLocIdService.deleteInvLotLocList(baseLocationInfo.getId());
+                    invLotLocIdService.insertInvLotLocId(baseLocationInfo.getId(), lotnum, bindSku, quantity);
+                    //重置库位数据
+                    reSetLocationInfo(baseLocationInfo, bindSku, Constants.NO, skuTypeMapping);
+                    return;
+                } else {
+                    //此时只有数量是错的,那么update一下数量就好
+                    InvLotLocId invLotLocId = invLotLocList.get(0);
+                    invLotLocId.setQty(quantity);
+                    //TODO  其他关于数量的字段要改嘛
+                    invLotLocId.setQtyEach(quantity);
+                    invLotLocIdService.updateInvLotLocId(invLotLocId);
+                    //重置库存数据
+                    reSetLocationInfo(baseLocationInfo, bindSku, Constants.NO, skuTypeMapping);
+                    return;
+                }
+            }
+
+        }
+    }
+
+    /**
+     * 重置库位表字段
+     * @param baseLocationInfo
+     * @param bindSku 物料号
+     * @param isEmpty
+     * @param skuTypeMapping
+     */
+    private Boolean reSetLocationInfo(BaseLocationInfo baseLocationInfo, String bindSku, String isEmpty, Map<String, String> skuTypeMapping) {
+        //重置当前的库位信息
+        baseLocationInfo.setIsEmpty(isEmpty);
+        baseLocationInfo.setStockStatus(FREE);
+        baseLocationInfo.setUserdefine10(StringUtils.isNotBlank(bindSku) ? bindSku : null);
+        baseLocationInfo.setBindSku(StringUtils.isNotBlank(bindSku) ? skuTypeMapping.get(bindSku) : null );
+        return baseLocationInfoService.reSetLocationInfo(baseLocationInfo);
+    }
+
+
+
+    /*public static void main(String[] args) {
+        System.out.println(handleLocationNo("A\t-02\t-08"));
+        System.out.println(handleLocationNo("  A-02-08"));
+        System.out.println(handleLocationNo("  -02-08"));
+        System.out.println(handleLocationNo("Out-02-cache"));
+        System.out.println(handleLocationNo("STAGE01"));
+    }*/
+
+
+    private static String handleLocationNo(String locationNo) {
+        if (StringUtils.isBlank(locationNo)) return StringUtil.EMPTY_STRING;
+        Pattern pattern = Pattern.compile("\\s*|\t|\r|\n");
+        Matcher matcher = pattern.matcher(locationNo);
+        String lotNo = matcher.replaceAll(StringUtil.EMPTY_STRING);
+        String start = StringUtils.split(lotNo, "-")[0];
+        if(start.length() == 1 && StringUtils.isAllUpperCase(start)){
+            lotNo = StringUtils.replace(lotNo, "-", "\t-");
+        }
+        return lotNo;
+
+    }
+
+
+}

+ 20 - 1
ruoyi-common/pom.xml

@@ -35,10 +35,29 @@
             <artifactId>spring-boot-starter-security</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+        </dependency>
+
         <!-- pagehelper 分页插件 -->
         <dependency>
             <groupId>com.github.pagehelper</groupId>
             <artifactId>pagehelper-spring-boot-starter</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.mybatis</groupId>
+                    <artifactId>mybatis</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.mybatis</groupId>
+                    <artifactId>mybatis-spring</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.github.jsqlparser</groupId>
+                    <artifactId>jsqlparser</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <!-- 自定义验证注解 -->
@@ -140,7 +159,7 @@
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpclient</artifactId>
-            <version>4.5.13</version>
+            <version>4.5.2</version>
         </dependency>
 
     </dependencies>

+ 55 - 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java

@@ -164,4 +164,59 @@ public class Constants
      */
     public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
             "org.springframework", "org.apache", "com.ruoyi.common.utils.file" };
+
+    /**
+     *  升序
+     */
+    public static final String ASC = "asc";
+    /**
+     * 降序
+     */
+    public static final String DESC = "desc";
+    /**
+     * 创建时间字段名
+     */
+    public static final String CREATE_DATE = "create_date";
+
+    /**
+     * 创建时间字段名
+     */
+    public static final String ID = "id";
+
+    /**
+     * 数据权限过滤
+     */
+    public static final String SQL_FILTER = "sqlFilter";
+
+    /**
+     * 当前页码
+     */
+    public static final String PAGE = "page";
+    /**
+     * 每页显示记录数
+     */
+    public static final String LIMIT = "limit";
+    /**
+     * 排序字段
+     */
+    public static final String ORDER_FIELD = "orderField";
+    /**
+     * 排序方式
+     */
+    public static final String ORDER = "order";
+
+    /**
+     * 否
+     */
+    public static final String NO = "N";
+
+    /**
+     * 是
+     */
+    public static final String YES = "Y";
+
+    /**
+     * 默认的货主代码
+     */
+    public static final String DEFAULT_CUSTOMER_ID = "default";
 }

+ 5 - 1
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java

@@ -4,11 +4,13 @@ import java.io.Serializable;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
+
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 
 /**
  * Entity基类
- * 
+ *
  * @author ruoyi
  */
 public class BaseEntity implements Serializable
@@ -16,6 +18,7 @@ public class BaseEntity implements Serializable
     private static final long serialVersionUID = 1L;
 
     /** 搜索值 */
+    @TableField(exist = false)
     private String searchValue;
 
     /** 创建者 */
@@ -36,6 +39,7 @@ public class BaseEntity implements Serializable
     private String remark;
 
     /** 请求参数 */
+    @TableField(exist = false)
     private Map<String, Object> params;
 
     public String getSearchValue()

+ 52 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/ConvertUtils.java

@@ -0,0 +1,52 @@
+package com.ruoyi.common.utils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * 转换工具类
+ *
+ * @author chenyang
+ */
+public class ConvertUtils {
+    private static Logger logger = LoggerFactory.getLogger(ConvertUtils.class);
+
+    public static <T> T sourceToTarget(Object source, Class<T> target){
+        if(source == null){
+            return null;
+        }
+        T targetObject = null;
+        try {
+            targetObject = target.newInstance();
+            BeanUtils.copyProperties(source, targetObject);
+        } catch (Exception e) {
+            logger.error("convert error ", e);
+        }
+
+        return targetObject;
+    }
+
+    public static <T> List<T> sourceToTarget(Collection<?> sourceList, Class<T> target){
+        if(sourceList == null){
+            return null;
+        }
+
+        List targetList = new ArrayList<>(sourceList.size());
+        try {
+            for(Object source : sourceList){
+                T targetObject = target.newInstance();
+                BeanUtils.copyProperties(source, targetObject);
+                targetList.add(targetObject);
+            }
+        }catch (Exception e){
+            logger.error("convert error ", e);
+        }
+
+        return targetList;
+    }
+}

+ 18 - 0
ruoyi-framework/pom.xml

@@ -27,6 +27,18 @@
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-aop</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-jdbc</artifactId>
+            <version>5.3.16</version>
         </dependency>
 
         <!-- 阿里数据库连接池 -->
@@ -35,6 +47,12 @@
             <artifactId>druid-spring-boot-starter</artifactId>
         </dependency>
 
+        <!-- SwggerUI集成 -->
+        <dependency>
+            <groupId>io.springfox</groupId>
+            <artifactId>springfox-boot-starter</artifactId>
+        </dependency>
+
         <!-- 验证码 -->
         <dependency>
             <groupId>com.github.penggle</groupId>

+ 2 - 3
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java

@@ -1,12 +1,12 @@
 package com.ruoyi.framework.config;
 
-import java.util.TimeZone;
-import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
 
+import java.util.TimeZone;
+
 /**
  * 程序注解配置
  *
@@ -16,7 +16,6 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
 // 表示通过aop框架暴露该代理对象,AopContext能够访问
 @EnableAspectJAutoProxy(exposeProxy = true)
 // 指定要扫描的Mapper类的包的路径
-@MapperScan("com.ruoyi.**.mapper")
 public class ApplicationConfig
 {
     /**

+ 0 - 132
ruoyi-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java

@@ -1,132 +0,0 @@
-package com.ruoyi.framework.config;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import javax.sql.DataSource;
-import org.apache.ibatis.io.VFS;
-import org.apache.ibatis.session.SqlSessionFactory;
-import org.mybatis.spring.SqlSessionFactoryBean;
-import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.env.Environment;
-import org.springframework.core.io.DefaultResourceLoader;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
-import org.springframework.core.io.support.ResourcePatternResolver;
-import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
-import org.springframework.core.type.classreading.MetadataReader;
-import org.springframework.core.type.classreading.MetadataReaderFactory;
-import org.springframework.util.ClassUtils;
-import com.ruoyi.common.utils.StringUtils;
-
-/**
- * Mybatis支持*匹配扫描包
- * 
- * @author ruoyi
- */
-@Configuration
-public class MyBatisConfig
-{
-    @Autowired
-    private Environment env;
-
-    static final String DEFAULT_RESOURCE_PATTERN = "**/*.class";
-
-    public static String setTypeAliasesPackage(String typeAliasesPackage)
-    {
-        ResourcePatternResolver resolver = (ResourcePatternResolver) new PathMatchingResourcePatternResolver();
-        MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resolver);
-        List<String> allResult = new ArrayList<String>();
-        try
-        {
-            for (String aliasesPackage : typeAliasesPackage.split(","))
-            {
-                List<String> result = new ArrayList<String>();
-                aliasesPackage = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
-                        + ClassUtils.convertClassNameToResourcePath(aliasesPackage.trim()) + "/" + DEFAULT_RESOURCE_PATTERN;
-                Resource[] resources = resolver.getResources(aliasesPackage);
-                if (resources != null && resources.length > 0)
-                {
-                    MetadataReader metadataReader = null;
-                    for (Resource resource : resources)
-                    {
-                        if (resource.isReadable())
-                        {
-                            metadataReader = metadataReaderFactory.getMetadataReader(resource);
-                            try
-                            {
-                                result.add(Class.forName(metadataReader.getClassMetadata().getClassName()).getPackage().getName());
-                            }
-                            catch (ClassNotFoundException e)
-                            {
-                                e.printStackTrace();
-                            }
-                        }
-                    }
-                }
-                if (result.size() > 0)
-                {
-                    HashSet<String> hashResult = new HashSet<String>(result);
-                    allResult.addAll(hashResult);
-                }
-            }
-            if (allResult.size() > 0)
-            {
-                typeAliasesPackage = String.join(",", (String[]) allResult.toArray(new String[0]));
-            }
-            else
-            {
-                throw new RuntimeException("mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:" + typeAliasesPackage + "未找到任何包");
-            }
-        }
-        catch (IOException e)
-        {
-            e.printStackTrace();
-        }
-        return typeAliasesPackage;
-    }
-
-    public Resource[] resolveMapperLocations(String[] mapperLocations)
-    {
-        ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();
-        List<Resource> resources = new ArrayList<Resource>();
-        if (mapperLocations != null)
-        {
-            for (String mapperLocation : mapperLocations)
-            {
-                try
-                {
-                    Resource[] mappers = resourceResolver.getResources(mapperLocation);
-                    resources.addAll(Arrays.asList(mappers));
-                }
-                catch (IOException e)
-                {
-                    // ignore
-                }
-            }
-        }
-        return resources.toArray(new Resource[resources.size()]);
-    }
-
-    @Bean
-    public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
-    {
-        String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");
-        String mapperLocations = env.getProperty("mybatis.mapperLocations");
-        String configLocation = env.getProperty("mybatis.configLocation");
-        typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
-        VFS.addImplClass(SpringBootVFS.class);
-
-        final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
-        sessionFactory.setDataSource(dataSource);
-        sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
-        sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ",")));
-        sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
-        return sessionFactory.getObject();
-    }
-}

+ 33 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java

@@ -0,0 +1,33 @@
+package com.ruoyi.framework.config;
+
+import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * mybatis-plus配置
+ * @author chenyang
+ *
+ */
+@Configuration
+@MapperScan({"com.ruoyi.**.mapper", "com.ruoyi.**.dao"})
+public class MybatisPlusConfig {
+
+    @Bean
+    public MybatisPlusInterceptor mybatisPlusInterceptor() {
+        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
+        // 分页插件 为兼容老系统的分页插件这个分页插件是没有用的
+        mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
+        // 乐观锁
+        mybatisPlusInterceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
+        // 防止全表更新与删除
+        mybatisPlusInterceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());
+
+        return mybatisPlusInterceptor;
+    }
+
+}

+ 12 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/dao/BaseDao.java

@@ -0,0 +1,12 @@
+package com.ruoyi.framework.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 基础Dao
+ * @author chenyang
+ *
+ */
+public interface BaseDao<T> extends BaseMapper<T> {
+
+}

+ 109 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/service/BaseService.java

@@ -0,0 +1,109 @@
+package com.ruoyi.framework.service;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+/**
+ * 基础服务接口,所有Service接口都要继承
+ *
+ * @author chenyang
+ */
+public interface BaseService<T> {
+
+    Class<T> currentModelClass();
+
+    /**
+     * <p>
+     * 插入一条记录(选择字段,策略插入)
+     * </p>
+     *
+     * @param entity 实体对象
+     */
+    boolean insert(T entity);
+
+    /**
+     * <p>
+     * 插入(批量),该方法不支持 Oracle、SQL Server
+     * </p>
+     *
+     * @param entityList 实体对象集合
+     */
+    boolean insertBatch(Collection<T> entityList);
+
+    /**
+     * <p>
+     * 插入(批量),该方法不支持 Oracle、SQL Server
+     * </p>
+     *
+     * @param entityList 实体对象集合
+     * @param batchSize  插入批次数量
+     */
+    boolean insertBatch(Collection<T> entityList, int batchSize);
+
+    /**
+     * <p>
+     * 根据 ID 选择修改
+     * </p>
+     *
+     * @param entity 实体对象
+     */
+    boolean updateById(T entity);
+
+    /**
+     * <p>
+     * 根据 whereEntity 条件,更新记录
+     * </p>
+     *
+     * @param entity        实体对象
+     * @param updateWrapper 实体对象封装操作类 {@link com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper}
+     */
+    boolean update(T entity, Wrapper<T> updateWrapper);
+
+    /**
+     * <p>
+     * 根据ID 批量更新
+     * </p>
+     *
+     * @param entityList 实体对象集合
+     */
+    boolean updateBatchById(Collection<T> entityList);
+
+    /**
+     * <p>
+     * 根据ID 批量更新
+     * </p>
+     *
+     * @param entityList 实体对象集合
+     * @param batchSize  更新批次数量
+     */
+    boolean updateBatchById(Collection<T> entityList, int batchSize);
+
+    /**
+     * <p>
+     * 根据 ID 查询
+     * </p>
+     *
+     * @param id 主键ID
+     */
+    T selectById(Serializable id);
+
+    /**
+     * <p>
+     * 根据 ID 删除
+     * </p>
+     *
+     * @param id 主键ID
+     */
+    boolean deleteById(Serializable id);
+
+    /**
+     * <p>
+     * 删除(根据ID 批量删除)
+     * </p>
+     *
+     * @param idList 主键ID列表
+     */
+    boolean deleteBatchIds(Collection<? extends Serializable> idList);
+}

+ 27 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/service/CrudService.java

@@ -0,0 +1,27 @@
+package com.ruoyi.framework.service;
+
+import com.ruoyi.framework.service.bean.PageData;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  CRUD基础服务接口
+ *
+ * @author chenyang
+ */
+public interface CrudService<T, D> extends BaseService<T> {
+
+    PageData<D> page(Map<String, Object> params);
+
+    List<D> list(Map<String, Object> params);
+
+    D get(Long id);
+
+    void save(D dto);
+
+    void update(D dto);
+
+    void delete(Long[] ids);
+
+}

+ 35 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/service/bean/PageData.java

@@ -0,0 +1,35 @@
+package com.ruoyi.framework.service.bean;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 分页工具类
+ *
+ * @author chenyang
+ */
+@Data
+@ApiModel(value = "分页数据")
+public class PageData<T> implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "总记录数")
+    private int total;
+
+    @ApiModelProperty(value = "列表数据")
+    private List<T> list;
+
+    /**
+     * 分页
+     * @param list   列表数据
+     * @param total  总记录数
+     */
+    public PageData(List<T> list, long total) {
+        this.list = list;
+        this.total = (int)total;
+    }
+}

+ 210 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/service/impl/BaseServiceImpl.java

@@ -0,0 +1,210 @@
+package com.ruoyi.framework.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.enums.SqlMethod;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
+import com.baomidou.mybatisplus.core.toolkit.ReflectionKit;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
+import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.utils.ConvertUtils;
+import com.ruoyi.framework.service.BaseService;
+import com.ruoyi.framework.service.bean.PageData;
+import org.apache.ibatis.binding.MapperMethod;
+import org.apache.ibatis.logging.Log;
+import org.apache.ibatis.logging.LogFactory;
+import org.apache.ibatis.session.SqlSession;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.function.BiConsumer;
+
+/**
+ * 基础服务类,所有Service都要继承
+ *
+ * @author chenyang
+ */
+public abstract class BaseServiceImpl<M extends BaseMapper<T>, T>  implements BaseService<T> {
+    @Autowired
+    protected M baseDao;
+    protected Log log = LogFactory.getLog(getClass());
+
+    /**
+     * 获取分页对象
+     * @param params      分页查询参数
+     * @param defaultOrderField  默认排序字段
+     * @param isAsc              排序方式
+     */
+    protected IPage<T> getPage(Map<String, Object> params, String defaultOrderField, boolean isAsc) {
+        //分页参数
+        long curPage = 1;
+        long limit = 10;
+
+        if(params.get(Constants.PAGE) != null){
+            curPage = Long.parseLong((String)params.get(Constants.PAGE));
+        }
+        if(params.get(Constants.LIMIT) != null){
+            limit = Long.parseLong((String)params.get(Constants.LIMIT));
+        }
+
+        //分页对象
+        Page<T> page = new Page<>(curPage, limit);
+
+        //分页参数
+        params.put(Constants.PAGE, page);
+
+        //排序字段
+        String orderField = (String)params.get(Constants.ORDER_FIELD);
+        String order = (String)params.get(Constants.ORDER);
+
+        //前端字段排序
+        if(StringUtils.isNotBlank(orderField) && StringUtils.isNotBlank(order)){
+            if(Constants.ASC.equalsIgnoreCase(order)) {
+                return page.addOrder(OrderItem.asc(orderField));
+            }else {
+                return page.addOrder(OrderItem.desc(orderField));
+            }
+        }
+
+        //没有排序字段,则不排序
+        if(StringUtils.isBlank(defaultOrderField)){
+            return page;
+        }
+
+        //默认排序
+        if(isAsc) {
+            page.addOrder(OrderItem.asc(defaultOrderField));
+        }else {
+            page.addOrder(OrderItem.desc(defaultOrderField));
+        }
+
+        return page;
+    }
+
+    protected <T> PageData<T> getPageData(List<?> list, long total, Class<T> target){
+        List<T> targetList = ConvertUtils.sourceToTarget(list, target);
+
+        return new PageData<>(targetList, total);
+    }
+
+    protected <T> PageData<T> getPageData(IPage page, Class<T> target){
+        return getPageData(page.getRecords(), page.getTotal(), target);
+    }
+
+    protected void paramsToLike(Map<String, Object> params, String... likes){
+        for (String like : likes){
+            String val = (String)params.get(like);
+            if (StringUtils.isNotBlank(val)){
+                params.put(like, "%" + val + "%");
+            }else {
+                params.put(like, null);
+            }
+        }
+    }
+
+    /**
+     * <p>
+     * 判断数据库操作是否成功
+     * </p>
+     * <p>
+     * 注意!! 该方法为 Integer 判断,不可传入 int 基本类型
+     * </p>
+     *
+     * @param result 数据库操作返回影响条数
+     * @return boolean
+     */
+    protected static boolean retBool(Integer result) {
+        return SqlHelper.retBool(result);
+    }
+
+    protected Class<M> currentMapperClass() {
+        return (Class<M>) ReflectionKit.getSuperClassGenericType(this.getClass(), BaseServiceImpl.class, 0);
+    }
+
+    @Override
+    public Class<T> currentModelClass() {
+        return (Class<T>)ReflectionKit.getSuperClassGenericType(this.getClass(), BaseServiceImpl.class, 1);
+    }
+
+    protected String getSqlStatement(SqlMethod sqlMethod) {
+        return SqlHelper.getSqlStatement(this.currentMapperClass(), sqlMethod);
+    }
+
+    @Override
+    public boolean insert(T entity) {
+        return BaseServiceImpl.retBool(baseDao.insert(entity));
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean insertBatch(Collection<T> entityList) {
+        return insertBatch(entityList, 100);
+    }
+
+    /**
+     * 批量插入
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean insertBatch(Collection<T> entityList, int batchSize) {
+        String sqlStatement = getSqlStatement(SqlMethod.INSERT_ONE);
+        return executeBatch(entityList, batchSize, (sqlSession, entity) -> sqlSession.insert(sqlStatement, entity));
+    }
+
+    /**
+     * 执行批量操作
+     */
+    protected <E> boolean executeBatch(Collection<E> list, int batchSize, BiConsumer<SqlSession, E> consumer) {
+        return SqlHelper.executeBatch(this.currentModelClass(), this.log, list, batchSize, consumer);
+    }
+
+
+    @Override
+    public boolean updateById(T entity) {
+        return BaseServiceImpl.retBool(baseDao.updateById(entity));
+    }
+
+    @Override
+    public boolean update(T entity, Wrapper<T> updateWrapper) {
+        return BaseServiceImpl.retBool(baseDao.update(entity, updateWrapper));
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean updateBatchById(Collection<T> entityList) {
+        return updateBatchById(entityList, 30);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public boolean updateBatchById(Collection<T> entityList, int batchSize) {
+        String sqlStatement = getSqlStatement(SqlMethod.UPDATE_BY_ID);
+        return executeBatch(entityList, batchSize, (sqlSession, entity) -> {
+            MapperMethod.ParamMap<T> param = new MapperMethod.ParamMap<>();
+            param.put(com.baomidou.mybatisplus.core.toolkit.Constants.ENTITY, entity);
+            sqlSession.update(sqlStatement, param);
+        });
+    }
+
+    @Override
+    public T selectById(Serializable id) {
+        return baseDao.selectById(id);
+    }
+
+    @Override
+    public boolean deleteById(Serializable id) {
+        return SqlHelper.retBool(baseDao.deleteById(id));
+    }
+
+    @Override
+    public boolean deleteBatchIds(Collection<? extends Serializable> idList) {
+        return SqlHelper.retBool(baseDao.deleteBatchIds(idList));
+    }
+}

+ 72 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/service/impl/CrudServiceImpl.java

@@ -0,0 +1,72 @@
+package com.ruoyi.framework.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ReflectionKit;
+import com.ruoyi.common.utils.ConvertUtils;
+import com.ruoyi.framework.service.CrudService;
+import com.ruoyi.framework.service.bean.PageData;
+import org.springframework.beans.BeanUtils;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  CRUD基础服务类
+ *
+ * @author chenyang
+ */
+public abstract class CrudServiceImpl<M extends BaseMapper<T>, T, D> extends BaseServiceImpl<M, T> implements CrudService<T, D> {
+
+    protected Class<D> currentDtoClass() {
+        return (Class<D>)ReflectionKit.getSuperClassGenericType(getClass(), CrudServiceImpl.class, 2);
+    }
+
+    @Override
+    public PageData<D> page(Map<String, Object> params) {
+        IPage<T> page = baseDao.selectPage(
+            getPage(params, null, false),
+            getWrapper(params)
+        );
+
+        return getPageData(page, currentDtoClass());
+    }
+
+    @Override
+    public List<D> list(Map<String, Object> params) {
+        List<T> entityList = baseDao.selectList(getWrapper(params));
+
+        return ConvertUtils.sourceToTarget(entityList, currentDtoClass());
+    }
+
+    public abstract QueryWrapper<T> getWrapper(Map<String, Object> params);
+
+    @Override
+    public D get(Long id) {
+        T entity = baseDao.selectById(id);
+
+        return ConvertUtils.sourceToTarget(entity, currentDtoClass());
+    }
+
+    @Override
+    public void save(D dto) {
+        T entity = ConvertUtils.sourceToTarget(dto, currentModelClass());
+        insert(entity);
+
+        //copy主键值到dto
+        BeanUtils.copyProperties(entity, dto);
+    }
+
+    @Override
+    public void update(D dto) {
+        T entity = ConvertUtils.sourceToTarget(dto, currentModelClass());
+        updateById(entity);
+    }
+
+    @Override
+    public void delete(Long[] ids) {
+        baseDao.deleteBatchIds(Arrays.asList(ids));
+    }
+}

+ 0 - 12
warewms-ams/pom.xml

@@ -15,18 +15,6 @@
 
     <dependencies>
 
-        <!-- 通用工具-->
-        <dependency>
-            <groupId>com.ruoyi</groupId>
-            <artifactId>ruoyi-common</artifactId>
-        </dependency>
-
-        <!-- 系统模块-->
-        <dependency>
-            <groupId>com.ruoyi</groupId>
-            <artifactId>ruoyi-system</artifactId>
-        </dependency>
-
         <dependency>
             <groupId>com.ruoyi</groupId>
             <artifactId>warewms-base</artifactId>

+ 2 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/domain/InvLotAtt.java

@@ -1,5 +1,7 @@
 package com.ruoyi.ams.inv.domain;
 
+import lombok.Data;
+import lombok.experimental.Accessors;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;

+ 2 - 3
warewms-ams/src/main/java/com/ruoyi/ams/inv/mapper/InvLotLocIdMapper.java

@@ -4,6 +4,7 @@ import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ruoyi.ams.asn.vo.StockingListVO;
 import com.ruoyi.ams.config.domain.dto.LotattDTO;
 import com.ruoyi.ams.inv.domain.InvLotAtt;
@@ -20,7 +21,7 @@ import org.apache.ibatis.annotations.Param;
  * @author andy
  * @date 2022-03-03
  */
-public interface InvLotLocIdMapper {
+public interface InvLotLocIdMapper extends BaseMapper<InvLotLocId> {
     /**
      * 查询库位库存信息
      *
@@ -144,7 +145,6 @@ public interface InvLotLocIdMapper {
     /**
      * 查询物料库存信息总数
      *
-     * @param invLocIdSearchFrom
      * @return
      */
     List<InvLotLocIdLotattVO> selectInvLocIdLotattList1();
@@ -259,7 +259,6 @@ public interface InvLotLocIdMapper {
      * 根据托盘查询库存
      *
      * @param invLotAtt
-     * @param boxNo
      * @return
      */
     List<InvLotLocId> queryInvByInvLotatt(@Param("lotattDTO") InvLotAtt invLotAtt);

+ 7 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/IInvLotAttService.java

@@ -66,4 +66,11 @@ public interface IInvLotAttService {
      * @return
      */
     int deleteInvLotAttBylocationId(Long locationId);
+
+    /**
+     * 生成新的批次记录
+     * @param bindSku
+     * @return
+     */
+    String insertInvLotAtt(String bindSku);
 }

+ 32 - 6
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/IInvLotLocIdService.java

@@ -3,20 +3,15 @@ package com.ruoyi.ams.inv.service;
 import java.math.BigDecimal;
 import java.util.List;
 
-import com.ruoyi.ams.asn.vo.StockingListVO;
 import com.ruoyi.ams.config.domain.dto.AgvCallDTO;
 import com.ruoyi.ams.config.domain.dto.LotattDTO;
 import com.ruoyi.ams.inv.domain.InvLotAtt;
 import com.ruoyi.ams.inv.domain.InvLotLocId;
 import com.ruoyi.ams.inv.domain.form.InvLocIdSearchFrom;
 import com.ruoyi.ams.inv.domain.form.InvLotLocIdAdjForm;
-import com.ruoyi.ams.inv.domain.form.InvLotLocIdForm;
 import com.ruoyi.ams.inv.domain.form.InvLotLocIdMoveForm;
 import com.ruoyi.ams.inv.domain.vo.InvLotLocIdLotattVO;
-import com.ruoyi.base.domain.BaseLocationInfo;
-import com.ruoyi.base.domain.vo.BaseLocationLotattVO;
 import com.ruoyi.common.core.domain.AjaxResult;
-import org.apache.ibatis.annotations.Param;
 
 /**
  * 库位库存信息Service接口
@@ -71,7 +66,6 @@ public interface IInvLotLocIdService {
     /**
      * 查询库存信息总量
      *
-     * @param invLocIdSearchFrom
      * @return
      */
     List<InvLotLocIdLotattVO> selectInvLocIdLotattList1( );
@@ -290,4 +284,36 @@ public interface IInvLotLocIdService {
      * @return true 代表质检没有问题,可以出库
      */
     boolean verifyInventoryCanOutbound(String locationId);
+
+    /**
+     * 删除掉相关的库位批次信息
+     * @param locationId 库位ID
+     * @return
+     */
+    Integer deleteInvLotLocList(Long locationId);
+
+    /**
+     * 删除掉相关的库位批次关系
+     * @param locationId 库位ID
+     * @param lotnumList 批次号列表
+     * @return
+     */
+    Integer deleteInvLotLocList(Long locationId, List<String> lotnumList);
+
+    /**
+     * 根据库位ID获取该库位的库存信息
+     * @param locationId 库位ID
+     * @return
+     */
+    List<InvLotLocId> getInvLotLocList(Long locationId);
+
+    /**
+     * 生成一条新的库存数据
+     * @param locationId 库位ID
+     * @param lotnum
+     * @param bindSku 绑定的sku
+     * @param quantity 数量
+     */
+    Boolean insertInvLotLocId(Long locationId, String lotnum, String bindSku, BigDecimal quantity);
+
 }

+ 20 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotAttServiceImpl.java

@@ -2,6 +2,8 @@ package com.ruoyi.ams.inv.service.impl;
 
 import java.util.List;
 
+import com.ruoyi.base.utils.IdSequenceUtils;
+import com.ruoyi.common.constant.Constants;
 import com.ruoyi.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -20,6 +22,9 @@ public class InvLotAttServiceImpl implements IInvLotAttService {
     @Autowired
     private InvLotAttMapper invLotAttMapper;
 
+    @Autowired
+    private IdSequenceUtils idSequenceUtils;
+
     /**
      * 查询批次属性
      *
@@ -96,4 +101,19 @@ public class InvLotAttServiceImpl implements IInvLotAttService {
     public int deleteInvLotAttBylocationId(Long locationId) {
         return invLotAttMapper.deleteInvLotAttBylocationId(locationId);
     }
+
+    @Override
+    public String insertInvLotAtt(String bindSku) {
+        InvLotAtt invLotAtt = new InvLotAtt();
+
+        String lotnum = idSequenceUtils.generateId("LOTNUMBER");
+        invLotAtt.setLotnum(lotnum);
+        invLotAtt.setCustomerId(Constants.DEFAULT_CUSTOMER_ID);
+        invLotAtt.setSku(bindSku);
+        //TODO 这俩是啥字段
+        invLotAtt.setLotatt07("");
+        invLotAtt.setLotatt08("");
+        invLotAttMapper.insertInvLotAtt(invLotAtt);
+        return lotnum;
+    }
 }

+ 49 - 1
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotLocIdServiceImpl.java

@@ -1,5 +1,9 @@
 package com.ruoyi.ams.inv.service.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.ruoyi.ams.box.domain.WmsBoxInfo;
 import com.ruoyi.ams.box.service.IWmsBoxInfoService;
 import com.ruoyi.ams.business.IBusinessService;
@@ -20,21 +24,23 @@ import com.ruoyi.base.constant.Constant;
 import com.ruoyi.base.domain.BaseLocationInfo;
 import com.ruoyi.base.service.IBaseLocationInfoService;
 import com.ruoyi.base.utils.IdSequenceUtils;
+import com.ruoyi.common.constant.Constants;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.compress.utils.Lists;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.Assert;
 
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
-import java.util.Objects;
 
 /**
  * 库位库存信息Service业务层处理
@@ -673,4 +679,46 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         List<InvLotLocIdLotattVO> lotattVOList = selectInvLocIdLotattList(invLocIdSearchFrom);
         return lotattVOList.stream().allMatch(v -> !v.getLotatt05().equals("DJ"));
     }
+
+    @Override
+    public Integer deleteInvLotLocList(Long locationId) {
+        deleteInvLotLocList(locationId, Lists.newArrayList());
+        return deleteInvLotLocList(locationId, Lists.newArrayList());
+    }
+
+    @Override
+    public Integer deleteInvLotLocList(Long locationId, List<String> lotnumList) {
+        Assert.isTrue(ObjectUtil.isNotNull(locationId), "locationId cannot be null ");
+        LambdaQueryWrapper<InvLotLocId> queryWrapper = Wrappers.<InvLotLocId>lambdaQuery().eq(InvLotLocId::getLocationId, locationId)
+                .in(CollectionUtil.isNotEmpty(lotnumList), InvLotLocId::getLotnum, lotnumList);
+        return invLotLocIdMapper.delete(queryWrapper);
+    }
+
+    @Override
+    public List<InvLotLocId> getInvLotLocList(Long locationId) {
+        LambdaQueryWrapper<InvLotLocId> queryWrapper
+                = Wrappers.<InvLotLocId>lambdaQuery().eq(InvLotLocId::getLocationId, locationId);
+        return invLotLocIdMapper.selectList(queryWrapper);
+    }
+
+    @Override
+    public Boolean insertInvLotLocId(Long locationId, String lotnum, String bindSku, BigDecimal quantity) {
+        Assert.isTrue(StringUtils.isNotBlank(lotnum) && ObjectUtil.isNotNull(locationId)
+                && StringUtils.isNotBlank(bindSku) && ObjectUtil.isNotNull(quantity), "params is illegal");
+        InvLotLocId invLotLocId = new InvLotLocId();
+        invLotLocId.setLocationId(String.valueOf(locationId));
+        invLotLocId.setLotnum(lotnum);
+        invLotLocId.setCustomerId(Constants.DEFAULT_CUSTOMER_ID);
+        invLotLocId.setSku(bindSku);
+        invLotLocId.setQty(quantity);
+        invLotLocId.setLotnum(lotnum);
+
+        //TODO 这俩是啥字段
+        invLotLocId.setQtyEach(null);
+        invLotLocId.setQtyallocated(null);
+        invLotLocId.setQtyallocatedEach(null);
+        invLotLocId.setQtypa(null);
+        invLotLocId.setQtyrpin(null);
+        return invLotLocIdMapper.insertInvLotLocId(invLotLocId) == 1;
+    }
 }

+ 2 - 2
warewms-base/pom.xml

@@ -15,10 +15,10 @@
 
     <dependencies>
 
-        <!-- 通用工具-->
+        <!-- 若依框架 -->
         <dependency>
             <groupId>com.ruoyi</groupId>
-            <artifactId>ruoyi-common</artifactId>
+            <artifactId>ruoyi-framework</artifactId>
         </dependency>
 
     </dependencies>

+ 14 - 0
warewms-base/src/main/java/com/ruoyi/base/domain/form/BaseLocationForm.java

@@ -0,0 +1,14 @@
+package com.ruoyi.base.domain.form;
+
+public class BaseLocationForm extends BasLocationForm {
+
+    private String bindSku;
+
+    public String getSku() {
+        return bindSku;
+    }
+
+    public void setBindSku(String bindSku) {
+        this.bindSku = bindSku;
+    }
+}

+ 2 - 1
warewms-base/src/main/java/com/ruoyi/base/mapper/BaseLocationInfoMapper.java

@@ -1,5 +1,6 @@
 package com.ruoyi.base.mapper;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ruoyi.base.domain.BaseLocationInfo;
 import com.ruoyi.base.domain.dto.BaseLocationGuiDTO;
 import com.ruoyi.base.domain.dto.BaseLocationInfoSameColDTO;
@@ -17,7 +18,7 @@ import java.util.Map;
  * @author andy
  * @date 2022-02-18
  */
-public interface BaseLocationInfoMapper {
+public interface BaseLocationInfoMapper extends BaseMapper<BaseLocationInfo> {
     /**
      * 查询库位信息
      *

+ 3 - 1
warewms-base/src/main/java/com/ruoyi/base/mapper/BaseSkuMapper.java

@@ -1,6 +1,8 @@
 package com.ruoyi.base.mapper;
 
 import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ruoyi.base.domain.BaseSku;
 import org.apache.ibatis.annotations.Param;
 
@@ -10,7 +12,7 @@ import org.apache.ibatis.annotations.Param;
  * @author andy
  * @date 2022-02-21
  */
-public interface BaseSkuMapper 
+public interface BaseSkuMapper extends BaseMapper<BaseSku>
 {
     /**
      * 查询物料信息

+ 7 - 0
warewms-base/src/main/java/com/ruoyi/base/service/IBaseLocationInfoService.java

@@ -320,4 +320,11 @@ public interface IBaseLocationInfoService {
      * @return
      */
     AjaxResult importLocation(List<BaseLocationInfo> list, boolean updateSupport, String opname);
+
+    /**
+     * 重置库位数据
+     * @param baseLocationInfo
+     * @return
+     */
+    Boolean reSetLocationInfo(BaseLocationInfo baseLocationInfo);
 }

+ 7 - 0
warewms-base/src/main/java/com/ruoyi/base/service/IBaseSkuService.java

@@ -74,4 +74,11 @@ public interface IBaseSkuService {
      * @return
      */
     List<BaseSku> selectBaseSkuBySkuTypeList(List<String> list);
+
+    /**
+     * 查询物料属性列表
+     * @author chenyang
+     * @return
+     */
+    List<BaseSku> querySkuList();
 }

+ 14 - 2
warewms-base/src/main/java/com/ruoyi/base/service/impl/BaseLocationInfoServiceImpl.java

@@ -1,5 +1,7 @@
 package com.ruoyi.base.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.ruoyi.base.constant.Constant;
 import com.ruoyi.base.domain.BaseLocationInfo;
 import com.ruoyi.base.domain.BaseLocationZone;
@@ -19,6 +21,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 
 import java.util.ArrayList;
 import java.util.Date;
@@ -47,8 +50,6 @@ public class BaseLocationInfoServiceImpl implements IBaseLocationInfoService {
      * 入库校验同列任务任务状态和阻挡
      *
      * @param basLocationList
-     * @param token
-     * @param isReleaseGoods  是否目标点位
      * @return
      */
     public BaseLocationLotattVO checkTheSameColumnLocation(List<BaseLocationLotattVO> basLocationList) {
@@ -504,4 +505,15 @@ public class BaseLocationInfoServiceImpl implements IBaseLocationInfoService {
         }
         return AjaxResult.success(successMsg);
     }
+
+    @Override
+    public Boolean reSetLocationInfo(BaseLocationInfo baseLocationInfo) {
+
+        LambdaUpdateWrapper<BaseLocationInfo> updateWrapper = Wrappers.<BaseLocationInfo>lambdaUpdate()
+                .set(StringUtils.isNotEmpty(baseLocationInfo.getIsEmpty()), BaseLocationInfo::getIsEmpty, baseLocationInfo.getIsEmpty())
+                .set(StringUtils.isNotEmpty(baseLocationInfo.getStockStatus()), BaseLocationInfo::getStockStatus, baseLocationInfo.getStockStatus())
+                .set(BaseLocationInfo::getBindSku, baseLocationInfo.getBindSku()).set(BaseLocationInfo::getUserdefine10, baseLocationInfo.getUserdefine10())
+                .eq(BaseLocationInfo::getId, baseLocationInfo.getId());
+        return baseLocationInfoMapper.update(null, updateWrapper) == 1;
+    }
 }

+ 8 - 0
warewms-base/src/main/java/com/ruoyi/base/service/impl/BaseSkuServiceImpl.java

@@ -1,7 +1,10 @@
 package com.ruoyi.base.service.impl;
 
 import java.util.List;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.ruoyi.common.utils.DateUtils;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.base.mapper.BaseSkuMapper;
@@ -107,4 +110,9 @@ public class BaseSkuServiceImpl implements IBaseSkuService
     public List<BaseSku> selectBaseSkuBySkuTypeList(List<String> list) {
         return baseSkuMapper.selectBaseSkuBySkuTypeList(list);
     }
+
+    @Override
+    public List<BaseSku> querySkuList() {
+        return baseSkuMapper.selectList(Wrappers.emptyWrapper());
+    }
 }

+ 44 - 2
warewms-hard/pom.xml

@@ -14,16 +14,58 @@
     <description>硬件对接</description>
 
     <dependencies>
-        <!-- 通用工具-->
+        <!-- 若依框架 -->
         <dependency>
             <groupId>com.ruoyi</groupId>
-            <artifactId>ruoyi-common</artifactId>
+            <artifactId>ruoyi-framework</artifactId>
         </dependency>
         <!--自定义starter组件-->
         <dependency>
             <groupId>com.jwk</groupId>
             <artifactId>modbus-spring-boot-starter</artifactId>
             <version>1.0</version>
+            <scope>system</scope>
+            <systemPath>${pom.basedir}/src/main/resources/lib/modbus-spring-boot-starter.jar</systemPath>
         </dependency>
+        <dependency>
+            <groupId>com.jwk</groupId>
+            <artifactId>rfid-zebra-spring-boot-starter</artifactId>
+            <version>1.0</version>
+            <scope>system</scope>
+            <systemPath>${pom.basedir}/src/main/resources/lib/rfid-zebra-spring-boot-starter.jar</systemPath>
+        </dependency>
+
+        <!-- rfid-zebra-只能跑在window上-->
+        <dependency>
+            <groupId>com.warewms</groupId>
+            <artifactId>rfid</artifactId>
+            <version>1.0.0</version>
+            <scope>system</scope>
+            <systemPath>${pom.basedir}/src/main/resources/lib/rfid-1.0.0.jar</systemPath>
+        </dependency>
+
+        <!--modbus4j start-->
+        <dependency>
+            <groupId>com.jwk</groupId>
+            <artifactId>RXTXcomm</artifactId>
+            <version>3.0.5</version>
+            <scope>system</scope>
+            <systemPath>${pom.basedir}/src/main/resources/lib/RXTXcomm.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>com.jwk</groupId>
+            <artifactId>modbus4j</artifactId>
+            <version>3.0.5</version>
+            <scope>system</scope>
+            <systemPath>${pom.basedir}/src/main/resources/lib/modbus4j-3.0.5.jar</systemPath>
+        </dependency>
+        <dependency>
+            <groupId>com.jwk</groupId>
+            <artifactId>jssc</artifactId>
+            <version>2.8.0</version>
+            <scope>system</scope>
+            <systemPath>${pom.basedir}/src/main/resources/lib/jssc-2.8.0.jar</systemPath>
+        </dependency>
+        <!--modbus4j end-->
     </dependencies>
 </project>