初始化
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
package com.ruoyi.apiService.controller;
|
||||
|
||||
|
||||
import com.ruoyi.apiService.domain.receiveStockList.StockinListReceive;
|
||||
import com.ruoyi.apiService.domain.receiveStockList.StockinListResponse;
|
||||
import com.ruoyi.apiService.domain.receiveStockList.StockoutListReceive;
|
||||
import com.ruoyi.apiService.service.IToErpService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 作业统计 Controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api2erp")
|
||||
public class ToErpApiController {
|
||||
|
||||
// @Autowired
|
||||
// private IToErpService toErpService;
|
||||
//
|
||||
// /**
|
||||
// * 接收物料信息
|
||||
// */
|
||||
// @GetMapping("/receiveProduct")
|
||||
// public AjaxResult receiveProduct() {
|
||||
// return toErpService.receiveProduct();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 接收客户信息
|
||||
// */
|
||||
// @GetMapping("/receiveCustomer")
|
||||
// public AjaxResult receiveCustomer() {
|
||||
// return toErpService.receiveCustomer();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 接收供应商信息
|
||||
// */
|
||||
// @GetMapping("/receiveSupplier")
|
||||
// public AjaxResult receiveSupplier() {
|
||||
// return toErpService.receiveSupplier();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 接收入库单信息
|
||||
// */
|
||||
// @GetMapping("/receiveStockinList")
|
||||
// public AjaxResult receiveStockinList(@RequestBody StockinListReceive stockinListReceive){
|
||||
// return toErpService.receiveStockinList(stockinListReceive);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 接收出库单信息
|
||||
// */
|
||||
// @GetMapping("/receiveStockoutList")
|
||||
// public AjaxResult receiveStockoutList(@RequestBody StockoutListReceive stockoutListReceive){
|
||||
// return toErpService.receiveStockoutList(stockoutListReceive);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 接收盘点单信息
|
||||
// */
|
||||
// @GetMapping("/receiveInventoryList")
|
||||
// public AjaxResult receiveInventoryList(){
|
||||
// return toErpService.receiveInventoryList();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @PostMapping("/login")
|
||||
// public AjaxResult login() {
|
||||
// toErpService.login();
|
||||
// return AjaxResult.success();
|
||||
// }
|
||||
//
|
||||
// @PostMapping("/qqq")
|
||||
// public AjaxResult qqq() {
|
||||
// return toErpService.getErpStockinList();
|
||||
// }
|
||||
//
|
||||
// @RequestMapping("/getInStock")
|
||||
// public AjaxResult getInStock(){
|
||||
// return toErpService.getInStock();
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.ruoyi.apiService.controller;
|
||||
|
||||
|
||||
import com.ruoyi.apiService.domain.AgvMoveParam;
|
||||
import com.ruoyi.apiService.service.IToWcsService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 作业统计 Controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api2wcs")
|
||||
public class ToWcsApiController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IToWcsService toWcsService;
|
||||
|
||||
|
||||
/**
|
||||
* 推送agv搬运作业
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/pushAgvMoveJob")
|
||||
public AjaxResult pushAgvMoveJob(@RequestBody AgvMoveParam agvMoveParam) {
|
||||
// return toWcsService.pushAgvMoveJob(agvMoveParam);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.ruoyi.apiService.controller;
|
||||
|
||||
import com.ruoyi.apiService.service.IToWmsService;
|
||||
import com.ruoyi.log.service.IRequestLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 作业统计 Controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api2wms")
|
||||
public class ToWmsApiController {
|
||||
|
||||
@Autowired
|
||||
private IToWmsService toWmsService;
|
||||
@Autowired
|
||||
private IRequestLogService requestLogService;
|
||||
|
||||
// /**
|
||||
// * 请求生成入库作业
|
||||
// */
|
||||
// @PostMapping("/requestMydoJobByTrayCode")
|
||||
// public AjaxResult requestEnterByTrayCode(@RequestBody WcsStockinReiceive wcsStockinReiceive) {
|
||||
// AjaxResult ajaxResult = toWmsService.requestMydoJobByTrayCode(wcsStockinReiceive);
|
||||
// RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wcsStockinReiceive), "入库任务创建请求",ajaxResult);
|
||||
// requestLogService.insertRequestLog(requestLog);
|
||||
// return ajaxResult;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 请求补码作业
|
||||
// */
|
||||
// @RequestMapping("/requestMydoJobByNoTrayCode")
|
||||
// public AjaxResult requestByNoTrayCode(@RequestBody WcsStockinReiceive wcsStockinReiceive) {
|
||||
// AjaxResult ajaxResult = toWmsService.requestMydoJobManual(wcsStockinReiceive);
|
||||
// RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wcsStockinReiceive), "请求补码作业",ajaxResult);
|
||||
// requestLogService.insertRequestLog(requestLog);
|
||||
// return ajaxResult;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取入库作业
|
||||
// */
|
||||
// @RequestMapping("/requestMydoJobByTrayCodeAndEntranceId")
|
||||
// public AjaxResult requestEnterByTrayCodeAndEntranceId(@RequestBody RequestEnter requestEnter) {
|
||||
// AjaxResult ajaxResult = toWmsService.requestEnterByTrayCodeAndEntranceId(requestEnter);
|
||||
// RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(requestEnter), "获取入库作业",ajaxResult);
|
||||
// requestLogService.insertRequestLog(requestLog);
|
||||
// return ajaxResult;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 入库、出库 任务完成回传
|
||||
// * Map<String, String>
|
||||
// * "wmsType": "任务类型" 1-入库 2-出库 3-agv搬运,
|
||||
// * taskNo:出库 入库任务号
|
||||
// * trayCode:托盘码
|
||||
// * positionCode1:起点
|
||||
// * positionCode2:终点
|
||||
// * containerCode:容器编码
|
||||
// *
|
||||
// */
|
||||
// @PostMapping("/jobFinish")
|
||||
// public AjaxResult jobFinish(@RequestBody WmsJobRequest wmsJobRequest) {
|
||||
// AjaxResult ajaxResult = toWmsService.jobFinish(wmsJobRequest);
|
||||
// RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wmsJobRequest), "jobFinish",ajaxResult);
|
||||
// requestLogService.insertRequestLog(requestLog);
|
||||
// return ajaxResult;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 放货有货,重新分配货位
|
||||
// */
|
||||
// @PostMapping("/reAssign")
|
||||
// public AjaxResult reAssign(@RequestBody ReMaterialParam reMaterialParam) {
|
||||
// AjaxResult ajaxResult = toWmsService.reAssign(reMaterialParam);
|
||||
// RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(reMaterialParam), "reAssign",ajaxResult);
|
||||
// requestLogService.insertRequestLog(requestLog);
|
||||
// return ajaxResult;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 取货无货,重新分配物料
|
||||
// */
|
||||
// @PostMapping("/reMaterial")
|
||||
// public AjaxResult reMaterial(@RequestBody ReMaterialParam reMaterialParam) {
|
||||
// AjaxResult ajaxResult = toWmsService.reMaterial(reMaterialParam);
|
||||
// RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(reMaterialParam), "reMaterial",ajaxResult);
|
||||
// requestLogService.insertRequestLog(requestLog);
|
||||
// return ajaxResult;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 接收入库单据
|
||||
*/
|
||||
|
||||
/**
|
||||
* 接收出库单据
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.ruoyi.apiService.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AgvMoveParam {
|
||||
private String startPoint;
|
||||
private String endPoint;
|
||||
private String containerCode;
|
||||
private String taskNo;
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.ruoyi.apiService.domain;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 【生成AGV任务】请求接口
|
||||
*/
|
||||
@Data
|
||||
public class GenAgvSchedulingTaskRequest {
|
||||
/**
|
||||
* 请求编号
|
||||
* 同一个请求重复提交, 使用同一编号
|
||||
*/
|
||||
@NotNull
|
||||
private String reqCode = UUID.randomUUID().toString();
|
||||
/**
|
||||
* 请求时间
|
||||
* 格式: “yyyy-MM-dd HH:mm:ss”
|
||||
*/
|
||||
private String reqTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")).toString();
|
||||
/**
|
||||
* 客户端编号
|
||||
* 客户端编号,如PDA,HCWMS等
|
||||
*/
|
||||
private String clientCode;
|
||||
/**
|
||||
* 令牌号
|
||||
* 由调度系统颁发
|
||||
*/
|
||||
private String tokenCode;
|
||||
/**
|
||||
* 任务类型
|
||||
* 内置任务类型:
|
||||
* 厂内货架搬运: F01
|
||||
* 厂内货架空满交换: F02
|
||||
* 辊筒搬运接驳:F03
|
||||
* 厂内货架出库AGV待命:F04
|
||||
* 旋转货架: F05
|
||||
* 厂内电梯任务: F06
|
||||
* 以下为叉车专用任务类型
|
||||
* 高位货架到工作台: F11
|
||||
* 工作台到高位货架: F12
|
||||
* 巷道到工作台: F13
|
||||
* 工作台到巷道: F14
|
||||
* 高位货架到工作台(接驳) : F15
|
||||
* 工作台到高位货架 (接驳) : F16
|
||||
* 巷道到工作台(接驳) : F17
|
||||
* 工作台到巷道(接驳) : F18
|
||||
* 叉车电梯主任务: F20
|
||||
*/
|
||||
@NotNull
|
||||
private String taskTyp;
|
||||
/**
|
||||
* 容器类型(叉车/CTU专用) 叉车项目必传
|
||||
*/
|
||||
private String ctnrTyp;
|
||||
/**
|
||||
* 容器编号 (叉车/CTU专用)
|
||||
*/
|
||||
private String ctnrCode; //
|
||||
/**
|
||||
* 容器数量(叉车堆叠专用),默认值1,仅记录堆叠的数量不记录堆叠的每个容器号
|
||||
*/
|
||||
private String ctnrNum;
|
||||
/**
|
||||
* 任务模式
|
||||
* 0-普通move 1-出库move 2-入库move 3-移库move
|
||||
*/
|
||||
private String taskMode;
|
||||
/**
|
||||
* 工作位
|
||||
* 与RCS-2000端配置的位置名称一致, 工作位名称为字母\数字\或组合
|
||||
*/
|
||||
private String wbCode;
|
||||
/**
|
||||
* 位置路径
|
||||
* AGV关键路径位置集合,与任务类型中模板配置的位置路径一一对应。待现场地图部署、配置完成后可获取
|
||||
*/
|
||||
private List<PositionCodeData> positionCodePath;
|
||||
/**
|
||||
* 货架编号
|
||||
* 不指定货架可以为空
|
||||
*/
|
||||
private String podCode;
|
||||
/**
|
||||
* 货架方向
|
||||
* “180”,”0”,”90”,”-90” 分别对应地图的”左”,”右”,”上”,”下”
|
||||
* 不指定方向可以为空
|
||||
* 如果终点不是工作台或工作台未配置操作方向则货架拣货方向podDir作为终点方向
|
||||
* 如果工作台配有操作方向,则系统会根据货架拣货方向podDir和工作台操作方向计算货架终点方向
|
||||
*/
|
||||
private String podDir;
|
||||
/**
|
||||
* 货架类型, 传空时表示随机找个货架
|
||||
* 找空货架传参方式如下:
|
||||
* -1: 代表不关心货架类型, 找到空货架即可.
|
||||
* -2: 代表从工作位获取关联货架类型, 如果未配置, 只找空货架.
|
||||
* 货架类型编号: 只找该货架类型的空货架
|
||||
*/
|
||||
private String podTyp;
|
||||
/**
|
||||
* 物料批次
|
||||
* 物料批次或货架上的物料唯一编码,生成任务单时,货架与物料直接绑定时使用. (通过同时传podCode和materialLot来绑定或通过 wbCode 找到位置上的货架和materialLot来绑定)
|
||||
* 如果是区域/策略内查找货架,可以匹配对应物料批次的货架,支持以下值:
|
||||
* 0:区域/策略内查找空货架
|
||||
* 1:区域/策略内查找满货架
|
||||
* 其他值:查找指定物料批次对应的货架
|
||||
* 巷道任务通过该字段传入特征值
|
||||
*/
|
||||
private String materialLot;
|
||||
/**
|
||||
* 优先级
|
||||
* 从(1~127)级,最大优先级最高。为空时,采用任务模板的优先级
|
||||
*/
|
||||
private String priority;
|
||||
/**
|
||||
* AGV编号
|
||||
* 填写表示指定某一编号的AGV执行该任务
|
||||
*/
|
||||
private String agvCode;
|
||||
/**
|
||||
* 任务单号
|
||||
* 选填, 不填系统自动生成
|
||||
*/
|
||||
private String taskCode;
|
||||
/**
|
||||
* 组编号
|
||||
* CTU场景下用于按组出库,同组任务优先拼车。 如业务需要任务组间或组内按顺序出库,则需调用料箱顺序出库(CTU)接口。
|
||||
* 潜伏式场景下,通过组号来管理顺序出库的顺序,组号小的优先出库。
|
||||
*/
|
||||
private String groupId;
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String agvTyp;
|
||||
/**
|
||||
* 选择策略
|
||||
* 区域/策略中挑选货架以及根据物料批次挑选货架时的先进先出规则,支持以下4个值:
|
||||
* 1:按照货架到达储位的时间顺序,先进先出
|
||||
* 2:按照货架到达储位的时间顺序,先进后出
|
||||
* 9:按照货架绑定物料批次的时间顺序,先进先出
|
||||
* 10:按照货架绑定物料批次的时间顺序,先进后出
|
||||
*/
|
||||
private String positionSelStrategy;
|
||||
/**
|
||||
* 自定义数据
|
||||
*/
|
||||
private String data;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.ruoyi.apiService.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PositionCodeData {
|
||||
/**
|
||||
* 位置编号 - 单个编号不超过64位
|
||||
*/
|
||||
private String positionCode;
|
||||
/**
|
||||
* 类型
|
||||
*
|
||||
* 位置类型说明:
|
||||
* 00表示:位置编号
|
||||
* 01表示:物料批次号
|
||||
* 02表示:策略编号(含多个区域) 如:第一个区域放不下, 可以放第二个区域
|
||||
* 03表示:货架编号,通过货架编号找到货架所在位置
|
||||
* 04表示:区域编号,在区域中查找可用位置
|
||||
* 05表示:仓位编号(叉车/CTU专用)
|
||||
* 06表示:巷道编号
|
||||
* 07表示:容器编号
|
||||
* 08表示:巷道策略
|
||||
* 09表示:巷道区域
|
||||
* 10表示:巷道仓位
|
||||
* 11表示:输送线(机台)编号
|
||||
* 12表示:CTU工作台(梳齿工作站)编号
|
||||
* 13表示:搬运巷道指定货架出库
|
||||
*/
|
||||
private String type;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.ruoyi.apiService.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ReMaterialParam {
|
||||
|
||||
/** 请求码 */
|
||||
String reqCode;
|
||||
|
||||
/** 作业号 */
|
||||
String jobId;
|
||||
|
||||
/** 异常货位 */
|
||||
String cargoSpaceId;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.ruoyi.apiService.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RequestEnter {
|
||||
//物料码
|
||||
private String trayCode;
|
||||
|
||||
//入库位置
|
||||
private String entranceId;
|
||||
|
||||
private String warehouseId;
|
||||
|
||||
private String roadwayId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.ruoyi.apiService.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class RequestEnterResponse {
|
||||
|
||||
/** 请求码 */
|
||||
String reqCode;
|
||||
|
||||
/** 分配货位 */
|
||||
String cargoSpaceId;
|
||||
|
||||
/** 条码 */
|
||||
String trayCode;
|
||||
|
||||
/** 任务号 */
|
||||
String JobId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ruoyi.apiService.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ResponseBase {
|
||||
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 响应信息
|
||||
*/
|
||||
private String msg;
|
||||
|
||||
/**
|
||||
* 响应数据
|
||||
*/
|
||||
private Object data;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.ruoyi.apiService.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class WmsJobRequest {
|
||||
|
||||
//任务id
|
||||
private String jobId;
|
||||
|
||||
//wms任务号
|
||||
private String taskNo;
|
||||
|
||||
//wms任务类型 1-入库 2-出库 3-agv任务
|
||||
private String wmsType;
|
||||
|
||||
//托盘编码
|
||||
private String trayCode;
|
||||
|
||||
//拣选输送机
|
||||
// private String pickSsj;
|
||||
//料架编码
|
||||
// private String containerCode;
|
||||
//起点
|
||||
// private String positionCode1;
|
||||
//终点
|
||||
// private String positionCode2;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.ruoyi.apiService.domain.erp;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 版辊信息
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class RollerInfo {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.ruoyi.apiService.domain.receiveStockList;
|
||||
|
||||
import com.ruoyi.in.stockindetail.domain.InStockinDetail;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class StockinListReceive {
|
||||
|
||||
private List<InStockinDetail> stockinDetails;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.ruoyi.apiService.domain.receiveStockList;
|
||||
|
||||
import com.ruoyi.apiService.domain.ResponseBase;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StockinListResponse extends ResponseBase {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ruoyi.apiService.domain.receiveStockList;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StockoutListReceive {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.ruoyi.apiService.domain.receiveStockList;
|
||||
|
||||
import com.ruoyi.apiService.domain.ResponseBase;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StockoutListResponse extends ResponseBase {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.ruoyi.apiService.domain.wcs;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WcsStockinReceive {
|
||||
|
||||
/**
|
||||
* 请求码
|
||||
*/
|
||||
@Nullable
|
||||
String reqCode;
|
||||
|
||||
/**
|
||||
* 条码
|
||||
*/
|
||||
private String trayCode;
|
||||
|
||||
/**
|
||||
* 入口
|
||||
*/
|
||||
@Nullable
|
||||
private String entranceId;
|
||||
|
||||
/**
|
||||
* 仓库
|
||||
*/
|
||||
@Nullable
|
||||
private String warehouseId;
|
||||
|
||||
/**
|
||||
* 巷道号
|
||||
*/
|
||||
private String roadwayId;
|
||||
|
||||
/**
|
||||
* 托盘类型
|
||||
*/
|
||||
// String trayType;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
// String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.ruoyi.apiService.domain.wcs;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class WcsStockinResponse {
|
||||
|
||||
/**
|
||||
* 请求时传入的 reqCode,原样回传
|
||||
*/
|
||||
String reqCode;
|
||||
|
||||
/**
|
||||
* 分配货位
|
||||
*/
|
||||
String cargoSpaceId;
|
||||
|
||||
/** 任务类型 */
|
||||
int taskType;
|
||||
|
||||
/**
|
||||
* 条码
|
||||
*/
|
||||
String trayCode;
|
||||
|
||||
/**
|
||||
* 作业号
|
||||
*/
|
||||
String jobId;
|
||||
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
String taskNo;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.ruoyi.apiService.service;
|
||||
|
||||
|
||||
import com.ruoyi.apiService.domain.receiveStockList.StockinListReceive;
|
||||
import com.ruoyi.apiService.domain.receiveStockList.StockinListResponse;
|
||||
import com.ruoyi.apiService.domain.receiveStockList.StockoutListReceive;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 作业统计 Service 接口
|
||||
*/
|
||||
public interface IToErpService {
|
||||
|
||||
|
||||
// Map<String,String> saveTransferBill();
|
||||
//
|
||||
// Map<String,String> billCompletedCallBack();
|
||||
//
|
||||
// AjaxResult receiveProduct();
|
||||
//
|
||||
// AjaxResult receiveCustomer();
|
||||
//
|
||||
// AjaxResult receiveSupplier();
|
||||
//
|
||||
// String login();
|
||||
//
|
||||
// AjaxResult callErp(ReceiveOutStockConfirm receiveOutStockConfirm);
|
||||
//
|
||||
// AjaxResult receiveStockinList(StockinListReceive StockinListReceive);
|
||||
//
|
||||
// AjaxResult receiveStockoutList(StockoutListReceive stockoutListReceive);
|
||||
//
|
||||
// AjaxResult receiveInventoryList();
|
||||
//
|
||||
//
|
||||
// AjaxResult getErpStockinList();
|
||||
//
|
||||
// AjaxResult getInStock();
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.ruoyi.apiService.service;
|
||||
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 作业统计 Service 接口
|
||||
*/
|
||||
public interface IToWcsService {
|
||||
|
||||
/**
|
||||
* 呼叫空托盘出库
|
||||
* @param PalletType
|
||||
*/
|
||||
public AjaxResult callEmptyPalletOut(String PalletType);
|
||||
|
||||
|
||||
/**
|
||||
* 推送CTU出库任务
|
||||
*/
|
||||
void pushOutMydoJob();
|
||||
|
||||
|
||||
/**
|
||||
* 推送agv搬运作业
|
||||
* @return
|
||||
*/
|
||||
// AjaxResult pushAgvMoveJob(AgvMoveParam agvMoveParam);
|
||||
|
||||
|
||||
/**
|
||||
* 推送流利架入库任务
|
||||
*/
|
||||
void pushInMydoJob();
|
||||
|
||||
/**
|
||||
* 出库作业确认
|
||||
* @param outMydojobMakeSureParam
|
||||
* @return
|
||||
*/
|
||||
AjaxResult outMydojobMakeSure(HashMap<String, String> outMydojobMakeSureParam);
|
||||
|
||||
/**
|
||||
* 取消任务
|
||||
* @param taskNo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult cancelTaskByTaskNo(String taskNo);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.ruoyi.apiService.service;
|
||||
|
||||
|
||||
/**
|
||||
* 作业统计 Service 接口
|
||||
*/
|
||||
public interface IToWmsService {
|
||||
|
||||
// /**
|
||||
// * 根据托盘条码请求入库任务
|
||||
// */
|
||||
// AjaxResult requestMydoJobByTrayCode(WcsStockinReiceive wcsStockinReiceive);
|
||||
//
|
||||
// /** 请求补码作业 */
|
||||
// AjaxResult requestMydoJobManual(WcsStockinReiceive wcsStockinReiceive);
|
||||
//
|
||||
// /**
|
||||
// * 入库、出库 任务完成回传
|
||||
// * Map<String, String>
|
||||
// * "wmsType": "任务类型" 1-入库 2-出库
|
||||
// * taskNo:出库 入库任务号
|
||||
// * trayCode:托盘码
|
||||
// * positionCode1:起点
|
||||
// * positionCode2:终点
|
||||
// * containerCode:容器编码
|
||||
// *
|
||||
// */
|
||||
// AjaxResult jobFinish(WmsJobRequest wmsJobRequest);
|
||||
//
|
||||
// /**
|
||||
// * 放货有货,重新分配货位
|
||||
// */
|
||||
// AjaxResult reAssign(ReMaterialParam reMaterialParam);
|
||||
//
|
||||
// /**
|
||||
// * 取货无货,重新分配物料
|
||||
// */
|
||||
// AjaxResult reMaterial(ReMaterialParam reMaterialParam);
|
||||
//
|
||||
// /**
|
||||
// * 获取入库作业
|
||||
// */
|
||||
// AjaxResult requestEnterByTrayCodeAndEntranceId(RequestEnter requestEnter);
|
||||
}
|
||||
@@ -0,0 +1,641 @@
|
||||
package com.ruoyi.apiService.service.impl;
|
||||
|
||||
|
||||
import com.ruoyi.apiService.service.IToErpService;
|
||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||
|
||||
import com.ruoyi.bas.customer.service.IBasCustomerService;
|
||||
import com.ruoyi.bas.id.job.service.IBasJobIdService;
|
||||
import com.ruoyi.bas.product.service.IBasProductService;
|
||||
import com.ruoyi.bas.stock.service.IBasStockService;
|
||||
import com.ruoyi.bas.supplier.service.IBasSupplierService;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
|
||||
import com.ruoyi.in.stockindetail.service.IInStockinDetailService;
|
||||
import com.ruoyi.in.stockin.service.IInStockinService;
|
||||
|
||||
|
||||
import com.ruoyi.log.service.IRequestLogService;
|
||||
import com.ruoyi.out.stockout.service.IOutStockoutService;
|
||||
import com.ruoyi.out.stockoutdetail.service.IOutStockoutDetailService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 作业统计 Service 实现
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ToErpServiceImpl implements IToErpService {
|
||||
|
||||
@Autowired
|
||||
private IBasProductService basProductService;
|
||||
|
||||
@Autowired
|
||||
private IBasSupplierService basSupplierService;
|
||||
|
||||
@Autowired
|
||||
private IOutStockoutService outStockoutService;
|
||||
|
||||
@Autowired
|
||||
private IOutStockoutDetailService outStockoutDetailService;
|
||||
|
||||
|
||||
//wms入库主单
|
||||
@Autowired
|
||||
private IInStockinService inStockinService;
|
||||
|
||||
//wms入库子单
|
||||
@Autowired
|
||||
private IInStockinDetailService inStockinDetailService;
|
||||
|
||||
//货位
|
||||
@Autowired
|
||||
private IBasCargoSpaceService basCargoSpaceService;
|
||||
|
||||
//库存
|
||||
@Autowired
|
||||
private IBasStockService basStockService;
|
||||
|
||||
//日志
|
||||
@Autowired
|
||||
private IRequestLogService requestLogService;
|
||||
|
||||
@Autowired
|
||||
private IBasJobIdService basJobIdService;
|
||||
|
||||
@Autowired
|
||||
private IBasCustomerService basCustomerService;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
|
||||
private static final String erpUrl = "http://115.190.99.109:5055";
|
||||
|
||||
private static final String loginUrl = erpUrl+"/webapi/v3/ov1/login";
|
||||
private static final String supplierListUrl = erpUrl+"/webapi/v3/store/supplierList";
|
||||
private static final String customerListUrl = erpUrl+"/sysa/mobilephone/salesmanage/custom/list.asp";
|
||||
private static final String productListUrl = erpUrl+"/sysa/mobilephone/salesmanage/product/billlist.asp";
|
||||
|
||||
private static final String TOKEN_KEY = "ZBAPI-Token";
|
||||
private static final String outStockListUrl = erpUrl+"/webapi/v3/store/KuOutApplyList";
|
||||
private static final String outStockConfirmUrl = erpUrl+"/webapi/v3/store/KuOutApplyEdit/edit";
|
||||
|
||||
private static final String getStockinListUrl = erpUrl+"/webapi/v3/store/KuInApplyList";
|
||||
private static final String stockinConfirmUrl = erpUrl+"/webapi/v3/store/KuInApplyEdit/edit";
|
||||
|
||||
|
||||
|
||||
// @Override
|
||||
// public Map<String, String> saveTransferBill() {
|
||||
// HashMap<String, String> map = new HashMap<>();
|
||||
// map.put("code","200");
|
||||
// return map;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Map<String, String> billCompletedCallBack() {
|
||||
// HashMap<String, String> map = new HashMap<>();
|
||||
// map.put("code","200");
|
||||
// return map;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public AjaxResult receiveProduct() {
|
||||
// AspRequestParam erpCustomerParam = new AspRequestParam();
|
||||
// erpCustomerParam.setSession(login());
|
||||
// erpCustomerParam.setCmdkey("refresh");
|
||||
// List<AspRequestParam.DataInfo> dataInfoList = new ArrayList<>();
|
||||
// dataInfoList.add(new AspRequestParam.DataInfo("pagesize", 100000));
|
||||
// dataInfoList.add(new AspRequestParam.DataInfo("pageindex", 1));
|
||||
// dataInfoList.add(new AspRequestParam.DataInfo("idProductClass", "532"));
|
||||
// erpCustomerParam.setDatas(dataInfoList);
|
||||
// String body = HttpRequest.post(productListUrl).header(TOKEN_KEY, login()).body(JSONUtil.toJsonStr(erpCustomerParam)).execute().body();
|
||||
// AspResponse responseBean = JSONUtil.toBean(body, AspResponse.class);
|
||||
// for (List<String> row : responseBean.getBody().getSource().getTable().getRows()) {
|
||||
// BasProduct product = new BasProduct();
|
||||
// product.setProductGuid(row.get(2));
|
||||
// product.setProductId(row.get(2));
|
||||
// product.setProductName(row.get(1));
|
||||
// product.setCargoNo(row.get(0));
|
||||
// product.setSpec(row.get(3));
|
||||
// product.setUnit(row.get(4));
|
||||
// product.setSpare1(row.get(5));
|
||||
// product.setPrice(row.get(6));
|
||||
// product.setParentId(row.get(7));
|
||||
// product.setSpare3(row.get(8));
|
||||
// product.setSpare4(row.get(9));
|
||||
// product.setSpare5(row.get(10));
|
||||
// product.setSpare6(row.get(11));
|
||||
// product.setSpare7(row.get(12));
|
||||
// BasProduct basProduct = basProductService.selectBasProductByProductId(product.getProductId());
|
||||
// if (ObjUtil.isNotNull(basProduct)){
|
||||
// BeanUtil.copyProperties(product,basProduct);
|
||||
// basProductService.updateBasProduct(basProduct);
|
||||
// }else {
|
||||
// basProductService.insertBasProduct(product);
|
||||
// }
|
||||
// }
|
||||
// return AjaxResult.success();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public AjaxResult receiveCustomer() {
|
||||
// AspRequestParam erpCustomerParam = new AspRequestParam();
|
||||
// erpCustomerParam.setSession(login());
|
||||
// erpCustomerParam.setCmdkey("refresh");
|
||||
// List<AspRequestParam.DataInfo> dataInfoList = new ArrayList<>();
|
||||
// dataInfoList.add(new AspRequestParam.DataInfo("pagesize", 100000));
|
||||
// dataInfoList.add(new AspRequestParam.DataInfo("pageindex", 1));
|
||||
// erpCustomerParam.setDatas(dataInfoList);
|
||||
//
|
||||
// String body = HttpRequest.post(customerListUrl).header(TOKEN_KEY, login()).body(JSONUtil.toJsonStr(erpCustomerParam)).execute().body();
|
||||
// AspResponse responseBean = JSONUtil.toBean(body, AspResponse.class);
|
||||
// for (List<String> row : responseBean.getBody().getSource().getTable().getRows()) {
|
||||
// BasCustomer customer = new BasCustomer();
|
||||
// customer.setCustomerName(Convert.toStr(row.get(0)));
|
||||
// customer.setSalesman(Convert.toStr(row.get(1)));
|
||||
// customer.setBusinessDepartment(Convert.toStr(row.get(2)));
|
||||
// customer.setSupCustomer(Convert.toStr(row.get(3)));
|
||||
// customer.setContactName(Convert.toStr(row.get(4)));
|
||||
// customer.setMnemonicCode(Convert.toStr(row.get(5)));
|
||||
// customer.setType(Convert.toStr(row.get(6)));
|
||||
// customer.setTaxpayerRegistrationNumber(Convert.toStr(row.get(7)));
|
||||
// customer.setOrganization(Convert.toStr(row.get(8)));
|
||||
// customer.setRetailInvestor(Convert.toStr(row.get(9)));
|
||||
// customer.setId(Convert.toStr(row.get(10)));
|
||||
// customer.setCustomerNo(Convert.toStr(row.get(10)));
|
||||
// customer.setShipment(Convert.toStr(row.get(11)));
|
||||
// customer.setTaxCategory(Convert.toStr(row.get(12)));
|
||||
// BasCustomer basCustomer = basCustomerService.selectBasCustomerById(customer.getId());
|
||||
// if (ObjUtil.isNotNull(basCustomer)){
|
||||
// basCustomerService.updateBasCustomer(customer);
|
||||
// }else {
|
||||
// basCustomerService.insertBasCustomer(customer);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return AjaxResult.success();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public AjaxResult receiveSupplier() {
|
||||
// ErpSupplierParam erpSupplierParam = new ErpSupplierParam();
|
||||
// erpSupplierParam.setPage_index(1);
|
||||
// erpSupplierParam.setPage_size(100000);
|
||||
// String body = HttpRequest.post(supplierListUrl).header(TOKEN_KEY, login()).body(JSONUtil.toJsonStr(erpSupplierParam)).execute().body();
|
||||
// ErpSupplierResponse responseBean = JSONUtil.toBean(body, ErpSupplierResponse.class);
|
||||
// for (List<Object> row : responseBean.getRows()) {
|
||||
// BasSupplier supplier = new BasSupplier();
|
||||
// supplier.setSupplierName(Convert.toStr(row.get(0)));
|
||||
// supplier.setTaxpayerRegistrationNumber(Convert.toStr(row.get(1)));
|
||||
// supplier.setId(Convert.toStr(row.get(2)));
|
||||
// supplier.setSupplierNo(Convert.toStr(row.get(2)));
|
||||
// supplier.setSupplierArae(Convert.toStr(row.get(3)));
|
||||
// supplier.setContactName(Convert.toStr(row.get(4)));
|
||||
// supplier.setContactNumber(Convert.toStr(row.get(5)));
|
||||
// supplier.setCountry(Convert.toStr(row.get(6)));
|
||||
// supplier.setTimeZone(Convert.toStr(row.get(7)));
|
||||
// supplier.setUseable("1");
|
||||
// BasSupplier basSupplier = basSupplierService.selectBasSupplierById(supplier.getId());
|
||||
// if (ObjUtil.isNotNull(basSupplier)){
|
||||
// basSupplierService.updateBasSupplier(basSupplier);
|
||||
// }else {
|
||||
// basSupplierService.insertBasSupplier( supplier);
|
||||
// }
|
||||
// }
|
||||
// return AjaxResult.success();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public AjaxResult receiveStockinList(StockinListReceive stockinListReceive){
|
||||
//
|
||||
// //------------生成接口记录------------
|
||||
// RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(stockinListReceive), REICEIVE_ERP_STOCKIN_LIST);
|
||||
// requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success()));
|
||||
// requestLog.setResponseStatus("0");
|
||||
// requestLog.setIsSuccessful("1");
|
||||
// requestLogService.insertRequestLog(requestLog);
|
||||
//
|
||||
//
|
||||
// //todo ------------参数校验------------
|
||||
// //检查重复单号
|
||||
// int count = inStockinService.selectInStockinList(
|
||||
// new InStockin().builder().erpBill("这是一个ERP单号").build()
|
||||
// ).size();
|
||||
// if (count > 0){
|
||||
// log.warn("【ERP推送错误】已存在该编号的入库单据,ERP单号:{}", "这是一个ERP单号");
|
||||
// return AjaxResult.error("已存在该编号的入库单据,ERP单号:" + 123);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// //todo ------------生成入库主单------------
|
||||
// InStockin inStockin = new InStockin();
|
||||
// inStockin.setStockinId(basJobIdService.getId(JOB_RECEIVE_LIST_STOCKIN));
|
||||
// inStockin.setStockSource("ERP");
|
||||
// inStockin.setStatus(InStockInStatusEnum.RUNNING.getDesc());
|
||||
// inStockin.setErpBill("这是一个ERP单号");
|
||||
// inStockin.setCreateDate(new Date());
|
||||
// inStockin.setWarehouseId("01");
|
||||
// inStockin.setWarehouseName("立体库");
|
||||
// inStockin.setUserId(100L);
|
||||
// inStockin.setUserName("这是一个用户Id");
|
||||
// inStockin.setDeptId(100L);
|
||||
// inStockin.setDeptName("这是一个部门Id");
|
||||
// inStockinService.insertInStockin(inStockin);
|
||||
//
|
||||
// log.info("【ERP推送】下发入库单据,wms单号:{},ERP单号:{}",inStockin.getStockinId(), "这是一个ERP单号");
|
||||
//
|
||||
//
|
||||
// //todo ------------生成入库子单------------
|
||||
// List<InStockinDetail> details = stockinListReceive.getStockinDetails();
|
||||
// for (int i = 1; i <= details.size(); i++) {
|
||||
// InStockinDetail inStockinDetail = new InStockinDetail().builder()
|
||||
// .stockinId(inStockin.getStockinId())
|
||||
// .stockinDetailId(inStockin.getStockinId() + "-" + i)
|
||||
// .build();
|
||||
// inStockinDetailService.insertInStockinDetail(inStockinDetail);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// return AjaxResult.success();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public AjaxResult receiveStockoutList(StockoutListReceive stockoutListReceive) {
|
||||
//
|
||||
// return AjaxResult.success();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public AjaxResult receiveInventoryList() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public String login() {
|
||||
// LoginParam loginParam = new LoginParam();
|
||||
// List<LoginParam.ErpUserDataInfo> datas = new ArrayList<>();
|
||||
// LoginParam.ErpUserDataInfo d1 = new LoginParam.ErpUserDataInfo("user", "txt:孙瑞雅");
|
||||
// LoginParam.ErpUserDataInfo d2 = new LoginParam.ErpUserDataInfo("password", "txt:888888");
|
||||
// LoginParam.ErpUserDataInfo d3 = new LoginParam.ErpUserDataInfo("serialnum", "txt:abcd1234");
|
||||
// LoginParam.ErpUserDataInfo d4 = new LoginParam.ErpUserDataInfo("rndcode", "");
|
||||
// datas.add(d1);
|
||||
// datas.add(d2);
|
||||
// datas.add(d3);
|
||||
// datas.add(d4);
|
||||
// loginParam.setDatas(datas);
|
||||
// String post = HttpUtil.post(loginUrl, JSONUtil.toJsonStr(loginParam));
|
||||
// LoginResponse bean = JSONUtil.toBean(post, LoginResponse.class);
|
||||
// if (!redisCache.hasKey("erpSession")){
|
||||
// redisCache.setCacheObject("erpSession", bean.getHeader().getSession(), 1500, TimeUnit.SECONDS);
|
||||
// return bean.getHeader().getSession();
|
||||
// }else {
|
||||
// return redisCache.getCacheObject("erpSession");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public AjaxResult callErp(ReceiveOutStockConfirm receiveOutStockConfirm) {
|
||||
// String body= HttpRequest.post(outStockConfirmUrl).header("ZBAPI-Token", login()).body(JSONUtil.toJsonStr(receiveOutStockConfirm)).execute().body();
|
||||
// CallErpResponse callErpResponse = JSONUtil.toBean(body, CallErpResponse.class);
|
||||
// if (callErpResponse.getCode()==200){
|
||||
// return AjaxResult.success();
|
||||
// }else {
|
||||
// if (callErpResponse.getCode()==300){
|
||||
// return AjaxResult.error("请求失败");
|
||||
// }else if (callErpResponse.getCode()==400){
|
||||
// return AjaxResult.error("token验证失败");
|
||||
// }else if (callErpResponse.getCode()==500){
|
||||
// return AjaxResult.error("服务器内部错误");
|
||||
// }
|
||||
// return AjaxResult.error(callErpResponse.getMsg());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// //入库单据执行计数(用于区分是否首次执行获取单据请求)
|
||||
// int num = 0;
|
||||
//
|
||||
// /**
|
||||
// * 入库单据 -> 请求入库单列表
|
||||
// * @return
|
||||
// */
|
||||
//// @Scheduled(fixedDelay = 600_000)
|
||||
// public AjaxResult getErpStockinList(){
|
||||
//
|
||||
// ErpStockinParam erpStockinParam = new ErpStockinParam();
|
||||
//
|
||||
// // 首次执行(num=0)时,同步所有单据数据
|
||||
// // 后续执行(num>0)仅同步指定时间内的单据数据
|
||||
// if (num > 0){
|
||||
// //当前时间
|
||||
// DateTime dateNow = DateUtil.date();
|
||||
// String dateStart = dateNow.offset(DateField.SECOND, -60).toString();//开始时间
|
||||
// String dateEnd = DateUtil.date().toString();//当前时间
|
||||
// //todo 请求筛选时间似乎时分秒条件无效,只能筛选年月日条件
|
||||
// //todo 请求筛选时间似乎时分秒条件无效,只能筛选年月日条件
|
||||
//// erpStockinParam.setDate3Start(dateStart);//请求筛选:开始时间
|
||||
//// erpStockinParam.setDate3End(dateEnd);//请求筛选:结束时间
|
||||
// }
|
||||
//
|
||||
// //测试参数 - 无主题筛选 - 默认关键字【冷】
|
||||
// erpStockinParam.setTitle("");
|
||||
// //测试参数 - 入库状态(0=全部, 1=待入库, 2=已入库, 3=已取消...) 默认 - 1
|
||||
// //erpStockinParam.setComplete1(1);
|
||||
// //测试参数 - 无请求明细【0】
|
||||
// //erpStockinParam.setNeedList(0);
|
||||
//
|
||||
////=================================================================== 主单 =====================================================================
|
||||
//
|
||||
// try {
|
||||
// log.info(">>>>>>>>>>>>>>>>>>>> 开始更新入库单据 >>>>>>>>>>>>>>>>>>>>");
|
||||
// //------获取请求响应
|
||||
// String response = getResponse(getStockinListUrl, erpStockinParam, "更新入库单据");
|
||||
// if (response == null) {
|
||||
// log.info("请求异常:响应信息为空!检查请求内容!");
|
||||
// return null;
|
||||
// }
|
||||
// //------处理响应信息
|
||||
// ErpStockinResponse res = JSONUtil.toBean(response, ErpStockinResponse.class);
|
||||
// for (List<Object> list : res.getRows()) {
|
||||
// //【入库id】校验单据是否存在
|
||||
// String kuin = Convert.toStr(list.get(1));
|
||||
// ErpInStockin erpInStockin = new ErpInStockin();
|
||||
// //获取入库主单参数
|
||||
// erpInStockin.setTitle(Convert.toStr(list.get(0)));//主题
|
||||
// erpInStockin.setKuin(kuin);//入库id
|
||||
// erpInStockin.setComplete1(Convert.toStr(list.get(2)));//入库状态
|
||||
// erpInStockin.setCateid(Convert.toStr(list.get(3)));//申请人
|
||||
// erpInStockin.setDate3(Convert.toStr(list.get(4)));//申请日期
|
||||
// erpInStockin.setDate5(Convert.toStr(list.get(5)));//确认日期
|
||||
// erpInStockin.setCatein(Convert.toStr(list.get(6)));//审批人
|
||||
// erpInStockin.setIntro2(Convert.toStr(list.get(7)));//审批意见
|
||||
// erpInStockin.setIntro(Convert.toStr(list.get(8)));//备注
|
||||
// erpInStockin.setCaigou(Convert.toStr(list.get(9)));//其他采购单据
|
||||
// erpInStockin.setDate7(Convert.toStr(list.get(10)));//erp添加时间
|
||||
// erpInStockin.setKg(Convert.toStr(list.get(11)));//库管
|
||||
// erpInStockin.setSort1(Convert.toStr(list.get(12)));//入库类别
|
||||
// erpInStockin.setRkbh(Convert.toStr(list.get(13)));//入库编号
|
||||
// erpInStockin.setStatus(Convert.toStr(list.get(14)));//审批状态
|
||||
// erpInStockin.setKuinList(Convert.toStr(list.get(15)));//主单明细
|
||||
// erpInStockin.setSysIcusIInheritIdIidI413(Convert.toStr(list.get(16)));//客户名称
|
||||
// erpInStockin.setSysIcusIInheritIdIidI414(Convert.toStr(list.get(17)));//
|
||||
// erpInStockin.setSysIcusIInheritIdIidI415(Convert.toStr(list.get(18)));//车号
|
||||
// String id = erpInStockin.getRkbh() + "_" + erpInStockin.getKuin();
|
||||
// erpInStockin.setStockinGuid(id);//guid
|
||||
// //------校验单据是否已经在表中 - 新增/更新
|
||||
// if (ObjUtil.isNotNull(erpInStockinService.selectErpInStockinByKuin(kuin))) {
|
||||
// erpInStockinService.updateErpInStockin(erpInStockin);
|
||||
// }else{
|
||||
// erpInStockinService.insertErpInStockin(erpInStockin);
|
||||
// }
|
||||
// //------更新wms主单
|
||||
// AddStockinByErpStockin(erpInStockin);
|
||||
////=================================================================== 明细 =====================================================================
|
||||
// //------根据主单【kuinlist】字段获取子单信息
|
||||
// if (erpStockinParam.getNeedList() == 1) {
|
||||
// //------获取子单明细
|
||||
// JSONObject jsonObject = JSONUtil.parseObj(erpInStockin.getKuinList());
|
||||
// jsonObject.get("rows");
|
||||
// ErpStockinDetailResponse resDetail = JSONUtil.toBean(erpInStockin.getKuinList(), ErpStockinDetailResponse.class);
|
||||
//
|
||||
// //------生成子单信息
|
||||
// for (List<Object> details : resDetail.getRows()){
|
||||
// //获取入库子单数据
|
||||
// ErpInStockinDetail erpInStockinDetail = new ErpInStockinDetail();
|
||||
// erpInStockinDetail.setId(Convert.toLong(details.get(0)));//明细id
|
||||
// erpInStockinDetail.setQuantity(Convert.toLong(details.get(9)));//入库数量
|
||||
// erpInStockinDetail.setAssistUnit(Convert.toLong(details.get(5)));//辅助单位
|
||||
// erpInStockinDetail.setAssistQuantity(Convert.toLong(details.get(9)));//辅助数量
|
||||
// erpInStockinDetail.setKu(0L);//库区
|
||||
// erpInStockinDetail.setPh(Convert.toStr(details.get(17)));//批号
|
||||
// erpInStockinDetail.setXlh(Convert.toStr(details.get(18)));//序列号
|
||||
// erpInStockinDetail.setDatesc(Convert.toStr(details.get(19)));//生产日期
|
||||
// erpInStockinDetail.setDateyx(Convert.toStr(details.get(20)));//有效日期
|
||||
// erpInStockinDetail.setDate2(Convert.toStr(details.get(21)));//到货日期
|
||||
// erpInStockinDetail.setSysIcusIInheritIdIidI1(Convert.toStr(details.get(29)));//装卸工
|
||||
// erpInStockinDetail.setSpare1(Convert.toStr(details.get(1)));//产品名称 - product_name
|
||||
// erpInStockinDetail.setSpare2(Convert.toStr(details.get(2)));//产品型号 - product_id
|
||||
//
|
||||
// //自动分配货位区域
|
||||
//// String cargoSpace = getCargoSpaceByProductInfo(Convert.toStr(details.get(2)));
|
||||
//// erpInStockinDetail.setWarehousePositionID(cargoSpace);//货位
|
||||
//
|
||||
// //关联主单
|
||||
// erpInStockinDetail.setKuin(erpInStockin.getKuin());//入库id
|
||||
// erpInStockinDetail.setRkbh(erpInStockin.getRkbh());//入库编号
|
||||
// erpInStockinDetail.setSpare3(erpInStockin.getStockinGuid());//入库单guid
|
||||
//
|
||||
// //------校验数据是否已经在表中 - 新增/更新
|
||||
// if (ObjUtil.isNotNull(erpInStockinDetailService.selectErpInStockinDetailById(erpInStockinDetail.getId()))) {
|
||||
// erpInStockinDetailService.updateErpInStockinDetail(erpInStockinDetail);
|
||||
// }else{
|
||||
// erpInStockinDetailService.insertErpInStockinDetail(erpInStockinDetail);
|
||||
// }
|
||||
//
|
||||
// //------更新wms子单
|
||||
// AddStockinDetailByErpStockinDetail(erpInStockinDetail);
|
||||
// }
|
||||
// }else {
|
||||
// log.info("请求未获取子单详情【needList:0】");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }catch(Exception e){
|
||||
// log.error("获取/同步单据异常:" + e.getMessage());
|
||||
// return AjaxResult.error();
|
||||
// }
|
||||
//
|
||||
// log.info("<<<<<<<<<<<<<<<<<<<< 更新入库单据完成 <<<<<<<<<<<<<<<<<<<<");
|
||||
// num++;
|
||||
// return AjaxResult.success();
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 生成入库单据 -> 获取请求响应
|
||||
// * @param url 请求地址
|
||||
// * @param param 请求参数
|
||||
// * @param remark
|
||||
// * @return 响应信息
|
||||
// */
|
||||
// public String getResponse(String url, Object param, String remark){
|
||||
// try {
|
||||
// //------获取请求响应
|
||||
// String requestSession = login();
|
||||
// String response = HttpRequest.post(url)
|
||||
// .header(TOKEN_KEY,requestSession)
|
||||
// .body(JSONUtil.toJsonStr(param))
|
||||
// .execute()
|
||||
// .body();
|
||||
//
|
||||
// //生成请求记录
|
||||
// RequestLog requestLog = new RequestLog();
|
||||
// requestLog.setRequestTime(DateUtil.now());
|
||||
// requestLog.setSourceSystem("wms");
|
||||
// requestLog.setTargetSystem("erp");
|
||||
// requestLog.setEndpoint(remark);
|
||||
// requestLog.setRequestUrl(url);
|
||||
// requestLog.setRequestMethod("POST");
|
||||
// requestLog.setRequestBody(JSONUtil.toJsonStr(param));
|
||||
// requestLog.setResponseBody(JSONUtil.toJsonStr(response));
|
||||
// requestLog.setIsSuccessful("1");
|
||||
// requestLogService.insertRequestLog(requestLog);
|
||||
//
|
||||
// return response;
|
||||
// } catch (Exception e) {
|
||||
// log.error("请求异常:" + e.getMessage());
|
||||
// }
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// @Autowired
|
||||
// private ObjectMapper objectMapper;
|
||||
//
|
||||
// //获取入库单据
|
||||
//
|
||||
// public AjaxResult getInStock(){
|
||||
// //创建请求体
|
||||
// InStockinNQueryRequest inStockinNQueryRequest = new InStockinNQueryRequest();
|
||||
// inStockinNQueryRequest.setComplete1(0);//查找未执行的单据
|
||||
// inStockinNQueryRequest.setSort1(0);
|
||||
// // 设置日期范围为当天
|
||||
// String today = DateUtil.today();
|
||||
//// inStockinNQueryRequest.setDate3Start(today + " 00:00:00");
|
||||
//// inStockinNQueryRequest.setDate3End(today + " 23:59:59");
|
||||
// inStockinNQueryRequest.setDate3Start("2025-11-03" + " 00:00:00");
|
||||
// inStockinNQueryRequest.setDate3End("2025-11-03" + " 23:59:59");
|
||||
// inStockinNQueryRequest.setDate5Start("2025-11-03" + " 00:00:00");
|
||||
// inStockinNQueryRequest.setDate5End("2025-11-03" + " 23:59:59");
|
||||
// inStockinNQueryRequest.setTitle("打冷");
|
||||
// inStockinNQueryRequest.setNeedList(1);
|
||||
// inStockinNQueryRequest.setPageIndex(1);
|
||||
// inStockinNQueryRequest.setPageSize(0);
|
||||
// String jsonStr = "";
|
||||
// try {
|
||||
// jsonStr = objectMapper.writeValueAsString(inStockinNQueryRequest);
|
||||
// } catch (Exception e) {
|
||||
// log.error("JSON序列化失败", e);
|
||||
// return AjaxResult.error("JSON序列化失败");
|
||||
// }
|
||||
// // 获取ERP数据
|
||||
// String body = HttpRequest.post(getStockinListUrl).header(TOKEN_KEY, login()).body(jsonStr).execute().body();
|
||||
// // 解析响应
|
||||
// ErpInStockinNResponse response = JSONUtil.toBean(body, ErpInStockinNResponse.class);
|
||||
// if (response != null && response.getRows() != null) {
|
||||
// List<List<Object>> rows = response.getRows();
|
||||
// for (List<Object> row : rows) {
|
||||
// // 0: 入库主题, 1: 入库id, 2: 入库状态, 3: 申请人, 4: 申请日期, 5: 确认日期, 6: 审批人, 7: 审批意见,
|
||||
// // 8: 入库备注, 9: 关联其他单据id, 10: 添加时间, 11: 库管id, 12: 入库类别, 13: 入库编号,
|
||||
// // 14: 审批状态, 15: 产品明细, 16: 客户名称, 17: 磅单编号, 18: 入库车号
|
||||
// String erpStockInId = Convert.toStr(row.get(13)); // 入库id
|
||||
// // 检查本地是否存在
|
||||
// InStockinN existing = inStockinNService.selectInStockinNByStockinIdAndDate(erpStockInId, "2025-11-03");
|
||||
// if (existing == null) {
|
||||
// // 不存在则插入
|
||||
// String stockinId = "RK" + DateUtil.format(DateUtil.date(), "yyyyMMddHHmmssSSS");
|
||||
// InStockinN newStockin = new InStockinN();
|
||||
// newStockin.setStockinGuid(UUID.randomUUID().toString());
|
||||
// newStockin.setStockinId(stockinId);
|
||||
// newStockin.setStatus(1);//未执行
|
||||
// newStockin.setSubject(Convert.toStr(row.get(0)));
|
||||
// newStockin.setErpStockinId(erpStockInId);
|
||||
// newStockin.setErpStatus(row.get(2).toString()); // 假设状态映射需要转换
|
||||
// newStockin.setApplicant(Convert.toStr(row.get(3)));
|
||||
// newStockin.setApplyDate(Convert.toStr(row.get(4)));
|
||||
// newStockin.setConfirmDate(Convert.toStr(row.get(5)));
|
||||
// newStockin.setApprover(Convert.toStr(row.get(6)));
|
||||
// newStockin.setApprovalComment(Convert.toStr(row.get(7)));
|
||||
// newStockin.setRemark(Convert.toStr(row.get(8)));
|
||||
// newStockin.setRelatedDocId(Convert.toStr(row.get(9)));
|
||||
// newStockin.setCreatedAt(Convert.toStr(row.get(10)));
|
||||
// newStockin.setKeeperId(Convert.toLong(row.get(11)));
|
||||
// newStockin.setCategory(Convert.toStr(row.get(12)));
|
||||
// newStockin.setEntryCode(Convert.toStr(row.get(1)));
|
||||
// newStockin.setApprovalStatus(Convert.toLong(row.get(14)));
|
||||
// newStockin.setProductDetails(Convert.toStr(row.get(15)));
|
||||
// newStockin.setCustomerName(Convert.toStr(row.get(16)));
|
||||
// newStockin.setWeighbillNo(Convert.toStr(row.get(17)));
|
||||
// newStockin.setVehicleNo(Convert.toStr(row.get(18)));
|
||||
// newStockin.setOrderSrc("ERP");
|
||||
// try {
|
||||
// BigDecimal orderSum = new BigDecimal("0");
|
||||
// cn.hutool.json.JSONObject detailsObjForSum = JSONUtil.parseObj(newStockin.getProductDetails());
|
||||
// cn.hutool.json.JSONArray detailRowsForSum = detailsObjForSum.getJSONArray("Rows");
|
||||
// if (detailRowsForSum != null) {
|
||||
// for (int si = 0; si < detailRowsForSum.size(); si++) {
|
||||
// cn.hutool.json.JSONArray sd = detailRowsForSum.getJSONArray(si);
|
||||
// orderSum = orderSum.add(Convert.toBigDecimal(sd.get(9)));
|
||||
// }
|
||||
// }
|
||||
// newStockin.setOrderNum(orderSum);
|
||||
// } catch (Exception ignore) {
|
||||
// }
|
||||
//
|
||||
// inStockinNService.insertInStockinN(newStockin);
|
||||
// // 解析并落库产品明细(Rows)
|
||||
// try {
|
||||
// JSONObject detailsObj = JSONUtil.parseObj(newStockin.getProductDetails());
|
||||
// JSONArray detailRows = detailsObj.getJSONArray("Rows");
|
||||
// if (detailRows != null) {
|
||||
// for (int i = 0; i < detailRows.size(); i++) {
|
||||
// JSONArray d = detailRows.getJSONArray(i);
|
||||
// String stockinDetailId = newStockin.getStockinId() + "-" + (i + 1);
|
||||
// InStockinDetailN detail = new InStockinDetailN();
|
||||
// detail.setStockinDetailId(stockinDetailId);
|
||||
// detail.setErpDetailId(Convert.toInt(d.get(0)));
|
||||
// detail.setStockinGuid(newStockin.getStockinGuid());
|
||||
// detail.setStockinId(newStockin.getStockinId());
|
||||
// detail.setProductName(Convert.toStr(d.get(1)));
|
||||
// detail.setProductModel(Convert.toStr(d.get(2)));
|
||||
// detail.setUnit(Convert.toStr(d.get(3)));
|
||||
// detail.setUnitPrice(Convert.toBigDecimal(d.get(5)));
|
||||
// detail.setAuxUnit(Convert.toStr(d.get(6)));
|
||||
// detail.setAttr1(Convert.toStr(d.get(7)));
|
||||
// detail.setAttr2(Convert.toStr(d.get(8)));
|
||||
// detail.setQuantity(Convert.toBigDecimal(d.get(9)));
|
||||
// detail.setInQuantity(Convert.toBigDecimal(d.get(10)));
|
||||
// detail.setAuxQuantity(Convert.toBigDecimal(d.get(11)));
|
||||
// detail.setTotalPrice(Convert.toBigDecimal(d.get(12)));
|
||||
// detail.setCostUnitPrice(Convert.toBigDecimal(d.get(13)));
|
||||
// detail.setCostTotalPrice(Convert.toBigDecimal(d.get(14)));
|
||||
// detail.setAccountingCostTotal(Convert.toBigDecimal(d.get(15)));
|
||||
// detail.setAccountingQuantity(Convert.toBigDecimal(d.get(16)));
|
||||
// detail.setAccountingStatus(Long.valueOf(Convert.toInt(d.get(17))));
|
||||
// detail.setBatchNo(Convert.toStr(d.get(18)));
|
||||
// detail.setSerialNo(Convert.toStr(d.get(19)));
|
||||
// detail.setProductionDate(Convert.toStr(d.get(20)));
|
||||
// detail.setExpiryDate(Convert.toStr(d.get(21)));
|
||||
// detail.setArrivalDate(Convert.toStr(d.get(22)));
|
||||
// detail.setRemark(Convert.toStr(d.get(23)));
|
||||
// detail.setCustom1(Convert.toStr(d.get(24)));
|
||||
// detail.setCustom2(Convert.toStr(d.get(25)));
|
||||
// detail.setCustom3(Convert.toStr(d.get(26)));
|
||||
// detail.setCustom4(Convert.toStr(d.get(27)));
|
||||
// detail.setCustom5(Convert.toStr(d.get(28)));
|
||||
// detail.setCustom6(Convert.toStr(d.get(29)));
|
||||
// detail.setStevedore(Convert.toStr(d.get(30)));
|
||||
// detail.setOrderSrc("ERP");
|
||||
// inStockinDetailNService.insertInStockinDetailN(detail);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// log.error("解析并落库产品明细失败: {}", e.getMessage());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return AjaxResult.success(body);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
package com.ruoyi.apiService.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.apiService.service.IToWcsService;
|
||||
|
||||
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||
import com.ruoyi.bas.id.job.service.IBasJobIdService;
|
||||
import com.ruoyi.bas.id.taskno.service.IBasTaskNoService;
|
||||
import com.ruoyi.bas.stock.domain.BasStock;
|
||||
import com.ruoyi.bas.stock.service.IBasStockService;
|
||||
import com.ruoyi.common.*;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
import com.ruoyi.in.job.domain.MydoJob;
|
||||
import com.ruoyi.in.job.service.IMydoJobService;
|
||||
import com.ruoyi.log.domain.RequestLog;
|
||||
import com.ruoyi.log.service.IRequestLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.ruoyi.common.RequestTitle.SEND_WCS_STOCKOUT_EMPTY_TRAY_MYDOJOB;
|
||||
import static com.ruoyi.common.TaskType.TASKTYPE_STOCKOUT_EMPTY_TRAY;
|
||||
import static com.ruoyi.common.WcsUrl.CANCEL_MYDOJOB;
|
||||
import static com.ruoyi.common.WcsUrl.OUT_MYDOJOB_MS;
|
||||
|
||||
/**
|
||||
* 作业统计 Service 实现
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ToWcsServiceImpl implements IToWcsService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IRequestLogService requestLogService;
|
||||
@Autowired
|
||||
private IMydoJobService mydoJobService;
|
||||
// @Autowired
|
||||
// private IAgvContainerTaskService agvContainerTaskService;
|
||||
@Autowired
|
||||
private IBasStockService basStockService;
|
||||
@Autowired
|
||||
private IBasJobIdService basJobIdService;
|
||||
@Autowired
|
||||
private IBasTaskNoService basTaskNoService;
|
||||
@Autowired
|
||||
IBasCargoSpaceService basCargoSpaceService;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 人工呼叫空托盘出库
|
||||
*/
|
||||
public AjaxResult callEmptyPalletOut(int type){
|
||||
|
||||
log.info("【呼叫空托】人工呼叫空托盘出库,托盘类型:{}", type);
|
||||
|
||||
//呼叫空托出库
|
||||
List<BasStock> basStocks = basStockService.selectBasStockList(
|
||||
new BasStock().builder()
|
||||
.productId(ProductType.EMPTY_TRAY)
|
||||
.trayType(type)
|
||||
.stockStatus(StockStatusEnum.NORMAL.getCode())
|
||||
.build()
|
||||
);
|
||||
|
||||
|
||||
if (CollUtil.isEmpty(basStocks)){
|
||||
log.warn("【呼叫空托-警告】呼叫空托盘出库失败,托盘类型:{},查不到该类型的空托盘库存,请咨询管理员", type);
|
||||
return AjaxResult.error("呼叫空托盘出库失败,托盘类型:" + type +",查不到该类型的空托盘库存,请咨询管理员");
|
||||
}
|
||||
|
||||
//获取指定出库空托盘的库存信息
|
||||
BasStock stock = basStocks.get(0);
|
||||
String cargo = basStocks.get(0).getCargoSpaceId();
|
||||
|
||||
MydoJob mydoJob = new MydoJob().builder()
|
||||
.jobId(basJobIdService.getId(JobIdType.MYDOJOB_STOCKOUT_EMPTY_PALLET))
|
||||
.taskNo(basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKOUT_EMPTY_PALLET))
|
||||
.status(TaskStatusEnum.READY.getCode())
|
||||
.inOrOut(TASKTYPE_STOCKOUT_EMPTY_TRAY)
|
||||
.trayCode(stock.getTrayCode())
|
||||
.cargoSpaceId(cargo)
|
||||
.build();
|
||||
|
||||
//更新库存状态【占用】
|
||||
stock.setStockStatus(StockStatusEnum.OCCUPIED.getCode());
|
||||
basStockService.updateBasStock(stock);
|
||||
|
||||
//更新货位状态【出库预分配】
|
||||
BasCargoSpace cs =basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(cargo);
|
||||
cs.setStatus(CargoSpaceCode.CARGOSPACE_STATUS_PRE_STOCKOUT);
|
||||
basCargoSpaceService.updateBasCargoSpace(cs);
|
||||
|
||||
//推送wcs出库
|
||||
RequestLog requestLog = requestLogService.getRequestLog(WcsUrl.PUSH_EMPTY_TRAY_OUT_MYDO_JOB, JSONUtil.toJsonStr(mydoJob), SEND_WCS_STOCKOUT_EMPTY_TRAY_MYDOJOB);
|
||||
if ("1".equals(requestLog.getIsSuccessful())){
|
||||
mydoJobService.insertMydoJob(mydoJob);
|
||||
|
||||
//更新库存状态
|
||||
stock.setStockStatus(StockStatusEnum.OCCUPIED.getCode());
|
||||
basStockService.updateBasStock(stock);
|
||||
}
|
||||
|
||||
//todo 是否需要生成子作业?
|
||||
|
||||
log.info("【呼叫空托】呼叫成功,下发空托盘出库任务,wms作业号:{},任务号:{},源货位:{}", mydoJob.getJobId(), mydoJob.getTaskNo(), mydoJob.getCargoSpaceId());
|
||||
|
||||
return AjaxResult.success("呼叫空托盘出库任务,wms作业号:" + mydoJob.getJobId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult callEmptyPalletOut(String PalletType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
//@Scheduled(fixedDelay=1500)
|
||||
public void pushOutMydoJob() {
|
||||
//查询所有未推送的出库作业
|
||||
// MydoJob mydoJobParam = new MydoJob();
|
||||
// mydoJobParam.setStatus("1");
|
||||
// List<String> list = new ArrayList<>();
|
||||
// list.add("21");
|
||||
// list.add("26");
|
||||
// mydoJobParam.setInOutIds(list);
|
||||
// List<MydoJob> outMydoJobs = mydoJobService.selectMydoJobListApi(mydoJobParam);
|
||||
// for (MydoJob outMydoJob : outMydoJobs) {
|
||||
// RequestLog requestLog = requestLogService.getRequestLog(PUSH_OUT_MYDO_JOB, JSONUtil.toJsonStr(outMydoJob), SEND_WCS_STOCKOUT_MYDOJOB);
|
||||
// if ("1".equals(requestLog.getIsSuccessful())){
|
||||
// outMydoJob.setStatus("3");
|
||||
// outMydoJob.setExecutionPhase("1");
|
||||
// outMydoJob.setStartTime(DateUtil.formatDateTime(new Date()));
|
||||
// mydoJobService.updateMydoJob(outMydoJob);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public AjaxResult pushAgvMoveJob(AgvMoveParam agvMoveParam) {
|
||||
// agvMoveParam.setTaskNo(IdUtil.fastSimpleUUID());
|
||||
// RequestLog requestLog = requestLogService.getRequestLog(PUSH_AGV_MOVE_JOB, JSONUtil.toJsonStr(agvMoveParam), "推送搬运任务");
|
||||
// if ("1".equals(requestLog.getIsSuccessful())){
|
||||
// AgvContainerTask agvContainerTask = new AgvContainerTask();
|
||||
// agvContainerTask.setContainer(agvMoveParam.getContainerCode());
|
||||
// agvContainerTask.setStartPoint(agvMoveParam.getStartPoint());
|
||||
// agvContainerTask.setEndPoint(agvMoveParam.getEndPoint());
|
||||
// agvContainerTask.setStatus("0");
|
||||
// agvContainerTask.setTaskNo(agvMoveParam.getTaskNo());
|
||||
// agvContainerTask.setCreateTime(new Date());
|
||||
// agvContainerTaskService.insertAgvContainerTask(agvContainerTask);
|
||||
// return AjaxResult.success();
|
||||
// }
|
||||
// return AjaxResult.error(requestLog.getErrorDetails());
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void pushInMydoJob() {
|
||||
// MydoJob mydoJobParam = new MydoJob();
|
||||
// mydoJobParam.setInOrOut("1");
|
||||
// mydoJobParam.setStatus("1");
|
||||
// List<MydoJob> mydoJobs = mydoJobService.selectMydoJobListApi(mydoJobParam);
|
||||
// if (CollUtil.isNotEmpty(mydoJobs)){
|
||||
// for (MydoJob mydoJob : mydoJobs) {
|
||||
// RequestLog requestLog = requestLogService.getRequestLog(PUSH_IN_MYDO_JOB, JSONUtil.toJsonStr(mydoJob), "推送出库任务");
|
||||
// if ("1".equals(requestLog.getIsSuccessful())){
|
||||
// mydoJob.setStatus("2");
|
||||
// mydoJobService.updateMydoJob(mydoJob);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// mydoJobParam.setEntranceId("fluent");
|
||||
// mydoJobs = mydoJobService.selectMydoJobListApi(mydoJobParam);
|
||||
// if (CollUtil.isNotEmpty(mydoJobs)){
|
||||
// for (MydoJob mydoJob : mydoJobs) {
|
||||
// RequestLog requestLog = requestLogService.getRequestLog(PUSH_IN_MYDO_JOB, JSONUtil.toJsonStr(mydoJob), "推送出库任务");
|
||||
// if ("1".equals(requestLog.getIsSuccessful())){
|
||||
// mydoJob.setStatus("2");
|
||||
// mydoJobService.updateMydoJob(mydoJob);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult outMydojobMakeSure(HashMap<String, String> outMydojobMakeSureParam) {
|
||||
RequestLog requestLog = requestLogService.getRequestLog(OUT_MYDOJOB_MS, JSONUtil.toJsonStr(outMydojobMakeSureParam), "推送出库任务");
|
||||
if ("1".equals(requestLog.getIsSuccessful())){
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error(requestLog.getDuration());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult cancelTaskByTaskNo(String taskNo) {
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("taskNo", taskNo);
|
||||
RequestLog requestLog = requestLogService.getRequestLog(CANCEL_MYDOJOB, JSONUtil.toJsonStr(map), "取消任务");
|
||||
if ("1".equals(requestLog.getIsSuccessful())){
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error(requestLog.getErrorDetails());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,639 @@
|
||||
package com.ruoyi.apiService.service.impl;
|
||||
|
||||
import com.ruoyi.apiService.service.IToErpService;
|
||||
import com.ruoyi.apiService.service.IToWmsService;
|
||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||
import com.ruoyi.bas.id.job.service.IBasJobIdService;
|
||||
import com.ruoyi.bas.id.taskno.service.IBasTaskNoService;
|
||||
import com.ruoyi.bas.product.service.IBasProductService;
|
||||
import com.ruoyi.bas.roadway.service.IBasRoadwayService;
|
||||
|
||||
import com.ruoyi.bas.stock.service.IBasStockService;
|
||||
|
||||
import com.ruoyi.in.bind.service.IInTrayMsgService;
|
||||
import com.ruoyi.in.job.service.IMydoJobService;
|
||||
import com.ruoyi.in.jobdetail.service.IMydoJobDetailService;
|
||||
import com.ruoyi.in.stockindetail.service.IInStockinDetailService;
|
||||
import com.ruoyi.in.stockin.service.IInStockinService;
|
||||
|
||||
import com.ruoyi.log.service.IRequestLogService;
|
||||
import com.ruoyi.out.stockout.service.IOutStockoutService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 作业统计 Service 实现
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ToWmsServiceImpl implements IToWmsService {
|
||||
@Autowired
|
||||
private IMydoJobService mydoJobService;
|
||||
|
||||
@Autowired
|
||||
private IMydoJobDetailService mydoJobDetailService;
|
||||
|
||||
@Autowired
|
||||
private IBasTaskNoService basTaskNoService;
|
||||
|
||||
@Autowired
|
||||
private IBasCargoSpaceService basCargoSpaceService;
|
||||
|
||||
@Autowired
|
||||
private IOutStockoutService outStockoutService;
|
||||
|
||||
@Autowired
|
||||
private IBasProductService basProductService;
|
||||
@Autowired
|
||||
private IBasJobIdService basJobIdService;
|
||||
@Autowired
|
||||
private IToErpService toErpService;
|
||||
|
||||
@Autowired
|
||||
private IInStockinService inStockinService;
|
||||
@Autowired
|
||||
private IInStockinDetailService inStockinDetailService;
|
||||
|
||||
@Autowired
|
||||
private IBasRoadwayService basRoadwayService;
|
||||
|
||||
//条码绑定
|
||||
@Autowired
|
||||
private IInTrayMsgService inTrayMsgService;
|
||||
|
||||
//库存
|
||||
@Autowired
|
||||
private IBasStockService basStockService;
|
||||
|
||||
@Autowired
|
||||
IRequestLogService requestLogService;
|
||||
|
||||
|
||||
// /**
|
||||
// * 响应wcs请求-下发入库任务
|
||||
// * @param wcsStockinReiceive
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
// public AjaxResult requestMydoJobByTrayCode(WcsStockinReiceive wcsStockinReiceive) {
|
||||
//
|
||||
// RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wcsStockinReiceive), "wcs请求入库作业");
|
||||
// requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success()));
|
||||
// requestLog.setResponseStatus("0");
|
||||
// requestLog.setIsSuccessful("1");
|
||||
// requestLogService.insertRequestLog(requestLog);
|
||||
//
|
||||
// String type = mydoJobService.getTrayTypeByTrayCode(wcsStockinReiceive.getTrayCode());
|
||||
//
|
||||
// // -------------------------检查推送的任务参数-------------------------
|
||||
// log.info(
|
||||
// "【wcs请求入库】托盘号:{},托盘类型:{},巷道口:{}",wcsStockinReiceive.getTrayCode(), type, wcsStockinReiceive.getRoadwayId()
|
||||
// );
|
||||
//
|
||||
// //校验 - 条码空
|
||||
// if (StrUtil.isEmpty(wcsStockinReiceive.getTrayCode())) {
|
||||
// log.warn("【wcs请求入库】请求条码异常,参数为空,请重试");
|
||||
// return AjaxResult.error("请求条码异常,参数为空");
|
||||
// }
|
||||
//
|
||||
// //获取请求条码对应的绑定信息
|
||||
// List<InTrayMsg> trayMsgs = inTrayMsgService.selectInTrayMsgList(
|
||||
// new InTrayMsg().builder().trayCode(wcsStockinReiceive.getTrayCode()).build()
|
||||
// );
|
||||
//
|
||||
// //-------------------通过绑定信息的物料编码确认入库类型 -空托入库-------------------
|
||||
// if (trayMsgs.get(0).getProductId() == ProductType.EMPTY_TRAY) {
|
||||
//
|
||||
// //todo 货位分配查询
|
||||
// BasCargoSpace cargoSpace = getCargoSpaceForStockin(type, wcsStockinReiceive.getRoadwayId());
|
||||
//
|
||||
// if (cargoSpace == null) {
|
||||
// log.warn("【货位分配】该类型托盘立库中无可用货位");
|
||||
// return AjaxResult.error("【货位分配失败】该类型托盘立库中无可用货位");
|
||||
// }
|
||||
//
|
||||
// String jobId = basJobIdService.getId(JobIdType.MYDOJOB_STOCKIN_EMPTY_PALLET);
|
||||
// String taskNo = basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKIN_EMPTY_PALLET);
|
||||
//
|
||||
// //生成wms的入库作业
|
||||
// MydoJob mydoJob = new MydoJob().builder()
|
||||
// .jobId(jobId)
|
||||
// .taskNo(taskNo)
|
||||
// .status(TaskStatusEnum.READY.getCode())
|
||||
// .executionPhase("0")
|
||||
// .inOrOut(TaskType.TASKTYPE_STOCKIN_EMPTY_PALLET)
|
||||
// .trayCode(wcsStockinReiceive.getTrayCode())
|
||||
// .entranceId(wcsStockinReiceive.getEntranceId())
|
||||
// .roadwayId(wcsStockinReiceive.getRoadwayId())
|
||||
// .cargoSpaceId(cargoSpace.getCargoSpaceId())
|
||||
// .cargoSpaceName(cargoSpace.getCargoSpaceName())
|
||||
// .trayType(wcsStockinReiceive.getTrayType())
|
||||
// .build();
|
||||
//
|
||||
// if (mydoJobService.selectMydoJobByTrayCode(wcsStockinReiceive.getTrayCode()) == null){
|
||||
// mydoJobService.insertMydoJob(mydoJob);
|
||||
// log.info("【wms生成入库】<空托入库>作业,作业号:{},任务号:{},托盘号:{},分配货位:{}",mydoJob.getJobId() ,mydoJob.getTaskNo() ,mydoJob.getTrayCode(), mydoJob.getCargoSpaceId());
|
||||
// }else{
|
||||
// log.info("【提示】<空托入库>wms已存在该条码作业,托盘号:{}",mydoJob.getTrayCode());
|
||||
// }
|
||||
//
|
||||
// //循环生成子作业
|
||||
// int sum = 1;
|
||||
// for (InTrayMsg trayMsg : trayMsgs){
|
||||
//
|
||||
// if (mydoJobDetailService.selectMydoJobDetailList(
|
||||
// new MydoJobDetail().builder().stockinDetailId(trayMsg.getStockinDetailId()).build()
|
||||
// ).isEmpty()){
|
||||
//
|
||||
// String instockinId = trayMsg.getStockinId();
|
||||
// String instockinDetailId = trayMsg.getStockinDetailId() + sum;
|
||||
//
|
||||
// MydoJobDetail detail = new MydoJobDetail().builder()
|
||||
// .jobId(jobId)
|
||||
// .jobDetailId(jobId + "-" + sum)
|
||||
// .inQuantity(1)
|
||||
// .productId(trayMsg.getProductId())
|
||||
// .inDate(mydoJob.getCreateTime())
|
||||
// .inOrOutId(instockinId)
|
||||
// .inOrOutDId(instockinDetailId)
|
||||
// .stockinId(instockinId)
|
||||
// .stockinDetailId(instockinDetailId)
|
||||
// .status("1")
|
||||
// .build();
|
||||
// sum++;
|
||||
// mydoJobDetailService.insertMydoJobDetail(detail);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// //返回wcs的响应信息
|
||||
// WcsStockinResponse response = new WcsStockinResponse()
|
||||
// .builder()
|
||||
// .reqCode(wcsStockinReiceive.getTrayCode())
|
||||
// .jobId(jobId)
|
||||
// .taskNo(taskNo)
|
||||
// .taskType(TaskType.TASKTYPE_STOCKIN_EMPTY_PALLET)
|
||||
// .trayCode(wcsStockinReiceive.getTrayCode())
|
||||
// .cargoSpaceId(cargoSpace.getCargoSpaceId())
|
||||
// .build();
|
||||
//
|
||||
// log.info("【wms请求响应】<空托入库>响应信息,作业号:{},任务号:{},分配货位:{}",mydoJob.getJobId() ,mydoJob.getTaskNo(), mydoJob.getCargoSpaceId());
|
||||
//
|
||||
// return AjaxResult.success(response);
|
||||
//
|
||||
// }
|
||||
// else//-------------------常规物料入库-------------------
|
||||
// {
|
||||
// //生成主作业
|
||||
// //获取货位表中可用货位
|
||||
// BasCargoSpace cargoSpace = getCargoSpaceForStockin(wcsStockinReiceive.getTrayType(), wcsStockinReiceive.getRoadwayId());
|
||||
//
|
||||
// String jobId = basJobIdService.getId(JobIdType.MYDOJOB_STOCKIN_EMPTY_PALLET);
|
||||
// String taskNo = basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKIN_EMPTY_PALLET);
|
||||
//
|
||||
// //生成wms的入库作业
|
||||
// MydoJob mydoJob = new MydoJob().builder()
|
||||
// .jobId(jobId)
|
||||
// .taskNo(taskNo)
|
||||
// .status(TaskStatusEnum.READY.getCode())
|
||||
// .executionPhase("0")
|
||||
// .inOrOut(TaskType.TASKTYPE_STOCKIN)
|
||||
// .trayCode(wcsStockinReiceive.getTrayCode())
|
||||
// .entranceId(wcsStockinReiceive.getEntranceId())
|
||||
// .roadwayId(wcsStockinReiceive.getRoadwayId())
|
||||
// .cargoSpaceId(cargoSpace.getCargoSpaceId())
|
||||
// .cargoSpaceName(cargoSpace.getCargoSpaceName())
|
||||
// .trayType(wcsStockinReiceive.getTrayType())
|
||||
// .build();
|
||||
//
|
||||
// if (mydoJobService.selectMydoJobByTrayCode(wcsStockinReiceive.getTrayCode()) == null){
|
||||
// mydoJobService.insertMydoJob(mydoJob);
|
||||
// log.info("【wms生成入库】<物料入库>作业,作业号:{},任务号:{},托盘号:{},分配货位:{}",mydoJob.getJobId() ,mydoJob.getTaskNo() ,mydoJob.getTrayCode(), mydoJob.getCargoSpaceId());
|
||||
// }else{
|
||||
// log.info("【提示】<物料入库>wms已存在该条码作业,托盘号:{}",mydoJob.getTrayCode());
|
||||
// }
|
||||
//
|
||||
// //循环生成子作业
|
||||
// int sum = 1;
|
||||
// for (InTrayMsg trayMsg : trayMsgs){
|
||||
//
|
||||
// if (mydoJobDetailService.selectMydoJobDetailList(
|
||||
// new MydoJobDetail().builder().stockinDetailId(trayMsg.getStockinDetailId()).build()
|
||||
// ).isEmpty()){
|
||||
//
|
||||
// String instockinId = trayMsg.getStockinId();
|
||||
// String instockinDetailId = trayMsg.getStockinDetailId() + sum;
|
||||
//
|
||||
// MydoJobDetail detail = new MydoJobDetail().builder()
|
||||
// .jobId(jobId)
|
||||
// .jobDetailId(mydoJob.getJobId() + "-" + sum)
|
||||
// .inQuantity(1)
|
||||
// .productId(trayMsg.getProductId())
|
||||
// .inDate(mydoJob.getCreateTime())
|
||||
// .inOrOutId(instockinId)
|
||||
// .inOrOutDId(instockinDetailId)
|
||||
// .stockinId(instockinId)
|
||||
// .stockinDetailId(instockinDetailId)
|
||||
// .status("1")
|
||||
// .build();
|
||||
// sum++;
|
||||
// mydoJobDetailService.insertMydoJobDetail(detail);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// //返回wcs响应信息
|
||||
// WcsStockinResponse response = new WcsStockinResponse().builder()
|
||||
// .reqCode(wcsStockinReiceive.getTrayCode())
|
||||
// .jobId(jobId)
|
||||
// .taskNo(taskNo)
|
||||
// .taskType(TaskType.TASKTYPE_STOCKIN)
|
||||
// .trayCode(wcsStockinReiceive.getTrayCode())
|
||||
// .cargoSpaceId(cargoSpace.getCargoSpaceId())
|
||||
// .build();
|
||||
//
|
||||
// log.info("【wms请求响应】<物料入库>响应信息,作业号:{},任务号:{},分配货位:{}",mydoJob.getJobId() ,mydoJob.getTaskNo(), mydoJob.getCargoSpaceId());
|
||||
//
|
||||
// return AjaxResult.success(response);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * requestEnterByTrayCode -> 入库货位分配
|
||||
// * 入库任务请求根据托盘码 -> 向子单明细分配入库货位
|
||||
// * 获取库存物料号 -> 货位id -> 存储区组group -> 状态:未占用 -> 按规则获取货位
|
||||
// *
|
||||
// * @param productId 物料号
|
||||
// * @return
|
||||
// */
|
||||
// public String getCargoSpaceByProductInfo(String productId) {
|
||||
////>>>>>>>>>>>>>>获取物料库存信息 -> 有库存 -> 货位(cargospace) -> 存储区组(groupCodingNo) -> 根据groupCoding(由高到低) -> 获取状态1的货位分配
|
||||
////>>>>>>>>>>>>>>获取物料库存信息 -> 无库存 -> 遍历存储区组(groupCodingNo) -> 查找全部货位空的区组 -> 根据groupCoding(由高到低) -> 获取状态1的货位分配
|
||||
//// try {
|
||||
//// //获取物料的货位集合 - 首先查找已经存放该物料的存储区
|
||||
//// List<BasStock> stocks = basStockService.selectBasStockListByProductId(productId);
|
||||
////
|
||||
//// //如果集合空 - 寻找未被占用的存储区组放货
|
||||
//// if (stocks.size() == 0) {
|
||||
//// for (int i = 1; i <= 45; i++) {
|
||||
//// BasCargoSpace cargospace = new BasCargoSpace();
|
||||
////
|
||||
//// //存储区
|
||||
//// String groupCodingNo = String.format("%03d", i);
|
||||
//// cargospace.setGroupCodingNo(groupCodingNo);
|
||||
////
|
||||
//// //获取【groupCodingNo】所有货位
|
||||
//// List<BasCargoSpace> cargoSpaces = basCargoSpaceService.selectBasCargoSpaceList(cargospace);
|
||||
////
|
||||
//// //判断是否全部未占用,即某存储区全部为空位 - 避免物料混放
|
||||
//// boolean isAllEmpty = cargoSpaces.stream().allMatch(c -> "1".equals(c.getStatus()));
|
||||
////
|
||||
//// //区域未占用 - 则分配最内侧货位
|
||||
//// if (isAllEmpty && cargoSpaces.size() > 0) {
|
||||
//// cargoSpaces.sort(Comparator.comparing(BasCargoSpace::getGroupCoding).reversed());
|
||||
//// return cargoSpaces.get(0).getCargoSpaceId();
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// }
|
||||
////
|
||||
//// //如果物料已经存放在多个货位(区域) - 去重
|
||||
//// List<BasStock> stocksNew = stocks.stream().distinct().collect(Collectors.toList());
|
||||
////
|
||||
//// //查询对应货位的区域在【BasCargoSpace】是否有空位 - 在groupCodingNo的分组中是否仍然有状态【1】的货位
|
||||
//// for (BasStock stock : stocksNew) {
|
||||
//// //获取每种物料的存放货位信息
|
||||
//// BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(stock.getCargoSpaceId());
|
||||
////
|
||||
//// //获取每种物料的存放货位信息 - 存储区
|
||||
//// String group = cargoSpace.getGroupCodingNo();
|
||||
////
|
||||
//// //获取该存储区组的所有货位
|
||||
//// List<BasCargoSpace> cargoSpaces = basCargoSpaceService.selectBasCargoSpaceListByGroupCodingNo(group);
|
||||
////
|
||||
//// //在集合中获取状态为【1】的货位
|
||||
//// for (BasCargoSpace cs : cargoSpaces) {
|
||||
//// //货位状态:1(未占用) -> 返回该货位结果
|
||||
//// if ("1".equals(cs.getStatus())) {
|
||||
//// return cs.getCargoSpaceId();
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// }
|
||||
//// } catch (Exception e) {
|
||||
//// log.error("入库子单获取目标货位失败,异常信息:" + e.getMessage());
|
||||
//// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 入库分配货位
|
||||
// * 查询规则:层 → 排 → 列 → 先左后右 → 先双伸后单伸
|
||||
// * @param trayType
|
||||
// * @param roadwayId
|
||||
// * @return
|
||||
// */
|
||||
// public BasCargoSpace getCargoSpaceForStockin(String trayType, String roadwayId) {
|
||||
// List<BasCargoSpace> cargos = basCargoSpaceService.selectBasCargoSpaceList(
|
||||
// new BasCargoSpace().builder()
|
||||
// .theType(trayType)
|
||||
// .roadwayId(roadwayId)
|
||||
// .locked(CargoSpaceCode.CARGOSPACE_UNLOCKED)
|
||||
// .status(CargoSpaceCode.CARGOSPACE_STATUS_AVAILABLE)
|
||||
// .build()
|
||||
// );
|
||||
//
|
||||
// //查询规则:层 → 排 → 列 → 先左后右 → 先双伸后单伸
|
||||
// BasCargoSpace cargoSpace = cargos.stream()
|
||||
// .sorted(Comparator
|
||||
// .comparing(BasCargoSpace::getGroupCoding)
|
||||
// .thenComparing(BasCargoSpace::getTheFloor)
|
||||
// .thenComparing(BasCargoSpace::getThePlatoon)
|
||||
// .thenComparing(BasCargoSpace::getTheColumn)
|
||||
// .thenComparing(BasCargoSpace::getIssDouble, Comparator.reverseOrder()))
|
||||
// .collect(Collectors.toList()).get(0);
|
||||
//
|
||||
//
|
||||
// return cargoSpace;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 请求补码作业
|
||||
// * @param wcsStockinReiceive
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public AjaxResult requestMydoJobManual(WcsStockinReiceive wcsStockinReiceive) {
|
||||
//
|
||||
// RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wcsStockinReiceive), "补码请求入库作业");
|
||||
// requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success()));
|
||||
// requestLog.setResponseStatus("0");
|
||||
// requestLog.setIsSuccessful("1");
|
||||
// requestLogService.insertRequestLog(requestLog);
|
||||
//
|
||||
// //查绑定信息
|
||||
// List<InTrayMsg> trayMsgs = inTrayMsgService.selectInTrayMsgList(
|
||||
// new InTrayMsg().builder().trayCode(wcsStockinReiceive.getTrayCode()).build()
|
||||
// );
|
||||
//
|
||||
// if (trayMsgs.size() == 0){
|
||||
// log.warn("【补码请求】未找到该托盘的绑定信息,请确认绑定后进行补码操作,托盘条码:{}", wcsStockinReiceive.getTrayCode());
|
||||
// return AjaxResult.error("未找到该托盘的绑定信息,请确认绑定后进行补码操作");
|
||||
// }
|
||||
//
|
||||
// //通过绑定信息的物料编码获取任务类型
|
||||
// int taskType = trayMsgs.get(0).getProductId() == ProductType.EMPTY_TRAY ? TaskType.TASKTYPE_STOCKIN_EMPTY_PALLET : TaskType.TASKTYPE_STOCKIN;
|
||||
//
|
||||
// //校验是否已经有该条码的入库作业
|
||||
// List<MydoJob> jobs = mydoJobService.selectMydoJobList(
|
||||
// new MydoJob().builder()
|
||||
// .trayCode(wcsStockinReiceive.getTrayCode())
|
||||
// .build()
|
||||
// );
|
||||
//
|
||||
// if (!jobs.isEmpty()){
|
||||
// log.warn("【补码请求】已经存在该条码的入库任务,,托盘条码:{}", wcsStockinReiceive.getTrayCode());
|
||||
// return AjaxResult.error("未找到该托盘的绑定信息,请确认绑定后进行补码操作");
|
||||
// }
|
||||
//
|
||||
// //分配货位
|
||||
// BasCargoSpace cargoSpace = getCargoSpaceForStockin(wcsStockinReiceive.getTrayType(), wcsStockinReiceive.getRoadwayId());
|
||||
//
|
||||
// //生成wms的入库主作业
|
||||
// MydoJob mydoJob = new MydoJob().builder()
|
||||
// .jobId(basJobIdService.getId(JobIdType.MYDOJOB_STOCKIN))
|
||||
// .taskNo(basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKIN))
|
||||
// .status(TaskStatusEnum.READY.getCode())
|
||||
// .executionPhase("0")
|
||||
// .inOrOut(taskType)
|
||||
// .trayCode(wcsStockinReiceive.getTrayCode())
|
||||
// .entranceId(wcsStockinReiceive.getEntranceId())
|
||||
// .roadwayId(wcsStockinReiceive.getRoadwayId())
|
||||
// .cargoSpaceId(cargoSpace.getCargoSpaceId())
|
||||
// .cargoSpaceName(cargoSpace.getCargoSpaceName())
|
||||
// .trayType(wcsStockinReiceive.getTrayType())
|
||||
// .build();
|
||||
//
|
||||
// //循环生成子作业
|
||||
// int sum = 1;
|
||||
// for (InTrayMsg trayMsg : trayMsgs){
|
||||
//
|
||||
// if (mydoJobDetailService.selectMydoJobDetailList(
|
||||
// new MydoJobDetail().builder().stockinDetailId(trayMsg.getStockinDetailId()).build()
|
||||
// ).isEmpty()){
|
||||
// MydoJobDetail detail = new MydoJobDetail().builder()
|
||||
// .jobId(mydoJob.getJobId())
|
||||
// .jobDetailId(mydoJob.getJobId() + "-" + sum)
|
||||
// .inQuantity(1)
|
||||
// .productId(trayMsg.getProductId())
|
||||
// .inDate(mydoJob.getCreateTime())
|
||||
// .inOrOutId(trayMsg.getStockinId())
|
||||
// .inOrOutDId(trayMsg.getStockinDetailId() + sum)
|
||||
// .stockinId(trayMsg.getStockinId())
|
||||
// .stockinDetailId(trayMsg.getStockinDetailId() + sum)
|
||||
// .status("1")
|
||||
// .build();
|
||||
// sum++;
|
||||
// mydoJobDetailService.insertMydoJobDetail(detail);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// //返回wcs响应信息
|
||||
// WcsStockinResponse response = new WcsStockinResponse().builder()
|
||||
// .reqCode(wcsStockinReiceive.getTrayCode())
|
||||
// .jobId(basJobIdService.getId(JobIdType.MYDOJOB_STOCKIN))
|
||||
// .taskNo(basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKIN))
|
||||
// .taskType(TaskType.TASKTYPE_STOCKIN)
|
||||
// .trayCode(wcsStockinReiceive.getTrayCode())
|
||||
// .cargoSpaceId(cargoSpace.getCargoSpaceId())
|
||||
// .build();
|
||||
// log.info("【补码请求】<补码入库>响应信息,作业号:{},任务号:{},分配货位:{}",mydoJob.getJobId() ,mydoJob.getTaskNo(), mydoJob.getCargoSpaceId());
|
||||
// return AjaxResult.success(response);
|
||||
//
|
||||
//// HashMap<String, String> result = new HashMap<>();
|
||||
//// result.put("jobId", mydoJob.getJobId());
|
||||
//// result.put("taskNo", mydoJob.getTaskNo());
|
||||
//// result.put("cargoSpaceId", mydoJob.getCargoSpaceId());
|
||||
//// result.put("roadwayId", mydoJob.getRoadwayId());
|
||||
//// result.put("entranceId", mydoJob.getEntranceId());
|
||||
//// return AjaxResult.success(result);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public AjaxResult jobFinish(WmsJobRequest wmsJobRequest) {
|
||||
//
|
||||
// if (StrUtil.isEmpty(wmsJobRequest.getTaskNo())) {
|
||||
// return AjaxResult.error("任务号不能为空");
|
||||
// }
|
||||
// if (StrUtil.isEmpty(wmsJobRequest.getJobId())) {
|
||||
// return AjaxResult.error("作业号不能为空");
|
||||
// }
|
||||
//
|
||||
// MydoJob mydoJobParam = new MydoJob();
|
||||
//
|
||||
// switch (wmsJobRequest.getWmsType()) {
|
||||
// //入库
|
||||
// case "1":
|
||||
// mydoJobParam.setTaskNo(wmsJobRequest.getTaskNo());
|
||||
// mydoJobParam.setJobId(wmsJobRequest.getJobId());
|
||||
// List<MydoJob> inMydoJobs = mydoJobService.selectMydoJobList(mydoJobParam);
|
||||
// if (inMydoJobs.isEmpty()) {
|
||||
// return AjaxResult.error("找不到该任务,请核对任务状态");
|
||||
// }
|
||||
//
|
||||
// MydoJob inMydoJob = inMydoJobs.get(0);
|
||||
//// mydoJobService.manualCompleteJob(inMydoJob, 1);
|
||||
// mydoJobService.autoCompleteJob(wmsJobRequest.getJobId(), wmsJobRequest.getWmsType());
|
||||
// break;
|
||||
// //出库
|
||||
// case "2":
|
||||
// mydoJobParam.setTaskNo(wmsJobRequest.getTaskNo());
|
||||
// List<MydoJob> outMydoJobs = mydoJobService.selectMydoJobList(mydoJobParam);
|
||||
// if (outMydoJobs.isEmpty()) {
|
||||
// return AjaxResult.error("找不到该任务,请核对任务状态");
|
||||
// }
|
||||
// MydoJob outJob = outMydoJobs.get(0);
|
||||
// outJob.setExecutionPhase("2");
|
||||
// mydoJobService.updateMydoJob(outJob);
|
||||
// break;
|
||||
//
|
||||
// default:
|
||||
// log.error("作业类型错误");
|
||||
// return AjaxResult.error(MessageUtils.message("error.message12"));
|
||||
// }
|
||||
// return AjaxResult.success();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 放货有货 - 入库重分
|
||||
// * @param reMaterialParam
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public AjaxResult reAssign(ReMaterialParam reMaterialParam) {
|
||||
//
|
||||
// BasCargoSpace basCargoSpaceParam = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(reMaterialParam.getCargoSpaceId());
|
||||
//
|
||||
// if (basCargoSpaceParam == null) {
|
||||
// log.warn("【请求重分】请求货位异常,找不到该货位数据,作业号:{},异常货位:{}", reMaterialParam.getJobId(), reMaterialParam.getCargoSpaceId());
|
||||
// return AjaxResult.error("【请求重分】请求货位异常,找不到该货位数据");
|
||||
// }
|
||||
//
|
||||
// //货位状态标记为【异常】
|
||||
// basCargoSpaceParam.setStatus(CargoSpaceCode.CARGOSPACE_STATUS_EXCEPTION);
|
||||
// basCargoSpaceService.updateBasCargoSpace(basCargoSpaceParam);
|
||||
//
|
||||
// //重新分配货位
|
||||
// MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(reMaterialParam.getJobId());
|
||||
//
|
||||
// //重新查找可用货位
|
||||
// BasCargoSpace newCargoSpace = basCargoSpaceService.selectBasCargoSpaceForStockin(mydoJob.getRoadwayId());
|
||||
//
|
||||
// if (newCargoSpace == null) {
|
||||
// log.warn("【重分失败】没有可分配的空货位,作业号:{},异常货位:{}", reMaterialParam.getJobId(), reMaterialParam.getCargoSpaceId());
|
||||
// return AjaxResult.error("【重分失败】没有可分配的空货位");
|
||||
// } else {
|
||||
// //更新任务
|
||||
// mydoJob.setCargoSpaceId(newCargoSpace.getCargoSpaceId());
|
||||
// mydoJob.setFaultFlag("1");
|
||||
// mydoJobService.updateMydoJob(mydoJob);
|
||||
//
|
||||
// //更新货位状态
|
||||
// newCargoSpace.setStatus(CargoSpaceCode.CARGOSPACE_STATUS_PRE_STOCKIN);
|
||||
// basCargoSpaceService.updateBasCargoSpace(newCargoSpace);
|
||||
//
|
||||
// return AjaxResult.success(
|
||||
// new RequestEnterResponse().builder()
|
||||
// .cargoSpaceId(newCargoSpace.getCargoSpaceId())
|
||||
// .trayCode(mydoJob.getTrayCode())
|
||||
// .JobId(reMaterialParam.getJobId())
|
||||
// .reqCode(reMaterialParam.getReqCode())
|
||||
// .build()
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 取货无货 - 重分物料
|
||||
// * @param reMaterialParam
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public AjaxResult reMaterial(ReMaterialParam reMaterialParam) {
|
||||
//
|
||||
// //获取上报的异常任务和子任务
|
||||
// MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(reMaterialParam.getJobId());
|
||||
// MydoJobDetail mydoJobDetailParam = new MydoJobDetail();
|
||||
// mydoJobDetailParam.setJobId(mydoJob.getJobId());
|
||||
// List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailList(mydoJobDetailParam);
|
||||
//
|
||||
// //获取出库单据号
|
||||
// String stockOutId = mydoJobDetails.get(0).getInOrOutId();
|
||||
//
|
||||
// //作废作业
|
||||
// mydoJobService.cancelJob(reMaterialParam.getJobId());
|
||||
//
|
||||
// //调用自动分配
|
||||
// return outStockoutService.autoAssignOutStockout(stockOutId);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
// public AjaxResult requestEnterByTrayCodeAndEntranceId(RequestEnter requestEnter) {
|
||||
// HashMap<String, String> result = new HashMap<>();
|
||||
// if (StrUtil.isEmpty(requestEnter.getTrayCode())) {
|
||||
// return AjaxResult.error("托盘条码不能为空");
|
||||
// }
|
||||
// log.info("扫码内容{}", requestEnter.getTrayCode());
|
||||
//
|
||||
// MydoJob param = new MydoJob();
|
||||
// param.setStatus("1");
|
||||
// param.setTrayCode(requestEnter.getTrayCode());
|
||||
// param.setWarehouseId(requestEnter.getWarehouseId());
|
||||
// List<MydoJob> mydoJobs = mydoJobService.selectMydoJobList(param);
|
||||
// if (CollUtil.isEmpty(mydoJobs)) {
|
||||
// return AjaxResult.error("没有该托盘任务", requestEnter.getTrayCode());
|
||||
// }
|
||||
// MydoJob mydoJob = mydoJobs.get(0);
|
||||
// if (StrUtil.isEmpty(mydoJob.getCargoSpaceId())) {
|
||||
// BasCargoSpace basCargoSpaceParam = new BasCargoSpace();
|
||||
// basCargoSpaceParam.setWarehouseId(mydoJob.getWarehouseId());
|
||||
// basCargoSpaceParam.setRoadwayId(mydoJob.getRoadwayId());
|
||||
// BasCargoSpace basCargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(basCargoSpaceParam.getCargoSpaceId());
|
||||
// if (ObjUtil.isNull(basCargoSpace)) {
|
||||
// return AjaxResult.error("没有空货位");
|
||||
// }
|
||||
//
|
||||
// //修改作业状态为正执行
|
||||
// mydoJob.setCargoSpaceId(basCargoSpace.getCargoSpaceId());
|
||||
// mydoJob.setStatus("3");
|
||||
// mydoJob.setStartTime(DateUtil.formatDateTime(new Date()));
|
||||
// mydoJob.setRoadwayId(requestEnter.getRoadwayId());
|
||||
// mydoJobService.updateMydoJob(mydoJob);
|
||||
//
|
||||
// //修改货位状态为已分配
|
||||
// basCargoSpace.setStatus("3");
|
||||
// basCargoSpaceService.updateBasCargoSpace(basCargoSpace);
|
||||
// }
|
||||
//
|
||||
// //返回结果
|
||||
// result.put("jobId", mydoJob.getJobId());
|
||||
// result.put("taskNo", mydoJob.getTaskNo());
|
||||
// result.put("cargoSpaceId", mydoJob.getCargoSpaceId());
|
||||
// result.put("roadwayId", mydoJob.getRoadwayId());
|
||||
// result.put("entranceId", mydoJob.getEntranceId());
|
||||
// result.put("inOrOut", String.valueOf(mydoJob.getInOrOut()));
|
||||
// return AjaxResult.success(result);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user