This commit is contained in:
xd 2024-03-18 20:02:23 +08:00
parent 3509e4a15d
commit 8d2169d2bb
9 changed files with 371 additions and 78 deletions

View File

@ -11,12 +11,15 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.DataSourceType; import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.ip.IpUtils; import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.storageLocation.domain.Operlog;
import com.ruoyi.storageLocation.domain.StorageLocation; import com.ruoyi.storageLocation.domain.StorageLocation;
import com.ruoyi.storageLocation.domain.StorageSelected; import com.ruoyi.storageLocation.domain.StorageSelected;
import com.ruoyi.storageLocation.service.StorageLocationService; import com.ruoyi.storageLocation.service.StorageLocationService;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysConfigService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -110,6 +113,21 @@ public class storageLocationController extends BaseController
}else{ }else{
redisCache.setCacheObject(getLocationZyCacheKey(materialBh),user_name); redisCache.setCacheObject(getLocationZyCacheKey(materialBh),user_name);
redisCache.deleteObject(getLocationLyCacheKey(materialBh)); redisCache.deleteObject(getLocationLyCacheKey(materialBh));
//插入操作记录表
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);
return toAjax(storageLocationService.addStorageLocation(storageLocation)); return toAjax(storageLocationService.addStorageLocation(storageLocation));
} }
@ -240,6 +258,31 @@ public class storageLocationController extends BaseController
if(StringUtils.isNotNull(kw_user_name)&&user_name.equals(kw_user_name)){ if(StringUtils.isNotNull(kw_user_name)&&user_name.equals(kw_user_name)){
redisCache.deleteObject(getLocationLyCacheKey(materialBh)); redisCache.deleteObject(getLocationLyCacheKey(materialBh));
} }
//批量插入操作记录表
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String date = format.format(new Date());
//查询已选库位信息
List<String> materialBhList = new ArrayList<String>();
materialBhList.add(materialBh);
List<StorageLocation> selectedList = storageLocationService.selectStorageLocation(user_name,materialBhList);
List<Operlog> operlogList = new ArrayList<Operlog>();
Operlog operlog = new Operlog();
for(StorageLocation sl:selectedList){
operlog = new Operlog();
operlog.setOperlog_user_name(user_name);
operlog.setOperlog_date(date);
operlog.setOperlog_event("删除已选库位信息");
operlog.setOperlog_kw(sl.getMaterialBh());
operlog.setOperlog_zlh(sl.getMaterialZlh());
operlog.setOperlog_xingh(sl.getMaterialXingh());
operlog.setOperlog_guig(sl.getMaterialGuig());
operlog.setOperlog_diany(sl.getMaterialDiany());
operlog.setOperlog_ms(sl.getMaterialMs());
operlogList.add(operlog);
}
storageLocationService.addBatchOperlog(operlogList);
storageLocationService.deleteStorageLocation(user_name,materialBh); storageLocationService.deleteStorageLocation(user_name,materialBh);
return success(); return success();
} }
@ -247,17 +290,39 @@ public class storageLocationController extends BaseController
/** /**
* 确认完成认领 * 确认完成认领
*/ */
@Log(title = "确认完成", businessType = BusinessType.OTHER) @Log(title = "确认完成", businessType = BusinessType.OTHER)
@PostMapping("/confirmStorageLocation") @PostMapping("/confirmStorageLocation")
public AjaxResult confirmStorageLocation(@RequestBody String [] materialBhArr) public AjaxResult confirmStorageLocation(@RequestBody String [] materialBhArr)
{ {
List<String> materialBhList = Arrays.asList(materialBhArr);
storageLocationService.confirmStorageLocation(materialBhList);
String user_name = getLoginUser().getUsername();//当前登陆者 String user_name = getLoginUser().getUsername();//当前登陆者
storageLocationService.deleteBatchStorageLocation(user_name,materialBhList); List<String> materialBhList = Arrays.asList(materialBhArr);
//批量插入操作记录表
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String date = format.format(new Date());
//查询已选库位信息
List<StorageLocation> selectedList = storageLocationService.selectStorageLocation(user_name,materialBhList);
List<Operlog> operlogList = new ArrayList<Operlog>();
Operlog operlog = new Operlog();
for(StorageLocation sl:selectedList){
operlog = new Operlog();
operlog.setOperlog_user_name(user_name);
operlog.setOperlog_date(date);
operlog.setOperlog_event("确认完成领用");
operlog.setOperlog_kw(sl.getMaterialBh());
operlog.setOperlog_zlh(sl.getMaterialZlh());
operlog.setOperlog_xingh(sl.getMaterialXingh());
operlog.setOperlog_guig(sl.getMaterialGuig());
operlog.setOperlog_diany(sl.getMaterialDiany());
operlog.setOperlog_ms(sl.getMaterialMs());
operlogList.add(operlog);
}
storageLocationService.addBatchOperlog(operlogList);
//删除已选库位信息
storageLocationService.deleteBatchStorageLocation(user_name,materialBhList);
//更新库位状态 -空闲
storageLocationService.confirmStorageLocation(materialBhList);
//删除占用缓存
for(String materialBh:materialBhArr){ for(String materialBh:materialBhArr){
redisCache.deleteObject(getLocationZyCacheKey(materialBh));// 清空占用缓存keys redisCache.deleteObject(getLocationZyCacheKey(materialBh));// 清空占用缓存keys
} }
@ -266,6 +331,19 @@ public class storageLocationController extends BaseController
/*===========================================库位领用==========================================================*/ /*===========================================库位领用==========================================================*/
/*===========================================操作记录==========================================================*/
/**
* 获取操作记录
*/
@GetMapping("/listOperlog")
public AjaxResult listOperlog(Operlog operlog)
{
AjaxResult ajaxResult = new AjaxResult();
List<Operlog> operlogData = storageLocationService.selectOperlogs(operlog);
ajaxResult.put("operlogData",operlogData);
return ajaxResult;
}
/*===========================================操作记录==========================================================*/
/** /**
* 库位占用缓存键名 * 库位占用缓存键名

View File

@ -0,0 +1,94 @@
package com.ruoyi.storageLocation.domain;
public class Operlog {
private String operlog_id;
private String operlog_kw;
private String operlog_date;
private String operlog_user_name;
private String operlog_event;
private String operlog_zlh;
private String operlog_xingh;
private String operlog_guig;
private String operlog_diany;
private String operlog_ms;
public String getOperlog_id() {
return operlog_id;
}
public void setOperlog_id(String operlog_id) {
this.operlog_id = operlog_id;
}
public String getOperlog_kw() {
return operlog_kw;
}
public void setOperlog_kw(String operlog_kw) {
this.operlog_kw = operlog_kw;
}
public String getOperlog_date() {
return operlog_date;
}
public void setOperlog_date(String operlog_date) {
this.operlog_date = operlog_date;
}
public String getOperlog_user_name() {
return operlog_user_name;
}
public void setOperlog_user_name(String operlog_user_name) {
this.operlog_user_name = operlog_user_name;
}
public String getOperlog_event() {
return operlog_event;
}
public void setOperlog_event(String operlog_event) {
this.operlog_event = operlog_event;
}
public String getOperlog_zlh() {
return operlog_zlh;
}
public void setOperlog_zlh(String operlog_zlh) {
this.operlog_zlh = operlog_zlh;
}
public String getOperlog_xingh() {
return operlog_xingh;
}
public void setOperlog_xingh(String operlog_xingh) {
this.operlog_xingh = operlog_xingh;
}
public String getOperlog_guig() {
return operlog_guig;
}
public void setOperlog_guig(String operlog_guig) {
this.operlog_guig = operlog_guig;
}
public String getOperlog_diany() {
return operlog_diany;
}
public void setOperlog_diany(String operlog_diany) {
this.operlog_diany = operlog_diany;
}
public String getOperlog_ms() {
return operlog_ms;
}
public void setOperlog_ms(String operlog_ms) {
this.operlog_ms = operlog_ms;
}
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.storageLocation.mapper; package com.ruoyi.storageLocation.mapper;
import com.ruoyi.storageLocation.domain.Operlog;
import com.ruoyi.storageLocation.domain.StorageLocation; import com.ruoyi.storageLocation.domain.StorageLocation;
import com.ruoyi.storageLocation.domain.StorageSelected; import com.ruoyi.storageLocation.domain.StorageSelected;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -78,4 +79,31 @@ public interface StorageLocationMapper
* @param materialBhList * @param materialBhList
*/ */
void deleteBatchStorageLocation(@Param("userName") String userName, @Param("list") List<String> materialBhList); void deleteBatchStorageLocation(@Param("userName") String userName, @Param("list") List<String> materialBhList);
/**
* 插入操作记录表
* @param operlog
*/
void addOperlog(Operlog operlog);
/**
* 查询已选库位信息
* @param userName
* @param materialBhList
* @return
*/
List<StorageLocation> selectStorageLocation(@Param("userName") String userName,@Param("list") List<String> materialBhList);
/**
* 批量插入操作记录表
* @param operlogList
*/
void addBatchOperlog(List<Operlog> operlogList);
/**
* 获取操作记录
* @param operlog
* @return
*/
List<Operlog> selectOperlogs(Operlog operlog);
} }

