no message

main
HUOJIN\92525 2024-04-18 16:34:24 +08:00
parent 142718f5af
commit c79a29817a
5 changed files with 79 additions and 19 deletions

View File

@ -11,11 +11,11 @@ import lombok.Data;
public class ReturnIssueInfo { public class ReturnIssueInfo {
@ApiModelProperty(value = "接口编码") @ApiModelProperty(value = "接口编码")
@Schema(example = "MLS-WQ-006") @Schema(example = "MLS-YC-001")
String ifaceCode; String ifaceCode;
@ApiModelProperty(value = "来源系统") @ApiModelProperty(value = "来源系统")
@Schema(example = "WQ") @Schema(example = "WMS")
String sourceSystem; String sourceSystem;
@ApiModelProperty(value = "参数") @ApiModelProperty(value = "参数")

View File

@ -8,24 +8,17 @@ import java.util.Set;
@Data @Data
public class ReturnIssueInfoParams { public class ReturnIssueInfoParams {
@ApiModelProperty(value = "类型")
@Schema(example = "ISSUE")
String billType;
@ApiModelProperty(value = "库存组织id") @ApiModelProperty(value = "库存组织id")
@Schema(example = "100219") @Schema(example = "100219")
int orgId; int orgId;
@ApiModelProperty(value = "任务号")
@Schema(example = "YCJL2024040300001")
String taskNumber;
@ApiModelProperty(value = "标签集合") @ApiModelProperty(value = "标签集合")
@Schema(example = "[\"DC0001\"]") @Schema(example = "[\"DC0001\"]")
Set labelNos; Set labelNo;
@ApiModelProperty(value = "子库编码")
@Schema(example = "MC1311")
String invCode;
@ApiModelProperty(value = "需求工单")
@Schema(example = "ZZ总部18210606021401")
String workOrderName;
} }

View File

@ -8,6 +8,8 @@ import com.youchain.appupdate.inputJson.MissionStateCallback;
import com.youchain.businessdata.domain.AgvTask; import com.youchain.businessdata.domain.AgvTask;
import com.youchain.businessdata.domain.ItemKey; import com.youchain.businessdata.domain.ItemKey;
import com.youchain.businessdata.domain.Task; import com.youchain.businessdata.domain.Task;
import com.youchain.businessdata.inputJson.ReturnIssueInfo;
import com.youchain.businessdata.inputJson.ReturnIssueInfoParams;
import com.youchain.businessdata.inputJson.ReturnMoInfo; import com.youchain.businessdata.inputJson.ReturnMoInfo;
import com.youchain.businessdata.inputJson.ReturnMoParams; import com.youchain.businessdata.inputJson.ReturnMoParams;
import com.youchain.businessdata.repository.TaskRepository; import com.youchain.businessdata.repository.TaskRepository;
@ -27,6 +29,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -76,6 +79,8 @@ public class KMReSController {
//回传 //回传
if (agvTask.getType().equals(BizStatus.ASN)) { if (agvTask.getType().equals(BizStatus.ASN)) {
returnMo(task.getItemKey().getOrderNumber()); returnMo(task.getItemKey().getOrderNumber());
} else if (agvTask.getType().equals(BizStatus.PICK)) {
returnIssue(task);
} }
return new ResponseEntity<>(ApiResult.success(OK.value(), "", ""), HttpStatus.OK); return new ResponseEntity<>(ApiResult.success(OK.value(), "", ""), HttpStatus.OK);
} catch (Exception e) { } catch (Exception e) {
@ -84,7 +89,13 @@ public class KMReSController {
} }
public void returnMo(String orderNumber) { /**
* MO
*
* @param orderNumber
*/
@Async
public void returnMo( String orderNumber) {
OrderDto orderDto = orderService.findByBarcodeNumber(orderNumber); OrderDto orderDto = orderService.findByBarcodeNumber(orderNumber);
if (orderDto == null) { if (orderDto == null) {
@ -92,11 +103,12 @@ public class KMReSController {
} }
double receivedQty = agvTaskService.queryOrderNumberSum(orderNumber); double receivedQty = agvTaskService.queryOrderNumberSum(orderNumber);
String resultJson="";
if (receivedQty == orderDto.getReceivedQty()) { if (receivedQty == orderDto.getReceivedQty()) {
List<Task> tasks = taskService.findByOrderNumber(orderNumber); List<Task> tasks = taskService.findByOrderNumber(orderNumber);
ReturnMoInfo returnMoInfo = getReturnMoInfo(tasks); ReturnMoInfo returnMoInfo = getReturnMoInfo(tasks);
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
String resultJson = mlsService.returnMo(returnMoInfo); resultJson = mlsService.returnMo(returnMoInfo);
long endTime = System.currentTimeMillis(); long endTime = System.currentTimeMillis();
long time = endTime - startTime; long time = endTime - startTime;
JSONObject resulObject = JSON.parseObject(resultJson); JSONObject resulObject = JSON.parseObject(resultJson);
@ -119,6 +131,38 @@ public class KMReSController {
} }
} }
/**
*
*
* @param task
*/
@Async
public void returnIssue(@RequestBody Task task) {
ReturnIssueInfo returnIssueInfo = getReturnIssueInfo(task);
long startTime = System.currentTimeMillis();
String resultJson = mlsService.returnIssue(returnIssueInfo);
long endTime = System.currentTimeMillis();
long time = endTime - startTime;
JSONObject resulObject = JSON.parseObject(resultJson);
if (resulObject == null) {
throw new RuntimeException("按MO票入库接口返回数据为空!");
}
com.youchain.domain.Log newlogs = new com.youchain.domain.Log();
newlogs.setDescription("叫料结果回传");
newlogs.setLogType("INFO");
newlogs.setMethod(UrlApi.publicApi);
newlogs.setParams(JSON.toJSONString(returnIssueInfo));
newlogs.setReturnData(resultJson);
newlogs.setRequestIp("127.0.0.1");
newlogs.setTime(time);
newlogs.setUsername("admin");
newlogs.setAddress("内网IP");
newlogs.setBrowser("Chrome 123");
newlogs.setCreateTime(new Timestamp(new Date().getTime()));
logService.saveLog(newlogs);
}
private static ReturnMoInfo getReturnMoInfo(List<Task> tasks) { private static ReturnMoInfo getReturnMoInfo(List<Task> tasks) {
ReturnMoParams params = new ReturnMoParams(); ReturnMoParams params = new ReturnMoParams();
params.setOrgId(100059); params.setOrgId(100059);
@ -135,4 +179,20 @@ public class KMReSController {
returnMoInfo.setParams(params); returnMoInfo.setParams(params);
return returnMoInfo; return returnMoInfo;
} }
private static ReturnIssueInfo getReturnIssueInfo(Task task) {
ReturnIssueInfoParams params = new ReturnIssueInfoParams();
params.setOrgId(808);
params.setTaskNumber(task.getBillCode());
Set<String> labelNos = new HashSet<>();
labelNos.add(task.getItemKey().getPropC1());
params.setLabelNo(labelNos);
ReturnIssueInfo returnIssueInfo = new ReturnIssueInfo();
returnIssueInfo.setIfaceCode("MLS-YC-001");
returnIssueInfo.setSourceSystem("WMS");
returnIssueInfo.setParams(params);
return returnIssueInfo;
}
} }

View File

@ -36,6 +36,7 @@ import com.youchain.businessdata.service.dto.AgvTaskDto;
import com.youchain.businessdata.service.dto.AgvTaskQueryCriteria; import com.youchain.businessdata.service.dto.AgvTaskQueryCriteria;
import com.youchain.businessdata.service.mapstruct.AgvTaskMapper; import com.youchain.businessdata.service.mapstruct.AgvTaskMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
@ -468,6 +469,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
} else if (status.equals("UP_CONTAINER")) { } else if (status.equals("UP_CONTAINER")) {
} else if (status.equals("COMPLETED")) { } else if (status.equals("COMPLETED")) {
//入库
if (agvTask.getType().equals(BizStatus.ASN)) { if (agvTask.getType().equals(BizStatus.ASN)) {
//增加库存 //增加库存
AsnDetail ad = task.getAsnDetail(); AsnDetail ad = task.getAsnDetail();
@ -478,7 +480,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
task.setMoveQty(task.getPlanQty()); task.setMoveQty(task.getPlanQty());
taskService.update(task); taskService.update(task);
Stock stock = task.getSrcStock(); Stock stock = task.getSrcStock();
List<Inventory> inventoryList = inventoryService.queryInventory(stock); List<Inventory> inventoryList = inventoryService.queryInventory(stock);
for (Inventory inventory : inventoryList) { for (Inventory inventory : inventoryList) {
Long[] ids = new Long[1]; Long[] ids = new Long[1];
@ -486,7 +487,6 @@ public class AgvTaskServiceImpl implements AgvTaskService {
inventoryService.deleteAll(ids); inventoryService.deleteAll(ids);
} }
//生成库存 //生成库存
Inventory inventory = inventoryService.getInventory(task.getItemKey(), task.getDstPoint(), task.getSrcStock(), task.getDept(), BizStatus.RECEIVING_UP); Inventory inventory = inventoryService.getInventory(task.getItemKey(), task.getDstPoint(), task.getSrcStock(), task.getDept(), BizStatus.RECEIVING_UP);
inventory.setQuantity(task.getPlanQty()); inventory.setQuantity(task.getPlanQty());
@ -494,14 +494,14 @@ public class AgvTaskServiceImpl implements AgvTaskService {
inventoryLogService.storeInventoryLog(BizStatus.RECEIVING_UP, BizStatus.ADD, null, task.getItemKey(), task.getSrcPoint(), task.getDstPoint(), task.getSrcStock(), task.getSrcStock(), task.getPlanQty(), task.getPlanQty(), BizStatus.ASN, ad.getId(), inventory.getId(), ad.getRemark()); inventoryLogService.storeInventoryLog(BizStatus.RECEIVING_UP, BizStatus.ADD, null, task.getItemKey(), task.getSrcPoint(), task.getDstPoint(), task.getSrcStock(), task.getSrcStock(), task.getPlanQty(), task.getPlanQty(), BizStatus.ASN, ad.getId(), inventory.getId(), ad.getRemark());
} else if (agvTask.getType().equals(BizStatus.PICK)) { } else if (agvTask.getType().equals(BizStatus.PICK)) {
//处理实际逻辑 //出库
//扣除库存 //扣除库存
try { try {
taskService.pickConfirm(task.getId(), task.getPlanQty()); taskService.pickConfirm(task.getId(), task.getPlanQty());
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e.getMessage()); throw new RuntimeException(e.getMessage());
} }
//回传
} }

View File

@ -19,7 +19,9 @@ import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.youchain.basicdata.domain.Item; import com.youchain.basicdata.domain.Item;
import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.domain.Stock; import com.youchain.basicdata.domain.Stock;
import com.youchain.basicdata.repository.PointRepository;
import com.youchain.basicdata.repository.StockRepository; import com.youchain.basicdata.repository.StockRepository;
import com.youchain.basicdata.service.dto.StockSmallDto; import com.youchain.basicdata.service.dto.StockSmallDto;
import com.youchain.businessdata.ReturnJson.RPTaskList; import com.youchain.businessdata.ReturnJson.RPTaskList;
@ -69,6 +71,7 @@ public class TaskServiceImpl implements TaskService {
private final InventoryLogService inventoryLogService; private final InventoryLogService inventoryLogService;
private final EntityManager entityMapper; private final EntityManager entityMapper;
private final StockRepository stockRepository; private final StockRepository stockRepository;
private final PointRepository pointRepository;
@Override @Override
public Map<String, Object> queryAll(TaskQueryCriteria criteria, Pageable pageable) { public Map<String, Object> queryAll(TaskQueryCriteria criteria, Pageable pageable) {
Page<Task> page = taskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); Page<Task> page = taskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
@ -171,8 +174,12 @@ public class TaskServiceImpl implements TaskService {
inventoryRepository.delete(inv); inventoryRepository.delete(inv);
} }
Stock stock=inv.getStock(); Stock stock=inv.getStock();
Point point=stock.getPoint();
stock.setStatus(BaseStatus.FREE); stock.setStatus(BaseStatus.FREE);
stock.setPoint(null);
stockRepository.save(stock); stockRepository.save(stock);
point.setStatus(BaseStatus.FREE);
pointRepository.save(point);
//添加库存日志 //添加库存日志
inventoryLogService.storeInventoryLog(BizStatus.PICK_DOWN,BizStatus.REDUCE,task.getPickDetail().getPo(),task.getItemKey(),task.getSrcPoint(),task.getDstPoint(),task.getSrcStock(),task.getDstStock(),srcQty,pickedQuantity, BizStatus.PICK,task.getId(),inv.getId(),""); inventoryLogService.storeInventoryLog(BizStatus.PICK_DOWN,BizStatus.REDUCE,task.getPickDetail().getPo(),task.getItemKey(),task.getSrcPoint(),task.getDstPoint(),task.getSrcStock(),task.getDstStock(),srcQty,pickedQuantity, BizStatus.PICK,task.getId(),inv.getId(),"");