var refreshGirdData;
var bootstrap = function ($, learun) {
"use strict";
var selectRowsData;
var psuid = "";
var stampType = request('stamptype');
var urls = [{ "url": "/FJManager/BillBomSet/DFM1509", "name": "DFM1509", "width": 744, "height": 690 },
{ "url": "/FJManager/BillBomSet/DOF2", "name": "DOF2", "width": 920, "height": 676 },
{ "url": "/FJManager/BillBomSet/DOF4", "name": "DOF4", "width": 920, "height": 676 },
{ "url": "/FJManager/BillBomSet/DFM6", "name": "DFM6", "width": 920, "height": 676 },
{ "url": "/FJManager/BillBomSet/DFM09", "name": "DFM9", "width": 940, "height": 676 },
{ "url": "/FJManager/BillBomSet/Exception", "name": "Exception", "width": 920, "height": 676 },
{ "url": "/FJManager/BillBomSet/DFMAll", "name": "DFMAll", "width": 920, "height": 676 },];
var page = {
init: function () {
page.bind();
page.initGird();
},
bind: function () {
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
// 调用后台查询
// queryJson 查询条件
console.log(queryJson);
queryJson["Code"] = $("#Code").val();
queryJson["Name"] = $("#Name").val();
queryJson["ShortCode"] = $("#ShortCode").val();
queryJson["ProMaterCode"] = $("#ProMaterCode").val();
queryJson["BomCode"] = $("#BomCode").val();
if ($("#IsStop").is(":checked")) {
queryJson["IsStop"] = '1';
} else {
queryJson["IsStop"] = '';
}
queryJson["StampType"] = stampType;
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(), StampType: stampType }) });
});
// 刷新
$('#lr_refresh').on('click', function () {
location.reload();
});
// 新增
$('#lr_add').on('click', function () {
learun.layerForm({
id: 'form',
title: '新增' + urls[parseInt(stampType) - 1].name,
url: top.$.rootUrl + urls[parseInt(stampType) - 1].url,
width: urls[parseInt(stampType) - 1].width,
height: urls[parseInt(stampType) - 1].height,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
});
// 编辑
$('#lr_edit').on('click', function () {
let editSelRows = $('#gridtable').jfGridGet("rowdata");
if (editSelRows.length == 0) {
learun.alert.error('未选择行!');
return false;
}
if (editSelRows.length > 1) {
learun.alert.error('选择了多行!');
return false;
}
var keyValue = $('#gridtable').jfGridValue('Id');
if (learun.checkrow(keyValue)) {
learun.layerForm({
id: 'form',
title: '编辑' + urls[parseInt(stampType) - 1].name,
url: top.$.rootUrl + urls[parseInt(stampType) - 1].url + '?keyValue=' + keyValue,
width: urls[parseInt(stampType) - 1].width,
height: urls[parseInt(stampType) - 1].height,
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
});
}
});
$("#lr_search").on('click', function () {
let editSelRows = $('#gridtable').jfGridGet("rowdata");
if (editSelRows.length == 0) {
learun.alert.error('未选择行!');
return false;
}
if (editSelRows.length > 1) {
learun.alert.error('选择了多行!');
return false;
}
var keyValue = $('#gridtable').jfGridValue('Id');
if (learun.checkrow(keyValue)) {
learun.layerForm({
id: 'form',
title: '查看' + urls[parseInt(stampType) - 1].name,
btn: ['关闭'],
url: top.$.rootUrl + urls[parseInt(stampType) - 1].url + '?keyValue=' + keyValue,
width: urls[parseInt(stampType) - 1].width,
height: urls[parseInt(stampType) - 1].height,
callBack: function (id) {
return true;
//return top[id].acceptClick(refreshGirdData);
}
});
}
});
// 删除
$('#lr_delete').on('click', function () {
selectRowsData = $('#gridtable').jfGridGet("rowdata");
if (selectRowsData.length == 0) {
learun.alert.error('未选择行!');
return false;
}
var keyValue = selectRowsData.map((item) => item.Id);
//var keyValue = $('#gridtable').jfGridValue('Id');
if (learun.checkrow(keyValue)) {
learun.layerConfirm('是否确认删除该项!', function (res) {
if (res) {
learun.deleteForm(top.$.rootUrl + '/FJManager/BillBomSet/Deletes', { keyValue: keyValue }, function () {
refreshGirdData();
});
}
});
}
});
// 启用
$('#lr_enable').on('click', function () {
var postData = $('#gridtable').jfGridGet("rowdata");
if (postData.length == 0) {
learun.alert.error('未选择行!');
return false;
}
if (postData.length > 1) {
learun.alert.error('启用只能选择一条数据!');
return false;
}
learun.layerConfirm('是否确认启用该跺型!', function (res) {
if (res) {
learun.postForm(top.$.rootUrl + '/FJManager/BillBomSet/Enables', { 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 + '/FJManager/BillBomSet/Disables', { ids: JSON.stringify(postData.map((item) => item.Id)) }, function () {
refreshGirdData();
});
}
});
});
// 打印
$('#lr_print').on('click', function () {
$('#gridtable').jqprintTable();
});
},
// 初始化列表
initGird: function () {
$('#gridtable').jfGrid({
url: top.$.rootUrl + '/FJManager/BillBomSet/GetPageList',
headData: [
{ label: '垛型编码', name: 'Code', width: 160, align: 'left' },
{ label: '垛型名称', name: 'Name', width: 160, align: 'left' },
{ label: '短编号', name: 'ShortCode', width: 50, align: 'left' },
{ label: '帘线物料编码', name: 'ProMaterCode', width: 100, align: 'left' },
{ label: '投料物料编码', name: 'ProCode', width: 180, align: 'left' },
{ label: '实际物料编码', name: 'BomCode', width: 180, align: 'left' },
//{
// label: '投料物料名称', name: 'BomCode', width: 180, align: 'left', formatterAsync: function (callback, value, row) {
// learun.httpAsync('GET', top.$.rootUrl + '/FJManager/BillBomInfo/GetList', { queryJson: JSON.stringify({ Code: value }) }, function (res) {
// if (res.code > 0 && res.data.length > 0) {
// callback(res.data[0].Name);
// }
// });
// },
//},
{ label: '工字轮个数', name: 'HWCountQty', width: 70, align: 'left' },
{
label: '托盘类型', name: 'TpTypeCode', width: 60, align: 'left', formatter: function (cellvalue) {
if (cellvalue == '1') {
return '09';
} else if (cellvalue == '2') {
return '非09';
} else {
return '未知';
}
}
},
{ label: '层数', name: 'LayerCountQty', width: 40, align: 'left' },
learun.jfFormatter.col_ISSTOP(),
//{
// label: '是否删除', name: 'IsDelete', width: 60, align: "center"
// , formatter: function (cellvalue) {
// if (cellvalue == 0) {
// return '正常';
// } else if (cellvalue == 1) {
// return '删除';
// } else {
// return '未知';
// }
// }
//},
{
label: '子类型', name: 'StampChildType', width: 120, align: 'left', formatter: function (cellvalue, item) {
if (item.StampType == '2') {
if (cellvalue == '1') {
return 'DOF2-01';
} else if (cellvalue == '2') {
return 'DOF2-02';
} else if (cellvalue == '3') {
return 'DOF2-03';
} else if (cellvalue == '4') {
return 'DOF2-04';
} else if (cellvalue == '5') {
return 'DOF2-05';
}
}
if (item.StampType == '3') {
if (cellvalue == '1') {
return 'DOF4-01';
} else if (cellvalue == '2') {
return 'DOF4-02';
} else if (cellvalue == '3') {
return 'DOF4-03';
} else if (cellvalue == '4') {
return 'DOF4-04';
} else if (cellvalue == '5') {
return 'DOF4-05';
} else if (cellvalue == '6') {
return 'DOF4-06';
} else if (cellvalue == '7') {
return 'DOF4-07';
}
}
else if (item.StampType == '4') {
if (cellvalue == '1') {
return 'DFM6-01';
} else if (cellvalue == '2') {
return 'DFM6-02';
} else if (cellvalue == '3') {
return 'DFM6-03';
} else if (cellvalue == '4') {
return 'DFM6-04';
} else if (cellvalue == '5') {
return 'DFM6-05';
} else if (cellvalue == '6') {
return 'DFM6-06';
} else if (cellvalue == '7') {
return 'DFM6-07';
} else if (cellvalue == '8') {
return 'DFM6-08';
} else if (cellvalue == '9') {
return 'DFM6-09';
}
} else if (item.StampType == '5') {
if (cellvalue == '1') {
return 'DFM9-01';
} else if (cellvalue == '2') {
return 'DFM9-02';
} else if (cellvalue == '3') {
return 'DFM9-03';
} else if (cellvalue == '4') {
return 'DFM9-04';
} else if (cellvalue == '5') {
return 'DFM9-05';
} else if (cellvalue == '6') {
return 'DFM9-06';
} else if (cellvalue == '7') {
return 'DFM9-07';
} else if (cellvalue == '8') {
return 'DFM9-08';
} else if (cellvalue == '9') {
return 'DFM9-09';
}
}
else if (item.StampType == '6') {
if (cellvalue == '1') {
return 'WS34芯股--异常';
} else if (cellvalue == '2') {
return 'WS18--异常';
} else if (cellvalue == '3') {
return 'WS50--异常';
} else if (cellvalue == '4') {
return 'WS09--异常';
}
}
else {
return '无';
}
}
},
{
label: '是否桁架码垛', name: 'IsTruss', width: 80, align: 'left', formatter: function (cellvalue) {
if (cellvalue==1) {
return '是';
} else if (cellvalue==='') {
return '未知';
} else if (cellvalue === 0) {
return '否';
} else {
return '未知';
}
}
},
learun.jfFormatter.col_AddWho(),
learun.jfFormatter.col_AddTime(),
learun.jfFormatter.col_EditWho(),
learun.jfFormatter.col_EditTime(),
learun.jfFormatter.col_MEMO()
],
mainId: 'Code',
isPage: true,
isMultiselect: true,
reloadSelected: true,
sidx: 'Code',
isSubGrid: true, // 是否有子表
subGridExpanded: function (subid, rowdata) {
psuid = subid;
$('#' + subid).jfGrid({
url: top.$.rootUrl + '/FJManager/BillBomSet/GetBillBomSetInfoItem',
headData: [
{ label: '编号', name: 'XYNo', width: 40, align: 'left' },
{ label: '行', name: 'Row', width: 40, align: 'left' },
{ label: '物料编码', name: 'MatCode', width: 200, align: 'left' },
{ label: '物料Id', name: 'MatId', width: 150, align: 'left' },
{
label: '有/无', name: 'IsEmpty', width: 60, align: 'left', formatter: function (cellvalue) {
if (cellvalue == '0') {
return '有';
} else if (cellvalue == '1') {
return '无';
} else {
return '未知';
}
}
},
{
label: '正/反面', name: 'SideNum', width: 70, align: 'left', formatter: function (cellvalue) {
if (cellvalue == '1') {
return '正面朝上';
} else if (cellvalue == '2') {
return '反面朝上';
} else {
return '未知';
}
}
},
{ label: '工字轮型号', name: 'SpoolType', width: 80, align: 'left' },
{
label: '单/双丝', name: 'SilkType', width: 80, align: 'left', formatter: function (cellvalue) {
if (cellvalue == '1') {
return '单丝';
} else if (cellvalue == '2') {
return '双丝';
} else if (cellvalue == '3') {
return '三丝';
}
else {
return '未知';
}
}
},
{ label: '钢丝直径上限', name: 'SilkDiam', width: 100, align: 'left' },
/* { label: '钢丝直径上限', name: 'SilkDiamMaxCount', width: 100, align: 'left' },*/
{ label: '数量上限', name: 'QtyMaxCount', width: 100, align: 'left' },
{
label: '是否芯股', name: 'IsCore', width: 100, align: 'left', formatter: function (cellvalue) {
if (cellvalue == '1') {
return '是';
} else if (cellvalue == '2') {
return '否';
}
else {
return '未知';
}
}
},
{
label: '是混合行', name: 'IsMixRow', width: 100, align: 'left', formatter: function (cellvalue) {
if (cellvalue == '1') {
return '是';
} else if (cellvalue == '0') {
return '否';
}
else {
return '未知';
}
}
},
{ label: '混合料行编码', name: 'MixRowCode', width: 100, align: 'left' },
learun.jfFormatter.col_ISSTOP(),
]
});
$('#' + subid).jfGridSet('reloadSon', { bomSetHdrId: rowdata.Id });
},
});
page.search({ queryJson: JSON.stringify({ keyword: $('#txt_Keyword').val(), StampType: stampType }) });
},
search: function (param) {
$('#gridtable').jfGridSet('reload', param);
}
};
refreshGirdData = function () {
$('#gridtable').jfGridSet('reload');
};
page.init();
}