浏览代码

bug修复

andy 3 年之前
父节点
当前提交
1d1bd7a60f

+ 25 - 2
ruoyi-admin/src/test/java/com/ruoyi/admin/test/base/WarehouseTest.java

@@ -2,12 +2,14 @@ package com.ruoyi.admin.test.base;
 
 import com.alibaba.fastjson.JSON;
 import com.ruoyi.RuoYiApplication;
+import com.ruoyi.ams.config.domain.AsnSoStrategy;
 import com.ruoyi.ams.config.domain.FlowConfigHeader;
 import com.ruoyi.ams.config.domain.dto.InWarehouseDTO;
 import com.ruoyi.ams.business.IBusinessService;
 import com.ruoyi.ams.config.domain.dto.LotattDTO;
 import com.ruoyi.ams.config.domain.dto.OutWarehouseDTO;
 import com.ruoyi.ams.config.domain.vo.FlowConfigHeaderVO;
+import com.ruoyi.ams.config.mapper.AsnSoStrategyMapper;
 import com.ruoyi.ams.config.service.IFlowConfigHeaderService;
 import com.ruoyi.ams.config.service.LocationAllocationStrategy;
 import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
@@ -21,12 +23,14 @@ import com.ruoyi.base.domain.vo.BaseLocationLotattVO;
 import com.ruoyi.base.mapper.BaseLocationInfoMapper;
 import com.ruoyi.base.mapper.BaseSkuMapper;
 import com.ruoyi.base.service.IBaseLocationInfoService;
+import com.ruoyi.base.service.IBaseLocationZoneService;
 import com.ruoyi.base.service.IBaseWarehouseService;
 import com.ruoyi.base.service.SysIdsequenceService;
 import com.ruoyi.framework.web.domain.server.Sys;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
