Просмотр исходного кода

Merge remote-tracking branch 'origin/master' into xuankuang

k 2 лет назад
Родитель
Сommit
310b31e132

+ 42 - 32
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/ams/LocationViewController.java

@@ -1,12 +1,15 @@
 package com.ruoyi.web.controller.warewms.ams;
 
-import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
+import com.ruoyi.ams.config.service.ILotattConfigService;
+import com.ruoyi.ams.inv.domain.vo.InvLotLocIdLotattVO;
+import com.ruoyi.ams.inv.service.IInvLotLocIdService;
 import com.ruoyi.ams.locationView.domain.form.LocationViewForm;
 import com.ruoyi.ams.locationView.domain.vo.LocationViewVO;
 import com.ruoyi.ams.locationView.service.LocationViewService;
-import com.ruoyi.base.domain.BaseLocationInfo;
+import com.ruoyi.base.constant.Constant;
+import com.ruoyi.base.domain.BaseLocationZone;
 import com.ruoyi.base.domain.dto.BasLocationGuiExtDTO;
-import com.ruoyi.base.service.IBaseLocationInfoService;
+import com.ruoyi.base.service.IBaseLocationZoneService;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -18,9 +21,11 @@ import org.springframework.web.bind.annotation.RestController;
 import java.util.List;
 
 /**
+ * 库位视图
+ *
  * Created by IntelliJ IDEA.
- * User: andy.qu
- * Date: 2022/3/16
+ * User: kaka
+ * Date: 2022/3/22
  */
 @RestController
 @RequestMapping("/ams/locationView")
