初版作成
This commit is contained in:
parent
1e06a27a44
commit
434f8ccc03
|
|
@ -2,6 +2,7 @@
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<annotationProcessing>
|
<annotationProcessing>
|
||||||
|
<profile default="true" name="Default" enabled="true" />
|
||||||
<profile name="Maven default annotation processors profile" enabled="true">
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@ public enum AppConfigKeyEnums {
|
||||||
STAND_CAPACITY("StandCapacity", "站台容量"),
|
STAND_CAPACITY("StandCapacity", "站台容量"),
|
||||||
IMAGE_IP("ImageIp", "图片存放ip"),
|
IMAGE_IP("ImageIp", "图片存放ip"),
|
||||||
EMPTY_BACK("EmptyBack", "空载具是否回库"),
|
EMPTY_BACK("EmptyBack", "空载具是否回库"),
|
||||||
STOCK_WARNING_QTY("StockWarningQty", "库存预警数量");
|
STOCK_WARNING_QTY("StockWarningQty", "库存预警数量"),
|
||||||
|
MES_GET_GOODS_URL("MesGetGoodsUrl", "获取物料信息地址");
|
||||||
private final String key;
|
private final String key;
|
||||||
private final String desc;
|
private final String desc;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,142 +0,0 @@
|
||||||
package com.wms_main.controller.wms;
|
|
||||||
|
|
||||||
import com.wms_main.model.dto.query.*;
|
|
||||||
import com.wms_main.model.dto.request.wms.BaseWmsRequest;
|
|
||||||
import com.wms_main.model.dto.request.wms.ConfirmWorkRequest;
|
|
||||||
import com.wms_main.model.dto.request.wms.GenKanbanRequirementRequest;
|
|
||||||
import com.wms_main.model.dto.request.wms.InitKateWorkRequest;
|
|
||||||
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
|
||||||
import com.wms_main.model.dto.response.wms.WmsApiResponse;
|
|
||||||
import com.wms_main.model.vo.wms.*;
|
|
||||||
import com.wms_main.service.controller.IKateWorkControllerService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 卡特相关控制类
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@ResponseBody
|
|
||||||
@CrossOrigin
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@RequestMapping("/wms/kate")
|
|
||||||
public class KateWorkController {
|
|
||||||
private final IKateWorkControllerService kateWorkControllerService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理查询请求
|
|
||||||
* @param kateWorksQuery 查询参数
|
|
||||||
* @return 查询结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/queryKateWorks")
|
|
||||||
public WmsApiResponse<KateWorkOptionsVo> queryKateWorks(@RequestBody KateWorksQuery kateWorksQuery) {
|
|
||||||
return kateWorkControllerService.queryKateWorks(kateWorksQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 请求创建工作
|
|
||||||
* @param initKateWorkRequest 请求参数
|
|
||||||
* @return 查询结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/initWorks")
|
|
||||||
public BaseWmsApiResponse initWorks(@RequestBody InitKateWorkRequest initKateWorkRequest) {
|
|
||||||
return kateWorkControllerService.initWorks(initKateWorkRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取工作信息
|
|
||||||
* @param kateWorksQuery 请求参数
|
|
||||||
* @return 查询结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/getCurrentWorks")
|
|
||||||
public WmsApiResponse<WorkConfirmVo> getCurrentWorks(@RequestBody KateWorksQuery kateWorksQuery) {
|
|
||||||
return kateWorkControllerService.getCurrentWorks(kateWorksQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 确认工作
|
|
||||||
* @param confirmWorkRequest 请求参数
|
|
||||||
* @return 查询结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/confirmCurrentWork")
|
|
||||||
public BaseWmsApiResponse confirmCurrentWork(@RequestBody ConfirmWorkRequest confirmWorkRequest) {
|
|
||||||
return kateWorkControllerService.confirmCurrentWork(confirmWorkRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询图纸
|
|
||||||
* @param request 请求参数
|
|
||||||
* @return 查询结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/getImageOfWork")
|
|
||||||
public WmsApiResponse<ImageVo> getImageOfWork(@RequestBody BaseWmsRequest request) {
|
|
||||||
return kateWorkControllerService.getImageOfWork(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 配料界面获取料盒显示信息
|
|
||||||
* @param request 请求
|
|
||||||
* @return 查询结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/getBoxesAndLacks")
|
|
||||||
WmsApiResponse<BoxDetailVo> getBoxesAndLacks(@RequestBody BaseWmsRequest request) {
|
|
||||||
return kateWorkControllerService.getBoxesAndLacks(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查看看板
|
|
||||||
* @param kanbanQuery 查询参数
|
|
||||||
* @return 查询结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/queryKanbanByPage")
|
|
||||||
WmsApiResponse<PageVo<KanbanVo>> queryKanbanByPage(@RequestBody KanbanQuery kanbanQuery) {
|
|
||||||
return kateWorkControllerService.queryKanbanByPage(kanbanQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/genClcKanbanRequirement")
|
|
||||||
BaseWmsApiResponse genClcKanbanRequirement(@RequestBody GenKanbanRequirementRequest genRequest) {
|
|
||||||
return kateWorkControllerService.genClcKanbanRequirement(genRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询图纸
|
|
||||||
* @param imageQuery 查询参数
|
|
||||||
* @return 查询结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/requestImageDetail")
|
|
||||||
public WmsApiResponse<List<ImageVo>> requestImageDetail(@RequestBody ImageQuery imageQuery) {
|
|
||||||
return kateWorkControllerService.requestImageDetail(imageQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询DBS数据--分页
|
|
||||||
* @param dbsQuery 查询参数
|
|
||||||
* @return 查询结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/queryDbsByPage")
|
|
||||||
public WmsApiResponse<PageVo<DbsVo>> queryDbsByPage(@RequestBody DbsQuery dbsQuery) {
|
|
||||||
return kateWorkControllerService.queryDbsByPage(dbsQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询配料单数据--分页
|
|
||||||
* @param kittingBomQuery 查询参数
|
|
||||||
* @return 查询结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/queryKittingBomByPage")
|
|
||||||
public WmsApiResponse<PageVo<KittingBomVo>> queryKittingBomByPage(@RequestBody KittingBomQuery kittingBomQuery) {
|
|
||||||
return kateWorkControllerService.queryKittingBomByPage(kittingBomQuery);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询配对关系数据--分页
|
|
||||||
* @param kittingBomRelationQuery 查询参数
|
|
||||||
* @return 查询结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/queryRelationByPage")
|
|
||||||
public WmsApiResponse<PageVo<KittingBomRelationVo>> queryKittingRelationByPage(@RequestBody KittingBomRelationQuery kittingBomRelationQuery) {
|
|
||||||
return kateWorkControllerService.queryKittingRelationByPage(kittingBomRelationQuery);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.wms_main.controller.wms;
|
package com.wms_main.controller.wms;
|
||||||
|
|
||||||
import com.wms_main.model.dto.query.LocationQuery;
|
|
||||||
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
||||||
|
import com.wms_main.model.po.TAppLocation;
|
||||||
import com.wms_main.service.controller.ILocationControllerService;
|
import com.wms_main.service.controller.ILocationControllerService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
@ -23,7 +23,7 @@ public class LocationController {
|
||||||
* @return 创建结果
|
* @return 创建结果
|
||||||
*/
|
*/
|
||||||
@PostMapping("/genLocations")
|
@PostMapping("/genLocations")
|
||||||
public BaseWmsApiResponse genLocations(@RequestBody LocationQuery locationQuery) {
|
public BaseWmsApiResponse genLocations(@RequestBody TAppLocation locationQuery) {
|
||||||
return locationControllerService.genLocations(locationQuery);
|
return locationControllerService.genLocations(locationQuery);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,9 @@
|
||||||
package com.wms_main.controller.wms;
|
package com.wms_main.controller.wms;
|
||||||
|
|
||||||
import com.wms_main.model.bo.wcs.WcsStackerTask;
|
|
||||||
import com.wms_main.model.dto.request.wcs.WcsBoxArriveRequest;
|
|
||||||
import com.wms_main.model.dto.request.wcs.WcsTaskResultRequest;
|
import com.wms_main.model.dto.request.wcs.WcsTaskResultRequest;
|
||||||
import com.wms_main.model.dto.request.wcs.WcsVehicleInRequest;
|
|
||||||
import com.wms_main.model.dto.request.wms.*;
|
import com.wms_main.model.dto.request.wms.*;
|
||||||
import com.wms_main.model.dto.response.wcs.BaseWcsApiResponse;
|
import com.wms_main.model.dto.response.wcs.BaseWcsApiResponse;
|
||||||
import com.wms_main.model.dto.response.wcs.WcsApiResponse;
|
|
||||||
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
||||||
import com.wms_main.model.dto.response.wms.WmsApiResponse;
|
|
||||||
import com.wms_main.model.vo.wms.TaskConfirmVo;
|
|
||||||
import com.wms_main.service.controller.ITaskControllerService;
|
import com.wms_main.service.controller.ITaskControllerService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
@ -54,54 +48,4 @@ public class TaskController {
|
||||||
public BaseWcsApiResponse sendTaskResult(@RequestBody WcsTaskResultRequest wcsTaskResultRequest) {
|
public BaseWcsApiResponse sendTaskResult(@RequestBody WcsTaskResultRequest wcsTaskResultRequest) {
|
||||||
return taskControllerService.sendTaskResult(wcsTaskResultRequest);
|
return taskControllerService.sendTaskResult(wcsTaskResultRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* wcs请求载具入库
|
|
||||||
* @param wcsVehicleInRequest 载具请求
|
|
||||||
* @return 处理结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/wcsRequestVehicleIn")
|
|
||||||
public WcsApiResponse<WcsStackerTask> wcsRequestVehicleIn(@RequestBody WcsVehicleInRequest wcsVehicleInRequest) {
|
|
||||||
return taskControllerService.wcsRequestVehicleIn(wcsVehicleInRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wcs上报载具到达站台
|
|
||||||
* @param boxArriveRequest 请求信息
|
|
||||||
* @return 处理结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/boxArrive")
|
|
||||||
public BaseWcsApiResponse boxArrive(@RequestBody WcsBoxArriveRequest boxArriveRequest) {
|
|
||||||
return taskControllerService.boxArrive(boxArriveRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取消拣选任务
|
|
||||||
* @param pickTaskRequest 请求信息
|
|
||||||
* @return 处理结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/cancelPickTasks")
|
|
||||||
public BaseWmsApiResponse cancelPickTasks(@RequestBody PickTaskRequest pickTaskRequest) {
|
|
||||||
return taskControllerService.cancelPickTasks(pickTaskRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询站台拣货任务---拣配工作之外
|
|
||||||
* @param wmsRequest 请求信息
|
|
||||||
* @return 处理结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/getCurrentTask")
|
|
||||||
public WmsApiResponse<TaskConfirmVo> getCurrentTask(@RequestBody BaseWmsRequest wmsRequest) {
|
|
||||||
return taskControllerService.getCurrentTask(wmsRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 确认当前站台拣货任务---拣配工作之外
|
|
||||||
* @param confirmTaskRequest 请求信息
|
|
||||||
* @return 处理结果
|
|
||||||
*/
|
|
||||||
@PostMapping("/confirmCurrentTask")
|
|
||||||
public BaseWmsApiResponse confirmCurrentTask(@RequestBody ConfirmTaskRequest confirmTaskRequest) {
|
|
||||||
return taskControllerService.confirmCurrentTask(confirmTaskRequest);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package com.wms_main.controller.wms.mes;
|
package com.wms_main.controller.wms.mes;
|
||||||
|
|
||||||
|
import com.wms_main.model.dto.request.mes.MesInTaskRequest;
|
||||||
|
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
||||||
|
import com.wms_main.service.controller.IMesControllerService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 卡特相关控制类
|
* 卡特相关控制类
|
||||||
|
|
@ -15,4 +15,15 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RequestMapping("/mes")
|
@RequestMapping("/mes")
|
||||||
public class MesController {
|
public class MesController {
|
||||||
|
private final IMesControllerService mesControllerService;
|
||||||
|
|
||||||
|
@PostMapping("requestIn")
|
||||||
|
public BaseWmsApiResponse requestIn(@RequestBody MesInTaskRequest mesInTaskRequest) {
|
||||||
|
return mesControllerService.requestIn(mesInTaskRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("requestOut")
|
||||||
|
public BaseWmsApiResponse requestOut(@RequestBody MesInTaskRequest mesInTaskRequest) {
|
||||||
|
return mesControllerService.requestIn(mesInTaskRequest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.wms_main.model.bo.mes;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mes物料信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MesDetailGoodsInfo {
|
||||||
|
/**
|
||||||
|
* 物料id
|
||||||
|
*/
|
||||||
|
@JsonProperty("F_MaterialId")
|
||||||
|
private String F_MaterialId;
|
||||||
|
/**
|
||||||
|
* 物料编号
|
||||||
|
*/
|
||||||
|
@JsonProperty("F_MaterialCode")
|
||||||
|
private String F_MaterialCode;
|
||||||
|
/**
|
||||||
|
* 物料名称
|
||||||
|
*/
|
||||||
|
@JsonProperty("F_MaterialName")
|
||||||
|
private String F_MaterialName;
|
||||||
|
/**
|
||||||
|
* 型号
|
||||||
|
*/
|
||||||
|
@JsonProperty("F_Model")
|
||||||
|
private String F_Model;
|
||||||
|
/**
|
||||||
|
* 规格
|
||||||
|
*/
|
||||||
|
@JsonProperty("F_Spec")
|
||||||
|
private String F_Spec;
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
|
@JsonProperty("F_Unit")
|
||||||
|
private String F_Unit;
|
||||||
|
/**
|
||||||
|
* 物料重量
|
||||||
|
*/
|
||||||
|
@JsonProperty("F_StockNum")
|
||||||
|
private String F_StockNum;
|
||||||
|
/**
|
||||||
|
* 称重日期
|
||||||
|
*/
|
||||||
|
@JsonProperty("F_InDate")
|
||||||
|
private String F_InDate;
|
||||||
|
/**
|
||||||
|
* 生产编号
|
||||||
|
*/
|
||||||
|
@JsonProperty("F_Barcode")
|
||||||
|
private String F_Barcode;
|
||||||
|
/**
|
||||||
|
* 生产批次
|
||||||
|
*/
|
||||||
|
@JsonProperty("F_InnerBatchNo")
|
||||||
|
private String F_InnerBatchNo;
|
||||||
|
/**
|
||||||
|
* 盘具编号
|
||||||
|
*/
|
||||||
|
@JsonProperty("F_PanJuClass")
|
||||||
|
private String F_PanJuClass;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.wms_main.model.bo.mes;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mes任务详情
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MesDetailTaskInfo {
|
||||||
|
/**
|
||||||
|
* 线圈编号
|
||||||
|
*/
|
||||||
|
@JsonProperty("goodsId")
|
||||||
|
private String goodsId;
|
||||||
|
/**
|
||||||
|
* 批次号
|
||||||
|
*/
|
||||||
|
@JsonProperty("batchNo")
|
||||||
|
private String batchNo;
|
||||||
|
/**
|
||||||
|
* 型号
|
||||||
|
*/
|
||||||
|
@JsonProperty("goodsType")
|
||||||
|
private String goodsType;
|
||||||
|
/**
|
||||||
|
* 规格
|
||||||
|
*/
|
||||||
|
@JsonProperty("specification")
|
||||||
|
private String specification;
|
||||||
|
/**
|
||||||
|
* 线圈位置
|
||||||
|
*/
|
||||||
|
@JsonProperty("position")
|
||||||
|
private Integer position;
|
||||||
|
/**
|
||||||
|
* 线圈数量
|
||||||
|
*/
|
||||||
|
@JsonProperty("quantity")
|
||||||
|
private Integer quantity;
|
||||||
|
/**
|
||||||
|
* 重量
|
||||||
|
*/
|
||||||
|
@JsonProperty("weight")
|
||||||
|
private Double weight;
|
||||||
|
/**
|
||||||
|
* 条码
|
||||||
|
*/
|
||||||
|
@JsonProperty("barCode")
|
||||||
|
private String barCode;
|
||||||
|
/**
|
||||||
|
* 库位--出库用
|
||||||
|
*/
|
||||||
|
@JsonProperty("locationId")
|
||||||
|
private String locationId;
|
||||||
|
/**
|
||||||
|
* 工作令号
|
||||||
|
*/
|
||||||
|
@JsonProperty("workOrder")
|
||||||
|
private String workOrder;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.wms_main.model.dto.request.mes;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.wms_main.model.bo.mes.MesDetailTaskInfo;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mes入库请求
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MesInTaskRequest {
|
||||||
|
/**
|
||||||
|
* 站台号
|
||||||
|
*/
|
||||||
|
@JsonProperty("standId")
|
||||||
|
private String standId;
|
||||||
|
/**
|
||||||
|
* 任务号
|
||||||
|
*/
|
||||||
|
@JsonProperty("taskId")
|
||||||
|
private String taskId;
|
||||||
|
/**
|
||||||
|
* 任务类型
|
||||||
|
*/
|
||||||
|
@JsonProperty("taskType")
|
||||||
|
private Integer taskType;
|
||||||
|
/**
|
||||||
|
* 载具号:托盘号、箱号
|
||||||
|
*/
|
||||||
|
@JsonProperty("vehicleId")
|
||||||
|
private String vehicleId;
|
||||||
|
/**
|
||||||
|
* 请求人
|
||||||
|
*/
|
||||||
|
@JsonProperty("requestName")
|
||||||
|
private String requestName;
|
||||||
|
/**
|
||||||
|
* 请求详情
|
||||||
|
*/
|
||||||
|
@JsonProperty("detailTaskInfoList")
|
||||||
|
private List<MesDetailTaskInfo> detailTaskInfoList;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.wms_main.model.dto.request.mes;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.wms_main.model.bo.mes.MesDetailTaskInfo;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mes出库请求
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MesOutTaskRequest {
|
||||||
|
/**
|
||||||
|
* 站台号
|
||||||
|
*/
|
||||||
|
@JsonProperty("standId")
|
||||||
|
private String standId;
|
||||||
|
/**
|
||||||
|
* 任务号
|
||||||
|
*/
|
||||||
|
@JsonProperty("taskId")
|
||||||
|
private String taskId;
|
||||||
|
/**
|
||||||
|
* 任务类型
|
||||||
|
*/
|
||||||
|
@JsonProperty("taskType")
|
||||||
|
private Integer taskType;
|
||||||
|
/**
|
||||||
|
* 载具号:托盘号、箱号
|
||||||
|
*/
|
||||||
|
@JsonProperty("vehicleId")
|
||||||
|
private String vehicleId;
|
||||||
|
/**
|
||||||
|
* 请求人
|
||||||
|
*/
|
||||||
|
@JsonProperty("requestName")
|
||||||
|
private String requestName;
|
||||||
|
/**
|
||||||
|
* 请求详情
|
||||||
|
*/
|
||||||
|
@JsonProperty("detailTaskInfoList")
|
||||||
|
private List<MesDetailTaskInfo> detailTaskInfoList;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.wms_main.model.dto.response.mes;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.wms_main.model.bo.mes.MesDetailGoodsInfo;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mes获取物料信息响应信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class MesGetGoodsResponse {
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
* success---获取信息成功
|
||||||
|
* error---获取信息失败
|
||||||
|
*/
|
||||||
|
@JsonProperty("state")
|
||||||
|
private String state;
|
||||||
|
/**
|
||||||
|
* 状态描述
|
||||||
|
*/
|
||||||
|
@JsonProperty("message")
|
||||||
|
private String message;
|
||||||
|
/**
|
||||||
|
* 物料详细信息
|
||||||
|
*/
|
||||||
|
@JsonProperty("data")
|
||||||
|
private MesDetailGoodsInfo data;
|
||||||
|
}
|
||||||
|
|
@ -99,4 +99,14 @@ public class TAppStock {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "sled")
|
@TableField(value = "sled")
|
||||||
private Integer sled;
|
private Integer sled;
|
||||||
|
/**
|
||||||
|
* 条码
|
||||||
|
*/
|
||||||
|
@TableField(value = "bar_code")
|
||||||
|
private String barCode;
|
||||||
|
/**
|
||||||
|
* Mes任务单号
|
||||||
|
*/
|
||||||
|
@TableField(value = "mes_id")
|
||||||
|
private String mesId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,4 +103,14 @@ public class TAppTask {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "goods_desc")
|
@TableField(value = "goods_desc")
|
||||||
private String goodsDesc;
|
private String goodsDesc;
|
||||||
|
/**
|
||||||
|
* 条码
|
||||||
|
*/
|
||||||
|
@TableField(value = "bar_code")
|
||||||
|
private String barCode;
|
||||||
|
/**
|
||||||
|
* Mes任务单号
|
||||||
|
*/
|
||||||
|
@TableField(value = "mes_id")
|
||||||
|
private String mesId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,4 +103,14 @@ public class TAppTaskBak {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "goods_desc")
|
@TableField(value = "goods_desc")
|
||||||
private String goodsDesc;
|
private String goodsDesc;
|
||||||
|
/**
|
||||||
|
* 条码
|
||||||
|
*/
|
||||||
|
@TableField(value = "bar_code")
|
||||||
|
private String barCode;
|
||||||
|
/**
|
||||||
|
* Mes任务单号
|
||||||
|
*/
|
||||||
|
@TableField(value = "mes_id")
|
||||||
|
private String mesId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import org.springframework.util.StopWatch;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* api 客户端
|
* api 客户端
|
||||||
|
|
@ -32,6 +33,7 @@ public class HttpClient {
|
||||||
* @return 响应数据
|
* @return 响应数据
|
||||||
*/
|
*/
|
||||||
public HttpResponse httpGet(HttpRequest request) {
|
public HttpResponse httpGet(HttpRequest request) {
|
||||||
|
log.info("请求信息{}", StringUtils.objectToString(request));
|
||||||
HttpResponse response = new HttpResponse();
|
HttpResponse response = new HttpResponse();
|
||||||
String url = request.getUrl();
|
String url = request.getUrl();
|
||||||
if(StringUtils.isEmpty(url)) {
|
if(StringUtils.isEmpty(url)) {
|
||||||
|
|
@ -49,8 +51,10 @@ public class HttpClient {
|
||||||
try {
|
try {
|
||||||
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
|
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
|
||||||
HttpGet getRequest = new HttpGet(url + request.getData());
|
HttpGet getRequest = new HttpGet(url + request.getData());
|
||||||
getRequest.setHeader("Content-Type", request.getContentType());
|
// 设置请求头
|
||||||
getRequest.setHeader("Authorization", request.getToken());
|
for(Map.Entry<String, String> entry : request.getHeader().entrySet()){
|
||||||
|
getRequest.setHeader(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
RequestConfig requestConfig = RequestConfig.custom()
|
RequestConfig requestConfig = RequestConfig.custom()
|
||||||
.setConnectTimeout(request.getTimeout())
|
.setConnectTimeout(request.getTimeout())
|
||||||
.setConnectionRequestTimeout(request.getTimeout())
|
.setConnectionRequestTimeout(request.getTimeout())
|
||||||
|
|
@ -110,6 +114,10 @@ public class HttpClient {
|
||||||
HttpPost postRequest = new HttpPost(url);
|
HttpPost postRequest = new HttpPost(url);
|
||||||
postRequest.setHeader("Content-Type", request.getContentType());
|
postRequest.setHeader("Content-Type", request.getContentType());
|
||||||
postRequest.setHeader("Authorization", request.getToken());
|
postRequest.setHeader("Authorization", request.getToken());
|
||||||
|
// 设置请求头
|
||||||
|
for(Map.Entry<String, String> entry : request.getHeader().entrySet()){
|
||||||
|
postRequest.setHeader(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
postRequest.setEntity(new StringEntity(request.getData()));
|
postRequest.setEntity(new StringEntity(request.getData()));
|
||||||
RequestConfig requestConfig = RequestConfig.custom()
|
RequestConfig requestConfig = RequestConfig.custom()
|
||||||
.setConnectTimeout(request.getTimeout())
|
.setConnectTimeout(request.getTimeout())
|
||||||
|
|
@ -149,6 +157,7 @@ public class HttpClient {
|
||||||
* @return 响应数据
|
* @return 响应数据
|
||||||
*/
|
*/
|
||||||
public HttpResponse httpDelete(HttpRequest request) {
|
public HttpResponse httpDelete(HttpRequest request) {
|
||||||
|
log.info("请求信息{}", StringUtils.objectToString(request));
|
||||||
HttpResponse response = new HttpResponse();
|
HttpResponse response = new HttpResponse();
|
||||||
String url = request.getUrl();
|
String url = request.getUrl();
|
||||||
if(StringUtils.isEmpty(url)) {
|
if(StringUtils.isEmpty(url)) {
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,11 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WCS HTTP 请求类
|
* HTTP 请求类
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
|
@ -26,7 +29,7 @@ public class HttpRequest {
|
||||||
*/
|
*/
|
||||||
private HttpMethodEnum method;
|
private HttpMethodEnum method;
|
||||||
/**
|
/**
|
||||||
* 请求头
|
* 内容格式
|
||||||
*/
|
*/
|
||||||
private String contentType = "application/json";
|
private String contentType = "application/json";
|
||||||
/**
|
/**
|
||||||
|
|
@ -37,6 +40,10 @@ public class HttpRequest {
|
||||||
* token
|
* token
|
||||||
*/
|
*/
|
||||||
private String token;
|
private String token;
|
||||||
|
/**
|
||||||
|
* header
|
||||||
|
*/
|
||||||
|
private Map<String, String> header;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建一个POST请求
|
* 构建一个POST请求
|
||||||
|
|
@ -55,7 +62,7 @@ public class HttpRequest {
|
||||||
if (StringUtils.isEmpty(contentType)) {
|
if (StringUtils.isEmpty(contentType)) {
|
||||||
contentType = "application/json";
|
contentType = "application/json";
|
||||||
}
|
}
|
||||||
return new HttpRequest(url.trim(), timeout, HttpMethodEnum.POST, contentType, StringUtils.objectToString(data), token);
|
return new HttpRequest(url.trim(), timeout, HttpMethodEnum.POST, contentType, StringUtils.objectToString(data), token, new HashMap<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -68,4 +75,18 @@ public class HttpRequest {
|
||||||
public static <T> HttpRequest postInstanceOf(String url, T data) {
|
public static <T> HttpRequest postInstanceOf(String url, T data) {
|
||||||
return postInstanceOf(url.trim(), data, 5000, "application/json", "");
|
return postInstanceOf(url.trim(), data, 5000, "application/json", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建get请求
|
||||||
|
* @param url url
|
||||||
|
* @param timeout 超时
|
||||||
|
* @param header 请求头
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public static HttpRequest getInstanceOf(String url, Integer timeout, Map<String, String> header) {
|
||||||
|
if (timeout == null || timeout <= 1000) {
|
||||||
|
timeout = 5000;
|
||||||
|
}
|
||||||
|
return new HttpRequest(url.trim(), timeout, HttpMethodEnum.GET, "", "", "", header);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
package com.wms_main.service.business;
|
|
||||||
|
|
||||||
import com.wms_main.model.bo.wms.WmsPickTask;
|
|
||||||
import com.wms_main.model.po.TAppPickTask;
|
|
||||||
import com.wms_main.model.po.TAppStock;
|
|
||||||
import com.wms_main.model.vo.wms.TaskConfirmVo;
|
|
||||||
import com.wms_main.model.vo.wms.WorkConfirmVo;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 输送线任务服务
|
|
||||||
*/
|
|
||||||
public interface IConveyTaskService {
|
|
||||||
/**
|
|
||||||
* 取消拣选任务
|
|
||||||
* @param vehicleStandMap 载具-站台map
|
|
||||||
* @param successCount 成功count
|
|
||||||
* @param failCount 失败count
|
|
||||||
* @param exceptionCount 异常count
|
|
||||||
*/
|
|
||||||
void cancelPickTasks(Map<String, WmsPickTask> vehicleStandMap, int successCount, int failCount, int exceptionCount);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取消后续站台任务
|
|
||||||
* @param vehicleId 载具
|
|
||||||
* @param standId 当前站台
|
|
||||||
*/
|
|
||||||
void cancelOtherStandPickTasks(String vehicleId, String standId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 释放站台箱子
|
|
||||||
* @param targetPickTask 目标拣选任务
|
|
||||||
* @return 处理结果
|
|
||||||
*/
|
|
||||||
boolean releaseStandVehicle(TAppPickTask targetPickTask);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得当前站台的工作
|
|
||||||
* @param thisPickTask 拣选任务
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
WorkConfirmVo getCurrentStandWork(TAppPickTask thisPickTask);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得当前站台的任务
|
|
||||||
* @param thisPickTask 当前站台拣选任务
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
TaskConfirmVo getCurrentStandTask(TAppPickTask thisPickTask);
|
|
||||||
}
|
|
||||||
|
|
@ -1,439 +0,0 @@
|
||||||
package com.wms_main.service.business.serviceImpl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
||||||
import com.wms_main.app.AppCommon;
|
|
||||||
import com.wms_main.constant.AppConstant;
|
|
||||||
import com.wms_main.constant.enums.wcs.WcsApiResponseCodeEnums;
|
|
||||||
import com.wms_main.constant.enums.wms.*;
|
|
||||||
import com.wms_main.dao.*;
|
|
||||||
import com.wms_main.model.bo.wcs.WcsPickTask;
|
|
||||||
import com.wms_main.model.bo.wms.OrderConfirmEntity;
|
|
||||||
import com.wms_main.model.bo.wms.StockConfirmEntity;
|
|
||||||
import com.wms_main.model.bo.wms.TaskConfirmEntity;
|
|
||||||
import com.wms_main.model.bo.wms.WmsPickTask;
|
|
||||||
import com.wms_main.model.dto.request.wcs.WcsPickTaskRequest;
|
|
||||||
import com.wms_main.model.dto.request.wcs.WcsReleaseBoxRequest;
|
|
||||||
import com.wms_main.model.dto.response.wcs.BaseWcsApiResponse;
|
|
||||||
import com.wms_main.model.dto.response.wcs.WcsApiResponse;
|
|
||||||
import com.wms_main.model.po.*;
|
|
||||||
import com.wms_main.model.vo.wms.TaskConfirmVo;
|
|
||||||
import com.wms_main.model.vo.wms.WorkConfirmVo;
|
|
||||||
import com.wms_main.repository.utils.StringUtils;
|
|
||||||
import com.wms_main.repository.utils.UUIDUtils;
|
|
||||||
import com.wms_main.service.api.IWcsApiService;
|
|
||||||
import com.wms_main.service.business.IConveyTaskService;
|
|
||||||
import com.wms_main.service.business.IStockDataService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 输送线任务服务 实现
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Slf4j
|
|
||||||
public class ConveyTaskServiceImpl implements IConveyTaskService {
|
|
||||||
private final IWcsApiService wcsApiService;// wcs api服务
|
|
||||||
private final ITAppPickTaskService appPickTaskService;// 拣选任务服务
|
|
||||||
private final ITAppPickTaskBakService appPickTaskBakService;// 拣选任务备份服务
|
|
||||||
private final ITAppTaskService appTaskService;// 堆垛机任务服务
|
|
||||||
private final ITAppWorkService appWorkService;// 工作服务
|
|
||||||
private final ITAppOutsService appOutsService;// 出库单服务
|
|
||||||
private final IStockDataService stockDataService;// 库存数据服务
|
|
||||||
private final ITAppPickPlanService appPickPlanService;// 拣选计划服务
|
|
||||||
private final ITAppStockService appStockService;// 库存服务
|
|
||||||
private final AppCommon appCommon;
|
|
||||||
private final ITAppVehicleService appVehicleService;// 载具服务
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取消拣选任务实现
|
|
||||||
*
|
|
||||||
* @param vehicleStandMap 键为站台,值为WmsPickTask
|
|
||||||
* @param successCount 成功数量
|
|
||||||
* @param failCount 失败数量
|
|
||||||
* @param exceptionCount 异常数量
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void cancelPickTasks(Map<String, WmsPickTask> vehicleStandMap, int successCount, int failCount, int exceptionCount) {
|
|
||||||
// 循环取消
|
|
||||||
for (String key : vehicleStandMap.keySet()) {
|
|
||||||
WmsPickTask thisKeyPickTask = vehicleStandMap.get(key);
|
|
||||||
try {
|
|
||||||
WcsPickTaskRequest request = new WcsPickTaskRequest(
|
|
||||||
null,
|
|
||||||
thisKeyPickTask.getVehicleId(),
|
|
||||||
1,
|
|
||||||
thisKeyPickTask.getPickStand(),
|
|
||||||
""
|
|
||||||
);
|
|
||||||
WcsApiResponse<WcsPickTask> wcsResponse = wcsApiService.cancelPickTask(request);
|
|
||||||
if (wcsResponse != null && WcsApiResponseCodeEnums.SUCCESS.getCode() == wcsResponse.getCode()) {
|
|
||||||
// 将这些拣选任务添加进记录表
|
|
||||||
List<TAppPickTask> targetPickTasks = appPickTaskService.list(new LambdaQueryWrapper<TAppPickTask>()
|
|
||||||
.eq(TAppPickTask::getVehicleId, thisKeyPickTask.getVehicleId())
|
|
||||||
.eq(TAppPickTask::getPickStand, thisKeyPickTask.getPickStand())
|
|
||||||
.ne(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.FOR_IN.getCode()));
|
|
||||||
// 设置拣选任务记录
|
|
||||||
List<TAppPickTaskBak> pickRecords = new ArrayList<>();
|
|
||||||
for (TAppPickTask pickTask : targetPickTasks) {
|
|
||||||
TAppPickTaskBak pickRecord = new TAppPickTaskBak(
|
|
||||||
pickTask.getPickId(),
|
|
||||||
pickTask.getPickStand(),
|
|
||||||
pickTask.getVehicleId(),
|
|
||||||
WmsPickTaskStatusEnum.CANCEL.getCode(),
|
|
||||||
pickTask.getCreateTime(),
|
|
||||||
pickTask.getSendTime(),
|
|
||||||
LocalDateTime.now(),
|
|
||||||
LocalDateTime.now()
|
|
||||||
);
|
|
||||||
pickRecords.add(pickRecord);
|
|
||||||
}
|
|
||||||
// 添加记录
|
|
||||||
appPickTaskBakService.saveBatch(pickRecords);
|
|
||||||
// 删除拣选任务
|
|
||||||
appPickTaskService.removeByIds(targetPickTasks);
|
|
||||||
successCount++;
|
|
||||||
log.info("取消拣选任务成功。载具:{},站台:{}。", thisKeyPickTask.getVehicleId(), thisKeyPickTask.getPickStand());
|
|
||||||
} else {
|
|
||||||
failCount++;
|
|
||||||
log.error("取消拣选任务失败。载具:{},站台:{}。", thisKeyPickTask.getVehicleId(), thisKeyPickTask.getPickStand());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
// 回滚事务
|
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
||||||
exceptionCount++;
|
|
||||||
log.error("取消拣选任务异常。载具:{},站台:{}。", thisKeyPickTask.getVehicleId(), thisKeyPickTask.getPickStand());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取消当前其他站台的任务
|
|
||||||
*
|
|
||||||
* @param vehicleId 载具号
|
|
||||||
* @param standId 站台号
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void cancelOtherStandPickTasks(String vehicleId, String standId) {
|
|
||||||
// 取消这个箱子去其他站台的任务
|
|
||||||
List<TAppPickTask> otherStandPickTaskList = appPickTaskService.list(new LambdaQueryWrapper<TAppPickTask>()
|
|
||||||
.ne(TAppPickTask::getPickStand, standId)
|
|
||||||
.eq(TAppPickTask::getVehicleId, vehicleId)
|
|
||||||
.ne(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.FOR_IN.getCode()));
|
|
||||||
Map<String, WmsPickTask> vehicleStandMap = new HashMap<>();
|
|
||||||
for (TAppPickTask otherStandPickTask : otherStandPickTaskList) {
|
|
||||||
String key = otherStandPickTask.getVehicleId() + "_" + otherStandPickTask.getPickStand();
|
|
||||||
if (vehicleStandMap.containsKey(key)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
vehicleStandMap.put(key, new WmsPickTask(otherStandPickTask.getPickStand(), otherStandPickTask.getVehicleId()));
|
|
||||||
}
|
|
||||||
cancelPickTasks(vehicleStandMap, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 释放站台载具
|
|
||||||
*
|
|
||||||
* @param targetPickTask 目标拣选任务
|
|
||||||
* @return 处理结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean releaseStandVehicle(TAppPickTask targetPickTask) {
|
|
||||||
// 判断是否是需要回库
|
|
||||||
int router = 0;// 默认不需要回库
|
|
||||||
if (!appPickTaskService.exists(new LambdaQueryWrapper<TAppPickTask>()
|
|
||||||
.eq(TAppPickTask::getVehicleId, targetPickTask.getVehicleId())
|
|
||||||
.ne(TAppPickTask::getPickStand, targetPickTask.getPickStand())
|
|
||||||
.ne(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.FOR_IN.getCode()))) {
|
|
||||||
router = 1;// 需要回库
|
|
||||||
}
|
|
||||||
// 需要回库时,需要生成回库任务
|
|
||||||
List<TAppPickTaskBak> pickRecords = new ArrayList<>();
|
|
||||||
if (router == 1) {
|
|
||||||
// 设置这个载具为入库中
|
|
||||||
appVehicleService.update(new LambdaUpdateWrapper<TAppVehicle>()
|
|
||||||
.set(TAppVehicle::getVehicleStatus, WmsVehicleStatusEnums.IN.getCode())
|
|
||||||
.eq(TAppVehicle::getVehicleId, targetPickTask.getVehicleId()));
|
|
||||||
// 设置这个载具的库存为回库中
|
|
||||||
appStockService.update(new LambdaUpdateWrapper<TAppStock>()
|
|
||||||
.set(TAppStock::getStockStatus, WmsStockStatusEnums.BACK.getCode())
|
|
||||||
.eq(TAppStock::getVehicleId, targetPickTask.getVehicleId()));
|
|
||||||
// 查询这个箱子入库用的拣选任务
|
|
||||||
List<TAppPickTask> forInPickTasks = appPickTaskService.list(new LambdaQueryWrapper<TAppPickTask>()
|
|
||||||
.eq(TAppPickTask::getVehicleId, targetPickTask.getVehicleId())
|
|
||||||
.eq(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.FOR_IN.getCode()));
|
|
||||||
boolean haveForIn = false;// 是否要为了入库不回库
|
|
||||||
for (TAppPickTask forInPickTask : forInPickTasks) {
|
|
||||||
if (!Objects.equals(forInPickTask.getPickStand(), targetPickTask.getPickStand())) {
|
|
||||||
haveForIn = true;
|
|
||||||
}
|
|
||||||
// 生成记录并删除
|
|
||||||
pickRecords.add(new TAppPickTaskBak(
|
|
||||||
targetPickTask.getPickId(),
|
|
||||||
targetPickTask.getPickStand(),
|
|
||||||
targetPickTask.getVehicleId(),
|
|
||||||
WmsPickTaskStatusEnum.FOR_IN.getCode(),
|
|
||||||
targetPickTask.getCreateTime(),
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
LocalDateTime.now()
|
|
||||||
));
|
|
||||||
}
|
|
||||||
// 没有需要入库的拣选任务
|
|
||||||
if (!haveForIn) {
|
|
||||||
// 判断空箱需不需要回库
|
|
||||||
String emptyBack = "0";
|
|
||||||
try {
|
|
||||||
emptyBack = appCommon.getConfigByKey(AppConfigKeyEnums.EMPTY_BACK.getKey());
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("获取空箱回库配置失败,使用默认值不回库。");
|
|
||||||
}
|
|
||||||
// 判断这个箱子是不是空箱需要回库
|
|
||||||
if (!stockDataService.isEmptyVehicle(targetPickTask.getVehicleId())
|
|
||||||
|| (stockDataService.isEmptyVehicle(targetPickTask.getVehicleId()) && "1".equals(emptyBack))) {
|
|
||||||
// 生成回库任务
|
|
||||||
TAppTask task = new TAppTask(
|
|
||||||
UUIDUtils.getNewUUID("BACK_"),
|
|
||||||
WmsTaskTypeEnums.IN.getCode(),
|
|
||||||
WmsStackerTaskStatusEnums.TEMP.getCode(),
|
|
||||||
1,
|
|
||||||
targetPickTask.getVehicleId(),
|
|
||||||
targetPickTask.getPickStand(),
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
LocalDateTime.now(),
|
|
||||||
null,
|
|
||||||
AppConstant.EMPTY_GOODS_ID,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
"wms_auto",
|
|
||||||
"",
|
|
||||||
targetPickTask.getPickStand(),
|
|
||||||
""
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
// 保存任务
|
|
||||||
appTaskService.save(task);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("释放站台载具生成回库任务时失败。");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 更新拣选任务信息,添加拣选任务记录信息
|
|
||||||
pickRecords.add(new TAppPickTaskBak(
|
|
||||||
targetPickTask.getPickId(),
|
|
||||||
targetPickTask.getPickStand(),
|
|
||||||
targetPickTask.getVehicleId(),
|
|
||||||
WmsPickTaskStatusEnum.LEAVE.getCode(),
|
|
||||||
targetPickTask.getCreateTime(),
|
|
||||||
targetPickTask.getSendTime(),
|
|
||||||
targetPickTask.getArriveTime(),
|
|
||||||
LocalDateTime.now()
|
|
||||||
));
|
|
||||||
try {
|
|
||||||
appPickTaskBakService.saveBatch(pickRecords);
|
|
||||||
// 删除当前载具在当前站台的拣选任务
|
|
||||||
appPickTaskService.remove(new LambdaQueryWrapper<TAppPickTask>()
|
|
||||||
.eq(TAppPickTask::getVehicleId, targetPickTask.getVehicleId())
|
|
||||||
.eq(TAppPickTask::getPickStand, targetPickTask.getPickStand()));
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("保存拣选任务记录时发生异常。载具号:{},站台号:{}", targetPickTask.getVehicleId(), targetPickTask.getPickStand());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
// 给wcs放行信号
|
|
||||||
BaseWcsApiResponse releaseResult = wcsApiService.releaseBox(new WcsReleaseBoxRequest(targetPickTask.getVehicleId(), targetPickTask.getPickStand(), router));
|
|
||||||
if (releaseResult == null || WcsApiResponseCodeEnums.SUCCESS.getCode() != releaseResult.getCode()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("向wcs传递放行信息异常。");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得对应库存的第一条工作
|
|
||||||
*
|
|
||||||
* @param thisPickTask 站台号
|
|
||||||
* @return 工作确认信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public WorkConfirmVo getCurrentStandWork(TAppPickTask thisPickTask) {
|
|
||||||
// 站台号和载具号必须输入
|
|
||||||
if (thisPickTask == null || StringUtils.isEmpty(thisPickTask.getPickStand()) || StringUtils.isEmpty(thisPickTask.getVehicleId())) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
// 轮询当前站台的拣选计划
|
|
||||||
List<TAppPickPlan> pickPlans = appPickPlanService.list(new LambdaQueryWrapper<TAppPickPlan>()
|
|
||||||
.eq(TAppPickPlan::getStandId, thisPickTask.getPickStand())
|
|
||||||
.eq(TAppPickPlan::getVehicleId, thisPickTask.getVehicleId())
|
|
||||||
.eq(TAppPickPlan::getPickType, 1));
|
|
||||||
if (pickPlans == null || pickPlans.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
WorkConfirmVo resultVo = null;
|
|
||||||
List<TAppPickPlan> needRemovePlans = new ArrayList<>();
|
|
||||||
for (TAppPickPlan pickPlan : pickPlans) {
|
|
||||||
needRemovePlans.add(pickPlan);
|
|
||||||
// 计划拣选数量
|
|
||||||
int planPickQty = pickPlan.getPlanPickQty();
|
|
||||||
// 先查询对应的工作存不存在
|
|
||||||
TAppWork thisWork = appWorkService.getById(pickPlan.getWorkIndex());
|
|
||||||
// 判断这条工作还存在否
|
|
||||||
if (thisWork == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// 判断有没有需求
|
|
||||||
if (thisWork.getFinishNum() >= thisWork.getNeedNum()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// 剩余需求量
|
|
||||||
int remainNeedNum = thisWork.getNeedNum() - thisWork.getFinishNum();
|
|
||||||
if (remainNeedNum < planPickQty) {
|
|
||||||
// 需求不足,将计划拣选数量更新成实际需求数量
|
|
||||||
planPickQty = remainNeedNum;
|
|
||||||
}
|
|
||||||
// 查询这个箱子上库存是否足够
|
|
||||||
List<TAppStock> stockList = appStockService.list(new LambdaQueryWrapper<TAppStock>()
|
|
||||||
.eq(TAppStock::getVehicleId, thisPickTask.getVehicleId())
|
|
||||||
.eq(TAppStock::getGoodsId, thisWork.getGoodsId())
|
|
||||||
.gt(TAppStock::getRealNum, 0).orderByAsc(TAppStock::getFirstInTime));
|
|
||||||
if (stockList == null || stockList.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// 算出库存总量
|
|
||||||
int remainSumNum = stockList.stream().mapToInt(TAppStock::getRealNum).sum();
|
|
||||||
if (remainSumNum < planPickQty) {
|
|
||||||
// 剩余数量不足,计划拣选数量更新成实际剩余数量
|
|
||||||
planPickQty = remainSumNum;
|
|
||||||
}
|
|
||||||
// 命中,开始设置返回数据
|
|
||||||
OrderConfirmEntity orderConfirmVo = new OrderConfirmEntity(
|
|
||||||
thisWork.getWorkOrder(),
|
|
||||||
thisWork.getProductId(),
|
|
||||||
thisWork.getSingleProductId(),
|
|
||||||
thisWork.getGoodsId(),
|
|
||||||
thisWork.getBoxNo(),
|
|
||||||
planPickQty,
|
|
||||||
planPickQty
|
|
||||||
);
|
|
||||||
StockConfirmEntity stockConfirmVo = new StockConfirmEntity(
|
|
||||||
pickPlan.getPlanId(),
|
|
||||||
pickPlan.getVehicleId(),
|
|
||||||
pickPlan.getGoodsId(),
|
|
||||||
remainSumNum - planPickQty,
|
|
||||||
remainSumNum - planPickQty,
|
|
||||||
0,
|
|
||||||
"ASRS",
|
|
||||||
stockDataService.getWarningQty()
|
|
||||||
);
|
|
||||||
resultVo = new WorkConfirmVo(orderConfirmVo, stockConfirmVo);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// 删除不可用拣货计划
|
|
||||||
if (!needRemovePlans.isEmpty()) {
|
|
||||||
appPickPlanService.removeBatchByIds(needRemovePlans.stream().map(TAppPickPlan::getPlanId).toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
return resultVo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前站台拣选任务需求
|
|
||||||
* @param thisPickTask 拣选任务
|
|
||||||
* @return 任务vo
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public TaskConfirmVo getCurrentStandTask(TAppPickTask thisPickTask) {
|
|
||||||
// 站台号和载具号必须输入
|
|
||||||
if (thisPickTask == null || StringUtils.isEmpty(thisPickTask.getPickStand()) || StringUtils.isEmpty(thisPickTask.getVehicleId())) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
// 轮询当前站台的拣选计划
|
|
||||||
List<TAppPickPlan> pickPlans = appPickPlanService.list(new LambdaQueryWrapper<TAppPickPlan>()
|
|
||||||
.eq(TAppPickPlan::getStandId, thisPickTask.getPickStand())
|
|
||||||
.eq(TAppPickPlan::getVehicleId, thisPickTask.getVehicleId())
|
|
||||||
.eq(TAppPickPlan::getPickType, 2));
|
|
||||||
if (pickPlans == null || pickPlans.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
TaskConfirmVo resultVo = null;
|
|
||||||
List<TAppPickPlan> needRemovePlans = new ArrayList<>();
|
|
||||||
for (TAppPickPlan pickPlan : pickPlans) {
|
|
||||||
needRemovePlans.add(pickPlan);
|
|
||||||
// 计划拣选数量
|
|
||||||
int planPickQty = pickPlan.getPlanPickQty();
|
|
||||||
// 先查询对应的工作存不存在
|
|
||||||
TAppOuts thisOuts = appOutsService.getById(pickPlan.getWorkIndex());
|
|
||||||
// 判断这条工作还存在否
|
|
||||||
if (thisOuts == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// 判断有没有需求
|
|
||||||
if (thisOuts.getPickNum() >= thisOuts.getNeedNum()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// 剩余需求量
|
|
||||||
int remainNeedNum = thisOuts.getNeedNum() - thisOuts.getPickNum();
|
|
||||||
if (remainNeedNum < planPickQty) {
|
|
||||||
// 需求不足,将计划拣选数量更新成实际需求数量
|
|
||||||
planPickQty = remainNeedNum;
|
|
||||||
}
|
|
||||||
// 查询这个箱子上库存是否足够
|
|
||||||
List<TAppStock> stockList = appStockService.list(new LambdaQueryWrapper<TAppStock>()
|
|
||||||
.eq(TAppStock::getVehicleId, thisPickTask.getVehicleId())
|
|
||||||
.eq(TAppStock::getGoodsId, thisOuts.getGoodsId())
|
|
||||||
.gt(TAppStock::getRealNum, 0).orderByAsc(TAppStock::getFirstInTime));
|
|
||||||
if (stockList == null || stockList.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// 算出库存总量
|
|
||||||
int remainSumNum = stockList.stream().mapToInt(TAppStock::getRealNum).sum();
|
|
||||||
if (remainSumNum < planPickQty) {
|
|
||||||
// 剩余数量不足,计划拣选数量更新成实际剩余数量
|
|
||||||
planPickQty = remainSumNum;
|
|
||||||
}
|
|
||||||
// 命中,开始设置返回数据
|
|
||||||
TaskConfirmEntity taskConfirmVo = new TaskConfirmEntity(
|
|
||||||
thisOuts.getTaskId(),
|
|
||||||
thisOuts.getOutType(),
|
|
||||||
thisOuts.getGoodsId(),
|
|
||||||
thisOuts.getNeedNum(),
|
|
||||||
remainNeedNum,
|
|
||||||
planPickQty,
|
|
||||||
planPickQty
|
|
||||||
);
|
|
||||||
StockConfirmEntity stockConfirmVo = new StockConfirmEntity(
|
|
||||||
pickPlan.getPlanId(),
|
|
||||||
pickPlan.getVehicleId(),
|
|
||||||
pickPlan.getGoodsId(),
|
|
||||||
remainSumNum - planPickQty,
|
|
||||||
remainSumNum - planPickQty,
|
|
||||||
0,
|
|
||||||
"ASRS",
|
|
||||||
stockDataService.getWarningQty()
|
|
||||||
);
|
|
||||||
resultVo = new TaskConfirmVo(taskConfirmVo, stockConfirmVo);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// 删除不可用拣货计划
|
|
||||||
if (!needRemovePlans.isEmpty()) {
|
|
||||||
appPickPlanService.removeBatchByIds(needRemovePlans.stream().map(TAppPickPlan::getPlanId).toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
return resultVo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -328,7 +328,9 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
||||||
thisVehicleInTask.getOpUser(),
|
thisVehicleInTask.getOpUser(),
|
||||||
thisVehicleInTask.getRemark(),
|
thisVehicleInTask.getRemark(),
|
||||||
thisVehicleInTask.getCallStand(),
|
thisVehicleInTask.getCallStand(),
|
||||||
thisVehicleInTask.getGoodsDesc()
|
thisVehicleInTask.getGoodsDesc(),
|
||||||
|
thisVehicleInTask.getBarCode(),
|
||||||
|
thisVehicleInTask.getMesId()
|
||||||
));
|
));
|
||||||
// 删除任务
|
// 删除任务
|
||||||
needDeleteTaskIds.add(thisVehicleInTask.getTaskId());
|
needDeleteTaskIds.add(thisVehicleInTask.getTaskId());
|
||||||
|
|
@ -362,7 +364,9 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
||||||
thisVehicleInTask.getOpNum(),
|
thisVehicleInTask.getOpNum(),
|
||||||
thisVehicleInTask.getGoodsDesc(),
|
thisVehicleInTask.getGoodsDesc(),
|
||||||
expireDate,
|
expireDate,
|
||||||
sledDays
|
sledDays,
|
||||||
|
thisVehicleInTask.getBarCode(),
|
||||||
|
thisVehicleInTask.getMesId()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -468,7 +472,9 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
||||||
thisVehicleInTask.getOpUser(),
|
thisVehicleInTask.getOpUser(),
|
||||||
thisVehicleInTask.getRemark(),
|
thisVehicleInTask.getRemark(),
|
||||||
thisVehicleInTask.getCallStand(),
|
thisVehicleInTask.getCallStand(),
|
||||||
""
|
"",
|
||||||
|
thisVehicleInTask.getGoodsDesc(),
|
||||||
|
thisVehicleInTask.getBarCode()
|
||||||
));
|
));
|
||||||
// 删除任务
|
// 删除任务
|
||||||
needDeleteTaskIds.add(thisVehicleInTask.getTaskId());
|
needDeleteTaskIds.add(thisVehicleInTask.getTaskId());
|
||||||
|
|
@ -510,7 +516,9 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
||||||
thisVehicleInTask.getOpNum(),
|
thisVehicleInTask.getOpNum(),
|
||||||
thisVehicleInTask.getGoodsDesc(),
|
thisVehicleInTask.getGoodsDesc(),
|
||||||
expireDate,
|
expireDate,
|
||||||
sledDays
|
sledDays,
|
||||||
|
thisVehicleInTask.getBarCode(),
|
||||||
|
thisVehicleInTask.getMesId()
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
// 更新已有库存信息
|
// 更新已有库存信息
|
||||||
|
|
@ -539,7 +547,9 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
||||||
originSum + thisVehicleInTask.getOpNum(),
|
originSum + thisVehicleInTask.getOpNum(),
|
||||||
thisVehicleInTask.getGoodsDesc(),
|
thisVehicleInTask.getGoodsDesc(),
|
||||||
expireDate,
|
expireDate,
|
||||||
sledDays
|
sledDays,
|
||||||
|
thisVehicleInTask.getBarCode(),
|
||||||
|
thisVehicleInTask.getMesId()
|
||||||
));
|
));
|
||||||
needDeleteStockIds.addAll(oldStockList.stream()
|
needDeleteStockIds.addAll(oldStockList.stream()
|
||||||
.map(TAppStock::getStockId)
|
.map(TAppStock::getStockId)
|
||||||
|
|
@ -687,7 +697,9 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
||||||
outTask.getOpUser(),
|
outTask.getOpUser(),
|
||||||
outTask.getRemark(),
|
outTask.getRemark(),
|
||||||
outTask.getCallStand(),
|
outTask.getCallStand(),
|
||||||
""
|
"",
|
||||||
|
outTask.getBarCode(),
|
||||||
|
outTask.getMesId()
|
||||||
)).toList();
|
)).toList();
|
||||||
appTaskBakService.saveBatch(stockOutRecordList);
|
appTaskBakService.saveBatch(stockOutRecordList);
|
||||||
// 删除当前载具所对应的出库任务
|
// 删除当前载具所对应的出库任务
|
||||||
|
|
|
||||||
|
|
@ -1,101 +0,0 @@
|
||||||
package com.wms_main.service.controller;
|
|
||||||
|
|
||||||
import com.wms_main.model.dto.query.*;
|
|
||||||
import com.wms_main.model.dto.request.wms.BaseWmsRequest;
|
|
||||||
import com.wms_main.model.dto.request.wms.ConfirmWorkRequest;
|
|
||||||
import com.wms_main.model.dto.request.wms.GenKanbanRequirementRequest;
|
|
||||||
import com.wms_main.model.dto.request.wms.InitKateWorkRequest;
|
|
||||||
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
|
||||||
import com.wms_main.model.dto.response.wms.WmsApiResponse;
|
|
||||||
import com.wms_main.model.vo.wms.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 卡特工作控制类服务接口
|
|
||||||
*/
|
|
||||||
public interface IKateWorkControllerService {
|
|
||||||
/**
|
|
||||||
* 查询工作情况
|
|
||||||
* @param kateWorksQuery 查询参数
|
|
||||||
* @return 查询结果
|
|
||||||
*/
|
|
||||||
WmsApiResponse<KateWorkOptionsVo> queryKateWorks(KateWorksQuery kateWorksQuery);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建工作/初始化
|
|
||||||
* @param initKateWorkRequest 请求信息
|
|
||||||
* @return 处理结果
|
|
||||||
*/
|
|
||||||
BaseWmsApiResponse initWorks(InitKateWorkRequest initKateWorkRequest);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得当前需要配料的工作
|
|
||||||
* @param kateWorksQuery 查询参数
|
|
||||||
* @return 查询结果
|
|
||||||
*/
|
|
||||||
WmsApiResponse<WorkConfirmVo> getCurrentWorks(KateWorksQuery kateWorksQuery);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 确认当前工作
|
|
||||||
* @param confirmWorkRequest 确认请求
|
|
||||||
* @return 处理结果
|
|
||||||
*/
|
|
||||||
BaseWmsApiResponse confirmCurrentWork(ConfirmWorkRequest confirmWorkRequest);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查找图纸
|
|
||||||
* @param request 请求参数
|
|
||||||
* @return 图纸
|
|
||||||
*/
|
|
||||||
WmsApiResponse<ImageVo> getImageOfWork(BaseWmsRequest request);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 配料界面获取料盒显示信息
|
|
||||||
* @param request 请求
|
|
||||||
* @return 查询结果
|
|
||||||
*/
|
|
||||||
WmsApiResponse<BoxDetailVo> getBoxesAndLacks(BaseWmsRequest request);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查看看板
|
|
||||||
* @param kanbanQuery 查询参数
|
|
||||||
* @return 查询结果
|
|
||||||
*/
|
|
||||||
WmsApiResponse<PageVo<KanbanVo>> queryKanbanByPage(KanbanQuery kanbanQuery);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生成看板需求
|
|
||||||
* @param genRequest 请求参数
|
|
||||||
* @return 请求结果
|
|
||||||
*/
|
|
||||||
BaseWmsApiResponse genClcKanbanRequirement(GenKanbanRequirementRequest genRequest);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询图纸
|
|
||||||
* @param imageQuery 查询参数
|
|
||||||
* @return 查询结果
|
|
||||||
*/
|
|
||||||
WmsApiResponse<List<ImageVo>> requestImageDetail(ImageQuery imageQuery);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询Dbs列表---分页
|
|
||||||
* @param dbsQuery 查询参数
|
|
||||||
* @return 查询结果---分页
|
|
||||||
*/
|
|
||||||
WmsApiResponse<PageVo<DbsVo>> queryDbsByPage(DbsQuery dbsQuery);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询配料单列表---分页
|
|
||||||
* @param kittingBomQuery 查询参数
|
|
||||||
* @return 查询结果---分页
|
|
||||||
*/
|
|
||||||
WmsApiResponse<PageVo<KittingBomVo>> queryKittingBomByPage(KittingBomQuery kittingBomQuery);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询配料单对应关系列表---分页
|
|
||||||
* @param kittingBomRelationQuery 查询参数
|
|
||||||
* @return 查询结果---分页
|
|
||||||
*/
|
|
||||||
WmsApiResponse<PageVo<KittingBomRelationVo>> queryKittingRelationByPage(KittingBomRelationQuery kittingBomRelationQuery);
|
|
||||||
}
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.wms_main.service.controller;
|
||||||
|
|
||||||
import com.wms_main.model.dto.query.LocationQuery;
|
import com.wms_main.model.dto.query.LocationQuery;
|
||||||
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
||||||
|
import com.wms_main.model.po.TAppLocation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 库位控制类服务
|
* 库位控制类服务
|
||||||
|
|
@ -12,5 +13,5 @@ public interface ILocationControllerService {
|
||||||
* @param locationQuery 查询参数
|
* @param locationQuery 查询参数
|
||||||
* @return 创建结果
|
* @return 创建结果
|
||||||
*/
|
*/
|
||||||
BaseWmsApiResponse genLocations(LocationQuery locationQuery);
|
BaseWmsApiResponse genLocations(TAppLocation locationQuery);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.wms_main.service.controller;
|
||||||
|
|
||||||
|
import com.wms_main.model.dto.request.mes.MesInTaskRequest;
|
||||||
|
import com.wms_main.model.dto.request.mes.MesOutTaskRequest;
|
||||||
|
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mes控制类
|
||||||
|
*/
|
||||||
|
public interface IMesControllerService {
|
||||||
|
/**
|
||||||
|
* 请求入库
|
||||||
|
* @param mesInTaskRequest 入库请求
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
BaseWmsApiResponse requestIn(MesInTaskRequest mesInTaskRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求出库
|
||||||
|
* @param mesOutTaskRequest 出库请求
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
BaseWmsApiResponse requestOut(MesOutTaskRequest mesOutTaskRequest);
|
||||||
|
}
|
||||||
|
|
@ -35,39 +35,4 @@ public interface ITaskControllerService {
|
||||||
* @return 处理结果
|
* @return 处理结果
|
||||||
*/
|
*/
|
||||||
BaseWcsApiResponse sendTaskResult(WcsTaskResultRequest wcsTaskResultRequest);
|
BaseWcsApiResponse sendTaskResult(WcsTaskResultRequest wcsTaskResultRequest);
|
||||||
|
|
||||||
/**
|
|
||||||
* wcs请求载具入库
|
|
||||||
* @param wcsVehicleInRequest 载具请求
|
|
||||||
* @return 处理结果
|
|
||||||
*/
|
|
||||||
WcsApiResponse<WcsStackerTask> wcsRequestVehicleIn(WcsVehicleInRequest wcsVehicleInRequest);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wcs上报载具到达站台
|
|
||||||
* @param boxArriveRequest 请求信息
|
|
||||||
* @return 处理结果
|
|
||||||
*/
|
|
||||||
BaseWcsApiResponse boxArrive(WcsBoxArriveRequest boxArriveRequest);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取消拣选任务
|
|
||||||
* @param pickTaskRequest 请求信息
|
|
||||||
* @return 处理结果
|
|
||||||
*/
|
|
||||||
BaseWmsApiResponse cancelPickTasks(PickTaskRequest pickTaskRequest);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得当前站台任务
|
|
||||||
* @param wmsRequest 请求信息
|
|
||||||
* @return 处理结果
|
|
||||||
*/
|
|
||||||
WmsApiResponse<TaskConfirmVo> getCurrentTask(BaseWmsRequest wmsRequest);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 确认任务
|
|
||||||
* @param confirmTaskRequest 请求信息
|
|
||||||
* @return 处理结果
|
|
||||||
*/
|
|
||||||
BaseWmsApiResponse confirmCurrentTask(ConfirmTaskRequest confirmTaskRequest);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -30,32 +30,35 @@ public class LocationControllerServiceImpl implements ILocationControllerService
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public BaseWmsApiResponse genLocations(LocationQuery locationQuery) {
|
public BaseWmsApiResponse genLocations(TAppLocation locationQuery) {
|
||||||
List<TAppLocation> newLocationList = new ArrayList<>();
|
List<TAppLocation> newLocationList = new ArrayList<>();
|
||||||
for (int row = 1; row <= 4; row++) {
|
for (int row = 1; row <= locationQuery.getLRow(); row++) {
|
||||||
for (int col = 1; col <= 42; col++) {
|
for (int col = 1; col <= locationQuery.getLCol(); col++) {
|
||||||
for (int layer = 1; layer <= 12; layer++) {
|
for (int layer = 1; layer <= locationQuery.getLLayer(); layer++) {
|
||||||
String locationId = "A" + StringUtils.padLeft(String.valueOf(row), "0", 2)
|
for (int depth = 1; depth <= locationQuery.getLDepth(); depth++) {
|
||||||
+ "-" + StringUtils.padLeft(String.valueOf(col), "0", 2)
|
String locationId = locationQuery.getSubArea() + StringUtils.padLeft(String.valueOf(row), "0", 2)
|
||||||
+ "-" + StringUtils.padLeft(String.valueOf(layer), "0", 2);
|
+ "-" + StringUtils.padLeft(String.valueOf(col), "0", 2)
|
||||||
TAppLocation newLocation = new TAppLocation(
|
+ "-" + StringUtils.padLeft(String.valueOf(layer), "0", 2)
|
||||||
locationId,
|
+ "-" + StringUtils.padLeft(String.valueOf(depth), "0", 2);
|
||||||
"",
|
TAppLocation newLocation = new TAppLocation(
|
||||||
1,
|
locationId,
|
||||||
layer == 2 ? 1 : 0,
|
"",
|
||||||
0,
|
1,
|
||||||
0,
|
0,
|
||||||
(row + 1)/2,
|
0,
|
||||||
(row + 1)/2,
|
0,
|
||||||
row,
|
(row + 1)/2,
|
||||||
col,
|
(row + 1)/2,
|
||||||
layer,
|
row,
|
||||||
1,
|
col,
|
||||||
"",
|
layer,
|
||||||
1,
|
depth,
|
||||||
""
|
"",
|
||||||
);
|
locationQuery.getAreaId() != null ? locationQuery.getAreaId() : 1,
|
||||||
newLocationList.add(newLocation);
|
""
|
||||||
|
);
|
||||||
|
newLocationList.add(newLocation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,187 @@
|
||||||
|
package com.wms_main.service.controller.serviceImpl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.wms_main.app.AppCommon;
|
||||||
|
import com.wms_main.constant.enums.wms.AppConfigKeyEnums;
|
||||||
|
import com.wms_main.constant.enums.wms.WmsStackerTaskStatusEnums;
|
||||||
|
import com.wms_main.constant.enums.wms.WmsTaskTypeEnums;
|
||||||
|
import com.wms_main.dao.ITAppStockService;
|
||||||
|
import com.wms_main.dao.ITAppTaskService;
|
||||||
|
import com.wms_main.model.bo.mes.MesDetailGoodsInfo;
|
||||||
|
import com.wms_main.model.bo.mes.MesDetailTaskInfo;
|
||||||
|
import com.wms_main.model.bo.wcs.WcsPickTask;
|
||||||
|
import com.wms_main.model.dto.request.mes.MesInTaskRequest;
|
||||||
|
import com.wms_main.model.dto.request.mes.MesOutTaskRequest;
|
||||||
|
import com.wms_main.model.dto.response.mes.MesGetGoodsResponse;
|
||||||
|
import com.wms_main.model.dto.response.wcs.WcsApiResponse;
|
||||||
|
import com.wms_main.model.dto.response.wms.BaseWmsApiResponse;
|
||||||
|
import com.wms_main.model.po.TAppLocation;
|
||||||
|
import com.wms_main.model.po.TAppTask;
|
||||||
|
import com.wms_main.repository.http.HttpClient;
|
||||||
|
import com.wms_main.repository.http.entity.HttpRequest;
|
||||||
|
import com.wms_main.repository.http.entity.HttpResponse;
|
||||||
|
import com.wms_main.repository.utils.StringUtils;
|
||||||
|
import com.wms_main.repository.utils.UUIDUtils;
|
||||||
|
import com.wms_main.service.business.IStackerTaskService;
|
||||||
|
import com.wms_main.service.controller.IMesControllerService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mes控制类服务实现
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class MesControllerServiceImpl implements IMesControllerService {
|
||||||
|
private final ITAppTaskService appTaskService;// wms任务服务
|
||||||
|
private final ITAppStockService appStockService;// wms库存服务
|
||||||
|
private final IStackerTaskService stackerTaskService;// 堆垛机任务服务
|
||||||
|
private final Map<String, Integer> mesTaskIdMap = new HashMap<>();// 防止mes发送重复任务号
|
||||||
|
private final AppCommon appCommon;
|
||||||
|
private final HttpClient httpClient;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mes请求入库--实现
|
||||||
|
* @param mesInTaskRequest 入库请求
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public BaseWmsApiResponse requestIn(MesInTaskRequest mesInTaskRequest) {
|
||||||
|
// 判断请求参数是否齐全
|
||||||
|
if (mesTaskIdMap.containsKey(mesInTaskRequest.getTaskId())) {
|
||||||
|
return BaseWmsApiResponse.error("任务号重复。");
|
||||||
|
}
|
||||||
|
// 添加任务号进缓存
|
||||||
|
mesTaskIdMap.put(mesInTaskRequest.getTaskId(), 1);
|
||||||
|
// 验证请求
|
||||||
|
String validateInfo = validateMesInRequest(mesInTaskRequest);
|
||||||
|
if (StringUtils.isNotEmpty(validateInfo)) {
|
||||||
|
return BaseWmsApiResponse.error(validateInfo);
|
||||||
|
}
|
||||||
|
// 请求一个空库位
|
||||||
|
TAppLocation targetLocation = stackerTaskService.requestOneLocation(null, mesInTaskRequest.getVehicleId());
|
||||||
|
if (targetLocation == null) {
|
||||||
|
return BaseWmsApiResponse.error("可用库位不足,请稍后重试。");
|
||||||
|
}
|
||||||
|
// 生成入库任务
|
||||||
|
List<TAppTask> inTasks = new ArrayList<>();
|
||||||
|
for (MesDetailTaskInfo mesDetailTaskInfo : mesInTaskRequest.getDetailTaskInfoList()) {
|
||||||
|
inTasks.add(new TAppTask(
|
||||||
|
UUIDUtils.getNewUUID(),
|
||||||
|
WmsTaskTypeEnums.IN.getCode(),
|
||||||
|
WmsStackerTaskStatusEnums.WAIT.getCode(),
|
||||||
|
1,
|
||||||
|
mesInTaskRequest.getVehicleId(),
|
||||||
|
mesInTaskRequest.getStandId(),
|
||||||
|
targetLocation.getLocationId(),
|
||||||
|
null,
|
||||||
|
LocalDateTime.now(),
|
||||||
|
null,
|
||||||
|
mesDetailTaskInfo.getGoodsId(),
|
||||||
|
mesDetailTaskInfo.getQuantity(),
|
||||||
|
0,
|
||||||
|
"mes",
|
||||||
|
"",
|
||||||
|
mesInTaskRequest.getStandId(),
|
||||||
|
"",
|
||||||
|
mesDetailTaskInfo.getBarCode(),
|
||||||
|
mesInTaskRequest.getTaskId()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
// 保存任务
|
||||||
|
appTaskService.saveBatch(inTasks);
|
||||||
|
|
||||||
|
// 请求处理结束,删除任务号缓存
|
||||||
|
mesTaskIdMap.remove(mesInTaskRequest.getTaskId());
|
||||||
|
return BaseWmsApiResponse.success("请求入库成功。");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mes请求出库--实现
|
||||||
|
* @param mesOutTaskRequest 出库请求
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public BaseWmsApiResponse requestOut(MesOutTaskRequest mesOutTaskRequest) {
|
||||||
|
// 验证出库请求
|
||||||
|
// 生成出库任务
|
||||||
|
List<TAppTask> outTasks = new ArrayList<>();
|
||||||
|
for (MesDetailTaskInfo mesDetailTaskInfo : mesOutTaskRequest.getDetailTaskInfoList()) {
|
||||||
|
outTasks.add(new TAppTask(
|
||||||
|
UUIDUtils.getNewUUID(),
|
||||||
|
WmsTaskTypeEnums.IN.getCode(),
|
||||||
|
WmsStackerTaskStatusEnums.WAIT.getCode(),
|
||||||
|
1,
|
||||||
|
"test01",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
null,
|
||||||
|
LocalDateTime.now(),
|
||||||
|
null,
|
||||||
|
mesDetailTaskInfo.getGoodsId(),
|
||||||
|
mesDetailTaskInfo.getQuantity(),
|
||||||
|
0,
|
||||||
|
"mes",
|
||||||
|
"",
|
||||||
|
mesOutTaskRequest.getStandId(),
|
||||||
|
"",
|
||||||
|
mesDetailTaskInfo.getBarCode(),
|
||||||
|
mesOutTaskRequest.getTaskId()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
appTaskService.saveBatch(outTasks);
|
||||||
|
return BaseWmsApiResponse.success("请求出库成功。");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证入库请求正确性
|
||||||
|
* @param mesInTaskRequest 入库请求
|
||||||
|
* @return 验证结果
|
||||||
|
*/
|
||||||
|
private String validateMesInRequest(MesInTaskRequest mesInTaskRequest) {
|
||||||
|
if (StringUtils.isEmpty(mesInTaskRequest.getTaskId())) {
|
||||||
|
return "任务号/订单号为空";
|
||||||
|
}
|
||||||
|
// 判断任务号是否重复
|
||||||
|
if (appTaskService.exists(new LambdaQueryWrapper<TAppTask>().eq(TAppTask::getMesId, mesInTaskRequest.getTaskId()))) {
|
||||||
|
return "任务号/订单号重复";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据条码号获取物料信息
|
||||||
|
* @param barCode 条码号
|
||||||
|
* @return 物料信息
|
||||||
|
*/
|
||||||
|
private MesDetailGoodsInfo getGoodsByBarCode(String barCode) {
|
||||||
|
String mesDetailQueryUrl = appCommon.getConfigByKey(AppConfigKeyEnums.MES_GET_GOODS_URL.getKey());
|
||||||
|
if (StringUtils.isNotEmpty(mesDetailQueryUrl)) {
|
||||||
|
Map<String, String> header = new HashMap<>();
|
||||||
|
header.put("X-Requested-With", "XMLHttpRequest");
|
||||||
|
// 设置http请求
|
||||||
|
HttpRequest httpRequest = HttpRequest.getInstanceOf(mesDetailQueryUrl + "?scCode=" + barCode, 5000, header);
|
||||||
|
HttpResponse httpResponse = httpClient.httpGet(httpRequest);
|
||||||
|
log.info("请求物料接口响应信息:{}", StringUtils.objectToString(httpResponse));
|
||||||
|
if (httpResponse != null && httpResponse.isSuccess()) {
|
||||||
|
MesGetGoodsResponse goodsInfoResponse = httpResponse.getData(MesGetGoodsResponse.class);
|
||||||
|
if (goodsInfoResponse != null && Objects.equals(goodsInfoResponse.getState(), "success")) {
|
||||||
|
return goodsInfoResponse.getData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.error("请求地址为空。");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -27,7 +27,6 @@ import com.wms_main.model.vo.wms.WorkConfirmVo;
|
||||||
import com.wms_main.repository.utils.ConvertUtils;
|
import com.wms_main.repository.utils.ConvertUtils;
|
||||||
import com.wms_main.repository.utils.StringUtils;
|
import com.wms_main.repository.utils.StringUtils;
|
||||||
import com.wms_main.repository.utils.UUIDUtils;
|
import com.wms_main.repository.utils.UUIDUtils;
|
||||||
import com.wms_main.service.business.IConveyTaskService;
|
|
||||||
import com.wms_main.service.business.IStackerTaskService;
|
import com.wms_main.service.business.IStackerTaskService;
|
||||||
import com.wms_main.service.business.IStockDataService;
|
import com.wms_main.service.business.IStockDataService;
|
||||||
import com.wms_main.service.controller.ITaskControllerService;
|
import com.wms_main.service.controller.ITaskControllerService;
|
||||||
|
|
@ -55,7 +54,6 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
||||||
private final ITAppPickTaskService appPickTaskService;// 拣选任务服务
|
private final ITAppPickTaskService appPickTaskService;// 拣选任务服务
|
||||||
private final ITAppVehicleService appVehicleService;// 载具服务
|
private final ITAppVehicleService appVehicleService;// 载具服务
|
||||||
private final ITAppStockService appStockService;// 库存服务
|
private final ITAppStockService appStockService;// 库存服务
|
||||||
private final IConveyTaskService conveyTaskService;// 输送线任务服务
|
|
||||||
private final ITAppStandService appStandService;// 站台服务
|
private final ITAppStandService appStandService;// 站台服务
|
||||||
private final ITAppOutsService appOutsService;// 出库单服务
|
private final ITAppOutsService appOutsService;// 出库单服务
|
||||||
private final IStockDataService stockDataService;// 库存数据服务
|
private final IStockDataService stockDataService;// 库存数据服务
|
||||||
|
|
@ -122,6 +120,8 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
||||||
stockInRequest.getUserName(),
|
stockInRequest.getUserName(),
|
||||||
"",
|
"",
|
||||||
stockInRequest.getStandId(),
|
stockInRequest.getStandId(),
|
||||||
|
"",
|
||||||
|
"",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
|
|
@ -167,7 +167,9 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
||||||
stockInRequest.getUserName(),
|
stockInRequest.getUserName(),
|
||||||
goodsInfoForTask.getRemark(),
|
goodsInfoForTask.getRemark(),
|
||||||
stockInRequest.getStandId(),
|
stockInRequest.getStandId(),
|
||||||
goods.getGoodsDescription()
|
goods.getGoodsDescription(),
|
||||||
|
"",
|
||||||
|
""
|
||||||
);
|
);
|
||||||
goodsIdTaskMap.put(goodsInfoForTask.getGoodsId(), task);
|
goodsIdTaskMap.put(goodsInfoForTask.getGoodsId(), task);
|
||||||
goodsMap.put(goodsInfoForTask.getGoodsId(), goods);
|
goodsMap.put(goodsInfoForTask.getGoodsId(), goods);
|
||||||
|
|
@ -325,331 +327,4 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
||||||
}
|
}
|
||||||
return BaseWcsApiResponse.success("处理任务状态反馈成功。");
|
return BaseWcsApiResponse.success("处理任务状态反馈成功。");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 实现
|
|
||||||
*
|
|
||||||
* @param wcsVehicleInRequest 载具请求
|
|
||||||
* @return 响应信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public WcsApiResponse<WcsStackerTask> wcsRequestVehicleIn(WcsVehicleInRequest wcsVehicleInRequest) {
|
|
||||||
if (StringUtils.isEmpty(wcsVehicleInRequest.getVehicleNo())) {
|
|
||||||
return WcsApiResponse.error("请求缺少关键信息:载具号。", null);
|
|
||||||
}
|
|
||||||
// 查询该载具对应的wms任务
|
|
||||||
List<TAppTask> wmsTasks = appWmsTaskService.list(
|
|
||||||
new LambdaQueryWrapper<TAppTask>()
|
|
||||||
.eq(TAppTask::getVehicleId, wcsVehicleInRequest.getVehicleNo())
|
|
||||||
.eq(TAppTask::getTaskType, WmsTaskTypeEnums.IN.getCode())
|
|
||||||
.eq(TAppTask::getTaskStatus, WmsStackerTaskStatusEnums.TEMP.getCode())
|
|
||||||
);
|
|
||||||
if (wmsTasks == null || wmsTasks.isEmpty()) {
|
|
||||||
return WcsApiResponse.error("当前载具不存在任务或者任务已经下发。", null);
|
|
||||||
}
|
|
||||||
// 查询是否已经有对应wcs任务
|
|
||||||
List<TAppWcsTask> wcsTasks = appWcsTaskService.list(
|
|
||||||
new LambdaQueryWrapper<TAppWcsTask>()
|
|
||||||
.eq(TAppWcsTask::getVehicleId, wcsVehicleInRequest.getVehicleNo())
|
|
||||||
.eq(TAppWcsTask::getWcsTaskType, WcsStackerTaskTypeEnums.IN.getCode())
|
|
||||||
.ne(TAppWcsTask::getWcsTaskStatus, WcsStackerTaskStatusEnums.FINISH.getCode()));
|
|
||||||
if (wcsTasks != null && !wcsTasks.isEmpty()) {
|
|
||||||
WcsStackerTask wcsStackerTask = new WcsStackerTask(
|
|
||||||
wcsTasks.getFirst().getWcsTaskId(),
|
|
||||||
wcsTasks.getFirst().getWcsTaskType(),
|
|
||||||
wcsTasks.getFirst().getVehicleId(),
|
|
||||||
wcsTasks.getFirst().getOrigin(),
|
|
||||||
wcsTasks.getFirst().getDestination(),
|
|
||||||
"WMS"
|
|
||||||
);
|
|
||||||
return WcsApiResponse.success("载具请求入库成功。", wcsStackerTask);
|
|
||||||
}
|
|
||||||
// 判断是否已经分配库位
|
|
||||||
String locationId = "";
|
|
||||||
List<String> goodsIds = new ArrayList<>();
|
|
||||||
for (TAppTask wmsTask : wmsTasks) {
|
|
||||||
if (StringUtils.isNotEmpty(wmsTask.getDestination())) {
|
|
||||||
locationId = wmsTask.getDestination();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!goodsIds.contains(wmsTask.getGoodsId())) {
|
|
||||||
goodsIds.add(wmsTask.getGoodsId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (StringUtils.isEmpty(locationId)) {
|
|
||||||
// 如果只有一个料号,那么分配优先存放区域
|
|
||||||
TAppLocation locationFilter = new TAppLocation();
|
|
||||||
if (goodsIds.size() == 1) {
|
|
||||||
TAppGoods thisGoods = appCommon.getInstantGoodsByGoodsId(goodsIds.getFirst());
|
|
||||||
if (thisGoods != null && StringUtils.isNotEmpty(thisGoods.getPutArea())) {
|
|
||||||
locationFilter.setSubArea(thisGoods.getPutArea());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 需要申请库位
|
|
||||||
TAppLocation targetLocation = stackerTaskService.requestOneLocation(null, wcsVehicleInRequest.getVehicleNo());
|
|
||||||
locationId = targetLocation.getLocationId();
|
|
||||||
}
|
|
||||||
// 解析wms任务以获得wcs任务
|
|
||||||
TAppWcsTask wcsInTask = new TAppWcsTask();
|
|
||||||
wcsInTask.setWcsTaskId(UUIDUtils.getNewUUID());
|
|
||||||
wcsInTask.setWcsTaskType(WcsStackerTaskTypeEnums.IN.getCode());
|
|
||||||
wcsInTask.setWcsTaskStatus(WcsStackerTaskStatusEnums.WAIT.getCode());
|
|
||||||
wcsInTask.setTaskPriority(wmsTasks.getFirst().getTaskPriority());
|
|
||||||
wcsInTask.setOrigin(wmsTasks.getFirst().getOrigin());
|
|
||||||
wcsInTask.setDestination(locationId);
|
|
||||||
wcsInTask.setVehicleId(wmsTasks.getFirst().getVehicleId());
|
|
||||||
wcsInTask.setCreateTime(LocalDateTime.now());
|
|
||||||
wcsInTask.setSendTime(LocalDateTime.now());
|
|
||||||
// 实时返回的任务
|
|
||||||
WcsStackerTask wcsStackerTask = new WcsStackerTask(
|
|
||||||
wcsInTask.getWcsTaskId(),
|
|
||||||
wcsInTask.getWcsTaskType(),
|
|
||||||
wcsInTask.getVehicleId(),
|
|
||||||
wcsInTask.getOrigin(),
|
|
||||||
wcsInTask.getDestination(),
|
|
||||||
"WMS"
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
// 载具设置状态入库中
|
|
||||||
appVehicleService.update(new LambdaUpdateWrapper<TAppVehicle>()
|
|
||||||
.set(TAppVehicle::getVehicleStatus, WmsVehicleStatusEnums.IN.getCode())
|
|
||||||
.eq(TAppVehicle::getVehicleId, wcsVehicleInRequest.getVehicleNo()));
|
|
||||||
// 如果有库存的话,更新库存状态为回库中
|
|
||||||
appStockService.update(new LambdaUpdateWrapper<TAppStock>()
|
|
||||||
.set(TAppStock::getStockStatus, WmsStockStatusEnums.BACK.getCode())
|
|
||||||
.eq(TAppStock::getVehicleId, wcsVehicleInRequest.getVehicleNo()));
|
|
||||||
// 更新wmsTask
|
|
||||||
appWmsTaskService.update(
|
|
||||||
new LambdaUpdateWrapper<TAppTask>()
|
|
||||||
.set(TAppTask::getTaskStatus, WmsStackerTaskStatusEnums.SEND.getCode())
|
|
||||||
.set(TAppTask::getWcsTaskId, wcsInTask.getWcsTaskId())
|
|
||||||
.set(TAppTask::getDestination, locationId)
|
|
||||||
.eq(TAppTask::getVehicleId, wcsVehicleInRequest.getVehicleNo())
|
|
||||||
.eq(TAppTask::getTaskType, WmsTaskTypeEnums.IN.getCode())
|
|
||||||
.eq(TAppTask::getTaskStatus, WmsStackerTaskStatusEnums.TEMP.getCode())
|
|
||||||
);
|
|
||||||
// 存储wcsTask
|
|
||||||
appWcsTaskService.save(wcsInTask);
|
|
||||||
return WcsApiResponse.success("载具请求入库成功。", wcsStackerTask);
|
|
||||||
} catch (Exception e) {
|
|
||||||
// 回滚事务
|
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
||||||
// 恢复库位空闲
|
|
||||||
appLocationService.update(new LambdaUpdateWrapper<TAppLocation>()
|
|
||||||
.set(TAppLocation::getIsOccupy, 0)
|
|
||||||
.set(TAppLocation::getVehicleId, "")
|
|
||||||
.eq(TAppLocation::getLocationId, locationId));
|
|
||||||
return WcsApiResponse.error("载具请求入库发生异常。", null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 实现
|
|
||||||
*
|
|
||||||
* @param boxArriveRequest 请求信息
|
|
||||||
* @return 响应信息
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public BaseWcsApiResponse boxArrive(WcsBoxArriveRequest boxArriveRequest) {
|
|
||||||
if (boxArriveRequest == null
|
|
||||||
|| StringUtils.isEmpty(boxArriveRequest.getVehicleNo())
|
|
||||||
|| StringUtils.isEmpty(boxArriveRequest.getLocation())) {
|
|
||||||
return BaseWcsApiResponse.error("请求信息不完整,缺少载具号或者点位。");
|
|
||||||
}
|
|
||||||
// 更新当前载具到达当前点位的拣选任务为已到达
|
|
||||||
boolean isUpdateSuccess = appPickTaskService.update(new LambdaUpdateWrapper<TAppPickTask>()
|
|
||||||
.set(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.ARRIVE.getCode())
|
|
||||||
.set(TAppPickTask::getArriveTime, LocalDateTime.now())
|
|
||||||
.eq(TAppPickTask::getVehicleId, boxArriveRequest.getVehicleNo())
|
|
||||||
.eq(TAppPickTask::getPickStand, boxArriveRequest.getLocation())
|
|
||||||
.ne(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.FOR_IN.getCode()));
|
|
||||||
if (isUpdateSuccess) {
|
|
||||||
// 更新成功,返回成功
|
|
||||||
return BaseWcsApiResponse.success("处理成功。");
|
|
||||||
} else {
|
|
||||||
// 更新失败,返回失败
|
|
||||||
return BaseWcsApiResponse.error("处理失败。");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取消拣选任务实现
|
|
||||||
*
|
|
||||||
* @param pickTaskRequest 请求信息
|
|
||||||
* @return 处理结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public BaseWmsApiResponse cancelPickTasks(PickTaskRequest pickTaskRequest) {
|
|
||||||
if (pickTaskRequest == null || pickTaskRequest.getPickTasks() == null || pickTaskRequest.getPickTasks().isEmpty()) {
|
|
||||||
// 更新失败,返回失败
|
|
||||||
return BaseWmsApiResponse.error("空请求。");
|
|
||||||
}
|
|
||||||
// 获得需要取消的拣选任务列表
|
|
||||||
Map<String, WmsPickTask> vehicleStandMap = new HashMap<>();
|
|
||||||
for (WmsPickTask pickTask : pickTaskRequest.getPickTasks()) {
|
|
||||||
String key = pickTask.getVehicleId() + "_" + pickTask.getPickStand();
|
|
||||||
if (vehicleStandMap.containsKey(key)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
vehicleStandMap.put(key, pickTask);
|
|
||||||
}
|
|
||||||
int successCount = 0;
|
|
||||||
int failCount = 0;
|
|
||||||
int exceptionCount = 0;
|
|
||||||
conveyTaskService.cancelPickTasks(vehicleStandMap, successCount, failCount, exceptionCount);
|
|
||||||
return BaseWmsApiResponse.success("取消拣选任务成功" + successCount + "条,失败" + failCount + "条,异常" + exceptionCount + "条。");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前站台任务---实现
|
|
||||||
*
|
|
||||||
* @param wmsRequest 请求信息
|
|
||||||
* @return 获取结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public WmsApiResponse<TaskConfirmVo> getCurrentTask(BaseWmsRequest wmsRequest) {
|
|
||||||
if (wmsRequest == null || StringUtils.isEmpty(wmsRequest.getStandId())) {
|
|
||||||
// 缺少站台号
|
|
||||||
return WmsApiResponse.error("请求缺少信息,请输入站台号。", null);
|
|
||||||
}
|
|
||||||
// 查询当前站台的拣选任务
|
|
||||||
List<TAppPickTask> pickTasks = appPickTaskService.list(new LambdaQueryWrapper<TAppPickTask>()
|
|
||||||
.eq(TAppPickTask::getPickStand, wmsRequest.getStandId())
|
|
||||||
.eq(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.ARRIVE.getCode()));
|
|
||||||
if (pickTasks == null || pickTasks.isEmpty()) {
|
|
||||||
// 当前站台没有任务
|
|
||||||
return WmsApiResponse.error("当前站台没有任务。", null);
|
|
||||||
}
|
|
||||||
TAppPickTask thisStandPickTask = pickTasks.getFirst();
|
|
||||||
// 查找这个载具对应的库存信息:数量>0
|
|
||||||
List<TAppStock> thisVehicleStocks = appStockService.list(new LambdaQueryWrapper<TAppStock>()
|
|
||||||
.eq(TAppStock::getVehicleId, thisStandPickTask.getVehicleId())
|
|
||||||
.gt(TAppStock::getRealNum, 0));
|
|
||||||
if (thisVehicleStocks == null || thisVehicleStocks.isEmpty()) {
|
|
||||||
return WmsApiResponse.instanceOf(WmsApiResponseCodeEnums.WARNING.getCode(), "当前箱子已经是空箱,请直接放行。", null);
|
|
||||||
}
|
|
||||||
// 判断是否有任务需求
|
|
||||||
TaskConfirmVo confirmVo = conveyTaskService.getCurrentStandTask(thisStandPickTask);
|
|
||||||
if (confirmVo != null) {
|
|
||||||
return WmsApiResponse.success("请根据界面提示拣选。", confirmVo);
|
|
||||||
}
|
|
||||||
return WmsApiResponse.instanceOf(WmsApiResponseCodeEnums.WARNING.getCode(), "当前箱子没有拣选需求,请直接放行。", null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 确认当前站台任务---实现
|
|
||||||
*
|
|
||||||
* @param confirmTaskRequest 请求信息
|
|
||||||
* @return 确认结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public BaseWmsApiResponse confirmCurrentTask(ConfirmTaskRequest confirmTaskRequest) {
|
|
||||||
if (confirmTaskRequest == null || StringUtils.isEmpty(confirmTaskRequest.getStandId())) {
|
|
||||||
return BaseWmsApiResponse.error("请求缺少信息,请输入站台号。");
|
|
||||||
}
|
|
||||||
// 查询当前站台上的已到达的拣选任务
|
|
||||||
List<TAppPickTask> pickTaskList = appPickTaskService.list(new LambdaQueryWrapper<TAppPickTask>()
|
|
||||||
.eq(TAppPickTask::getPickStand, confirmTaskRequest.getStandId())
|
|
||||||
.eq(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.ARRIVE.getCode()));
|
|
||||||
if (pickTaskList == null || pickTaskList.isEmpty()) {
|
|
||||||
return BaseWmsApiResponse.error("当前站台没有箱子到达, 请检查。");
|
|
||||||
}
|
|
||||||
if (pickTaskList.size() > 1) {
|
|
||||||
return BaseWmsApiResponse.error("当前站台有多个箱子到达,请检查。");
|
|
||||||
}
|
|
||||||
// 当前站台到达的拣选任务
|
|
||||||
TAppPickTask thisPickTask = pickTaskList.getFirst();
|
|
||||||
// 更新工作信息
|
|
||||||
updateTaskInfo(confirmTaskRequest);
|
|
||||||
// 更新库存信息
|
|
||||||
stockDataService.updateStockInfo(confirmTaskRequest.getStockConfirm(), confirmTaskRequest.getStandId(), confirmTaskRequest.getUserName(), "出库拣选");
|
|
||||||
// 查询库存获得当前载具中存储的库存列表
|
|
||||||
LambdaQueryWrapper<TAppStock> stockQueryWrapper = new LambdaQueryWrapper<TAppStock>()
|
|
||||||
.eq(TAppStock::getVehicleId, thisPickTask.getVehicleId())
|
|
||||||
.gt(TAppStock::getRealNum, 0);
|
|
||||||
List<TAppStock> stockList = appStockService.list(stockQueryWrapper);
|
|
||||||
// 界面直接点击确认/放行
|
|
||||||
if (!stockList.isEmpty()) {
|
|
||||||
// 判断还有没有当前站台的其他拣选任务
|
|
||||||
TaskConfirmVo taskConfirmVo = conveyTaskService.getCurrentStandTask(thisPickTask);
|
|
||||||
if (taskConfirmVo != null) {
|
|
||||||
return BaseWmsApiResponse.warn("当前载具还有其他拣选任务,请根据界面信息进行拣配。");
|
|
||||||
}
|
|
||||||
WorkConfirmVo resultVo = conveyTaskService.getCurrentStandWork(thisPickTask);
|
|
||||||
if (resultVo != null) {
|
|
||||||
return BaseWmsApiResponse.warn("当前载具还有工作,请切换到拣配界面进行拣配。");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 取消后续拣选任务
|
|
||||||
conveyTaskService.cancelOtherStandPickTasks(thisPickTask.getVehicleId(), thisPickTask.getPickStand());
|
|
||||||
}
|
|
||||||
// 放行
|
|
||||||
if (conveyTaskService.releaseStandVehicle(thisPickTask)) {
|
|
||||||
return BaseWmsApiResponse.success("确认成功。");
|
|
||||||
} else {
|
|
||||||
// 回滚事务
|
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
||||||
return BaseWmsApiResponse.error("释放箱子失败。");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新出库单信息
|
|
||||||
* @param confirmTaskRequest 确认信息
|
|
||||||
*/
|
|
||||||
private void updateTaskInfo(ConfirmTaskRequest confirmTaskRequest) {
|
|
||||||
if (confirmTaskRequest == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
TaskConfirmEntity taskConfirm = confirmTaskRequest.getTaskConfirm();
|
|
||||||
if (taskConfirm == null || StringUtils.isEmpty(taskConfirm.getTaskId())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 查询对应的任务
|
|
||||||
TAppOuts outs = appOutsService.getOne(new LambdaQueryWrapper<TAppOuts>()
|
|
||||||
.eq(TAppOuts::getTaskId, taskConfirm.getTaskId()));
|
|
||||||
if (outs == null || taskConfirm.getRealPickQty() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
outs.setPickNum(outs.getPickNum() + taskConfirm.getRealPickQty());
|
|
||||||
outs.setUserName(confirmTaskRequest.getUserName());
|
|
||||||
if (Objects.equals(outs.getPickNum(), outs.getNeedNum())) {
|
|
||||||
// 生成记录
|
|
||||||
TAppOutsRecord record = new TAppOutsRecord(
|
|
||||||
outs.getTaskId(),
|
|
||||||
outs.getGoodsId(),
|
|
||||||
outs.getVehicleId(),
|
|
||||||
outs.getNeedNum(),
|
|
||||||
outs.getDistributeNum(),
|
|
||||||
outs.getPickNum(),
|
|
||||||
outs.getOutType(),
|
|
||||||
outs.getDestination(),
|
|
||||||
outs.getUserName()
|
|
||||||
);
|
|
||||||
// 删除出库单
|
|
||||||
appOutsService.removeById(outs.getTaskId());
|
|
||||||
// 添加记录
|
|
||||||
appOutsRecordService.save(record);
|
|
||||||
} else {
|
|
||||||
// 更新出库单
|
|
||||||
appOutsService.updateById(outs);
|
|
||||||
}
|
|
||||||
// 同时修正库存剩余数量
|
|
||||||
if (confirmTaskRequest.getStockConfirm() != null) {
|
|
||||||
if (!Objects.equals(taskConfirm.getRealPickQty(), taskConfirm.getPlanPickQty())) {
|
|
||||||
// 判断当前的库存确认中是不是库外料
|
|
||||||
StockConfirmEntity stockConfirm = confirmTaskRequest.getStockConfirm();
|
|
||||||
if (stockConfirm.getIsOut() != 1) {
|
|
||||||
// 修正剩余库存数量
|
|
||||||
int change = taskConfirm.getRealPickQty() - taskConfirm.getPlanPickQty();
|
|
||||||
stockConfirm.setRealRemainQty(stockConfirm.getRealRemainQty() + change);
|
|
||||||
confirmTaskRequest.setStockConfirm(stockConfirm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
package com.wms_main.service.quartz_job;
|
|
||||||
|
|
||||||
public interface IOutsExecutorService {
|
|
||||||
/**
|
|
||||||
* 解析出库单
|
|
||||||
*/
|
|
||||||
void executeOuts();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 解析订单并生成wms任务、拣选任务
|
|
||||||
*/
|
|
||||||
void executeKateWorks();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修复工作状态
|
|
||||||
*/
|
|
||||||
void repairKateWorks();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修复站台工作
|
|
||||||
*/
|
|
||||||
void repairStandWorks();
|
|
||||||
}
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
package com.wms_main.service.quartz_job.job_executor;
|
|
||||||
|
|
||||||
import com.wms_main.repository.utils.StringUtils;
|
|
||||||
import com.wms_main.service.quartz_job.IOutsExecutorService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.quartz.DisallowConcurrentExecution;
|
|
||||||
import org.quartz.Job;
|
|
||||||
import org.quartz.JobExecutionContext;
|
|
||||||
import org.quartz.PersistJobDataAfterExecution;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 定时任务定义类---出库单解析类
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@PersistJobDataAfterExecution
|
|
||||||
// 以下注解用于实现fixed_delay
|
|
||||||
@DisallowConcurrentExecution
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class OutsExecutor implements Job {
|
|
||||||
private final IOutsExecutorService outsExecutorService;// 出库单解析服务
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运行定时任务
|
|
||||||
*
|
|
||||||
* @param jobExecutionContext 定时任务执行的环境(上下文)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void execute(JobExecutionContext jobExecutionContext) {
|
|
||||||
// 修复站台工作StandWork
|
|
||||||
try {
|
|
||||||
outsExecutorService.repairStandWorks();
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("修复站台工作StandWork失败{}", StringUtils.objectToString(e));
|
|
||||||
}
|
|
||||||
// 解析工作(配料)
|
|
||||||
try {
|
|
||||||
outsExecutorService.executeKateWorks();
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("解析工作(配料)失败{}", StringUtils.objectToString(e));
|
|
||||||
}
|
|
||||||
// 自修复(配料)
|
|
||||||
try {
|
|
||||||
outsExecutorService.repairKateWorks();
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("自修复(配料)失败{}", StringUtils.objectToString(e));
|
|
||||||
}
|
|
||||||
// 处理出库单
|
|
||||||
try {
|
|
||||||
outsExecutorService.executeOuts();
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("处理出库单失败{}", StringUtils.objectToString(e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,81 +0,0 @@
|
||||||
package com.wms_main.service.quartz_job.job_executor;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
||||||
import com.wms_main.constant.enums.wcs.WcsApiResponseCodeEnums;
|
|
||||||
import com.wms_main.constant.enums.wcs.WcsConveyTaskTypeEnums;
|
|
||||||
import com.wms_main.constant.enums.wms.WmsPickTaskStatusEnum;
|
|
||||||
import com.wms_main.dao.ITAppPickTaskService;
|
|
||||||
import com.wms_main.model.bo.wcs.WcsPickTask;
|
|
||||||
import com.wms_main.model.dto.request.wcs.WcsPickTaskRequest;
|
|
||||||
import com.wms_main.model.dto.response.wcs.WcsApiResponse;
|
|
||||||
import com.wms_main.model.po.TAppPickTask;
|
|
||||||
import com.wms_main.service.api.IWcsApiService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.quartz.*;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 定时任务定义类---发送拣选任务
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@PersistJobDataAfterExecution
|
|
||||||
// 以下注解用于实现fixed_delay
|
|
||||||
@DisallowConcurrentExecution
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class WcsPickTaskSender implements Job {
|
|
||||||
/**
|
|
||||||
* 拣选任务服务
|
|
||||||
*/
|
|
||||||
private final ITAppPickTaskService appPickTaskService;
|
|
||||||
/**
|
|
||||||
* Wcs接口服务
|
|
||||||
*/
|
|
||||||
private final IWcsApiService wcsApiService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 运行定时任务
|
|
||||||
* 向Wcs发送拣选任务
|
|
||||||
*
|
|
||||||
* @param jobExecutionContext 定时任务执行的环境(上下文)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void execute(JobExecutionContext jobExecutionContext) {
|
|
||||||
// 获取到所有待下发的拣选任务
|
|
||||||
List<TAppPickTask> waitSendPickTaskList = appPickTaskService.list(
|
|
||||||
new LambdaQueryWrapper<TAppPickTask>()
|
|
||||||
.eq(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.WAIT.getCode())
|
|
||||||
);
|
|
||||||
// 轮询发送任务
|
|
||||||
for (TAppPickTask pickTask : waitSendPickTaskList) {
|
|
||||||
// 生成请求
|
|
||||||
WcsPickTaskRequest request = new WcsPickTaskRequest(
|
|
||||||
pickTask.getPickId(),
|
|
||||||
pickTask.getVehicleId(),
|
|
||||||
WcsConveyTaskTypeEnums.CONVEY_TASK_TYPE_PICK.getCode(),
|
|
||||||
pickTask.getPickStand(),
|
|
||||||
""
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
WcsApiResponse<WcsPickTask> wcsResponse = wcsApiService.sendPickTask(request);
|
|
||||||
if (wcsResponse != null && WcsApiResponseCodeEnums.SUCCESS.getCode() == wcsResponse.getCode()) {
|
|
||||||
// 更新这个载具这个站台的拣选任务的状态
|
|
||||||
appPickTaskService.update(
|
|
||||||
new LambdaUpdateWrapper<TAppPickTask>()
|
|
||||||
.set(TAppPickTask::getPickStatus, WmsPickTaskStatusEnum.SEND.getCode())
|
|
||||||
.set(TAppPickTask::getSendTime, LocalDateTime.now())
|
|
||||||
.eq(TAppPickTask::getVehicleId, pickTask.getVehicleId())
|
|
||||||
.eq(TAppPickTask::getPickStand, pickTask.getPickStand())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("拣选任务发送失败,任务号:{},载具号:{},拣选站台:{}。", request.getTaskId(), request.getVehicleNo(), request.getLocation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user