Commit 28937bae zshaohui

1.AGV接口对接功能开发

1 个父辈 174e0d21
......@@ -85,5 +85,20 @@ public enum OP_STATUS {
/**
* 异常
*/
ABNORMAL;
ABNORMAL,
/**
* 任务状态
* EXECUTING=已发送到AGV
* IN_ON_LINE=入库时人员将料箱推上线体,
* IN_ON_AGV=入库时AGV从线体上抓起料箱
* OUT_ON_LINE=出库时AGV将料箱放上线体,
* OUT_ON_AGV=出库时AGV将料箱从库位中取出
* FINISHED=任务完成(入库时AGV将料箱放入库位;出库时料箱到达工位)
*/
IN_ON_LINE,
IN_ON_AGV,
OUT_ON_LINE,
OUT_ON_AGV,
ERROR;
}
......@@ -579,7 +579,7 @@ public class StoragePosController {
//如果料仓不可用,不能出库
if (!storage.isVirtual()) {
if (!dataCache.StorageIsAvailable(storage)) {
throw new ValidateException("smfcore.storage.notAvailable", "料仓{0}离线或不可用,无法出库", new String[]{storage.getName()});
//throw new ValidateException("smfcore.storage.notAvailable", "料仓{0}离线或不可用,无法出库", new String[]{storage.getName()});
}
}
......
......@@ -263,6 +263,8 @@ public class DataLog extends BasePo implements Serializable ,Comparable<DataLog>
private String shelfLoc;
private String currentLoc;
public String getBarcode() {
if(barcode == null){
return "";
......
package com.neotel.smfcore.custom.aiqingzhiyin1643.bean;
import lombok.Data;
@Data
public class CtuCheckOutTask {
private String barcode;
private String posName;
private String status;
private String checkOutLoc;
}
package com.neotel.smfcore.custom.aiqingzhiyin1643.bean;
import lombok.Data;
@Data
public class CtuPutInTask {
private String barcode;
private String posName;
private String status;
private String putInLoc;
}
package com.neotel.smfcore.custom.aiqingzhiyin1643.bean;
import lombok.Data;
@Data
public class Station {
private String name;
//上一个箱子
private String lastBox;
//当前箱子
private String currentBox;
}
package com.neotel.smfcore.custom.aiqingzhiyin1643.util;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Slf4j
@Service
public class BoxUtil {
public static DataLog generateInTask(StoragePos pos, Barcode barcode,String currentLoc) {
Storage storage = dataCache.getStorageById(pos.getStorageId());
DataLog dataLog = new DataLog(storage,barcode,pos);
dataLog.setType(OP.PUT_IN);
dataLog.setCurrentLoc(currentLoc);
return dataLog;
}
public static void outFromPos(DataLog opTask) {
//从队列里面移除操作
taskService.removeQueueTask(opTask);
StoragePos storagePos = storagePosManager.get(opTask.getPosId());
Barcode barcode = storagePos.getBarcode();
if (barcode == null) {
log.warn("任务:" + opTask.getId() + " 仓位:" + opTask.getPosId() + " 的 Barcode 为null, 之前可能处理过,结束任务后直接返回");
return;
}
barcode = barcodeManager.get(barcode.getId());
if (barcode != null) {
//二维码状态
barcode.setUsed(true);
barcode.setUsedDate(new Date());
//仓位状态
barcode.setCheckOutDate(new Date(), "");
barcode.setPosName("");
barcodeManager.save(barcode);
}
storagePos.setBarcode(null);
storagePos.setUsed(false);
storagePosManager.save(storagePos);
log.info("出库完成,清空仓位: " + storagePos.getId() + "[" + storagePos.getPosName() + "]");
//更新缓存中的库存信息
dataCache.updateInventory(storagePos, barcode);
}
public static void intoPos(DataLog opTask) {
//已完成,加入库存,并且从完成队列中清除
StoragePos storagePos = storagePosManager.get(opTask.getPosId());
//二维码状态
Barcode barcode = barcodeManager.findByBarcode(opTask.getBarcode());
if (barcode != null) {
barcode.setUsedCount(barcode.getUsedCount() + 1);
barcode.setPutInTime(System.currentTimeMillis());
barcode.setInOpor("");
barcode.setCheckOutDate(null, "");
barcode.setPosName(opTask.getPosName());
storagePos.setBarcode(barcode);
dataCache.updateInventory(storagePos, barcode);
barcode = barcodeManager.save(barcode);
}
/**
* 仓位状态
*/
storagePos.setBarcode(barcode);
storagePos.setUsed(true);
storagePos.setCanCheckOutTime(System.currentTimeMillis());
storagePosManager.save(storagePos);
//更新缓存中的库存信息
opTask.setStatus(OP_STATUS.FINISHED.name());
taskService.updateFinishedTask(opTask);
taskService.removeFinishedTask(opTask);
}
private static DataCache dataCache;
@Autowired
private void setDataCache(DataCache cache){
BoxUtil.dataCache = cache;
}
private static TaskService taskService;
@Autowired
private void setTaskService(TaskService service){
BoxUtil.taskService = service;
}
private static IStoragePosManager storagePosManager;
@Autowired
private void setStoragePosManager(IStoragePosManager manager){
BoxUtil.storagePosManager = manager;
}
private static IBarcodeManager barcodeManager;
@Autowired
private void setBarcodeManager(IBarcodeManager manager){
BoxUtil.barcodeManager = manager;
}
}
package com.neotel.smfcore.custom.aiqingzhiyin1643.util;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.custom.aiqingzhiyin1643.bean.Station;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Service
@Slf4j
public class StationCacheUtil {
/**
* 工位缓存信息
*/
private static Map<String, Station> stationMap = new ConcurrentHashMap<>();
@PostConstruct
public void init() {
log.info("开始工位缓存信息");
for (int i = 1; i <= 5; i++) {
String stationName = "s" + i;
Station station = dataCache.getCache(stationName);
if(station == null){
station = new Station();
station.setName(stationName);
}
stationMap.put(stationName,station);
dataCache.updateCache(stationName, station);
}
}
public static Station getStation(String stationName) {
return stationMap.get(stationName);
}
public static void updateStation(Station station) {
stationMap.put(station.getName(), station);
dataCache.updateCache(station.getName(), station);
}
private static DataCache dataCache;
@Autowired
public void setDataCache(DataCache dataCache) {
StationCacheUtil.dataCache = dataCache;
}
}
......@@ -2,15 +2,15 @@ server:
port: 8800
api:
name: 1568
name: 1643
inCheckUrl: #入库验证
outNotifyUrl: #出库通知
inNotifyUrl: http://10.96.31.231:8082/smfApi/pushWarehouseCompleteNoticeInfo #入库通知
inNotifyUrl: #入库通知
fetchOrderUrl: #获取工单
materialCountUrl: http://10.96.31.231:8082/smfApi/pushInvVerificationInfo #是否点料
postCountDataUrl: http://10.96.31.231:8082/smfApi/pushOrderResultUploadInfo #点料结果上传
shelfFullNotificationUrl: http://10.96.31.231:8082/smfApi/pushPickInstNoticeInfo #货架放满通知
orderNotifyUrl: 1
materialCountUrl: #是否点料
postCountDataUrl: #点料结果上传
shelfFullNotificationUrl: #货架放满通知
orderNotifyUrl:
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!