View File

@ -1,6 +1,6 @@
package com.ruoyi.storageLocation.service; package com.ruoyi.storageLocation.service;
import com.ruoyi.clMaterial.domain.CYlMaterial; import com.ruoyi.storageLocation.domain.Operlog;
import com.ruoyi.storageLocation.domain.StorageLocation; import com.ruoyi.storageLocation.domain.StorageLocation;
import com.ruoyi.storageLocation.domain.StorageSelected; import com.ruoyi.storageLocation.domain.StorageSelected;
@ -74,8 +74,35 @@ public interface StorageLocationService
/** /**
* 批量删除已选库位表记录 * 批量删除已选库位表记录
* @param user_name * @param userName
* @param materialBhList * @param materialBhList
*/ */
void deleteBatchStorageLocation(String user_name, List<String> materialBhList); void deleteBatchStorageLocation(String userName, List<String> materialBhList);
/**
* 插入操作记录表
* @param operlog
*/
void addOperlog(Operlog operlog);
/**
* 查询已选库位信息
* @param userName
* @param materialBhList
* @return StorageLocation
*/
List<StorageLocation> selectStorageLocation(String userName,List<String> materialBhList);
/**
* 批量插入操作记录表
* @param operlogList
*/
void addBatchOperlog(List<Operlog> operlogList);
/**
* 获取操作记录
* @param operlog
* @return
*/
List<Operlog> selectOperlogs(Operlog operlog);
} }

