春风项目四线(合箱线、总装线)
wujian
2024-09-10 51b05b093fa15dd477981372f67ae7b3b2747733
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<template>
  <div class="app-container">
    <div style="height: 100%;width: 100%">
      <el-card class="box-card">
        <el-form :model="queryParams" size="large" :inline="true" label-width="68px" @submit.native.prevent>
          <el-form-item label-width="200" label="箱体码" :prop="queryParams.productionNotice"  style="align-content: center">
            <input v-model="queryParams.productionNotice"
                      ref="inputdata"
                   style="height: 39px; width: 300px"
                   placeholder="请扫描箱体码"
                     />
          </el-form-item>
          <el-checkbox class="custom-size" style="margin-left: 40px; margin-right: 40px" v-model="repairFlag">返修</el-checkbox>
          <el-button size="large" type="info" @click="refresh">返回</el-button>
        </el-form>
      </el-card>
      <el-row :gutter="0">
        <el-col :span="6">
          <div >
            <el-card style="height: 560px">
              <el-descriptions class="margin-top" :column="1" direction="horizontal">
                <el-descriptions-item label="生产订单">{{singleSelect.workOrderNo}}</el-descriptions-item>
                <el-descriptions-item label="机型" :span="2">{{singleSelect.typeZ}}</el-descriptions-item>
                <el-descriptions-item label="计划数量">
                  {{singleSelect.planQty}}
                </el-descriptions-item>
                <el-descriptions-item label="上线数量">{{onlineNum}}</el-descriptions-item>
                <el-descriptions-item label="完成数量">{{finishNum}}</el-descriptions-item>
                <el-descriptions-item label="不合格数">{{unReachNum}}</el-descriptions-item>
              </el-descriptions>
            </el-card>
          </div>
        </el-col>
        <el-col :span="18">
          <div>
            <el-card style="height: 560px; overflow: auto">
              <el-table border :data="orderSchedulingList">
                <el-table-column
                  type="index"
                  label="序号"
                  width="50"></el-table-column>
                <el-table-column label="生产订单" align="center" prop="orderNo" width="130">
 
                </el-table-column>
                <el-table-column label="发动机号" align="center" prop="engineNo" width="150">
 
                </el-table-column>
                <el-table-column label="箱体码" align="center" prop="boxCode" width="250">
 
                </el-table-column>
                <el-table-column label="机型" align="center" prop="model">
 
                </el-table-column>
                <el-table-column label="生产状态" align="center" prop="productionStatus">
                  <template slot-scope="scope">
                    <dict-tag :options="dict.type.order_scheduling_produce_status" :value="scope.row.productionStatus"/>
                  </template>
                </el-table-column>
                <el-table-column label="质量状态" align="center" prop="qualityStatus">
                  <template slot-scope="scope">
                    <dict-tag :options="dict.type.quality_status" :value="scope.row.qualityStatus"/>
                  </template>
                </el-table-column>
 
 
                <el-table-column label="操作人" align="center" prop="operator">
                </el-table-column>
                <el-table-column label="操作时间" align="center" prop="operateTime" width="160">
                  <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.operateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
                  </template>
                </el-table-column>
                <el-table-column
                  fixed="right"
                  label="操作"
                  width="100">
                  <template slot-scope="scope">
                    <el-button @click="handleClick(scope.row)" type="text" size="small">更换箱体上线</el-button>
                  </template>
                </el-table-column>
              </el-table>
              <pagination
                v-show="total>0"
                :total="total"
                :page.sync="queryParams.pageNum"
                :limit.sync="queryParams.pageSize"
                @pagination="getListData"
              />
            </el-card>
          </div>
        </el-col>
      </el-row>
    </div>
    <el-dialog v-dialogpop-up :title="title" :visible.sync="changeBoxFlag" width="500px" append-to-body>
       <span slot="title">
        <i class="el-icon-s-order"></i>
        {{titleName}}
      </span>
      <el-form ref="changeFrom" inline  :model="changeFrom" label-width="80px">
        <el-form-item   label="发动机号" prop="sfcCode">
          <el-input disabled v-model="changeFrom.sfcCode" style="width: 370px"/>
        </el-form-item>
        <el-form-item   label="原箱体码" prop="boxCode">
          <el-input disabled v-model="changeFrom.boxCode" style="width: 370px"/>
        </el-form-item>
        <el-form-item  label="现箱体码" v-model="changeFrom.newBoxCode" prop="newBoxCode">
          <input v-model="changeFrom.newBoxCode"
                 ref="changeBoxInput"
                 style="height: 39px; width: 370px"
                 placeholder="请扫描箱体码"
          />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormForBoxCode">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
 
