Commit d192273c zshaohui

mesApi增加亮灯颜色

1 个父辈 8bef213a
...@@ -5,6 +5,7 @@ import com.google.common.base.Strings; ...@@ -5,6 +5,7 @@ import com.google.common.base.Strings;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.SecurityUtils; import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.api.bean.CodeValidateParam; import com.neotel.smfcore.core.api.bean.CodeValidateParam;
import com.neotel.smfcore.core.barcode.service.po.Barcode; import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.bean.StatusBean; import com.neotel.smfcore.core.device.bean.StatusBean;
...@@ -228,10 +229,17 @@ public class NLPShelfHandler extends BaseDeviceHandler { ...@@ -228,10 +229,17 @@ public class NLPShelfHandler extends BaseDeviceHandler {
dataLogList.add(queueTask); dataLogList.add(queueTask);
outMap.put(queueTask.getSourceId(), dataLogList); outMap.put(queueTask.getSourceId(), dataLogList);
} else { } else {
color = ORDER_COLOR.BLUE; if (StringUtils.isNotBlank(rgb)){
log.info(queueTask.getPosName() + "发送亮灯任务:" + "#" + rgb);
statusBean.addData("open", queueTask.getPosName() + "=#" + rgb);
} else {
color = ORDER_COLOR.BLUE;
}
} }
} }
statusBean.addData("open", queueTask.getPosName() + "=" + color.name()); if (color != null){
statusBean.addData("open", queueTask.getPosName() + "=" + color.name());
}
log.info("库位[" + queueTask.getPosName() + "]+亮灯:" + color.name()); log.info("库位[" + queueTask.getPosName() + "]+亮灯:" + color.name());
} }
} }
......
...@@ -549,6 +549,10 @@ public class TaskService { ...@@ -549,6 +549,10 @@ public class TaskService {
public synchronized String checkout(StoragePos pos, boolean forceOut, String subSourceId, boolean isSingleOut) { public synchronized String checkout(StoragePos pos, boolean forceOut, String subSourceId, boolean isSingleOut) {
return checkout(pos,forceOut,subSourceId,isSingleOut,"");
}
public synchronized String checkout(StoragePos pos, boolean forceOut, String subSourceId, boolean isSingleOut,String rgbCode) {
Barcode barcode = pos.getBarcode(); Barcode barcode = pos.getBarcode();
if (barcode != null) { if (barcode != null) {
...@@ -589,6 +593,12 @@ public class TaskService { ...@@ -589,6 +593,12 @@ public class TaskService {
task.setType(OP.CHECKOUT); task.setType(OP.CHECKOUT);
task.setStatus(OP_STATUS.WAIT.name()); task.setStatus(OP_STATUS.WAIT.name());
task.setSingleOut(isSingleOut); task.setSingleOut(isSingleOut);
//判断颜色是否为空
if (StringUtils.isNotBlank(rgbCode)){
task.setLightColor(rgbCode);
}
//工单出库任务 //工单出库任务
if (!Strings.isNullOrEmpty(subSourceId)) { if (!Strings.isNullOrEmpty(subSourceId)) {
// LiteOrderItem liteOrderItem = liteOrderItemDao.findOneById(subSourceId); // LiteOrderItem liteOrderItem = liteOrderItemDao.findOneById(subSourceId);
......
...@@ -30,6 +30,7 @@ import io.swagger.annotations.Api; ...@@ -30,6 +30,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.util.Integers; import org.apache.logging.log4j.core.util.Integers;
...@@ -38,6 +39,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -38,6 +39,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.*; import java.util.*;
...@@ -69,6 +71,31 @@ public class MesApiController { ...@@ -69,6 +71,31 @@ public class MesApiController {
@Autowired @Autowired
protected CodeResolve codeResolve; protected CodeResolve codeResolve;
private Map<String,String> colorMap = Maps.newConcurrentMap();
@PostConstruct
private void initColor() {
colorMap.put("FF0000", "Red");
colorMap.put("FFC0CB", "Pink");
colorMap.put("C71585", "Medium Violet Red");
colorMap.put("FF8C00", "Dark Orange");
colorMap.put("FFFF00", "Yellow");
colorMap.put("BDB76B", "Dark Khaki");
colorMap.put("E6E6FA", "Lavender");
colorMap.put("9370DB", "Medium Purple");
colorMap.put("800080", "Purple");
colorMap.put("ADFF2F", "Green Yellow");
colorMap.put("98FB98", "Pale Green");
colorMap.put("008000", "Green");
colorMap.put("808000", "Olive");
colorMap.put("00FFFF", "Aqua");
colorMap.put("7FFFD4", "Aquamarine");
colorMap.put("B0C4DE", "Light Steel Blue");
colorMap.put("0000FF", "Blue");
colorMap.put("FFE4C4", "Bisque");
colorMap.put("f4A460", "Sandy Brown");
}
//http://localhost/myproject/rest/api/v2/mes/inventory?LOC=1 //http://localhost/myproject/rest/api/v2/mes/inventory?LOC=1
@ApiOperation("查询有料仓位") @ApiOperation("查询有料仓位")
@RequestMapping(value = "/inventory") @RequestMapping(value = "/inventory")
...@@ -217,11 +244,18 @@ public class MesApiController { ...@@ -217,11 +244,18 @@ public class MesApiController {
try { try {
String[] REEL_IDS = request.getParameterValues("RIS"); String[] REEL_IDS = request.getParameterValues("RIS");
String rgbCode = request.getParameter("rgbCode"); //亮灯颜色
if(REEL_IDS == null || REEL_IDS.length == 0){ if(REEL_IDS == null || REEL_IDS.length == 0){
return "Error: RI 为必须项"; return "Error: RI 为必须项";
} }
//判断亮灯颜色是否在这20种内
if (StringUtils.isBlank(colorMap.get(rgbCode)) || StringUtils.isBlank(rgbCode)){
return "Error :rgbCode不在指定范围内";
//return "Error: rgbCode 不在颜色范围内";
}
ArrayList<StoragePos> poses = Lists.newArrayList(); ArrayList<StoragePos> poses = Lists.newArrayList();
for (String REEL_ID : REEL_IDS) { for (String REEL_ID : REEL_IDS) {
StoragePos pos = storagePosManager.getByBarcode(REEL_ID); StoragePos pos = storagePosManager.getByBarcode(REEL_ID);
...@@ -232,7 +266,7 @@ public class MesApiController { ...@@ -232,7 +266,7 @@ public class MesApiController {
} }
for (StoragePos pos : poses) { for (StoragePos pos : poses) {
log.info("出库位置仓位【"+pos.getPosName()+"】"); log.info("出库位置仓位【"+pos.getPosName()+"】");
taskService.checkout(pos,false,null,false); taskService.checkout(pos,false,null,false,rgbCode);
} }
}catch (Exception e){ }catch (Exception e){
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!