no message

main
HUOJIN\92525 2024-07-01 09:46:40 +08:00
parent 190271455e
commit a26c54f08c
6 changed files with 0 additions and 475 deletions

View File

@ -1,13 +0,0 @@
package com.youchain.appupdate.service;
import com.youchain.appupdate.inputJson.ContainerIn;
/**
*
*/
public interface ContainerService {
//容器出场
Boolean ContainerOut(ContainerIn containerIn);
//容器入场
Boolean ContainerIn(ContainerIn containerIn);
}

View File

@ -1,185 +0,0 @@
package com.youchain.appupdate.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.youchain.appupdate.inputJson.ContainerIn;
import com.youchain.appupdate.service.ContainerService;
import com.youchain.basicdata.domain.Item;
import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.domain.Stock;
import com.youchain.basicdata.service.BoxService;
import com.youchain.basicdata.service.ItemService;
import com.youchain.basicdata.service.PointService;
import com.youchain.basicdata.service.StockService;
import com.youchain.businessdata.domain.Inventory;
import com.youchain.businessdata.domain.Task;
import com.youchain.businessdata.service.*;
import com.youchain.businessdata.service.impl.InventoryLogServiceImpl;
import com.youchain.modules.system.service.DictService;
import com.youchain.utils.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service
@RequiredArgsConstructor
public class ContainerServiceImpl implements ContainerService {
private final ItemService itemService;
private final PointService pointService;
private final StockService stockService;
private final DictService dictService;
private final AgvTaskService agvTaskService;
private final InventoryService inventoryService;
private final InventoryLogServiceImpl invLogImpl;
private final BoxService boxService;
@Override
public Boolean ContainerOut(ContainerIn containerIn) {
String containerCode = containerIn.getContainerCode();
String position = containerIn.getPosition();
Stock stock = stockService.findByCode(containerCode, null);
if (stock == null) {
log.error("请扫描正确容器,操作失败!");
return false;
}
Point point = pointService.findByCode(position, null, null, null, null,null);
if (point == null) {
log.error("请扫描正确点位,操作失败!");
return false;
}
//出场查询是否有库存 有则出库存,没有则直接出场
List<Inventory> inventoryList = inventoryService.queryInventory(stock);
for (Inventory inventory : inventoryList) {
// if(inventory.getQueuedQty()>0){
// return new ResponseEntity<>(ApiResult.fail(BAD_REQUEST.value(), "容器对应库存锁定", ""), HttpStatus.BAD_REQUEST);
// }
invLogImpl.storeInventoryLog(BizStatus.INVENTORY_ADJUST, BizStatus.REDUCE, "容器出场", inventory.getItemKey(), inventory.getPoint(),
null, inventory.getStock(), null, inventory.getQuantity(), inventory.getQuantity(), null, null, inventory.getId(), "容器出场库存扣减");
inventory.setQuantity(0d);
inventory.setQueuedQty(0d);
inventoryService.update(inventory);
}
//调用容器出场接口
String jsonObject = "";
String agv_on_off = "OFF";
agv_on_off = dictService.getDictDescription("agv_on_off").getDescription();
String code = "0";
String message = null;
if (agv_on_off.equals("ON")) {
String resultJson = HttpPostUtil.sendPostReq(UrlApi.containerOut(), jsonObject.toString());
// String resultJson = "{\n" +
// " \"data\": null,\n" +
// " \"code\": 0,\n" +
// " \"message\": null,\n" +
// " \"success\": true\n" +
// "}";
JSONObject resulObject = JSON.parseObject(resultJson);
code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
message = resulObject.getString("message") == null ? "" : resulObject.getString("message");
}
if (code.equals("0")) {
stock.setPoint(null);
stock.setStatus(BaseStatus.FREE);
stockService.update(stock);
point.setStatus(BaseStatus.FREE);
pointService.update(point);
} else {
log.error("出场失败{}", message);
return false;
}
return true;
}
@Override
public Boolean ContainerIn(ContainerIn containerIn) {
String containerCode = containerIn.getContainerCode();//容器号
String position = containerIn.getPosition();//点位
//int checkCode = containerIn.getCheckCode();
Stock stock = stockService.findByCode(containerCode, null);
if (stock == null) {
log.error("请扫描正确容器,操作失败!");
return false;
}
Point point = pointService.findByCode(position, null, null, null, null,null);
if (point == null) {
log.error("请扫描正确点位,操作失败!");
return false;
}
String areaName = point.getArea().getCode();//库区
String code = "0";
String message = null;
String agv_on_off = "OFF";
String jsonObject = "";
agv_on_off = dictService.getDictDescription("agv_on_off") == null ? "OFF" : dictService.getDictDescription("agv_on_off").getDescription();
//空车入场和满车入场
if (areaName.equals(AreaNameDic.CPRKQ) || areaName.equals(AreaNameDic.FBQ)) {
//是否调用AGV
if (agv_on_off.equals("ON")) {
//调用容器入场接口
String resultJson = HttpPostUtil.sendPostReq(UrlApi.containerIn(), jsonObject.toString());
JSONObject resulObject = JSON.parseObject(resultJson);
code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
message = resulObject.getString("message") == null ? "" : resulObject.getString("message");
}
//空车入场
if (code.equals("0")) {
stock.setPoint(point);
stockService.update(stock);
point.setStatus(BaseStatus.USED);
pointService.update(point);
} else {
log.error("容器入场失败:{}", message);
return false;
}
} else if (areaName.equals(AreaNameDic.DJQ) || areaName.equals(AreaNameDic.XJQ)) {
//满车入场,需要物料号且生成库存信息
String itemCode = containerIn.getItemCode();//物料
Item item = itemService.existItem(itemCode);
if (item == null) {
log.error("{}区入场请物料编号!", areaName);
return false;
}
if ((point.getDescription() != null && !item.getGoodType().equals(point.getDescription()))) {
log.error("物料类型和点位对应的类型不匹配!");
return false;
}
//是否调用AGV
if (agv_on_off.equals("ON")) {
//调用容器入场接口
String resultJson = HttpPostUtil.sendPostReq(UrlApi.containerIn(), jsonObject.toString());
JSONObject resulObject = JSON.parseObject(resultJson);
code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
message = resulObject.getString("message") == null ? "" : resulObject.getString("message");
}
if (code.equals("0")) {
List<Inventory> inventoryList = inventoryService.queryInventory(stock);
for (Inventory inventory : inventoryList) {
Long[] ids = new Long[1];
ids[0] = inventory.getId();
inventoryService.deleteAll(ids);
}
Task task = boxService.createTask(item, stock, point);
Inventory inventory = inventoryService.getInventory(task.getItemKey(), task.getDstPoint(), task.getSrcStock(), task.getDept(), BizStatus.RECEIVING_UP);
inventory.addQty(inventory, task.getPlanQty());
inventoryService.update(inventory);
stock.setStatus(BaseStatus.USED);
stock.setPoint(inventory.getPoint());
stockService.update(stock);
point.setStatus(BaseStatus.USED);
pointService.update(point);
} else {
log.error("失败{}", message);
return false;
}
} else {
log.error("{}不能入场", areaName);
return false;
}
return true;
}
}

