李林
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
/*
 *    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.warehouse.mapper;
 
import com.alibaba.fastjson.JSONObject;
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.warehouse.dto.*;
import com.chinaztt.mes.warehouse.entity.InventoryDetail;
import com.chinaztt.mes.warehouse.entity.Stock;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
 
import java.math.BigDecimal;
import java.util.List;
 
/**
 * 库存表
 *
 * @author cxf
 * @date 2020-10-22 16:37:46
 */
@Mapper
public interface StockMapper extends BaseMapper<Stock> {
 
    /**
     * 分页查询
     *
     * @param page
     * @param gen
     * @return
     */
    IPage<StockDTO> getStockPage(Page page, @Param("ew") QueryWrapper<StockDTO> gen);
 
    /**
     * 统计实时库存数量
     *
     * @param gen
     * @return
     */
    BigDecimal getSumStockQuantity(@Param("ew") QueryWrapper<StockDTO> gen);
 
    /**
     * 根据sn号获取库存明细
     *
     * @param partBatchNo
     * @return
     */
    List<StockDTO> getStockBySn(@Param("partBatchNo") String partBatchNo);
 
    /**
     * 部分页查询
     *
     * @param gen
     * @return
     */
    List<FeedingStockDTO> getFeedingStock(@Param("workstationId") Long workstationId, @Param("ew") QueryWrapper<FeedingStockDTO> gen);
 
    /**
     * 部分页查询
     *
     * @param gen
     * @return
     */
    List<JSONObject> pdaList(@Param("ew") QueryWrapper<FeedingStockDTO> gen);
 
    /**
     * 分页查询
     *
     * @param page
     * @param gen
     * @param partId
     * @return
     */
    IPage<List<StockDTO>> getStockByPartIdPage(Page page, @Param("ew") QueryWrapper<StockDTO> gen, @Param("partId") Long partId);
 
    /**
     * 根据工作站id查询线边仓
     *
     * @param gen
     * @return
     */
    IPage<List<StockDTO>> getStockByWorkstationId(Page page, @Param("ew") QueryWrapper<StockDTO> gen);
 
    /**
     * 根据工作站id查询线边仓待处理物料
     *
     * @param gen
     * @return
     */
    IPage<List<StockDTO>> getToDealStockByWorkstationId(Page page, @Param("ew") QueryWrapper<StockDTO> gen);
 
    /**
     * 根据库位查询零件
     *
     * @param ids
     * @return
     */
    List<StockDTO> getStockByLocation(@Param("ids") List<Long> ids);
 
 
    /**
     * 根据零件、库位和批次号筛选实时库存
     *
     * @param id
     * @param id1
     * @param partBatchNo
     * @return
     */
    List<StockDTO> getStock(@Param("id") Long id, @Param("id1") Long id1, @Param("ew") String partBatchNo,@Param("condition") String condition);
 
    /**
     * 根据零件、库位和批次号筛选实时库存数量
     *
     * @param id
     * @param id1
     * @param partBatchNo
     * @return
     */
    Integer countStock(@Param("id") Long id, @Param("id1") Long id1, @Param("ew") String partBatchNo,@Param("condition") String condition);
 
    /**
     * 分页查询
     *
     * @param page
     * @param gen
     * @param operationTaskId
     * @return
     */
    IPage<List<StockDTO>> getStockPageByOperation(Page page, @Param("ew") QueryWrapper<StockDTO> gen, @Param("operationTaskId") Long operationTaskId);
 
    /**
     * 不分页查询
     *
     * @param gen
     * @param operationTaskId
     * @return
     */
    List<StockDTO> getStockPageByOperation(@Param("ew") QueryWrapper<StockDTO> gen, @Param("operationTaskId") Long operationTaskId);
 
    /**
     * 不分页查询
     *
     * @param gen
     * @param operationTaskId
     * @return
     */
    List<StockDTO> getStockListByOperation(@Param("ew") QueryWrapper<StockDTO> gen, @Param("operationTaskId") Long operationTaskId);
 
 
    /**
     * 根据产出物料系统编号查询序列号
     * @param systemNo
     * @return
     */
    String getSerialNoBySystemNo(@Param("systemNo") String systemNo);
 
    /**
     * 根据SN号获取可用实时库存对象list
     * @return
     */
    List<StockDTO> getEnableStockObjList(@Param("sn") String sn);
 
    /**
     * 获取可用库位对象list
     * @return
     */
    List<JSONObject> getEnableLocationObjList();
 
    /**
     * 根据库存id获取MoveLibraryBoxDTO集合
     * @param stockId
     * @return
     */
    List<MoveLibraryBoxDTO> getMoveLibraryBoxDTOListByStockId(@Param("stockId") Long stockId);
 
    /**
     * 根据库存id查找对应的车间订单
     * @param id
     * @return
     */
    String getStockMoNo(@Param("id") Long id);
 
    /**
     * 根据仓库,库位号,零件查找实时库存
     * @param locationIds
     * @param warehouseIds
     * @param partId
     * @return
     */
    List<InventoryDetail> getStockByInventory(@Param("locationIds") List<Long> locationIds,@Param("warehouseIds") List<Long> warehouseIds,@Param("partId") Long partId);
    /*
    * 根据零件批次号,零件id查询是否工序库存
     * @param outBatchNo
     * @param partId
     * @return
     */
    List<Boolean> getStockOperationStatus(@Param("outBatchNo") String outBatchNo, @Param("partId") Long partId,
                                          @Param("systemNo") String systemNo);
 
    /**
     * 查找检测合格库位库存
     * @param sn
     * @param partNo
     * @return
     */
    List<StockDTO> getFinishProductStock(@Param("sn") String sn,@Param("partNo") String partNo);
    /*
     * 根据locationId,sn查询库存表
     * @param locationId
     * @param sn
     * @return
     */
    List<InventoryDetail> getStockByLocIdAndSn(@Param("locationId") Long locationId, @Param("sn") String sn);
 
    /**
     * 分页查询出库位尾号为001的
     *
     * @param page
     * @param gen
     * @return
     */
    IPage<List<StockDTO>> getStockPageByLocNo(Page page, @Param("ew") QueryWrapper<StockDTO> gen);
 
    /**
     * 获取成品库库存
     * @param partBatchNo
     * @param partId
     * @return
     */
    int getFinishLocationProduct(@Param("partBatchNo") String partBatchNo,@Param("partId") Long partId);
 
 
    /**
     * 根据sn号获取馈线合格证信息
     * @param sn
     * @param locationIdList
     * @return
     */
    FeederCertificateDTO getFeederCertificate(@Param("sn")String sn,@Param("locationIdList")List<Long> locationIdList);
 
 
    /**
     * 根据sn号获取车间订单信息
     * @param snList
     * @return
     */
    List<FeederManufacturingOrderDTO> getFeederManufacturingOrder(@Param("snList") List<String> snList);
 
 
    /**
     * 根据仓库,库位号,零件查找报工产出
     * @param locationIds
     * @param warehouseIds
     * @param partId
     * @return
     */
    List<InventoryDetail> getProductionByInventory(@Param("locationIds") List<Long> locationIds,@Param("warehouseIds") List<Long> warehouseIds,@Param("partId") Long partId);
 
 
 
 
    /**
     * 根据sn号获取库存信息
     * @param snList
     * @return
     */
    List<StockDTO> getStockBySnList(@Param("snList")List<String> snList);
 
}