View File

@ -1,5 +1,6 @@
package com.ruoyi.storageLocation.service.impl; package com.ruoyi.storageLocation.service.impl;
import com.ruoyi.storageLocation.domain.Operlog;
import com.ruoyi.storageLocation.domain.StorageLocation; import com.ruoyi.storageLocation.domain.StorageLocation;
import com.ruoyi.storageLocation.domain.StorageSelected; import com.ruoyi.storageLocation.domain.StorageSelected;
import com.ruoyi.storageLocation.mapper.StorageLocationMapper; import com.ruoyi.storageLocation.mapper.StorageLocationMapper;
@ -123,4 +124,43 @@ public class StorageLocationServiceImpl implements StorageLocationService
public void deleteBatchStorageLocation(String userName, List<String> materialBhList) { public void deleteBatchStorageLocation(String userName, List<String> materialBhList) {
storageLocationMapper.deleteBatchStorageLocation(userName,materialBhList); storageLocationMapper.deleteBatchStorageLocation(userName,materialBhList);
} }
/**
* 插入操作记录表
* @param operlog
*/
@Override
public void addOperlog(Operlog operlog) {
storageLocationMapper.addOperlog(operlog);
}
/**
* 查询已选库位信息
* @param userName
* @param materialBhList
* @return
*/
@Override
public List<StorageLocation> selectStorageLocation(String userName,List<String> materialBhList) {
return storageLocationMapper.selectStorageLocation(userName,materialBhList);
}
/**
* 批量插入操作记录表
* @param operlogList
*/
@Override
public void addBatchOperlog(List<Operlog> operlogList) {
storageLocationMapper.addBatchOperlog(operlogList);
}
/**
* 获取操作记录
* @param operlog
* @return
*/
@Override
public List<Operlog> selectOperlogs(Operlog operlog) {
return storageLocationMapper.selectOperlogs(operlog);
}
} }

View File

