From 05b8ccfc9eeadddd65e95ea82479c224d1516b4c Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期四, 07 八月 2025 19:19:33 +0800 Subject: [PATCH] no message --- zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/LocDetlServiceImpl.java | 53 ++++++++++++++++++++++++++++++++++------------------- 1 files changed, 34 insertions(+), 19 deletions(-) diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/LocDetlServiceImpl.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/LocDetlServiceImpl.java index afeaed7..0bdab34 100644 --- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/LocDetlServiceImpl.java +++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/LocDetlServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zy.asrs.framework.exception.CoolException; import com.zy.asrs.wms.asrs.entity.*; +import com.zy.asrs.wms.asrs.entity.enums.LocAreaTypeSts; 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; @@ -19,11 +20,13 @@ import com.zy.asrs.wms.asrs.service.LocService; import com.zy.asrs.wms.common.domain.BaseParam; import com.zy.asrs.wms.common.domain.PageParam; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; 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 { @@ -40,15 +43,14 @@ @Override public PageParam<ViewLocDetl, BaseParam> getPage(PageParam<ViewLocDetl, BaseParam> pageParam, QueryWrapper<ViewLocDetl> buildWrapper) { PageParam<ViewLocDetl, BaseParam> result = viewLocDetlMapper.selectPage(pageParam, buildWrapper); - //瑙f瀽鍔ㄦ�佸瓧娈� - JSONObject data = JSON.parseObject(JSON.toJSONString(result)); - List<ViewLocDetl> records = result.getRecords(); - data.put("records", records); - for (ViewLocDetl locDetl : records) { - Map<String, Object> resultMap = viewLocDetlMapper.getById(locDetl.getId()); - locDetl.syncFieldMap(resultMap); - } +// JSONObject data = JSON.parseObject(JSON.toJSONString(result)); +// List<ViewLocDetl> records = result.getRecords(); +// data.put("records", records); +// for (ViewLocDetl locDetl : records) { +// Map<String, Object> resultMap = viewLocDetlMapper.getById(locDetl.getId()); +// locDetl.syncFieldMap(resultMap); +// } return result; } @@ -101,9 +103,9 @@ @Override 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); + 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) { @@ -132,7 +134,7 @@ if (loc == null) { continue; } - + //褰撳墠搴撲綅鐘舵�佹槸鍚﹀湪搴� if(!loc.getLocStsId().equals(LocStsType.F.val())){ continue; } @@ -154,6 +156,7 @@ 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())); @@ -182,7 +185,7 @@ } @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public void locDetlFreeze(LocDetlFreezeParam param) { if (param == null) { throw new CoolException("鍙傛暟涓嶈兘涓虹┖"); @@ -211,18 +214,30 @@ } @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("鏄庣粏鍒犻櫎澶辫触"); +// } } } + + @Override + public List<LocDetl> queryFlatStock(String matnr, String batch, List<FieldParam> params) { + //鑾峰彇骞冲簱涓鍚堟潯浠剁殑搴撲綅 + List<Map<String, Object>> list = viewLocDetlMapper.queryFlatStock(matnr, batch, params, LocAreaTypeSts.LOC_AREA_TYPE_FLAT.id); + List<LocDetl> detls = new ArrayList<>(); + list.forEach(action -> { + LocDetl parseObject = JSONObject.parseObject(JSON.toJSONString(action), LocDetl.class); + detls.add(parseObject); + }); + return detls; + } } -- Gitblit v1.9.1