diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OutStockServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OutStockServiceImpl.java index f5803f6..b830f57 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OutStockServiceImpl.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OutStockServiceImpl.java @@ -15,12 +15,14 @@ import com.mt.wms.core.vo.R; import com.mt.wms.empty.params.OutStockParam; import com.mt.wms.empty.service.OutStockService; import com.mt.wms.empty.task.AsynRunTaskService; +import com.mt.wms.empty.task.RunTaskUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import javax.validation.constraints.NotNull; +import java.io.IOException; import java.time.LocalDateTime; import java.util.List; @@ -41,42 +43,16 @@ public class OutStockServiceImpl extends BaseService implements OutStockService private InStockInfoServiceBiz inStockInfoServiceBiz; @Resource private RunTaskServiceBiz runTaskServiceBiz; + @Resource + private RunTaskUtils runTaskUtils; @Override - public R outTask(OutStockParam outStockParam) { - // TODO: 2021/12/17 出库 + public R outTask(OutStockParam outStockParam) throws IOException { + // 2021/12/17 出库 Long locationId = outStockParam.getLocaltionId(); //提升台 - Integer code = outStockParam.getCode(); - //查询是否有空闲车辆,若有。占用车辆,若无,返回暂无可用车辆 - List vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper() - .eq(VehicleInfo.STATUS, 0) - .eq(VehicleInfo.VALID, 1)); - if (vehicleInfoList.size()>0){ - VehicleInfo vehicleInfo = vehicleInfoList.get(0); - vehicleInfo.setStatus(1); - vehicleInfo.setUpdateTime(LocalDateTime.now()); - vehicleInfoServiceBiz.updateById(vehicleInfo); - }else { - return R.failed("暂无可用车辆!请稍后重试!"); - } - //生成调度任务 - RunTask runTask=new RunTask(); - runTask.setBeginTime(LocalDateTime.now()); - runTask.setVehicleId(vehicleInfoList.get(0).getId()); - // TODO: 2021/12/22 库位id对应的位置 ,提升平台对应的位置 - runTask.setStartPosition("库位位置"); - runTask.setEndPosition("提升台位置"); - setCommonField(runTask); - runTaskServiceBiz.save(runTask); - //异步调用车辆 - asynRunTaskService.asynRunOutStock(locationId); - //修改库位状态 - InStockInfo inStockInfo = inStockInfoServiceBiz - .getOne(new QueryWrapper().eq("Location_id", locationId)); - inStockInfo.setStatus(1); - inStockInfoServiceBiz.updateById(inStockInfo); - return R.ok("操作成功"); + String code = outStockParam.getCode(); + return runTaskUtils.runTaskForOut(locationId,code); } } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/websocket/WebSocketServer.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/websocket/WebSocketServer.java index a76cac4..181d097 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/websocket/WebSocketServer.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/websocket/WebSocketServer.java @@ -46,7 +46,7 @@ public class WebSocketServer { this.id = id;//接收到发送消息的人员编号 webSocketSet.put(id, this); //加入set中 addOnlineCount(); //在线数加1 - //log.info("用户"+id+"加入!当前在线人数为" + getOnlineCount()); + log.info("用户"+id+"加入!当前在线人数为" + getOnlineCount()); try { sendMessage("连接成功"); diff --git a/6.program/wms-gateway/src/main/resources/config/application.yml b/6.program/wms-gateway/src/main/resources/config/application.yml index 9348986..6600ba6 100644 --- a/6.program/wms-gateway/src/main/resources/config/application.yml +++ b/6.program/wms-gateway/src/main/resources/config/application.yml @@ -89,6 +89,7 @@ wms: - /*/wechatLogin - /*/mobileLogin - /apms + - /qj/websocket/* #公共配置 common: