/*
* 描 述:订单
*/
var refreshGirdData; // 更新数据
var typnum = request('ordertype');
var keyValue = request('keyValue');
var logbegin = '';
var logend = '';
var selectedRow;
var bootstrap = function ($, learun) {
"use strict";
var page = {
init: function () {
page.initGrid();
page.bind();
},
bind: function () {
// 查询
$('#btn_Search').on('click', function () {
page.search({ ordertypenum: typnum, queryJson: JSON.stringify({ Btime: logbegin, Etime: logend, keyword: $('#txt_Keyword').val() }) });
});
// 刷新
$('#lr_refresh').on('click', function () {
location.reload();
});
// 自动生成出库
$('#lr_autoCreateOutTask').on('click', function () {
var stockData = '';
var stockDataTmp = $('#gridtable').jfGridGet('rowdata');
for (var i = 0, l = stockDataTmp.length; i < l; i++) {
if (stockData.length == 0) {
stockData = stockDataTmp[i].F_ROWNO;
} else {
stockData = stockData + ',' + stockDataTmp[i].F_ROWNO;
}
};
if (learun.checkrow(keyValue)) {
learun.layerConfirm('是否确认对选中项自动生成出库!', function (res) {
if (res) {
learun.postForm(top.$.rootUrl + '/OrderManager/Order/AutoCreateOrderDtlOutTask', { keyValue: stockData }, function () {
refreshGirdData();
});
}
});
}
});
// 手动选择出库
//$('#lr_manualCreateOutTask').on('click', function () {
// selectedRow = null;
// var stockData = '';
// var stockDataTmp = $('#gridtable').jfGridGet('rowdata');
// if (stockDataTmp.length > 1) {
// var msg = "[手动选择货位]只能选中一项操作!";
// learun.alert.info(msg);
// //learun.alert.warning(text);
// }
// else {
// if ($.isEmptyObject(stockDataTmp) == false) {
// stockData = stockDataTmp[0].F_ROWNO;
// }
// if (learun.checkrow(stockData)) {
// learun.layerForm({
// id: 'lrgridlayerform',
// title: '手动选择货位出库',
// url: top.$.rootUrl + '/OrderManager/Order/ManualChoiceCellOut?keyValue=' + stockData,
// width: 1600,
// height: 800,
// btn: ['生成出库任务', '关闭'],
// callBack: function (id) {
// return top[id].acceptClick(refreshGirdData);
// }
// });
// }
// }
//});
// 查询任务
//$('#lr_queryTask').on('click', function () {
// selectedRow = null;
// var stockData = '';
// var stockDataTmp = $('#gridtable').jfGridGet('rowdata');
// if (stockDataTmp.length > 1) {
// var msg = "[查询任务]只能选中一项操作!";
// learun.alert.info(msg);
// //learun.alert.warning(text);
// }
// else {
// if ($.isEmptyObject(stockDataTmp) == false) {
// stockData = stockDataTmp[0].F_ROWNO;
// }
// if (learun.checkrow(stockData)) {
// learun.layerForm({
// id: 'lrgridlayerform',
// title: '查询任务',
// url: top.$.rootUrl + '/OrderManager/Order/QueryCellOutTask?keyValue=' + stockData,
// width: 1400,
// height: 800,
// btn: ['关闭'],
// //callBack: function (id) {
// // return top[id].acceptClick(refreshGirdData);
// //}
// });
// }
// }
//});
},
initGrid: function () {
$('#gridtable').jfGrid({
url: top.$.rootUrl + '/OrderManager/Order/GetOrderDtlItem',
headData: [
{
label: '操作', name: 'F_ROWNO', width: 120, align: "center",
formatterAsync: function (value, row, op, $cell) {
$cell.on('click', function () {
learun.layerForm({
id: 'lrgridlayerform1',
title: '任务管理',
url: top.$.rootUrl + '/OrderManager/Order/QueryCellOutTask?keyValue=' + row.F_ROWNO,
width: 1400,
height: 800,
btn: ['关闭'],
//callBack: function (id) {
// return top[id].acceptClick(refreshGirdData);
//}
});
return false;
});
//return ' 手动选择货位';
return ' 任务管理';
}
},
{
label: '操作', name: 'F_ROWNO', width: 120, align: "center",
formatterAsync: function (value, row, op, $cell) {
$cell.on('click', function () {
learun.layerForm({
id: 'lrgridlayerform2',
title: '手动选择货位出库',
url: top.$.rootUrl + '/OrderManager/Order/ManualChoiceCellOut?keyValue=' + row.F_ROWNO,
width: 1600,
height: 800,
btn: ['生成出库任务', '关闭'],
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
return false;
});
//return ' 手动选择货位';
return ' 手动选择货位';
}
},
{ label: '物料编号', name: 'F_MATNO', width: 160, align: "left" },
{ label: '物料名称', name: 'F_MATNAME', width: 200, align: "left" },
{ label: '计划量', name: 'F_FQTY', width: 100, align: "left" },
{ label: '已分配量', name: 'F_AQTY', width: 100, align: "left" },
{ label: '未分配量', name: 'F_LQTY', width: 100, align: "left" },
{ label: '单位编号', name: 'F_UNITNO', width: 80, align: "left" },
{ label: '单位名称', name: 'F_UNITNAME', width: 80, align: "left" },
{ label: '已扫描入库量', name: 'F_CQTY', width: 100, align: "left" },
{
label: '物料类型', name: 'F_MATTYPENUM', width: 80, align: "center"
, formatterAsync: function (callback, value, row) {
learun.clientdata.getAsync('dataItem', {
Rowkey: value,
GrpCode: 'EMatType',
getType: 'Num',
callback: function (item) {
callback(item.F_NAME);
}
});
}
},
{
label: '物料状态', name: 'F_MATSTATENUM', width: 80, align: "center"
, formatterAsync: function (callback, value, row) {
learun.clientdata.getAsync('dataItem', {
Rowkey: value,
GrpCode: 'EMatState',
getType: 'Num',
callback: function (item) {
callback(item.F_NAME);
}
});
}
},
{ label: '移动类型', name: 'F_MOVETYPE', width: 80, align: "left" },
{ label: '物料条码', name: 'F_MATBARCODE', width: 120, align: "left" },
{ label: '批次号', name: 'F_BATCHNO', width: 200, align: "left" },
{ label: '版本号', name: 'F_VERSION', width: 80, align: "left" },
{ label: '档位', name: 'F_GEAR', width: 80, align: "left" },
{ label: '上传量', name: 'F_UQTY', width: 100, align: "left" },
{ label: 'mes使用', name: 'F_SQTY', width: 100, align: "left" },
{ label: '工位编号', name: 'F_WORKPOSNO', width: 100, align: "left" },
{ label: '工位名称', name: 'F_WORKPOSNAME', width: 100, align: "left" },
{ label: 'AGV站点', name: 'F_AGVWORK', width: 100, align: "left" },
{ label: '产线编号', name: 'F_PROLINENO', width: 100, align: "left" },
{ label: '产线名称', name: 'F_PROLINENAME', width: 100, align: "left" },
{ label: '备注', name: 'F_MEMO', width: 200, align: "left" },
{ label: '创建用户编号', name: 'F_ADDUSERNO', width: 100, align: "left" },
{ label: '创建时间', name: 'F_ADDTIME', width: 200, align: "left" },
{ label: '编辑用户编号', name: 'F_EDITUSERNO', width: 100, align: "left" },
{ label: '编辑时间', name: 'F_EDITTIME', width: 200, align: "left" },
{ label: '生产工单', name: 'F_DEFINE01', width: 200, align: "left" },
{ label: '生产工单ID', name: 'F_DEFINE02', width: 200, align: "left" },
{ label: '成品编号', name: 'F_DEFINE03', width: 200, align: "left" },
{ label: '包装方式', name: 'F_PACKMETHOD', width: 200, align: "left" },
{ label: '成本中心', name: 'F_COST', width: 200, align: "left" }
],
isShowNum: false,
mainId: 'F_ROWNO',
isPage: true,
reloadSelected: true,
isMultiselect: true,
sidx: 'F_MATNO',
//isEdit: true,
});
$('#orderno').text(keyValue);
page.search({ OrderNo: keyValue });
},
search: function (param) {
$('#gridtable').jfGridSet('reload', param);
}
};
// 保存数据后回调刷新
refreshGirdData = function () {
page.search();
}
page.init();
}