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.

481 lines
20 KiB

3 weeks ago
  1. 
  2. @{
  3. ViewBag.Title = "";
  4. Layout = "~/Views/Shared/_Form.cshtml";
  5. }
  6. <script src="~/Content/js/datepicker/WdatePicker.js"></script>
  7. <!--引入 element-ui 的样式,-->
  8. <link rel="stylesheet" href="~/Content/element-ui/lib/theme-chalk/index.css">
  9. <script src="~/Content/vue/dist/vue.js"></script>
  10. <script src="~/Content/element-ui/lib/index.js"></script>
  11. <script src="~/Content/axios.min.js"></script>
  12. <style>
  13. </style>
  14. <form id="form1">
  15. <div id="app">
  16. <template>
  17. <el-form ref="form" :model="form" :rules="rules" label-width="130px">
  18. @*<el-divider>主表信息</el-divider>*@
  19. <el-row :gutter="24">
  20. <el-col :span="4">
  21. <el-form-item label="物料编码" prop="InvCode">
  22. <el-input v-model="form.InvCode" placeholder="请输入内容" size="mini" :disabled="true"></el-input>
  23. </el-form-item>
  24. </el-col>
  25. <el-col :span="4">
  26. <el-form-item label="物料名称" prop="InvName">
  27. <el-input v-model="form.InvName" placeholder="请输入内容" size="mini" :disabled="true"></el-input>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :span="4">
  31. <el-form-item label="批次" prop="InvBatcgNo">
  32. <el-input v-model="form.InvBatcgNo" placeholder="请输入内容" size="mini" :disabled="true"></el-input>
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="4">
  36. </el-col>
  37. </el-row>
  38. <el-row :gutter="24">
  39. <el-col :span="4">
  40. <el-form-item label="批次数量" prop="InvBatcgQty">
  41. <el-input v-model="form.InvBatcgQty" size="mini" :disabled="true"></el-input>
  42. </el-form-item>
  43. </el-col>
  44. <el-col :span="4">
  45. <el-form-item label="单位" prop="InvUnit">
  46. <el-input v-model="form.InvUnit" size="mini" :disabled="true"></el-input>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :span="4">
  50. <el-form-item label="外观抽检数量" prop="AqlCheckQty">
  51. <el-input v-model="form.AqlCheckQty" size="mini" :disabled="true"></el-input>
  52. </el-form-item>
  53. </el-col>
  54. <el-col :span="4">
  55. <el-form-item label="检验结果" prop="Result">
  56. <el-input v-model="form.Result" size="mini" :disabled="true"></el-input>
  57. </el-form-item>
  58. </el-col>
  59. </el-row>
  60. <el-row :gutter="24">
  61. <el-col :span="6">
  62. <el-form-item label="判定结果" prop="FinalResult">
  63. <el-radio-group v-model="form.FinalResult" v-on:change="change4FinalResult">
  64. <el-radio-button label="判退"></el-radio-button>
  65. <el-radio-button label="返工"></el-radio-button>
  66. <el-radio-button label="让步接收"></el-radio-button>
  67. </el-radio-group>
  68. </el-form-item>
  69. </el-col>
  70. <el-col :span="6">
  71. <el-form-item label="特采单号" prop="SpecialNo">
  72. <el-input v-model="form.SpecialNo" size="mini" :disabled="disabled4SpecialNo"></el-input>
  73. </el-form-item>
  74. </el-col>
  75. <el-col :span="2">
  76. <input id='FileUp2' type='file' style="display: none;" />
  77. <a id="NF-Uploading" authorize="yes" class="btn btn-primary dropdown-text" onclick="UpLoadClick()" :disabled="disabled4SpecialNo"><i class="fa fa-file-excel-o"></i>上传</a>
  78. </el-col>
  79. @*<el-col :span="6">
  80. <el-form-item label="SQE处理方案" prop="EATTRIBUTE1">
  81. <el-input v-model="form.EATTRIBUTE1" size="mini" :disabled="true"></el-input>
  82. </el-form-item>
  83. </el-col>*@
  84. </el-row>
  85. <el-divider>条码信息</el-divider>
  86. <el-row :gutter="24">
  87. <el-col :span="24">
  88. <el-table ref="dataSource4Test" highlight-current-row
  89. :data="dataSource4Test"
  90. style="width: 100%"
  91. stripe border
  92. size="mini"
  93. height="500"
  94. v-on:current-change="handleCurrentChange4Test">
  95. <el-table-column type="index" width="50"></el-table-column>
  96. <el-table-column type="selection" width="55"> </el-table-column>
  97. <el-table-column prop="InvCode" label="物料编码" width="100">
  98. </el-table-column>
  99. <el-table-column prop="InvName" label="物料名称" width="100">
  100. </el-table-column>
  101. <el-table-column prop="LotNo" label="物料条码" width="150">
  102. </el-table-column>
  103. <el-table-column prop="TransCode" label="采购订单" width="100">
  104. </el-table-column>
  105. <el-table-column prop="TransSequence" label="采购订单行" width="150">
  106. </el-table-column>
  107. <el-table-column prop="InvBatcgNo" label="批次" width="100">
  108. </el-table-column>
  109. <el-table-column prop="Quantity" label="条码数量" width="100">
  110. </el-table-column>
  111. <el-table-column prop="GoodQty" label="合格数量" width="100">
  112. <template slot-scope="scope">
  113. <el-input-number v-model="scope.row.GoodQty" :min="0" size="small" style="width:60px;" :controls="false" v-on:change="change4GoodQty" :disabled="disabled4GoodQty"></el-input-number>
  114. </template>
  115. </el-table-column>
  116. <el-table-column prop="NgQty" label="不合格数量" width="100">
  117. <template slot-scope="scope">
  118. <el-input-number v-model="scope.row.NgQty" :min="0" size="small" style="width:60px;" :controls="false" v-on:change="change4NgQty" :disabled="disabled4NgQty"></el-input-number>
  119. </template>
  120. </el-table-column>
  121. <el-table-column prop="InQty" label="入库数量" width="100">
  122. </el-table-column>
  123. </el-table>
  124. </el-col>
  125. </el-row>
  126. </el-form>
  127. </template>
  128. </div>
  129. </form>
  130. <script type="text/javascript">
  131. //const { Console } = require("node:console");
  132. var vm = new Vue({
  133. el: '#app',
  134. data: {
  135. id:'',
  136. userCode: "",
  137. ssList: [],
  138. form: {},
  139. dataSource4Test: [],
  140. currentRow4Test:null,
  141. rules: {
  142. },
  143. disabled4RulesCode: false,
  144. disabled4SpecialNo:false,
  145. disabled4GoodQty:false,
  146. disabled4NgQty: false,
  147. fileName:'',
  148. },
  149. //挂在DOM 触发
  150. mounted() {
  151. //let reactiveObject = {
  152. //};
  153. //this.form = reactiveObject;
  154. // this.loadGrid();
  155. // this.show();
  156. this.id = '@ViewData["ids"]';
  157. this.judgeRole='@ViewData["judgeRole"]';
  158. this.initControl();
  159. this.loadEvent();
  160. // console.log(this.id);
  161. },
  162. beforeDestroy() {
  163. // this.autoScrol1(true);
  164. },
  165. methods: {
  166. change4FinalResult(val) {
  167. if (!val) {
  168. return;
  169. }
  170. if (val == "判退") {
  171. this.disabled4SpecialNo = true;
  172. this.disabled4GoodQty = true;
  173. this.disabled4NgQty = true;
  174. }
  175. else if (val == "返工") {
  176. this.disabled4SpecialNo = true;
  177. this.disabled4GoodQty = false;
  178. this.disabled4NgQty = false;
  179. for (var i = 0; i < this.dataSource4Test.length; i++) {
  180. let item = this.dataSource4Test[i];
  181. item.NgQty = 0;
  182. item.GoodQty = item.Quantity;
  183. item.InQty = item.Quantity;
  184. }
  185. }
  186. else if (val == "让步接收") {
  187. this.disabled4SpecialNo = false;
  188. this.disabled4GoodQty = false;
  189. this.disabled4NgQty = false;
  190. for (var i = 0; i < this.dataSource4Test.length; i++) {
  191. let item = this.dataSource4Test[i];
  192. item.NgQty = 0;
  193. item.GoodQty = item.Quantity;
  194. item.InQty = item.Quantity;
  195. }
  196. }
  197. else {
  198. }
  199. },
  200. upload() {
  201. },
  202. loadEvent() {
  203. let that = this;
  204. debugger;
  205. $("#FileUp2").on("change", function (e) {
  206. var files = e.target.files;
  207. var fileName = files[0].name;
  208. if (fileName != null && fileName != "") {
  209. var data = new FormData();
  210. jQuery.each(jQuery('#FileUp2')[0].files, function (i, file) {
  211. data.append('file-' + i, file);
  212. });
  213. data.append("ID", that.id);
  214. // data.append("LableName", LableName);
  215. $.modalConfirm("确定上传文件吗?", function (r) {
  216. if (r) {
  217. $.ajax({
  218. url: "/BBWMS/IQCQuality/UpLoadFinalJudgeFile" + "?" + Math.random(),
  219. type: "post",
  220. data: data,
  221. contentType: false,
  222. processData: false,
  223. dataType: "json",
  224. success: function (data) {
  225. // console.log(data);
  226. if (data.message == "上传成功!") {
  227. $.modalMsg("操作成功", "success");
  228. // $.currentWindow().$("#gridList").trigger("reloadGrid");
  229. that.form.SpecialFile = fileName;
  230. }
  231. else {
  232. $.modalMsg(data.message, "warning");
  233. }
  234. },
  235. error: function (aa) {
  236. $.modalAlertNew("WMS00016", aa);
  237. }
  238. });
  239. }
  240. });
  241. }
  242. });
  243. },
  244. change4GoodQty(currentValue, oldValue) {
  245. //console.log('OK数改变');
  246. //debugger;
  247. let currentRow = this.dataSource4Test.filter((x) => x.RowNo == this.currentRow4Test.RowNo)[0];
  248. if (currentRow) {
  249. currentRow.NgQty = currentRow.Quantity - currentValue;
  250. if (currentRow.NgQty < 0) {
  251. currentRow.GoodQty = 0;
  252. currentRow.InQty = 0;
  253. currentRow.NgQty = 0;
  254. }
  255. currentRow.InQty = currentRow.GoodQty;
  256. }
  257. },
  258. change4NgQty(currentValue, oldValue) {
  259. //console.log('NG数改变');
  260. let currentRow = this.dataSource4Test.filter((x) => x.RowNo == this.currentRow4Test.RowNo)[0];
  261. if (currentRow) {
  262. currentRow.GoodQty = currentRow.Quantity - currentValue;
  263. if (currentRow.GoodQty < 0) {
  264. currentRow.GoodQty = 0;
  265. currentRow.NgQty = 0;
  266. }
  267. currentRow.InQty = currentRow.GoodQty;
  268. }
  269. },
  270. judgeWGRowResult(currentRow) {
  271. if (!currentRow) {
  272. return;
  273. }
  274. if (currentRow.NgQty <= this.form.AllowNgQty) {
  275. currentRow.Result = "OK";
  276. }
  277. else {
  278. currentRow.Result = "NG";
  279. }
  280. },
  281. initControl: function () {
  282. let that = this;
  283. let orgName = '';
  284. this.disabled4RulesCode = this.id ? true : false;
  285. let userName = '@NFine.Code.OperatorProvider.Provider.GetCurrent().UserName';
  286. // console.log(userName);
  287. //this.getAllBRGCode();
  288. //this.getAllBCGCode();
  289. this.getData();
  290. },
  291. getData() {
  292. if (!this.id) return;
  293. let _this = this;
  294. axios
  295. .get('/BBWMS/IQCQuality/GetMaterialReJudgeMain?keyValue=' + _this.id)
  296. .then(function (res) {
  297. // debugger;
  298. if (res.data) {
  299. for (var i in res.data) {
  300. Vue.set(vm.form, i, res.data[i]);
  301. }
  302. //_this.form.JudgeRole = _this.judgeRole;
  303. if (!_this.form.FinalResult) {
  304. _this.form.FinalResult = '判退';
  305. _this.change4FinalResult(_this.form.FinalResult);
  306. }
  307. }
  308. })
  309. .then(function () {
  310. axios
  311. .get("/BBWMS/IQCQuality/GetCPMaterialInStorageCheckDetailList2?code=" + _this.form.AsnCode + "&lotno=" + _this.form.InvBatcgNo + "&invCode=" + _this.form.InvCode)
  312. .then(function (res) {
  313. if (res.data) {
  314. res.data.forEach(function (el, i) {
  315. Vue.set(vm.dataSource4Test, i, el)
  316. });
  317. }
  318. })
  319. })
  320. .catch(function (error) { // 请求失败处理
  321. alert(error);
  322. });
  323. },
  324. //选中行变化
  325. handleCurrentChange4CC(val) {
  326. this.currentRow4CC = val;
  327. console.log('尺寸行变化');
  328. },
  329. handleCurrentChange4WG(val) {
  330. this.currentRow4WG = val;
  331. console.log('外观行变化');
  332. },
  333. handleCurrentChange4Test(val) {
  334. this.currentRow4Test = val;
  335. },
  336. submitCheck() {
  337. debugger;
  338. if (!this.form.Result) {
  339. $.modalMsg("必须存在最终检验结果", "warning");
  340. return false;
  341. }
  342. if (!this.form.FinalResult) {
  343. $.modalMsg("必须存在终判结果", "warning");
  344. return false;
  345. }
  346. //if (!this.form.IQCGroupHeaderResult) {
  347. // $.modalMsg("必须存在判定结果", "warning");
  348. // return false;
  349. //}
  350. //if (!this.form.IQCGroupHeaderRemark ) {
  351. // $.modalMsg("判定必须填写原因", "warning");
  352. // return false;
  353. //}
  354. //if (this.form.IQCGroupHeaderResult == "NG") {
  355. // if ( !this.form.BRGCode) {
  356. // $.modalMsg("判定不合格必须填写选择不良分类", "warning");
  357. // return false;
  358. // }
  359. //}
  360. //this.dataSource4CC.forEach((item) => {
  361. // if (!item.Result) {
  362. // }
  363. //})
  364. if (this.form.FinalResult == "判退") {
  365. for (var i = 0; i < this.dataSource4Test.length; i++) {
  366. let item = this.dataSource4Test[i];
  367. item.NgQty = item.Quantity;
  368. item.GoodQty = 0;
  369. item.InQty = 0;
  370. //if (!item.GoodQty && !item.NgQty) {
  371. // $.modalMsg("必须填写合格不合格数量", "warning");
  372. // return false;
  373. //}
  374. }
  375. }
  376. else if (this.form.FinalResult == "返工") {
  377. for (var i = 0; i < this.dataSource4Test.length; i++) {
  378. let item = this.dataSource4Test[i];
  379. if (!item.GoodQty && !item.NgQty) {
  380. $.modalMsg("必须填写合格不合格数量", "warning");
  381. return false;
  382. }
  383. }
  384. }
  385. else if (this.form.FinalResult == "让步接收") {
  386. if (!this.form.SpecialNo || !this.form.SpecialFile) {
  387. $.modalMsg("让步接收必须填写特采单号,上传文件", "warning");
  388. return false;
  389. }
  390. for (var i = 0; i < this.dataSource4Test.length; i++) {
  391. let item = this.dataSource4Test[i];
  392. if (!item.GoodQty && !item.NgQty) {
  393. $.modalMsg("必须填写合格不合格数量", "warning");
  394. return false;
  395. }
  396. }
  397. }
  398. else {
  399. }
  400. //this.form.CCList = this.dataSource4CC;
  401. //this.form.WGList = this.dataSource4WG;
  402. this.form.FinalItemLotList = this.dataSource4Test;
  403. this.$refs['form'].validate((valid) => {
  404. if (valid) {
  405. //alert('submit!');
  406. $.submitForm({
  407. url: "/BBWMS/IQCQuality/SaveMaterialCheckFinalJudgeResult",
  408. param: { keyValue: JSON.stringify(this.form) },
  409. success: function () {
  410. $.currentWindow().$("#gridList").trigger("reloadGrid");
  411. }
  412. })
  413. } else {
  414. console.log('error submit!!');
  415. return false;
  416. }
  417. });
  418. // console.log(result);
  419. },
  420. },
  421. });
  422. function submitForm() {
  423. //debugger;
  424. vm.submitCheck();
  425. }
  426. function UpLoadClick() {
  427. //var ids = $("#gridList").jqGrid('getGridParam', 'selarrrow'); //获取 多行数据
  428. //if (ids.length != 1) {
  429. // $.modalAlertNew("WMS00050");
  430. // return;
  431. //}
  432. $("#FileUp2").click();
  433. }
  434. </script>