Commit 11a719d7 sunke

Http请求时添加UTF-8编码

泰治状态修正
1 个父辈 bc987b9c
正在显示 28 个修改的文件 包含 327 行增加70 行删除
...@@ -8,6 +8,7 @@ import lombok.Data; ...@@ -8,6 +8,7 @@ import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
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.util.Strings;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.util.Locale; import java.util.Locale;
...@@ -33,7 +34,9 @@ public class ResultBean<T> { ...@@ -33,7 +34,9 @@ public class ResultBean<T> {
result.setParams(params); result.setParams(params);
result.setMsg(MessageUtils.getText(msgKey, params, new Locale(SecurityUtils.getCurrentUserLanguage()), msg)); result.setMsg(MessageUtils.getText(msgKey, params, new Locale(SecurityUtils.getCurrentUserLanguage()), msg));
if (writeLog) { if (writeLog) {
log.info(result.getMsg()); if(Strings.isNotBlank(result.getMsg())){
log.info(result.getMsg());
}
} }
return result; return result;
} }
......
...@@ -45,13 +45,21 @@ public class MainTimer { ...@@ -45,13 +45,21 @@ public class MainTimer {
log.info("开始加载未完成的任务..."); log.info("开始加载未完成的任务...");
List<DataLog> unExecuteTasks = dataLogManager.findUnFinishedTasks(); List<DataLog> unExecuteTasks = dataLogManager.findUnFinishedTasks();
for (DataLog unExecuteTask : unExecuteTasks) { for (DataLog unExecuteTask : unExecuteTasks) {
if (unExecuteTask.isExecuting() || unExecuteTask.isWait()) { try {
try { if(unExecuteTask.isPutInTask()){
//入库
taskService.addTaskToExecute(unExecuteTask); taskService.addTaskToExecute(unExecuteTask);
}catch (Exception e){ }else{
log.error("初始化任务["+unExecuteTask+"]出错:"+e); if(unExecuteTask.isWait() || unExecuteTask.isExecuting()){
taskService.addTaskToExecute(unExecuteTask);
}else{
taskService.updateFinishedTask(unExecuteTask);
}
} }
}catch (Exception e){
log.error("初始化任务["+unExecuteTask+"]出错:"+e);
} }
} }
log.info("加载未完成的任务完成,共[" + unExecuteTasks.size() + "]条数据..."); log.info("加载未完成的任务完成,共[" + unExecuteTasks.size() + "]条数据...");
} }
......
...@@ -38,10 +38,10 @@ public class HttpHelper { ...@@ -38,10 +38,10 @@ public class HttpHelper {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
try { try {
String requestBody = mapper.writeValueAsString(params); String requestBody = mapper.writeValueAsString(params);
httpPost.setEntity(new StringEntity(requestBody)); httpPost.setEntity(new StringEntity(requestBody,"utf-8"));
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
throw new ApiException("Request params to [" + url + "] failed:" + e.getMessage()); throw new ApiException("Request params to [" + url + "] failed:" + e.getMessage());
} catch (UnsupportedEncodingException e) { } catch (Exception e) {
throw new ApiException("Request params to [" + url + "] failed:" + e.getMessage()); throw new ApiException("Request params to [" + url + "] failed:" + e.getMessage());
} }
} }
......
package com.neotel.smfcore.common.utils;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
public class JsonUtil {
// 定义jackson对象
private static final ObjectMapper MAPPER = new ObjectMapper();
static{
MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
/**
* 将对象转换成json字符串。
* <p>Title: pojoToJson</p>
* <p>Description: </p>
* @param data
* @return
*/
public static String toJsonStr(Object data) {
try {
String string = MAPPER.writeValueAsString(data);
return string;
} catch (Exception e) {
log.info("转换JSON字符串出错:",e);
}
return null;
}
/**
* 将json结果集转化为对象
*
* @param jsonStr json数据
* @param beanType 对象中的object类型
* @return
*/
public static <T> T toObj(String jsonStr, Class<T> beanType) {
try {
T t = MAPPER.readValue(jsonStr, beanType);
return t;
} catch (Exception e) {
log.info(jsonStr + "转换对象出错:",e);
}
return null;
}
/**
* 将json数据转换成对象list
* <p>Title: jsonToList</p>
* <p>Description: </p>
* @param jsonStr
* @param beanType
* @return
*/
public static <T> List<T> toList(String jsonStr, Class<T> beanType) {
JavaType javaType = MAPPER.getTypeFactory().constructParametricType(List.class, beanType);
try {
List<T> list = MAPPER.readValue(jsonStr, javaType);
return list;
} catch (Exception e) {
log.info(jsonStr + "转换List出错:",e);
}
return new ArrayList<>();
}
public static Map<String, Object> toMap(String jsonStr){
//JavaType javaType = MAPPER.getTypeFactory().constructParametricType(HashMap.class, String.class, String.class);
try {
//Map<String, String> map = MAPPER.readValue(jsonStr, javaType);
Map<String, Object> map = MAPPER.readValue(jsonStr, Map.class);
return map;
} catch (Exception e) {
log.info(jsonStr + "转换Map出错:",e);
}
return new HashMap<>();
}
}
...@@ -414,4 +414,33 @@ public class StatusBean { ...@@ -414,4 +414,33 @@ public class StatusBean {
} }
} }
public int getTaiZhiStatus(){
int taiZhiStatus = 0;
if(boxStatus != null){
Collection<BoxStatusBean> boxList = boxStatus.values();
for (BoxStatusBean theBox : boxList) {
int theStatus = theBox.getStatus();
//设备状态:0:离线;1:空闲;2:急停;3:故障;4:工作中;5:调试中
if(theStatus == 1){
taiZhiStatus = 1;
}else if(theStatus == 2){
taiZhiStatus = 2;
}else if(theStatus == 3 || theStatus == 4){
taiZhiStatus = 3;
}else if(theStatus == 5){
taiZhiStatus = 5;
}else if(theStatus >= 6 && theStatus <= 11){
taiZhiStatus = 4;
}
break;
}
}
if(!Strings.isNullOrEmpty(getMsg()) && taiZhiStatus != 2){
taiZhiStatus = 3;
}
return taiZhiStatus;
}
} }
...@@ -104,4 +104,9 @@ public class BOX_STATUS { ...@@ -104,4 +104,9 @@ public class BOX_STATUS {
* 22 搅拌完成放回原来的仓中 * 22 搅拌完成放回原来的仓中
*/ */
public final static int MIX_END = 22; public final static int MIX_END = 22;
/**
* 23出库失败(放到料仓门口后,未检测到有料盘)
*/
public final static int OUT_FAILED = 23;
} }
...@@ -35,6 +35,10 @@ public enum OP_STATUS { ...@@ -35,6 +35,10 @@ public enum OP_STATUS {
*/ */
END, END,
/** /**
* 已从仓位中取出
*/
OUTBOX,
/**
* 机器人正在移栽中 * 机器人正在移栽中
*/ */
INROBOT, INROBOT,
......
...@@ -43,6 +43,7 @@ import com.neotel.smfcore.core.system.service.po.Humiture; ...@@ -43,6 +43,7 @@ import com.neotel.smfcore.core.system.service.po.Humiture;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil; import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.core.system.util.TaskService; import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.security.service.manager.IGroupManager; import com.neotel.smfcore.security.service.manager.IGroupManager;
import com.neotel.smfcore.taizhi.TaiZhiApi;
import lombok.Data; import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -224,7 +225,7 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -224,7 +225,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
} }
} }
ReelLockPosUtil.removeReelLockPosInfo(barcodeSave.getBarcode()); //ReelLockPosUtil.removeReelLockPosInfo(barcodeSave.getBarcode());
return taskService.addPutInTaskToExecute(storage, barcodeSave, storagePos); return taskService.addPutInTaskToExecute(storage, barcodeSave, storagePos);
} }
} }
...@@ -316,7 +317,7 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -316,7 +317,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
/** /**
* 从API接口验证条码是否可以入库 * 从API接口验证条码是否可以入库
*/ */
protected Barcode verifyPutInFromApi(Barcode barcode) throws ValidateException { public Barcode verifyPutInFromApi(Barcode barcode) throws ValidateException {
for (IOpAuthApi opAuthApi : opAuthApiList) { for (IOpAuthApi opAuthApi : opAuthApiList) {
Barcode responseBarcode = opAuthApi.canPutIn(barcode); Barcode responseBarcode = opAuthApi.canPutIn(barcode);
if(responseBarcode != null){ if(responseBarcode != null){
...@@ -498,7 +499,7 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -498,7 +499,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
updatePosExecuteTime(posName,executeTime); updatePosExecuteTime(posName,executeTime);
} }
log.info(task.getBarcode() + "入仓位[" + task.getPosName() + "]完成,执行时间["+executeTime+"]秒"); log.info(task.getBarcode() + "入仓位[" + task.getPosName() + "]完成,执行时间["+executeTime+"]秒");
ReelLockPosUtil.removeReelLockPosInfo(task.getBarcode()); //ReelLockPosUtil.removeReelLockPosInfo(task.getBarcode());
DataLog cancelTask = taskService.findFinishedTask(cid, posName); DataLog cancelTask = taskService.findFinishedTask(cid, posName);
if (cancelTask != null && cancelTask.isCancel()) { if (cancelTask != null && cancelTask.isCancel()) {
//将相同库位已经取消的任务从完成队列里删除 //将相同库位已经取消的任务从完成队列里删除
...@@ -665,7 +666,7 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -665,7 +666,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
log.warn("任务:" + task.getId() + " 仓位:" + task.getPosId() + " 的 Barcode 为null, 之前可能处理过,结束任务后直接返回"); log.warn("任务:" + task.getId() + " 仓位:" + task.getPosId() + " 的 Barcode 为null, 之前可能处理过,结束任务后直接返回");
//记录日志 //记录日志
task.setStatus(OP_STATUS.FINISHED.name()); task.setStatus(OP_STATUS.OUTBOX.name());
taskService.updateFinishedTask(task); taskService.updateFinishedTask(task);
return; return;
} }
...@@ -696,7 +697,7 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -696,7 +697,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
dataCache.updateInventory(storagePos, barcode); dataCache.updateInventory(storagePos, barcode);
//记录日志 //记录日志
task.setStatus(OP_STATUS.FINISHED.name()); task.setStatus(OP_STATUS.OUTBOX.name());
taskService.updateFinishedTask(task); taskService.updateFinishedTask(task);
} }
...@@ -748,6 +749,9 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -748,6 +749,9 @@ public class BaseDeviceHandler implements IDeviceHandler {
} else { } else {
needSaveToMongo = statusBean.needSaveToMongo(); needSaveToMongo = statusBean.needSaveToMongo();
} }
if(statusBean.getTaiZhiStatus() != statusBeanToSave.getTaiZhiStatus()){
TaiZhiApi.deviceStatusChange(statusBeanToSave.getCid(),statusBeanToSave.getTaiZhiStatus());
}
statusBean.setTime(System.currentTimeMillis()); statusBean.setTime(System.currentTimeMillis());
Map<String, BoxStatusBean> statusOfBoxes = statusBeanToSave.getBoxStatus(); Map<String, BoxStatusBean> statusOfBoxes = statusBeanToSave.getBoxStatus();
...@@ -769,12 +773,14 @@ public class BaseDeviceHandler implements IDeviceHandler { ...@@ -769,12 +773,14 @@ public class BaseDeviceHandler implements IDeviceHandler {
if (statusOfBoxes != null) { if (statusOfBoxes != null) {
for (BoxStatusBean boxStatus : statusOfBoxes.values()) { for (BoxStatusBean boxStatus : statusOfBoxes.values()) {
String humidity = boxStatus.getHumidity();
String temperature = boxStatus.getTemperature();
if (needSaveToMongo) { if (needSaveToMongo) {
TaiZhiApi.tempEnv(cid,temperature,humidity);
//保存温湿度到数据库 //保存温湿度到数据库
Humiture humiture = new Humiture(); Humiture humiture = new Humiture();
humiture.setCid(cid); humiture.setCid(cid);
String humidity = boxStatus.getHumidity();
String temperature = boxStatus.getTemperature();
if (!Strings.isNullOrEmpty(humidity) && !Strings.isNullOrEmpty(temperature)) { if (!Strings.isNullOrEmpty(humidity) && !Strings.isNullOrEmpty(temperature)) {
humiture.setHumidity(humidity); humiture.setHumidity(humidity);
humiture.setTemperature(temperature); humiture.setTemperature(temperature);
......
...@@ -178,8 +178,7 @@ public class NLPShelfHandler extends BaseDeviceHandler{ ...@@ -178,8 +178,7 @@ public class NLPShelfHandler extends BaseDeviceHandler{
} }
return null; return null;
} }
@Override @Override
public StatusBean handleClientRequest(StatusBean statusBean, HttpServletRequest request) { public StatusBean handleClientRequest(StatusBean statusBean, HttpServletRequest request) {
statusBean.setClientIp(request.getRemoteHost()); statusBean.setClientIp(request.getRemoteHost());
......
...@@ -666,13 +666,12 @@ public class DataCache { ...@@ -666,13 +666,12 @@ public class DataCache {
if(storage.getType().equals(deviceType.name())) { if(storage.getType().equals(deviceType.name())) {
StatusBean bean = DevicesStatusUtil.getStatusBean(storage.getCid()); StatusBean bean = DevicesStatusUtil.getStatusBean(storage.getCid());
if (bean == null || bean.timeOut()) { if (bean == null || bean.timeOut() || bean.isAvailable()) {
continue; continue;
} }
if (bean.getStatus() == 1) { //if (bean.getStatus() == 1) {
availableStorageIds.add(storage.getId()); availableStorageIds.add(storage.getId());
} //}
} }
} }
return availableStorageIds; return availableStorageIds;
......
...@@ -128,8 +128,7 @@ public class BoxKanbanController { ...@@ -128,8 +128,7 @@ public class BoxKanbanController {
} }
List<DataLog> allTasks=taskService.getAllTasks(); List<DataLog> allTasks=taskService.getAllTasks();
List<BoxTaskDto> dtos=new ArrayList<>(); List<BoxTaskDto> dtos=new ArrayList<>();
for (DataLog datalog : for (DataLog datalog : allTasks) {
allTasks) {
//判断类型 //判断类型
if (criteria.getType() != null && (!criteria.getType().equals(datalog.getType()))) { if (criteria.getType() != null && (!criteria.getType().equals(datalog.getType()))) {
continue; continue;
...@@ -150,12 +149,12 @@ public class BoxKanbanController { ...@@ -150,12 +149,12 @@ public class BoxKanbanController {
Date lastUpdateTime = new Date((new Date().getTime()) - 10 * 60 * 1000); Date lastUpdateTime = new Date((new Date().getTime()) - 10 * 60 * 1000);
//正常 //正常
if (criteria.getTaskStatus() == 1) { if (criteria.getTaskStatus() == 1) {
if (lastUpdateTime.before(datalog.getUpdateDate()) && datalog.getStatus().equals(OP_STATUS.EXECUTING.name())) { if (lastUpdateTime.before(datalog.getUpdateDate())) {
statusOk = true; statusOk = true;
} }
}//异常 }//异常
else if (criteria.getTaskStatus() == 2) { else if (criteria.getTaskStatus() == 2) {
if (lastUpdateTime.after(datalog.getUpdateDate()) && datalog.getStatus().equals(OP_STATUS.EXECUTING.name())) { if (lastUpdateTime.after(datalog.getUpdateDate()) && !datalog.getStatus().equals(OP_STATUS.WAIT.name())) {
statusOk = true; statusOk = true;
} }
}//等待 }//等待
...@@ -396,14 +395,14 @@ public class BoxKanbanController { ...@@ -396,14 +395,14 @@ public class BoxKanbanController {
int allcount=0; int allcount=0;
int waitCount=0; int waitCount=0;
for (DataLog data : allTasks) { for (DataLog data : allTasks) {
if (data.isFinished() || data.isCancel()) { // if (data.isFinished() || data.isCancel()) {
continue; // continue;
} // }
if(data.isWait()){ if(data.isWait()){
waitCount++; waitCount++;
} }
//超过10分钟未更新为异常 //超过10分钟未更新为异常
else if (data.isAbnormal() ) { else if (data.isAbnormal()) {
abnormal++; abnormal++;
} else { } else {
normal++; normal++;
...@@ -463,7 +462,7 @@ public class BoxKanbanController { ...@@ -463,7 +462,7 @@ public class BoxKanbanController {
String temperature = boxStatus.getTemperature(); String temperature = boxStatus.getTemperature();
boxDto.setHumidity(humidity); boxDto.setHumidity(humidity);
boxDto.setTemperature(temperature); boxDto.setTemperature(temperature);
boxDto.setStatus(bean.getStatus()); boxDto.setStatus(boxStatus.getStatus());
boxDto.setMsg(bean.getShowMsg(locale)); boxDto.setMsg(bean.getShowMsg(locale));
boxDto.setBarcode(bean.getCode()); boxDto.setBarcode(bean.getCode());
boxDto.setPosName(bean.getPosId()); boxDto.setPosName(bean.getPosId());
......
...@@ -8,10 +8,14 @@ import com.neotel.smfcore.core.message.service.manager.IMessageManager; ...@@ -8,10 +8,14 @@ import com.neotel.smfcore.core.message.service.manager.IMessageManager;
import com.neotel.smfcore.core.message.service.po.Message; import com.neotel.smfcore.core.message.service.po.Message;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos; import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.taizhi.TaiZhiApi;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Slf4j @Slf4j
@Component @Component
public class DeviceMessageUtil { public class DeviceMessageUtil {
...@@ -63,6 +67,8 @@ public class DeviceMessageUtil { ...@@ -63,6 +67,8 @@ public class DeviceMessageUtil {
} }
Message message=Message.newMsg(MessageType.ERROR ,storage.getName(), storage.getId(), moudle, code,msg,msgParam); Message message=Message.newMsg(MessageType.ERROR ,storage.getName(), storage.getId(), moudle, code,msg,msgParam);
messageManager.save(message); messageManager.save(message);
TaiZhiApi.onDeviceAlarm(cid,msg);
} }
} }
...@@ -79,7 +85,8 @@ public class DeviceMessageUtil { ...@@ -79,7 +85,8 @@ public class DeviceMessageUtil {
Storage storage = dataCache.getStorage(cid); Storage storage = dataCache.getStorage(cid);
if (storage != null) { if (storage != null) {
Message message=Message.newMsg(MessageType.INFO,storage.getName(), storage.getId(), moudle, "smfcore.messages.offline","离线",null); Message message=Message.newMsg(MessageType.ERROR,storage.getName(), storage.getId(), moudle, "smfcore.messages.offline","离线",null);
TaiZhiApi.deviceStatusChange(cid,0);
messageManager.save(message); messageManager.save(message);
} }
......
...@@ -27,6 +27,7 @@ import com.neotel.smfcore.core.system.bean.MSDAppendInfo; ...@@ -27,6 +27,7 @@ import com.neotel.smfcore.core.system.bean.MSDAppendInfo;
import com.neotel.smfcore.core.system.listener.ITaskListener; import com.neotel.smfcore.core.system.listener.ITaskListener;
import com.neotel.smfcore.core.system.service.po.DataLog; import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService; import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.taizhi.TaiZhiApi;
import javafx.concurrent.Task; import javafx.concurrent.Task;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -146,7 +147,6 @@ public class LiteOrderCache implements ITaskListener { ...@@ -146,7 +147,6 @@ public class LiteOrderCache implements ITaskListener {
} }
} }
public ResultBean checkOutOrder(LiteOrder liteOrder) throws ValidateException { public ResultBean checkOutOrder(LiteOrder liteOrder) throws ValidateException {
ORDER_COLOR nextColor = getNextColor(); ORDER_COLOR nextColor = getNextColor();
...@@ -280,6 +280,7 @@ public class LiteOrderCache implements ITaskListener { ...@@ -280,6 +280,7 @@ public class LiteOrderCache implements ITaskListener {
} }
liteOrderManager.save(order); liteOrderManager.save(order);
liteOrderMap.put(orderNo, order); liteOrderMap.put(orderNo, order);
TaiZhiApi.orderStatusChange(order);
} else { } else {
log.error("完成任务时,未找到工单[" + orderNo + "]信息"); log.error("完成任务时,未找到工单[" + orderNo + "]信息");
} }
...@@ -332,6 +333,7 @@ public class LiteOrderCache implements ITaskListener { ...@@ -332,6 +333,7 @@ public class LiteOrderCache implements ITaskListener {
} }
log.info("开始执行工单[" + orderNo + "] outBom=" + outBom); log.info("开始执行工单[" + orderNo + "] outBom=" + outBom);
TaiZhiApi.orderStatusChange(cacheOrder);
cacheOrder.setTaskReelCount(0); cacheOrder.setTaskReelCount(0);
cacheOrder.setTaskFinishedTime(-1); cacheOrder.setTaskFinishedTime(-1);
cacheOrder.setFinishedReelCount(0); cacheOrder.setFinishedReelCount(0);
...@@ -393,6 +395,10 @@ public class LiteOrderCache implements ITaskListener { ...@@ -393,6 +395,10 @@ public class LiteOrderCache implements ITaskListener {
task.setSubSourceId(orderItem.getId()); task.setSubSourceId(orderItem.getId());
task.setSubSourceInfo(orderItem.getFeederInfo()); task.setSubSourceInfo(orderItem.getFeederInfo());
task.setType(OP.CHECKOUT); task.setType(OP.CHECKOUT);
//jobType 任务种类:M 常规发料;P 改机发料(优先级最高)
if(cacheOrder.getJobType().equals("P")){
task.setUrgentReel(true);
}
task.setLightColor(nextColor.getRgb()); task.setLightColor(nextColor.getRgb());
task.setStatus(OP_STATUS.WAIT.name()); task.setStatus(OP_STATUS.WAIT.name());
// task = dataLogDao.save(task); // task = dataLogDao.save(task);
...@@ -429,9 +435,9 @@ public class LiteOrderCache implements ITaskListener { ...@@ -429,9 +435,9 @@ public class LiteOrderCache implements ITaskListener {
*/ */
public Collection<String> excludePosIds() { public Collection<String> excludePosIds() {
//排除掉正在执行的仓位 //排除掉正在执行的仓位
List<DataLog> allTasks = taskService.getAllTasks(); Collection<DataLog> queueTasks = taskService.getQueueTasks();
Collection<String> operatingPosIds = new HashSet<>(); Collection<String> operatingPosIds = new HashSet<>();
for (DataLog task : allTasks) { for (DataLog task : queueTasks) {
String posId = task.getPosId(); String posId = task.getPosId();
if (!Strings.isNullOrEmpty(posId)) { if (!Strings.isNullOrEmpty(posId)) {
operatingPosIds.add(task.getPosId()); operatingPosIds.add(task.getPosId());
......
...@@ -94,6 +94,11 @@ public class LiteOrder extends BasePo implements Serializable { ...@@ -94,6 +94,11 @@ public class LiteOrder extends BasePo implements Serializable {
private float orderTimes = 1f; private float orderTimes = 1f;
/** /**
* 任务类型
*/
private String jobType = "";
/**
* 工单类型,默认1=PN,2=RI * 工单类型,默认1=PN,2=RI
*/ */
private int type=1; private int type=1;
......
...@@ -139,7 +139,7 @@ public class MaterialController { ...@@ -139,7 +139,7 @@ public class MaterialController {
@ApiOperation("物料分组界面") @ApiOperation("物料分组界面")
@GetMapping("/labelOuput") @GetMapping("/labelOuput")
@PreAuthorize("@el.check('labelOuput')") @PreAuthorize("@el.check('labelOuput')")
public PageData<StoragePosDto> storagePosFind(StoragePosFindCriteria criteria, Pageable pageable, HttpServletRequest request) { public PageData<StoragePosDto> labelOuput(StoragePosFindCriteria criteria, Pageable pageable, HttpServletRequest request) {
if (ObjectUtil.isEmpty(criteria.getStorageId()) ||criteria.getStorageId().equals("0") ){ if (ObjectUtil.isEmpty(criteria.getStorageId()) ||criteria.getStorageId().equals("0") ){
criteria.setStorageId(null); criteria.setStorageId(null);
} }
......
...@@ -12,7 +12,7 @@ import java.util.List; ...@@ -12,7 +12,7 @@ import java.util.List;
@Data @Data
public class StoragePosFindCriteria { public class StoragePosFindCriteria {
@QueryCondition(blurry = "barcode.partNumber,barcode,posName") @QueryCondition(blurry = "barcode.partNumber,barcode.barcode,posName")
private String blurry; private String blurry;
@QueryCondition(type = QueryCondition.Type.BETWEEN, propName = "barcode.putInDate") @QueryCondition(type = QueryCondition.Type.BETWEEN, propName = "barcode.putInDate")
......
package com.neotel.smfcore.core.system.api;
public class APIUtil {
}
package com.neotel.smfcore.core.system.api;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.system.listener.ITaskListener;
import com.neotel.smfcore.core.system.service.po.DataLog;
import org.springframework.stereotype.Service;
/**
* Created by sunke on 2021/7/12.
*/
@Service
public class DefaultSMFListener implements ISMFListener {
@Override
public void onTaskStatusChange(DataLog task) {
}
@Override
public void onLiteOrderStatusChange(LiteOrder liteOrder) {
}
@Override
public Barcode canPutIn(Barcode barcode) throws ValidateException {
return null;
}
}
package com.neotel.smfcore.core.system.api;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.api.CodeValidateParam;
import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.system.service.po.DataLog;
/**
* Created by sunke on 2021/7/12.
*/
public interface ISMFListener {
void onTaskStatusChange(DataLog task);
void onLiteOrderStatusChange(LiteOrder liteOrder);
/**
* 是否可入库验证
*/
Barcode canPutIn(Barcode barcode) throws ValidateException;
}
...@@ -248,6 +248,10 @@ public class DataLog extends BasePo implements Serializable { ...@@ -248,6 +248,10 @@ public class DataLog extends BasePo implements Serializable {
return OP_STATUS.FINISHED.name().equals(status); return OP_STATUS.FINISHED.name().equals(status);
} }
public boolean isOutBox(){
return OP_STATUS.OUTBOX.name().equals(status);
}
public boolean isWait(){ public boolean isWait(){
return OP_STATUS.WAIT.name().equals(status); return OP_STATUS.WAIT.name().equals(status);
} }
...@@ -404,7 +408,7 @@ public class DataLog extends BasePo implements Serializable { ...@@ -404,7 +408,7 @@ public class DataLog extends BasePo implements Serializable {
* 判断任务是否异常,执行中,且10分钟未更新的认为异常 * 判断任务是否异常,执行中,且10分钟未更新的认为异常
*/ */
public boolean isAbnormal(){ public boolean isAbnormal(){
if(isExecuting() ){ if(isExecuting()){
if(System.currentTimeMillis() - super.getUpdateDate().getTime() > 10 * 60 * 1000){ if(System.currentTimeMillis() - super.getUpdateDate().getTime() > 10 * 60 * 1000){
return true; return true;
} }
......
...@@ -648,37 +648,7 @@ public class TaskService { ...@@ -648,37 +648,7 @@ public class TaskService {
} }
String lockPosId = ReelLockPosUtil.getReelLockPosId(barcode.getBarcode());
StoragePos pos = null; StoragePos pos = null;
if (!Strings.isNullOrEmpty(lockPosId)) {
//已有锁定库位
pos = storagePosManager.get(lockPosId);
if (pos != null) {
if(!storageIds.contains(pos.getStorageId())){
log.info("条码[" + barcode.getBarcode() + "]已有锁定库位[" + pos.getPosName() + "],料仓ID["+pos.getStorageId()+"]不在请求列表["+String.join(",",storageIds)+"]中,重新查找库位");
pos = null;
}
else if (pos.getW() < barcode.getPlateSize() || pos.getH() < barcode.getHeight()) {
log.info("条码[" + barcode.getBarcode() + "]尺寸已改变,无法放入已锁定库位[" + pos.getPosName() + "],重新查找库位");
pos = null;
} else {
Barcode posBarcode = pos.getBarcode();
if (posBarcode == null) {
log.info("条码[" + barcode.getBarcode() + "]已锁定库位[" + pos.getPosName() + "],返回锁定中的库位");
} else {
log.info("条码[" + barcode.getBarcode() + "]已锁定库位[" + pos.getPosName() + "]中已有物料[" + posBarcode.getBarcode() + "],重新查找库位");
pos = null;
}
}
}
}
if (pos != null) {
return pos;
}
//可用的料仓(在线,且可以放入) //可用的料仓(在线,且可以放入)
List<Storage> availbleStorageList = new ArrayList<>(); List<Storage> availbleStorageList = new ArrayList<>();
...@@ -926,7 +896,7 @@ public class TaskService { ...@@ -926,7 +896,7 @@ public class TaskService {
dataCache.updateInventory(storagePos, barcode); dataCache.updateInventory(storagePos, barcode);
//记录日志 //记录日志
task.setStatus(OP_STATUS.FINISHED.name()); task.setStatus(OP_STATUS.OUTBOX.name());
if (isCancelTask) { if (isCancelTask) {
task.setStatus(OP_STATUS.CANCEL.name()); task.setStatus(OP_STATUS.CANCEL.name());
} }
......
...@@ -424,7 +424,7 @@ public class PanaApiController implements IOpAuthApi, ITaskListener{ ...@@ -424,7 +424,7 @@ public class PanaApiController implements IOpAuthApi, ITaskListener{
} }
} }
}else{ }else{
log.info("没有配置PanaCIM条码检测接口,查找setConfiguration注册的IP 及端口"); //log.info("没有配置PanaCIM条码检测接口,查找setConfiguration注册的IP 及端口");
return null; return null;
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -477,7 +477,7 @@ public class PanaApiController implements IOpAuthApi, ITaskListener{ ...@@ -477,7 +477,7 @@ public class PanaApiController implements IOpAuthApi, ITaskListener{
String result = HttpHelper.postJson(inNotifyApi,params); String result = HttpHelper.postJson(inNotifyApi,params);
log.info("Response Of checkInNotification From PanaCIM:"+result); log.info("Response Of checkInNotification From PanaCIM:"+result);
}else{ }else{
log.info("没有配置PanaCIM接口,无需通知"); //log.info("没有配置PanaCIM接口,无需通知");
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -511,7 +511,7 @@ public class PanaApiController implements IOpAuthApi, ITaskListener{ ...@@ -511,7 +511,7 @@ public class PanaApiController implements IOpAuthApi, ITaskListener{
log.info("Response Of deliverNotification From PanaCIM:"+result); log.info("Response Of deliverNotification From PanaCIM:"+result);
}else{ }else{
log.info("没有配置PanaCIM接口,无需通知"); //log.info("没有配置PanaCIM接口,无需通知");
} }
} catch (Exception e) { } catch (Exception e) {
log.error("出库通知PanaCIM["+outNotifyApi+"]料盘"+task.getBarcode()+" 出错",e); log.error("出库通知PanaCIM["+outNotifyApi+"]料盘"+task.getBarcode()+" 出错",e);
......
package com.neotel.smfcore.taizhi;
import com.neotel.smfcore.core.device.util.DataCache;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
@Service
@Slf4j
public class TaiZhiConfig {
//读取配置中的地址
@Value("${taizhi.url.deviceAlarm:}")
public String deviceAlarmUrl = "";
@Value("${taizhi.url.deviceStatus:}")
public String deviceStatusUrl = "";
/**
* 入库验证地址
*/
@Value("${taizhi.url.inAssert:}")
public String inAssertUrl = "";
/**
* 入库完成通知接口
*/
@Value("${taizhi.url.inLocation:}")
public String inLocationUrl = "";
@Value("${taizhi.url.outStatus:}")
public String outStatusUrl = "";
/**
* 出库完成通知接口
*/
@Value("${taizhi.url.outDone:}")
public String outDoneUrl = "";
/**
* 仓储温湿度接口
*/
@Value("${taizhi.url.storageEnv:}")
public String storageEnvUrl = "";
}
taizhi:
#url:
inAssert: http://172.26.13.211:9030/device/alarm
deviceAlarm: http://172.26.13.211:9030/device/alarm
# 登录相关配置 # 登录相关配置
......
taizhi:
url:
deviceAlarm: http://172.26.13.211:9030/device/alarm
deviceStatus: http://172.26.13.211:9030/device/status
inAssert: http://172.26.13.211:9030/matter/in/assert
inLocation: http://172.26.13.211:9030/matter/in/location
outStatus: http://172.26.13.211:9030/matter/out/status
outDone: http://172.26.13.211:9030/matter/out/done
storageEnv: http://172.26.13.211:9030/storage/env
server: server:
port: 8800 port: 8800
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!