/**
|
* 出库通知档
|
*/
|
var myColumns = [];
|
$(function () {
|
getColumns();
|
|
$('#test-table').bootstrapTable('destroy');
|
$('#test-table').bootstrapTable({
|
method: 'GET',
|
url: "work/waitPakOutList.action",
|
cache: false,
|
striped: true,
|
pagination: true, //在表格底部显示分页工具栏
|
pageSize: 10, //默认每页条数
|
pageNumber: 1, //默认分页
|
pageList: [5, 10, 20, 50, 100],//分页数
|
showColumns: true, //显示隐藏列
|
showRefresh: false, //显示刷新按钮
|
showExport: false,
|
toolbar: "#toolbar",
|
// singleSelect : true,
|
// clickToSelect: true, // 单击行即可以选中
|
search: false,//显示搜素表单
|
silent: true, //刷新事件必须设置
|
sidePagination: "server", //表示服务端请求
|
columns: //myColumns,
|
[{
|
checkbox: true,
|
formatter:function (value, row, index) {
|
if(row.ems_status === 1){//如果已经操作禁止选择
|
return { disabled : true,}
|
}else{
|
return { disabled : false,}
|
}
|
}
|
}, {
|
field: "lgnum",
|
title: "仓库号",
|
// class : 'col-md-2',
|
align: "center",
|
valign: "middle",
|
sortable: "true"
|
}, {
|
field: "tanum",
|
title: "转储编号",
|
align: "center",
|
valign: "middle",
|
}, {
|
field: "tapos",
|
title: "行项目",
|
align: "center",
|
valign: "middle",
|
}, {
|
field: "matnr",
|
title: "物料",
|
align: "left",
|
valign: "middle",
|
sortable: "true"
|
}, {
|
field: "maktx",
|
title: "物料描述",
|
align: "center",
|
valign: "middle",
|
sortable: "true"
|
}, {
|
field: "werks",
|
title: "工厂",
|
align: "center",
|
valign: "middle",
|
sortable: "true"//,
|
// visible : false
|
}, {
|
field: "vsolm",
|
title: "数量",
|
align: "center",
|
valign: "middle",
|
sortable: "true"
|
}, {
|
field: "meins",
|
title: "单位",
|
align: "center",
|
valign: "middle",
|
sortable: "true"
|
}, {
|
field: "vltyp",
|
title: "源发地类型",
|
align: "center",
|
valign: "middle",
|
sortable: "true"
|
}, {
|
field: "vlpla",
|
title: "源发地仓位",
|
align: "center",
|
valign: "middle",
|
sortable: "true"
|
}, {
|
field: "nltyp",
|
title: "目的地类型",
|
align: "center",
|
valign: "middle",
|
sortable: "true"
|
}, {
|
field: "nlpla",
|
title: "目的地仓位",
|
align: "center",
|
valign: "middle",
|
sortable: "true"
|
}, {
|
field: "bname",
|
title: "用户ID",
|
align: "center",
|
valign: "middle",
|
sortable: "true"
|
}, {
|
field: "memo",
|
title: "备注",
|
align: "center",
|
valign: "middle",
|
sortable: "true",
|
visible: true
|
}, {
|
field: "status",
|
title: "资料状态",
|
align: "center",
|
valign: "middle",
|
sortable: "true",
|
formatter: function (value, row, index) {
|
if (value == 'N') {
|
return '未处理';
|
} else if (value == 'Y') {
|
return '出库中';
|
} else if (value == 'X') {
|
return '任务异常';
|
}
|
}
|
}, {
|
field: "io_status",
|
title: "完成状态",
|
align: "center",
|
valign: "middle",
|
sortable: "true",
|
formatter: function (value, row, index) {
|
if (value == 'N') {
|
return '未完成';
|
} else if (value == 'Y') {
|
return '出库完成';
|
} else if (value == 'X') {
|
return '回报异常';
|
}
|
}
|
}, {
|
field: "ems_status",
|
title: "紧急状态",
|
align: "center",
|
valign: "middle",
|
sortable: "true",
|
formatter: function (value, row, index) {
|
if (value == 0) {
|
return '无';
|
} else if (value == 1) {
|
return '<span style="color: red">紧急</span>';
|
}
|
}
|
}, {
|
field: "modi_user",
|
title: "修改人员",
|
align: "center",
|
valign: "middle",
|
visible: false,
|
sortable: "true"
|
}, {
|
field: "modi_time",
|
title: "修改时间",
|
align: "center",
|
valign: "middle",
|
visible: false,
|
sortable: "true"
|
}, {
|
field: 'operate',
|
title: '操作',
|
class: 'col-md-2',
|
align: 'center',
|
valign: 'middle',
|
formatter: operateFormatter,
|
}],
|
queryParamsType: "undefined",
|
queryParams: function queryParams(params) { //设置查询参数
|
var param = {
|
pageNumber: params.pageNumber,
|
pageSize: params.pageSize,
|
matnr: $("#search_sheet_no").val(),
|
vlpla: $("#loc_no").val(),
|
maktx: $("#search_mat_no").val()
|
// searchText: params.searchText
|
};
|
return param;
|
},
|
formatLoadingMessage: function () {
|
return "请稍等,正在加载中...";
|
},
|
|
formatNoMatches: function () {
|
return '无符合条件的记录';
|
},
|
//注册加载子表的事件。注意下这里的三个参数!
|
onExpandRow: function (index, row, $detail) {
|
oInit.InitSubTable(index, row, $detail);
|
},
|
onCheck: function (row) {
|
// getNetACount();
|
// alert(row.menu_name);
|
}, onUncheck: function (row) {
|
// getNetACount();
|
// alert('取消选中');
|
}, onCheckAll: function () {
|
// getNetACount();
|
}, onUncheckAll: function () {
|
// getNetACount();
|
},
|
onClickRow: function (row, $element) {
|
$('.info').removeClass('info');
|
$($element).addClass('info');
|
// 联动勾选
|
if (row[0]) {
|
$("#test-table").bootstrapTable('uncheckBy', {field:"vlpla", values:[row.vlpla]});
|
} else {
|
$("#test-table").bootstrapTable('checkBy', {field:"vlpla", values:[row.vlpla]});
|
}
|
}
|
});
|
});
|
|
function operateFormatter(value, row, index) {
|
return [
|
// '<button type="button" style="display:'+updateEnable+'" class=" btn btn-info" onclick="overWaitPakOut(\''+row.lgnum+'\',\''+row.tanum+'\',\''+row.tapos+'\')">完成</button>',
|
' <button style="display:' + deleteEnable + '" class=" btn btn-danger" type="button" onclick="delWaitPakOut(\'' + row.lgnum + '\',\'' + row.tanum + '\',\'' + row.tapos + '\')">删除</button>'
|
].join('');
|
}
|
|
function getColumns() {
|
myColumns = [];
|
// 加载动态表格
|
$.ajax({
|
url: $("#PageContext").val() + "/matColumn.json",
|
type: 'get',
|
dataType: "json",
|
async: false,
|
success: function (returnValue) {
|
// 未查询到相应的列,展示默认列
|
if (returnValue.retCode == "0") {
|
//没查到列的时候把之前的列再给它
|
myColumns = $table.bootstrapTable('getOptions').columns[0];
|
} else {
|
// 异步获取要动态生成的列
|
myColumns.push({
|
checkbox: true,
|
align: "center",
|
valign: "middle"
|
});
|
myColumns.push({
|
title: '序',
|
field: '',
|
formatter: function (value, row, index) {
|
return index + 1;
|
}
|
});
|
myColumns.push({
|
field: "sheet_no",
|
title: "单号",
|
class: 'col-md-1',
|
align: "center",
|
valign: "middle",
|
sortable: "true"
|
});
|
myColumns.push({
|
field: "loc_no",
|
title: "库位",
|
align: "left",
|
valign: "middle"
|
});
|
myColumns.push({
|
field: "io_status",
|
title: "状态",
|
align: "left",
|
valign: "middle",
|
formatter: function (value, row, index) {
|
if (value == '1') {
|
return '准备中';
|
} else if (value == '2') {
|
return "<font color='blue'>出库中</font>";
|
} else if (value == '3') {
|
return "<font color='red'>完成</font>";
|
}
|
}
|
});
|
myColumns.push({
|
field: "ctns",
|
title: "优先级",
|
align: "left",
|
valign: "middle"
|
});
|
var arr = returnValue.data;
|
$.each(arr, function (i, item) {
|
// alert(item.ColumnCode);
|
// myColumns.push(item.ColumnCode);
|
myColumns.push({
|
"field": item.ColumnCode,
|
"title": item.ColumnName,
|
// "hide" : true,
|
"visible": item.visible,
|
"align": item.align,//'center',
|
"valign": item.valign//'middle'
|
});
|
});
|
}
|
// console.log(myColumns);
|
// alert(myColumns.toString());
|
// return myColumns;
|
}
|
});
|
}
|
|
/**
|
* 条件查询库位
|
* @returns
|
*/
|
function getByCon() {
|
// $("#test-table").bootstrapTable('refresh');
|
$("#test-table").bootstrapTable('refreshOptions', {pageNumber: 1}); //分页后重新搜索时,初始化页码为1
|
}
|
|
function formValidator() {
|
// $("#addForm").bootstrapValidator({
|
// message: 'This value is not valid',
|
// feedbackIcons: {
|
// valid: 'glyphicon glyphicon-ok',
|
// invalid: 'glyphicon glyphicon-remove',
|
// validating: 'glyphicon glyphicon-refresh'
|
// },
|
//
|
// fields:{
|
//// mat_no:{
|
//// message: '验证失败',
|
//// validators:{
|
//// notEmpty:{message:'不能为空'},
|
//// stringLength:{max:50,message:'字符长度不能超过50'}
|
//// }
|
//// },
|
//// qty: {
|
//// message: '验证失败',
|
//// validators:{
|
//// notEmpty:{message:'不能为空'},
|
//// numeric:{message:'只能输入数字'}
|
//// }
|
//// }
|
// }
|
// });
|
//
|
// $("#myform").bootstrapValidator({
|
// message: 'This value is not valid',
|
// feedbackIcons: {
|
// valid: 'glyphicon glyphicon-ok',
|
// invalid: 'glyphicon glyphicon-remove',
|
// validating: 'glyphicon glyphicon-refresh'
|
// },
|
//
|
// fields: {
|
// mat_no:{
|
// message: '验证失败',
|
// validators:{
|
// notEmpty:{message:'不能为空'},
|
// stringLength:{max:50,message:'字符长度不能超过50'}
|
// }
|
// },
|
// qty: {
|
// message: '验证失败',
|
// validators:{
|
// notEmpty:{message:'不能为空'},
|
// numeric:{message:'只能输入数字'},
|
// callback: {
|
// message: '修改数量必须大于已出库量',
|
// callback:function(value, validator,$field,options){
|
// var out_qty = $("#out_qty").val();
|
// return parseInt(out_qty) < parseInt(value);
|
// }
|
// }
|
// }
|
// }
|
// }
|
// });
|
}
|
|
//表单验证
|
$(function () {
|
formValidator();
|
});
|
|
//添加,打开模态框
|
function addWaitPakOut() {
|
// $("#addDlg").modal('show');
|
// $("#loc_detail").bootstrapTable('refreshOptions',{pageNumber:1});
|
}
|
|
//添加前验证是否唯一
|
function checkCode() {
|
var x = $("#mat_no_add").val();
|
if (x != "") {
|
$.ajax({
|
url: 'work/checkCodeOut.action',
|
dataType: 'json',
|
type: 'post',
|
data: {
|
did: $("#mat_no_add").val(),
|
loc_no: $("#loc_no_add").val()
|
},
|
success: function (data) {
|
$("#info").text(data.msg);
|
$("#mat_name_add").val(data.mat_name_add);
|
},
|
error: function () {
|
alert("请求失败");
|
}
|
});
|
} else {
|
return false;
|
}
|
};
|
|
//提交插入
|
function insertWaitPakOut() {
|
var msg = $("#info").text();
|
if (msg == "代号可用") {
|
if ($("#addForm").data('bootstrapValidator').validate().isValid()) {
|
$.ajax({
|
url: 'work/addWaitPakOut.action',
|
type: 'post',
|
dataType: 'json',
|
data: $("#addForm").serialize(),
|
success: function (info) {
|
if (info > 0) {
|
alert("添加成功");
|
} else {
|
alert("添加失败");
|
}
|
$("#test-table").bootstrapTable('refresh');
|
closedlg();
|
},
|
error: function () {
|
alert('请求失败');
|
}
|
});
|
} else {
|
return false;
|
}
|
} else {
|
alert("代号不可用");
|
}
|
}
|
|
/**
|
* 根据查询明细
|
* @returns
|
*/
|
//function getvalue(sheet_no,mat_no){
|
function getvalue(sheet_no, mat_no, out_qty) {
|
// if(out_qty>0){
|
// alert('已有出库数量,不能修改');
|
// return;
|
// }
|
$.ajax({
|
url: 'work/queryWaitPakOutById.action',
|
type: 'post',
|
dataType: 'json',
|
data: {sheet_no: sheet_no, mat_no: mat_no},
|
success: function (data) {
|
$("#sheet_no").val(data.sheet_no);
|
$("#mat_no").val(data.mat_no);
|
$("#mat_name").val(data.mat_name);
|
$("#qty").val(data.qty);
|
$("#out_qty").val(data.out_qty);
|
$("#memo").val(data.memo);
|
},
|
error: function () {
|
alert("请求失败");
|
}
|
});
|
$("#mydlg").modal("show");
|
}
|
|
//保存修改内容
|
function upWaitPakOut() {
|
if ($("#myform").data('bootstrapValidator').validate().isValid()) {
|
$.ajax({
|
url: 'work/upWaitPakOut.action',
|
type: 'post',
|
dataType: 'json',
|
data: $("#myform").serialize(),
|
success: function (data) {
|
if (data > 0) {
|
alert("修改成功");
|
} else {
|
alert("修改失败");
|
}
|
$("#test-table").bootstrapTable('refresh');
|
closedlg();
|
},
|
error: function () {
|
alert("请求失败");
|
}
|
});
|
} else {
|
return false;
|
}
|
}
|
|
/**
|
* 手工完结出库通知档,反馈ERP
|
* @returns
|
*/
|
function overWaitPakOut(lgnum, tanum, tapos) {
|
var msg = '仓库号:' + lgnum + '\n转储编号:' + tanum + '\n行项目:' + tapos;
|
if (confirm('确认完结该笔通知档?\n' + msg)) {
|
$.ajax({
|
url: 'work/overWaitPakOut.action',
|
type: 'post',
|
dataType: 'json',
|
data: {
|
lgnum: lgnum,
|
tanum: tanum,
|
tapos: tapos
|
},
|
success: function (data) {
|
if (data > 0) {
|
alert("完结成功");
|
} else {
|
alert("完结失败");
|
}
|
$("#test-table").bootstrapTable('refresh');
|
closedlg();
|
},
|
error: function () {
|
alert("请求失败");
|
}
|
});
|
} else {
|
return false;
|
}
|
}
|
|
//单个删除
|
function delWaitPakOut(lgnum, tanum, tapos) {
|
if (confirm('您确定要删除这条数据吗')) {
|
$.ajax({
|
url: 'work/delWaitPakOut.action',
|
type: 'post',
|
dataType: 'json',
|
data: {
|
lgnum: lgnum,
|
tanum: tanum,
|
tapos: tapos
|
},
|
success: function (data) {
|
if (data > 0) {
|
alert("删除成功");
|
} else {
|
alert("删除失败");
|
}
|
$("#test-table").bootstrapTable('refresh');
|
},
|
error: function () {
|
alert("请求失败");
|
}
|
});
|
}
|
}
|
|
//取消出库
|
function cancleRetreve() {
|
var idstr = [];
|
var matStr = [];
|
var locStr = [];
|
|
var flag = true;
|
//获取选中的行
|
var a = $('#test-table').bootstrapTable('getSelections');
|
if (a.length <= 0) {
|
alert('请选择待处理数据');
|
return;
|
}
|
if (confirm('确认取消出库?')) {
|
$.each(a, function (index) {
|
if (a[index].io_status != "1") {
|
flag = false;
|
}
|
idstr.push(a[index].sheet_no);
|
matStr.push(a[index].mat_no);
|
locStr.push(a[index].loc_no)
|
});
|
if (flag == false) {
|
alert('存在出库中数据,不能取消');
|
return;
|
}
|
$.ajax({
|
url: 'work/movePakOutToLog.action',
|
type: 'post',
|
dataType: 'json',
|
data: {ids: idstr, matStr: matStr, locStr: locStr},
|
traditional: true,
|
success: function (data) {
|
if (data > 0) {
|
alert("取消成功");
|
} else {
|
alert("取消失败");
|
}
|
$("#test-table").bootstrapTable('refresh');
|
},
|
error: function () {
|
alert("请求失败");
|
}
|
});
|
}
|
}
|
|
//关闭模态框
|
function closedlg() {
|
$("#mydlg").modal("hide");
|
$("#addDlg").modal("hide");
|
$("#info").text("");
|
$("#infos").text("");
|
|
$('#myform').data('bootstrapValidator', null);
|
$("#addForm").data('bootstrapValidator', null);
|
formValidator();
|
//$('#mydlg').data('bootstrapValidator').resetForm(true);
|
$("input[type=reset]").trigger("click");
|
}
|
|
//添加出库单
|
function addPakOutData() {
|
if ($("#sheet_no").val() == "") {
|
alert('请输入出库单号');
|
return;
|
}
|
var locstr = [];
|
//获取选中的行
|
var a = $('#loc_detail').bootstrapTable('getSelections');
|
if (a.length > 0) {
|
$.each(a, function (index) {
|
locstr.push(a[index].loc_no + ';' + a[index].mat_no);
|
});
|
|
if (confirm("确定添加到出库单?")) {
|
// console.log(idstr);
|
$.ajax({
|
url: 'work/addPakOutData.action',
|
dataType: 'json',
|
type: 'post',
|
traditional: true,
|
data: {
|
sheet_no: $("#sheet_no").val().trim(),
|
locstr: locstr
|
},
|
success: function (data) {
|
if (data.code == 0) {
|
alert("添加成功!" + data.msg);
|
$('#test-table').bootstrapTable('refresh');
|
} else {
|
alert("添加失败!" + data.msg);
|
}
|
},
|
error: function () {
|
alert("请求失败!");
|
}
|
});
|
} else {
|
return false;
|
}
|
} else {
|
alert("请至少选中一行数据");
|
}
|
}
|
|
//确认出库
|
function confirmRetrieve() {
|
if ($("#stn_no").val() == "") {
|
alert('请选择全板出库站');
|
return;
|
}
|
// if($("#stn_no1").val()==""){
|
// alert('请选择拣料站');
|
// return;
|
// }
|
var idstr = [];
|
var locstr = [];
|
// var flag = true;
|
//获取选中的行
|
var a = $('#test-table').bootstrapTable('getSelections');
|
if (a.length > 0) {
|
$.each(a, function (index) {
|
// if(a[index].retrieve_qty<=0){
|
// flag = false;
|
// return;
|
// }
|
var temp = [];
|
temp.push(a[index].loc_no);
|
temp.push(a[index].mat_no);
|
// temp.push(a[index].retrieve_qty);
|
var str = temp.join(';');
|
idstr.push(str);
|
|
// idstr.push(a[index].mat_no);
|
if (locstr.indexOf(a[index].loc_no) < 0) {
|
locstr.push(a[index].loc_no);
|
}
|
});
|
// if(flag==false){
|
// alert('出库数量必须大于0');
|
// return;
|
// }
|
if (confirm("确定启动出库?")) {
|
console.log(idstr);
|
$.ajax({
|
url: 'work/confirmRetrieve.action',
|
dataType: 'json',
|
type: 'post',
|
traditional: true,
|
data: {
|
ids: idstr,
|
locstr: locstr,
|
stn_no: $("#stn_no").val(),
|
stn_no1: 1 //$("#stn_no1").val()
|
},
|
success: function (data) {
|
if (data.code == 0) {
|
alert("启动成功!" + data.msg);
|
$('#test-table').bootstrapTable('refresh');
|
} else {
|
alert("启动失败!" + data.msg);
|
}
|
},
|
error: function () {
|
alert("请求失败!");
|
}
|
});
|
} else {
|
return false;
|
}
|
} else {
|
alert("请至少选中一行数据");
|
}
|
}
|
|
/* 设置通知档为紧急任务 */
|
function emsBtn() {
|
// 获取当前行
|
var row = $("#test-table").bootstrapTable('getSelections');
|
var paramList = [];
|
|
if (row.length > 0) {
|
row.map(function (item) {
|
paramList.push({
|
lgnum: item.lgnum,
|
tanum: item.tanum,
|
tapos: item.tapos,
|
vlpla: item.vlpla,
|
})
|
});
|
}
|
if(confirm('您确定要设置该任务为紧急状态吗')){
|
$.ajax({
|
url: 'work/waitPakOutSetEms.action',
|
type:'post',
|
dataType:'text',
|
contentType:"application/json",
|
data: JSON.stringify(paramList),
|
success: function (data) {
|
if (isNaN(Number(data))) {
|
alert(data);
|
}
|
$('#test-table').bootstrapTable('refresh');
|
},
|
error: function () {
|
alert("请求失败!");
|
}
|
});
|
}
|
}
|
|
//导出
|
function ExportExcel(){
|
if(confirm("确认导出excel?")){
|
var url = "work/exportWaitPakOut.action?";
|
url += "matnr=" + $("#search_sheet_no").val();
|
url += "&maktx=" + $("#search_mat_no").val();
|
url += "&loc_no=" + $("#loc_no").val();
|
location.href=url;
|
}else{
|
return false;
|
}
|
}
|