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.

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