From e2ef58086619bf43d323f7f0f60cd15b91942493 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期五, 11 七月 2025 14:34:27 +0800 Subject: [PATCH] no message --- zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java | 142 ++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 132 insertions(+), 10 deletions(-) diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java index 1adf5de..c569d81 100644 --- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java +++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java @@ -1,10 +1,14 @@ package com.zy.asrs.wms.asrs.service.impl; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.IService; import com.zy.asrs.framework.common.R; import com.zy.asrs.framework.exception.CoolException; +import com.zy.asrs.wms.apis.wcs.entity.request.SlapLightControlParam; +import com.zy.asrs.wms.apis.wcs.entity.response.CommonReponse; +import com.zy.asrs.wms.apis.wcs.utils.HttpEssUtils; import com.zy.asrs.wms.asrs.entity.*; import com.zy.asrs.wms.asrs.entity.dto.PickSheetDetlDto; import com.zy.asrs.wms.asrs.entity.dto.ShippingOrderDetlDto; @@ -18,6 +22,7 @@ import com.zy.asrs.wms.system.entity.Host; import com.zy.asrs.wms.system.service.HostService; import io.netty.util.internal.StringUtil; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -28,6 +33,7 @@ import java.util.stream.Collectors; @Service +@Slf4j public class MobileServiceImpl implements MobileService { @Autowired @@ -236,7 +242,7 @@ Double anfme = detls.stream().mapToDouble(OrderDetl::getAnfme).sum(); if (v.compareTo(anfme) == 0.0) { order.setOrderSettle(OrderSettleType.COMPLETE.val()); - if (! orderService.updateById(order)) { + if (!orderService.updateById(order)) { throw new CoolException("鍗曟嵁鐘舵�佷慨鏀瑰け璐ワ紒锛�"); } } @@ -319,7 +325,7 @@ pickSheet.setStatus(3); if (!pickSheetService.updateById(pickSheet)) { throw new CoolException("杞巻鍙叉。澶辫触锛侊紒"); - } else{ + } else { if (!pickSheetDetlService.update(new LambdaUpdateWrapper<PickSheetDetl>().eq(PickSheetDetl::getPickId, pickSheet.getId()).set(PickSheetDetl::getStatus, 3))) { throw new CoolException("鎷h揣鍗曟槑缁嗚浆鍘嗗彶妗eけ璐ワ紒锛�"); } @@ -394,6 +400,7 @@ /** * 鑾峰彇鎾澧欑珯鐐� + * * @return */ @Override @@ -403,6 +410,7 @@ /** * 璁㈠崟缁戝畾鎾澧欑珯鐐�+ + * * @param param * @return */ @@ -426,7 +434,7 @@ .setSiteStatus(CacheSiteStatusType.R.id) .setBarcode(param.get("barcode").toString()); if (!cacheSiteService.saveOrUpdate(siteNo)) { - throw new CoolException("璁㈠崟鎾浣嶇粦瀹氬け璐ワ紒锛�" ); + throw new CoolException("璁㈠崟鎾浣嶇粦瀹氬け璐ワ紒锛�"); } if (!waveSeedMapper.update(new LambdaUpdateWrapper<WaveSeed>() @@ -435,17 +443,58 @@ .set(WaveSeed::getSiteNo, siteNo.getSiteNo()))) { throw new CoolException("鎾绔欑偣鏇存柊澶辫触锛侊紒"); } + //缁戝畾鎴愬姛锛屾挱绉嶅浜伅 + sowLightMange(siteNo.getSiteNo(), order, "LIGHT"); } else { if (StringUtil.isNullOrEmpty(siteNo.getOrderNo())) { throw new CoolException("褰撳墠鎾绔欑偣鏈粦瀹氳鍗曪紒锛�"); } - siteNo.setOrderId(null).setOrderNo(null).setBarcode(null).setSiteNo("0"); + siteNo.setOrderId(null).setOrderNo(null).setBarcode(null).setSiteNo("0"); if (cacheSiteMapper.updateById(siteNo) < 1) { - throw new CoolException("璁㈠崟涓庢挱绉嶄綅瑙g粦澶辫触锛侊紒" ); + throw new CoolException("璁㈠崟涓庢挱绉嶄綅瑙g粦澶辫触锛侊紒"); } } return true; } + + /** + * @author Ryan + * @date 2025/7/11 + * @description: 缁戝畾鎾澧欎寒鐏� + * @version 1.0 + */ + public void sowLightMange(String siteNo, Order order, String light) { + // 鍒拌揪鎷i�変綅锛屾帶鍒舵挱绉嶅浜伅 + CacheSite cacheSite = cacheSiteService.getOne(new LambdaQueryWrapper<CacheSite>() + .eq(CacheSite::getSiteNo, siteNo)); + if (Objects.isNull(cacheSite)) { + log.error("鏉$爜锛歿}锛屾湭鎵惧埌鎾澧欎寒鐏�", siteNo); + throw new CoolException("鏈壘鍒版挱绉嶅"); + } + List<OrderDetl> detls = orderDetlService.list(new LambdaQueryWrapper<OrderDetl>().eq(OrderDetl::getOrderId, order.getId())); + if (Objects.isNull(detls)) { + throw new CoolException("鏁版嵁閿欒锛岃鍗曟槑缁嗕笉瀛樺湪锛侊紒"); + } + int anfme = (int)detls.stream().mapToDouble(OrderDetl::getAnfme).sum(); + SlapLightControlParam slapLightControlParam = new SlapLightControlParam(); + slapLightControlParam + .setControllerCode(cacheSite.getMemo()) + .setTagCode(cacheSite.getSiteNo()) + .setColor("GREEN") + .setIndex(cacheSite.getIndex()) +// .setMode("LIGHT") + .setMode(light) + .setDisplay(anfme + ""); + // 鍙戣捣浜伅璇锋眰 + log.info("鎾澧欎寒鐏笅鍙�", JSONObject.toJSONString(slapLightControlParam)); + CommonReponse response = HttpEssUtils.post("鍒拌揪鎷i�変綅锛屾挱绉嶅浜伅", HttpEssUtils.PLT_SEND_COMMAND, slapLightControlParam); + if (response.getCode().equals(0)) { + log.info("鎾澧檣}浜伅鎴愬姛", cacheSite.getSiteNo()); + } else { + log.info("鎾澧檣}浜伅澶辫触", cacheSite.getSiteNo()); + } + } + @Override public R selectShippingDetl(Map<String, Object> params) { @@ -472,6 +521,7 @@ * 1. 鍑哄簱淇敼璁㈠崟瀹屾垚鐘舵�侊紝鍒ゆ柇璁㈠崟鏄惁瀹屾垚锛屽畬鎴愬姞鍏ュ巻鍙叉。锛屾湭瀹屾垚淇敼璁㈠崟宸插畬鎴愭暟閲� * 2. 鍒犻櫎璁㈠崟宸插畬鎴愭挱绉嶆槑缁嗕俊鎭� * 3. 娓呴櫎闆嗚揣鍖虹粦瀹氭暟鎹� + * * @param params * @return */ @@ -526,11 +576,11 @@ if (!waveSeeds.isEmpty()) { ArrayList<WaveSeedLog> waveSeedLogs = new ArrayList<>(); waveSeeds.forEach(seed -> { - WaveSeedLog waveSeedLog = new WaveSeedLog(); - BeanUtils.copyProperties(seed, waveSeedLog); - waveSeedLog.setId(null); + WaveSeedLog waveSeedLog = new WaveSeedLog(); + BeanUtils.copyProperties(seed, waveSeedLog); + waveSeedLog.setId(null); waveSeedLogs.add(waveSeedLog); - }); + }); if (!waveSeedLogService.saveBatch(waveSeedLogs)) { throw new CoolException("娉㈡槑鍘嗗彶妗d繚瀛樺け璐ワ紒锛�"); } @@ -563,7 +613,7 @@ } } else { //涓嶄负绌猴紝淇敼璁㈠崟鐘舵�侊紝鍙噸鏂扮粍鎷� one.setOrderSettle(OrderSettleType.INIT.val()); - if (orderService.updateById(one)); + if (orderService.updateById(one)) ; } }); @@ -609,4 +659,76 @@ return R.ok().add(matService.list(new LambdaQueryWrapper<Mat>().eq(Mat::getMatnr, matnr))); } + /** + * @author Ryan + * @date 2025/7/10 + * @description: 鑾峰彇搴撲綅鏄庣粏 + * @version 1.0 + */ + @Override + public List<LocDetl> getDetlsByCode(String barcode) { + Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, barcode)); + if (Objects.isNull(loc)) { + throw new CoolException("搴撲綅涓嶅瓨鍦紒锛�"); + } + LocArea locArea = locAreaService.getOne(new LambdaQueryWrapper<LocArea>() + .eq(LocArea::getLocId, loc.getId()) + .eq(LocArea::getTypeId, LocAreaTypeSts.LOC_AREA_TYPE_FLAT.id)); + if (Objects.isNull(locArea)) { + throw new CoolException("闈炲钩搴撳簱浣嶄笉鍙墽琛屾鎿嶄綔锛侊紒"); + } + List<LocDetl> detls = locDetlService.list(new LambdaQueryWrapper<LocDetl>() + .eq(LocDetl::getLocNo, barcode)); + for (int i = 0; i < detls.size(); i++) { +// detls.get(i).setMats(matService.getOne(new LambdaQueryWrapper<Mat>().eq(Mat::getMatnr, detls.get(i).getMatnr()))); + } + return detls; + } + + /** + * @author Ryan + * @date 2025/7/11 + * @description: 骞冲簱搴撲綅杞Щ + * @version 1.0 + */ + @Override + public R transferLocs(Map<String, String> param) { + Loc barcode = locService.getOne(new LambdaQueryWrapper<Loc>() + .eq(Loc::getLocStsId, LocStsType.F.val()) + .eq(Loc::getLocNo, param.get("barcode"))); + if (Objects.isNull(barcode)) { + throw new CoolException("婧愬簱浣嶆槑缁嗕笉瀛樺湪锛侊紒"); + } + Loc tarCode = locService.getOne(new LambdaQueryWrapper<Loc>() + .eq(Loc::getLocStsId, LocStsType.O.val()) + .eq(Loc::getLocNo, param.get("tarCode"))); + if (Objects.isNull(tarCode)) { + throw new CoolException("璇锋鏌ョ洰鏍囦负鍞綅鏄惁瀛樺湪鎴栨槸鍚︿负绌哄簱锛侊紒"); + } + + List<Long> ids = Arrays.asList(barcode.getId(), tarCode.getId()); + + List<LocArea> locAreas = locAreaService.list(new LambdaQueryWrapper<LocArea>() + .in(LocArea::getLocId, ids) + .eq(LocArea::getTypeId, LocAreaTypeSts.LOC_AREA_TYPE_FLAT.id)); + if (!locAreas.isEmpty() && locAreas.size() == ids.size()) { + throw new CoolException("闈炲钩搴撲笉鍙墽琛屾鎿嶄綔锛侊紒"); + } + + List<LocDetl> locDetls = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocNo, barcode.getLocNo())); + if (locDetls.isEmpty()) { + return R.error("搴撲綅鏄庣粏涓嶅瓨鍦紒锛�"); + } + + if (!locDetlService.update(new LambdaUpdateWrapper<LocDetl>() + .eq(LocDetl::getLocId, barcode.getId()) + .set(LocDetl::getLocId, tarCode.getId()) + .set(LocDetl::getLocNo, tarCode.getLocNo()))) { + throw new CoolException("搴撲綅鏄庣粏淇敼澶辫触锛侊紒"); + } + + return R.ok(); + } + + } -- Gitblit v1.9.1