@ -105,4 +105,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item} #{item}
</foreach> </foreach>
</delete> </delete>
<insert id="addOperlog" parameterType="Operlog">
insert into operlog (operlog_kw,operlog_date,operlog_user_name,operlog_event,operlog_zlh,operlog_xingh,operlog_guig,operlog_diany,operlog_ms)
values (#{operlog_kw},#{operlog_date},#{operlog_user_name},#{operlog_event},#{operlog_zlh},#{operlog_xingh},#{operlog_guig},#{operlog_diany},#{operlog_ms})
</insert>
<select id="selectStorageLocation" resultType="StorageLocation">
select a.material_bh materialBh,b.materialXingh,b.materialGuig,b.materialDiany,b.materialMs,b.materialZlh
from storageSelected a
left join storageLocation b on a.material_bh = b.materialBh
where a.user_name = #{userName}
and a.material_bh
<foreach collection="list" item="item" index="index" open="in (" close=")" separator=",">
#{item}
</foreach>
</select>
<insert id="addBatchOperlog">
insert into operlog (operlog_kw,operlog_date,operlog_user_name,operlog_event,operlog_zlh,operlog_xingh,operlog_guig,operlog_diany,operlog_ms)
values
<foreach collection="list" index="" item="item" separator=",">
(#{item.operlog_kw,jdbcType=VARCHAR},
#{item.operlog_date,jdbcType=VARCHAR},
#{item.operlog_user_name,jdbcType=VARCHAR},
#{item.operlog_event,jdbcType=VARCHAR},
#{item.operlog_zlh,jdbcType=VARCHAR},
#{item.operlog_xingh,jdbcType=VARCHAR},
#{item.operlog_guig,jdbcType=VARCHAR},
#{item.operlog_diany,jdbcType=VARCHAR},
#{item.operlog_ms,jdbcType=VARCHAR})
</foreach>
</insert>
<select id="selectOperlogs" parameterType="Operlog" resultType="Operlog">
select operlog_date,operlog_user_name,operlog_event,operlog_zlh,operlog_xingh
,operlog_guig,operlog_diany,operlog_ms
from operlog
where operlog_kw = #{operlog_kw} order by operlog_date desc
</select>
</mapper> </mapper>

View File

@ -0,0 +1,10 @@
import request from '@/utils/request'
// 获取操作记录
export function listOperlog(query) {
return request({
url: '/storageLocation/storageLocation/listOperlog',
method: 'get',
params: query
})
}

View File

@ -20,7 +20,7 @@
<template slot="label"> <template slot="label">
库位 库位
</template> </template>
<el-link class="kw" :underline="false" type="primary" @click="operlogdialog">{{item.materialBh}}</el-link> <el-link class="kw" :underline="false" type="primary" @click="operlogdialog(item.materialBh)">{{item.materialBh}}</el-link>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item :contentStyle='contentStyle' :labelStyle='labelStyle'> <el-descriptions-item :contentStyle='contentStyle' :labelStyle='labelStyle'>
<template slot="label"> <template slot="label">
@ -73,7 +73,7 @@
<template slot="label"> <template slot="label">
库位 库位
</template> </template>
<el-link class="kw" :underline="false" type="primary" @click="operlogdialog">{{item.materialBh}}</el-link> <el-link class="kw" :underline="false" type="primary" @click="operlogdialog(item.materialBh)">{{item.materialBh}}</el-link>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item :contentStyle='contentStyle' :labelStyle='labelStyle'> <el-descriptions-item :contentStyle='contentStyle' :labelStyle='labelStyle'>
<template slot="label"> <template slot="label">
@ -126,7 +126,7 @@
<template slot="label"> <template slot="label">
库位 库位
</template> </template>
<el-link class="kw" :underline="false" type="primary" @click="operlogdialog">{{item.materialBh}}</el-link> <el-link class="kw" :underline="false" type="primary" @click="operlogdialog(item.materialBh)">{{item.materialBh}}</el-link>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item :contentStyle='contentStyle' :labelStyle='labelStyle'> <el-descriptions-item :contentStyle='contentStyle' :labelStyle='labelStyle'>
<template slot="label"> <template slot="label">
@ -185,7 +185,7 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="指令号" prop="materialZlh"> <el-form-item label="指令号" prop="materialZlh">
<el-input v-model="form.materialZlh"/> <el-input v-model="form.materialZlh" placeholder="请输入指令号"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -316,6 +316,7 @@
operlogTitle: "", operlogTitle: "",
// //
operlogOpen: false, operlogOpen: false,
materialBhProp: "",
// //
form: {}, form: {},
@ -423,9 +424,10 @@
this.resetForm("form"); this.resetForm("form");
}, },
// //
operlogdialog(){ operlogdialog(materialBh){
this.operlogTitle = "操作记录"; this.operlogTitle = "操作记录";
this.operlogOpen = true; this.operlogOpen = true;
this.materialBhProp = materialBh;
} }
} }
} }

View File

