var PalletMatOutManager = {
|
LogStoreList: undefined,
|
Server: function () {
|
var config = (function () {
|
var URL_GetList = "/Business/IPalletMatOutAjax/GetList";
|
var URL_PalletOut = "/Business/IPalletMatOutAjax/PalletOut";
|
return {
|
URL_GetList: URL_GetList,
|
URL_PalletOut: URL_PalletOut,
|
};
|
})();
|
|
//数据操作服务
|
var dataServer = (function ($, config) {
|
|
//查询分页列表
|
var GetList = function (data, callback) {
|
$.gitAjax({
|
url: config.URL_GetList,
|
data: { ajaxdata: JSON.stringify(data) },
|
type: "post",
|
dataType: "json",
|
success: function (result) {
|
if (callback != undefined && typeof callback == "function") {
|
callback(result);
|
}
|
}
|
});
|
}
|
|
var PalletOut = function (data, callback) {
|
$.gitAjax({
|
url: config.URL_PalletOut,
|
data: { ajaxdata: JSON.stringify(data) },
|
type: "post",
|
dataType: "json",
|
success: function (result) {
|
if (callback != undefined && typeof callback == "function") {
|
callback(result);
|
}
|
}
|
});
|
}
|
return {
|
GetList: GetList,
|
PalletOut: PalletOut
|
}
|
})($, config);
|
return dataServer;
|
},
|
PalletOut: function () {
|
debugger
|
var rows = this.LogStoreList.selectedRows();
|
if (rows.length == 0) {
|
$.jBox.tip("请选择要出库的托盘", "提示");
|
return false;
|
}
|
var Palno = rows[0].Palno;
|
var LocationCode = rows[0].LocationCode;
|
var MatNo = rows[0].MatNo;
|
|
debugger
|
//var AccessCode = $("div[data-condition='search']").find("select[name='AccessCode']").val();
|
//if (AccessCode == null || AccessCode.length <= 0) {
|
// $.jBox.tip("请选择要出库口", "提示");
|
// return false;
|
//}
|
var submit = function (v, h, f) {
|
if (v) {
|
var param = {};
|
param["Palno"] = Palno;
|
param["LocationCode"] = LocationCode;
|
param["MatNo"] = MatNo;
|
var AccessCode = h.find('select[name="AccessCode"]').val();
|
if (AccessCode == null || AccessCode.length <= 0) {
|
$.jBox.tip("请选择要出库口", "提示");
|
return false;
|
}
|
param["AccessCode"] = AccessCode;
|
var Server = PalletMatOutManager.Server();
|
Server.PalletOut(param,
|
function(result) {
|
if (result.Code == 1) {
|
$.jBox.tip(result.Message, "info");
|
PalletMatOutManager.PageClick(1, 50);
|
} else {
|
$.jBox.tip(result.Message, "warn");
|
}
|
});
|
} else {
|
|
}
|
}
|
|
$.jBox.open("get:/Business/IPalletMatOut/SelectOutMode", "提示", 300, 150, { buttons: { "确定": true, "关闭": false }, top: '6%', submit: submit, loaded: "" });
|
/*$.jBox.confirm("确定要出库吗?", "提示", submit);*/
|
},
|
PageClick: function (PageIndex, PageSize) {
|
$.jBox.tip("正在努力加载数据...", "loading");
|
var Server = PalletMatOutManager.Server();
|
var search = PalletMatOutManager.GetSearch();
|
search["PageIndex"] = PageIndex;
|
search["PageSize"] = PageSize;
|
|
Server.GetList(search, function (result) {
|
$.jBox.closeTip();
|
if (result.Code == 1) {
|
PalletMatOutManager.SetTable(result);
|
} else {
|
$.jBox.tip(result.Message, "warn");
|
}
|
});
|
},
|
SetTable: function (result) {
|
var cols = [
|
{
|
title: '操作', name: 'Guid', width: 80, align: 'left', lockWidth: false, renderer: function (data, item, rowIndex) {
|
var html = "";
|
html += '<a class="out dis" href="javascript:void(0)">出库</a> ';
|
return html;
|
}
|
},
|
{
|
title: '生产令号', name: 'LingNo', width: 100, align: 'center', lockWidth: false, sortable: true, renderer: function (data, item, rowIndex) {
|
return data;
|
}
|
},
|
{
|
title: '库位地址', name: 'LocationCode', width: 120, align: 'center', lockWidth: false, sortable: true, renderer: function (data, item, rowIndex) {
|
return data;
|
}
|
},
|
{
|
title: '托盘码', name: 'Palno', width: 100, align: 'center', lockWidth: false, sortable: true, renderer: function (data, item, rowIndex) {
|
return data;
|
}
|
},
|
{
|
title: '批次号', name: 'BatchNo', width: 100, align: 'center', lockWidth: false, sortable: true, renderer: function (data, item, rowIndex) {
|
return data;
|
}
|
},
|
{
|
title: '批次描述', name: 'BatchName', width: 100, align: 'center', lockWidth: false, sortable: true, renderer: function (data, item, rowIndex) {
|
return data;
|
}
|
},
|
{
|
title: '物料编码', name: 'MatNo', width: 100, align: 'center', lockWidth: false, sortable: true, renderer: function (data, item, rowIndex) {
|
return data;
|
}
|
},
|
{
|
title: '物料名称', name: 'MatName', width: 160, align: 'center', lockWidth: false, renderer: function (data, item, rowIndex) {
|
return data;
|
}
|
},
|
{
|
title: '数量', name: 'Quant', width: 60, align: 'center', lockWidth: false, renderer: function (data, item, rowIndex) {
|
return data;
|
}
|
},
|
{
|
title: '单位', name: 'UnitName', width: 60, align: 'center', lockWidth: false, renderer: function (data, item, rowIndex) {
|
return data;
|
}
|
},
|
{
|
title: '合格证', name: 'Certificate', width: 120, align: 'center', lockWidth: false, renderer: function (data, item, rowIndex) {
|
return data;
|
}
|
},
|
{
|
title: '图号', name: 'TuNo', width: 120, align: 'center', lockWidth: false, renderer: function (data, item, rowIndex) {
|
return data;
|
}
|
},
|
];
|
var ht = masterUI.MMGridHeight();
|
if (this.LogStoreList == undefined) {
|
this.LogStoreList = $("#tabList").mmGrid({
|
cols: cols,
|
items: result.Result.List,
|
fullWidthRows: true,
|
checkCol: true,
|
nowrap: true,
|
height: ht
|
});
|
//绑定编辑 删除事件
|
PalletMatOutManager.BindEvent();
|
}
|
else {
|
this.LogStoreList.load(result.Result.List);
|
}
|
|
var pageInfo = result.PageInfo;
|
if (pageInfo != undefined) {
|
$("#mypager").pager({ pagenumber: pageInfo.PageIndex, recordCount: pageInfo.RowCount, pageSize: pageInfo.PageSize, buttonClickCallback: PalletMatOutManager.PageClick });
|
}
|
},
|
BindEvent: function () {
|
this.LogStoreList.on('loadSuccess', function (e, data) {
|
LoadBtn.SetBtn();
|
});
|
|
this.LogStoreList.off("cellSelected").on("cellSelected", function (e, item, rowIndex, colIndex) {
|
if ($(e.target).is("a.out")) {
|
var Palno = item.Palno;
|
var LocationCode = item.LocationCode;
|
var MatNo = item.MatNo;
|
|
//var AccessCode = $("div[data-condition='search']").find("select[name='AccessCode']").val();
|
|
var submit = function (v, h, f) {
|
if (v) {
|
var param = {};
|
param["Palno"] = Palno;
|
param["LocationCode"] = LocationCode;
|
param["MatNo"] = MatNo;
|
|
var AccessCode = h.find('select[name="AccessCode"]').val();
|
if (AccessCode == null || AccessCode.length <= 0) {
|
$.jBox.tip("请选择要出库口", "提示");
|
return false;
|
}
|
param["AccessCode"] = AccessCode;
|
|
var Server = PalletMatOutManager.Server();
|
Server.PalletOut(param, function (result) {
|
if (result.Code == 1) {
|
$.jBox.tip(result.Message, "info");
|
PalletMatOutManager.PageClick(1, 50);
|
} else {
|
$.jBox.tip(result.Message, "warn");
|
}
|
});
|
}
|
}
|
|
$.jBox.open("get:/Business/IPalletMatOut/SelectOutMode", "提示", 300, 150, { buttons: { "确定": true, "关闭": false }, top: '6%', submit: submit, loaded: "" });
|
}
|
});
|
},
|
GetSelect: function () {
|
var list = [];
|
if (this.LogStoreList != undefined) {
|
var rows = this.LogStoreList.selectedRows();
|
if (rows != undefined && rows.length > 0) {
|
for (var i = 0; i < rows.length; i++) {
|
list.push(rows[i].Addre);
|
}
|
}
|
}
|
return list;
|
},
|
GetRows: function () {
|
var list = [];
|
if (this.LogStoreList != undefined) {
|
var rows = this.LogStoreList.selectedRows();
|
if (rows != undefined && rows.length > 0) {
|
for (var i = 0; i < rows.length; i++) {
|
list.push(rows[i]);
|
}
|
}
|
}
|
return list;
|
},
|
GetSearch: function () {
|
var search = {};
|
var searchBar = $("div[data-condition='search']");
|
search["Palno"] = searchBar.find("input[name='Palno']").val();
|
search["LocationCode"] = searchBar.find("input[name='Addre']").val();
|
search["MatNo"] = searchBar.find("input[name='MatNo']").val();
|
search["MatName"] = searchBar.find("input[name='MatName']").val();
|
search["LingNo"] = searchBar.find("input[name='LingNo']").val();
|
search["BatchNo"] = searchBar.find("input[name='BatchNo']").val();
|
return search;
|
},
|
ToolBar: function () {
|
//debugger
|
//工具栏按钮点击事件
|
$("div.toolbar").find("a.btn").click(function () {
|
var command = $(this).attr("data-command");
|
|
if (command == "Out") {
|
|
PalletMatOutManager.PalletOut();
|
}
|
|
});
|
//搜索 高级搜索按钮
|
var searchBar = $("div[data-condition='search']");
|
searchBar.find("a[data-command='search']").click(function () {
|
PalletMatOutManager.PageClick(1, 50);
|
});
|
//加载默认数据
|
PalletMatOutManager.PageClick(1, 50);
|
}
|
}
|