123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- var refreshGirdData;
-
- var bootstrap = function ($, learun) {
- "use strict";
- var psuid = "";
- var page = {
- init: function () {
- page.initGird();
- page.bind();
-
- },
- bind: function () {
- $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
- // 调用后台查询
- // queryJson 查询条件
-
- queryJson["MatCode"] = $("#MatCode").val();
- queryJson["MatName"] = $("#MatName").val();
- queryJson["ContGrpBarCode"] = $("#ContGrpBarCode").val();
- queryJson["Grade"] = $("#Grade").val();
- queryJson["SKU"] = $("#SKU").val();
- queryJson["DocNo"] = $("#DocNo").val();
- queryJson["IsTorsChk"] = $("#IsTorsChk").lrselectGet();
- queryJson["IsBlack"] = $("#IsBlack").lrselectGet();
- page.search({ queryJson: JSON.stringify(queryJson) });
- }, 250);
- // 查询
- $('#btn_Search').on('click', function () {
- var keyword = $('#txt_Keyword').val();
- page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val()}) });
- });
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- $('#IsBlack').lrselect({
- url: top.$.rootUrl + '/SXManager/Enums/YesNoList',
- maxHeight: 60,
- allowSearch: false
- });
- $('#IsTorsChk').lrselect({
- url: top.$.rootUrl + '/SXManager/Enums/YesNoList',
- maxHeight: 60,
- allowSearch: false
- });
- // 导出数据
- $('#lr_exportnow').on('click', function () {
- var subsuid = "";
- if (psuid == "") {
- psuid = $('#gridtable').attr('id');
- }
- else if (psuid != "") {
- var t = $('#' + psuid).attr('id');
- if (t == undefined)
- psuid = $('#gridtable').attr('id');
- }
- var mainGridId = $('#gridtable').attr('id');
- learun.layerForm({
- id: "ExcelExportForm",
- title: '导出Excel数据',
- url: top.$.rootUrl + '/Utility/ExcelExportForm?mainGridId=' + mainGridId + '&gridId=' + psuid + '&filename=' + encodeURI(encodeURI("导出出入库报表")),
- width: 500,
- height: 380,
- callBack: function (id) {
- return top[id].acceptClick();
- },
- btn: ['导出Excel', '关闭']
- });
- });
- $('#lr_exportall').on('click', function () {
- //var where = $("#queryWhere").val();
- var query = $('#multiple_condition_query').lrGetFormData();
- query["EndTimeBegin"] = $("#EndTimeBegin").val();
- query["EndTimeEnd"] = $("#EndTimeEnd").val();
- query["GroupName"] = $("#GroupName").val();
- query["keyword"] = $('#txt_Keyword').val();
- var queryJson = JSON.stringify(query);
- learun.layerForm({
- id: "ExcelExportForm",
- title: '导出Excel数据',
- // url: top.$.rootUrl + '/Utility/ExcelExportForm?mainGridId=' + mainGridId + '&gridId=' + psuid + '&filename=' + encodeURI(encodeURI("库存")),
- url: top.$.rootUrl + '/Utility/ExcelExportColumn?gridId=' + $('#gridtable').attr('id') + '&subgridId=',
- width: 500,
- height: 380,
- callBack: function (id) {
- return top[id].acceptClick(function (data) {
- learun.download({
- method: "POST",
- url: '/SXManager/Statisticsreport/ExportInOutReportExcel',
- param: {
- fileName: "导出出入库报表",
- queryJson: queryJson,
- exportField: JSON.stringify(data)
- }
- });
- });
- },
- btn: ['导出Excel', '关闭']
- });
- });
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').jfGrid({
- url: top.$.rootUrl + '/SXManager/Statisticsreport/GetCurStockInfoControlList',
- headData: [
- { label: "SKU编码", name: "SKU", width: 100, align: "left" },
- { label: "物料描述", name: "MatName", width: 280, align: "left", },
-
- { label: "机器组", name: "WbGroupCode", width: 80, align: "left", },
- {
- label: "前天(R/L)", name: "BeforeYesterdayQty", width: 80, align: "left"
- , formatter: function (cellvalue) {
- return '<span class=\"label label-default\" >' + cellvalue[0] + '</span>/<span class=\"label label-default\" >' + cellvalue[1] + '</span>'
- }
- },
- {
- label: "昨天(R/L)", name: "YesterdayQty", width: 80, align: "left", formatter: function (cellvalue) {
- return '<span class=\"label label-default\" >' + cellvalue[0] + '</span>/<span class=\"label label-default\" >' + cellvalue[1] + '</span>'
- }
- },
- {
- label: "今天(R/L)", name: "TodayQty", width: 80, align: "left", formatter: function (cellvalue) {
- return '<span class=\"label label-default\" >' + cellvalue[0] + '</span>/<span class=\"label label-default\" >' + cellvalue[1] + '</span>'
- }
- },
- {
- label: "是否有黑盘", name: "HaveBlack", width: 230, align: "left", formatter: function (cellvalue) {
- return '<span class=\"label label-default\" >' + cellvalue[0] + '</span>/<span class=\"label label-default\" >' + cellvalue[1] + '</span>/<span class=\"label label-default\" >' + cellvalue[1] + '</span >';
- }
- },
-
- { label: "质量等级", name: "Grade", width: 80, align: "left", },
-
- ],
- rows: 200,
- mainId: 'SKU',
- footerrow: true,
- isPage: true,
- reloadSelected: true,
- autowWidth: true,
- sidx: 'SKU',
- sord: 'asc',
- onRenderComplete: function (data) {
- var datas = $('#gridtable').jfGridGet("rowdatas");
- for (var i = 0; i < datas.length; i++) {
- if (datas[i].BeforeYesterdayQty[0] != '0R' || datas[i].BeforeYesterdayQty[1] != '0L') {
- let result = datas[i].HaveBlack[0].match(/\(([^)]*)\)/);
- if (result) {
- let arr = result[1].split('/');
- if ((datas[i].BeforeYesterdayQty[0] != '0R' && arr[0] == '0R') || (datas[i].BeforeYesterdayQty[1] != '0L' && arr[1] == '0L')) {
- $('.jfgrid-data-cell[rowindex=' + i + ']').addClass("SelectBG");
- }
- }
- }
- if (datas[i].YesterdayQty[0] != '0R' || datas[i].YesterdayQty[1] != '0L') {
- let result = datas[i].HaveBlack[1].match(/\(([^)]*)\)/);
- if (result) {
- let arr = result[1].split('/');
- if ((datas[i].YesterdayQty[0] != '0R' && arr[0] == '0R') || (datas[i].YesterdayQty[1] != '0L' && arr[1] == '0L')) {
- $('.jfgrid-data-cell[rowindex=' + i + ']').addClass("SelectBG");
- }
- }
- }
- if (datas[i].TodayQty[0] != '0R' || datas[i].TodayQty[1] != '0L') {
- let result = datas[i].HaveBlack[2].match(/\(([^)]*)\)/);
- if (result) {
- let arr = result[1].split('/');
- if ((datas[i].TodayQty[0] != '0R' && arr[0] == '0R') || (datas[i].TodayQty[1] != '0L' && arr[1] == '0L')) {
- $('.jfgrid-data-cell[rowindex=' + i + ']').addClass("SelectBG");
- }
- }
- }
- }
- },
- });
- page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val()}) });
- },
- search: function (param) {
- $('#gridtable').jfGridSet('reload', param);
- }
- };
- refreshGirdData = function () {
- $('#gridtable').jfGridSet('reload');
- };
- page.init();
- }
|