瀏覽代碼

工具类添加
库存分配功能

andy 3 年之前
父節點
當前提交
217d8d08db
共有 22 個文件被更改,包括 1295 次插入672 次删除
  1. 1 1
      ruoyi-admin/src/main/resources/application.yml
  2. 5 1
      ruoyi-admin/src/test/java/com/ruoyi/admin/test/base/WarehouseTest.java
  3. 1 2
      ruoyi-admin/start.bat
  4. 二進制
      ruoyi-ui/src/assets/images/login-background.jpeg
  5. 9 2
      ruoyi-ui/src/views/ams/locationPriority/index.vue
  6. 4 660
      ruoyi-ui/src/views/index.vue
  7. 1 1
      ruoyi-ui/src/views/login.vue
  8. 2 2
      ruoyi-ui/vue.config.js
  9. 27 0
      warewms-ams/src/main/java/com/ruoyi/ams/config/domain/dto/OutWarehouseDTO.java
  10. 92 2
      warewms-ams/src/main/java/com/ruoyi/ams/config/service/LocationAllocationStrategy.java
  11. 29 1
      warewms-ams/src/main/java/com/ruoyi/ams/config/service/impl/BusinessServiceImpl.java
  12. 236 0
      warewms-ams/src/main/java/com/ruoyi/ams/inv/domain/InvLotLocId.java
  13. 84 0
      warewms-ams/src/main/java/com/ruoyi/ams/inv/mapper/InvLotLocIdMapper.java
  14. 69 0
      warewms-ams/src/main/java/com/ruoyi/ams/inv/service/IInvLotLocIdService.java
  15. 113 0
      warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotLocIdServiceImpl.java
  16. 203 0
      warewms-ams/src/main/resources/mapper/ams/InvLotLocIdMapper.xml
  17. 128 0
      warewms-base/src/main/java/com/ruoyi/base/domain/SysIdsequence.java
  18. 16 0
      warewms-base/src/main/java/com/ruoyi/base/mapper/SysIdsequenceMapper.java
  19. 10 0
      warewms-base/src/main/java/com/ruoyi/base/service/SysIdsequenceService.java
  20. 58 0
      warewms-base/src/main/java/com/ruoyi/base/service/impl/SysIdsequenceServiceImpl.java
  21. 177 0
      warewms-base/src/main/java/com/ruoyi/base/utils/CommonUtils.java
  22. 30 0
      warewms-base/src/main/resources/mapper/base/SysIdsequenceMapper.xml

+ 1 - 1
ruoyi-admin/src/main/resources/application.yml

@@ -18,7 +18,7 @@ ruoyi:
 # 开发环境配置
 server:
   # 服务器的HTTP端口,默认为8080
-  port: 8089
+  port: 8008
   servlet:
     # 应用的访问路径
     context-path: /

+ 5 - 1
ruoyi-admin/src/test/java/com/ruoyi/admin/test/base/WarehouseTest.java

@@ -8,6 +8,7 @@ import com.ruoyi.ams.config.service.LocationAllocationStrategy;
 import com.ruoyi.base.domain.BaseLocationInfo;
 import com.ruoyi.base.domain.BaseWarehouse;
 import com.ruoyi.base.service.IBaseWarehouseService;
+import com.ruoyi.base.service.SysIdsequenceService;
 import com.ruoyi.framework.web.domain.server.Sys;
 import io.swagger.models.auth.In;
 import org.junit.Test;
