李林
2023-10-07 658d4927d468c47208fd012d9128b09249c07eff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
/*
 *    Copyright (c) 2018-2025, ztt All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: ztt
 */
 
package com.chinaztt.mes.production.service;
 
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chinaztt.mes.basic.entity.Template;
import com.chinaztt.mes.plan.dto.ManufacturingOrderDTO;
import com.chinaztt.mes.plan.dto.ManufacturingOrderOperationTemplateDTO;
import com.chinaztt.mes.production.dto.*;
import com.chinaztt.mes.production.entity.*;
import com.chinaztt.mes.production.vo.OperationTaskScreenVO;
import com.chinaztt.ztt.common.core.util.R;
import org.springframework.web.multipart.MultipartFile;
 
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
/**
 * 工序任务
 *
 * @author zhangxy
 * @date 2020-09-18 09:26:35
 */
public interface OperationTaskService extends IService<OperationTask> {
 
    /**
     * 分页查询
     *
     * @param page
     * @param ew
     * @return
     */
    IPage<List<OperationTaskDTO>> getPage(Page page, QueryWrapper<OperationTaskDTO> ew);
 
    /**
     * 工作站id
     *
     * @param workstationId
     * @return
     */
    List<OperationTaskDTO> getOperationTask(Long workstationId, String productSn, String salesOrder,
                                            String productName, String outBatchNo, String mpsNo);
 
    /**
     * 改变工单状态
     *
     * @param ids
     * @param event
     * @return
     */
    boolean changeState(List<Long> ids, String event);
 
    /**
     * 改变后台工单状态
     *
     * @param id
     * @param event
     * @return
     */
    boolean changeState(Long id, String event);
 
    /**
     * 根据id查询
     *
     * @param id
     * @return
     */
    OperationTaskDTO getOperation(Long id);
 
    /**
     * 关联保存
     *
     * @param operationTaskDTO
     * @return
     */
    String fullSave(OperationTaskDTO operationTaskDTO);
 
    /**
     * 批量保存
     *
     * @param operationTaskDTOList
     * @return
     */
    List<String> batchFullSave(List<OperationTaskDTO> operationTaskDTOList);
 
    /**
     * 关联修改
     *
     * @param operationTaskDTO
     * @return
     */
    String fullUpdate(OperationTaskDTO operationTaskDTO);
 
    /**
     * 关联删除
     *
     * @param id
     * @return
     */
    boolean fullDelete(Long id);
 
    /**
     * 通过id查询工单来源
     *
     * @param id
     * @return
     */
    List<ManufacturingOrderDTO> getOperationSupplyById(Long id);
 
    /**
     * 通过id查询工单所需物料
     *
     * @param gen
     * @return
     */
    List<OperationTaskMaterialDTO> getMaterial(QueryWrapper<OperationTaskMaterialDTO> gen);
 
    /**
     * PDA查询所有
     *
     * @param page
     * @param gen
     * @return
     */
    IPage<List<OperationTaskDTO>> pdaPage(Page page, QueryWrapper<OperationTaskDTO> gen);
 
    /**
     * PDA查询工单所需物料
     *
     * @param gen
     * @return
     */
    List<JSONObject> pdaMaterial(QueryWrapper<OperationTaskMaterialDTO> gen);
 
    /**
     * 通过工序任务ID查询工单所需物料
     *
     * @param id
     * @return
     */
    List<OperationTaskMaterial> getOperationMaterialById(Long id);
 
    /**
     * 通过id查询工单所需物料
     *
     * @param id
     * @return
     */
    OperationTaskMaterial getOperationMaterialByMaterialId(Long id);
 
    /**
     * 新增工单所需物料
     *
     * @param operationTaskMaterial
     * @return
     */
    R addOperationMaterial(OperationTaskMaterial operationTaskMaterial);
 
    /**
     * 更新工单所需物料
     *
     * @param operationTaskMaterial
     * @return
     */
    R updateOperationMaterial(OperationTaskMaterial operationTaskMaterial);
 
    /**
     * 删除工单所需物料
     *
     * @param id
     * @return
     */
    R deleteOperationMaterial(Long id);
 
 
    /**
     * 通过id查询工单所关联的模板和参数
     *
     * @param id
     * @return
     */
    List<ManufacturingOrderOperationTemplateDTO> getTemplate(Long id);
 
    /**
     * 通过工序id、模板类型、所在页面查询工单所关联的模板(类型为生产记录可以修改)
     *
     * @param id
     * @param page
     * @param template
     * @return
     */
    IPage<List<Template>> getTemplateUpdate(Page page, Long id, Template template);
 
    /**
     * 通过模板类型查询工单所关联的模板
     *
     * @param page
     * @param gen
     * @return
     */
    IPage<List<Template>> getTemplateByType(Page page, QueryWrapper<Template> gen);
 
    /**
     * 根据工单、当班记录、参数集模板,查询点巡检或原始记录的主表
     *
     * @param operationTaskRecordDTO
     * @return
     */
    List<OperationTaskRecordDTO> getTemplateRecord(OperationTaskRecordDTO operationTaskRecordDTO);
 
