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.
 
 
 
 
 

425 lines
18 KiB

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Index.cshtml";
}
<script src="~/Content/js/datepicker/WdatePicker.js"></script>
<script>
debugger;
var myDate = new Date;
var year = myDate.getFullYear(); //获取当前年
var mon = myDate.getMonth() + 1 < 10 ? "0" + (myDate.getMonth() + 1) : myDate.getMonth() + 1; //获取当前月
var date = myDate.getDate() + 1 < 10 ? "0" + myDate.getDate() : myDate.getDate(); //获取当前日
var MtimeFrom = year + "-" + mon + "-" + date;
var MtimeArrive = year + "-" + mon + "-" + date;
var _Clos = new Array();
var _Clos2 = new Array();
var _Clos1 = new Array();
var flag = '1';
var mark = '';
var Arguments = '';
$(function () {
$("#TimeFrom").val(MtimeFrom);
$("#TimeArrive").val(MtimeArrive);
SetCols();
GetPickingListType();
gridList();
});
function Selchange() {
document.getElementById("gridPanel").innerHTML = ' <span><strong>详细信息</strong></span> <table id="gridList"></table> ';//重置grid
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, key: true };
cols.push(collast);
var collast = { label: '单据号', name: 'Code', width: 120, align: 'left' };
cols.push(collast);
var collast = { label: '操作日期', name: 'MTIME', width: 150, align: 'left' };
cols.push(collast);
var collast = { label: '维护人', name: 'MUSER', width: 80, align: 'left' };
cols.push(collast);
var collast = { label: '维护人名称', name: 'MUSERName', width: 80, align: 'left' };
cols.push(collast);
var collast = { label: '合并拣料ID', name: 'IsNew', width: 80, align: 'left' };
cols.push(collast);
var collast = { label: '是否占料', name: 'IsOccupy', width: 80, align: 'left' };
cols.push(collast);
var cols2 = new Array();
var collast2 = { label: '合并拣料ID', name: 'MergeID', width: 120, align: 'left' };
cols2.push(collast2);
var collast2 = { label: '单据号', name: 'Code', width: 120, align: 'left' };
cols2.push(collast2);
var collast2 = { label: '单据行号', name: 'Sequence', width: 100, align: 'left' };
cols2.push(collast2);
var collast2 = { label: '条码', name: 'LotNO', width: 200, align: 'left' };
cols2.push(collast2);
var collast2 = { label: '料品编码', name: 'InvCode', width: 150, align: 'left' };
cols2.push(collast2);
var collast2 = { label: '料品名称', name: 'InvName', width: 150, align: 'left' };
cols2.push(collast2);
var collast2 = { label: '料品描述', name: 'InvDesc', width: 150, align: 'left' };
cols2.push(collast2);
var collast2 = { label: '规格型号', name: 'InvStd', width: 150, align: 'left' };
cols2.push(collast2);
var collast2 = { label: '料品单位', name: 'InvSInvUnittd', width: 150, align: 'left' };
cols2.push(collast2);
var collast2 = { label: '应发数量', name: 'iQuantity', width: 100, align: 'left' };
cols2.push(collast2);
//var collast2 = { label: '库存数量', name: 'QTY', width: 100, align: 'left' };
//cols2.push(collast2);
var collast2 = { label: '单位', name: 'InvUnit', width: 100, align: 'left' };
cols2.push(collast2);
var collast2 = { label: '维护人', name: 'MUSER', width: 80, align: 'left' };
cols2.push(collast2);
var collast2 = { label: '维护人名称', name: 'MUSERName', width: 80, align: 'left' };
cols2.push(collast2);
var collast2 = { label: '仓库编码', name: 'WHCode', width: 80, align: 'left' };
cols2.push(collast2);
var collast2 = { label: '仓库名称', name: 'WarehouseName', width: 80, align: 'left' };
cols2.push(collast2);
var collast2 = { label: '操作日期', name: 'MTIME', width: 150, align: 'left' };
cols2.push(collast2);
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);
//cols1.push(obj);
cols2.push(obj);
}
}
_Clos = cols;
_Clos2 = cols2;
}
});
}
function gridList() {
var Type = $("#selShow").val();
var $gridList = $("#gridList");
var queryJson = {
POCode: $("#txt_POCode").val(),
InvCode: $("#txt_InvCode").val(),
TimeFrom: $("#TimeFrom").val(),
TimeArrive: $("#TimeArrive").val(),
}
$gridList.dataGrid({
url: "/WMS/PickMaterial/GetGridJsonSeizeM? " + Math.random(),
postData: { queryJson: JSON.stringify(queryJson), Type: Type },
height: $(window).height() - 150,
width: $(window).width() - 500,
colModel: _Clos,
//colModel: [
// { label: "主键", name: "ID", hidden: true, key: true },
// { label: '单据号', name: 'Code', width: 120, align: 'left' },
// { label: '操作日期', name: 'MTIME', width: 150, align: 'left' },
// { label: '维护人', name: 'MUSER', width: 80, align: 'left' },
// { label: '维护人名称', name: 'MUSERName', 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,
subGrid: true, // (1)开启子表格支持
subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
$("#gridList").jqGrid("setSelection", rowid, false);
bindSubGrid(subgrid_id, rowid)
},
gridComplete: function () {
debugger;
var strIds = $("#gridList").jqGrid("getDataIDs");
}
});
}
function bindSubGrid(subgrid_id, rowid) {
var Type = $("#selShow").val();
$("#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/PickMaterial/GetSubGridJsonSeizeM?Code=" + Code + "&Type=" + Type + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
//colModel: [
// { label: '单据号', name: 'Code', width: 120, align: 'left' },
// { label: '单据行号', name: 'Sequence', width: 100, align: 'left' },
// { label: '操作日期', name: 'MTIME', width: 150, align: 'left' },
// { label: '是否合并拣料', name: 'IsNew', width: 80, 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: 'IssueQuantity', 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' },
//],
colModel: _Clos2,
//colModel: ColModelSub,
shrinkToFit: true,//宽度自适应
//multiselect: true,
prmNames: { search: "search" },
viewrecords: true,
height: "100%",
rowNum: 20,
pager: subgrid_pager_id,
});
}
function btnPrint() {
debugger;
var mold = '';
if (mark == '') {
$.modalAlertNew("WMS00093");
return;
}
if (mark == '合并拣料') {
var objArr = '';
var arr = [];
var obj_Item1 = $("#gridList2");
var rowIds_Item1 = obj_Item1.getDataIDs();
var arrayData_Item1 = new Array();
var Enables = '';
if (rowIds_Item1.length > 0) {
debugger;
for (var i = 0; i < rowIds_Item1.length; i++) {
var RowData_Item1 = obj_Item1.getRowData(rowIds_Item1[0]);
objArr += "'" + RowData_Item1.MergeID + "',";
objArr = objArr.slice(0, objArr.length - 1);
objArr = "" + objArr + "|";
arr.push(objArr);
}
Arguments = arr;
mold = 'HBJL00001';
}
}
if (mark == '拣料') {
var objArr = '';
var arr = [];
var obj_Item1 = $("#gridList2");
var rowIds_Item1 = obj_Item1.getDataIDs();
var arrayData_Item1 = new Array();
var Enables = '';
if (rowIds_Item1.length > 0) {
debugger;
for (var i = 0; i < rowIds_Item1.length; i++) {
var RowData_Item1 = obj_Item1.getRowData(rowIds_Item1[0]);
objArr += "'" + RowData_Item1.Code + "',";
objArr = objArr.slice(0, objArr.length - 1);
objArr = "" + objArr + "|";
arr.push(objArr);
}
Arguments = arr;
mold = 'JL00001';
}
}
$.modalOpen({
id: "PrintLot",
title: "打印",
url: "/WMS/Print/PrintView?Arguments=" + encodeURI(encodeURI(Arguments)) + "&mold=" + mold + "&" + Math.random(),
width: "550px",
height: "1000px",
callBack: function (iframeId) {
top.frames[iframeId].submitForm();
}
});
}
function GetPickingListType() {
$.ajax({
url: "/WMS/PickMaterial/GetPickingListType",
dataType: "json",
async: false,
success: function (data) {
if (data != false && data != null && data.length > 0) {
$("#selShow").find("option").remove();
//$("#selShow").append("<option value=''>==请选择站点==</option>");
for (var i = 0; i < data.length; i++) {
$("#selShow").append("<option value='" + data[i].Code + "'>" + data[i].Name + "</option>");
}
$("#selShow").val([data[0].Code]).trigger("change");
}
}
});
}
function btnBackMaterial() {
debugger;
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);
objArr += "'" + rowData.Code + "',";
}
if (objArr == '') {
$.modalAlert("请选择单据后取消占料!", "warning");
return;
}
debugger;
$.deleteForm({
url: "/WMS/PickMaterial/DelPickLog" + "?" + Math.random(),
param: { objCode: JSON.stringify(objArr) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
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-BackMaterial" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnBackMaterial()"><i class="fa fa-pencil-square-o"></i>回撤拣配</a>
<a id="NF-Print" authorize="yes" style="margin-left:3px;" class="btn btn-primary" onclick="btnPrint()"><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;" onchange="Selchange()">
@*<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>
<option value="10" selected="selected">物料调拨</option>
<option value="11" 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 style="text-align:right;"><label class="lglabel" for="txt_TimeFrom">&nbsp;&nbsp;&nbsp;日期(从)</label>:</td>
<td>
<div class="input-group">
<input id="TimeFrom" name="Time" type="text" class="form-control required" style="width:85%;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd'})" placeholder="日期(从)" />
</div>
</td>
<td style="text-align:right;"><label class="lglabel" for="txt_TimeArrive">&nbsp;&nbsp;&nbsp;日期(到)</label>:</td>
<td>
<div class="input-group">
<input id="TimeArrive" name="Time" type="text" class="form-control required" style="width:85%;" maxlength="10" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" placeholder="日期(到)" />
</div>
</td>
<td>
<span class="input-group-btn">
<button id="btn_search" type="button" class="btn btn-primary" onclick="Selchange()"><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>