| package com.zy.asrs.service.impl; | 
|   | 
| import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
| import com.baomidou.mybatisplus.plugins.Page; | 
| import com.core.common.Cools; | 
| import com.zy.asrs.mapper.OrderDetlMapper; | 
| import com.zy.asrs.entity.OrderDetl; | 
| import com.zy.asrs.service.OrderDetlService; | 
| import com.baomidou.mybatisplus.service.impl.ServiceImpl; | 
| import org.springframework.stereotype.Service; | 
|   | 
| import java.util.List; | 
|   | 
| @Service("orderDetlService") | 
| public class OrderDetlServiceImpl extends ServiceImpl<OrderDetlMapper, OrderDetl> implements OrderDetlService { | 
|   | 
|     @Override | 
|     public List<OrderDetl> selectByOrderId(Long orderId) { | 
|         return this.selectList(new EntityWrapper<OrderDetl>().eq("order_id", orderId)); | 
|     } | 
|   | 
|     @Override | 
|     public Page<OrderDetl> getPakoutPage(Page<OrderDetl> page) { | 
|         page.setRecords(baseMapper.getPakoutPage(page.getCondition())); | 
|         page.setTotal(baseMapper.getPakoutPageCount(page.getCondition())); | 
|         return page; | 
|     } | 
|   | 
|     @Override | 
|     public OrderDetl selectItem(Long orderId, String matnr, String batch) { | 
|         return this.baseMapper.selectItem(orderId, matnr, batch); | 
|     } | 
|   | 
|     @Override | 
|     public OrderDetl selectItem(String orderNo, String matnr, String batch) { | 
|         return this.baseMapper.selectItemByOrderNo(orderNo, matnr, batch); | 
|     } | 
|   | 
|     @Override | 
|     public OrderDetl findByLook(List<OrderDetl> orderDetls, Long orderId, String matnr, String batch) { | 
|         for (OrderDetl orderDetl : orderDetls) { | 
|             if (orderDetl.getOrderId().equals(orderId) && orderDetl.getMatnr().equals(matnr)) { | 
|                 if (Cools.eq(batch, orderDetl.getBatch())) { | 
|                     return orderDetl; | 
|                 } | 
|             } | 
|         } | 
|         return null; | 
|     } | 
|   | 
|     @Override | 
|     public boolean increase(Long orderId, String matnr, String batch, Double workQty) { | 
|         return this.baseMapper.increase(orderId, matnr, batch, workQty) > 0; | 
|     } | 
|   | 
|     @Override | 
|     public boolean decrease(String orderNo, String matnr, String batch, Double workQty) { | 
|         int decrease = this.baseMapper.decrease(orderNo, matnr, batch, workQty); | 
|         if (decrease == 0) { | 
|             return this.baseMapper.decrease(orderNo, matnr, null, workQty) > 0; | 
|         } else { | 
|             return true; | 
|         } | 
|     } | 
|   | 
|     @Override | 
|     public boolean modifyStatus(Long orderId, Integer status) { | 
|         return this.baseMapper.modifyStatus(orderId, status) > 0; | 
|     } | 
|   | 
|     @Override | 
|     public boolean addToLogTable(OrderDetl orderDetl) { | 
|         return this.baseMapper.addToLogTable(orderDetl) > 0; | 
|     } | 
|   | 
|     @Override | 
|     public boolean increaseQtyByOrderNo(String orderNo, String matnr, String batch, Double qty) { | 
|         return this.baseMapper.increaseQtyByOrderNo(orderNo, matnr, batch, qty) > 0; | 
|     } | 
|   | 
|     /** | 
|      * 入出库任务生成时,更新单据表中作业数量 | 
|      * @param orderId | 
|      * @param matnr | 
|      * @param batch | 
|      * @param workQty | 
|      * @return | 
|      */ | 
|     @Override | 
|     public boolean increaseWorkQty(Long orderId, String matnr, String batch, Double workQty) { | 
|         return this.baseMapper.increaseWorkQty(orderId, matnr, batch, workQty) > 0; | 
|     } | 
|   | 
|     @Override | 
|     public Boolean checkAllDetlFinish(String orderNo) { | 
|         return this.baseMapper.checkAllDetlFinish(orderNo) <= 0 ; | 
|     } | 
|   | 
|     /** | 
|      * 获取相同单号,相同批号,相同物料代码已经在入库通知档里组托的数量 | 
|      * @param orderNo | 
|      * @param matnr | 
|      * @param batch | 
|      * @return | 
|      */ | 
|     @Override | 
|     public Integer sameOrderComb(String orderNo, String matnr, String batch) { | 
|         Integer sum = this.baseMapper.sameOrderComb(orderNo, matnr, batch); | 
|         return  sum != null ? sum : 0; | 
|     } | 
| } |