Commit ee5cac00 LN

增加机器人料仓代码

1 个父辈 c483084b
......@@ -33,6 +33,14 @@ public enum OP_STATUS {
/**
* 已结束
*/
END
END,
/**
* 机器人正在移栽中
*/
INROBOT,
/**
* 已放到料仓门口
*/
BOXDOOR,
;
}
......@@ -7,6 +7,7 @@ import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.language.service.bean.LanguageInfo;
import com.neotel.smfcore.core.language.util.MessageUtils;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import com.neotel.smfcore.security.rest.bean.dto.UserDto;
import com.neotel.smfcore.security.service.po.User;
import io.swagger.annotations.Api;
......@@ -47,7 +48,8 @@ public class LanguageSetController {
@ApiOperation("获取语言列表")
@GetMapping
@PreAuthorize("@el.check('translation')")
@AnonymousAccess
// @PreAuthorize("@el.check('translation')")
public List<LanguageInfo> getList(){
return getAllLanList();
}
......
......@@ -110,6 +110,11 @@ public enum DeviceType {
NLP("storage.type.nlp"),
/**
* 18 机器人料仓
*/
ROBOT_BOX("storage.type.robotBox"),
/**
* 18 (默认料仓)
*/
DEFAULT("storage.type.default")
......@@ -134,6 +139,6 @@ public enum DeviceType {
}
public static List<DeviceType> availableTypeList(){
return Lists.newArrayList(AUTO,LINE,BATCH,SOLDERPASTE,VERTICALBOX,SMD_XL,SMD_DUO,SMD_XLC,VIRTUAL,NL,NLP);
return Lists.newArrayList(AUTO,LINE,BATCH,SOLDERPASTE,VERTICALBOX,SMD_XL,SMD_DUO,SMD_XLC,VIRTUAL,NL,NLP,ROBOT_BOX);
}
}
......@@ -239,8 +239,14 @@ public class StoragePosController {
pos.setPriority(saveDto.getPriority());
pos.setH(saveDto.getH());
pos.setW(saveDto.getW());
String enabledStr="";
if(pos.isEnabled()!= saveDto.isEnabled()){
pos.setEnabled(saveDto.isEnabled());
enabledStr=saveDto.isEnabled()?",启用库位":",禁用库位";
}
storagePosManager.save(pos);
log.info("修改库位:库位号[" + pos.getId() + "]=[" + saveDto.toString() + "]");
log.info("修改库位:库位号[" + pos.getId() + "]=[" + saveDto.toString() + "]"+enabledStr);
return new ResponseEntity<>(HttpStatus.OK);
}
......
......@@ -24,4 +24,7 @@ public class StoragePosSaveDto implements Serializable {
@ApiModelProperty("宽度")
private int w;
@ApiModelProperty("是否可用,true=可用,false=禁用")
private boolean enabled = true;
}
......@@ -179,6 +179,10 @@ public class Storage extends BasePo implements Serializable {
return DeviceType.SMD_XLC.name().equals(type);
}
public boolean isRobotBox() {
return DeviceType.ROBOT_BOX.name().equals(type);
}
public boolean isType(DeviceType[] types){
for (DeviceType str :
types) {
......
......@@ -210,6 +210,11 @@ public class DataLog extends BasePo implements Serializable {
*/
private MSDAppendInfo msdAppendInfo;
/**
* 位置信息,如料架编号,托盘编号,移栽编号,皮带线编号,机器人编号等
*/
private String locInfo = "";
public String getBarcode() {
if(barcode == null){
return "";
......@@ -252,6 +257,14 @@ public class DataLog extends BasePo implements Serializable {
return OP_STATUS.END.name().equals(status);
}
public boolean isInRobot(){
return OP_STATUS.INROBOT.name().equals(status);
}
public boolean isBoxdoor(){
return OP_STATUS.BOXDOOR.name().equals(status);
}
/**
* 是否是入库任务
......
......@@ -325,6 +325,21 @@ public class TaskService {
return false;
}
private DataLog findPutInBoxTask(Storage storage){
if(storage.isRobotBox()){
for (DataLog task : taskMap.values()) {
if (OP.PUT_IN == task.getType() && task.getCid().equals(storage.getCid())) {
if(task.isBoxdoor()){
return task;
}
}
}
}
return null;
}
/**
* 为 box 分配出库任务
*/
......@@ -393,6 +408,30 @@ public class TaskService {
*/
public StatusBean checkOut(Storage storage, StatusBean statusBean) {
try {
DataLog putInTask=findPutInBoxTask(storage);
if(putInTask!=null){
//发送入库任务到BOX
putInTask.setStatus(OP_STATUS.EXECUTING.name());
taskMap.put(putInTask.getId(), putInTask);
putInTask = dataLogDao.save(putInTask);
String posName = putInTask.getPosName();
Barcode codeObj = barcodeManager.findByBarcode(putInTask.getBarcode());
int plateW = 0;
int plateH = 0;
if (codeObj != null) {
plateW = codeObj.getPlateSize();
plateH = codeObj.getHeight();
} else {
log.warn("入库未找到条码" + storage.getName() + "[" + posName + "],条码["+putInTask.getBarcode()+"]");
}
statusBean.setOp(OP.PUT_IN);
statusBean.addPosInfo(putInTask.getBarcode(), posName, plateW, plateH, true);
log.info("入库" + storage.getName() + "[" + posName + "]物料[" + putInTask.getBarcode() + "]["+putInTask.getStatus()+"]到 " + storage.getCid());
return statusBean;
}
//准备更新暂停出入库
if (dataCache.getCache(Constants.CACHE_StopOut)) {
return statusBean;
......@@ -946,4 +985,13 @@ public class TaskService {
taskMap.remove(task.getId());
theFinishedTaskMap.put(task.getId(), task);
}
public DataLog findTask(String barcode) {
for (DataLog task : taskMap.values()) {
if (task.getBarcode().equals(barcode)) {
return task;
}
}
return null;
}
}
......@@ -161,8 +161,8 @@ public class MenuController {
@PostMapping
@PreAuthorize("@el.check('menu:add')")
public ResponseEntity<Object> create(@Validated @RequestBody MenuDto menuDto) {
Menu resources=menuMapper.toEntity(menuDto);
menuManager.saveMenu(resources);
// Menu resources=menuMapper.toEntity(menuDto);
// menuManager.saveMenu(resources);
return new ResponseEntity<>(HttpStatus.CREATED);
}
......@@ -184,16 +184,16 @@ public class MenuController {
@DeleteMapping
@PreAuthorize("@el.check('menu:del')")
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
if(!SecurityUtils.getCurrentUsername().equals(Constants.SUPER_USERNAME)){
throw new ValidateException("smfcore.noAccessUpdate","没有删除菜单的权限");
}
Set<Menu> menuSet = new HashSet<>();
for (String id : ids) {
List<Menu> menuList = menuManager.getMenusByPid(id);
menuSet.add(menuManager.get(id));
menuSet = menuManager.getChildMenus(menuList, menuSet);
}
menuManager.delete(menuSet);
// if(!SecurityUtils.getCurrentUsername().equals(Constants.SUPER_USERNAME)){
// throw new ValidateException("smfcore.noAccessUpdate","没有删除菜单的权限");
// }
// Set<Menu> menuSet = new HashSet<>();
// for (String id : ids) {
// List<Menu> menuList = menuManager.getMenusByPid(id);
// menuSet.add(menuManager.get(id));
// menuSet = menuManager.getChildMenus(menuList, menuSet);
// }
// menuManager.delete(menuSet);
return new ResponseEntity<>(HttpStatus.OK);
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!