var refreshGirdData;
var OneInTimebegin = '';
var OneInTimeend = '';
var ProductTimebegin = '';
var ProductTimeend = '';
var logbegin = '';
var logend = '';
var selectRowsData;
var BusType = '0';
var bootstrap = function ($, learun) {
"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["WarehouseId"] = $("#WarehouseId").lrselectGet();
queryJson["InvStateCode"] = 3;
queryJson["IsManualOut"] = '1';
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();
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(), InvStateCode: 3, IsManualOut:'1' }) });
});
// 刷新
$('#lr_refresh').on('click', function () {
location.reload();
});
// 手动出库
$('#lr_edit').on('click', function () {
selectRowsData = $('#gridtable').jfGridGet("rowdata");
if (selectRowsData.length == 0) {
learun.alert.error('未选择行!');
return false;
}
if (selectRowsData.filter(o => o.WarehouseTypeNum == 4).length > 0) {
learun.alert.error('环形库不能手动出库!');
return false;
}
if (selectRowsData.filter(o => o.WarehouseName != selectRowsData[0].WarehouseName ).length > 0) {
learun.alert.error('请选择同一个仓库的数据手动出库!');
return false;
}
BusType = '1';
learun.layerForm({
id: 'form',
title: '手动出库',
url: top.$.rootUrl + '/FJManager/Inventorys/Form',
width: 450,
height: 300,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
});
$('#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/GetSelectWarehouseNameListByType?typenum=1',
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
});
},
// 初始化列表
initGird: function () {
$('#gridtable').jfGrid({
url: top.$.rootUrl + '/FJManager/Inventorys/GetPageList',
headData: [
{ label: "仓库", name: "WarehouseName", width: 120, align: "left" },
{ label: "容器条码", name: "ContGrpBarCode", width: 120, align: "left" },
{
label: "库存类型", name: "ContGrpType", width: 60, align: "left", formatter: function (cellvalue) {
if (cellvalue == 1) {
return '物料盘';
} else if (cellvalue == 2) {
return '空盘';
} else {
return '未知';
}
}
},
{ 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 '启用';
} else {
return '禁用';
}
}
},
{ 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" },
{ label: "生产时间", name: "ProductTime", width: 130, align: "left" },
{ label: "物料编码", name: "MatCode", width: 80, 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: 70, align: "left"
, formatter: function (cellvalue) {
if (cellvalue == true) {
return '是';
} else {
return '否';
}
}
},
{
label: "是否退料", name: "IsBack", width: 70, align: "left"
, formatter: function (cellvalue) {
if (cellvalue == true) {
return '是';
} else {
return '否';
}
}
},
{
label: "是否锁定", name: "ExecStateCode", width: 80, align: "left"
, formatter: function (cellvalue) {
if (cellvalue == "InvState_Normal") {
return '否';
} else {
return '是';
}
}
},
{
label: "返工标记", name: "IsRework", width: 60, align: "left", formatter: function (cellvalue) {
if (cellvalue == true) {
return '是';
} else {
return '否';
}
}
},
{
label: "快投标记", name: "IsFast", width: 60, align: "left", formatter: function (cellvalue) {
if (cellvalue == true) {
return '是';
} else {
return '否';
}
}
},
{
label: "是否异常", name: "IsFail", width: 60, align: "left", formatter: function (cellvalue) {
if (cellvalue == true) {
return '是';
} else {
return '否';
}
}
},
{ 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: 150, align: "left" },
{ label: "更新时间", name: "EditTime", width: 150, 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(), InvStateCode: 3, IsManualOut: '1' }) });
},
search: function (param) {
param = param || { queryJson: JSON.stringify({ InvStateCode: 3, IsManualOut: '1' }) };
$('#gridtable').jfGridSet('reload', param);
}
};
refreshGirdData = function () {
page.search();
};
page.init();
}