代码更新
This commit is contained in:
parent
6b6331b237
commit
15dca6d413
|
|
@ -5,7 +5,8 @@ public enum ConfigMapKeyEnum {
|
|||
URL_WCS_TASK("URL_WCS_TASK"),
|
||||
URL_NEW_DESTINATION("URL_NEW_DESTINATION"),
|
||||
URL_WCS_PICK_TASK("URL_WCS_PICK_TASK"),
|
||||
URL_WCS_E_TASK("URL_WCS_E_TASK");
|
||||
URL_WCS_E_TASK("URL_WCS_E_TASK"),
|
||||
URL_WCS_DISPOSE_VEHICLE("URL_WCS_DISPOSE_VEHICLE");
|
||||
private final String configKey;
|
||||
ConfigMapKeyEnum(String configKey) {
|
||||
this.configKey = configKey;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,9 @@ import com.wms.entity.app.wcs.*;
|
|||
import com.wms.entity.table.*;
|
||||
import com.wms.service.*;
|
||||
import com.wms.service.business.IValidateService;
|
||||
import com.wms.service.business.IWcsService;
|
||||
import com.wms.service.business.IWmsTaskService;
|
||||
import com.wms.service.business.IWorkService;
|
||||
import com.wms.utils.HttpUtils;
|
||||
import com.wms.utils.StringUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
|
@ -113,6 +115,18 @@ public class TaskController {
|
|||
* 流转中物料箱号数据
|
||||
*/
|
||||
private final OutsideVehiclesService outsideVehiclesService;
|
||||
/**
|
||||
* 拣选任务记录服务
|
||||
*/
|
||||
private final PickTaskRecordService pickTaskRecordService;
|
||||
/**
|
||||
* Wcs服务
|
||||
*/
|
||||
private final IWcsService wcsService;
|
||||
/**
|
||||
* 工作服务
|
||||
*/
|
||||
private final IWorkService workService;
|
||||
|
||||
/**
|
||||
* 接收入库任务请求
|
||||
|
|
@ -1046,34 +1060,93 @@ public class TaskController {
|
|||
return convertJsonString(response);
|
||||
}
|
||||
// 查询当前站台的拣货任务
|
||||
PickTask pickTasks = pickTaskService.getOne(new LambdaQueryWrapper<PickTask>()
|
||||
PickTask pickTask = pickTaskService.getOne(new LambdaQueryWrapper<PickTask>()
|
||||
.eq(PickTask::getStandId, standId)
|
||||
.eq(PickTask::getPickStatus, PickTaskStatusEnum.FINISH.getCode()));
|
||||
if (pickTasks == null) {
|
||||
if (pickTask == null) {
|
||||
// 没有拣货任务,直接放行
|
||||
// TODO 调用Wcs的放行接口
|
||||
// 调用Wcs的放行接口
|
||||
wcsService.sendWcsDisposeVehicle(new WcsDisposeVehicleRequest(standId, null));
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("确认成功,放行");
|
||||
} else {
|
||||
// 查询当前载具上的流转中的物料
|
||||
List<OutsideVehicles> outsideVehicles = outsideVehiclesService.list(new LambdaQueryWrapper<OutsideVehicles>()
|
||||
.eq(OutsideVehicles::getVehicleId, pickTasks.getVehicleId()));
|
||||
.eq(OutsideVehicles::getVehicleId, pickTask.getVehicleId()));
|
||||
List<String> goodsIdList = new ArrayList<>();
|
||||
if (outsideVehicles != null && !outsideVehicles.isEmpty()) {
|
||||
for (OutsideVehicles outsideVehicle : outsideVehicles) {
|
||||
// 料号不对应
|
||||
if (Objects.equals(outsideVehicle.getGoodsId(), workConfirmRequest.getGoodsId())) {
|
||||
continue;
|
||||
}
|
||||
if (!goodsIdList.contains(outsideVehicle.getGoodsId())) {
|
||||
goodsIdList.add(outsideVehicle.getGoodsId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (goodsIdList.size() > 0) {
|
||||
// 判断这些物料是不是当前站台的工作流中人否需要
|
||||
if (workFlowService.exists(new LambdaQueryWrapper<WorkFlow>()
|
||||
.eq(WorkFlow::getWorkStation, standId)
|
||||
.in(WorkFlow::getGoodsId, goodsIdList)
|
||||
.ne(WorkFlow::getWorkStatus, 2))) {
|
||||
// 需要,不放行,返回前台提示信息
|
||||
StandPickVo pickVoEntity = new StandPickVo();
|
||||
pickVoEntity.setTip("当前料箱还有其他物料需要拣货");
|
||||
response.setCode(ResponseCode.WARNING.getCode());
|
||||
response.setMessage("当前料箱还有其他物料需要拣货");
|
||||
response.setReturnData(pickVoEntity);
|
||||
} else {
|
||||
// 存储拣选记录
|
||||
PickTaskRecord pickTaskRecord = BeanUtil.copyProperties(pickTask, PickTaskRecord.class);
|
||||
pickTaskRecord.setLastUpdateTime(LocalDateTime.now());
|
||||
pickTaskRecordService.save(pickTaskRecord);
|
||||
// 删除当前拣选任务
|
||||
pickTaskService.removeById(pickTask);
|
||||
// 不需要,放行
|
||||
wcsService.sendWcsDisposeVehicle(new WcsDisposeVehicleRequest(standId, pickTask.getVehicleId()));
|
||||
// 判断是不是已经完成工作
|
||||
if (workFlowService.exists(new LambdaQueryWrapper<WorkFlow>()
|
||||
.eq(WorkFlow::getWorkStation, standId)
|
||||
.ne(WorkFlow::getWorkStatus, 2))) {
|
||||
// 当前站台工作未全部完成
|
||||
response.setMessage("确认成功,放行");
|
||||
} else {
|
||||
// 当前站台工作已全部完成,需要提示工作完成,打印标签
|
||||
response.setMessage("当前工作已经全部完成,请至完成界面进行后续工作。");
|
||||
}
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
}
|
||||
} else {
|
||||
// 存储拣选记录
|
||||
PickTaskRecord pickTaskRecord = BeanUtil.copyProperties(pickTask, PickTaskRecord.class);
|
||||
pickTaskRecord.setLastUpdateTime(LocalDateTime.now());
|
||||
pickTaskRecordService.save(pickTaskRecord);
|
||||
// 删除当前拣选任务
|
||||
pickTaskService.removeById(pickTask);
|
||||
// 放行
|
||||
wcsService.sendWcsDisposeVehicle(new WcsDisposeVehicleRequest(standId, pickTask.getVehicleId()));
|
||||
// 判断是不是已经完成工作
|
||||
if (workFlowService.exists(new LambdaQueryWrapper<WorkFlow>()
|
||||
.eq(WorkFlow::getWorkStation, standId)
|
||||
.ne(WorkFlow::getWorkStatus, 2))) {
|
||||
// 当前站台工作未全部完成
|
||||
response.setMessage("确认成功,放行");
|
||||
} else {
|
||||
// 当前站台工作已全部完成,需要提示工作完成,打印标签
|
||||
response.setMessage("当前工作已经全部完成,请至完成界面进行后续工作。");
|
||||
}
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
}
|
||||
}
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("获取工作信息异常");
|
||||
logger.error("确认时发生异常:{}", convertJsonString(e));
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("获取工作信息异常");
|
||||
response.setMessage("确认时发生异常");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
|
|
@ -1081,24 +1154,130 @@ public class TaskController {
|
|||
/**
|
||||
* Wcs请求释放箱子---站台实体按钮触发
|
||||
*
|
||||
* @param eTaskFeedbackRequest 反馈信息
|
||||
* @param wcsDisposeVehicleRequest 请求信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/requestFreeVehicle")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "Wcs请求释放箱子(站台实体按钮触发)", logMethod = "requestFreeVehicle")
|
||||
public String requestFreeVehicle(@RequestBody WcsETaskFeedbackRequest eTaskFeedbackRequest) {
|
||||
logger.info("接收到获取备料工作信息请求:{},ip地址:{}", convertJsonString(eTaskFeedbackRequest), HttpUtils.getIpAddr(servletRequest));
|
||||
public String requestFreeVehicle(@RequestBody WcsDisposeVehicleRequest wcsDisposeVehicleRequest) {
|
||||
logger.info("Wcs请求释放箱子(站台实体按钮触发):{},ip地址:{}", convertJsonString(wcsDisposeVehicleRequest), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
// 获取站台号
|
||||
String standId = "";
|
||||
if (StringUtils.isNotEmpty(wcsDisposeVehicleRequest.getLocation())) {
|
||||
// 站台号从请求参数中获取
|
||||
standId = wcsDisposeVehicleRequest.getLocation();
|
||||
} else {
|
||||
// 站台号从ip获取
|
||||
Stand standOfIp = standService.getOne(new LambdaQueryWrapper<Stand>()
|
||||
.eq(Stand::getStandIp, HttpUtils.getIpAddr(servletRequest))
|
||||
.eq(Stand::getStandType, 1));
|
||||
if (standOfIp != null && StringUtils.isNotEmpty(standOfIp.getStandId())) {
|
||||
standId = standOfIp.getStandId();
|
||||
}
|
||||
}
|
||||
if (StringUtils.isEmpty(standId)) {
|
||||
// TODO 这里需要使用websocket,从后台向前台推送消息
|
||||
logger.error("请求参数缺少站台号。");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("请求参数缺少站台号。");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
// 判断当前站台是否还有亮灯数据
|
||||
if (etagLocationService.exists(new LambdaQueryWrapper<ETagLocation>()
|
||||
.eq(ETagLocation::getWorkStation, standId)
|
||||
.eq(ETagLocation::getPickStatus, 1))) {
|
||||
// TODO 这里需要使用websocket,从后台向前台推送消息
|
||||
logger.error("站台灯光未全部拍灭,请检查。");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("站台灯光未全部拍灭,请检查。");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
// 查询当前站台的拣货任务
|
||||
PickTask pickTask = pickTaskService.getOne(new LambdaQueryWrapper<PickTask>()
|
||||
.eq(PickTask::getStandId, standId)
|
||||
.eq(PickTask::getPickStatus, PickTaskStatusEnum.FINISH.getCode()));
|
||||
if (pickTask == null) {
|
||||
// 没有拣货任务,直接放行
|
||||
// 调用Wcs的放行接口
|
||||
wcsService.sendWcsDisposeVehicle(new WcsDisposeVehicleRequest(standId, null));
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("确认成功,放行");
|
||||
} else {
|
||||
// 查询当前载具上的流转中的物料
|
||||
List<OutsideVehicles> outsideVehicles = outsideVehiclesService.list(new LambdaQueryWrapper<OutsideVehicles>()
|
||||
.eq(OutsideVehicles::getVehicleId, pickTask.getVehicleId()));
|
||||
List<String> goodsIdList = new ArrayList<>();
|
||||
if (outsideVehicles != null && !outsideVehicles.isEmpty()) {
|
||||
for (OutsideVehicles outsideVehicle : outsideVehicles) {
|
||||
if (!goodsIdList.contains(outsideVehicle.getGoodsId())) {
|
||||
goodsIdList.add(outsideVehicle.getGoodsId());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (goodsIdList.size() > 0) {
|
||||
// 判断这些物料是不是当前站台的工作流中人否需要
|
||||
if (workFlowService.exists(new LambdaQueryWrapper<WorkFlow>()
|
||||
.eq(WorkFlow::getWorkStation, standId)
|
||||
.in(WorkFlow::getGoodsId, goodsIdList)
|
||||
.ne(WorkFlow::getWorkStatus, 2))) {
|
||||
// TODO 这里需要使用websocket,从后台向前台推送消息
|
||||
// 需要,不放行,返回前台提示信息
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("当前料箱还有其他物料需要拣货");
|
||||
} else {
|
||||
// 存储拣选记录
|
||||
PickTaskRecord pickTaskRecord = BeanUtil.copyProperties(pickTask, PickTaskRecord.class);
|
||||
pickTaskRecord.setLastUpdateTime(LocalDateTime.now());
|
||||
pickTaskRecordService.save(pickTaskRecord);
|
||||
// 删除当前拣选任务
|
||||
pickTaskService.removeById(pickTask);
|
||||
// 不需要,放行
|
||||
wcsService.sendWcsDisposeVehicle(new WcsDisposeVehicleRequest(standId, pickTask.getVehicleId()));
|
||||
// 判断是不是已经完成工作
|
||||
if (workFlowService.exists(new LambdaQueryWrapper<WorkFlow>()
|
||||
.eq(WorkFlow::getWorkStation, standId)
|
||||
.ne(WorkFlow::getWorkStatus, 2))) {
|
||||
// 当前站台工作未全部完成
|
||||
response.setMessage("确认成功,放行");
|
||||
} else {
|
||||
// 当前站台工作已全部完成,需要提示工作完成,打印标签
|
||||
response.setMessage("当前工作已经全部完成,请至完成界面进行后续工作。");
|
||||
}
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
}
|
||||
} else {
|
||||
// 存储拣选记录
|
||||
PickTaskRecord pickTaskRecord = BeanUtil.copyProperties(pickTask, PickTaskRecord.class);
|
||||
pickTaskRecord.setLastUpdateTime(LocalDateTime.now());
|
||||
pickTaskRecordService.save(pickTaskRecord);
|
||||
// 删除当前拣选任务
|
||||
pickTaskService.removeById(pickTask);
|
||||
// 放行
|
||||
wcsService.sendWcsDisposeVehicle(new WcsDisposeVehicleRequest(standId, pickTask.getVehicleId()));
|
||||
// 判断是不是已经完成工作
|
||||
if (workFlowService.exists(new LambdaQueryWrapper<WorkFlow>()
|
||||
.eq(WorkFlow::getWorkStation, standId)
|
||||
.ne(WorkFlow::getWorkStatus, 2))) {
|
||||
// 当前站台工作未全部完成
|
||||
response.setMessage("确认成功,放行");
|
||||
} else {
|
||||
// 当前站台工作已全部完成,需要提示工作完成,打印标签
|
||||
response.setMessage("当前工作已经全部完成,请至完成界面进行后续工作。");
|
||||
}
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
}
|
||||
}
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("获取工作信息异常");
|
||||
logger.error("Wcs请求释放箱子异常");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("获取工作信息异常");
|
||||
response.setMessage("Wcs请求释放箱子异常");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.wms.entity.app.wcs;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Wms请求输送线释放箱子
|
||||
*/
|
||||
@Data
|
||||
public class WcsDisposeVehicleRequest {
|
||||
/**
|
||||
* 点位
|
||||
*/
|
||||
@JsonProperty("location")
|
||||
private String location;
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
@JsonProperty("vehicleId")
|
||||
private String vehicleId;
|
||||
|
||||
public WcsDisposeVehicleRequest(String location, String vehicleId) {
|
||||
this.location = location;
|
||||
this.vehicleId = vehicleId;
|
||||
}
|
||||
}
|
||||
|
|
@ -36,4 +36,14 @@ public class ELocationConfig {
|
|||
*/
|
||||
@TableField("order_box_no")
|
||||
private String orderBoxNo;
|
||||
/**
|
||||
* 是否打印
|
||||
*/
|
||||
@TableField("print_status")
|
||||
private Integer printStatus = 0;
|
||||
/**
|
||||
* 是否打印
|
||||
*/
|
||||
@TableField("print_counts")
|
||||
private Integer printCounts = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 工单明细
|
||||
|
|
@ -98,4 +99,9 @@ public class KateOrders {
|
|||
*/
|
||||
@TableField("user_name")
|
||||
private String userName;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@TableField("finish_time")
|
||||
private LocalDateTime finishTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 工单导入历史
|
||||
|
|
@ -97,4 +98,9 @@ public class KateOrdersHistory {
|
|||
*/
|
||||
@TableField("user_name")
|
||||
private String userName;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@TableField("finish_time")
|
||||
private LocalDateTime finishTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 上一次导入的工单明细
|
||||
|
|
@ -97,4 +98,9 @@ public class KateOrdersLast {
|
|||
*/
|
||||
@TableField("user_name")
|
||||
private String userName;
|
||||
/**
|
||||
* 完成时间
|
||||
*/
|
||||
@TableField("finish_time")
|
||||
private LocalDateTime finishTime;
|
||||
}
|
||||
|
|
|
|||
10
src/main/java/com/wms/service/business/IWcsService.java
Normal file
10
src/main/java/com/wms/service/business/IWcsService.java
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
package com.wms.service.business;
|
||||
|
||||
import com.wms.entity.app.wcs.WcsDisposeVehicleRequest;
|
||||
|
||||
/**
|
||||
* Wcs服务
|
||||
*/
|
||||
public interface IWcsService {
|
||||
void sendWcsDisposeVehicle(WcsDisposeVehicleRequest request) throws Exception;
|
||||
}
|
||||
|
|
@ -20,5 +20,5 @@ public interface IWorkService {
|
|||
* 完成工作
|
||||
* @param workStation 工作站台
|
||||
*/
|
||||
void finishWork(String workStation);
|
||||
String finishWork(String workStation) throws Exception;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
package com.wms.service.business.serviceImplements;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.wms.constants.enums.ConfigMapKeyEnum;
|
||||
import com.wms.constants.enums.ResponseCode;
|
||||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.app.wcs.WcsDisposeVehicleRequest;
|
||||
import com.wms.entity.table.WmsLog;
|
||||
import com.wms.service.LogService;
|
||||
import com.wms.service.business.IWcsService;
|
||||
import com.wms.utils.HttpUtils;
|
||||
import com.wms.utils.WmsUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.wms.config.InitLocalConfig.configMap;
|
||||
import static com.wms.utils.StringUtils.convertJsonString;
|
||||
|
||||
/**
|
||||
* Wcs服务实现类
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class WcsServiceImplements implements IWcsService {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());// 日志
|
||||
private final LogService logService;// 日志服务
|
||||
|
||||
/**
|
||||
* Wms请求释放箱子
|
||||
*/
|
||||
@Override
|
||||
public void sendWcsDisposeVehicle(WcsDisposeVehicleRequest request) throws Exception {
|
||||
// 发送任务
|
||||
String url = configMap.get(ConfigMapKeyEnum.URL_WCS_DISPOSE_VEHICLE.getConfigKey());
|
||||
if (url != null) {
|
||||
logger.info("向WCS发送释放箱子请求,地址:{},请求详情:{}", url, convertJsonString(request));
|
||||
ResponseEntity result = JSON.parseObject(HttpUtils.sendHttpPostWithoutToken(url, convertJsonString(request)), ResponseEntity.class);
|
||||
try {
|
||||
logService.save(new WmsLog(WmsUtils.generateId("LOG_"), "向WCS发送释放箱子请求", ConfigMapKeyEnum.URL_WCS_DISPOSE_VEHICLE.getConfigKey(), convertJsonString(request), convertJsonString(result), url, LocalDateTime.now(), "WMS"));
|
||||
} catch (Exception e) {
|
||||
logger.error("插入日志错误");
|
||||
}
|
||||
if (result != null && Objects.equals(ResponseCode.OK.getCode(), result.getCode())) {
|
||||
logger.info("Wms请求释放箱子成功");
|
||||
} else {
|
||||
logger.error("Wms请求释放箱子发生错误:{}", convertJsonString(result));
|
||||
throw new Exception("Wms请求释放箱子发生错误");
|
||||
}
|
||||
} else {
|
||||
logger.error("WCS释放箱子地址为空");
|
||||
throw new Exception("WCS释放箱子地址为空");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.wms.constants.enums.*;
|
||||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.app.request.TaskInRequest;
|
||||
import com.wms.entity.app.wcs.WcsStandTaskRequest;
|
||||
import com.wms.entity.app.wcs.WcsTaskRequest;
|
||||
import com.wms.entity.table.PickTask;
|
||||
|
|
@ -29,7 +28,6 @@ import java.util.*;
|
|||
|
||||
import static com.wms.config.InitLocalConfig.configMap;
|
||||
import static com.wms.utils.StringUtils.convertJsonString;
|
||||
import static com.wms.utils.WmsUtils.generateId;
|
||||
|
||||
/**
|
||||
* Wms定时任务服务实现
|
||||
|
|
|
|||
|
|
@ -39,8 +39,11 @@ public class WorkServiceImplements implements IWorkService {
|
|||
private final TaskService taskService;// 任务服务
|
||||
private final PickTaskService pickTaskService;// 拣选任务服务
|
||||
private final VehicleService vehicleService;// 载具服务
|
||||
private final WorkSummaryService workSummaryService;// 工作总结服务
|
||||
private final List<String> workCreatingStations = new ArrayList<>();// 当前正在创建任务的站台
|
||||
private final List<String> workDoingStations = new ArrayList<>();// 当前正在执行任务的站台
|
||||
private final List<String> workFinishingStations = new ArrayList<>();// 当前正在完成任务的站台
|
||||
|
||||
@Override
|
||||
public void createWork(String workStation) throws Exception {
|
||||
if (workCreatingStations.contains(workStation)) {
|
||||
|
|
@ -281,12 +284,77 @@ public class WorkServiceImplements implements IWorkService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void finishWork(String workStation) {
|
||||
// TODO
|
||||
public String finishWork(String workStation) throws Exception {
|
||||
if (workFinishingStations.contains(workStation)) {
|
||||
// 当前站台正在完成工作
|
||||
return "当前站台正在完成工作,请勿重复操作";
|
||||
} else {
|
||||
// 添加站台
|
||||
workFinishingStations.add(workStation);
|
||||
}
|
||||
try {
|
||||
if (workFlowService.exists(new LambdaQueryWrapper<WorkFlow>()
|
||||
.eq(WorkFlow::getWorkStation, workStation)
|
||||
.ne(WorkFlow::getWorkStatus, 2))) {
|
||||
// 当前站台工作未全部完成
|
||||
return "工作未全部做完,不允许确认完成。";
|
||||
}
|
||||
if (eLocationConfigService.exists(new LambdaQueryWrapper<ELocationConfig>()
|
||||
.eq(ELocationConfig::getWorkStation, workStation)
|
||||
.eq(ELocationConfig::getPrintStatus, 0))) {
|
||||
// 有标签未打印
|
||||
return "有标签未打印";
|
||||
}
|
||||
// 删除所有的标签配置
|
||||
eLocationConfigService.remove(new LambdaQueryWrapper<ELocationConfig>()
|
||||
.eq(ELocationConfig::getWorkStation, workStation));
|
||||
// 查询当前站台的所有工作流列表
|
||||
List<WorkFlow> workFlowList = workFlowService.list(new LambdaQueryWrapper<WorkFlow>()
|
||||
.eq(WorkFlow::getWorkStation, workStation)
|
||||
.eq(WorkFlow::getWorkStatus, 2));
|
||||
// workSummary列表
|
||||
List<WorkSummary> workSummaryList = new ArrayList<>();
|
||||
for (WorkFlow workFlow : workFlowList) {
|
||||
WorkSummary summary = new WorkSummary();
|
||||
summary.setWorkFlowId(workFlow.getWorkFlowId());
|
||||
summary.setWorkStation(workFlow.getWorkStation());
|
||||
summary.setWorkOrder(workFlow.getWorkOrder());
|
||||
summary.setWorkCenter(workFlow.getWorkCenter());
|
||||
summary.setGoodsId(workFlow.getGoodsId());
|
||||
summary.setPickedNum(workFlow.getPickedNum());
|
||||
summary.setNeedNum(workFlow.getNeedNum());
|
||||
summary.setLackNum(workFlow.getNeedNum().subtract(workFlow.getPickedNum()));
|
||||
summary.setWorkDate(workFlow.getFinishTime());
|
||||
summary.setWorkStatus(workFlow.getWorkStatus());
|
||||
summary.setLackStatus(summary.getLackNum().compareTo(BigDecimal.ZERO) > 0 ? 1 : 0);
|
||||
summary.setFinishTime(workFlow.getFinishTime());
|
||||
workSummaryList.add(summary);
|
||||
kateOrdersService.update(new LambdaUpdateWrapper<KateOrders>()
|
||||
.set(KateOrders::getOrderStatus, 2)
|
||||
.set(KateOrders::getFinishTime, LocalDateTime.now())
|
||||
.set(KateOrders::getPickedQuantity, workFlow.getPickedNum())
|
||||
.set(KateOrders::getLackQuantity, workFlow.getNeedNum().subtract(workFlow.getPickedNum()))
|
||||
.eq(KateOrders::getOrderId, workFlow.getOrderId())
|
||||
.eq(KateOrders::getSupplyArea, workFlow.getWorkCenter())
|
||||
.eq(KateOrders::getGoodsId, workFlow.getGoodsId()));
|
||||
}
|
||||
workSummaryService.saveBatch(workSummaryList);
|
||||
// 更新工单表
|
||||
|
||||
// 更新DBS表
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new Exception("完成站台:" + workStation + "工作发生异常!");
|
||||
} finally {
|
||||
// 当前站台工作完成
|
||||
workFinishingStations.remove(workStation);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 先找到MWL的小工位的配置
|
||||
*
|
||||
* @param workStation 工站
|
||||
* @param workFlows 工作流/工作任务
|
||||
* @param model 机型
|
||||
|
|
@ -380,6 +448,7 @@ public class WorkServiceImplements implements IWorkService {
|
|||
|
||||
/**
|
||||
* 生成出库任务,同时生成拣选任务
|
||||
*
|
||||
* @param waitForOutStocks 待出库库存
|
||||
*/
|
||||
private void createVehicleOutTaskAndPickTask(List<Stock> waitForOutStocks, String workStation) {
|
||||
|
|
@ -456,6 +525,7 @@ public class WorkServiceImplements implements IWorkService {
|
|||
|
||||
/**
|
||||
* 生成拣选任务
|
||||
*
|
||||
* @param vehicleIds 载具列表
|
||||
* @param workStation 工作站台
|
||||
* @param pickStatus 任务状态:只接受-1、0。-1:暂存不发送,0:可发送
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user