| | |
| | | @Repository |
| | | public interface LocMastMapper extends BaseMapper<LocMast> { |
| | | |
| | | LocMast queryFreeLocMast(@Param("row") Integer row, @Param("locType1") Short locType1); |
| | | |
| | | @Select("select loc_no from asr_loc_mast where 1=1 and loc_sts = 'O' and lev1 = #{lev}") |
| | | List<String> queryGroupEmptyStock(Integer lev); |
| | | |
| | | @Select("select count(*) as count from asr_loc_mast where 1=1 and loc_sts = 'O' and loc_type1 = #{locType1} and crn_no = #{crnNo}") |
| | | Integer selectEmptyLocCount(@Param("locType1") Short locType1, @Param("crnNo") Integer crnNo); |
| | | |
| | | List<LocMast> queryShallowLocFMast(@Param("crnNo") Integer crnNo); |
| | | |
| | | List<LocMast> querySame(@Param("matnr") String matnr,@Param("lev1") Integer lev1); |
| | | List<Integer> getLevList(); |
| | | } |
| | |
| | | import java.util.List; |
| | | |
| | | public interface LocMastService extends IService<LocMast> { |
| | | |
| | | /** |
| | | * 检索可用库位 |
| | | */ |
| | | LocMast queryFreeLocMast(Integer row, Short locType1); |
| | | |
| | | /** |
| | | * 获取同组货架的空库位 |
| | | * @param sourceLocNo 源库位 |
| | |
| | | */ |
| | | List<String> queryGroupEmptyStock(String sourceLocNo); |
| | | |
| | | /** |
| | | * 检查当前库位所属巷道的空库位数量 |
| | | * @param locMast |
| | | * @return |
| | | */ |
| | | Boolean checkEmptyCount(LocMast locMast); |
| | | |
| | | /** |
| | | * 当前库存明细是否为整托 |
| | | */ |
| | | Boolean checkWhole(List<LocDetl> locDetls); |
| | | |
| | | /** |
| | | * 查询浅库位在库,深库位为O的数据 |
| | | * @return |
| | | */ |
| | | List<LocMast> queryShallowLocFMast(Integer crnNo); |
| | | |
| | | List<LocMast> querySame(String matnr,Integer lev1); |
| | | List<Integer> getLevList(); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.mapper.LocMastMapper; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.RowLastnoService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | @Service("locMastService") |
| | | public class LocMastServiceImpl extends ServiceImpl<LocMastMapper, LocMast> implements LocMastService { |
| | | |
| | | @Autowired |
| | | private RowLastnoService rowLastnoService; |
| | | |
| | | @Override |
| | | public LocMast queryFreeLocMast(Integer row, Short locType1) { |
| | | return this.baseMapper.queryFreeLocMast(row, locType1); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> queryGroupEmptyStock(String sourceLocNo) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Boolean checkEmptyCount(LocMast locMast) { |
| | | if (locMast == null) { |
| | | return false; |
| | | } |
| | | return this.baseMapper.selectEmptyLocCount(locMast.getLocType1(), locMast.getCrnNo()) > 1; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean checkWhole(List<LocDetl> locDetls) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<LocMast> queryShallowLocFMast(Integer crnNo) { |
| | | return this.baseMapper.queryShallowLocFMast(crnNo); |
| | | } |
| | | |
| | | @Override |
| | | public List<LocMast> querySame(String matnr,Integer lev1) { |
| | | return this.baseMapper.querySame(matnr,lev1); |
| | | public List<Integer> getLevList() { |
| | | return this.baseMapper.getLevList(); |
| | | } |
| | | } |
| | |
| | | List<Integer> levList = basCrnpService.getLevList(); |
| | | Collections.shuffle(levList); |
| | | |
| | | List<Integer> locLevList = locMastService.getLevList(); |
| | | levList.addAll(locLevList); |
| | | |
| | | for (Integer lev : levList) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts", "O") |
| | |
| | | List<Integer> levList = basCrnpService.getLevList(); |
| | | Collections.shuffle(levList); |
| | | |
| | | List<Integer> locLevList = locMastService.getLevList(); |
| | | levList.addAll(locLevList); |
| | | |
| | | for (Integer lev : levList) { |
| | | //相近物料匹配失败,搜索可用空库位组 |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | |
| | | |
| | | </resultMap> |
| | | |
| | | <select id="queryFreeLocMast" resultMap="BaseResultMap"> |
| | | select top 1 * |
| | | from asr_loc_mast |
| | | where row1=#{row} |
| | | and loc_sts='O' |
| | | <if test="locType1 != null"> |
| | | and loc_type1 = #{locType1} |
| | | </if> |
| | | order by loc_sts desc ,lev1 asc,bay1 asc |
| | | </select> |
| | | |
| | | <select id="queryShallowLocFMast" resultMap="BaseResultMap"> |
| | | select * from asr_loc_mast |
| | | where 1=1 |
| | | and loc_no in ( |
| | | select |
| | | concat( |
| | | ( |
| | | case |
| | | when left(loc_no, 2) = '01' then '02' |
| | | when left(loc_no, 2) = '04' then '03' |
| | | when left(loc_no, 2) = '05' then '06' |
| | | when left(loc_no, 2) = '08' then '07' |
| | | when left(loc_no, 2) = '09' then '10' |
| | | when left(loc_no, 2) = '12' then '11' |
| | | when left(loc_no, 2) = '13' then '14' |
| | | when left(loc_no, 2) = '16' then '15' |
| | | when left(loc_no, 2) = '17' then '18' |
| | | when left(loc_no, 2) = '20' then '19' |
| | | end) |
| | | , right(loc_no, 5)) as shallowLocNo |
| | | from asr_loc_mast |
| | | where 1=1 |
| | | and loc_sts = 'O' |
| | | and row1 in (1,4,5,8,9,12,13,16,17,20) |
| | | ) |
| | | and (loc_sts = 'F' or loc_sts = 'D') and crn_no = #{crnNo} |
| | | </select> |
| | | |
| | | <select id="querySame" resultMap="BaseResultMap"> |
| | | select l.* from asr_loc_mast l,asr_loc_detl d where 1=1 |
| | | and l.loc_no = d.loc_no |
| | | and d.matnr = #{matnr} |
| | | and l.lev1 = #{lev1} |
| | | and l.loc_sts = 'F' |
| | | <select id="getLevList" resultType="integer"> |
| | | select DISTINCT lev1 from asr_loc_mast |
| | | </select> |
| | | |
| | | </mapper> |