Commit ee5cac00 LN

增加机器人料仓代码

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