李林
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
/*
 *    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.mapper;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chinaztt.mes.basic.entity.Location;
import com.chinaztt.mes.production.dto.ApplyReportTypeDetailDTO;
import com.chinaztt.mes.production.dto.OperationTaskDTO;
import com.chinaztt.mes.production.entity.OperationTask;
import com.chinaztt.mes.production.vo.OperationTaskScreenVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
 
import java.math.BigDecimal;
import java.util.List;
 
/**
 * 工序任务
 *
 * @author zhangxy
 * @date 2020-09-18 09:26:35
 */
@Mapper
public interface OperationTaskMapper extends BaseMapper<OperationTask> {
 
    /**
     * 查询机台工序任务,车间执行看板用
     *
     * @param workstationId
     * @return
     */
    List<OperationTaskDTO> getListByWorkstationId(Long workstationId);
 
    /**
     * 分页查询
     *
     * @param page
     * @param ew
     * @return
     */
    IPage<List<OperationTaskDTO>> queryPage(Page page, @Param("ew") QueryWrapper<OperationTaskDTO> ew);
 
    /**
     * 查询工单任务
     *
     * @param gen
     * @return
     */
    List<OperationTaskDTO> getOperationTask(@Param("ew") QueryWrapper<OperationTaskDTO> gen,
                                            @Param("stateLimit") Boolean stateLimit,
                                            @Param("productSn") String productSn,
                                            @Param("salesOrder") String salesOrder,
                                            @Param("productName") String productName,
                                            @Param("outBatchNo") String outBatchNo,
                                            @Param("mpsNo") String mpsNo,
                                            @Param("operationStockStatus") Boolean operationStockStatus);
 
    /**
     * 更新完成数量
     *
     * @param id
     * @param diffQuantity
     */
    void updateCompletedQuantity(@Param("id") Long id, @Param("diffQuantity") BigDecimal diffQuantity);
 
    /**
     * 根据id查询
     *
     * @param id
     * @return
     */
    OperationTaskDTO getOperationTaskDTO(Long id);
 
    /**
     * 关联删除
     *
     * @param id
     * @return
     */
    void deleteOperationById(Long id);
 
    /**
     * PDA查询所有
     *
     * @param page
     * @param gen
     * @return
     */
    IPage<List<OperationTaskDTO>> pdaPage(Page page, @Param("ew") QueryWrapper<OperationTaskDTO> gen);
 
    /**
     * 查询当前工单同一个制造订单下的下一道工序的工单
     *
     * @param operationTaskId
     * @return
     */
    List<OperationTask> getLastOperationTask(Long operationTaskId);
 
    /**
     * @param ids
     * @return
     */
    List<OperationTaskDTO> selectByIds(@Param("ids") List<Long> ids);
 
    /**
     * @param id
     * @return
     */
    List<OperationTaskDTO> getCombinedOperationTaskInfo(Long id);
 
    /**
     * 获取检测汇报类型基础数据
     *
     * @return
     */
    List<ApplyReportTypeDetailDTO> getApplyReportType();
 
    /**
     * 根据车间订单查询临时车间订单
     *
     * @param moId
     * @return
     */
    List<OperationTaskDTO> getFromMoOptionByMoId(Long moId);
 
    /**
     * 根据工单ids查询货盘运输任务
     *
     * @param ids
     * @return
     */
    List<String> getPalletOptaskCode(@Param("ids") List<Long> ids);
 
    /**
     * 根据工作站编号获取工作站对应的投料库位列表
     *
     * @param workstationNo 工作站编号
     * @return
     */
    List<Location> getFeedLocationListByWorkstationNo(@Param("workstationNo") String workstationNo);
 
    /**
     * 根据工作站编号获取工作站对的工单列表
     *
     * @param workstationNo
     * @return
     */
    List<OperationTask> getActiveOperationTaskListByWorkstationNo(@Param("workstationNo") String workstationNo);
 
    /**
     * 根据工作站编号获取没有直接指定工作站的工单列表
     *
     * @param workstationNo
     * @return
     */
    List<OperationTask> getActiveOperationTaskListUnPointWorkstationByWorkstationNo(@Param("workstationNo") String workstationNo);
 
    /**
     * 根据货盘运输任务id查询工单
     *
     * @param palletId
     * @return
     */
    List<OperationTaskDTO> getByPalletTransId(Long palletId);
 
    /**
     * 根据工单id查询信息
     *
     * @param id
     * @return
     */
    OperationTaskDTO getOperationInfoById(Long id);
 
    /**
     * @param id
     */
    void updateNextPriority(Long id);
 
    /**
     * @param id
     */
    void removeActualFinishDateById(Long id);
 
    /**
     * 根据产出批次号获取生产数量(包含交班产出)
     *
     * @param batchNo
     * @return
     */
    BigDecimal getProdOutQtyByBatchNo(@Param("batchNo") String batchNo);
 
    /**
     * 根据产出批次号获取工序id
     *
     * @param batchNo
     * @return
     */
    Long getOperationId(@Param("batchNo") String batchNo);
 
    /**
     * 根据工单id查找对应车间订单号
     *
     * @param operationTaskId
     * @return
     */
    String getTaskMoNo(@Param("id") Long operationTaskId);
 
    /**
     * 根据工单id查找对应车间订单下所有工单状态
     *
     * @param operationTaskId
     * @return
     */
    List<String> getAllTaskStateByTaskId(@Param("id") Long operationTaskId);
 
    /**
     * 根据工单id判断当前是否是最后一道工序工单
     *
     * @param id
     * @return
     */
    Boolean validateIsLastOperation(@Param("id") Long id);
 
    /**
     * @param operationTaskId
     * @return
     */
    Long getFirstOperationId(@Param("operationTaskId") Long operationTaskId);
 
    /**
     * @param operationTaskId
     * @return
     */
    Long getOperationIdByTaskId(@Param("operationTaskId") Long operationTaskId);
 
    /**
     * 查询根据客户订单id 查询工单
     *
     * @param customerOrderId
     * @return
     */
    List<OperationTaskScreenVO> getByCustomerOrderId(@Param("customerOrderId") Long customerOrderId);
}