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

538 lines
21 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">
<input name="workOrderNo" class="form-control" type="text" onclick="chooseWorkOrder()">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">领料单号:</label>
<div class="col-sm-8">
<input name="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" 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="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">-->
<!-- <input name="outputClass" 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="CPItemCode" 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">
<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">-->
<!-- <select name="deptNo" 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="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>
</form>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrapTableBody">
</table>
</div>
<div class="modal inmodal" id="workModal" tabindex="-1"
role="dilog" aria-hidden="true" style="padding-bottom: 100px;">
<div class="modal-dialog" style="width: 800px">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true"></button>
<h4 class="modal-title">选择制工单</h4>
</div>
<div class="modal-body" style="text-align: center;">
<div class="row">
<div class="col-md-5">
<form id="saleOrderForm" class="form-group">
<label class="control-label col-md-4">制工单号:</label>
<div class="col-md-8">
<input type="text" class="form-control" name="poId"
id="poId">
</div>
</form>
</div>
<div class="col-md-2">
<button type="button" class="btn btn-success" id="poIdSearch">搜索</button>
</div>
<div class="col-md-2">
<button type="button" class="btn btn-success" id="reset" onclick="reset()">重置</button>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table id="workOrderTable"
class="table table-striped table-responsive" style="padding-bottom: 50px;">
</table>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary"
onClick="confirm();">确定
</button>
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<!-- <button type="button" class="btn btn-default" onclick="closeModal()">关闭</button>-->
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</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"
$("#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 + "/workOrder",
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("出错了!");
}
});
}
//待提交表格
$('#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: '计划数量'
},
{
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: '应退数量'
},
{
field: 'remark',
title: '备注'
},
{
field: 'itemClass',
title: '物料类别',
visible: false
}
]
});
//弹层制工单列表
$('#workOrderTable').bootstrapTable({
url: ctx + "produce/workorderhead/list",
method: 'post',
striped: true, // 是否显示行间隔色
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
pagination: true, // 是否显示分页(*)
contentType: "application/x-www-form-urlencoded",
queryParams: function (params) {
let curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1
// searchValue: params.search,
// orderByColumn: params.sort,
// isAsc: params.order
};
let poId = $("#poId").val();
//alert(wlCode);
let json = $.extend(curParams, {"poId": poId});
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: 'workNo',
title: '制工单号',
},
{
field: 'cpCode',
title: '成品代码',
},
{
field: 'cpName',
title: '成品名称',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "80px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "100px",
"white-space": "nowrap"
}
}
}
}
]
});
function submitHandler() {
submit();
}
//点击选择制工单
function confirm() {
let row = $("#workOrderTable").bootstrapTable("getSelections");
//alert(JSON.stringify(row));
if (row.length !== 0) {
$("input[name='workOrderNo']").val(row[0].workNo);
$("input[name='CPItemCode']").val(row[0].cpCode);
$("select[name='outputClass']").val("1").select2();
$.ajax({
url:ctx+"produce/list/getList",
type:"post",
dataType:"json",
success: function (resp) {
if (resp.code === 0) {
let list = resp.data;
let count = $('#bootstrapTableBody').bootstrapTable('getData').length;
for (let i in list) {
$("#bootstrapTableBody").bootstrapTable('insertRow', {
index: count + i,
row: {
itemCode: list[i].wlCode,
itemName: list[i].itemname,
itemSpecification: list[i].itemstandard,
unit: list[i].stockDw,
planQty: list[i].qty,
realQty: list[i].orderQty,
returnQty: list[i].returnQty,
remark: list[i].MemoList,
}
});
}
} else {
$.modal.msgError(resp.msg);
}
},
error: function () {
$.modal.msgError("后台出错啦!");
}
})
reset();
}
$("#workModal").modal("hide");
}
//获取部门编号和名称
$.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);
//获取出库单号
$.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 chooseWorkOrder(){
$("#workModal").modal("show");
}
//重置
function reset() {
$("#poId").val("");
$("#workOrderTable").bootstrapTable("refresh");
}
//搜索销售列表
$("#poIdSearch").on("click", function () {
$("#workOrderTable").bootstrapTable("refresh");
})
</script>
</body>
</html>