开发物料管理模块

pull/1/head
wangziyangyang 2020-03-20 09:46:29 +08:00
parent 660f38e862
commit a683f2a914
10 changed files with 772 additions and 0 deletions

View File

@ -1,7 +1,9 @@
package com.wangziyang.mes.basedata.controller; package com.wangziyang.mes.basedata.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wangziyang.mes.basedata.entity.SpFlow;
import com.wangziyang.mes.basedata.request.SpFlowReq; import com.wangziyang.mes.basedata.request.SpFlowReq;
import com.wangziyang.mes.basedata.service.ISpFlowService; import com.wangziyang.mes.basedata.service.ISpFlowService;
import com.wangziyang.mes.common.BaseController; import com.wangziyang.mes.common.BaseController;
@ -11,10 +13,13 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/** /**
* <p> * <p>
* *
@ -46,4 +51,19 @@ public class SpFlowController extends BaseController {
} }
/**
*
*
* @return Result
*/
@ApiOperation("流程全部信息查询")
@GetMapping("/list")
@ResponseBody
public Result list() {
QueryWrapper queryWrapper = new QueryWrapper();
//queryWrapper.eq("is_deleted", "0");
List<SpFlow> list = iSpFlowService.list(queryWrapper);
return Result.success(list);
}
} }

View File

@ -19,6 +19,7 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
/** /**

View File

@ -0,0 +1,87 @@
package com.wangziyang.mes.basedata.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wangziyang.mes.basedata.entity.SpMaterile;
import com.wangziyang.mes.basedata.entity.SpTableManager;
import com.wangziyang.mes.basedata.request.SpFlowReq;
import com.wangziyang.mes.basedata.service.ISpMaterileService;
import com.wangziyang.mes.common.Result;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import com.wangziyang.mes.common.BaseController;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* <p>
*
* </p>
*
* @author WangZiYang
* @since 2020-03-19
*/
@Controller
@RequestMapping("/basedata/materile")
public class SpMaterileController extends BaseController {
/**
*
*/
@Autowired
private ISpMaterileService iSpMaterileService;
/**
*
*
* @param model
* @return
*/
@ApiOperation("物料管理界面UI")
@ApiImplicitParams({@ApiImplicitParam(name = "model", value = "模型", defaultValue = "模型")})
@GetMapping("/list-ui")
public String listUI(Model model) {
return "basedata/materile/list";
}
/**
*
*
* @param model
* @param record
* @return
*/
@ApiOperation("物料管理修改界面")
@GetMapping("/add-or-update-ui")
public String addOrUpdateUI(Model model, SpTableManager record) {
if (StringUtils.isNotEmpty(record.getId())) {
SpMaterile SpMaterile = iSpMaterileService.getById(record.getId());
model.addAttribute("result", SpMaterile);
}
return "basedata/materile/addOrUpdate";
}
/**
*
*
* @param req
* @return Result
*/
@ApiOperation("物料管理界面分页查询")
@ApiImplicitParams({@ApiImplicitParam(name = "req", value = "请求参数", defaultValue = "请求参数")})
@PostMapping("/page")
@ResponseBody
public Result page(SpFlowReq req) {
IPage result = iSpMaterileService.page(req);
return Result.success(result);
}
}

View File

