-
admin
2024-04-18 e70fb4b691d0411cb6de676256160255a153cada
提交 | 用户 | 时间
e57a89 1 <template>
2   <div class="app-container">
3     <el-card class="box-card">
4     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
5       <el-form-item label-width="80" label="生产工单号" prop="workOrderNo">
6         <el-input
7           v-model="queryParams.workOrderNo"
8           placeholder="请输入生产工单号"
9           clearable
10           @keyup.enter.native="handleQuery"
11         />
12       </el-form-item>
13       <el-form-item label="产品名称" prop="productName">
14         <el-input
15           v-model="queryParams.productName"
16           placeholder="请输入产品名称"
17           clearable
18           @keyup.enter.native="handleQuery"
19         />
20       </el-form-item>
21       <el-form-item label="工单状态" prop="orderStatus">
22         <el-select v-model="queryParams.orderStatus" placeholder="请选择工单状态" clearable>
23           <el-option
24             v-for="dict in dict.type.order_state"
25             :key="dict.value"
26             :label="dict.label"
27             :value="dict.value"
28           />
29         </el-select>
30       </el-form-item>
31       <el-form-item style="float: right">
32         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
33         <el-button type="warning" icon="el-icon-copy-document" size="mini" @click="advancedQuery">高级查询</el-button>
34         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
35       </el-form-item>
36     </el-form>
37     <el-form :model="queryParams" ref="queryParams" size="small" :inline="true" v-show="advancedShowSearch" label-width="68px">
38       <el-form-item style="margin-left: 14px" label="产品编号" prop="productCode">
39         <el-input
40           v-model="queryParams.productCode"
648160 41           placeholder="请输入产品序列号"
e57a89 42           clearable
43           @keyup.enter.native="handleQuery"
44         />
45       </el-form-item>
46       <el-form-item label="订单编号" prop="salesOrderCode">
47         <el-input
48           v-model="queryParams.salesOrderCode"
49           placeholder="请输入订单编号"
50           clearable
51           @keyup.enter.native="handleQuery"
52         />
53       </el-form-item>
648160 54       <el-form-item label="工厂编号" prop="siteCode">
e57a89 55         <el-input
648160 56           v-model="queryParams.siteCode"
H 57           placeholder="请输入工厂编号"
e57a89 58           clearable
59           @keyup.enter.native="handleQuery"
60         />
61       </el-form-item>
648160 62       <el-form-item label="工站编号" prop="stationCode">
e57a89 63         <el-input
648160 64           v-model="queryParams.stationCode"
H 65           placeholder="请输入工站编号"
e57a89 66           clearable
67           @keyup.enter.native="handleQuery"
68         />
69       </el-form-item>
70     </el-form>
71     </el-card>
72
73     <el-card style="margin-top: 10px" class="box-card">
74     <el-row :gutter="10" class="mb8">
75       <el-col :span="1.5">
76         <el-button
77           type="primary"
78           plain
79           icon="el-icon-plus"
80           size="mini"
81           @click="handleAdd"
82           v-hasPermi="['om:productionOrde:add']"
83         >新增</el-button>
84       </el-col>
85       <el-col :span="1.5">
86         <el-button
87           type="success"
88           plain
89           icon="el-icon-edit"
90           size="mini"
91           :disabled="single"
92           @click="handleUpdate"
93           v-hasPermi="['om:productionOrde:edit']"
94         >修改</el-button>
95       </el-col>
96       <el-col :span="1.5">
97         <el-button
98           type="danger"
99           plain
100           icon="el-icon-delete"
101           size="mini"
102           :disabled="multiple"
103           @click="handleDelete"
104           v-hasPermi="['om:productionOrde:remove']"
105         >删除</el-button>
42cfe3 106         <el-button
107           type="info"
108           icon="el-icon-upload2"
109           size="mini"
110           @click="handleImport"
111         >导入</el-button>
e57a89 112       </el-col>
42cfe3 113       <el-col :span="1.5">
114         <el-button
115           type="warning"
116           plain
117           icon="el-icon-download"
118           size="mini"
119           @click="handleExport"
120           v-hasPermi="['om:productionOrde:export']"
121         >导出</el-button>
122       </el-col>
e70fb4 123       <el-col :span="1.5">
A 124         <el-button
125           type="warning"
126           plain
127           icon="el-icon-download"
128           size="mini"
129           @click="receivingWorkOrders"
130         >接收</el-button>
131       </el-col>
e57a89 132       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
133     </el-row>
134
135       <el-table border v-loading="loading" :data="productionOrdeList" @selection-change="handleSelectionChange">
136         <el-table-column type="selection" width="55" align="center" />
137         <el-table-column label="生产工单号" width="160" align="center">
138           <template slot-scope="scope">
139             <router-link :to="{path: '/main/workReport-data/index/', query: {workOrderNo: scope.row.workOrderNo} }" class="link-type">
140               <span>{{ scope.row.workOrderNo }}</span>
141             </router-link>
142           </template>
143         </el-table-column>
42cfe3 144 <!--        <el-table-column label="订单编号" width="140" align="center" prop="salesOrderCode">-->
145 <!--        </el-table-column>-->
49c784 146         <el-table-column label="产品编号" width="110" align="center" prop="productCode">
e57a89 147         </el-table-column>
648160 148         <el-table-column label="产品名称" width="120" align="center" prop="productName">
e57a89 149         </el-table-column>
49c784 150         <el-table-column label="产品序列号" width="110" align="center" prop="productNum">
151         </el-table-column>
b64ed2 152         <el-table-column label="产品型号" align="center" prop="productModel">
153         </el-table-column>
648160 154         <el-table-column label="工单状态" width="100" align="center" prop="orderStatus">
e57a89 155           <template slot-scope="scope">
156             <dict-tag :options="dict.type.order_state" :value="scope.row.orderStatus"/>
157           </template>
158         </el-table-column>
42cfe3 159 <!--        <el-table-column label="工厂编号" align="center" prop="siteCode">-->
160 <!--        </el-table-column>-->
648160 161         <el-table-column label="工站编号" align="center" prop="stationCode">
e57a89 162         </el-table-column>
648160 163         <el-table-column label="报工信息结果" width="110" align="center" prop="resultText">
e57a89 164         </el-table-column>
648160 165         <el-table-column label="报工结果代码" width="110" align="center" prop="resultCode">
e57a89 166         </el-table-column>
648160 167         <el-table-column label="是否报工" width="80" align="center" prop="sfResult">
e57a89 168         </el-table-column>
169         <el-table-column label="实际开始时间" width="160" align="center" prop="actualStartTime">
170         </el-table-column>
648160 171         <el-table-column label="当前站点报工时间" width="160" align="center" prop="actualEndTime">
e57a89 172         </el-table-column>
173         <el-table-column label="创建人" width="80" align="center" prop="createUser">
174         </el-table-column>
175         <el-table-column label="备注" width="100" align="center" prop="remarks">
176         </el-table-column>
177       </el-table>
178     </el-card>
179
180
181     <pagination
182       v-show="total>0"
183       :total="total"
184       :page.sync="queryParams.pageNum"
185       :limit.sync="queryParams.pageSize"
186       @pagination="getList"
187     />
188
189     <!-- 添加或修改生产工单对话框 -->
648160 190     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
e57a89 191        <span slot="title">
192         <i class="el-icon-s-order"></i>
193         {{titleName}}
194       </span>
648160 195       <el-form ref="form" inline :model="form" :rules="rules" label-width="100px">
H 196         <el-form-item label="生产工单号" prop="workOrderNo">
197           <el-input style="width: 265px" v-model="form.workOrderNo" placeholder="请输入生产工单号" />
e57a89 198         </el-form-item>
199         <el-form-item label="订单编号" prop="salesOrderCode">
648160 200           <el-input style="width: 265px" v-model="form.salesOrderCode" placeholder="请输入订单编号" />
e57a89 201         </el-form-item>
648160 202         <el-form-item label="产品序列号" prop="productNum">
e57a89 203           <el-input v-model="form.productCode" placeholder="请选择产品" >
204             <el-button slot="append" @click="handleSelectProduct" icon="el-icon-search"></el-button>
205           </el-input>
206           <ItemSelect ref="itemSelect" @onSelected="onItemSelected" > </ItemSelect>
207         </el-form-item>
208         <el-form-item label="产品名称" prop="productName">
648160 209           <el-input style="width: 265px" v-model="form.productName" disabled placeholder="请输入产品名称" />
e57a89 210         </el-form-item>
b64ed2 211         <el-form-item label="产品型号" prop="productModel">
212           <el-input v-model="form.productModel" placeholder="请输入产品型号" />
213         </el-form-item>
648160 214         <el-form-item label="工厂编号" prop="siteCode">
H 215           <el-input style="width: 265px" v-model="form.siteCode" placeholder="请输入工厂编号" />
e57a89 216         </el-form-item>
648160 217         <el-form-item label="工站编号" prop="stationCode">
H 218           <el-input style="width: 265px"v-model="form.stationCode" placeholder="请输入工站编号" />
e57a89 219         </el-form-item>
648160 220         <el-form-item label="备注" prop="remarks">
H 221           <el-input style="width: 265px" v-model="form.remarks" placeholder="请输入备注" />
e57a89 222         </el-form-item>
223
224       </el-form>
225       <div slot="footer" class="dialog-footer">
226         <el-button type="primary" @click="submitForm">确 定</el-button>
227         <el-button @click="cancel">取 消</el-button>
228       </div>
229     </el-dialog>
230
42cfe3 231     <!-- 用户导入对话框 -->
232     <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px">
233       <el-upload
234         ref="upload"
235         :limit="1"
236         accept=".xlsx, .xls"
237         :headers="upload.headers"
238         :action="upload.url + '?updateSupport=' + upload.updateSupport"
239         :disabled="upload.isUploading"
240         :on-progress="handleFileUploadProgress"
241         :on-success="handleFileSuccess"
242         :auto-upload="false"
243         drag
244       >
245         <i class="el-icon-upload"></i>
246         <div class="el-upload__text">
247           将文件拖到此处,或
248           <em>点击上传</em>
249         </div>
250         <div class="el-upload__tip" slot="tip">
251           <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
252           <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
253         </div>
254         <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
255       </el-upload>
256       <div slot="footer" class="dialog-footer">
257         <el-button type="primary" @click="submitFileForm">确 定</el-button>
258         <el-button @click="upload.open = false">取 消</el-button>
259       </div>
260     </el-dialog>
261
e57a89 262   </div>
263 </template>
264
265 <script>
42cfe3 266 import { getToken } from "@/utils/auth";
e57a89 267 import { listLineInfo } from "@/api/main/bs/lineInfo/lineInfo";
268 import { listWorkshop } from "@/api/main/bs/workshop/workshop";
269 import { listProductBom } from "@/api/main/bs/ProductBom/ProductBom";
270 import { listTechnologyRoute} from "@/api/main/bs/technologyRoute/technologyRoute";
271 import ItemSelect  from "@/components/itemSelect/single.vue";
42cfe3 272 import { importTemplate, upDownMove, listProductionOrde, getProductionOrde, delProductionOrde, addProductionOrde, updateProductionOrde } from "@/api/main/om/productionOrde/productionOrde";
e57a89 273
274 export default {
275   name: "ProductionOrde",
276   dicts: ['order_state'],
277   components: {
278     ItemSelect ,
279   },
280   data() {
281     return {
282       titleName: '',
283       options: [],
284       lineOptions: [],
285       showFlag:false,
286       advancedShowSearch: false,
287       workOrder: {
288         status: 'ss'
289       },
290       // 遮罩层
291       loading: true,
292       // 选中数组
293       ids: [],
294       // 非单个禁用
295       single: true,
296       // 非多个禁用
297       multiple: true,
298       move: true,
299       selectedRowIndex: -1, // 存储选中行的索引
300       // 显示搜索条件
301       showSearch: true,
302       // 总条数
303       total: 0,
304       // 生产工单表格数据
305       productionOrdeList: [],
306       // 弹出层标题
307       title: "",
308       // 是否显示弹出层
309       open: false,
310       // 查询参数
311       queryParams: {
312         pageNum: 1,
313         pageSize: 10,
314         workOrderNo: null,
315         salesOrderCode: null,
316         productCode: null,
317         productName: null,
318         workshopCode: null,
319         lineCode: null,
320         routeCode: null,
321         bomCode: null,
322         recipeCode: null,
323         orderStatus: null,
324         custom: null,
325         marketAreaCode: null,
326         softwareVersionCode: null,
327         productCompanyCode: null,
328         frontEndId: 0,
329         idNums: null,
330         flag: null,
b64ed2 331         siteCode: null,
332         productNum: null,
333         stationCode: null,
334         resultText: null,
335         resultCode: null,
336         sfResult: null,
337         productModel: null
338
e57a89 339       },
340       // 表单参数
341       form: {},
342       updateStatusParameter: {
343         id: null,
344         orderStatus: null
345       },
346       // 表单校验
347       rules: {
348         id: [
349           { required: true, message: "ID不能为空", trigger: "blur" }
350         ],
42cfe3 351       },
352       // 用户导入参数
353       upload: {
354         // 是否显示弹出层(用户导入)
355         open: false,
356         // 弹出层标题(用户导入)
357         title: "",
358         // 是否禁用上传
359         isUploading: false,
360         // 是否更新已经存在的用户数据
361         updateSupport: 0,
362         // 设置上传的请求头部
363         headers: { Authorization: "Bearer " + getToken() },
364         // 上传的地址
365         url: process.env.VUE_APP_BASE_API + "/om/productionOrde/importData"
366       },
e57a89 367     };
368   },
369   created() {
370     this.getList();
371     this.initWorkshop();
372   },
373   methods: {
e70fb4 374     receivingWorkOrders(){
A 375
376     },
42cfe3 377     /** 导入按钮操作 */
378     handleImport() {
379       this.upload.title = "订单信息导入";
380       this.upload.open = true;
381     },
382     /** 下载模板操作 */
383     importTemplate() {
384       this.download('om/productionOrde/importTemplate', {
385       }, `productionOrde_template_${new Date().getTime()}.xlsx`)
386     },
387 // 文件上传中处理
388     handleFileUploadProgress(event, file, fileList) {
389       this.upload.isUploading = true;
390     },
391 // 文件上传成功处理
392     handleFileSuccess(response, file, fileList) {
393       this.upload.open = false;
394       this.upload.isUploading = false;
395       this.$refs.upload.clearFiles();
396       this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
397       this.getList();
398     },
399 // 提交上传文件
400     submitFileForm() {
401       this.$refs.upload.submit();
e57a89 402     },
403     initWorkshop(){
404       listWorkshop(this.queryParams).then(response => {
405         this.options = response.rows;
406       });
407     },
408     // 在这里编写处理选中事件的逻辑
409     handleSelectChange(selectedOption) {
410       this.form.lineCode = null;
411       let params = {
412         workshopCode: selectedOption
413       };
414       listLineInfo(params).then(response => {
415         this.lineOptions = response.rows;
416       });
417     },
418     //物料选择弹出框
419     onItemSelected(obj){
420       if(obj !== undefined && obj !== null){
421         let productCode = obj.materialCode;
422         this.form.productCode = productCode;
423         this.form.productName = obj.materialName;
424         this.queryParams.productCode = productCode
425         listTechnologyRoute(this.queryParams).then(response => {
426           this.form.routeCode = response.rows[0].routeCode;
427         });
428         listProductBom(this.queryParams).then(response => {
429           this.form.bomCode = response.rows[0].bomCode;
430         });
431       }
432     },
433     handleSelectProduct(){
434       this.$refs.itemSelect.showFlag = true;
435     },
436     advancedQuery(){
437       this.advancedShowSearch = (this.advancedShowSearch) ? this.advancedShowSearch = false : this.advancedShowSearch = true;
438     },
439     handleCommand(status,id) {
440       console.log(status)
441       this.updateStatusParameter.id = id;
442       this.updateStatusParameter.orderStatus = status;
443       updateProductionOrde(this.updateStatusParameter).then(response => {
444         this.$modal.msgSuccess("修改成功");
445         this.open = false;
446         this.getList();
447       });
448     },
449     /** 查询生产工单列表 */
450     getList() {
451       this.loading = true;
452       listProductionOrde(this.queryParams).then(response => {
453         this.productionOrdeList = response.rows;
454         this.total = response.total;
455         this.loading = false;
456       });
457     },
458     // 取消按钮
459     cancel() {
460       this.open = false;
461       this.reset();
462     },
463     // 表单重置
464     reset() {
465       this.form = {
466         id: null,
467         workOrderNo: null,
468         salesOrderCode: null,
469         productCode: null,
470         productName: null,
471         workshopCode: null,
472         lineCode: null,
473         routeCode: null,
474         bomCode: null,
475         recipeCode: null,
476         planQty: null,
477         actualQty: null,
478         badQty: null,
479         scrapQty: null,
480         repairQty: null,
481         actualOnlineQty: null,
482         onlineCompletionMark: null,
483         demandDate: null,
484         planStartTime: null,
485         planEndTime: null,
486         actualStartTime: null,
487         actualEndTime: null,
488         serialNumber: null,
489         orderStatus: null,
490         createTime: null,
491         updateTime: null,
492         createUser: null,
493         updateUser: null,
494         remarks: null,
495         streamNumber: null,
496         custom: null,
497         marketAreaCode: null,
498         softwareVersionCode: null,
499         productCompanyCode: null,
500         spareField1: null,
501         spareField2: null,
502         spareField3: null,
648160 503         spareField4: null,
H 504         siteCode: null,
505         productNum: null,
506         stationCode: null,
507         resultText: null,
508         resultCode: null,
509         sfResult: null
e57a89 510       };
511       this.resetForm("form");
512     },
513     /** 搜索按钮操作 */
514     handleQuery() {
515       this.queryParams.pageNum = 1;
516       this.getList();
517     },
518     /** 重置按钮操作 */
519     resetQuery() {
520       this.resetForm("queryForm");
521       this.handleQuery();
522     },
523     // 多选框选中数据
524     handleSelectionChange(selection) {
525       this.ids = selection.map(item => item.id)
526       this.move = selection.length!==1
527       if(!selection.length){
528         this.single = true
529         this.multiple = true
530       }else {
531         if(selection[0].orderStatus === '1' && selection.length === 1){
532           this.single = false
533           this.multiple = false
534         }
535       }
536
537     },
538     /** 新增按钮操作 */
539     handleAdd() {
540       this.initWorkshop();
541       this.reset();
542       this.open = true;
543       this.titleName = "添加生产工单";
544     },
545     /** 修改按钮操作 */
546     handleUpdate(row) {
547       this.initWorkshop();
548       this.reset();
549       const id = row.id || this.ids
550       getProductionOrde(id).then(response => {
551         console.log(response.data)
552         this.form = response.data;
553         this.open = true;
554         this.titleName = "修改生产工单";
555       });
556     },
557     /** 提交按钮 */
558     submitForm() {
559       this.$refs["form"].validate(valid => {
560         if (valid) {
561           if (this.form.id != null) {
562             updateProductionOrde(this.form).then(response => {
563               this.$modal.msgSuccess("修改成功");
564               this.open = false;
565               this.getList();
566             });
567           } else {
568             addProductionOrde(this.form).then(response => {
569               this.$modal.msgSuccess("新增成功");
570               this.open = false;
571               this.getList();
572             });
573           }
574         }
575       });
576     },
577     /** 删除按钮操作 */
578     handleDelete(row) {
579       const ids = row.id || this.ids;
580       this.$modal.confirm('是否确认删除生产工单编号为"' + ids + '"的数据项?').then(function() {
581         return delProductionOrde(ids);
582       }).then(() => {
583         this.getList();
584         this.$modal.msgSuccess("删除成功");
585       }).catch(() => {});
586     },
587     /** 导出按钮操作 */
588     handleExport() {
589       this.download('om/productionOrde/export', {
590         ...this.queryParams
591       }, `productionOrde_${new Date().getTime()}.xlsx`)
592     }
593   }
594 };
595 </script>
596 <style lang="scss" scoped>
597 //::v-deep .el-dialog__header{
598 //  /*background-color: #f8f8f8;*/
599 //  background-color: #f8f8f9;
600 //}
601 </style>