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