代码更新

This commit is contained in:
梁州 2024-08-09 23:01:59 +08:00
parent 1e14df8455
commit 6f57f53d38
7 changed files with 100 additions and 11 deletions

View File

@ -12,6 +12,7 @@ import com.wms.entity.app.dto.PageDto;
import com.wms.entity.app.dto.extend.StockDetailInfo;
import com.wms.entity.app.dto.extend.TaskDetailInfo;
import com.wms.entity.app.request.*;
import com.wms.entity.app.vo.BoxPrintData;
import com.wms.entity.app.vo.StandPickFinishVo;
import com.wms.entity.app.vo.StandPickVo;
import com.wms.entity.app.vo.TaskVO;
@ -121,6 +122,10 @@ public class TaskController {
* 拣选任务记录服务
*/
private final PickTaskRecordService pickTaskRecordService;
/**
* DBS服务
*/
private final KateDBSService kateDBSService;
/**
* Wcs服务
*/
@ -906,6 +911,7 @@ public class TaskController {
// 设置工作流更新信息
// tempWork.setPickedNum(tempWork.getPickedNum().add(thisPickNum));
tempWork.setLightStatus(1);
tempWork.setOpUser(workQuery.getUserName());
realNum = realNum.subtract(thisPickNum);
}
}
@ -1098,7 +1104,7 @@ public class TaskController {
List<PickTask> pickedTasks = pickTaskService.list(new LambdaQueryWrapper<PickTask>()
.eq(PickTask::getStandId, workFlow.getWorkStation())
.ne(PickTask::getPickStatus, PickTaskStatusEnum.FINISH.getCode()));
List<String> vehicleIds = pickedTasks.stream().map(PickTask::getVehicleId).toList();
List<String> vehicleIds = pickedTasks.stream().map(PickTask::getVehicleId).distinct().toList();
if (outsideVehiclesService.exists(new LambdaQueryWrapper<OutsideVehicles>()
.eq(OutsideVehicles::getGoodsId, workFlow.getGoodsId())
.in(OutsideVehicles::getVehicleId, vehicleIds))) {
@ -1116,7 +1122,7 @@ public class TaskController {
}
if (needNum.compareTo(workFlow.getNeedNum().subtract(workFlow.getPickedNum())) == 0) {
workFlow.setLightStatus(2);// 已拍灯
workFlow.setWorkStatus(2);// 正在做
workFlow.setWorkStatus(2);// 已完成
} else {
workFlow.setLightStatus(1);// 已亮灯
workFlow.setWorkStatus(1);// 正在做
@ -1730,7 +1736,6 @@ public class TaskController {
emptyVehicleTask.setTaskType(TaskType.OUT.getCode());
emptyVehicleTask.setTaskStatus(WmsTaskStatus.NEW.getCode());
emptyVehicleTask.setOrigin(emptyVehicle.getCurrentLocation());
// TODO 这里的终点与Wcs商量传不传
emptyVehicleTask.setDestination("");
emptyVehicleTask.setTaskPriority(1);
emptyVehicleTask.setTaskGroup(generateId(""));
@ -1908,17 +1913,81 @@ public class TaskController {
logger.info("请求打印标签的数据:{}ip地址{}", convertJsonString(printRequest), HttpUtils.getIpAddr(servletRequest));
ResponseEntity response = new ResponseEntity();
try {
// 获取站台号
String standId = "";
if (StringUtils.isNotEmpty(printRequest.getStandId())) {
// 站台号从请求参数中获取
standId = printRequest.getStandId();
} else {
// 站台号从ip获取
Stand standOfIp = standService.getOne(new LambdaQueryWrapper<Stand>()
.eq(Stand::getStandIp, HttpUtils.getIpAddr(servletRequest))
.eq(Stand::getStandType, 2));
if (standOfIp != null && StringUtils.isNotEmpty(standOfIp.getStandId())) {
standId = standOfIp.getStandId();
}
}
if (StringUtils.isEmpty(standId)) {
logger.error("请求参数缺少站台号。");
response.setCode(ResponseCode.ERROR.getCode());
response.setMessage("请求参数缺少站台号。");
return convertJsonString(response);
}
// 根据站台号查找电子标签配置表
List<ELocationConfig> eLocationConfigs = eLocationConfigService.list(new LambdaQueryWrapper<ELocationConfig>()
.eq(ELocationConfig::getWorkStation, standId));
if (eLocationConfigs == null || eLocationConfigs.isEmpty()) {
logger.error("没有可以打印的标签。");
response.setCode(ResponseCode.ERROR.getCode());
response.setMessage("没有可以打印的标签。");
return convertJsonString(response);
}
List<BoxPrintData> boxPrintDatas = new ArrayList<>();
for (ELocationConfig eLocationConfig : eLocationConfigs) {
BoxPrintData boxPrintData = new BoxPrintData();
// 查找电子标签库位
ETagLocation eTagLocation = etagLocationService.getOne(new LambdaQueryWrapper<ETagLocation>()
.eq(ETagLocation::getELocationId, eLocationConfig.getELocationId()));
// 获取工作流信息
List<WorkFlow> workFlows = workFlowService.list(new LambdaQueryWrapper<WorkFlow>()
.eq(WorkFlow::getWorkOrder, eLocationConfig.getWorkOrder())
.eq(WorkFlow::getWorkCenter, eLocationConfig.getWorkCenter())
.eq(WorkFlow::getWorkStation, eLocationConfig.getWorkStation()));
// 查询DBS
KateDBS kateDBS = kateDBSService.getOne(new LambdaQueryWrapper<KateDBS>()
.eq(KateDBS::getWorkOrder, eLocationConfig.getWorkOrder()));
if (eTagLocation == null || workFlows == null || workFlows.isEmpty() || kateDBS == null) {
// 存在数据异常跳过
continue;
}
// 开始设定标签信息
boxPrintData.setSequenceNo(eTagLocation.getSequenceId());
boxPrintData.setMachineNo(kateDBS.getMachineNo());
boxPrintData.setSmallWorkCenter(eLocationConfig.getWorkCenter());
boxPrintData.setWorkOrder(eLocationConfig.getWorkOrder());
boxPrintData.setGoodsCount(workFlows.stream().map(WorkFlow::getGoodsId).distinct().toList().size());
boxPrintData.setGoodsNumCount(workFlows.stream().map(WorkFlow::getPickedNum).reduce(BigDecimal.ZERO, BigDecimal::add));
boxPrintData.setOpTime(workFlows.get(0).getFinishTime());
boxPrintData.setOpUser(workFlows.get(0).getOpUser());
boxPrintDatas.add(boxPrintData);
// 设置打印状态
eLocationConfig.setPrintStatus(1);
eLocationConfig.setPrintCounts(eLocationConfig.getPrintCounts() + 1);
}
// 更新电子标签库位
eLocationConfigService.updateBatchById(eLocationConfigs);
logger.info("获取打印标签成功。");
response.setCode(ResponseCode.OK.getCode());
response.setMessage("可以回库。");
response.setMessage("获取打印标签成功。");
response.setReturnData(boxPrintDatas);
return convertJsonString(response);
} catch (Exception e) {
// 回滚事务
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
logger.error("处理回库请求异常,{}", convertJsonString(e));
logger.error("获取打印标签异常,{}", convertJsonString(e));
response.setCode(ResponseCode.ERROR.getCode());
response.setMessage("处理回库请求异常。");
response.setMessage("获取打印标签异常。");
return convertJsonString(response);
}
}

View File

@ -35,4 +35,9 @@ public class WorkConfirmRequest {
*/
@JsonProperty("remainNumReal")
private BigDecimal remainNumReal;
/**
* 实际剩余数量
*/
@JsonProperty("userName")
private BigDecimal userName;
}

View File

@ -15,4 +15,9 @@ public class WorkQuery {
*/
@JsonProperty("goodsId")
private String goodsId;
/**
* 用户名
*/
@JsonProperty("userName")
private String userName;
}

View File

@ -80,4 +80,9 @@ public class WorkFlow {
*/
@TableField("finish_time")
private LocalDateTime finishTime;
/**
* 操作人员
*/
@TableField("op_user")
private String opUser;
}

View File

@ -79,4 +79,9 @@ public class WorkSummary {
*/
@TableField("finish_time")
private LocalDateTime finishTime;
/**
* 操作人员
*/
@TableField("op_user")
private String opUser;
}

View File

@ -326,7 +326,7 @@ public class WmsTaskServiceImplements implements IWmsTaskService {
// 更新流转箱表
outsideVehiclesService.updateBatchById(usedOutsideVehiclesList);
// 生成拣选任务
List<String> vehicleIds = usedOutsideVehiclesList.stream().map(OutsideVehicles::getVehicleId).toList();
List<String> vehicleIds = usedOutsideVehiclesList.stream().map(OutsideVehicles::getVehicleId).distinct().toList();
createPickTasks(vehicleIds, workStation, PickTaskStatusEnum.NEW.getCode());
}
return needNum;

View File

@ -113,7 +113,7 @@ public class WorkServiceImplements implements IWorkService {
// 将站台要料列表存进数据库
goodsToStationService.saveBatch(goodsToStationList);
// 更新工单表
List<String> orderIds = currentStationWorkFlows.stream().map(WorkFlow::getOrderId).toList();
List<String> orderIds = currentStationWorkFlows.stream().map(WorkFlow::getOrderId).distinct().toList();
kateOrdersService.update(new LambdaUpdateWrapper<KateOrders>()
.set(KateOrders::getOrderStatus, 1)
.in(KateOrders::getOrderId, orderIds)
@ -204,8 +204,8 @@ public class WorkServiceImplements implements IWorkService {
}
goodsToStationService.updateBatchById(goodsToStationList);
// 更新工作流状态
List<String> workFlowIds = currentWorkFlowList.stream().map(WorkFlow::getWorkFlowId).toList();
List<String> orderIds = currentWorkFlowList.stream().map(WorkFlow::getOrderId).toList();
List<String> workFlowIds = currentWorkFlowList.stream().map(WorkFlow::getWorkFlowId).distinct().toList();
List<String> orderIds = currentWorkFlowList.stream().map(WorkFlow::getOrderId).distinct().toList();
workFlowService.update(new LambdaUpdateWrapper<WorkFlow>()
.set(WorkFlow::getWorkStatus, 1)
.in(WorkFlow::getWorkFlowId, workFlowIds)