春风项目四线(合箱线、总装线)
yyt
2024-05-22 696fd55ecc1243bce1d421d95cb9fba4b0a598b1
提交 | 用户 | 时间
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">
df1f2b 6       <el-form-item label-width="100" label="生产通知单" prop="productName">
7         <el-input v-model="queryParams.productionNotice" placeholder="请输入生产通知单" clearable @keyup.enter.native="handleQuery"/>
fd2207 8       </el-form-item>
df1f2b 9       <el-form-item label-width="80" label="生产订单" prop="workOrderNo">
10         <el-input v-model="queryParams.workOrderNo" placeholder="请输入生产订单" clearable @keyup.enter.native="handleQuery"/>
fd2207 11       </el-form-item>
696fd5 12       <el-form-item style="margin-left: 14px" label="产品编号" prop="productCode">
Y 13         <el-input v-model="queryParams.productCode" placeholder="请输入产品编号" clearable @keyup.enter.native="handleQuery"/>
14       </el-form-item>
df1f2b 15 <!--      <el-form-item label="产品名称" prop="productName">-->
16 <!--        <el-input v-model="queryParams.productName" placeholder="请输入产品名称" clearable @keyup.enter.native="handleQuery"/>-->
17 <!--      </el-form-item>-->
fd2207 18       <el-form-item label="工单状态" prop="orderStatus">
19         <el-select v-model="queryParams.orderStatus" placeholder="请选择工单状态" clearable>
20           <el-option
21             v-for="dict in dict.type.order_state"
22             :key="dict.value"
23             :label="dict.label"
3d8828 24             :value="dict.value"/>
fd2207 25         </el-select>
26       </el-form-item>
27       <el-form-item style="float: right">
28         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
29         <el-button type="warning" icon="el-icon-copy-document" size="mini" @click="advancedQuery">高级查询</el-button>
30         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
31       </el-form-item>
32     </el-form>
33     <el-form :model="queryParams" ref="queryParams" size="small" :inline="true" v-show="advancedShowSearch" label-width="68px">
162d0b 34       <el-form-item label="机型" prop="typeZ">
35         <el-input v-model="queryParams.typeZ" placeholder="请输入机型" clearable @keyup.enter.native="handleQuery"/>
fd2207 36       </el-form-item>
162d0b 37       <el-form-item label-width="130" label="通知单生成日期" prop="dateConditions">
38         <el-date-picker
39           v-model="queryParams.dateConditions"
40           type="datetimerange"
41           :picker-options="pickerOptions"
42           value-format="yyyy-MM-dd HH:mm:ss"
43           range-separator="至"
44           start-placeholder="开始日期"
45           end-placeholder="结束日期"
46           align="right">
47         </el-date-picker>
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"
70           :disabled="single"
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"
1391b3 104           v-hasPermi="['om:productionOrde:receive']"
acbca4 105         >接收</el-button>
fd2207 106       </el-col>
065fe8 107       <el-col :span="1.5">
H 108         <el-button
109           type="primary"
110           plain
1391b3 111           icon="el-icon-edit"
065fe8 112           size="mini"
3d8828 113           :disabled="single"
H 114           @click="CreatehandleUpdate"
115           v-hasPermi="['om:productionOrde:createUpdate']"
065fe8 116         >生成</el-button>
d4f437 117       </el-col>
Y 118       <el-col :span="1.5">
119         <el-button
120           type="warning"
121           plain
122           icon="el-icon-download"
123           size="mini"
124           :disabled="!single"
125           @click="goToPage"
126         >开始作业</el-button>
065fe8 127       </el-col>
H 128
fd2207 129       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
130     </el-row>
131
132       <el-table border v-loading="loading" :data="productionOrdeList" @selection-change="handleSelectionChange">
133         <el-table-column type="selection" width="55" align="center" />
e0a2b8 134         <el-table-column label="生产通知单" width="120" align="center" prop="productionNotice">
df1f2b 135         </el-table-column>
e0a2b8 136         <el-table-column label="生产订单" width="140" align="center">
fd2207 137           <template slot-scope="scope">
5f7e70 138             <router-link :to="{path: '/main/orderScheduling-data/index/', query: {workOrderNo: scope.row.workOrderNo} }" class="link-type">
fd2207 139               <span>{{ scope.row.workOrderNo }}</span>
140             </router-link>
141           </template>
142         </el-table-column>
e0a2b8 143         <el-table-column label="机型" width="100" align="center" prop="typeZ">
fd2207 144         </el-table-column>
c33ba1 145
df1f2b 146         <el-table-column label="需求数量" align="center" prop="planQty">
fd2207 147         </el-table-column>
c33ba1 148
acbca4 149         <el-table-column label="产品编号" width="150" align="center" prop="productCode">
e0a2b8 150         </el-table-column>
C 151
152         <el-table-column label="开工日期" width="120" align="center" prop="demandDate">
3d8828 153         </el-table-column>
c33ba1 154
fd2207 155         <el-table-column label="工单状态" align="center" prop="orderStatus">
156           <template slot-scope="scope">
157             <dict-tag :options="dict.type.order_state" :value="scope.row.orderStatus"/>
158           </template>
159         </el-table-column>
c33ba1 160
df1f2b 161         <el-table-column label="产线" align="center" prop="lineCode">
fd2207 162         </el-table-column>
df1f2b 163
e0a2b8 164         <el-table-column label="制单人" width="80" align="center" prop="createUser">
fd2207 165         </el-table-column>
e0a2b8 166         <el-table-column width="160" label="接收日期" align="center" prop="createTime">
fd2207 167         </el-table-column>
f11989 168         <el-table-column label="成品描述" width="320" align="center" prop="productName">
fd2207 169         </el-table-column>
170       </el-table>
171     </el-card>
172
173
174     <pagination
175       v-show="total>0"
176       :total="total"
177       :page.sync="queryParams.pageNum"
178       :limit.sync="queryParams.pageSize"
179       @pagination="getList"
180     />
181
182     <!-- 添加或修改生产工单对话框 -->
183     <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="1000px" append-to-body>
184        <span slot="title">
185         <i class="el-icon-s-order"></i>
186         {{titleName}}
187       </span>
188       <el-form ref="form" inline :model="form" :rules="rules" label-width="80px">
189         <el-form-item label="工单号" prop="workOrderNo">
df1f2b 190           <el-input v-model="form.workOrderNo" placeholder="请输入生产订单" />
fd2207 191         </el-form-item>
192         <el-form-item label="订单编号" prop="salesOrderCode">
193           <el-input v-model="form.salesOrderCode" placeholder="请输入订单编号" />
194         </el-form-item>
195         <el-form-item label="产品编号" prop="productCode">
196           <el-input v-model="form.productCode" placeholder="请选择产品" >
197             <el-button slot="append" @click="handleSelectProduct" icon="el-icon-search"></el-button>
198           </el-input>
199           <ItemSelect ref="itemSelect" @onSelected="onItemSelected" > </ItemSelect>
200         </el-form-item>
201         <el-form-item label="产品名称" prop="productName">
202           <el-input v-model="form.productName" disabled placeholder="请输入产品名称" />
065fe8 203         </el-form-item>
3d8828 204         <el-form-item label="种类" prop="productName">
065fe8 205           <el-input v-model="form.typeZ" disabled placeholder="请输入种类" />
3d8828 206         </el-form-item>
H 207         <el-form-item label="实际数量" prop="actualQty">
208           <el-input v-model="form.actualQty"  placeholder="请输入实际数量" />
fd2207 209         </el-form-item>
210         <el-form-item label="车间编号" prop="workshopCode">
211           <el-select style="width: 93%" @change="handleSelectChange(form.workshopCode)" v-model="form.workshopCode" placeholder="请选择车间编号">
212             <el-option
213               v-for="item in options"
214               :key="item.workshopCode"
215               :label="item.workshopName"
216               :value="item.workshopCode">
217             </el-option>
218           </el-select>
219         </el-form-item>
220         <el-form-item style="margin-left: -15px" label="产线编号" prop="lineCode">
221           <el-select style="width: 93%" v-model="form.lineCode" placeholder="请选择产线编号">
222             <el-option
223               v-for="item in lineOptions"
224               :key="item.lineCode"
225               :label="item.lineName"
226               :value="item.lineCode">
227             </el-option>
228           </el-select>
229         </el-form-item>
230         <el-form-item label="工艺流程" prop="routeCode">
231           <el-input v-model="form.routeCode" disabled placeholder="请输入工艺流程" />
232         </el-form-item>
233         <el-form-item label="产品BOM" prop="bomCode">
234           <el-input v-model="form.bomCode" disabled placeholder="请输入产品BOM" />
235         </el-form-item>
236         <el-form-item label="工艺配方" prop="recipeCode">
237           <el-input v-model="form.recipeCode" placeholder="请输入工艺配方" />
238         </el-form-item>
239         <el-form-item label="计划数量" prop="planQty">
240           <el-input v-model="form.planQty" placeholder="请输入计划数量" />
241         </el-form-item>
242         <el-form-item label="需求日期" prop="demandDate">
243           <el-date-picker style="width: 88%" clearable
244             v-model="form.demandDate"
245             type="date"
246             value-format="yyyy-MM-dd"
247             placeholder="请选择需求日期">
248           </el-date-picker>
249         </el-form-item>
250         <el-form-item style="margin-left: -30px" label="备注" prop="remarks">
251           <el-input v-model="form.remarks" placeholder="请输入备注" />
252         </el-form-item>
253         <el-row>
254           <el-col :span="12">
255             <el-form-item style="margin-left: 10px" label-width="120" label="计划开始时间" prop="planStartTime">
256               <el-date-picker clearable
257                 v-model="form.planStartTime"
258                 type="date"
259                 value-format="yyyy-MM-dd"
260                 placeholder="请选择计划开始时间">
261               </el-date-picker>
262             </el-form-item>
263           </el-col>
264           <el-col :span="12">
265             <el-form-item style="margin-left: 76px" label-width="120" label="计划结束时间" prop="planEndTime">
266               <el-date-picker clearable
267                 v-model="form.planEndTime"
268                 type="date"
269                 value-format="yyyy-MM-dd"
270                 placeholder="请选择计划结束时间">
271               </el-date-picker>
272             </el-form-item>
273           </el-col>
274
275         </el-row>
276       </el-form>
277       <div slot="footer" class="dialog-footer">
278         <el-button type="primary" @click="submitForm">确 定</el-button>
279         <el-button @click="cancel">取 消</el-button>
280       </div>
281     </el-dialog>
282
3d8828 283     <el-dialog v-dialogpop-up :title="title" :visible.sync="Createopen" width="400px" append-to-body>
H 284        <span slot="title">
285         <i class="el-icon-s-order"></i>
286         {{titleName}}
287       </span>
b7ce0c 288       <el-form ref="form" inline  :model="form" :rules="CreateRules" label-width="100px">
C 289         <el-form-item   label="机型" prop="typeZ">
290           <el-input disabled v-model="form.typeZ"  placeholder="请输入机型" />
3d8828 291         </el-form-item>
05d425 292         <el-form-item  label="日期" prop="dateTime">
C 293           <el-date-picker clearable
294                           v-model="form.dateTime"
295                           type="date"
296                           value-format="yyyy-MM-dd"
297                           placeholder="请选择日期" @input="handleCodeChange">
298           </el-date-picker>
3d8828 299         </el-form-item>
f11989 300         <el-form-item class="hidden-form-item" label="日期规则" prop="dateTimeRule">
301           <el-input v-model="form.dateTimeRule"/>
3d8828 302         </el-form-item>
05d425 303         <el-form-item   label="起始编号" prop="startCode">
acbca4 304           <el-input type="number"   :maxlength="3"  :pattern="'[0-9]{3}'" v-model="form.startCode"  placeholder="请输入起始编号" @input="handleCodeChange"/>
3d8828 305         </el-form-item>
05d425 306         <el-form-item   label="起止编号" prop="startEndCode">
b7ce0c 307           <el-input type="textarea" disabled v-model="form.startEndCode"/>
3d8828 308         </el-form-item>
H 309       </el-form>
310       <div slot="footer" class="dialog-footer">
05d425 311         <el-button type="primary" @click="submitFormForBoxCode">确 定</el-button>
3d8828 312         <el-button @click="cancel">取 消</el-button>
H 313       </div>
314     </el-dialog>
d4f437 315     </div>
Y 316     <Detail v-if="showDetailFlag" :singleSelect="singleSelect"></Detail>
fd2207 317   </div>
318 </template>
319
320 <script>
321 import { listLineInfo } from "@/api/main/bs/lineInfo/lineInfo";
322 import { listWorkshop } from "@/api/main/bs/workshop/workshop";
323 import { listProductBom } from "@/api/main/bs/ProductBom/ProductBom";
324 import { listTechnologyRoute} from "@/api/main/bs/technologyRoute/technologyRoute";
325 import ItemSelect  from "@/components/itemSelect/single.vue";
696fd5 326 import {  addOrderSchedulingForBoxCode,getProductionNotice, upDownMove, listProductionOrde, getProductionOrde,getProductionOrdes, delProductionOrde, addProductionOrde, updateProductionOrde } from "@/api/main/om/productionOrde/productionOrde";
05d425 327 import {
C 328   listOrderScheduling,
329   getOrderScheduling,
330   delOrderScheduling,
331   addOrderScheduling,
332   updateOrderScheduling,
333   generateNumbers
334 } from "@/api/main/bs/orderScheduling/orderScheduling";
f11989 335 import {listMaterial} from "@/api/main/bs/material/material";
04cd5a 336 import {listModelNumber} from "@/api/main/bs/modelNumber/modelNumber";
d4f437 337 import Detail from "./detail.vue";
fd2207 338
339 export default {
340   name: "ProductionOrde",
c33ba1 341   dicts: ['order_state','year','month','day','subscription_type', 'sys_yes_no', 'data_type','sys_normal_disable'],
fd2207 342   components: {
343     ItemSelect ,
d4f437 344     Detail
fd2207 345   },
346   data() {
347     return {
d4f437 348       showDetailFlag: false,
Y 349       singleSelect:{},
fd2207 350       titleName: '',
351       options: [],
352       lineOptions: [],
3d8828 353       outputArray: [],
fd2207 354       showFlag:false,
355       advancedShowSearch: false,
356       workOrder: {
357         status: 'ss'
358       },
359       // 遮罩层
360       loading: true,
361       // 选中数组
362       ids: [],
363       // 非单个禁用
364       single: true,
365       // 非多个禁用
366       multiple: true,
367       move: true,
368       selectedRowIndex: -1, // 存储选中行的索引
369       // 显示搜索条件
370       showSearch: true,
371       // 总条数
372       total: 0,
373       // 生产工单表格数据
374       productionOrdeList: [],
375       // 弹出层标题
376       title: "",
377       // 是否显示弹出层
378       open: false,
3d8828 379       Createopen: false,
fd2207 380       // 查询参数
381       queryParams: {
382         pageNum: 1,
383         pageSize: 10,
384         workOrderNo: null,
385         salesOrderCode: null,
386         productCode: null,
387         productName: null,
388         workshopCode: null,
389         lineCode: null,
390         routeCode: null,
391         bomCode: null,
392         recipeCode: null,
393         orderStatus: null,
394         custom: null,
395         marketAreaCode: null,
396         softwareVersionCode: null,
397         productCompanyCode: null,
398         frontEndId: 0,
399         idNums: null,
065fe8 400         typeZ: 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         //赋值起始编码
d4f437 517         this.form.startEndCode =   dateTimeRule + String(parseInt(startCode)).padStart(3, '0') + "         " + 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);
df1f2b 525         this.queryParams = {}
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;
603       listProductionOrde(this.queryParams).then(response => {
604         this.productionOrdeList = response.rows;
605         this.total = response.total;
606         this.loading = false;
607       });
608     },
609     // 取消按钮
610     cancel() {
611       this.open = false;
3d8828 612       this.Createopen = false;
fd2207 613       this.reset();
614     },
615     // 表单重置
616     reset() {
617       this.form = {
618         id: null,
619         workOrderNo: null,
620         salesOrderCode: null,
621         productCode: null,
622         productName: null,
623         workshopCode: null,
624         lineCode: null,
625         routeCode: null,
626         bomCode: null,
627         recipeCode: null,
628         planQty: null,
629         actualQty: null,
630         badQty: null,
631         scrapQty: null,
632         repairQty: null,
633         actualOnlineQty: null,
634         onlineCompletionMark: null,
635         demandDate: null,
636         planStartTime: null,
637         planEndTime: null,
638         actualStartTime: null,
639         actualEndTime: null,
640         serialNumber: null,
641         orderStatus: null,
642         createTime: null,
643         updateTime: null,
644         createUser: null,
645         updateUser: null,
646         remarks: null,
647         streamNumber: null,
648         custom: null,
649         marketAreaCode: null,
650         softwareVersionCode: null,
651         productCompanyCode: null,
652         spareField1: null,
653         spareField2: null,
654         spareField3: null,
065fe8 655         typeZ: null,
3d8828 656         spareField4: null,
d4f437 657         adds:null,
Y 658         idNums:null
fd2207 659       };
660       this.resetForm("form");
661     },
662     /** 搜索按钮操作 */
663     handleQuery() {
664       this.queryParams.pageNum = 1;
665       this.getList();
666     },
667     /** 重置按钮操作 */
668     resetQuery() {
669       this.resetForm("queryForm");
670       this.handleQuery();
671     },
d4f437 672     /** 多选框选中数据 */
fd2207 673     handleSelectionChange(selection) {
674       this.ids = selection.map(item => item.id)
675       this.move = selection.length!==1
676       if(!selection.length){
677         this.single = true
678         this.multiple = true
679       }else {
680         if(selection[0].orderStatus === '1' && selection.length === 1){
681           this.single = false
682           this.multiple = false
683         }
d4f437 684         if(selection[0].orderStatus === '2' && selection.length === 1){
Y 685           this.singleSelect = selection[0]
686         }
fd2207 687       }
688     },
c33ba1 689
fd2207 690     /** 新增按钮操作 */
691     handleAdd() {
692       this.initWorkshop();
693       this.reset();
694       this.open = true;
df1f2b 695       this.titleName = "添加生产订单";
3d8828 696     },
H 697     /** 同步按钮操作 */
698     CreatehandleUpdate(Row) {
699       this.initWorkshop();
700       this.reset();
701       const id = Row.id || this.ids
696fd5 702       getProductionOrdes(id).then(response => {
3d8828 703         console.log(response.data)
f11989 704         console.log(response.data.productCode)
705         this.materialQueryParams.materialCode = response.data.productCode;
706         listMaterial(this.materialQueryParams).then(response => {
707           this.markNo = response.rows[0].mark
a5f938 708           this.form.typeL = response.rows[0].typeL;
f11989 709         });
3d8828 710         this.form = response.data;
d4f437 711         this.form.idNums=id;
3d8828 712         this.Createopen = true;
05d425 713         this.titleName = "生成箱体条码";
3d8828 714         // return Array.from({ length: parseInt(this.actualQty) }, (_, index) => index + 1);
H 715       });
fd2207 716     },
717     /** 修改按钮操作 */
718     handleUpdate(row) {
719       this.initWorkshop();
720       this.reset();
721       const id = row.id || this.ids
722       getProductionOrde(id).then(response => {
723         console.log(response.data)
724         this.form = response.data;
725         this.open = true;
df1f2b 726         this.titleName = "修改生产订单";
fd2207 727       });
728     },
729     /** 提交按钮 */
730     submitForm() {
731       this.$refs["form"].validate(valid => {
732         if (valid) {
733           if (this.form.id != null) {
734             updateProductionOrde(this.form).then(response => {
735               this.$modal.msgSuccess("修改成功");
736               this.open = false;
737               this.getList();
738             });
739           } else {
740             addProductionOrde(this.form).then(response => {
741               this.$modal.msgSuccess("新增成功");
742               this.open = false;
743               this.getList();
744             });
745           }
746         }
747       });
748     },
05d425 749
C 750     /** 生成箱体条码提交按钮 */
751     submitFormForBoxCode() {
04cd5a 752       let startCode = parseInt(this.form.startCode);
753       let queryParams = {
754         model: this.form.typeZ,
755         modelDate: this.form.dateTimeRule,
756       }
a5f938 757       if(startCode>999){
C 758         this.$message.error('起始编号超出最大范围,请输入1-999的数字!');
759         return;
760       }else if(startCode<1){
761         this.$message.error('起始编号超出最小范围,请输入1-999的数字!');
762         return;
763       }
04cd5a 764       listModelNumber(queryParams).then(response => {
765         if(response.rows.length === 0){
766           this.saveBoxCode()
767         }else {
768           let maxNumValue = response.rows[0].maxnumValue;
c2254b 769           if(startCode<=maxNumValue){
a5f938 770             this.$message.error('箱体条码重复,请重新输入起始编号!');
04cd5a 771           }else {
772             this.saveBoxCode()
773           }
774         }
775       });
776     },
777
778     saveBoxCode(){
05d425 779       this.$refs["form"].validate(valid => {
C 780         if (valid) {
d4f437 781           if (this.form.idNums != null) {
05d425 782             addOrderSchedulingForBoxCode(this.form).then(response => {
C 783               this.$modal.msgSuccess("保存成功");
f11989 784               this.Createopen = false;
05d425 785               this.getList();
C 786             });
787           }
788         }
789       });
790     },
791
fd2207 792     /** 删除按钮操作 */
793     handleDelete(row) {
794       const ids = row.id || this.ids;
df1f2b 795       this.$modal.confirm('是否确认删除生产订单编号为"' + ids + '"的数据项?').then(function() {
fd2207 796         return delProductionOrde(ids);
797       }).then(() => {
798         this.getList();
799         this.$modal.msgSuccess("删除成功");
800       }).catch(() => {});
801     },
802     /** 导出按钮操作 */
803     handleExport() {
804       this.download('om/productionOrde/export', {
805         ...this.queryParams
806       }, `productionOrde_${new Date().getTime()}.xlsx`)
3d8828 807     },
d4f437 808     goToPage() {
Y 809       this.showDetailFlag=true
810       console.log('this.showDetailFlag',this.showDetailFlag)
811       //更新实际生产日期
812       //updateOrderInfo(this.singleSelect)
813     },
fd2207 814   }
815 };
816 </script>
817 <style lang="scss" scoped>
f11989 818 .hidden-form-item {
819   display: none;
820 }
fd2207 821 </style>