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