You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
328 lines
13 KiB
328 lines
13 KiB
@{
|
|
ViewBag.Title = "Index";
|
|
Layout = "~/Views/Shared/_Index.cshtml";
|
|
}
|
|
<script>
|
|
debugger;
|
|
//var Type = $.request("Type");
|
|
var ColModelMain = [];
|
|
var ColModelSub = [];
|
|
var _Clos = new Array();
|
|
$(function () {
|
|
SetCols();
|
|
gridList();
|
|
})
|
|
|
|
function SetCols() {
|
|
$.ajax({
|
|
url: "/Print/SelectColumnName?" + Math.random(),
|
|
dataType: "json",
|
|
async: false,
|
|
success: function (data) {
|
|
var cols = new Array();
|
|
|
|
var collast = { label: "主键", name: "ID", hidden: true, frozen: true };
|
|
cols.push(collast);
|
|
var collast = {
|
|
label: "类型", name: "DABDOCType", width: 60, align: "left",
|
|
formatter: function (cellvalue) {
|
|
if (cellvalue == "1") {
|
|
return "套件";
|
|
} else if (cellvalue == "2") {
|
|
return "散件";
|
|
}
|
|
else { return ""; }
|
|
}
|
|
};
|
|
cols.push(collast);
|
|
var collast = { label: '拆卸单号', name: 'Code', width: 120, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: '数量', name: 'Qty', width: 150, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: '料品编码', name: 'InvCode', width: 150, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: '料品名称', name: 'InvName', width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: '仓库代码', name: 'WHCode', width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: '是否选择', name: 'isInput', width: 150, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: '是否生成', name: 'isCreate', width: 150, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: '自由项ID', name: 'ExtensionID', hidden: true };
|
|
cols.push(collast);
|
|
|
|
if (data != null && data.length > 0) {
|
|
DateList = data;
|
|
for (var i = 0; i < data.length; i++) {
|
|
var ColName = data[i].ColName;
|
|
var ColCode = data[i].ColCode;
|
|
var obj = new Array();
|
|
obj = {
|
|
label: ColName,
|
|
name: ColCode,
|
|
width: 80,
|
|
align: "left"
|
|
}
|
|
cols.push(obj);
|
|
}
|
|
}
|
|
_Clos = cols;
|
|
}
|
|
});
|
|
}
|
|
|
|
function gridList() {
|
|
var $gridList = $("#gridList");
|
|
var queryJson = {
|
|
DABDOCCode: $("#txt_DABDOCCode").val(),
|
|
}
|
|
$gridList.dataGrid({
|
|
url: "/WMS/ICSDisassemblyDoc/GetGridJson" + "?" + Math.random(),
|
|
postData: { queryJson: JSON.stringify(queryJson) },
|
|
height: $(window).height() - 200,
|
|
width: $(window).width() - 300,
|
|
colModel: _Clos,
|
|
//colModel: [
|
|
// { label: "主键", name: "ID", hidden: true, key: true },
|
|
// {
|
|
// label: "类型", name: "DABDOCType", width: 60, align: "left",
|
|
// formatter: function (cellvalue) {
|
|
// if (cellvalue == "1") {
|
|
// return "套件";
|
|
// } else if (cellvalue == "2") {
|
|
// return "散件";
|
|
// }
|
|
// else { return ""; }
|
|
// }
|
|
// },
|
|
// { label: '拆卸单号', name: 'Code', width: 120, align: 'left' },
|
|
// { label: '数量', name: 'Qty', width: 150, align: 'left' },
|
|
// { label: '料品编码', name: 'InvCode', width: 150, align: 'left' },
|
|
// { label: '料品名称', name: 'InvName', width: 100, align: 'left' },
|
|
// { label: '仓库代码', name: 'WHCode', width: 100, align: 'left' },
|
|
// { label: '批次', name: 'BatchCode', width: 150, align: 'left' },
|
|
// { label: '是否选择', name: 'isInput', width: 150, align: 'left' },
|
|
// { label: '是否生成', name: 'isCreate', width: 150, align: 'left' },
|
|
//],
|
|
width: "100%",
|
|
autowidth: true,
|
|
gridComplete: function () {
|
|
},
|
|
pager: "#gridPager",
|
|
sortname: 'Code',
|
|
sortorder: "desc",
|
|
viewrecords: true,
|
|
multiselect: true,
|
|
beforeSelectRow: function (rowid, e) {
|
|
$("#gridList").jqGrid('resetSelection');
|
|
return (true);
|
|
},
|
|
subGrid: true, // (1)开启子表格支持
|
|
subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
|
|
$("#gridList").jqGrid("setSelection", rowid, false);
|
|
bindSubGrid(subgrid_id, rowid)
|
|
}
|
|
});
|
|
|
|
$("#warehouse a.btn-default").click(function () {
|
|
$("#warehouse a.btn-default").removeClass("active");
|
|
$(this).addClass("active");
|
|
$('#btn_search').trigger("click");
|
|
});
|
|
$("#btn_search").click(function () {
|
|
var warehouse = $("#warehouse a.active").attr('data-value');
|
|
var queryJson = {
|
|
DABDOCCode: $("#txt_DABDOCCode").val(),
|
|
}
|
|
$gridList.jqGrid('setGridParam', {
|
|
postData: { queryJson: JSON.stringify(queryJson) },
|
|
}).trigger('reloadGrid');
|
|
});
|
|
|
|
}
|
|
|
|
function bindSubGrid(subgrid_id, rowid) {
|
|
debugger;
|
|
$("#gridList").jqGrid("setSelection", rowid, false);
|
|
var subgrid_table_id;
|
|
subgrid_table_id = subgrid_id + "_t"; // (3)根据subgrid_id定义对应的子表格的table的id
|
|
|
|
var subgrid_pager_id;
|
|
subgrid_pager_id = subgrid_id + "_pgr" // (4)根据subgrid_id定义对应的子表格的pager的id
|
|
|
|
// (5)动态添加子报表的table和pager
|
|
$("#" + subgrid_id).html("<table id='" + subgrid_table_id + "' class='scroll'></table><div id='" + subgrid_pager_id + "' class='scroll'></div>");
|
|
var Code = $("#gridList").jqGrid('getRowData', rowid).Code;
|
|
//var Sequence = $("#gridList").jqGrid('getRowData', rowid).Sequence;
|
|
// (6)创建jqGrid对象
|
|
$("#" + subgrid_table_id).dataGrid({
|
|
cellEdit: true,
|
|
url: "/WMS/ICSDisassemblyDoc/GetSubGridJson?Code=" + Code + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
|
|
colModel: [
|
|
{ label: '行号', name: 'Sequence', width: 120, align: 'left' },
|
|
{
|
|
label: "类型", name: "DABDOCType", width: 60, align: "left",
|
|
formatter: function (cellvalue) {
|
|
if (cellvalue == "1") {
|
|
return "套件";
|
|
} else if (cellvalue == "2") {
|
|
return "散件";
|
|
}
|
|
else { return ""; }
|
|
}
|
|
},
|
|
{ label: '拆卸单号', name: 'Code', width: 120, align: 'left' },
|
|
{ label: '数量', name: 'Qty', width: 150, align: 'left' },
|
|
{ label: '料品编码', name: 'InvCode', width: 150, align: 'left' },
|
|
{ label: '料品名称', name: 'InvName', width: 100, align: 'left' },
|
|
{ label: '仓库代码', name: 'WHCode', width: 100, align: 'left' },
|
|
{ label: '批次', name: 'BatchCode', width: 150, align: 'left' },
|
|
{ label: '条码', name: 'LotNo', width: 150, align: 'left' },
|
|
],
|
|
//colModel: ColModelSub,
|
|
shrinkToFit: true,//宽度自适应
|
|
multiselect: true,
|
|
prmNames: { search: "search" },
|
|
viewrecords: true,
|
|
height: "100%",
|
|
rowNum: 20,
|
|
pager: subgrid_pager_id,
|
|
|
|
});
|
|
}
|
|
|
|
function btnkit() {
|
|
debugger;
|
|
var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
|
|
if (ids.length == 0) {
|
|
$.modalAlert("请选择数据!");
|
|
return;
|
|
}
|
|
for (var i = 0; i < ids.length; i++) {
|
|
var rowData = $("#gridList").jqGrid('getRowData', ids[i]);
|
|
var Code = rowData.Code;//单据号
|
|
var InvCode = rowData.InvCode;//料品编码
|
|
var InvName = rowData.InvName;//料品名称
|
|
var WHCode = rowData.WHCode;//仓库代码
|
|
var ExtensionID = rowData.ExtensionID;
|
|
var Qty = rowData.Qty//数量
|
|
var isInput = rowData.isInput//是否选择
|
|
if (isInput == "已选") {
|
|
$.modalAlert("该套件已选择!");
|
|
return;
|
|
}
|
|
}
|
|
$.modalOpen({
|
|
id: "ICSDisassemblyDocAdd",
|
|
title: "选择套件",
|
|
url: "/WMS/ICSDisassemblyDoc/ICSDisassemblyDocAdd?Code=" + Code + "&InvName=" + encodeURI(encodeURI(InvName)) + "&WHCode=" + WHCode + "&ExtensionID=" + ExtensionID + "&InvCode=" + InvCode + "&Qty=" + Qty + "&" + Math.random(),
|
|
width: "1200px",
|
|
height: "1150px",
|
|
callBack: function (iframeId) {
|
|
top.frames[iframeId].submitForm();
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
//批量生成条码
|
|
function btnGenerate() {
|
|
debugger;
|
|
var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
|
|
if (ids.length == 0) {
|
|
$.modalAlert("请选择数据!");
|
|
return;
|
|
}
|
|
for (var i = 0; i < ids.length; i++) {
|
|
var rowData = $("#gridList").jqGrid('getRowData', ids[i]);
|
|
var Code = rowData.Code;
|
|
var isInput = rowData.isInput;
|
|
var isCreate = rowData.isCreate;
|
|
if (isInput == '未选') {
|
|
$.modalAlert("请先绑定套件!");
|
|
return;
|
|
}
|
|
if (isCreate == '已生成') {
|
|
$.modalAlert("该单据已生成过条码!");
|
|
return;
|
|
}
|
|
}
|
|
$.modalConfirm("是否批量生成条码?", function (r) {
|
|
if (r) {
|
|
$.submitForm({
|
|
url: "/WMS/ICSDisassemblyDoc/CreateInventoryLot?Code=" + Code + "&" + Math.random(),
|
|
success: function () {
|
|
$.currentWindow().$("#gridList").trigger("reloadGrid");
|
|
}
|
|
})
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
function btnDeleteLot() {
|
|
var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
|
|
if (ids.length == 0) {
|
|
$.modalAlert("请选择数据!");
|
|
return;
|
|
}
|
|
for (var i = 0; i < ids.length; i++) {
|
|
var rowData = $("#gridList").jqGrid('getRowData', ids[i]);
|
|
var Code = rowData.Code;
|
|
}
|
|
|
|
|
|
$.modalConfirm("是否批量删除条码?", function (r) {
|
|
if (r) {
|
|
$.submitForm({
|
|
url: "/WMS/ICSDisassemblyDoc/DeleteInventoryLot?Code=" + Code + "&" + Math.random(),
|
|
success: function () {
|
|
$.currentWindow().$("#gridList").trigger("reloadGrid");
|
|
}
|
|
})
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<div class="topPanel" style="height:60px;">
|
|
<div class="toolbar">
|
|
<div class="btn-group">
|
|
<a id="NF-kit" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnkit()"><i class="fa fa-pencil-square-o"></i>绑定套件</a>
|
|
<a id="NF-Generate" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnGenerate()"><i class="fa fa-pencil-square-o"></i>批量生成条码</a>
|
|
<a id="NF-DeleteLot" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnDeleteLot()"><i class="fa fa-pencil-square-o"></i>删除条码</a>
|
|
<a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
|
|
|
|
</div>
|
|
|
|
<script>$('.toolbar').authorizeButton()</script>
|
|
</div>
|
|
<div class="search">
|
|
<table>
|
|
<tr>
|
|
<td style="text-align:right;"><label class="lglabel" for="txt_DABDOCCode">单据号</label>:</td>
|
|
<td>
|
|
<div class="input-group">
|
|
<input id="txt_DABDOCCode" type="text" class="form-control" style="width: 100px;">
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<span class="input-group-btn">
|
|
<button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="gridPanel">
|
|
<table id="gridList"></table>
|
|
<div id="gridPager"></div>
|
|
</div>
|