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.
1397 lines
62 KiB
1397 lines
62 KiB
@{
|
|
ViewBag.Title = "Index";
|
|
Layout = "~/Views/Shared/_Index.cshtml";
|
|
}
|
|
<link href="~/Content/js/select2/select2.min.css" rel="stylesheet" />
|
|
<script src="~/Content/js/select2/select2.min.js"></script>
|
|
<style>
|
|
.formTitle {
|
|
text-align: right;
|
|
width: 10%;
|
|
}
|
|
|
|
.formActions {
|
|
text-align: left;
|
|
width: 15%;
|
|
}
|
|
|
|
.project-list table tr td {
|
|
padding: 5px;
|
|
}
|
|
|
|
.th_classAdd {
|
|
text-align: center !important;
|
|
}
|
|
|
|
.th_classMar {
|
|
padding: 10px;
|
|
vertical-align: inherit;
|
|
}
|
|
|
|
.ui-jqgrid .ui-jqgrid-view {
|
|
height: 300px;
|
|
}
|
|
|
|
.ui-jqgrid .ui-jqgrid-bdiv {
|
|
height: 266px !important;
|
|
}
|
|
|
|
.bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) {
|
|
width: 100%;
|
|
}
|
|
|
|
.lr-layout-center {
|
|
padding: 0 5px;
|
|
}
|
|
|
|
.th_classMar {
|
|
padding: 0;
|
|
}
|
|
|
|
.lr-layout-tool {
|
|
height: 50px;
|
|
}
|
|
|
|
.lr-layout-center .lr-layout-wrap.lr-layout-wrap-notitle {
|
|
padding-top: 50px;
|
|
}
|
|
|
|
.wrapper .nav-tabs {
|
|
padding: 0;
|
|
}
|
|
|
|
.webuploader-pick {
|
|
padding: 7px 15px;
|
|
}
|
|
|
|
.table > tbody > tr > td, .table > tbody > tr > th, .table > tfoot > tr > td, .table > tfoot > tr > th, .table > thead > tr > td, .table > thead > tr > th {
|
|
padding: 3px;
|
|
}
|
|
|
|
.form .formTitle {
|
|
padding-right: 8px;
|
|
}
|
|
|
|
.form-control, .single-line {
|
|
padding: 3px;
|
|
}
|
|
|
|
.ibox-title {
|
|
height: 20px;
|
|
line-height: 20px;
|
|
padding: 0;
|
|
padding-left: 15px;
|
|
}
|
|
|
|
.table {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.bootstrap-select > .dropdown-toggle {
|
|
height: 22px;
|
|
padding: 2px 6px;
|
|
}
|
|
|
|
.bootstrap-select > .dropdown-toggle.bs-placeholder, .bootstrap-select > .dropdown-toggle.bs-placeholder:hover, .bootstrap-select > .dropdown-toggle.bs-placeholder:focus, .bootstrap-select > .dropdown-toggle.bs-placeholder:active {
|
|
height: 22px;
|
|
padding: 2px 6px;
|
|
}
|
|
|
|
.form-control, .single-line {
|
|
padding: 3px;
|
|
height: 22px;
|
|
padding: 0 3px;
|
|
}
|
|
|
|
/* 不良原因可选样式 */
|
|
.bad-reason-optional {
|
|
color: #666;
|
|
font-style: italic;
|
|
}
|
|
|
|
/* 空值时的占位符样式 */
|
|
.empty-bad-reason {
|
|
color: #999;
|
|
}
|
|
</style>
|
|
<script>
|
|
debugger;
|
|
// 添加全局变量跟踪最后编辑的单元格
|
|
var lastrow = null;
|
|
var lastcell = null;
|
|
var lastrow1 = null;
|
|
var lastcell1 = null;
|
|
|
|
var InvCode = decodeURI($.request("InvCode"));
|
|
var JYID = decodeURI($.request("JYID"));
|
|
var SampleQuantity = $.request("SampleQuantity");
|
|
var WaiveQuantity = decodeURI($.request("WaiveQuantity"));
|
|
var AllNumber = $.request("AllNumber");
|
|
var YLOTQTY = $.request("YLOTQTY");
|
|
var NLOTQTY = $.request("NLOTQTY");
|
|
var BCCode = $.request("BCCode");
|
|
var BRCode = $.request("BRCode");
|
|
var EATTRIBUTE5 = $.request("EATTRIBUTE5");
|
|
var EATTRIBUTE6 = $.request("EATTRIBUTE6");
|
|
var EATTRIBUTE7 = $.request("EATTRIBUTE7");
|
|
var ResultINp = decodeURI($.request("Result"));
|
|
var Type = decodeURI($.request("Type"));
|
|
var LotNo = decodeURI($.request("LotNo"));
|
|
var _Clos = new Array();
|
|
var _Clos1 = new Array();
|
|
var _ColCaption = new Array();
|
|
var _ColFiledName = new Array();
|
|
var _LW = new Array();
|
|
var AfterLW = new Array();
|
|
var SumNum = 1;
|
|
var SJKSumNum = 0;
|
|
var cj = 0;//记录抽检数量
|
|
|
|
$(function () {
|
|
debugger;
|
|
$.ajax({
|
|
url: "/DHAY/IQCQuality/GetRulesDetail?LotNo=" + LotNo,
|
|
dataType: "json",
|
|
async: false,
|
|
success: function (data) {
|
|
$("#txt_Lot").val(data.rows[0].LotNo);
|
|
$("#txt_LotQty").val(data.rows[0].Quantity);
|
|
$("#txt_RulesType").val("抽检");
|
|
$("#txt_RulesCode").val(data.rows[0].RulesCode);
|
|
$("#txt_InvCode").val(data.rows[0].InvCode);
|
|
$("#txt_InvName").val(data.rows[0].InvName);
|
|
$("#txt_InvStd").val(data.rows[0].InvStd);
|
|
if (JYID == "null") {
|
|
$("#txt_badCount").val(0);
|
|
$("#txt_specialPicks").val(0);
|
|
$("#txt_filtering").val(0);
|
|
$("#txt_specialNumber").val(data.rows[0].EATTRIBUTE3);
|
|
} else {
|
|
$("#txt_badCount").val(data.rows[0].UnqualifiedQuantity);
|
|
$("#txt_specialPicks").val(data.rows[0].EATTRIBUTE4);
|
|
$("#txt_filtering").val(data.rows[0].EATTRIBUTE2);
|
|
$("#txt_specialNumber").val(data.rows[0].EATTRIBUTE3);
|
|
$("#txt_manhours").val(EATTRIBUTE5);
|
|
$("#txt_rejections").val(EATTRIBUTE6);
|
|
$("#txt_otherNumber").val(EATTRIBUTE7);
|
|
$("#txt_result").val(data.rows[0].Result);
|
|
}
|
|
}
|
|
});
|
|
Getcol();
|
|
Getcol1();
|
|
gridList();
|
|
gridList1();
|
|
});
|
|
|
|
// 统一计算表头结论
|
|
function calcHeaderResult() {
|
|
var gridListOKCount = 0;
|
|
var gridList1OKCount = 0;
|
|
var rowIds_Item = $("#gridList").getDataIDs();
|
|
var rowIds_Item1 = $("#gridList1").getDataIDs();
|
|
|
|
for (var k = 0; k < rowIds_Item.length; k++) {
|
|
var data = $("#gridList").getRowData(rowIds_Item[k]);
|
|
if (data.Result === "OK" || data.Result === "合格") {
|
|
gridListOKCount++;
|
|
}
|
|
}
|
|
for (var j = 0; j < rowIds_Item1.length; j++) {
|
|
var data = $("#gridList1").getRowData(rowIds_Item1[j]);
|
|
if (data.Result === "OK" || data.Result === "合格") {
|
|
gridList1OKCount++;
|
|
}
|
|
}
|
|
|
|
if (rowIds_Item.length === gridListOKCount &&
|
|
rowIds_Item1.length === gridList1OKCount) {
|
|
$("#txt_result").val("OK");
|
|
} else {
|
|
$("#txt_result").val("NG");
|
|
}
|
|
}
|
|
|
|
function gridList() {
|
|
debugger;
|
|
var $gridPanel = $("#gridPanel");
|
|
var $gridList = $("#gridList");
|
|
// 步骤1:深度缓存所有行数据(兼容所有版本)
|
|
var cachedData = [];
|
|
if ($gridList.length > 0) {
|
|
try {
|
|
var rowIds = $gridList.getDataIDs(); // 尝试获取行ID(兼容多数版本)
|
|
for (var i = 0; i < rowIds.length; i++) {
|
|
var rowId = rowIds[i];
|
|
var rowData = {};
|
|
// 遍历所有列,手动获取单元格值(避免依赖jqGrid内置方法)
|
|
var colModel = $gridList.jqGrid('getGridParam', 'colModel') || _Clos;
|
|
for (var j = 0; j < colModel.length; j++) {
|
|
var colName = colModel[j].name;
|
|
if (colName && colName !== 'rn' && colName !== 'cb') { // 排除内置列
|
|
try {
|
|
rowData[colName] = $gridList.jqGrid('getCell', rowId, colName);
|
|
} catch (e) {
|
|
// 若getCell也报错,改用DOM获取单元格值(终极兜底)
|
|
var cellElem = $gridList.find("#" + rowId + "_" + colName);
|
|
rowData[colName] = cellElem.text() || cellElem.val() || "";
|
|
}
|
|
}
|
|
}
|
|
rowData._rowId = rowId; // 保留行ID
|
|
cachedData.push(rowData);
|
|
}
|
|
} catch (e) {
|
|
console.log("缓存数据时兼容旧版jqGrid:", e);
|
|
}
|
|
}
|
|
|
|
// 步骤2:暴力清空表格DOM(无需依赖jqGrid内置方法)
|
|
$gridPanel.empty(); // 清空容器所有内容
|
|
$gridPanel.html('<table id="gridList"></table>'); // 重建表格DOM
|
|
$gridList = $("#gridList"); // 重新获取表格对象
|
|
|
|
// 步骤3:重新初始化表格(原有配置不变)
|
|
$gridList.dataGrid({
|
|
url: "/DHAY/IQCQuality/GetInventoryInspectionNew?InvCode=" + InvCode + "&" + Math.random() + "&SampleQuantity=" + SampleQuantity + "&ResultINp=" + ResultINp + "&JYID=" + JYID + "&LotNo=" + LotNo + "&AllNumber=" + AllNumber,
|
|
height: $(window).height() - 400,
|
|
width: 300,
|
|
cellEdit: true,
|
|
colModel: _Clos,
|
|
cellsubmit: "clientArray", // 数据保存在客户端,关键!
|
|
sortname: 'GroupCode',
|
|
sortorder: "asc",
|
|
viewrecords: true,
|
|
rowNum: 200,
|
|
afterEditCell: function (rowid, cellname, value, iRow, iCol) {
|
|
lastrow = rowid;
|
|
lastcell = iCol;
|
|
},
|
|
loadComplete: function () {
|
|
debugger;
|
|
$('.ui-jqgrid-bdiv').scrollTop(0);
|
|
|
|
// 步骤4:强制回填缓存数据(核心:覆盖新加载的空数据)
|
|
if (cachedData.length > 0) {
|
|
var newRowIds = $gridList.getDataIDs();
|
|
for (var i = 0; i < newRowIds.length && i < cachedData.length; i++) {
|
|
var rowId = newRowIds[i];
|
|
var oldData = cachedData[i];
|
|
// 遍历所有缓存的字段,逐列回填
|
|
for (var key in oldData) {
|
|
if (oldData.hasOwnProperty(key) && key !== '_rowId') {
|
|
try {
|
|
// 优先用jqGrid方法设置值
|
|
$gridList.jqGrid('setCell', rowId, key, oldData[key]);
|
|
} catch (e) {
|
|
// 终极兜底:直接修改DOM元素值
|
|
var cellElem = $gridList.find("#" + rowId + "_" + key);
|
|
if (cellElem.is("input")) {
|
|
cellElem.val(oldData[key]); // 编辑状态的单元格
|
|
} else {
|
|
cellElem.text(oldData[key]); // 普通单元格
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (_LW.length > 0) {
|
|
for (var i = 0; i < _LW.length; i++) {
|
|
try {
|
|
$gridList.jqGrid("setCell", _LW[i].ID, _LW[i].FiledNamekey, _LW[i].FiledNamevalue);
|
|
} catch (e) {
|
|
var cellElem = $gridList.find("#" + _LW[i].ID + "_" + _LW[i].FiledNamekey);
|
|
cellElem.text(_LW[i].FiledNamevalue);
|
|
}
|
|
}
|
|
}
|
|
reSetActualValueColor();
|
|
calcHeaderResult();
|
|
},
|
|
afterSaveCell: function (rowid, cellname, value) {
|
|
debugger;
|
|
var obj_Item = $("#gridList");
|
|
var rowIds_Item = obj_Item.getDataIDs();
|
|
|
|
var obj_Item1 = $("#gridList1");
|
|
var rowIds_Item1 = obj_Item1.getDataIDs();
|
|
if (rowIds_Item.length > 0) {
|
|
|
|
for (var i = 0; i < rowIds_Item.length; i++) {
|
|
var RowData_Item1 = obj_Item.getRowData(rowIds_Item[i]);
|
|
if (RowData_Item1.ID == rowid && cellname != "UnqualifiedQuantity" && cellname != "SamplingQuantity") {
|
|
var SetValueMax = Number($("#gridList").jqGrid("getCell", RowData_Item1.ID, "SetValueMax"));
|
|
var SetValueMin = Number($("#gridList").jqGrid("getCell", RowData_Item1.ID, "SetValueMin"));
|
|
for (var j = 0; j < _ColFiledName.length; j++) {
|
|
|
|
var result = Number($("#gridList").jqGrid("getCell", RowData_Item1.ID, _ColFiledName[j]));
|
|
|
|
if (result >= SetValueMin && result <= SetValueMax) {
|
|
$("#gridList").jqGrid('setCell', RowData_Item1.ID, _ColFiledName[j], '', { color: 'black' });
|
|
} else {
|
|
$("#gridList").jqGrid('setCell', RowData_Item1.ID, _ColFiledName[j], '', { color: 'red' });
|
|
}
|
|
}
|
|
}
|
|
if (RowData_Item1.ID == rowid && cellname == "UnqualifiedQuantity") {
|
|
var SimpaleQuantity = Number($("#gridList").jqGrid("getCell", RowData_Item1.ID, "SamplingQuantity"));
|
|
var AcceptableValue = Number($("#gridList").jqGrid("getCell", RowData_Item1.ID, "EATTRIBUTE1"));
|
|
var result = Number($("#gridList").jqGrid("getCell", RowData_Item1.ID, "UnqualifiedQuantity"));
|
|
RowData_Item1.UnqualifiedQuantity = result;
|
|
if (SimpaleQuantity != 0 && result > SimpaleQuantity) {
|
|
$.modalMsg("不良数不能大于抽检数量", "warning");
|
|
$gridList.jqGrid("setCell", RowData_Item1.ID, "UnqualifiedQuantity", " ");
|
|
return;
|
|
}
|
|
if (SimpaleQuantity == 0) {
|
|
if (result == 1) {
|
|
$gridList.jqGrid("setCell", RowData_Item1.ID, "Result", "OK");
|
|
}
|
|
else {
|
|
$gridList.jqGrid("setCell", RowData_Item1.ID, "Result", "NG");
|
|
}
|
|
}
|
|
else {
|
|
if (result > AcceptableValue) {
|
|
$gridList.jqGrid("setCell", RowData_Item1.ID, "Result", "NG");
|
|
}
|
|
else {
|
|
$gridList.jqGrid("setCell", RowData_Item1.ID, "Result", "OK");
|
|
}
|
|
}
|
|
|
|
var gridListOKCount = 0;
|
|
var gridList1OKCount = 0;
|
|
for (var k = 0; k < rowIds_Item.length; k++) {
|
|
var gridListData = obj_Item.getRowData(rowIds_Item[k]);
|
|
if (gridListData.Result == "OK") {
|
|
gridListOKCount++;
|
|
}
|
|
}
|
|
for (var j = 0; j < rowIds_Item1.length; j++) {
|
|
var gridList1Data = obj_Item1.getRowData(rowIds_Item1[j]);
|
|
if (gridList1Data.Result == "OK") {
|
|
gridList1OKCount++;
|
|
}
|
|
}
|
|
if (gridListOKCount == rowIds_Item.length && gridList1OKCount == rowIds_Item1.length) {
|
|
$("#txt_result").val("OK");
|
|
}
|
|
else {
|
|
$("#txt_result").val("NG");
|
|
}
|
|
}
|
|
var cjMin = Number($("#gridList").jqGrid("getCell", RowData_Item1.ID, "SamplingQuantity"));
|
|
if (cjMin > cj) {
|
|
cj = cjMin;
|
|
}
|
|
}
|
|
}
|
|
},
|
|
shrinkToFit: false,
|
|
ondblClickRow: function (rowid, iRow, iCol, e) {
|
|
debugger;
|
|
var colModel = $("#gridList").jqGrid("getGridParam", "colModel");
|
|
var cellname = colModel[iCol].name;
|
|
if (cellname !== "BadReason") {
|
|
return; // 如果双击的不是 "BadReason" 列,则直接返回
|
|
}
|
|
|
|
$.modalOpen({
|
|
id: "InvCodeSelect",
|
|
title: "选择不良原因(可选)",
|
|
url: "/DHAY/ICSRCVIQCs/GetBadReasonCode?InvCode=" + InvCode,
|
|
width: "50%",
|
|
height: "50%",
|
|
callBack: function (iframeId) {
|
|
var obj = top.frames[iframeId].submitForm();
|
|
if (obj) {
|
|
debugger;
|
|
// 设置单元格值
|
|
$("#gridList").jqGrid('setCell', rowid, 'BadReason', obj.BadReasonDesc);
|
|
|
|
// 强制保存该单元格
|
|
try {
|
|
// 方法1:使用 saveCell
|
|
$("#gridList").jqGrid("saveCell", rowid, iCol);
|
|
|
|
// 方法2:直接更新行数据
|
|
var rowData = $("#gridList").jqGrid('getRowData', rowid);
|
|
rowData.BadReason = obj.BadReasonDesc;
|
|
$("#gridList").jqGrid('setRowData', rowid, rowData);
|
|
|
|
// 方法3:触发编辑和保存(更可靠)
|
|
$("#gridList").jqGrid('editRow', rowid, true);
|
|
$("#gridList").jqGrid('saveRow', rowid);
|
|
|
|
console.log("不良原因已设置并保存:", obj.BadReasonDesc);
|
|
} catch (e) {
|
|
console.error("保存单元格时出错:", e);
|
|
}
|
|
|
|
top.frames[iframeId].Close();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
$("#gridList").jqGrid('setFrozenColumns');
|
|
}
|
|
|
|
function gridList1() {
|
|
debugger;
|
|
document.getElementById("gridPanel1").innerHTML = '<table id="gridList1"></table> ';
|
|
var $gridList1 = $("#gridList1");
|
|
$gridList1.dataGrid({
|
|
url: "/DHAY/IQCQuality/GetInventoryInspectionNew1?InvCode=" + InvCode + "&" + Math.random() + "&SampleQuantity=" + SampleQuantity + "&ResultINp=" + ResultINp + "&JYID=" + JYID + "&LotNo=" + LotNo + "&AllNumber=" + AllNumber,
|
|
height: $(window).height() - 400,
|
|
width: 300,
|
|
cellEdit: true,
|
|
colModel: _Clos1,
|
|
cellsubmit: "clientArray",
|
|
sortname: 'GroupCode',
|
|
sortorder: "asc",
|
|
viewrecords: true,
|
|
rowNum: 200,
|
|
afterEditCell: function (rowid, cellname, value, iRow, iCol) {
|
|
lastrow1 = rowid;
|
|
lastcell1 = iCol;
|
|
},
|
|
afterSaveCell: function (rowid, cellname, value) {
|
|
debugger;
|
|
var obj_Item = $("#gridList");
|
|
var rowIds_Item = obj_Item.getDataIDs();
|
|
|
|
var obj_Item1 = $("#gridList1");
|
|
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]);
|
|
|
|
if (RowData_Item1.ID == rowid && cellname == "UnqualifiedQuantity") {
|
|
var SimpaleQuantity = Number($("#gridList1").jqGrid("getCell", RowData_Item1.ID, "SamplingQuantity"));
|
|
var AcceptableValue = Number($("#gridList1").jqGrid("getCell", RowData_Item1.ID, "EATTRIBUTE1"));
|
|
var result = Number($("#gridList1").jqGrid("getCell", RowData_Item1.ID, "UnqualifiedQuantity"));
|
|
if (SimpaleQuantity != 0 && result > SimpaleQuantity) {
|
|
$.modalMsg("不良数不能大于抽检数量", "warning");
|
|
$gridList1.jqGrid("setCell", RowData_Item1.ID, "UnqualifiedQuantity", " ");
|
|
return;
|
|
}
|
|
if (SimpaleQuantity == 0) {
|
|
if (result == 1) {
|
|
$gridList1.jqGrid("setCell", RowData_Item1.ID, "Result", "OK");
|
|
}
|
|
else {
|
|
$gridList1.jqGrid("setCell", RowData_Item1.ID, "Result", "NG");
|
|
}
|
|
}
|
|
else {
|
|
if (result > AcceptableValue) {
|
|
$gridList1.jqGrid("setCell", RowData_Item1.ID, "Result", "NG");
|
|
}
|
|
else {
|
|
$gridList1.jqGrid("setCell", RowData_Item1.ID, "Result", "OK");
|
|
}
|
|
}
|
|
var gridListOKCount = 0;
|
|
var gridList1OKCount = 0;
|
|
for (var k = 0; k < rowIds_Item.length; k++) {
|
|
var gridListData = obj_Item.getRowData(rowIds_Item[k]);
|
|
if (gridListData.Result == "OK") {
|
|
gridListOKCount++;
|
|
}
|
|
}
|
|
for (var j = 0; j < rowIds_Item1.length; j++) {
|
|
var gridList1Data = obj_Item1.getRowData(rowIds_Item1[j]);
|
|
if (gridList1Data.Result == "OK") {
|
|
gridList1OKCount++;
|
|
}
|
|
}
|
|
if (gridListOKCount == rowIds_Item.length && gridList1OKCount == rowIds_Item1.length) {
|
|
$("#txt_result").val("OK");
|
|
}
|
|
else {
|
|
$("#txt_result").val("NG");
|
|
}
|
|
var cjMin = Number($("#gridList1").jqGrid("getCell", RowData_Item1.ID, "SamplingQuantity"));
|
|
if (cjMin > cj) {
|
|
cj = cjMin;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
shrinkToFit: false,
|
|
ondblClickRow: function (rowid, iRow, iCol, e) {
|
|
debugger;
|
|
var colModel = $("#gridList1").jqGrid("getGridParam", "colModel");
|
|
var cellname = colModel[iCol].name;
|
|
if (cellname !== "BadReason") {
|
|
return; // 如果双击的不是 "BadReason" 列,则直接返回
|
|
}
|
|
|
|
$.modalOpen({
|
|
id: "InvCodeSelect",
|
|
title: "选择不良原因(可选)",
|
|
url: "/DHAY/ICSRCVIQCs/GetBadReasonCode?InvCode=" + InvCode,
|
|
width: "50%",
|
|
height: "50%",
|
|
callBack: function (iframeId) {
|
|
var obj = top.frames[iframeId].submitForm();
|
|
if (obj) {
|
|
debugger;
|
|
// 设置单元格值
|
|
$("#gridList1").jqGrid('setCell', rowid, 'BadReason', obj.BadReasonDesc);
|
|
|
|
// 强制保存该单元格
|
|
try {
|
|
// 方法1:使用 saveCell
|
|
$("#gridList1").jqGrid("saveCell", rowid, iCol);
|
|
|
|
// 方法2:直接更新行数据
|
|
var rowData = $("#gridList1").jqGrid('getRowData', rowid);
|
|
rowData.BadReason = obj.BadReasonDesc;
|
|
$("#gridList1").jqGrid('setRowData', rowid, rowData);
|
|
|
|
// 方法3:触发编辑和保存(更可靠)
|
|
$("#gridList1").jqGrid('editRow', rowid, true);
|
|
$("#gridList1").jqGrid('saveRow', rowid);
|
|
|
|
console.log("不良原因已设置并保存:", obj.BadReasonDesc);
|
|
} catch (e) {
|
|
console.error("保存单元格时出错:", e);
|
|
}
|
|
|
|
top.frames[iframeId].Close();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
$("#gridList1").jqGrid('setFrozenColumns');
|
|
}
|
|
|
|
function submitForm() {
|
|
debugger;
|
|
|
|
// 先强制保存所有编辑中的单元格
|
|
try {
|
|
if (lastrow !== null && lastcell !== null) {
|
|
$("#gridList").jqGrid("saveCell", lastrow, lastcell);
|
|
}
|
|
if (lastrow1 !== null && lastcell1 !== null) {
|
|
$("#gridList1").jqGrid("saveCell", lastrow1, lastcell1);
|
|
}
|
|
} catch (e) {
|
|
console.log("保存单元格时出错:", e);
|
|
}
|
|
|
|
// 确保获取最新的表格数据
|
|
$("#gridList").trigger("reloadGrid", { fromServer: false });
|
|
$("#gridList1").trigger("reloadGrid", { fromServer: false });
|
|
|
|
var ICSMTDOC = [];
|
|
var obj_Item1 = $("#gridList");
|
|
var Result = '';
|
|
var samplingQuantity = 0;
|
|
var rowIds_Item1 = obj_Item1.getDataIDs();
|
|
var obj_Item2 = $("#gridList1");
|
|
var rowIds_Item2 = obj_Item2.getDataIDs();
|
|
var SpecialPicks = Number($("#txt_specialPicks").val()) || 0;
|
|
var BadCount = Number($("#txt_badCount").val()) || 0;
|
|
var Filtering = Number($("#txt_filtering").val()) || 0;
|
|
var SpecialNumber = $("#txt_specialNumber").val();
|
|
var LotResult = "1";
|
|
LotResult = $("#txt_result").val() == "Ok" ? "1" : "0";
|
|
var Manhours = $("#txt_manhours").val();
|
|
var Rejections = Number($("#txt_rejections").val()) || 0;
|
|
var OtherNumber = $("#txt_otherNumber").val();
|
|
YLOTQTY = AllNumber - BadCount;
|
|
NLOTQTY = BadCount;
|
|
WaiveQuantity = SpecialPicks - 0 + (Filtering - 0);
|
|
|
|
if (Manhours == 0 || Manhours == "") {
|
|
$.modalMsg("工时必须填写!", "warning");
|
|
return;
|
|
}
|
|
|
|
// 调试:打印表格数据
|
|
console.log("=== 开始收集数据 ===");
|
|
|
|
if (rowIds_Item1.length > 0) {
|
|
for (var i = 0; i < rowIds_Item1.length; i++) {
|
|
var LWFiledName = new Array();
|
|
var RowData_Item1 = obj_Item1.getRowData(rowIds_Item1[i]);
|
|
var curRowData = $("#gridList").jqGrid('getRowData', RowData_Item1.ID);
|
|
if (samplingQuantity < (RowData_Item1.SamplingQuantity - 0)) {
|
|
samplingQuantity = RowData_Item1.SamplingQuantity - 0;
|
|
}
|
|
if (RowData_Item1.Result == "") {
|
|
$.modalMsg("定量检验区第" + (i + 1) + "行检验结论为空,必须所有行都有检验结论才能保存检验结果!", "warning");
|
|
return;
|
|
}
|
|
var chkValue = false;
|
|
for (var j = 0; j < _ColCaption.length; j++) {
|
|
var aaa = _ColCaption[j];
|
|
var bbb = _ColFiledName[j];
|
|
if (curRowData[bbb] != "") {
|
|
chkValue = true;
|
|
}
|
|
var objFiledName = {
|
|
FiledNamevalue: curRowData[bbb],
|
|
FiledNamekey: aaa
|
|
}
|
|
LWFiledName.push(objFiledName);
|
|
}
|
|
if (chkValue == false) {
|
|
$.modalMsg("定量检验区第" + (i + 1) + "行未填写实测值,每一行至少填写一个实测值!", "warning");
|
|
return;
|
|
}
|
|
|
|
// 处理结果值
|
|
if (RowData_Item1.Result == "OK" || RowData_Item1.Result == "合格") {
|
|
Result = '1';
|
|
} else {
|
|
Result = '0';
|
|
}
|
|
|
|
// 确保获取到正确的数据
|
|
var badReasonValue = RowData_Item1.BadReason || "";
|
|
var samplingQty = RowData_Item1.SamplingQuantity || 0;
|
|
var unqualifiedQty = RowData_Item1.UnqualifiedQuantity || 0;
|
|
|
|
console.log("定量检验区第" + (i + 1) + "行数据:");
|
|
console.log("- BadReason:", badReasonValue);
|
|
console.log("- SamplingQuantity:", samplingQty);
|
|
console.log("- UnqualifiedQuantity:", unqualifiedQty);
|
|
|
|
var obj = {
|
|
ID: RowData_Item1.ID,
|
|
InspectionID: JYID,
|
|
GroupCode: RowData_Item1.GroupCode,
|
|
GroupName: RowData_Item1.GroupName,
|
|
ListCode: RowData_Item1.ListCode,
|
|
ListName: RowData_Item1.ListName,
|
|
Unit: RowData_Item1.Unit,
|
|
SetValueMax: RowData_Item1.SetValueMax,
|
|
SetValueMin: RowData_Item1.SetValueMin,
|
|
SetValue: unqualifiedQty,
|
|
Result: Result,
|
|
NUM: RowData_Item1.NUM,
|
|
LWFiledName: LWFiledName,
|
|
BadReason: badReasonValue, // 确保这个字段存在
|
|
SamplingQuantity: samplingQty,
|
|
Memo: RowData_Item1.EATTRIBUTE30 || ""
|
|
};
|
|
ICSMTDOC.push(obj);
|
|
|
|
console.log("推送的数据对象:", obj);
|
|
}
|
|
}
|
|
|
|
if (rowIds_Item2.length > 0) {
|
|
for (var i = 0; i < rowIds_Item2.length; i++) {
|
|
var RowData_Item2 = obj_Item2.getRowData(rowIds_Item2[i]);
|
|
var curRowData = $("#gridList1").jqGrid('getRowData', RowData_Item2.ID)
|
|
if (samplingQuantity < (RowData_Item2.SamplingQuantity - 0)) {
|
|
samplingQuantity = RowData_Item2.SamplingQuantity - 0;
|
|
}
|
|
|
|
if (RowData_Item2.Result == "") {
|
|
$.modalMsg("定性检验区第" + (i + 1) + "行检验结论为空,必须所有行都有检验结论才能保存检验结果!", "warning");
|
|
return;
|
|
}
|
|
|
|
// 处理结果值
|
|
if (RowData_Item2.Result == "OK" || RowData_Item2.Result == "合格") {
|
|
Result = '1';
|
|
} else {
|
|
Result = '0';
|
|
}
|
|
|
|
// 确保获取到正确的数据
|
|
var badReasonValue = RowData_Item2.BadReason || "";
|
|
var samplingQty = RowData_Item2.SamplingQuantity || 0;
|
|
var unqualifiedQty = RowData_Item2.UnqualifiedQuantity || 0;
|
|
|
|
console.log("定性检验区第" + (i + 1) + "行数据:");
|
|
console.log("- BadReason:", badReasonValue);
|
|
console.log("- SamplingQuantity:", samplingQty);
|
|
console.log("- UnqualifiedQuantity:", unqualifiedQty);
|
|
|
|
var obj = {
|
|
ID: RowData_Item2.ID,
|
|
InspectionID: JYID,
|
|
GroupCode: RowData_Item2.GroupCode,
|
|
GroupName: RowData_Item2.GroupName,
|
|
ListCode: RowData_Item2.ListCode,
|
|
ListName: RowData_Item2.ListName,
|
|
Unit: RowData_Item2.Unit,
|
|
SetValueMax: "0",
|
|
SetValueMin: "0",
|
|
SetValue: unqualifiedQty,
|
|
Result: Result,
|
|
NUM: RowData_Item2.NUM,
|
|
LWFiledName: new Array(),
|
|
BadReason: badReasonValue, // 确保这个字段存在
|
|
SamplingQuantity: samplingQty,
|
|
Memo: RowData_Item2.EATTRIBUTE30 || ""
|
|
};
|
|
ICSMTDOC.push(obj);
|
|
|
|
console.log("推送的数据对象:", obj);
|
|
}
|
|
}
|
|
|
|
SampleQuantity = samplingQuantity;
|
|
|
|
// 在提交前输出完整数据用于调试
|
|
console.log("准备提交的完整数据:", JSON.stringify(ICSMTDOC, null, 2));
|
|
|
|
if (ResultINp != "") {
|
|
debugger;
|
|
$.modalConfirm("确定修改吗?", function (r) {
|
|
if (r) {
|
|
$.submitForm({
|
|
url: "/DHAY/IQCQuality/UpdateICSInspectionDetailNew?InvCode=" + InvCode + "&JYID=" + JYID + "&AllNumber=" + AllNumber + "&YLOTQTY=" + YLOTQTY + "&NLOTQTY=" + NLOTQTY + "&WaiveQuantity=" + WaiveQuantity + "&Filtering=" + Filtering + "&SpecialNumber=" + SpecialNumber + "&ResultINp=" + ResultINp + "&SpecialPicks=" + SpecialPicks + "&LotResult=" + LotResult + "&Manhours=" + Manhours + "&Rejections=" + Rejections + "&OtherNumber=" + OtherNumber,
|
|
param: { ICSMTDOC: JSON.stringify(ICSMTDOC), Lot: $("#txt_Lot").val(), InvCode: $("#txt_InvCode").val(), Type: Type, CJQty: SampleQuantity },
|
|
success: function () {
|
|
$.currentWindow().$("#gridList").trigger("reloadGrid");
|
|
}
|
|
})
|
|
}
|
|
});
|
|
} else {
|
|
debugger;
|
|
$.modalConfirm("确定保存吗?", function (r) {
|
|
if (r) {
|
|
$.submitForm({
|
|
url: "/DHAY/IQCQuality/SaveICSInspectionDetailNew?InvCode=" + InvCode + "&JYID=" + JYID + "&AllNumber=" + AllNumber + "&YLOTQTY=" + YLOTQTY + "&NLOTQTY=" + NLOTQTY + "&WaiveQuantity=" + WaiveQuantity + "&Filtering=" + Filtering + "&SpecialNumber=" + SpecialNumber + "&" + Math.random() + "&ResultINp=" + ResultINp + "&SpecialPicks=" + SpecialPicks + "&LotResult=" + LotResult + "&Manhours=" + Manhours + "&Rejections=" + Rejections + "&OtherNumber=" + OtherNumber,
|
|
param: { ICSMTDOC: JSON.stringify(ICSMTDOC), Lot: $("#txt_Lot").val(), InvCode: $("#txt_InvCode").val(), Type: Type, CJQty: SampleQuantity },
|
|
success: function () {
|
|
$.currentWindow().$("#gridList").trigger("reloadGrid");
|
|
}
|
|
})
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function Getcol() {
|
|
_ColCaption = new Array();
|
|
_ColFiledName = new Array();
|
|
$.ajax({
|
|
url: "/DHAY/ICSRCVIQCs/SelectSORRFQColumnName?InvCode=" + InvCode + "&JYID=" + JYID + "&" + "&LotNo=" + LotNo + "&" + 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: "EATTRIBUTE2", hidden: true };
|
|
cols.push(collast);
|
|
var collast = { label: '检验ID', name: 'InspectionID', hidden: true };
|
|
cols.push(collast);
|
|
var collast = { label: "检验项目组代码", name: "GroupCode", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "检验项目组名称", name: "GroupName", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "检验项目代码", name: "ListCode", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "检验项目名称", name: "ListName", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "单位", name: "Unit", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "检验标准", name: "InspectStander", width: 100, align: 'left', editable: false };
|
|
cols.push(collast);
|
|
var collast = { label: "检验仪器", name: "EATTRIBUTE7", width: 100, align: 'left', editable: false };
|
|
cols.push(collast);
|
|
var collast = { label: '标准上限', name: 'SetValueMax', width: 80, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: '标准下限', name: 'SetValueMin', width: 80, align: 'left' };
|
|
cols.push(collast);
|
|
|
|
if (data.length > 0 && data[0].ColCaption != null) {
|
|
debugger;
|
|
DateList = data;
|
|
if (SJKSumNum == 0) {
|
|
SJKSumNum = data.length;
|
|
}
|
|
for (var i = 0; i < data.length; i++) {
|
|
var ColCaption = data[i].ColCaption;
|
|
var ColFiledName = data[i].ColFiledName;
|
|
var obj = new Array();
|
|
obj = {
|
|
label: ColCaption,
|
|
name: ColFiledName,
|
|
width: 150,
|
|
align: "center",
|
|
sortable: false,
|
|
editable: true,
|
|
editrules: { number: true }
|
|
}
|
|
cols.push(obj);
|
|
_ColCaption.push(ColCaption);
|
|
_ColFiledName.push(ColFiledName);
|
|
}
|
|
};
|
|
|
|
if (data.length == 0) {
|
|
for (var i = 1; i < SumNum; i++) {
|
|
debugger;
|
|
var ColCaption = "实际值" + i;
|
|
var ColFiledName = "绑定" + i;
|
|
var obj = new Array();
|
|
obj = {
|
|
label: ColCaption,
|
|
name: ColFiledName,
|
|
width: 80,
|
|
align: "center",
|
|
sortable: false,
|
|
editable: true,
|
|
editrules: { number: true }
|
|
}
|
|
cols.push(obj);
|
|
_ColCaption.push(ColCaption);
|
|
_ColFiledName.push(ColFiledName);
|
|
}
|
|
}
|
|
|
|
if (data.length > 0) {
|
|
for (var i = data.length + 1; i <= SJKSumNum; i++) {
|
|
debugger;
|
|
var ColCaption = "实际值" + i;
|
|
var ColFiledName = "绑定" + i;
|
|
var obj = new Array();
|
|
obj = {
|
|
label: ColCaption,
|
|
name: ColFiledName,
|
|
width: 80,
|
|
align: "center",
|
|
sortable: false,
|
|
editable: true,
|
|
editrules: { number: true }
|
|
}
|
|
cols.push(obj);
|
|
_ColCaption.push(ColCaption);
|
|
_ColFiledName.push(ColFiledName);
|
|
}
|
|
}
|
|
|
|
var collast = { label: '抽检数量', name: 'SamplingQuantity', width: 80, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "允许不良数", name: "EATTRIBUTE1", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: '不良数', name: 'UnqualifiedQuantity', width: 150, align: 'left', editable: true, editrules: { number: true } };
|
|
cols.push(collast);
|
|
var collast = { label: '结论', name: 'Result', width: 150, align: 'left', editable: false };
|
|
cols.push(collast);
|
|
var collast = {
|
|
label: '不良原因',
|
|
name: 'BadReason',
|
|
width: 120,
|
|
align: 'left',
|
|
editable: true, // 允许编辑
|
|
editrules: { required: false }, // 设为非必填
|
|
editoptions: {
|
|
placeholder: "可选填"
|
|
}
|
|
};
|
|
cols.push(collast);
|
|
var collast = { label: '备注', name: 'EATTRIBUTE30', width: 120, align: 'left', editable: true };
|
|
cols.push(collast);
|
|
_Clos = cols;
|
|
}
|
|
});
|
|
}
|
|
|
|
function Getcol1() {
|
|
var cols = new Array();
|
|
var collast = { label: "主键", name: "ID", hidden: true, key: true };
|
|
cols.push(collast);
|
|
var collast = { label: "抽检值必填", name: "EATTRIBUTE2", hidden: true };
|
|
cols.push(collast);
|
|
var collast = { label: '检验ID', name: 'InspectionID', hidden: true };
|
|
cols.push(collast);
|
|
var collast = { label: "检验项目组代码", name: "GroupCode", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "检验项目组名称", name: "GroupName", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "检验项目代码", name: "ListCode", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "检验项目名称", name: "ListName", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "单位", name: "Unit", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "检验标准", name: "InspectStander", width: 100, align: 'left', editable: false };
|
|
cols.push(collast);
|
|
var collast = { label: "检验仪器", name: "EATTRIBUTE7", width: 100, align: 'left', editable: false };
|
|
cols.push(collast);
|
|
|
|
var collast = { label: '抽检数量', name: 'SamplingQuantity', width: 80, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "允许不良数", name: "EATTRIBUTE1", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: '不良数', name: 'UnqualifiedQuantity', width: 150, align: 'left', editable: true, editrules: { number: true } };
|
|
cols.push(collast);
|
|
var collast = { label: '结论', name: 'Result', width: 150, align: 'left', editable: false };
|
|
cols.push(collast);
|
|
var collast = {
|
|
label: '不良原因',
|
|
name: 'BadReason',
|
|
width: 120,
|
|
align: 'left',
|
|
editable: true, // 允许编辑
|
|
editrules: { required: false }, // 设为非必填
|
|
editoptions: {
|
|
placeholder: "可选填"
|
|
}
|
|
};
|
|
cols.push(collast);
|
|
var collast = { label: '备注', name: 'EATTRIBUTE30', width: 120, align: 'left', editable: true };
|
|
cols.push(collast);
|
|
_Clos1 = cols;
|
|
}
|
|
|
|
function AddRows_ColorFastness() {
|
|
debugger;
|
|
_LW = new Array();
|
|
AfterLW = new Array();
|
|
var $gridList = $("#gridList");
|
|
// 提前缓存_LW数据(兼容旧版)
|
|
if ($gridList.length > 0) {
|
|
try {
|
|
var rowIds = $gridList.getDataIDs();
|
|
for (var i = 0; i < rowIds.length; i++) {
|
|
var rowData = {};
|
|
if (_ColCaption.length > 0) {
|
|
for (var j = 0; j < _ColCaption.length; j++) {
|
|
var filedKey = _ColFiledName[j];
|
|
try {
|
|
var filedValue = $gridList.jqGrid('getCell', rowIds[i], filedKey);
|
|
} catch (e) {
|
|
var cellElem = $gridList.find("#" + rowIds[i] + "_" + filedKey);
|
|
var filedValue = cellElem.text() || cellElem.val() || "";
|
|
}
|
|
_LW.push({
|
|
ID: rowIds[i],
|
|
FiledNamekey: filedKey,
|
|
FiledNamevalue: filedValue
|
|
});
|
|
}
|
|
}
|
|
}
|
|
} catch (e) {
|
|
console.log("新增时缓存数据:", e);
|
|
}
|
|
}
|
|
SumNum = SumNum + 1;
|
|
SJKSumNum = SJKSumNum + 1;
|
|
Getcol();
|
|
gridList();
|
|
}
|
|
|
|
function DelRows_ColorFastness() {
|
|
_ColCaption = new Array();
|
|
_ColFiledName = new Array();
|
|
$.ajax({
|
|
url: "/DHAY/ICSRCVIQCs/deleteSelectSORRFQColumnName?InvCode=" + InvCode + "&JYID=" + JYID + "&" + "&LotNo=" + LotNo + "&" + 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: "EATTRIBUTE2", hidden: true };
|
|
cols.push(collast);
|
|
var collast = { label: '检验ID', name: 'InspectionID', hidden: true };
|
|
cols.push(collast);
|
|
var collast = { label: "检验项目组代码", name: "GroupCode", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "检验项目组名称", name: "GroupName", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "检验项目代码", name: "ListCode", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "检验项目名称", name: "ListName", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "单位", name: "Unit", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "检验标准", name: "InspectStander", width: 100, align: 'left', editable: false };
|
|
cols.push(collast);
|
|
var collast = { label: "检验仪器", name: "EATTRIBUTE7", width: 100, align: 'left', editable: false };
|
|
cols.push(collast);
|
|
var collast = { label: '标准上限', name: 'SetValueMax', width: 80, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: '标准下限', name: 'SetValueMin', width: 80, align: 'left' };
|
|
cols.push(collast);
|
|
|
|
if (data.length > 0 && data[0].ColCaption != null) {
|
|
debugger;
|
|
DateList = data;
|
|
if (SJKSumNum == 0) {
|
|
SJKSumNum = data.length;
|
|
}
|
|
for (var i = 0; i < data.length; i++) {
|
|
var ColCaption = data[i].ColCaption;
|
|
var ColFiledName = data[i].ColFiledName;
|
|
var obj = new Array();
|
|
obj = {
|
|
label: ColCaption,
|
|
name: ColFiledName,
|
|
width: 150,
|
|
align: "center",
|
|
sortable: false,
|
|
editable: true,
|
|
editrules: { number: true }
|
|
}
|
|
cols.push(obj);
|
|
_ColCaption.push(ColCaption);
|
|
_ColFiledName.push(ColFiledName);
|
|
}
|
|
};
|
|
|
|
if (data.length == 0) {
|
|
for (var i = 1; i < SumNum; i++) {
|
|
debugger;
|
|
var ColCaption = "实际值" + i;
|
|
var ColFiledName = "绑定" + i;
|
|
var obj = new Array();
|
|
obj = {
|
|
label: ColCaption,
|
|
name: ColFiledName,
|
|
width: 80,
|
|
align: "center",
|
|
sortable: false,
|
|
editable: true,
|
|
editrules: { number: true }
|
|
}
|
|
cols.push(obj);
|
|
_ColCaption.push(ColCaption);
|
|
_ColFiledName.push(ColFiledName);
|
|
}
|
|
}
|
|
|
|
if (data.length > 0) {
|
|
for (var i = data.length + 1; i <= SJKSumNum; i++) {
|
|
debugger;
|
|
var ColCaption = "实际值" + i;
|
|
var ColFiledName = "绑定" + i;
|
|
var obj = new Array();
|
|
obj = {
|
|
label: ColCaption,
|
|
name: ColFiledName,
|
|
width: 80,
|
|
align: "center",
|
|
sortable: false,
|
|
editable: true,
|
|
editrules: { number: true }
|
|
}
|
|
cols.push(obj);
|
|
_ColCaption.push(ColCaption);
|
|
_ColFiledName.push(ColFiledName);
|
|
}
|
|
}
|
|
|
|
var collast = { label: '抽检数量', name: 'SamplingQuantity', width: 80, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: "允许不良数", name: "EATTRIBUTE1", width: 100, align: 'left' };
|
|
cols.push(collast);
|
|
var collast = { label: '不良数', name: 'UnqualifiedQuantity', width: 150, align: 'left', editable: true, editrules: { number: true } };
|
|
cols.push(collast);
|
|
var collast = { label: '结论', name: 'Result', width: 150, align: 'left', editable: false };
|
|
cols.push(collast);
|
|
var collast = {
|
|
label: '不良原因',
|
|
name: 'BadReason',
|
|
width: 120,
|
|
align: 'left',
|
|
editable: true, // 允许编辑
|
|
editrules: { required: false }, // 设为非必填
|
|
editoptions: {
|
|
placeholder: "可选填"
|
|
}
|
|
};
|
|
cols.push(collast);
|
|
var collast = { label: '备注', name: 'EATTRIBUTE30', width: 120, align: 'left', editable: true };
|
|
cols.push(collast);
|
|
_Clos = cols;
|
|
}
|
|
});
|
|
_LW = new Array();
|
|
AfterLW = new Array();
|
|
var $gridList = $("#gridList");
|
|
if ($gridList.length > 0) {
|
|
try {
|
|
var rowIds = $gridList.getDataIDs();
|
|
for (var i = 0; i < rowIds.length; i++) {
|
|
if (_ColCaption.length > 0) {
|
|
for (var j = 0; j < _ColCaption.length; j++) {
|
|
var filedKey = _ColFiledName[j];
|
|
try {
|
|
var filedValue = $gridList.jqGrid('getCell', rowIds[i], filedKey);
|
|
} catch (e) {
|
|
var cellElem = $gridList.find("#" + rowIds[i] + "_" + filedKey);
|
|
var filedValue = cellElem.text() || cellElem.val() || "";
|
|
}
|
|
_LW.push({
|
|
ID: rowIds[i],
|
|
FiledNamekey: filedKey,
|
|
FiledNamevalue: filedValue
|
|
});
|
|
}
|
|
}
|
|
}
|
|
} catch (e) {
|
|
console.log("删除时缓存数据:", e);
|
|
}
|
|
}
|
|
if (SumNum > 1) SumNum = SumNum - 1;
|
|
if (SJKSumNum > 1) SJKSumNum = SJKSumNum - 1;
|
|
Getcol();
|
|
gridList();
|
|
}
|
|
|
|
//导入
|
|
function btn_Introduction() {
|
|
debugger;
|
|
$("#FileUp").click();
|
|
}
|
|
function btn_UPload() {
|
|
$("#FileUp").click();
|
|
}
|
|
|
|
function btnUpLoad(up) {
|
|
var form = new FormData(document.getElementById("form1"));
|
|
var lot = "";
|
|
if (JYID == "" || JYID == "null") {
|
|
lot = LotNo;
|
|
}
|
|
else {
|
|
lot = JYID;
|
|
}
|
|
debugger;
|
|
$.ajax({
|
|
url: "/DHAY/ICSRCVIQCs/UploadFile?LotNo=" + lot + "&" + Math.random(),
|
|
type: "post",
|
|
data: form,
|
|
contentType: false,
|
|
processData: false,
|
|
success: function (data) {
|
|
debugger;
|
|
if (data == "导入成功" || data == true) {
|
|
Getcol();
|
|
gridList();
|
|
alert("导入成功");
|
|
}
|
|
else {
|
|
alert(data);
|
|
}
|
|
},
|
|
error: function (aa) {
|
|
alert("导入失败:" + aa);
|
|
}
|
|
});
|
|
}
|
|
|
|
// 公共方法:重新判断所有实际值是否超上下限,并设置对应文字颜色
|
|
function reSetActualValueColor() {
|
|
debugger;
|
|
var obj_Item = $("#gridList");
|
|
var rowIds_Item = obj_Item.getDataIDs();
|
|
|
|
if (rowIds_Item.length > 0) {
|
|
for (var i = 0; i < rowIds_Item.length; i++) {
|
|
var RowData_Item1 = obj_Item.getRowData(rowIds_Item[i]);
|
|
var SetValueMax = Number($("#gridList").jqGrid("getCell", RowData_Item1.ID, "SetValueMax"));
|
|
var SetValueMin = Number($("#gridList").jqGrid("getCell", RowData_Item1.ID, "SetValueMin"));
|
|
|
|
for (var j = 0; j < _ColFiledName.length; j++) {
|
|
var result = Number($("#gridList").jqGrid("getCell", RowData_Item1.ID, _ColFiledName[j]));
|
|
if (isNaN(result)) {
|
|
continue;
|
|
}
|
|
if (result >= SetValueMin && result <= SetValueMax) {
|
|
$("#gridList").jqGrid('setCell', RowData_Item1.ID, _ColFiledName[j], '', { color: 'black' });
|
|
} else {
|
|
$("#gridList").jqGrid('setCell', RowData_Item1.ID, _ColFiledName[j], '', { color: 'red' });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// 调试函数:查看当前表格数据
|
|
function debugData() {
|
|
debugger;
|
|
var obj_Item1 = $("#gridList");
|
|
var rowIds_Item1 = obj_Item1.getDataIDs();
|
|
var obj_Item2 = $("#gridList1");
|
|
var rowIds_Item2 = obj_Item2.getDataIDs();
|
|
|
|
console.log("=== 定量检验区数据 ===");
|
|
for (var i = 0; i < rowIds_Item1.length; i++) {
|
|
var rowData = obj_Item1.getRowData(rowIds_Item1[i]);
|
|
console.log("行" + (i + 1) + ":", rowData);
|
|
console.log("不良原因值:", rowData.BadReason);
|
|
console.log("数据类型:", typeof rowData.BadReason);
|
|
}
|
|
|
|
console.log("=== 定性检验区数据 ===");
|
|
for (var i = 0; i < rowIds_Item2.length; i++) {
|
|
var rowData = obj_Item2.getRowData(rowIds_Item2[i]);
|
|
console.log("行" + (i + 1) + ":", rowData);
|
|
console.log("不良原因值:", rowData.BadReason);
|
|
console.log("数据类型:", typeof rowData.BadReason);
|
|
}
|
|
|
|
$.modalAlert("数据已输出到控制台,请按F12查看", "info");
|
|
}
|
|
</script>
|
|
<form id="form1">
|
|
<div class="topPanel" style="height:15px">
|
|
<div class="toolbar">
|
|
<div class="btn-group">
|
|
<input id="FileUp" name="FileUp" type="file" style="display:none;" accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" onchange="btnUpLoad(this)" />
|
|
<a id="NF-Introduction" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_UPload()">导入</a>
|
|
<!-- 添加调试按钮 -->
|
|
<a class="btn btn-warning dropdown-text" onclick="debugData()">调试数据</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div style="padding-top: 20px; margin-right: 20px;">
|
|
<div class="ibox-title">
|
|
主表
|
|
</div>
|
|
<table class="form">
|
|
<tr>
|
|
<td style="text-align:right;"><label class="lglabel" for="txt_InvCode">条码批次</label>:</td>
|
|
<td>
|
|
<div class="input-group">
|
|
<input id="txt_Lot" type="text" class="form-control" style="width: 100px;" readonly="readonly">
|
|
</div>
|
|
</td>
|
|
<td style="width:20px"></td>
|
|
<td style="text-align:right;"><label class="lglabel" for="txt_RulesCode">条码数量</label>:</td>
|
|
<td>
|
|
<div class="input-group">
|
|
<input id="txt_LotQty" type="text" class="form-control" style="width: 100px;" readonly="readonly">
|
|
</div>
|
|
</td>
|
|
<td style="width:20px"></td>
|
|
<td style="text-align:right;"><label class="lglabel" for="txt_RulesName">检验属性</label>:</td>
|
|
<td colspan="3">
|
|
<div class="input-group">
|
|
<input id="txt_RulesType" type="text" class="form-control" style="width: 100px;" readonly="readonly">
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr></tr>
|
|
<tr>
|
|
<td style="text-align:right;"><label class="lglabel" for="txt_InvCode">存货代码</label>:</td>
|
|
<td>
|
|
<div class="input-group">
|
|
<input id="txt_InvCode" type="text" class="form-control" style="width: 100px;" readonly="readonly">
|
|
</div>
|
|
</td>
|
|
<td style="width:20px"></td>
|
|
<td style="text-align:right;"><label class="lglabel" for="txt_RulesCode">存货名称</label>:</td>
|
|
<td>
|
|
<div class="input-group">
|
|
<input id="txt_InvName" type="text" class="form-control" style="width: 100px;" readonly="readonly">
|
|
</div>
|
|
</td>
|
|
<td style="width:20px"></td>
|
|
<td style="text-align:right;"><label class="lglabel" for="txt_RulesName">规格型号</label>:</td>
|
|
<td colspan="3">
|
|
<div class="input-group">
|
|
<input id="txt_InvStd" type="text" class="form-control" style="width: 100px;" readonly="readonly">
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr></tr>
|
|
<tr>
|
|
<td style="text-align:right;"><label class="lglabel" for="txt_badCount">总不良数</label>:</td>
|
|
<td>
|
|
<div class="input-group">
|
|
<input id="txt_badCount" type="text" class="form-control" style="width: 100px;" oninput="value=value.replace(/[^\d]/g,'')">
|
|
</div>
|
|
</td>
|
|
<td style="width:20px"></td>
|
|
<td style="text-align:right;"><label class="lglabel" for="txt_specialPicks">特采数量</label>:</td>
|
|
<td>
|
|
<div class="input-group">
|
|
<input id="txt_specialPicks" type="text" class="form-control" value="0" style="width: 100px;" oninput="value=value.replace(/[^\d]/g,'')">
|
|
</div>
|
|
</td>
|
|
<td style="width:20px"></td>
|
|
<td style="text-align:right;"><label class="lglabel" for="txt_filtering">上线筛选数量</label>:</td>
|
|
<td>
|
|
<div class="input-group">
|
|
<input id="txt_filtering" type="text" class="form-control" style="width: 100px;" oninput="value=value.replace(/[^\d]/g,'')">
|
|
</div>
|
|
</td>
|
|
<td style="text-align:right;"><label class="lglabel" for="txt_specialNumber">特采单号</label>:</td>
|
|
<td>
|
|
<div class="input-group">
|
|
<input id="txt_specialNumber" type="text" class="form-control" style="width: 100px;">
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td style="text-align:right;"><label class="lglabel" for="txt_result">检测结果</label>:</td>
|
|
<td>
|
|
<div class="input-group">
|
|
<input id="txt_result" type="text" class="form-control" style="width: 100px;" value="OK" oninput="value=value.replace(/[^\d]/g,'')" readonly="readonly">
|
|
</div>
|
|
</td>
|
|
<td style="width:20px"></td>
|
|
<td style="text-align:right;"><span style="color:red">*</span><label class="lglabel" for="txt_manhours">工时</label>:</td>
|
|
<td>
|
|
<div class="input-group">
|
|
<input id="txt_manhours" type="text" class="form-control required" value="0" style="width: 100px;" oninput="value=value.replace(/[^\d.]/g,'').replace(/\.{2,}/g,'.').replace(/^\./g,'').replace(/(\.\d*)\./g,'$1')">
|
|
</div>
|
|
</td>
|
|
<td style="width:20px"></td>
|
|
<td style="text-align:right;"><label class="lglabel" for="txt_rejections">拒收数量</label>:</td>
|
|
<td>
|
|
<div class="input-group">
|
|
<input id="txt_rejections" type="text" class="form-control" value="0" style="width: 100px;" oninput="value=value.replace(/[^\d]/g,'')">
|
|
</div>
|
|
</td>
|
|
<td style="text-align:right;"><label class="lglabel" for="txt_otherNumber">其它数量</label>:</td>
|
|
<td>
|
|
<div class="input-group">
|
|
<input id="txt_otherNumber" type="text" class="form-control" value="0" style="width: 100px;">
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</form>
|
|
<div class="ibox-title">
|
|
定量检验区:
|
|
</div>
|
|
<div class="gridPanel2">
|
|
<div id="gridPager">
|
|
<label class="radio-inline">
|
|
<a style="margin-left:3px;" class="btn btn-next" onclick="AddRows_ColorFastness(); return false;"><i class="fa fa-plus" style="margin-right:5px"></i>新增</a>
|
|
</label>
|
|
<label class="radio-inline">
|
|
<a style="margin-left:3px;" class="btn btn-next" onclick="DelRows_ColorFastness(); return false;"><i class="fa fa-minus" style="margin-right:5px"></i>删除</a>
|
|
</label>
|
|
</div>
|
|
<div class="gridPanel" id="gridPanel">
|
|
<table id="gridList"></table>
|
|
</div>
|
|
</div>
|
|
<div class="ibox-title" style="height: 30px;">
|
|
定性检验区:
|
|
</div>
|
|
<div class="gridPanel1">
|
|
<div class="gridPanel1" id="gridPanel1">
|
|
<table id="gridList1"></table>
|
|
</div>
|
|
</div>
|