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.
 
 
 
 
 

964 lines
44 KiB

@{
ViewBag.Title = "";
Layout = "~/Views/Shared/_Form.cshtml";
}
<script src="~/Content/js/datepicker/WdatePicker.js"></script>
<!--引入 element-ui 的样式,-->
<link rel="stylesheet" href="~/Content/element-ui/lib/theme-chalk/index.css">
<script src="~/Content/vue/dist/vue.js"></script>
<script src="~/Content/element-ui/lib/index.js"></script>
<script src="~/Content/axios.min.js"></script>
<style>
.redClass {
color: red;
}
</style>
<form id="form1">
<input id='FileUp3' type='file' style="display: none" onchange="UpLoadLabelFile(this)" />
<div id="app">
<template>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
@*<el-divider>主表信息</el-divider>*@
<el-row :gutter="24">
<el-col :span="4">
<el-form-item label="物料编码" prop="InvCode">
<el-input v-model="form.InvCode" placeholder="请输入内容" size="mini" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="物料名称" prop="InvName">
<el-input v-model="form.InvName" placeholder="请输入内容" size="mini" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="批次" prop="InvBatcgNo">
<el-input v-model="form.InvBatcgNo" placeholder="请输入内容" size="mini" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="仓库" prop="WHCode">
<el-select v-model="form.WHCode" placeholder="请选择" size="mini">
<el-option v-for="item in WHCodeList"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="4">
<el-form-item label="批次数量" prop="qty">
<el-input v-model="qty" size="mini" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="单位" prop="InvUnit">
<el-input v-model="form.InvUnit" size="mini" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="抽检数量" prop="AqlCheckQty">
<el-input v-model="form.AqlCheckQty" size="mini" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="总判定结果" prop="Result">
<el-input v-model="form.Result" size="mini" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="异常文件" prop="WgNgFile">
<el-input v-model="form.WgNgFile" size="mini" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<a id="NF-Uploading" authorize="yes" class="btn btn-primary dropdown-text" onclick="UpLoadClick()"><i class="fa fa-file-excel-o"></i>上传</a>
<input id='FileUp2' type='file' style="display: none" v-on:change="change4FileUp2" />
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="24">
@*<el-button type="primary" size="mini" v-on:click="addLine()">新增</el-button>*@
<a id="NF-Add" authorize="no" style="margin-left:3px;" class="btn btn-primary" v-on:click="queryCheckRecord()"><i class="fa fa-pencil-square-o"></i>历史检验记录</a>
<a id="NF-QualFile" authorize="no" style="margin-left:3px;" class="btn btn-primary" v-on:click="viewFile()"><i class="fa fa-pencil-square-o"></i>质量文件查看</a>
<a id="NF-Add" authorize="no" style="margin-left:3px;" class="btn btn-primary" v-on:click="test()"><i class="fa fa-pencil-square-o"></i>破坏性实验</a>
<a id="NF-Add" authorize="no" style="margin-left:3px;" class="btn btn-primary" v-on:click="SizeJudge()"><i class="fa fa-pencil-square-o"></i>尺寸合格</a>
<a id="NF-Add" authorize="no" style="margin-left:3px;" class="btn btn-primary" v-on:click="finalJudge()"><i class="fa fa-pencil-square-o"></i>总结果判定</a>
<a id="NF-VendorFile" authorize="no" style="margin-left:3px;" class="btn btn-primary" v-on:click="VendorFile()"><i class="fa fa-pencil-square-o"></i>供应商检验报告</a>
<a id="NF-Uploading1" authorize="yes" class="btn btn-primary dropdown-text" onclick="UpLoadClick1()"><i class="fa fa-file-excel-o"></i>检测报告上传</a>
@*<a id="NF-ExportInspection" authorize="yes" class="btn btn-primary"><i class="fa fa-download" onclick="LookFiles()"></i>检测报告下载</a>*@
</el-col>
</el-row>
<el-divider>尺寸检验</el-divider>
<el-row :gutter="24">
<el-col :span="24">
<el-table ref="singleTable" highlight-current-row
:data="dataSource4CC"
style="width: 100%"
stripe border
size="mini"
height="300"
v-on:current-change="handleCurrentChange4CC">
@*<el-table-column type="index" width="50"></el-table-column>*@
<el-table-column prop="CheckItemCode" label="检验项目编码" width="120">
</el-table-column>
<el-table-column prop="CheckAttrText" label="分类" width="60">
</el-table-column>
<el-table-column prop="CheckItemName" label="检验描述" width="140">
</el-table-column>
<el-table-column prop="CheckWay" label="检验方法" width="140">
</el-table-column>
<el-table-column prop="CheckAqlName" label="抽样标准" width="150">
</el-table-column>
<el-table-column prop="RulesType" label="检验类别" width="150">
</el-table-column>
<el-table-column prop="RulesDesc" label="Aql描述" width="100">
</el-table-column>
<el-table-column prop="SetValueMax" label="上限值" width="60">
</el-table-column>
<el-table-column prop="SetValueMin" label="下限值" width="60">
</el-table-column>
<el-table-column prop="Unit" label="单位" width="60">
</el-table-column>
<el-table-column prop="S1" label="S1" width="80">
<template slot-scope="scope">
<el-input-number v-model="scope.row.S1" :min="0" size="small" style="width:60px;" :controls="false" v-on:change="() => change4S1('S1')"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="S2" label="S2" width="80">
<template slot-scope="scope">
<el-input-number v-model="scope.row.S2" :min="0" size="small" style="width:60px;" :controls="false" v-on:change="() => change4S1('S2')"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="S3" label="S3" width="80">
<template slot-scope="scope">
<el-input-number v-model="scope.row.S3" :min="0" size="small" style="width:60px;" :controls="false" v-on:change="() => change4S1('S3')"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="S4" label="S4" width="80">
<template slot-scope="scope">
<el-input-number v-model="scope.row.S4" :min="0" size="small" style="width:60px;" :controls="false" v-on:change="() => change4S1('S4')"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="S5" label="S5" width="80">
<template slot-scope="scope">
<el-input-number v-model="scope.row.S5" :min="0" size="small" style="width:60px;" :controls="false" v-on:change="() => change4S1('S5')"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="S6" label="S6" width="80">
<template slot-scope="scope">
<el-input-number v-model="scope.row.S6" :disabled='scope.row.RulesDesc!="加严检验"' :min="0" size="small" style="width:60px;" :controls="false" v-on:change="() => change4S1('S6')"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="S7" label="S7" width="80">
<template slot-scope="scope">
<el-input-number v-model="scope.row.S7" :disabled='scope.row.RulesDesc!="加严检验"' :min="0" size="small" style="width:60px;" :controls="false" v-on:change="() => change4S1('S7')"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="S8" label="S8" width="80">
<template slot-scope="scope">
<el-input-number v-model="scope.row.S8" :disabled='scope.row.RulesDesc!="加严检验"' :min="0" size="small" style="width:60px;" :controls="false" v-on:change="() => change4S1('S8')"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="S9" label="S9" width="80">
<template slot-scope="scope">
<el-input-number v-model="scope.row.S9" :disabled='scope.row.RulesDesc!="加严检验"' :min="0" size="small" style="width:60px;" :controls="false" v-on:change="() => change4S1('S9')"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="S10" label="S10" width="80">
<template slot-scope="scope">
<el-input-number v-model="scope.row.S10"
:disabled='scope.row.RulesDesc!="加严检验"'
:min="0" size="small" style="width:60px;" :controls="false" v-on:change="() => change4S1('S10')"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="Result" label="判定结果" width="80">
</el-table-column>
<el-table-column prop="Remark" label="备注" width="300">
<template slot-scope="scope">
<el-input v-model="scope.row.Remark" size="mini"></el-input>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="15">
<el-divider>抽样检验</el-divider>
<el-table ref="singleTable2" highlight-current-row
:data="dataSource4WG"
style="width: 100%"
stripe border
size="mini"
height="500"
v-on:current-change="handleCurrentChange4WG">
@*<el-table-column type="index" width="50"></el-table-column>*@
<el-table-column prop="CheckItemCode" label="检验项目编码" width="120">
</el-table-column>
<el-table-column prop="CheckAttrText" label="分类" width="60">
</el-table-column>
<el-table-column prop="CheckItemName" label="检验描述" width="300">
</el-table-column>
<el-table-column prop="CheckWay" label="检验方法" width="100">
</el-table-column>
<el-table-column prop="CheckAqlName" label="抽样标准" width="100">
</el-table-column>
<el-table-column prop="RulesType" label="检验类别" width="100">
</el-table-column>
<el-table-column prop="AqlQty" label="抽检数量" width="100">
</el-table-column>
<el-table-column prop="GoodQty" label="合格数量" width="100">
<template slot-scope="scope">
<el-input-number v-model="scope.row.GoodQty" :min="0" size="small" style="width:60px;" :controls="false" v-on:change="change4GoodQty"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="NgQty" label="不合格数量" width="100">
<template slot-scope="scope">
<el-input-number v-model="scope.row.NgQty" :min="0" size="small" style="width:60px;" :controls="false" v-on:change="change4NgQty"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="Result" label="判定结果" width="80">
</el-table-column>
<el-table-column prop="Remark" label="备注" width="300">
<template slot-scope="scope">
<el-input v-model="scope.row.Remark" size="mini"></el-input>
</template>
</el-table-column>
</el-table>
</el-col>
<el-col :span="9">
<el-divider>性能检验</el-divider>
<el-table ref="singleTable3" highlight-current-row
:data="dataSource4XN"
style="width: 100%"
stripe border
size="mini"
height="500"
v-on:current-change="handleCurrentChange4XN">
<el-table-column type="index" width="50"></el-table-column>
<el-table-column prop="CheckAttrText" label="分类" width="60">
</el-table-column>
<el-table-column prop="CheckItemName" label="检验描述" width="300">
</el-table-column>
<el-table-column prop="RulesType" label="检验类别" width="100">
</el-table-column>
<el-table-column prop="Result" label="检验结果" width="150">
<template slot-scope="scope">
<el-radio-group v-model="scope.row.Result">
<el-radio-button label="OK"></el-radio-button>
<el-radio-button label="NG"></el-radio-button>
</el-radio-group>
</template>
</el-table-column>
<el-table-column prop="Remark" label="备注" width="300">
<template slot-scope="scope">
<el-input v-model="scope.row.Remark" size="mini"></el-input>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
</el-form>
</template>
</div>
</form>
<script type="text/javascript">
//const { Console } = require("node:console");
function UpLoadClick() {
//var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
//if (ids.length != 1) {
// $.modalAlertNew("WMS00050");
// return;
//}
$("#FileUp2").click();
}
var InvCode = '@ViewData["InvCode"]';
var InvBatcgNo = '@ViewData["InvBatcgNo"]';
var vm = new Vue({
el: '#app',
data: {
id:'',
userCode: "",
ssList: [],
form: {},
dataSource4CC: [],
dataSource4WG: [],
dataSource4XN: [],
WHCodeList:[],
currentRow4CC: null,
currentRow4WG: null,
currentRow4XN: null,
rules: {
},
disabled4RulesCode: false,
destroyExprementDataSource: [],
qty: 0,
docType: '',
ASNCode: '',
InvCode: '',
InvBatcgNo: ''
},
//挂在DOM 触发
mounted() {
//let reactiveObject = {
//};
//this.form = reactiveObject;
// this.loadGrid();
// this.show();
this.id = '@ViewData["ids"]';
this.qty = @ViewData["qty"];
this.docType = @ViewData["docType"];
this.ASNCode = '@ViewData["ASNCode"]';
this.InvCode = '@ViewData["InvCode"]';
this.InvBatcgNo = '@ViewData["InvBatcgNo"]';
this.initControl();
// console.log(this.id);
},
beforeDestroy() {
// this.autoScrol1(true);
},
methods: {
change4FileUp2(e) {
debugger;
var files = e.target.files;
var fileName = files[0].name;
// vm.setExFileName(fileName);
this.form.WgNgFile = fileName;
if (fileName != null && fileName != "") {
var data = new FormData();
jQuery.each(jQuery('#FileUp2')[0].files, function (i, file) {
data.append('file-' + i, file);
});
data.append("ID", '001');
// data.append("LableName", LableName);
$.modalConfirm("确定上传文件吗?", function (r) {
if (r) {
$.ajax({
url: "/BBWMS/IQCQuality/UpLoadMaterialCheckExFile" + "?" + Math.random(),
type: "post",
data: data,
contentType: false,
processData: false,
dataType: "json",
success: function (data) {
// console.log(data);
if (data.message == "上传成功!") {
$.modalMsg("操作成功", "success");
// $.currentWindow().$("#gridList").trigger("reloadGrid");
}
else {
$.modalMsg(data.message, "warning");
}
},
error: function (aa) {
$.modalAlertNew("WMS00016", aa);
}
});
}
});
}
},
setExFileName(val) {
this.form.WgNgFile = val;
},
getAllWHCodeList() {
axios
.get('/BBWMS/IQCQuality/GetSelectItemList?keyValue=InspectionWH')
.then(function (res) {
//debugger;
if (res.data) {
res.data.forEach(function (el, i) {
Vue.set(vm.WHCodeList, i, el)
});
}
})
.catch(function (error) { // 请求失败处理
alert(error);
});
},
change4S1(field) {
debugger;
console.log('变化的列是:', field);
// console.log('S1数改变');
//debugger;
let currentRow = this.dataSource4CC.filter((x) => x.ID == this.currentRow4CC.ID)[0];
if (!currentRow) {
return;
}
let upper = currentRow.SetValueMax;
let lower = currentRow.SetValueMin;
const currentNum = Number(field.match(/\d+/)[0]);
// 初始化结果为true
let result = true;
// 循环从1到当前数字(包含当前数字)
for (let i = 1; i <= 5; i++) {
// 动态访问currentRow的S1、S2...属性
const currentValue = currentRow[`S${i}`];
// 如果字段值为 undefined 或 null,跳过判断(不视为 NG)
if (currentValue !== undefined && currentValue !== null && currentValue !== '') {
// 累积检查结果(有一个不通过则整体为false)
result = result && this.checkResult(currentValue, upper, lower);
}
// 如果已经为false,可提前退出循环优化性能
if (!result) break;
}
// 加严检验的额外判断(保持原有逻辑)
if (result && currentRow.RulesDesc === "加严检验") {
// 这里假设加严检验固定需要检查到S10,可根据实际需求调整
for (let i = 6; i <= 10; i++) {
const currentValue = currentRow[`S${i}`];
// 加严检验要求所有字段都必须填写
if (currentValue === undefined || currentValue === null || currentValue === '') {
// 如果有未填写的字段,设置为未判定状态
currentRow.Result = '';
return;
}
result = result && this.checkResult(currentValue, upper, lower);
if (!result) break;
}
}
currentRow.Result = result ? "OK" : "NG";
//let result = this.checkResult(currentRow.S1, upper, lower)
// && this.checkResult(currentRow.S2, upper, lower)
// && this.checkResult(currentRow.S3, upper, lower)
// && this.checkResult(currentRow.S4, upper, lower)
// && this.checkResult(currentRow.S5, upper, lower);
//if (result && currentRow.RulesDesc == "加严检验")
// result = result
// && this.checkResult(currentRow.S6, upper, lower)
// && this.checkResult(currentRow.S7, upper, lower)
// && this.checkResult(currentRow.S8, upper, lower)
// && this.checkResult(currentRow.S9, upper, lower)
// && this.checkResult(currentRow.S10, upper, lower);
//if (result)
// currentRow.Result = "OK";
//else
// currentRow.Result = "NG";
},
checkResult(value, upper, lower) {
return value >= lower && value <= upper;
},
change4GoodQty(currentValue, oldValue) {
//console.log('OK数改变');
//debugger;
let currentRow = this.dataSource4WG.filter((x) => x.ID == this.currentRow4WG.ID)[0];
if (currentRow) {
currentRow.NgQty = currentRow.AqlQty - currentValue;
if (currentRow.NgQty < 0) {
currentRow.GoodQty = 0;
currentRow.NgQty = 0;
}
else {
this.judgeWGRowResult(currentRow);
}
}
},
change4NgQty(currentValue, oldValue) {
//console.log('NG数改变');
let currentRow = this.dataSource4WG.filter((x) => x.ID == this.currentRow4WG.ID)[0];
if (currentRow) {
currentRow.GoodQty = currentRow.AqlQty - currentValue;
if (currentRow.GoodQty < 0) {
currentRow.GoodQty = 0;
currentRow.NgQty = 0;
}
else {
this.judgeWGRowResult(currentRow);
}
}
},
judgeCCRowResult() {
},
judgeWGRowResult(currentRow) {
//debugger;
if (!currentRow) {
return;
}
if (currentRow.NgQty <= this.form.AllowNgQty) {
currentRow.Result = "OK";
}
else {
currentRow.Result = "NG";
}
},
initControl: function () {
let that = this;
let orgName = '';
this.disabled4RulesCode = this.id ? true : false;
let userName = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserName';
// console.log(userName);
this.getAllWHCodeList();
this.getData();
},
finalJudge() {
for (var i = 0; i < this.dataSource4CC.length; i++) {
let item = this.dataSource4CC[i];
if (!item.Result) {
$.modalMsg("当前行没有检验结果" + " 尺寸检验,第" + (i + 1) + "行", "warning");
return false;
}
}
for (var i = 0; i < this.dataSource4WG.length; i++) {
let item = this.dataSource4WG[i];
if (!item.Result) {
$.modalMsg("当前行没有检验结果" + " 外观检验,第" + (i + 1) + "行", "warning");
return false;
}
}
for (var i = 0; i < this.dataSource4XN.length; i++) {
let item = this.dataSource4XN[i];
if (!item.Result) {
$.modalMsg("当前行没有检验结果" + " 性能检验,第" + (i + 1) + "行", "warning");
return false;
}
}
this.form.Result = "OK";
this.dataSource4CC.forEach((item) => {
if (item.Result == 'NG') {
this.form.Result = "NG";
}
})
this.dataSource4WG.forEach((item) => {
if (item.Result == 'NG') {
this.form.Result = "NG";
}
})
this.dataSource4XN.forEach((item) => {
if (item.Result == 'NG') {
this.form.Result = "NG";
}
})
//if (!this.form.Result) {
// this.form.Result = "OK";
//}
},
queryCheckRecord() {
$.modalOpen({
id: "Formdd",
title: "历史检验记录",
url: "/BBWMS/IQCQuality/MaterialCheckLog?ids=" + this.form.InvCode + "",
width: "1600px",
height: "400px",
callBack: function (iframeId) {
//let data=top.frames[iframeId].submitForm();
}
});
},
SizeJudge() {
for (var i = 0; i < this.dataSource4CC.length; i++) {
let item = this.dataSource4CC[i];
item.Result = 'OK';
//if (!item.Result) {
// $.modalMsg("当前行没有检验结果" + " 尺寸检验,第" + (i + 1) + "行", "warning");
// return false;
//}
}
},
viewFile() {
$.modalOpen({
id: "Formdd",
title: "质量履历文件查看",
url: "/BBWMS/IQCQuality/Item2AqlFileView?ids=" + this.form.InvCode + "",
width: "1200px",
height: "400px",
callBack: function (iframeId) {
//let data=top.frames[iframeId].submitForm();
}
});
},
test() {
let _this = this;
$.modalOpen({
id: "Formdd",
title: "破坏性实验抽选结果",
url: "/BBWMS/IQCQuality/MaterialDestoryExperimentEdit?ids=" + _this.id+ "",
width: "1200px",
height: "400px",
callBack: function (iframeId) {
//debugger;
let data = top.frames[iframeId].submitForm();//破坏性结果
top.frames[iframeId].Close();
_this.destroyExprementDataSource = data;
// console.log(data);
}
});
},
VendorFile() {
let _this = this;
$.modalOpen({
id: "Formdd",
title: "供应商文件查看",
url: "/BBWMS/IQCQuality/VendorFileIndex?ASNCode=" + _this.ASNCode + "&InvCode=" + this.form.InvCode + "&BatchCode=" + this.form.InvBatcgNo + "",
width: "1200px",
height: "400px",
callBack: function (iframeId) {
//let data=top.frames[iframeId].submitForm();
}
});
},
getData() {
if (!this.id) return;
let _this = this;
axios
.get('/BBWMS/IQCQuality/GetMaterialCheckMain2?keyValue=' + _this.id + '&qty=' + _this.qty )
.then(function (res) {
// debugger;
if (res.data) {
if (res.data[0]) {
for (var i in res.data[0]) {
Vue.set(vm.form, i, res.data[0][i]);
}
}
}
})
.then(function () {
axios
.get('/BBWMS/IQCQuality/GetMaterialCheckMain4CC?keyValue=' + _this.form.InvCode)
.then(function (res2) {
//console.log(res2);
if (res2.data) {
res2.data.forEach(function (el, i) {
// 将 S1 和 S2 的默认值设为空
el.S1 = undefined;
el.S2 = undefined;
el.S3 = undefined;
el.S4 = undefined;
el.S5 = undefined;
el.S6 = undefined;
el.S7 = undefined;
el.S8 = undefined;
el.S9 = undefined;
el.S10 = undefined;
Vue.set(vm.dataSource4CC, i, el)
});
}
});
})
.then(function () {
axios
.get('/BBWMS/IQCQuality/GetMaterialCheckMain4WG?keyValue=' + _this.form.InvCode)
.then(function (res2) {
//console.log(res2);
if (res2.data) {
//debugger;
res2.data.forEach(function (el, i) {
el.AqlQty = _this.form.AqlCheckQty > _this.qty ? _this.qty : _this.form.AqlCheckQty;
Vue.set(vm.dataSource4WG, i, el)
});
}
});
})
.then(function () {
axios
.get('/BBWMS/IQCQuality/GetMaterialCheckMain4XN?keyValue=' + _this.form.InvCode)
.then(function (res2) {
//console.log(res2);
if (res2.data) {
res2.data.forEach(function (el, i) {
// el.AqlQty = _this.form.AqlCheckQty;
Vue.set(vm.dataSource4XN, i, el)
});
}
});
})
.then(function () {
axios
.get('/BBWMS/IQCQuality/GetItem2AqlFileList?keyValue=' + _this.form.InvCode)
.then(function (res) {
if (res.data) {
if (res.data.length > 0) {
$("#NF-QualFile").addClass("redClass");
}
}
})
})
.catch(function (error) { // 请求失败处理
alert(error);
});
},
//选中行变化
handleCurrentChange4CC(val) {
this.currentRow4CC = val;
// console.log('尺寸行变化');
},
handleCurrentChange4WG(val) {
this.currentRow4WG = val;
// console.log('外观行变化');
},
handleCurrentChange4XN(val) {
this.currentRow4XN = val;
},
submitCheck() {
debugger;
if (!this.form.Result) {
$.modalMsg("必须存在最终检验结果", "warning");
return false;
}
//if (this.dataSource4CC.length == 0 || this.dataSource4WG.length == 0 || this.dataSource4XN.length == 0) {
// $.modalMsg("必须存在检验项目", "warning");
// return false;
//}
for (var i = 0; i < this.dataSource4CC.length; i++) {
let item = this.dataSource4CC[i];
item.CheckItemName = '';
if (!item.Result) {
$.modalMsg("当前行没有检验结果"+ " 尺寸检验,第"+(i+1)+"行", "warning");
return false;
}
if (item.RulesDesc.includes("正常")) {
// 如果是 S1 或 S2,允许为空
if ((item.S1 === undefined || item.S1 === null || item.S1 === '') &&
(item.S2 === undefined || item.S2 === null || item.S2 === '')) {
// 可以视为用户还未填写,不强制要求
}
// 其他字段仍然需要检查
if ((item.S3 === undefined || item.S3 === null || item.S3 === '') ||
(item.S4 === undefined || item.S4 === null || item.S4 === '') ||
(item.S5 === undefined || item.S5 === null || item.S5 === '')) {
$.modalMsg("当前行为正常检验,S3-S5必须填写,第" + (i + 1) + "行", "warning");
return false;
}
}
if (item.RulesDesc.includes("加严")) {
// 加严检验的所有字段都需要填写
for (let j = 1; j <= 10; j++) {
const fieldName = `S${j}`;
if (item[fieldName] === undefined || item[fieldName] === null || item[fieldName] === '') {
$.modalMsg(`当前行为加严检验,S${j}必须填写,第${i + 1}行`, "warning");
return false;
}
}
}
}
for (var i = 0; i < this.dataSource4WG.length; i++) {
let item = this.dataSource4WG[i];
item.CheckItemName = '';
if (!item.Result) {
$.modalMsg("当前行没有检验结果" + " 外观检验,第" + (i + 1) + "行", "warning");
return false;
}
}
for (var i = 0; i < this.dataSource4XN.length; i++) {
let item = this.dataSource4XN[i];
item.CheckItemName = '';
if (!item.Result) {
$.modalMsg("当前行没有检验结果" + " 性能检验,第" + (i + 1) + "行", "warning");
return false;
}
}
//this.dataSource4CC.forEach((item) => {
// if (!item.Result) {
// }
//})
this.form.InvBatcgQty = this.qty;
this.form.EATTRIBUTE2 = this.docType;
this.form.FinalItemLotList = this.destroyExprementDataSource;
this.form.CCList = this.dataSource4CC;
this.form.WGList = this.dataSource4WG;
this.form.XNList = this.dataSource4XN;
this.$refs['form'].validate((valid) => {
if (valid) {
//alert('submit!');
$.submitForm({
url: "/BBWMS/IQCQuality/SaveMaterialCheckResult",
param: { keyValue: JSON.stringify(this.form) },
success: function () {
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
})
} else {
console.log('error submit!!');
return false;
}
});
// console.log(result);
},
},
});
function submitForm() {
//debugger;
vm.submitCheck();
}
//function LookFiles() {
// debugger;
// $.modalOpenClean({
// id: "CheckInfo",
// title: "查看信息",
// url: "/BBWMS/IQCQuality/ICSLookFiles?" + Math.random(),
// width: "1000px",
// height: "400px",
// callBack: function (iframeId) {
// top.frames[iframeId].submitForm();
// }
// });
//}
function UpLoadClick1() {
$("#FileUp3").click();
}
function UpLoadLabelFile(fileinfo) {
debugger;
var id = 1001;
var batchCode = 1001;
//var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
//for (var i = 0; i < objList.length; i++) {
// var rowId = objList[i];
// var rowData = $("#gridList").jqGrid('getRowData', rowId);
// //var ID = rowData.ID;
// //var LableName = rowData.LableName;
//}
var files = fileinfo.files;
var fileName = files[0].name;
if (fileName != null && fileName != "") {
var data = new FormData();
jQuery.each(jQuery('#FileUp3')[0].files, function (i, file) {
data.append('file-' + i, file);
});
$.modalConfirm("确定上传文件吗?", function (r) {
if (r) {
$.ajax({
url: "/BBWMS/IQCQuality/UpLoadLabelFile?id=" + InvCode + "&batchCode=" + InvBatcgNo,
type: "post",
data: data,
contentType: false,
processData: false,
success: function (data) {
debugger;
if (data.state != "error") {
$.modalAlertNew("WMS00014");
$.currentWindow().$("#gridList").trigger("reloadGrid");
}
else {
$.modalAlertNew("WMS00015", data);
}
},
error: function (aa) {
$.modalAlertNew("WMS00016", aa);
}
});
}
});
}
document.getElementById("FileUp3").value = "";
}
function LookFiles() {
debugger;
$.modalOpenClean({
id: "CheckInfo",
title: "查看信息",
url: "/BBWMS/IQCQuality/ICSLookFiles?id=" + InvCode + "&batchCode=" + InvBatcgNo,
width: "1000px",
height: "400px",
callBack: function (iframeId) {
top.frames[iframeId].submitForm();
}
});
}
</script>