@ -0,0 +1,263 @@
package com.wangziyang.mes.basedata.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.sun.istack.internal.NotNull;
import com.wangziyang.mes.common.BaseEntity;
/**
* <p>
*
* </p>
*
* @author WangZiYang
* @since 2020-03-19
*/
public class SpMaterile extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private String materiel;
/**
*
*/
private String materielDesc;
/**
*
*/
private String unit;
/**
*
*/
private String productGroup;
/**
*
*/
private String matType;
/**
*
*/
@NotNull
private String size;
/**
* ID
*/
private String flowId;
/**
*
*/
private String flowDesc;
/**
*
*/
private String model;
/**
* (00:;01:;02:)
*/
@TableField(value = "is_deleted")
private String deleted;
@Override
public String toString() {
return "SpMaterile{" +
"materiel=" + materiel +
", materielDesc=" + materielDesc +
", unit=" + unit +
", productGroup=" + productGroup +
", matType=" + matType +
", size=" + size +
", flow=" + flowId +
"}";
}
/**
*
*
* @return materiel
*/
public String getMateriel() {
return this.materiel;
}
/**
*
*
* @param materiel
*/
public void setMateriel(String materiel) {
this.materiel = materiel;
}
/**
*
*
* @return materielDesc
*/
public String getMaterielDesc() {
return this.materielDesc;
}
/**
*
*
* @param materielDesc
*/
public void setMaterielDesc(String materielDesc) {
this.materielDesc = materielDesc;
}
/**
*
*
* @return unit
*/
public String getUnit() {
return this.unit;
}
/**
*
*
* @param unit
*/
public void setUnit(String unit) {
this.unit = unit;
}
/**
*
*
* @return productGroup
*/
public String getProductGroup() {
return this.productGroup;
}
/**
*
*
* @param productGroup
*/
public void setProductGroup(String productGroup) {
this.productGroup = productGroup;
}
/**
*
*
* @return matType
*/
public String getMatType() {
return this.matType;
}
/**
*
*
* @param matType
*/
public void setMatType(String matType) {
this.matType = matType;
}
/**
*
*
* @return size
*/
public String getSize() {
return this.size;
}
/**
*
*
* @param size
*/
public void setSize(String size) {
this.size = size;
}
/**
* (00:;01:;02:)
*
* @return deleted (00:;01:;02:)
*/
public String getDeleted() {
return this.deleted;
}
/**
* (00:;01:;02:)
*
* @param deleted (00:;01:;02:)
*/
public void setDeleted(String deleted) {
this.deleted = deleted;
}
/**
*
*
* @return model
*/
public String getModel() {
return this.model;
}
/**
*
*
* @param model
*/
public void setModel(String model) {
this.model = model;
}
/**
*
*
* @return flowId
*/
public String getFlowId() {
return this.flowId;
}
/**
*
*
* @param flowId
*/
public void setFlowId(String flowId) {
this.flowId = flowId;
}
/**
*
*
* @return flowDesc
*/
public String getFlowDesc() {
return this.flowDesc;
}
/**
*
*
* @param flowDesc
*/
public void setFlowDesc(String flowDesc) {
this.flowDesc = flowDesc;
}
}

View File

@ -0,0 +1,16 @@
package com.wangziyang.mes.basedata.mapper;
import com.wangziyang.mes.basedata.entity.SpMaterile;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper
* </p>
*
* @author WangZiYang
* @since 2020-03-19
*/
public interface SpMaterileMapper extends BaseMapper<SpMaterile> {
}

View File

@ -0,0 +1,16 @@
package com.wangziyang.mes.basedata.service;
import com.wangziyang.mes.basedata.entity.SpMaterile;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
*
* </p>
*
* @author WangZiYang
* @since 2020-03-19
*/
public interface ISpMaterileService extends IService<SpMaterile> {
}

View File

@ -0,0 +1,20 @@
package com.wangziyang.mes.basedata.service.impl;
import com.wangziyang.mes.basedata.entity.SpMaterile;
import com.wangziyang.mes.basedata.mapper.SpMaterileMapper;
import com.wangziyang.mes.basedata.service.ISpMaterileService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
*
* </p>
*
* @author WangZiYang
* @since 2020-03-19
*/
@Service
public class SpMaterileServiceImpl extends ServiceImpl<SpMaterileMapper, SpMaterile> implements ISpMaterileService {
}

View File

@ -0,0 +1,5 @@
<?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.wangziyang.mes.basedata.mapper.SpMaterileMapper">
</mapper>

View File

