开发BOM功能。。完成主表操作

pull/1/head
wangziyangyang 2020-04-30 16:11:16 +08:00
parent 2c037ab419
commit 17f8b46e74
6 changed files with 169 additions and 213 deletions

View File

@ -12,7 +12,7 @@
<artifactId>mes</artifactId>
<name>mes</name>
<version>1.0.0</version>
<description>maven 骨架生成所需项目</description>
<description>mes</description>
<packaging>jar</packaging>
<properties>

View File

@ -1,6 +1,7 @@
package com.wangziyang.mes.technology.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wangziyang.mes.common.BaseController;
import com.wangziyang.mes.common.Result;
@ -58,7 +59,7 @@ public class SpBomController extends BaseController {
* @param spBom bom
* @return
*/
@ApiOperation("主数据维护修改界面")
@ApiOperation("工艺BOM管理修改界面")
@GetMapping("/add-or-update-ui")
public String addOrUpdateUI(Model model, SpBom spBom) throws Exception {
if (StringUtils.isNotEmpty(spBom.getId())) {
@ -81,9 +82,42 @@ public class SpBomController extends BaseController {
@PostMapping("/page")
@ResponseBody
public Result page(SpBomReq req) {
IPage result = iSpBomService.page(req);
QueryWrapper qw = new QueryWrapper();
if (StringUtils.isNotEmpty(req.getMaterielCodeLike())) {
qw.likeRight("materiel_code",req.getMaterielCodeLike());
}
IPage result = iSpBomService.page(req,qw);
return Result.success(result);
}
/**
* BOM
*
* @param spBom
* @return
*/
@ApiOperation("工艺BOM修改、新增")
@PostMapping("/add-or-update")
@ResponseBody
public Result addOrUpdate(SpBom spBom) {
iSpBomService.saveOrUpdate(spBom);
return Result.success();
}
/**
* BOM
*
* @param spBom
* @return Result
*/
@ApiOperation("删除工艺BOM")
@ApiImplicitParams({@ApiImplicitParam(name = "req", value = "工艺BOM", defaultValue = "工艺BOM")})
@PostMapping("/delete")
@ResponseBody
public Result deleteByTableNameId(SpBom spBom) throws Exception {
iSpBomService.removeById(spBom.getId());
return Result.success();
}
}

View File

@ -8,5 +8,28 @@ import com.wangziyang.mes.common.BasePageReq;
* @author wangziyang
* @since 20200328
*/
public class SpBomReq extends BasePageReq {
/**
*
*/
private String materielCodeLike ;
/**
*
*
* @return materielCodeLike
*/
public String getMaterielCodeLike() {
return this.materielCodeLike;
}
/**
*
*
* @param materielCodeLike
*/
public void setMaterielCodeLike(String materielCodeLike) {
this.materielCodeLike = materielCodeLike;
}
}

View File

@ -12,219 +12,114 @@
<body>
<div class="splayui-container">
<div class="splayui-main">
<div class="layui-carousel" id="stepForm" lay-filter="stepForm">
<div carousel-item>
<div>
<form class="layui-form" style="margin: 0 auto;max-width: 460px;padding-top: 40px;">
<div class="layui-form-item">
<div class="layui-inline">
<label for="js-bomCode" class="layui-form-label sp-required">BOM编码
</label>
<div class="layui-input-inline">
<input type="text" id="js-bomCode" name="bomCode" lay-verify="required"
autocomplete="off"
class="layui-input" value="${result.bomCode}">
</div>
</div>
</div>
<div class="layui-form-item">
<label for="js-materielCode" class="layui-form-label sp-required">物料编码
</label>
<div style="display: flex; flex-direction: row;">
<button type="button" id="js-test-btn" class="layui-btn" style="height:37px "><i
class="layui-icon layui-icon-search "></i>
</button>
<input id="js-test-input" name="materielCode" readonly="true" lay-verify="required"
placeholder="搜索物料" autocomplete="off"
value="${result.materielCode}"
class="layui-input" style="width: 133PX">
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label for="js-version-number" class="layui-form-label sp-required">版本号
</label>
<div style="display: flex; flex-direction: row;">
<input type="text" id="js-versionNumber" readonly="true" name="versionNumber"
lay-verify="required"
autocomplete="off"
class="layui-input"
{value="${result.versionNumber}" | value='1' style=" width: 163PX;" }>
<div style="display: flex; flex-direction: column;">
<div style="display: flex">
<button onclick="FN('plus')" type="button" style="height: 19PX"
class="layui-btn layui-btn-xs"><i
class="layui-icon layui-icon-up"></i>
</button>
</div>
<div style="display: flex">
<button onclick="FN('minus')" type="button" style="height: 19PX"
class="layui-btn layui-btn-xs"><i
class="layui-icon layui-icon-down"></i>
</button>
</div>
</div>
</div>
</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 class="layui-form-item">
<label class="layui-form-label">备注说明:</label>
<div class="layui-input-block">
<textarea placeholder="BOM备注" value="" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button type="button" class="layui-btn" lay-submit lay-filter="formStep">
&emsp;下一步&emsp;
</button>
</div>
</div>
</form>
<form class="layui-form" style="margin: 0 auto;max-width: 460px;padding-top: 40px;">
<div class="layui-form-item">
<div class="layui-inline">
<label for="js-bomCode" class="layui-form-label sp-required">BOM编码
</label>
<div class="layui-input-inline">
<input type="text" id="js-bomCode" name="bomCode" lay-verify="required"
autocomplete="off"
class="layui-input" value="${result.bomCode}">
</div>
</div>
<div>
<form class="layui-form">
<div class="layui-form-item">
<input id="js-id" name="id" class="layui-hide" value="${result.id}"/>
<button type="button" class="layui-btn layui-bg-green pre" lay-submit
lay-filter="formStep">
&emsp;上一步&emsp;
</button>
<button id="js-submit" class="layui-btn pre" lay-demotransferactive="getData" lay-submit
lay-filter="js-submit-filter">&emsp;保存&emsp;
</button>
</div>
<div class="layui-form-item">
<!--表格-->
<table class="layui-hide" id="layTableId" lay-filter="js-record-table-filter"></table>
</div>
</form>
</div>
</div>
</div>
<div class="layui-form-item">
<label for="js-materielCode" class="layui-form-label sp-required">物料编码
</label>
<div style="display: flex; flex-direction: row;">
<button type="button" id="js-test-btn" class="layui-btn" style="height:37px "><i
class="layui-icon layui-icon-search "></i>
</button>
<input id="js-materiel-code" name="materielCode" readonly="true" lay-verify="required"
placeholder="搜索物料" autocomplete="off"
value="${result.materielCode}"
class="layui-input" style="width: 133PX">
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label for="js-materielName" class="layui-form-label sp-required">物料名称
</label>
<div class="layui-input-inline">
<input id="js-materiel-name" readonly="true" name="materielDesc" lay-verify="required"
autocomplete="off"
class="layui-input" value="${result.materielDesc}">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label for="js-version-number" class="layui-form-label sp-required">版本号
</label>
<div style="display: flex; flex-direction: row;">
<input type="text" id="js-versionNumber" readonly="true" name="versionNumber"
lay-verify="required"
autocomplete="off"
class="layui-input"
{value="${result.versionNumber}" | value='1' style=" width: 163PX;" }>
<div style="display: flex; flex-direction: column;">
<div style="display: flex">
<button onclick="FN('plus')" type="button" style="height: 19PX"
class="layui-btn layui-btn-xs"><i
class="layui-icon layui-icon-up"></i>
</button>
</div>
<div style="display: flex">
<button onclick="FN('minus')" type="button" style="height: 19PX"
class="layui-btn layui-btn-xs"><i
class="layui-icon layui-icon-down"></i>
</button>
</div>
</div>
</div>
</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 class="layui-form-item">
<label class="layui-form-label">备注说明:</label>
<div class="layui-input-block">
<textarea placeholder="BOM备注" name="remark" value="${result.remark}"
class="layui-textarea"></textarea>
</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-demotransferactive="getData" lay-submit
lay-filter="js-submit-filter">确定
</button>
</div>
</div>
</form>
</div>
</div>
<!--表格头操作模板-->
<script type="text/html" id="js-record-table-toolbar-top">
<div class="layui-btn-container">
<@shiro.hasPermission name="user:add">
<div>
<button type="button" class="layui-btn layui-btn-sm" lay-event="add" title="添加一行">
<i class="layui-icon layui-icon-add-1"></i> 添加一行
</button>
</div>
</@shiro.hasPermission>
</div>
</script>
<!--行操作模板-->
<script type="text/html" id="js-record-table-toolbar-right">
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete"><i class="layui-icon layui-icon-delete"></i>删除</a>
</script>
<script>
layui.use(['form', 'util', 'layer', 'step', 'spLayer', 'spTable', 'table'], function () {
var form = layui.form,
spLayer = layui.spLayer,
layer = layui.layer,
spTable = layui.spTable,
table = layui.table,
step = layui.step;
//分步表单绘制
step.render({
elem: '#stepForm',
filter: 'stepForm',
width: '100%', //设置容器宽度
stepWidth: '700px',
height: '500px',
scrollbar:true,
stepItems: [{
title: 'BOM主信息'
}, {
title: 'BOM子项信息'
}]
});
form.on('submit(formStep)', function (data) {
step.next('#stepForm');
return false;
});
form.on('submit(formStep2)', function (data) {
step.next('#stepForm');
return false;
});
$('.pre').click(function () {
step.pre('#stepForm');
});
$('.next').click(function () {
step.next('#stepForm');
});
table = layui.table;
//监听提交
form.on('submit(js-submit-filter)', function (data) {
layer.alert("嘿嘿暂时无法保存开发loading....");
<#--spUtil.submitForm({-->
<#-- contentType: 'application/json;charset=UTF-8',-->
<#-- url: "${request.contextPath}/basedata/flow/process/add-or-update",-->
<#-- data: data.field-->
<#--});-->
spUtil.submitForm({
url: "${request.contextPath}/technology/bom/add-or-update",
data: data.field
});
return false;
});
var layTableId = "layTableId";
/**
* 表格绘制
*/
var tableIns = spTable.render({
page: true,
even: false, //不开启隔行背景
height: 'full-200',
elem: "#layTableId",
page: false,
cols: [[ //标题栏
{title: '序号', type: 'numbers'}
, {field: 'LocationID', title: '仓位编码', width: 158, edit: 'text', align: "center"}
, {field: 'InventoryQuantity', title: '拆分数量', edit: 'text', width: 158, align: "center"}
,{field: 'site', title: '位置', edit: 'text', width: 158, align: "center"}
, {
field: 'operate',
title: '操作',
toolbar: '#js-record-table-toolbar-right',
unresize: true,
width: 150
}
]],
data: [{"LocationID": "123", "InventoryQuantity": "0",site:"001"}]
});
/**
* 头工具栏事件
*/
table.on('toolbar(js-record-table-filter)', function (obj) {
// 添加一行可编辑数据
if (obj.event === 'add') {
var Data = table.cache[layTableId];
var datas = {}
Data.push(datas);
tableIns.reload({
data: Data
});
}
});
/**
* 监听行工具事件
@ -256,16 +151,16 @@
// 如果是搜索弹窗,需要添加回调函数来获取选中数据
spCallback: function (result) {
if (result.code === 0 && result.data.length > 0) {
$('#js-test-input').val(result.data[0].materiel);
console.log(result);
$('#js-materiel-code').val(result.data[0].materiel);
$('#js-materiel-name').val(result.data[0].materielDesc);
}
}
});
}
});
//版本号
function FN(btnType) {
var versionNumber = $('#js-versionNumber')

View File

@ -17,7 +17,7 @@
<div class="layui-inline">
<label class="layui-form-label">物料编号</label>
<div class="layui-input-inline">
<input type="text" name="nameLike" autocomplete="off" class="layui-input">
<input type="text" name="materielCodeLike" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
@ -70,9 +70,9 @@
}, {
field: 'materielCode', title: '物料编号'
}, {
field: 'versionNumber', title: '版本号'
field: 'materielDesc', title: '物料名称'
}, {
field: 'state', title: 'BOM状态'
field: 'versionNumber', title: '版本号'
}, {
field: 'factory', title: '所属工厂'
}, {
@ -138,8 +138,13 @@
}
// 添加
if (obj.event === 'add') {
var index = spLayer.open({
title: '添加',
area: ['70%', '90%'],
content: '${request.contextPath}/technology/bom/add-or-update-ui'
});
//新开一个TAB标签 url 标题名称 图标
spLayui.createTableItem('/technology/bom/add-or-update-ui?mpi=bom-1','BOM信息','fa fa-dropbox');
//spLayui.createTableItem('/technology/bom/add-or-update-ui?mpi=bom-1','BOM信息','fa fa-dropbox');
}
});
@ -164,7 +169,7 @@
if (obj.event === 'delete') {
layer.confirm('确认要删除吗?', function (index) {
spUtil.ajax({
url: '${request.contextPath}/basedata/materile/delete',
url: '${request.contextPath}/technology/bom/delete',
async: false,
type: 'POST',
// 是否显示 loading

View File

@ -102,7 +102,6 @@
//监听提交
form.on('submit(js-submit-filter)', function (data) {
data.field.spOperVoList = requestParmaArr;
spUtil.submitForm({
contentType: 'application/json;charset=UTF-8',
url: "${request.contextPath}/basedata/flow/process/add-or-update",