纽威
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.
 
 
 
 
 

286 lines
12 KiB

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
debugger;
var flag = '1';
$(function () {
gridList();
gridList2(flag);
$("#selShow").change(function () {
debugger;
gridList();
});
});
function gridList() {
document.getElementById("gridPanel").innerHTML = ' <span><strong>详细信息</strong></span> <table id="gridList"></table> ';//重置grid
var Type = $("#selShow").val();
var $gridList = $("#gridList");
var queryJson = {
POCode: $("#txt_POCode").val(),
InvCode: $("#txt_InvCode").val(),
}
$gridList.dataGrid({
url: "/WMS/PickMaterial/GetGridJson?Type=" + Type + "&" + Math.random(),
postData: { queryJson: JSON.stringify(queryJson) },
height: 280,
width: $(window).width() - 500,
colModel: [
{ label: "主键", name: "ID", hidden: true, key: true },
{ label: '单据号', name: 'Code', width: 120, align: 'left' },
{ label: '单据行号', name: 'Sequence', width: 100, align: 'left' },
{ label: '操作日期', name: 'MTIME', width: 150, align: 'left' },
{ label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
{ label: '料品名称', name: 'InvName', width: 100, align: 'left' },
{ label: '料品描述', name: 'InvDesc', width: 100, align: 'left' },
{ label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
{ label: '数量', name: 'Quantity', width: 100, align: 'left' },
{ label: '单位', name: 'InvUnit', width: 100, align: 'left' },
{ label: '维护人', name: 'MUSER', width: 80, align: 'left' },
{ label: '维护人名称', name: 'MUSERName', width: 80, align: 'left' },
{ label: '仓库编码', name: 'WHCode', width: 80, align: 'left' },
{ label: '仓库名称', name: 'WarehouseName', width: 80, align: 'left' },
//{ label: '是否合并拣料', name: 'IsNew', width: 80, align: 'left' },
],
shrinkToFit: false,//宽度自适应
autowidth: true,
gridComplete: function () {
},
rowNum: 10000,
autoScroll: true,
sortname: 'Code',
sortorder: "desc",
viewrecords: true,
multiselect: true,
});
$("#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 = {
POCode: $("#txt_POCode").val(),
InvCode: $("#txt_InvCode").val(),
}
$gridList.jqGrid('setGridParam', {
postData: { queryJson: JSON.stringify(queryJson) },
}).trigger('reloadGrid');
});
}
function gridList2(flag) {
debugger;
document.getElementById("gridPanel2").innerHTML = ' <span><strong>合并信息</strong></span> <table id="gridList2"></table>';//重置grid
var Type = $("#selShow").val();
var $gridList = $("#gridList2");
var objArr = '';
var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
for (var i = 0; i < objList.length; i++) {
var rowId = objList[i];
var rowData = $("#gridList").jqGrid('getRowData', rowId);
if (flag=='1') {
objArr += "'" + rowData.Code + rowData.Sequence + "',";
} else {
objArr += "'" + rowData.ID + "',";
}
}
$gridList.dataGrid({
url: "/WMS/PickMaterial/GetICSMOPickMergeTemp?ID=" + objArr + "&Type=" + Type + "&flag=" + flag + "&" + Math.random(),
height: 500,
width: $(window).width() - 500,
colModel: [
{ label: "主键", name: "ID", hidden: true, key: true },
{ label: '领料合并ID', name: 'MergeID', width: 120, align: 'left' },
{ label: '单据号', name: 'Code', width: 120, align: 'left' },
{ label: '料品编码', name: 'InvCode', width: 150, align: 'left' },
{ label: '料品名称', name: 'InvName', width: 150, align: 'left' },
{ label: '规格型号', name: 'InvStd', width: 100, align: 'left' },
{ label: '应发数量', name: 'iQuantity', width: 100, align: 'left' },
{ label: '单位', name: 'InvUnit', width: 150, align: 'left' },
{ label: '仓库编码', name: 'WarehouseCode', width: 100, align: 'left' },
{ label: '库位编码', name: 'LocationCode', width: 100, align: 'left' },
{ label: '条码库存', name: 'QTY', width: 100, align: 'left' },
{ label: '条码', name: 'LotNO', width: 100, align: 'left' },
],
shrinkToFit: false,//宽度自适应
autowidth: true,
gridComplete: function () {
},
rowNum: 10000,
sortorder: "desc",
viewrecords: true,
//multiselect: true,
});
$("#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 = {
POCode: $("#txt_POCode").val(),
}
$gridList.jqGrid('setGridParam', {
postData: { queryJson: JSON.stringify(queryJson) },
}).trigger('reloadGrid');
});
}
function btnMaterial() {
debugger;
flag = '1';
var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
for (var i = 0; i < objList.length; i++) {
var rowId = objList[i];
var rowData = $("#gridList").jqGrid('getRowData', rowId);
if (rowData.IsNew=="已合并") {
$.modalAlert("该单据已合并拣料,无法重复拣料!");
return;
}
}
gridList2(flag);
}
function btnMergeMaterial() {
debugger;
var sign = '';
flag = '2';
var Type = $("#selShow").val();
var obj = '';
var objArr = '';
var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
if (objList.length < 2) {
$.modalAlert("请至少选择两条数据进行合并!");
return;
}
for (var i = 0; i < objList.length; i++) {
var rowId = objList[i];
var rowData = $("#gridList").jqGrid('getRowData', rowId);
obj += rowData.ID + ",";
objArr += "'" + rowData.ID + "',";
}
$.ajax({
url: "/WMS/PickMaterial/CheckQty" + "?" + Math.random() + "&objArr=" + objArr,
dataType: "json",
type: "post",
async: false,
success: function (data) {
sign = data.count;
}
});
if (sign == '1') {
$.modalAlert("该单据已合并拣料,无法重复拣料!");
return;
}
$.submitForm({
url: "/WMS/PickMaterial/MergeMaterial?Type=" + Type + "&" + Math.random(),
param: {
keyValue: obj
},
success: function () {
//$.currentWindow().$("#gridList").trigger("reloadGrid");
gridList2(flag);
}
})
}
function fullscreen() {
var docElm = document.documentElement;
if (docElm.requestFullscreen) {
docElm.requestFullscreen();
} else if (docElm.mozRequestFullScreen) {
docElm.mozRequestFullScreen();
} else if (docElm.webkitRequestFullScreen) {
docElm.webkitRequestFullScreen();
} else if (docElm.msRequestFullscreen) {
docElm.msRequestFullscreen();
}
$(window).bind('resize', function () {
$("#gridList").setGridWidth($(window).width());
}).trigger('resize');
$(window).bind('resize', function () {
$("#gridList").setGridHeight($(window).height());
}).trigger('resize');
}
</script>
<div class="topPanel" style="height:60px;">
<div class="toolbar">
<div class="btn-group">
<a id="NF-Material" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnMaterial()"><i class="fa fa-pencil-square-o"></i>拣料</a>
<a id="NF-MergeMaterial" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnMergeMaterial()"><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>
<label>&nbsp;&nbsp;&nbsp;类型:</label>
</td>
<td>
<div class="input-group">
<select id="selShow" name="F_Target" class="form-control" style="width: 100px;">
<option value="1" selected="selected">工单备料</option>
<option value="2" selected="selected">工单领料</option>
<option value="3" selected="selected">工单材料出库</option>
<option value="4" selected="selected">委外备料</option>
<option value="5" selected="selected">委外领料</option>
<option value="6" selected="selected">委外材料出库</option>
<option value="7" selected="selected">销售发货</option>
<option value="8" selected="selected">其它出库</option>
<option value="9" selected="selected">借用</option>
</select>
</div>
</td>
<td style="text-align:right;"><label class="lglabel" for="txt_POCode">&nbsp;&nbsp;&nbsp;单据号</label>:</td>
<td>
<div class="input-group">
<input id="txt_POCode" type="text" class="form-control" style="width: 150px;">
</div>
</td>
<td style="text-align:right;"><label class="lglabel" for="txt_InvCode">&nbsp;&nbsp;&nbsp;料品编码</label>:</td>
<td>
<div class="input-group">
<input id="txt_InvCode" type="text" class="form-control" style="width: 150px;">
</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" id="gridPanel">
<span><strong>详细信息</strong></span>
<table id="gridList"></table>
</div>
<div class="gridPanel" id="gridPanel2">
<span><strong>合并信息</strong></span>
<table id="gridList2"></table>
</div>