This commit is contained in:
xd 2024-03-19 10:05:33 +08:00
parent 581dc8e385
commit f3d00a2c50
9 changed files with 189 additions and 30 deletions

View File

@ -65,31 +65,40 @@ public class storageLocationController extends BaseController
for(StorageLocation sl:listA){
String materialBh = sl.getMaterialBh();
String materialState = sl.getMaterialState();
String userName = sl.getUserName();
String kw_user_name = redisCache.getCacheObject(getLocationZyCacheKey(materialBh));
if("0".equals(materialState)){
if(StringUtils.isNotNull(kw_user_name)&&user_name.equals(kw_user_name)){
redisCache.deleteObject(getLocationZyCacheKey(materialBh));
}
}else if ("1".equals(materialState)){
redisCache.setCacheObject(getLocationZyCacheKey(materialBh),userName);
}
}
for(StorageLocation sl:listB){
String materialBh = sl.getMaterialBh();
String materialState = sl.getMaterialState();
String userName = sl.getUserName();
String kw_user_name = redisCache.getCacheObject(getLocationZyCacheKey(materialBh));
if("0".equals(materialState)){
if(StringUtils.isNotNull(kw_user_name)&&user_name.equals(kw_user_name)){
redisCache.deleteObject(getLocationZyCacheKey(materialBh));
}
}else if ("1".equals(materialState)){
redisCache.setCacheObject(getLocationZyCacheKey(materialBh),userName);
}
}
for(StorageLocation sl:listC){
String materialBh = sl.getMaterialBh();
String materialState = sl.getMaterialState();
String userName = sl.getUserName();
String kw_user_name = redisCache.getCacheObject(getLocationZyCacheKey(materialBh));
if("0".equals(materialState)){
if(StringUtils.isNotNull(kw_user_name)&&user_name.equals(kw_user_name)){
redisCache.deleteObject(getLocationZyCacheKey(materialBh));
}
}else if ("1".equals(materialState)){
redisCache.setCacheObject(getLocationZyCacheKey(materialBh),userName);
}
}
return ajaxResult;
@ -126,13 +135,56 @@ public class storageLocationController extends BaseController
operlog.setOperlog_guig(storageLocation.getMaterialGuig());
operlog.setOperlog_diany(storageLocation.getMaterialDiany());
operlog.setOperlog_ms(storageLocation.getMaterialMs());
storageLocationService.addOperlog(operlog);
storageLocation.setUserName(user_name);
return toAjax(storageLocationService.addStorageLocation(storageLocation));
}
}
/**
* 修噶库位信息
*/
@Log(title = "修改库位信息", businessType = BusinessType.UPDATE)
@PostMapping("/addUpdStorageLocation")
public AjaxResult addUpdStorageLocation(@RequestBody StorageLocation storageLocation)
{
String user_name = getLoginUser().getUsername();//当前登陆者
String materialBh = storageLocation.getMaterialBh();
String kw_user_name = redisCache.getCacheObject(getLocationZyCacheKey(materialBh));
if (StringUtils.isNotNull(kw_user_name)) {
String kw_user2_name = redisCache.getCacheObject(getLocationLyCacheKey(materialBh));
//查询已录入库位信息
StorageSelected storageSelected = storageLocationService.hasStorageLocation(materialBh);
if (StringUtils.isNotNull(kw_user2_name)&&storageSelected!=null) {//已选择领用有选择领用记录
return error("当前库位已被其他人选择领用中,领用人账号:" + kw_user2_name + ",请先删除领用记录,再继续操作!");
} else {
//插入操作记录表
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Operlog operlog = new Operlog();
operlog.setOperlog_user_name(user_name);
operlog.setOperlog_date(format.format(new Date()));
operlog.setOperlog_event("修改库位信息");
operlog.setOperlog_kw(storageLocation.getMaterialBh());
operlog.setOperlog_zlh(storageLocation.getMaterialZlh());
operlog.setOperlog_xingh(storageLocation.getMaterialXingh());
operlog.setOperlog_guig(storageLocation.getMaterialGuig());
operlog.setOperlog_diany(storageLocation.getMaterialDiany());
operlog.setOperlog_ms(storageLocation.getMaterialMs());
storageLocationService.addOperlog(operlog);
storageLocation.setUserName(user_name);
return toAjax(storageLocationService.addStorageLocation(storageLocation));
}
}else{
return error("当前库位或被其他人领用,请刷新重试!");
}
}
/**
* 校验库位是否已占用
*/
@ -155,6 +207,37 @@ public class storageLocationController extends BaseController
}
}
/**
* 校验库位是否被领用或者是否是自己录入的
*/
@Log(title = "校验库位是否被领用或者是否是自己录入的", businessType = BusinessType.OTHER)
@PostMapping("/checkUpdStorageLocation")
public AjaxResult checkUpdStorageLocation(@RequestBody StorageLocation storageLocation) {
String user_name = getLoginUser().getUsername();//当前登陆者
String materialBh = storageLocation.getMaterialBh();
String kw_user_name = redisCache.getCacheObject(getLocationZyCacheKey(materialBh));
if (StringUtils.isNotNull(kw_user_name)) {
if (!user_name.equals(kw_user_name)) {
return error("当前库位信息非本人录入,不允许修改!");
} else {
String kw_user2_name = redisCache.getCacheObject(getLocationLyCacheKey(materialBh));
//查询已录入库位信息
StorageSelected storageSelected = storageLocationService.hasStorageLocation(materialBh);
if (StringUtils.isNotNull(kw_user2_name)&&storageSelected!=null) {//已选择领用有选择领用记录
return error("当前库位已被其他人选择领用中,领用人账号:" + kw_user2_name + ",请先删除领用记录,再继续操作!");
} else {
//查询已录入库位信息
StorageLocation sl = storageLocationService.selectYlrStorageLocation(materialBh);
return success(sl);
}
}
}else{
return error("当前库位或被其他人领用,请刷新重试!");
}
}
/**
* 弹窗取消按钮 清除库位缓存
*/

