Junjie
2024-09-27 69e085fd101062814ac8d5413dacb87cc9a737e8
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/LocDetlServiceImpl.java
@@ -10,6 +10,7 @@
import com.zy.asrs.wms.asrs.entity.enums.LocStsType;
import com.zy.asrs.wms.asrs.entity.param.FieldParam;
import com.zy.asrs.wms.asrs.entity.param.FieldSortParam;
import com.zy.asrs.wms.asrs.entity.param.LocDetlFreezeParam;
import com.zy.asrs.wms.asrs.mapper.LocDetlMapper;
import com.zy.asrs.wms.asrs.mapper.ViewLocDetlMapper;
import com.zy.asrs.wms.asrs.service.LanewayRuleService;
@@ -20,6 +21,7 @@
import com.zy.asrs.wms.common.domain.PageParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
@@ -99,7 +101,7 @@
    @Override
    public List<LocDetl> queryStock(String matnr, String batch, List<FieldParam> param, List<FieldSortParam> sortParam) {
        List<Map<String, Object>> list = viewLocDetlMapper.getList(matnr, batch, param, sortParam);
        List<Map<String, Object>> list = viewLocDetlMapper.queryStock(matnr, batch, param, sortParam);
        List<LocDetl> locDetlsSort = resortDetls(list);
        return locDetlsSort;
    }
@@ -180,4 +182,32 @@
        return sortDirctDetls;
    }
    @Override
    @Transactional
    public void locDetlFreeze(LocDetlFreezeParam param) {
        if (param == null) {
            throw new CoolException("参数不能为空");
        }
        if (param.getDetlIds() == null) {
            throw new CoolException("库存明细参数不能为空");
        }
        if (param.getFreeze() == null) {
            throw new CoolException("冻结参数不能为空");
        }
        List<LocDetl> locDetls = this.listByIds(param.getDetlIds());
        if(locDetls.isEmpty()){
            throw new CoolException("库存不存在");
        }
        for (LocDetl locDetl : locDetls) {
            locDetl.setFreeze(param.getFreeze());
            locDetl.setUpdateTime(new Date());
            if (!this.updateById(locDetl)) {
                throw new CoolException("更新失败");
            }
        }
    }
}