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

917 lines
34 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="container-div">
<div class="row">
<div class="col-sm-12">
</div>
<form class="form-horizontal m" id="form-head-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">退库单号:</label>
<div class="col-sm-8">
<input name="cancelStockNo" class="form-control" type="text" required readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">工单号:</label>
<div class="col-sm-8">
<input name="workOrderNo" class="form-control" type="text" required>
</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" th:with="type=${@dict.getType('sys_dept_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="cancelStockMan" 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="stockNo" 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="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="warehouseKeeper" 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="cancelStockType" class="form-control m-b"
th:with="type=${@dict.getType('dock_warehousing_purchase_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="cancelStockDate" 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">
<textarea name="remark" class="form-control"></textarea>
</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">-->
<!-- <input name="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" 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" 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" 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="modal inmodal" id="workOrderModal" tabindex="-1"
role="dilog" aria-hidden="true">
<div class="modal-dialog" style="width: 800px;height: 600px;">
<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" style="margin-bottom: 20px;">
<div class="col-md-5">
<form id="workOrderForm">
<div class="form-group">
<label class="control-label col-md-4">制工单号:</label>
<div class="col-md-8">
<input type="text" class="form-control"
id="poId">
</div>
</div>
</form>
</div>
<div class="col-md-2">
<button type="button" class="btn btn-success" id="poIdSearch">搜索</button>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table id="workOrderTable"
class="table table-striped table-responsive">
</table>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary"
onClick="selectWorkOrder();">选择
</button>
<button type="button" class="btn btn-default" data-dismiss="modal" name="close">关闭</button>
</div>
</div>
</div>
</div>
</div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:src="@{/ajax/libs/select2/select2.js}"></script>
<th:block th:include="include :: bootstrap-table-editable-js"/>
<script th:inline="javascript">
var prefix = ctx + "produce/head"
$("#form-head-add").validate({
focusCleanup: true
});
//鼠标移入,显示完整的数据
function paramsMatter(value, row, index) {
var span = document.createElement("span");
span.setAttribute("title", value);
span.innerHTML = value;
return span.outerHTML;
}
$("input[name='workOrderNo']").on("click", function () {
$("#workOrderModal").modal("show");
})
function submitHandler() {
// if ($.validate.form()) {
// $.operate.save(prefix + "/add", $('#form-head-add').serialize());
// }
submit();
}
let today = new Date();
today.setTime(today.getTime());
let time = today.getFullYear() + "-" + (today.getMonth() + 1) + "-" + today.getDate();
$("input[name='cancelStockDate']").val(time);
//获取单号
$.ajax({
url: prefix + "/id",
type: "post",
dateType: "json",
success: function (resp) {
if (resp.code === 0) {
$("input[name='cancelStockNo']").val(resp.data);
} else {
$.modal.msgError("失败啦");
}
},
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>");
}
} else {
$.modal.msgError(resp.msg);
}
},
error: function () {
$.modal.msgError("后台出错啦!");
}
})
//全部库存
$('#bootstrap-table').bootstrapTable({
url: ctx + "ck/itemCP/itemList",
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: '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: '机种'
},
{
field: 'stockDw',
title: '单位'
},
{
field: 'pWldm',
title: '客户料号'
},
{
field: 'itemClass',
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',
// onEditableSave: function (field, row, oldValue, $el) {
// if (row.qty > 0 && row.price > 0) {
// row.totalPrice = row.qty * row.price;
// }
// },
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: 'unit',
title: '单位'
},
{
field: 'qty',
title: '退回数量',
editable: {
type: 'text',
title: '数量',
emptytext: "0",
validate: function (value) {
if (parseInt(value) < 0) {
return '数量不能小于0!';
}
if (isNaN(value)) {
return '数量必须是数字!';
}
}
}
},
{
field: 'remark',
title: '备注',
editable: {
type: 'text',
title: '说明',
emptytext: ""
}
},
{
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,
qty: 0
}
});
}
itemTableReset();
}
function remove(itemCode) {
$("#selectItemTable").bootstrapTable("remove", {
field: 'itemCode',
values: itemCode
});
}
//提交
function submit() {
let bootstrapTable = $("#selectItemTable").bootstrapTable("getData", true);
let formData = new FormData($("#form-head-add")[0]);
formData.append("cancelStockLists", JSON.stringify(bootstrapTable));
let data1 = {};
formData.forEach((value, key) => data1[key] = value);
//alert(JSON.stringify(data1));
$.ajax({
url: prefix + "/add",
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("出错了!");
}
});
}
//选择制工单列表
$('#workOrderTable').bootstrapTable({
url: '/produce/workorderhead/list',
pagination: true,
pageNumber: 1,
pageSize: 10,
pageList: [10, 25, 50, 100],
showRefresh: true,
method: "post",
contentType: "application/x-www-form-urlencoded",
striped: true, // 是否显示行间隔色
cache: false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
sidePagination: "server", // 分页方式:client客户端分页,server服务端分页(*)
clickToSelect: true, // 是否启用点击选中行
showToggle: false, // 是否显示详细视图和列表视图的切换按钮
cardView: false, // 是否显示详细视图
detailView: false, // 是否显示父子表
smartDisplay: false, // 加了这个才显示每页显示的行数
showExport: false, // 是否显示导出按钮
singleSelect: true,
height: 400,
queryParams: function (params) {
//console.log("123");
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
searchValue: params.search,
orderByColumn: params.sort,
isAsc: params.order
};
//console.log(curParams);
var json = $.extend(curParams, $.common.formToJSON("workOrderForm"));
//console.log(json);
return json;
},
columns: [
{
checkbox: true
},
{
field: 'poId',
title: '工单号',
visible: false
},
{
field: 'poNo',
title: '订单号'
},
{
field: 'workNo',
title: '工单号'
},
{
field: 'piNo',
title: '',
visible: false
},
{
field: 'pCode',
title: '客户代码',
visible: false
},
{
field: 'pName',
title: '公司名称',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "60px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "80px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'cpCode',
title: '成品代码'
},
{
field: 'cpQty',
title: '订单数量'
},
{
field: 'ylCpQty',
title: '投单数量'
},
{
field: 'cpInQty',
title: '完工入库数量'
},
{
field: 'qdQty',
title: '欠工单数量'
},
{
field: 'poDate',
title: '开单日期',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "80px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "100px",
"white-space": "nowrap"
}
}
},
},
{
field: 'beginDate',
title: '开工日期',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "80px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "100px",
"white-space": "nowrap"
}
}
},
},
{
field: 'endDate',
title: '完工日期',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "80px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "100px",
"white-space": "nowrap"
}
}
},
},
{
field: 'sendDate',
title: '发货日期',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "80px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "100px",
"white-space": "nowrap"
}
}
},
},
{
field: 'workorderClass',
title: '工单类型',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "60px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "80px",
"white-space": "nowrap"
}
}
},
},
{
field: 'cpName',
title: '成品名称',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "60px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'cpType',
title: '规格型号',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "60px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
formatter: paramsMatter
},
{
field: 'cpMachineno',
title: '机种',
cellStyle: function (value, row, index) {
return {
css: {
"min-width": "60px",
"text-overflow": "ellipsis",
"overflow": "hidden",
"max-width": "150px",
"white-space": "nowrap"
}
}
},
},
{
field: 'cpDw',
title: '单位'
},
{
field: 'bzMemo',
title: '备注'
},
{
field: 'endFlag',
title: '是否结案',
formatter: function (value, index, row) {
if (value == 1) {
return "是";
} else {
return "否";
}
}
},
{
field: 'chinaInOrOut',
title: '',
visible: false
},
{
field: 'isDelete',
title: '',
visible: false
},
{
field: 'cpwldm',
title: '成品料号',
visible: false
},
{
field: 'nowcpstockqty',
title: '',
visible: false
},
{
field: 'NWX',
title: '',
visible: false
},
{
field: 'haveprint',
title: '',
visible: false
},
{
field: 'bomVersionNo',
title: '版本号',
visible: false
},
{
field: 'badQty',
title: '',
visible: false
},
{
field: 'jaMan',
title: '',
visible: false
},
{
field: 'jaTime',
title: '',
visible: false
},
{
field: 'department',
title: '',
visible: false
},
{
field: 'cpWeizhi',
title: '',
visible: false
},
{
field: 'mjWeizhi',
title: '',
visible: false
},
{
field: 'versionNo',
title: '版本号',
visible: false
},
{
field: 'Factory',
title: '',
visible: false
},
{
field: 'madeQty',
title: '制造数量',
visible: false
},
{
field: 'qMadeQty',
title: '损耗',
visible: false
}
]
});
//搜索制工单列表
$("#poIdSearch").on("click", function () {
$("#workOrderTable").bootstrapTable('refresh');
$("#poId").val("");
})
//选择制工单
function selectWorkOrder() {
let row = $("#workOrderTable").bootstrapTable("getSelections");
$("#workOrderModal").modal("hide");
$("input[name='workOrderNo']").val(row[0].workNo);
}
</script>
</body>
</html>