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