View File

@ -1,55 +0,0 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.youchain.modules.quartz.task;
import com.youchain.businessdata.domain.AgvTask;
import com.youchain.businessdata.repository.AgvTaskRepository;
import com.youchain.businessdata.service.AgvTaskService;
import com.youchain.utils.BizStatus;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
/**
*
* @author Liu Xue
* @date 2019-01-08
*/
@Slf4j
@Service
public class TestTask {
@Autowired
private AgvTaskRepository agvTaskRepository;
@Autowired
private AgvTaskService agvTaskService;
private static final int MAX_TASK_COUNT = 4;
private static final long TIMEOUT_MS = 600000; // 10分钟以毫秒为单位
private long lastTaskTime = System.currentTimeMillis();
public void TestTask2(){
}
}

View File

@ -1,67 +0,0 @@
package com.youchain.modules.quartz.task;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.youchain.businessdata.domain.AgvTask;
import com.youchain.businessdata.repository.AgvTaskRepository;
import com.youchain.businessdata.service.AgvTaskService;
import com.youchain.utils.BizStatus;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
*
*/
@Slf4j
@Service
public class asnTask {
@Autowired
public AgvTaskRepository agvTaskRepository;
@Autowired
public AgvTaskService agvTaskService;
private static final int MAX_TASK_COUNT = 4;
private static final long TIMEOUT_MS = 2*60*1000; // 2分钟以毫秒为单位
private long lastTaskTime = System.currentTimeMillis();
public void asnTask() {
//查询待执行已扫描的入库AGV任务
List<AgvTask> agvTasks = agvTaskRepository.queryByAgvTask(null, BizStatus.OPEN,BizStatus.ASN,1,"PICKER_MOVE");
if(agvTasks.size()>0){
if (agvTasks.size() == MAX_TASK_COUNT) {
log.info("小件入库料箱任务已满足,当前任务数:" + agvTasks.size());
String resultJson=agvTaskService.sendAgvTaskLXImpl(agvTasks);
log.info(resultJson);
lastTaskTime = System.currentTimeMillis();
} else if (System.currentTimeMillis() - lastTaskTime >=TIMEOUT_MS) {
if(agvTasks.size()>4){
List<AgvTask> newAgvTask = agvTasks.subList(0,4);
log.info("2分钟未满足4个小件入库料箱任务当前任务数" + newAgvTask.size());
String resultJson=agvTaskService.sendAgvTaskLXImpl(newAgvTask);
log.info(resultJson);
}else{
log.info("2分钟未满足4个小件入库料箱任务当前任务数" + agvTasks.size());
String resultJson=agvTaskService.sendAgvTaskLXImpl(agvTasks);
log.info(resultJson);
lastTaskTime = System.currentTimeMillis();
}
}else{
log.info("小件入库料箱任务未满足条件!");
}
}else{
log.info("无小件入库料箱任务!");
}
}
}

