| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
| | | import com.zy.asrs.framework.common.R;
|
| | | import com.zy.asrs.framework.exception.CoolException;
|
| | | import com.zy.asrs.wms.asrs.entity.*;
|
| | | import com.zy.asrs.wms.asrs.entity.enums.LocAreaTypeSts;
|
| | |
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import java.util.*;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | @Service("locDetlService")
|
| | | public class LocDetlServiceImpl extends ServiceImpl<LocDetlMapper, LocDetl> implements LocDetlService {
|
| | |
| | | public List<LocDetl> queryStock(String matnr, String batch, List<FieldParam> param, List<FieldSortParam> sortParam) {
|
| | | List<Map<String, Object>> list = viewLocDetlMapper.queryStock(matnr, batch, param, sortParam, LocAreaTypeSts.LOC_AREA_TYPE_UTC.id);
|
| | | List<LocDetl> locDetlsSort = resortDetls(list);
|
| | | return locDetlsSort;
|
| | | return locDetlsSort.stream().sorted(Comparator.comparing(LocDetl::getCreateTime)).collect(Collectors.toList());
|
| | | }
|
| | |
|
| | | private List<LocDetl> resortDetls(List<Map<String, Object>> list) {
|
| | |
| | |
|
| | | for (Integer row : direction) {
|
| | | Loc one = locService.getOne(new LambdaQueryWrapper<Loc>()
|
| | | .select(Loc::getId)
|
| | | .eq(Loc::getRow1, row)
|
| | | .eq(Loc::getBay1, loc.getBay1())
|
| | | .eq(Loc::getLev1, loc.getLev1()));
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void removeLocDetl(Long locId) {
|
| | | List<LocDetl> locDetls = this.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, locId));
|
| | | for (LocDetl locDetl : locDetls) {
|
| | | boolean remove = locDetlFieldService.remove(new LambdaQueryWrapper<LocDetlField>().eq(LocDetlField::getDetlId, locDetl.getId()));
|
| | | if (!remove) {
|
| | | throw new CoolException("扩展字段删除失败");
|
| | | }
|
| | |
|
| | | // if (!remove) {
|
| | | // throw new CoolException("扩展字段删除失败");
|
| | | // }
|
| | | boolean result = this.removeById(locDetl.getId());
|
| | | if (!result) {
|
| | | throw new CoolException("明细删除失败");
|
| | | }
|
| | | // if (!result) {
|
| | | // throw new CoolException("明细删除失败");
|
| | | // }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | });
|
| | | return detls;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取所有库存数量
|
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public R getAllStockQty() {
|
| | | Map<String, Double> map = new HashMap<>();
|
| | | Double allQty = this.baseMapper.getAllStock();
|
| | | map.put("allQty", allQty);
|
| | | return R.ok().add(map);
|
| | | }
|
| | | }
|