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