春风项目四线(合箱线、总装线)
wujian
2024-01-31 238595017057e4bc67393915140507785f45b195
提交 | 用户 | 时间
fd2207 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">
df1f2b 5       <el-form-item label-width="100" label="生产通知单" prop="productName">
6         <el-input v-model="queryParams.productionNotice" placeholder="请输入生产通知单" clearable @keyup.enter.native="handleQuery"/>
fd2207 7       </el-form-item>
df1f2b 8       <el-form-item label-width="80" label="生产订单" prop="workOrderNo">
9         <el-input v-model="queryParams.workOrderNo" placeholder="请输入生产订单" clearable @keyup.enter.native="handleQuery"/>
fd2207 10       </el-form-item>
df1f2b 11 <!--      <el-form-item label="产品名称" prop="productName">-->
12 <!--        <el-input v-model="queryParams.productName" placeholder="请输入产品名称" clearable @keyup.enter.native="handleQuery"/>-->
13 <!--      </el-form-item>-->
fd2207 14       <el-form-item label="工单状态" prop="orderStatus">
15         <el-select v-model="queryParams.orderStatus" placeholder="请选择工单状态" clearable>
16           <el-option
17             v-for="dict in dict.type.order_state"
18             :key="dict.value"
19             :label="dict.label"
3d8828 20             :value="dict.value"/>
fd2207 21         </el-select>
22       </el-form-item>
23       <el-form-item style="float: right">
24         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
25         <el-button type="warning" icon="el-icon-copy-document" size="mini" @click="advancedQuery">高级查询</el-button>
26         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
27       </el-form-item>
28     </el-form>
29     <el-form :model="queryParams" ref="queryParams" size="small" :inline="true" v-show="advancedShowSearch" label-width="68px">
30       <el-form-item style="margin-left: 14px" label="产品编号" prop="productCode">
3d8828 31         <el-input v-model="queryParams.productCode" placeholder="请输入产品编号" clearable @keyup.enter.native="handleQuery"/>
fd2207 32       </el-form-item>
162d0b 33       <el-form-item label="机型" prop="typeZ">
34         <el-input v-model="queryParams.typeZ" placeholder="请输入机型" clearable @keyup.enter.native="handleQuery"/>
fd2207 35       </el-form-item>
162d0b 36       <el-form-item label-width="130" label="通知单生成日期" prop="dateConditions">
37         <el-date-picker
38           v-model="queryParams.dateConditions"
39           type="datetimerange"
40           :picker-options="pickerOptions"
41           value-format="yyyy-MM-dd HH:mm:ss"
42           range-separator="至"
43           start-placeholder="开始日期"
44           end-placeholder="结束日期"
45           align="right">
46         </el-date-picker>
fd2207 47       </el-form-item>
48     </el-form>
49     </el-card>
50
51     <el-card style="margin-top: 10px" class="box-card">
52     <el-row :gutter="10" class="mb8">
53       <el-col :span="1.5">
54         <el-button
55           type="primary"
56           plain
57           icon="el-icon-plus"
58           size="mini"
59           @click="handleAdd"
60           v-hasPermi="['om:productionOrde:add']"
61         >新增</el-button>
62       </el-col>
63       <el-col :span="1.5">
64         <el-button
65           type="success"
66           plain
67           icon="el-icon-edit"
68           size="mini"
69           :disabled="single"
70           @click="handleUpdate"
71           v-hasPermi="['om:productionOrde:edit']"
72         >修改</el-button>
73       </el-col>
74       <el-col :span="1.5">
75         <el-button
76           type="danger"
77           plain
78           icon="el-icon-delete"
79           size="mini"
80           :disabled="multiple"
81           @click="handleDelete"
82           v-hasPermi="['om:productionOrde:remove']"
83         >删除</el-button>
84       </el-col>
85       <el-col :span="1.5">
86         <el-button
87           type="warning"
88           plain
89           icon="el-icon-download"
90           size="mini"
91           @click="handleExport"
92           v-hasPermi="['om:productionOrde:export']"
93         >导出</el-button>
94       </el-col>
c33ba1 95
fd2207 96       <el-col :span="1.5">
97         <el-button
40126d 98           type="success"
fd2207 99           plain
40126d 100           icon="el-icon-wind-power"
fd2207 101           size="mini"
acbca4 102           @click="getProductionNotice"
1391b3 103           v-hasPermi="['om:productionOrde:receive']"
acbca4 104         >接收</el-button>
fd2207 105       </el-col>
065fe8 106       <el-col :span="1.5">
H 107         <el-button
108           type="primary"
109           plain
1391b3 110           icon="el-icon-edit"
065fe8 111           size="mini"
3d8828 112           :disabled="single"
H 113           @click="CreatehandleUpdate"
114           v-hasPermi="['om:productionOrde:createUpdate']"
065fe8 115         >生成</el-button>
H 116       </el-col>
117
fd2207 118       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
119     </el-row>
120
121       <el-table border v-loading="loading" :data="productionOrdeList" @selection-change="handleSelectionChange">
122         <el-table-column type="selection" width="55" align="center" />
df1f2b 123         <el-table-column label="生产通知单号" width="160" align="center" prop="productionNotice">
124         </el-table-column>
125         <el-table-column label="生产订单" width="160" align="center">
fd2207 126           <template slot-scope="scope">
5f7e70 127             <router-link :to="{path: '/main/orderScheduling-data/index/', query: {workOrderNo: scope.row.workOrderNo} }" class="link-type">
fd2207 128               <span>{{ scope.row.workOrderNo }}</span>
129             </router-link>
130           </template>
131         </el-table-column>
df1f2b 132         <el-table-column label="机型" width="160" align="center" prop="typeZ">
fd2207 133         </el-table-column>
c33ba1 134
df1f2b 135         <el-table-column label="需求数量" align="center" prop="planQty">
fd2207 136         </el-table-column>
c33ba1 137
acbca4 138         <el-table-column label="产品编号" width="150" align="center" prop="productCode">
3d8828 139         </el-table-column>
c33ba1 140
fd2207 141         <el-table-column label="工单状态" align="center" prop="orderStatus">
142           <template slot-scope="scope">
143             <dict-tag :options="dict.type.order_state" :value="scope.row.orderStatus"/>
144           </template>
145         </el-table-column>
c33ba1 146
df1f2b 147         <el-table-column label="产线" align="center" prop="lineCode">
fd2207 148         </el-table-column>
df1f2b 149
150         <el-table-column label="通知单制单人" width="80" align="center" prop="createUser">
fd2207 151         </el-table-column>
df1f2b 152         <el-table-column width="160" label="通知生成日期" align="center" prop="createTime">
fd2207 153         </el-table-column>
f11989 154         <el-table-column label="成品描述" width="320" align="center" prop="productName">
fd2207 155         </el-table-column>
156       </el-table>
157     </el-card>
158
159
160     <pagination
161       v-show="total>0"
162       :total="total"
163       :page.sync="queryParams.pageNum"
164       :limit.sync="queryParams.pageSize"
165       @pagination="getList"
166     />
167
168     <!-- 添加或修改生产工单对话框 -->
169     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="1000px" append-to-body>
170        <span slot="title">
171         <i class="el-icon-s-order"></i>
172         {{titleName}}
173       </span>
174       <el-form ref="form" inline :model="form" :rules="rules" label-width="80px">
175         <el-form-item label="工单号" prop="workOrderNo">
df1f2b 176           <el-input v-model="form.workOrderNo" placeholder="请输入生产订单" />
fd2207 177         </el-form-item>
178         <el-form-item label="订单编号" prop="salesOrderCode">
179           <el-input v-model="form.salesOrderCode" placeholder="请输入订单编号" />
180         </el-form-item>
181         <el-form-item label="产品编号" prop="productCode">
182           <el-input v-model="form.productCode" placeholder="请选择产品" >
183             <el-button slot="append" @click="handleSelectProduct" icon="el-icon-search"></el-button>
184           </el-input>
185           <ItemSelect ref="itemSelect" @onSelected="onItemSelected" > </ItemSelect>
186         </el-form-item>
187         <el-form-item label="产品名称" prop="productName">
188           <el-input v-model="form.productName" disabled placeholder="请输入产品名称" />
065fe8 189         </el-form-item>
3d8828 190         <el-form-item label="种类" prop="productName">
065fe8 191           <el-input v-model="form.typeZ" disabled placeholder="请输入种类" />
3d8828 192         </el-form-item>
H 193         <el-form-item label="实际数量" prop="actualQty">
194           <el-input v-model="form.actualQty"  placeholder="请输入实际数量" />
fd2207 195         </el-form-item>
196         <el-form-item label="车间编号" prop="workshopCode">
197           <el-select style="width: 93%" @change="handleSelectChange(form.workshopCode)" v-model="form.workshopCode" placeholder="请选择车间编号">
198             <el-option
199               v-for="item in options"
200               :key="item.workshopCode"
201               :label="item.workshopName"
202               :value="item.workshopCode">
203             </el-option>
204           </el-select>
205         </el-form-item>
206         <el-form-item style="margin-left: -15px" label="产线编号" prop="lineCode">
207           <el-select style="width: 93%" v-model="form.lineCode" placeholder="请选择产线编号">
208             <el-option
209               v-for="item in lineOptions"
210               :key="item.lineCode"
211               :label="item.lineName"
212               :value="item.lineCode">
213             </el-option>
214           </el-select>
215         </el-form-item>
216         <el-form-item label="工艺流程" prop="routeCode">
217           <el-input v-model="form.routeCode" disabled placeholder="请输入工艺流程" />
218         </el-form-item>
219         <el-form-item label="产品BOM" prop="bomCode">
220           <el-input v-model="form.bomCode" disabled placeholder="请输入产品BOM" />
221         </el-form-item>
222         <el-form-item label="工艺配方" prop="recipeCode">
223           <el-input v-model="form.recipeCode" placeholder="请输入工艺配方" />
224         </el-form-item>
225         <el-form-item label="计划数量" prop="planQty">
226           <el-input v-model="form.planQty" placeholder="请输入计划数量" />
227         </el-form-item>
228         <el-form-item label="需求日期" prop="demandDate">
229           <el-date-picker style="width: 88%" clearable
230             v-model="form.demandDate"
231             type="date"
232             value-format="yyyy-MM-dd"
233             placeholder="请选择需求日期">
234           </el-date-picker>
235         </el-form-item>
236         <el-form-item style="margin-left: -30px" label="备注" prop="remarks">
237           <el-input v-model="form.remarks" placeholder="请输入备注" />
238         </el-form-item>
239         <el-row>
240           <el-col :span="12">
241             <el-form-item style="margin-left: 10px" label-width="120" label="计划开始时间" prop="planStartTime">
242               <el-date-picker clearable
243                 v-model="form.planStartTime"
244                 type="date"
245                 value-format="yyyy-MM-dd"
246                 placeholder="请选择计划开始时间">
247               </el-date-picker>
248             </el-form-item>
249           </el-col>
250           <el-col :span="12">
251             <el-form-item style="margin-left: 76px" label-width="120" label="计划结束时间" prop="planEndTime">
252               <el-date-picker clearable
253                 v-model="form.planEndTime"
254                 type="date"
255                 value-format="yyyy-MM-dd"
256                 placeholder="请选择计划结束时间">
257               </el-date-picker>
258             </el-form-item>
259           </el-col>
260
261         </el-row>
262       </el-form>
263       <div slot="footer" class="dialog-footer">
264         <el-button type="primary" @click="submitForm">确 定</el-button>
265         <el-button @click="cancel">取 消</el-button>
266       </div>
267     </el-dialog>
268
3d8828 269     <el-dialog v-dialogpop-up :title="title" :visible.sync="Createopen" width="400px" append-to-body>
H 270        <span slot="title">
271         <i class="el-icon-s-order"></i>
272         {{titleName}}
273       </span>
b7ce0c 274       <el-form ref="form" inline  :model="form" :rules="CreateRules" label-width="100px">
C 275         <el-form-item   label="机型" prop="typeZ">
276           <el-input disabled v-model="form.typeZ"  placeholder="请输入机型" />
3d8828 277         </el-form-item>
05d425 278         <el-form-item  label="日期" prop="dateTime">
C 279           <el-date-picker clearable
280                           v-model="form.dateTime"
281                           type="date"
282                           value-format="yyyy-MM-dd"
283                           placeholder="请选择日期" @input="handleCodeChange">
284           </el-date-picker>
3d8828 285         </el-form-item>
f11989 286         <el-form-item class="hidden-form-item" label="日期规则" prop="dateTimeRule">
287           <el-input v-model="form.dateTimeRule"/>
3d8828 288         </el-form-item>
05d425 289         <el-form-item   label="起始编号" prop="startCode">
acbca4 290           <el-input type="number"   :maxlength="3"  :pattern="'[0-9]{3}'" v-model="form.startCode"  placeholder="请输入起始编号" @input="handleCodeChange"/>
3d8828 291         </el-form-item>
05d425 292         <el-form-item   label="起止编号" prop="startEndCode">
b7ce0c 293           <el-input type="textarea" disabled v-model="form.startEndCode"/>
3d8828 294         </el-form-item>
H 295       </el-form>
296       <div slot="footer" class="dialog-footer">
05d425 297         <el-button type="primary" @click="submitFormForBoxCode">确 定</el-button>
3d8828 298         <el-button @click="cancel">取 消</el-button>
H 299       </div>
300     </el-dialog>
301
fd2207 302   </div>
303 </template>
304
305 <script>
306 import { listLineInfo } from "@/api/main/bs/lineInfo/lineInfo";
307 import { listWorkshop } from "@/api/main/bs/workshop/workshop";
308 import { listProductBom } from "@/api/main/bs/ProductBom/ProductBom";
309 import { listTechnologyRoute} from "@/api/main/bs/technologyRoute/technologyRoute";
310 import ItemSelect  from "@/components/itemSelect/single.vue";
05d425 311 import {  addOrderSchedulingForBoxCode,getProductionNotice, upDownMove, listProductionOrde, getProductionOrde, delProductionOrde, addProductionOrde, updateProductionOrde } from "@/api/main/om/productionOrde/productionOrde";
C 312 import {
313   listOrderScheduling,
314   getOrderScheduling,
315   delOrderScheduling,
316   addOrderScheduling,
317   updateOrderScheduling,
318   generateNumbers
319 } from "@/api/main/bs/orderScheduling/orderScheduling";
f11989 320 import {listMaterial} from "@/api/main/bs/material/material";
04cd5a 321 import {listModelNumber} from "@/api/main/bs/modelNumber/modelNumber";
fd2207 322
323 export default {
324   name: "ProductionOrde",
c33ba1 325   dicts: ['order_state','year','month','day','subscription_type', 'sys_yes_no', 'data_type','sys_normal_disable'],
fd2207 326   components: {
327     ItemSelect ,
328   },
329   data() {
330     return {
331       titleName: '',
332       options: [],
333       lineOptions: [],
3d8828 334       outputArray: [],
fd2207 335       showFlag:false,
336       advancedShowSearch: false,
337       workOrder: {
338         status: 'ss'
339       },
340       // 遮罩层
341       loading: true,
342       // 选中数组
343       ids: [],
344       // 非单个禁用
345       single: true,
346       // 非多个禁用
347       multiple: true,
348       move: true,
349       selectedRowIndex: -1, // 存储选中行的索引
350       // 显示搜索条件
351       showSearch: true,
352       // 总条数
353       total: 0,
354       // 生产工单表格数据
355       productionOrdeList: [],
356       // 弹出层标题
357       title: "",
358       // 是否显示弹出层
359       open: false,
3d8828 360       Createopen: false,
fd2207 361       // 查询参数
362       queryParams: {
363         pageNum: 1,
364         pageSize: 10,
365         workOrderNo: null,
366         salesOrderCode: null,
367         productCode: null,
368         productName: null,
369         workshopCode: null,
370         lineCode: null,
371         routeCode: null,
372         bomCode: null,
373         recipeCode: null,
374         orderStatus: null,
375         custom: null,
376         marketAreaCode: null,
377         softwareVersionCode: null,
378         productCompanyCode: null,
379         frontEndId: 0,
380         idNums: null,
065fe8 381         typeZ: null,
fd2207 382         flag: null,
3d8828 383         adds:null,
df1f2b 384         productionNotice: null,
162d0b 385         dateConditions: [],
fd2207 386       },
f11989 387       materialQueryParams: {
388         pageNum: 1,
389         pageSize: 10,
390         materialCode: null,
391       },
3d8828 392
fd2207 393       // 表单参数
394       form: {},
395       updateStatusParameter: {
396         id: null,
397         orderStatus: null
398       },
399       // 表单校验
400       rules: {
401         id: [
402           { required: true, message: "ID不能为空", trigger: "blur" }
403         ],
3d8828 404       },
H 405       CreateRules: {
406         day: [
407           { required: true, message: "不能为空", trigger: "blur" }
408         ],
409         month: [
410           { required: true, message: "不能为空", trigger: "blur" }
411         ],
412         year: [
413           { required: true, message: "不能为空", trigger: "blur" }
414         ],
f11989 415         dateTime: [
416           { required: true, message: "不能为空", trigger: "blur" }
417         ],
418         startCode: [
419           { required: true, message: "不能为空", trigger: "blur" }
420         ],
3d8828 421       },
H 422       change: {
423         day: '',
424         month: '',
425         year: '',
426       },
f11989 427       markNo: '',
162d0b 428       pickerOptions: {
429         shortcuts: [{
430           text: '最近一周',
431           onClick(picker) {
432             const end = new Date();
433             const start = new Date();
434             start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
435             picker.$emit('pick', [start, end]);
436           }
437         }, {
438           text: '最近一个月',
439           onClick(picker) {
440             const end = new Date();
441             const start = new Date();
442             start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
443             picker.$emit('pick', [start, end]);
444           }
445         }, {
446           text: '最近三个月',
447           onClick(picker) {
448             const end = new Date();
449             const start = new Date();
450             start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
451             picker.$emit('pick', [start, end]);
452           }
453         }]
454       },
fd2207 455     };
456   },
457   created() {
458     this.getList();
459     this.initWorkshop();
460   },
461   methods: {
05d425 462     //日期或开始编号输入时
C 463     handleCodeChange(data){
464       let dateTime = this.form.dateTime;
465       let planQty = this.form.planQty;
466       let startCode = this.form.startCode
467       if(dateTime !== null && dateTime !== undefined
468         && startCode !== null && startCode !== undefined) {
469         let dateTimes = dateTime.split("-");
470         let year = dateTimes[0];
471         let month = dateTimes[1];
472         let day = dateTimes[2];
473         let dictYear = this.dict.type.year;
474         let dictMonth = this.dict.type.month;
475         let startCode = this.form.startCode
476         let dateTimeRule = "";
477
478         //年
479         for (let i = 0; i < dictYear.length; i++) {
480           if (year === dictYear[i].label) {
481             dateTimeRule = dictYear[i].value
482             // this.form.startEndCode = startEndCode;
483           }
484         }
485         //月
486         for (let i = 0; i < dictMonth.length; i++) {
487           if (month === dictMonth[i].label) {
488             dateTimeRule = dateTimeRule + dictMonth[i].value;
489           }
490         }
491         //日
492         dateTimeRule = dateTimeRule + day;
f11989 493         dateTimeRule = dateTimeRule + this.markNo;
b7ce0c 494         this.form.dateTimeRule = dateTimeRule;//此处赋值不加机型
C 495         dateTimeRule = dateTimeRule + this.form.typeZ;//此处加机型,顺序不能颠倒
496
05d425 497         //赋值起始编码
b7ce0c 498         this.form.startEndCode = dateTimeRule +  String(parseInt(startCode)).padStart(3, '0') + "         " + dateTimeRule + String(parseInt(startCode) + parseInt(planQty)-1).padStart(3, '0') ;
05d425 499       }
C 500     },
501
df1f2b 502     getProductionNotice(){
503       getProductionNotice(this.queryParams).then(response => {
1de44b 504
505         this.$modal.msgSuccess(response.msg);
df1f2b 506         this.queryParams = {}
507         this.getList();
508       });
509     },
3d8828 510     //数组生成
H 511     changeDay(day){
512       this.change.day = day;
513       let adds =this.form.typeZ+this.change.year+this.change.month+this.change.day+this.form.actualQty;
514       this.form.adds = adds
515     },
516     changeMonth(day){
517       this.change.month = day;
518       let adds =this.form.typeZ+this.change.year+this.change.month+this.change.day+this.form.actualQty;
519       this.form.adds = adds
520     },
521     changeYear(day){
522       this.change.year = day;
523       let adds =this.form.typeZ+this.change.year+this.change.month+this.change.day+this.form.actualQty;
524       this.form.adds = adds
525     },
fd2207 526     moveUp(row, val){
527       console.log(val)
528       const ids = row.id || this.ids
529       let str = JSON.stringify(ids);
530       let num = BigInt(str.replace(/[\[\]]/g, ''));
531       this.queryParams.frontEndId = num
532       this.queryParams.idNums = ids
533       this.queryParams.flag = val
534       upDownMove(this.queryParams).then(response => {
535         this.$modal.msgSuccess("移动成功");
536         this.getList();
537       });
538     },
539     initWorkshop(){
540       listWorkshop(this.queryParams).then(response => {
541         this.options = response.rows;
542       });
543     },
544     // 在这里编写处理选中事件的逻辑
3d8828 545
H 546
fd2207 547     //物料选择弹出框
548     onItemSelected(obj){
549       if(obj !== undefined && obj !== null){
550         let productCode = obj.materialCode;
551         this.form.productCode = productCode;
552         this.form.productName = obj.materialName;
065fe8 553         this.form.typeZ = obj.typeZ;
3d8828 554         this.typeL = obj.typeZ;
065fe8 555         this.queryParams.productCode = productCode;
H 556         this.queryParams.typeZ = typeZ
fd2207 557         listTechnologyRoute(this.queryParams).then(response => {
558           this.form.routeCode = response.rows[0].routeCode;
559         });
560         listProductBom(this.queryParams).then(response => {
561           this.form.bomCode = response.rows[0].bomCode;
562         });
563       }
564     },
565     handleSelectProduct(){
566       this.$refs.itemSelect.showFlag = true;
567     },
568     advancedQuery(){
569       this.advancedShowSearch = (this.advancedShowSearch) ? this.advancedShowSearch = false : this.advancedShowSearch = true;
570     },
571     handleCommand(status,id) {
572       console.log(status)
573       this.updateStatusParameter.id = id;
574       this.updateStatusParameter.orderStatus = status;
575       updateProductionOrde(this.updateStatusParameter).then(response => {
576         this.$modal.msgSuccess("修改成功");
577         this.open = false;
578         this.getList();
579       });
580     },
581     /** 查询生产工单列表 */
582     getList() {
583       this.loading = true;
584       listProductionOrde(this.queryParams).then(response => {
585         this.productionOrdeList = response.rows;
586         this.total = response.total;
587         this.loading = false;
588       });
589     },
590     // 取消按钮
591     cancel() {
592       this.open = false;
3d8828 593       this.Createopen = false;
fd2207 594       this.reset();
595     },
596     // 表单重置
597     reset() {
598       this.form = {
599         id: null,
600         workOrderNo: null,
601         salesOrderCode: null,
602         productCode: null,
603         productName: null,
604         workshopCode: null,
605         lineCode: null,
606         routeCode: null,
607         bomCode: null,
608         recipeCode: null,
609         planQty: null,
610         actualQty: null,
611         badQty: null,
612         scrapQty: null,
613         repairQty: null,
614         actualOnlineQty: null,
615         onlineCompletionMark: null,
616         demandDate: null,
617         planStartTime: null,
618         planEndTime: null,
619         actualStartTime: null,
620         actualEndTime: null,
621         serialNumber: null,
622         orderStatus: null,
623         createTime: null,
624         updateTime: null,
625         createUser: null,
626         updateUser: null,
627         remarks: null,
628         streamNumber: null,
629         custom: null,
630         marketAreaCode: null,
631         softwareVersionCode: null,
632         productCompanyCode: null,
633         spareField1: null,
634         spareField2: null,
635         spareField3: null,
065fe8 636         typeZ: null,
3d8828 637         spareField4: null,
H 638         adds:null
fd2207 639       };
640       this.resetForm("form");
641     },
642     /** 搜索按钮操作 */
643     handleQuery() {
644       this.queryParams.pageNum = 1;
645       this.getList();
646     },
647     /** 重置按钮操作 */
648     resetQuery() {
649       this.resetForm("queryForm");
650       this.handleQuery();
651     },
652     // 多选框选中数据
653     handleSelectionChange(selection) {
654       this.ids = selection.map(item => item.id)
655       this.move = selection.length!==1
656       if(!selection.length){
657         this.single = true
658         this.multiple = true
659       }else {
660         if(selection[0].orderStatus === '1' && selection.length === 1){
661           this.single = false
662           this.multiple = false
663         }
664       }
665
666     },
c33ba1 667
fd2207 668     /** 新增按钮操作 */
669     handleAdd() {
670       this.initWorkshop();
671       this.reset();
672       this.open = true;
df1f2b 673       this.titleName = "添加生产订单";
3d8828 674     },
H 675     /** 同步按钮操作 */
676     CreatehandleUpdate(Row) {
677       this.initWorkshop();
678       this.reset();
679       const id = Row.id || this.ids
680       getProductionOrde(id).then(response => {
681         console.log(response.data)
f11989 682         console.log(response.data.productCode)
683         this.materialQueryParams.materialCode = response.data.productCode;
684         listMaterial(this.materialQueryParams).then(response => {
685           this.markNo = response.rows[0].mark
a5f938 686           this.form.typeL = response.rows[0].typeL;
f11989 687         });
3d8828 688         this.form = response.data;
H 689         this.Createopen = true;
05d425 690         this.titleName = "生成箱体条码";
3d8828 691         // return Array.from({ length: parseInt(this.actualQty) }, (_, index) => index + 1);
H 692       });
fd2207 693     },
694     /** 修改按钮操作 */
695     handleUpdate(row) {
696       this.initWorkshop();
697       this.reset();
698       const id = row.id || this.ids
699       getProductionOrde(id).then(response => {
700         console.log(response.data)
701         this.form = response.data;
702         this.open = true;
df1f2b 703         this.titleName = "修改生产订单";
fd2207 704       });
705     },
706     /** 提交按钮 */
707     submitForm() {
708       this.$refs["form"].validate(valid => {
709         if (valid) {
710           if (this.form.id != null) {
711             updateProductionOrde(this.form).then(response => {
712               this.$modal.msgSuccess("修改成功");
713               this.open = false;
714               this.getList();
715             });
716           } else {
717             addProductionOrde(this.form).then(response => {
718               this.$modal.msgSuccess("新增成功");
719               this.open = false;
720               this.getList();
721             });
722           }
723         }
724       });
725     },
05d425 726
C 727     /** 生成箱体条码提交按钮 */
728     submitFormForBoxCode() {
04cd5a 729       let startCode = parseInt(this.form.startCode);
730       let queryParams = {
731         model: this.form.typeZ,
732         modelDate: this.form.dateTimeRule,
733       }
a5f938 734       if(startCode>999){
C 735         this.$message.error('起始编号超出最大范围,请输入1-999的数字!');
736         return;
737       }else if(startCode<1){
738         this.$message.error('起始编号超出最小范围,请输入1-999的数字!');
739         return;
740       }
04cd5a 741       listModelNumber(queryParams).then(response => {
742         if(response.rows.length === 0){
743           this.saveBoxCode()
744         }else {
745           let maxNumValue = response.rows[0].maxnumValue;
c2254b 746           if(startCode<=maxNumValue){
a5f938 747             this.$message.error('箱体条码重复,请重新输入起始编号!');
04cd5a 748           }else {
749             this.saveBoxCode()
750           }
751         }
752       });
753     },
754
755     saveBoxCode(){
05d425 756       this.$refs["form"].validate(valid => {
C 757         if (valid) {
758           if (this.form.id != null) {
759             addOrderSchedulingForBoxCode(this.form).then(response => {
760               this.$modal.msgSuccess("保存成功");
f11989 761               this.Createopen = false;
05d425 762               this.getList();
C 763             });
764           }
765         }
766       });
767     },
768
fd2207 769     /** 删除按钮操作 */
770     handleDelete(row) {
771       const ids = row.id || this.ids;
df1f2b 772       this.$modal.confirm('是否确认删除生产订单编号为"' + ids + '"的数据项?').then(function() {
fd2207 773         return delProductionOrde(ids);
774       }).then(() => {
775         this.getList();
776         this.$modal.msgSuccess("删除成功");
777       }).catch(() => {});
778     },
779     /** 导出按钮操作 */
780     handleExport() {
781       this.download('om/productionOrde/export', {
782         ...this.queryParams
783       }, `productionOrde_${new Date().getTime()}.xlsx`)
3d8828 784     },
H 785
fd2207 786   }
787 };
788 </script>
789 <style lang="scss" scoped>
f11989 790 .hidden-form-item {
791   display: none;
792 }
fd2207 793 </style>