| | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Collection; |
| | | |
| | | /** |
| | | * MES 销售出库明细 Mapper |
| | |
| | | @Mapper |
| | | public interface MesWmProductSalesDetailMapper extends BaseMapperX<MesWmProductSalesDetailDO> { |
| | | |
| | | default List<MesWmProductSalesDetailDO> selectBySalesIdsAndBagIds(Collection<Long> salesIds, Collection<Long> bagIds) { |
| | | if (salesIds.isEmpty() || bagIds.isEmpty()) return List.of(); |
| | | return selectList(new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<MesWmProductSalesDetailDO>() |
| | | .in(MesWmProductSalesDetailDO::getSalesId, salesIds) |
| | | .in(MesWmProductSalesDetailDO::getBagCodeId, bagIds)); |
| | | } |
| | | |
| | | default List<MesWmProductSalesDetailDO> selectByBagIds(Collection<Long> bagIds) { |
| | | if (bagIds.isEmpty()) return List.of(); |
| | | return selectList(new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<MesWmProductSalesDetailDO>() |
| | | .in(MesWmProductSalesDetailDO::getBagCodeId, bagIds)); |
| | | } |
| | | |
| | | // 仅未取消且尚未完成的出库单占用袋码。旧整托明细也参与重叠判断。 |
| | | @org.apache.ibatis.annotations.Select(""" |
| | | SELECT d.* FROM mes_wm_product_sales_detail d |
| | | JOIN mes_wm_product_sales s ON s.id = d.sales_id |
| | | LEFT JOIN mes_wm_product_sales_shipment sh ON sh.id = d.shipment_id AND sh.deleted = 0 |
| | | WHERE d.deleted = 0 AND s.deleted = 0 AND s.status IN (2, 10, 3) |
| | | AND (d.shipment_id IS NULL OR sh.status IN (10, 20)) |
| | | AND d.batch_code = #{batchCode} |
| | | """) |
| | | List<MesWmProductSalesDetailDO> selectPickingByBatchCode(String batchCode); |
| | |
| | | @org.apache.ibatis.annotations.Select(""" |
| | | SELECT d.* FROM mes_wm_product_sales_detail d |
| | | JOIN mes_wm_product_sales s ON s.id = d.sales_id |
| | | LEFT JOIN mes_wm_product_sales_shipment sh ON sh.id = d.shipment_id AND sh.deleted = 0 |
| | | WHERE d.deleted = 0 AND s.deleted = 0 AND s.status IN (2, 10, 3) |
| | | AND (d.shipment_id IS NULL OR sh.status IN (10, 20)) |
| | | AND d.batch_code = #{batchCode} FOR UPDATE |
| | | """) |
| | | List<MesWmProductSalesDetailDO> selectPickingByBatchCodeForUpdate(String batchCode); |
| | |
| | | return selectList(MesWmProductSalesDetailDO::getLineId, lineId); |
| | | } |
| | | |
| | | default void unassignShipment(Long shipmentId) { |
| | | update(null, new com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper<MesWmProductSalesDetailDO>() |
| | | .eq(MesWmProductSalesDetailDO::getShipmentId, shipmentId) |
| | | .set(MesWmProductSalesDetailDO::getShipmentId, null)); |
| | | } |
| | | |
| | | default List<MesWmProductSalesDetailDO> selectListBySalesId(Long salesId) { |
| | | return selectList(MesWmProductSalesDetailDO::getSalesId, salesId); |
| | | } |