现场调试更改
This commit is contained in:
@@ -6,7 +6,7 @@ import com.ruoyi.api.constant.SysEnum;
|
||||
import com.ruoyi.api.domain.ApiLog;
|
||||
import com.ruoyi.api.domain.ApiResponse;
|
||||
import com.ruoyi.api.exception.BizException;
|
||||
import com.ruoyi.api.service.ApiLogService;
|
||||
import com.ruoyi.api.service.impl.ApiLogService;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -1,26 +1,40 @@
|
||||
package com.ruoyi.api.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.api.domain.ErpStock.ErpStockDetail;
|
||||
import com.ruoyi.api.domain.ErpStock.ErpStockParam;
|
||||
import com.ruoyi.api.service.IApiErpService;
|
||||
import com.ruoyi.api.service.impl.ApiErpService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.in.stockin.domain.InStockin;
|
||||
import com.ruoyi.in.stockin.service.IInStockinService;
|
||||
import com.ruoyi.in.stockindetail.service.IInStockinDetailService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/wmsService/erp")
|
||||
@Slf4j
|
||||
public class ErpServiceController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
IApiErpService apiErpService;
|
||||
|
||||
/**
|
||||
* 接受入库单据
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/sendErpStockinInfo")
|
||||
public AjaxResult sendErpStockinInfo(){
|
||||
|
||||
|
||||
|
||||
return AjaxResult.success();
|
||||
public AjaxResult receiveErpStockinInfo(@RequestBody ErpStockParam erpStockParam) {
|
||||
return apiErpService.receiveErpStockinBill(erpStockParam);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,11 +43,8 @@ public class ErpServiceController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/sendErpStockoutInfo")
|
||||
public AjaxResult sendErpStockoutInfo(){
|
||||
|
||||
|
||||
|
||||
return AjaxResult.success();
|
||||
public AjaxResult receiveErpStockoutInfo(@RequestBody ErpStockParam erpStockParam){
|
||||
return apiErpService.receiveErpStockoutBill(erpStockParam);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,10 +2,9 @@ package com.ruoyi.api.controller;
|
||||
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.api.service.ApiWcsService;
|
||||
import com.ruoyi.apiService.domain.ReMaterialParam;
|
||||
import com.ruoyi.apiService.domain.WmsJobRequest;
|
||||
import com.ruoyi.apiService.domain.wcs.WcsStockinReceive;
|
||||
import com.ruoyi.api.domain.wcsJobHandle.WmsJobHandler;
|
||||
import com.ruoyi.api.domain.wcsStockin.WcsStockinReceive;
|
||||
import com.ruoyi.api.service.impl.ApiWcsService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.log.domain.RequestLog;
|
||||
@@ -33,7 +32,7 @@ public class WcsServiceController extends BaseController {
|
||||
@PostMapping("/requestMydoJobByTrayCode")
|
||||
public AjaxResult requestEnterByTrayCode(@RequestBody WcsStockinReceive wcsStockinReiceive) {
|
||||
AjaxResult ajaxResult = apiWcsService.requestMydoJobByTrayCode(wcsStockinReiceive);
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wcsStockinReiceive), "入库任务创建请求",ajaxResult);
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wcsStockinReiceive), "创建入库任务请求", ajaxResult);
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
return ajaxResult;
|
||||
}
|
||||
@@ -61,9 +60,9 @@ public class WcsServiceController extends BaseController {
|
||||
*
|
||||
*/
|
||||
@PostMapping("/jobFinish")
|
||||
public AjaxResult jobFinish(@RequestBody WmsJobRequest wmsJobRequest) {
|
||||
AjaxResult ajaxResult = apiWcsService.jobFinish(wmsJobRequest);
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wmsJobRequest), "wcs任务回传",ajaxResult);
|
||||
public AjaxResult jobFinish(@RequestBody WmsJobHandler wmsJobHandler) {
|
||||
AjaxResult ajaxResult = apiWcsService.jobFinish(wmsJobHandler);
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wmsJobHandler), "wcs任务回传",ajaxResult);
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
return ajaxResult;
|
||||
}
|
||||
@@ -72,9 +71,9 @@ public class WcsServiceController extends BaseController {
|
||||
* 放货有货,重新分配货位
|
||||
*/
|
||||
@PostMapping("/reAssign")
|
||||
public AjaxResult reAssign(@RequestBody ReMaterialParam reMaterialParam) {
|
||||
AjaxResult ajaxResult = apiWcsService.reAssign(reMaterialParam);
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(reMaterialParam), "入库重分货位",ajaxResult);
|
||||
public AjaxResult reAssign(@RequestBody WmsJobHandler wmsJobHandler) {
|
||||
AjaxResult ajaxResult = apiWcsService.reAssign(wmsJobHandler);
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wmsJobHandler), "入库重分货位",ajaxResult);
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
return ajaxResult;
|
||||
}
|
||||
@@ -83,9 +82,9 @@ public class WcsServiceController extends BaseController {
|
||||
* 取货无货,重新分配物料
|
||||
*/
|
||||
@PostMapping("/reMaterial")
|
||||
public AjaxResult reMaterial(@RequestBody ReMaterialParam reMaterialParam) {
|
||||
AjaxResult ajaxResult = apiWcsService.reMaterial(reMaterialParam);
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(reMaterialParam), "取货无货重分物料",ajaxResult);
|
||||
public AjaxResult reMaterial(@RequestBody WmsJobHandler wmsJobHandler) {
|
||||
AjaxResult ajaxResult = apiWcsService.reMaterial(wmsJobHandler);
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wmsJobHandler), "取货无货重分物料",ajaxResult);
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
return ajaxResult;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.ruoyi.api.domain.ErpStock;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ErpStockDetail {
|
||||
|
||||
/** 序号 */
|
||||
@JsonProperty("序号")
|
||||
int number;
|
||||
|
||||
/** 辊号 */
|
||||
@JsonProperty("辊号")
|
||||
String rollerNumber;
|
||||
|
||||
/** 色序 */
|
||||
@JsonProperty("色序")
|
||||
Integer colorSequence;
|
||||
|
||||
/** 颜色 */
|
||||
@JsonProperty("颜色")
|
||||
String color;
|
||||
|
||||
/** 规格 */
|
||||
@JsonProperty("规格")
|
||||
String spec;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.api.domain.ErpStock;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ErpStockParam {
|
||||
|
||||
/** 单据编号 */
|
||||
@JsonProperty("单据号")
|
||||
String docNumber;
|
||||
|
||||
/** 单据明细 */
|
||||
@JsonProperty("明细")
|
||||
List<ErpStockDetail> details;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.ruoyi.api.domain.wcsJobHandle;
|
||||
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class WmsJobHandler {
|
||||
|
||||
/** 请求码 */
|
||||
String reqCode;
|
||||
|
||||
/** 作业号 */
|
||||
String jobId;
|
||||
|
||||
/** 条码 */
|
||||
String trayCode;
|
||||
|
||||
/** 货位 */
|
||||
String cargoSpaceId;
|
||||
|
||||
/** 任务类型 */
|
||||
int wmsType;
|
||||
|
||||
/** 备注 */
|
||||
String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.ruoyi.api.domain.wcsStockin;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class WcsStockinReceive {
|
||||
|
||||
/** 请求码 */
|
||||
private String reqCode;
|
||||
|
||||
/** 条码 */
|
||||
private String trayCode;
|
||||
|
||||
/** 巷道号 */
|
||||
private String roadwayId;
|
||||
|
||||
/** 货区 */
|
||||
private String cargoAreaId;
|
||||
|
||||
/** 入口 */
|
||||
@Nullable
|
||||
private String entranceId;
|
||||
|
||||
/** 高度 */
|
||||
private Integer height;
|
||||
|
||||
/** 备注 */
|
||||
@Nullable
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.ruoyi.api.domain.wcsStockin;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class WcsStockinResponse {
|
||||
|
||||
/** 请求码 */
|
||||
private String reqCode;
|
||||
|
||||
/** 作业号 */
|
||||
private String jobId;
|
||||
|
||||
/** 任务号 */
|
||||
@Nullable
|
||||
private String taskNo;
|
||||
|
||||
/** 任务类型 */
|
||||
@JsonProperty("inOrOut")
|
||||
private int taskType;
|
||||
|
||||
/** 条码 */
|
||||
private String trayCode;
|
||||
|
||||
/** 货位 */
|
||||
@Nullable
|
||||
private String cargoSpaceId;
|
||||
|
||||
/** 备注 */
|
||||
@Nullable
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.ruoyi.api.domain.wcsStockout;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class WcsStockoutParam {
|
||||
|
||||
/** 请求码 */
|
||||
private String reqCode;
|
||||
|
||||
/** 作业号 */
|
||||
private String jobId;
|
||||
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
private String taskNo;
|
||||
|
||||
/** 条码 */
|
||||
private String trayCode;
|
||||
|
||||
/** 巷道号 */
|
||||
private String roadwayId;
|
||||
|
||||
/** 货位 */
|
||||
private String cargoSpaceId;
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
private Integer inOrOut;
|
||||
|
||||
/** 入口 */
|
||||
@Nullable
|
||||
private String entranceId;
|
||||
|
||||
/** 高度 */
|
||||
@Nullable
|
||||
private Integer height;
|
||||
|
||||
/** 备注 */
|
||||
@Nullable
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
package com.ruoyi.api.service;
|
||||
|
||||
import com.ruoyi.apiService.domain.ReMaterialParam;
|
||||
import com.ruoyi.apiService.domain.WmsJobRequest;
|
||||
import com.ruoyi.apiService.domain.wcs.WcsStockinReceive;
|
||||
import com.ruoyi.apiService.service.IToErpService;
|
||||
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.stock.service.IBasStockService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
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.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ApiErpService {
|
||||
|
||||
@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 IInTrayMsgService inTrayMsgService;
|
||||
//库存
|
||||
@Autowired
|
||||
private IBasStockService basStockService;
|
||||
@Autowired
|
||||
IRequestLogService requestLogService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 响应wcs请求-下发入库任务
|
||||
* @param wcsStockinReiceive
|
||||
* @return
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult requestMydoJobByTrayCode(WcsStockinReceive wcsStockinReiceive) {
|
||||
|
||||
|
||||
log.info("【wms请求响应】<常规入库>响应信息,作业号:{},任务号:{},分配货位:{}");
|
||||
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 请求补码作业
|
||||
* @param wcsStockinReiceive
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
public AjaxResult requestMydoJobManual(WcsStockinReceive wcsStockinReiceive) {
|
||||
|
||||
|
||||
log.info("【补码请求】<补码入库>响应信息,作业号:{},任务号:{},分配货位:{}");
|
||||
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wcs任务回传
|
||||
* @param wmsJobRequest
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult jobFinish(WmsJobRequest wmsJobRequest) {
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 放货有货 - 入库重分
|
||||
* @param reMaterialParam
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult reAssign(ReMaterialParam reMaterialParam) {
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取货无货 - 重分物料
|
||||
* @param reMaterialParam
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
public AjaxResult reMaterial(ReMaterialParam reMaterialParam) {
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,629 +0,0 @@
|
||||
package com.ruoyi.api.service;
|
||||
|
||||
import cn.hutool.core.lang.UUID;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.apiService.domain.ReMaterialParam;
|
||||
import com.ruoyi.apiService.domain.RequestEnterResponse;
|
||||
import com.ruoyi.apiService.domain.WmsJobRequest;
|
||||
import com.ruoyi.apiService.domain.wcs.WcsStockinReceive;
|
||||
import com.ruoyi.apiService.domain.wcs.WcsStockinResponse;
|
||||
import com.ruoyi.apiService.service.IToErpService;
|
||||
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.product.service.IBasProductService;
|
||||
import com.ruoyi.bas.stock.domain.BasStock;
|
||||
import com.ruoyi.bas.stock.domain.BasStockInfo;
|
||||
import com.ruoyi.bas.stock.service.IBasStockInfoService;
|
||||
import com.ruoyi.bas.stock.service.IBasStockService;
|
||||
import com.ruoyi.common.*;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
import com.ruoyi.in.bind.domain.InTrayMsg;
|
||||
import com.ruoyi.in.bind.service.IInTrayMsgService;
|
||||
import com.ruoyi.in.job.domain.MydoJob;
|
||||
import com.ruoyi.in.job.service.IMydoJobService;
|
||||
import com.ruoyi.in.jobdetail.domain.MydoJobDetail;
|
||||
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.domain.RequestLog;
|
||||
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.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.common.core.domain.AjaxResult.error;
|
||||
import static com.ruoyi.common.core.domain.AjaxResult.success;
|
||||
import static java.util.Locale.filter;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ApiWcsService {
|
||||
|
||||
@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 IInTrayMsgService inTrayMsgService;
|
||||
//库存
|
||||
@Autowired
|
||||
private IBasStockService basStockService;
|
||||
@Autowired
|
||||
private IBasStockInfoService basStockInfoService;
|
||||
@Autowired
|
||||
IRequestLogService requestLogService;
|
||||
|
||||
|
||||
/**
|
||||
* 呼叫可用容器出库
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult callContainerOut(int type){
|
||||
|
||||
//获取库存主表种所有可用容器,包括空托盘和非空且有余位的托盘
|
||||
List<BasStockInfo> stockInfos = basStockInfoService.selectBasStockInfoList(
|
||||
new BasStockInfo().builder().trayType(type).build()
|
||||
);
|
||||
stockInfos = stockInfos.stream()
|
||||
.filter(s -> s.getEmptyStatus() != 0)
|
||||
.sorted(Comparator.comparing(BasStockInfo::getEmptyStatus))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
//按托盘余位出库,优先有货未放满的托盘
|
||||
//获取指定托盘类型的所有库存
|
||||
// List<BasStock> stocks = basStockService.selectBasStockList(
|
||||
// new BasStock().builder().trayType(type).build()
|
||||
// );
|
||||
// stocks = stocks.stream()
|
||||
// .sorted(Comparator.comparing(BasStock::getAvailablePlace))//排序会优先筛选已放货但未放满的托盘
|
||||
// .filter(s -> s.getAvailablePlace() > 0)
|
||||
// .filter(s -> s.getStockStatus().equals(1))
|
||||
// .collect(Collectors.toList());
|
||||
|
||||
if (stockInfos.isEmpty()){
|
||||
return AjaxResult.error("没有可用托盘容器");
|
||||
}else{
|
||||
//要出库的库存
|
||||
BasStockInfo stockInfo = stockInfos.get(0);
|
||||
String jobId = basJobIdService.getId(JobIdType.MYDOJOB_STOCKOUT_EMPTY_PALLET);
|
||||
//判断托盘【未满】或【空】区分任务类型
|
||||
int taskType = stockInfo.getEmptyStatus() == 1 ? TaskType.TASKTYPE_STOCKOUT_CONTAINER : TaskType.TASKTYPE_STOCKOUT_EMPTY_TRAY;
|
||||
|
||||
MydoJob mydoJob = new MydoJob().builder()
|
||||
.jobId(jobId)
|
||||
.inOrOut(taskType)
|
||||
.trayCode(stockInfo.getTrayCode())
|
||||
.status(TaskStatusEnum.READY.getCode())
|
||||
.trayType(type)
|
||||
.warehouseId("01")
|
||||
.build();
|
||||
mydoJobService.insertMydoJob(mydoJob);
|
||||
|
||||
//todo 空托盘或余位托盘出库有无子任务?
|
||||
// MydoJobDetail md = new MydoJobDetail().builder()
|
||||
// .jobId(jobId)
|
||||
// .jobDetailId(jobId + 1)
|
||||
// .trayType(type)
|
||||
// .stockQuantity(Convert.toInt(stock.getQuantity()))
|
||||
// .build();
|
||||
|
||||
|
||||
//初始化参数
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("reqCode", UUID.randomUUID().toString());//请求码
|
||||
paramMap.put("trayCode", mydoJob.getTrayCode());//容器编号
|
||||
paramMap.put("jobId", mydoJob.getJobId());
|
||||
paramMap.put("inOrOut", mydoJob.getInOrOut());
|
||||
paramMap.put("cargoSpaceId", mydoJob.getCargoSpaceId());
|
||||
paramMap.put("trayType", mydoJob.getTrayType());//高度
|
||||
paramMap.put("remark", "");
|
||||
|
||||
AjaxResult ajaxResult = sendOutMydoJob(paramMap);
|
||||
if (ajaxResult.isSuccess()){
|
||||
log.info("【推送出库】<容器>出库,作业号:{},货位:{},托盘号:{}", jobId, mydoJob.getCargoSpaceId(), mydoJob.getTrayCode());
|
||||
mydoJob.setStatus(TaskStatusEnum.RUNNING.getCode());
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
|
||||
//标记库存状态【冻结/占用】
|
||||
List<BasStock> stocks =basStockService.selectBasStockList(
|
||||
new BasStock().builder().trayCode(stockInfo.getTrayCode()).build()
|
||||
);
|
||||
for (BasStock stock : stocks){
|
||||
stock.setStockStatus(StockStatusEnum.OCCUPIED.getCode());
|
||||
basStockService.updateBasStock(stock);
|
||||
}
|
||||
|
||||
//货位状态更新
|
||||
basCargoSpaceService.updateBasCargoSpaceStatus(stockInfo.getCargoSpaceId(), stockInfo.getTrayCode(), CargoSpaceCode.CARGOSPACE_STATUS_PRE_STOCKOUT);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 响应wcs请求-下发入库任务
|
||||
* @param wcsStockinReiceive
|
||||
* @return
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult requestMydoJobByTrayCode(WcsStockinReceive wcsStockinReiceive) {
|
||||
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wcsStockinReiceive), "wcs请求入库作业");
|
||||
requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success()));
|
||||
requestLog.setResponseStatus("0");
|
||||
requestLog.setIsSuccessful("1");
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
|
||||
int 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.size() == 0){
|
||||
log.warn("【入库请求】未找到该托盘的绑定信息,请确认是否有绑定操作,托盘条码:{}", wcsStockinReiceive.getTrayCode());
|
||||
return AjaxResult.error("未找到该托盘的绑定信息,请确认是否有绑定操作");
|
||||
}
|
||||
|
||||
//入库货位分配
|
||||
BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceForStockin(
|
||||
new BasCargoSpace().builder().roadwayId(wcsStockinReiceive.getRoadwayId()).theType(type).build()
|
||||
);
|
||||
if (cargoSpace == null) {
|
||||
log.warn("【货位分配】该类型托盘立库中无可用货位");
|
||||
return AjaxResult.error("【货位分配失败】该类型托盘立库中无可用货位");
|
||||
}
|
||||
|
||||
String jobId;
|
||||
String taskNo;
|
||||
int taskType;
|
||||
String instockinId;
|
||||
String instockinDetailId;
|
||||
|
||||
//判断入库类型
|
||||
if (trayMsgs.get(0).getProductId().equals(ProductType.EMPTY_TRAY)){
|
||||
jobId = basJobIdService.getId(JobIdType.MYDOJOB_STOCKIN_EMPTY_PALLET);
|
||||
taskNo = basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKIN_EMPTY_PALLET);
|
||||
taskType = TaskType.TASKTYPE_STOCKIN_EMPTY_TRAY;
|
||||
}else{
|
||||
jobId = basJobIdService.getId(JobIdType.MYDOJOB_STOCKIN);
|
||||
taskNo = basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKIN);
|
||||
taskType = TaskType.TASKTYPE_STOCKIN;
|
||||
}
|
||||
|
||||
//>>>生成wms的入库主作业
|
||||
MydoJob mydoJob = new MydoJob().builder()
|
||||
.jobId(jobId)
|
||||
.taskNo(taskNo)
|
||||
.status(TaskStatusEnum.READY.getCode())
|
||||
.executionPhase("0")
|
||||
.inOrOut(taskType)
|
||||
.trayCode(wcsStockinReiceive.getTrayCode())
|
||||
.entranceId(wcsStockinReiceive.getEntranceId())
|
||||
.roadwayId(wcsStockinReiceive.getRoadwayId())
|
||||
.cargoSpaceId(cargoSpace.getCargoSpaceId())
|
||||
.cargoSpaceName(cargoSpace.getCargoSpaceName())
|
||||
.trayType(type)
|
||||
.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()){
|
||||
|
||||
if (trayMsg.getProductId().equals(ProductType.EMPTY_TRAY)){
|
||||
instockinId = null;
|
||||
instockinDetailId = null;
|
||||
}else {
|
||||
instockinId = trayMsg.getStockinId();
|
||||
instockinDetailId = trayMsg.getStockinDetailId() + sum;
|
||||
}
|
||||
|
||||
MydoJobDetail detail = new MydoJobDetail().builder()
|
||||
.jobId(jobId)
|
||||
.jobDetailId(jobId + "-" + sum)
|
||||
.inQuantity(1)
|
||||
.productId(trayMsg.getProductId())
|
||||
.productName(basProductService.selectBasProductByProductId(trayMsg.getProductId()).getProductName())
|
||||
.rollerNumber(trayMsg.getRollerNumber())
|
||||
.inDate(mydoJob.getCreateTime())
|
||||
.inOrOutId(instockinId)
|
||||
.inOrOutDId(instockinDetailId)
|
||||
.stockinId(instockinId)
|
||||
.stockinDetailId(instockinDetailId)
|
||||
.status("1")
|
||||
.trayType(mydoJob.getTrayType())
|
||||
.build();
|
||||
sum++;
|
||||
mydoJobDetailService.insertMydoJobDetail(detail);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//货位状态更新为【入库预占用】
|
||||
cargoSpace.setStatus(CargoSpaceCode.CARGOSPACE_STATUS_PRE_STOCKIN);
|
||||
basCargoSpaceService.insertBasCargoSpace(cargoSpace);
|
||||
|
||||
//返回wcs的响应信息
|
||||
WcsStockinResponse response = new WcsStockinResponse()
|
||||
.builder()
|
||||
.reqCode(wcsStockinReiceive.getTrayCode())
|
||||
.jobId(jobId)
|
||||
.taskNo(taskNo)
|
||||
.taskType(taskType)
|
||||
.trayCode(wcsStockinReiceive.getTrayCode())
|
||||
.cargoSpaceId(cargoSpace.getCargoSpaceId())
|
||||
.build();
|
||||
|
||||
log.info("【wms请求响应】<常规入库>响应信息,作业号:{},任务号:{},分配货位:{}",mydoJob.getJobId() ,mydoJob.getTaskNo(), mydoJob.getCargoSpaceId());
|
||||
|
||||
return AjaxResult.success(response);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//todo 补码
|
||||
/**
|
||||
* 请求补码作业
|
||||
* @param wcsStockinReiceive
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
public AjaxResult requestMydoJobManual(WcsStockinReceive wcsStockinReiceive) {
|
||||
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wcsStockinReiceive), "补码请求入库作业");
|
||||
requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success()));
|
||||
requestLog.setResponseStatus("0");
|
||||
requestLog.setIsSuccessful("1");
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
|
||||
int type = mydoJobService.getTrayTypeByTrayCode(wcsStockinReiceive.getTrayCode());
|
||||
|
||||
//查绑定信息
|
||||
List<InTrayMsg> trayMsgs = inTrayMsgService.selectInTrayMsgList(
|
||||
new InTrayMsg().builder().trayCode(wcsStockinReiceive.getTrayCode()).build()
|
||||
);
|
||||
|
||||
if (trayMsgs.size() == 0){
|
||||
log.warn("【补码请求】未找到该托盘的绑定信息,请确认绑定后进行补码操作,托盘条码:{}", wcsStockinReiceive.getTrayCode());
|
||||
return AjaxResult.error("未找到该托盘的绑定信息,请确认绑定后进行补码操作");
|
||||
}
|
||||
|
||||
//通过绑定信息的物料编码获取任务类型
|
||||
String jobId;
|
||||
String taskNo;
|
||||
int taskType;
|
||||
|
||||
if (trayMsgs.get(0).getProductId() == ProductType.EMPTY_TRAY){
|
||||
jobId = basJobIdService.getId(JobIdType.MYDOJOB_STOCKIN_EMPTY_PALLET);
|
||||
taskNo = basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKIN_EMPTY_PALLET);
|
||||
taskType = TaskType.TASKTYPE_STOCKIN_EMPTY_TRAY;
|
||||
}else{
|
||||
jobId = basJobIdService.getId(JobIdType.MYDOJOB_STOCKIN);
|
||||
taskNo = basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKIN);
|
||||
taskType = 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 = basCargoSpaceService.selectBasCargoSpaceForStockin(
|
||||
new BasCargoSpace().builder().roadwayId(wcsStockinReiceive.getRoadwayId()).theType(type).build()
|
||||
);
|
||||
|
||||
//生成wms的入库主作业
|
||||
MydoJob mydoJob = new MydoJob().builder()
|
||||
.jobId(jobId)
|
||||
.taskNo(taskNo)
|
||||
.status(TaskStatusEnum.READY.getCode())
|
||||
.executionPhase("0")
|
||||
.inOrOut(taskType)
|
||||
.trayCode(wcsStockinReiceive.getTrayCode())
|
||||
.entranceId(wcsStockinReiceive.getEntranceId())
|
||||
.roadwayId(wcsStockinReiceive.getRoadwayId())
|
||||
.cargoSpaceId(cargoSpace.getCargoSpaceId())
|
||||
.cargoSpaceName(cargoSpace.getCargoSpaceName())
|
||||
.trayType(type)
|
||||
.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(jobId)
|
||||
.jobDetailId(taskNo + "-" + sum)
|
||||
.inQuantity(1)
|
||||
.productId(trayMsg.getProductId())
|
||||
.productName(basProductService.selectBasProductByProductId(trayMsg.getProductId()).getProductName())
|
||||
.inDate(mydoJob.getCreateTime())
|
||||
.inOrOutId(trayMsg.getStockinId())
|
||||
.inOrOutDId(trayMsg.getStockinDetailId() + sum)
|
||||
.stockinId(trayMsg.getStockinId())
|
||||
.stockinDetailId(trayMsg.getStockinDetailId() + sum)
|
||||
.status("1")
|
||||
.trayType(mydoJob.getTrayType())
|
||||
.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("【补码请求】<补码入库>响应信息,作业号:{},任务号:{},分配货位:{}",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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wcs任务回传
|
||||
* @param wmsJobRequest
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult jobFinish(WmsJobRequest wmsJobRequest) {
|
||||
|
||||
MydoJob mydoJobParam = mydoJobService.selectMydoJobByJobId(wmsJobRequest.getJobId());
|
||||
|
||||
if (StrUtil.isEmpty(wmsJobRequest.getJobId())) {
|
||||
log.warn("【wcs任务上报】请求异常,作业号为空!");
|
||||
return AjaxResult.error("作业号不能为空");
|
||||
}
|
||||
|
||||
if (ObjUtil.isEmpty(mydoJobParam)) {
|
||||
log.warn("【wcs任务上报】找不到该任务,请核对任务状态,作业号:{}", wmsJobRequest.getJobId());
|
||||
return AjaxResult.error("找不到该任务,请核对任务状态");
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(wmsJobRequest.getTrayCode())) {
|
||||
log.warn("【wcs任务上报】请求异常,托盘条码为空!");
|
||||
return AjaxResult.error("条码不能为空");
|
||||
}
|
||||
|
||||
|
||||
//根据任务类型处理账务
|
||||
switch (wmsJobRequest.getWmsType()) {
|
||||
//入库
|
||||
case "1":
|
||||
//自动完成任务
|
||||
mydoJobService.autoCompleteJob(wmsJobRequest.getJobId(), wmsJobRequest.getWmsType());
|
||||
break;
|
||||
//出库
|
||||
case "2":
|
||||
//自动完成任务
|
||||
mydoJobService.autoCompleteJob(wmsJobRequest.getJobId(), wmsJobRequest.getWmsType());
|
||||
break;
|
||||
|
||||
default:
|
||||
log.error("【wcs任务完成上报】执行失败,作业类型错误");
|
||||
return AjaxResult.error(MessageUtils.message("执行失败,作业类型错误"));
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 放货有货 - 入库重分
|
||||
* @param reMaterialParam
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult reAssign(ReMaterialParam reMaterialParam) {
|
||||
|
||||
//重新分配货位
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(reMaterialParam.getJobId());
|
||||
|
||||
String warehouseId = mydoJob.getWarehouseId();
|
||||
BasCargoSpace basCargoSpaceParam = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(reMaterialParam.getCargoSpaceId());
|
||||
|
||||
//标记异常货位状态
|
||||
if (basCargoSpaceParam != null) {
|
||||
basCargoSpaceParam.setStatus(CargoSpaceCode.CARGOSPACE_STATUS_EXCEPTION);
|
||||
basCargoSpaceService.updateBasCargoSpace(basCargoSpaceParam);
|
||||
}
|
||||
|
||||
//重新查找可用货位
|
||||
BasCargoSpace newCargoSpace = basCargoSpaceService.selectBasCargoSpaceForStockin(
|
||||
new BasCargoSpace().builder().roadwayId(mydoJob.getRoadwayId()).theType(mydoJob.getTrayType()).build()
|
||||
);
|
||||
|
||||
if (newCargoSpace == null) {
|
||||
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
|
||||
*/
|
||||
@Transactional
|
||||
public AjaxResult reMaterial(ReMaterialParam reMaterialParam) {
|
||||
|
||||
//>>>重新分配物料<<<
|
||||
//获取上报的异常任务jobId
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推送入库回流作业
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult sendReturnMydoJob(Map<String, Object> param) {
|
||||
|
||||
RequestLog requestLog = requestLogService.getRequestLog(WcsUrl.PUSH_IN_MYDO_JOB, "推送入库回流作业", JSONUtil.toJsonStr(param));
|
||||
requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success()));
|
||||
requestLog.setResponseStatus("0");
|
||||
requestLog.setIsSuccessful("1");
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
|
||||
public AjaxResult sendOutMydoJob(Map<String, Object> param) {
|
||||
|
||||
RequestLog requestLog = requestLogService.getRequestLog(WcsUrl.PUSH_OUT_MYDO_JOB, "推送出库作业", JSONUtil.toJsonStr(param));
|
||||
requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success()));
|
||||
requestLog.setResponseStatus("0");
|
||||
requestLog.setIsSuccessful("1");
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
public AjaxResult sendMoveMydoJob(Map<String, Object> param) {
|
||||
|
||||
RequestLog requestLog = requestLogService.getRequestLog(WcsUrl.PUSH_MOVE_MYDO_JOB, "推送移库作业", JSONUtil.toJsonStr(param));
|
||||
requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success()));
|
||||
requestLog.setResponseStatus("0");
|
||||
requestLog.setIsSuccessful("1");
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
|
||||
public AjaxResult sendEmptyTrayOutMydoJob(Map<String, Object> param) {
|
||||
|
||||
RequestLog requestLog = requestLogService.getRequestLog(WcsUrl.PUSH_OUT_MYDO_JOB, "推送容器出库作业", JSONUtil.toJsonStr(param));
|
||||
requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success()));
|
||||
requestLog.setResponseStatus("0");
|
||||
requestLog.setIsSuccessful("1");
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.ruoyi.api.service;
|
||||
|
||||
import com.ruoyi.api.domain.ErpStock.ErpStockParam;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
public interface IApiErpService {
|
||||
|
||||
/**
|
||||
* 响应erp请求-推送入库单据
|
||||
* @param erpStockParam
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult receiveErpStockinBill(ErpStockParam erpStockParam);
|
||||
|
||||
/**
|
||||
* 响应erp请求-推送出库单据
|
||||
* @param erpStockParam
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult receiveErpStockoutBill(ErpStockParam erpStockParam);
|
||||
|
||||
/**
|
||||
* 发起erp请求-单据完成上报
|
||||
* @param docNumber ERP下发单号
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult sendErpStockBillFinish(String docNumber);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.ruoyi.api.service;
|
||||
|
||||
import com.ruoyi.api.domain.wcsJobHandle.WmsJobHandler;
|
||||
import com.ruoyi.api.domain.wcsStockin.WcsStockinReceive;
|
||||
import com.ruoyi.api.domain.wcsStockout.WcsStockoutParam;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface IApiWcsService {
|
||||
|
||||
/**
|
||||
* 呼叫可用容器出库
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult callContainerOut(String cargoAreaId, Integer type);
|
||||
|
||||
/**
|
||||
* 响应wcs请求-下发入库任务
|
||||
* @param wcsStockinReiceive
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult requestMydoJobByTrayCode(WcsStockinReceive wcsStockinReiceive);
|
||||
|
||||
/**
|
||||
* 响应wcs请求-分配货位
|
||||
* @param wcsStockinReiceive
|
||||
* @return
|
||||
*/
|
||||
// public AjaxResult requestMydoJobForCargoSpace(WcsStockinReceive wcsStockinReiceive);
|
||||
|
||||
/**
|
||||
* 请求补码作业
|
||||
* @param wcsStockinReiceive
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult requestMydoJobManual(WcsStockinReceive wcsStockinReiceive);
|
||||
|
||||
/**
|
||||
* wcs任务回传
|
||||
* @param wmsJobHandler
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult jobFinish(WmsJobHandler wmsJobHandler);
|
||||
|
||||
/**
|
||||
* 放货有货 - 入库重分
|
||||
* @param wmsJobHandler
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult reAssign(WmsJobHandler wmsJobHandler);
|
||||
|
||||
/**
|
||||
* 取货无货 - 重分物料
|
||||
* @param wmsJobHandler
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult reMaterial(WmsJobHandler wmsJobHandler);
|
||||
|
||||
/**
|
||||
* 推送入库回流作业
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult sendReturnMydoJob(Map<String, Object> param);
|
||||
|
||||
public AjaxResult sendOutMydoJob(Map<String, Object> param);
|
||||
|
||||
public AjaxResult sendMoveMydoJob(Map<String, Object> param);
|
||||
|
||||
public AjaxResult sendEmptyTrayOutMydoJob(Map<String, Object> param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
package com.ruoyi.api.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.api.domain.ErpStock.ErpStockDetail;
|
||||
import com.ruoyi.api.domain.ErpStock.ErpStockParam;
|
||||
import com.ruoyi.api.service.IApiErpService;
|
||||
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.stock.service.IBasStockService;
|
||||
import com.ruoyi.common.StockStatusEnum;
|
||||
import com.ruoyi.common.JobIdType;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
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.stockin.domain.InStockin;
|
||||
import com.ruoyi.in.stockindetail.domain.InStockinDetail;
|
||||
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.domain.OutStockout;
|
||||
import com.ruoyi.out.stockout.service.IOutStockoutService;
|
||||
import com.ruoyi.out.stockoutdetail.domain.OutStockoutDetail;
|
||||
import com.ruoyi.out.stockoutdetail.service.IOutStockoutDetailService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ApiErpService implements IApiErpService {
|
||||
|
||||
@Autowired
|
||||
private IMydoJobService mydoJobService;
|
||||
@Autowired
|
||||
private IMydoJobDetailService mydoJobDetailService;
|
||||
@Autowired
|
||||
private IBasTaskNoService basTaskNoService;
|
||||
@Autowired
|
||||
private IBasCargoSpaceService basCargoSpaceService;
|
||||
@Autowired
|
||||
private IOutStockoutService outStockoutService;
|
||||
@Autowired
|
||||
IOutStockoutDetailService outStockoutDetailService;
|
||||
@Autowired
|
||||
private IBasProductService basProductService;
|
||||
@Autowired
|
||||
private IBasJobIdService basJobIdService;
|
||||
@Autowired
|
||||
private IInStockinService inStockinService;
|
||||
@Autowired
|
||||
private IInStockinDetailService inStockinDetailService;
|
||||
//条码绑定
|
||||
@Autowired
|
||||
private IInTrayMsgService inTrayMsgService;
|
||||
//库存
|
||||
@Autowired
|
||||
private IBasStockService basStockService;
|
||||
@Autowired
|
||||
IRequestLogService requestLogService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 响应erp请求-推送入库单据
|
||||
* @param erpStockParam
|
||||
* @return
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult receiveErpStockinBill(ErpStockParam erpStockParam) {
|
||||
|
||||
//>>>接收并处理单据主信息
|
||||
String docNo = erpStockParam.getDocNumber();
|
||||
if (StrUtil.isBlank(docNo)) {
|
||||
log.error("【ERP请求】请求异常,单据号空");
|
||||
return AjaxResult.error("【ERP请求】请求异常,单据号空");
|
||||
}
|
||||
|
||||
log.info("【ERP请求】推送入库单据,单据号:{}", docNo);
|
||||
|
||||
//>>>遍历处理明细信息
|
||||
if (erpStockParam.getDetails().isEmpty()) {
|
||||
log.error("【ERP请求】请求异常,单据明细空,单据号:{}", docNo);
|
||||
return AjaxResult.error("【ERP请求】请求异常,单据明细空");
|
||||
|
||||
}
|
||||
|
||||
//>>>生成入库单据主表
|
||||
List<InStockin> stockinList = inStockinService.selectInStockinList(
|
||||
new InStockin().builder().erpBill(docNo).build()
|
||||
);
|
||||
if (!stockinList.isEmpty()) {
|
||||
log.error("【ERP请求】请求异常,已经存在当前编号的入库单据,单据号:{}", docNo);
|
||||
return AjaxResult.error("【ERP请求】请求异常,已经存在当前编号的入库单据");
|
||||
}
|
||||
String stockinId = basJobIdService.getId(JobIdType.JOB_RECEIVE_LIST_STOCKIN);
|
||||
inStockinService.insertInStockin(
|
||||
new InStockin().builder()
|
||||
.stockinId((stockinId))
|
||||
.inType("1")
|
||||
.stockSource("ERP")
|
||||
.status(StockStatusEnum.CREATE.getCode())
|
||||
.createDate(DateUtil.date())
|
||||
.erpBill(docNo)
|
||||
.warehouseId("01")
|
||||
.warehouseName("立体库")
|
||||
.userId(1L)
|
||||
.userName("admin")
|
||||
.deptId(1L)
|
||||
.deptName("运城其尚")
|
||||
.supplierId("1")
|
||||
.supplierName("运城制版")
|
||||
.build()
|
||||
);
|
||||
|
||||
log.info("【ERP请求】推送入库单据,wms入库单号:{},ERP单号:{}", stockinId, docNo);
|
||||
|
||||
|
||||
//>>>生成入库单据明细
|
||||
for (ErpStockDetail detail : erpStockParam.getDetails()) {
|
||||
inStockinDetailService.insertInStockinDetail(
|
||||
new InStockinDetail().builder()
|
||||
.stockinId(stockinId)
|
||||
.stockinDetailId(stockinId + "-" + detail.getNumber())
|
||||
.status(0)
|
||||
.quantity(new BigDecimal(1))
|
||||
.scanNum(new BigDecimal(0))
|
||||
.assignNum(new BigDecimal(0))
|
||||
.rollerNumber(detail.getRollerNumber())
|
||||
.colorSequence(detail.getColorSequence())
|
||||
.color(detail.getColor())
|
||||
.spec(detail.getSpec())
|
||||
.build()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
return AjaxResult.success("操作成功,erp入库单据:" + docNo);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 响应erp请求-推送出库单据
|
||||
* @param erpStockParam
|
||||
* @return
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult receiveErpStockoutBill(ErpStockParam erpStockParam) {
|
||||
|
||||
//>>>接收并处理单据主信息
|
||||
String docNo = erpStockParam.getDocNumber();
|
||||
if (StrUtil.isBlank(docNo)) {
|
||||
log.error("【ERP请求】请求异常,单据号空");
|
||||
return AjaxResult.error("【ERP请求】请求异常,单据号空");
|
||||
}
|
||||
|
||||
log.info("【ERP请求】推送出库单据,单据号:{}", docNo);
|
||||
|
||||
//>>>遍历处理明细信息
|
||||
if (erpStockParam.getDetails().isEmpty()) {
|
||||
log.error("【ERP请求】请求异常,单据明细空,单据号:{}", docNo);
|
||||
return AjaxResult.error("【ERP请求】请求异常,单据明细空");
|
||||
|
||||
}
|
||||
|
||||
//>>>生成出库单据主表
|
||||
List<OutStockout> stockoutList = outStockoutService.selectOutStockoutList(
|
||||
new OutStockout().builder().erpBill(docNo).build()
|
||||
);
|
||||
if (!stockoutList.isEmpty()) {
|
||||
log.error("【ERP请求】请求异常,已经存在当前编号的出库单据,单据号:{}", docNo);
|
||||
return AjaxResult.error("【ERP请求】请求异常,已经存在当前编号的出库单据");
|
||||
}
|
||||
String stockoutId = basJobIdService.getId(JobIdType.JOB_RECEIVE_LIST_STOCKOUT);
|
||||
outStockoutService.insertOutStockout(
|
||||
new OutStockout().builder()
|
||||
.stockoutId((stockoutId))
|
||||
.outType("1")
|
||||
.stockSource("ERP")
|
||||
.status(StockStatusEnum.CREATE.getCode())
|
||||
.createDate(DateUtil.date())
|
||||
.erpBill(docNo)
|
||||
.warehouseId("01")
|
||||
.warehouseName("立体库")
|
||||
.userId(1L)
|
||||
.userName("admin")
|
||||
.deptId(1L)
|
||||
.deptName("运城其尚")
|
||||
.customerId("1")
|
||||
.customerName("运城制版")
|
||||
.build()
|
||||
);
|
||||
|
||||
log.info("【ERP请求】推送出库单据,wms出库单号:{},ERP单号:{}", stockoutId, docNo);
|
||||
|
||||
|
||||
//>>>生成出库单据明细
|
||||
for (ErpStockDetail detail : erpStockParam.getDetails()) {
|
||||
outStockoutDetailService.insertOutStockoutDetail(
|
||||
new OutStockoutDetail().builder()
|
||||
.stockoutId(stockoutId)
|
||||
.stockoutDetailId(stockoutId + "-" + detail.getNumber())
|
||||
.status(0)
|
||||
.quantity(new BigDecimal(1))
|
||||
.allotNum(new BigDecimal(0))
|
||||
.assignNum(new BigDecimal(0))
|
||||
.productId(detail.getRollerNumber())
|
||||
.rollerNumber(detail.getRollerNumber())
|
||||
.colorSequence(detail.getColorSequence())
|
||||
.color(detail.getColor())
|
||||
.spec(detail.getSpec())
|
||||
.build()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
return AjaxResult.success("操作成功,erp出库单据:" + docNo);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 单据完成请求上报ERP
|
||||
* @param docNumber ERP下发单号
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult sendErpStockBillFinish(String docNumber){
|
||||
|
||||
|
||||
|
||||
|
||||
log.info("【单据完成上报】回传成功,ERP单号:{}", docNumber);
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.ruoyi.api.service;
|
||||
package com.ruoyi.api.service.impl;
|
||||
|
||||
import com.ruoyi.api.domain.ApiLog;
|
||||
import org.slf4j.Logger;
|
||||
@@ -0,0 +1,838 @@
|
||||
package com.ruoyi.api.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.UUID;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.api.domain.wcsJobHandle.WmsJobHandler;
|
||||
import com.ruoyi.api.domain.wcsStockin.WcsStockinReceive;
|
||||
import com.ruoyi.api.domain.wcsStockin.WcsStockinResponse;
|
||||
import com.ruoyi.api.domain.wcsStockout.WcsStockoutParam;
|
||||
import com.ruoyi.api.service.IApiWcsService;
|
||||
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.product.service.IBasProductService;
|
||||
import com.ruoyi.bas.stock.domain.BasStock;
|
||||
import com.ruoyi.bas.stock.domain.BasStockInfo;
|
||||
import com.ruoyi.bas.stock.service.IBasStockInfoService;
|
||||
import com.ruoyi.bas.stock.service.IBasStockService;
|
||||
import com.ruoyi.common.*;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
import com.ruoyi.in.bind.domain.InTrayMsg;
|
||||
import com.ruoyi.in.bind.service.IInTrayMsgService;
|
||||
import com.ruoyi.in.job.domain.MydoJob;
|
||||
import com.ruoyi.in.job.service.IMydoJobService;
|
||||
import com.ruoyi.in.jobdetail.domain.MydoJobDetail;
|
||||
import com.ruoyi.in.jobdetail.service.IMydoJobDetailService;
|
||||
import com.ruoyi.kpi.domain.BasCargoSpaceStatus;
|
||||
import com.ruoyi.log.domain.RequestLog;
|
||||
import com.ruoyi.log.service.IRequestLogService;
|
||||
import com.ruoyi.out.stockout.service.IOutStockoutService;
|
||||
import com.ruoyi.out.stockoutdetail.domain.OutStockoutDetail;
|
||||
import com.ruoyi.out.stockoutdetail.service.IOutStockoutDetailService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.common.core.domain.AjaxResult.error;
|
||||
import static com.ruoyi.common.core.domain.AjaxResult.success;
|
||||
import static java.util.Locale.filter;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ApiWcsService implements IApiWcsService {
|
||||
|
||||
@Autowired
|
||||
private IMydoJobService mydoJobService;
|
||||
@Autowired
|
||||
private IMydoJobDetailService mydoJobDetailService;
|
||||
@Autowired
|
||||
private IBasTaskNoService basTaskNoService;
|
||||
@Autowired
|
||||
private IBasCargoSpaceService basCargoSpaceService;
|
||||
@Autowired
|
||||
private IOutStockoutService outStockoutService;
|
||||
@Autowired
|
||||
private IOutStockoutDetailService outStockoutDetailService;
|
||||
@Autowired
|
||||
private IBasProductService basProductService;
|
||||
@Autowired
|
||||
private IBasJobIdService basJobIdService;
|
||||
//条码绑定
|
||||
@Autowired
|
||||
private IInTrayMsgService inTrayMsgService;
|
||||
//库存
|
||||
@Autowired
|
||||
private IBasStockService basStockService;
|
||||
@Autowired
|
||||
private IBasStockInfoService basStockInfoService;
|
||||
@Autowired
|
||||
IRequestLogService requestLogService;
|
||||
|
||||
|
||||
/**
|
||||
* 呼叫可用容器出库
|
||||
* @return
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult callContainerOut(String cargoAreaId, Integer type){
|
||||
|
||||
//获取立库区域和托盘类型
|
||||
List<BasCargoSpace> basCargoSpaces = basCargoSpaceService.selectAllBasCargoSpaceForStockout(
|
||||
new BasCargoSpace().builder().cargoAreaId(cargoAreaId).theType(type).build()
|
||||
);
|
||||
|
||||
List<BasStock> stocks = basStockService.selectBasStockList(
|
||||
new BasStock().builder().productId("KTP0001").stockStatus("1").build()
|
||||
);
|
||||
|
||||
if (stocks.isEmpty()) {
|
||||
log.info("【呼叫容器】空容器呼叫失败,无可用的空容器库存");
|
||||
|
||||
//todo 此处可查存放库存较少的托盘出库
|
||||
}else{
|
||||
BasStock stock = stocks.get(0);
|
||||
|
||||
//检查出库货位是否触发移库作业 - 双伸货位出库查询单伸是否有货
|
||||
BasCargoSpace cargoSpaceCurrent = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(stock.getCargoSpaceId());//要出库的货位
|
||||
if (cargoSpaceCurrent.getIssDouble().equals(CargoSpaceCode.CARGOSPACE_ISDOUBLE_Y)){//是否处于双伸位
|
||||
BasCargoSpace cargoSpaceInSide = basCargoSpaceService.selectAnotherBasCargoSpaceBySameGroup(cargoSpaceCurrent);//获取【要出库货位】对应的【单伸货位】
|
||||
//如果外侧有货,先执行移库
|
||||
if (cargoSpaceInSide.getStatus().equals(CargoSpaceCode.CARGOSPACE_STATUS_OCCUPIED)){
|
||||
String moveJobId = basJobIdService.getId(JobIdType.MYDOJOB_MOVE);
|
||||
String moveTaskNo = basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKOUT);
|
||||
BasCargoSpace targetCargo = basCargoSpaceService.selectBasCargoSpaceForStockin(
|
||||
new BasCargoSpace().builder().theType(cargoSpaceCurrent.getTheType()).roadwayId(cargoSpaceCurrent.getRoadwayId()).build()
|
||||
);
|
||||
|
||||
//生成并推送移库
|
||||
MydoJob moveJob = new MydoJob().builder()
|
||||
.jobId(moveJobId)
|
||||
.taskNo(moveTaskNo)
|
||||
.status(TaskStatusEnum.READY.getCode())
|
||||
.inOrOut(TaskType.TASKTYPE_PICK_STOCK_MOVE)
|
||||
.executionPhase("0")
|
||||
.trayCode(cargoSpaceInSide.getTrayCode())
|
||||
.trayType(cargoSpaceInSide.getTheType())
|
||||
.roadwayId(cargoSpaceInSide.getRoadwayId())
|
||||
.cargoSpaceId(cargoSpaceInSide.getCargoSpaceId())
|
||||
.targetCargoSpaceId(targetCargo.getCargoSpaceId())
|
||||
.priority(0)
|
||||
.build();
|
||||
|
||||
log.info("【出库分配】出库双伸货位外侧有货,生成移库作业,作业号:{},移库货位:{},目标货位:{}", moveJobId, cargoSpaceInSide.getCargoSpaceId(), targetCargo.getCargoSpaceId());
|
||||
|
||||
//推送移库
|
||||
AjaxResult ajaxResult;
|
||||
|
||||
/*-----------------推送wcs移库任务----------------- */
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("reqCode", UUID.randomUUID().toString());//请求码
|
||||
paramMap.put("jobId", moveJob.getJobId());//容器编号
|
||||
paramMap.put("taskNo", moveJob.getTaskNo());//容器编号
|
||||
paramMap.put("trayCode", moveJob.getTrayCode());//容器编号
|
||||
paramMap.put("cargoSpaceId", moveJob.getCargoSpaceId());//货位
|
||||
paramMap.put("targetCargoSpaceId", moveJob.getTargetCargoSpaceId());//目标货位
|
||||
paramMap.put("inOrOut", moveJob.getInOrOut());//任务类型
|
||||
paramMap.put("priority", 0);//任务优先级
|
||||
|
||||
ajaxResult = sendMoveMydoJob(paramMap);
|
||||
log.info(
|
||||
"【空托出库-移库】推送wcs移库作业,作业号:{},托盘条码:{},移库货位:{},目标货位:{}", moveJob.getJobId(), moveJob.getTrayCode(), moveJob.getCargoSpaceId(), moveJob.getTargetCargoSpaceId()
|
||||
);
|
||||
if (ajaxResult.isSuccess()){
|
||||
|
||||
//生成托盘主作业
|
||||
mydoJobService.insertMydoJob(moveJob);
|
||||
|
||||
log.info(
|
||||
"【空托出库-移库】推送成功,作业号:{},托盘条码:{},移库货位:{},目标货位:{}", moveJob.getJobId(), moveJob.getTrayCode(), moveJob.getCargoSpaceId(), moveJob.getTargetCargoSpaceId()
|
||||
);
|
||||
|
||||
//更新库存表货位【占用】状态
|
||||
stock.setStockStatus(BasStockCode.STOCK_STATUS_OCCUPIED);
|
||||
basStockService.updateBasStock(stock);
|
||||
|
||||
//更新货位表【预占用】状态
|
||||
basCargoSpaceService.updateBasCargoSpaceStatus(cargoSpaceInSide.getCargoSpaceId(),cargoSpaceInSide.getTrayCode(),CargoSpaceCode.CARGOSPACE_STATUS_PRE_STOCKOUT);
|
||||
basCargoSpaceService.updateBasCargoSpaceStatus(targetCargo.getCargoSpaceId(),cargoSpaceInSide.getTrayCode(),CargoSpaceCode.CARGOSPACE_STATUS_PRE_STOCKIN);
|
||||
|
||||
}
|
||||
|
||||
// return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (basCargoSpaces.stream().anyMatch(s -> s.getCargoSpaceId().equals(stock.getCargoSpaceId()))) {
|
||||
//生成空托出库作业
|
||||
if (mydoJobService.selectMydoJobByTrayCode(stock.getTrayCode()) == null) {
|
||||
//库存号 - 用于获取托盘号
|
||||
BasStockInfo stockInfo = basStockInfoService.selectBasStockInfoByStockId(stock.getStockId());
|
||||
//作业号
|
||||
String jobId = basJobIdService.getId(JobIdType.MYDOJOB_STOCKOUT_EMPTY_PALLET);
|
||||
String taskNo = basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKOUT_EMPTY_PALLET);
|
||||
//判断托盘【未满】或【空】区分任务类型
|
||||
int taskType = TaskType.TASKTYPE_STOCKOUT_EMPTY_TRAY;
|
||||
MydoJob mydoJob = new MydoJob().builder()
|
||||
.jobId(jobId)
|
||||
.taskNo(taskNo)
|
||||
.inOrOut(taskType)
|
||||
.trayCode(stockInfo.getTrayCode())
|
||||
.status(TaskStatusEnum.READY.getCode())
|
||||
.cargoSpaceId(stock.getCargoSpaceId())
|
||||
.trayType(type)
|
||||
.executionPhase("0")
|
||||
.warehouseId("01")
|
||||
.build();
|
||||
mydoJobService.insertMydoJob(mydoJob);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 响应wcs请求-下发入库任务
|
||||
* @param wcsStockinReiceive
|
||||
* @return
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult requestMydoJobByTrayCode(WcsStockinReceive wcsStockinReiceive) {
|
||||
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wcsStockinReiceive), "wcs请求入库作业");
|
||||
requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success()));
|
||||
requestLog.setResponseStatus("0");
|
||||
requestLog.setIsSuccessful("1");
|
||||
// requestLogService.insertRequestLog(requestLog);
|
||||
|
||||
int type = mydoJobService.getTrayTypeByTrayCode(wcsStockinReiceive.getTrayCode());
|
||||
if (type == 0){
|
||||
log.warn("【wcs请求入库】托盘类型异常,请检查条码格式,条码:{}", wcsStockinReiceive.getTrayCode());
|
||||
return AjaxResult.error("托盘类型异常,请检查条码格式");
|
||||
}
|
||||
|
||||
// -------------------------检查推送的任务参数-------------------------
|
||||
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.size() == 0){
|
||||
log.warn("【入库请求】未找到该托盘的绑定信息,请确认是否有绑定操作,托盘条码:{}", wcsStockinReiceive.getTrayCode());
|
||||
return AjaxResult.error("未找到该托盘的绑定信息,请确认是否有绑定操作");
|
||||
}
|
||||
|
||||
//--------------------------- 入库货位分配 ---------------------------
|
||||
//区分高矮货,只能在堆垛机上获取货物高度,高货位可放全部高度的托盘
|
||||
BasCargoSpace cargoParam;
|
||||
if (wcsStockinReiceive.getHeight() == 1){
|
||||
//低货位380H - 不限制高度
|
||||
cargoParam = new BasCargoSpace().builder().theType(type).cargoAreaId(wcsStockinReiceive.getCargoAreaId()).build();
|
||||
}else{
|
||||
//高货位510H - 只能放指定层高的货位
|
||||
cargoParam = new BasCargoSpace().builder().theType(type).cargoAreaId(wcsStockinReiceive.getCargoAreaId()).theHeight(wcsStockinReiceive.getHeight()).build();
|
||||
}
|
||||
BasCargoSpace cargoStockin = basCargoSpaceService.selectBasCargoSpaceForStockin(cargoParam);
|
||||
if (cargoParam == null) {
|
||||
log.warn("【货位分配】该类型托盘立库中无可用货位");
|
||||
return AjaxResult.error("【货位分配失败】该类型托盘立库中无可用货位");
|
||||
}
|
||||
|
||||
String jobId;
|
||||
String taskNo;
|
||||
int taskType;
|
||||
String instockinId;
|
||||
String instockinDetailId;
|
||||
|
||||
//>>>判断入库类型
|
||||
if (trayMsgs.stream().anyMatch(s -> s.getProductId().equals(ProductType.EMPTY_TRAY))){
|
||||
//空托入库
|
||||
jobId = basJobIdService.getId(JobIdType.MYDOJOB_STOCKIN_EMPTY_PALLET);
|
||||
taskNo = basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKIN_EMPTY_PALLET);
|
||||
taskType = TaskType.TASKTYPE_STOCKIN_EMPTY_TRAY;
|
||||
}else{
|
||||
if (trayMsgs.stream().anyMatch(s -> s.getStatus() == 2)){
|
||||
//回流入库
|
||||
jobId = basJobIdService.getId(JobIdType.MYDOJOB_PICK_RETURN);
|
||||
taskNo = basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKIN_BACK);
|
||||
taskType = TaskType.TASKTYPE_PICK_RETURN;
|
||||
}else{
|
||||
//货物入库
|
||||
jobId = basJobIdService.getId(JobIdType.MYDOJOB_STOCKIN);
|
||||
taskNo = basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKIN);
|
||||
taskType = TaskType.TASKTYPE_STOCKIN;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//检查当前条码是否已经生成作业
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTrayCode(wcsStockinReiceive.getTrayCode());
|
||||
|
||||
if (ObjUtil.isEmpty(mydoJob)) {
|
||||
|
||||
//>>>生成wms的入库主作业
|
||||
MydoJob mydoJobNew = new MydoJob().builder()
|
||||
.jobId(jobId)
|
||||
.taskNo(taskNo)
|
||||
.status(TaskStatusEnum.READY.getCode())
|
||||
.warehouseId(cargoStockin.getWarehouseId())
|
||||
.warehouseName("立体库")
|
||||
.executionPhase("0")
|
||||
.inOrOut(taskType)
|
||||
.trayCode(wcsStockinReiceive.getTrayCode())
|
||||
.entranceId(wcsStockinReiceive.getEntranceId())
|
||||
.roadwayId(wcsStockinReiceive.getRoadwayId())
|
||||
.cargoSpaceId(cargoStockin.getCargoSpaceId())
|
||||
.cargoSpaceName(cargoStockin.getCargoSpaceName())
|
||||
.trayType(type)
|
||||
.build();
|
||||
|
||||
mydoJobService.insertMydoJob(mydoJobNew);
|
||||
log.info("【wms生成入库】<空托入库>作业,作业号:{},任务号:{},托盘号:{},分配货位:{}",mydoJobNew.getJobId() ,mydoJobNew.getTaskNo() ,mydoJobNew.getTrayCode(), cargoStockin.getCargoSpaceId());
|
||||
}else{
|
||||
log.info("【提示】<常规入库>wms已存在该条码作业,托盘号:{}",mydoJob.getTrayCode());
|
||||
}
|
||||
|
||||
//>>>根据绑定物料信息条数循环生成子作业,单条绑定信息对应一条子任务
|
||||
int sum = 1;
|
||||
for (InTrayMsg trayMsg : trayMsgs){
|
||||
|
||||
if (trayMsg.getProductId().equals(ProductType.EMPTY_TRAY)){
|
||||
instockinId = null;
|
||||
instockinDetailId = null;
|
||||
|
||||
//空托入库 - 只能有一条子作业
|
||||
List<MydoJobDetail> details = mydoJobDetailService.selectMydoJobDetailList(
|
||||
new MydoJobDetail().builder().productId(trayMsg.getProductId()).build()
|
||||
);
|
||||
if (details.isEmpty()){
|
||||
MydoJobDetail detail = new MydoJobDetail().builder()
|
||||
.jobId(jobId)
|
||||
.jobDetailId(jobId + "-1")
|
||||
.inQuantity(BigDecimal.ONE)
|
||||
.productId(trayMsg.getProductId())
|
||||
.productName(basProductService.selectBasProductByProductId(trayMsg.getProductId()).getProductName())
|
||||
.rollerNumber(trayMsg.getRollerNumber())
|
||||
.inDate(DateUtil.date())
|
||||
.inOrOutId(instockinId)
|
||||
.inOrOutDId(instockinDetailId)
|
||||
.stockinId(instockinId)
|
||||
.stockinDetailId(instockinDetailId)
|
||||
.trayCode(trayMsg.getTrayCode())
|
||||
.status(0)
|
||||
.trayType(trayMsg.getTrayType())
|
||||
.build();
|
||||
mydoJobDetailService.insertMydoJobDetail(detail);
|
||||
}
|
||||
|
||||
}else {
|
||||
instockinId = trayMsg.getStockinId();
|
||||
instockinDetailId = trayMsg.getStockinDetailId() + sum;
|
||||
|
||||
MydoJobDetail detail = mydoJobDetailService.selectMydoJobDetailByRollerNumber(trayMsg.getRollerNumber());
|
||||
|
||||
if (ObjUtil.isNull(detail)){
|
||||
detail = new MydoJobDetail().builder()
|
||||
.jobId(jobId)
|
||||
.jobDetailId(jobId + "-" + sum++)
|
||||
.inQuantity(BigDecimal.ONE)
|
||||
.productId(trayMsg.getProductId())
|
||||
// .productName(basProductService.selectBasProductByProductId(trayMsg.getProductId()).getProductName())
|
||||
.rollerNumber(trayMsg.getRollerNumber())
|
||||
.inDate(DateUtil.date())
|
||||
.inOrOutId(instockinId)
|
||||
.inOrOutDId(instockinDetailId)
|
||||
.stockinId(instockinId)
|
||||
.stockinDetailId(instockinDetailId)
|
||||
.status(0)
|
||||
.trayType(cargoStockin.getTheType())
|
||||
.build();
|
||||
mydoJobDetailService.insertMydoJobDetail(detail);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//货位状态更新为【入库预占用】
|
||||
cargoStockin.setStatus(CargoSpaceCode.CARGOSPACE_STATUS_PRE_STOCKIN);
|
||||
basCargoSpaceService.updateBasCargoSpace(cargoStockin);
|
||||
|
||||
//返回wcs的响应信息
|
||||
WcsStockinResponse response = new WcsStockinResponse()
|
||||
.builder()
|
||||
.reqCode(wcsStockinReiceive.getTrayCode())
|
||||
.jobId(jobId)
|
||||
.taskNo(taskNo)
|
||||
.taskType(taskType)
|
||||
.trayCode(wcsStockinReiceive.getTrayCode())
|
||||
.cargoSpaceId(cargoStockin.getCargoSpaceId())
|
||||
.build();
|
||||
|
||||
log.info("【wms请求响应】<常规入库>响应信息,作业号:{},任务号:{},分配货位:{}",jobId ,taskNo, cargoStockin.getCargoSpaceId());
|
||||
|
||||
return AjaxResult.success(response);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 指定货位出库
|
||||
* @param cargoSpaceId
|
||||
* @return
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult stockoutByManual(String cargoSpaceId){
|
||||
BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(cargoSpaceId);
|
||||
if (ObjUtil.isNull(cargoSpace)){
|
||||
log.warn("【操作失败】找不到该货位,可能是货位信息错误,请联系管理员,货位号:", cargoSpaceId);
|
||||
return AjaxResult.error("找不到该货位信息");
|
||||
}
|
||||
|
||||
if (!cargoSpace.getStatus().equals(CargoSpaceCode.CARGOSPACE_STATUS_OCCUPIED)){
|
||||
log.warn("【操作失败】该货位已被其它任务预占用,请等待任务执行完成后重试,货位号:", cargoSpaceId);
|
||||
return AjaxResult.error("该货位已被其它任务预占用,请等待任务执行完成后重试");
|
||||
}
|
||||
|
||||
MydoJob job = mydoJobService.selectMydoJobByTrayCode(cargoSpace.getTrayCode());
|
||||
if (ObjUtil.isNull(job)){
|
||||
|
||||
String jobId = basJobIdService.getId(JobIdType.MYDOJOB_STOCKIN_EMPTY_PALLET);
|
||||
String taskNo = basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKIN_EMPTY_PALLET);
|
||||
int taskType = TaskType.TASKTYPE_STOCKIN_EMPTY_TRAY;
|
||||
|
||||
MydoJob mydoJob = new MydoJob().builder()
|
||||
.jobId(jobId)
|
||||
.taskNo(taskNo)
|
||||
.status(TaskStatusEnum.READY.getCode())
|
||||
.warehouseId(cargoSpace.getWarehouseId())
|
||||
.warehouseName("立体库")
|
||||
.executionPhase("0")
|
||||
.inOrOut(taskType)
|
||||
.trayCode(cargoSpace.getTrayCode())
|
||||
// .exitId()
|
||||
.roadwayId(cargoSpace.getRoadwayId())
|
||||
.cargoSpaceId(cargoSpaceId)
|
||||
.cargoSpaceName(cargoSpace.getCargoSpaceName())
|
||||
.trayType(cargoSpace.getTheType())
|
||||
.build();
|
||||
|
||||
mydoJobService.insertMydoJob(mydoJob);
|
||||
log.info("【wms生成出库】<指定货位出库>作业,作业号:{},任务号:{},托盘号:{},分配货位:{}",mydoJob.getJobId() ,mydoJob.getTaskNo() ,mydoJob.getTrayCode(), cargoSpaceId);
|
||||
|
||||
List<BasStock> stocks = basStockService.selectBasStockList(
|
||||
new BasStock().builder().cargoSpaceId(cargoSpaceId).build()
|
||||
);
|
||||
int num = 1;
|
||||
if (stocks.isEmpty()){
|
||||
return AjaxResult.success();
|
||||
}else{
|
||||
for (BasStock stock : stocks){
|
||||
mydoJobDetailService.insertMydoJobDetail(
|
||||
new MydoJobDetail().builder()
|
||||
.jobId(mydoJob.getJobId())
|
||||
.jobDetailId(mydoJob.getJobId() + "-" + num++)
|
||||
// .inOrOutId(detail.getStockoutId())
|
||||
// .inOrOutDId(detail.getStockoutDetailId())
|
||||
.stockinId(stock.getStockinId())
|
||||
.stockinDetailId(stock.getStockinDetailId())
|
||||
.productId(stock.getProductId())
|
||||
.productName(stock.getProductName())
|
||||
.lotNo(stock.getLotNo())
|
||||
.stockQuantity(stock.getQuantity())
|
||||
.outQuantity(BigDecimal.ZERO)
|
||||
// .trayType()
|
||||
.status(0)
|
||||
.inDate(stock.getInDate())
|
||||
.rollerNumber(stock.getRollerNumber())
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return AjaxResult.error();
|
||||
|
||||
}
|
||||
|
||||
|
||||
//todo 补码
|
||||
/**
|
||||
* 请求补码作业
|
||||
* @param wcsStockinReiceive
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
public AjaxResult requestMydoJobManual(WcsStockinReceive wcsStockinReiceive) {
|
||||
|
||||
RequestLog requestLog = requestLogService.getRequestLog(JSONUtil.toJsonStr(wcsStockinReiceive), "补码请求入库作业");
|
||||
requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success()));
|
||||
requestLog.setResponseStatus("0");
|
||||
requestLog.setIsSuccessful("1");
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
|
||||
int type = mydoJobService.getTrayTypeByTrayCode(wcsStockinReiceive.getTrayCode());
|
||||
|
||||
//查绑定信息
|
||||
List<InTrayMsg> trayMsgs = inTrayMsgService.selectInTrayMsgList(
|
||||
new InTrayMsg().builder().trayCode(wcsStockinReiceive.getTrayCode()).build()
|
||||
);
|
||||
|
||||
if (trayMsgs.size() == 0){
|
||||
log.warn("【补码请求】未找到该托盘的绑定信息,请确认绑定后进行补码操作,托盘条码:{}", wcsStockinReiceive.getTrayCode());
|
||||
return AjaxResult.error("未找到该托盘的绑定信息,请确认绑定后进行补码操作");
|
||||
}
|
||||
|
||||
//通过绑定信息的物料编码获取任务类型
|
||||
String jobId;
|
||||
String taskNo;
|
||||
int taskType;
|
||||
|
||||
if (trayMsgs.get(0).getProductId() == ProductType.EMPTY_TRAY){
|
||||
jobId = basJobIdService.getId(JobIdType.MYDOJOB_STOCKIN_EMPTY_PALLET);
|
||||
taskNo = basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKIN_EMPTY_PALLET);
|
||||
taskType = TaskType.TASKTYPE_STOCKIN_EMPTY_TRAY;
|
||||
}else{
|
||||
jobId = basJobIdService.getId(JobIdType.MYDOJOB_STOCKIN);
|
||||
taskNo = basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKIN);
|
||||
taskType = 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 = basCargoSpaceService.selectBasCargoSpaceForStockin(
|
||||
new BasCargoSpace().builder().roadwayId(wcsStockinReiceive.getRoadwayId()).theType(type).build()
|
||||
);
|
||||
|
||||
//生成wms的入库主作业
|
||||
MydoJob mydoJob = new MydoJob().builder()
|
||||
.jobId(jobId)
|
||||
.taskNo(taskNo)
|
||||
.status(TaskStatusEnum.READY.getCode())
|
||||
.executionPhase("0")
|
||||
.inOrOut(taskType)
|
||||
.trayCode(wcsStockinReiceive.getTrayCode())
|
||||
.entranceId(wcsStockinReiceive.getEntranceId())
|
||||
.roadwayId(wcsStockinReiceive.getRoadwayId())
|
||||
.cargoSpaceId(cargoSpace.getCargoSpaceId())
|
||||
.cargoSpaceName(cargoSpace.getCargoSpaceName())
|
||||
.trayType(type)
|
||||
.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(jobId)
|
||||
.jobDetailId(taskNo + "-" + sum)
|
||||
.inQuantity(BigDecimal.ONE)
|
||||
.productId(trayMsg.getProductId())
|
||||
.productName(basProductService.selectBasProductByProductId(trayMsg.getProductId()).getProductName())
|
||||
.inDate(DateUtil.date())
|
||||
.inOrOutId(trayMsg.getStockinId())
|
||||
.inOrOutDId(trayMsg.getStockinDetailId() + sum)
|
||||
.stockinId(trayMsg.getStockinId())
|
||||
.stockinDetailId(trayMsg.getStockinDetailId() + sum)
|
||||
.status(0)
|
||||
.trayType(mydoJob.getTrayType())
|
||||
.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("【补码请求】<补码入库>响应信息,作业号:{},任务号:{},分配货位:{}",mydoJob.getJobId() ,mydoJob.getTaskNo(), mydoJob.getCargoSpaceId());
|
||||
|
||||
return AjaxResult.success(response);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wcs任务回传
|
||||
* @param wmsJobHandler
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult jobFinish(WmsJobHandler wmsJobHandler) {
|
||||
|
||||
MydoJob mydoJobParam = mydoJobService.selectMydoJobByJobId(wmsJobHandler.getJobId());
|
||||
|
||||
if (StrUtil.isEmpty(wmsJobHandler.getJobId())) {
|
||||
log.warn("【wcs任务上报】请求异常,作业号为空!");
|
||||
return AjaxResult.error("作业号不能为空");
|
||||
}
|
||||
|
||||
if (ObjUtil.isEmpty(mydoJobParam)) {
|
||||
log.warn("【wcs任务上报】找不到该任务,请核对任务状态,作业号:{}", wmsJobHandler.getJobId());
|
||||
return AjaxResult.error("找不到该任务,请核对任务状态");
|
||||
}
|
||||
|
||||
|
||||
if (wmsJobHandler.getWmsType() == TaskType.TASKTYPE_STOCKIN_EMPTY_TRAY ||
|
||||
wmsJobHandler.getWmsType() == TaskType.TASKTYPE_STOCKOUT_EMPTY_TRAY){
|
||||
//空托入库/出库
|
||||
mydoJobService.autoCompleteEmptyTrayJob(wmsJobHandler.getJobId(), wmsJobHandler.getWmsType());
|
||||
}else{
|
||||
//自动完成任务
|
||||
mydoJobService.autoCompleteJob(wmsJobHandler.getJobId(), wmsJobHandler.getWmsType());
|
||||
}
|
||||
|
||||
// log.error("【wcs任务完成上报】执行失败,作业类型错误");
|
||||
// return AjaxResult.error(MessageUtils.message("执行失败,作业类型错误"));
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 放货有货 - 入库重分
|
||||
* @param wmsJobHandler
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult reAssign(WmsJobHandler wmsJobHandler) {
|
||||
|
||||
//重新分配货位
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(wmsJobHandler.getJobId());
|
||||
|
||||
String warehouseId = mydoJob.getWarehouseId();
|
||||
BasCargoSpace basCargoSpaceParam = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(wmsJobHandler.getCargoSpaceId());
|
||||
|
||||
//标记异常货位状态
|
||||
if (ObjUtil.isNotNull(basCargoSpaceParam)) {
|
||||
basCargoSpaceParam.setStatus(CargoSpaceCode.CARGOSPACE_STATUS_STOCKIN_EXCEPTION);
|
||||
basCargoSpaceService.updateBasCargoSpace(basCargoSpaceParam);
|
||||
}
|
||||
|
||||
//重新查找可用货位
|
||||
BasCargoSpace cargoSpaceNew = basCargoSpaceService.selectBasCargoSpaceForStockin(
|
||||
new BasCargoSpace().builder().roadwayId(mydoJob.getRoadwayId()).cargoAreaId(basCargoSpaceParam.getCargoAreaId()).theType(mydoJob.getTrayType()).build()
|
||||
);
|
||||
|
||||
if (ObjUtil.isNotNull(cargoSpaceNew)) {
|
||||
log.info("【入库重分】重分失败,该区域没有可用的空货位,货区:{},托盘类型:{}", basCargoSpaceParam.getCargoAreaId(), mydoJob.getTrayType());
|
||||
return AjaxResult.error("该区域没有可用的空货位");
|
||||
} else {
|
||||
//更新任务
|
||||
mydoJob.setCargoSpaceId(cargoSpaceNew.getCargoSpaceId());
|
||||
mydoJob.setFaultFlag("1");
|
||||
mydoJobService.updateMydoJob(mydoJob);
|
||||
|
||||
//更新货位状态
|
||||
cargoSpaceNew.setStatus(CargoSpaceCode.CARGOSPACE_STATUS_PRE_STOCKIN);
|
||||
basCargoSpaceService.updateBasCargoSpace(cargoSpaceNew);
|
||||
|
||||
return AjaxResult.success(
|
||||
new WmsJobHandler().builder()
|
||||
.cargoSpaceId(cargoSpaceNew.getCargoSpaceId())
|
||||
.trayCode(mydoJob.getTrayCode())
|
||||
.jobId(wmsJobHandler.getJobId())
|
||||
.reqCode(wmsJobHandler.getReqCode())
|
||||
.build()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 取货无货 - 重分物料
|
||||
* @param wmsJobHandler
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
public AjaxResult reMaterial(WmsJobHandler wmsJobHandler) {
|
||||
|
||||
//>>>重新分配物料<<<
|
||||
//获取上报的异常任务jobId
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByJobId(wmsJobHandler.getJobId());
|
||||
|
||||
BasCargoSpace basCargoSpaceParam = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(wmsJobHandler.getCargoSpaceId());
|
||||
//标记异常货位状态
|
||||
if (ObjUtil.isNotNull(basCargoSpaceParam)) {
|
||||
basCargoSpaceParam.setStatus(CargoSpaceCode.CARGOSPACE_STATUS_STOCKOUT_EXCEPTION);
|
||||
basCargoSpaceService.updateBasCargoSpace(basCargoSpaceParam);
|
||||
}
|
||||
|
||||
MydoJobDetail mydoJobDetailParam = new MydoJobDetail();
|
||||
mydoJobDetailParam.setJobId(mydoJob.getJobId());
|
||||
List<MydoJobDetail> mydoJobDetails = mydoJobDetailService.selectMydoJobDetailList(mydoJobDetailParam);
|
||||
|
||||
//还原子单中的分配数量-只能等待盘点后重新分配
|
||||
for (MydoJobDetail mydoJobDetail : mydoJobDetails) {
|
||||
OutStockoutDetail outStockoutDetail = outStockoutDetailService.selectOutStockoutDetailByRollerNumber(mydoJobDetail.getRollerNumber());
|
||||
outStockoutDetail.setAllotNum(BigDecimal.ZERO);
|
||||
outStockoutDetail.setStatus(0);
|
||||
outStockoutDetailService.updateOutStockoutDetail(outStockoutDetail);
|
||||
}
|
||||
|
||||
//处理异常库存信息
|
||||
List<BasStock> stocks = basStockService.selectBasStockListByTrayCode(mydoJob.getTrayCode());
|
||||
for (BasStock basStock : stocks) {
|
||||
basStock.setStockStatus(BasStockCode.STOCK_STATUS_EXCEPTION);
|
||||
basStockService.updateBasStock(basStock);
|
||||
}
|
||||
|
||||
//作废作业
|
||||
mydoJobService.cancelJob(wmsJobHandler.getJobId());
|
||||
|
||||
//调用自动分配
|
||||
// return outStockoutService.autoAssignOutStockout(stockoutId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推送入库回流作业
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult sendReturnMydoJob(Map<String, Object> param) {
|
||||
|
||||
RequestLog requestLog = requestLogService.getRequestLog(WcsUrl.PUSH_IN_MYDO_JOB, JSONUtil.toJsonStr(param), "推送入库回流作业");
|
||||
requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success()));
|
||||
requestLog.setResponseStatus("0");
|
||||
requestLog.setIsSuccessful("1");
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推送出库作业
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult sendOutMydoJob(Map<String, Object> param) {
|
||||
|
||||
RequestLog requestLog = requestLogService.getRequestLog(WcsUrl.PUSH_OUT_MYDO_JOB, JSONUtil.toJsonStr(param), "推送出库作业");
|
||||
requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success()));
|
||||
requestLog.setResponseStatus("0");
|
||||
requestLog.setIsSuccessful("1");
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推送移库作业
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult sendMoveMydoJob(Map<String, Object> param) {
|
||||
|
||||
RequestLog requestLog = requestLogService.getRequestLog(WcsUrl.PUSH_MOVE_MYDO_JOB, JSONUtil.toJsonStr(param), "推送移库作业");
|
||||
requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success()));
|
||||
requestLog.setResponseStatus("0");
|
||||
requestLog.setIsSuccessful("1");
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推送盘点作业
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult sendInventroyMydoJob(Map<String, Object> param) {
|
||||
|
||||
RequestLog requestLog = requestLogService.getRequestLog(WcsUrl.PUSH_MOVE_MYDO_JOB, JSONUtil.toJsonStr(param), "推送盘点作业");
|
||||
requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success()));
|
||||
requestLog.setResponseStatus("0");
|
||||
requestLog.setIsSuccessful("1");
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推送容器出库作业
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult sendEmptyTrayOutMydoJob(Map<String, Object> param) {
|
||||
|
||||
RequestLog requestLog = requestLogService.getRequestLog(WcsUrl.PUSH_OUT_MYDO_JOB, JSONUtil.toJsonStr(param), "推送容器出库作业");
|
||||
requestLog.setResponseBody(JSONUtil.toJsonStr(AjaxResult.success()));
|
||||
requestLog.setResponseStatus("0");
|
||||
requestLog.setIsSuccessful("1");
|
||||
requestLogService.insertRequestLog(requestLog);
|
||||
|
||||
if ("1".equals(requestLog.getIsSuccessful())) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
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();
|
||||
// }
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
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;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 接收入库单据
|
||||
*/
|
||||
|
||||
/**
|
||||
* 接收出库单据
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
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;
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
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;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
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;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.ruoyi.apiService.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ResponseBase {
|
||||
|
||||
/**
|
||||
* 状态码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 响应信息
|
||||
*/
|
||||
private String msg;
|
||||
|
||||
/**
|
||||
* 响应数据
|
||||
*/
|
||||
private Object data;
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.ruoyi.apiService.domain.erp;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 版辊信息
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class RollerInfo {
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
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;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.ruoyi.apiService.domain.receiveStockList;
|
||||
|
||||
import com.ruoyi.apiService.domain.ResponseBase;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StockinListResponse extends ResponseBase {
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.ruoyi.apiService.domain.receiveStockList;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StockoutListReceive {
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.ruoyi.apiService.domain.receiveStockList;
|
||||
|
||||
import com.ruoyi.apiService.domain.ResponseBase;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StockoutListResponse extends ResponseBase {
|
||||
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
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();
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
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);
|
||||
}
|
||||
@@ -1,641 +0,0 @@
|
||||
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);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@@ -1,215 +0,0 @@
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,639 +0,0 @@
|
||||
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);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@@ -112,4 +112,7 @@ public class BasCargoSpaceController extends BaseController
|
||||
public AjaxResult selectPlatListByPlatoon(BasCargoSpace basCargoSpace) {
|
||||
return success(basCargoSpaceService.selectPlatListByPlatoon(basCargoSpace));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class BasCargoSpace extends BaseEntity
|
||||
|
||||
/** 货位类型 */
|
||||
@Excel(name = "货位类型")
|
||||
private int theType;
|
||||
private Integer theType;
|
||||
|
||||
/** 货位类型名称 */
|
||||
@Excel(name = "货位类型名称")
|
||||
@@ -110,7 +110,7 @@ public class BasCargoSpace extends BaseEntity
|
||||
|
||||
/** 高度 */
|
||||
@Excel(name = "高度")
|
||||
private Long theHeight;
|
||||
private Integer theHeight;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -83,8 +83,11 @@ public interface BasCargoSpaceMapper
|
||||
|
||||
BasCargoSpace selectBasCargoSpaceForStockin(BasCargoSpace basCargoSpace);
|
||||
|
||||
List<BasCargoSpace> selectAllBasCargoSpaceForStockin(BasCargoSpace basCargoSpace);
|
||||
|
||||
BasCargoSpace selectBasCargoSpaceForStockout(BasCargoSpace basCargoSpace);
|
||||
|
||||
List<BasCargoSpace> selectAllBasCargoSpaceForStockout(BasCargoSpace basCargoSpace);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -78,6 +78,11 @@ public interface IBasCargoSpaceService
|
||||
*/
|
||||
BasCargoSpace selectBasCargoSpaceForStockin(BasCargoSpace basCargoSpace);
|
||||
|
||||
/**
|
||||
* 查询可分配入库的货位
|
||||
* @return
|
||||
*/
|
||||
List<BasCargoSpace> selectAllBasCargoSpaceForStockin(BasCargoSpace basCargoSpace);
|
||||
|
||||
/**
|
||||
* 查询可分配出库的货位
|
||||
@@ -85,6 +90,11 @@ public interface IBasCargoSpaceService
|
||||
*/
|
||||
BasCargoSpace selectBasCargoSpaceForStockout(BasCargoSpace basCargoSpace);
|
||||
|
||||
/**
|
||||
* 查询可分配出库的货位
|
||||
* @return
|
||||
*/
|
||||
List<BasCargoSpace> selectAllBasCargoSpaceForStockout(BasCargoSpace basCargoSpace);
|
||||
|
||||
/**
|
||||
* 根据单/双伸货位获取对应的双/单伸货位信息
|
||||
|
||||
@@ -110,6 +110,17 @@ public class BasCargoSpaceServiceImpl implements IBasCargoSpaceService
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取入库所有分配货位
|
||||
* @param basCargoSpace
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BasCargoSpace> selectAllBasCargoSpaceForStockin(BasCargoSpace basCargoSpace){
|
||||
return basCargoSpaceMapper.selectAllBasCargoSpaceForStockin(basCargoSpace);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取出库分配货位
|
||||
* @param basCargoSpace
|
||||
@@ -121,21 +132,27 @@ public class BasCargoSpaceServiceImpl implements IBasCargoSpaceService
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取出库分配货位
|
||||
* @param basCargoSpace
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BasCargoSpace> selectAllBasCargoSpaceForStockout(BasCargoSpace basCargoSpace){
|
||||
return basCargoSpaceMapper.selectAllBasCargoSpaceForStockout(basCargoSpace);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BasCargoSpace selectAnotherBasCargoSpaceBySameGroup(BasCargoSpace basCargoSpace){
|
||||
|
||||
BasCargoSpace cargoSingle = selectBasCargoSpaceForStockin(basCargoSpace);
|
||||
Long platoon = basCargoSpace.getThePlatoon();
|
||||
|
||||
if (basCargoSpace.getIssDouble().equals(CargoSpaceCode.CARGOSPACE_ISDOUBLE_N)){
|
||||
Long platoonOtherSide = (platoon % 2 == 1) ? platoon + 1 : platoon - 1;
|
||||
|
||||
cargoSingle.setIssDouble(CargoSpaceCode.CARGOSPACE_ISDOUBLE_Y);
|
||||
|
||||
}else{
|
||||
//todo 此处可考虑优化:单伸有货优先出库
|
||||
cargoSingle.setIssDouble(CargoSpaceCode.CARGOSPACE_ISDOUBLE_N);
|
||||
}
|
||||
|
||||
return ObjUtil.isNull(cargoSingle) || selectBasCargoSpaceList(basCargoSpace).isEmpty() ? null : cargoSingle;
|
||||
return selectBasCargoSpaceList(
|
||||
new BasCargoSpace().builder().thePlatoon(platoonOtherSide).theColumn(basCargoSpace.getTheColumn()).theFloor(basCargoSpace.getTheFloor()).build()
|
||||
).get(0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.ruoyi.bas.product.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.bas.product.mapper.BasProductMapper;
|
||||
@@ -90,4 +92,16 @@ public class BasProductServiceImpl implements IBasProductService
|
||||
{
|
||||
return basProductMapper.deleteBasProductByProductId(productId);
|
||||
}
|
||||
|
||||
|
||||
public String getProductNameByProductId(String productId){
|
||||
BasProduct product = selectBasProductByProductId(productId);
|
||||
|
||||
if (StrUtil.isBlank(productId)){
|
||||
return product.getProductName();
|
||||
}
|
||||
|
||||
return productId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class BasStock extends BaseEntity
|
||||
private String cargoSpaceId;
|
||||
|
||||
/** 库存状态 */
|
||||
@Excel(name = "库存状态")
|
||||
@Excel(name = "库存状态 1-可用 2-占用 3-异常")
|
||||
private String stockStatus;
|
||||
|
||||
/** 物料状态 */
|
||||
@@ -68,6 +68,14 @@ public class BasStock extends BaseEntity
|
||||
@Excel(name = "辊号")
|
||||
private String rollerNumber;
|
||||
|
||||
/** 色序 */
|
||||
@Excel(name = "色序")
|
||||
private Integer colorSequence;
|
||||
|
||||
/** 颜色 */
|
||||
@Excel(name = "颜色")
|
||||
private String color;
|
||||
|
||||
/** 库存数量 */
|
||||
@Excel(name = "库存数量")
|
||||
private BigDecimal quantity;
|
||||
@@ -128,13 +136,13 @@ public class BasStock extends BaseEntity
|
||||
@Excel(name = "供应商名称")
|
||||
private String supplierName;
|
||||
|
||||
/** 托盘类型 */
|
||||
@Excel(name = "托盘类型")
|
||||
private int trayType;
|
||||
|
||||
/** 托盘可用位置 */
|
||||
@Excel(name = "可用位置")
|
||||
private int availablePlace;
|
||||
// /** 托盘类型 */
|
||||
// @Excel(name = "托盘类型")
|
||||
// private int trayType;
|
||||
//
|
||||
// /** 托盘可用位置 */
|
||||
// @Excel(name = "可用位置")
|
||||
// private int availablePlace;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class BasStockInfo extends BaseEntity
|
||||
@Excel(name = "托盘类型")
|
||||
private int trayType;
|
||||
|
||||
/** 托盘状态 0满 1未满 2空 */
|
||||
/** 托盘状态 */
|
||||
@Excel(name = "托盘状态")
|
||||
private int emptyStatus;
|
||||
|
||||
|
||||
@@ -89,6 +89,15 @@ public interface BasStockMapper
|
||||
public int deleteBasStockByRollerNumber(String rollerNumber);
|
||||
|
||||
|
||||
/**
|
||||
* 删除库存信息
|
||||
*
|
||||
* @param trayCode 托盘号
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasStockByTrayCode(String trayCode);
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除库存信息
|
||||
*
|
||||
|
||||
@@ -33,6 +33,14 @@ public interface IBasStockService
|
||||
*/
|
||||
public List<BasStock> selectBasStockListByTrayCode(String trayCode);
|
||||
|
||||
/**
|
||||
* 查询辊号集合
|
||||
*
|
||||
* @param trayCode 托盘号
|
||||
* @return 辊号信息集合
|
||||
*/
|
||||
public List<String> selectBasStockRollerNumberList(String trayCode);
|
||||
|
||||
/**
|
||||
* 查询指定辊号的库存
|
||||
* @param rollerNumber 辊号
|
||||
@@ -48,6 +56,7 @@ public interface IBasStockService
|
||||
*/
|
||||
public List<BasStock> selectBasStockList(BasStock basStock);
|
||||
|
||||
|
||||
/**
|
||||
* 新增库存信息
|
||||
*
|
||||
@@ -72,6 +81,14 @@ public interface IBasStockService
|
||||
*/
|
||||
public int deleteBasStockByRollerNumber(String rollerNumber);
|
||||
|
||||
/**
|
||||
* 删除库存信息信息
|
||||
*
|
||||
* @param trayCode 库存信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBasStockByTrayCode(String trayCode);
|
||||
|
||||
/**
|
||||
* 批量删除库存信息
|
||||
*
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ruoyi.bas.stock.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.bas.stockoper.domain.BasStockOperRecord;
|
||||
@@ -54,6 +55,25 @@ public class BasStockServiceImpl implements IBasStockService
|
||||
return basStockMapper.selectBasStockListByTrayCode(trayCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询辊号集合
|
||||
*
|
||||
* @param trayCode 托盘号
|
||||
* @return 辊号信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<String> selectBasStockRollerNumberList(String trayCode){
|
||||
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<BasStock> stockList = selectBasStockListByTrayCode(trayCode);
|
||||
|
||||
for (BasStock stock : stockList) {
|
||||
list.add(stock.getRollerNumber());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public BasStock selectBasStockByRollerNumber(String rollerNumber){
|
||||
return basStockMapper.selectBasStockByRollerNumber(rollerNumber);
|
||||
}
|
||||
@@ -155,6 +175,18 @@ public class BasStockServiceImpl implements IBasStockService
|
||||
return basStockMapper.deleteBasStockByRollerNumber(rollerNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除库存信息信息
|
||||
*
|
||||
* @param trayCode 库存信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBasStockByTrayCode(String trayCode)
|
||||
{
|
||||
return basStockMapper.deleteBasStockByTrayCode(trayCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getQuantityByTrayCode(String trayCode){
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.ruoyi.common;
|
||||
|
||||
public class StockCode {
|
||||
public class BasStockCode {
|
||||
|
||||
/** 库存状态 - 可用 */
|
||||
public static final String STOCK_STATUS_AVAILABLE = "1";
|
||||
@@ -8,6 +8,9 @@ public class StockCode {
|
||||
/** 库存状态 - 冻结 */
|
||||
public static final String STOCK_STATUS_OCCUPIED = "2";
|
||||
|
||||
/** 库存状态 - 异常需盘点 */
|
||||
public static final String STOCK_STATUS_EXCEPTION = "3";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
package com.ruoyi.common;
|
||||
|
||||
/**
|
||||
* 入库单据状态
|
||||
*/
|
||||
public enum InStockInStatusEnum {
|
||||
public enum BasStockStatusEnum {
|
||||
|
||||
NORMAL("1", "正常"),
|
||||
OCCUPIED("2", "占用");
|
||||
|
||||
CREATE("1", "创建"),
|
||||
AUDIT("2", "审核"),
|
||||
RUNNING("3", "执行"),
|
||||
FINISHED("4", "完成"),
|
||||
CANCEL("5", "作废");
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
InStockInStatusEnum(String code, String desc) {
|
||||
BasStockStatusEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
@@ -26,4 +21,6 @@ public enum InStockInStatusEnum {
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -14,8 +14,11 @@ public class CargoSpaceCode {
|
||||
/** 货位状态 - 出库分配 */
|
||||
public static final String CARGOSPACE_STATUS_PRE_STOCKOUT = "4";
|
||||
|
||||
/** 货位状态 - 需盘点 */
|
||||
public static final String CARGOSPACE_STATUS_EXCEPTION = "5";
|
||||
/** 货位状态 - 入库有货-库存需盘点 */
|
||||
public static final String CARGOSPACE_STATUS_STOCKIN_EXCEPTION = "5";
|
||||
|
||||
/** 货位状态 - 出库无货-库存需盘点 */
|
||||
public static final String CARGOSPACE_STATUS_STOCKOUT_EXCEPTION = "6";
|
||||
|
||||
|
||||
/** 货位锁定状态 - 锁定 */
|
||||
@@ -36,10 +39,10 @@ public class CargoSpaceCode {
|
||||
|
||||
|
||||
/** 货位是否双伸 - 单伸 */
|
||||
public static final String CARGOSPACE_ISDOUBLE_N = "N";
|
||||
public static final String CARGOSPACE_ISDOUBLE_N = "0";
|
||||
|
||||
/** 货位是否双伸 - 双伸 */
|
||||
public static final String CARGOSPACE_ISDOUBLE_Y = "Y";
|
||||
public static final String CARGOSPACE_ISDOUBLE_Y = "1";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@ package com.ruoyi.common;
|
||||
public class InTrayMsgCode {
|
||||
|
||||
/** 绑定状态 - 新建 */
|
||||
public static final String STATUS_NEW = "1";
|
||||
public static final int STATUS_NEW = 1;
|
||||
|
||||
/** 绑定状态 - 已有库存 */
|
||||
public static final String STATUS_EXIST = "2";
|
||||
public static final int STATUS_EXIST = 2;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,22 +6,22 @@ package com.ruoyi.common;
|
||||
public class JobIdType {
|
||||
|
||||
/**
|
||||
* 接收入库单据
|
||||
* 接收ERP入库本地单据号生成
|
||||
*/
|
||||
public static final String JOB_RECEIVE_LIST_STOCKIN = "RKD";
|
||||
|
||||
/**
|
||||
* 接收入库单据
|
||||
* 接收ERP出库本地单据号生成
|
||||
*/
|
||||
public static final String JOB_RECEIVE_LIST_STOCKOUT = "CKD";
|
||||
|
||||
/**
|
||||
* 手动入库单据
|
||||
* 手动入库本地单据号生成
|
||||
*/
|
||||
public static final String JOB_MANUAL_LIST_STOCKIN = "RKDM";
|
||||
|
||||
/**
|
||||
* 手动入库单据
|
||||
* 手动出库本地单据号生成
|
||||
*/
|
||||
public static final String JOB_MANUAL_LIST_STOCKOUT = "CKDM";
|
||||
|
||||
|
||||
@@ -4,5 +4,7 @@ public class ProductType {
|
||||
|
||||
public static final String EMPTY_TRAY = "KTP0001";
|
||||
|
||||
public static final String TRAY_RETURN = "TRAY_BACK";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
package com.ruoyi.common;
|
||||
|
||||
/**
|
||||
* 入库单据状态
|
||||
*/
|
||||
public enum StockStatusEnum {
|
||||
|
||||
NORMAL("1", "正常"),
|
||||
OCCUPIED("2", "占用");
|
||||
|
||||
CREATE("1", "创建"),
|
||||
AUDIT("2", "审核"),
|
||||
RUNNING("3", "执行"),
|
||||
FINISHED("4", "完成"),
|
||||
CANCEL("5", "作废");
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
@@ -21,6 +26,4 @@ public enum StockStatusEnum {
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -32,4 +32,11 @@ public class TaskIdType {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 出库任务
|
||||
*/
|
||||
public static final String TASK_STOCKOUT = "21";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@ public class TaskType {
|
||||
/**
|
||||
* 移库
|
||||
*/
|
||||
public static final int TASKTYPE_STOCK_MOVE = 4;
|
||||
public static final int TASKTYPE_PICK_STOCK_MOVE = 4;
|
||||
public static final String TASKTYPE_PICK_STOCK_MOVE_STR = "4";
|
||||
|
||||
/**
|
||||
* 常规出库
|
||||
* 常规/整托出库
|
||||
*/
|
||||
public static final int TASKTYPE_STOCKOUT = 20;
|
||||
public static final String TASKTYPE_STOCKOUT_STR = "20";
|
||||
|
||||
@@ -3,28 +3,28 @@ package com.ruoyi.common;
|
||||
public class WcsUrl {
|
||||
|
||||
/** 推送出库作业 */
|
||||
public static final String PUSH_OUT_MYDO_JOB = "http://localhost:8081/wcs2Wms/api/receiveOutMydoJob";
|
||||
public static final String PUSH_OUT_MYDO_JOB = "http://localhost:8081/wcs2wms/api/receiveOutMydoJob";
|
||||
|
||||
/** 推送容器出库作业 */
|
||||
public static final String PUSH_EMPTY_TRAY_OUT_MYDO_JOB = "http://localhost:8081/wcs2Wms/api/receiveOutMydoJob";
|
||||
public static final String PUSH_EMPTY_TRAY_OUT_MYDO_JOB = "http://localhost:8081/wcs2wms/api/receiveOutMydoJob";
|
||||
|
||||
/** 推送入库作业 */
|
||||
public static final String PUSH_IN_MYDO_JOB = "http://localhost:8081/wcs2Wms/api/receiveInMydoJob";
|
||||
public static final String PUSH_IN_MYDO_JOB = "http://localhost:8081/wcs2wms/api/receiveInMydoJob";
|
||||
|
||||
/** 推送移库作业 */
|
||||
public static final String PUSH_MOVE_MYDO_JOB = "http://localhost:8081/wcs2Wms/api/receiveMoveMydoJob";
|
||||
public static final String PUSH_MOVE_MYDO_JOB = "http://localhost:8081/wcs2wms/api/receiveMoveMydoJob";
|
||||
|
||||
/** 推送回流作业 */
|
||||
public static final String PUSH_RETURN_MYDO_JOB = "http://localhost:8081/wcs2Wms/api/receiveReturnMydoJob";
|
||||
public static final String PUSH_RETURN_MYDO_JOB = "http://localhost:8081/wcs2wms/api/receiveReturnMydoJob";
|
||||
|
||||
/** */
|
||||
public static final String PUSH_AGV_MOVE_JOB = "http://localhost:8081/agv/api/receiveAgvMoveJob";
|
||||
|
||||
/** */
|
||||
public static final String OUT_MYDOJOB_MS = "http://localhost:8081/wcs2Wms/api/outMydojobMakesure";
|
||||
public static final String OUT_MYDOJOB_MS = "http://localhost:8081/wcs2wms/api/outMydojobMakesure";
|
||||
|
||||
/** */
|
||||
public static final String CANCEL_MYDOJOB = "http://localhost:8081/wcs2Wms/api/cancelMydoJob";
|
||||
public static final String CANCEL_MYDOJOB = "http://localhost:8081/wcs2wms/api/cancelMydoJob";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
package com.ruoyi.in.bind.controller;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import com.ruoyi.in.stockindetail.domain.InStockinDetail;
|
||||
import com.ruoyi.in.stockindetail.service.IInStockinDetailService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -34,6 +39,9 @@ public class InTrayMsgController extends BaseController
|
||||
@Autowired
|
||||
private IInTrayMsgService inTrayMsgService;
|
||||
|
||||
@Autowired
|
||||
IInStockinDetailService inStockinDetailService;
|
||||
|
||||
/**
|
||||
* 查询入库信息列表
|
||||
*/
|
||||
@@ -101,4 +109,30 @@ public class InTrayMsgController extends BaseController
|
||||
{
|
||||
return toAjax(inTrayMsgService.deleteInTrayMsgByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除入库信息 - 辊号
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('in:bindMsg:remove')")
|
||||
@Log(title = "入库信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/delete/{rollerNumbers}")
|
||||
public AjaxResult removeByRollerNumbers(@PathVariable String[] rollerNumbers)
|
||||
{
|
||||
try {
|
||||
for (String rollerNumber : rollerNumbers){
|
||||
InStockinDetail detail = inStockinDetailService.selectInStockinDetailByRollerNumber(rollerNumber);
|
||||
if (ObjUtil.isNotNull(detail)){
|
||||
detail.setScanNum(BigDecimal.ZERO);
|
||||
inStockinDetailService.updateInStockinDetail(detail);
|
||||
}
|
||||
}
|
||||
inTrayMsgService.deleteInTrayMsgByRollerNumbers(rollerNumbers);
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 入库信息对象 in_tray_msg
|
||||
@@ -63,24 +64,32 @@ public class InTrayMsg
|
||||
|
||||
/** 托盘类型 */
|
||||
@Excel(name = "托盘类型")
|
||||
private int trayType;
|
||||
private Integer trayType;
|
||||
|
||||
/** 生成时间 */
|
||||
@Excel(name = "生成时间")
|
||||
private DateTime createTime;
|
||||
private Date createTime;
|
||||
|
||||
/** 辊号 */
|
||||
@Excel(name = "辊号")
|
||||
private String rollerNumber;
|
||||
|
||||
/** 绑定状态 0-新建绑定 1-原有库存 */
|
||||
/** 色序 */
|
||||
@Excel(name = "色序")
|
||||
private Integer colorSequence;
|
||||
|
||||
/** 颜色 */
|
||||
@Excel(name = "颜色")
|
||||
private String color;
|
||||
|
||||
/** 绑定状态 1-新建绑定 2-原有库存 */
|
||||
@Excel(name = "绑定状态")
|
||||
private String status;
|
||||
private Integer status;
|
||||
|
||||
|
||||
public DateTime getCreateTime() {
|
||||
return DateTime.now();
|
||||
}
|
||||
// public DateTime getCreateTime() {
|
||||
// return DateTime.now();
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,14 @@ public interface InTrayMsgMapper
|
||||
*/
|
||||
public InTrayMsg selectInTrayMsgById(Long id);
|
||||
|
||||
/**
|
||||
* 查询入库信息
|
||||
*
|
||||
* @param rollerNumber 入库信息主键
|
||||
* @return 入库信息
|
||||
*/
|
||||
public InTrayMsg selectInTrayMsgByRollerNumber(String rollerNumber);
|
||||
|
||||
/**
|
||||
* 查询入库信息列表
|
||||
*
|
||||
@@ -63,5 +71,12 @@ public interface InTrayMsgMapper
|
||||
|
||||
public int deleteInTrayMsgByTrayCode(String trayCode);
|
||||
|
||||
public int deleteInTrayMsgByRollerNumber(String rollerNumber);
|
||||
|
||||
public int deleteInTrayMsgByRollerNumbers(String[] rollerNumbers);
|
||||
|
||||
int selectInTrayMsgCountByTrayCodeAndWarehouseId(@Param("trayCode") String trayCode,@Param("warehouseId") String warehouseId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -69,4 +69,22 @@ public interface IInTrayMsgService
|
||||
public int deleteInTrayMsgByTrayCode(String trayCode);
|
||||
|
||||
|
||||
/**
|
||||
* 删除入库信息信息
|
||||
*
|
||||
* @param rollerNumber 托盘条码
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteInTrayMsgByRollerNumber(String rollerNumber);
|
||||
|
||||
|
||||
/**
|
||||
* 删除入库信息信息
|
||||
*
|
||||
* @param rollerNumbers 托盘条码
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteInTrayMsgByRollerNumbers(String[] rollerNumbers);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -99,6 +99,21 @@ public class InTrayMsgServiceImpl implements IInTrayMsgService
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteInTrayMsgByRollerNumber(String rollerNumber){
|
||||
return inTrayMsgMapper.deleteInTrayMsgByRollerNumber(rollerNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除入库信息信息
|
||||
*
|
||||
* @param rollerNumbers 托盘条码
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteInTrayMsgByRollerNumbers(String[] rollerNumbers){
|
||||
return inTrayMsgMapper.deleteInTrayMsgByRollerNumbers(rollerNumbers);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class InMydoJobController extends BaseController
|
||||
{
|
||||
startPage();
|
||||
List<MydoJob> list;
|
||||
if(StringUtils.isEmpty(mydoJob.getStatus()) || Convert.toInt(mydoJob.getStatus())<4){
|
||||
if(StringUtils.isEmpty(mydoJob.getStatus()) || Convert.toInt(mydoJob.getStatus()) < 4){
|
||||
list = mydoJobService.selectInMydoJobList(mydoJob);
|
||||
}else {
|
||||
list = mydoJobService.selectInMydoJobFinishList(mydoJob);
|
||||
@@ -117,6 +117,6 @@ public class InMydoJobController extends BaseController
|
||||
@PutMapping("/complete/{jobId}")
|
||||
public AjaxResult complete(@PathVariable("jobId") String jobId)
|
||||
{
|
||||
return mydoJobService.manualCompleteJob(jobId,"1");
|
||||
return mydoJobService.manualCompleteJob(jobId,1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ruoyi.in.job.domain;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -41,7 +42,7 @@ public class MydoJob
|
||||
|
||||
/** 任务类型 */
|
||||
@Excel(name = "任务类型")
|
||||
private int inOrOut;
|
||||
private Integer inOrOut;
|
||||
|
||||
/** 执行阶段 */
|
||||
@Excel(name = "执行阶段")
|
||||
@@ -85,7 +86,7 @@ public class MydoJob
|
||||
|
||||
/** 优先级 */
|
||||
@Excel(name = "优先级")
|
||||
private int priority;
|
||||
private Integer priority;
|
||||
|
||||
/** 高度 */
|
||||
@Excel(name = "高度")
|
||||
@@ -121,19 +122,19 @@ public class MydoJob
|
||||
* 托盘类型(托盘尺寸)
|
||||
*/
|
||||
@Excel(name = "托盘类型")
|
||||
int trayType;
|
||||
Integer trayType;
|
||||
|
||||
|
||||
|
||||
public void setCreateTime(String createTime)
|
||||
{
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getCreateTime()
|
||||
{
|
||||
return DateUtil.formatDateTime(new Date());
|
||||
}
|
||||
// public void setCreateTime(String createTime)
|
||||
// {
|
||||
// this.createTime = createTime;
|
||||
// }
|
||||
//
|
||||
// public String getCreateTime()
|
||||
// {
|
||||
// return DateUtil.now();
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,14 @@ public interface MydoJobMapper
|
||||
*/
|
||||
public List<MydoJob> selectMydoJobList(MydoJob mydoJob);
|
||||
|
||||
/**
|
||||
* 查询作业信息列表
|
||||
*
|
||||
* @param mydoJob 作业信息
|
||||
* @return 作业信息集合
|
||||
*/
|
||||
public List<MydoJob> selectMydoJobToDealList(MydoJob mydoJob);
|
||||
|
||||
/**
|
||||
* 查询作业信息列表
|
||||
*
|
||||
@@ -46,6 +54,14 @@ public interface MydoJobMapper
|
||||
*/
|
||||
public int insertMydoJob(MydoJob mydoJob);
|
||||
|
||||
/**
|
||||
* 新增作业信息
|
||||
*
|
||||
* @param mydoJob 作业信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMydoJobFinish(String jobId);
|
||||
|
||||
/**
|
||||
* 修改作业信息
|
||||
*
|
||||
|
||||
@@ -43,6 +43,13 @@ public interface IMydoJobService
|
||||
*/
|
||||
List<MydoJob> selectOutMydoJobList(MydoJob mydoJob);
|
||||
|
||||
/**
|
||||
* 查询出库作业信息列表
|
||||
* @param mydoJob
|
||||
* @return
|
||||
*/
|
||||
List<MydoJob> selectMydoJobToDealList(MydoJob mydoJob);
|
||||
|
||||
/**
|
||||
* 查询作业信息
|
||||
*
|
||||
@@ -59,6 +66,14 @@ public interface IMydoJobService
|
||||
*/
|
||||
int insertMydoJob(MydoJob mydoJob);
|
||||
|
||||
/**
|
||||
* 新增作业信息历史记录
|
||||
*
|
||||
* @param jobId 作业信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertMydoJobFinish(String jobId);
|
||||
|
||||
/**
|
||||
* 修改作业信息
|
||||
*
|
||||
@@ -84,7 +99,10 @@ public interface IMydoJobService
|
||||
int deleteMydoJobByJobId(String jobId);
|
||||
|
||||
/** 自动完成作业 */
|
||||
AjaxResult autoCompleteJob(String jobId, String type);
|
||||
AjaxResult autoCompleteJob(String jobId, int type);
|
||||
|
||||
/** 自动完成作业 - 空托出入库 */
|
||||
AjaxResult autoCompleteEmptyTrayJob(String jobId, int type);
|
||||
|
||||
/**
|
||||
* 手动作废作业
|
||||
@@ -110,7 +128,15 @@ public interface IMydoJobService
|
||||
* @param type 作业类型 1-入库 2-出库
|
||||
* @return 结果
|
||||
*/
|
||||
AjaxResult manualCompleteJob(String jobId, String type);
|
||||
AjaxResult manualCompleteJob(String jobId, int type);
|
||||
|
||||
/**
|
||||
* 手动完成作业
|
||||
*
|
||||
* @param jobId 作业ID
|
||||
* @return 结果
|
||||
*/
|
||||
AjaxResult manualCompleteJob(String jobId);
|
||||
|
||||
/**
|
||||
* 查询已完成的作业信息列表
|
||||
|
||||
@@ -3,16 +3,12 @@ package com.ruoyi.in.job.service.impl;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.UUID;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.api.service.ApiWcsService;
|
||||
import com.ruoyi.api.service.IApiWcsService;
|
||||
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||
import com.ruoyi.bas.id.job.service.IBasJobIdService;
|
||||
@@ -25,23 +21,21 @@ import com.ruoyi.common.*;
|
||||
import com.ruoyi.common.annotation.WarehouseScope;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.in.bind.domain.InTrayMsg;
|
||||
import com.ruoyi.in.bind.service.IInTrayMsgService;
|
||||
import com.ruoyi.in.jobdetail.domain.MydoJobDetail;
|
||||
import com.ruoyi.in.jobdetail.service.IMydoJobDetailService;
|
||||
import com.ruoyi.in.stockin.domain.InStockin;
|
||||
import com.ruoyi.in.stockindetail.domain.InStockinDetail;
|
||||
import com.ruoyi.in.stockindetail.service.IInStockinDetailService;
|
||||
import com.ruoyi.in.stockin.service.IInStockinService;
|
||||
import com.ruoyi.log.domain.RequestLog;
|
||||
import com.ruoyi.log.service.IRequestLogService;
|
||||
import com.ruoyi.out.stockout.domain.OutStockout;
|
||||
import com.ruoyi.out.stockout.service.IOutStockoutService;
|
||||
import com.ruoyi.out.stockoutdetail.domain.OutStockoutDetail;
|
||||
import com.ruoyi.out.stockoutdetail.service.IOutStockoutDetailService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.in.job.mapper.MydoJobMapper;
|
||||
import com.ruoyi.in.job.domain.MydoJob;
|
||||
@@ -78,8 +72,8 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
IInStockinService instockinService;
|
||||
@Autowired
|
||||
IInStockinDetailService instockinDetailService;
|
||||
@Autowired
|
||||
IOutStockoutService outStockoutService;
|
||||
// @Autowired
|
||||
// IOutStockoutService outStockoutService;
|
||||
@Autowired
|
||||
IOutStockoutDetailService outStockoutDetailService;
|
||||
@Autowired
|
||||
@@ -87,7 +81,8 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
@Autowired
|
||||
IBasTaskNoService basTaskNoService;
|
||||
@Autowired
|
||||
ApiWcsService apiWcsService;
|
||||
@Lazy
|
||||
IApiWcsService apiWcsService;
|
||||
|
||||
|
||||
|
||||
@@ -115,7 +110,6 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
* @return 作业信息
|
||||
*/
|
||||
@Override
|
||||
@WarehouseScope
|
||||
public List<MydoJob> selectInMydoJobList(MydoJob mydoJob)
|
||||
{
|
||||
return mydoJobMapper.selectInMydoJobList(mydoJob);
|
||||
@@ -126,6 +120,13 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
return mydoJobMapper.selectOutMydoJobList(mydoJob);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<MydoJob> selectMydoJobToDealList(MydoJob mydoJob){
|
||||
return mydoJobMapper.selectMydoJobToDealList(mydoJob);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询作业信息
|
||||
*
|
||||
@@ -146,10 +147,23 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
@Override
|
||||
public int insertMydoJob(MydoJob mydoJob)
|
||||
{
|
||||
mydoJob.setCreateTime(DateUtils.getNowDate().toString());
|
||||
mydoJob.setCreateTime(DateUtil.now());
|
||||
return mydoJobMapper.insertMydoJob(mydoJob);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增作业信息历史记录
|
||||
*
|
||||
* @param jobId 作业信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMydoJobFinish(String jobId){
|
||||
return mydoJobMapper.insertMydoJobFinish(jobId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改作业信息
|
||||
*
|
||||
@@ -162,6 +176,7 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
return mydoJobMapper.updateMydoJob(mydoJob);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除作业信息
|
||||
*
|
||||
@@ -174,6 +189,7 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
return mydoJobMapper.deleteMydoJobByJobIds(jobIds);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除作业信息信息
|
||||
*
|
||||
@@ -239,41 +255,13 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
return AjaxResult.error("找不到该作业信息");
|
||||
}
|
||||
|
||||
//任务子表
|
||||
List<MydoJobDetail> details = mydoJobDetailService.selectMydoJobDetailByJobId(jobId);
|
||||
|
||||
if (details.isEmpty()){
|
||||
log.warn("【操作异常】找不到该作业明细信息,作业号:{}", jobId);
|
||||
return AjaxResult.error("找不到该作业明细信息");
|
||||
}
|
||||
|
||||
for (MydoJob mydoJob : jobs){
|
||||
//移除任务主表
|
||||
//任务状态标记为【作废】
|
||||
mydoJob.setStatus(TaskStatusEnum.CANCEL.getCode());
|
||||
updateMydoJob(mydoJob);
|
||||
deleteMydoJobByJobId(mydoJob.getJobId());
|
||||
|
||||
//移除任务子表
|
||||
mydoJobDetailService.deleteMydoJobDetailsByJobId(jobId);
|
||||
|
||||
//todo 还原子单明细的物料数量
|
||||
// int quantity = mydoJobDetailService.getQuantityByJobId(jobId);
|
||||
|
||||
//恢复货位状态
|
||||
//入库
|
||||
if (mydoJob.getInOrOut() == TaskType.TASKTYPE_STOCKIN){
|
||||
basCargoSpaceService.updateBasCargoSpaceStatus(mydoJob.getCargoSpaceId(), null, CargoSpaceCode.CARGOSPACE_STATUS_AVAILABLE);
|
||||
}
|
||||
|
||||
//出库
|
||||
if (mydoJob.getInOrOut() == TaskType.TASKTYPE_STOCKOUT){
|
||||
basCargoSpaceService.updateBasCargoSpaceStatus(mydoJob.getCargoSpaceId(), mydoJob.getTrayCode(), CargoSpaceCode.CARGOSPACE_STATUS_OCCUPIED);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
log.warn("【手动操作】已作废当前作业,作业号:{}", jobId);
|
||||
log.warn("【手动操作】执行成功,当前作业已标记为<手动作废>,作业号:{}", jobId);
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
@@ -287,9 +275,9 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult manualCompleteJob(String jobId, String type)
|
||||
public AjaxResult manualCompleteJob(String jobId, int type)
|
||||
{
|
||||
if ("1".equals(type)){
|
||||
if (1 == type){
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("job_id", jobId);
|
||||
map.put("dept_id", SecurityUtils.getDeptId());
|
||||
@@ -301,7 +289,7 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
}else {
|
||||
return AjaxResult.error(Convert.toStr(map.get("v_resultmsg")));
|
||||
}
|
||||
}else if ("2".equals(type)){
|
||||
}else if (2 == type){
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("v_job_id", jobId);
|
||||
map.put("v_dept_id", SecurityUtils.getDeptId());
|
||||
@@ -318,50 +306,80 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
|
||||
|
||||
/**
|
||||
* 自动完成任务
|
||||
* 手动完成作业
|
||||
*
|
||||
* @param jobId 作业ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult manualCompleteJob(String jobId)
|
||||
{
|
||||
//任务主表
|
||||
List<MydoJob> jobs = mydoJobMapper.selectMydoJobList(
|
||||
new MydoJob().builder().jobId(jobId).build()
|
||||
);
|
||||
|
||||
if (jobs.isEmpty()){
|
||||
log.warn("【操作异常】找不到该作业信息,作业号:{}", jobId);
|
||||
return AjaxResult.error("找不到该作业信息");
|
||||
}
|
||||
|
||||
for (MydoJob mydoJob : jobs){
|
||||
//任务状态标记为【作废】
|
||||
mydoJob.setStatus(TaskStatusEnum.MANUAL_FINISHED.getCode());
|
||||
updateMydoJob(mydoJob);
|
||||
}
|
||||
|
||||
log.warn("【手动操作】执行成功,当前作业已标记为<手动完成>,作业号:{}", jobId);
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 自动完成任务 - 带货托盘
|
||||
* @param jobId
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult autoCompleteJob(String jobId, String type){
|
||||
public AjaxResult autoCompleteJob(String jobId, int type){
|
||||
|
||||
//>>>获取任务数据
|
||||
MydoJob mydoJob = selectMydoJobByJobId(jobId);//获取主任务
|
||||
|
||||
List<MydoJobDetail> details = mydoJobDetailService.selectMydoJobDetailByJobId(jobId);//对应的所有子任务
|
||||
if (details.isEmpty()){
|
||||
log.warn("【任务完成上报】查不到该作业对应的子单明细,请检查子单状态,任务号:" + jobId);
|
||||
return AjaxResult.error("查不到该作业对应的子单明细,请检查子单状态");
|
||||
}
|
||||
|
||||
List<InTrayMsg> inTrayMsgs = inTrayMsgService.selectInTrayMsgList(
|
||||
new InTrayMsg().builder().trayCode(mydoJob.getTrayCode()).build()
|
||||
);//获取当前托盘绑定信息
|
||||
if (inTrayMsgs.isEmpty()){
|
||||
log.warn("【任务完成上报】查不到该作业对应的托盘绑定信息,请检查绑定状态,任务号:" + jobId);
|
||||
return AjaxResult.error("查不到该作业对应的托盘绑定信息,请检查绑定状态");
|
||||
if (ObjUtil.isNull(mydoJob)){
|
||||
log.warn("【任务完成】查不到该作业,请检查作业状态,作业号:" + jobId);
|
||||
return AjaxResult.error("查不到该作业,请检查作业状态");
|
||||
}
|
||||
|
||||
|
||||
//todo --------------------处理库存信息--------------------
|
||||
//todo 可能需要处理多种物料
|
||||
//--------------------处理库存信息--------------------
|
||||
//>>>>>>>>>>>>>>>>>>>>>>>常规入库<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
if (type == TaskType.TASKTYPE_STOCKIN_STR){
|
||||
//获取非重复的物料种类
|
||||
// List<String> products = details.stream()
|
||||
// .map(MydoJobDetail::getProductId)
|
||||
// .filter(Objects::nonNull)
|
||||
// .distinct()
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
//>>>>>>>>>>>>>>>>>>>>>>>常规入库<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
//>>>>>>>>>>>>>>>>>>>>>>>常规入库<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
if (type == TaskType.TASKTYPE_STOCKIN || type == TaskType.TASKTYPE_PICK_RETURN){
|
||||
|
||||
//库存编号
|
||||
//获取当前托盘绑定信息
|
||||
List<InTrayMsg> inTrayMsgs = inTrayMsgService.selectInTrayMsgList(
|
||||
new InTrayMsg().builder().trayCode(mydoJob.getTrayCode()).build()
|
||||
);
|
||||
if (inTrayMsgs.isEmpty()){
|
||||
log.warn("【任务完成】查不到该作业对应的托盘绑定信息,请检查绑定状态,任务号:" + jobId);
|
||||
return AjaxResult.error("查不到该作业对应的托盘绑定信息,请检查绑定状态");
|
||||
}
|
||||
|
||||
//子任务
|
||||
List<MydoJobDetail> details = mydoJobDetailService.selectMydoJobDetailByJobId(jobId);
|
||||
if (details.isEmpty()){
|
||||
log.warn("【任务完成】查不到该作业对应的子单明细,请检查子单状态,任务号:" + jobId);
|
||||
return AjaxResult.error("查不到该作业对应的子单明细,请检查子单状态");
|
||||
}
|
||||
|
||||
//生成库存编号
|
||||
String stockId = basJobIdService.getId(JobIdType.STOCK);
|
||||
|
||||
//插入库存主表
|
||||
//查库存主表是否有该托盘号:判断空容器或非空容器
|
||||
BasStockInfo info = basStockInfoService.selectBasStockInfoByTrayCode(mydoJob.getTrayCode());
|
||||
if (ObjUtil.isNull(info)){
|
||||
basStockInfoService.insertBasStockInfo(
|
||||
@@ -371,17 +389,17 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
.trayCode(mydoJob.getTrayCode())
|
||||
.warehouseId(mydoJob.getWarehouseId())
|
||||
.trayType(mydoJob.getTrayType())
|
||||
.emptyStatus(mydoJob.getTrayType() - details.size())//计算托盘具体余位数量
|
||||
.emptyStatus(details.size())//版辊数量
|
||||
.build()
|
||||
);
|
||||
|
||||
log.info("【账务处理】新增库存主信息,库存编号:{},货位:{},托盘号:{},入库数量:{}", stockId, mydoJob.getCargoSpaceId(), mydoJob.getTrayCode(), details.size());
|
||||
log.info("【账务处理】新增库存主表信息,库存编号:{},货位:{},托盘号:{},入库数量:{}", stockId, mydoJob.getCargoSpaceId(), mydoJob.getTrayCode(), inTrayMsgs.size());
|
||||
}else{
|
||||
//更新托盘空位数量:加上子任务的条数(物料数量)
|
||||
info.setEmptyStatus(info.getEmptyStatus() + details.size());
|
||||
info.setStockId(stockId);
|
||||
info.setCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
info.setEmptyStatus(details.size());
|
||||
basStockInfoService.updateBasStockInfo(info);
|
||||
|
||||
log.info("【账务处理】更新库存主信息,库存编号:{},货位:{},托盘号:{},入库/原数量:{}/{}", stockId, mydoJob.getCargoSpaceId(), mydoJob.getTrayCode(), details.size(), info.getEmptyStatus());
|
||||
log.info("【账务处理】更新库存主表信息,库存编号:{},货位:{},托盘号:{},入库数量:{}", stockId, mydoJob.getCargoSpaceId(), mydoJob.getTrayCode(), inTrayMsgs.size());
|
||||
}
|
||||
|
||||
int num = 1;
|
||||
@@ -394,77 +412,72 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
new BasStock().builder()
|
||||
.stockId(stockId)
|
||||
.stockDetailId(stockId + "-" + num)
|
||||
.stockStatus(StockCode.STOCK_STATUS_AVAILABLE)
|
||||
.stockStatus(BasStockCode.STOCK_STATUS_AVAILABLE)
|
||||
.trayCode(detail.getTrayCode())
|
||||
.jobId(jobId)
|
||||
.jobDetailId(jobId + "-" + num)
|
||||
.trayType(mydoJob.getTrayType())
|
||||
.jobDetailId(jobId + "-" + num++)
|
||||
.stockinId(inTrayMsgs.get(0).getStockinId())//获取单据号需要从托盘绑定信息表获取
|
||||
.stockinDetailId(inTrayMsgs.get(0).getStockinDetailId())
|
||||
.rollerNumber(detail.getRollerNumber())
|
||||
.quantity(BigDecimal.valueOf(detail.getInQuantity()))
|
||||
.quantity(detail.getInQuantity())
|
||||
.cargoSpaceId(mydoJob.getCargoSpaceId())
|
||||
.productId(detail.getProductId())
|
||||
.productName(detail.getProductName())
|
||||
.inDate(DateUtil.date().now())
|
||||
.build()
|
||||
);
|
||||
|
||||
num++;
|
||||
log.info("【账务处理】新增库存明细,作业号:{},库存编号:{},辊号:{}", jobId, stockId, detail.getRollerNumber());
|
||||
|
||||
log.info("【账务处理】生成库存明细,作业号:{},库存编号:{},辊号:{},物料号:{}", jobId, stockId, detail.getRollerNumber(), detail.getProductId());
|
||||
|
||||
//增加单据明细(子单)分配数量
|
||||
InStockinDetail inStockinDetail = instockinDetailService.selectInStockinDetailByStockinDetailId(detail.getStockinDetailId());
|
||||
//更新分配数量 = 当前入库数量
|
||||
inStockinDetail.setAssignNum(inStockinDetail.getAssignNum().add(BigDecimal.valueOf(detail.getInQuantity())));
|
||||
//更新实际数量 = 当前入库数量
|
||||
InStockinDetail inStockinDetail = instockinDetailService.selectInStockinDetailByRollerNumber(detail.getRollerNumber());
|
||||
inStockinDetail.setAssignNum(detail.getInQuantity());
|
||||
inStockinDetail.setStatus(1);
|
||||
instockinDetailService.updateInStockinDetail(inStockinDetail);
|
||||
|
||||
//todo -------------------------处理单据状态-------------------------
|
||||
//todo 核对单据数量 - 必须所有物料全部分配完成才能结束单据
|
||||
boolean isCompeleted = instockinDetailService.checkInStockinDetailListIsCompeleted(detail.getStockinId());
|
||||
if (isCompeleted){
|
||||
//更主单据账务处理
|
||||
instockinService.instockinHandler(detail.getStockinId());
|
||||
//子单明细账务处理
|
||||
instockinDetailService.instockinDetailHandler(detail.getStockinId());
|
||||
|
||||
log.info("【账务处理】<入库>单据完成,单据号:{}", detail.getStockinId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//todo --------------------更新货位状态--------------------
|
||||
//--------------------更新货位状态--------------------
|
||||
BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
basCargoSpaceService.updateBasCargoSpaceStatus(cargoSpace.getCargoSpaceId(), mydoJob.getTrayCode(), CargoSpaceCode.CARGOSPACE_STATUS_OCCUPIED);
|
||||
log.info("【账务处理】更新货位状态<已占用>,作业号:{},货位:{},托盘号:{}", jobId, cargoSpace.getCargoSpaceId(), mydoJob.getTrayCode());
|
||||
|
||||
log.info("【账务处理】更新<入库完成>货位状态,作业号:{},货位:{},托盘号:{}", jobId, cargoSpace.getCargoSpaceId(), mydoJob.getTrayCode());
|
||||
|
||||
//todo --------------------处理任务表和子任务表--------------------
|
||||
//--------------------处理任务表和子任务表--------------------
|
||||
//1.更新任务主表状态并移除作业
|
||||
mydoJob.setStatus(TaskStatusEnum.AUTO_FINISHED.getCode());
|
||||
mydoJobMapper.updateMydoJob(mydoJob);
|
||||
mydoJobMapper.insertMydoJobFinish(mydoJob.getJobId());
|
||||
deleteMydoJobByJobId(jobId);
|
||||
|
||||
//2.并移除所有子作业
|
||||
//2.移除所有子作业,任务子表插入历史
|
||||
mydoJobDetailService.insertMydoJobDetailsForJobFinish(jobId);
|
||||
mydoJobDetailService.deleteMydoJobDetailsByJobId(jobId);
|
||||
|
||||
//3.移除当前托盘的绑定信息
|
||||
inTrayMsgService.deleteInTrayMsgByTrayCode(mydoJob.getTrayCode());
|
||||
|
||||
log.info("【账务处理】移除任务数据,作业号:{},托盘号:{}", jobId, mydoJob.getTrayCode());
|
||||
log.info("【账务处理】移除任务数据和绑定信息,生成历史记录,作业号:{},托盘号:{}", jobId, mydoJob.getTrayCode());
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
//>>>>>>>>>>>>>>>>>>>>>>>常规(整托)出库\拣选出库\指定出库<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
if (type == TaskType.TASKTYPE_STOCKOUT_STR || type == TaskType.TASKTYPE_STOCKOUT_PICKING_STR || type == TaskType.TASKTYPE_STOCKOUT_MANUAL_STR){
|
||||
//>>>>>>>>>>>>>>>>>>>>>>>常规(整托)出库\拣选出库\指定出库<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
//>>>>>>>>>>>>>>>>>>>>>>>常规(整托)出库\拣选出库\指定出库<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
if (type == TaskType.TASKTYPE_STOCKOUT || type == TaskType.TASKTYPE_STOCKOUT_PICKING || type == TaskType.TASKTYPE_STOCKOUT_MANUAL){
|
||||
|
||||
//todo --------------------处理库存信息--------------------
|
||||
//子任务
|
||||
List<MydoJobDetail> details = mydoJobDetailService.selectMydoJobDetailByJobId(jobId);
|
||||
if (details.isEmpty()){
|
||||
log.warn("【任务完成】查不到该作业对应的子单明细,请检查子单状态,任务号:" + jobId);
|
||||
return AjaxResult.error("查不到该作业对应的子单明细,请检查子单状态");
|
||||
}
|
||||
|
||||
//--------------------处理库存信息--------------------
|
||||
//移除指定辊号的库存信息
|
||||
for (MydoJobDetail detail : details){
|
||||
|
||||
//todo 可能需要与出库子单明细校验
|
||||
|
||||
//移除指定辊号的库存明细
|
||||
basStockService.deleteBasStockByRollerNumber(detail.getRollerNumber());
|
||||
//如果条码没有库存明细,则移除主表信息
|
||||
@@ -472,135 +485,72 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
basStockInfoService.deleteBasStockInfoByTrayCode(mydoJob.getTrayCode());
|
||||
}
|
||||
|
||||
//增加出库子单物料分配数量
|
||||
List<OutStockoutDetail> outStockoutDetails = outStockoutDetailService.selectOutStockoutDetailList(
|
||||
new OutStockoutDetail().builder().rollerNumber(detail.getRollerNumber()).assignNum(new BigDecimal(0)).build()
|
||||
);
|
||||
//更新出库子单物料实际出库数量
|
||||
OutStockoutDetail outStockoutDetail = outStockoutDetailService.selectOutStockoutDetailByRollerNumber(detail.getRollerNumber());
|
||||
|
||||
if (outStockoutDetails.size() == 0) {
|
||||
log.warn("【账务处理提示】物料已完成出库分配,辊号:{}", detail.getRollerNumber());
|
||||
continue;
|
||||
}
|
||||
if (ObjUtil.isNotNull(outStockoutDetail)){
|
||||
outStockoutDetail.setAssignNum(detail.getOutQuantity());
|
||||
outStockoutDetail.setStatus(1);
|
||||
outStockoutDetailService.updateOutStockoutDetail(outStockoutDetail);
|
||||
|
||||
OutStockoutDetail outStockoutDetail = outStockoutDetails.get(0);
|
||||
outStockoutDetail.setAssignNum(outStockoutDetail.getAssignNum().add(BigDecimal.valueOf(detail.getOutQuantity())));
|
||||
outStockoutDetailService.updateOutStockoutDetail(outStockoutDetail);
|
||||
log.info("【账务处理】移除库存信息,更新单据出库分配数量,作业号:{},库存编号:{},辊号:{}", jobId, detail.getStockinDetailId(), detail.getRollerNumber());
|
||||
|
||||
log.info("【账务处理】移除库存信息,更新单据出库分配数量,作业号:{},库存编号:{},辊号:{}", jobId, detail.getStockinDetailId(), detail.getRollerNumber());
|
||||
|
||||
|
||||
//todo -------------------------处理单据状态-------------------------
|
||||
//todo 核对单据数量 - 必须所有物料全部分配完成才能结束单据
|
||||
boolean isCompeleted = instockinDetailService.checkInStockinDetailListIsCompeleted(detail.getStockinId());
|
||||
if (isCompeleted){
|
||||
|
||||
//更主单据账务处理
|
||||
instockinService.instockinHandler(detail.getStockinId());
|
||||
|
||||
//子单明细账务处理
|
||||
instockinDetailService.instockinDetailHandler(detail.getStockinId());
|
||||
|
||||
log.info("【账务处理】<出库>单据完成,单据号:{}", detail.getStockinId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//todo --------------------更新货位状态--------------------
|
||||
//--------------------更新货位状态--------------------
|
||||
BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
basCargoSpaceService.updateBasCargoSpaceStatus(cargoSpace.getCargoSpaceId(), mydoJob.getTrayCode(), CargoSpaceCode.CARGOSPACE_STATUS_AVAILABLE);
|
||||
|
||||
basCargoSpaceService.updateBasCargoSpaceStatus(cargoSpace.getCargoSpaceId(), "", CargoSpaceCode.CARGOSPACE_STATUS_AVAILABLE);
|
||||
log.info("【账务处理】更新货位状态,作业号:{},货位编号:{},托盘号:{}", jobId, cargoSpace.getCargoSpaceId(), mydoJob.getTrayCode());
|
||||
|
||||
|
||||
//todo --------------------处理任务表和子任务表--------------------
|
||||
//--------------------处理任务表和子任务表--------------------
|
||||
//1.更新任务主表状态并移除作业
|
||||
mydoJob.setStatus(TaskStatusEnum.AUTO_FINISHED.getCode());
|
||||
mydoJobMapper.updateMydoJob(mydoJob);
|
||||
deleteMydoJobByJobId(jobId);
|
||||
// mydoJobMapper.updateMydoJob(mydoJob);
|
||||
// deleteMydoJobByJobId(jobId);
|
||||
//
|
||||
// //2.并移除所有子作业
|
||||
// mydoJobDetailService.insertMydoJobDetailsForJobFinish(jobId);
|
||||
// mydoJobDetailService.deleteMydoJobDetailsByJobId(jobId);
|
||||
|
||||
//2.并移除所有子作业
|
||||
mydoJobDetailService.deleteMydoJobDetailsByJobId(jobId);
|
||||
|
||||
//3.移除当前托盘的绑定信息
|
||||
inTrayMsgService.deleteInTrayMsgByTrayCode(mydoJob.getTrayCode());
|
||||
|
||||
//todo 4.可能产生拣选回流任务?
|
||||
if (type == TaskType.TASKTYPE_STOCKOUT_PICKING_STR){
|
||||
|
||||
String jobIdHL = basJobIdService.getId(JobIdType.MYDOJOB_PICK_RETURN);
|
||||
// String taskNo = basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKIN_BACK);
|
||||
// BasCargoSpace cargo = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
BasCargoSpace cargo = basCargoSpaceService.selectBasCargoSpaceForStockin(
|
||||
new BasCargoSpace().builder().theType(mydoJob.getTrayType()).roadwayId(mydoJob.getRoadwayId()).build()
|
||||
);
|
||||
|
||||
mydoJob.setJobId(jobIdHL);
|
||||
// mydoJob.setTaskNo(taskNo);
|
||||
mydoJob.setStatus(TaskStatusEnum.READY.getCode());
|
||||
mydoJob.setCargoSpaceId(cargo.getCargoSpaceId());
|
||||
mydoJob.setTrayCode(mydoJob.getTrayCode());
|
||||
mydoJob.setInOrOut(TaskType.TASKTYPE_PICK_RETURN);
|
||||
mydoJob.setExecutionPhase("0");
|
||||
mydoJob.setCreateTime(DateUtil.now());
|
||||
|
||||
AjaxResult ajaxResult;
|
||||
/*-----------------推送wcs任务----------------- */
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("reqCode", UUID.randomUUID().toString());//请求码
|
||||
paramMap.put("jobId", jobIdHL);//容器编号
|
||||
paramMap.put("trayCode", mydoJob.getTrayCode().trim());//容器编号
|
||||
paramMap.put("cargoSpaceId", mydoJob.getCargoSpaceId());//高度
|
||||
// paramMap.put("remark", errorMessage);
|
||||
|
||||
ajaxResult = apiWcsService.sendReturnMydoJob(paramMap);
|
||||
if (ajaxResult.isSuccess()) {
|
||||
log.info("【推送wcs回流任务】推送wcs作业成功,作业号:{},托盘条码:{},分配货位:{}", jobIdHL, mydoJob.getTrayCode(), mydoJob.getCargoSpaceId());
|
||||
//如果还没有wcs任务 - 生成一条任务
|
||||
if (selectMydoJobList(new MydoJob().builder().trayCode(mydoJob.getTrayCode()).build()).isEmpty()) {
|
||||
//生成作业
|
||||
insertMydoJob(mydoJob);
|
||||
//更新货位状态
|
||||
basCargoSpaceService.updateBasCargoSpaceStatus(mydoJob.getCargoSpaceId(), mydoJob.getTrayCode(), CargoSpaceCode.CARGOSPACE_STATUS_PRE_STOCKIN);
|
||||
|
||||
log.info("【账务处理】拣选任务完成,生成回流作业,拣选出库作业号:{},回流作业号:{},托盘号:{}", jobId, jobIdHL, mydoJob.getTrayCode());
|
||||
}else{
|
||||
log.warn("【提示】已经存在指定托盘号的作业,托盘号:{}", mydoJob.getTrayCode());
|
||||
}
|
||||
|
||||
}else{
|
||||
// 接口调用失败处理
|
||||
log.info("【推送wcs回流任务】推送失败,请检查网络或请求参数,请求内容:{}", JSON.toJSONString(paramMap));
|
||||
log.info("【错误信息】{}", requestLogService.selectRequestLogByLatestTask().getErrorDetails());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
log.info("【账务处理】任务完成,作业号:{},托盘号:{}", jobId, mydoJob.getTrayCode());
|
||||
log.info("【账务处理】出库完成,等待确认,作业号:{},托盘号:{}", jobId, mydoJob.getTrayCode());
|
||||
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
|
||||
//移库任务
|
||||
if (type.equals(TaskType.TASKTYPE_PICK_STOCK_MOVE_STR)){
|
||||
//todo --------------------更新库存状态--------------------
|
||||
//>>>>>>>>>>>>>>>>>>>>> 移库任务 <<<<<<<<<<<<<<<<<<<<<<<<
|
||||
//>>>>>>>>>>>>>>>>>>>>> 移库任务 <<<<<<<<<<<<<<<<<<<<<<<<
|
||||
//>>>>>>>>>>>>>>>>>>>>> 移库任务 <<<<<<<<<<<<<<<<<<<<<<<<
|
||||
if (type == TaskType.TASKTYPE_PICK_STOCK_MOVE){
|
||||
//--------------------更新库存状态--------------------
|
||||
//更新主表
|
||||
BasStockInfo stockInfo = basStockInfoService.selectBasStockInfoByTrayCode(mydoJob.getTrayCode());
|
||||
stockInfo.setCargoSpaceId(mydoJob.getTargetCargoSpaceId());
|
||||
basStockInfoService.updateBasStockInfo(stockInfo);
|
||||
//更新子表
|
||||
List<BasStock> stocks = basStockService.selectBasStockListByTrayCode(mydoJob.getTrayCode());
|
||||
for (BasStock stock : stocks){
|
||||
stock.setCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
basStockService.updateBasStock(stock);
|
||||
}
|
||||
|
||||
//todo --------------------更新货位状态--------------------
|
||||
//--------------------更新货位状态--------------------
|
||||
BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
basCargoSpaceService.updateBasCargoSpaceStatus(cargoSpace.getCargoSpaceId(), mydoJob.getTrayCode(), CargoSpaceCode.CARGOSPACE_STATUS_OCCUPIED);
|
||||
basCargoSpaceService.updateBasCargoSpaceStatus(cargoSpace.getCargoSpaceId(), "", CargoSpaceCode.CARGOSPACE_STATUS_AVAILABLE);
|
||||
basCargoSpaceService.updateBasCargoSpaceStatus(mydoJob.getTargetCargoSpaceId(), mydoJob.getTrayCode(), CargoSpaceCode.CARGOSPACE_STATUS_OCCUPIED);
|
||||
|
||||
log.info("【账务处理】更新<入库完成>货位状态,作业号:{},货位:{},托盘号:{}", jobId, cargoSpace.getCargoSpaceId(), mydoJob.getTrayCode());
|
||||
log.info("【账务处理】更新<移库完成>货位状态,作业号:{},货位:{},托盘号:{}", jobId, cargoSpace.getCargoSpaceId(), mydoJob.getTrayCode());
|
||||
|
||||
//todo --------------------处理任务表和子任务表--------------------
|
||||
//--------------------处理任务表和子任务表--------------------
|
||||
//1.更新任务主表状态并移除作业
|
||||
mydoJob.setStatus(TaskStatusEnum.AUTO_FINISHED.getCode());
|
||||
mydoJobMapper.updateMydoJob(mydoJob);
|
||||
deleteMydoJobByJobId(jobId);
|
||||
|
||||
//2.并移除所有子作业
|
||||
mydoJobDetailService.insertMydoJobDetailsForJobFinish(jobId);
|
||||
mydoJobDetailService.deleteMydoJobDetailsByJobId(jobId);
|
||||
|
||||
//3.移除当前托盘的绑定信息
|
||||
@@ -614,6 +564,140 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 自动完成任务 - 空托盘
|
||||
* @param jobId
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult autoCompleteEmptyTrayJob(String jobId, int type){
|
||||
|
||||
//>>>获取任务数据
|
||||
MydoJob mydoJob = selectMydoJobByJobId(jobId);//获取主任务
|
||||
if (ObjUtil.isNull(mydoJob)){
|
||||
log.warn("【任务完成】查不到该作业,请检查作业状态,作业号:" + jobId);
|
||||
return AjaxResult.error("查不到该作业,请检查作业状态");
|
||||
}
|
||||
//子任务
|
||||
// List<MydoJobDetail> details = mydoJobDetailService.selectMydoJobDetailByJobId(jobId);
|
||||
// if (details.isEmpty()){
|
||||
// log.warn("【任务完成】查不到该作业对应的子单明细,请检查子单状态,任务号:" + jobId);
|
||||
// return AjaxResult.error("查不到该作业对应的子单明细,请检查子单状态");
|
||||
// }
|
||||
|
||||
|
||||
//--------------------处理库存信息--------------------
|
||||
//>>>>>>>>>>>>>>>>>>>>>>> 空托入库 <<<<<<<<<<<<<<<<<<<<<<<<
|
||||
//>>>>>>>>>>>>>>>>>>>>>>> 空托入库 <<<<<<<<<<<<<<<<<<<<<<<<
|
||||
//>>>>>>>>>>>>>>>>>>>>>>> 空托入库 <<<<<<<<<<<<<<<<<<<<<<<<
|
||||
if (type == TaskType.TASKTYPE_STOCKIN_EMPTY_TRAY) {
|
||||
|
||||
//库存编号
|
||||
String stockId = basJobIdService.getId(JobIdType.STOCK);
|
||||
|
||||
//插入库存主表
|
||||
BasStockInfo info = basStockInfoService.selectBasStockInfoByTrayCode(mydoJob.getTrayCode());
|
||||
if (ObjUtil.isNull(info)) {
|
||||
basStockInfoService.insertBasStockInfo(
|
||||
new BasStockInfo().builder()
|
||||
.stockId(stockId)
|
||||
.cargoSpaceId(mydoJob.getCargoSpaceId())
|
||||
.trayCode(mydoJob.getTrayCode())
|
||||
.warehouseId(mydoJob.getWarehouseId())
|
||||
.trayType(mydoJob.getTrayType())
|
||||
.emptyStatus(0)
|
||||
.build()
|
||||
);
|
||||
|
||||
log.info("【账务处理-空托盘】新增库存主表信息,库存编号:{},货位:{},托盘号:{}", stockId, mydoJob.getCargoSpaceId(), mydoJob.getTrayCode());
|
||||
}else{
|
||||
info.setStockId(stockId);
|
||||
info.setCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
info.setEmptyStatus(0);
|
||||
basStockInfoService.updateBasStockInfo(info);
|
||||
log.info("【账务处理-空托盘】更新库存主表信息,库存编号:{},货位:{},托盘号:{}", stockId, mydoJob.getCargoSpaceId(), mydoJob.getTrayCode());
|
||||
}
|
||||
|
||||
//生成一条库存信息
|
||||
basStockService.insertBasStock(
|
||||
new BasStock().builder()
|
||||
.stockId(stockId)
|
||||
.stockDetailId(stockId + "-" + 1)
|
||||
.stockStatus(BasStockCode.STOCK_STATUS_AVAILABLE)
|
||||
.trayCode(mydoJob.getTrayCode())
|
||||
.jobId(jobId)
|
||||
.jobDetailId(jobId + "-" + 1)
|
||||
.rollerNumber(ProductType.EMPTY_TRAY)
|
||||
.quantity(BigDecimal.ONE)
|
||||
.cargoSpaceId(mydoJob.getCargoSpaceId())
|
||||
.productId(ProductType.EMPTY_TRAY)
|
||||
.productName("空托盘")
|
||||
.inDate(DateUtil.date().now())
|
||||
.build()
|
||||
);
|
||||
log.info("【账务处理-空托盘】新增库存明细,作业号:{},库存编号:{},托盘号:{}", jobId, stockId, mydoJob.getTrayCode());
|
||||
|
||||
|
||||
//--------------------更新货位状态--------------------
|
||||
BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
basCargoSpaceService.updateBasCargoSpaceStatus(cargoSpace.getCargoSpaceId(), mydoJob.getTrayCode(), CargoSpaceCode.CARGOSPACE_STATUS_OCCUPIED);
|
||||
log.info("【账务处理-空托盘】更新货位状态<已占用>,作业号:{},货位:{},托盘号:{}", jobId, cargoSpace.getCargoSpaceId(), mydoJob.getTrayCode());
|
||||
|
||||
//--------------------处理任务表和子任务表--------------------
|
||||
//1.更新任务主表状态并移除作业
|
||||
mydoJob.setStatus(TaskStatusEnum.AUTO_FINISHED.getCode());
|
||||
mydoJobMapper.updateMydoJob(mydoJob);
|
||||
mydoJobMapper.insertMydoJobFinish(mydoJob.getJobId());
|
||||
deleteMydoJobByJobId(jobId);
|
||||
|
||||
//2.移除所有子作业
|
||||
mydoJobDetailService.insertMydoJobDetailsForJobFinish(jobId);
|
||||
mydoJobDetailService.deleteMydoJobDetailsByJobId(jobId);
|
||||
|
||||
//3.移除当前托盘的绑定信息
|
||||
inTrayMsgService.deleteInTrayMsgByTrayCode(mydoJob.getTrayCode());
|
||||
log.info("【账务处理-空托盘】移除任务数据,生成历史记录,作业号:{},托盘号:{}", jobId, mydoJob.getTrayCode());
|
||||
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
|
||||
//>>>>>>>>>>>>>>>>>>>>>>>空托出库<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
if (type == TaskType.TASKTYPE_STOCKOUT_EMPTY_TRAY){
|
||||
|
||||
//--------------------处理库存信息--------------------
|
||||
//移除指定辊号的库存明细
|
||||
basStockService.deleteBasStockByTrayCode(mydoJob.getTrayCode());
|
||||
basStockInfoService.deleteBasStockInfoByTrayCode(mydoJob.getTrayCode());
|
||||
|
||||
//--------------------更新货位状态--------------------
|
||||
BasCargoSpace cargoSpace = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(mydoJob.getCargoSpaceId());
|
||||
basCargoSpaceService.updateBasCargoSpaceStatus(cargoSpace.getCargoSpaceId(), "", CargoSpaceCode.CARGOSPACE_STATUS_AVAILABLE);
|
||||
log.info("【账务处理-空托盘】更新货位状态,作业号:{},货位编号:{},托盘号:{}", jobId, cargoSpace.getCargoSpaceId(), mydoJob.getTrayCode());
|
||||
|
||||
//--------------------处理任务表和子任务表--------------------
|
||||
//1.更新任务主表状态并移除作业
|
||||
mydoJob.setStatus(TaskStatusEnum.AUTO_FINISHED.getCode());
|
||||
mydoJobMapper.updateMydoJob(mydoJob);
|
||||
deleteMydoJobByJobId(jobId);
|
||||
|
||||
//2.并移除所有子作业
|
||||
mydoJobDetailService.insertMydoJobDetailsForJobFinish(jobId);
|
||||
mydoJobDetailService.deleteMydoJobDetailsByJobId(jobId);
|
||||
|
||||
log.info("【账务处理-空托盘】任务完成,作业号:{},托盘号:{}", jobId, mydoJob.getTrayCode());
|
||||
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@WarehouseScope
|
||||
public List<MydoJob> selectInMydoJobFinishList(MydoJob mydoJob) {
|
||||
@@ -621,7 +705,6 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<MydoJob> selectOutMydoJobFinishList(MydoJob mydoJob) {
|
||||
return mydoJobMapper.selectOutMydoJobFinishList(mydoJob);
|
||||
@@ -630,23 +713,21 @@ public class MydoJobServiceImpl implements IMydoJobService
|
||||
|
||||
@Override
|
||||
public int getTrayTypeByTrayCode(String TrayCode){
|
||||
return TrayCode.startsWith("TP") ? 4 : 6;
|
||||
|
||||
if (TrayCode.startsWith("A")){
|
||||
//长1200 高380 6槽
|
||||
return 1;
|
||||
}else if (TrayCode.startsWith("B")){
|
||||
//长1200 高510 4槽
|
||||
return 2;
|
||||
}else if (TrayCode.startsWith("C")){
|
||||
//长1350 高380 6槽
|
||||
return 3;
|
||||
}else{
|
||||
//类型异常
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//mydojob任务处理
|
||||
public void JobHandler(String jobId){
|
||||
MydoJob mydoJob = selectMydoJobByJobId(jobId);//获取主任务
|
||||
List<MydoJobDetail> details = mydoJobDetailService.selectMydoJobDetailByJobId(jobId);//对应的所有子任务
|
||||
List<InTrayMsg> inTrayMsgs = inTrayMsgService.selectInTrayMsgList(
|
||||
new InTrayMsg().builder().trayCode(mydoJob.getTrayCode()).build()
|
||||
);//当前托盘的绑定信息
|
||||
|
||||
//1.更新任务主表状态并移除作业
|
||||
mydoJob.setStatus(TaskStatusEnum.AUTO_FINISHED.getCode());
|
||||
mydoJobMapper.updateMydoJob(mydoJob);
|
||||
deleteMydoJobByJobId(jobId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class InMydoJobDetailController extends BaseController
|
||||
{
|
||||
startPage();
|
||||
List<MydoJobDetail> list;
|
||||
if (StringUtils.isEmpty(mydoJobDetail.getStatus()) || Convert.toInt(mydoJobDetail.getStatus())<4){
|
||||
if (mydoJobDetail.getStatus() != null && Convert.toInt(mydoJobDetail.getStatus()) < 4){
|
||||
list = mydoJobDetailService.selectMydoJobDetailList(mydoJobDetail);
|
||||
}else {
|
||||
list = mydoJobDetailService.selectMydoJobDetailFinishList(mydoJobDetail);
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 作业子信息对象 mydo_job_detail
|
||||
@@ -40,7 +41,7 @@ public class MydoJobDetail extends BaseEntity
|
||||
|
||||
/** 入库时间 */
|
||||
@Excel(name = "入库时间")
|
||||
private String inDate;
|
||||
private Date inDate;
|
||||
|
||||
/** 单据ID */
|
||||
@Excel(name = "单据ID")
|
||||
@@ -50,6 +51,10 @@ public class MydoJobDetail extends BaseEntity
|
||||
@Excel(name = "子单据ID")
|
||||
private String inOrOutDId;
|
||||
|
||||
/** 托盘号 */
|
||||
@Excel(name = "托盘号")
|
||||
private String trayCode;
|
||||
|
||||
/** 物料编码 */
|
||||
@Excel(name = "物料编码")
|
||||
private String productId;
|
||||
@@ -64,15 +69,15 @@ public class MydoJobDetail extends BaseEntity
|
||||
|
||||
/** 入库数量 */
|
||||
@Excel(name = "入库数量")
|
||||
private int inQuantity;
|
||||
private BigDecimal inQuantity;
|
||||
|
||||
/** 库存数量 */
|
||||
@Excel(name = "库存数量")
|
||||
private int stockQuantity;
|
||||
private BigDecimal stockQuantity;
|
||||
|
||||
/** 出库数量 */
|
||||
@Excel(name = "出库数量")
|
||||
private int outQuantity;
|
||||
private BigDecimal outQuantity;
|
||||
|
||||
/** 追溯入库单ID */
|
||||
private String stockinId;
|
||||
@@ -97,7 +102,7 @@ public class MydoJobDetail extends BaseEntity
|
||||
|
||||
private int trayType;
|
||||
|
||||
private String status;
|
||||
private Integer status;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,14 @@ public interface MydoJobDetailMapper
|
||||
*/
|
||||
public MydoJobDetail selectMydoJobDetailByJobDetailId(String jobDetailId);
|
||||
|
||||
/**
|
||||
* 查询作业子信息
|
||||
*
|
||||
* @param rollerNumber 辊号
|
||||
* @return 作业子信息
|
||||
*/
|
||||
public MydoJobDetail selectMydoJobDetailByRollerNumber(String rollerNumber);
|
||||
|
||||
|
||||
/**
|
||||
* 根据作业号查询所有子作业信息
|
||||
@@ -75,5 +83,15 @@ public interface MydoJobDetailMapper
|
||||
*/
|
||||
int deleteMydoJobDetailsByJobId(String jobId);
|
||||
|
||||
/**
|
||||
* 作业子信息批量插入历史表
|
||||
*
|
||||
* @param jobId 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int insertMydoJobDetailsForJobFinish(String jobId);
|
||||
|
||||
List<MydoJobDetail> selectMydoJobDetailFinishList(MydoJobDetail mydoJobDetail);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,14 @@ public interface IMydoJobDetailService
|
||||
*/
|
||||
public MydoJobDetail selectMydoJobDetailByJobDetailId(String jobDetailId);
|
||||
|
||||
/**
|
||||
* 查询作业子信息
|
||||
*
|
||||
* @param rollerNumber 辊号
|
||||
* @return 作业子信息
|
||||
*/
|
||||
public MydoJobDetail selectMydoJobDetailByRollerNumber(String rollerNumber);
|
||||
|
||||
public List<MydoJobDetail> selectMydoJobDetailByJobId(String jobId);
|
||||
|
||||
/**
|
||||
@@ -77,7 +85,8 @@ public interface IMydoJobDetailService
|
||||
*/
|
||||
List<MydoJobDetail> selectMydoJobDetailFinishList(MydoJobDetail mydoJobDetail);
|
||||
|
||||
int getQuantityByJobId(String jobId, String productId);
|
||||
int insertMydoJobDetailsForJobFinish(String jobId);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,19 @@ public class MydoJobDetailServiceImpl implements IMydoJobDetailService
|
||||
return mydoJobDetailMapper.selectMydoJobDetailByJobDetailId(jobDetailId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询作业子信息
|
||||
*
|
||||
* @param rollerNumber 辊号
|
||||
* @return 作业子信息
|
||||
*/
|
||||
@Override
|
||||
public MydoJobDetail selectMydoJobDetailByRollerNumber(String rollerNumber)
|
||||
{
|
||||
return mydoJobDetailMapper.selectMydoJobDetailByRollerNumber(rollerNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据作业号查询所有作业子信息
|
||||
*
|
||||
@@ -116,34 +129,10 @@ public class MydoJobDetailServiceImpl implements IMydoJobDetailService
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取托盘任务所有子任务物料数量(单物料类型)
|
||||
* @param jobId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int getQuantityByJobId(String jobId, String productId){
|
||||
|
||||
//根据作业号获取子任务所有任务明细
|
||||
List<MydoJobDetail> details = selectMydoJobDetailByJobId(jobId);
|
||||
|
||||
//获取指定物料编号的所有明细记录
|
||||
List<MydoJobDetail> detailProducts = details.stream()
|
||||
.filter(p -> p.getProductId().equals(productId))
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
int sum = 0;
|
||||
|
||||
//获取指定指定物料编号的物料总数量
|
||||
for(MydoJobDetail detail : detailProducts){
|
||||
sum += detail.getInQuantity();
|
||||
}
|
||||
|
||||
return sum;
|
||||
public int insertMydoJobDetailsForJobFinish(String jobId) {
|
||||
return mydoJobDetailMapper.insertMydoJobDetailsForJobFinish(jobId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class InStockin extends BaseEntity
|
||||
@Excel(name = "单据来源")
|
||||
private String stockSource;
|
||||
|
||||
/** 单据状态 */
|
||||
/** 单据状态 单据状态 1 新建单据 2审核单据 3 单据执行 4 确认单据 5 作废单据 */
|
||||
@Excel(name = "单据状态")
|
||||
private String status;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.in.stockin.domain;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.in.stockindetail.domain.InStockinDetail;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 入库单据保存DTO(主单+明细)
|
||||
@@ -9,6 +10,7 @@ import com.ruoyi.in.stockindetail.domain.InStockinDetail;
|
||||
* @author ruoyi
|
||||
* @date 2026-05-11
|
||||
*/
|
||||
@Data
|
||||
public class InStockinSaveDTO extends InStockin
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -16,13 +18,4 @@ public class InStockinSaveDTO extends InStockin
|
||||
/** 入库明细列表 */
|
||||
private List<InStockinDetail> details;
|
||||
|
||||
public void setDetails(List<InStockinDetail> details)
|
||||
{
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
public List<InStockinDetail> getDetails()
|
||||
{
|
||||
return details;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,15 +110,6 @@ public interface IInStockinService
|
||||
List<InStockin> selectInStockinFinishList(InStockin inStockin);
|
||||
|
||||
|
||||
/**
|
||||
* 处理主单账务
|
||||
* @param inStockinId 主单号
|
||||
*/
|
||||
void instockinHandler(String inStockinId);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.bas.id.job.service.IBasJobIdService;
|
||||
import com.ruoyi.common.InStockInStatusEnum;
|
||||
import com.ruoyi.common.StockStatusEnum;
|
||||
import com.ruoyi.common.annotation.WarehouseScope;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
@@ -147,7 +147,7 @@ public class InStockinServiceImpl implements IInStockinService
|
||||
saveDTO.setUserName(SecurityUtils.getUsername());
|
||||
saveDTO.setDeptId(SecurityUtils.getDeptId());
|
||||
saveDTO.setDeptName(sysDeptMapper.selectDeptById(saveDTO.getDeptId()).getDeptName());
|
||||
saveDTO.setStatus(InStockInStatusEnum.CREATE.getCode());
|
||||
saveDTO.setStatus(StockStatusEnum.CREATE.getCode());
|
||||
inStockinMapper.insertInStockin(saveDTO);
|
||||
// 3. 保存明细
|
||||
List<InStockinDetail> details = saveDTO.getDetails();
|
||||
@@ -156,7 +156,7 @@ public class InStockinServiceImpl implements IInStockinService
|
||||
for (InStockinDetail detail : details) {
|
||||
// 生成明细ID
|
||||
if (detail.getStockinDetailId() == null || detail.getStockinDetailId().isEmpty()) {
|
||||
detail.setStockinDetailId(saveDTO.getStockinId()+"-"+(count++));
|
||||
detail.setStockinDetailId(saveDTO.getStockinId() + "-" + (count++));
|
||||
}
|
||||
// 关联主单ID
|
||||
detail.setStockinId(saveDTO.getStockinId());
|
||||
@@ -224,31 +224,9 @@ public class InStockinServiceImpl implements IInStockinService
|
||||
}
|
||||
|
||||
@Override
|
||||
@WarehouseScope
|
||||
public List<InStockin> selectInStockinFinishList(InStockin inStockin) {
|
||||
return inStockinMapper.selectInStockinFinishList(inStockin);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理单据账务 插入历史表、移除明细
|
||||
* @param inStockinId
|
||||
*/
|
||||
@Override
|
||||
public void instockinHandler(String inStockinId){
|
||||
|
||||
//更新主单状态
|
||||
InStockin inStockin = selectInStockinByStockinId(inStockinId);
|
||||
inStockin.setStatus(InStockInStatusEnum.FINISHED.getCode());
|
||||
updateInStockin(inStockin);
|
||||
|
||||
//插入历史表
|
||||
insertInStockinFinish(inStockin);
|
||||
|
||||
//移除主单明细
|
||||
deleteInStockinByStockinId(inStockinId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
* @date 2026-05-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/in/sotckindetail")
|
||||
@RequestMapping("/in/stockindetail")
|
||||
public class InStockinDetailController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
@@ -41,24 +41,24 @@ public class InStockinDetailController extends BaseController
|
||||
/**
|
||||
* 查询入库单据子信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('in:sotckindetail:list')")
|
||||
@PreAuthorize("@ss.hasPermi('in:stockindetail:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(InStockinDetail inStockinDetail)
|
||||
{
|
||||
startPage();
|
||||
List<InStockinDetail> list;
|
||||
if (inStockinDetail.getStatus() == 0 || inStockinDetail.getStatus() == 1){
|
||||
list = inStockinDetailService.selectInStockinDetailList(inStockinDetail);
|
||||
}else {
|
||||
list = inStockinDetailService.selectInStockinDetailFinishList(inStockinDetail);
|
||||
}
|
||||
List<InStockinDetail> list = inStockinDetailService.selectInStockinDetailList(inStockinDetail);
|
||||
// if (inStockinDetail.getStatus() == 0 || inStockinDetail.getStatus() == 1){
|
||||
// list = inStockinDetailService.selectInStockinDetailList(inStockinDetail);
|
||||
// }else {
|
||||
// list = inStockinDetailService.selectInStockinDetailFinishList(inStockinDetail);
|
||||
// }
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出入库单据子信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('in:sotckindetail:export')")
|
||||
@PreAuthorize("@ss.hasPermi('in:stockindetail:export')")
|
||||
@Log(title = "入库单据子信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, InStockinDetail inStockinDetail)
|
||||
@@ -71,7 +71,7 @@ public class InStockinDetailController extends BaseController
|
||||
/**
|
||||
* 获取入库单据子信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('in:sotckindetail:query')")
|
||||
@PreAuthorize("@ss.hasPermi('in:stockindetail:query')")
|
||||
@GetMapping(value = "/{stockinDetailId}")
|
||||
public AjaxResult getInfo(@PathVariable("stockinDetailId") String stockinDetailId)
|
||||
{
|
||||
@@ -81,7 +81,7 @@ public class InStockinDetailController extends BaseController
|
||||
/**
|
||||
* 新增入库单据子信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('in:sotckindetail:add')")
|
||||
@PreAuthorize("@ss.hasPermi('in:stockindetail:add')")
|
||||
@Log(title = "入库单据子信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody InStockinDetail inStockinDetail)
|
||||
@@ -97,7 +97,7 @@ public class InStockinDetailController extends BaseController
|
||||
/**
|
||||
* 修改入库单据子信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('in:sotckindetail:edit')")
|
||||
@PreAuthorize("@ss.hasPermi('in:stockindetail:edit')")
|
||||
@Log(title = "入库单据子信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody InStockinDetail inStockinDetail)
|
||||
@@ -108,7 +108,7 @@ public class InStockinDetailController extends BaseController
|
||||
/**
|
||||
* 删除入库单据子信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('in:sotckindetail:remove')")
|
||||
@PreAuthorize("@ss.hasPermi('in:stockindetail:remove')")
|
||||
@Log(title = "入库单据子信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{stockinDetailIds}")
|
||||
public AjaxResult remove(@PathVariable String[] stockinDetailIds)
|
||||
|
||||
@@ -54,9 +54,25 @@ public class InStockinDetail extends BaseEntity
|
||||
@Excel(name = "实际数量")
|
||||
private BigDecimal assignNum;
|
||||
|
||||
/** 分配状态 0-未分配完成 1-分配完成 */
|
||||
/** 分配状态 0-未完成 1-入库完成等待回传 2-回传成功 */
|
||||
private int status;
|
||||
|
||||
// /** 键槽规格 */
|
||||
// String keyGrooveSpec;
|
||||
//
|
||||
// /** 键槽单双 */
|
||||
// String keyGrooveType;
|
||||
|
||||
/** 规格 */
|
||||
@Excel(name = "规格")
|
||||
String spec;
|
||||
|
||||
/** 色序 */
|
||||
Integer colorSequence;
|
||||
|
||||
/** 颜色 */
|
||||
String color;
|
||||
|
||||
/**
|
||||
* 辊号
|
||||
*/
|
||||
@@ -65,4 +81,9 @@ public class InStockinDetail extends BaseEntity
|
||||
|
||||
private String remark;
|
||||
|
||||
private String spare1;
|
||||
|
||||
private String spare2;
|
||||
|
||||
private String spare3;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,14 @@ public interface InStockinDetailMapper
|
||||
*/
|
||||
public InStockinDetail selectInStockinDetailByRollerNumber(String rollerNumber);
|
||||
|
||||
/**
|
||||
* 查询入库单据子信息(未进行扫码绑定的版辊)
|
||||
*
|
||||
* @param rollerNumber 辊号
|
||||
* @return 入库单据子信息
|
||||
*/
|
||||
public InStockinDetail selectInStockinDetailByRollerNumberNoBinding(String rollerNumber);
|
||||
|
||||
/**
|
||||
* 查询入库单据子信息
|
||||
*
|
||||
|
||||
@@ -44,6 +44,16 @@ public interface IInStockinDetailService
|
||||
*/
|
||||
public InStockinDetail selectInStockinDetailByProductId(String productId);
|
||||
|
||||
/**
|
||||
* 查询入库子单据子信息列表
|
||||
*
|
||||
* @param rollerNumber 辊号
|
||||
* @return 入库单据子信息集合
|
||||
*/
|
||||
public InStockinDetail selectInStockinDetailByRollerNumber(String rollerNumber);
|
||||
|
||||
public InStockinDetail selectInStockinDetailByRollerNumberNoBinding(String rollerNumber);
|
||||
|
||||
/**
|
||||
* 查询入库子单据子信息列表
|
||||
* @param status 分配状态
|
||||
@@ -107,7 +117,7 @@ public interface IInStockinDetailService
|
||||
List<InStockinDetail> selectInStockinDetailFinishList(InStockinDetail inStockinDetail);
|
||||
|
||||
|
||||
boolean checkInStockinDetailListIsCompeleted(String inStockinId);
|
||||
boolean checkInStockinDetailListIsCompleted(String inStockinId);
|
||||
|
||||
|
||||
void instockinDetailHandler(String inStockinId);
|
||||
|
||||
@@ -61,6 +61,16 @@ public class InStockinDetailServiceImpl implements IInStockinDetailService
|
||||
return inStockinDetailMapper.selectInStockinDetailByProductId(productId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InStockinDetail selectInStockinDetailByRollerNumber(String rollerNumber){
|
||||
return inStockinDetailMapper.selectInStockinDetailByRollerNumber(rollerNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InStockinDetail selectInStockinDetailByRollerNumberNoBinding(String rollerNumber){
|
||||
return inStockinDetailMapper.selectInStockinDetailByRollerNumberNoBinding(rollerNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InStockinDetail> selectInStockinDetailByStatus(int status){
|
||||
return inStockinDetailMapper.selectInStockinDetailByStatus(status);
|
||||
@@ -155,7 +165,7 @@ public class InStockinDetailServiceImpl implements IInStockinDetailService
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean checkInStockinDetailListIsCompeleted(String inStockinId){
|
||||
public boolean checkInStockinDetailListIsCompleted(String inStockinId){
|
||||
|
||||
//获取指定单据所有子单
|
||||
List<InStockinDetail> details = inStockinDetailMapper.selectInStockinDetailByStockinId(inStockinId);
|
||||
|
||||
@@ -89,4 +89,5 @@ public interface IRequestLogService
|
||||
* @return
|
||||
*/
|
||||
public RequestLog getRequestLog(String param, String remark, AjaxResult ajaxResult);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.ruoyi.log.service.impl;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
@@ -13,7 +15,10 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -145,15 +150,22 @@ public class RequestLogServiceImpl implements IRequestLogService
|
||||
public RequestLog getRequestLog(String url, String param, String remark) {
|
||||
RequestLog requestLog = new RequestLog();
|
||||
requestLog.setRequestTime(DateUtil.formatDateTime(new Date()));
|
||||
requestLog.setSourceSystem("wcs");
|
||||
requestLog.setTargetSystem("wms");
|
||||
requestLog.setSourceSystem("wms");
|
||||
requestLog.setTargetSystem("wcs");
|
||||
requestLog.setEndpoint(remark);
|
||||
requestLog.setRequestMethod("post");
|
||||
requestLog.setRequestHeaders(null);
|
||||
requestLog.setRequestBody(param);
|
||||
requestLog.setRequestUrl(url);
|
||||
try {
|
||||
String resStr = HttpUtil.post(url, param);
|
||||
// String resStr = HttpUtil.post(url, param);
|
||||
System.out.println(param);
|
||||
System.out.println(JSONUtil.toJsonStr(param));
|
||||
String resStr = HttpRequest.post(url)
|
||||
.contentType("application/json;")
|
||||
.body(param)
|
||||
.execute()
|
||||
.body();
|
||||
requestLog.setResponseBody(resStr);
|
||||
AjaxResult bean = JSONUtil.toBean(resStr, AjaxResult.class);
|
||||
if (Convert.toInt(bean.get("code")) == 200) {
|
||||
@@ -187,8 +199,8 @@ public class RequestLogServiceImpl implements IRequestLogService
|
||||
RequestLog requestLog = new RequestLog();
|
||||
requestLog.setRequestTime(DateUtil.formatDateTime(new Date()));
|
||||
requestLog.setRequestBody(param);
|
||||
requestLog.setSourceSystem("wms");
|
||||
requestLog.setTargetSystem("wcs");
|
||||
requestLog.setSourceSystem("wcs");
|
||||
requestLog.setTargetSystem("wms");
|
||||
requestLog.setEndpoint(remark);
|
||||
requestLog.setRequestMethod("post");
|
||||
requestLog.setResponseTime(DateUtil.formatDateTime(new Date()));
|
||||
|
||||
@@ -115,6 +115,6 @@ public class OutMydoJobController extends BaseController
|
||||
@PutMapping("/complete/{jobId}")
|
||||
public AjaxResult complete(@PathVariable("jobId") String jobId)
|
||||
{
|
||||
return mydoJobService.manualCompleteJob(jobId,"2");
|
||||
return mydoJobService.manualCompleteJob(jobId,2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class OutMydoJobDetailController extends BaseController
|
||||
{
|
||||
startPage();
|
||||
List<MydoJobDetail> list;
|
||||
if (StringUtils.isEmpty(mydoJobDetail.getStatus()) || Convert.toInt(mydoJobDetail.getStatus())<4){
|
||||
if (mydoJobDetail.getStatus() != null && Convert.toInt(mydoJobDetail.getStatus()) < 4){
|
||||
list = mydoJobDetailService.selectMydoJobDetailList(mydoJobDetail);
|
||||
}else {
|
||||
list = mydoJobDetailService.selectMydoJobDetailFinishList(mydoJobDetail);
|
||||
|
||||
@@ -2,6 +2,10 @@ package com.ruoyi.out.stockout.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
@@ -14,6 +18,10 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||
* @author ruoyi
|
||||
* @date 2026-05-12
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OutStockout extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -29,7 +37,7 @@ public class OutStockout extends BaseEntity
|
||||
@Excel(name = "单据来源")
|
||||
private String stockSource;
|
||||
|
||||
/** 单据状态 */
|
||||
/** 单据状态 单据状态 1 新建单据 2审核单据 3 单据执行 4 确认单据 5 作废单据 */
|
||||
@Excel(name = "单据状态")
|
||||
private String status;
|
||||
|
||||
@@ -83,185 +91,5 @@ public class OutStockout extends BaseEntity
|
||||
@Excel(name = "客户名称")
|
||||
private String customerName;
|
||||
|
||||
public void setStockoutId(String stockoutId)
|
||||
{
|
||||
this.stockoutId = stockoutId;
|
||||
}
|
||||
|
||||
public String getStockoutId()
|
||||
{
|
||||
return stockoutId;
|
||||
}
|
||||
|
||||
public void setOutType(String outType)
|
||||
{
|
||||
this.outType = outType;
|
||||
}
|
||||
|
||||
public String getOutType()
|
||||
{
|
||||
return outType;
|
||||
}
|
||||
|
||||
public void setStockSource(String stockSource)
|
||||
{
|
||||
this.stockSource = stockSource;
|
||||
}
|
||||
|
||||
public String getStockSource()
|
||||
{
|
||||
return stockSource;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setCreateDate(Date createDate)
|
||||
{
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
public Date getCreateDate()
|
||||
{
|
||||
return createDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate)
|
||||
{
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Date getStartDate()
|
||||
{
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setFinishDate(Date finishDate)
|
||||
{
|
||||
this.finishDate = finishDate;
|
||||
}
|
||||
|
||||
public Date getFinishDate()
|
||||
{
|
||||
return finishDate;
|
||||
}
|
||||
|
||||
public void setErpBill(String erpBill)
|
||||
{
|
||||
this.erpBill = erpBill;
|
||||
}
|
||||
|
||||
public String getErpBill()
|
||||
{
|
||||
return erpBill;
|
||||
}
|
||||
|
||||
public void setWarehouseId(String warehouseId)
|
||||
{
|
||||
this.warehouseId = warehouseId;
|
||||
}
|
||||
|
||||
public String getWarehouseId()
|
||||
{
|
||||
return warehouseId;
|
||||
}
|
||||
|
||||
public void setWarehouseName(String warehouseName)
|
||||
{
|
||||
this.warehouseName = warehouseName;
|
||||
}
|
||||
|
||||
public String getWarehouseName()
|
||||
{
|
||||
return warehouseName;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserName(String userName)
|
||||
{
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserName()
|
||||
{
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public Long getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName)
|
||||
{
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public String getDeptName()
|
||||
{
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setCustomerId(String customerId)
|
||||
{
|
||||
this.customerId = customerId;
|
||||
}
|
||||
|
||||
public String getCustomerId()
|
||||
{
|
||||
return customerId;
|
||||
}
|
||||
|
||||
public void setCustomerName(String customerName)
|
||||
{
|
||||
this.customerName = customerName;
|
||||
}
|
||||
|
||||
public String getCustomerName()
|
||||
{
|
||||
return customerName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("stockoutId", getStockoutId())
|
||||
.append("outType", getOutType())
|
||||
.append("stockSource", getStockSource())
|
||||
.append("status", getStatus())
|
||||
.append("createDate", getCreateDate())
|
||||
.append("startDate", getStartDate())
|
||||
.append("finishDate", getFinishDate())
|
||||
.append("erpBill", getErpBill())
|
||||
.append("warehouseId", getWarehouseId())
|
||||
.append("warehouseName", getWarehouseName())
|
||||
.append("userId", getUserId())
|
||||
.append("userName", getUserName())
|
||||
.append("deptId", getDeptId())
|
||||
.append("deptName", getDeptName())
|
||||
.append("customerId", getCustomerId())
|
||||
.append("customerName", getCustomerName())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,17 @@ package com.ruoyi.out.stockout.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.lang.UUID;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import com.ruoyi.api.service.ApiWcsService;
|
||||
import com.ruoyi.api.service.IApiWcsService;
|
||||
import com.ruoyi.bas.cargospace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService;
|
||||
import com.ruoyi.bas.id.job.mapper.BasJobIdMapper;
|
||||
import com.ruoyi.bas.id.taskno.service.IBasTaskNoService;
|
||||
import com.ruoyi.bas.stock.domain.BasStock;
|
||||
import com.ruoyi.bas.stock.domain.BasStockInfo;
|
||||
import com.ruoyi.bas.stock.service.IBasStockInfoService;
|
||||
import com.ruoyi.bas.stock.service.IBasStockService;
|
||||
import com.ruoyi.common.*;
|
||||
import com.ruoyi.common.Utils.DecimalUtil;
|
||||
import com.ruoyi.common.annotation.WarehouseScope;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.in.job.domain.MydoJob;
|
||||
@@ -26,6 +23,7 @@ import com.ruoyi.out.stockout.domain.OutStockoutManualAssignDTO;
|
||||
import com.ruoyi.out.stockoutdetail.service.IOutStockoutDetailService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.ruoyi.bas.id.job.service.IBasJobIdService;
|
||||
@@ -58,8 +56,6 @@ public class OutStockoutServiceImpl implements IOutStockoutService
|
||||
@Autowired
|
||||
private IBasJobIdService IBasJobIdService;
|
||||
@Autowired
|
||||
IOutStockoutService outStockoutService;
|
||||
@Autowired
|
||||
IOutStockoutDetailService outStockoutDetailService;
|
||||
@Autowired
|
||||
IBasStockService basStockService;
|
||||
@@ -74,7 +70,10 @@ public class OutStockoutServiceImpl implements IOutStockoutService
|
||||
@Autowired
|
||||
IBasJobIdService basJobIdService;
|
||||
@Autowired
|
||||
ApiWcsService apiWcsService;
|
||||
IBasTaskNoService basTaskNoService;
|
||||
@Autowired
|
||||
@Lazy
|
||||
IApiWcsService apiWcsService;
|
||||
|
||||
/**
|
||||
* 查询出库单据主信息
|
||||
@@ -89,7 +88,6 @@ public class OutStockoutServiceImpl implements IOutStockoutService
|
||||
* 查询出库单据主信息列表
|
||||
*/
|
||||
@Override
|
||||
@WarehouseScope
|
||||
public List<OutStockout> selectOutStockoutList(OutStockout outStockout)
|
||||
{
|
||||
return outStockoutMapper.selectOutStockoutList(outStockout);
|
||||
@@ -185,8 +183,8 @@ public class OutStockoutServiceImpl implements IOutStockoutService
|
||||
/**
|
||||
* 自动分配出库单据
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult autoAssignOutStockout(String stockoutId)
|
||||
// @Override
|
||||
public AjaxResult autoAssignOutStockout111111(String stockoutId)
|
||||
{
|
||||
StringBuilder str = new StringBuilder();
|
||||
List<OutStockoutDetail> details = outStockoutDetailMapper.selectOutStockoutDetailListByStockoutId(stockoutId);
|
||||
@@ -210,18 +208,23 @@ public class OutStockoutServiceImpl implements IOutStockoutService
|
||||
* 3.处理库存和货位账务
|
||||
* 4.>>>可能会触发出库移库
|
||||
*/
|
||||
// @Override
|
||||
public AjaxResult autoAssignOutStockout111111111111111111(String stockoutId)
|
||||
@Override
|
||||
public AjaxResult autoAssignOutStockout(String stockoutId)
|
||||
{
|
||||
//校验>>>出库单据明细
|
||||
List<OutStockoutDetail> details = outStockoutDetailService.selectOutStockoutDetailList(
|
||||
new OutStockoutDetail().builder().stockoutId(stockoutId).build()
|
||||
);
|
||||
if (details.size() == 0){
|
||||
log.warn("【出库单据分配】操作异常,未找到该单据号对应的出库明细,单据号:{}", stockoutId);
|
||||
return AjaxResult.error("操作异常,未找到该单据号对应的出库明细");
|
||||
OutStockout outStockout = selectOutStockoutByStockoutId(stockoutId);
|
||||
if (!outStockout.getStatus().equals(StockStatusEnum.RUNNING.getCode())){
|
||||
log.warn("【出库分配】操作失败,非<执行>状态的单据不能进行分配操作,请先审核完成后点击<执行>操作,单据号:{}", stockoutId);
|
||||
return AjaxResult.error("非【执行】状态的单据不能进行分配操作");
|
||||
}
|
||||
|
||||
//校验>>>出库单据明细
|
||||
List<OutStockoutDetail> details = outStockoutDetailService.selectOutStockoutDetailList(
|
||||
new OutStockoutDetail().builder().stockoutId(stockoutId).allotNum(BigDecimal.valueOf(0)).build()
|
||||
);
|
||||
if (details.size() == 0){
|
||||
log.warn("【出库单据分配】操作已中止,未找到该单据号的子单明细或者没有可分配的物料,单据号:{}", stockoutId);
|
||||
return AjaxResult.error("操作异常,未找到该单据号的子单明细或者没有可分配的物料");
|
||||
}
|
||||
|
||||
int num = 1;
|
||||
|
||||
@@ -230,36 +233,38 @@ public class OutStockoutServiceImpl implements IOutStockoutService
|
||||
//>>>>>>>>>>>>>>>>>>>>>>分配物料<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
for (OutStockoutDetail detail : details) {
|
||||
|
||||
//>>>辊号(物料)校验
|
||||
//>>>辊号(物料)校验
|
||||
if (ObjUtil.isNull(basStockService.selectBasStockByRollerNumber(detail.getRollerNumber()))){
|
||||
log.warn("【出库分配异常】找不到该辊号的物料库存,辊号:{}", detail.getRollerNumber());
|
||||
log.warn("【出库分配异常】找不到该版辊的库存信息,辊号:{}", detail.getRollerNumber());
|
||||
continue;
|
||||
}
|
||||
|
||||
//1.获取子单明细中辊号对应的库存
|
||||
//1.获取子单明细辊号对应的库存,拿到出库板棍的托盘号用于生成主作业
|
||||
BasStock stock = basStockService.selectBasStockByRollerNumber(detail.getRollerNumber());
|
||||
|
||||
//>>>获取出库货位
|
||||
//注意:如果<货位是双伸>且<单伸位有货>的情况则触发【移库作业】
|
||||
//>>>获取出库货位 - 如果是<双伸货位>且对应<单伸货位有货>的情况则触发【移库作业】
|
||||
BasCargoSpace cargoCurrent = basCargoSpaceService.selectBasCargoSpaceByCargoSpaceId(stock.getCargoSpaceId());
|
||||
|
||||
//【移库判断】如果双伸位,则需要额外判断其对应的单伸货位状态和库存
|
||||
if (cargoCurrent.getIssDouble().equals(CargoSpaceCode.CARGOSPACE_ISDOUBLE_Y)){
|
||||
//【移库判断-1】查询对应单/双伸位相对应的双/单伸位(同列同层,堆垛机同侧) - 此处获取双伸对应的单伸货位
|
||||
//【移库判断-1】此处获取出库双伸货位对应的外侧单伸货位号进行移库
|
||||
BasCargoSpace cargoSingle = basCargoSpaceService.selectAnotherBasCargoSpaceBySameGroup(cargoCurrent);
|
||||
//【移库判断-2】如果单伸位有货,触发移库作业
|
||||
if (cargoSingle.getStatus().equals(CargoSpaceCode.CARGOSPACE_STATUS_OCCUPIED)){
|
||||
|
||||
String moveJobId = basJobIdService.getId(JobIdType.MYDOJOB_MOVE);
|
||||
String moveTaskNo = basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKOUT);
|
||||
BasCargoSpace targetCargo = basCargoSpaceService.selectBasCargoSpaceForStockin(
|
||||
new BasCargoSpace().builder().theType(cargoSingle.getTheType()).roadwayId(cargoSingle.getRoadwayId()).build()
|
||||
new BasCargoSpace().builder().theType(cargoCurrent.getTheType()).roadwayId(cargoCurrent.getRoadwayId()).build()
|
||||
);
|
||||
|
||||
//生成并推送移库
|
||||
MydoJob moveJob = new MydoJob().builder()
|
||||
.jobId(moveJobId)
|
||||
.taskNo(moveTaskNo)
|
||||
.status(TaskStatusEnum.READY.getCode())
|
||||
.inOrOut(TaskType.TASKTYPE_STOCK_MOVE)
|
||||
.inOrOut(TaskType.TASKTYPE_PICK_STOCK_MOVE)
|
||||
.executionPhase("0")
|
||||
.trayCode(cargoSingle.getTrayCode())
|
||||
.trayType(cargoSingle.getTheType())
|
||||
.roadwayId(cargoSingle.getRoadwayId())
|
||||
.cargoSpaceId(cargoSingle.getCargoSpaceId())
|
||||
@@ -267,10 +272,12 @@ public class OutStockoutServiceImpl implements IOutStockoutService
|
||||
.priority(0)
|
||||
.build();
|
||||
|
||||
log.info("【出库分配】出库双伸货位外侧有货,生成移库作业,作业号:{},移库货位:{},目标货位:{}", moveJobId, cargoSingle.getCargoSpaceId(), targetCargo.getCargoSpaceId());
|
||||
|
||||
//推送移库
|
||||
AjaxResult ajaxResult;
|
||||
|
||||
/*-----------------推送wcs任务----------------- */
|
||||
/*-----------------推送wcs移库任务----------------- */
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("reqCode", UUID.randomUUID().toString());//请求码
|
||||
paramMap.put("jobId", moveJob.getJobId());//容器编号
|
||||
@@ -278,10 +285,13 @@ public class OutStockoutServiceImpl implements IOutStockoutService
|
||||
paramMap.put("cargoSpaceId", moveJob.getCargoSpaceId());//货位
|
||||
paramMap.put("targetCargoSpaceId", moveJob.getTargetCargoSpaceId());//目标货位
|
||||
paramMap.put("inOrOut", moveJob.getInOrOut());//任务类型
|
||||
paramMap.put("priority", 0);//任务优先级
|
||||
|
||||
ajaxResult = apiWcsService.sendMoveMydoJob(paramMap);
|
||||
log.info(
|
||||
"【出库分配-移库】推送wcs移库作业,作业号:{},托盘条码:{},移库货位:{},目标货位:{}", moveJob.getJobId(), moveJob.getTrayCode(), moveJob.getCargoSpaceId(), moveJob.getTargetCargoSpaceId()
|
||||
);
|
||||
if (ajaxResult.isSuccess()){
|
||||
|
||||
//生成托盘主作业
|
||||
mydoJobService.insertMydoJob(moveJob);
|
||||
|
||||
@@ -289,15 +299,14 @@ public class OutStockoutServiceImpl implements IOutStockoutService
|
||||
num = 1;
|
||||
|
||||
log.info(
|
||||
"【推送移库】生成并推送wcs作业成功,作业号:{},托盘条码:{},源货位:{},目标货位:{}", moveJob.getJobId(), moveJob.getTrayCode(), moveJob.getCargoSpaceId(), moveJob.getTargetCargoSpaceId()
|
||||
"【出库分配-移库】推送成功,作业号:{},托盘条码:{},移库货位:{},目标货位:{}", moveJob.getJobId(), moveJob.getTrayCode(), moveJob.getCargoSpaceId(), moveJob.getTargetCargoSpaceId()
|
||||
);
|
||||
|
||||
//todo 更新库存货位
|
||||
stock.setCargoSpaceId(targetCargo.getCargoSpaceId());
|
||||
stock.setStockStatus(StockCode.STOCK_STATUS_OCCUPIED);
|
||||
//更新库存表货位【占用】状态
|
||||
stock.setStockStatus(BasStockCode.STOCK_STATUS_OCCUPIED);
|
||||
basStockService.updateBasStock(stock);
|
||||
|
||||
//todo 更新货位
|
||||
//更新货位表【预占用】状态
|
||||
basCargoSpaceService.updateBasCargoSpaceStatus(cargoSingle.getCargoSpaceId(),cargoSingle.getTrayCode(),CargoSpaceCode.CARGOSPACE_STATUS_PRE_STOCKOUT);
|
||||
basCargoSpaceService.updateBasCargoSpaceStatus(targetCargo.getCargoSpaceId(),cargoSingle.getTrayCode(),CargoSpaceCode.CARGOSPACE_STATUS_PRE_STOCKIN);
|
||||
|
||||
@@ -305,53 +314,58 @@ public class OutStockoutServiceImpl implements IOutStockoutService
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}//执行完移库判断
|
||||
|
||||
//2.生成辊号库存对应托盘的出库作业
|
||||
//2.生成辊号库存对应托盘的出库作业
|
||||
MydoJob mydoJob = mydoJobService.selectMydoJobByTrayCode(stock.getTrayCode());
|
||||
if (ObjUtil.isNull(mydoJob)){
|
||||
|
||||
String jobId = basJobIdService.getId(JobIdType.MYDOJOB_STOCKOUT);
|
||||
String taskNo = basTaskNoService.getTaskNo(TaskIdType.TASK_STOCKOUT);
|
||||
|
||||
//判断出库类型,用于确定完成后是否生成回流任务
|
||||
//获取生成出库任务的托盘库存集合
|
||||
// 遍历托盘库存的辊号在子单明细中是否全部存在
|
||||
// 如果全部匹配,则任务类型为整托出库,否则为拣选出库
|
||||
int taskType = TaskType.TASKTYPE_STOCKOUT;
|
||||
List<BasStock> stocks = basStockService.selectBasStockList(
|
||||
new BasStock().builder().trayCode(stock.getTrayCode()).build()
|
||||
);
|
||||
|
||||
for(BasStock stockByTrayCode : stocks){
|
||||
//子单明细中进行库存辊号匹配
|
||||
if (details.stream().anyMatch(s -> !s.getRollerNumber().equals(stockByTrayCode.getRollerNumber()))){
|
||||
taskType = TaskType.TASKTYPE_STOCKOUT_PICKING;
|
||||
break;
|
||||
}
|
||||
//---1.遍历子单明细的辊号集合是否包含出库托盘库存的辊号集合
|
||||
//---2.如果全部匹配,则任务类型为整托出库,否则为拣选出库
|
||||
int taskType = TaskType.TASKTYPE_STOCKOUT_PICKING;
|
||||
//匹配出库版辊确认是【整托出库】还是【拣选出库】
|
||||
List<String> detailRollerNumbers = outStockoutDetailService.selectOutStockoutDetailRollerNumberList(detail.getStockoutId());//【子单所有辊号集合】
|
||||
List<String> stockRollerNumbers = basStockService.selectBasStockRollerNumberList(stock.getTrayCode());//【库存托盘辊号集合】
|
||||
if (detailRollerNumbers.containsAll(stockRollerNumbers)){
|
||||
taskType = TaskType.TASKTYPE_STOCKOUT;
|
||||
}
|
||||
|
||||
mydoJob = new MydoJob().builder()
|
||||
.jobId(jobId)
|
||||
.taskNo(taskNo)
|
||||
.status(TaskStatusEnum.READY.getCode())
|
||||
.inOrOut(taskType)
|
||||
.trayType(stock.getTrayType())
|
||||
.executionPhase("0")
|
||||
.trayCode(cargoCurrent.getTrayCode())
|
||||
.trayType(cargoCurrent.getTheType())
|
||||
.roadwayId(cargoCurrent.getRoadwayId())
|
||||
.cargoSpaceId(cargoCurrent.getCargoSpaceId())
|
||||
.cargoSpaceName(cargoCurrent.getThePlatoon() + "排" + cargoCurrent.getTheColumn() + "列" + cargoCurrent.getTheFloor() + "层")
|
||||
.priority(10)
|
||||
.build();
|
||||
|
||||
|
||||
//todo 推送出库
|
||||
//>>>>>>>>>>>>>>>>>>>>>> 推送出库 <<<<<<<<<<<<<<<<<<<<<<<
|
||||
//>>>>>>>>>>>>>>>>>>>>>> 推送出库 <<<<<<<<<<<<<<<<<<<<<<<
|
||||
//>>>>>>>>>>>>>>>>>>>>>> 推送出库 <<<<<<<<<<<<<<<<<<<<<<<
|
||||
AjaxResult ajaxResult;
|
||||
/*-----------------推送wcs任务----------------- */
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("reqCode", UUID.randomUUID().toString());//请求码
|
||||
paramMap.put("jobId", mydoJob.getJobId());//容器编号
|
||||
paramMap.put("trayCode", mydoJob.getTrayCode().trim());//容器编号
|
||||
paramMap.put("jobId", mydoJob.getJobId());//作业号
|
||||
paramMap.put("taskNo", mydoJob.getTaskNo());//任务号
|
||||
paramMap.put("trayCode", mydoJob.getTrayCode());//容器编号
|
||||
paramMap.put("cargoSpaceId", mydoJob.getCargoSpaceId());//货位
|
||||
paramMap.put("inOrOut", mydoJob.getInOrOut());//任务类型
|
||||
|
||||
ajaxResult = apiWcsService.sendOutMydoJob(paramMap);
|
||||
|
||||
log.info("【推送出库】推送wcs出库作业,作业号:{},托盘条码:{},分配货位:{}", mydoJob.getJobId(), mydoJob.getTrayCode(), mydoJob.getCargoSpaceId());
|
||||
|
||||
if (ajaxResult.isSuccess()){
|
||||
|
||||
//生成托盘主作业
|
||||
@@ -362,15 +376,11 @@ public class OutStockoutServiceImpl implements IOutStockoutService
|
||||
|
||||
log.info("【推送出库】生成并推送wcs作业成功,作业号:{},托盘条码:{},分配货位:{}", mydoJob.getJobId(), mydoJob.getTrayCode(), mydoJob.getCargoSpaceId());
|
||||
|
||||
//todo 更新库存明细
|
||||
stock.setStockStatus(StockStatusEnum.OCCUPIED.getCode());
|
||||
basStockService.updateBasStock(stock);
|
||||
|
||||
//todo 更新货位
|
||||
//更新货位【预占用】
|
||||
cargoCurrent.setStatus(CargoSpaceCode.CARGOSPACE_STATUS_PRE_STOCKOUT);
|
||||
basCargoSpaceService.updateBasCargoSpace(cargoCurrent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -378,26 +388,38 @@ public class OutStockoutServiceImpl implements IOutStockoutService
|
||||
mydoJobDetailService.insertMydoJobDetail(
|
||||
new MydoJobDetail().builder()
|
||||
.jobId(mydoJob.getJobId())
|
||||
.jobDetailId(mydoJob.getJobId() + num)
|
||||
.jobDetailId(mydoJob.getJobId() + "-" + num++)
|
||||
.inOrOutId(detail.getStockoutId())
|
||||
.inOrOutDId(detail.getStockoutDetailId())
|
||||
.stockinId(stock.getStockinId())
|
||||
.stockinDetailId(detail.getStockoutDetailId())
|
||||
.stockinDetailId(stock.getStockinDetailId())
|
||||
.productId(detail.getProductId())
|
||||
.productName(stock.getProductName())
|
||||
.lotNo(detail.getLotNo())
|
||||
.stockQuantity(Convert.toInt(stock.getQuantity()))
|
||||
.outQuantity(Convert.toInt(detail.getQuantity()))
|
||||
.status("0")
|
||||
.inDate(stock.getInDate().toString())
|
||||
.stockQuantity(stock.getQuantity())
|
||||
.outQuantity(BigDecimal.ZERO)
|
||||
.trayType(cargoCurrent.getTheType())
|
||||
.status(0)
|
||||
.inDate(stock.getInDate())
|
||||
.rollerNumber(stock.getRollerNumber())
|
||||
.build()
|
||||
);
|
||||
|
||||
num++;
|
||||
//更新库存明细【占用】
|
||||
stock.setStockStatus(BasStockStatusEnum.OCCUPIED.getCode());//库存状态
|
||||
stock.setOutQuantity(detail.getQuantity());//出库数量
|
||||
basStockService.updateBasStock(stock);
|
||||
|
||||
//生成子作业后更新子单【分配数量】
|
||||
detail.setAllotNum(BigDecimal.valueOf(1));
|
||||
outStockoutDetailService.updateOutStockoutDetail(detail);
|
||||
|
||||
log.info("【出库分配】生成子作业,作业号:{},辊号:{}", mydoJob.getJobId(), stock.getRollerNumber());
|
||||
|
||||
}
|
||||
|
||||
log.info("【出库单据分配】分配成功,单据号:{}", details.get(0).getStockoutId());
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -44,12 +44,12 @@ public class OutStockoutDetailController extends BaseController
|
||||
public TableDataInfo list(OutStockoutDetail outStockoutDetail)
|
||||
{
|
||||
startPage();
|
||||
List<OutStockoutDetail> list;
|
||||
if (StringUtils.isEmpty(outStockoutDetail.getStatus()) || Convert.toInt(outStockoutDetail.getStatus()) < 4){
|
||||
list = outStockoutDetailService.selectOutStockoutDetailList(outStockoutDetail);
|
||||
}else {
|
||||
list = outStockoutDetailService.selectOutStockoutDetailFinishList(outStockoutDetail);
|
||||
}
|
||||
List<OutStockoutDetail> list = outStockoutDetailService.selectOutStockoutDetailList(outStockoutDetail);
|
||||
// if (StringUtils.isEmpty(outStockoutDetail.getStatus()) || Convert.toInt(outStockoutDetail.getStatus()) < 4){
|
||||
// list = outStockoutDetailService.selectOutStockoutDetailList(outStockoutDetail);
|
||||
// }else {
|
||||
// list = outStockoutDetailService.selectOutStockoutDetailFinishList(outStockoutDetail);
|
||||
// }
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,111 +60,18 @@ public class OutStockoutDetail extends BaseEntity
|
||||
@Excel(name = "实际数量")
|
||||
private BigDecimal assignNum;
|
||||
|
||||
/** 状态 */
|
||||
private String status;
|
||||
/** 规格 */
|
||||
@Excel(name = "规格")
|
||||
String spec;
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
/** 色序 */
|
||||
Integer colorSequence;
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
/** 颜色 */
|
||||
String color;
|
||||
|
||||
public void setStockoutDetailId(String stockoutDetailId)
|
||||
{
|
||||
this.stockoutDetailId = stockoutDetailId;
|
||||
}
|
||||
/** 状态 0-未完成分配 1-出库完成等待回传 2-回传成功 */
|
||||
private int status;
|
||||
|
||||
public String getStockoutDetailId()
|
||||
{
|
||||
return stockoutDetailId;
|
||||
}
|
||||
|
||||
public void setStockoutId(String stockoutId)
|
||||
{
|
||||
this.stockoutId = stockoutId;
|
||||
}
|
||||
|
||||
public String getStockoutId()
|
||||
{
|
||||
return stockoutId;
|
||||
}
|
||||
|
||||
public void setLotNo(String lotNo)
|
||||
{
|
||||
this.lotNo = lotNo;
|
||||
}
|
||||
|
||||
public String getLotNo()
|
||||
{
|
||||
return lotNo;
|
||||
}
|
||||
|
||||
public void setProductId(String productId)
|
||||
{
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getProductId()
|
||||
{
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductName(String productName)
|
||||
{
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getProductName()
|
||||
{
|
||||
return productName;
|
||||
}
|
||||
|
||||
public void setQuantity(BigDecimal quantity)
|
||||
{
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public BigDecimal getQuantity()
|
||||
{
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setAllotNum(BigDecimal allotNum)
|
||||
{
|
||||
this.allotNum = allotNum;
|
||||
}
|
||||
|
||||
public BigDecimal getAllotNum()
|
||||
{
|
||||
return allotNum;
|
||||
}
|
||||
|
||||
public void setAssignNum(BigDecimal assignNum)
|
||||
{
|
||||
this.assignNum = assignNum;
|
||||
}
|
||||
|
||||
public BigDecimal getAssignNum()
|
||||
{
|
||||
return assignNum;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("stockoutDetailId", getStockoutDetailId())
|
||||
.append("stockoutId", getStockoutId())
|
||||
.append("lotNo", getLotNo())
|
||||
.append("productId", getProductId())
|
||||
.append("productName", getProductName())
|
||||
.append("quantity", getQuantity())
|
||||
.append("allotNum", getAllotNum())
|
||||
.append("assignNum", getAssignNum())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,13 @@ public interface OutStockoutDetailMapper
|
||||
*/
|
||||
List<OutStockoutDetail> selectOutStockoutDetailListByStockoutId(String stockoutId);
|
||||
|
||||
/**
|
||||
* 获取未完成的出库单据明细
|
||||
* @param outStockoutDetail
|
||||
* @return
|
||||
*/
|
||||
List<OutStockoutDetail> outboundTaskList(OutStockoutDetail outStockoutDetail);
|
||||
|
||||
/**
|
||||
* 查询出库单据子信息完成列表
|
||||
* @param outStockoutDetail
|
||||
|
||||
@@ -27,6 +27,13 @@ public interface IOutStockoutDetailService
|
||||
*/
|
||||
public OutStockoutDetail selectOutStockoutDetailByRollerNumber(String rollerNumber);
|
||||
|
||||
/**
|
||||
* 获取未完成的出库单据明细
|
||||
* @param outStockoutDetail
|
||||
* @return
|
||||
*/
|
||||
List<OutStockoutDetail> outboundTaskList(OutStockoutDetail outStockoutDetail);
|
||||
|
||||
/**
|
||||
* 查询出库单据子信息列表
|
||||
*
|
||||
@@ -35,6 +42,14 @@ public interface IOutStockoutDetailService
|
||||
*/
|
||||
public List<OutStockoutDetail> selectOutStockoutDetailList(OutStockoutDetail outStockoutDetail);
|
||||
|
||||
/**
|
||||
* 查询辊号子信息列表
|
||||
*
|
||||
* @param stockoutId 出库单号
|
||||
* @return 子单辊号集合
|
||||
*/
|
||||
public List<String> selectOutStockoutDetailRollerNumberList(String stockoutId);
|
||||
|
||||
/**
|
||||
* 新增出库单据子信息
|
||||
*
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.ruoyi.out.stockoutdetail.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -36,6 +38,11 @@ public class OutStockoutDetailServiceImpl implements IOutStockoutDetailService
|
||||
return outStockoutDetailMapper.selectOutStockoutDetailByRollerNumber(rollerNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OutStockoutDetail> outboundTaskList(OutStockoutDetail outStockoutDetail){
|
||||
return outStockoutDetailMapper.outboundTaskList(outStockoutDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询出库单据子信息列表
|
||||
*
|
||||
@@ -48,6 +55,29 @@ public class OutStockoutDetailServiceImpl implements IOutStockoutDetailService
|
||||
return outStockoutDetailMapper.selectOutStockoutDetailList(outStockoutDetail);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询辊号子信息列表
|
||||
*
|
||||
* @param stockoutId 出库单号
|
||||
* @return 子单辊号集合
|
||||
*/
|
||||
@Override
|
||||
public List<String> selectOutStockoutDetailRollerNumberList(String stockoutId){
|
||||
|
||||
List<String> list = new ArrayList<String>();
|
||||
List<OutStockoutDetail> details = selectOutStockoutDetailList(
|
||||
new OutStockoutDetail().builder().stockoutId(stockoutId).build()
|
||||
);
|
||||
|
||||
for (OutStockoutDetail detail : details) {
|
||||
list.add(detail.getRollerNumber());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增出库单据子信息
|
||||
*
|
||||
|
||||
@@ -108,6 +108,6 @@ public class PdInMydoJobController extends BaseController
|
||||
@PutMapping("/complete/{jobId}")
|
||||
public AjaxResult complete(@PathVariable("jobId") String jobId)
|
||||
{
|
||||
return mydoJobService.manualCompleteJob(jobId,"2");
|
||||
return mydoJobService.manualCompleteJob(jobId,2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +115,6 @@ public class PdOutMydoJobController extends BaseController
|
||||
@PutMapping("/complete/{jobId}")
|
||||
public AjaxResult complete(@PathVariable("jobId") String jobId)
|
||||
{
|
||||
return mydoJobService.manualCompleteJob(jobId,"2");
|
||||
return mydoJobService.manualCompleteJob(jobId,2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class PdInMydoJobDetailController extends BaseController
|
||||
{
|
||||
startPage();
|
||||
List<MydoJobDetail> list;
|
||||
if (StringUtils.isEmpty(mydoJobDetail.getStatus()) || Convert.toInt(mydoJobDetail.getStatus())<4){
|
||||
if (mydoJobDetail.getStatus() != null && Convert.toInt(mydoJobDetail.getStatus())<4){
|
||||
list = mydoJobDetailService.selectMydoJobDetailList(mydoJobDetail);
|
||||
}else {
|
||||
list = mydoJobDetailService.selectMydoJobDetailFinishList(mydoJobDetail);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class PdOutMydoJobDetailController extends BaseController
|
||||
{
|
||||
startPage();
|
||||
List<MydoJobDetail> list;
|
||||
if (StringUtils.isEmpty(mydoJobDetail.getStatus()) || Convert.toInt(mydoJobDetail.getStatus())<4){
|
||||
if (mydoJobDetail.getStatus() != null && Convert.toInt(mydoJobDetail.getStatus())<4){
|
||||
list = mydoJobDetailService.selectMydoJobDetailList(mydoJobDetail);
|
||||
}else {
|
||||
list = mydoJobDetailService.selectMydoJobDetailFinishList(mydoJobDetail);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user