| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.model.LocDto; |
| | | import com.zy.common.model.TaskDto; |
| | | import com.zy.common.utils.RoleUtils; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D); |
| | | if (issued <= 0.0D) { continue; } |
| | | List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist); |
| | | for (LocDetl locDetl : locDetls) { |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | | issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued); |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), issued >= locDetl.getAnfme() ? 101 : 103); |
| | | locDto.setStaNos(staNos); |
| | | locDtos.add(locDto); |
| | | exist.add(locDetl.getLocNo()); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | } else { |
| | | List<LocDetl> locDetls = new ArrayList<>(); |
| | | switch (RoleUtils.outRole(getUserId())) { |
| | | case "stacker_hangar": |
| | | locDetls = locDetlService.queryStockCrn(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist); |
| | | break; |
| | | } |
| | | case "four_directional_library": |
| | | locDetls = locDetlService.queryStockFour(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist); |
| | | break; |
| | | case "ctu_library": |
| | | locDetls = locDetlService.queryStockMinAnfme(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist); |
| | | break; |
| | | case "all": |
| | | locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist); |
| | | break; |
| | | } |
| | | for (LocDetl locDetl : locDetls) { |
| | | if (RoleUtils.outRole(getUserId()).equals("four_directional_library")){ |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo())); |
| | | List<LocMast> locMasts = new ArrayList<>(); |
| | | if (locMast.getBay1() >=1 && locMast.getBay1()<=2){ |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("gro1", locMast.getGro1()) |
| | | .eq("crn_no", 7) |
| | | .eq("lev1",locMast.getLocType1()) |
| | | .orderBy("bay1", false)); |
| | | }else if (locMast.getBay1() >=4 && locMast.getBay1()<=12){ |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("gro1", locMast.getGro1()) |
| | | .eq("crn_no", 7) |
| | | .eq("lev1",locMast.getLocType1()) |
| | | .orderBy("bay1", true)); |
| | | }else { |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("gro1", locMast.getGro1()) |
| | | .eq("crn_no", 7) |
| | | .eq("lev1",locMast.getLocType1()) |
| | | .orderBy("bay1", false)); |
| | | } |
| | | for (LocMast locMast1 : locMasts){ |
| | | if (locMast1.getLocSts().equals("F")){ |
| | | LocDetl locDetl1 = locDetlService.selectOne(new EntityWrapper<LocDetl>() |
| | | .eq("loc_No", locMast1.getLocNo()) |
| | | .eq("matnr", locDetl.getMatnr()).eq("batch", locDetl.getBatch())); |
| | | if (!Cools.isEmpty(locDetl1)) { |
| | | if (exist.add(locDetl.getLocNo())){ |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | | issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued); |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), issued >= locDetl.getAnfme() ? 101 : 103); |
| | | locDto.setStaNos(staNos); |
| | | locDtos.add(locDto); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | }else { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | }else { |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | | issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued); |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), issued >= locDetl.getAnfme() ? 101 : 103); |
| | | locDto.setStaNos(staNos); |
| | | locDtos.add(locDto); |
| | | exist.add(locDetl.getLocNo()); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | }else { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued); |
| | |
| | | // ------------------------------------------------- |
| | | |
| | | List<LocDetl> queryStock(@Param("matnr")String matnr, @Param("batch")String batch, @Param("orderNo")String orderNo, @Param("locNos") Set<String> locNos); |
| | | List<LocDetl> queryStockCrn(@Param("matnr")String matnr, @Param("batch")String batch, @Param("orderNo")String orderNo, @Param("locNos") Set<String> locNos); |
| | | List<LocDetl> queryStockFour(@Param("matnr")String matnr, @Param("batch")String batch, @Param("orderNo")String orderNo, @Param("locNos") Set<String> locNos); |
| | | |
| | | |
| | | Double queryStockAnfme(String matnr, String batch); |
| | | |
| | |
| | | List<LocDetl> selectLocDetlUnilateralMoveShuttleY(@Param("matnr")String matnr,@Param("batch")String batch,@Param("grade")String grade); |
| | | List<LocDetl> selectLocDetlUnilateralMoveShuttleN(@Param("matnr")String matnr,@Param("batch")String batch,@Param("grade")String grade); |
| | | |
| | | List<LocDetl> queryStockMinAnfme(@Param("matnr")String matnr, @Param("batch")String batch, @Param("orderNo")String orderNo, @Param("locNos") Set<String> locNos); |
| | | } |
| | |
| | | // -------------------------------------------------- |
| | | |
| | | List<LocDetl> queryStock(String matnr, String batch, String orderNo, Set<String> locNos); |
| | | List<LocDetl> queryStockCrn(String matnr, String batch, String orderNo, Set<String> locNos); |
| | | List<LocDetl> queryStockFour(String matnr, String batch, String orderNo, Set<String> locNos); |
| | | List<LocDetl> queryStockMinAnfme(String matnr, String batch, String orderNo, Set<String> locNos); |
| | | |
| | | Double queryStockAnfme(String matnr, String batch); |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<LocDetl> queryStockCrn(String matnr, String batch, String orderNo, Set<String> locNos) { |
| | | return this.baseMapper.queryStockCrn(matnr, batch, orderNo, locNos); |
| | | } |
| | | |
| | | @Override |
| | | public List<LocDetl> queryStockFour(String matnr, String batch, String orderNo, Set<String> locNos) { |
| | | return this.baseMapper.queryStockFour(matnr, batch, orderNo, locNos); |
| | | } |
| | | |
| | | @Override |
| | | public List<LocDetl> queryStockMinAnfme(String matnr, String batch, String orderNo, Set<String> locNos) { |
| | | return this.baseMapper.queryStockMinAnfme(matnr, batch, orderNo, locNos); |
| | | } |
| | | |
| | | @Override |
| | | public Double queryStockAnfme(String matnr, String batch) { |
| | | return this.baseMapper.queryStockAnfme(matnr, batch); |
| | | } |
| | |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("gro1", locMastWrk.getGro1()) |
| | | .eq("crn_no", 7) |
| | | .eq("lev1",locTypeDto.getLocType1()) |
| | | .orderBy("bay1", true)); |
| | | }else if (locMastWrk.getBay1() >=4 && locMastWrk.getBay1()<=12){ |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("gro1", locMastWrk.getGro1()) |
| | | .eq("crn_no", 7) |
| | | .eq("lev1",locTypeDto.getLocType1()) |
| | | .orderBy("bay1", false)); |
| | | }else { |
| | | locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("gro1", locMastWrk.getGro1()) |
| | | .eq("crn_no", 7) |
| | | .eq("lev1",locTypeDto.getLocType1()) |
| | | .orderBy("bay1", true)); |
| | | } |
| | | if (Cools.isEmpty(locMasts)) { |
| | |
| | | .eq("bay1", nearRow) |
| | | .eq("loc_sts", "O").eq("whs_type",rowLastnoType.getType().longValue()) |
| | | .eq("crn_no",7) |
| | | .eq("loc_type1",locTypeDto.getLocType1()) |
| | | .orderBy("lev1",true).orderBy("row1",false));//最浅库位 |
| | | |
| | | for (LocMast locMast1 : locMasts) { |
| | |
| | | locMasts1 = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("gro1", locMast1.getGro1()) |
| | | .eq("crn_no",7) |
| | | .eq("loc_type1",locTypeDto.getLocType1()) |
| | | .orderBy("bay1",true)); |
| | | if(locMasts1.size() == 3 || (curRow>20 && locMasts1.size() == 2)){ |
| | | if(locMast1.getBay1()>= 4 && locMast1.getBay1()<=12){ |
| | | locMasts1 = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("gro1", locMast1.getGro1()) |
| | | .eq("crn_no",7) |
| | | .eq("loc_type1",locTypeDto.getLocType1()) |
| | | .orderBy("bay1",false)); |
| | | } |
| | | }else { |
| | | locMasts1 = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("gro1", locMast1.getGro1()) |
| | | .eq("crn_no",7) |
| | | .eq("loc_type1",locTypeDto.getLocType1()) |
| | | .orderBy("bay1",false)); |
| | | } |
| | | if (Cools.isEmpty(locMasts1)) { |
| | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | //未找到 允许混料 |
| | | if (Cools.isEmpty(locMast) && Utils.BooleanWhsTypeStaIoType(rowLastno)){ |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | | } |
| | | if (Utils.BooleanWhsTypeStaIoType(rowLastno)){ |
| | | //获取目标库位所在巷道并排序 |
| | | // List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,locMast1.getLocNo(), curRow>nearRow); |
| | | |
| | | //获取目标库位所在巷道最浅非空库位 |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRow,nearRow,locMast1,rowLastnoType.getType().longValue()); |
| | | if (Cools.isEmpty(locMast2)) { |
| | | LocMast locMast3 = locMastService.selectLocByLocStsPakInO(curRow,nearRow,locMast1,rowLastnoType.getType().longValue()); |
| | | if (!Cools.isEmpty(locMast3)) { |
| | | locMast = locMast3; |
| | | break; |
| | | } |
| | | } else { |
| | | if ((locMast2.getLocSts().equals("F") && staDescId == 1) || (locMast2.getLocSts().equals("D") && staDescId == 10)){ |
| | | LocMast locMast3 = locMastService.selectLocByLocStsPakInO(curRow,nearRow,locMast1,rowLastnoType.getType().longValue()); |
| | | if (!Cools.isEmpty(locMast3)) { |
| | | locMast = locMast3; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | @Component |
| | | public class RoleUtils { |
| | | /** |
| | | * 以角色继承角色显示出指定库信息按堆垛机限制 |
| | | */ |
| | | public static <T> String outRole(Long userId) { |
| | | // super账号 |
| | | if (userId == 9527) { |
| | | return "all"; |
| | | } |
| | | |
| | | UserService userService = SpringUtils.getBean(UserService.class); |
| | | User user = userService.selectById(userId); |
| | | String roleName = user.getRoleName(); |
| | | |
| | | // 管理员角色 |
| | | if (Cools.isEmpty(roleName)) { |
| | | |
| | | } else if (roleName.equals("管理员")) { |
| | | return "all"; |
| | | } |
| | | |
| | | // 其他角色看继承角色 |
| | | String roleLeaderCode = user.getRoleLeaderCode(); |
| | | if (Cools.isEmpty(roleLeaderCode)) { |
| | | |
| | | } else if (roleLeaderCode.equals("stacker_hangar")) { // 堆垛机库 |
| | | return "stacker_hangar"; |
| | | } else if (roleLeaderCode.equals("four_directional_library")) { // 四向库 |
| | | return "four_directional_library"; |
| | | } else if (roleLeaderCode.equals("ctu_library")) { // ctu库 |
| | | return "ctu_library"; |
| | | |
| | | } |
| | | return "all"; |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 以角色继承角色显示出指定库信息按堆垛机限制 |
| | |
| | | order by row1 |
| | | </select> |
| | | |
| | | <select id="queryStockMinAnfme" resultMap="BaseResultMap"> |
| | | select a.* |
| | | from asr_loc_detl a |
| | | left join asr_loc_mast b on a.loc_no = b.loc_no |
| | | where 1=1 |
| | | and b.loc_sts = 'F' |
| | | and a.matnr = #{matnr} |
| | | and b.crn_no in (8,9) |
| | | <if test="batch != null and batch != ''"> |
| | | and a.batch = #{batch} |
| | | </if> |
| | | <if test="orderNo != null and orderNo != ''"> |
| | | and a.order_no = #{orderNo} |
| | | </if> |
| | | |
| | | <if test="locNos != null and locNos.size > 0"> |
| | | and b.loc_no not in |
| | | <foreach item="item" collection="locNos" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | |
| | | order by |
| | | a.anfme asc,DATEPART(yyyy,a.modi_time),DATEPART(mm,a.modi_time),DATEPART(dd,a.modi_time) |
| | | desc, |
| | | NEWID(), |
| | | case |
| | | when (left(a.loc_no, 2) = '01') then 0 |
| | | when (left(a.loc_no, 2) = '02') then 1 |
| | | when (left(a.loc_no, 2) = '03') then 1 |
| | | when (left(a.loc_no, 2) = '04') then 0 |
| | | when (left(a.loc_no, 2) = '05') then 0 |
| | | when (left(a.loc_no, 2) = '06') then 1 |
| | | when (left(a.loc_no, 2) = '07') then 1 |
| | | when (left(a.loc_no, 2) = '08') then 0 |
| | | when (left(a.loc_no, 2) = '09') then 0 |
| | | when (left(a.loc_no, 2) = '10') then 1 |
| | | when (left(a.loc_no, 2) = '11') then 1 |
| | | when (left(a.loc_no, 2) = '12') then 0 |
| | | when (left(a.loc_no, 2) = '13') then 0 |
| | | when (left(a.loc_no, 2) = '14') then 1 |
| | | when (left(a.loc_no, 2) = '15') then 1 |
| | | when (left(a.loc_no, 2) = '16') then 0 |
| | | when (left(a.loc_no, 2) = '17') then 0 |
| | | when (left(a.loc_no, 2) = '18') then 1 |
| | | when (left(a.loc_no, 2) = '19') then 1 |
| | | when (left(a.loc_no, 2) = '20') then 0 |
| | | when (left(a.loc_no, 2) = '21') then 0 |
| | | when (left(a.loc_no, 2) = '22') then 1 |
| | | when (left(a.loc_no, 2) = '23') then 1 |
| | | when (left(a.loc_no, 2) = '24') then 0 |
| | | when (left(a.loc_no, 2) = '25') then 0 |
| | | when (left(a.loc_no, 2) = '26') then 1 |
| | | when (left(a.loc_no, 2) = '27') then 1 |
| | | when (left(a.loc_no, 2) = '28') then 0 |
| | | when (left(a.loc_no, 2) = '29') then 0 |
| | | when (left(a.loc_no, 2) = '30') then 1 |
| | | when (left(a.loc_no, 2) = '31') then 1 |
| | | when (left(a.loc_no, 2) = '32') then 0 |
| | | when (left(a.loc_no, 2) = '33') then 0 |
| | | when (left(a.loc_no, 2) = '34') then 1 |
| | | when (left(a.loc_no, 2) = '35') then 1 |
| | | when (left(a.loc_no, 2) = '36') then 0 |
| | | when (left(a.loc_no, 2) = '37') then 0 |
| | | when (left(a.loc_no, 2) = '38') then 1 |
| | | when (left(a.loc_no, 2) = '39') then 1 |
| | | when (left(a.loc_no, 2) = '40') then 0 |
| | | when (left(a.loc_no, 2) = '41') then 0 |
| | | when (left(a.loc_no, 2) = '42') then 1 |
| | | when (left(a.loc_no, 2) = '43') then 1 |
| | | when (left(a.loc_no, 2) = '44') then 0 |
| | | when (left(a.loc_no, 2) = '45') then 0 |
| | | when (left(a.loc_no, 2) = '46') then 1 |
| | | when (left(a.loc_no, 2) = '47') then 1 |
| | | when (left(a.loc_no, 2) = '48') then 0 |
| | | else 0 |
| | | end |
| | | desc |
| | | </select> |
| | | |
| | | |
| | | <select id="queryStockCrn" resultMap="BaseResultMap"> |
| | | select a.* |
| | | from asr_loc_detl a |
| | | left join asr_loc_mast b on a.loc_no = b.loc_no |
| | | where 1=1 |
| | | and b.loc_sts = 'F' |
| | | and a.matnr = #{matnr} |
| | | and b.crn_no in (1,2,3,4) |
| | | <!-- <choose>--> |
| | | <!-- <when test="batch != null and batch != ''">--> |
| | | <!-- and a.batch = #{batch}--> |
| | | <!-- </when>--> |
| | | <!-- <otherwise>--> |
| | | <!-- and (a.batch IS NULL OR a.batch = '')--> |
| | | <!-- </otherwise>--> |
| | | <!-- </choose>--> |
| | | <if test="batch != null and batch != ''"> |
| | | and a.batch = #{batch} |
| | | </if> |
| | | <if test="orderNo != null and orderNo != ''"> |
| | | and a.order_no = #{orderNo} |
| | | </if> |
| | | |
| | | <if test="locNos != null and locNos.size > 0"> |
| | | and b.loc_no not in |
| | | <foreach item="item" collection="locNos" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | |
| | | order by |
| | | DATEPART(yyyy,a.modi_time),DATEPART(mm,a.modi_time),DATEPART(dd,a.modi_time), a.anfme |
| | | desc, |
| | | NEWID(), |
| | | case |
| | | when (left(a.loc_no, 2) = '01') then 0 |
| | | when (left(a.loc_no, 2) = '02') then 1 |
| | | when (left(a.loc_no, 2) = '03') then 1 |
| | | when (left(a.loc_no, 2) = '04') then 0 |
| | | when (left(a.loc_no, 2) = '05') then 0 |
| | | when (left(a.loc_no, 2) = '06') then 1 |
| | | when (left(a.loc_no, 2) = '07') then 1 |
| | | when (left(a.loc_no, 2) = '08') then 0 |
| | | when (left(a.loc_no, 2) = '09') then 0 |
| | | when (left(a.loc_no, 2) = '10') then 1 |
| | | when (left(a.loc_no, 2) = '11') then 1 |
| | | when (left(a.loc_no, 2) = '12') then 0 |
| | | when (left(a.loc_no, 2) = '13') then 0 |
| | | when (left(a.loc_no, 2) = '14') then 1 |
| | | when (left(a.loc_no, 2) = '15') then 1 |
| | | when (left(a.loc_no, 2) = '16') then 0 |
| | | when (left(a.loc_no, 2) = '17') then 0 |
| | | when (left(a.loc_no, 2) = '18') then 1 |
| | | when (left(a.loc_no, 2) = '19') then 1 |
| | | when (left(a.loc_no, 2) = '20') then 0 |
| | | when (left(a.loc_no, 2) = '21') then 0 |
| | | when (left(a.loc_no, 2) = '22') then 1 |
| | | when (left(a.loc_no, 2) = '23') then 1 |
| | | when (left(a.loc_no, 2) = '24') then 0 |
| | | when (left(a.loc_no, 2) = '25') then 0 |
| | | when (left(a.loc_no, 2) = '26') then 1 |
| | | when (left(a.loc_no, 2) = '27') then 1 |
| | | when (left(a.loc_no, 2) = '28') then 0 |
| | | when (left(a.loc_no, 2) = '29') then 0 |
| | | when (left(a.loc_no, 2) = '30') then 1 |
| | | when (left(a.loc_no, 2) = '31') then 1 |
| | | when (left(a.loc_no, 2) = '32') then 0 |
| | | when (left(a.loc_no, 2) = '33') then 0 |
| | | when (left(a.loc_no, 2) = '34') then 1 |
| | | when (left(a.loc_no, 2) = '35') then 1 |
| | | when (left(a.loc_no, 2) = '36') then 0 |
| | | when (left(a.loc_no, 2) = '37') then 0 |
| | | when (left(a.loc_no, 2) = '38') then 1 |
| | | when (left(a.loc_no, 2) = '39') then 1 |
| | | when (left(a.loc_no, 2) = '40') then 0 |
| | | when (left(a.loc_no, 2) = '41') then 0 |
| | | when (left(a.loc_no, 2) = '42') then 1 |
| | | when (left(a.loc_no, 2) = '43') then 1 |
| | | when (left(a.loc_no, 2) = '44') then 0 |
| | | when (left(a.loc_no, 2) = '45') then 0 |
| | | when (left(a.loc_no, 2) = '46') then 1 |
| | | when (left(a.loc_no, 2) = '47') then 1 |
| | | when (left(a.loc_no, 2) = '48') then 0 |
| | | else 0 |
| | | end |
| | | desc |
| | | </select> |
| | | |
| | | <select id="queryStockFour" resultMap="BaseResultMap"> |
| | | select a.* |
| | | from asr_loc_detl a |
| | | left join asr_loc_mast b on a.loc_no = b.loc_no |
| | | where 1=1 |
| | | and b.loc_sts = 'F' |
| | | and a.matnr = #{matnr} |
| | | and b.crn_no in (7) |
| | | <!-- <choose>--> |
| | | <!-- <when test="batch != null and batch != ''">--> |
| | | <!-- and a.batch = #{batch}--> |
| | | <!-- </when>--> |
| | | <!-- <otherwise>--> |
| | | <!-- and (a.batch IS NULL OR a.batch = '')--> |
| | | <!-- </otherwise>--> |
| | | <!-- </choose>--> |
| | | <if test="batch != null and batch != ''"> |
| | | and a.batch = #{batch} |
| | | </if> |
| | | <if test="orderNo != null and orderNo != ''"> |
| | | and a.order_no = #{orderNo} |
| | | </if> |
| | | |
| | | <if test="locNos != null and locNos.size > 0"> |
| | | and b.loc_no not in |
| | | <foreach item="item" collection="locNos" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | |
| | | order by |
| | | DATEPART(yyyy,a.modi_time),DATEPART(mm,a.modi_time),DATEPART(dd,a.modi_time), a.anfme |
| | | desc, |
| | | NEWID(), |
| | | case |
| | | when (left(a.loc_no, 2) = '01') then 0 |
| | | when (left(a.loc_no, 2) = '02') then 1 |
| | | when (left(a.loc_no, 2) = '03') then 1 |
| | | when (left(a.loc_no, 2) = '04') then 0 |
| | | when (left(a.loc_no, 2) = '05') then 0 |
| | | when (left(a.loc_no, 2) = '06') then 1 |
| | | when (left(a.loc_no, 2) = '07') then 1 |
| | | when (left(a.loc_no, 2) = '08') then 0 |
| | | when (left(a.loc_no, 2) = '09') then 0 |
| | | when (left(a.loc_no, 2) = '10') then 1 |
| | | when (left(a.loc_no, 2) = '11') then 1 |
| | | when (left(a.loc_no, 2) = '12') then 0 |
| | | when (left(a.loc_no, 2) = '13') then 0 |
| | | when (left(a.loc_no, 2) = '14') then 1 |
| | | when (left(a.loc_no, 2) = '15') then 1 |
| | | when (left(a.loc_no, 2) = '16') then 0 |
| | | when (left(a.loc_no, 2) = '17') then 0 |
| | | when (left(a.loc_no, 2) = '18') then 1 |
| | | when (left(a.loc_no, 2) = '19') then 1 |
| | | when (left(a.loc_no, 2) = '20') then 0 |
| | | when (left(a.loc_no, 2) = '21') then 0 |
| | | when (left(a.loc_no, 2) = '22') then 1 |
| | | when (left(a.loc_no, 2) = '23') then 1 |
| | | when (left(a.loc_no, 2) = '24') then 0 |
| | | when (left(a.loc_no, 2) = '25') then 0 |
| | | when (left(a.loc_no, 2) = '26') then 1 |
| | | when (left(a.loc_no, 2) = '27') then 1 |
| | | when (left(a.loc_no, 2) = '28') then 0 |
| | | when (left(a.loc_no, 2) = '29') then 0 |
| | | when (left(a.loc_no, 2) = '30') then 1 |
| | | when (left(a.loc_no, 2) = '31') then 1 |
| | | when (left(a.loc_no, 2) = '32') then 0 |
| | | when (left(a.loc_no, 2) = '33') then 0 |
| | | when (left(a.loc_no, 2) = '34') then 1 |
| | | when (left(a.loc_no, 2) = '35') then 1 |
| | | when (left(a.loc_no, 2) = '36') then 0 |
| | | when (left(a.loc_no, 2) = '37') then 0 |
| | | when (left(a.loc_no, 2) = '38') then 1 |
| | | when (left(a.loc_no, 2) = '39') then 1 |
| | | when (left(a.loc_no, 2) = '40') then 0 |
| | | when (left(a.loc_no, 2) = '41') then 0 |
| | | when (left(a.loc_no, 2) = '42') then 1 |
| | | when (left(a.loc_no, 2) = '43') then 1 |
| | | when (left(a.loc_no, 2) = '44') then 0 |
| | | when (left(a.loc_no, 2) = '45') then 0 |
| | | when (left(a.loc_no, 2) = '46') then 1 |
| | | when (left(a.loc_no, 2) = '47') then 1 |
| | | when (left(a.loc_no, 2) = '48') then 0 |
| | | else 0 |
| | | end |
| | | desc |
| | | </select> |
| | | |
| | | </mapper> |