123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283 |
- var refreshGirdData;
- var logbegin = '';
- var logend = '';
- var StartTimeBegin = '';
- var StartTimeend = '';
- var EndTimeBegin = '';
- var EndTimeend = '';
- var selectedRow;
- var refreshGirdData; // 更新数据
- var bootstrap = function ($, learun) {
- "use strict";
- var page = {
- init: function () {
- page.initGird();
- page.bind();
- },
- bind: function () {
- $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
- // 调用后台查询
- // queryJson 查询条件
- //var starttime = $('#lr_search_date_StartTime').html();
- //if (starttime == '') {
- // StartTimeBegin = '';
- // StartTimeend = '';
- //}
- //var endtime = $('#lr_search_date_EndTime').html();
- //if (endtime == '') {
- // EndTimeBegin = '';
- // EndTimeend = '';
- //}
- queryJson["AddTimeFrom"] = logbegin;
- queryJson["AddTimeTo"] = logend;
- queryJson["MatType"] = $("#MatType").val();
- queryJson["Code"] = $("#Code").val();
- queryJson["Name"] = $("#Name").val();
- queryJson["StateNum"] = $("#Status").lrselectGet();
- queryJson["WarehouseId"] = $("#WarehouseId").lrselectGet();
- queryJson["Tunnel"] = $("#Tunnel").val();
- queryJson["Layer"] = $("#Layer").val();
- queryJson["SCRel"] = $("#SCRel").val();
- queryJson["Row"] = $("#Row").val();
- queryJson["Col"] = $("#Col").val();
- queryJson["GroupID"] = $("#GroupID").val();
- queryJson["Size"] = $("#Size").val();
- queryJson["ContGrpBarCode"] = $("#ContGrpBarCode").val();
- if ($("#IsStop").is(":checked")) {
- queryJson["IsStop"] = '1';
- } else {
- queryJson["IsStop"] = '0';
- }
- 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();
- });
- $('.datetime').each(function () {
- $(this).lrdatetime({
- dfdata: [
- { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
- ],
- // 月
- mShow: false,
- premShow: false,
- // 季度
- jShow: false,
- prejShow: false,
- // 年
- ysShow: false,
- yxShow: false,
- preyShow: false,
- yShow: false,
- // 默认
- dfvalue: 'all',
- selectfn: function (begin, end) {
- let id = $(this).attr('id');
- if (id == 'datesearch') {
- logbegin = begin;
- logend = end;
- }
- else if (id == 'StartTime') {
- StartTimeBegin = begin;
- StartTimeend = end;
- }
- else if (id == 'EndTime') {
- EndTimeBegin = begin;
- EndTimeend = end;
- }
- }
- });
- });
- $('#Type').lrselect({
- url: top.$.rootUrl + '/KLHCManager/Enums/GetTaskTypeList',
- maxHeight: 180,
- allowSearch: false
- });
- $('#Status').lrselect({
- url: top.$.rootUrl + '/KLHCManager/Enums/GetLocationStateList',
- maxHeight: 180,
- allowSearch: false
- });
- $('#WarehouseId').lrselect({
- url: top.$.rootUrl + '/KLHCManager/BaseWarehouse/GetSelectWarehouseNameList',
- maxHeight: 180,
- allowSearch: false
- });
- // 启用
- $('#lr_enable').on('click', function () {
- var postData = $('#gridtable').jfGridGet("rowdata");
- if (postData.length == 0) {
- learun.alert.error('未选择行!');
- return false;
- }
- learun.layerConfirm('是否确认启用该货位!', function (res) {
- if (res) {
- learun.postForm(top.$.rootUrl + '/KLHCManager/BaseWareCell/EnableWareCells', { ids: JSON.stringify(postData.map((item) => item.Id)) }, function () {
- refreshGirdData();
- });
- }
- });
- });
- // 禁用
- $('#lr_disable').on('click', function () {
- var postData = $('#gridtable').jfGridGet("rowdata");
- if (postData.length == 0) {
- learun.alert.error('未选择行!');
- return false;
- }
- learun.layerConfirm('是否确认禁用该货位!', function (res) {
- if (res) {
- learun.postForm(top.$.rootUrl + '/KLHCManager/BaseWareCell/DisableWareCells', { ids: JSON.stringify(postData.map((item) => item.Id)) }, function () {
- refreshGirdData();
- });
- }
- });
- });
- // 新增
- $('#lr_add').on('click', function () {
- var keyValue = {};
- selectedRow = {};
- learun.layerForm({
- id: 'form',
- title: '添加货位',
- url: top.$.rootUrl + '/KLHCManager/BaseWareCell/Form',
- height: 500,
- width: 800,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
- // 编辑
- $('#lr_edit').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Code');
- let editSelRows = $('#gridtable').jfGridGet("rowdata");
- if (editSelRows.length == 0) {
- learun.alert.error('未选择行!');
- return false;
- }
- if (editSelRows.length > 1) {
- learun.alert.error('选择了多行!');
- return false;
- }
- selectedRow = editSelRows[0];
- if (learun.checkrow(keyValue)) {
- learun.layerForm({
- id: 'form',
- title: '编辑货位信息',
- url: top.$.rootUrl + '/KLHCManager/BaseWareCell/Form?keyValue=' + keyValue,
- height: 500,
- width: 800,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- $('#lr_size').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Code');
- selectedRow = $('#gridtable').jfGridGet("rowdata");
- if (selectedRow.length == 0) {
- learun.alert.error('未选择行!');
- return false;
- }
- if (learun.checkrow(keyValue)) {
- learun.layerForm({
- id: 'form',
- title: '编辑货位值',
- url: top.$.rootUrl + '/KLHCManager/BaseWareCell/SizeForm?keyValue=' + keyValue,
- height: 300,
- width: 400,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- }
- });
- // 删除
- $('#lr_delete').on('click', function () {
- var keyValue = $('#gridtable').jfGridValue('Code');
- if (learun.checkrow(keyValue)) {
- learun.layerConfirm('是否确认删除该项!', function (res) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/KLHCManager/BaseWareCell/Delete', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- });
- }
- });
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').jfGrid({
- url: top.$.rootUrl + '/KLHCManager/BaseWareCell/GetPageList',
- headData: [
- { label: "仓库", name: "WarehouseName", width: 120, align: "left" },
- { label: "货物类型", name: "MatType", width: 50, align: "left" },
- { label: "货位号", name: "Code", width: 120, align: "left" },
- { label: "货位名称", name: "Name", width: 150, align: "left" },
- { label: "货位状态", name: "StatusName", width: 90, align: "left", sortname: "StateNum" },
- { label: "货位类型", name: "TypeName", width: 70, align: "left", sortname: "TypeNum" },
- {
- label: "是否停用", name: "IsStop", width: 70, align: "left", formatter: function (cellvalue) {
- if (cellvalue == 0) {
- return '<span class=\"label label-success\" >正常</span>';
- } else if (cellvalue == 1) {
- return '<span class=\"label label-default\" >停用</span>';
- } else {
- return '<span class=\"label label-default\" >未知</span>';
- }
- }
- },
- { label: "组ID", name: "GroupID", width: 160, align: "left" },
- { label: "货位值", name: "Size", width: 50, align: "left" },
- { label: "RFID条码", name: "ContGrpBarCode", width: 130, align: "left" },
- { label: "行", name: "Row", width: 50, align: "left" },
- { label: "列", name: "Col", width: 50, align: "left" },
- { label: "层", name: "Layer", width: 50, align: "left" },
- { label: "深度", name: "Depth", width: 50, align: "left" },
- { label: "设备", name: "SCRel", width: 60, align: "left" },
- { label: '出库跺型', name: 'XYNO', width: 100, align: 'left' },
- { label: "创建时间", name: "AddTime", width: 130, align: "left" },
- { label: "创建用户", name: "AddWho", width: 90, align: "left" },
- { label: "更新用户", name: "EditWho", width: 90, align: "left" },
- { label: "更新时间", name: "EditTime", width: 130, align: "left" },
- ],
- mainId: 'Id',
- isPage: true,
- reloadSelected: true,
- sidx: 'AddTime',
- isMultiselect: true,
- sord: 'DESC',
- });
- page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val() }) });
- },
- search: function (param) {
- $('#gridtable').jfGridSet('reload', param);
- }
- };
- refreshGirdData = function () {
- $('#gridtable').jfGridSet('reload');
- };
- page.init();
- }
|