import { engineNoIsInModel, changeBoxCode, getSumDataMethod, listOrderScheduling3 } from "../../../../api/main/bs/orderScheduling/orderScheduling";
export default {
  name: 'Detail',
  props: ['singleSelect'],
  dicts: ['order_scheduling_produce_status','quality_status','print_status','material_type'],
  data(){
    return{
      title: '更换箱体',
      changeBoxFlag: false,
      titleName: '更换箱体',
      changeFrom: {
        boxCode: '',
        newBoxCode: '',
        sfcCode: ''
      },
      // 总条数
      total: 0,
      repairFlag:false,
      queryParams: {
        orderNo:'',
        pageNum: 1,
        pageSize: 10,
      },
      orderSchedulingList: [],
      onlineNum: 0,
      finishNum: 0,
      unReachNum: 0,
      scannerFlag: false
    }
  },
  methods:{
    handleQuery(){
 
    },
    submitFormForBoxCode(){
      if (this.changeFrom.newBoxCode === '' || this.changeFrom.newBoxCode === null){
        this.$message.info("新箱体码不能为空")
      } else {
        changeBoxCode({sfcCode:this.changeFrom.sfcCode,newBoxCode:this.changeFrom.newBoxCode}).then(res => {
          console.log('res',res)
          if (res.code===200){
            this.$message({
              message:'操作成功',
              type:'success'
            })
            this.changeBoxFlag = false
            this.getListData()
            this.$refs.inputdata.focus()
          }else {
            this.$message({
              message:res.msg,
              type:'warning'
            })
 
          }
        })
      }
 
    },
    handleClick(row){
      console.log('row',row)
      this.changeBoxFlag = true
      this.changeFrom.sfcCode = row.engineNo
      this.changeFrom.boxCode = row.boxCode
      this.changeFrom.newBoxCode = ''
      this.$nextTick(()=>{
        this.$refs.changeBoxInput.focus()
      })
    },
    cancel(){
      this.changeBoxFlag = false
      this.$refs.inputdata.focus()
    },
    handleChangeBoxInput(event){
      const input = event.target
      const inputValue = input.value
      this.changeFrom.newBoxCode =  inputValue
 
    },
    refresh() {
      this.$emit("reserveChild",null)
    },
    setFocus(){
      this.$nextTick(()=>{
        this.$refs.inputdata.focus()
      })
    },
    handleScannerInput(event){
      if (this.scannerFlag){
        this.queryParams.productionNotice = ''
        this.$refs.inputdata.value = ''
        this.scannerFlag = false
      }
      const input = event.target
      const inputValue = input.value
      this.queryParams.productionNotice = inputValue
      if (event.key === 'Enter'){
        this.scannerFlag = true
        //扫描完成
        engineNoIsInModel({engineNo:this.queryParams.productionNotice,
          model:this.singleSelect.typeZ,orderNo:this.singleSelect.workOrderNo,repairFlag:this.repairFlag
        }).then(res => {
          if (res.data===500){
            this.$message({
              message:res.msg,
              type:'warning'
            })
          }else {
            this.$message({
              message:'操作成功',
              type:'success'
            })
            this.repairFlag = false
            this.getListData()
          }
        })
      }
    },
    //查询列表
    getListData(){
      this.queryParams.orderNo = this.singleSelect.workOrderNo
      listOrderScheduling3(this.queryParams).then(res => {
        this.orderSchedulingList = res.rows
        this.total = res.total
      })
      getSumDataMethod(this.queryParams).then(res =>{
        console.log('res',res)
        this.onlineNum = res.data.onlineNum
        this.finishNum = res.data.finishNum
        this.unReachNum = res.data.unqualified
      })
    }
  },
  mounted() {
    this.getListData()
    this.setFocus()
    this.$refs.inputdata.addEventListener('keydown',this.handleScannerInput)
    this.$refs.changeBoxInput.addEventListener('keydown',this.handleChangeBoxInput)
  },
  beforeDestroy() {
    this.$refs.inputdata.removeEventListener('keydown',this.handleScannerInput)
    this.$refs.changeBoxInput.removeEventListener('keydown',this.handleChangeBoxInput)
  }
}
</script>