View File

@ -1,93 +0,0 @@
package com.youchain.modules.quartz.task;
import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.service.PointService;
import com.youchain.businessdata.domain.AgvTask;
import com.youchain.businessdata.repository.AgvTaskRepository;
import com.youchain.businessdata.service.AgvTaskService;
import com.youchain.modules.quartz.utils.TimeNumberUtils;
import com.youchain.utils.BaseStatus;
import com.youchain.utils.BizStatus;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
@Slf4j
@Service
public class gtcTask {
@Autowired
public AgvTaskRepository agvTaskRepository;
@Autowired
public AgvTaskService agvTaskService;
@Autowired
public PointService pointService;
public void gtcTask() {
//查询缓存输送线上的已扫描成功的满箱任务!
List<AgvTask> agvTaskList1 = agvTaskRepository.queryByAgvTask(null, BizStatus.OPEN, BizStatus.PICK, 1, "ROLLER_MOVE");
if (agvTaskList1.size() > 0) {
if (agvTaskList1.size() > 2) {
List<AgvTask> newAgvTask = agvTaskList1.subList(0, 2);
this.isussTask(newAgvTask);
} else {
this.isussTask(agvTaskList1);
}
} else {
log.info("无出库滚筒输送线任务!");
}
}
public void isussTask(List<AgvTask> agvTaskList1) {
List<AgvTask> agvTaskList2 = new ArrayList<>();//空箱任务
for (AgvTask agvTask : agvTaskList1) {
try {
//满箱任务的终点是线边空箱的起点;获取线边点位
Point startPoint = pointService.findByCode(agvTask.getEndSlotCode(), null, null, null, null,null);
String taskCode = startPoint.getName() + "2";//线边名称2代表空箱输送线
//出库缓存出库缓存滚筒输送线满箱接驳口为终点
Point endPoint = pointService.getPoint("", BaseStatus.FREE, BaseStatus.BOX, "出库缓存滚筒输送线满箱接驳口");
if (endPoint == null) {
log.info("出库缓存滚筒输送线满箱接驳口点位没有维护!");
return;
}
//线边任务执行中,不追加空箱任务
if (agvTaskService.findByendSlotCode(agvTask.getEndSlotCode(), BizStatus.EMPTY_OUT, "ROLLER_MOVE")) {
int count = agvTaskService.QueryCount(taskCode);//查询线边空箱的数量
if (count > 2) {
count = 2;
}
if (count > 0) {
//生成反空箱滚筒任务任务
for (int i = 0; i < count; i++) {
if (agvTaskList2.size() < 2) {
AgvTask newAgvTask = new AgvTask(BizStatus.EMPTY_OUT, TimeNumberUtils.getKLXTaskCode(), startPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "ROLLER_MOVE");
agvTaskService.create(newAgvTask);
agvTaskList2.add(newAgvTask);
}
}
}
} else {
log.info("线边任务执行中,不追加空箱任务!");
}
} catch (Exception e) {
log.info(e.getMessage());
}
}
String resultJson = agvTaskService.sendAgvTaskGTImpl(agvTaskList1, agvTaskList2);
log.info(resultJson);
}
}

View File

@ -1,62 +0,0 @@
package com.youchain.modules.quartz.task;
import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.service.PointService;
import com.youchain.businessdata.domain.AgvTask;
import com.youchain.businessdata.service.AgvTaskService;
import com.youchain.modules.quartz.utils.TimeNumberUtils;
import com.youchain.utils.BaseStatus;
import com.youchain.utils.BizStatus;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
@Slf4j
@Service
public class hkxTask {
@Autowired
public AgvTaskService agvTaskService;
@Autowired
public PointService pointService;
public void hkxTask() {
//有没有回入库空箱的任务
if (agvTaskService.findByendSlotCode("S-001-002-001-001",BizStatus.EMPTY_IN,"PICKER_MOVE")) {
int queryCount = agvTaskService.QueryCount("6x2");
if (queryCount >= 4 && queryCount <=6){
//起点
Point startPoint = pointService.getPoint("", BaseStatus.FREE, BaseStatus.BOX, "出库缓存输送线空箱接驳口");
//终点
Point endPoint = pointService.getPoint("", BaseStatus.FREE, BaseStatus.BOX, "入库输送线空箱接驳口");
//生成反空箱料箱任务任务
List<AgvTask> agvTaskList = new ArrayList<>();
for (int i = 0; i < queryCount; i++) {
AgvTask newAgvTask = new AgvTask(BizStatus.EMPTY_IN, TimeNumberUtils.getKLXTaskCode(), startPoint.getCode(), endPoint.getCode(), BizStatus.OPEN, "PICKER_MOVE");
agvTaskService.create(newAgvTask);
agvTaskList.add(newAgvTask);
}
String rul=agvTaskService.sendAgvTaskLXImpl(agvTaskList);
log.info(rul);
}else{
log.info("出库缓存输送线下层空箱不满足条件,不下发任务!");
}
}else{
log.info("有执行中回空箱的料箱入库任务!");
}
}
}