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

324 lines
13 KiB

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Index.cshtml";
}
<style>
.btn-primary {
margin-right: 2px;
}
.topPanel .toolbar {
float: left;
}
</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;
}
});
});
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, key: true };
cols.push(collast);
var collast = { label: "退料申请单号", name: "ApplyNegCode", width: 150, align: 'left' };
cols.push(collast);
var collast = { label: "退料申请单行号", name: "Sequence", width: 150, align: 'left' };
cols.push(collast);
var collast = { label: '来源单据表体ID', name: 'SourceDetailID', width: 100, 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: 'Amount', width: 100, align: 'left' };
cols.push(collast);
var collast = { label: '已退数量', name: 'IssueNegQuantity', width: 100, align: 'left' };
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);
}
}
_Clos = cols;
}
});
}
function gridList() {
var $gridList = $("#gridList");
$gridList.dataGrid({
url: "/WMS/MaterialsDeliveredRTM/GetICSMOApplyNeg" + "?" + Math.random(),
height: $(window).height() - 200,
width: $(window).width() - 300,
colModel: [
{ label: "主键", name: "ID", hidden: true, key: true },
{ label: 'ID', name: 'ID', hidden: true },
{ label: '退料申请单号', name: 'ApplyNegCode', width: 120, align: 'left' },
{ label: '仓库代码', name: 'WHCode', width: 150, align: 'left' },
{ label: '仓库名称', name: 'WarehouseName', width: 150, 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: "Type", 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: 'Memo', width: 200, align: 'left' },
{ label: '创建人', name: 'CreatePerson', width: 150, align: 'left' },
{ label: '创建时间', name: 'CreateDateTime', width: 150, align: 'left' },
],
shrinkToFit: false,//宽度自适应
autoWidth:true,
gridComplete: function () {
},
pager: "#gridPager",
sortorder: "desc",
sortname: 'ApplyNegCode',
viewrecords: true,
multiselect: true,
//beforeSelectRow: function (rowid, e) {
// $("#gridList").jqGrid('resetSelection');
// return (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;
$("#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 ApplyNegCode = $("#gridList").jqGrid('getRowData', rowid).ApplyNegCode;
// (6)创建jqGrid对象
$("#" + subgrid_table_id).dataGrid({
cellEdit: true,
url: "/WMS/MaterialsDeliveredRTM/GetICSMOApplyNegDetail?ApplyNegCode=" + ApplyNegCode + "&" + Math.random(), // (7)子表格数据对应的url,注意传入的contact.id参数
//colModel: [
// { label: "主键", name: "ID", hidden: true, key: true },
// { label: "退料申请单号", name: "ApplyNegCode", width: 150, align: 'left' },
// { label: "退料申请单行号", name: "Sequence", width: 150, align: 'left' },
// { label: '来源单据表体ID', name: 'SourceDetailID', width: 100, align: 'left' },
// { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
// { label: '数量', name: 'Quantity', width: 100, align: 'left' },
// { label: '辅计量数量', name: 'Amount', width: 100, align: 'left' },
// { label: '已退数量', name: 'IssueNegQuantity', width: 100, align: 'left' },
// { label: '自由项唯一标识', name: 'ExtensionID', width: 150, align: 'left' },
// { label: '操作人名称', name: 'MUSERName', width: 150, align: 'left' },
// { label: '操作时间', name: 'MTIME', width: 150, align: 'left' },
//],
colModel: _Clos,
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.ApplyNegCode + "',";
}
if (objArr == '') {
$.modalAlertNew("WMS00001");
return;
}
$.deleteForm({
url: "/WMS/MaterialsDeliveredRTM/DeleteICSMOApplyNeg" + "?" + 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]);
var ID = rowData.ID;
var ApplyNegCode = rowData.ApplyNegCode;
var WHCode = rowData.WHCode;
$.modalOpen({
id: "Details",
title: "修改",
url: "/WMS/MaterialsDeliveredRTM/ICSMOApplyNegMDUpdate?ID=" + ID + "&ApplyNegCode=" + ApplyNegCode + "&WHCode=" + WHCode + "&" + Math.random(),
width: "1000px",
height: "1200px",
callBack: function (iframeId) {
top.frames[iframeId].submitForm();
}
});
}
}
function btnCreate() {
$.modalOpen({
id: "BRGCodeAdd",
title: "新增",
url: "/WMS/MaterialsDeliveredRTM/ICSMOApplyNegMDAdd" + "?" + Math.random(),
width: "1000px",
height: "1200px",
callBack: function (iframeId) {
top.frames[iframeId].submitForm();
}
});
}
function btn_Audit() {
var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
if (ids.length != 1) {
$.modalAlertNew("WMS00087");
return;
}
var RoleEnCode = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode'
var WorkPoint = '@NFine.Code.OperatorProvider.Provider.GetCurrent().Location'
var date = new Date();
for (var i in ids) {
ID = $("#gridList").jqGrid('getRowData', ids[i]).ID;
Status = $("#gridList").jqGrid('getRowData', ids[i]).Status;
if (Status != '开立') {
$.modalAlertNew("WMS00088");
return;
}
}
var ICSASNs = {
ID: ID,
User: RoleEnCode,
MTIME: date,
WorkPoint: WorkPoint
}
var ICSASN = [];
ICSASN.push(ICSASNs);
$.submitForm({
url: "/WMS/ProductionIssue/AuditICSMOApplyNeg?" + Math.random(),
param: { ICSASN: JSON.stringify(ICSASN) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
</script>
<div class="topPanel" style="height:45px">
<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-Audit" authorize="yes" class="btn btn-primary" onclick="btn_Audit()"><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 class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
</div>
</div>
</div>
<div class="gridPanel">
<table id="gridList"></table>
<div id="gridPager"></div>
</div>