@@ -29,9 +34,11 @@ public class LocationViewController extends BaseController {
     @Autowired
     private LocationViewService locationViewService;
     @Autowired
-    private IBaseLocationInfoService baseLocationInfoService;
+    private IInvLotLocIdService invLotLocIdService;
     @Autowired
-    private InvLotLocIdMapper invLotLocIdMapper;
+    private ILotattConfigService lotattConfigService;
+    @Autowired
+    private IBaseLocationZoneService baseLocationZoneService;
 
     @GetMapping(value = "/view")
     public AjaxResult getInfo(LocationViewForm locationViewForm) {
@@ -47,34 +54,37 @@ public class LocationViewController extends BaseController {
 
     @GetMapping(value = "/lockLoc/{id}")
     public AjaxResult lockLoc(@PathVariable("id") Long id) {
-        BaseLocationInfo baseLocationInfo = baseLocationInfoService.selectBaseLocationInfoById(id);
-        if (baseLocationInfo != null) {
-            if (baseLocationInfo.getStockStatus().equals("00")) {
-                baseLocationInfoService.updateLocationStockStatus(id, "10");
-                return AjaxResult.success("锁定成功");
-            } else {
-                baseLocationInfoService.updateLocationStockStatus(id, "00");
-                return AjaxResult.success("解锁成功");
-            }
-        } else {
-            return AjaxResult.error("查询不到对应的库位");
-        }
+        return invLotLocIdService.adjLocationStockStatus(id.toString(), Constant.WAREHOUSE_ID
+                , logger.getName());
     }
 
     @GetMapping(value = "/clearLoc/{id}")
     public AjaxResult clearLoc(@PathVariable("id") Long id) {
-        BaseLocationInfo baseLocationInfo = baseLocationInfoService.selectBaseLocationInfoById(id);
-        if (baseLocationInfo != null) {
-            if (baseLocationInfo.getStockStatus().equals("00")) {
-                baseLocationInfo.setIsEmpty("Y");
-                baseLocationInfoService.updateBaseLocationInfo(baseLocationInfo);
-                invLotLocIdMapper.deleteInvLotLocIdByLocationId(baseLocationInfo.getId());
-                return AjaxResult.success("清空成功");
-            } else {
-                return AjaxResult.error("锁定中的库位无法清空");
-            }
-        } else {
-            return AjaxResult.error("查询不到对应的库位");
-        }
+        return invLotLocIdService.clear(id.toString(),Constant.WAREHOUSE_ID, logger.getName());
+    }
+
+    @GetMapping(value = "/setIsEmpty/{id}")
+    public AjaxResult adjLocationIsEmpty(@PathVariable("id") Long id) {
+
+        return invLotLocIdService.adjLocationIsEmpty(id.toString(), Constant.WAREHOUSE_ID, logger.getName());
+    }
+
+    @GetMapping(value = "/locationLotatt/{locationId}")
+    public AjaxResult locationLotatt(@PathVariable("locationId") Long locationId) {
+        List<InvLotLocIdLotattVO> invLotLocIdLotattVOS = invLotLocIdService.selectInvLocIdLotattByLocationId(locationId);
+        return AjaxResult.success(invLotLocIdLotattVOS);
+    }
+
+    @GetMapping("/lotattConfigList")
+    public AjaxResult lotattConfigList() {
+        return AjaxResult.success(lotattConfigService.queryLotattConfigList());
+    }
+
+    @GetMapping("/queryZoneDict")
+    public AjaxResult queryZoneDict()
+    {
+        BaseLocationZone query = new BaseLocationZone();
+        query.setStatus("0");
+        return AjaxResult.success(baseLocationZoneService.selectBaseLocationZoneList(query));
     }
 }

+ 96 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/ams/LocationViewSafeController.java

@@ -0,0 +1,96 @@
+package com.ruoyi.web.controller.warewms.ams;
+
+import com.ruoyi.ams.config.service.ILotattConfigService;
+import com.ruoyi.ams.inv.domain.vo.InvLotLocIdLotattVO;
+import com.ruoyi.ams.inv.service.IInvLotLocIdService;
+import com.ruoyi.ams.locationView.domain.form.LocationViewForm;
+import com.ruoyi.ams.locationView.domain.vo.LocationViewVO;
+import com.ruoyi.ams.locationView.service.LocationViewService;
+import com.ruoyi.base.constant.Constant;
+import com.ruoyi.base.domain.BaseLocationZone;
+import com.ruoyi.base.domain.BaseWarehouse;
+import com.ruoyi.base.domain.dto.BasLocationGuiExtDTO;
+import com.ruoyi.base.service.IBaseLocationZoneService;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 库位视图
+ * 需要登陆
+ *
+ * Created by IntelliJ IDEA.
+ * User: kaka
+ * Date: 2022/3/22
+ */
+@RestController
+@RequestMapping("/ams/safe/locationView/")
+public class LocationViewSafeController extends BaseController {
+
+    @Autowired
+    private LocationViewService locationViewService;
+    @Autowired
+    private IInvLotLocIdService invLotLocIdService;
+    @Autowired
+    private ILotattConfigService lotattConfigService;
+    @Autowired
+    private IBaseLocationZoneService baseLocationZoneService;
+
+    @GetMapping(value = "/view")
+    public AjaxResult getInfo(LocationViewForm locationViewForm) {
+        LocationViewVO locationViewVO = locationViewService.locationView(locationViewForm);
+        return AjaxResult.success(locationViewVO);
+    }
+
+    @GetMapping(value = "/invView")
+    public AjaxResult getInvView(LocationViewForm locationViewForm) {
+        List<BasLocationGuiExtDTO> basLocationGuiDTOS = locationViewService.queryLocationGuiExt(locationViewForm);
+        return AjaxResult.success(basLocationGuiDTOS);
+    }
+
+    @Log(title = "库位任务状态调整", businessType = BusinessType.UPDATE)
+    @GetMapping(value = "/lockLoc/{id}")
+    public AjaxResult lockLoc(@PathVariable("id") Long id) {
+        return invLotLocIdService.adjLocationStockStatus(id.toString(), Constant.WAREHOUSE_ID
+                , logger.getName());
+    }
+
+    @Log(title = "库位库存清除", businessType = BusinessType.CLEAN)
+    @GetMapping(value = "/clearLoc/{id}")
+    public AjaxResult clearLoc(@PathVariable("id") Long id) {
+        return invLotLocIdService.clear(id.toString(),Constant.WAREHOUSE_ID, logger.getName());
+    }
+
+    @Log(title = "库存有货状态调整", businessType = BusinessType.CLEAN)
+    @GetMapping(value = "/setIsEmpty/{id}")
+    public AjaxResult adjLocationIsEmpty(@PathVariable("id") Long id) {
+        return invLotLocIdService.adjLocationIsEmpty(id.toString(), Constant.WAREHOUSE_ID, logger.getName());
+    }
+
+    @GetMapping(value = "/locationLotatt/{locationId}")
+    public AjaxResult locationLotatt(@PathVariable("locationId") Long locationId) {
+        List<InvLotLocIdLotattVO> invLotLocIdLotattVOS = invLotLocIdService.selectInvLocIdLotattByLocationId(locationId);
+        return AjaxResult.success(invLotLocIdLotattVOS);
+    }
+
+    @GetMapping("/lotattConfigList")
+    public AjaxResult lotattConfigList() {
+        return AjaxResult.success(lotattConfigService.queryLotattConfigList());
+    }
+
+    @GetMapping("/queryZoneDict")
+    public AjaxResult queryZoneDict()
+    {
+        BaseLocationZone query = new BaseLocationZone();
+        query.setStatus("0");
+        return AjaxResult.success(baseLocationZoneService.selectBaseLocationZoneList(query));
+    }
+}

+ 6 - 0
ruoyi-common/pom.xml

@@ -137,6 +137,12 @@
             <version>5.8.5</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.13</version>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 12 - 1
ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java

@@ -26,6 +26,11 @@ public class RedisCache {
     @Autowired
     public RedisTemplate redisTemplate;
 
+    /**
+     * 默认过期时长,单位:秒
+     */
+    public final static long DEFAULT_EXPIRE = 60 * 60 * 24;
+
     /**
      * 缓存基本的对象,Integer、String、实体类等
      *
@@ -40,6 +45,8 @@ public class RedisCache {
         boolean isOK = redisTemplate.opsForValue().setIfAbsent(key, value);
         if (isOK) {
             redisTemplate.opsForList().rightPush(RedisKey.LOCK_LIST + token, key);
+            expire(key, DEFAULT_EXPIRE);
+            expire(RedisKey.LOCK_LIST + token, DEFAULT_EXPIRE);
         }
         return isOK;
     }
@@ -55,11 +62,15 @@ public class RedisCache {
         }
     }
 
-    public void unlockCacheObject(Long token,final String key) {
+    public void unlockCacheObject(Long token, final String key) {
         redisTemplate.opsForList().remove(RedisKey.LOCK_LIST + token, 1, RedisKey.LOCK_LOCATION + key);
         redisTemplate.delete(RedisKey.LOCK_LOCATION + key);
     }
 
+    public void unlockCacheLocation(final String key) {
+        redisTemplate.delete(RedisKey.LOCK_LOCATION + key);
+    }
+
     public boolean checkIsLock(String key) {
         boolean isLock = false;
         Object obj = redisTemplate.opsForValue().get(key);

+ 172 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpRequest.java

@@ -0,0 +1,172 @@
+package com.ruoyi.common.utils.http;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.http.HttpEntity;
+import org.apache.http.NameValuePair;
+import org.apache.http.StatusLine;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+public class HttpRequest {
+
+    public static String addUrl(String head, String tail) {
+        if (head.endsWith("/")) {
+            if (tail.startsWith("/")) {
+                return head.substring(0, head.length() - 1) + tail;
+            } else {
+                return head + tail;
+            }
+        } else {
+            if (tail.startsWith("/")) {
+                return head + tail;
+            } else {
+                return head + "/" + tail;
+            }
+        }
+    }
+
+    public synchronized static String postData(String url, Map<String, String> params) throws Exception {
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+        HttpPost httpPost = new HttpPost(url);
+        //拼接参数
+        List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+
+        NameValuePair[] nameValuePairArray = assembleRequestParams(params);
+        for (NameValuePair value : nameValuePairArray
+        ) {
+            nvps.add(value);
+        }
+
+        httpPost.setEntity(new UrlEncodedFormEntity(nvps, "UTF-8"));
+        CloseableHttpResponse response = httpclient.execute(httpPost);
+        String result = "";
+        try {
+            StatusLine statusLine = response.getStatusLine();
+            HttpEntity entity = response.getEntity();
+            // do something useful with the response body
+            if (entity != null) {
+                result = EntityUtils.toString(entity, "UTF-8");
+            } else {
+                log.error("httpRequest postData1 error entity = null code = " + statusLine.getStatusCode());
+            }
+            // and ensure it is fully consumed
+            //消耗掉response
+            EntityUtils.consume(entity);
+        } finally {
+            response.close();
+        }
+
+        return result;
+    }
+
+    public synchronized static String postData(String url, String Json) throws Exception {
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+        HttpPost httpPost = new HttpPost(url);
+        httpPost.setHeader("Content-Type", "application/json;charset=UTF-8");
+        StringEntity stringEntity = new StringEntity(Json);
+        stringEntity.setContentType("text/json");
+        httpPost.setEntity(stringEntity);
+        CloseableHttpResponse response = httpclient.execute(httpPost);
+        String result = "";
+        try {
+            StatusLine statusLine = response.getStatusLine();
+            HttpEntity entity = response.getEntity();
+            // do something useful with the response body
+            if (entity != null) {
+                result = EntityUtils.toString(entity, "UTF-8");
+            } else {
+                log.error("httpRequest postData2 error entity = null code = " + statusLine.getStatusCode());
+            }
+            // and ensure it is fully consumed
+            //消耗掉response
+            EntityUtils.consume(entity);
+        } finally {
+            response.close();
+        }
+
+        return result;
+    }
+
+    public synchronized static String postData(String url, String Json, String head) throws Exception {
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+        HttpPost httpPost = new HttpPost(url);
+        httpPost.setHeader("Content-Type", "application/json;charset=UTF-8");
+        httpPost.setHeader("token", head);
+        StringEntity stringEntity = new StringEntity(Json);
+        stringEntity.setContentType("text/json");
+        httpPost.setEntity(stringEntity);
+        CloseableHttpResponse response = httpclient.execute(httpPost);
+        String result = "";
+        try {
+            StatusLine statusLine = response.getStatusLine();
+            HttpEntity entity = response.getEntity();
+            // do something useful with the response body
+            if (entity != null) {
+                result = EntityUtils.toString(entity, "UTF-8");
+            } else {
+                log.error("httpRequest postData2 error entity = null code = " + statusLine.getStatusCode());
+            }
+            // and ensure it is fully consumed
+            //消耗掉response
+            EntityUtils.consume(entity);
+        } finally {
+            response.close();
+        }
+
+        return result;
+    }
+
+    public synchronized static String postData(String url) throws Exception {
+        CloseableHttpClient httpclient = HttpClients.createDefault();
+        HttpPost httpPost = new HttpPost(url);
+        CloseableHttpResponse response = httpclient.execute(httpPost);
+        String result = "";
+        try {
+            StatusLine statusLine = response.getStatusLine();
+            HttpEntity entity = response.getEntity();
+            // do something useful with the response body
+            if (entity != null) {
+                result = EntityUtils.toString(entity, "UTF-8");
+            } else {
+                log.error("httpRequest postData2 error entity = null code = " + statusLine.getStatusCode());
+            }
+            // and ensure it is fully consumed
+            //消耗掉response
+            EntityUtils.consume(entity);
+        } finally {
+            response.close();
+        }
+
+        return result;
+    }
+
+    /**
+     * 组装http请求参数
+     *
+     * @return
+     */
+    private synchronized static NameValuePair[] assembleRequestParams(Map<String, String> data) {
+        final List<NameValuePair> nameValueList = new ArrayList<NameValuePair>();
+
+        Iterator<Map.Entry<String, String>> it = data.entrySet().iterator();
+        while (it.hasNext()) {
+            Map.Entry<String, String> entry = (Map.Entry<String, String>) it.next();
+            nameValueList.add(new BasicNameValuePair((String) entry.getKey(), (String) entry.getValue()));
+        }
+
+        return nameValueList.toArray(new NameValuePair[nameValueList.size()]);
+    }
+
+}

+ 40 - 2
ruoyi-ui/src/api/ams/locationView.js

@@ -18,14 +18,52 @@ export function locationInvView(query) {
 
 export function lockLocRequest(id) {
   return request({
-    url: '/ams/locationView/lockLoc/'+id,
+    url: '/ams/safe/locationView/lockLoc/'+id,
+    // url: '/ams/locationView/lockLoc/'+id,
     method: 'get'
   })
 }
 
 export function clearLocRequest(id) {
   return request({
-    url: '/ams/locationView/clearLoc/'+id,
+    url: '/ams/safe/locationView/clearLoc/'+id,
+    // url: '/ams/locationView/clearLoc/'+id,
     method: 'get'
   })
 }
+
+export function occupyLocRequest(id) {
+  return request({
+    url: '/ams/safe/locationView/setIsEmpty/'+id,
+    // url: '/ams/locationView/setIsEmpty/'+id,
+    method: 'get'
+  })
+}
+
+export function lotattInfo(id) {
+  return request({
+    url: '/ams/locationView/locationLotatt/'+id,
+    method: 'get'
+  })
+}
+
+export function lotattConfigList() {
+  return request({
+    url: '/ams/locationView/lotattConfigList',
+    method: 'get'
+  })
+}
+
+export function queryLocationZoneDict() {
+  return request({
+    url: '/ams/locationView/queryZoneDict',
+    method: 'get',
+  })
+}
+
+export function queryWarehouseDict() {
+  return request({
+    url: '',
+    method: 'get',
+  })
+}

+ 168 - 5
ruoyi-ui/src/views/ams/inv/locationView/index.vue

@@ -15,10 +15,36 @@
 <!--            库存<icon-svg name="steel" class="site-sidebar__menu-icon"></icon-svg>-->
 <!--          </div>-->
           <div class="divLeft">
-            空托盘<svg-icon class-name="pallet-icon" icon-class="pallet" @click.stop="click" />
+            【托盘】<svg-icon class-name="pallet-icon" icon-class="pallet" @click.stop="click" />
           </div>
         </div>
       </el-header>
+      <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="600px" label-position="right">
+        <el-form-item label="仓库" prop="warehouseId" v-show="false">
+          <el-select v-model="queryParams.warehouseId" placeholder="请选择所属仓库" clearable size="small" style="width: 100%" >
+            <el-option
+              v-for="dict in this.warehouseCombo"
+              :key="dict.warehouseId"
+              :label="dict.warehouseName"
+              :value="dict.warehouseId"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="区域" prop="zoneId">
+          <el-select v-model="queryParams.zoneId" placeholder="请选择库区" clearable size="small" style="width: 100%">
+            <el-option
+              v-for="dict in this.locationZoneCombo"
+              :key="dict.zoneId"
+              :label="dict.zoneName"
+              :value="dict.zoneId"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        </el-form-item>
+      </el-form>
       <el-main>
         <el-card v-for="zone in locationZoneList" v-bind:key="zone.zoneName" class="box-card">
           <div slot="header" class="clearfix">
@@ -50,14 +76,45 @@
           </div>
         </el-card>
       </el-main>
+      <!-- 点击库位弹出展示框做修改  -->
+      <el-dialog title="操作" :visible.sync="open" width="1000px" append-to-body>
+        <el-form>
+          <el-form-item>
+            <el-button type="primary" @click="lockLoc()">锁定/解锁</el-button>
+            <el-button type="primary" @click="occupyLoc()">有货/无货</el-button>
+            <el-button type="primary" @click="clearLoc()">清空</el-button>
+            <!--<el-button type="primary" @click="submitForm">初始化一个空托盘</el-button>-->
+          </el-form-item>
+        </el-form>
+        <el-divider content-position="center">批次属性信息</el-divider>
+        <el-table v-loading="loading" :data="form.lotattList">
+          <el-table-column label="物料" align="center" prop="sku" width="200"/>
+          <el-table-column label="物料名称" align="center" prop="skuName" width="200"/>
+          <el-table-column label="库位" align="center" prop="locationNo" width="200"/>
+          <el-table-column label="库存数量" align="center" prop="qty"/>
+          <el-table-column label="已分配数量" align="center" prop="qtyallocated" width="200"/>
+          <el-table-column
+            v-for="(item, index) in itemOption"
+            :key="index_back"
+            :label="item.label"
+            align="center" :prop="item.prop" width="200">
+          </el-table-column>
+        </el-table>
+        <!--<el-descriptions title="批次属性" :column="2" border>
+          <el-descriptions-item v-for="(item, index) in itemOption" :label="item.label">{{form[`${item.prop}`]}}</el-descriptions-item>
+        </el-descriptions>-->
+      </el-dialog>
     </el-container>
 </template>
 <script>
-import { locationInvView } from "@/api/ams/locationView";
+import { clearLocRequest,locationInvView,queryLocationZoneDict,lockLocRequest,lotattConfigList
+  ,lotattInfo,occupyLocRequest,queryWarehouseDict} from "@/api/ams/locationView";
 
   export default {
     data () {
       return {
+        open: false,
+        showSearch: true,
         dataForm: {
           zoneId: ''
         },
@@ -67,7 +124,30 @@ import { locationInvView } from "@/api/ams/locationView";
         },
         locationZoneList: [],
         locationList: {'a': [1, 2, 3]},
-        locationClearVisible: false
+        locationClearVisible: false,
+        // 表单参数
+        form: {
+          lotatt01: '',
+          lotatt02: '',
+          lotatt03: '',
+          lotatt04: '',
+          lotatt05: '',
+          lotatt06: '',
+          lotatt07: '',
+          lotatt08: '',
+          lotatt09: '',
+          lotatt10: '',
+          lotatt11: '',
+          lotatt12: '',
+          lotatt13: '',
+          lotatt14: '',
+          lotatt15: '',
+          lotatt16: '',
+          lotatt17: '',
+          lotatt18: '',
+          lotattList: null
+        },
+        itemOption: []
       }
     },
     mounted () {
@@ -75,13 +155,27 @@ import { locationInvView } from "@/api/ams/locationView";
     activated () {
     },
     created () {
+      // this.getWarehouseList()
+      this.getBasZoneList()
       this.getDataList()
+      this.getItemopention()
       this.timer = setInterval(this.getDataList, 5000)
     },
     beforeDestroy () {
       clearInterval(this.timer)
     },
     methods: {
+      getItemopention(){
+        lotattConfigList().then(response => {
+          let data = response.data
+          for(let i=0;i<data.length;i++) {
+            let obj = new Object();
+            obj.label = data[i].lotattName
+            obj.prop = data[i].lotattId
+            this.itemOption.push(obj)
+          }
+        })
+      },
       getDataList () {
         this.dataListLoading = true
         locationInvView(this.queryParams).then(response => {
@@ -90,8 +184,77 @@ import { locationInvView } from "@/api/ams/locationView";
         this.dataListLoading = false
       },
       changeLocation(o){
+        this.selected(o)
         // alert(o.locationNo);
-      }
+      },
+      resetQuery() {//重置搜索
+        this.resetForm("queryForm");
+        this.getDataList();
+        this.handleQuery();
+      },
+      selected(item) {
+        if (item.locationNo) {
+          this.currentSelect = parseInt(item.id)
+          this.open = true;
+          lotattInfo(this.currentSelect).then(response => {
+            this.form.lotattList = response.data
+            this.loading = false;
+          })
+        }
+
+      },
+      lockLoc() {
+        let that = this
+        this.$modal.confirm('是否确认要锁定/解锁?').then(function() {
+          lockLocRequest(that.currentSelect).then(response => {
+            if (response.code === 200) {
+              that.open = false;
+              that.$modal.msgSuccess(response.msg);
+              that.search();
+            } else {
+              that.$modal.msgError(response.msg);
+            }
+          });
+        });
+      },
+      occupyLoc() {
+        let that = this
+        this.$modal.confirm('是否确认要修改库位状态?').then(function() {
+        occupyLocRequest(that.currentSelect).then(response => {
+          if (response.code === 200) {
+            that.open = false;
+            that.$modal.msgSuccess(response.msg);
+            that.search();
+          } else {
+            that.$modal.msgError(response.msg);
+          }
+          });
+        });
+      },
+      clearLoc() {
+        let that = this
+        this.$modal.confirm('是否确认要清空库存?').then(function() {
+          clearLocRequest(that.currentSelect).then(response => {
+            if (response.code === 200) {
+              that.open = false;
+              that.$modal.msgSuccess(response.msg);
+              that.search();
+            } else {
+              that.$modal.msgError(response.msg);
+            }
+          });
+        });
+      },
+      getBasZoneList() {
+        queryLocationZoneDict().then(response => {
+          this.locationZoneCombo = response.data
+        })
+      },
+      getWarehouseList() {
+        queryWarehouseDict().then(response => {
+          this.warehouseCombo = response.data
+        });
+      },
     }
   }
 </script>
@@ -163,7 +326,7 @@ import { locationInvView } from "@/api/ams/locationView";
   height: 30px;
   width: 80px;
   text-align: center;
-  margin-top: 10px;
+  margin-top: 42.5px;
   padding-top: 5px;
 }
 

+ 12 - 6
ruoyi-ui/src/views/base/locationZone/index.vue

@@ -88,10 +88,10 @@
           <div v-if="scope.row.userdefine1 === 'OTHER'">非存储区</div>
         </template>
       </el-table-column>
-      <!--<el-table-column label="自定义字段2" align="center" prop="userdefine2" />
-      <el-table-column label="自定义字段3" align="center" prop="userdefine3" />
-      <el-table-column label="自定义字段4" align="center" prop="userdefine4" />
-      <el-table-column label="自定义字段5" align="center" prop="userdefine5" />-->
+      <el-table-column label="库区排序" align="center" prop="userdefine2" />
+     <el-table-column label="库位视图排序" align="center" prop="userdefine3" />
+      <!--<el-table-column label="自定义字段4" align="center" prop="userdefine4" />
+     <el-table-column label="自定义字段5" align="center" prop="userdefine5" />-->
       <el-table-column label="备注" align="center" prop="remark" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
@@ -134,9 +134,15 @@
             />
           </el-select>
         </el-form-item>
-        <el-form-item label="库区名称" prop="zoneName">
+        <el-form-item label="库区名称" prop="zoneName" >
           <el-input v-model="form.zoneName" placeholder="请输入库区名称" />
         </el-form-item>
+        <el-form-item label="库区排序" prop="userdefine2" >
+          <el-input v-model="form.userdefine2" placeholder="请输入库区排序编号" />
+        </el-form-item>
+        <el-form-item label="库位视图排序" prop="userdefine3">
+          <el-input v-model="form.userdefine3" placeholder="请输入库位视图排序编号" />
+        </el-form-item>
         <el-form-item label="库区类型" prop="userdefine1">
           <el-select v-model="form.userdefine1" placeholder="请选择库区类型" clearable size="small" style="width: 100%">
             <el-option
@@ -227,7 +233,7 @@ export default {
         ],
         userdefine1: [
           { required: true, message: "库区类型不能为空", trigger: "change" }
-        ]
+        ],
       },
       warehouseCombo: [],
       zoneTypeCombo:[

+ 21 - 10
ruoyi-ui/src/views/wms/allocation/index.vue

@@ -108,16 +108,12 @@
       <el-table-column label="拣货数量" align="center" prop="pickQty" />
       <el-table-column label="已拣库位" align="center" prop="pickToLocation" />
       <el-table-column label="拣货事务" align="center" prop="pickTransactionId" />
-      <el-table-column label="批号" align="center" prop="lotatt01" />
-<!--      <el-table-column label="重量" align="center" prop="lotatt02" />-->
-<!--      <el-table-column label="生产日期" align="center" prop="lotatt03" />-->
-<!--      <el-table-column label="有效期" align="center" prop="lotatt04" />-->
-      <el-table-column label="质量状态" align="center" prop="lotatt05" />
-<!--      <el-table-column label="供应商" align="center" prop="lotatt06" />-->
-<!--      <el-table-column label="托盘号" align="center" prop="lotatt07" />-->
-      <el-table-column label="入库单号" align="center" prop="lotatt08" />
-<!--      <el-table-column label="拣货事务" align="center" prop="lotatt09" />-->
-<!--      <el-table-column label="拣货事务" align="center" prop="lotatt10" />-->
+      <el-table-column
+        v-for="(item, index) in tableOption"
+        :key="index"
+        :label="item.label"
+        align="center" :prop="item.prop" width="200">
+      </el-table-column>
       <el-table-column label="lotnum" align="center" prop="lotnum" />
       <!--<el-table-column label="待检库位" align="center" prop="locationId" />
       <el-table-column label="叫料待检事务id" align="center" prop="callTransactionId" />-->
@@ -241,6 +237,8 @@
 
 <script>
 import { listAllocation, getAllocation, delAllocation, addAllocation, updateAllocation } from "@/api/ams/allocation";
+import {lotattConfigList} from "@/api/ams/config";
+import {queryLocationZoneDict} from "@/api/base/locationZone";
 
 export default {
   name: "Allocation",
@@ -266,6 +264,7 @@ export default {
       // 是否显示弹出层
       open: false,
       dateRange: [],
+      tableOption: [],
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -295,9 +294,21 @@ export default {
     };
   },
   created() {
+    this.initData();
     this.getList();
   },
   methods: {
+    initData() {
+      lotattConfigList().then(response => {
+        let data = response.data
+        for(let i=0;i<data.length;i++) {
+          let obj = new Object();
+          obj.label = data[i].lotattName
+          obj.prop = data[i].lotattId
+          this.tableOption.push(obj)
+        }
+      })
+    },
     /** 查询分配查询列表 */
     getList() {
       this.loading = true;

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

@@ -21,6 +21,7 @@ import com.ruoyi.base.domain.BaseLocationInfo;
 import com.ruoyi.base.service.IBaseLocationInfoService;
 import com.ruoyi.base.utils.IdSequenceUtils;
 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;
@@ -59,6 +60,8 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
     private IInvLotLocIdService invLotLocIdService;
     @Autowired
     private IBusinessService iBusinessService;
+    @Autowired
+    private RedisCache redisCache;
 
     /**
      * 查询库位库存信息
@@ -351,6 +354,8 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         }
         // 修改库位为空闲无货
         baseLocationInfoService.updateLocationIdleAndEmpty(id, warehouseId, updateBy);
+        // 释放redis锁
+        redisCache.unlockCacheLocation(id.toString());
         return AjaxResult.success("操作成功!");
     }
 
@@ -372,7 +377,8 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
 
         log.error("【修改库位任务占用状态】:" + baseLocationInfo.getLocationNo() + ","
                 + (isIdle ? Constant.STOCK_STATUS.STOCK10.getValue() : Constant.STOCK_STATUS.STOCK00.getValue()));
-
+        // 释放redis锁
+        redisCache.unlockCacheLocation(baseLocationInfo.getId().toString());
         return AjaxResult.success("操作成功!");
     }
 

+ 1 - 1
warewms-ams/src/main/java/com/ruoyi/ams/task/service/impl/WcsTaskServiceImpl.java

@@ -416,7 +416,7 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
                             redisCache.unlockCacheObject(Long.parseLong(wcsTask.getExt8()));
                         }
                         // 取消任务删除中间缓存库存
-                        cancelTaskDelMiddleCache(wcsTask);
+//                        cancelTaskDelMiddleCache(wcsTask);
                         break;
                     case 8:
                         log.error("任务异常状态------------" + wcsTask.getTaskNo());

+ 186 - 0
warewms-base/src/main/java/com/ruoyi/base/constant/Constant.java

@@ -44,6 +44,16 @@ public class Constant {
     public static final long MOLD_HANDLING_CB_FLOW_ID = 25;
 
 
+    /**
+     * 入库缓存位
+     */
+    public static final Long LOC_STAGE_CACHE = 99997l;
+
+    /**
+     * 出库缓存位
+     */
+    public static final Long LOC_SORTATION_CACHE = 99998l;
+
     /**
      * 中间缓存位
      * AGV作业搬运任务时候库存的虚拟库位
@@ -74,6 +84,182 @@ public class Constant {
         }
     }
 
+    /**
+     * 入库单据类型
+     */
+    public enum ASN_TYP {
+        /**
+         * 正常入库
+         */
+        ZC("ZC"),
+        /**
+         * 采购入库
+         */
+        PR("PR"),
+        /**
+         * 其他入库
+         */
+        OT("OT");
+
+        private String value;
+
+        ASN_TYP(String value) {
+            this.value = value;
+        }
+
+        public String getValue() {
+            return value;
+        }
+    }
+
+    /**
+     * 出库单据类型
+     */
+    public enum ORDER_TYP {
+        /**
+         * 正常出库
+         */
+        ZC("ZC"),
+        /**
+         * 备货
+         */
+        BH("BH"),
+        /**
+         * 库内理货
+         */
+        LH("LH");
+
+        private String value;
+
+        ORDER_TYP(String value) {
+            this.value = value;
+        }
+
+        public String getValue() {
+            return value;
+        }
+    }
+
+    /**
+     * 入库单状态
+     */
+    public enum ASN_STS {
+        /**
+         * 订单创建
+         */
+        STS00("00"),
+        /**
+         * 部分收货
+         */
+        STS30("30"),
+        /**
+         * 完全收货
+         */
+        STS40("40"),
+        /**
+         * 部分上架
+         */
+        STS50("50"),
+        /**
+         * 完全上架
+         */
+        STS60("60"),
+        /**
+         * 部分验收
+         */
+        STS70("70"),
+        /**
+         * 完全验收
+         */
+        STS80("80"),
+        /**
+         * 收货取消
+         */
+        STS90("90"),
+        /**
+         * ASN关闭
+         */
+        STS99("99");
+
+        private String value;
+
+        ASN_STS(String value) {
+            this.value = value;
+        }
+
+        public String getValue() {
+            return value;
+        }
+    }
+
+    /**
+     * 出库状态
+     */
+    public enum ORDER_STS {
+        /**
+         * 订单创建
+         */
+        STS00("00"),
+        /**
+         * 部分分配
+         */
+        STS10("10"),
+        /**
+         * 完全分配
+         */
+        STS20("20"),
+        /**
+         * 部分拣货
+         */
+        STS30("30"),
+        /**
+         * 拣货完成
+         */
+        STS40("40"),
+        /**
+         * 取消
+         */
+        STS90("90"),
+        /**
+         * 关闭
+         */
+        STS99("99");
+
+        private String value;
+
+        ORDER_STS(String value) {
+            this.value = value;
+        }
+
+        public String getValue() {
+            return value;
+        }
+    }
+
+    /**
+     * 库存状态
+     */
+    public enum INV_STS {
+        /**
+         * 合格
+         */
+        HG("90"),
+        /**
+         * 不合格
+         */
+        BHG("99");
+
+        private String value;
+
+        INV_STS(String value) {
+            this.value = value;
+        }
+
+        public String getValue() {
+            return value;
+        }
+    }
+
     /**
      * 储位状态
      */

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

@@ -10,6 +10,7 @@ import com.ruoyi.base.mapper.BaseLocationZoneMapper;
 import com.ruoyi.base.service.IBaseLocationInfoService;
 import com.ruoyi.base.utils.CommonUtils;
 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;
@@ -40,7 +41,7 @@ public class BaseLocationInfoServiceImpl implements IBaseLocationInfoService {
     @Autowired
     private BaseLocationZoneMapper baseLocationZoneMapper;
     @Autowired
-    private RedisTemplate<String, String> redisTemplate;
+    private RedisCache redisCache;
 
     /**
      * 查询库位信息

+ 2 - 2
warewms-base/src/main/resources/mapper/base/BaseLocationInfoMapper.xml

@@ -591,10 +591,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM
             base_location_info t1
                 LEFT JOIN base_location_zone t2 on t2.zone_id = t1.zone_id
-                LEFT JOIN (SELECT * from inv_lot_loc_id GROUP BY location_id) t3 on t3.location_id = t1.id
+                LEFT JOIN (SELECT location_id,any_value(lotnum) lotnum,any_value(customer_id) customer_id,any_value(sku) sku from inv_lot_loc_id GROUP BY location_id) t3 on t3.location_id = t1.id
                 LEFT JOIN inv_lot_att t4 on t4.lotnum = t3.lotnum
                 LEFT JOIN base_sku t5 on t5.customer_id=t3.customer_id and t5.sku = t3.sku
-        where t1.zone_id = #{zoneId} and t1.id not in (99997, 99998, 99999)
+        where t1.zone_id = #{zoneId}
         <choose>
             <when test=" sort == '1'.toString() ">
                 ORDER BY CONCAT(t1.row_no,t1.shift_no),t1.location_no