代码更新:
1. 修复备料错误 2. 增加堆垛机可用性变更
This commit is contained in:
parent
91d224b18c
commit
0cc57c91b8
|
|
@ -14,7 +14,6 @@ import com.wms.entity.app.dto.StockOfGoodsDto;
|
|||
import com.wms.entity.app.dto.extend.KanbanEntity;
|
||||
import com.wms.entity.app.request.*;
|
||||
import com.wms.entity.app.vo.FileVo;
|
||||
import com.wms.entity.app.vo.LocationVo;
|
||||
import com.wms.entity.app.vo.UploadRecordVo;
|
||||
import com.wms.entity.table.*;
|
||||
import com.wms.service.*;
|
||||
|
|
@ -314,7 +313,6 @@ public class ExcelController {
|
|||
HorizontalCellStyleStrategy horizontalCellStyleStrategy = ExcelContentStyle.getContentStyle();
|
||||
// 获取导出结果
|
||||
List<ClcKanbanRequirementExcelVo> clcKanbanRequirementExcelVoList = new ArrayList<>();
|
||||
// TODO 需要处理获得数据
|
||||
// 查询物料库存信息
|
||||
List<StockOfGoodsDto> stockOfGoodsDtoList = stockService.selectSumOfGoods("");
|
||||
if (stockOfGoodsDtoList == null || stockOfGoodsDtoList.isEmpty()) {
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ public class LocationController {
|
|||
try {
|
||||
List<ETagLocation> eLocations = new ArrayList<>();
|
||||
for (int i = 1; i <= 9; i++) {
|
||||
for (int j = 1; j <= 48; j++) {
|
||||
for (int j = 1; j <= 96; j++) {
|
||||
ETagLocation eTagLocation = new ETagLocation();
|
||||
eTagLocation.setELocationId(i + "-" + StringUtils.padLeft(String.valueOf(j), 2, "0"));
|
||||
eTagLocation.setAreaId(String.valueOf(i));
|
||||
|
|
@ -287,7 +287,8 @@ public class LocationController {
|
|||
Page<Vehicle> vehiclePage = vehicleService.page(page, new LambdaQueryWrapper<Vehicle>()
|
||||
.like(StringUtils.isNotEmpty(vehicleQuery.getVehicleId()), Vehicle::getVehicleId, vehicleQuery.getVehicleId())
|
||||
.eq(vehicleQuery.getVehicleStatus() != null, Vehicle::getVehicleStatus, vehicleQuery.getVehicleStatus())
|
||||
.eq(vehicleQuery.getIsEmpty() != null, Vehicle::getIsEmpty, vehicleQuery.getIsEmpty()));
|
||||
.eq(vehicleQuery.getIsEmpty() != null, Vehicle::getIsEmpty, vehicleQuery.getIsEmpty())
|
||||
.orderByDesc(Vehicle::getLastInTime));
|
||||
|
||||
PageDto<VehicleVO> pageDto = PageDto.of(vehiclePage, vehicle -> BeanUtil.copyProperties(vehicle, VehicleVO.class));
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.wms.entity.app.dto.PageDto;
|
|||
import com.wms.entity.app.dto.StandDto;
|
||||
import com.wms.entity.app.request.StandQuery;
|
||||
import com.wms.entity.app.vo.StandVo;
|
||||
import com.wms.entity.app.wcs.DdjStatusChangeRequest;
|
||||
import com.wms.entity.table.Stand;
|
||||
import com.wms.service.StandService;
|
||||
import com.wms.utils.HttpUtils;
|
||||
|
|
@ -27,6 +28,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.wms.utils.StringUtils.convertJsonString;
|
||||
|
||||
/**
|
||||
|
|
@ -130,4 +134,67 @@ public class StandController {
|
|||
return convertJsonString(rsp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 堆垛机状态变更
|
||||
*
|
||||
* @param request 请求信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/ddjStatusChange")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
public String ddjStatusChange(@RequestBody List<DdjStatusChangeRequest> request) {
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
try {
|
||||
if (request == null || request.isEmpty()) {
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("请求信息不完整。");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
List<Stand> modifiedStands = new ArrayList<>();
|
||||
for (DdjStatusChangeRequest tempDDJ : request) {
|
||||
// 查询对应的堆垛机
|
||||
Stand stand = standService.getOne(new LambdaQueryWrapper<Stand>().eq(Stand::getEquipmentId, tempDDJ.getEquipment())
|
||||
.eq(Stand::getStandType, 3)
|
||||
.last("limit 1"));
|
||||
if (stand == null) {
|
||||
continue;
|
||||
}
|
||||
if (stand.getIsLock() == 0 && tempDDJ.getError() != 0) {
|
||||
stand.setIsLock(1);
|
||||
modifiedStands.add(stand);
|
||||
}
|
||||
if (stand.getIsLock() == 1 && tempDDJ.getError() == 0) {
|
||||
stand.setIsLock(0);
|
||||
modifiedStands.add(stand);
|
||||
}
|
||||
}
|
||||
if (!modifiedStands.isEmpty()) {
|
||||
if (standService.updateBatchById(modifiedStands)) {
|
||||
logger.info("更新堆垛机状态成功: {}", convertJsonString(request));
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("更新堆垛机状态成功。");
|
||||
} else {
|
||||
logger.error("更新堆垛机状态失败: {}", convertJsonString(request));
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("更新堆垛机状态失败。");
|
||||
}
|
||||
} else {
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("没有堆垛机变更状态。");
|
||||
}
|
||||
|
||||
return convertJsonString(rsp);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
// 返回其他异常
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("堆垛机状态变更发生异常");
|
||||
return convertJsonString(rsp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,8 @@ public class StockController {
|
|||
.eq(StringUtils.isNotEmpty(stockQuery.getLocationId()), Stock::getLocationId, stockQuery.getLocationId())
|
||||
.eq(stockQuery.getStockStatus() != null, Stock::getStockStatus, stockQuery.getStockStatus())
|
||||
.apply(StringUtils.isNotEmpty(stockQuery.getGoodsId()), "goods_related ->> '$.goodsId' like concat('%', {0}, '%')", stockQuery.getGoodsId())
|
||||
.apply(StringUtils.isNotEmpty(stockQuery.getGoodsName()), "goods_related ->> '$.goodsName' like concat('%', {0}, '%')", stockQuery.getGoodsName()));
|
||||
.apply(StringUtils.isNotEmpty(stockQuery.getGoodsName()), "goods_related ->> '$.goodsName' like concat('%', {0}, '%')", stockQuery.getGoodsName())
|
||||
.orderByDesc(Stock::getLastUpdateTime));
|
||||
|
||||
PageDto<StockVo> pageDto = PageDto.of(stockPage, StockVo::of);
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.wms.annotation.MyLog;
|
|||
import com.wms.constants.enums.*;
|
||||
import com.wms.entity.app.*;
|
||||
import com.wms.entity.app.dto.PageDto;
|
||||
import com.wms.entity.app.dto.StockOfGoodsDto;
|
||||
import com.wms.entity.app.dto.extend.StockDetailInfo;
|
||||
import com.wms.entity.app.request.*;
|
||||
import com.wms.entity.app.vo.BoxPrintData;
|
||||
|
|
@ -125,6 +126,10 @@ public class TaskController {
|
|||
* DBS服务
|
||||
*/
|
||||
private final KateDBSService kateDBSService;
|
||||
/**
|
||||
* 工单服务
|
||||
*/
|
||||
private final KateOrdersService kateOrdersService;
|
||||
/**
|
||||
* 上一次标签配置的服务
|
||||
*/
|
||||
|
|
@ -906,6 +911,9 @@ public class TaskController {
|
|||
BigDecimal realNum = stock.getGoodsRelated().getRemainNum();
|
||||
List<ETaskData> eTaskDataList = new ArrayList<>();
|
||||
for (WorkFlow tempWork : workFlows) {
|
||||
if (realNum.compareTo(BigDecimal.ZERO) <= 0) {// 当前物料数量不足
|
||||
break;
|
||||
}
|
||||
if (tempWork.getLightStatus() != 0) {
|
||||
// 不是未亮灯的状态
|
||||
// 当次拣选数量
|
||||
|
|
@ -913,9 +921,6 @@ public class TaskController {
|
|||
realNum = realNum.subtract(thisPickNum);
|
||||
continue;
|
||||
}
|
||||
if (realNum.compareTo(BigDecimal.ZERO) <= 0) {// 当前物料数量不足
|
||||
break;
|
||||
}
|
||||
// 查找对应的标签配置
|
||||
ELocationConfig eConfig = eLocationConfigService.getOne(new LambdaQueryWrapper<ELocationConfig>()
|
||||
.eq(ELocationConfig::getWorkStation, standId)
|
||||
|
|
@ -975,14 +980,14 @@ public class TaskController {
|
|||
.set(ETagLocation::getTaskType, wcsETaskRequest.getTaskType())
|
||||
.set(ETagLocation::getVehicleNo, wcsETaskRequest.getVehicleNo())
|
||||
.in(ETagLocation::getELocationId, eTaskDataList.stream().map(ETaskData::getLocation).collect(Collectors.toList())));
|
||||
// 更新站台数据
|
||||
standService.update(new LambdaUpdateWrapper<Stand>()
|
||||
.set(Stand::getPickGoods, workQuery.getGoodsId())
|
||||
.set(Stand::getPickVehicle, vehicleId)
|
||||
.eq(Stand::getStandId, standId));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 更新站台数据
|
||||
standService.update(new LambdaUpdateWrapper<Stand>()
|
||||
.set(Stand::getPickGoods, workQuery.getGoodsId())
|
||||
.set(Stand::getPickVehicle, vehicleId)
|
||||
.eq(Stand::getStandId, standId));
|
||||
// 生成前台VO
|
||||
StandPickVo standPickVo = new StandPickVo();
|
||||
standPickVo.setStandId(standId);
|
||||
|
|
@ -1140,7 +1145,7 @@ public class TaskController {
|
|||
// 查站台要料表---未分配以及分配但未完全分配
|
||||
GoodsToStation goodsToStation = goodsToStationService.getOne(new LambdaQueryWrapper<GoodsToStation>()
|
||||
.eq(GoodsToStation::getWorkStation, workFlow.getWorkStation())
|
||||
.eq(GoodsToStation::getGoodsId, workFlow.getGoodsId())
|
||||
.eq(GoodsToStation::getGoodsId, workFlow.getGoodsId())
|
||||
.eq(GoodsToStation::getDistributeStatus, 0)
|
||||
.or().eq(GoodsToStation::getDistributeStatus, 1)
|
||||
.last("limit 1"));
|
||||
|
|
@ -1318,7 +1323,7 @@ public class TaskController {
|
|||
List<String> goodsIdList = new ArrayList<>();
|
||||
if (outsideVehicles != null && !outsideVehicles.isEmpty()) {
|
||||
for (OutsideVehicles outsideVehicle : outsideVehicles) {
|
||||
// 料号不对应
|
||||
// 当前确认料号
|
||||
if (Objects.equals(outsideVehicle.getGoodsId(), workConfirmRequest.getGoodsId())) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1522,7 +1527,7 @@ public class TaskController {
|
|||
// 删除当前拣选任务
|
||||
pickTaskService.removeById(pickTask);
|
||||
// 不需要,放行
|
||||
wcsService.sendWcsDisposeVehicle(new WcsDisposeVehicleRequest(targetStand.getStandId(), pickTask.getVehicleId()));
|
||||
// wcsService.sendWcsDisposeVehicle(new WcsDisposeVehicleRequest(targetStand.getStandId(), pickTask.getVehicleId()));
|
||||
// 判断是不是已经完成工作
|
||||
if (workFlowService.exists(new LambdaQueryWrapper<WorkFlow>()
|
||||
.eq(WorkFlow::getWorkStation, targetStand.getStandId())
|
||||
|
|
@ -1555,7 +1560,7 @@ public class TaskController {
|
|||
// 删除当前拣选任务
|
||||
pickTaskService.removeById(pickTask);
|
||||
// 放行
|
||||
wcsService.sendWcsDisposeVehicle(new WcsDisposeVehicleRequest(targetStand.getStandId(), pickTask.getVehicleId()));
|
||||
// wcsService.sendWcsDisposeVehicle(new WcsDisposeVehicleRequest(targetStand.getStandId(), pickTask.getVehicleId()));
|
||||
// 判断是不是已经完成工作
|
||||
if (workFlowService.exists(new LambdaQueryWrapper<WorkFlow>()
|
||||
.eq(WorkFlow::getWorkStation, targetStand.getStandId())
|
||||
|
|
@ -2076,6 +2081,13 @@ public class TaskController {
|
|||
logger.info("请求整理盒子:{},ip地址:{}", convertJsonString(sortBoxRequest), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
// 判断请求参数是否正确
|
||||
if (sortBoxRequest == null || StringUtils.isEmpty(sortBoxRequest.getBigBoxNo()) || sortBoxRequest.getOrderOfOrders() == null) {
|
||||
logger.error("请求参数不全。");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("请求参数不全。");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
// 获取站台号
|
||||
String standId = "";
|
||||
if (StringUtils.isNotEmpty(sortBoxRequest.getStandId())) {
|
||||
|
|
@ -2117,70 +2129,87 @@ public class TaskController {
|
|||
response.setMessage("请将已亮灯的盒子取走并灭灯后重试。");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
// 生成工位列表
|
||||
List<String> workCenterList = stationConfigs.stream().map(WorkStationConfig::getWorkCenter).distinct().toList();
|
||||
// 筛选小盒子号
|
||||
List<String> smallBoxListOfAll = stationConfigs.stream().map(WorkStationConfig::getSmallBox).distinct().toList();
|
||||
// 查询该盒子下面所有的工单
|
||||
List<KateOrders> orders = kateOrdersService.list(new LambdaQueryWrapper<KateOrders>()
|
||||
.in(KateOrders::getSupplyArea, smallBoxListOfAll));
|
||||
List<String> orderIds = orders.stream().map(KateOrders::getOrderId).distinct().toList();
|
||||
// 查询DBS
|
||||
List<KateDBS> dbsList = kateDBSService.list(new LambdaQueryWrapper<KateDBS>()
|
||||
.in(KateDBS::getWorkOrder, orderIds)
|
||||
.orderByAsc(KateDBS::getWorkSequence));
|
||||
if (dbsList.isEmpty()) {
|
||||
logger.error("DBS查询不到对应信息。");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("DBS查询不到对应信息。");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
// 获取要打印的工单号
|
||||
String currentOrderId = dbsList.get(sortBoxRequest.getOrderOfOrders() - 1).getWorkOrder();
|
||||
List<String> smallBoxList = orders.stream().filter(order -> order.getWorkOrder().equals(currentOrderId)).map(KateOrders::getSupplyArea).distinct().toList();
|
||||
// 亮灯列表
|
||||
List<ETaskData> eTaskDataList = new ArrayList<>();
|
||||
for (String workCenter : workCenterList) {
|
||||
if (!eTaskDataList.isEmpty()) {
|
||||
break;
|
||||
for (String smallBox : smallBoxList) {
|
||||
// 查找对应的标签配置
|
||||
ELocationConfigLast eConfigLast = eLocationConfigLastService.getOne(new LambdaQueryWrapper<ELocationConfigLast>()
|
||||
.eq(ELocationConfigLast::getWorkStation, standId)
|
||||
.eq(ELocationConfigLast::getWorkCenter, smallBox)
|
||||
.eq(ELocationConfigLast::getBoxStatus, 0)
|
||||
.last("limit 1"));
|
||||
if (eConfigLast != null) {
|
||||
// 当次拣选数量
|
||||
ETaskData eTaskData = new ETaskData();
|
||||
eTaskData.setTaskId(generateId(smallBox + "_"));// 用户查询对应的拣选任务
|
||||
eTaskData.setETaskId(generateId(smallBox + "_"));
|
||||
eTaskData.setGoodsId(smallBox);
|
||||
eTaskData.setGoodsName("");
|
||||
eTaskData.setNeedNum(1);
|
||||
eTaskData.setLocation(eConfigLast.getELocationId());
|
||||
eTaskDataList.add(eTaskData);
|
||||
// 更新电子标签库位信息
|
||||
etagLocationService.update(new LambdaUpdateWrapper<ETagLocation>()
|
||||
.set(ETagLocation::getTaskId, eTaskData.getTaskId())
|
||||
.set(ETagLocation::getNeedNum, eTaskData.getNeedNum())
|
||||
.set(ETagLocation::getConfirmNum, eTaskData.getNeedNum())
|
||||
.eq(ETagLocation::getELocationId, eConfigLast.getELocationId()));
|
||||
}
|
||||
List<String> smallBoxList = stationConfigs.stream().filter(stationConfig -> stationConfig.getWorkCenter().equals(workCenter)).map(WorkStationConfig::getSmallBox).distinct().toList();
|
||||
for (String smallBox : smallBoxList) {
|
||||
// 查找对应的标签配置
|
||||
ELocationConfigLast eConfigLast = eLocationConfigLastService.getOne(new LambdaQueryWrapper<ELocationConfigLast>()
|
||||
.eq(ELocationConfigLast::getWorkStation, standId)
|
||||
.eq(ELocationConfigLast::getWorkCenter, smallBox)
|
||||
.eq(ELocationConfigLast::getBoxStatus, 0)
|
||||
.last("limit 1"));
|
||||
if (eConfigLast != null) {
|
||||
// 当次拣选数量
|
||||
ETaskData eTaskData = new ETaskData();
|
||||
eTaskData.setTaskId(generateId(smallBox + "_"));// 用户查询对应的拣选任务
|
||||
eTaskData.setETaskId(generateId(smallBox + "_"));
|
||||
eTaskData.setGoodsId(smallBox);
|
||||
eTaskData.setGoodsName("");
|
||||
eTaskData.setNeedNum(1);
|
||||
eTaskData.setLocation(eConfigLast.getELocationId());
|
||||
eTaskDataList.add(eTaskData);
|
||||
// 更新电子标签库位信息
|
||||
}
|
||||
if (!eTaskDataList.isEmpty()) {
|
||||
// 发送亮灯
|
||||
WcsETaskRequest wcsETaskRequest = new WcsETaskRequest();
|
||||
wcsETaskRequest.setTaskGroup(generateId(sortBoxRequest.getBigBoxNo() + "_"));
|
||||
wcsETaskRequest.setTaskType(2);
|
||||
wcsETaskRequest.setTaskData(eTaskDataList);
|
||||
wcsETaskRequest.setOrderId(generateId(""));
|
||||
wcsETaskRequest.setVehicleNo(sortBoxRequest.getBigBoxNo());
|
||||
String sendToWcsETaskUrl = configMap.get(ConfigMapKeyEnum.URL_WCS_E_TASK.getConfigKey());
|
||||
if (StringUtils.isEmpty(sendToWcsETaskUrl)) {
|
||||
// url地址为空
|
||||
logger.error("向Wcs发送电子标签亮灯任务的地址为空");
|
||||
} else {
|
||||
logger.info("发送电子标签亮灯请求:{}", convertJsonString(wcsETaskRequest));
|
||||
ResponseEntity result = JSON.parseObject(HttpUtils.sendHttpPostWithoutToken(sendToWcsETaskUrl, convertJsonString(wcsETaskRequest)), ResponseEntity.class);
|
||||
if (result == null || !Objects.equals(result.getCode(), ResponseCode.OK.getCode())) {
|
||||
logger.error("发送电子标签亮灯任务失败:{}", convertJsonString(result));
|
||||
throw new Exception("发送电子标签亮灯任务失败");
|
||||
} else {
|
||||
// 更新亮灯数据
|
||||
etagLocationService.update(new LambdaUpdateWrapper<ETagLocation>()
|
||||
.set(ETagLocation::getTaskId, eTaskData.getTaskId())
|
||||
.set(ETagLocation::getNeedNum, eTaskData.getNeedNum())
|
||||
.set(ETagLocation::getConfirmNum, eTaskData.getNeedNum())
|
||||
.eq(ETagLocation::getELocationId, eConfigLast.getELocationId()));
|
||||
.set(ETagLocation::getPickStatus, 1)
|
||||
.set(ETagLocation::getTaskType, wcsETaskRequest.getTaskType())
|
||||
.set(ETagLocation::getVehicleNo, wcsETaskRequest.getVehicleNo())
|
||||
.in(ETagLocation::getELocationId, eTaskDataList.stream().map(ETaskData::getLocation).collect(Collectors.toList())));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 发送亮灯
|
||||
WcsETaskRequest wcsETaskRequest = new WcsETaskRequest();
|
||||
wcsETaskRequest.setTaskGroup(generateId(sortBoxRequest.getBigBoxNo() + "_"));
|
||||
wcsETaskRequest.setTaskType(2);
|
||||
wcsETaskRequest.setTaskData(eTaskDataList);
|
||||
wcsETaskRequest.setOrderId(generateId(""));
|
||||
wcsETaskRequest.setVehicleNo(sortBoxRequest.getBigBoxNo());
|
||||
String sendToWcsETaskUrl = configMap.get(ConfigMapKeyEnum.URL_WCS_E_TASK.getConfigKey());
|
||||
if (StringUtils.isEmpty(sendToWcsETaskUrl)) {
|
||||
// url地址为空
|
||||
logger.error("向Wcs发送电子标签亮灯任务的地址为空");
|
||||
logger.info("处理整理盒子请求成功。");
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("请根据灯光拣选盒子。");
|
||||
} else {
|
||||
logger.info("发送电子标签亮灯请求:{}", convertJsonString(wcsETaskRequest));
|
||||
ResponseEntity result = JSON.parseObject(HttpUtils.sendHttpPostWithoutToken(sendToWcsETaskUrl, convertJsonString(wcsETaskRequest)), ResponseEntity.class);
|
||||
if (result == null || !Objects.equals(result.getCode(), ResponseCode.OK.getCode())) {
|
||||
logger.error("发送电子标签亮灯任务失败:{}", convertJsonString(result));
|
||||
throw new Exception("发送电子标签亮灯任务失败");
|
||||
} else {
|
||||
// 更新亮灯数据
|
||||
etagLocationService.update(new LambdaUpdateWrapper<ETagLocation>()
|
||||
.set(ETagLocation::getPickStatus, 1)
|
||||
.set(ETagLocation::getTaskType, wcsETaskRequest.getTaskType())
|
||||
.set(ETagLocation::getVehicleNo, wcsETaskRequest.getVehicleNo())
|
||||
.in(ETagLocation::getELocationId, eTaskDataList.stream().map(ETaskData::getLocation).collect(Collectors.toList())));
|
||||
}
|
||||
logger.info("没有可亮灯的数据。");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("没有可亮灯的数据。");
|
||||
}
|
||||
logger.info("处理整理盒子请求成功。");
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("请根据灯光拣选盒子。");
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
|
|
@ -2206,6 +2235,13 @@ public class TaskController {
|
|||
logger.info("直接物料非计划领料:{},ip地址:{}", convertJsonString(noPlanRequest), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
if (StringUtils.isEmpty(noPlanRequest.getGoodsId())
|
||||
|| noPlanRequest.getNeedNum() == null || noPlanRequest.getNeedNum().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
logger.error("非计划领料,请输入料号和数量。");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("非计划领料,请输入料号和数量。");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
// 获取站台号
|
||||
Stand targetStand;
|
||||
if (StringUtils.isNotEmpty(noPlanRequest.getStandId())) {
|
||||
|
|
@ -2225,13 +2261,62 @@ public class TaskController {
|
|||
return convertJsonString(response);
|
||||
}
|
||||
// 查询库存
|
||||
// TODO 非计划领料待确认
|
||||
// Task中的isPicking=1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
List<Stock> stockList = stockService.list(new LambdaQueryWrapper<Stock>()
|
||||
.eq(Stock::getStockStatus, StockStatus.OK.getCode())
|
||||
.apply("goods_related ->> '$.goodsId' = {0}", noPlanRequest.getGoodsId())
|
||||
.apply("goods_related ->> '$.remainNum' > 0")
|
||||
.orderByAsc(Stock::getCreateTime));
|
||||
// 查询应该的库存总数
|
||||
List<StockOfGoodsDto> stockOfGoodsList = stockService.selectSumOfGoods(noPlanRequest.getGoodsId());
|
||||
// 总数量
|
||||
BigDecimal stockNum = stockOfGoodsList.stream().map(StockOfGoodsDto::getRemainNumSum).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
if (stockList != null && !stockList.isEmpty()) {
|
||||
List<Stock> waitForOutStockList = new ArrayList<>();
|
||||
// TODO 生成出库任务
|
||||
// 尝试生成出库任务
|
||||
// for (Stock tempStock : stockList) {
|
||||
// if (needNum.compareTo(BigDecimal.ZERO) <= 0) {// 需求数量小于等于0
|
||||
// break;
|
||||
// }
|
||||
// if (tempStock.getGoodsRelated().getRemainNum().compareTo(needNum) > 0) {
|
||||
// // 当前箱子剩余物料数量多于需求数量
|
||||
// needNum = BigDecimal.ZERO;
|
||||
// // 设置剩余数量
|
||||
// StockDetailInfo goodsRelated = tempStock.getGoodsRelated();
|
||||
// goodsRelated.setRemainNum(goodsRelated.getRemainNum().subtract(needNum));
|
||||
// tempStock.setGoodsRelated(goodsRelated);
|
||||
// waitForOutStockList.add(tempStock);
|
||||
// break;
|
||||
// } else {
|
||||
// // 当前箱子物料剩余数量少于需求数量
|
||||
// needNum = needNum.subtract(tempStock.getGoodsRelated().getRemainNum());
|
||||
// // 设置剩余数量
|
||||
// StockDetailInfo goodsRelated = tempStock.getGoodsRelated();
|
||||
// goodsRelated.setRemainNum(BigDecimal.ZERO);
|
||||
// tempStock.setGoodsRelated(goodsRelated);
|
||||
// waitForOutStockList.add(tempStock);
|
||||
// }
|
||||
// }
|
||||
// createVehicleOutTaskAndPickTask(waitForOutStockList, workStation);
|
||||
// 非计划领料记录生成
|
||||
NoPlanRecord noPlanRecord = new NoPlanRecord();
|
||||
noPlanRecord.setRecordId(generateId("CLC-NO-PLAN_"));
|
||||
noPlanRecord.setCallType(1);
|
||||
noPlanRecord.setGoodsId(noPlanRequest.getGoodsId());
|
||||
noPlanRecord.setNeedNum(noPlanRequest.getNeedNum());
|
||||
noPlanRecord.setStockNum(stockNum);
|
||||
} else {
|
||||
if (stockNum.compareTo(BigDecimal.ZERO) > 0) {
|
||||
logger.error("所有库存在站台备料中。");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("所有库存在站台备料中。");
|
||||
} else {
|
||||
logger.error("非计划领料没有库存。");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("非计划领料没有库存。");
|
||||
}
|
||||
return convertJsonString(response);
|
||||
}
|
||||
|
||||
logger.info("处理整理盒子请求成功。");
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
|
|
@ -2240,9 +2325,9 @@ public class TaskController {
|
|||
} 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);
|
||||
}
|
||||
}
|
||||
|
|
@ -2256,9 +2341,9 @@ public class TaskController {
|
|||
@PostMapping("/clcNoPlanConfirmBack")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "直接物料非计划领料", logMethod = "clcNoPlanConfirmBack")
|
||||
@MyLog(logTitle = "直接物料非计划领料确认回库", logMethod = "clcNoPlanConfirmBack")
|
||||
public String clcNoPlanConfirmBack(@RequestBody NoPlanRequest noPlanRequest) {
|
||||
logger.info("直接物料非计划领料:{},ip地址:{}", convertJsonString(noPlanRequest), HttpUtils.getIpAddr(servletRequest));
|
||||
logger.info("直接物料非计划领料确认回库:{},ip地址:{}", convertJsonString(noPlanRequest), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
// 获取站台号
|
||||
|
|
@ -2283,10 +2368,6 @@ public class TaskController {
|
|||
// Task中的isPicking=1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
logger.info("处理整理盒子请求成功。");
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("请根据灯光拣选盒子。");
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@ public class WmsLogController {
|
|||
.or().like(StringUtils.isNotEmpty(logQuery.getQueryParam()), WmsLog::getLogRequest, logQuery.getQueryParam())
|
||||
.or().like(StringUtils.isNotEmpty(logQuery.getQueryParam()), WmsLog::getLogResponse, logQuery.getQueryParam())
|
||||
.or().like(StringUtils.isNotEmpty(logQuery.getQueryParam()), WmsLog::getLogIp, logQuery.getQueryParam())
|
||||
.or().like(StringUtils.isNotEmpty(logQuery.getQueryParam()), WmsLog::getLogUser, logQuery.getQueryParam()));
|
||||
.or().like(StringUtils.isNotEmpty(logQuery.getQueryParam()), WmsLog::getLogUser, logQuery.getQueryParam())
|
||||
.orderByDesc(WmsLog::getLogTime));
|
||||
|
||||
PageDto<WmsLogVo> pageDto = PageDto.of(logPage, log -> BeanUtil.copyProperties(log, WmsLogVo.class));
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.wms.entity.app.wcs;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class DdjStatusChangeRequest extends BaseWcsRequest {
|
||||
/**
|
||||
* 设备号
|
||||
*/
|
||||
@JsonProperty("equipment")
|
||||
private Integer equipment;
|
||||
/**
|
||||
* 错误
|
||||
*/
|
||||
@JsonProperty("error")
|
||||
private Integer error;
|
||||
}
|
||||
|
|
@ -310,18 +310,31 @@ public class WmsTaskServiceImplements implements IWmsTaskService {
|
|||
if (needNum.compareTo(BigDecimal.ZERO) <= 0) {// 需求数量小于等于0
|
||||
break;
|
||||
}
|
||||
if (outsideVehicle.getRemainNum().compareTo(needNum) > 0) {
|
||||
// 当前箱子剩余物料数量多于需求数量
|
||||
needNum = BigDecimal.ZERO;
|
||||
outsideVehicle.setRemainNum(outsideVehicle.getRemainNum().subtract(needNum));
|
||||
usedOutsideVehiclesList.add(outsideVehicle);
|
||||
break;
|
||||
// 查询当前料箱当前物料的库存
|
||||
Stock stock = stockService.getOne(new LambdaQueryWrapper<Stock>()
|
||||
.eq(Stock::getVehicleId, outsideVehicle.getVehicleId())
|
||||
.apply("goods_related ->> '$.goodsId' = {0}", goodsId)
|
||||
.apply("goods_related ->> '$.remainNum' > 0")
|
||||
.last("limit 1"));
|
||||
if (stock == null) {
|
||||
// 没有库存,那么就要移除当前的outsideVehicles
|
||||
outsideVehiclesService.removeById(outsideVehicle.getOutsideId());
|
||||
} else {
|
||||
// 当前箱子物料剩余数量少于需求数量
|
||||
needNum = needNum.subtract(outsideVehicle.getRemainNum());
|
||||
outsideVehicle.setRemainNum(BigDecimal.ZERO);
|
||||
usedOutsideVehiclesList.add(outsideVehicle);
|
||||
StockDetailInfo goodsRelated = stock.getGoodsRelated();
|
||||
if (goodsRelated.getRemainNum().compareTo(needNum) > 0) {
|
||||
// 当前箱子剩余物料数量多于需求数量
|
||||
needNum = BigDecimal.ZERO;
|
||||
outsideVehicle.setRemainNum(goodsRelated.getRemainNum().subtract(needNum));
|
||||
usedOutsideVehiclesList.add(outsideVehicle);
|
||||
break;
|
||||
} else {
|
||||
// 当前箱子物料剩余数量少于需求数量
|
||||
needNum = needNum.subtract(goodsRelated.getRemainNum());
|
||||
outsideVehicle.setRemainNum(BigDecimal.ZERO);
|
||||
usedOutsideVehiclesList.add(outsideVehicle);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// 更新流转箱表
|
||||
outsideVehiclesService.updateBatchById(usedOutsideVehiclesList);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ public class WorkServiceImplements implements IWorkService {
|
|||
private final WorkSummaryService workSummaryService;// 工作总结服务
|
||||
private final ELocationConfigLastService eLocationConfigLastService;// 上一次标签配置的服务
|
||||
private final StockService stockService;// 库存服务
|
||||
private final IWmsTaskService wmsTaskService;
|
||||
private final IWmsTaskService wmsTaskService;// 任务服务
|
||||
private final PickTaskService pickTaskService;// 拣选任务服务
|
||||
private final List<String> workCreatingStations = new ArrayList<>();// 当前正在创建任务的站台
|
||||
private final List<String> workDoingStations = new ArrayList<>();// 当前正在执行任务的站台
|
||||
private final List<String> workFinishingStations = new ArrayList<>();// 当前正在完成任务的站台
|
||||
|
|
@ -190,14 +191,19 @@ public class WorkServiceImplements implements IWorkService {
|
|||
.eq(GoodsToStation::getDistributeStatus, 0)
|
||||
.or().eq(GoodsToStation::getDistributeStatus, 1));
|
||||
if (goodsToStationList == null || goodsToStationList.isEmpty()) {
|
||||
// 更新工作流状态-->完成
|
||||
List<String> workFlowIds = currentWorkFlowList.stream().map(WorkFlow::getWorkFlowId).distinct().toList();
|
||||
workFlowService.update(new LambdaUpdateWrapper<WorkFlow>()
|
||||
.set(WorkFlow::getWorkStatus, 2)
|
||||
.set(WorkFlow::getFinishTime, LocalDateTime.now())
|
||||
.set(WorkFlow::getOpUser, "库存等原因,系统自动完成")
|
||||
.in(WorkFlow::getWorkFlowId, workFlowIds)
|
||||
.ne(WorkFlow::getWorkStatus, 2));
|
||||
// 查询是否还有这个站台的拣选任务
|
||||
if (!pickTaskService.exists(new LambdaQueryWrapper<PickTask>()
|
||||
.eq(PickTask::getStandId, workStation))) {
|
||||
// 已经不存在未分配的任务,且没有拣选任务,可视为完成。
|
||||
// 更新工作流状态-->完成
|
||||
List<String> workFlowIds = currentWorkFlowList.stream().map(WorkFlow::getWorkFlowId).distinct().toList();
|
||||
workFlowService.update(new LambdaUpdateWrapper<WorkFlow>()
|
||||
.set(WorkFlow::getWorkStatus, 2)
|
||||
.set(WorkFlow::getFinishTime, LocalDateTime.now())
|
||||
.set(WorkFlow::getOpUser, "系统自动完成")
|
||||
.in(WorkFlow::getWorkFlowId, workFlowIds)
|
||||
.ne(WorkFlow::getWorkStatus, 2));
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (GoodsToStation goodsToStation : goodsToStationList) {
|
||||
|
|
@ -224,8 +230,11 @@ public class WorkServiceImplements implements IWorkService {
|
|||
} else {
|
||||
needNum = wmsTaskService.callStocks(goodsToStation.getGoodsId(), needNum, workStation);
|
||||
if (needNum.compareTo(BigDecimal.ZERO) > 0) {
|
||||
// 分配完成但库存缺料
|
||||
// 已分配但未完全分配
|
||||
goodsToStation.setDistributeStatus(1);
|
||||
} else {
|
||||
// 分配完成
|
||||
goodsToStation.setDistributeStatus(2);
|
||||
}
|
||||
}
|
||||
// 更新已分配数量
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.read.listener.ReadListener;
|
||||
import com.alibaba.excel.util.ListUtils;
|
||||
import com.wms.entity.app.dto.extend.KanbanEntity;
|
||||
import com.wms.entity.table.Goods;
|
||||
import com.wms.service.GoodsService;
|
||||
import com.wms.utils.StringUtils;
|
||||
|
|
@ -23,9 +24,9 @@ import static com.wms.utils.StringUtils.convertJsonString;
|
|||
public class UploadGoodsListener implements ReadListener<GoodsExcelVo> {
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
/**
|
||||
* 每隔5条存储数据库,实际使用中可以100条,然后清理list ,方便内存回收
|
||||
* 每隔5条存储数据库,实际使用中可以1000条,然后清理list ,方便内存回收
|
||||
*/
|
||||
private static final int BATCH_COUNT = 100;
|
||||
private static final int BATCH_COUNT = 1000;
|
||||
/**
|
||||
* 保存数据总数
|
||||
*/
|
||||
|
|
@ -84,6 +85,9 @@ public class UploadGoodsListener implements ReadListener<GoodsExcelVo> {
|
|||
List<Goods> goodsList = new ArrayList<>();
|
||||
for (GoodsExcelVo goodsExcelVo : cachedDataList) {
|
||||
Goods currentGoods = BeanUtil.copyProperties(goodsExcelVo, Goods.class);
|
||||
// 设置看板
|
||||
List<KanbanEntity> kanbanList = goodsExcelVo.convertToKanbanList();
|
||||
currentGoods.setKanbanList(kanbanList);
|
||||
currentGoods.setLastUpdateTime(LocalDateTime.now());
|
||||
currentGoods.setLastUpdateUser(uploadUser);
|
||||
goodsList.add(currentGoods);
|
||||
|
|
|
|||
|
|
@ -3,14 +3,12 @@ package com.wms.utils.excel.vo;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.format.DateTimeFormat;
|
||||
import com.wms.entity.app.dto.extend.KanbanEntity;
|
||||
import com.wms.entity.table.Goods;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物料excel
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@ package com.wms.utils.excel.vo;
|
|||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.wms.entity.app.dto.extend.KanbanEntity;
|
||||
import com.wms.utils.StringUtils;
|
||||
import lombok.Data;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -142,4 +144,27 @@ public class KanbanExcelVo {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设定看板
|
||||
*/
|
||||
public List<KanbanEntity> convertToKanbanList() {
|
||||
List<KanbanEntity> kanbanList = new ArrayList<>();
|
||||
for (Field field : this.getClass().getDeclaredFields()) {
|
||||
if (field.getName().startsWith("KANBAN")) {
|
||||
try {
|
||||
field.setAccessible(true);
|
||||
if (StringUtils.isNotEmpty(String.valueOf(field.get(this)))) {
|
||||
KanbanEntity kanbanEntity = new KanbanEntity();
|
||||
kanbanEntity.setKanbanId(String.valueOf(field.get(this)));
|
||||
kanbanList.add(kanbanEntity);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
// 捕捉异常
|
||||
System.out.println("转化看板数据配置时发生异常:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return kanbanList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,20 +8,20 @@ spring:
|
|||
# 主库
|
||||
master:
|
||||
# 卡特数据库服务器
|
||||
# url: jdbc:mysql://10.90.36.71:3306/wms_kate_suzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||
# username: developer
|
||||
# password: developer
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://10.90.36.71:3306/wms_kate_suzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||
username: developer
|
||||
password: developer
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 宝开服务器--内网
|
||||
# url: jdbc:mysql://192.168.3.254:3306/wms_kate_suzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||
# username: coder
|
||||
# password: coder
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# # 本地环境
|
||||
url: jdbc:mysql://localhost:3306/wms_kate_suzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||
username: developer
|
||||
password: developer
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# url: jdbc:mysql://localhost:3306/wms_kate_suzhou?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||
# username: developer
|
||||
# password: developer
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 从库
|
||||
# slave_1:
|
||||
# url: jdbc:mysql://localhost:3306/wms_aaa?characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowMultiQueries=true&rewriteBatchedStatements=true
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user