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