View File

@ -106,4 +106,11 @@ public interface StorageLocationMapper
* @return
*/
List<Operlog> selectOperlogs(Operlog operlog);
/**
* 查询已录入库位信息
* @param materialBh
* @return
*/
StorageLocation selectYlrStorageLocation(String materialBh);
}

View File

@ -105,4 +105,10 @@ public interface StorageLocationService
* @return
*/
List<Operlog> selectOperlogs(Operlog operlog);
/**
* 查询已录入库位信息
* @param materialBh
*/
StorageLocation selectYlrStorageLocation(String materialBh);
}

View File

@ -163,4 +163,13 @@ public class StorageLocationServiceImpl implements StorageLocationService
public List<Operlog> selectOperlogs(Operlog operlog) {
return storageLocationMapper.selectOperlogs(operlog);
}
/**
* 查询已录入库位信息
* @param materialBh
*/
@Override
public StorageLocation selectYlrStorageLocation(String materialBh) {
return storageLocationMapper.selectYlrStorageLocation(materialBh);
}
}

View File

@ -16,15 +16,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<select id="selectStorageLocationAList" parameterType="StorageLocation" resultMap="StorageLocationResult">
select materialBh, materialZlh, materialXingh, materialGuig, materialDiany, materialMs, materialState
select materialBh, materialZlh, materialXingh, materialGuig, materialDiany, materialMs, materialState, userName
from storageLocation where materialBh like 'A%'
</select>
<select id="selectStorageLocationBList" parameterType="StorageLocation" resultMap="StorageLocationResult">
select materialBh, materialZlh, materialXingh, materialGuig, materialDiany, materialMs, materialState
select materialBh, materialZlh, materialXingh, materialGuig, materialDiany, materialMs, materialState, userName
from storageLocation where materialBh like 'B%'
</select>
<select id="selectStorageLocationCList" parameterType="StorageLocation" resultMap="StorageLocationResult">
select materialBh, materialZlh, materialXingh, materialGuig, materialDiany, materialMs, materialState
select materialBh, materialZlh, materialXingh, materialGuig, materialDiany, materialMs, materialState, userName
from storageLocation where materialBh like 'C%'
</select>
@ -36,6 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialGuig != null and materialGuig != ''">materialGuig = #{materialGuig},</if>
<if test="materialDiany != null and materialDiany != ''">materialDiany = #{materialDiany},</if>
<if test="materialMs != null and materialMs != ''">materialMs = #{materialMs},</if>
<if test="userName != null and userName != ''">userName = #{userName},</if>
materialState = '1'
</trim>
where materialBh = #{materialBh}
@ -144,4 +145,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from operlog
where operlog_kw = #{operlog_kw} order by operlog_date desc
</select>
<select id="selectYlrStorageLocation" parameterType="java.lang.String" resultType="StorageLocation">
select materialBh,materialXingh,materialGuig,materialDiany,materialMs
,materialState,materialZlh,userName
from storageLocation
where materialBh = #{materialBh}
</select>
</mapper>

View File

