/** * *移库管理功能 * **/ var MoveManager = { TabGrid:undefined, Server: function () { var config = (function () { var URL_Add = "/Order/MoveAjax/Add"; var URL_LoadDetail = "/Order/MoveAjax/LoadDetail"; var URL_AddProduct = "/Order/MoveAjax/AddProduct"; var URL_DelProduct = "/Order/MoveAjax/DelProduct"; var URL_GetList = "/Order/MoveManagerAjax/GetList"; var URL_GetDetail = "/Order/MoveManagerAjax/GetDetail"; var URL_Delete = "/Order/MoveManagerAjax/Delete"; var URL_Cancel = "/Order/MoveManagerAjax/Cancel"; var URL_Audite = "/Order/MoveManagerAjax/Audite"; var URL_ToExcel = "/Order/MoveManagerAjax/ToExcel"; return { URL_GetList: URL_GetList, URL_GetDetail: URL_GetDetail, URL_LoadDetail: URL_LoadDetail, URL_AddProduct: URL_AddProduct, URL_DelProduct: URL_DelProduct, URL_Add: URL_Add, URL_Delete: URL_Delete, URL_Cancel: URL_Cancel, URL_Audite: URL_Audite, URL_ToExcel: URL_ToExcel, }; })(); //数据操作服务 var dataServer = (function ($, config) { //查询分页列表 var Add = function (data, callback) { $.gitAjax({ url: config.URL_Add, data: data, type: "post", dataType: "json", success: function (result) { if (callback != undefined && typeof callback == "function") { callback(result); } } }); } var LoadDetail = function (data, callback) { $.gitAjax({ url: config.URL_LoadDetail, data: data, type: "post", dataType: "json", success: function (result) { if (callback != undefined && typeof callback == "function") { callback(result); } } }); } var AddProduct = function (data, callback) { $.gitAjax({ url: config.URL_AddProduct, data: data, type: "post", dataType: "json", success: function (result) { if (callback != undefined && typeof callback == "function") { callback(result); } } }); } var DelProduct = function (data, callback) { $.gitAjax({ url: config.URL_DelProduct, data: data, type: "post", dataType: "json", success: function (result) { if (callback != undefined && typeof callback == "function") { callback(result); } } }); } var GetList = function (data, callback) { $.gitAjax({ url: config.URL_GetList, data: data, type: "post", dataType: "json", success: function (result) { if (callback != undefined && typeof callback == "function") { callback(result); } } }); } var GetDetail = function (data, callback) { $.gitAjax({ url: config.URL_GetDetail, data: data, type: "post", dataType: "json", success: function (result) { if (callback != undefined && typeof callback == "function") { callback(result); } } }); } var Delete = function (data, callback) { $.gitAjax({ url: config.URL_Delete, data: data, type: "post", dataType: "json", success: function (result) { if (callback != undefined && typeof callback == "function") { callback(result); } } }); } var Cancel = function (data, callback) { $.gitAjax({ url: config.URL_Cancel, data: data, type: "post", dataType: "json", success: function (result) { if (callback != undefined && typeof callback == "function") { callback(result); } } }); } var Audite = function (data, callback) { $.gitAjax({ url: config.URL_Audite, data: data, type: "post", dataType: "json", success: function (result) { if (callback != undefined && typeof callback == "function") { callback(result); } } }); } var ToExcel = function (data, callback) { $.gitAjax({ url: config.URL_ToExcel, data: data, type: "post", dataType: "json", success: function (result) { if (callback != undefined && typeof callback == "function") { callback(result); } } }); } return { Add: Add, LoadDetail: LoadDetail, AddProduct: AddProduct, DelProduct: DelProduct, GetList: GetList, GetDetail: GetDetail, Delete: Delete, Cancel: Cancel, Audite: Audite, ToExcel: ToExcel, } })($, config); return dataServer; }, PageClick: function (PageIndex, PageSize) { $.jBox.tip("正在努力加载数据...", "loading"); var Server = MoveManager.Server(); var search = MoveManager.GetSearch(); search["PageIndex"] = PageIndex; search["PageSize"] = PageSize; Server.GetList(search, function (result) { $.jBox.closeTip(); if(result.Code==1){ MoveManager.SetTable(result); }else{ $.jBox.tip(result.Message,"warn"); } }); }, Refresh: function () { var PageSize = $("#mypager").pager("GetPageSize"); var PageIndex = $("#mypager").pager("GetCurrent"); $.jBox.tip("正在努力加载数据...", "loading"); var Server = MoveManager.Server(); var search = MoveManager.GetSearch(); search["PageIndex"] = PageIndex; search["PageSize"] = PageSize; Server.GetList(search, function (result) { $.jBox.closeTip(); if(result.Code==1){ MoveManager.SetTable(result); }else{ $.jBox.tip(result.Message,"warn"); } }); }, SetTable: function (result) { var cols=[ {title:'移库单号', name:'OrderNum', width: 65, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return data; }}, {title:'操作', name:'OrderNum', width: 120, align: 'left',lockWidth:false, renderer: function(data,item,rowIndex){ var html = ""; if (item.Status == EAuditeJson.Wait || item.Status == EAuditeJson.NotPass) { html += '编辑 '; } if (item.Status == EAuditeJson.Wait || item.Status == EAuditeJson.NotPass) { html += '审核 '; } html += '查看 '; html += '打印 '; html += '删除 '; return html; }}, {title:'产品名称', name:'ProductName', width: 120, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return data; }}, {title:'产品编号', name:'BarCode', width: 65, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return data; }}, {title:'批次', name:'BatchNum', width: 65, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return data; }}, {title:'过期时间', name:'LastTime', width: 65, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return data; }}, {title:'规格', name:'Size', width: 70, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return data; }}, {title:'数量', name:'RealNum', width: 45, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return data; }}, {title:'体积', name:'RealVolume', width: 45, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return git.ToDecimal(data,2); }}, {title:'重量', name:'RealNetWeight', width: 45, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return git.ToDecimal(data,2); }}, {title:'托盘数', name:'RealPalletNum', width: 45, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return data; }}, {title:'仓库', name:'StorageName', width: 70, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return data; }}, {title:'原库位', name:'FromLocalName', width: 70, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return data; }}, {title:'目标库', name:'ToLocalName', width: 70, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return data; }}, {title:'移库类型', name:'MoveType', width: 80, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return git.GetEnumDesc(EMoveType,data); }}, {title:'制单人', name:'CreateUserName', width: 75, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return data; }}, {title:'制单时间', name:'CreateTime', width: 65, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return git.JsonToDateTime(data); }}, {title:'状态', name:'Status', width: 65, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ if(data==EAuditeJson.Pass){ return ''+git.GetEnumDesc(EAudite,data)+''; }else if(data==EAuditeJson.NotPass){ return ''+git.GetEnumDesc(EAudite,data)+''; }else{ return git.GetEnumDesc(EAudite,data); } }}, {title:'审核人', name:'AuditUserName', width: 75, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return data; }}, {title:'审核时间', name:'AuditeTime', width: 65, align: 'center',lockWidth:false, renderer: function(data,item,rowIndex){ return git.JsonToDateTime(data); }}, ]; if(this.TabGrid==undefined){ this.TabGrid=$("#tabList").mmGrid({ cols:cols, items:result.Result, checkCol:true, nowrap:true, multiSelect:true, height:380 }); //绑定编辑 删除事件 MoveManager.BindEvent(); }else{ this.TabGrid.load(result.Result); } var pageInfo = result.PageInfo; if (pageInfo != undefined) { $("#mypager").pager({ pagenumber: pageInfo.PageIndex, recordCount: pageInfo.RowCount, pageSize: pageInfo.PageSize, buttonClickCallback: MoveManager.PageClick }); } }, BindEvent: function () { this.TabGrid.off("cellSelected").on("cellSelected",function(e, item, rowIndex, colIndex){ if($(e.target).is("a.edit")){ var SN=item.OrderSnNum; window.location.href = "/Order/Move/Add?SnNum=" + SN; }else if($(e.target).is("a.audite")){ var SN=item.OrderSnNum; MoveManager.Detail(SN, "Audite"); }else if($(e.target).is("a.view")){ var SN=item.OrderSnNum; MoveManager.Detail(SN, "View"); }else if($(e.target).is("a.delete")){ var SN=item.OrderSnNum; var submit = function (v, h, f) { if (v == "ok") { var list = []; list.push(SN); var param = {}; param["list"] = JSON.stringify(list); var Server = MoveManager.Server(); Server.Delete(param, function (result) { $.jBox.tip(result.Message, "success"); var pageSize = $("#mypager").pager("GetPageSize"); MoveManager.PageClick(1, pageSize); }); } } $.jBox.confirm("该操作将删除该订单所有数据,确定要删除吗?", "提示", submit); } }); this.TabGrid.on('loadSuccess', function(e, data){ $('#tabList').find('a.print').each(function(i,item){ $(item).CusReportDialog({ ReportType:8, callBack:function(result){ if(result!=undefined){ var SN=data[i].OrderSnNum; var SnNum=result.SnNum; var url="/Report/Manager/Show?SnNum="+SnNum+"&OrderNum="+SN; window.location.href=url; } } }); }); }); }, GetSelect: function () { var list=[]; if(this.TabGrid!=undefined){ var rows=this.TabGrid.selectedRows(); if(rows!=undefined && rows.length>0){ for(var i=0;i0){ for(var i=0;i0){ var list=[]; for(var i=0;i