@@ -64,6 +68,8 @@ public class WarehouseTest {
     private IBaseLocationInfoService baseLocationInfoService;
     @Autowired
     private IFlowConfigHeaderService flowConfigHeaderService;
+    @Autowired
+    private AsnSoStrategyMapper asnSoStrategyMapper;
 
     @Test
     public void test() {
@@ -79,7 +85,7 @@ public class WarehouseTest {
         inWarehouseDTO.setSku("test2");
         inWarehouseDTO.setWarehouseId(1L);
         inWarehouseDTO.setLotattDTO(lotattDTO);
-        BaseLocationInfo locationInfo = businessService.inLocationAllocation(inWarehouseDTO,1L);
+        BaseLocationInfo locationInfo = businessService.inLocationAllocation(inWarehouseDTO, 1L);
         if (locationInfo != null) {
             System.out.println("-------------------");
             System.out.println(locationInfo.getId());
@@ -94,7 +100,7 @@ public class WarehouseTest {
         outWarehouseDTO.setSku("test1");
         outWarehouseDTO.setWarehouseId(1L);
         outWarehouseDTO.setLotattDTO(lotattDTO);
-        BaseLocationInfo locationInfo = businessService.outInvAllocation(outWarehouseDTO,1L);
+        BaseLocationInfo locationInfo = businessService.outInvAllocation(outWarehouseDTO, 1L);
         if (locationInfo != null) {
             System.out.println("-------------------");
             System.out.println(locationInfo.getId());
@@ -141,4 +147,21 @@ public class WarehouseTest {
         List<FlowConfigHeader> flowConfigHeaderVOS = flowConfigHeaderService.sortFlowConfigHeader(8L);
         System.out.println(JSON.toJSONString(flowConfigHeaderVOS));
     }
+
+    @Test
+    public void test6() {
+        List<BaseLocationInfo> loc1 = baseLocationInfoService.selectSortedLocatinListByZoneId(2L, 1L);
+        //List<BaseLocationInfo> loc2 = baseLocationInfoService.selectSortedLocatinListByZoneId(1L,1L);
+        //List<BaseLocationInfo> loc3 = baseLocationInfoService.selectSortedLocatinListByZoneId(1L,1L);
+        List<Long> locationIdList = new ArrayList<>();
+        for (BaseLocationInfo b : loc1) {
+            locationIdList.add(b.getId());
+        }
+        List<OutWarehouseDTO> outWarehouseDTOs = new ArrayList<>();
+        OutWarehouseDTO sku1 = new OutWarehouseDTO();
+        sku1.setSku("");
+        AsnSoStrategy asnSoStrategy = asnSoStrategyMapper.selectAsnSoStrategy();
+        Long token = 100L;
+        locationAllocationStrategy.filterLockInv(locationIdList, outWarehouseDTOs, asnSoStrategy, token);
+    }
 }

+ 150 - 0
warewms-ams/src/main/java/com/ruoyi/ams/config/service/LocationAllocationStrategy.java

@@ -1,16 +1,20 @@
 package com.ruoyi.ams.config.service;
 
+import com.alibaba.fastjson.JSON;
 import com.ruoyi.ams.business.domain.LocationSortComparator;
 import com.ruoyi.ams.business.domain.LocationSortDTO;
 import com.ruoyi.ams.config.domain.AsnSoStrategy;
 import com.ruoyi.ams.config.domain.dto.InWarehouseDTO;
 import com.ruoyi.ams.config.domain.dto.OutWarehouseDTO;
 import com.ruoyi.base.domain.BaseLocationInfo;
+import com.ruoyi.base.domain.vo.BaseLocationLotattListVO;
 import com.ruoyi.base.domain.vo.BaseLocationLotattVO;
+import com.ruoyi.base.domain.vo.LotattInfo;
 import com.ruoyi.base.service.IBaseLocationInfoService;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.core.redis.RedisKey;
 import com.ruoyi.common.utils.StringUtils;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
@@ -23,6 +27,7 @@ import java.util.*;
  * User: andy.qu
  * Date: 2022/3/1
  */
+@Slf4j
 @Component
 public class LocationAllocationStrategy {
 
@@ -336,4 +341,149 @@ public class LocationAllocationStrategy {
         }
         return currentLocation;
     }
+
+    private Double checkOutedInvQty(OutWarehouseDTO ow, Map<String, List<LotattInfo>> lockInvList) {
+        Double qty = 0d;
+        for (Map.Entry<String, List<LotattInfo>> entry : lockInvList.entrySet()) {
+            List<LotattInfo> list = entry.getValue();
+            for (LotattInfo info : list) {
+                if (info.getSku().equals(ow.getSku())) {
+                    qty += info.getQty();
+                }
+            }
+        }
+        return qty;
+    }
+
+    /**
+     * 过滤库存信息
+     *
+     * @param locationIdList   库位id列表
+     * @param outWarehouseDTOs 物料
+     * @param asnSoStrategy    策略
+     * @param token            唯一token用来解锁加锁
+     * @return
+     */
+    public List<BaseLocationInfo> filterLockInv(List<Long> locationIdList, List<OutWarehouseDTO> outWarehouseDTOs, AsnSoStrategy asnSoStrategy, Long token) {
+        //取出范围内所有的库存
+        List<BaseLocationLotattListVO> locationLotattVOList = baseLocationInfoService.selectSortedLocatinListByZoneId(locationIdList, 1L, null, null);
+        List<BaseLocationInfo> result = new ArrayList<>(); //返回的结果
+        Map<String, List<LotattInfo>> lockInv = new HashMap<>(); //已锁定的库存列表(key:列名,value:库位库存)
+        //将同一列的库位排序好====================================================>
+        LinkedHashMap<String, Boolean> taskingFlag = new LinkedHashMap<>(); //任务中的列
+        LinkedHashMap<String, List<BaseLocationLotattListVO>> mapFloor = new LinkedHashMap<>(); //同一列的库存(key:列名,value:库位库存)地堆
+        LinkedHashMap<String, List<BaseLocationLotattListVO>> shelvesFloor = new LinkedHashMap<>(); //同一列的库存(key:列名,value:库位库存)货架
+        LinkedHashMap<String, String> skuTagMap = new LinkedHashMap<>(); //每列存放的物料分类(key:列名,value:sku)
+        List<LocationSortDTO> list = new ArrayList<>();//全部
+        List<LocationSortDTO> sameLotattList = new ArrayList<>(); //同批号
+        for (BaseLocationLotattListVO info : locationLotattVOList) {
+            List<BaseLocationLotattListVO> infoList;
+            if (info.getLocationType().equals("1")) {
+                if (shelvesFloor.containsKey(info.getColNo())) {
+                    infoList = shelvesFloor.get(info.getColNo());
+                } else {
+                    infoList = new ArrayList<>();
+                }
+            } else {
+                if (mapFloor.containsKey(info.getColNo())) {
+                    infoList = mapFloor.get(info.getColNo());
+                } else {
+                    infoList = new ArrayList<>();
+                }
+            }
+
+            if (info.getColNo() != null) {
+                if (skuTagMap.containsKey(info.getColNo())) {
+                    String tmp = skuTagMap.get(info.getColNo());
+                    StringBuffer sb = new StringBuffer(tmp);
+                    List<LotattInfo> lotattInfoList = info.getLotattInfoList();
+                    if (info.getLotattInfoList() != null && info.getLotattInfoList().size() > 0) {
+                        for (LotattInfo lot : lotattInfoList) {
+                            if (lot.getSku() == null || tmp.contains(lot.getSku())) {
+                                continue;
+                            }
+                            sb.append(",");
+                            sb.append(lot.getSku());
+                        }
+                        if (sb.length() > 0) {
+                            skuTagMap.put(info.getColNo(), sb.toString());
+                        }
+                    }
+                } else {
+                    StringBuffer sb = new StringBuffer("");
+                    List<LotattInfo> lotattInfoList = info.getLotattInfoList();
+                    if (info.getLotattInfoList() != null && info.getLotattInfoList().size() > 0) {
+                        for (LotattInfo lot : lotattInfoList) {
+                            if (lot.getSku() == null || sb.toString().contains(lot.getSku())) {
+                                continue;
+                            }
+                            sb.append(",");
+                            sb.append(lot.getSku());
+                        }
+                        if (sb.length() > 0) {
+                            skuTagMap.put(info.getColNo(), sb.toString());
+                        }
+                    }
+                }
+            }
+
+            if (info.getStockStatus().equals("10") || redisCache.checkIsLock(RedisKey.LOCK_LOCATION + info.getId())) {
+                taskingFlag.put(info.getColNo(), true);
+                lockInv.put(info.getId().toString(), info.getLotattInfoList());
+                //如果在任务中跳过该库存
+            } else {
+                if (taskingFlag.get(info.getColNo()) == null || taskingFlag.get(info.getColNo()).booleanValue() == false) {
+                    taskingFlag.put(info.getColNo(), false);
+                }
+            }
+            infoList.add(info);
+            if (info.getLocationType().equals("1")) {
+                mapFloor.put(info.getColNo(), infoList);
+            } else {
+                shelvesFloor.put(info.getColNo(), infoList);
+            }
+
+            String period = "";
+            if (asnSoStrategy.getSoPeriodFlag().equals("optimization") || asnSoStrategy.getSoPeriodFlag().equals("force")) {
+                info.getLotattInfoList().get(0).initLotatt();
+                period = info.getLotattInfoList().get(0).getAttMap().get(asnSoStrategy.getSoPeriodLotatt());
+            }
+            LocationSortDTO sortDTO = new LocationSortDTO(info.getColNo(), period);
+            list.add(sortDTO);
+
+            if (asnSoStrategy.getSoSameLotatt1Flag().equals("optimization")) {
+                String lotattValue = redisCache.getCacheObject(asnSoStrategy.getAsnSameLotatt1Value());
+                if (!StringUtils.isEmpty(lotattValue)) {
+                    if (!StringUtils.isEmpty(info.getLotattInfoList().get(0).getAttMap().get(asnSoStrategy.getSoSameLotatt1Value())) && info.getLotattInfoList().get(0).getAttMap().get(asnSoStrategy.getSoSameLotatt1Value()).equals(lotattValue)) {
+                        sameLotattList.add(sortDTO);
+                    }
+                }
+            }
+        }
+        //=========================================================>
+        log.info("检索的库存范围:" + JSON.toJSONString(locationLotattVOList));
+        log.info("列的任务状态:" + JSON.toJSONString(taskingFlag));
+        log.info("每列存放的物料分类:" + JSON.toJSONString(skuTagMap));
+
+        for (OutWarehouseDTO ow : outWarehouseDTOs) {
+            //先去已锁定的库存中查询是否有可以扣减的库存
+            Double qty = checkOutedInvQty(ow, lockInv);
+            if (qty >= ow.getQty()) {
+                continue;
+            }
+            //过滤出每列可以用的库位并进行分配
+            BaseLocationInfo currentLocation = null;
+            BaseLocationLotattListVO currentLocationLotatt = null;
+            //地堆
+            for (Map.Entry<String, List<BaseLocationLotattListVO>> invList : mapFloor.entrySet()) {
+                
+            }
+            //货架
+            for (Map.Entry<String, List<BaseLocationLotattListVO>> invList : shelvesFloor.entrySet()) {
+
+            }
+        }
+
+        return result;
+    }
 }

+ 2 - 0
warewms-base/src/main/java/com/ruoyi/base/mapper/BaseLocationInfoMapper.java

@@ -164,4 +164,6 @@ public interface BaseLocationInfoMapper {
      * @return
      */
     List<BaseLocationInfo> selectLocationByColNos(@Param("colNos") List<String> colNos);
+
+
 }

+ 29 - 24
warewms-base/src/main/java/com/ruoyi/base/service/IBaseLocationInfoService.java

@@ -11,74 +11,74 @@ import org.apache.ibatis.annotations.Param;
 
 /**
  * 库位信息Service接口
- * 
+ *
  * @author andy
  * @date 2022-02-18
  */
-public interface IBaseLocationInfoService 
-{
+public interface IBaseLocationInfoService {
     /**
      * 查询库位信息
-     * 
+     *
      * @param id 库位信息主键
      * @return 库位信息
      */
-     BaseLocationInfo selectBaseLocationInfoById(Long id);
+    BaseLocationInfo selectBaseLocationInfoById(Long id);
 
     /**
      * 根据id或者编号查询库位信息
+     *
      * @param idOrNo
      * @param warehouseId
      * @return
      */
-     BaseLocationInfo selectBaseLocationInfoByIdOrNo(String idOrNo,Long warehouseId);
+    BaseLocationInfo selectBaseLocationInfoByIdOrNo(String idOrNo, Long warehouseId);
 
     /**
      * 查询库位信息列表
-     * 
+     *
      * @param baseLocationInfo 库位信息
      * @return 库位信息集合
      */
-     List<BaseLocationInfo> selectBaseLocationInfoList(BaseLocationInfo baseLocationInfo);
+    List<BaseLocationInfo> selectBaseLocationInfoList(BaseLocationInfo baseLocationInfo);
 
     /**
      * 新增库位信息
-     * 
+     *
      * @param baseLocationInfo 库位信息
      * @return 结果
      */
-     int insertBaseLocationInfo(BaseLocationInfo baseLocationInfo);
+    int insertBaseLocationInfo(BaseLocationInfo baseLocationInfo);
 
     /**
      * 修改库位信息
-     * 
+     *
      * @param baseLocationInfo 库位信息
      * @return 结果
      */
-     int updateBaseLocationInfo(BaseLocationInfo baseLocationInfo);
+    int updateBaseLocationInfo(BaseLocationInfo baseLocationInfo);
 
     /**
      * 批量删除库位信息
-     * 
+     *
      * @param ids 需要删除的库位信息主键集合
      * @return 结果
      */
-     int deleteBaseLocationInfoByIds(Long[] ids);
+    int deleteBaseLocationInfoByIds(Long[] ids);
 
     /**
      * 删除库位信息信息
-     * 
+     *
      * @param id 库位信息主键
      * @return 结果
      */
-     int deleteBaseLocationInfoById(Long id);
+    int deleteBaseLocationInfoById(Long id);
 
     /**
      * 构建前端所需要下拉树结构
      *
      * @return 下拉树结构列表
      */
-     List<TreeSelectVO> buildLocationTreeSelect();
+    List<TreeSelectVO> buildLocationTreeSelect();
 
     /**
      * 构建前端所需要树结构
@@ -86,48 +86,53 @@ public interface IBaseLocationInfoService
      * @param zoneId 库位列表
      * @return 树结构列表
      */
-     List<BasLocationTreeSelectVO> buildLocationTree(Long zoneId);
+    List<BasLocationTreeSelectVO> buildLocationTree(Long zoneId);
 
     /**
      * 检测是库位还是库区,由于下拉树库位和库区没有做区分所以用这个方法来判断下类型
-     * @param idOrNo id或者编号
+     *
+     * @param idOrNo      id或者编号
      * @param warehouseId 仓库id
      * @return
      */
-     boolean checkIsLocation(String idOrNo, Long warehouseId);
+    boolean checkIsLocation(String idOrNo, Long warehouseId);
 
     /**
      * 根据zoneId查询库位信息
      * 返回结果会根据排列层进行排序
+     *
      * @param zoneId
      * @param warehouseId
      * @return
      */
-    List<BaseLocationInfo> selectSortedLocatinListByZoneId(Long zoneId,Long warehouseId);
+    List<BaseLocationInfo> selectSortedLocatinListByZoneId(Long zoneId, Long warehouseId);
 
     /**
      * 根据zoneId查询库位信息
      * 返回结果会根据排列层进行排序,同库位多种物料的数据会合并
+     *
      * @param locationId
      * @param warehouseId
      * @param lotatt
      * @param sku
      * @return
      */
-    List<BaseLocationLotattListVO> selectSortedLocatinListByZoneId(List<Long> locationId,Long warehouseId, Map<String, String> lotatt,String sku);
+    List<BaseLocationLotattListVO> selectSortedLocatinListByZoneId(List<Long> locationId, Long warehouseId, Map<String, String> lotatt, String sku);
 
     /**
      * 更新库位状态
+     *
      * @param status
      * @return
      */
-    int updateLocationStockStatus(Long id,String status);
+    int updateLocationStockStatus(Long id, String status);
 
     /**
      * 查询相邻可以存放的库位
+     *
      * @param colNo
      * @param zoneId
      * @return
      */
-    List<BaseLocationInfo> selectNeighborLocation(String colNo,Long zoneId);
+    List<BaseLocationInfo> selectNeighborLocation(String colNo, Long zoneId);
 }

+ 21 - 19
warewms-base/src/main/resources/mapper/base/BaseLocationInfoMapper.xml

@@ -425,24 +425,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{item}
         </foreach>
         <if test="sku != null and sku != ''"> and (inv.sku = #{sku} or inv.sku is null)</if>
-        <if test="lotatt.lotatt01 != null and lotatt.lotatt01 != ''"> and att.lotatt01 = #{lotatt.lotatt01}</if>
-        <if test="lotatt.lotatt02 != null and lotatt.lotatt02 != ''"> and att.lotatt02 = #{lotatt.lotatt02}</if>
-        <if test="lotatt.lotatt03 != null and lotatt.lotatt03 != ''"> and att.lotatt03 = #{lotatt.lotatt03}</if>
-        <if test="lotatt.lotatt04 != null and lotatt.lotatt04 != ''"> and att.lotatt04 = #{lotatt.lotatt04}</if>
-        <if test="lotatt.lotatt05 != null and lotatt.lotatt05 != ''"> and att.lotatt05 = #{lotatt.lotatt05}</if>
-        <if test="lotatt.lotatt06 != null and lotatt.lotatt06 != ''"> and att.lotatt06 = #{lotatt.lotatt06}</if>
-        <if test="lotatt.lotatt07 != null and lotatt.lotatt07 != ''"> and att.lotatt07 = #{lotatt.lotatt07}</if>
-        <if test="lotatt.lotatt08 != null and lotatt.lotatt08 != ''"> and att.lotatt08 = #{lotatt.lotatt08}</if>
-        <if test="lotatt.lotatt09 != null and lotatt.lotatt09 != ''"> and att.lotatt09 = #{lotatt.lotatt09}</if>
-        <if test="lotatt.lotatt10 != null and lotatt.lotatt10 != ''"> and att.lotatt10 = #{lotatt.lotatt10}</if>
-        <if test="lotatt.lotatt11 != null and lotatt.lotatt11 != ''"> and att.lotatt11 = #{lotatt.lotatt11}</if>
-        <if test="lotatt.lotatt12 != null and lotatt.lotatt12 != ''"> and att.lotatt12 = #{lotatt.lotatt12}</if>
-        <if test="lotatt.lotatt13 != null and lotatt.lotatt13 != ''"> and att.lotatt13 = #{lotatt.lotatt13}</if>
-        <if test="lotatt.lotatt14 != null and lotatt.lotatt14 != ''"> and att.lotatt14 = #{lotatt.lotatt14}</if>
-        <if test="lotatt.lotatt15 != null and lotatt.lotatt15 != ''"> and att.lotatt15 = #{lotatt.lotatt15}</if>
-        <if test="lotatt.lotatt16 != null and lotatt.lotatt16 != ''"> and att.lotatt16 = #{lotatt.lotatt16}</if>
-        <if test="lotatt.lotatt17 != null and lotatt.lotatt17 != ''"> and att.lotatt17 = #{lotatt.lotatt17}</if>
-        <if test="lotatt.lotatt18 != null and lotatt.lotatt18 != ''"> and att.lotatt18 = #{lotatt.lotatt18}</if>
-        order by lpad(row_no, 11, '0'),row_index,lpad(shift_no, 11, '0'),shift_index,lpad(col_no, 11, '0'),col_index
+        <if test="lotatt != null">
+            <if test="lotatt.lotatt01 != null and lotatt.lotatt01 != ''"> and att.lotatt01 = #{lotatt.lotatt01}</if>
+            <if test="lotatt.lotatt02 != null and lotatt.lotatt02 != ''"> and att.lotatt02 = #{lotatt.lotatt02}</if>
+            <if test="lotatt.lotatt03 != null and lotatt.lotatt03 != ''"> and att.lotatt03 = #{lotatt.lotatt03}</if>
+            <if test="lotatt.lotatt04 != null and lotatt.lotatt04 != ''"> and att.lotatt04 = #{lotatt.lotatt04}</if>
+            <if test="lotatt.lotatt05 != null and lotatt.lotatt05 != ''"> and att.lotatt05 = #{lotatt.lotatt05}</if>
+            <if test="lotatt.lotatt06 != null and lotatt.lotatt06 != ''"> and att.lotatt06 = #{lotatt.lotatt06}</if>
+            <if test="lotatt.lotatt07 != null and lotatt.lotatt07 != ''"> and att.lotatt07 = #{lotatt.lotatt07}</if>
+            <if test="lotatt.lotatt08 != null and lotatt.lotatt08 != ''"> and att.lotatt08 = #{lotatt.lotatt08}</if>
+            <if test="lotatt.lotatt09 != null and lotatt.lotatt09 != ''"> and att.lotatt09 = #{lotatt.lotatt09}</if>
+            <if test="lotatt.lotatt10 != null and lotatt.lotatt10 != ''"> and att.lotatt10 = #{lotatt.lotatt10}</if>
+            <if test="lotatt.lotatt11 != null and lotatt.lotatt11 != ''"> and att.lotatt11 = #{lotatt.lotatt11}</if>
+            <if test="lotatt.lotatt12 != null and lotatt.lotatt12 != ''"> and att.lotatt12 = #{lotatt.lotatt12}</if>
+            <if test="lotatt.lotatt13 != null and lotatt.lotatt13 != ''"> and att.lotatt13 = #{lotatt.lotatt13}</if>
+            <if test="lotatt.lotatt14 != null and lotatt.lotatt14 != ''"> and att.lotatt14 = #{lotatt.lotatt14}</if>
+            <if test="lotatt.lotatt15 != null and lotatt.lotatt15 != ''"> and att.lotatt15 = #{lotatt.lotatt15}</if>
+            <if test="lotatt.lotatt16 != null and lotatt.lotatt16 != ''"> and att.lotatt16 = #{lotatt.lotatt16}</if>
+            <if test="lotatt.lotatt17 != null and lotatt.lotatt17 != ''"> and att.lotatt17 = #{lotatt.lotatt17}</if>
+            <if test="lotatt.lotatt18 != null and lotatt.lotatt18 != ''"> and att.lotatt18 = #{lotatt.lotatt18}</if>
+        </if>
+        order by lpad(row_no, 11, '0'),row_index,lpad(shift_no, 11, '0'),shift_index,lpad(col_no, 11, '0'),col_index desc
     </select>
 </mapper>