@ -0,0 +1,161 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>添加用户</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<#include "${request.contextPath}/common/common.ftl">
</head>
<body>
<div class="splayui-container">
<div class="splayui-main">
<form class="layui-form splayui-form" lay-filter="formTest">
<div class="layui-row">
<div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
<div class="layui-form-item">
<label for="js-materiel" class="layui-form-label sp-required">物料编号
</label>
<div class="layui-input-inline">
<input type="text" id="js-materiel" name="materiel" lay-verify="required" autocomplete="off"
class="layui-input" value="${result.materiel}">
</div>
</div>
<div class="layui-form-item">
<label for="js-materielDesc" class="layui-form-label sp-required">物料描述
</label>
<div class="layui-input-inline">
<input type="text" id="js-materielDesc" name="materielDesc" lay-verify="required"
autocomplete="off" class="layui-input" value="${result.materielDesc}">
</div>
</div>
<div class="layui-form-item">
<label for="js-unit" class="layui-form-label sp-required">单位
</label>
<div class="layui-input-inline">
<input type="text" id="js-unit" name="unit" lay-verify="required" autocomplete="off"
class="layui-input" value="${result.unit}">
</div>
</div>
<div class="layui-form-item">
<label for="js-productGroup" class="layui-form-label sp-required">产品组
</label>
<div class="layui-input-inline">
<input type="text" id="js-productGroup" name="productGroup" lay-verify="required"
autocomplete="off"
class="layui-input" value="${result.unit}">
</div>
</div>
<div class="layui-form-item">
<label for="js-model" class="layui-form-label sp-required">规格型号
</label>
<div class="layui-input-inline">
<input type="text" id="js-model" name="model" lay-verify="required"
autocomplete="off"
class="layui-input" value="${result.model}">
</div>
</div>
<div class="layui-form-item">
<label for="js-matType" class="layui-form-label sp-required">物料类型
</label>
<div class="layui-input-inline">
<input type="text" id="js-matType" name="matType" lay-verify="required" autocomplete="off"
class="layui-input" value="${result.matType}">
</div>
</div>
<div class="layui-form-item">
<label for="js-size" class="layui-form-label sp-required">尺寸
</label>
<div class="layui-input-inline">
<input type="text" id="js-size" name="size" lay-verify="required" autocomplete="off"
class="layui-input" value="${result.size}">
</div>
</div>
<div class="layui-form-item">
<div class="layui-form-item">
<label for="js-flowId" class="layui-form-label sp-required">工艺流程
</label>
<div class="layui-input-inline">
<select id="js-flowId" name="flowId" lay-filter="aihao" lay-verify="required"
value="${result.flow}">
</select>
</div>
</div>
<div class="layui-form-item">
<label for="js-is-deleted" class="layui-form-label sp-required">状态
</label>
<div class="layui-input-block" id="js-is-deleted" style="width: 310px;">
<input type="radio" name="deleted" value="0" title="正常"
<#if result.deleted == "0" || !(result??)>checked</#if>>
<input type="radio" name="deleted" value="1" title="已删除"
<#if result.deleted == "1">checked</#if>>
<input type="radio" name="deleted" value="2" title="已禁用"
<#if result.deleted == "2">checked</#if>>
</div>
</div>
</div>
<div class="layui-form-item layui-hide">
<div class="layui-input-block">
<input id="js-id" name="id" value="${result.id}"/>
<button id="js-submit" class="layui-btn" lay-submit lay-filter="js-submit-filter">确定
</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<script>
layui.use(['form', 'util'], function () {
var form = layui.form,
util = layui.util;
var flowRows = [];
getFlowData();
console.log(flowRows);
$.each(flowRows, function (index, item) {
$('#js-flowId').append(new Option(item.flowDesc,item.id));
});
//给表单赋值
form.val("formTest", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
"size": "100*100*100",// "name": "value"
"flowId": 3
});
//获取表单区域所有值
var data1 = form.val("formTest");
/**
* 初始化流程数据
*/
function getFlowData() {
spUtil.ajax({
url: '${request.contextPath}/basedata/flow/list',
async: false,
type: 'GET',
// 是否显示 loading
showLoading: true,
// 是否序列化参数
serializable: false,
// 参数
data: {},
success: function (data) {
flowRows = data.data;
}
});
}
//监听提交
form.on('submit(js-submit-filter)', function (data) {
spUtil.submitForm({
url: "${request.contextPath}/admin/sys/role/add-or-update",
data: data.field
});
return false;
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,183 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>系统角色列表</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<#include "${request.contextPath}/common/common.ftl">
</head>
<body>
<div class="splayui-container">
<div class="splayui-main">
<!--查询参数-->
<form id="js-search-form" class="layui-form" lay-filter="js-q-form-filter">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">物料编号</label>
<div class="layui-input-inline">
<input type="materiel" name="materiel" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">物料名称</label>
<div class="layui-input-inline">
<input type="materielDesc" name="materielDesc" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<a class="layui-btn" lay-submit lay-filter="js-search-filter"><i
class="layui-icon layui-icon-search layuiadmin-button-btn"></i></a>
</div>
</div>
</form>
<!--表格-->
<table class="layui-hide" id="js-record-table" lay-filter="js-record-table-filter"></table>
</div>
</div>
<!--表格头操作模板-->
<script type="text/html" id="js-record-table-toolbar-top">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-danger layui-btn-sm" lay-event="deleteBatch"><i
class="layui-icon">&#xe640;</i>批量删除
</button>
<@shiro.hasPermission name="user:add">
<button class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon">&#xe61f;</i>添加</button>
</@shiro.hasPermission>
</div>
</script>
<!--行操作模板-->
<script type="text/html" id="js-record-table-toolbar-right">
<a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete"><i class="layui-icon layui-icon-delete"></i>删除</a>
</script>
<!--js逻辑-->
<script>
layui.use(['form', 'table', 'spLayer', 'spTable'], function () {
var form = layui.form,
table = layui.table,
spLayer = layui.spLayer,
spTable = layui.spTable;
// 表格及数据初始化
var tableIns = spTable.render({
url: '${request.contextPath}/basedata/materile/page',
cols: [
[{
type: 'checkbox'
}, {
field: 'materiel', title: '物料编码'
}, {
field: 'materielDesc', title: '物料描述'
}, {
field: 'productGroup', title: '产品组'
}, {
field: 'size', title: '尺寸'
}, {
field: 'flowDesc', title: '流程描述'
}, {
field: 'model', title: '型号'
}, {
field: 'deleted', title: '状态', templet: function (d) {
return spConfig.isDeletedDict[d.deleted];
}
}, {
fixed: 'right',
field: 'operate',
title: '操作',
toolbar: '#js-record-table-toolbar-right',
unresize: true,
width: 150
}]
],
done: function (res, curr, count) {
}
});
/*
* 数据表格中form表单元素是动态插入,所以需要更新渲染下
* http://www.layui.com/doc/modules/form.html#render
*/
$(function () {
form.render();
});
/**
* 搜索按钮事件
*/
form.on('submit(js-search-filter)', function (data) {
tableIns.reload({
where: data.field,
page: {
// 重新从第 1 页开始
curr: 1
}
});
// 阻止表单跳转。如果需要表单跳转,去掉这段即可。
return false;
});
/**
* 头工具栏事件
*/
table.on('toolbar(js-record-table-filter)', function (obj) {
var checkStatus = table.checkStatus(obj.config.id);
// 批量删除
if (obj.event === 'deleteBatch') {
var checkStatus = table.checkStatus('record-table'),
data = checkStatus.data;
if (data.length > 0) {
layer.confirm('确认要删除吗?', function (index) {
});
} else {
layer.msg("请先选择需要删除的数据!");
}
}
// 添加
if (obj.event === 'add') {
var index = spLayer.open({
title: '添加',
area: ['90%', '90%'],
content: '${request.contextPath}/basedata/materile/add-or-update-ui'
});
}
});
/**
* 监听行工具事件
*/
table.on('tool(js-record-table-filter)', function (obj) {
var data = obj.data;
// 编辑
if (obj.event === 'edit') {
spLayer.open({
title: '编辑',
area: ['800px', '400px'],
// 请求url参数
spWhere: {id: data.id},
content: '${request.contextPath}/basedata/materile/add-or-update-ui'
});
}
// 删除
if (obj.event === 'delete') {
layer.confirm('确认要删除吗?', function (index) {
obj.del();
layer.close(index);
});
}
});
});
</script>
</body>
</html>