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

191 lines
6.2 KiB

@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
$(function () {
gridList();
SireCodeBinding();
LotNoBinding();
});
function gridList() {
var $gridList = $("#gridList");
$gridList.dataGrid({
url: "/WMS/BasicSettings/GetSendContainerLot?" + Math.random(),
height: $(window).height() -50,
width: $(window).width() - 400,
cellEdit: true,
cellsubmit: "clientArray",
colModel: [
{ label: "主键", name: "ID", hidden: true, key: true },
{
label: '删除', width: 100, align: 'left',
formatter: btnLook
},
{ label: '条码', name: 'LotNo', width: 120, align: 'left' },
{ label: '料品编码', name: 'InvCode', width: 150, align: 'left' },
{ label: '料品名称', name: 'InvName', width: 100, align: 'left' },
{ label: '规格型号', name: 'InvStd', width: 200, align: 'left' },
{ label: '单位', name: 'InvUnit', width: 200, align: 'left' },
{ label: '生产日期', name: 'ProductDate', width: 200, align: 'left' },
{ label: '数量', name: 'Quantity', width: 200, align: 'left' },
],
afterSaveCell: function (rowid, cellname, value) {
if (cellname === 'ProjectCN') {
$gridList.jqGrid("setCell", rowid, 'ProjectID', value);
}
},
width: "100%",
autowidth: true,
rownumbers: true,
viewrecords: true,
});
}
function btnLook(cellvalue, options, rowObject) {
return cellvalue = "<a class=\"btn btn-primary dropdown-text\" onclick=\"UpLoadClick('" + rowObject.ID + "')\">删除</a>";
}
function UpLoadClick(ID) {
$("#gridList").delRowData(ID);
}
function SireCodeBinding() {
$("#SireCode").keydown(function (e) {
var curKey = e.which;
debugger;
if (curKey == 13) {
var SireCode = $("#SireCode").val();//需绑定容器
$.ajax({
url: "/WMS/BasicSettings/GetBindContainerID?SireCode=" + SireCode,
dataType: "json",
async: false,
success: function (data) {
debugger;
if (data == "" || data == null) {
$.modalAlertNew("WMS00022");
return;
}
$("#SireID").val(data.rows[0].ID);
$("#LotNo").focus();
}
});
}
});
};
function LotNoBinding() {
$("#LotNo").keydown(function (e) {
var curKey = e.which;
debugger;
if (curKey == 13) {
var LotNo = $("#LotNo").val();//需绑定容器
$.ajax({
url: "/WMS/BasicSettings/GetContainerLotInfo?LotNo=" + LotNo,
dataType: "json",
async: false,
success: function (data) {
debugger;
if (data == "" || data == null) {
$.modalAlertNew("WMS00022");
return;
}
//最后一行新增数据
var obj = {
ID: data.rows[0].ID,
LotNo: data.rows[0].LotNo,
InvCode: data.rows[0].InvCode,
InvName: data.rows[0].InvName,
InvStd: data.rows[0].InvStd,
InvUnit: data.rows[0].InvUnit,
ProductDate: data.rows[0].ProductDate,
Quantity: data.rows[0].Quantity,
};
$("#gridList").jqGrid('addRowData', obj.ID, obj, 'first');
$(".unwritten").hide();
}
});
}
});
};
function submitForm() {
debugger;
var SireID = $("#SireID").val();
var SireCode = $("#SireCode").val();
var ICSMTDOC = [];
var obj_Item1 = $("#gridList");
var rowIds_Item1 = obj_Item1.getDataIDs();
if (rowIds_Item1.length > 0) {
for (var i = 0; i < rowIds_Item1.length; i++) {
var RowData_Item1 = obj_Item1.getRowData(rowIds_Item1[i]);
var obj = {
LotNo: RowData_Item1.LotNo,
};
ICSMTDOC.push(obj);
}
}
debugger;
$.modalConfirm("确定绑定吗?", function (r) {
if (r) {
$.submitForm({
url: "/WMS/BasicSettings/BindingContainerLotID?SireID=" + SireID + "&SireCode=" + SireCode + "&" + Math.random(),
param: { ICSMTDOC: JSON.stringify(ICSMTDOC) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
}
});
}
</script>
<form id="form1">
<div style="padding-top: 20px; margin-right: 20px;">
<table class="form">
<tr>
<th class="formTitle">容器:</th>
<td class="formValue">
<input id="SireCode" type="text" class="form-control" style="width: 300px;" οnkeydοwn="SireCodeBinding()" />
<input id="SireID" type="text" class="form-control" />
</td>
<th class="formTitle">条码:</th>
<td class="formValue">
<input id="LotNo" type="text" class="form-control" style="width: 300px;" οnkeydοwn="LotNoBinding()" />
</td>
</tr>
</table>
</div>
</form>
<!--色牢度-->
<div class="gridPanel" style="width: 100% ">
<div class="ibox-title">
子表
</div>
<div class="gridPanel">
<table id="gridList"></table>
</div>
</div>