万材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.
 
 
 
 

643 lines
23 KiB

<!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">-->
<div class="container-div">
<div class="row">
<div class="col-sm-12">
</div>
<form class="form-horizontal m" id="form-poinvoicehead-add">
<div class="form-group">
<label class="col-sm-3 control-label">出库单号:</label>
<div class="col-sm-8">
<input name="warehousingOutNo" 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="outputClass" class="form-control m-b" th:with="type=${@dict.getType('sys_out_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">
<div class="input-group date">
<input name="warehousingOutDate" class="form-control time-input" 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">
<input name="warehouseKeeper" 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="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">
<select name="deptName" class="form-control m-b">
</select>
</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>
</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">
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="spare3" class="form-control" type="text">
</div>
</div>
</form>
<div class="col-sm-12">
<label>物料代码:</label>
<input type="text" id="itemNo" class="form-control" placeholder="请输入物料代码"
style="margin-bottom: 15px">
<button type="button" class="btn btn-success" id="bomTableSearch">搜索</button>
<button type="button" class="btn btn-success" onclick="bomTableReset()">重置</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="addBom()">确定
</button>
</div>
<div class="col-sm-12 select-table table-striped" style="padding-bottom: 100px;">
<table id="bootstrapTableBody"></table>
</div>
</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">
let prefix = ctx + "stock/warehousingOutHead"
var warehousingTypeDatas = [[${@dict.getType('dock_warehousing_purchase_type')}]];
var domesticOrExportDatas = [[${@dict.getType('sys_NWX_class')}]];
$("#form-poinvoicehead-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-poinvoicehead-add').serialize());
}
}
//鼠标移入,显示完整的数据
function paramsMatter(value, row, index) {
var span = document.createElement("span");
span.setAttribute("title", value);
span.innerHTML = value;
return span.outerHTML;
}
//提交
function submit() {
let bootstrapTable = $("#bootstrapTableBody").bootstrapTable("getData", true);
let formData = new FormData($("#form-poinvoicehead-add")[0]);
formData.append("warehousingOutLists", JSON.stringify(bootstrapTable));
let data = {};
formData.forEach((value, key) => data[key] = value);
//alert(JSON.stringify(data1));
$.ajax({
url: prefix + "/scrapItem",
type: "post",
resultType: "json",
data: {"jsonStr": JSON.stringify(data)},
success: function (resp) {
if (resp.code === 0) {
alert("添加成功!");
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("出错了!");
}
});
}
//选择入库记录列表
$('#bootstrap-table').bootstrapTable({
url: ctx + "stock/record/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 itemNo = $("#itemNo").val();
//alert(wlCode);
var json = $.extend(curParams, {"itemNo": itemNo});
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,
uniqueId: 'warehousingrecordNo',
height: 350,
columns: [{
checkbox: true
},
{
field: 'warehousingrecordNo',
title: '入库记录单号'
},
{
field: 'customerId',
title: '客户号',
visible: false
},
{
field: 'customerName',
title: '客户名称',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter,
visible: false
},
{
field: 'warehousingType',
title: '入库类型',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: function (value, row, index) {
// return $.table.selectDictLabel(warehousingTypeDatas, value);
var s = $.table.selectDictLabel(warehousingTypeDatas, value);
var span = document.createElement("span");
span.setAttribute("title", s);
span.innerHTML = s;
return span.outerHTML;
}
},
{
field: 'warehousingrecordDate',
title: '入库日期',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter,
visible: false
},
{
field: 'purchaseorderNo',
title: '采购订单号',
visible: false
},
{
field: 'workorderNo',
title: '制工单号',
visible: false
},
{
field: 'domesticOrExport',
title: '内外销',
formatter: function (value, row, index) {
return $.table.selectDictLabel(domesticOrExportDatas, value);
}
},
{
field: 'warehouseNo',
title: '仓库号'
},
{
field: 'warehouseName',
title: '仓库名称',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'warehousingAmt',
title: '入库数量'
},
{
field: 'itemNo',
title: '物料代码',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'itemName',
title: '物料名称',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'itemTimes',
title: '项次',
visible: false
},
{
field: 'specificationModel',
title: '规格型号',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'machineType',
title: '机种',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "130px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter,
visible: false
},
{
field: 'unit',
title: '单位',
visible: false
},
{
field: 'spell1',
title: '是否对账',
visible: false
},
{
field: 'spell2',
title: '批次',
visible: false
},
{
field: 'spell3',
title: '是否撤销',
visible: false
},
{
field: 'surplusQty',
title: '剩余数量',
},
]
});
//待提交表格
$('#bootstrapTableBody').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,
columns: [{
checkbox: false
},
{
field: 'itemCode',
title: '物料代码'
},
{
field: 'itemName',
title: '物料名称'
},
{
field: 'itemSpecification',
title: '物料规格'
},
{
field: 'unit',
title: '单位'
},
{
field: 'planQty',
title: '计划数量',
visible: false
},
{
field: 'realQty',
title: '实际数量',
editable: {
type: 'text',
title: '数量',
emptytext: "0",
validate: function (value) {
if (parseInt(value) < 0) {
return '数量不能小于0!';
}
if (isNaN(value)) {
return '数量必须是数字!';
}
let findQty = 0;
$.ajax({
url: ctx + "stock/warehouse/code",
type: "post",
dataType: "json",
success: function (resp) {
if (resp.code === 0) {
let data = resp.data;
findQty = data.qty;
} else {
$.modal.msgError(resp.msg);
}
},
error: function () {
$.modal.msgError("后台出错啦!");
}
})
//alert(findQty);
if (parseInt(value) > findQty) {
return '该料库存不足!';
}
}
}
},
{
field: 'returnQty',
title: '应退数量',
visible: false
},
{
field: 'remark',
title: '备注',
editable: {
type: 'text',
title: '说明',
emptytext: ""
}
},
{
field: 'itemClass',
title: '物料类别',
visible: false
},
{
field: 'spare1',
title: '入库单号'
}
]
});
function submitHandler() {
submit();
}
//获取部门编号和名称
$.ajax({
url: ctx + "system/dept/list",
type: "post",
dataType: "json",
success: function (resp) {
//let list = resp.data;
//alert(JSON.stringify(resp));
for (let i in resp) {
$("select[name='deptName']").append("<option value='" + resp[i].deptName + "'>" + resp[i].deptName + "</option>");
// $("select[name='deptNo']").append("<option value='" + resp[i].deptId + "'>" + resp[i].deptId + "</option>");
}
},
error: function () {
$.modal.msgError("后台出错啦!");
}
})
//获取仓库名
$.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>");
}
} 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("出错了!");
}
})
})
//获取今天日期
let today = new Date();
today.setTime(today.getTime());
let time = today.getFullYear() + "-" + (today.getMonth() + 1) + "-" + today.getDate();
$("input[name='warehousingOutDate']").val(time);
//获取登录人
let userName = [[${@permission.getPrincipalProperty('userName')}]];
$("input[name='warehouseKeeper']").val(userName);
$("input[name='spare2']").val(userName);
//获取出库单号
$.ajax({
url: prefix + "/no",
type: "post",
dataType: "json",
success: function (resp) {
if (resp.code === 0) {
$("input[name='warehousingOutNo']").val(resp.data);
} else {
$.modal.msgError(resp.msg);
}
},
error: function () {
$.modal.msgError("后台出错啦!");
}
})
//入库表格重置
function bomTableReset() {
$("#itemNo").val("");
$("#bootstrap-table").bootstrapTable("refresh");
}
//搜索销售列表
$("#bomTableSearch").on("click", function () {
$("#bootstrap-table").bootstrapTable("refresh");
})
//将选中的入库记录引入表格
function addBom() {
let row = $("#bootstrap-table").bootstrapTable("getSelections");
let count = $('#bootstrapTableBody').bootstrapTable('getData').length;
for (let i = 0; i < row.length; i++) {
let bootstrapTable = $("#bootstrapTableBody").bootstrapTable("getRowByUniqueId", row[i].zpGuige);
//alert(bootstrapTable);
if (bootstrapTable != null) {
alert("入库单号" + bootstrapTable.zpGuige + "已存在!");
continue;
}
$("#bootstrapTableBody").bootstrapTable('insertRow', {
index: count + i,
row: {
itemCode: row[i].itemNo,
itemName: row[i].itemName,
itemSpecification: row[i].specificationModel,
unit: row[i].unit,
realQty: 0,
spare1: row[i].warehousingrecordNo
}
});
}
bomTableReset();
}
</script>
</body>
</html>