|
|
@{ 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"> <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="finalJudge()"><i class="fa fa-pencil-square-o"></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="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"></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"></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"></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"></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"></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"></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"></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"></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"></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"></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="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 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:'' }, //挂在DOM 触发 mounted() { //let reactiveObject = {
//}; //this.form = reactiveObject;
// this.loadGrid(); // this.show(); this.id = '@ViewData["ids"]'; this.qty = @ViewData["qty"]; this.asnCode = '@ViewData["asnCode"]'; 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(currentValue, oldValue) { //debugger; // 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; 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(); } });
}, 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); } });
}, getData() { if (!this.id) return;
let _this = this;
axios .get('/BBWMS/IQCQuality/GetCPMaterialCheckMain2?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/GetCPMaterialCheckMain4CC?keyValue=' + _this.form.InvCode) .then(function (res2) { //console.log(res2); if (res2.data) { res2.data.forEach(function (el, i) { 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]; if (!item.Result) { $.modalMsg("当前行没有检验结果"+ " 尺寸检验,第"+(i+1)+"行", "warning"); return false; }
if (item.RulesDesc.includes("正常")) { if (!item.S1 || !item.S2 || !item.S3 || !item.S4 || !item.S5) { $.modalMsg("当前行为正常检验,必须填写5个检测值,第" + (i + 1) + "行", "warning"); return false; } } if (item.RulesDesc.includes("加严")) { if (!item.S1 || !item.S2 || !item.S3 || !item.S4 || !item.S5 || !item.S6 || !item.S7 || !item.S8 || !item.S9 || !item.S10) { $.modalMsg("当前行为加严检验,必须填写10个检测值,第" + (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.dataSource4CC.forEach((item) => { // if (!item.Result) {
// } //})
this.form.InvBatcgQty = this.qty; this.form.AsNCode = this.asnCode; 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/SaveCPMaterialCheckResult", 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();
}
</script>
|