懒羊羊
2024-03-15 49c784e6ac7d71c5eaf7352e0a215842b4ca5456
提交 | 用户 | 时间
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>
106       </el-col>
648160 107 <!--      <el-col :span="1.5">-->
H 108 <!--        <el-button-->
109 <!--          type="warning"-->
110 <!--          plain-->
111 <!--          icon="el-icon-download"-->
112 <!--          size="mini"-->
113 <!--          @click="handleExport"-->
114 <!--          v-hasPermi="['om:productionOrde:export']"-->
115 <!--        >导出</el-button>-->
116 <!--      </el-col>-->
117 <!--      <el-col :span="1.5">-->
118 <!--        <el-button-->
119 <!--          type="warning"-->
120 <!--          plain-->
121 <!--          icon="el-icon-upload2"-->
122 <!--          :disabled="move"-->
123 <!--          size="mini"-->
124 <!--          @click="moveUp(val => val, 'up')"-->
125 <!--        >上移</el-button>-->
126 <!--      </el-col>-->
127 <!--      <el-col :span="1.5">-->
128 <!--        <el-button-->
129 <!--          type="warning"-->
130 <!--          plain-->
131 <!--          icon="el-icon-download"-->
132 <!--          size="mini"-->
133 <!--          :disabled="move"-->
134 <!--          @click="moveUp(val => val, 'down')"-->
135 <!--        >下移</el-button>-->
136 <!--      </el-col>-->
e57a89 137       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
138     </el-row>
139
140       <el-table border v-loading="loading" :data="productionOrdeList" @selection-change="handleSelectionChange">
141         <el-table-column type="selection" width="55" align="center" />
142         <el-table-column label="生产工单号" width="160" align="center">
143           <template slot-scope="scope">
144             <router-link :to="{path: '/main/workReport-data/index/', query: {workOrderNo: scope.row.workOrderNo} }" class="link-type">
145               <span>{{ scope.row.workOrderNo }}</span>
146             </router-link>
147           </template>
148         </el-table-column>
149         <el-table-column label="订单编号" width="140" align="center" prop="salesOrderCode">
150         </el-table-column>
49c784 151         <el-table-column label="产品编号" width="110" align="center" prop="productCode">
e57a89 152         </el-table-column>
648160 153         <el-table-column label="产品名称" width="120" align="center" prop="productName">
e57a89 154         </el-table-column>
49c784 155         <el-table-column label="产品序列号" width="110" align="center" prop="productNum">
156         </el-table-column>
b64ed2 157         <el-table-column label="产品型号" align="center" prop="productModel">
158         </el-table-column>
648160 159         <el-table-column label="工单状态" width="100" align="center" prop="orderStatus">
e57a89 160           <template slot-scope="scope">
161             <dict-tag :options="dict.type.order_state" :value="scope.row.orderStatus"/>
162           </template>
163         </el-table-column>
648160 164         <el-table-column label="工厂编号" align="center" prop="siteCode">
e57a89 165         </el-table-column>
648160 166         <el-table-column label="工站编号" align="center" prop="stationCode">
e57a89 167         </el-table-column>
648160 168         <el-table-column label="报工信息结果" width="110" align="center" prop="resultText">
e57a89 169         </el-table-column>
648160 170         <el-table-column label="报工结果代码" width="110" align="center" prop="resultCode">
e57a89 171         </el-table-column>
648160 172         <el-table-column label="是否报工" width="80" align="center" prop="sfResult">
e57a89 173         </el-table-column>
174         <el-table-column label="实际开始时间" width="160" align="center" prop="actualStartTime">
175         </el-table-column>
648160 176         <el-table-column label="当前站点报工时间" width="160" align="center" prop="actualEndTime">
e57a89 177         </el-table-column>
178         <el-table-column label="创建人" width="80" align="center" prop="createUser">
179         </el-table-column>
180         <el-table-column label="备注" width="100" align="center" prop="remarks">
181         </el-table-column>
648160 182 <!--        <el-table-column label="流水号" align="center" prop="streamNumber">-->
H 183 <!--        </el-table-column>-->
184 <!--        <el-table-column label="客户" width="80" align="center" prop="custom">-->
185 <!--        </el-table-column>-->
186 <!--        <el-table-column fixed="right" width="350" label="操作" align="center" class-name="small-padding fixed-width">-->
187 <!--          <template slot-scope="scope">-->
188 <!--            &lt;!&ndash;  工单状态(1创建、2已发布、3生产中、4已冻结、5已完工、6已关闭) &ndash;&gt;-->
189 <!--            <el-button type="success" :disabled="scope.row.orderStatus !== '1'"  style="width: 72px" plain @click="handleCommand('3',scope.row.id)" size="mini">开始</el-button>-->
190 <!--            <el-button style="width: 72px" :disabled="scope.row.orderStatus !== '2' && scope.row.orderStatus !== '3'" v-if="scope.row.orderStatus !== '2'&&  scope.row.orderStatus !== '4'" plain @click="handleCommand('4',scope.row.id)" type="warning" size="mini">冻结</el-button>-->
191 <!--            <el-button style="width: 72px" :disabled="scope.row.orderStatus !== '4'" v-if="scope.row.orderStatus === '4'" plain @click="handleCommand('3',scope.row.id)" type="warning" size="mini">解冻</el-button>-->
192 <!--            <el-button style="width: 72px" :disabled="scope.row.orderStatus !== '1'" plain @click="handleCommand('6',scope.row.id)" v-if="scope.row.orderStatus === '1'||scope.row.orderStatus === '3'||scope.row.orderStatus === '4'||scope.row.orderStatus === '5'" type="danger" size="mini">关闭</el-button>-->
193 <!--            <el-button style="width: 72px" :disabled="scope.row.orderStatus !== '6'" plain @click="handleCommand('1',scope.row.id)" v-if="scope.row.orderStatus === '6' " type="success" size="mini">启用</el-button>-->
194 <!--&lt;!&ndash;            <el-button&ndash;&gt;-->
195 <!--&lt;!&ndash;              :disabled="scope.row.orderStatus !== '1'"&ndash;&gt;-->
196 <!--&lt;!&ndash;              size="mini"&ndash;&gt;-->
197 <!--&lt;!&ndash;              type="success"&ndash;&gt;-->
198 <!--&lt;!&ndash;              style="width: 72px"&ndash;&gt;-->
199 <!--&lt;!&ndash;              icon="el-icon-edit"&ndash;&gt;-->
200 <!--&lt;!&ndash;              @click="handleUpdate(scope.row)"&ndash;&gt;-->
201 <!--&lt;!&ndash;              v-hasPermi="['om:productionOrde:edit']"&ndash;&gt;-->
202 <!--&lt;!&ndash;            >修改</el-button>&ndash;&gt;-->
203 <!--&lt;!&ndash;            <el-button&ndash;&gt;-->
204 <!--&lt;!&ndash;              :disabled="scope.row.orderStatus !== '1'"&ndash;&gt;-->
205 <!--&lt;!&ndash;              size="mini"&ndash;&gt;-->
206 <!--&lt;!&ndash;              type="warning"&ndash;&gt;-->
207 <!--&lt;!&ndash;              style="width: 72px"&ndash;&gt;-->
208 <!--&lt;!&ndash;              icon="el-icon-delete"&ndash;&gt;-->
209 <!--&lt;!&ndash;              @click="handleDelete(scope.row)"&ndash;&gt;-->
210 <!--&lt;!&ndash;              v-hasPermi="['om:productionOrde:remove']"&ndash;&gt;-->
211 <!--&lt;!&ndash;            >删除</el-button>&ndash;&gt;-->
212 <!--            <el-button style="width: 72px" :disabled="scope.row.orderStatus === '4'||scope.row.orderStatus === '6'" v-if="scope.row.orderStatus !== '5'" @click="handleCommand('5',scope.row.id)" type="success" size="mini">完成</el-button>-->
213 <!--            <el-button style="width: 72px" :disabled="scope.row.orderStatus === '5'" v-if="scope.row.orderStatus === '5'" type="success" size="mini">已完工</el-button>            <el-button style="width: 72px" :disabled="scope.row.orderStatus !== '6'" plain @click="handleCommand('1',scope.row.id)" v-if="scope.row.orderStatus === '6' " type="success" size="mini">启用</el-button>-->
214 <!--          </template>-->
215 <!--        </el-table-column>-->
e57a89 216       </el-table>
217     </el-card>
218
219
220     <pagination
221       v-show="total>0"
222       :total="total"
223       :page.sync="queryParams.pageNum"
224       :limit.sync="queryParams.pageSize"
225       @pagination="getList"
226     />
227
228     <!-- 添加或修改生产工单对话框 -->
648160 229     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body>
e57a89 230        <span slot="title">
231         <i class="el-icon-s-order"></i>
232         {{titleName}}
233       </span>
648160 234       <el-form ref="form" inline :model="form" :rules="rules" label-width="100px">
H 235         <el-form-item label="生产工单号" prop="workOrderNo">
236           <el-input style="width: 265px" v-model="form.workOrderNo" placeholder="请输入生产工单号" />
e57a89 237         </el-form-item>
238         <el-form-item label="订单编号" prop="salesOrderCode">
648160 239           <el-input style="width: 265px" v-model="form.salesOrderCode" placeholder="请输入订单编号" />
e57a89 240         </el-form-item>
648160 241         <el-form-item label="产品序列号" prop="productNum">
e57a89 242           <el-input v-model="form.productCode" placeholder="请选择产品" >
243             <el-button slot="append" @click="handleSelectProduct" icon="el-icon-search"></el-button>
244           </el-input>
245           <ItemSelect ref="itemSelect" @onSelected="onItemSelected" > </ItemSelect>
246         </el-form-item>
247         <el-form-item label="产品名称" prop="productName">
648160 248           <el-input style="width: 265px" v-model="form.productName" disabled placeholder="请输入产品名称" />
e57a89 249         </el-form-item>
b64ed2 250         <el-form-item label="产品型号" prop="productModel">
251           <el-input v-model="form.productModel" placeholder="请输入产品型号" />
252         </el-form-item>
648160 253         <el-form-item label="工厂编号" prop="siteCode">
H 254           <el-input style="width: 265px" v-model="form.siteCode" placeholder="请输入工厂编号" />
e57a89 255         </el-form-item>
648160 256         <el-form-item label="工站编号" prop="stationCode">
H 257           <el-input style="width: 265px"v-model="form.stationCode" placeholder="请输入工站编号" />
e57a89 258         </el-form-item>
648160 259         <el-form-item label="备注" prop="remarks">
H 260           <el-input style="width: 265px" v-model="form.remarks" placeholder="请输入备注" />
e57a89 261         </el-form-item>
262
263       </el-form>
264       <div slot="footer" class="dialog-footer">
265         <el-button type="primary" @click="submitForm">确 定</el-button>
266         <el-button @click="cancel">取 消</el-button>
267       </div>
268     </el-dialog>
269
270   </div>
271 </template>
272
273 <script>
274 import { listLineInfo } from "@/api/main/bs/lineInfo/lineInfo";
275 import { listWorkshop } from "@/api/main/bs/workshop/workshop";
276 import { listProductBom } from "@/api/main/bs/ProductBom/ProductBom";
277 import { listTechnologyRoute} from "@/api/main/bs/technologyRoute/technologyRoute";
278 import ItemSelect  from "@/components/itemSelect/single.vue";
279 import { upDownMove, listProductionOrde, getProductionOrde, delProductionOrde, addProductionOrde, updateProductionOrde } from "@/api/main/om/productionOrde/productionOrde";
280
281 export default {
282   name: "ProductionOrde",
283   dicts: ['order_state'],
284   components: {
285     ItemSelect ,
286   },
287   data() {
288     return {
289       titleName: '',
290       options: [],
291       lineOptions: [],
292       showFlag:false,
293       advancedShowSearch: false,
294       workOrder: {
295         status: 'ss'
296       },
297       // 遮罩层
298       loading: true,
299       // 选中数组
300       ids: [],
301       // 非单个禁用
302       single: true,
303       // 非多个禁用
304       multiple: true,
305       move: true,
306       selectedRowIndex: -1, // 存储选中行的索引
307       // 显示搜索条件
308       showSearch: true,
309       // 总条数
310       total: 0,
311       // 生产工单表格数据
312       productionOrdeList: [],
313       // 弹出层标题
314       title: "",
315       // 是否显示弹出层
316       open: false,
317       // 查询参数
318       queryParams: {
319         pageNum: 1,
320         pageSize: 10,
321         workOrderNo: null,
322         salesOrderCode: null,
323         productCode: null,
324         productName: null,
325         workshopCode: null,
326         lineCode: null,
327         routeCode: null,
328         bomCode: null,
329         recipeCode: null,
330         orderStatus: null,
331         custom: null,
332         marketAreaCode: null,
333         softwareVersionCode: null,
334         productCompanyCode: null,
335         frontEndId: 0,
336         idNums: null,
337         flag: null,
b64ed2 338         siteCode: null,
339         productNum: null,
340         stationCode: null,
341         resultText: null,
342         resultCode: null,
343         sfResult: null,
344         productModel: null
345
e57a89 346       },
347       // 表单参数
348       form: {},
349       updateStatusParameter: {
350         id: null,
351         orderStatus: null
352       },
353       // 表单校验
354       rules: {
355         id: [
356           { required: true, message: "ID不能为空", trigger: "blur" }
357         ],
358       }
359     };
360   },
361   created() {
362     this.getList();
363     this.initWorkshop();
364   },
365   methods: {
366     moveUp(row, val){
367       console.log(val)
368       const ids = row.id || this.ids
369       let str = JSON.stringify(ids);
370       let num = BigInt(str.replace(/[\[\]]/g, ''));
371       this.queryParams.frontEndId = num
372       this.queryParams.idNums = ids
373       this.queryParams.flag = val
374       upDownMove(this.queryParams).then(response => {
375         this.$modal.msgSuccess("移动成功");
376         this.getList();
377       });
378     },
379     initWorkshop(){
380       listWorkshop(this.queryParams).then(response => {
381         this.options = response.rows;
382       });
383     },
384     // 在这里编写处理选中事件的逻辑
385     handleSelectChange(selectedOption) {
386       this.form.lineCode = null;
387       let params = {
388         workshopCode: selectedOption
389       };
390       listLineInfo(params).then(response => {
391         this.lineOptions = response.rows;
392       });
393     },
394     //物料选择弹出框
395     onItemSelected(obj){
396       if(obj !== undefined && obj !== null){
397         let productCode = obj.materialCode;
398         this.form.productCode = productCode;
399         this.form.productName = obj.materialName;
400         this.queryParams.productCode = productCode
401         listTechnologyRoute(this.queryParams).then(response => {
402           this.form.routeCode = response.rows[0].routeCode;
403         });
404         listProductBom(this.queryParams).then(response => {
405           this.form.bomCode = response.rows[0].bomCode;
406         });
407       }
408     },
409     handleSelectProduct(){
410       this.$refs.itemSelect.showFlag = true;
411     },
412     advancedQuery(){
413       this.advancedShowSearch = (this.advancedShowSearch) ? this.advancedShowSearch = false : this.advancedShowSearch = true;
414     },
415     handleCommand(status,id) {
416       console.log(status)
417       this.updateStatusParameter.id = id;
418       this.updateStatusParameter.orderStatus = status;
419       updateProductionOrde(this.updateStatusParameter).then(response => {
420         this.$modal.msgSuccess("修改成功");
421         this.open = false;
422         this.getList();
423       });
424     },
425     /** 查询生产工单列表 */
426     getList() {
427       this.loading = true;
428       listProductionOrde(this.queryParams).then(response => {
429         this.productionOrdeList = response.rows;
430         this.total = response.total;
431         this.loading = false;
432       });
433     },
434     // 取消按钮
435     cancel() {
436       this.open = false;
437       this.reset();
438     },
439     // 表单重置
440     reset() {
441       this.form = {
442         id: null,
443         workOrderNo: null,
444         salesOrderCode: null,
445         productCode: null,
446         productName: null,
447         workshopCode: null,
448         lineCode: null,
449         routeCode: null,
450         bomCode: null,
451         recipeCode: null,
452         planQty: null,
453         actualQty: null,
454         badQty: null,
455         scrapQty: null,
456         repairQty: null,
457         actualOnlineQty: null,
458         onlineCompletionMark: null,
459         demandDate: null,
460         planStartTime: null,
461         planEndTime: null,
462         actualStartTime: null,
463         actualEndTime: null,
464         serialNumber: null,
465         orderStatus: null,
466         createTime: null,
467         updateTime: null,
468         createUser: null,
469         updateUser: null,
470         remarks: null,
471         streamNumber: null,
472         custom: null,
473         marketAreaCode: null,
474         softwareVersionCode: null,
475         productCompanyCode: null,
476         spareField1: null,
477         spareField2: null,
478         spareField3: null,
648160 479         spareField4: null,
H 480         siteCode: null,
481         productNum: null,
482         stationCode: null,
483         resultText: null,
484         resultCode: null,
485         sfResult: null
e57a89 486       };
487       this.resetForm("form");
488     },
489     /** 搜索按钮操作 */
490     handleQuery() {
491       this.queryParams.pageNum = 1;
492       this.getList();
493     },
494     /** 重置按钮操作 */
495     resetQuery() {
496       this.resetForm("queryForm");
497       this.handleQuery();
498     },
499     // 多选框选中数据
500     handleSelectionChange(selection) {
501       this.ids = selection.map(item => item.id)
502       this.move = selection.length!==1
503       if(!selection.length){
504         this.single = true
505         this.multiple = true
506       }else {
507         if(selection[0].orderStatus === '1' && selection.length === 1){
508           this.single = false
509           this.multiple = false
510         }
511       }
512
513     },
514     /** 新增按钮操作 */
515     handleAdd() {
516       this.initWorkshop();
517       this.reset();
518       this.open = true;
519       this.titleName = "添加生产工单";
520     },
521     /** 修改按钮操作 */
522     handleUpdate(row) {
523       this.initWorkshop();
524       this.reset();
525       const id = row.id || this.ids
526       getProductionOrde(id).then(response => {
527         console.log(response.data)
528         this.form = response.data;
529         this.open = true;
530         this.titleName = "修改生产工单";
531       });
532     },
533     /** 提交按钮 */
534     submitForm() {
535       this.$refs["form"].validate(valid => {
536         if (valid) {
537           if (this.form.id != null) {
538             updateProductionOrde(this.form).then(response => {
539               this.$modal.msgSuccess("修改成功");
540               this.open = false;
541               this.getList();
542             });
543           } else {
544             addProductionOrde(this.form).then(response => {
545               this.$modal.msgSuccess("新增成功");
546               this.open = false;
547               this.getList();
548             });
549           }
550         }
551       });
552     },
553     /** 删除按钮操作 */
554     handleDelete(row) {
555       const ids = row.id || this.ids;
556       this.$modal.confirm('是否确认删除生产工单编号为"' + ids + '"的数据项?').then(function() {
557         return delProductionOrde(ids);
558       }).then(() => {
559         this.getList();
560         this.$modal.msgSuccess("删除成功");
561       }).catch(() => {});
562     },
563     /** 导出按钮操作 */
564     handleExport() {
565       this.download('om/productionOrde/export', {
566         ...this.queryParams
567       }, `productionOrde_${new Date().getTime()}.xlsx`)
568     }
569   }
570 };
571 </script>
572 <style lang="scss" scoped>
573 //::v-deep .el-dialog__header{
574 //  /*background-color: #f8f8f8;*/
575 //  background-color: #f8f8f9;
576 //}
577 </style>