@ -18,6 +18,15 @@ export function addStorageLocation(data) {
})
}
// 修改库位信息
export function addUpdStorageLocation(data) {
return request({
url: '/storageLocation/storageLocation/addUpdStorageLocation',
method: 'post',
data: data
})
}
// 校验库位是否已占用
export function checkStorageLocation(data) {
return request({
@ -27,6 +36,15 @@ export function checkStorageLocation(data) {
})
}
// 校验库位是否被领用或者是否是自己录入的
export function checkUpdStorageLocation(data) {
return request({
url: '/storageLocation/storageLocation/checkUpdStorageLocation',
method: 'post',
data: data
})
}
// 弹窗取消按钮 清除库位占用缓存
export function cancelStorageLocation(data) {
return request({

View File

@ -54,7 +54,7 @@
</el-descriptions-item>
<el-descriptions-item :contentStyle='contentStyle' :labelStyle='labelStyle'>
<template slot="label">
电压等级
电压
</template>
{{item.materialDiany}}
</el-descriptions-item>
@ -107,7 +107,7 @@
</el-descriptions-item>
<el-descriptions-item :contentStyle='contentStyle' :labelStyle='labelStyle'>
<template slot="label">
电压等级
电压
</template>
{{item.materialDiany}}
</el-descriptions-item>
@ -160,7 +160,7 @@
</el-descriptions-item>
<el-descriptions-item :contentStyle='contentStyle' :labelStyle='labelStyle'>
<template slot="label">
电压等级
电压
</template>
{{item.materialDiany}}
</el-descriptions-item>
@ -531,7 +531,6 @@
refresh(){
this.getStorageLocation();
},
/*获取库位信息*/
getStorageLocation(){
listStorageLocation(this.queryParams).then(response => {
@ -600,6 +599,7 @@
/*===============================================领用操作==========================================*/
// Tag
handleClick(tab, event) {
this.getStorageLocation();
console.log(tab, event);
},
@ -636,7 +636,7 @@
//
checkStorageLocation(this.form).then(response => {
if(materialBh.indexOf('A-')==0){
/*if(materialBh.indexOf('A-')==0){
this.selMaterialDetailA.push(item)
}
if(materialBh.indexOf('B-')==0){
@ -644,7 +644,7 @@
}
if(materialBh.indexOf('C-')==0){
this.selMaterialDetailC.push(item)
}
}*/
this.$message({
message: '已成功选择库位 '+ materialBh,
type: 'success'

View File

@ -30,7 +30,7 @@
<el-tag size="mini" type="success" @click="openDialog(item)">空闲</el-tag>
</span>
<span v-if = "item.materialState=='1'">
<el-tag size="mini" type="danger">已用</el-tag>
<el-tag size="mini" type="danger" @click="openUpdDialog(item)">已用</el-tag>
</span>
</el-descriptions-item>
<el-descriptions-item :span="2" :contentStyle='contentStyle' :labelStyle='labelStyle'>
@ -53,7 +53,7 @@
</el-descriptions-item>
<el-descriptions-item :contentStyle='contentStyle' :labelStyle='labelStyle'>
<template slot="label">
电压等级
电压
</template>
{{item.materialDiany}}
</el-descriptions-item>
@ -106,7 +106,7 @@
</el-descriptions-item>
<el-descriptions-item :contentStyle='contentStyle' :labelStyle='labelStyle'>
<template slot="label">
电压等级
电压
</template>
{{item.materialDiany}}
</el-descriptions-item>
@ -159,7 +159,7 @@
</el-descriptions-item>
<el-descriptions-item :contentStyle='contentStyle' :labelStyle='labelStyle'>
<template slot="label">
电压等级
电压
</template>
{{item.materialDiany}}
</el-descriptions-item>
@ -181,6 +181,7 @@
<el-col :span="12">
<el-form-item label="库位" prop="materialBh">
<el-input v-model="form.materialBh" :disabled="true"/>
<el-input v-model="form.userName" v-if="false"/>
</el-form-item>
</el-col>
<el-col :span="12">
@ -215,8 +216,8 @@
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submitForm(form)"> </el-button>
<el-button @click="cancel(form)"> </el-button>
</div>
</el-dialog>
<!-- 操作详情对话框 -->
@ -271,7 +272,7 @@
}
</style>
<script>
import { listStorageLocation, addStorageLocation, checkStorageLocation,cancelStorageLocation } from "@/api/storageLocation/storageLocation";
import { listStorageLocation, addStorageLocation, addUpdStorageLocation, checkStorageLocation,checkUpdStorageLocation,cancelStorageLocation } from "@/api/storageLocation/storageLocation";
//
import operlog from '@/views/storageLocation/operlog.vue';
@ -387,28 +388,54 @@
});
},
/** 打开录入修改弹窗 */
openUpdDialog(item) {
//
this.form.materialBh = item.materialBh;
checkUpdStorageLocation(this.form).then(response => {
this.reset();
this.open = true;
this.title = "修改信息";
this.form = response.data;
}).catch((error) => {
console.error(error);
});
},
/** 提交按钮 */
submitForm() {
submitForm(form) {
this.$refs["form"].validate(valid => {
if (valid) {
if(!form.userName){
addStorageLocation(this.form).then(response => {
this.$modal.msgSuccess("录入成功");
this.open = false;
this.getStorageLocation();
});
}else{//
addUpdStorageLocation(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getStorageLocation();
});
}
}
});
},
//
cancel() {
cancel(form) {
if(form.userName){
cancelStorageLocation(this.form).then(response => {
this.open = false;
this.reset();
}).catch((error) => {
console.error(error);
});
}else{//
this.open = false;
this.reset();
}
},
//

View File

@ -20,7 +20,7 @@
<el-table-column
prop="operlog_event"
label="事件"
width="120"
width="200"
fixed>
</el-table-column>
<el-table-column label="录入信息">