Commit b6e276b1 sunke

908XLR料仓处理

1 个父辈 fbfebb1e
package com.neotel.smfcore.core.device.handler.impl; package com.neotel.smfcore.core.device.handler.impl;
import com.google.common.base.Strings;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.core.device.bean.BoxStatusBean;
import com.neotel.smfcore.core.device.bean.StatusBean; import com.neotel.smfcore.core.device.bean.StatusBean;
import com.neotel.smfcore.core.device.enums.BOX_STATUS;
import com.neotel.smfcore.core.device.enums.OP; import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.storage.enums.DeviceType; import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.system.service.po.DataLog;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/** /**
* XLR料仓 * XLR料仓
...@@ -27,7 +34,7 @@ public class XLRBoxHandler extends BaseDeviceHandler { ...@@ -27,7 +34,7 @@ public class XLRBoxHandler extends BaseDeviceHandler {
} }
handleMsg(statusBean); handleMsg(statusBean);
statusBean = saveAlarmAndHumidity(statusBean); statusBean = saveAlarmAndHumidity(statusBean);
statusBean = handleInOutFinished(statusBean); statusBean = handleDeviceStatus(statusBean);
StatusBean humidityResult = handleHumidity(statusBean); StatusBean humidityResult = handleHumidity(statusBean);
if (humidityResult != null) { if (humidityResult != null) {
return humidityResult; return humidityResult;
...@@ -44,6 +51,43 @@ public class XLRBoxHandler extends BaseDeviceHandler { ...@@ -44,6 +51,43 @@ public class XLRBoxHandler extends BaseDeviceHandler {
return statusBean; return statusBean;
} }
protected StatusBean handleDeviceStatus(StatusBean statusBean) {
Map<String, BoxStatusBean> statusOfBoxes = statusBean.getBoxStatus();
if (statusOfBoxes != null) {
for (BoxStatusBean boxStatus : statusOfBoxes.values()) {
try {
//出库入库完成处理
int status = boxStatus.getStatus();
String posName = boxStatus.getPosId();
int executeTime=boxStatus.getExecuteTime();
if (!Strings.isNullOrEmpty(posName)) {//客户端发一次完成之后,会发空的 posName,不需要处理
if (BOX_STATUS.IN_FINISHED == status) {//入仓完成
finishedPutIn(statusBean.getCid(),posName,executeTime);
} else if (BOX_STATUS.OUT_FINISHED == status) {//出仓完成
reelOutBox(statusBean.getCid(),posName);
} else if (BOX_STATUS.OUT_END == status) {//出库完成(放到仓门口
log.info(statusBean.getCid() +"将物料从库位["+posName+"]出库到门口/料串完成");
finishedOutPos(statusBean.getCid(),posName,executeTime);
}
}
} catch (ValidateException e) {
log.error("更新状态时出错" + e.getMessage());
}
}
}
return statusBean;
}
protected void reelOutBox(String cid, String posName){
log.info(cid +"将物料从库位["+posName+"]中取出");
DataLog task = taskService.findExecutingTask(cid,posName);
if(task != null){
task.setStatus(OP_STATUS.OUT_BOX.name());
taskService.updateQueueTask(task);
}
}
@Override @Override
public DeviceType getDeviceType() { public DeviceType getDeviceType() {
return DeviceType.SMD_XLR; return DeviceType.SMD_XLR;
......
...@@ -15,7 +15,9 @@ import com.neotel.smfcore.core.api.bean.CodeValidateParam; ...@@ -15,7 +15,9 @@ 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.barcode.utils.CodeResolve; import com.neotel.smfcore.core.barcode.utils.CodeResolve;
import com.neotel.smfcore.core.device.bean.PosInfo; import com.neotel.smfcore.core.device.bean.PosInfo;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.message.util.DeviceMessageUtil; import com.neotel.smfcore.core.message.util.DeviceMessageUtil;
import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager; import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.StoragePos; import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.dao.IAlarmInfoDao; import com.neotel.smfcore.core.system.service.dao.IAlarmInfoDao;
...@@ -533,4 +535,40 @@ public class DeviceController { ...@@ -533,4 +535,40 @@ public class DeviceController {
return outTaskCount; return outTaskCount;
} }
@ApiOperation("出库更新任务状态")
@RequestMapping("/service/store/updateLocInfo")
@ResponseBody
@AnonymousAccess
public ResultBean updateLocInfo(HttpServletRequest request) {
// String code = request.getParameter("barcode");
// String status = request.getParameter("status");
// String loc = request.getParameter("loc");
// String cid = request.getParameter("cid");
// //获取到当前执行的任务
// DataLog opTask = null;
// Collection<DataLog> allTasks = taskService.getAllTasks();
// for (DataLog task : allTasks) {
// if (task.isCheckOutTask() && code.equals(task.getBarcode())) {
// opTask = task;
// break;
// }
// }
// if (opTask == null) {
// return ResultBean.newErrorResult(303, "smfcore.task.notExist", "任务不存在");
// }
// status = status.toUpperCase();
// log.info("更新任务["+code+"]状态:{}-->{}", opTask.getStatus(), status);
// OP_STATUS updateStatus = OP_STATUS.valueOf(status);
// if (updateStatus != null) {
// DataLog task = taskService.findFinishedOutTask(cid, opTask.getPosName());
// if(task != null){
// task.setStatus(updateStatus.name());
// taskService.updateFinishedTask(task);
// }
// } else {
// log.info(code + "更新状态时未找到状态:" + status + "");
// }
return ResultBean.newOkResult("");
}
} }
...@@ -139,6 +139,6 @@ public enum DeviceType { ...@@ -139,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,NLM); return Lists.newArrayList(AUTO,LINE,BATCH,SOLDERPASTE,VERTICALBOX,SMD_XL,SMD_DUO,SMD_XLC,SMD_XLR,VIRTUAL,NL,NLP,NLM);
} }
} }
...@@ -282,7 +282,7 @@ public class TaskService { ...@@ -282,7 +282,7 @@ public class TaskService {
* @return * @return
*/ */
private DataLog findFinishedTask(String cid, String posName, boolean putInTask) { private DataLog findFinishedTask(String cid, String posName, boolean putInTask) {
Collection<DataLog> areaFinishedTasks = getFinishedTasks(); Collection<DataLog> areaFinishedTasks = theFinishedTaskMap.values();
for (DataLog task : areaFinishedTasks) { for (DataLog task : areaFinishedTasks) {
if (task.getPosName().equals(posName) && task.getCid().equals(cid)) { if (task.getPosName().equals(posName) && task.getCid().equals(cid)) {
if(putInTask){ if(putInTask){
......
...@@ -76,9 +76,9 @@ public class TianTongApi extends BaseSmfApiListener { ...@@ -76,9 +76,9 @@ public class TianTongApi extends BaseSmfApiListener {
*/ */
@Override @Override
public void outTaskStatusChange(String outNotifyUrl, DataLog task) { public void outTaskStatusChange(String outNotifyUrl, DataLog task) {
if (task.isFinished()) { if (task.isStatus(OP_STATUS.OUT_BOX)) {
outBoxNotify(task); outBoxNotify(task);
}else if(task.isEnd()) { }else if(task.isFinished()) {
outFinishedNotify(outNotifyUrl,task); outFinishedNotify(outNotifyUrl,task);
} }
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!