zy-asrs-admin/src/views/loc/stockTransfer/index.vue
@@ -248,7 +248,6 @@ return; } Modal.confirm({ title: formatMessage('page.stockTransfer.transfer', '库存移转'), content: formatMessage('page.stockTransfer.confirm', '确定库存移转吗?'), zy-asrs-wms/src/main/java/com/zy/asrs/wms/apis/wcs/services/Impl/WcsApiServiceImpl.java
@@ -61,9 +61,10 @@ @Autowired private PlatformService platformService; @Resource private SystemProperties systemProperties; @Autowired private MobileService mobileService; /** @@ -107,36 +108,7 @@ } else { if (task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_ARRIVED.id || task.getTaskSts() == TaskStsType.WCS_EXECUTE_OUT_TASK_DONE.id) { // 到达拣选位,控制播种墙亮灯 CacheSite cacheSite = cacheSiteService.getOne(new LambdaQueryWrapper<CacheSite>() .eq(CacheSite::getChannel, task.getTargetSite()) .isNull(CacheSite::getOrderId).orderByAsc(CacheSite::getId), false); // List<CacheSite> cacheSites = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>() // .eq(CacheSite::getBarcode, task.getBarcode())); if (Objects.isNull(cacheSite)) { log.error("条码:{},未找到播种墙亮灯", task.getBarcode()); throw new CoolException("未找到播种墙"); } // 获取任务明细数量 List<TaskDetl> taskDetlByTaskId = taskDetlService.getTaskDetlByTaskId(task.getId()); int sum = (int) taskDetlByTaskId.stream().mapToDouble(TaskDetl::getAnfme).sum(); SlapLightControlParam slapLightControlParam = new SlapLightControlParam(); slapLightControlParam .setControllerCode(cacheSite.getMemo()) .setTagCode(cacheSite.getSiteNo()) .setColor("GREEN") .setIndex(cacheSite.getIndex()) .setMode("LIGHT") .setDisplay(sum + ""); // 发起亮灯请求 log.info("任务{}到达拣选位,播种墙亮灯下发", task.getTaskNo(), JSONObject.toJSONString(slapLightControlParam)); CommonReponse response = HttpEssUtils.post("到达拣选位,播种墙亮灯", HttpEssUtils.PLT_SEND_COMMAND, slapLightControlParam); if (response.getCode().equals(0)) { log.info("任务{}到达拣选位,播种墙{}亮灯成功", task.getTaskNo(), cacheSite.getSiteNo()); } else { log.info("任务{}到达拣选位,播种墙{}亮灯失败", task.getTaskNo(), cacheSite.getSiteNo()); } boolean update = taskService.update(new LambdaUpdateWrapper<Task>() .set(Task::getTaskSts, TaskStsType.WAVE_SEED.id) @@ -378,14 +350,12 @@ // List<OrderDetl> detlList = orderDetls.stream().filter(detl -> { // return detl.getPickStatus() == OrderPickStatus.ORDER_PICK_STATUS_DONE.val; // }).collect(Collectors.toList()); //判断数量是否与订单明细的需求量相同,相同则订单完成 List<WaveSeed> seeds = waveSeedService.list(new LambdaQueryWrapper<WaveSeed>().eq(WaveSeed::getOrderNo, orderNo)); if (Objects.isNull(seeds)) { throw new CoolException("数据错误:播种数据不存在!!"); } Double tolAnfme = seeds.stream().mapToDouble(WaveSeed::getAnfme).sum(); Double toDouble = seeds.stream().mapToDouble(WaveSeed::getWorkQty).sum(); if (toDouble.compareTo(tolAnfme) >= 0) { @@ -407,6 +377,14 @@ } } } //订单完成,灭灯 mobileService.sowLightMange(siteNo, one, "DARK"); log.info("完成灭灯请求地址:{},请求参数:{}", SystemProperties.SLAP_LIGHT, JSONObject.toJSONString(slapParam)); } else { //订单未完成,继续亮灯 mobileService.sowLightMange(siteNo, one, "LIGHT"); log.info("继续亮灯请求地址:{},请求参数:{}", SystemProperties.SLAP_LIGHT, JSONObject.toJSONString(slapParam)); } params.add("params", JSONObject.toJSONString(slapParam)); log.info("完成灭灯请求地址:{},请求参数:{}", SystemProperties.SLAP_LIGHT, JSONObject.toJSONString(slapParam)); zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/MobileController.java
@@ -285,6 +285,32 @@ } @ApiOperation("获取库位详细") @GetMapping("/flat/transfer/{barcode}") public R getDetlsBycode(@PathVariable String barcode) { if (Objects.isNull(barcode)) { return R.error("参数不能为空!!"); } return R.ok().add(mobileService.getDetlsByCode(barcode)); } @ApiOperation("平板转移") @PostMapping("/locs/transfer") public R changeFlatBarcode(@RequestBody Map<String, String> param) { if (Objects.isNull(param)) { return R.error("参数不能为空!!"); } if (Objects.isNull(param.get("barcode"))) { return R.error("源库位不能为空!!"); } if (Objects.isNull(param.get("tarCode"))) { return R.error("目标库位不能为空!!"); } return mobileService.transferLocs(param); } /** * 获取发货订单明细 * @return zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/entity/LocDetl.java
@@ -4,6 +4,7 @@ import java.text.SimpleDateFormat; import java.util.*; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.zy.asrs.common.utils.Synchro; @@ -13,6 +14,7 @@ import com.zy.asrs.wms.asrs.service.MatService; import com.zy.asrs.wms.system.entity.Host; import com.zy.asrs.wms.system.entity.User; import lombok.experimental.Delegate; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @@ -145,6 +147,11 @@ @ApiModelProperty(value= "库存冻结 1: 冻结 0: 正常") private Integer freeze; // @ApiModelProperty("物料信息") // @TableField(exist = false) // @Delegate // private Mat mats; public LocDetl() {} public LocDetl(Long locId,String locNo,Long matId,String matnr,String orderNo,String batch,Double anfme,Long hostId,Integer status,Integer deleted,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo) { zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/MobileService.java
@@ -2,6 +2,8 @@ import com.zy.asrs.framework.common.R; import com.zy.asrs.wms.asrs.entity.CacheSite; import com.zy.asrs.wms.asrs.entity.LocDetl; import com.zy.asrs.wms.asrs.entity.Order; import com.zy.asrs.wms.asrs.entity.dto.PickSheetDetlDto; import com.zy.asrs.wms.asrs.entity.dto.ShippingOrderDetlDto; import com.zy.asrs.wms.asrs.entity.param.BatchMergeOrdersParam; @@ -35,4 +37,10 @@ R getRecommendLocs(); R getMatsByCode(String matnr); List<LocDetl> getDetlsByCode(String barcode); R transferLocs(Map<String, String> param); void sowLightMange(String siteNo, Order order, String light); } 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 @@ -394,6 +400,7 @@ /** * 获取播种墙站点 * * @return */ @Override @@ -403,6 +410,7 @@ /** * 订单绑定播种墙站点+ * * @param param * @return */ @@ -435,6 +443,8 @@ .set(WaveSeed::getSiteNo, siteNo.getSiteNo()))) { throw new CoolException("播种站点更新失败!!"); } //绑定成功,播种墙亮灯 sowLightMange(siteNo.getSiteNo(), order, "LIGHT"); } else { if (StringUtil.isNullOrEmpty(siteNo.getOrderNo())) { throw new CoolException("当前播种站点未绑定订单!!"); @@ -446,6 +456,45 @@ } return true; } /** * @author Ryan * @date 2025/7/11 * @description: 绑定播种墙亮灯 * @version 1.0 */ public void sowLightMange(String siteNo, Order order, String light) { // 到达拣选位,控制播种墙亮灯 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("到达拣选位,播种墙亮灯", 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 */ @@ -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(); } }