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.

963 lines
44 KiB

3 weeks ago
  1. @{
  2. ViewBag.Title = "";
  3. Layout = "~/Views/Shared/_Form.cshtml";
  4. }
  5. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  6. <!--引入 element-ui 的样式,-->
  7. <link rel="stylesheet" href="~/Content/element-ui/lib/theme-chalk/index.css">
  8. <script src="~/Content/vue/dist/vue.js"></script>
  9. <script src="~/Content/element-ui/lib/index.js"></script>
  10. <script src="~/Content/axios.min.js"></script>
  11. <style>
  12. .redClass {
  13. color: red;
  14. }
  15. </style>
  16. <form id="form1">
  17. <input id='FileUp3' type='file' style="display: none" onchange="UpLoadLabelFile(this)" />
  18. <div id="app">
  19. <template>
  20. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  21. @*<el-divider>主表信息</el-divider>*@
  22. <el-row :gutter="24">
  23. <el-col :span="4">
  24. <el-form-item label="物料编码" prop="InvCode">
  25. <el-input v-model="form.InvCode" placeholder="请输入内容" size="mini" :disabled="true"></el-input>
  26. </el-form-item>
  27. </el-col>
  28. <el-col :span="4">
  29. <el-form-item label="物料名称" prop="InvName">
  30. <el-input v-model="form.InvName" placeholder="请输入内容" size="mini" :disabled="true"></el-input>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :span="4">
  34. <el-form-item label="批次" prop="InvBatcgNo">
  35. <el-input v-model="form.InvBatcgNo" placeholder="请输入内容" size="mini" :disabled="true"></el-input>
  36. </el-form-item>
  37. </el-col>
  38. <el-col :span="4">
  39. <el-form-item label="仓库" prop="WHCode">
  40. <el-select v-model="form.WHCode" placeholder="请选择" size="mini">
  41. <el-option v-for="item in WHCodeList"
  42. :key="item.value"
  43. :label="item.label"
  44. :value="item.value">
  45. </el-option>
  46. </el-select>
  47. </el-form-item>
  48. </el-col>
  49. </el-row>
  50. <el-row :gutter="24">
  51. <el-col :span="4">
  52. <el-form-item label="批次数量" prop="qty">
  53. <el-input v-model="qty" size="mini" :disabled="true"></el-input>
  54. </el-form-item>
  55. </el-col>
  56. <el-col :span="4">
  57. <el-form-item label="单位" prop="InvUnit">
  58. <el-input v-model="form.InvUnit" size="mini" :disabled="true"></el-input>
  59. </el-form-item>
  60. </el-col>
  61. <el-col :span="4">
  62. <el-form-item label="抽检数量" prop="AqlCheckQty">
  63. <el-input v-model="form.AqlCheckQty" size="mini" :disabled="true"></el-input>
  64. </el-form-item>
  65. </el-col>
  66. <el-col :span="4">
  67. <el-form-item label="总判定结果" prop="Result">
  68. <el-input v-model="form.Result" size="mini" :disabled="true"></el-input>
  69. </el-form-item>
  70. </el-col>
  71. <el-col :span="4">
  72. <el-form-item label="异常文件" prop="WgNgFile">
  73. <el-input v-model="form.WgNgFile" size="mini" :disabled="true"></el-input>
  74. </el-form-item>
  75. </el-col>
  76. <el-col :span="4">
  77. <a id="NF-Uploading" authorize="yes" class="btn btn-primary dropdown-text" onclick="UpLoadClick()"><i class="fa fa-file-excel-o"></i>上传</a>
  78. <input id='FileUp2' type='file' style="display: none" v-on:change="change4FileUp2" />
  79. </el-col>
  80. </el-row>
  81. <el-row :gutter="24">
  82. <el-col :span="24">
  83. @*<el-button type="primary" size="mini" v-on:click="addLine()">新增</el-button>*@
  84. <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>
  85. <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>
  86. <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>
  87. <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>
  88. <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>
  89. <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>
  90. <a id="NF-Uploading1" authorize="yes" class="btn btn-primary dropdown-text" onclick="UpLoadClick1()"><i class="fa fa-file-excel-o"></i>检测报告上传</a>
  91. @*<a id="NF-ExportInspection" authorize="yes" class="btn btn-primary"><i class="fa fa-download" onclick="LookFiles()"></i>检测报告下载</a>*@
  92. </el-col>
  93. </el-row>
  94. <el-divider>尺寸检验</el-divider>
  95. <el-row :gutter="24">
  96. <el-col :span="24">
  97. <el-table ref="singleTable" highlight-current-row
  98. :data="dataSource4CC"
  99. style="width: 100%"
  100. stripe border
  101. size="mini"
  102. height="300"
  103. v-on:current-change="handleCurrentChange4CC">
  104. @*<el-table-column type="index" width="50"></el-table-column>*@
  105. <el-table-column prop="CheckItemCode" label="检验项目编码" width="120">
  106. </el-table-column>
  107. <el-table-column prop="CheckAttrText" label="分类" width="60">
  108. </el-table-column>
  109. <el-table-column prop="CheckItemName" label="检验描述" width="140">
  110. </el-table-column>
  111. <el-table-column prop="CheckWay" label="检验方法" width="140">
  112. </el-table-column>
  113. <el-table-column prop="CheckAqlName" label="抽样标准" width="150">
  114. </el-table-column>
  115. <el-table-column prop="RulesType" label="检验类别" width="150">
  116. </el-table-column>
  117. <el-table-column prop="RulesDesc" label="Aql描述" width="100">
  118. </el-table-column>
  119. <el-table-column prop="SetValueMax" label="上限值" width="60">
  120. </el-table-column>
  121. <el-table-column prop="SetValueMin" label="下限值" width="60">
  122. </el-table-column>
  123. <el-table-column prop="Unit" label="单位" width="60">
  124. </el-table-column>
  125. <el-table-column prop="S1" label="S1" width="80">
  126. <template slot-scope="scope">
  127. <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>
  128. </template>
  129. </el-table-column>
  130. <el-table-column prop="S2" label="S2" width="80">
  131. <template slot-scope="scope">
  132. <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>
  133. </template>
  134. </el-table-column>
  135. <el-table-column prop="S3" label="S3" width="80">
  136. <template slot-scope="scope">
  137. <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>
  138. </template>
  139. </el-table-column>
  140. <el-table-column prop="S4" label="S4" width="80">
  141. <template slot-scope="scope">
  142. <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>
  143. </template>
  144. </el-table-column>
  145. <el-table-column prop="S5" label="S5" width="80">
  146. <template slot-scope="scope">
  147. <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>
  148. </template>
  149. </el-table-column>
  150. <el-table-column prop="S6" label="S6" width="80">
  151. <template slot-scope="scope">
  152. <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>
  153. </template>
  154. </el-table-column>
  155. <el-table-column prop="S7" label="S7" width="80">
  156. <template slot-scope="scope">
  157. <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>
  158. </template>
  159. </el-table-column>
  160. <el-table-column prop="S8" label="S8" width="80">
  161. <template slot-scope="scope">
  162. <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>
  163. </template>
  164. </el-table-column>
  165. <el-table-column prop="S9" label="S9" width="80">
  166. <template slot-scope="scope">
  167. <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>
  168. </template>
  169. </el-table-column>
  170. <el-table-column prop="S10" label="S10" width="80">
  171. <template slot-scope="scope">
  172. <el-input-number v-model="scope.row.S10"
  173. :disabled='scope.row.RulesDesc!="加严检验"'
  174. :min="0" size="small" style="width:60px;" :controls="false" v-on:change="() => change4S1('S10')"></el-input-number>
  175. </template>
  176. </el-table-column>
  177. <el-table-column prop="Result" label="判定结果" width="80">
  178. </el-table-column>
  179. <el-table-column prop="Remark" label="备注" width="300">
  180. <template slot-scope="scope">
  181. <el-input v-model="scope.row.Remark" size="mini"></el-input>
  182. </template>
  183. </el-table-column>
  184. </el-table>
  185. </el-col>
  186. </el-row>
  187. <el-row :gutter="24">
  188. <el-col :span="15">
  189. <el-divider>抽样检验</el-divider>
  190. <el-table ref="singleTable2" highlight-current-row
  191. :data="dataSource4WG"
  192. style="width: 100%"
  193. stripe border
  194. size="mini"
  195. height="500"
  196. v-on:current-change="handleCurrentChange4WG">
  197. @*<el-table-column type="index" width="50"></el-table-column>*@
  198. <el-table-column prop="CheckItemCode" label="检验项目编码" width="120">
  199. </el-table-column>
  200. <el-table-column prop="CheckAttrText" label="分类" width="60">
  201. </el-table-column>
  202. <el-table-column prop="CheckItemName" label="检验描述" width="300">
  203. </el-table-column>
  204. <el-table-column prop="CheckWay" label="检验方法" width="100">
  205. </el-table-column>
  206. <el-table-column prop="CheckAqlName" label="抽样标准" width="100">
  207. </el-table-column>
  208. <el-table-column prop="RulesType" label="检验类别" width="100">
  209. </el-table-column>
  210. <el-table-column prop="AqlQty" label="抽检数量" width="100">
  211. </el-table-column>
  212. <el-table-column prop="GoodQty" label="合格数量" width="100">
  213. <template slot-scope="scope">
  214. <el-input-number v-model="scope.row.GoodQty" :min="0" size="small" style="width:60px;" :controls="false" v-on:change="change4GoodQty"></el-input-number>
  215. </template>
  216. </el-table-column>
  217. <el-table-column prop="NgQty" label="不合格数量" width="100">
  218. <template slot-scope="scope">
  219. <el-input-number v-model="scope.row.NgQty" :min="0" size="small" style="width:60px;" :controls="false" v-on:change="change4NgQty"></el-input-number>
  220. </template>
  221. </el-table-column>
  222. <el-table-column prop="Result" label="判定结果" width="80">
  223. </el-table-column>
  224. <el-table-column prop="Remark" label="备注" width="300">
  225. <template slot-scope="scope">
  226. <el-input v-model="scope.row.Remark" size="mini"></el-input>
  227. </template>
  228. </el-table-column>
  229. </el-table>
  230. </el-col>
  231. <el-col :span="9">
  232. <el-divider>性能检验</el-divider>
  233. <el-table ref="singleTable3" highlight-current-row
  234. :data="dataSource4XN"
  235. style="width: 100%"
  236. stripe border
  237. size="mini"
  238. height="500"
  239. v-on:current-change="handleCurrentChange4XN">
  240. <el-table-column type="index" width="50"></el-table-column>
  241. <el-table-column prop="CheckAttrText" label="分类" width="60">
  242. </el-table-column>
  243. <el-table-column prop="CheckItemName" label="检验描述" width="300">
  244. </el-table-column>
  245. <el-table-column prop="RulesType" label="检验类别" width="100">
  246. </el-table-column>
  247. <el-table-column prop="Result" label="检验结果" width="150">
  248. <template slot-scope="scope">
  249. <el-radio-group v-model="scope.row.Result">
  250. <el-radio-button label="OK"></el-radio-button>
  251. <el-radio-button label="NG"></el-radio-button>
  252. </el-radio-group>
  253. </template>
  254. </el-table-column>
  255. <el-table-column prop="Remark" label="备注" width="300">
  256. <template slot-scope="scope">
  257. <el-input v-model="scope.row.Remark" size="mini"></el-input>
  258. </template>
  259. </el-table-column>
  260. </el-table>
  261. </el-col>
  262. </el-row>
  263. </el-form>
  264. </template>
  265. </div>
  266. </form>
  267. <script type="text/javascript">
  268. //const { Console } = require("node:console");
  269. function UpLoadClick() {
  270. //var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  271. //if (ids.length != 1) {
  272. // $.modalAlertNew("WMS00050");
  273. // return;
  274. //}
  275. $("#FileUp2").click();
  276. }
  277. var InvCode = '@ViewData["InvCode"]';
  278. var InvBatcgNo = '@ViewData["InvBatcgNo"]';
  279. var vm = new Vue({
  280. el: '#app',
  281. data: {
  282. id:'',
  283. userCode: "",
  284. ssList: [],
  285. form: {},
  286. dataSource4CC: [],
  287. dataSource4WG: [],
  288. dataSource4XN: [],
  289. WHCodeList:[],
  290. currentRow4CC: null,
  291. currentRow4WG: null,
  292. currentRow4XN: null,
  293. rules: {
  294. },
  295. disabled4RulesCode: false,
  296. destroyExprementDataSource: [],
  297. qty: 0,
  298. docType: '',
  299. ASNCode: '',
  300. InvCode: '',
  301. InvBatcgNo: ''
  302. },
  303. //挂在DOM 触发
  304. mounted() {
  305. //let reactiveObject = {
  306. //};
  307. //this.form = reactiveObject;
  308. // this.loadGrid();
  309. // this.show();
  310. this.id = '@ViewData["ids"]';
  311. this.qty = @ViewData["qty"];
  312. this.docType = @ViewData["docType"];
  313. this.ASNCode = '@ViewData["ASNCode"]';
  314. this.InvCode = '@ViewData["InvCode"]';
  315. this.InvBatcgNo = '@ViewData["InvBatcgNo"]';
  316. this.initControl();
  317. // console.log(this.id);
  318. },
  319. beforeDestroy() {
  320. // this.autoScrol1(true);
  321. },
  322. methods: {
  323. change4FileUp2(e) {
  324. debugger;
  325. var files = e.target.files;
  326. var fileName = files[0].name;
  327. // vm.setExFileName(fileName);
  328. this.form.WgNgFile = fileName;
  329. if (fileName != null && fileName != "") {
  330. var data = new FormData();
  331. jQuery.each(jQuery('#FileUp2')[0].files, function (i, file) {
  332. data.append('file-' + i, file);
  333. });
  334. data.append("ID", '001');
  335. // data.append("LableName", LableName);
  336. $.modalConfirm("确定上传文件吗?", function (r) {
  337. if (r) {
  338. $.ajax({
  339. url: "/BBWMS/IQCQuality/UpLoadMaterialCheckExFile" + "?" + Math.random(),
  340. type: "post",
  341. data: data,
  342. contentType: false,
  343. processData: false,
  344. dataType: "json",
  345. success: function (data) {
  346. // console.log(data);
  347. if (data.message == "上传成功!") {
  348. $.modalMsg("操作成功", "success");
  349. // $.currentWindow().$("#gridList").trigger("reloadGrid");
  350. }
  351. else {
  352. $.modalMsg(data.message, "warning");
  353. }
  354. },
  355. error: function (aa) {
  356. $.modalAlertNew("WMS00016", aa);
  357. }
  358. });
  359. }
  360. });
  361. }
  362. },
  363. setExFileName(val) {
  364. this.form.WgNgFile = val;
  365. },
  366. getAllWHCodeList() {
  367. axios
  368. .get('/BBWMS/IQCQuality/GetSelectItemList?keyValue=InspectionWH')
  369. .then(function (res) {
  370. //debugger;
  371. if (res.data) {
  372. res.data.forEach(function (el, i) {
  373. Vue.set(vm.WHCodeList, i, el)
  374. });
  375. }
  376. })
  377. .catch(function (error) { // 请求失败处理
  378. alert(error);
  379. });
  380. },
  381. change4S1(field) {
  382. debugger;
  383. console.log('变化的列是:', field);
  384. // console.log('S1数改变');
  385. //debugger;
  386. let currentRow = this.dataSource4CC.filter((x) => x.ID == this.currentRow4CC.ID)[0];
  387. if (!currentRow) {
  388. return;
  389. }
  390. let upper = currentRow.SetValueMax;
  391. let lower = currentRow.SetValueMin;
  392. const currentNum = Number(field.match(/\d+/)[0]);
  393. // 初始化结果为true
  394. let result = true;
  395. // 循环从1到当前数字(包含当前数字)
  396. for (let i = 1; i <= 5; i++) {
  397. // 动态访问currentRow的S1、S2...属性
  398. const currentValue = currentRow[`S${i}`];
  399. // 如果字段值为 undefined 或 null,跳过判断(不视为 NG)
  400. if (currentValue !== undefined && currentValue !== null && currentValue !== '') {
  401. // 累积检查结果(有一个不通过则整体为false)
  402. result = result && this.checkResult(currentValue, upper, lower);
  403. }
  404. // 如果已经为false,可提前退出循环优化性能
  405. if (!result) break;
  406. }
  407. // 加严检验的额外判断(保持原有逻辑)
  408. if (result && currentRow.RulesDesc === "加严检验") {
  409. // 这里假设加严检验固定需要检查到S10,可根据实际需求调整
  410. for (let i = 6; i <= 10; i++) {
  411. const currentValue = currentRow[`S${i}`];
  412. // 加严检验要求所有字段都必须填写
  413. if (currentValue === undefined || currentValue === null || currentValue === '') {
  414. // 如果有未填写的字段,设置为未判定状态
  415. currentRow.Result = '';
  416. return;
  417. }
  418. result = result && this.checkResult(currentValue, upper, lower);
  419. if (!result) break;
  420. }
  421. }
  422. currentRow.Result = result ? "OK" : "NG";
  423. //let result = this.checkResult(currentRow.S1, upper, lower)
  424. // && this.checkResult(currentRow.S2, upper, lower)
  425. // && this.checkResult(currentRow.S3, upper, lower)
  426. // && this.checkResult(currentRow.S4, upper, lower)
  427. // && this.checkResult(currentRow.S5, upper, lower);
  428. //if (result && currentRow.RulesDesc == "加严检验")
  429. // result = result
  430. // && this.checkResult(currentRow.S6, upper, lower)
  431. // && this.checkResult(currentRow.S7, upper, lower)
  432. // && this.checkResult(currentRow.S8, upper, lower)
  433. // && this.checkResult(currentRow.S9, upper, lower)
  434. // && this.checkResult(currentRow.S10, upper, lower);
  435. //if (result)
  436. // currentRow.Result = "OK";
  437. //else
  438. // currentRow.Result = "NG";
  439. },
  440. checkResult(value, upper, lower) {
  441. return value >= lower && value <= upper;
  442. },
  443. change4GoodQty(currentValue, oldValue) {
  444. //console.log('OK数改变');
  445. //debugger;
  446. let currentRow = this.dataSource4WG.filter((x) => x.ID == this.currentRow4WG.ID)[0];
  447. if (currentRow) {
  448. currentRow.NgQty = currentRow.AqlQty - currentValue;
  449. if (currentRow.NgQty < 0) {
  450. currentRow.GoodQty = 0;
  451. currentRow.NgQty = 0;
  452. }
  453. else {
  454. this.judgeWGRowResult(currentRow);
  455. }
  456. }
  457. },
  458. change4NgQty(currentValue, oldValue) {
  459. //console.log('NG数改变');
  460. let currentRow = this.dataSource4WG.filter((x) => x.ID == this.currentRow4WG.ID)[0];
  461. if (currentRow) {
  462. currentRow.GoodQty = currentRow.AqlQty - currentValue;
  463. if (currentRow.GoodQty < 0) {
  464. currentRow.GoodQty = 0;
  465. currentRow.NgQty = 0;
  466. }
  467. else {
  468. this.judgeWGRowResult(currentRow);
  469. }
  470. }
  471. },
  472. judgeCCRowResult() {
  473. },
  474. judgeWGRowResult(currentRow) {
  475. //debugger;
  476. if (!currentRow) {
  477. return;
  478. }
  479. if (currentRow.NgQty <= this.form.AllowNgQty) {
  480. currentRow.Result = "OK";
  481. }
  482. else {
  483. currentRow.Result = "NG";
  484. }
  485. },
  486. initControl: function () {
  487. let that = this;
  488. let orgName = '';
  489. this.disabled4RulesCode = this.id ? true : false;
  490. let userName = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserName';
  491. // console.log(userName);
  492. this.getAllWHCodeList();
  493. this.getData();
  494. },
  495. finalJudge() {
  496. for (var i = 0; i < this.dataSource4CC.length; i++) {
  497. let item = this.dataSource4CC[i];
  498. if (!item.Result) {
  499. $.modalMsg("当前行没有检验结果" + " 尺寸检验,第" + (i + 1) + "行", "warning");
  500. return false;
  501. }
  502. }
  503. for (var i = 0; i < this.dataSource4WG.length; i++) {
  504. let item = this.dataSource4WG[i];
  505. if (!item.Result) {
  506. $.modalMsg("当前行没有检验结果" + " 外观检验,第" + (i + 1) + "行", "warning");
  507. return false;
  508. }
  509. }
  510. for (var i = 0; i < this.dataSource4XN.length; i++) {
  511. let item = this.dataSource4XN[i];
  512. if (!item.Result) {
  513. $.modalMsg("当前行没有检验结果" + " 性能检验,第" + (i + 1) + "行", "warning");
  514. return false;
  515. }
  516. }
  517. this.form.Result = "OK";
  518. this.dataSource4CC.forEach((item) => {
  519. if (item.Result == 'NG') {
  520. this.form.Result = "NG";
  521. }
  522. })
  523. this.dataSource4WG.forEach((item) => {
  524. if (item.Result == 'NG') {
  525. this.form.Result = "NG";
  526. }
  527. })
  528. this.dataSource4XN.forEach((item) => {
  529. if (item.Result == 'NG') {
  530. this.form.Result = "NG";
  531. }
  532. })
  533. //if (!this.form.Result) {
  534. // this.form.Result = "OK";
  535. //}
  536. },
  537. queryCheckRecord() {
  538. $.modalOpen({
  539. id: "Formdd",
  540. title: "历史检验记录",
  541. url: "/BBWMS/IQCQuality/MaterialCheckLog?ids=" + this.form.InvCode + "",
  542. width: "1600px",
  543. height: "400px",
  544. callBack: function (iframeId) {
  545. //let data=top.frames[iframeId].submitForm();
  546. }
  547. });
  548. },
  549. SizeJudge() {
  550. for (var i = 0; i < this.dataSource4CC.length; i++) {
  551. let item = this.dataSource4CC[i];
  552. item.Result = 'OK';
  553. //if (!item.Result) {
  554. // $.modalMsg("当前行没有检验结果" + " 尺寸检验,第" + (i + 1) + "行", "warning");
  555. // return false;
  556. //}
  557. }
  558. },
  559. viewFile() {
  560. $.modalOpen({
  561. id: "Formdd",
  562. title: "质量履历文件查看",
  563. url: "/BBWMS/IQCQuality/Item2AqlFileView?ids=" + this.form.InvCode + "",
  564. width: "1200px",
  565. height: "400px",
  566. callBack: function (iframeId) {
  567. //let data=top.frames[iframeId].submitForm();
  568. }
  569. });
  570. },
  571. test() {
  572. let _this = this;
  573. $.modalOpen({
  574. id: "Formdd",
  575. title: "破坏性实验抽选结果",
  576. url: "/BBWMS/IQCQuality/MaterialDestoryExperimentEdit?ids=" + _this.id+ "",
  577. width: "1200px",
  578. height: "400px",
  579. callBack: function (iframeId) {
  580. //debugger;
  581. let data = top.frames[iframeId].submitForm();//破坏性结果
  582. top.frames[iframeId].Close();
  583. _this.destroyExprementDataSource = data;
  584. // console.log(data);
  585. }
  586. });
  587. },
  588. VendorFile() {
  589. let _this = this;
  590. $.modalOpen({
  591. id: "Formdd",
  592. title: "供应商文件查看",
  593. url: "/BBWMS/IQCQuality/VendorFileIndex?ASNCode=" + _this.ASNCode + "&InvCode=" + this.form.InvCode + "&BatchCode=" + this.form.InvBatcgNo + "",
  594. width: "1200px",
  595. height: "400px",
  596. callBack: function (iframeId) {
  597. //let data=top.frames[iframeId].submitForm();
  598. }
  599. });
  600. },
  601. getData() {
  602. if (!this.id) return;
  603. let _this = this;
  604. axios
  605. .get('/BBWMS/IQCQuality/GetMaterialCheckMain2?keyValue=' + _this.id + '&qty=' + _this.qty )
  606. .then(function (res) {
  607. // debugger;
  608. if (res.data) {
  609. if (res.data[0]) {
  610. for (var i in res.data[0]) {
  611. Vue.set(vm.form, i, res.data[0][i]);
  612. }
  613. }
  614. }
  615. })
  616. .then(function () {
  617. axios
  618. .get('/BBWMS/IQCQuality/GetMaterialCheckMain4CC?keyValue=' + _this.form.InvCode)
  619. .then(function (res2) {
  620. //console.log(res2);
  621. if (res2.data) {
  622. res2.data.forEach(function (el, i) {
  623. // 将 S1 和 S2 的默认值设为空
  624. el.S1 = undefined;
  625. el.S2 = undefined;
  626. el.S3 = undefined;
  627. el.S4 = undefined;
  628. el.S5 = undefined;
  629. el.S6 = undefined;
  630. el.S7 = undefined;
  631. el.S8 = undefined;
  632. el.S9 = undefined;
  633. el.S10 = undefined;
  634. Vue.set(vm.dataSource4CC, i, el)
  635. });
  636. }
  637. });
  638. })
  639. .then(function () {
  640. axios
  641. .get('/BBWMS/IQCQuality/GetMaterialCheckMain4WG?keyValue=' + _this.form.InvCode)
  642. .then(function (res2) {
  643. //console.log(res2);
  644. if (res2.data) {
  645. //debugger;
  646. res2.data.forEach(function (el, i) {
  647. el.AqlQty = _this.form.AqlCheckQty > _this.qty ? _this.qty : _this.form.AqlCheckQty;
  648. Vue.set(vm.dataSource4WG, i, el)
  649. });
  650. }
  651. });
  652. })
  653. .then(function () {
  654. axios
  655. .get('/BBWMS/IQCQuality/GetMaterialCheckMain4XN?keyValue=' + _this.form.InvCode)
  656. .then(function (res2) {
  657. //console.log(res2);
  658. if (res2.data) {
  659. res2.data.forEach(function (el, i) {
  660. // el.AqlQty = _this.form.AqlCheckQty;
  661. Vue.set(vm.dataSource4XN, i, el)
  662. });
  663. }
  664. });
  665. })
  666. .then(function () {
  667. axios
  668. .get('/BBWMS/IQCQuality/GetItem2AqlFileList?keyValue=' + _this.form.InvCode)
  669. .then(function (res) {
  670. if (res.data) {
  671. if (res.data.length > 0) {
  672. $("#NF-QualFile").addClass("redClass");
  673. }
  674. }
  675. })
  676. })
  677. .catch(function (error) { // 请求失败处理
  678. alert(error);
  679. });
  680. },
  681. //选中行变化
  682. handleCurrentChange4CC(val) {
  683. this.currentRow4CC = val;
  684. // console.log('尺寸行变化');
  685. },
  686. handleCurrentChange4WG(val) {
  687. this.currentRow4WG = val;
  688. // console.log('外观行变化');
  689. },
  690. handleCurrentChange4XN(val) {
  691. this.currentRow4XN = val;
  692. },
  693. submitCheck() {
  694. debugger;
  695. if (!this.form.Result) {
  696. $.modalMsg("必须存在最终检验结果", "warning");
  697. return false;
  698. }
  699. //if (this.dataSource4CC.length == 0 || this.dataSource4WG.length == 0 || this.dataSource4XN.length == 0) {
  700. // $.modalMsg("必须存在检验项目", "warning");
  701. // return false;
  702. //}
  703. for (var i = 0; i < this.dataSource4CC.length; i++) {
  704. let item = this.dataSource4CC[i];
  705. item.CheckItemName = '';
  706. if (!item.Result) {
  707. $.modalMsg("当前行没有检验结果"+ " 尺寸检验,第"+(i+1)+"行", "warning");
  708. return false;
  709. }
  710. if (item.RulesDesc.includes("正常")) {
  711. // 如果是 S1 或 S2,允许为空
  712. if ((item.S1 === undefined || item.S1 === null || item.S1 === '') &&
  713. (item.S2 === undefined || item.S2 === null || item.S2 === '')) {
  714. // 可以视为用户还未填写,不强制要求
  715. }
  716. // 其他字段仍然需要检查
  717. if ((item.S3 === undefined || item.S3 === null || item.S3 === '') ||
  718. (item.S4 === undefined || item.S4 === null || item.S4 === '') ||
  719. (item.S5 === undefined || item.S5 === null || item.S5 === '')) {
  720. $.modalMsg("当前行为正常检验,S3-S5必须填写,第" + (i + 1) + "行", "warning");
  721. return false;
  722. }
  723. }
  724. if (item.RulesDesc.includes("加严")) {
  725. // 加严检验的所有字段都需要填写
  726. for (let j = 1; j <= 10; j++) {
  727. const fieldName = `S${j}`;
  728. if (item[fieldName] === undefined || item[fieldName] === null || item[fieldName] === '') {
  729. $.modalMsg(`当前行为加严检验,S${j}必须填写,第${i + 1}行`, "warning");
  730. return false;
  731. }
  732. }
  733. }
  734. }
  735. for (var i = 0; i < this.dataSource4WG.length; i++) {
  736. let item = this.dataSource4WG[i];
  737. item.CheckItemName = '';
  738. if (!item.Result) {
  739. $.modalMsg("当前行没有检验结果" + " 外观检验,第" + (i + 1) + "行", "warning");
  740. return false;
  741. }
  742. }
  743. for (var i = 0; i < this.dataSource4XN.length; i++) {
  744. let item = this.dataSource4XN[i];
  745. item.CheckItemName = '';
  746. if (!item.Result) {
  747. $.modalMsg("当前行没有检验结果" + " 性能检验,第" + (i + 1) + "行", "warning");
  748. return false;
  749. }
  750. }
  751. //this.dataSource4CC.forEach((item) => {
  752. // if (!item.Result) {
  753. // }
  754. //})
  755. this.form.InvBatcgQty = this.qty;
  756. this.form.EATTRIBUTE2 = this.docType;
  757. this.form.FinalItemLotList = this.destroyExprementDataSource;
  758. this.form.CCList = this.dataSource4CC;
  759. this.form.WGList = this.dataSource4WG;
  760. this.form.XNList = this.dataSource4XN;
  761. this.$refs['form'].validate((valid) => {
  762. if (valid) {
  763. //alert('submit!');
  764. $.submitForm({
  765. url: "/BBWMS/IQCQuality/SaveMaterialCheckResult",
  766. param: { keyValue: JSON.stringify(this.form) },
  767. success: function () {
  768. $.currentWindow().$("#gridList").trigger("reloadGrid");
  769. }
  770. })
  771. } else {
  772. console.log('error submit!!');
  773. return false;
  774. }
  775. });
  776. // console.log(result);
  777. },
  778. },
  779. });
  780. function submitForm() {
  781. //debugger;
  782. vm.submitCheck();
  783. }
  784. //function LookFiles() {
  785. // debugger;
  786. // $.modalOpenClean({
  787. // id: "CheckInfo",
  788. // title: "查看信息",
  789. // url: "/BBWMS/IQCQuality/ICSLookFiles?" + Math.random(),
  790. // width: "1000px",
  791. // height: "400px",
  792. // callBack: function (iframeId) {
  793. // top.frames[iframeId].submitForm();
  794. // }
  795. // });
  796. //}
  797. function UpLoadClick1() {
  798. $("#FileUp3").click();
  799. }
  800. function UpLoadLabelFile(fileinfo) {
  801. debugger;
  802. var id = 1001;
  803. var batchCode = 1001;
  804. //var objList = $("#gridList").jqGrid('getGridParam', 'selarrrow');
  805. //for (var i = 0; i < objList.length; i++) {
  806. // var rowId = objList[i];
  807. // var rowData = $("#gridList").jqGrid('getRowData', rowId);
  808. // //var ID = rowData.ID;
  809. // //var LableName = rowData.LableName;
  810. //}
  811. var files = fileinfo.files;
  812. var fileName = files[0].name;
  813. if (fileName != null && fileName != "") {
  814. var data = new FormData();
  815. jQuery.each(jQuery('#FileUp3')[0].files, function (i, file) {
  816. data.append('file-' + i, file);
  817. });
  818. $.modalConfirm("确定上传文件吗?", function (r) {
  819. if (r) {
  820. $.ajax({
  821. url: "/BBWMS/IQCQuality/UpLoadLabelFile?id=" + InvCode + "&batchCode=" + InvBatcgNo,
  822. type: "post",
  823. data: data,
  824. contentType: false,
  825. processData: false,
  826. success: function (data) {
  827. debugger;
  828. if (data.state != "error") {
  829. $.modalAlertNew("WMS00014");
  830. $.currentWindow().$("#gridList").trigger("reloadGrid");
  831. }
  832. else {
  833. $.modalAlertNew("WMS00015", data);
  834. }
  835. },
  836. error: function (aa) {
  837. $.modalAlertNew("WMS00016", aa);
  838. }
  839. });
  840. }
  841. });
  842. }
  843. document.getElementById("FileUp3").value = "";
  844. }
  845. function LookFiles() {
  846. debugger;
  847. $.modalOpenClean({
  848. id: "CheckInfo",
  849. title: "查看信息",
  850. url: "/BBWMS/IQCQuality/ICSLookFiles?id=" + InvCode + "&batchCode=" + InvBatcgNo,
  851. width: "1000px",
  852. height: "400px",
  853. callBack: function (iframeId) {
  854. top.frames[iframeId].submitForm();
  855. }
  856. });
  857. }
  858. </script>