    /**
     * 修改工单模板对应的参数
     *
     * @param operationTaskParamList
     * @return
     */
    boolean updateTemplateParam(List<OperationTaskParam> operationTaskParamList);
 
    /**
     * 通过id查询工单是否完成
     *
     * @param id
     * @return
     */
    Object getOperationTaskById(Long id);
 
    /**
     * 根据点巡检或原始记录的主表id,查询具体的点巡检或原始记录的从表信息
     *
     * @param operationTaskParamDTO
     * @return
     */
    List<OperationTaskParamDTO> getTemplateParam(OperationTaskParamDTO operationTaskParamDTO);
 
    /**
     * 新增原始记录,点巡检的数据
     *
     * @param operationTaskRecordDTO
     * @param file
     * @return
     */
    OperationTaskRecord addTemplateParam(OperationTaskRecordDTO operationTaskRecordDTO, List<MultipartFile> file);
 
    /**
     * @param operationTaskId        工单id
     * @param dutyRecordId           班次id
     * @param workstationId          工作台id
     * @param productOutId           产出id
     * @param operationTaskParamList 参数
     * @param operationTemplateId
     * @param id
     * @param file
     * @return
     */
    OperationTaskRecord addTemplateParam(Long operationTaskId, Long dutyRecordId, Long workstationId, Long productOutId, String operationTaskParamList, Long operationTemplateId, Long id, List<MultipartFile> file);
 
    /**
     * @param templateRecordInputDTO
     * @return
     */
    List<OperationTaskRecord> batchAddTemplateRecord(TemplateRecordInputDTO templateRecordInputDTO);
 
    /**
     * @param templateRecordInputDTO
     * @return
     */
    Boolean batchUpdateTemplateRecord(TemplateRecordInputDTO templateRecordInputDTO);
 
    /**
     * 通过id删除点巡检或原始记录的主从表
     *
     * @param operationTaskRecordDTO
     * @return
     */
    Boolean deleteTemplateRecord(OperationTaskRecordDTO operationTaskRecordDTO);
 
    /**
     * 批量删除点巡检或原始记录的主从表
     *
     * @param idList
     * @return
     */
    Boolean deleteBatchTemplateRecord(List<Long> idList);
 
    /**
     * 上传文件
     *
     * @param file
     * @param operationTaskRecordId
     * @return
     */
    R uploadFile(List<MultipartFile> file, Long operationTaskRecordId);
 
    /**
     * 删除文件
     *
     * @param operationTaskAttachment
     * @return
     */
    R<Boolean> deleteFile(OperationTaskAttachment operationTaskAttachment);
 
    /**
     * 获取文件
     *
     * @param bucket
     * @param fileName
     * @param response
     * @return
     */
    R getFile(String bucket, String fileName, HttpServletResponse response);
 
    /**
     * 合并工单
     *
     * @param ids 工单id
     * @return
     */
    R combineOperationTask(List<Long> ids);
 
    /**
     * 查询被合并工单信息
     *
     * @param id
     * @return
     */
    List<OperationTaskDTO> getCombinedOperationTaskInfo(Long id);
 
 
    //*************************************************************************对接数据采集终端
 
    /**
     * 根据系统号查询设备所需信息
     *
     * @param productOutput 工单
     * @return
     */
    R getAllMessage(ProductOutputDTO productOutput);
 
 
    /**
     * 根据采集的检测信息新增检测汇报
     *
     * @param infosOfferDetectionTerminalDTO
     * @return
     */
    R saveReport(InfosOfferDetectionTerminalDTO infosOfferDetectionTerminalDTO);
 
    /**
     * 获取检测汇报类型基础数据
     *
     * @return
     */
    R getApplyReportType();
 
    //*************************************************************************对接数据采集终端
 
    /**
     * 根据车间订单id 查询临时工单
     *
     * @param moId
     * @return
     */
    R getFromMoOptionByMoId(Long moId);
 
    /**
     * 根据工单id查询工单所需物料
     *
     * @param ids
     */
    R addReserve(List<Long> ids);
 
    /**
     * 根据工单ids查询货盘运输任务
     *
     * @param ids id
     * @return R
     */
    R getPalletOptaskCode(List<Long> ids);
 
    /**
     * 根据工作站编号获取可见范围内的工单(在mes参数集中配置)&&线边仓库位
     *
     * @param workstationNo 工作站编号
     * @return
     */
    R getBasicInfoForPdaFeedByWorkstationNo(String workstationNo);
 
    /**
     * 根据货盘运输任务id 查询工单
     *
     * @param id 货盘运输任务id
     * @return
     */
    List<OperationTaskDTO> getByPalletTransId(Long id);
 
    /**
     * 批量更新工单优先级
     *
     * @param operationTaskList
     * @return
     */
    Boolean batchUpdatePriority(List<OperationTask> operationTaskList);
 
    /**
     * 判断该工单是否可以开始
     *
     * @param id
     * @param workstationId
     * @return
     */
    Boolean checkIsStart(Long id, Long workstationId);
 
    /**
     * 判断该工单完成数量是否大于计划数量
     *
     * @param id
     * @param event
     * @return
     */
    void checkStatus(Long id, String event);
 
 
    List<OperationTaskScreenVO> getByCustomerOrderId(Long customerOrderId);
}