@ -1,115 +1,90 @@
<template> <template>
<div>
<h1>{{ materialBhProp }}</h1>
<el-table <el-table
:data="tableData" :data="operlogData"
height="500" height="500"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
prop="operDate" prop="operlog_date"
label="时间" label="时间"
width="200" width="200"
fixed> fixed>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="operName" prop="operlog_user_name"
label="操作人" label="操作人"
width="100" width="100"
fixed> fixed>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="operEvent" prop="operlog_event"
label="事件" label="事件"
width="120" width="120"
fixed> fixed>
</el-table-column> </el-table-column>
<el-table-column label="录入信息"> <el-table-column label="录入信息">
<el-table-column <el-table-column
prop="operZlh" prop="operlog_zlh"
label="指令号" label="指令号"
width="150"> width="150">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="operXingh" prop="operlog_xingh"
label="型号" label="型号"
width="150"> width="150">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="operGuig" prop="operlog_guig"
label="规格" label="规格"
width="150"> width="150">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="operDiany" prop="operlog_diany"
label="电压等级" label="电压等级"
width="100"> width="100">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="operMs" prop="operlog_ms"
label="米数" label="米数"
width="100"> width="100">
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
</template> </template>
<script> <script>
import { listOperlog } from "@/api/storageLocation/operlog";
export default { export default {
name: 'Operlog', name: 'Operlog',
props: {
materialBhProp: String
},
data() { data() {
return { return {
tableData: [{ queryParams: {
operDate: '2016-05-02', operlog_kw: null,
operName: '王小虎', },
operEvent: '上海市普陀区金沙江路 1518 弄', operlogData: [],
operZlh: '上海市普陀区金沙江路 1518 弄', }
operXingh: '上海市普陀区金沙江路 1518 弄', },
operGuig: '上海市普陀区金沙江路 1518 弄', watch: {
operDiany: '上海市普陀区金沙江路 1518 弄', materialBhProp(value,oldvalue){
operMs: '上海市普陀区金沙江路 1518 弄', this.getOperlogData();
},{ }
operDate: '2016-05-02', },
operName: '王小虎', created() {
operEvent: '上海市普陀区金沙江路 1518 弄', /*获取库位信息*/
operZlh: '上海市普陀区金沙江路 1518 弄', this.getOperlogData();
operXingh: '上海市普陀区金沙江路 1518 弄', },
operGuig: '上海市普陀区金沙江路 1518 弄', methods: {
operDiany: '上海市普陀区金沙江路 1518 弄', /*获取操作记录*/
operMs: '上海市普陀区金沙江路 1518 弄', getOperlogData() {
},{ this.queryParams.operlog_kw = this._props.materialBhProp;
operDate: '2016-05-02', this.operlogData = [];
operName: '王小虎', listOperlog(this.queryParams).then(response => {
operEvent: '上海市普陀区金沙江路 1518 弄', this.operlogData = response.operlogData;
operZlh: '上海市普陀区金沙江路 1518 弄', });
operXingh: '上海市普陀区金沙江路 1518 弄',
operGuig: '上海市普陀区金沙江路 1518 弄',
operDiany: '上海市普陀区金沙江路 1518 弄',
operMs: '上海市普陀区金沙江路 1518 弄',
},{
operDate: '2016-05-02',
operName: '王小虎',
operEvent: '上海市普陀区金沙江路 1518 弄',
operZlh: '上海市普陀区金沙江路 1518 弄',
operXingh: '上海市普陀区金沙江路 1518 弄',
operGuig: '上海市普陀区金沙江路 1518 弄',
operDiany: '上海市普陀区金沙江路 1518 弄',
operMs: '上海市普陀区金沙江路 1518 弄',
},{
operDate: '2016-05-02',
operName: '王小虎',
operEvent: '上海市普陀区金沙江路 1518 弄',
operZlh: '上海市普陀区金沙江路 1518 弄',
operXingh: '上海市普陀区金沙江路 1518 弄',
operGuig: '上海市普陀区金沙江路 1518 弄',
operDiany: '上海市普陀区金沙江路 1518 弄',
operMs: '上海市普陀区金沙江路 1518 弄',
},{
operDate: '2016-05-02',
operName: '王小虎',
operEvent: '上海市普陀区金沙江路 1518 弄',
operZlh: '上海市普陀区金沙江路 1518 弄',
operXingh: '上海市普陀区金沙江路 1518 弄',
operGuig: '上海市普陀区金沙江路 1518 弄',
operDiany: '上海市普陀区金沙江路 1518 弄',
operMs: '上海市普陀区金沙江路 1518 弄',
}]
} }
} }
} }