万材erp项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

671 lines
28 KiB

2 years ago
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改盘底')" />
<th:block th:include="include :: datetimepicker-css" />
<link th:href="@{/ajax/libs/select2/select2.css}" rel="stylesheet">
<link th:href="@{/ajax/libs/select2/select2-bootstrap.css}" rel="stylesheet">
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-checkHead-edit" th:object="${checkHead}">
<!-- <input name="checkId" th:field="*{checkId}" readonly>-->
<div class="form-group">
<label class="col-sm-3 control-label">盘底单号:</label>
<div class="col-sm-8">
<input name="checkId" th:field="*{checkId}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">盘底人:</label>
<div class="col-sm-8">
<input name="checkMan" th:field="*{checkMan}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">仓库号:</label>
<div class="col-sm-8">
<select name="stockNo" class="form-control m-b" disabled>
<option value="">所有</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">仓库名称:</label>
<div class="col-sm-8">
<select name="stockName" class="form-control m-b">
<option value="">所有</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">盘底日期:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="checkDate" th:value="${#dates.format(checkHead.checkDate, 'yyyy-MM-dd')}" class="form-control time-input" placeholder="yyyy-MM-dd" type="text" disabled>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<!-- <div class="form-group"> -->
<!-- <label class="col-sm-3 control-label">取消否:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <select name="cancelFlag" class="form-control m-b">-->
<!-- <option value="">所有</option>-->
<!-- </select>-->
<!-- <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group"> -->
<!-- <label class="col-sm-3 control-label">结束否:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <select name="endFlag" class="form-control m-b">-->
<!-- <option value="">所有</option>-->
<!-- </select>-->
<!-- <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group"> -->
<!-- <label class="col-sm-3 control-label">结束日期:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <div class="input-group date">-->
<!-- <input name="endDate" th:value="${#dates.format(checkHead.endDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">-->
<!-- <span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group"> -->
<!-- <label class="col-sm-3 control-label">确认否:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <select name="comfirmFlag" class="form-control m-b">-->
<!-- <option value="">所有</option>-->
<!-- </select>-->
<!-- <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label">物料类别:</label>
<div class="col-sm-8">
<select name="itemClass" class="form-control m-b" th:with="type=${@dict.getType('ck_meterialt_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="remark" th:field="*{remark}" 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="spare1" th:field="*{spare1}" 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="spare2" th:field="*{spare2}" 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="spare3" th:field="*{spare3}" 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="spare4" th:field="*{spare4}" 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="spare5" th:field="*{spare5}" 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="spare6" th:field="*{spare6}" class="form-control" type="text">-->
<!-- </div>-->
<!-- </div>-->
</form>
<div class="col-sm-12">
<label>物料代码:</label>
<input type="text" name="wlCode" id="wlCode" class="form-control" placeholder="请输入物料代码"
style="margin-bottom: 15px">
<button type="button" class="btn btn-success" id="itemTableSearch">搜索</button>
<button type="button" class="btn btn-success" onclick="itemTableReset()">重置</button>
<div class="col-sm-12 select-table table-striped" style="padding-bottom: 100px;">
<table id="bootstrap-table"></table>
</div>
</div>
<div class="col-sm-12" style="text-align: center">
<button type="button" class="btn btn-success" style="margin-top: 20px"
onclick="addItem()">确定
</button>
</div>
<div class="col-sm-12 select-table table-striped" style="padding-bottom: 100px;">
<table id="selectItemTable"></table>
<!-- <button type="button" onclick="commit()" class="btn btn-primary"-->
<!-- style="margin-top: 30px;margin-left: 620px;">提交-->
<!-- </button>-->
<!-- <button onclick="close()" class="btn btn-danger" type="button" style="margin-top: 30px;margin-left: 200px">-->
<!-- 关闭-->
<!-- </button>-->
</div>
<div class="col-sm-12 col-sm-offset-3">
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-table-editable-js"/>
<script th:src="@{/ajax/libs/select2/select2.js}"></script>
<script th:inline="javascript">
var prefix = ctx + "stock/checkHead";
var warehousingTypeDatas = [[${@dict.getType('dock_warehousing_purchase_type')}]];
$("#form-checkHead-edit").validate({
focusCleanup: true
});
let getData = [[${checkHead}]];
$("select[name='itemClass']").val(getData.itemClass).trigger("change");
function submitHandler() {
// if ($.validate.form()) {
// $.operate.save(prefix + "/edit", $('#form-checkHead-edit').serialize());
// }
submit();
}
//鼠标移入,显示完整的数据
function paramsMatter(value, row, index) {
var span = document.createElement("span");
span.setAttribute("title", value);
span.innerHTML = value;
return span.outerHTML;
}
//获取登陆人名称
let userName = [[${@permission.getPrincipalProperty('userName')}]];
$("input[name='checkMan']").val(userName);
//获取仓库名
$.ajax({
url: ctx + "stock/stockInfo/all",
type: "post",
dataType: "json",
success: function (resp) {
if (resp.code === 0) {
let data = resp.data;
//alert(JSON.stringify(data));
for (let i in data) {
$("select[name='stockName']").append("<option value='" + data[i].stockname + "'>" + data[i].stockname + "</option>");
$("select[name='stockNo']").append("<option value='" + data[i].stockNO + "'>" + data[i].stockNO + "</option>");
}
$("select[name='stockName']").val(getData.stockName).trigger("change");
} else {
$.modal.msgError(resp.msg);
}
},
error: function () {
$.modal.msgError("后台出错啦!");
}
})
//修改仓库名时 改变仓库号
$("select[name='stockName']").change(function () {
let stockName = $(this).val();
$.ajax({
url: ctx + "stock/stockInfo/all",
data: {"Stockname": stockName},
type: "post",
resultType: "json",
success: function (resp) {
if (resp.code === 0) {
let stockList = resp.data;
//alert(JSON.stringify(stockList));
$("select[name='stockNo']").val(stockList[0].stockNO).trigger("change");
} else {
$.modal.msgError(resp.msg);
}
},
error: function () {
$.modal.msgError("出错了!");
}
})
})
//全部库存
$('#bootstrap-table').bootstrapTable({
url: ctx + "stock/warehouse/list",
method: 'post',
striped: true, // 是否显示行间隔色
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
pagination: true, // 是否显示分页(*)
contentType: "application/x-www-form-urlencoded",
queryParams: function (params) {
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1
// searchValue: params.search,
// orderByColumn: params.sort,
// isAsc: params.order
};
var wlCode = $("#wlCode").val();
//alert(wlCode);
var json = $.extend(curParams, {"wlCode": wlCode});
return json;
},
sidePagination: "server", // 分页方式:client客户端分页,server服务端分页(*)
pageNumber: 1, // 初始化加载第一页,默认第一页
pageSize: 5, // 每页的记录行数(*)
pageList: [5, 10, 50], // 可供选择的每页的行数(*)
clickToSelect: true, // 是否启用点击选中行
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
cardView: false, // 是否显示详细视图
detailView: false, // 是否显示父子表
smartDisplay: false, // 加了这个才显示每页显示的行数
showExport: false, // 是否显示导出按钮
// singleSelect : true,
height: 350,
columns: [{
checkbox: true
},
{
field: 'id',
title: '编号',
visible: false
},
{
field: 'wlCode',
title: '物料代码',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "80px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "100px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'itemName',
title: '物料名称',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "80px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "100px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'itemStandard',
title: '规格',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "80px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "100px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'machineNo',
title: '机种',
visible: false
},
{
field: 'stockDw',
title: '单位'
},
{
field: 'qty',
title: '数量'
},
{
field: 'warehouseName',
title: '仓库名称',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "80px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "100px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'warehouseNo',
title: '仓库号'
},
{
field: 'depositPosition',
title: '存放位置'
},
{
field: 'inClass',
title: '物料类别',
formatter: function (value, row, index) {
return $.table.selectDictLabel(warehousingTypeDatas, value);
},
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "80px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "100px",
"white-space": "nowrap"
}
}
},
},
{
field: 'spare1',
title: '',
visible: false
},
{
field: 'spare2',
title: '',
visible: false
},
{
field: 'spare3',
title: '',
visible: false
},
{
field: 'spare4',
title: '',
visible: false
},
{
field: 'spare5',
title: '',
visible: false
},
{
field: 'spare6',
title: '',
visible: false
},
{
field: 'wlType',
title: '物料种类',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "80px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "100px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'batchNumber',
title: '批号'
},
]
});
//准备提交的item
$('#selectItemTable').bootstrapTable({
striped: true, // 是否显示行间隔色
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
// contentType :"application/x-www-form-urlencoded",
// pageNumber : 1, // 初始化加载第一页,默认第一页
// pageSize : 10, // 每页的记录行数(*)
// pageList : [ 5, 10,50], // 可供选择的每页的行数(*)
// clickToSelect : true, // 是否启用点击选中行
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
cardView: false, // 是否显示详细视图
detailView: false, // 是否显示父子表
smartDisplay: false, // 加了这个才显示每页显示的行数
showExport: false, // 是否显示导出按钮
singleSelect: true,
height: 400,
uniqueId: 'itemCode',
columns: [{
checkbox: false
},
{
field: 'itemCode',
title: '物料代码',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "80px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "100px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'itemName',
title: '物料名称',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "80px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "100px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'itemSpecification',
title: '规格',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "80px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "100px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'machineType',
title: '机种',
visible: false
},
{
field: 'unit',
title: '单位'
},
{
field: 'checkQty',
title: '盘底数量',
editable: {
type: 'text',
title: '数量',
emptytext: "0",
validate: function (value) {
if (parseInt(value) < 0) {
return '数量不能小于0!';
}
if (isNaN(value)) {
return '数量必须是数字!';
}
}
}
},
{
field: 'nowQty',
title: '当前库存数量'
},
{
field: 'remark',
title: '备注',
editable: {
type: 'text',
title: '说明',
emptytext: ""
}
},
{
field: 'spare1',
title: '存放位置'
},
{
field: 'batchNumber',
title: '批号',
}, {
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs ' + '" href="javascript:void(0)" onclick="remove(\'' + row.itemCode + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}
]
});
//item表格重置
function itemTableReset() {
$("input[name='wlCode']").val("");
$("#bootstrap-table").bootstrapTable("refresh");
}
//搜索item表格
$("#itemTableSearch").on("click", function () {
$("#bootstrap-table").bootstrapTable("refresh");
})
//将选中的bom引入待确认bom表格
function addItem() {
let row = $("#bootstrap-table").bootstrapTable("getSelections");
let count = $('#selectItemTable').bootstrapTable('getData').length;
for (let i = 0; i < row.length; i++) {
let bootstrapTable = $("#selectItemTable").bootstrapTable("getRowByUniqueId", row[i].wlCode);
//alert(bootstrapTable);
if (bootstrapTable != null) {
alert("物料代码" + row[i].wlCode + "已存在!");
continue;
}
$("#selectItemTable").bootstrapTable('insertRow', {
index: count + i,
row: {
itemCode: row[i].wlCode,
itemName: row[i].itemName,
itemSpecification: row[i].itemStandard,
unit: row[i].stockDw,
spare1: row[i].depositPosition,
batchNumber: row[i].batchNumber,
nowQty: row[i].qty,
checkQty: 0
}
});
}
itemTableReset();
}
function remove(itemCode) {
$("#selectItemTable").bootstrapTable("remove", {
field: 'itemCode',
values: itemCode
});
}
//获取采购单中的物料信息
let checkList = [[${checkList}]];
//console.log(buyorderList);
for (let i = 0; i < checkList.length; i++) {
//alert(buyorderList[i].wlCode);
let count2 = $('#selectItemTable').bootstrapTable('getData').length;
$("#selectItemTable").bootstrapTable('insertRow', {
index: count2 + i,
row: {
itemCode: checkList[i].itemCode,
itemName: checkList[i].itemName,
itemSpecification: checkList[i].itemSpecification,
unit: checkList[i].unit,
checkQty: checkList[i].checkQty,
nowQty: checkList[i].nowQty,
spare1: checkList[i].spare1,
batchNumber: checkList[i].batchNumber
}
});
}
//提交
function submit() {
let bootstrapTable = $("#selectItemTable").bootstrapTable("getData", true);
let formData = new FormData($("#form-checkHead-edit")[0]);
formData.append("checkLists", JSON.stringify(bootstrapTable));
let data1 = {};
formData.forEach((value, key) => data1[key] = value);
//alert(JSON.stringify(data1));
$.ajax({
url: prefix + "/edit",
type: "post",
resultType: "json",
data: {"jsonStr": JSON.stringify(data1)},
success: function (resp) {
if (resp.code === 0) {
alert("修改成功!");
// window.location.href = prefix;
var index = parent.layer.getFrameIndex(window.name);
var parent2 = window.parent;
parent2.$.table.refresh();
parent.layer.close(index);//关闭当前页
} else {
$.modal.msgError(resp.msg);
}
},
error: function () {
$.modal.msgError("出错了!");
}
});
}
</script>
</body>
</html>