Commit 4a4a847f zshaohui

1.提供给入库线体,获取满料串分流目的地

2.提供给客户端 获取当前入料机构的料串信息
1 个父辈 d8332d1b
......@@ -29,4 +29,7 @@ public class CacheNameUtil {
//人工分拣线体工位定时状态通知
public static final String CHCHE_MANUAL_LINE_STATIONSTATUS = "CHCHE_MANUAL_LINE_STATIONSTATUS";
//入料机构料串信息
public static final String CHCHE_RAWIN_LINE_MATERIAL_DESTINATION = "CHCHE_RAWIN_LINE_MATERIAL_DESTINATION";
}
......@@ -39,7 +39,9 @@ import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BoxHandleUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.MaterialUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.common.util.CacheNameUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.common.util.CommonUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.third.bean.MaterialLoc;
import com.neotel.smfcore.custom.luxsan.factory_c.third.util.MaterialLocUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.third.util.RawInLineUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.wipstor.util.TaskLocUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
......@@ -1017,6 +1019,14 @@ public class CDeviceController {
return ResultBean.newOkResult(boxBarcode.getHeightMap());
}
@ApiOperation("获取入料机构,料串目的地")
@RequestMapping("/getMaterialByLoc")
@AnonymousAccess
public String getMaterialByLoc(String loc) {
return RawInLineUtil.getCurrentMaterial(loc);
}
private synchronized void callAgvTask(String stackerId, Barcode stackerBarcode) {
//判断AGV是上的料箱有几个
int count = 0;
......
......@@ -15,12 +15,10 @@ 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 com.neotel.smfcore.custom.luxsan.factory_c.common.util.CacheNameUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.TaskCurrentLoc;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BoxHandleUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javafx.concurrent.Task;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -28,9 +26,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Api(tags = "人工分拣线对接")
@Slf4j
......@@ -76,6 +74,8 @@ public class ManualLineController {
return ResultBean.newOkResult("");
}
Map<String,Object> lockBoxMap = new ConcurrentHashMap<>();
//空箱到达线体空箱出口后, 线体请求CTU背负空箱
@ApiOperation("请求CTU背负空箱")
@RequestMapping("/ctu/takeEmptyBox")
......@@ -115,8 +115,15 @@ public class ManualLineController {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"料箱信息"});
}
if (lockBoxMap.get(boxStr) == null){
lockBoxMap.put(boxStr,new Object());
}
boxStr = boxStr + "A";
Object lockObj = lockBoxMap.get(boxStr);
synchronized (lockObj) {
Barcode boxBarcode = codeResolve.resolveOneValideBarcode(boxStr);
if (boxBarcode == null) {
return ResultBean.newErrorResult(-1, "smfcore.error.barcode.invalid", "条码无效");
......@@ -150,9 +157,10 @@ public class ManualLineController {
//1.判断是否有正在入库的任务
for (DataLog dataLog : taskService.getAllTasks()) {
if (!dataLog.isCancel() && !dataLog.isFinished() && dataLog.getBarcode().equals(boxBarcode.getBarcode())) {
if (dataLog.isPutInTask()) {
//如果有出库任务 直接完成
if (boxBarcode.getBarcode().equals(dataLog.getBarcode())){
if (!dataLog.isCancel() && !dataLog.isFinished()){
if (dataLog.isPutInTask()){
log.info(boxStr+"有未完成/未取消的任务,库位为:"+dataLog.getPosName()+"直接返回ok");
return ResultBean.newOkResult("");
} else {
log.info(boxStr + "有正在执行的出库任务,服务器更改状态为完成");
......@@ -166,6 +174,7 @@ public class ManualLineController {
}
}
}
}
//如果是type为0时,入智能仓
StoragePos pos = BoxHandleUtil.locOnePos(boxBarcode);
......@@ -183,8 +192,9 @@ public class ManualLineController {
storagePosManager.save(pos);
log.info(boxStr + "入库到智能仓,分配的储位为:" + pos.getPosName());
DataLog dataLog = taskService.addPutInTaskToExecute(storage, boxBarcode, pos, lineNo+"_out");
DataLog dataLog = taskService.addPutInTaskToExecute(storage, boxBarcode, pos, lineNo + "_out");
return ResultBean.newOkResult("");
}
}
}
package com.neotel.smfcore.custom.luxsan.factory_c.third;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.custom.luxsan.factory_c.third.util.RawInLineUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@Slf4j
@Api(tags = "入库流水线")
@RestController
public class RawInLineController {
@ApiOperation("获取满料串分流目的地")
@RequestMapping("/rawInLine/materialDestination")
@AnonymousAccess
public ResultBean materialDestination(@RequestBody Map<String, String> paramMap) {
String materialStr = paramMap.get("materialStr");
String loc = paramMap.get("loc");
log.info("入库流水线,获取满料串:" + materialStr + "目的地为:" + loc);
String destination = RawInLineUtil.getNextDestination(materialStr, loc);
Map<String, String> resultMap = new HashMap<>();
resultMap.put("destination", destination);
resultMap.put("materialStr", materialStr);
return ResultBean.newOkResult(resultMap);
}
}
package com.neotel.smfcore.custom.luxsan.factory_c.third.bean;
import lombok.Data;
@Data
public class RawInLineMaterialLoc {
private String material;
//当前位置
private String currentLoc;
//目的地
private String destination;
}
package com.neotel.smfcore.custom.luxsan.factory_c.third.util;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.custom.luxsan.factory_c.common.util.CacheNameUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.third.bean.RawInLineMaterialLoc;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Component
@Slf4j
public class RawInLineUtil {
private static DataCache dataCache;
@Autowired
private void setDataCache(DataCache cache){
RawInLineUtil.dataCache = cache;
}
public static final String forkLoc = "forkLoc";//料串分流位,
public static final String rawInLine01 = "rawInLine01";//1号入库分拣机,
public static final String rawInLine02 = "rawInLine02";//2号入库分拣机,
public static final String rawInLine03 = "rawInLine03";//3号入库分拣机,
public static final String rawInLine04 = "rawInLine04";//4号入库分拣机,
public static final String rawInLine05 = "rawInLine05";//5号入库分拣机,
public static final String rawInLine06 = "rawInLine06";//6号入库分拣机
public static void updateDestinationMap(String material, String loc,String destination) {
Map<String, RawInLineMaterialLoc> destinationMap = dataCache.getCache(CacheNameUtil.CHCHE_RAWIN_LINE_MATERIAL_DESTINATION);
if (destinationMap == null) {
destinationMap = new ConcurrentHashMap<>();
}
RawInLineMaterialLoc materialLoc = destinationMap.get(material);
if (materialLoc == null){
materialLoc = new RawInLineMaterialLoc();
}
materialLoc.setMaterial(material);
materialLoc.setCurrentLoc(loc);
if (StringUtils.isNotEmpty(destination)){
materialLoc.setDestination(destination);
}
destinationMap.put(material, materialLoc);
dataCache.updateCache(CacheNameUtil.CHCHE_RAWIN_LINE_MATERIAL_DESTINATION, destinationMap);
}
public static String getNextDestination(String material,String loc) {
updateDestinationMap(material,loc,"");
return getNextLoc(material,loc);
}
public static String getCurrentMaterial(String loc) {
Map<String, RawInLineMaterialLoc> destinationMap = dataCache.getCache(CacheNameUtil.CHCHE_RAWIN_LINE_MATERIAL_DESTINATION);
if (destinationMap == null) {
destinationMap = new ConcurrentHashMap<>();
}
for (RawInLineMaterialLoc materialLoc : destinationMap.values()) {
if (loc.equals(materialLoc.getCurrentLoc())){
return materialLoc.getMaterial();
}
}
return "";
}
private static String getNextLoc(String material, String loc) {
log.info("获取满料串:"+material+",当前位置为:"+loc);
String nextLoc = "forkLoc";
if (forkLoc.equals(loc)) {
nextLoc = rawInLine01;
} else if (rawInLine01.equals(loc)) {
nextLoc = rawInLine02;
} else if (rawInLine02.equals(loc)) {
nextLoc = rawInLine03;
} else if (rawInLine03.equals(loc)) {
nextLoc = rawInLine04;
} else if (rawInLine04.equals(loc)) {
nextLoc = rawInLine05;
} else if (rawInLine05.equals(loc)) {
nextLoc = rawInLine06;
}
Map<String, RawInLineMaterialLoc> destinationMap = dataCache.getCache(CacheNameUtil.CHCHE_RAWIN_LINE_MATERIAL_DESTINATION);
int count = 0;
for (RawInLineMaterialLoc materialLoc : destinationMap.values()) {
if (nextLoc.equals(materialLoc.getDestination())) {
count++;
}
}
log.info("获取满料串:"+material+",下一个位置为:"+nextLoc+",当前数量为:"+count);
if (count >= 5) {
updateDestinationMap(material,loc,loc);
return loc;
}
updateDestinationMap(material,loc,nextLoc);
return nextLoc;
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!