'123'
This commit is contained in:
parent
c227a8c401
commit
be7bea1ca5
|
@ -6,9 +6,11 @@ import com.ruoyi.common.constant.CacheConstants;
|
|||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.core.redis.RedisLock;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.enums.DataSourceType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.ip.IpUtils;
|
||||
import com.ruoyi.storageLocation.domain.StorageLocation;
|
||||
import com.ruoyi.storageLocation.domain.StorageSelected;
|
||||
import com.ruoyi.storageLocation.service.StorageLocationService;
|
||||
|
@ -30,6 +32,9 @@ public class storageLocationController extends BaseController
|
|||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private RedisLock redisLock;
|
||||
|
||||
@Autowired
|
||||
private StorageLocationService storageLocationService;
|
||||
|
||||
|
@ -126,7 +131,8 @@ public class storageLocationController extends BaseController
|
|||
if(StringUtils.isNotNull(kw_user_name)&&!user_name.equals(kw_user_name)){
|
||||
return error("当前库位有人正在操作,请勿操作!");
|
||||
}else{
|
||||
redisCache.setCacheObject(getLocationZyCacheKey(materialBh),user_name,Integer.valueOf(storageExpire), TimeUnit.SECONDS);
|
||||
redisLock.getLock(getLocationZyCacheKey(materialBh), Integer.valueOf(storageExpire), user_name);
|
||||
//redisCache.setCacheObject(getLocationZyCacheKey(materialBh),user_name,Integer.valueOf(storageExpire), TimeUnit.SECONDS);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +205,7 @@ public class storageLocationController extends BaseController
|
|||
|
||||
String kw_user_name = redisCache.getCacheObject(getLocationLyCacheKey(materialBh));
|
||||
if(StringUtils.isNotNull(kw_user_name)&&!user_name.equals(kw_user_name)){
|
||||
return error("该库位当前有人正在操作,请勿操作!");
|
||||
return error("该库位当前有人正在领用操作,请勿操作!");
|
||||
}else{
|
||||
// 判断已选库位表是否存在库位信息
|
||||
StorageSelected storageSelected = storageLocationService.hasStorageLocation(materialBh);
|
||||
|
@ -211,8 +217,10 @@ public class storageLocationController extends BaseController
|
|||
}
|
||||
}else{
|
||||
// 保存至已选库位表并缓存
|
||||
redisCache.setCacheObject(getLocationLyCacheKey(materialBh),user_name);
|
||||
storageLocationService.saveStorageLocation(user_name,materialBh);
|
||||
Boolean lock = redisLock.getLock(getLocationLyCacheKey(materialBh), -1, user_name);
|
||||
if(lock){
|
||||
storageLocationService.saveStorageLocation(user_name,materialBh);
|
||||
}
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
@ -244,15 +252,15 @@ public class storageLocationController extends BaseController
|
|||
public AjaxResult confirmStorageLocation(@RequestBody String [] materialBhArr)
|
||||
{
|
||||
|
||||
storageLocationService.confirmStorageLocation(materialBhArr);
|
||||
List<String> materialBhList = Arrays.asList(materialBhArr);
|
||||
storageLocationService.confirmStorageLocation(materialBhList);
|
||||
|
||||
String user_name = getLoginUser().getUsername();//当前登陆者
|
||||
storageLocationService.deleteBatchStorageLocation(user_name,materialBhList);
|
||||
|
||||
List<String> list = new ArrayList<String>();
|
||||
for(String materialBh:materialBhArr){
|
||||
list.add(getLocationZyCacheKey(materialBh));
|
||||
redisCache.deleteObject(getLocationZyCacheKey(materialBh));// 清空占用缓存keys
|
||||
}
|
||||
Collection<List<String>> collection = new ArrayList<>();
|
||||
collection.add(list);
|
||||
redisCache.deleteObject(collection);// 清空占用缓存keys
|
||||
return success();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ spring:
|
|||
# 主库数据源
|
||||
master:
|
||||
driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
url: jdbc:sqlserver://192.168.9.66:1433;DatabaseName=ry-vue
|
||||
url: jdbc:sqlserver://192.168.9.130:1433;DatabaseName=ry-vue
|
||||
username: sa
|
||||
password: Itcenter110-
|
||||
# 红本数据库数据源
|
||||
|
@ -23,7 +23,7 @@ spring:
|
|||
enabled: true
|
||||
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
# 测试数据库
|
||||
# url: jdbc:sqlserver://192.168.9.66:1433;DatabaseName=jn_quot
|
||||
# url: jdbc:sqlserver://192.168.9.130:1433;DatabaseName=jn_quot
|
||||
# 正式数据库
|
||||
url: jdbc:sqlserver://192.168.9.99:1433;DatabaseName=jn_quot
|
||||
username: sa
|
||||
|
|
|
@ -35,7 +35,7 @@ public interface StorageLocationMapper
|
|||
* 确认完成认领
|
||||
* @param materialBhArr
|
||||
*/
|
||||
void confirmStorageLocation(String[] materialBhArr);
|
||||
void confirmStorageLocation(List<String> materialBhArr);
|
||||
|
||||
/**
|
||||
* 判断已选库位表是否存在库位信息
|
||||
|
@ -71,4 +71,11 @@ public interface StorageLocationMapper
|
|||
* @return
|
||||
*/
|
||||
List<StorageSelected> selectStorageSelectedLocationList();
|
||||
|
||||
/**
|
||||
* 批量删除已选库位表记录
|
||||
* @param userName
|
||||
* @param materialBhList
|
||||
*/
|
||||
void deleteBatchStorageLocation(@Param("userName") String userName, @Param("list") List<String> materialBhList);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public interface StorageLocationService
|
|||
* 确认完成认领
|
||||
* @param materialBhArr
|
||||
*/
|
||||
void confirmStorageLocation(String[] materialBhArr);
|
||||
void confirmStorageLocation(List<String> materialBhArr);
|
||||
|
||||
/**
|
||||
* 判断已选库位表是否存在库位信息
|
||||
|
@ -71,4 +71,11 @@ public interface StorageLocationService
|
|||
* @return
|
||||
*/
|
||||
List<StorageSelected> selectStorageSelectedLocationList();
|
||||
|
||||
/**
|
||||
* 批量删除已选库位表记录
|
||||
* @param user_name
|
||||
* @param materialBhList
|
||||
*/
|
||||
void deleteBatchStorageLocation(String user_name, List<String> materialBhList);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class StorageLocationServiceImpl implements StorageLocationService
|
|||
* @param materialBhArr
|
||||
*/
|
||||
@Override
|
||||
public void confirmStorageLocation(String[] materialBhArr) {
|
||||
public void confirmStorageLocation(List<String> materialBhArr) {
|
||||
storageLocationMapper.confirmStorageLocation(materialBhArr);
|
||||
}
|
||||
|
||||
|
@ -113,4 +113,14 @@ public class StorageLocationServiceImpl implements StorageLocationService
|
|||
public List<StorageSelected> selectStorageSelectedLocationList() {
|
||||
return storageLocationMapper.selectStorageSelectedLocationList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除已选库位表记录
|
||||
* @param userName
|
||||
* @param materialBhList
|
||||
*/
|
||||
@Override
|
||||
public void deleteBatchStorageLocation(String userName, List<String> materialBhList) {
|
||||
storageLocationMapper.deleteBatchStorageLocation(userName,materialBhList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,12 +41,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where materialBh = #{materialBh}
|
||||
</update>
|
||||
|
||||
<update id="confirmStorageLocation">
|
||||
<update id="confirmStorageLocation" parameterType="java.util.List">
|
||||
update storageLocation set materialState = '0'
|
||||
<where>
|
||||
materialBh
|
||||
<foreach collection="array" item="materialBh" index="index" open="in (" close=")" separator=",">
|
||||
#{materialBh}
|
||||
<foreach collection="list" item="item" index="index" open="in (" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</where>
|
||||
</update>
|
||||
|
@ -96,4 +96,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select user_name,material_bh
|
||||
from storageSelected
|
||||
</select>
|
||||
|
||||
<delete id="deleteBatchStorageLocation">
|
||||
delete from storageSelected where user_name = #{userName}
|
||||
and material_bh
|
||||
<foreach collection="list" item="item" index="index" open="in (" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
<el-tab-pane label="库位查看" name="locationShow">
|
||||
<el-row :gutter="10" style="letter-spacing: 5px;">
|
||||
<el-col :span="8">
|
||||
<div class="grid-content bg-purpleA">黄色线芯A区(余{{countA}})</div>
|
||||
<div class="grid-content bg-purpleA" @click="refresh()">黄色线芯A区(可用{{countA}})</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="grid-content bg-purpleB">绿色线芯B区(余{{countB}})</div>
|
||||
<div class="grid-content bg-purpleB" @click="refresh()">绿色线芯B区(可用{{countB}})</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="grid-content bg-purpleC">红色线芯C区(余{{countC}})</div>
|
||||
<div class="grid-content bg-purpleC" @click="refresh()">红色线芯C区(可用{{countC}})</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10">
|
||||
|
@ -416,6 +416,7 @@
|
|||
display: flex; /* 设置为 Flexbox */
|
||||
justify-content: center; /* 水平居中 */
|
||||
align-items: center; /* 垂直居中 */
|
||||
cursor: pointer; /* 将鼠标形状改为指针形状 */
|
||||
}
|
||||
.bg-purpleA {
|
||||
background: #e6a700;
|
||||
|
@ -501,18 +502,23 @@
|
|||
computed:{
|
||||
countA(){
|
||||
// 使用 find 方法找到第一个符合条件的对象
|
||||
return this.materialDetailA.filter(task => task.materialState === '0').length;
|
||||
return this.materialDetailA.filter(task => task.materialState === '1').length;
|
||||
},
|
||||
countB(){
|
||||
// 使用 find 方法找到第一个符合条件的对象
|
||||
return this.materialDetailB.filter(task => task.materialState === '0').length;
|
||||
return this.materialDetailB.filter(task => task.materialState === '1').length;
|
||||
},
|
||||
countC(){
|
||||
// 使用 find 方法找到第一个符合条件的对象
|
||||
return this.materialDetailC.filter(task => task.materialState === '0').length;
|
||||
return this.materialDetailC.filter(task => task.materialState === '1').length;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/*刷新库位信息*/
|
||||
refresh(){
|
||||
this.getStorageLocation();
|
||||
},
|
||||
|
||||
/*获取库位信息*/
|
||||
getStorageLocation(){
|
||||
listStorageLocation(this.queryParams).then(response => {
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
<div style="margin-left: 5px; margin-right: 5px;">
|
||||
<el-row :gutter="10" style="letter-spacing: 5px;">
|
||||
<el-col :span="8">
|
||||
<div class="grid-content bg-purpleA">黄色线芯A区(余{{countA}})</div>
|
||||
<div class="grid-content bg-purpleA" @click="refresh()">黄色线芯A区(余{{countA}})</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="grid-content bg-purpleB">绿色线芯B区(余{{countB}})</div>
|
||||
<div class="grid-content bg-purpleB" @click="refresh()">绿色线芯B区(余{{countB}})</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div class="grid-content bg-purpleC">红色线芯C区(余{{countC}})</div>
|
||||
<div class="grid-content bg-purpleC" @click="refresh()">红色线芯C区(余{{countC}})</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10">
|
||||
|
@ -248,6 +248,7 @@
|
|||
display: flex; /* 设置为 Flexbox */
|
||||
justify-content: center; /* 水平居中 */
|
||||
align-items: center; /* 垂直居中 */
|
||||
cursor: pointer; /* 将鼠标形状改为指针形状 */
|
||||
}
|
||||
.bg-purpleA {
|
||||
background: #e6a700;
|
||||
|
@ -338,6 +339,11 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
/*刷新库位信息*/
|
||||
refresh(){
|
||||
this.getStorageLocation();
|
||||
},
|
||||
|
||||
/*获取库位信息*/
|
||||
getStorageLocation(){
|
||||
listStorageLocation(this.queryParams).then(response => {
|
||||
|
|
Loading…
Reference in New Issue