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.
 
 
 
 
 

444 lines
18 KiB

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Index.cshtml";
}
<style>
.btn-primary {
margin-right: 2px;
}
</style>
<script src="~/Content/js/datepicker/WdatePicker.js"></script>
<script>
$(document).ready(function () {
$("input.cell").keyup(function (e) {
switch (e.keyCode) {
// up arrow
case 40:
$(this).parent()
.parent()
.next()
.children("td")
.children("input.cell[name="
+ $(this).attr("name") + "]")
.focus();
break;
// down arrow
case 38:
$(this).parent()
.parent()
.prev()
.children("td")
.children("input.cell[name="
+ $(this).attr("name") + "]")
.focus();
break;
}
});
});</script>
<script>
var _Clos = new Array();
var _Closs = 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, key: true };
cols.push(collast);
var collast = { label: "领料单号", name: "ApplyCode", width: 150, align: 'left' };
cols.push(collast);
var collast = { label: "领料单行号", name: "Sequence", width: 150, align: 'left' };
cols.push(collast);
var collast = { label: '料品编码', name: 'InvCode', width: 100, align: 'left' };
cols.push(collast);
var collast = { label: '数量', name: 'Quantity', width: 100, align: 'left' };
cols.push(collast);
var collast = { label: '已领数量', name: 'IssueQuantity', width: 100, align: 'left' };
cols.push(collast);
var collast = { label: '备注', name: 'EATTRIBUTE5', hidden: true };
cols.push(collast);
var collast = { label: '操作人名称', name: 'MUSERName', width: 150, align: 'left' };
cols.push(collast);
var collast = { label: '操作时间', name: 'MTIME', width: 150, align: 'left' };
cols.push(collast);
var collast = { label: '自由项唯一标识', 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);
}
}
$.ajax({
url: "/Print/SelectTableColumnName?" + Math.random(),
dataType: "json",
async: false,
success: function (data) {
if (data != null && data.length > 0) {
DateList = data;
for (var i = 0; i < data.length; i++) {
var TableCode = data[i].TableCode;
if (TableCode == "ICSMOApplyNegDetail") {
var Code = data[i].Code;
var Name = data[i].Name;
var obj = new Array();
obj = {
label: Name,
name: Code,
width: 80,
align: "left"
}
cols.push(obj);
}
}
}
_Closs = cols;
//_Clos1 = cols1;
}
});
_Clos = cols;
}
});
}
//绑定动态列
function gridList() {
var $gridList = $("#gridList");
var queryJson = {
POCode: $("#txt_POCode").val(),
InvCode: $("#txt_InvCode").val(),
TimeFrom: $("#TimeFrom").val(),
TimeArrive: $("#TimeArrive").val(),
CreatedBy: $("#txt_CreatedBy").val(),
}
$gridList.dataGrid({
url: "/DHAY/ICSAccessoriesMOApply/GetICSMOApply" + "?" + Math.random(),
height: $(window).height() - 200,
width: $(window).width() - 300,
colModel: [
{ label: "主键", name: "ID", hidden: true, key: true },
{ label: '领料单号', name: 'ApplyCode', width: 120, align: 'left' },
{
label: "单据类型", name: "EATTRIBUTE2", width: 80, align: "left",
},
{ label: '受益部门', name: 'EATTRIBUTE', width: 120, align: 'left' },
{ label: '受益项目', name: 'EATTRIBUTE7', width: 150, align: 'left' },
{ label: '在建工程项目', name: 'EATTRIBUTE3', width: 150, align: 'left' },
{ label: "客户", name: "EATTRIBUTE4", width: 80, align: "left"},
{
label: "状态", name: "Status", 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: 'EATTRIBUTE5', width: 200, align: 'left' },
{ label: '创建人', name: 'CreatePerson', width: 150, align: 'left' },
{ label: '创建时间', name: 'CreateDateTime', width: 150, align: 'left' },
],
postData: { queryJson: JSON.stringify(queryJson) },
shrinkToFit: false,//宽度自适应
autoWidth:true,
gridComplete: function () {
},
pager: "#gridPager",
sortorder: "desc",
sortname: 'ApplyCode',
viewrecords: true,
multiselect: true,
subGrid: true, // (1)开启子表格支持
subGridRowExpanded: function (subgrid_id, rowid) { // (2)子表格容器的id和需要展开子表格的行id,将传入此事件函数
debugger;
$("#gridList").jqGrid("setSelection", rowid, false);
bindSubGrid(subgrid_id, rowid)
}
});
}
//子表
function bindSubGrid(subgrid_id, rowid) {
debugger;
var queryJson = {
POCode: $("#txt_POCode").val(),
InvCode: $("#txt_InvCode").val(),
TimeFrom: $("#TimeFrom").val(),
TimeArrive: $("#TimeArrive").val(),
CreatedBy: $("#txt_CreatedBy").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 ApplyCode = $("#gridList").jqGrid('getRowData', rowid).ApplyCode;
// (6)创建jqGrid对象
$("#" + subgrid_table_id).dataGrid({
cellEdit: true,
url: "/DHAY/ICSAccessoriesMOApply/GetICSMOApplyDetail?ApplyCode=" + ApplyCode + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
colModel: _Clos,
postData: { queryJson: JSON.stringify(queryJson) },
sortname: 'MTIME',
shrinkToFit: true,//宽度自适应
//multiselect: true,
prmNames: { search: "search" },
viewrecords: true,
height: "100%",
rowNum: 20,
pager: subgrid_pager_id,
});
}
//删除
function btn_Delete() {
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.ApplyCode + "',";
}
if (objArr == '') {
$.modalAlertNew("WMS00001");
return;
}
$.deleteForm({
url: "/DHAY/ICSAccessoriesMOApply/DeleteICSMOApplyByCode" + "?" + Math.random(),
param: { keyValue: JSON.stringify(objArr) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
function Selchange() {
document.getElementById("gridPanel").innerHTML = '<table id="gridList"></table>';//重置grid
gridList();
}
//审核
function btn_Approve() {
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.ApplyCode + "',";
}
if (objArr == '') {
$.modalAlertNew("WMS00001");
return;
}
$.submitForm({
url: "/DHAY/ICSAccessoriesMOApply/ApproveICSMOApplyByCode" + "?" + Math.random(),
param: { keyValue: JSON.stringify(objArr) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
//弃审
function btn_Abandon() {
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.ApplyCode + "',";
}
if (objArr == '') {
$.modalAlertNew("WMS00001");
return;
}
$.submitForm({
url: "/DHAY/ICSAccessoriesMOApply/AbandonICSMOApplyByCode" + "?" + Math.random(),
param: { keyValue: JSON.stringify(objArr) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
//发料
function btn_MOApply() {
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.ApplyCode + "',";
}
if (objArr == '') {
$.modalAlertNew("WMS00001");
return;
}
$.submitForm({
url: "/DHAY/ICSAccessoriesMOApply/FLICSMOApplyByCode" + "?" + Math.random(),
param: { keyValue: JSON.stringify(objArr) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
//关闭
function btn_Close() {
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.ApplyCode + "',";
}
if (objArr == '') {
$.modalAlertNew("WMS00001");
return;
}
$.submitForm({
url: "/DHAY/ICSAccessoriesMOApply/CloseICSMOApplyByCode" + "?" + Math.random(),
param: { keyValue: JSON.stringify(objArr) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
//修改类型
function btn_update() {
var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
if (ids.length != 1) {
$.modalAlertNew("WMS00006");
return;
}
for (var i in ids) {
var rowData = jQuery("#gridList").jqGrid("getRowData", ids[i]);
//ID
var ID = rowData.ID;
var ApplyCode = rowData.ApplyCode;
$.modalOpen({
id: "Details",
title: "修改",
url: "/DHAY/ICSAccessoriesMOApply/Update?ID=" + ID + "&ApplyCode=" + ApplyCode + "&" + Math.random(),
width: "1000px",
height: "1200px",
callBack: function (iframeId) {
top.frames[iframeId].submitForm();
}
});
}
}
//创建
function btnCreate() {
$.modalOpen({
id: "BRGCodeAdd",
title: "新增",
url: "/DHAY/ICSAccessoriesMOApply/Create" + "?" + Math.random(),
width: "1000px",
height: "1200px",
callBack: function (iframeId) {
top.frames[iframeId].submitForm();
}
});
}
</script>
<div class="topPanel" style="height:60px">
<div class="search">
<table>
<tr>
<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: 100px;">
</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: 100px;">
</div>
</td>
<td style="text-align:right;" class="Mechanism"><label class="lglabel" for="txt_CreatedBy">&nbsp;&nbsp;&nbsp;创建人</label>:</td>
<td class="Mechanism">
<div class="input-group">
<input id="txt_CreatedBy" type="text" class="form-control" style="width: 100px;">
</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:80px;" 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:80px;" 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 class="topPanel" style="height:60px ;" >
<div class="toolbar">
<div class="btn-group">
<a id="NF-Create" authorize="yes" class="btn btn-primary" onclick="btnCreate()"><i class="fa fa-pencil-square-o"></i>新增</a>
<a id="NF-update" authorize="yes" class="btn btn-primary" onclick="btn_update()"><i class="fa fa-pencil-square-o"></i>修改</a>
<a id="NF-Delete" authorize="yes" class="btn btn-primary" onclick="btn_Delete()"><i class="fa fa-trash-o"></i>删除</a>
<a id="NF-Approve" authorize="yes" class="btn btn-primary" onclick="btn_Approve()"><i class="fa fa-pencil-square-o"></i>审核</a>
<a id="NF-Abandon" authorize="yes" class="btn btn-primary" onclick="btn_Abandon()"><i class="fa fa-pencil-square-o"></i>弃审</a>
<a id="NF-Close" authorize="yes" class="btn btn-primary" onclick="btn_Close()"><i class="fa fa-trash-o"></i>关闭</a>
<a id="NF-MOApply" authorize="yes" class="btn btn-primary" onclick="btn_MOApply()"><i class="fa fa-trash-o"></i>发料</a>
<a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
</div>
<script>$('.toolbar').authorizeButton()</script>
</div>
</div>
</div>
<div class="gridPanel" id="gridPanel">
<table id="gridList"></table>
<div id="gridPager"></div>
</div>