代码更新--备料业务完成
This commit is contained in:
parent
15dca6d413
commit
00837564e8
|
|
@ -15,4 +15,29 @@ import com.wms.constants.enums.WmsTaskStatus;
|
|||
public class WmsConstants {
|
||||
public static String EMPTY_STRING = "";
|
||||
public static String ROOT_MENU_ID = "0";
|
||||
|
||||
public static Map<String, String> type_values = ImmutableMap.<String, String>builder()
|
||||
.put("LR01", "CLC一箱两料")
|
||||
.put("LR02", "CLC一箱一料")
|
||||
.put("UD01", "CLC一箱两料")
|
||||
.put("FC01", "CLC一箱一料")
|
||||
.put("FB01", "No-CLC一箱一料")
|
||||
.put("FB02", "间接物料")
|
||||
.put("FB03", "间接物料")
|
||||
.put("FB04", "间接物料")
|
||||
.put("FB05", "间接物料")
|
||||
.put("FB06", "间接物料")
|
||||
.build();
|
||||
public static Map<String, String> type_descriptions = ImmutableMap.<String, String>builder()
|
||||
.put("LR01", "810左右4个")
|
||||
.put("LR02", "811左右2个")
|
||||
.put("UD01", "911上下2个")
|
||||
.put("FC01", "822整体1个")
|
||||
.put("FB01", "分包1个料箱")
|
||||
.put("FB02", "分包1/2个料箱")
|
||||
.put("FB03", "分包1/3个料箱")
|
||||
.put("FB04", "分包1/4个料箱")
|
||||
.put("FB05", "分包1/5个料箱")
|
||||
.put("FB06", "分包1/6个料箱")
|
||||
.build();
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ import com.wms.entity.app.*;
|
|||
import com.wms.entity.app.dto.PageDto;
|
||||
import com.wms.entity.app.dto.extend.StockDetailInfo;
|
||||
import com.wms.entity.app.request.*;
|
||||
import com.wms.entity.app.vo.StandPickFinishVo;
|
||||
import com.wms.entity.app.vo.StandPickVo;
|
||||
import com.wms.entity.app.vo.TaskVO;
|
||||
import com.wms.entity.app.wcs.*;
|
||||
|
|
@ -335,7 +336,7 @@ public class TaskController {
|
|||
// 添加载具
|
||||
Vehicle newVehicle = new Vehicle();
|
||||
newVehicle.setVehicleId(inTask.getVehicleId());
|
||||
newVehicle.setVehicleType(1);
|
||||
newVehicle.setVehicleType("");
|
||||
newVehicle.setVehicleStatus(VehicleStatus.ON.getCode());
|
||||
newVehicle.setCurrentLocation(inTask.getDestination());
|
||||
if (haveMoveTask) {
|
||||
|
|
@ -1022,11 +1023,11 @@ public class TaskController {
|
|||
* @param workConfirmRequest 请求信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/confirmFinishedWork")
|
||||
@PostMapping("/confirmFinishWork")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "确认当前拣货完成(wms界面触发)", logMethod = "confirmFinishedWork")
|
||||
public String confirmFinishedWork(@RequestBody WorkConfirmRequest workConfirmRequest) {
|
||||
@MyLog(logTitle = "确认当前拣货完成(wms界面触发)", logMethod = "confirmFinishWork")
|
||||
public String confirmFinishWork(@RequestBody WorkConfirmRequest workConfirmRequest) {
|
||||
logger.info("接收到确认当前拣货完成(wms界面触发)请求:{},ip地址:{}", convertJsonString(workConfirmRequest), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
|
|
@ -1281,4 +1282,143 @@ public class TaskController {
|
|||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前站台任务完成信息
|
||||
*
|
||||
* @param workQuery 请求信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/getFinishedWorkInfo")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "获取当前站台任务完成信息", logMethod = "getFinishedWorkInfo")
|
||||
public String getFinishedWorkInfo(@RequestBody WorkQuery workQuery) {
|
||||
logger.info("获取当前站台任务完成信息:{},ip地址:{}", convertJsonString(workQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
// 获取站台号
|
||||
String standId = "";
|
||||
if (StringUtils.isNotEmpty(workQuery.getStandId())) {
|
||||
// 站台号从请求参数中获取
|
||||
standId = workQuery.getStandId();
|
||||
} 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)) {
|
||||
logger.error("请求参数缺少站台号。");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("请求参数缺少站台号。");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
// 生成前台VO
|
||||
StandPickFinishVo standPickFinishVo = new StandPickFinishVo();
|
||||
standPickFinishVo.setStandId(standId);
|
||||
try {
|
||||
// 获取当前站台已完成数量
|
||||
List<WorkFlow> allWorkFlows = workFlowService.list();
|
||||
int finishedRows = 0;
|
||||
BigDecimal finishedCounts = BigDecimal.ZERO;
|
||||
BigDecimal planCounts = BigDecimal.ZERO;
|
||||
for (WorkFlow workFlow : allWorkFlows) {
|
||||
if (workFlow.getWorkStatus() == 2) {
|
||||
finishedRows++;
|
||||
}
|
||||
finishedCounts = finishedCounts.add(workFlow.getPickedNum());
|
||||
planCounts = planCounts.add(workFlow.getNeedNum());
|
||||
}
|
||||
standPickFinishVo.setPlanRows(allWorkFlows.size());
|
||||
standPickFinishVo.setActualRows(finishedRows);
|
||||
standPickFinishVo.setPlanCounts(planCounts);
|
||||
standPickFinishVo.setActualCounts(finishedCounts);
|
||||
if (finishedRows == allWorkFlows.size()) {
|
||||
standPickFinishVo.setTip("工作已经完成,请打印标签");
|
||||
} else {
|
||||
standPickFinishVo.setTip("工作未完成,请继续工作");
|
||||
}
|
||||
if (finishedCounts.compareTo(planCounts) < 0) {
|
||||
standPickFinishVo.setRemark("有缺料,请至异常区处理");
|
||||
} else {
|
||||
standPickFinishVo.setRemark("正常");
|
||||
}
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("获取工作信息成功");
|
||||
response.setReturnData(standPickFinishVo);
|
||||
} catch (Exception e) {
|
||||
logger.error("获取已完成数据报表失败,可能存在类型转换错误");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("获取已完成数据报表失败,可能存在类型转换错误");
|
||||
}
|
||||
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("获取当前站台任务完成信息");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("获取当前站台任务完成信息");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 工作完成确认
|
||||
*
|
||||
* @param workQuery 请求信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/confirmFinishedWork")
|
||||
@ResponseBody
|
||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||
@MyLog(logTitle = "工作完成确认", logMethod = "confirmFinishedWork")
|
||||
public String confirmFinishedWork(@RequestBody WorkQuery workQuery) {
|
||||
logger.info("工作完成确认:{},ip地址:{}", convertJsonString(workQuery), HttpUtils.getIpAddr(servletRequest));
|
||||
ResponseEntity response = new ResponseEntity();
|
||||
try {
|
||||
// 获取站台号
|
||||
String standId = "";
|
||||
if (StringUtils.isNotEmpty(workQuery.getStandId())) {
|
||||
// 站台号从请求参数中获取
|
||||
standId = workQuery.getStandId();
|
||||
} 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)) {
|
||||
logger.error("请求参数缺少站台号。");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("请求参数缺少站台号。");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
String finishResult = workService.finishWork(standId);
|
||||
if (Objects.equals(finishResult, "")) {
|
||||
// 工作完成成功
|
||||
response.setCode(ResponseCode.OK.getCode());
|
||||
response.setMessage("确认成功,请至收盒子界面完成后续操作。");
|
||||
} else {
|
||||
// 工作完成失败
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("确认失败:" + finishResult);
|
||||
}
|
||||
return convertJsonString(response);
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
logger.error("工作完成确认异常");
|
||||
response.setCode(ResponseCode.ERROR.getCode());
|
||||
response.setMessage("工作完成确认异常");
|
||||
return convertJsonString(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -26,6 +26,11 @@ public class VehicleQuery extends PageQuery {
|
|||
*/
|
||||
@JsonProperty("isEmpty")
|
||||
private Integer isEmpty;
|
||||
/**
|
||||
* 料箱类型
|
||||
*/
|
||||
@JsonProperty("vehicleType")
|
||||
private String vehicleType;
|
||||
/**
|
||||
* 当前位置
|
||||
*/
|
||||
|
|
@ -42,6 +47,7 @@ public class VehicleQuery extends PageQuery {
|
|||
vehiclePO.setVehicleStatus(vehicleStatus);
|
||||
vehiclePO.setIsEmpty(isEmpty);
|
||||
vehiclePO.setCurrentLocation(currentLocation);
|
||||
vehiclePO.setVehicleType(vehicleType);
|
||||
|
||||
return vehiclePO;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public class VehicleVO {
|
|||
/**
|
||||
* 载具类型
|
||||
*/
|
||||
private Integer vehicleType;
|
||||
private String vehicleType;
|
||||
/**
|
||||
* 额外信息
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
package com.wms.entity.table;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电子标签库位对应工单工位盒子
|
||||
*/
|
||||
|
|
@ -46,4 +49,28 @@ public class ELocationConfig {
|
|||
*/
|
||||
@TableField("print_counts")
|
||||
private Integer printCounts = 0;
|
||||
|
||||
/**
|
||||
* 转换为ELocationConfigLast
|
||||
* @return 转换后的ELocationConfigLast
|
||||
*/
|
||||
public ELocationConfigLast toLocationConfigLast() {
|
||||
ELocationConfigLast newELocationConfigLast = new ELocationConfigLast();
|
||||
newELocationConfigLast.setELocationId(this.eLocationId);
|
||||
newELocationConfigLast.setOrderBoxNo(this.orderBoxNo);
|
||||
newELocationConfigLast.setWorkCenter(this.workCenter);
|
||||
newELocationConfigLast.setWorkOrder(this.workOrder);
|
||||
newELocationConfigLast.setWorkStation(this.workStation);
|
||||
|
||||
return newELocationConfigLast;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换为ELocationConfigLast列表
|
||||
* @param eLocationConfigs 原来配置列表
|
||||
* @return 转换后的列表
|
||||
*/
|
||||
public static List<ELocationConfigLast> toLocationsConfigLastList(List<ELocationConfig> eLocationConfigs) {
|
||||
return BeanUtil.copyToList(eLocationConfigs, ELocationConfigLast.class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
44
src/main/java/com/wms/entity/table/ELocationConfigLast.java
Normal file
44
src/main/java/com/wms/entity/table/ELocationConfigLast.java
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
package com.wms.entity.table;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 待收盒子配置表
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "tbl_app_e_location_config_last", autoResultMap = true)
|
||||
public class ELocationConfigLast {
|
||||
/**
|
||||
* 电子标签库位
|
||||
*/
|
||||
@TableId("e_location_id")
|
||||
private String eLocationId;
|
||||
/**
|
||||
* 工站
|
||||
*/
|
||||
@TableField("work_station")
|
||||
private String workStation;
|
||||
/**
|
||||
* 工单
|
||||
*/
|
||||
@TableField("work_order")
|
||||
private String workOrder;
|
||||
/**
|
||||
* 工位
|
||||
*/
|
||||
@TableField("work_center")
|
||||
private String workCenter;
|
||||
/**
|
||||
* 盒子号
|
||||
*/
|
||||
@TableField("order_box_no")
|
||||
private String orderBoxNo;
|
||||
/**
|
||||
* 是否取走
|
||||
*/
|
||||
@TableField("box_status")
|
||||
private Integer boxStatus = 0;
|
||||
}
|
||||
|
|
@ -39,7 +39,7 @@ public class Vehicle {
|
|||
* 载具类型
|
||||
*/
|
||||
@TableField("vehicle_type")
|
||||
private Integer vehicleType;
|
||||
private String vehicleType;
|
||||
/**
|
||||
* 额外信息
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
package com.wms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.wms.entity.table.ELocationConfigLast;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ELocationConfigLastMapper extends BaseMapper<ELocationConfigLast> {
|
||||
}
|
||||
|
|
@ -4,10 +4,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.wms.entity.table.Vehicle;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 载具mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface VehicleMapper extends BaseMapper<Vehicle> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.wms.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.wms.entity.table.ELocationConfigLast;
|
||||
|
||||
/**
|
||||
* 电子标签库位配置服务接口
|
||||
*/
|
||||
public interface ELocationConfigLastService extends IService<ELocationConfigLast> {
|
||||
}
|
||||
|
|
@ -5,8 +5,8 @@ import com.wms.entity.app.dto.VehicleDto;
|
|||
import com.wms.entity.table.Vehicle;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface VehicleService extends IService<Vehicle> {
|
||||
|
||||
List<VehicleDto> selVehicles(Vehicle vehicle);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ public class WorkServiceImplements implements IWorkService {
|
|||
private final PickTaskService pickTaskService;// 拣选任务服务
|
||||
private final VehicleService vehicleService;// 载具服务
|
||||
private final WorkSummaryService workSummaryService;// 工作总结服务
|
||||
private final ELocationConfigLastService eLocationConfigLastService;// 上一次标签配置的服务
|
||||
private final List<String> workCreatingStations = new ArrayList<>();// 当前正在创建任务的站台
|
||||
private final List<String> workDoingStations = new ArrayList<>();// 当前正在执行任务的站台
|
||||
private final List<String> workFinishingStations = new ArrayList<>();// 当前正在完成任务的站台
|
||||
|
|
@ -305,6 +306,15 @@ public class WorkServiceImplements implements IWorkService {
|
|||
// 有标签未打印
|
||||
return "有标签未打印";
|
||||
}
|
||||
// 查找当前站台的标签配置
|
||||
List<ELocationConfig> eLocationConfigList = eLocationConfigService.list(new LambdaQueryWrapper<ELocationConfig>()
|
||||
.eq(ELocationConfig::getWorkStation, workStation));
|
||||
// 保存一下记录
|
||||
List<ELocationConfigLast> eLocationConfigLastList = ELocationConfig.toLocationsConfigLastList(eLocationConfigList);
|
||||
// 先清空之前的
|
||||
eLocationConfigLastService.remove(new LambdaQueryWrapper<ELocationConfigLast>()
|
||||
.eq(ELocationConfigLast::getWorkStation, workStation));
|
||||
eLocationConfigLastService.saveBatch(eLocationConfigLastList);
|
||||
// 删除所有的标签配置
|
||||
eLocationConfigService.remove(new LambdaQueryWrapper<ELocationConfig>()
|
||||
.eq(ELocationConfig::getWorkStation, workStation));
|
||||
|
|
@ -329,6 +339,7 @@ public class WorkServiceImplements implements IWorkService {
|
|||
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())
|
||||
|
|
@ -337,12 +348,23 @@ public class WorkServiceImplements implements IWorkService {
|
|||
.eq(KateOrders::getOrderId, workFlow.getOrderId())
|
||||
.eq(KateOrders::getSupplyArea, workFlow.getWorkCenter())
|
||||
.eq(KateOrders::getGoodsId, workFlow.getGoodsId()));
|
||||
// 如果当前工单已经没有未完成的工作,更新DBS状态完成
|
||||
if (!kateOrdersService.exists(new LambdaQueryWrapper<KateOrders>()
|
||||
.eq(KateOrders::getOrderId, workFlow.getOrderId())
|
||||
.ne(KateOrders::getOrderStatus, 4))) {
|
||||
kateDBSService.update(new LambdaUpdateWrapper<KateDBS>()
|
||||
.set(KateDBS::getDbsStatus, 2)
|
||||
.set(KateDBS::getLastUpdateTime, LocalDateTime.now())
|
||||
.eq(KateDBS::getWorkOrder, workFlow.getOrderId()));
|
||||
}
|
||||
}
|
||||
workSummaryService.saveBatch(workSummaryList);
|
||||
// 更新工单表
|
||||
|
||||
// 更新DBS表
|
||||
|
||||
// 移除工作流
|
||||
workFlowService.remove(new LambdaQueryWrapper<WorkFlow>()
|
||||
.eq(WorkFlow::getWorkStation, workStation));
|
||||
// 移库站台要料
|
||||
goodsToStationService.remove(new LambdaQueryWrapper<GoodsToStation>()
|
||||
.eq(GoodsToStation::getWorkStation, workStation));
|
||||
} catch (Exception e) {
|
||||
throw new Exception("完成站台:" + workStation + "工作发生异常!");
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.wms.service.serviceImplements;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wms.entity.table.ELocationConfig;
|
||||
import com.wms.entity.table.ELocationConfigLast;
|
||||
import com.wms.mapper.ELocationConfigLastMapper;
|
||||
import com.wms.mapper.ELocationConfigMapper;
|
||||
import com.wms.service.ELocationConfigLastService;
|
||||
import com.wms.service.ELocationConfigService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 电子标签库位配置服务实现
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class ELocationConfigLastServiceImpl extends ServiceImpl<ELocationConfigLastMapper, ELocationConfigLast> implements ELocationConfigLastService {
|
||||
}
|
||||
|
|
@ -12,7 +12,9 @@ import lombok.RequiredArgsConstructor;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
|
|
|
|||
6
src/main/resources/mapper/ELocationConfigMapperLast.xml
Normal file
6
src/main/resources/mapper/ELocationConfigMapperLast.xml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.wms.mapper.ELocationConfigLastMapper">
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user