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