diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/storageLocation/storageLocationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/storageLocation/storageLocationController.java index b02e9c1..3f6ef58 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/storageLocation/storageLocationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/storageLocation/storageLocationController.java @@ -11,12 +11,15 @@ 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.Operlog; import com.ruoyi.storageLocation.domain.StorageLocation; import com.ruoyi.storageLocation.domain.StorageSelected; import com.ruoyi.storageLocation.service.StorageLocationService; import com.ruoyi.system.service.ISysConfigService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; + +import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.TimeUnit; @@ -110,6 +113,21 @@ public class storageLocationController extends BaseController }else{ redisCache.setCacheObject(getLocationZyCacheKey(materialBh),user_name); 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)); } @@ -240,6 +258,31 @@ public class storageLocationController extends BaseController if(StringUtils.isNotNull(kw_user_name)&&user_name.equals(kw_user_name)){ redisCache.deleteObject(getLocationLyCacheKey(materialBh)); } + + //批量插入操作记录表 + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String date = format.format(new Date()); + //查询已选库位信息 + List materialBhList = new ArrayList(); + materialBhList.add(materialBh); + List selectedList = storageLocationService.selectStorageLocation(user_name,materialBhList); + + List operlogList = new ArrayList(); + 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); return success(); } @@ -247,17 +290,39 @@ public class storageLocationController extends BaseController /** * 确认完成认领 */ - @Log(title = "确认完成认领", businessType = BusinessType.OTHER) + @Log(title = "确认完成领用", businessType = BusinessType.OTHER) @PostMapping("/confirmStorageLocation") public AjaxResult confirmStorageLocation(@RequestBody String [] materialBhArr) { - - List materialBhList = Arrays.asList(materialBhArr); - storageLocationService.confirmStorageLocation(materialBhList); - String user_name = getLoginUser().getUsername();//当前登陆者 - storageLocationService.deleteBatchStorageLocation(user_name,materialBhList); + List materialBhList = Arrays.asList(materialBhArr); + //批量插入操作记录表 + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String date = format.format(new Date()); + //查询已选库位信息 + List selectedList = storageLocationService.selectStorageLocation(user_name,materialBhList); + List operlogList = new ArrayList(); + 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){ 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 operlogData = storageLocationService.selectOperlogs(operlog); + ajaxResult.put("operlogData",operlogData); + return ajaxResult; + } + /*===========================================操作记录==========================================================*/ /** * 库位占用缓存键名 diff --git a/ruoyi-system/src/main/java/com/ruoyi/storageLocation/domain/Operlog.java b/ruoyi-system/src/main/java/com/ruoyi/storageLocation/domain/Operlog.java new file mode 100644 index 0000000..1363242 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/storageLocation/domain/Operlog.java @@ -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; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/storageLocation/mapper/StorageLocationMapper.java b/ruoyi-system/src/main/java/com/ruoyi/storageLocation/mapper/StorageLocationMapper.java index 1bf7d33..025f439 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/storageLocation/mapper/StorageLocationMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/storageLocation/mapper/StorageLocationMapper.java @@ -1,5 +1,6 @@ package com.ruoyi.storageLocation.mapper; +import com.ruoyi.storageLocation.domain.Operlog; import com.ruoyi.storageLocation.domain.StorageLocation; import com.ruoyi.storageLocation.domain.StorageSelected; import org.apache.ibatis.annotations.Param; @@ -78,4 +79,31 @@ public interface StorageLocationMapper * @param materialBhList */ void deleteBatchStorageLocation(@Param("userName") String userName, @Param("list") List materialBhList); + + /** + * 插入操作记录表 + * @param operlog + */ + void addOperlog(Operlog operlog); + + /** + * 查询已选库位信息 + * @param userName + * @param materialBhList + * @return + */ + List selectStorageLocation(@Param("userName") String userName,@Param("list") List materialBhList); + + /** + * 批量插入操作记录表 + * @param operlogList + */ + void addBatchOperlog(List operlogList); + + /** + * 获取操作记录 + * @param operlog + * @return + */ + List selectOperlogs(Operlog operlog); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/storageLocation/service/StorageLocationService.java b/ruoyi-system/src/main/java/com/ruoyi/storageLocation/service/StorageLocationService.java index 926d44e..fa55d7b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/storageLocation/service/StorageLocationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/storageLocation/service/StorageLocationService.java @@ -1,6 +1,6 @@ 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.StorageSelected; @@ -74,8 +74,35 @@ public interface StorageLocationService /** * 批量删除已选库位表记录 - * @param user_name + * @param userName * @param materialBhList */ - void deleteBatchStorageLocation(String user_name, List materialBhList); + void deleteBatchStorageLocation(String userName, List materialBhList); + + /** + * 插入操作记录表 + * @param operlog + */ + void addOperlog(Operlog operlog); + + /** + * 查询已选库位信息 + * @param userName + * @param materialBhList + * @return StorageLocation + */ + List selectStorageLocation(String userName,List materialBhList); + + /** + * 批量插入操作记录表 + * @param operlogList + */ + void addBatchOperlog(List operlogList); + + /** + * 获取操作记录 + * @param operlog + * @return + */ + List selectOperlogs(Operlog operlog); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/storageLocation/service/impl/StorageLocationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/storageLocation/service/impl/StorageLocationServiceImpl.java index c79ec62..20960c6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/storageLocation/service/impl/StorageLocationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/storageLocation/service/impl/StorageLocationServiceImpl.java @@ -1,5 +1,6 @@ package com.ruoyi.storageLocation.service.impl; +import com.ruoyi.storageLocation.domain.Operlog; import com.ruoyi.storageLocation.domain.StorageLocation; import com.ruoyi.storageLocation.domain.StorageSelected; import com.ruoyi.storageLocation.mapper.StorageLocationMapper; @@ -123,4 +124,43 @@ public class StorageLocationServiceImpl implements StorageLocationService public void deleteBatchStorageLocation(String userName, List materialBhList) { storageLocationMapper.deleteBatchStorageLocation(userName,materialBhList); } + + /** + * 插入操作记录表 + * @param operlog + */ + @Override + public void addOperlog(Operlog operlog) { + storageLocationMapper.addOperlog(operlog); + } + + /** + * 查询已选库位信息 + * @param userName + * @param materialBhList + * @return + */ + @Override + public List selectStorageLocation(String userName,List materialBhList) { + return storageLocationMapper.selectStorageLocation(userName,materialBhList); + } + + /** + * 批量插入操作记录表 + * @param operlogList + */ + @Override + public void addBatchOperlog(List operlogList) { + storageLocationMapper.addBatchOperlog(operlogList); + } + + /** + * 获取操作记录 + * @param operlog + * @return + */ + @Override + public List selectOperlogs(Operlog operlog) { + return storageLocationMapper.selectOperlogs(operlog); + } } diff --git a/ruoyi-system/src/main/resources/mapper/storageLocation/StorageLocationMapper.xml b/ruoyi-system/src/main/resources/mapper/storageLocation/StorageLocationMapper.xml index 940d958..46f8900 100644 --- a/ruoyi-system/src/main/resources/mapper/storageLocation/StorageLocationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/storageLocation/StorageLocationMapper.xml @@ -105,4 +105,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{item} + + + 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 into operlog (operlog_kw,operlog_date,operlog_user_name,operlog_event,operlog_zlh,operlog_xingh,operlog_guig,operlog_diany,operlog_ms) + values + + (#{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}) + + + + diff --git a/ruoyi-ui/src/api/storageLocation/operlog.js b/ruoyi-ui/src/api/storageLocation/operlog.js new file mode 100644 index 0000000..2056c57 --- /dev/null +++ b/ruoyi-ui/src/api/storageLocation/operlog.js @@ -0,0 +1,10 @@ +import request from '@/utils/request' + +// 获取操作记录 +export function listOperlog(query) { + return request({ + url: '/storageLocation/storageLocation/listOperlog', + method: 'get', + params: query + }) +} diff --git a/ruoyi-ui/src/views/storageLocation/locationSet.vue b/ruoyi-ui/src/views/storageLocation/locationSet.vue index 5c1535a..e89bcd2 100644 --- a/ruoyi-ui/src/views/storageLocation/locationSet.vue +++ b/ruoyi-ui/src/views/storageLocation/locationSet.vue @@ -20,7 +20,7 @@ - {{item.materialBh}} + {{item.materialBh}}