123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482 |
- var refreshGirdData;
- var OneInTimebegin = '';
- var OneInTimeend = '';
- var ProductTimebegin = '';
- var ProductTimeend = '';
- var logbegin = '';
- var logend = '';
- var selectRowsData;
- var bootstrap = function ($, learun) {
- var psuid = "";
- "use strict";
- var page = {
- init: function () {
- page.initGird();
- page.bind();
- },
- bind: function () {
- $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
- // 调用后台查询
- // queryJson 查询条件
- var oneintime = $('#lr_search_date_OneInTime').html();
- if (oneintime == '') {
- OneInTimebegin = '';
- OneInTimeend = '';
- }
- var producttime = $('#lr_search_date_ProductTime').html();
- if (producttime == '') {
- ProductTimebegin = '';
- ProductTimeend = '';
- }
- console.log(queryJson);
- queryJson["MatCode"] = $("#MatCode").val();
- queryJson["MatName"] = $("#MatName").val();
- queryJson["RFIDBarCode"] = $("#RFIDBarCode").val();
- queryJson["InvBarCode"] = $("#InvBarCode").val();
- queryJson["Tunnel"] = $("#Tunnel").val();
- queryJson["Code"] = $("#Code").val();
- queryJson["PutRow"] = $("#PutRow").val();
- queryJson["PutCol"] = $("#PutCol").val();
- queryJson["PutLayer"] = $("#PutLayer").val();
- queryJson["OneInTimeBegin"] = $("#OneInTimeBegin").val();
- queryJson["OneInTimeEnd"] = $("#OneInTimeEnd").val();
- queryJson["ProductTimeBegin"] = $("#ProductTimeBegin").val();
- queryJson["ProductTimeEnd"] = $("#ProductTimeEnd").val();
- //queryJson["OneInTimeBegin"] = OneInTimebegin;
- //queryJson["OneInTimeEnd"] = OneInTimeend;
- //queryJson["ProductTimeBegin"] = ProductTimebegin;
- //queryJson["ProductTimeEnd"] = ProductTimeend;
- queryJson["Grade"] = $("#Grade").val();
- queryJson["ContGrpType"] = $("#ContGrpType").lrselectGet();
- queryJson["InvStateCode"] = $("#InvStateCode").lrselectGet();
- queryJson["WarehouseId"] = $("#WarehouseId").lrselectGet();
- queryJson["IsSurplus"] = $("#IsSurplus").lrselectGet();
- queryJson["IsRework"] = $("#IsRework").lrselectGet();
- queryJson["IsFast"] = $("#IsFast").lrselectGet();
- queryJson["IsFail"] = $("#IsFail").lrselectGet();
- queryJson["IsBack"] = $("#IsBack").lrselectGet();
- queryJson["ExecStateCode"] = $("#ExecStateCode").lrselectGet();
- queryJson["SetGrpCode"] = $("#SetGrpCode").val();
- queryJson["HWBarCode"] = $("#HWBarCode").val();
- queryJson["ContGrpBarCode"] = $("#ContGrpBarCode").val();
- queryJson["BomMatCode"] = $("#BomMatCode").val();
-
- page.search({ queryJson: JSON.stringify(queryJson) });
- }, 250);
- // 查询
- $('#btn_Search').on('click', function () {
- var keyword = $('#txt_Keyword').val();
-
- page.search({ queryJson: JSON.stringify({ keyword: keyword }) });
- });
- // 刷新
- $('#lr_refresh').on('click', function () {
- location.reload();
- });
- // 导出数据
- $('#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 query = $('#multiple_condition_query').lrGetFormData();
- // query["Btime"] = logbegin;
- // query["Etime"] = logend;
- // query["keyword"] = $('#txt_Keyword').val();
- // var queryJson = JSON.stringify(query);
- // if ($('#jfgrid_head_' + psuid).length == 0) {
- // learun.alert.warning('请任意展开一行子表');
- // return false;
- // }
- // learun.layerForm({
- // id: "ExcelExportColumn",
- // title: '导出Excel数据',
- // url: top.$.rootUrl + '/Utility/ExcelExportColumn?gridId=' + $('#gridtable').attr('id') + '&subgridId=' + psuid,
- // width: 600,
- // height: 480,
- // callBack: function (id) {
- // return top[id].acceptClick(function (data) {
- // learun.download({
- // method: "POST",
- // url: top.$.rootUrl + '/TaskManager/EquipmentTask_Dis/ExportExcel',
- // param: {
- // fileName: encodeURI("WCS历史任务"),
- // queryJson: queryJson,
- // exportField: JSON.stringify(data)
- // }
- // });
- // });
- // },
- // btn: ['导出Excel', '关闭']
- // });
- //});
- //导出
- $('#lr_exportall').on('click', function () {
- //var where = $("#queryWhere").val();
-
-
- var query = $('#multiple_condition_query').lrGetFormData();
- query["MatCode"] = $("#MatCode").val();
- query["MatName"] = $("#MatName").val();
- query["RFIDBarCode"] = $("#RFIDBarCode").val();
- query["InvBarCode"] = $("#InvBarCode").val();
- query["Tunnel"] = $("#Tunnel").val();
- query["Code"] = $("#Code").val();
- query["PutRow"] = $("#PutRow").val();
- query["PutCol"] = $("#PutCol").val();
- query["PutLayer"] = $("#PutLayer").val();
- query["OneInTimeBegin"] = OneInTimebegin;
- query["OneInTimeEnd"] = OneInTimeend;
- query["ProductTimeBegin"] = ProductTimebegin;
- query["ProductTimeEnd"] = ProductTimeend;
- query["Grade"] = $("#Grade").val();
- query["ContGrpType"] = $("#ContGrpType").lrselectGet();
- query["InvStateCode"] = $("#InvStateCode").lrselectGet();
- query["WarehouseId"] = $("#WarehouseId").lrselectGet();
- query["IsSurplus"] = $("#IsSurplus").lrselectGet();
- query["IsRework"] = $("#IsRework").lrselectGet();
- query["IsFast"] = $("#IsFast").lrselectGet();
- query["IsFail"] = $("#IsFail").lrselectGet();
- query["IsBack"] = $("#IsBack").lrselectGet();
- query["ExecStateCode"] = $("#ExecStateCode").lrselectGet();
- query["SetGrpCode"] = $("#SetGrpCode").val();
- query["HWBarCode"] = $("#HWBarCode").val();
- query["ContGrpBarCode"] = $("#ContGrpBarCode").val();
- query["BomMatCode"] = $("#BomMatCode").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: '/FJManager/Inventorys/ExportExcel',
- param: {
- fileName: "导出库存报表",
- queryJson: queryJson,
- exportField: JSON.stringify(data)
- }
- });
- });
- },
- btn: ['导出Excel', '关闭']
- });
- });
- $('#OneInTime').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) {
- OneInTimebegin = begin;
- OneInTimeend = end;
- }
- });
- $('#ProductTime').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) {
- ProductTimebegin = begin;
- ProductTimeend = end;
- }
- });
- $('#ContGrpType').lrselect({
- url: top.$.rootUrl + '/FJManager/Enums/GetContGrpTypeList',
- maxHeight: 180,
- allowSearch: false
- });
- $('#InvStateCode').lrselect({
- url: top.$.rootUrl + '/FJManager/Enums/GetInvStateList',
- maxHeight: 180,
- allowSearch: false
- });
- $('#WarehouseId').lrselect({
- url: top.$.rootUrl + '/FJManager/BaseWarehouse/GetSelectWarehouseNameList',
- maxHeight: 180,
- allowSearch: false
- });
- $('#ExecStateCode').lrselect({
- url: top.$.rootUrl + '/FJManager/Enums/InvLockStateList',
- maxHeight: 60,
- allowSearch: false
- });
- $('#IsSurplus').lrselect({
- url: top.$.rootUrl + '/FJManager/Enums/YesNoList',
- maxHeight: 60,
- allowSearch: false
- });
- $('#IsRework').lrselect({
- url: top.$.rootUrl + '/FJManager/Enums/YesNoList',
- maxHeight: 60,
- allowSearch: false
- });
- $('#IsFast').lrselect({
- url: top.$.rootUrl + '/FJManager/Enums/YesNoList',
- maxHeight: 60,
- allowSearch: false
- });
- $('#IsFail').lrselect({
- url: top.$.rootUrl + '/FJManager/Enums/YesNoList',
- maxHeight: 60,
- allowSearch: false
- });
- $('#IsBack').lrselect({
- url: top.$.rootUrl + '/FJManager/Enums/YesNoList',
- maxHeight: 60,
- allowSearch: false
- });
-
- $('#lr_delete').on('click', function () {
- selectRowsData = $('#gridtable').jfGridGet("rowdata");
- if (selectRowsData.length == 0) {
- learun.alert.error('未选择行!');
- return false;
- }
- if (selectRowsData.length > 10) {
- learun.alert.error('您选择的数据太多,请选择小于10条数据!');
- return false;
- }
- var keyValue = selectRowsData.map((item) => item.Id);
- //var keyValue = $('#gridtable').jfGridValue('Id');
- if (learun.checkrow(keyValue)) {
- learun.layerConfirm('是否确认删除该项!', function (res,index) {
- if (res) {
- learun.deleteForm(top.$.rootUrl + '/FJManager/Inventorys/Deletes', { keyValue: keyValue }, function () {
- refreshGirdData();
- });
- }
- top.layer.close(index);
- });
- }
-
- });
- // 异常托处理
- $('#lr_SetGrp').on('click', function () {
- var keyValue = {};
- selectedRow = {};
- learun.layerForm({
- id: 'form',
- title: '异常托处理',
- url: top.$.rootUrl + '/FJManager/Inventorys/SetGrpForm',
- height: 400,
- width: 800,
- callBack: function (id) {
- return top[id].acceptClick(refreshGirdData);
- }
- });
- });
- },
- // 初始化列表
- initGird: function () {
- $('#gridtable').jfGrid({
- url: top.$.rootUrl + '/FJManager/Inventorys/GetPageList',
- headData: [
- { label: "仓库", name: "WarehouseName", width: 120, align: "left" },
- { label: "条码", name: "HWBarCode", width: 110, align: "left" },
- { label: "容器条码", name: "ContGrpBarCode", width: 120, align: "left" },
- {
- label: "库存类型", name: "ContGrpTypeName", width: 60, align: "left", sortname: "ContGrpType", formatter: function (cellvalue) {
- if (cellvalue == '物料盘') {
- return '<span class=\"label label-success\" >物料盘</span>';
- } else if (cellvalue == '空盘') {
- return '<span class=\"label label-default\" >空盘</span>';
- } else {
- return '<span class=\"label label-default\" >未知</span>';
- }
- }
- },
- { label: "材料号", name: "InvBarCode", width: 110, align: "left" },
- { label: "库存状态", name: "InvStateName", width: 80, align: "left", sortname: "InvStateCode" },
- { label: "巷道", name: "Tunnel", width: 50, align: "left" },
- { label: "货位号", name: "Code", width: 100, align: "left" },
- {
- label: "货位状态", name: "CellState", width: 80, align: "left"
- , formatter: function (cellvalue) {
- if (cellvalue == 0) {
- return '<span class=\"label label-success\" >启用</span>';
- } else {
- return '<span class=\"label label-default\" >禁用</span>';
- }
- }
- },
- { label: "行", name: "PutRow", width: 40, align: "left" },
- { label: "列", name: "PutCol", width: 40, align: "left" },
- { label: "层", name: "PutLayer", width: 40, align: "left" },
- { label: "首次入库时间", name: "OneInTime", width: 130, align: "left" },
- learun.jfFormatter.col_Date("生产时间", "ProductTime"),
- { label: "物料编码", name: "MatCode", width: 110, align: "left" },
- { label: "物料名称", name: "MatName", width: 160, align: "left" },
- { label: "配方编码", name: "BomMatCode", width: 110, align: "left" },
- { label: "配方名称", name: "BomMatName", width: 160, align: "left" },
- { label: "垛型编码", name: "SetGrpCode", width: 150, align: "left" },
- { label: "总重量", name: "TolWQty", width: 80, align: "left" },
- { label: "净重", name: "NetWQty", width: 80, align: "left" },
- { label: "皮重", name: "TareWQty", width: 80, align: "left" },
- { label: "长度", name: "LengthQty", width: 80, align: "left" },
- /* { label: "RFID编号", name: "RFIDBarCode", width: 80, align: "left" },*/
- { label: "工字轮类型", name: "HWTypeCode", width: 80, align: "left" },
- {
- label: "是否余料", name: "IsSurplus", width: 80, align: "left"
- , formatter: function (cellvalue) {
- if (cellvalue == true) {
- return '<span class=\"label label-success\" >是</span>';
- } else {
- return '<span class=\"label label-default\" >否</span>';
- }
- }
- },
- {
- label: "是否退料", name: "IsBack", width: 80, align: "left"
- , formatter: function (cellvalue) {
- if (cellvalue == true) {
- return '<span class=\"label label-success\" >是</span>';
- } else {
- return '<span class=\"label label-default\" >否</span>';
- }
- }
- },
- {
- label: "返工标记", name: "IsRework", width: 80, align: "left", formatter: function (cellvalue) {
- if (cellvalue == true) {
- return '<span class=\"label label-success\" >是</span>';
- } else {
- return '<span class=\"label label-default\" >否</span>';
- }
- }
- },
- {
- label: "快投标记", name: "IsFast", width: 80, align: "left", formatter: function (cellvalue) {
- if (cellvalue == true) {
- return '<span class=\"label label-success\" >是</span>';
- } else {
- return '<span class=\"label label-default\" >否</span>';
- }
- }
- },
- {
- label: "是否异常", name: "IsFail", width: 80, align: "left", formatter: function (cellvalue) {
- if (cellvalue == true) {
- return '<span class=\"label label-success\" >是</span>';
- } else {
- return '<span class=\"label label-default\" >否</span>';
- }
- }
- },
- {
- label: "是否锁定", name: "ExecStateCode", width: 80, align: "left"
- , formatter: function (cellvalue) {
- if (cellvalue == "InvState_Normal") {
- return '<span class=\"label label-default\" >否</span>';
- } else {
- return '<span class=\"label label-success\" >是</span>';
- }
- }
- },
- { label: "异常原因", name: "FailReason", width: 80, align: "left" },
- { label: "等级", name: "Grade", width: 80, align: "left" },
- { label: "退料原因", name: "BackReason", width: 80, align: "left" },
- { label: "工序订单号", name: "ProcessDocsCode", width: 120, align: "left" },
- { label: "生产机台号", name: "ProductMachCode", width: 80, align: "left" },
- { label: "产线编号", name: "ProductLineNo", width: 80, align: "left" },
- { label: "入库单号", name: "InDocsNo", width: 120, align: "left" },
- { label: "入库单行号", name: "InDocsRowNo", width: 120, align: "left" },
- { label: "创建时间", name: "AddTime", width: 130, align: "left" },
- { label: "更新时间", name: "EditTime", width: 130, 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();
- }
|