完成 废品入库

master
wangh 8 months ago
parent 6edf3dea83
commit b457399d61

@ -0,0 +1,127 @@
package com.ruoyi.manage.controller;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.manage.domain.RecordWasteIn;
import com.ruoyi.manage.service.IRecordWasteInService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author wangh
* @date 2024-01-29
*/
@Controller
@RequestMapping("/manage/record_waste_in")
public class RecordWasteInController extends BaseController
{
private String prefix = "manage/record_waste_in";
@Autowired
private IRecordWasteInService recordWasteInService;
@RequiresPermissions("manage:record_waste_in:view")
@GetMapping()
public String record_waste_in()
{
return prefix + "/record_waste_in";
}
/**
*
*/
@RequiresPermissions("manage:record_waste_in:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(RecordWasteIn recordWasteIn)
{
startPage();
List<RecordWasteIn> list = recordWasteInService.selectRecordWasteInList(recordWasteIn);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("manage:record_waste_in:export")
@Log(title = "废品入库记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(RecordWasteIn recordWasteIn)
{
List<RecordWasteIn> list = recordWasteInService.selectRecordWasteInList(recordWasteIn);
ExcelUtil<RecordWasteIn> util = new ExcelUtil<RecordWasteIn>(RecordWasteIn.class);
return util.exportExcel(list, "废品入库记录数据");
}
/**
*
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
*
*/
@RequiresPermissions("manage:record_waste_in:add")
@Log(title = "废品入库记录", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(RecordWasteIn recordWasteIn)
{
return toAjax(recordWasteInService.insertRecordWasteIn(recordWasteIn));
}
/**
*
*/
@RequiresPermissions("manage:record_waste_in:edit")
@GetMapping("/edit/{objid}")
public String edit(@PathVariable("objid") Long objid, ModelMap mmap)
{
RecordWasteIn recordWasteIn = recordWasteInService.selectRecordWasteInByObjid(objid);
mmap.put("recordWasteIn", recordWasteIn);
return prefix + "/edit";
}
/**
*
*/
@RequiresPermissions("manage:record_waste_in:edit")
@Log(title = "废品入库记录", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(RecordWasteIn recordWasteIn)
{
return toAjax(recordWasteInService.updateRecordWasteIn(recordWasteIn));
}
/**
*
*/
@RequiresPermissions("manage:record_waste_in:remove")
@Log(title = "废品入库记录", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(recordWasteInService.deleteRecordWasteInByObjids(ids));
}
}

@ -0,0 +1,95 @@
package com.ruoyi.manage.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* record_waste_in
*
* @author wangh
* @date 2024-01-29
*/
public class RecordWasteIn extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long objid;
/** RFID */
@Excel(name = "RFID")
private String epc;
/** 前存储位置 */
@Excel(name = "前存储位置")
private String locationCode;
/** 报废时间 */
@Excel(name = "报废时间")
private String bfTime;
/** 入库库位 */
@Excel(name = "入库库位")
private String inCode;
public void setObjid(Long objid)
{
this.objid = objid;
}
public Long getObjid()
{
return objid;
}
public void setEpc(String epc)
{
this.epc = epc;
}
public String getEpc()
{
return epc;
}
public void setLocationCode(String locationCode)
{
this.locationCode = locationCode;
}
public String getLocationCode()
{
return locationCode;
}
public void setBfTime(String bfTime)
{
this.bfTime = bfTime;
}
public String getBfTime()
{
return bfTime;
}
public void setInCode(String inCode)
{
this.inCode = inCode;
}
public String getInCode()
{
return inCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("objid", getObjid())
.append("epc", getEpc())
.append("locationCode", getLocationCode())
.append("bfTime", getBfTime())
.append("inCode", getInCode())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.toString();
}
}

@ -0,0 +1,62 @@
package com.ruoyi.manage.mapper;
import java.util.List;
import com.ruoyi.manage.domain.RecordWasteIn;
import org.springframework.stereotype.Repository;
/**
* Mapper
*
* @author wangh
* @date 2024-01-29
*/
@Repository
public interface RecordWasteInMapper
{
/**
*
*
* @param objid
* @return
*/
public RecordWasteIn selectRecordWasteInByObjid(Long objid);
/**
*
*
* @param recordWasteIn
* @return
*/
public List<RecordWasteIn> selectRecordWasteInList(RecordWasteIn recordWasteIn);
/**
*
*
* @param recordWasteIn
* @return
*/
public int insertRecordWasteIn(RecordWasteIn recordWasteIn);
/**
*
*
* @param recordWasteIn
* @return
*/
public int updateRecordWasteIn(RecordWasteIn recordWasteIn);
/**
*
*
* @param objid
* @return
*/
public int deleteRecordWasteInByObjid(Long objid);
/**
*
*
* @param objids
* @return
*/
public int deleteRecordWasteInByObjids(String[] objids);
}

@ -0,0 +1,61 @@
package com.ruoyi.manage.service;
import java.util.List;
import com.ruoyi.manage.domain.RecordWasteIn;
/**
* Service
*
* @author wangh
* @date 2024-01-29
*/
public interface IRecordWasteInService
{
/**
*
*
* @param objid
* @return
*/
public RecordWasteIn selectRecordWasteInByObjid(Long objid);
/**
*
*
* @param recordWasteIn
* @return
*/
public List<RecordWasteIn> selectRecordWasteInList(RecordWasteIn recordWasteIn);
/**
*
*
* @param recordWasteIn
* @return
*/
public int insertRecordWasteIn(RecordWasteIn recordWasteIn);
/**
*
*
* @param recordWasteIn
* @return
*/
public int updateRecordWasteIn(RecordWasteIn recordWasteIn);
/**
*
*
* @param objids
* @return
*/
public int deleteRecordWasteInByObjids(String objids);
/**
*
*
* @param objid
* @return
*/
public int deleteRecordWasteInByObjid(Long objid);
}

@ -0,0 +1,93 @@
package com.ruoyi.manage.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.manage.mapper.RecordWasteInMapper;
import com.ruoyi.manage.domain.RecordWasteIn;
import com.ruoyi.manage.service.IRecordWasteInService;
import com.ruoyi.common.core.text.Convert;
/**
* Service
*
* @author wangh
* @date 2024-01-29
*/
@Service
public class RecordWasteInServiceImpl implements IRecordWasteInService {
@Autowired
private RecordWasteInMapper recordWasteInMapper;
/**
*
*
* @param objid
* @return
*/
@Override
public RecordWasteIn selectRecordWasteInByObjid(Long objid) {
return recordWasteInMapper.selectRecordWasteInByObjid(objid);
}
/**
*
*
* @param recordWasteIn
* @return
*/
@Override
public List<RecordWasteIn> selectRecordWasteInList(RecordWasteIn recordWasteIn) {
return recordWasteInMapper.selectRecordWasteInList(recordWasteIn);
}
/**
*
*
* @param recordWasteIn
* @return
*/
@Override
public int insertRecordWasteIn(RecordWasteIn recordWasteIn) {
recordWasteIn.setCreateBy(ShiroUtils.getLoginName());
recordWasteIn.setCreateTime(DateUtils.getNowDate());
return recordWasteInMapper.insertRecordWasteIn(recordWasteIn);
}
/**
*
*
* @param recordWasteIn
* @return
*/
@Override
public int updateRecordWasteIn(RecordWasteIn recordWasteIn) {
return recordWasteInMapper.updateRecordWasteIn(recordWasteIn);
}
/**
*
*
* @param objids
* @return
*/
@Override
public int deleteRecordWasteInByObjids(String objids) {
return recordWasteInMapper.deleteRecordWasteInByObjids(Convert.toStrArray(objids));
}
/**
*
*
* @param objid
* @return
*/
@Override
public int deleteRecordWasteInByObjid(Long objid) {
return recordWasteInMapper.deleteRecordWasteInByObjid(objid);
}
}

@ -0,0 +1,22 @@
-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('废品入库记录', '2026', '6', '/manage/record_waste_in', 'C', '0', 'manage:record_waste_in:view', '#', 'admin', sysdate(), '', null, '废品入库记录菜单');
-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();
-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('废品入库记录查询', @parentId, '1', '#', 'F', '0', 'manage:record_waste_in:list', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('废品入库记录新增', @parentId, '2', '#', 'F', '0', 'manage:record_waste_in:add', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('废品入库记录修改', @parentId, '3', '#', 'F', '0', 'manage:record_waste_in:edit', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('废品入库记录删除', @parentId, '4', '#', 'F', '0', 'manage:record_waste_in:remove', '#', 'admin', sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
values('废品入库记录导出', @parentId, '5', '#', 'F', '0', 'manage:record_waste_in:export', '#', 'admin', sysdate(), '', null, '');

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.manage.mapper.RecordWasteInMapper">
<resultMap type="RecordWasteIn" id="RecordWasteInResult">
<result property="objid" column="objid" />
<result property="epc" column="epc" />
<result property="locationCode" column="location_code" />
<result property="bfTime" column="bf_time" />
<result property="inCode" column="in_code" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectRecordWasteInVo">
select objid, epc, location_code, bf_time, in_code, create_by, create_time from record_waste_in
</sql>
<select id="selectRecordWasteInList" parameterType="RecordWasteIn" resultMap="RecordWasteInResult">
<include refid="selectRecordWasteInVo"/>
<where>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where>
</select>
<select id="selectRecordWasteInByObjid" parameterType="Long" resultMap="RecordWasteInResult">
<include refid="selectRecordWasteInVo"/>
where objid = #{objid}
</select>
<insert id="insertRecordWasteIn" parameterType="RecordWasteIn" useGeneratedKeys="true" keyProperty="objid">
insert into record_waste_in
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="epc != null">epc,</if>
<if test="locationCode != null">location_code,</if>
<if test="bfTime != null">bf_time,</if>
<if test="inCode != null">in_code,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="epc != null">#{epc},</if>
<if test="locationCode != null">#{locationCode},</if>
<if test="bfTime != null">#{bfTime},</if>
<if test="inCode != null">#{inCode},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateRecordWasteIn" parameterType="RecordWasteIn">
update record_waste_in
<trim prefix="SET" suffixOverrides=",">
<if test="epc != null">epc = #{epc},</if>
<if test="locationCode != null">location_code = #{locationCode},</if>
<if test="bfTime != null">bf_time = #{bfTime},</if>
<if test="inCode != null">in_code = #{inCode},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where objid = #{objid}
</update>
<delete id="deleteRecordWasteInByObjid" parameterType="Long">
delete from record_waste_in where objid = #{objid}
</delete>
<delete id="deleteRecordWasteInByObjids" parameterType="String">
delete from record_waste_in where objid in
<foreach item="objid" collection="array" open="(" separator="," close=")">
#{objid}
</foreach>
</delete>
</mapper>

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增废品入库记录')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-record_waste_in-add">
<div class="form-group">
<label class="col-sm-3 control-label">RFID</label>
<div class="col-sm-8">
<input name="epc" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">前存储位置:</label>
<div class="col-sm-8">
<input name="locationCode" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">报废时间:</label>
<div class="col-sm-8">
<input name="bfTime" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">入库库位:</label>
<div class="col-sm-8">
<input name="inCode" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "manage/record_waste_in"
$("#form-record_waste_in-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-record_waste_in-add').serialize());
}
}
</script>
</body>
</html>

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改废品入库记录')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-record_waste_in-edit" th:object="${recordWasteIn}">
<input name="objid" th:field="*{objid}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">RFID</label>
<div class="col-sm-8">
<input name="epc" th:field="*{epc}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">前存储位置:</label>
<div class="col-sm-8">
<input name="locationCode" th:field="*{locationCode}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">报废时间:</label>
<div class="col-sm-8">
<input name="bfTime" th:field="*{bfTime}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">入库库位:</label>
<div class="col-sm-8">
<input name="inCode" th:field="*{inCode}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "manage/record_waste_in";
$("#form-record_waste_in-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-record_waste_in-edit').serialize());
}
}
</script>
</body>
</html>

@ -0,0 +1,112 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('废品入库记录列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>入库人:</label>
<input type="text" name="createBy"/>
</li>
<li class="select-time">
<label>入库时间:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginCreateTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endCreateTime]"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="manage:record_waste_in:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="manage:record_waste_in:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="manage:record_waste_in:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="manage:record_waste_in:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('manage:record_waste_in:edit')}]];
var removeFlag = [[${@permission.hasPermi('manage:record_waste_in:remove')}]];
var prefix = ctx + "manage/record_waste_in";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "废品入库记录",
columns: [{
checkbox: true
},
{
field: 'objid',
title: '主键',
visible: false
},
{
field: 'epc',
title: 'RFID'
},
{
field: 'locationCode',
title: '前存储位置'
},
{
field: 'bfTime',
title: '报废时间'
},
{
field: 'inCode',
title: '入库库位'
},
{
field: 'createBy',
title: '入库人'
},
{
field: 'createTime',
title: '入库时间'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.objid + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.objid + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>
Loading…
Cancel
Save