春风项目四线(合箱线、总装线)
wujian
2024-10-23 2c65c31aceb16c1d06c692266e3fb555ecafdfb5
提交 | 用户 | 时间
fd2207 1 <template>
2   <div class="app-container">
d4f437 3     <div v-if="!showDetailFlag">
fd2207 4     <el-card class="box-card">
5     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
8876c2 6       <el-form-item label-width="100" label="生产通知单" prop="productionNotice">
df1f2b 7         <el-input v-model="queryParams.productionNotice" placeholder="请输入生产通知单" clearable @keyup.enter.native="handleQuery"/>
fd2207 8       </el-form-item>
131e8c 9       <el-form-item label-width="100" label="工厂编号" prop="workshopCode">
W 10         <el-select v-model="queryParams.workshopCode" placeholder="请选择工厂编号" clearable>
11           <el-option
12             v-for="dict in dict.type.factory_code"
13             :key="dict.value"
14             :label="dict.label"
15             :value="dict.value"/>
16         </el-select>
17       </el-form-item>
df1f2b 18       <el-form-item label-width="80" label="生产订单" prop="workOrderNo">
19         <el-input v-model="queryParams.workOrderNo" placeholder="请输入生产订单" clearable @keyup.enter.native="handleQuery"/>
fd2207 20       </el-form-item>
696fd5 21       <el-form-item style="margin-left: 14px" label="产品编号" prop="productCode">
Y 22         <el-input v-model="queryParams.productCode" placeholder="请输入产品编号" clearable @keyup.enter.native="handleQuery"/>
23       </el-form-item>
df1f2b 24 <!--      <el-form-item label="产品名称" prop="productName">-->
25 <!--        <el-input v-model="queryParams.productName" placeholder="请输入产品名称" clearable @keyup.enter.native="handleQuery"/>-->
26 <!--      </el-form-item>-->
fd2207 27       <el-form-item label="工单状态" prop="orderStatus">
28         <el-select v-model="queryParams.orderStatus" placeholder="请选择工单状态" clearable>
29           <el-option
30             v-for="dict in dict.type.order_state"
31             :key="dict.value"
32             :label="dict.label"
3d8828 33             :value="dict.value"/>
fd2207 34         </el-select>
35       </el-form-item>
36       <el-form-item style="float: right">
37         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
38         <el-button type="warning" icon="el-icon-copy-document" size="mini" @click="advancedQuery">高级查询</el-button>
39         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
40       </el-form-item>
41     </el-form>
42     <el-form :model="queryParams" ref="queryParams" size="small" :inline="true" v-show="advancedShowSearch" label-width="68px">
162d0b 43       <el-form-item label="机型" prop="typeZ">
51b05b 44         <el-select v-model="queryParams.typeZ" placeholder="请选择机型" clearable>
W 45           <el-option
46             v-for="dict in typeSelectList"
47             :key="dict.value"
48             :label="dict.label"
49             :value="dict.value"/>
50         </el-select>
fd2207 51       </el-form-item>
2d1514 52       <el-form-item label-width="130" label="发动机号" prop="engineNo">
W 53         <el-input v-model="queryParams.engineNo" placeholder="请输入发动机号" clearable @keyup.enter.native="handleQuery"/>
fd2207 54       </el-form-item>
55     </el-form>
56     </el-card>
57
58     <el-card style="margin-top: 10px" class="box-card">
59     <el-row :gutter="10" class="mb8">
60       <el-col :span="1.5">
61         <el-button
2c65c3 62           type="primary"
W 63           plain
64           icon="el-icon-plus"
65           size="mini"
66           @click="handleAdd"
67           v-hasPermi="['om:productionOrde:add']"
68         >新增</el-button>
69       </el-col>
70       <el-col :span="1.5">
71         <el-button
fd2207 72           type="success"
73           plain
74           icon="el-icon-edit"
75           size="mini"
8876c2 76           :disabled="multiple"
fd2207 77           @click="handleUpdate"
78           v-hasPermi="['om:productionOrde:edit']"
79         >修改</el-button>
80       </el-col>
81       <el-col :span="1.5">
82         <el-button
83           type="danger"
84           plain
85           icon="el-icon-delete"
86           size="mini"
87           :disabled="multiple"
88           @click="handleDelete"
89           v-hasPermi="['om:productionOrde:remove']"
90         >删除</el-button>
91       </el-col>
92       <el-col :span="1.5">
93         <el-button
94           type="warning"
95           plain
96           icon="el-icon-download"
97           size="mini"
98           @click="handleExport"
99           v-hasPermi="['om:productionOrde:export']"
100         >导出</el-button>
101       </el-col>
c33ba1 102
fd2207 103       <el-col :span="1.5">
104         <el-button
40126d 105           type="success"
fd2207 106           plain
40126d 107           icon="el-icon-wind-power"
fd2207 108           size="mini"
acbca4 109           @click="getProductionNotice"
H 110         >接收</el-button>
fd2207 111       </el-col>
065fe8 112       <el-col :span="1.5">
H 113         <el-button
114           type="primary"
115           plain
1391b3 116           icon="el-icon-edit"
065fe8 117           size="mini"
e4a393 118           :disabled="create"
3d8828 119           @click="CreatehandleUpdate"
065fe8 120         >生成</el-button>
d4f437 121       </el-col>
Y 122       <el-col :span="1.5">
123         <el-button
124           type="warning"
125           plain
126           icon="el-icon-download"
127           size="mini"
128           :disabled="!single"
129           @click="goToPage"
130         >开始作业</el-button>
065fe8 131       </el-col>
H 132
fd2207 133       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
134     </el-row>
135
136       <el-table border v-loading="loading" :data="productionOrdeList" @selection-change="handleSelectionChange">
137         <el-table-column type="selection" width="55" align="center" />
e0a2b8 138         <el-table-column label="生产通知单" width="120" align="center" prop="productionNotice">
df1f2b 139         </el-table-column>
e0a2b8 140         <el-table-column label="生产订单" width="140" align="center">
fd2207 141           <template slot-scope="scope">
5f7e70 142             <router-link :to="{path: '/main/orderScheduling-data/index/', query: {workOrderNo: scope.row.workOrderNo} }" class="link-type">
fd2207 143               <span>{{ scope.row.workOrderNo }}</span>
144             </router-link>
145           </template>
146         </el-table-column>
e0a2b8 147         <el-table-column label="机型" width="100" align="center" prop="typeZ">
fd2207 148         </el-table-column>
c33ba1 149
df1f2b 150         <el-table-column label="需求数量" align="center" prop="planQty">
fd2207 151         </el-table-column>
c33ba1 152
acbca4 153         <el-table-column label="产品编号" width="150" align="center" prop="productCode">
e0a2b8 154         </el-table-column>
C 155
156         <el-table-column label="开工日期" width="120" align="center" prop="demandDate">
3d8828 157         </el-table-column>
c33ba1 158
fd2207 159         <el-table-column label="工单状态" align="center" prop="orderStatus">
160           <template slot-scope="scope">
161             <dict-tag :options="dict.type.order_state" :value="scope.row.orderStatus"/>
162           </template>
163         </el-table-column>
c33ba1 164
cd403c 165         <el-table-column label="工厂编号" align="center" prop="workshopCode">
fd2207 166         </el-table-column>
df1f2b 167
e0a2b8 168         <el-table-column label="制单人" width="80" align="center" prop="createUser">
fd2207 169         </el-table-column>
e0a2b8 170         <el-table-column width="160" label="接收日期" align="center" prop="createTime">
fd2207 171         </el-table-column>
f11989 172         <el-table-column label="成品描述" width="320" align="center" prop="productName">
fd2207 173         </el-table-column>
174       </el-table>
175     </el-card>
176
177
178     <pagination
179       v-show="total>0"
180       :total="total"
181       :page.sync="queryParams.pageNum"
182       :limit.sync="queryParams.pageSize"
183       @pagination="getList"
184     />
185
186     <!-- 添加或修改生产工单对话框 -->
187     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="1000px" append-to-body>
188        <span slot="title">
189         <i class="el-icon-s-order"></i>
190         {{titleName}}
191       </span>
2c65c3 192       <el-form ref="form" inline :model="form" :rules="rules" label-width="100px">
W 193         <el-form-item label="生产通知单" prop="productionNotice">
194           <el-input v-model="form.productionNotice" :disabled="editFlag" placeholder="请输入生产通知单" />
fd2207 195         </el-form-item>
2c65c3 196         <el-form-item label="生产订单" prop="workOrderNo">
W 197           <el-input v-model="form.workOrderNo" :disabled="editFlag" placeholder="请输入生产订单" />
fd2207 198         </el-form-item>
199         <el-form-item label="产品编号" prop="productCode">
2c65c3 200           <el-input v-model="form.productCode" :disabled="editFlag" placeholder="请输入产品编号" />
fd2207 201         </el-form-item>
2c65c3 202         <el-form-item label="成品描述" prop="productName">
W 203           <el-input v-model="form.productName" :disabled="editFlag" placeholder="请输入成品描述" />
065fe8 204         </el-form-item>
2c65c3 205         <el-form-item label="机型" prop="productName">
W 206           <el-input v-model="form.typeZ" :disabled="editFlag" placeholder="请输入机型" />
207         </el-form-item>
208         <el-form-item label="需求数量" prop="planQty">
209           <el-input v-model="form.planQty" :disabled="editFlag" placeholder="请输入需求数量" />
3d8828 210         </el-form-item>
51b05b 211         <el-form-item label="工单状态" prop="orderStatus">
W 212           <el-select style="width: 93%" v-model="form.orderStatus" placeholder="请选择工单状态">
fd2207 213             <el-option
51b05b 214               v-for="item in statuOptions"
W 215               :key="item.value"
216               :label="item.label"
217               :value="item.value">
fd2207 218             </el-option>
219           </el-select>
220         </el-form-item>
221
222       </el-form>
223       <div slot="footer" class="dialog-footer">
224         <el-button type="primary" @click="submitForm">确 定</el-button>
225         <el-button @click="cancel">取 消</el-button>
226       </div>
227     </el-dialog>
228
2c65c3 229     <el-dialog v-dialogpop-up :title="title" :visible.sync="Createopen" width="600px" append-to-body>
3d8828 230        <span slot="title">
H 231         <i class="el-icon-s-order"></i>
232         {{titleName}}
233       </span>
2c65c3 234       <el-form ref="form" inline  :model="form" :rules="CreateRules" label-width="120px">
b7ce0c 235         <el-form-item   label="机型" prop="typeZ">
2c65c3 236           <el-input disabled v-model="form.typeZ" style="font-size: 18px"  placeholder="请输入机型" />
3d8828 237         </el-form-item>
05d425 238         <el-form-item  label="日期" prop="dateTime">
C 239           <el-date-picker clearable
240                           v-model="form.dateTime"
241                           type="date"
242                           value-format="yyyy-MM-dd"
51b05b 243                           placeholder="请选择日期" @input="handleCodeChangeData">
05d425 244           </el-date-picker>
3d8828 245         </el-form-item>
f11989 246         <el-form-item class="hidden-form-item" label="日期规则" prop="dateTimeRule">
247           <el-input v-model="form.dateTimeRule"/>
3d8828 248         </el-form-item>
05d425 249         <el-form-item   label="起始编号" prop="startCode">
2c65c3 250           <el-input type="number" style="font-size: 18px"  :maxlength="3"  :pattern="'[0-9]{3}'" v-model="form.startCode"  placeholder="请输入起始编号" @input="handleCodeChangeStart"/>
3d8828 251         </el-form-item>
05d425 252         <el-form-item   label="起止编号" prop="startEndCode">
2c65c3 253           <el-input type="textarea" style="font-size: 18px;width: 250px" disabled v-model="form.startEndCode"/>
3d8828 254         </el-form-item>
H 255       </el-form>
256       <div slot="footer" class="dialog-footer">
05d425 257         <el-button type="primary" @click="submitFormForBoxCode">确 定</el-button>
3d8828 258         <el-button @click="cancel">取 消</el-button>
H 259       </div>
260     </el-dialog>
d4f437 261     </div>
51b05b 262     <Detail v-if="showDetailFlag" :singleSelect="singleSelect" @reserveChild = "reserveChild"></Detail>
fd2207 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";
696fd5 272 import {  addOrderSchedulingForBoxCode,getProductionNotice, upDownMove, listProductionOrde, getProductionOrde,getProductionOrdes, delProductionOrde, addProductionOrde, updateProductionOrde } from "@/api/main/om/productionOrde/productionOrde";
05d425 273 import {
C 274   listOrderScheduling,
275   getOrderScheduling,
276   delOrderScheduling,
277   addOrderScheduling,
278   updateOrderScheduling,
279   generateNumbers
280 } from "@/api/main/bs/orderScheduling/orderScheduling";
f11989 281 import {listMaterial} from "@/api/main/bs/material/material";
04cd5a 282 import {listModelNumber} from "@/api/main/bs/modelNumber/modelNumber";
d4f437 283 import Detail from "./detail.vue";
fd2207 284
285 export default {
286   name: "ProductionOrde",
131e8c 287   dicts: ['order_state','year','month','day','subscription_type', 'sys_yes_no', 'data_type','sys_normal_disable','factory_code'],
fd2207 288   components: {
289     ItemSelect ,
d4f437 290     Detail
fd2207 291   },
292   data() {
293     return {
2c65c3 294       editFlag: false,
51b05b 295       statuOptions:[
W 296         {
297           label:"待下达",
298           value:"1"
299         },
300         {
301           label:"已下达",
302           value:"2"
303         }
304       ],
305       typeSelectList: [
306         {
307           label:"380",
308           value:"380"
309         },
310         {
311           label:"280",
312           value:"280"
313         }
314       ],
315       typeZDateRules: '',
d4f437 316       showDetailFlag: false,
Y 317       singleSelect:{},
fd2207 318       titleName: '',
319       options: [],
320       lineOptions: [],
3d8828 321       outputArray: [],
fd2207 322       showFlag:false,
323       advancedShowSearch: false,
324       workOrder: {
325         status: 'ss'
326       },
327       // 遮罩层
328       loading: true,
329       // 选中数组
330       ids: [],
331       // 非单个禁用
332       single: true,
e4a393 333       create: false,
fd2207 334       // 非多个禁用
335       multiple: true,
336       move: true,
337       selectedRowIndex: -1, // 存储选中行的索引
338       // 显示搜索条件
339       showSearch: true,
340       // 总条数
341       total: 0,
342       // 生产工单表格数据
343       productionOrdeList: [],
344       // 弹出层标题
345       title: "",
346       // 是否显示弹出层
347       open: false,
3d8828 348       Createopen: false,
fd2207 349       // 查询参数
350       queryParams: {
351         pageNum: 1,
352         pageSize: 10,
353         workOrderNo: null,
354         salesOrderCode: null,
355         productCode: null,
356         productName: null,
357         workshopCode: null,
358         lineCode: null,
359         routeCode: null,
360         bomCode: null,
361         recipeCode: null,
362         orderStatus: null,
363         custom: null,
364         marketAreaCode: null,
365         softwareVersionCode: null,
366         productCompanyCode: null,
131e8c 367         frontEndId: null,
fd2207 368         idNums: null,
065fe8 369         typeZ: null,
2d1514 370         engineNo: null,
fd2207 371         flag: null,
3d8828 372         adds:null,
df1f2b 373         productionNotice: null,
162d0b 374         dateConditions: [],
fd2207 375       },
f11989 376       materialQueryParams: {
377         pageNum: 1,
378         pageSize: 10,
379         materialCode: null,
380       },
3d8828 381
fd2207 382       // 表单参数
383       form: {},
384       updateStatusParameter: {
385         id: null,
386         orderStatus: null
387       },
388       // 表单校验
389       rules: {
390         id: [
391           { required: true, message: "ID不能为空", trigger: "blur" }
392         ],
3d8828 393       },
H 394       CreateRules: {
395         day: [
396           { required: true, message: "不能为空", trigger: "blur" }
397         ],
398         month: [
399           { required: true, message: "不能为空", trigger: "blur" }
400         ],
401         year: [
402           { required: true, message: "不能为空", trigger: "blur" }
403         ],
404       },
405       change: {
406         day: '',
407         month: '',
408         year: '',
409       },
f11989 410       markNo: '',
162d0b 411       pickerOptions: {
412         shortcuts: [{
413           text: '最近一周',
414           onClick(picker) {
415             const end = new Date();
416             const start = new Date();
417             start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
418             picker.$emit('pick', [start, end]);
419           }
420         }, {
421           text: '最近一个月',
422           onClick(picker) {
423             const end = new Date();
424             const start = new Date();
425             start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
426             picker.$emit('pick', [start, end]);
427           }
428         }, {
429           text: '最近三个月',
430           onClick(picker) {
431             const end = new Date();
432             const start = new Date();
433             start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
434             picker.$emit('pick', [start, end]);
435           }
436         }]
437       },
fd2207 438     };
439   },
440   created() {
441     this.getList();
442     this.initWorkshop();
443   },
444   methods: {
51b05b 445     reserveChild(){
W 446       this.showDetailFlag = false
447     },
448     handleCodeChangeData(){
449       console.log('1111111111111111')
05d425 450       let dateTime = this.form.dateTime;
C 451       let planQty = this.form.planQty;
51b05b 452       let dateTimeRule = "";
W 453       if(dateTime !== null && dateTime !== undefined){
05d425 454         let dateTimes = dateTime.split("-");
C 455         let year = dateTimes[0];
456         let month = dateTimes[1];
457         let day = dateTimes[2];
458         let dictYear = this.dict.type.year;
459         let dictMonth = this.dict.type.month;
460         //年
461         for (let i = 0; i < dictYear.length; i++) {
462           if (year === dictYear[i].label) {
463             dateTimeRule = dictYear[i].value
464             // this.form.startEndCode = startEndCode;
465           }
466         }
467         //月
468         for (let i = 0; i < dictMonth.length; i++) {
469           if (month === dictMonth[i].label) {
470             dateTimeRule = dateTimeRule + dictMonth[i].value;
471           }
472         }
473         //日
474         dateTimeRule = dateTimeRule + day;
f11989 475         dateTimeRule = dateTimeRule + this.markNo;
b7ce0c 476         this.form.dateTimeRule = dateTimeRule;//此处赋值不加机型
d4f437 477         dateTimeRule = this.form.typeZ +" "+dateTimeRule;//此处加机型,顺序不能颠倒
05d425 478       }
51b05b 479       if (this.form.typeZ !== null && this.form.typeZ !== '' && dateTimeRule !== null && dateTimeRule !== '' ){
W 480         this.typeZDateRules = dateTimeRule
481         console.log('222222222222')
482         let queryParams = {
483           model: this.form.typeZ,
484           modelDate: this.form.dateTimeRule,
485         }
486         listModelNumber(queryParams).then(response => {
487           if(response.rows.length === 0){
488             this.form.startCode = 1
489           }else {
490             let max = response.rows[0].maxnumValue
491             this.form.startCode = parseInt(max) + 1
492           }
493           this.form.startEndCode =   this.typeZDateRules + String(parseInt(this.form.startCode)).padStart(3, '0') +"\n"+ this.typeZDateRules + String(parseInt(this.form.startCode) + parseInt(planQty)-1).padStart(3, '0') ;
494           });
495       }
496
497     },
498     handleCodeChangeStart(){
499       let planQty = this.form.planQty;
500       console.log('planQty',planQty)
501       //赋值起始编码
502       this.form.startEndCode =   this.typeZDateRules + String(parseInt(this.form.startCode)).padStart(3, '0') +"\n"+ this.typeZDateRules + String(parseInt(this.form.startCode) + parseInt(planQty)-1).padStart(3, '0') ;
05d425 503     },
C 504
df1f2b 505     getProductionNotice(){
506       getProductionNotice(this.queryParams).then(response => {
1de44b 507
508         this.$modal.msgSuccess(response.msg);
cd403c 509         // this.queryParams = {}
df1f2b 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;
cd403c 587       console.log('this.queryParams',this.queryParams)
fd2207 588       listProductionOrde(this.queryParams).then(response => {
589         this.productionOrdeList = response.rows;
590         this.total = response.total;
591         this.loading = false;
592       });
593     },
594     // 取消按钮
595     cancel() {
596       this.open = false;
3d8828 597       this.Createopen = false;
fd2207 598       this.reset();
599     },
600     // 表单重置
601     reset() {
602       this.form = {
603         id: null,
604         workOrderNo: null,
605         salesOrderCode: null,
606         productCode: null,
607         productName: null,
608         workshopCode: null,
609         lineCode: null,
610         routeCode: null,
611         bomCode: null,
612         recipeCode: null,
613         planQty: null,
614         actualQty: null,
615         badQty: null,
616         scrapQty: null,
617         repairQty: null,
618         actualOnlineQty: null,
619         onlineCompletionMark: null,
620         demandDate: null,
621         planStartTime: null,
622         planEndTime: null,
623         actualStartTime: null,
624         actualEndTime: null,
625         serialNumber: null,
626         orderStatus: null,
627         createTime: null,
628         updateTime: null,
629         createUser: null,
630         updateUser: null,
631         remarks: null,
632         streamNumber: null,
633         custom: null,
634         marketAreaCode: null,
635         softwareVersionCode: null,
636         productCompanyCode: null,
637         spareField1: null,
638         spareField2: null,
639         spareField3: null,
065fe8 640         typeZ: null,
3d8828 641         spareField4: null,
d4f437 642         adds:null,
Y 643         idNums:null
fd2207 644       };
645       this.resetForm("form");
646     },
647     /** 搜索按钮操作 */
648     handleQuery() {
649       this.queryParams.pageNum = 1;
650       this.getList();
651     },
652     /** 重置按钮操作 */
653     resetQuery() {
654       this.resetForm("queryForm");
2d1514 655       this.queryParams.typeZ = ''
W 656       this.queryParams.engineNo = ''
fd2207 657       this.handleQuery();
658     },
d4f437 659     /** 多选框选中数据 */
fd2207 660     handleSelectionChange(selection) {
8876c2 661       console.log('this.single1111',this.single)
W 662       console.log('selecion',selection)
fd2207 663       this.ids = selection.map(item => item.id)
e4a393 664       const statusList = selection.map(item => item.orderStatus)
W 665       console.log('statusList',statusList)
666       console.log('statusList.filter( x => x !== "1").length',statusList.filter( x => x !== "1").length)
667       if (statusList.filter( x => x !== "1").length >0){
668         this.create = true
669       } else {
670         this.create = false
671       }
8876c2 672       if (selection.length >1){
W 673         this.single = false
674         this.multiple = true
675       } else if (selection.length === 1){
676         this.single = true
677         this.multiple = false
a5383f 678         this.singleSelect = selection[0]
8876c2 679       } else {
fd2207 680         this.single = true
681         this.multiple = true
682       }
8876c2 683       // let statusList = selection.filter(x => x.orderStatus === "1")
W 684       // console.log('statusList',statusList)
685       // if (selection.length === statusList.length){
686       //   //待生成
687       //   this.single = false
688       // }
689
690       // this.ids = selection.map(item => item.id)
691       // this.move = selection.length!==1
692       // if(!selection.length){
693       //   console.log('1')
694       //   this.single = true
695       //   this.multiple = true
696       // } else {
697       //   if(selection[0].orderStatus === '1' && selection.length === 1){
698       //     console.log('2')
699       //     this.single = false
700       //     this.multiple = false
701       //   }
702       //   if(selection[0].orderStatus === '2' && selection.length === 1){
703       //     console.log('3',this.single)
704       //     this.singleSelect = selection[0]
705       //   }
706       // }
fd2207 707     },
c33ba1 708
fd2207 709     /** 新增按钮操作 */
710     handleAdd() {
711       this.initWorkshop();
712       this.reset();
2c65c3 713       this.editFlag = false
fd2207 714       this.open = true;
df1f2b 715       this.titleName = "添加生产订单";
3d8828 716     },
H 717     /** 同步按钮操作 */
e4a393 718     CreatehandleUpdate() {
W 719       console.log('this.ids',this.ids)
720       if (this.ids.length === 0){
721         this.$message.error('请勾选数据');
722       }else {
723         this.initWorkshop();
724         this.reset();
725         const id = this.ids
726         getProductionOrdes(id).then(response => {
727           console.log(response.data)
728           console.log(response.data.productCode)
729           this.materialQueryParams.materialCode = response.data.productCode;
730           listMaterial(this.materialQueryParams).then(response => {
51b05b 731             console.log("res2121",response)
W 732             if (response.rows.length === 0){
733               this.$message.error('未查找到物料编码对应编号!');
734               this.cancel()
735             } else {
736               this.markNo = response.rows[0].mark
737               this.form.typeL = response.rows[0].typeL;
738             }
739
e4a393 740           });
W 741           this.form = response.data;
742           this.form.idNums=id;
743           this.Createopen = true;
744           this.titleName = "生成箱体条码";
745           // return Array.from({ length: parseInt(this.actualQty) }, (_, index) => index + 1);
f11989 746         });
e4a393 747       }
W 748
fd2207 749     },
750     /** 修改按钮操作 */
751     handleUpdate(row) {
752       this.initWorkshop();
753       this.reset();
2c65c3 754       this.editFlag = true
fd2207 755       const id = row.id || this.ids
756       getProductionOrde(id).then(response => {
757         console.log(response.data)
758         this.form = response.data;
759         this.open = true;
df1f2b 760         this.titleName = "修改生产订单";
fd2207 761       });
762     },
763     /** 提交按钮 */
764     submitForm() {
765       this.$refs["form"].validate(valid => {
766         if (valid) {
767           if (this.form.id != null) {
768             updateProductionOrde(this.form).then(response => {
769               this.$modal.msgSuccess("修改成功");
770               this.open = false;
771               this.getList();
772             });
773           } else {
774             addProductionOrde(this.form).then(response => {
775               this.$modal.msgSuccess("新增成功");
776               this.open = false;
777               this.getList();
778             });
779           }
780         }
781       });
782     },
05d425 783
C 784     /** 生成箱体条码提交按钮 */
785     submitFormForBoxCode() {
51b05b 786       if (this.form.startCode === null || this.form.startCode === ''){
W 787         this.$message.error('起始编号不能为空!');
788         return;
789       }
04cd5a 790       let startCode = parseInt(this.form.startCode);
791       let queryParams = {
792         model: this.form.typeZ,
793         modelDate: this.form.dateTimeRule,
794       }
51b05b 795
a5f938 796       if(startCode>999){
C 797         this.$message.error('起始编号超出最大范围,请输入1-999的数字!');
798         return;
799       }else if(startCode<1){
51b05b 800         this.$message.error('请输入1-999的数字!');
a5f938 801         return;
C 802       }
04cd5a 803       listModelNumber(queryParams).then(response => {
804         if(response.rows.length === 0){
805           this.saveBoxCode()
806         }else {
807           let maxNumValue = response.rows[0].maxnumValue;
c2254b 808           if(startCode<=maxNumValue){
a5f938 809             this.$message.error('箱体条码重复,请重新输入起始编号!');
04cd5a 810           }else {
811             this.saveBoxCode()
812           }
813         }
814       });
815     },
816
817     saveBoxCode(){
05d425 818       this.$refs["form"].validate(valid => {
C 819         if (valid) {
d4f437 820           if (this.form.idNums != null) {
05d425 821             addOrderSchedulingForBoxCode(this.form).then(response => {
C 822               this.$modal.msgSuccess("保存成功");
f11989 823               this.Createopen = false;
05d425 824               this.getList();
C 825             });
826           }
827         }
828       });
829     },
830
fd2207 831     /** 删除按钮操作 */
832     handleDelete(row) {
833       const ids = row.id || this.ids;
df1f2b 834       this.$modal.confirm('是否确认删除生产订单编号为"' + ids + '"的数据项?').then(function() {
fd2207 835         return delProductionOrde(ids);
836       }).then(() => {
837         this.getList();
838         this.$modal.msgSuccess("删除成功");
839       }).catch(() => {});
840     },
841     /** 导出按钮操作 */
842     handleExport() {
843       this.download('om/productionOrde/export', {
844         ...this.queryParams
845       }, `productionOrde_${new Date().getTime()}.xlsx`)
3d8828 846     },
d4f437 847     goToPage() {
e4a393 848       if (this.ids.length === 0){
W 849         this.$message.error('请勾选数据');
850       }else {
851         this.showDetailFlag=true
852         console.log('this.showDetailFlag',this.showDetailFlag)
853         //更新实际生产日期
854         //updateOrderInfo(this.singleSelect)
855       }
856
d4f437 857     },
fd2207 858   }
859 };
860 </script>
861 <style lang="scss" scoped>
f11989 862 .hidden-form-item {
863   display: none;
864 }
49ca7c 865 ::v-deep .custom-size .el-checkbox__input .el-checkbox__inner {
W 866   width: 20px;
867   height: 20px;
868 }
869 /* 调整Checkbox的标签文字大小 */
870 ::v-deep .custom-size .el-checkbox__inner::after {
871   border: 3px solid #fff;
872   border-left: 0;
873   border-top: 0;
874   left: 5px;
875   top: 5px;
876 }
877
878 ::v-deep .custom-size .el-checkbox__input.is-checked .el-checkbox__inner::after {
879   transform: rotate(50deg) scaleY(1.3);}
880
fd2207 881 </style>