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