var refreshGirdData; var OneInTimebegin = ''; var OneInTimeend = ''; var ProductTimebegin = ''; var ProductTimeend = ''; var logbegin = ''; var logend = ''; var selectedRow; var selectRowsData; var refreshGirdData; // 更新数据 var bootstrap = function ($, learun) { "use strict"; const Directions = [{ id: "", text: "" }, { id: "L", text: "左手车" }, { id: "R", text: "右手车" }]; //左/右手车 const WareDirects = [{ id: "", text: "" }, { id: "S", text: "南" }, { id: "N", text: "北" }]; //南北向 var page = { init: function () { page.initGird(); page.bind(); }, bind: function () { for (var j = 0; j < Directions.length; j++) { if (Directions[j].id == '') { $("#Direction").append($("")); } else { $("#Direction").append($("")); } } for (var j = 0; j < WareDirects.length; j++) { if (WareDirects[j].id == '') { $("#WareDirect").append($("")); } else { $("#WareDirect").append($("")); } } $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { // 调用后台查询 // queryJson 查询条件 console.log(queryJson); queryJson["WarehouseId"] = $("#WarehouseId").lrselectGet(); queryJson["Name"] = $("#Name").val(); queryJson["MachNo"] = $("#MachNo").val(); queryJson["Station"] = $("#Station").val(); queryJson["GrpCode"] = $("#GrpCode").val(); queryJson["Direction"] = $("#Direction").val(); queryJson["WareDirect"] = $("#WareDirect").val(); queryJson["BillCode"] = $("#BillCode").val(); queryJson["WorkOrder"] = $("#WorkOrder").val(); queryJson["SetGrpCode"] = $("#SetGrpCode").val(); queryJson["ProSetGrpCode"] = $("#ProSetGrpCode").val(); queryJson["ProBillCode"] = $("#ProBillCode").val(); queryJson["ProWorkOrder"] = $("#ProWorkOrder").val(); queryJson["MacTypeCode"] = $("#MacTypeCode").val(); queryJson["MacTypeName"] = $("#MacTypeName").val(); 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(); }); $('#lr_import').on('click', function () { learun.layerForm({ id: 'ImportForm', title: '导入Excel数据', url: top.$.rootUrl + '/Utility/ImportForm?ordertype=' + 100, width: 600, height: 400, maxmin: true, btn: null }); }); // 新增 $('#lr_add').on('click', function () { var keyValue = {}; selectedRow = {}; learun.layerForm({ id: 'form', title: '添加仓库', url: top.$.rootUrl + '/FJManager/BillMachInfo/Form', height: 400, width: 800, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); }); // 编辑 $('#lr_edit').on('click', function () { selectedRow = $('#gridtable').jfGridGet('rowdata'); if (selectedRow.length == 0) { learun.alert.error('未选择行!'); return false; } if (selectedRow.length > 1) { learun.alert.error('选择了多行!'); return false; } var keyValue = selectedRow[0].Id; selectedRow = selectedRow[0]; if (learun.checkrow(keyValue)) { learun.layerForm({ id: 'form', title: '编辑机台信息', url: top.$.rootUrl + '/FJManager/BillMachInfo/Form?keyValue=' + keyValue, height: 400, width: 800, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); } }); // 删除 $('#lr_delete').on('click', function () { var keyValue = $('#gridtable').jfGridValue('Id'); if (learun.checkrow(keyValue)) { learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { learun.deleteForm(top.$.rootUrl + '/FJManager/BillMachInfo/Delete', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } }); // 批量修改南北向 $('#lr_waredirectedit').on('click', function () { selectedRow = $('#gridtable').jfGridGet('rowdata'); if (selectedRow.length == 0) { learun.alert.error('未选择行!'); return false; } learun.layerForm({ id: 'form', title: '批量修改南北向', url: top.$.rootUrl + '/FJManager/BillMachInfo/WareDirectForm', height: 400, width: 800, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); }); $('#WarehouseId').lrselect({ url: top.$.rootUrl + '/FJManager/BaseWarehouse/GetSelectWarehouseNameList', maxHeight: 180, allowSearch: false }); }, // 初始化列表 initGird: function () { $('#gridtable').jfGrid({ url: top.$.rootUrl + '/FJManager/BillMachInfo/GetPageList', headData: [ { label: 'Id', name: 'Id', hidden: true }, { label: '仓库', name: 'WarehouseName', width: 100, align: 'left' }, { label: '南北向', name: 'WareDirect', width: 60, align: 'left', formatter: function (cellvalue) { if (cellvalue == "N" ) { return ''; } else if (cellvalue == "S") { return ''; } else { return '未知'; } } }, { label: '机台号', name: 'MachNo', width: 100, align: 'left' }, { label: '名称', name: 'Name', width: 100, align: 'left' }, { label: '机台组', name: 'GrpCode', width: 100, align: 'left' }, { label: 'AGV托盘位', name: 'Station', width: 100, align: 'left' }, { label: '最近的仓库名称', name: 'NearestWarehouseName', width: 100, align: 'left' }, { label: '左/右手车', name: 'Direction', width: 100, align: 'left', formatter: function (cellvalue) { if (cellvalue == "L") { return '左手车'; } else if (cellvalue == "R") { return '右手车'; } else { return '未知'; } } }, { label: '帘线工序工单号', name: 'BillCode', width: 100, align: 'left' }, { label: '生产订单号', name: 'WorkOrder', width: 100, align: 'left' }, { label: '垛型编码', name: 'SetGrpCode', width: 100, align: 'left' }, { label: '预排帘线工序工单号', name: 'ProBillCode', width: 100, align: 'left' }, { label: '预排生产订单号', name: 'ProWorkOrder', width: 100, align: 'left' }, { label: '预排垛型编码', name: 'ProSetGrpCode', width: 100, align: 'left' }, { label: '机器类型编码', name: 'MacTypeCode', width: 100, align: 'left' }, { label: '机器类型名称', name: 'MacTypeName', width: 100, align: 'left' }, { label: 'Agv地标', name: 'AgvPoint', width: 100, align: 'left' }, { label: "是否启用", name: "IsStop", width: 80, align: "left", formatter: function (cellvalue) { if (cellvalue == 0) { return ''; } else { return ''; } } }, { label: '备注', name: 'Memo', width: 100, align: 'left' }, { label: "创建时间", name: "AddTime", width: 130, align: "left" }, { label: "更新时间", name: "EditTime", width: 130, align: "left" }, { label: "创建用户", name: "AddWho", width: 110, align: "left" }, { label: "更新用户", name: "EditWho", width: 110, align: "left" }, ], mainId: 'Id', isPage: true, reloadSelected: true, autowWidth: true, sidx: 'AddTime', sord: 'DESC', isMultiselect: true, }); page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) }); }, search: function (param) { $('#gridtable').jfGridSet('reload', param); } }; refreshGirdData = function () { $('#gridtable').jfGridSet('reload'); }; page.init(); }