package com.zy.asrs.common.wms.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.zy.asrs.common.wms.entity.WrkMast; import com.zy.asrs.common.wms.mapper.BasDevpMapper; import com.zy.asrs.common.wms.entity.BasDevp; import com.zy.asrs.common.wms.service.BasDevpService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zy.asrs.common.wms.service.WrkMastService; import com.zy.asrs.framework.exception.CoolException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service("basDevpService") public class BasDevpServiceImpl extends ServiceImpl implements BasDevpService { @Autowired private WrkMastService wrkMastService; @Override public List getAvailableInSite(Long hostId) { return this.baseMapper.getAvailableInSite(1, hostId); } @Override public List getAvailableEmptyInSite(Long hostId) { return this.baseMapper.getAvailableInSite(10, hostId); } @Override public List getAvailableOutSite(Integer typeNo, Long hostId) { return this.baseMapper.getAvailableOutSite(typeNo, hostId); } @Override public BasDevp checkSiteStatus(Integer devpNo, boolean pakin, Long hostId) { BasDevp station = this.getOne(new LambdaQueryWrapper().eq(BasDevp::getDevNo, devpNo).eq(BasDevp::getHostId, hostId)); if (station == null){ throw new CoolException(devpNo + "站点不存在"); } if (pakin) { if(station.getAutoing()==null || !station.getAutoing().equals("Y")) { throw new CoolException(devpNo + "站点不是自动状态"); } if(station.getLoading()==null || !station.getLoading().equals("Y")) { throw new CoolException(devpNo + "站点无物"); } if(station.getWrkNo()!=null && station.getWrkNo()>0 && station.getWrkNo() < 9990) { throw new CoolException(devpNo + "站点已有工作号"); } if (wrkMastService.count(new LambdaQueryWrapper() .eq(WrkMast::getSourceStaNo, devpNo) .in(WrkMast::getWrkSts, 1, 6)) > 0) { throw new CoolException(devpNo + "站点不能同时生成两笔入库工作档"); } } return station; } }