@@ -33,6 +34,8 @@ public class WarehouseTest {
     private LocationAllocationStrategy locationAllocationStrategy;
     @Autowired
     private IBusinessService businessService;
+    @Autowired
+    private SysIdsequenceService sysIdsequenceService;
 
     @Test
     public void test() {
@@ -54,6 +57,7 @@ public class WarehouseTest {
 
     @Test
     public void test2() {
-
+        String str = sysIdsequenceService.generateId("ASNNO");
+        System.out.println(str);
     }
 }

+ 1 - 2
ruoyi-admin/start.bat

@@ -22,8 +22,7 @@ rem 启动入口类,该脚本文件用于别的项目时要改这里
 set MAIN_CLASS=com.ruoyi.RuoYiApplication
 
 rem Java 命令行参数,根据需要开启下面的配置,改成自己需要的,注意等号前后不能有空格
-rem set "JAVA_OPTS=-Xms256m -Xmx1024m -Dundertow.port=80 -Dundertow.host=0.0.0.0"
-rem set "JAVA_OPTS=-Dundertow.port=80 -Dundertow.host=0.0.0.0"
+rem set "JAVA_OPTS=-Xms256m -Xmx1024m"
 
 set APP_BASE_PATH=%~dp0
 set CP=%APP_BASE_PATH%conf;%APP_BASE_PATH%lib\*

二進制
ruoyi-ui/src/assets/images/login-background.jpeg


+ 9 - 2
ruoyi-ui/src/views/ams/locationPriority/index.vue

@@ -242,7 +242,14 @@
                 <el-date-picker v-model="scope.row.lotattValue" type="date" placeholder="" style="width: 100%"/>
               </div>
               <div v-if="scope.row.inputType === 'Combobox'">
-                  下拉框暂未实现
+                <el-select v-model="scope.row.lotattValue" placeholder="请选择" clearable size="small" style="width: 100%">
+                  <el-option
+                    v-for="dict in dict.type[scope.row.inputScope]"
+                    :key="dict.value"
+                    :label="dict.label"
+                    :value="dict.value"
+                  />
+                </el-select>
               </div>
             </template>
           </el-table-column>
@@ -263,7 +270,7 @@ import { queryLocationZoneDict } from "@/api/base/locationZone";
 
 export default {
   name: "LocationPriority",
-  dicts: ['sys_yes_no'],
+  dicts: ['sys_yes_no', 'ams_inv_quality'],
   data() {
     return {
       // 遮罩层

文件差異過大導致無法顯示
+ 4 - 660
ruoyi-ui/src/views/index.vue


+ 1 - 1
ruoyi-ui/src/views/login.vue

@@ -161,7 +161,7 @@ export default {
   justify-content: center;
   align-items: center;
   height: 100%;
-  background-image: url("../assets/images/login-background.jpg");
+  background-image: url("../assets/images/login-background.jpeg");
   background-size: cover;
 }
 .title {

+ 2 - 2
ruoyi-ui/vue.config.js

@@ -18,7 +18,7 @@ module.exports = {
   // 部署生产环境和开发环境下的URL。
   // 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
   // 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
-  publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
+  publicPath: process.env.NODE_ENV === "production" ? "/ams" : "/",
   // 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
   outputDir: 'dist',
   // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
@@ -35,7 +35,7 @@ module.exports = {
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-        target: `http://localhost:8089`,
+        target: `http://localhost:8008`,
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''

+ 27 - 0
warewms-ams/src/main/java/com/ruoyi/ams/config/domain/dto/OutWarehouseDTO.java

@@ -13,9 +13,12 @@ public class OutWarehouseDTO {
     private String skuType;
     private Double weight;
     private String supplier;
+    private String locationZoneFrom;
     private String locationFrom;
+    private String locationZoneTo;
     private String locationTo;
     private LotattDTO lotattDTO;
+    private Long warehouseId;
 
     private Map<String, String> attMap;
 
@@ -115,4 +118,28 @@ public class OutWarehouseDTO {
     public void setAttMap(Map<String, String> attMap) {
         this.attMap = attMap;
     }
+
+    public String getLocationZoneFrom() {
+        return locationZoneFrom;
+    }
+
+    public void setLocationZoneFrom(String locationZoneFrom) {
+        this.locationZoneFrom = locationZoneFrom;
+    }
+
+    public String getLocationZoneTo() {
+        return locationZoneTo;
+    }
+
+    public void setLocationZoneTo(String locationZoneTo) {
+        this.locationZoneTo = locationZoneTo;
+    }
+
+    public Long getWarehouseId() {
+        return warehouseId;
+    }
+
+    public void setWarehouseId(Long warehouseId) {
+        this.warehouseId = warehouseId;
+    }
 }

+ 92 - 2
warewms-ams/src/main/java/com/ruoyi/ams/config/service/LocationAllocationStrategy.java

@@ -1,9 +1,11 @@
 package com.ruoyi.ams.config.service;
 
 import com.ruoyi.ams.config.domain.dto.InWarehouseDTO;
+import com.ruoyi.ams.config.domain.dto.OutWarehouseDTO;
 import com.ruoyi.ams.config.domain.vo.LocationPriorityDetailsVO;
 import com.ruoyi.ams.config.domain.vo.LocationPriorityHeaderVO;
 import com.ruoyi.ams.config.mapper.LocationPriorityHeaderMapper;
+import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
 import com.ruoyi.base.domain.BaseLocationInfo;
 import com.ruoyi.base.domain.vo.BaseLocationLotattVO;
 import com.ruoyi.base.mapper.BaseLocationInfoMapper;
@@ -28,6 +30,8 @@ public class LocationAllocationStrategy {
     private BaseLocationInfoMapper baseLocationInfoMapper;
     @Autowired
     private LocationPriorityHeaderMapper locationPriorityHeaderMapper;
+    @Autowired
+    private InvLotLocIdMapper invLotLocIdMapper;
 
     /**
      * 过滤锁定库位
@@ -170,7 +174,93 @@ public class LocationAllocationStrategy {
         return currentLocation;
     }
 
-    /*public BaseLocationInfo filterLockInv() {
+    /**
+     * 过滤出库
+     *
+     * @param zoneId
+     * @param outWarehouseDTO
+     * @param locationPriorityHeaderVO
+     * @return
+     */
+    public BaseLocationInfo filterLockInv(Long zoneId, OutWarehouseDTO outWarehouseDTO, LocationPriorityHeaderVO locationPriorityHeaderVO) {
+        List<BaseLocationLotattVO> locationLotattVOList = invLotLocIdMapper.selectInvLocationList(zoneId, outWarehouseDTO.getSku(), outWarehouseDTO.getSkuType(), 0D, "", outWarehouseDTO.getLotattDTO());
+        List<LocationPriorityDetailsVO> locationPriorityDetails = null;
+        LinkedHashMap<String, String> lotatt = new LinkedHashMap<>();
+        if (locationPriorityHeaderVO != null) {
+            locationPriorityDetails = locationPriorityHeaderMapper.selectLocationPriorityDetailsList(locationPriorityHeaderVO.getId());
+            //批次属性
+            if (locationPriorityDetails != null && locationPriorityDetails.size() > 0) {
+                for (LocationPriorityDetailsVO vo : locationPriorityDetails) {
+                    lotatt.put(vo.getLotattId(), vo.getLotattValue());
+                }
+            }
+        }
+
+        //将同一列的库位排序好
+        Integer parallelCount = 0;
+        LinkedHashMap<String, Boolean> taskingFlag = new LinkedHashMap<>();
+        LinkedHashMap<String, List<BaseLocationLotattVO>> map = new LinkedHashMap<>();
+        for (BaseLocationLotattVO info : locationLotattVOList) {
+            List<BaseLocationLotattVO> infoList;
+            if (map.containsKey(info.getColNo())) {
+                infoList = map.get(info.getColNo());
+            } else {
+                infoList = new ArrayList<>();
+            }
+            if (info.getStockStatus().equals("10")) {
+                taskingFlag.put(info.getColNo(), true);
+                parallelCount++;
+            } else {
+                if (taskingFlag.get(info.getColNo()) == null || taskingFlag.get(info.getColNo()).booleanValue() == false) {
+                    taskingFlag.put(info.getColNo(), false);
+                }
+            }
+            infoList.add(info);
+            map.put(info.getColNo(), infoList);
+        }
+        //TODO 近效期
+        //过滤出每列可以用的库位并进行分配
+        BaseLocationInfo currentLocation = null;
+        for (Map.Entry<String, List<BaseLocationLotattVO>> entry : map.entrySet()) {
+            List<BaseLocationLotattVO> locationInfoList = entry.getValue();
+            for (BaseLocationLotattVO b : locationInfoList) {
+                if (locationPriorityHeaderVO.getSameLotattFlag().equals("N")) {
+                    //如果外围优先则跳过当前出
+                    if (locationPriorityHeaderVO.getOuterFlag().equals("Y")) {
+                        if (taskingFlag.get(b.getColNo())) {
+                            continue;
+                        }
+                    }
+                }
+                /*if (locationPriorityHeaderVO.getParallelFlag().equals("Y")) {
+                    //如果达到并行数量,则当前区域不再进行分配
+                    if (parallelCount + 1 > locationPriorityHeaderVO.getParallelCount()) {
+                        return null;
+                    }
+                    if (taskingFlag.get(b.getColNo())) {
+                        continue;
+                    }
+                }*/
 
-    }*/
+                if (currentLocation == null) {
+                    if (b.getIsEmpty().equals("Y") && b.getStockStatus().equals("00")) {
+                        BaseLocationInfo locationInfo = new BaseLocationInfo();
+                        BeanUtils.copyProperties(b, locationInfo);
+                        currentLocation = locationInfo;
+                    }
+                } else {
+                    //如果前面的库位已阻挡则之前的库位不可用
+                    if (!b.getIsEmpty().equals("Y") || !b.getStockStatus().equals("00")) {
+                        currentLocation = null;
+                    } else {
+                        continue;
+                    }
+                }
+            }
+            if (currentLocation != null) {
+                break;
+            }
+        }
+        return currentLocation;
+    }
 }

+ 29 - 1
warewms-ams/src/main/java/com/ruoyi/ams/config/service/impl/BusinessServiceImpl.java

@@ -9,6 +9,7 @@ import com.ruoyi.ams.config.mapper.LocationPriorityHeaderMapper;
 import com.ruoyi.ams.config.service.IBusinessService;
 import com.ruoyi.ams.config.service.ILocationPriorityHeaderService;
 import com.ruoyi.ams.config.service.LocationAllocationStrategy;
+import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
 import com.ruoyi.base.domain.BaseLocationInfo;
 import com.ruoyi.base.service.IBaseLocationInfoService;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -33,6 +34,8 @@ public class BusinessServiceImpl implements IBusinessService {
     private LocationAllocationStrategy locationAllocationStrategy;
     @Autowired
     private LocationPriorityHeaderMapper locationPriorityHeaderMapper;
+    @Autowired
+    private InvLotLocIdMapper invLotLocIdMapper;
 
     @Transactional
     @Override
@@ -92,11 +95,36 @@ public class BusinessServiceImpl implements IBusinessService {
         }
     }
 
+    @Transactional
     @Override
     public BaseLocationInfo OutInvAllocation(OutWarehouseDTO outWarehouseDTO) {
         /**
-         *
+         * 指定位置出库
          */
+        if (!StringUtils.isEmpty(outWarehouseDTO.getLocationFrom())) {
+            BaseLocationInfo baseLocationInfo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(outWarehouseDTO.getLocationFrom(), outWarehouseDTO.getWarehouseId());
+            return baseLocationInfo;
+        } else {
+            //未指定明确位置出库
+            List<Long> zoneIdList = new ArrayList<>();
+            if (!StringUtils.isEmpty(outWarehouseDTO.getLocationZoneFrom())) {
+                zoneIdList.add(Long.parseLong(outWarehouseDTO.getLocationZoneFrom()));
+            } else {
+                List<Long> zoneList = invLotLocIdMapper.selectInvZoneBySkuOrSkuType(outWarehouseDTO.getSku(),outWarehouseDTO.getSkuType());
+                zoneIdList.addAll(zoneList);
+            }
+
+            for (Long zoneId : zoneIdList) {
+                LocationPriorityHeader query = new LocationPriorityHeader();
+                query.setLocationZone(zoneId.toString());
+                List<LocationPriorityHeaderVO> list = locationPriorityHeaderService.selectLocationPriorityHeaderList(query);
+                LocationPriorityHeaderVO vo = null;
+                if (list != null && list.size() > 0) {
+                    vo = list.get(0);
+                }
+                return locationAllocationStrategy.filterLockInv(zoneId, outWarehouseDTO, vo);
+            }
+        }
         return null;
     }
 }

+ 236 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/domain/InvLotLocId.java

@@ -0,0 +1,236 @@
+package com.ruoyi.ams.inv.domain;
+
+import java.math.BigDecimal;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 库位库存信息对象 inv_lot_loc_id
+ * 
+ * @author andy
+ * @date 2022-03-03
+ */
+public class InvLotLocId extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 批次号 */
+    private String lotnum;
+
+    /** 库位 */
+    private String locationId;
+
+    /** 跟踪号 */
+    @Excel(name = "跟踪号")
+    private String traceid;
+
+    /** 客户 */
+    private String customerId;
+
+    /** 产品 */
+    private String sku;
+
+    /** 库存数量(件) */
+    @Excel(name = "库存数量(件)")
+    private BigDecimal qty;
+
+    /** 库存数量 */
+    @Excel(name = "库存数量")
+    private BigDecimal qtyEach;
+
+    /** 分配数量 */
+    @Excel(name = "分配数量")
+    private BigDecimal qtyallocated;
+
+    /** 库存数量(件) */
+    @Excel(name = "库存数量(件)")
+    private BigDecimal qtyallocatedEach;
+
+    /** 上架数量 */
+    @Excel(name = "上架数量")
+    private BigDecimal qtypa;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private BigDecimal qtyrpin;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private BigDecimal qtyrpout;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private BigDecimal qtymvin;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private BigDecimal qtymvout;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private BigDecimal qtyonhold;
+
+    public void setLotnum(String lotnum) 
+    {
+        this.lotnum = lotnum;
+    }
+
+    public String getLotnum() 
+    {
+        return lotnum;
+    }
+    public void setLocationId(String locationId) 
+    {
+        this.locationId = locationId;
+    }
+
+    public String getLocationId() 
+    {
+        return locationId;
+    }
+    public void setTraceid(String traceid) 
+    {
+        this.traceid = traceid;
+    }
+
+    public String getTraceid() 
+    {
+        return traceid;
+    }
+    public void setCustomerId(String customerId) 
+    {
+        this.customerId = customerId;
+    }
+
+    public String getCustomerId() 
+    {
+        return customerId;
+    }
+    public void setSku(String sku) 
+    {
+        this.sku = sku;
+    }
+
+    public String getSku() 
+    {
+        return sku;
+    }
+    public void setQty(BigDecimal qty) 
+    {
+        this.qty = qty;
+    }
+
+    public BigDecimal getQty() 
+    {
+        return qty;
+    }
+    public void setQtyEach(BigDecimal qtyEach) 
+    {
+        this.qtyEach = qtyEach;
+    }
+
+    public BigDecimal getQtyEach() 
+    {
+        return qtyEach;
+    }
+    public void setQtyallocated(BigDecimal qtyallocated) 
+    {
+        this.qtyallocated = qtyallocated;
+    }
+
+    public BigDecimal getQtyallocated() 
+    {
+        return qtyallocated;
+    }
+    public void setQtyallocatedEach(BigDecimal qtyallocatedEach) 
+    {
+        this.qtyallocatedEach = qtyallocatedEach;
+    }
+
+    public BigDecimal getQtyallocatedEach() 
+    {
+        return qtyallocatedEach;
+    }
+    public void setQtypa(BigDecimal qtypa) 
+    {
+        this.qtypa = qtypa;
+    }
+
+    public BigDecimal getQtypa() 
+    {
+        return qtypa;
+    }
+    public void setQtyrpin(BigDecimal qtyrpin) 
+    {
+        this.qtyrpin = qtyrpin;
+    }
+
+    public BigDecimal getQtyrpin() 
+    {
+        return qtyrpin;
+    }
+    public void setQtyrpout(BigDecimal qtyrpout) 
+    {
+        this.qtyrpout = qtyrpout;
+    }
+
+    public BigDecimal getQtyrpout() 
+    {
+        return qtyrpout;
+    }
+    public void setQtymvin(BigDecimal qtymvin) 
+    {
+        this.qtymvin = qtymvin;
+    }
+
+    public BigDecimal getQtymvin() 
+    {
+        return qtymvin;
+    }
+    public void setQtymvout(BigDecimal qtymvout) 
+    {
+        this.qtymvout = qtymvout;
+    }
+
+    public BigDecimal getQtymvout() 
+    {
+        return qtymvout;
+    }
+    public void setQtyonhold(BigDecimal qtyonhold) 
+    {
+        this.qtyonhold = qtyonhold;
+    }
+
+    public BigDecimal getQtyonhold() 
+    {
+        return qtyonhold;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("lotnum", getLotnum())
+            .append("locationId", getLocationId())
+            .append("traceid", getTraceid())
+            .append("customerId", getCustomerId())
+            .append("sku", getSku())
+            .append("qty", getQty())
+            .append("qtyEach", getQtyEach())
+            .append("qtyallocated", getQtyallocated())
+            .append("qtyallocatedEach", getQtyallocatedEach())
+            .append("qtypa", getQtypa())
+            .append("qtyrpin", getQtyrpin())
+            .append("qtyrpout", getQtyrpout())
+            .append("qtymvin", getQtymvin())
+            .append("qtymvout", getQtymvout())
+            .append("qtyonhold", getQtyonhold())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("remark", getRemark())
+            .toString();
+    }
+}

+ 84 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/mapper/InvLotLocIdMapper.java

@@ -0,0 +1,84 @@
+package com.ruoyi.ams.inv.mapper;
+
+import java.util.List;
+
+import com.ruoyi.ams.config.domain.dto.LotattDTO;
+import com.ruoyi.ams.inv.domain.InvLotLocId;
+import com.ruoyi.base.domain.vo.BaseLocationLotattVO;
+
+/**
+ * 库位库存信息Mapper接口
+ * 
+ * @author andy
+ * @date 2022-03-03
+ */
+public interface InvLotLocIdMapper 
+{
+    /**
+     * 查询库位库存信息
+     * 
+     * @param lotnum 库位库存信息主键
+     * @return 库位库存信息
+     */
+     InvLotLocId selectInvLotLocIdByLotnum(String lotnum);
+
+    /**
+     * 查询库位库存信息列表
+     * 
+     * @param invLotLocId 库位库存信息
+     * @return 库位库存信息集合
+     */
+     List<InvLotLocId> selectInvLotLocIdList(InvLotLocId invLotLocId);
+
+    /**
+     * 新增库位库存信息
+     * 
+     * @param invLotLocId 库位库存信息
+     * @return 结果
+     */
+     int insertInvLotLocId(InvLotLocId invLotLocId);
+
+    /**
+     * 修改库位库存信息
+     * 
+     * @param invLotLocId 库位库存信息
+     * @return 结果
+     */
+     int updateInvLotLocId(InvLotLocId invLotLocId);
+
+    /**
+     * 删除库位库存信息
+     * 
+     * @param lotnum 库位库存信息主键
+     * @return 结果
+     */
+     int deleteInvLotLocIdByLotnum(String lotnum);
+
+    /**
+     * 批量删除库位库存信息
+     * 
+     * @param lotnums 需要删除的数据主键集合
+     * @return 结果
+     */
+     int deleteInvLotLocIdByLotnums(String[] lotnums);
+
+    /**
+     * 查询库位库存
+     * @param zoneId
+     * @param sku
+     * @param skuType
+     * @param weight
+     * @param supplier
+     * @param lotattDTO
+     * @return
+     */
+     List<BaseLocationLotattVO> selectInvLocationList(Long zoneId, String sku, String skuType, Double weight, String supplier, LotattDTO lotattDTO);
+
+    /**
+     * 根据sku和skuType查询已存在库存的区域
+     * @param sku
+     * @param skuType
+     * @return
+     */
+     List<Long> selectInvZoneBySkuOrSkuType(String sku,String skuType);
+}

+ 69 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/IInvLotLocIdService.java

@@ -0,0 +1,69 @@
+package com.ruoyi.ams.inv.service;
+
+import java.util.List;
+import com.ruoyi.ams.inv.domain.InvLotLocId;
+
+/**
+ * 库位库存信息Service接口
+ * 
+ * @author andy
+ * @date 2022-03-03
+ */
+public interface IInvLotLocIdService 
+{
+    /**
+     * 查询库位库存信息
+     * 
+     * @param lotnum 库位库存信息主键
+     * @return 库位库存信息
+     */
+     InvLotLocId selectInvLotLocIdByLotnum(String lotnum);
+
+    /**
+     * 查询库位库存信息列表
+     * 
+     * @param invLotLocId 库位库存信息
+     * @return 库位库存信息集合
+     */
+     List<InvLotLocId> selectInvLotLocIdList(InvLotLocId invLotLocId);
+
+    /**
+     * 查询库位库存信息
+     *
+     * @param invLotLocId 库位库存信息
+     * @return 库位库存信息集合
+     */
+    InvLotLocId selectInvLotLocIdByModel(InvLotLocId invLotLocId);
+
+    /**
+     * 新增库位库存信息
+     * 
+     * @param invLotLocId 库位库存信息
+     * @return 结果
+     */
+     int insertInvLotLocId(InvLotLocId invLotLocId);
+
+    /**
+     * 修改库位库存信息
+     * 
+     * @param invLotLocId 库位库存信息
+     * @return 结果
+     */
+     int updateInvLotLocId(InvLotLocId invLotLocId);
+
+    /**
+     * 批量删除库位库存信息
+     * 
+     * @param lotnums 需要删除的库位库存信息主键集合
+     * @return 结果
+     */
+     int deleteInvLotLocIdByLotnums(String[] lotnums);
+
+    /**
+     * 删除库位库存信息信息
+     * 
+     * @param lotnum 库位库存信息主键
+     * @return 结果
+     */
+     int deleteInvLotLocIdByLotnum(String lotnum);
+}

+ 113 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotLocIdServiceImpl.java

@@ -0,0 +1,113 @@
+package com.ruoyi.ams.inv.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
+import com.ruoyi.ams.inv.domain.InvLotLocId;
+import com.ruoyi.ams.inv.service.IInvLotLocIdService;
+
+/**
+ * 库位库存信息Service业务层处理
+ * 
+ * @author andy
+ * @date 2022-03-03
+ */
+@Service
+public class InvLotLocIdServiceImpl implements IInvLotLocIdService 
+{
+    @Autowired
+    private InvLotLocIdMapper invLotLocIdMapper;
+
+    /**
+     * 查询库位库存信息
+     * 
+     * @param lotnum 库位库存信息主键
+     * @return 库位库存信息
+     */
+    @Override
+    public InvLotLocId selectInvLotLocIdByLotnum(String lotnum)
+    {
+        return invLotLocIdMapper.selectInvLotLocIdByLotnum(lotnum);
+    }
+
+    /**
+     * 查询库位库存信息列表
+     * 
+     * @param invLotLocId 库位库存信息
+     * @return 库位库存信息
+     */
+    @Override
+    public List<InvLotLocId> selectInvLotLocIdList(InvLotLocId invLotLocId)
+    {
+        return invLotLocIdMapper.selectInvLotLocIdList(invLotLocId);
+    }
+
+    /**
+     * 查询库位库存信息
+     *
+     * @param invLotLocId 库位库存信息
+     * @return 库位库存信息
+     */
+    @Override
+    public InvLotLocId selectInvLotLocIdByModel(InvLotLocId invLotLocId)
+    {
+        List<InvLotLocId> list = invLotLocIdMapper.selectInvLotLocIdList(invLotLocId);
+        if (list!=null && list.size()>0) {
+            return list.get(0);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * 新增库位库存信息
+     * 
+     * @param invLotLocId 库位库存信息
+     * @return 结果
+     */
+    @Override
+    public int insertInvLotLocId(InvLotLocId invLotLocId)
+    {
+        invLotLocId.setCreateTime(DateUtils.getNowDate());
+        return invLotLocIdMapper.insertInvLotLocId(invLotLocId);
+    }
+
+    /**
+     * 修改库位库存信息
+     * 
+     * @param invLotLocId 库位库存信息
+     * @return 结果
+     */
+    @Override
+    public int updateInvLotLocId(InvLotLocId invLotLocId)
+    {
+        invLotLocId.setUpdateTime(DateUtils.getNowDate());
+        return invLotLocIdMapper.updateInvLotLocId(invLotLocId);
+    }
+
+    /**
+     * 批量删除库位库存信息
+     * 
+     * @param lotnums 需要删除的库位库存信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteInvLotLocIdByLotnums(String[] lotnums)
+    {
+        return invLotLocIdMapper.deleteInvLotLocIdByLotnums(lotnums);
+    }
+
+    /**
+     * 删除库位库存信息信息
+     * 
+     * @param lotnum 库位库存信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteInvLotLocIdByLotnum(String lotnum)
+    {
+        return invLotLocIdMapper.deleteInvLotLocIdByLotnum(lotnum);
+    }
+}

+ 203 - 0
warewms-ams/src/main/resources/mapper/ams/InvLotLocIdMapper.xml

@@ -0,0 +1,203 @@
+<?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.ruoyi.ams.inv.mapper.InvLotLocIdMapper">
+    
+    <resultMap type="InvLotLocId" id="InvLotLocIdResult">
+        <result property="lotnum"    column="lotnum"    />
+        <result property="locationId"    column="location_id"    />
+        <result property="traceid"    column="traceid"    />
+        <result property="customerId"    column="customer_id"    />
+        <result property="sku"    column="sku"    />
+        <result property="qty"    column="qty"    />
+        <result property="qtyEach"    column="qty_each"    />
+        <result property="qtyallocated"    column="qtyallocated"    />
+        <result property="qtyallocatedEach"    column="qtyallocated_each"    />
+        <result property="qtypa"    column="qtypa"    />
+        <result property="qtyrpin"    column="qtyrpin"    />
+        <result property="qtyrpout"    column="qtyrpout"    />
+        <result property="qtymvin"    column="qtymvin"    />
+        <result property="qtymvout"    column="qtymvout"    />
+        <result property="qtyonhold"    column="qtyonhold"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <resultMap type="BaseLocationLotattVO" id="BaseLocationInfoLotattResult">
+        <result property="id"    column="id"    />
+        <result property="warehouseId"    column="warehouse_id"    />
+        <result property="zoneId"    column="zone_id"    />
+        <result property="locationNo"    column="location_no"    />
+        <result property="locationBarcode"    column="location_barcode"    />
+        <result property="rowNo"    column="row_no"    />
+        <result property="rowIndex"    column="row_index"    />
+        <result property="colNo"    column="col_no"    />
+        <result property="colIndex"    column="col_index"    />
+        <result property="shiftNo"    column="shift_no"    />
+        <result property="shiftIndex"    column="shift_index"    />
+        <result property="stockStatus"    column="stock_status"    />
+        <result property="isEmpty"    column="is_empty"    />
+        <result property="bindSku"    column="bind_sku"    />
+        <result property="locationType"    column="location_type"    />
+        <result property="rackId"    column="rack_id"    />
+        <result property="agvStation"    column="agv_station"    />
+        <result property="foldedTag"    column="folded_tag"    />
+        <result property="foldedCount"    column="folded_count"    />
+        <result property="userdefine1"    column="userdefine1"    />
+        <result property="userdefine2"    column="userdefine2"    />
+        <result property="userdefine3"    column="userdefine3"    />
+        <result property="userdefine4"    column="userdefine4"    />
+        <result property="userdefine5"    column="userdefine5"    />
+        <result property="userdefine6"    column="userdefine6"    />
+        <result property="userdefine7"    column="userdefine7"    />
+        <result property="userdefine8"    column="userdefine8"    />
+        <result property="userdefine9"    column="userdefine9"    />
+        <result property="userdefine10"    column="userdefine10"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+        <result property="sku"    column="sku"    />
+        <result property="qty"    column="qty"    />
+    </resultMap>
+
+    <sql id="selectInvLotLocIdVo">
+        select lotnum, location_id, traceid, customer_id, sku, qty, qty_each, qtyallocated, qtyallocated_each, qtypa, qtyrpin, qtyrpout, qtymvin, qtymvout, qtyonhold, create_by, create_time, update_by, update_time, remark from inv_lot_loc_id
+    </sql>
+
+    <select id="selectInvLotLocIdList" parameterType="InvLotLocId" resultMap="InvLotLocIdResult">
+        <include refid="selectInvLotLocIdVo"/>
+        <where>  
+            <if test="traceid != null  and traceid != ''"> and traceid = #{traceid}</if>
+        </where>
+    </select>
+    
+    <select id="selectInvLotLocIdByLotnum" parameterType="String" resultMap="InvLotLocIdResult">
+        <include refid="selectInvLotLocIdVo"/>
+        where lotnum = #{lotnum}
+    </select>
+        
+    <insert id="insertInvLotLocId" parameterType="InvLotLocId">
+        insert into inv_lot_loc_id
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="lotnum != null">lotnum,</if>
+            <if test="locationId != null">location_id,</if>
+            <if test="traceid != null">traceid,</if>
+            <if test="customerId != null">customer_id,</if>
+            <if test="sku != null">sku,</if>
+            <if test="qty != null">qty,</if>
+            <if test="qtyEach != null">qty_each,</if>
+            <if test="qtyallocated != null">qtyallocated,</if>
+            <if test="qtyallocatedEach != null">qtyallocated_each,</if>
+            <if test="qtypa != null">qtypa,</if>
+            <if test="qtyrpin != null">qtyrpin,</if>
+            <if test="qtyrpout != null">qtyrpout,</if>
+            <if test="qtymvin != null">qtymvin,</if>
+            <if test="qtymvout != null">qtymvout,</if>
+            <if test="qtyonhold != null">qtyonhold,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="lotnum != null">#{lotnum},</if>
+            <if test="locationId != null">#{locationId},</if>
+            <if test="traceid != null">#{traceid},</if>
+            <if test="customerId != null">#{customerId},</if>
+            <if test="sku != null">#{sku},</if>
+            <if test="qty != null">#{qty},</if>
+            <if test="qtyEach != null">#{qtyEach},</if>
+            <if test="qtyallocated != null">#{qtyallocated},</if>
+            <if test="qtyallocatedEach != null">#{qtyallocatedEach},</if>
+            <if test="qtypa != null">#{qtypa},</if>
+            <if test="qtyrpin != null">#{qtyrpin},</if>
+            <if test="qtyrpout != null">#{qtyrpout},</if>
+            <if test="qtymvin != null">#{qtymvin},</if>
+            <if test="qtymvout != null">#{qtymvout},</if>
+            <if test="qtyonhold != null">#{qtyonhold},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateInvLotLocId" parameterType="InvLotLocId">
+        update inv_lot_loc_id
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="locationId != null">location_id = #{locationId},</if>
+            <if test="traceid != null">traceid = #{traceid},</if>
+            <if test="customerId != null">customer_id = #{customerId},</if>
+            <if test="sku != null">sku = #{sku},</if>
+            <if test="qty != null">qty = #{qty},</if>
+            <if test="qtyEach != null">qty_each = #{qtyEach},</if>
+            <if test="qtyallocated != null">qtyallocated = #{qtyallocated},</if>
+            <if test="qtyallocatedEach != null">qtyallocated_each = #{qtyallocatedEach},</if>
+            <if test="qtypa != null">qtypa = #{qtypa},</if>
+            <if test="qtyrpin != null">qtyrpin = #{qtyrpin},</if>
+            <if test="qtyrpout != null">qtyrpout = #{qtyrpout},</if>
+            <if test="qtymvin != null">qtymvin = #{qtymvin},</if>
+            <if test="qtymvout != null">qtymvout = #{qtymvout},</if>
+            <if test="qtyonhold != null">qtyonhold = #{qtyonhold},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where lotnum = #{lotnum}
+    </update>
+
+    <delete id="deleteInvLotLocIdByLotnum" parameterType="String">
+        delete from inv_lot_loc_id where lotnum = #{lotnum}
+    </delete>
+
+    <delete id="deleteInvLotLocIdByLotnums" parameterType="String">
+        delete from inv_lot_loc_id where lotnum in 
+        <foreach item="lotnum" collection="array" open="(" separator="," close=")">
+            #{lotnum}
+        </foreach>
+    </delete>
+
+    <select id="selectInvLocationList" resultMap="BaseLocationInfoLotattResult">
+        select
+        b.id, b.warehouse_id, b.zone_id, b.location_no, b.location_barcode, b.row_no, b.row_index, b.col_no, b.col_index, b.shift_no,
+        b.shift_index, b.stock_status, b.is_empty, b.bind_sku, b.location_type,  b.rack_id,  b.agv_station,  b.folded_tag,  b.folded_count,
+        b.userdefine1, b.userdefine2, b.userdefine3, b.userdefine4,  b.userdefine5,  b.userdefine6,  b.userdefine7,  b.userdefine8,
+        b.userdefine9, b.userdefine10, b.create_by, b.create_time,  b.update_by,  b.update_time,  b.remark, inv.sku, inv.qty, att.*
+        from inv_lot_loc_id inv
+        left join inv_lot_att att on inv.lotnum = att.lotnum
+        left join base_location_info b on inv.location_id = b.id
+        left join base_sku sk on inv.sku = sk.sku
+        left join base_sku_type skt on sk.sku_type = skt.item_code
+        <where>
+            <if test="zoneId != null  and zoneId != ''"> and b.zone_id = #{zoneId}</if>
+            <if test="sku != null  and sku != ''"> and sk.sku = #{sku}</if>
+            <if test="skuType != null  and skuType != ''"> and skt.item_code = #{skuType}</if>
+        </where>
+        order by lpad(b.row_no, 11, '0'),b.row_index,lpad(b.shift_no, 11, '0'),b.shift_index,lpad(b.col_no, 11, '0'),b.col_index desc
+    </select>
+
+    <select id="selectInvZoneBySkuOrSkuType" resultMap="BaseLocationInfoLotattResult">
+        select
+        b.zone_id
+        from inv_lot_loc_id inv
+        left join inv_lot_att att on inv.lotnum = att.lotnum
+        left join base_location_info b on inv.location_id = b.id
+        left join base_sku sk on inv.sku = sk.sku
+        left join base_sku_type skt on sk.sku_type = skt.item_code
+        <where>
+            <if test="sku != null  and sku != ''"> and sk.sku = #{sku}</if>
+            <if test="skuType != null  and skuType != ''"> and skt.item_code = #{skuType}</if>
+        </where>
+    </select>
+
+</mapper>

+ 128 - 0
warewms-base/src/main/java/com/ruoyi/base/domain/SysIdsequence.java

@@ -0,0 +1,128 @@
+package com.ruoyi.base.domain;
+
+import java.math.BigDecimal;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: andy.qu
+ * Date: 2022/3/4
+ */
+public class SysIdsequence {
+    private String idName;
+    private String descr;
+    private String idType;
+    private BigDecimal idSequence;
+    private String createDate;
+    private String maxidSequence;
+    private String createUserId;
+    private String editTime;
+    private String editUserId;
+    private String prefix;
+    private Long length;
+    private String dateFormat;
+    private String dateMax;
+
+    public String getIdName() {
+        return idName;
+    }
+
+    public void setIdName(String idName) {
+        this.idName = idName;
+    }
+
+    public String getDescr() {
+        return descr;
+    }
+
+    public void setDescr(String descr) {
+        this.descr = descr;
+    }
+
+    public String getIdType() {
+        return idType;
+    }
+
+    public void setIdType(String idType) {
+        this.idType = idType;
+    }
+
+    public BigDecimal getIdSequence() {
+        return idSequence;
+    }
+
+    public void setIdSequence(BigDecimal idSequence) {
+        this.idSequence = idSequence;
+    }
+
+    public String getCreateDate() {
+        return createDate;
+    }
+
+    public void setCreateDate(String createDate) {
+        this.createDate = createDate;
+    }
+
+    public String getMaxidSequence() {
+        return maxidSequence;
+    }
+
+    public void setMaxidSequence(String maxidSequence) {
+        this.maxidSequence = maxidSequence;
+    }
+
+    public String getCreateUserId() {
+        return createUserId;
+    }
+
+    public void setCreateUserId(String createUserId) {
+        this.createUserId = createUserId;
+    }
+
+    public String getEditTime() {
+        return editTime;
+    }
+
+    public void setEditTime(String editTime) {
+        this.editTime = editTime;
+    }
+
+    public String getEditUserId() {
+        return editUserId;
+    }
+
+    public void setEditUserId(String editUserId) {
+        this.editUserId = editUserId;
+    }
+
+    public String getPrefix() {
+        return prefix;
+    }
+
+    public void setPrefix(String prefix) {
+        this.prefix = prefix;
+    }
+
+    public Long getLength() {
+        return length;
+    }
+
+    public void setLength(Long length) {
+        this.length = length;
+    }
+
+    public String getDateFormat() {
+        return dateFormat;
+    }
+
+    public void setDateFormat(String dateFormat) {
+        this.dateFormat = dateFormat;
+    }
+
+    public String getDateMax() {
+        return dateMax;
+    }
+
+    public void setDateMax(String dateMax) {
+        this.dateMax = dateMax;
+    }
+}

+ 16 - 0
warewms-base/src/main/java/com/ruoyi/base/mapper/SysIdsequenceMapper.java

@@ -0,0 +1,16 @@
+package com.ruoyi.base.mapper;
+
+import com.ruoyi.base.domain.SysIdsequence;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: andy.qu
+ * Date: 2022/3/4
+ */
+public interface SysIdsequenceMapper {
+
+    boolean updateByVersion(@Param("idName") String idName,@Param("dateMax") String dateMax,@Param("oldIdsequenc") int oldIdsequenc,@Param("nextIdsequenc") int nextIdsequenc);
+
+    SysIdsequence selectByIdname(@Param("idName")String idName);
+}

+ 10 - 0
warewms-base/src/main/java/com/ruoyi/base/service/SysIdsequenceService.java

@@ -0,0 +1,10 @@
+package com.ruoyi.base.service;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: andy.qu
+ * Date: 2022/3/4
+ */
+public interface SysIdsequenceService {
+    String generateId(String idName);
+}

+ 58 - 0
warewms-base/src/main/java/com/ruoyi/base/service/impl/SysIdsequenceServiceImpl.java

@@ -0,0 +1,58 @@
+package com.ruoyi.base.service.impl;
+
+import com.ruoyi.base.domain.SysIdsequence;
+import com.ruoyi.base.mapper.SysIdsequenceMapper;
+import com.ruoyi.base.service.SysIdsequenceService;
+import com.ruoyi.base.utils.CommonUtils;
+import com.ruoyi.common.utils.DateUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: andy.qu
+ * Date: 2022/3/4
+ */
+@Service
+public class SysIdsequenceServiceImpl implements SysIdsequenceService {
+
+    @Autowired
+    private SysIdsequenceMapper sysIdsequenceMapper;
+
+    @Override
+    public String generateId(String idName) {
+        while (true) {
+            SysIdsequence sysIdsequence = sysIdsequenceMapper.selectByIdname(idName);
+            if (sysIdsequence == null) {
+                return null;
+            }
+
+            String prefix;
+            String dateStr = "";
+            if(!StringUtils.isEmpty(sysIdsequence.getDateFormat()) && (sysIdsequence.getDateFormat().equals("YYYYMMDD") || sysIdsequence.getDateFormat().equals("YYMMDD"))){
+                prefix = sysIdsequence.getPrefix() + DateUtils.parseDateToStr("yMMdd",new Date());
+                dateStr = DateUtils.parseDateToStr("yMMdd",new Date());
+            }else {
+                prefix = sysIdsequence.getPrefix();
+            }
+            int index = 0;
+            if(sysIdsequence.getDateFormat() == null || sysIdsequence.getDateFormat().equals("") || dateStr.equals(sysIdsequence.getDateMax())){
+                index = sysIdsequence.getIdSequence() == null ? 0 : sysIdsequence.getIdSequence().intValue();
+            }
+            String resultNo = "";
+            if(!StringUtils.isEmpty(prefix)){
+                resultNo = prefix + CommonUtils.lpad((index+1)+"",sysIdsequence.getLength().intValue(),"0");
+            }else {
+                resultNo =  (index+1)+"";
+            }
+
+            boolean isOk = sysIdsequenceMapper.updateByVersion(idName,dateStr,sysIdsequence.getIdSequence().intValue(),index+1);
+            if(isOk){
+                return resultNo;
+            }
+        }
+    }
+}

+ 177 - 0
warewms-base/src/main/java/com/ruoyi/base/utils/CommonUtils.java

@@ -0,0 +1,177 @@
+package com.ruoyi.base.utils;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: andy.qu
+ * Date: 2019/11/14
+ */
+public class CommonUtils {
+
+    //转变的依赖字符
+    public static final char UNDERLINE = '_';
+
+    /**
+     * 文件下载
+     *
+     * @param file
+     * @param res
+     * @throws IOException
+     */
+    public static void download(File file, HttpServletResponse res) throws IOException {
+        // 发送给客户端的数据
+        OutputStream outputStream = res.getOutputStream();
+        byte[] buff = new byte[1024];
+        BufferedInputStream bis = null;
+        // 读取filename
+        bis = new BufferedInputStream(new FileInputStream(file));
+        int i = bis.read(buff);
+        while (i != -1) {
+            outputStream.write(buff, 0, buff.length);
+            outputStream.flush();
+            i = bis.read(buff);
+        }
+    }
+
+    /**
+     * 文件下载
+     *
+     * @param inputStream
+     * @param res
+     * @throws IOException
+     */
+    public static void download(InputStream inputStream, HttpServletResponse res) throws IOException {
+        // 发送给客户端的数据
+        OutputStream outputStream = res.getOutputStream();
+        byte[] buff = new byte[1024];
+        BufferedInputStream bis = null;
+        // 读取filename
+        bis = new BufferedInputStream(inputStream);
+        int i = bis.read(buff);
+        while (i != -1) {
+            outputStream.write(buff, 0, buff.length);
+            outputStream.flush();
+            i = bis.read(buff);
+        }
+    }
+
+    /**
+     * 对象字符串转换null判断
+     *
+     * @return
+     */
+    public static String objectStringConvert(Object object) {
+        return object == null ? "" : object.toString();
+    }
+
+    /**
+     * 检查是否为Int
+     *
+     * @param value    值
+     * @param fildName 提示字段名称
+     * @return
+     */
+    public static void checkInt(String value, String fildName) {
+        try {
+            Integer i = Integer.parseInt(value);
+        } catch (Exception e) {
+            throw new RuntimeException(fildName + "必须是整数");
+        }
+    }
+
+    /**
+     * 对象转map
+     *
+     * @param obj
+     * @return
+     */
+    public static Map<String, String> objToMap(Object obj) {
+        if (obj == null) {
+            return null;
+        }
+        JSONObject jsonObj = (JSONObject) JSON.toJSON(obj);
+        Map<String, String> map = JSONObject.parseObject(jsonObj.toJSONString(), new TypeReference<Map<String, String>>() {
+        });
+        return map;
+    }
+
+    /**
+     * 将驼峰转换成"_"(userId:user_id)
+     *
+     * @param param
+     * @return
+     */
+    public static String camelToUnderline(String param) {
+        if (param == null || "".equals(param.trim())) {
+            return "";
+        }
+        int len = param.length();
+        StringBuilder sb = new StringBuilder(len);
+        for (int i = 0; i < len; i++) {
+            char c = param.charAt(i);
+            if (Character.isUpperCase(c)) {
+                sb.append(UNDERLINE);
+                sb.append(Character.toLowerCase(c));
+            } else {
+                sb.append(c);
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
+     * 将"_"转成驼峰(user_id:userId)
+     *
+     * @param param
+     * @return
+     */
+    public static String underlineToCamel(String param) {
+        if (param == null || "".equals(param.trim())) {
+            return "";
+        }
+        int len = param.length();
+        StringBuilder sb = new StringBuilder(len);
+        for (int i = 0; i < len; i++) {
+            char c = param.charAt(i);
+            if (c == UNDERLINE) {
+                if (++i < len) {
+                    sb.append(Character.toUpperCase(param.charAt(i)));
+                }
+            } else {
+                sb.append(c);
+            }
+        }
+        return sb.toString();
+    }
+
+    public static String lpad(String s, int n, String replace) {
+        while (s.length() < n) {
+            s = replace+s;
+        }
+        return s;
+    }
+
+    public static void main(String[] args) {
+
+        //String pwd = RandomUtil.randomNumbers(6);
+
+        //System.out.println(DigestUtils.sha256Hex("583817"));
+        List<Map<String, Object>> arr = new ArrayList<>();
+        Map<String, Object> map1 = new HashMap<>();
+        map1.put("key", "123");
+        map1.put("value", "1");
+        arr.add(map1);
+        List<Object> map = arr.stream().map(e -> e.put("key","")).collect(Collectors.toList());
+        System.out.println(JSON.toJSONString(map));
+        //System.out.println(StringUtils.join(arr,","));
+
+    }
+}

+ 30 - 0
warewms-base/src/main/resources/mapper/base/SysIdsequenceMapper.xml

@@ -0,0 +1,30 @@
+<?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.ruoyi.base.mapper.SysIdsequenceMapper">
+
+    <resultMap type="SysIdsequence" id="SysIdsequenceResult">
+        <result property="idName"    column="id_name"    />
+        <result property="idSequence"    column="id_sequence"    />
+        <result property="createDate"    column="create_date"    />
+        <result property="createUserId"    column="create_user_id"    />
+        <result property="descr"    column="descr"    />
+        <result property="idType"    column="id_type"    />
+        <result property="maxidSequence"    column="max_id_sequence"    />
+        <result property="editTime"    column="edit_time"    />
+        <result property="editUserId"    column="edit_user_id"    />
+        <result property="prefix"    column="prefix"    />
+        <result property="length"    column="length"    />
+        <result property="dateFormat"    column="date_format"    />
+        <result property="dateMax"    column="date_max"    />
+    </resultMap>
+
+    <select id="selectByIdname" parameterType="sysIdsequence" resultMap="SysIdsequenceResult">
+        select * from sys_idsequence where id_name = #{idName}
+    </select>
+
+    <update id="updateByVersion">
+        update sys_idsequence set id_sequence =#{nextIdsequenc},date_max=#{dateMax} where id_name= #{idName} and id_sequence=#{oldIdsequenc}
+    </update>
+</mapper>