Commit 3be0048e zshaohui

工单出库逻辑修改

1 个父辈 8fde5746
...@@ -15,7 +15,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -15,7 +15,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
//@EnableAsync //@EnableAsync
@EnableScheduling //@EnableScheduling
@EnableKafka @EnableKafka
@RestController @RestController
@SpringBootApplication @SpringBootApplication
......
...@@ -46,7 +46,7 @@ public class MainTimer { ...@@ -46,7 +46,7 @@ public class MainTimer {
public void run() { public void run() {
timerTask(); timerTask();
} }
}, 5, 10, TimeUnit.SECONDS); }, 5, 30, TimeUnit.SECONDS);
//log.info("如果是人工叫料,则每2分钟执行一次"); //log.info("如果是人工叫料,则每2分钟执行一次");
scheduledThreadPool.scheduleAtFixedRate(new Runnable() { scheduledThreadPool.scheduleAtFixedRate(new Runnable() {
...@@ -72,18 +72,11 @@ public class MainTimer { ...@@ -72,18 +72,11 @@ public class MainTimer {
} }
private void timerTask() { private void timerTask() {
if (!preGenerateTaskTime()) {
return;
}
lastPreGenerateTaskTime = System.currentTimeMillis();
try { try {
log.info("生成缺料预警任务"); //log.info("生成缺料预警任务");
//PreWarningItemCache.runTimer(0); PreWarningItemCache.runTimer();
PreWarningItemCache.runTimer(1);
//liteOrderCache.runTimer(0);
//设备状态判断 //设备状态判断
DevicesStatusUtil.runTimer(); DevicesStatusUtil.runTimer();
//其他设备状态判断 //其他设备状态判断
EquipStatusUtil.runTimer(); EquipStatusUtil.runTimer();
} catch (Exception e) { } catch (Exception e) {
......
...@@ -175,4 +175,14 @@ public class Constants { ...@@ -175,4 +175,14 @@ public class Constants {
* 工单生成个数 * 工单生成个数
*/ */
public static final String CACHE_preGenerateTask_Times = "preGenerateTask_times"; public static final String CACHE_preGenerateTask_Times = "preGenerateTask_times";
/**
* 线体配置
*/
public static final String CACHE_lineConfigList = "CACHE_lineConfigList";
/**
* 迈征配置分钟
*/
public static final String CACHE_maiZhengMinute = "maiZhengMinute";
} }
...@@ -46,24 +46,36 @@ public class HttpHelper { ...@@ -46,24 +46,36 @@ public class HttpHelper {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
try { try {
String requestBody = mapper.writeValueAsString(object); String requestBody = mapper.writeValueAsString(object);
httpPost.setEntity(new StringEntity(requestBody,CONTENT_CHARSET)); httpPost.setEntity(new StringEntity(requestBody, CONTENT_CHARSET));
} 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 (Exception e) { } catch (Exception e) {
throw new ApiException("Request params to [" + url + "] failed:" + e.getMessage()); throw new ApiException("Request params to [" + url + "] failed:" + e.getMessage());
} }
} }
try{ CloseableHttpClient httpClient = null;
CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = null;
CloseableHttpResponse response = httpClient.execute(httpPost); try {
httpClient = HttpClients.createDefault();
response = httpClient.execute(httpPost);
//System.out.println(response.getStatusLine().getStatusCode() + "\n"); //System.out.println(response.getStatusLine().getStatusCode() + "\n");
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
String responseContent = EntityUtils.toString(entity, CONTENT_CHARSET); String responseContent = EntityUtils.toString(entity, CONTENT_CHARSET);
response.close();
httpClient.close();
return responseContent; return responseContent;
}catch (Exception e){ } catch (Exception e) {
throw new ApiException("Request to [" + url + "] failed:" + e.getMessage()); throw new ApiException("Request to [" + url + "] failed:" + e.getMessage());
} finally {
try {
if (response != null) {
response.close();
}
if (httpClient != null) {
httpClient.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
} }
...@@ -76,24 +88,37 @@ public class HttpHelper { ...@@ -76,24 +88,37 @@ 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,CONTENT_CHARSET)); httpPost.setEntity(new StringEntity(requestBody, CONTENT_CHARSET));
} 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 (Exception e) { } catch (Exception e) {
throw new ApiException("Request params to [" + url + "] failed:" + e.getMessage()); throw new ApiException("Request params to [" + url + "] failed:" + e.getMessage());
} }
} }
try{ CloseableHttpClient httpClient = null;
CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = null;
CloseableHttpResponse response = httpClient.execute(httpPost); try {
httpClient = HttpClients.createDefault();
response = httpClient.execute(httpPost);
//System.out.println(response.getStatusLine().getStatusCode() + "\n"); //System.out.println(response.getStatusLine().getStatusCode() + "\n");
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
String responseContent = EntityUtils.toString(entity, CONTENT_CHARSET); String responseContent = EntityUtils.toString(entity, CONTENT_CHARSET);
response.close(); response.close();
httpClient.close(); httpClient.close();
return responseContent; return responseContent;
}catch (Exception e){ } catch (Exception e) {
throw new ApiException("Request to [" + url + "] failed:" + e.getMessage()); throw new ApiException("Request to [" + url + "] failed:" + e.getMessage());
} finally {
try {
if (response != null) {
response.close();
}
if (httpClient != null) {
httpClient.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
} }
...@@ -122,15 +147,16 @@ public class HttpHelper { ...@@ -122,15 +147,16 @@ public class HttpHelper {
params.add(new BasicNameValuePair(entry.getKey(),value)); params.add(new BasicNameValuePair(entry.getKey(),value));
} }
} }
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
try { try {
URI uri = new URIBuilder(url).setParameters(params).build(); URI uri = new URIBuilder(url).setParameters(params).build();
log.info("执行MES请求:"+uri.toString()); log.info("执行MES请求:"+uri.toString());
HttpPost httpPost = new HttpPost(uri); HttpPost httpPost = new HttpPost(uri);
httpPost.addHeader("Content-Type", "application/json;charset=utf-8"); httpPost.addHeader("Content-Type", "application/json;charset=utf-8");
// httpPost.setEntity(new UrlEncodedFormEntity(params, CONTENT_CHARSET)); // httpPost.setEntity(new UrlEncodedFormEntity(params, CONTENT_CHARSET));
CloseableHttpClient httpClient = HttpClients.createDefault(); httpClient = HttpClients.createDefault();
CloseableHttpResponse response = httpClient.execute(httpPost); response = httpClient.execute(httpPost);
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
String responseContent = EntityUtils.toString(entity, CONTENT_CHARSET); String responseContent = EntityUtils.toString(entity, CONTENT_CHARSET);
response.close(); response.close();
...@@ -138,6 +164,17 @@ public class HttpHelper { ...@@ -138,6 +164,17 @@ public class HttpHelper {
return responseContent; return responseContent;
} catch (Exception e) { } catch (Exception e) {
throw new ApiException("Request params to [" + url + "] failed:" + e.getMessage()); throw new ApiException("Request params to [" + url + "] failed:" + e.getMessage());
} finally {
try {
if (response != null) {
response.close();
}
if (httpClient != null) {
httpClient.close();
}
} catch (IOException e) {
e.printStackTrace();
}
} }
} }
...@@ -156,9 +193,10 @@ public class HttpHelper { ...@@ -156,9 +193,10 @@ public class HttpHelper {
.setConnectTimeout(5000) .setConnectTimeout(5000)
.setConnectionRequestTimeout(5000).build(); .setConnectionRequestTimeout(5000).build();
httpget.setConfig(build); httpget.setConfig(build);
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null; CloseableHttpResponse response = null;
try { try {
CloseableHttpClient httpClient = HttpClients.createDefault(); httpClient = HttpClients.createDefault();
response = httpClient.execute(httpget); response = httpClient.execute(httpget);
} catch (IOException e1) { } catch (IOException e1) {
e1.printStackTrace(); e1.printStackTrace();
...@@ -173,7 +211,12 @@ public class HttpHelper { ...@@ -173,7 +211,12 @@ public class HttpHelper {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
try { try {
if (httpClient != null){
httpClient.close();
}
if (response != null) {
response.close(); response.close();
}
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -23,6 +23,7 @@ import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager; ...@@ -23,6 +23,7 @@ import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
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.core.system.bean.OrderSetting; import com.neotel.smfcore.core.system.bean.OrderSetting;
import com.neotel.smfcore.core.system.rest.bean.LineConfig;
import com.neotel.smfcore.core.system.service.dao.ICacheItemDao; import com.neotel.smfcore.core.system.service.dao.ICacheItemDao;
import com.neotel.smfcore.core.system.service.dao.ISettingsDao; import com.neotel.smfcore.core.system.service.dao.ISettingsDao;
import com.neotel.smfcore.core.system.service.po.CacheItem; import com.neotel.smfcore.core.system.service.po.CacheItem;
...@@ -709,4 +710,16 @@ public class DataCache { ...@@ -709,4 +710,16 @@ public class DataCache {
} }
return 0; return 0;
} }
public int getLineConfigMinute(String line) {
List<LineConfig> lineConfigList = getCache(Constants.CACHE_lineConfigList);
if (lineConfigList != null && !lineConfigList.isEmpty()){
for (LineConfig lineConfig : lineConfigList) {
if (lineConfig.getLine().equals(line)){
return lineConfig.getMinute();
}
}
}
return 0;
}
} }
...@@ -219,6 +219,9 @@ public class LiteOrderItem extends BasePo implements Serializable ,Comparable<Li ...@@ -219,6 +219,9 @@ public class LiteOrderItem extends BasePo implements Serializable ,Comparable<Li
*/ */
private Date issuanceDate; private Date issuanceDate;
private Date receiveDate;
/** /**
* 出库是否满足要求,已出库数量大于需求数量 * 出库是否满足要求,已出库数量大于需求数量
*/ */
......
...@@ -13,6 +13,7 @@ import com.neotel.smfcore.core.language.service.po.LanguageMsg; ...@@ -13,6 +13,7 @@ import com.neotel.smfcore.core.language.service.po.LanguageMsg;
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.bean.OrderSetting; import com.neotel.smfcore.core.system.bean.OrderSetting;
import com.neotel.smfcore.core.system.rest.bean.LineConfig;
import com.neotel.smfcore.core.system.rest.bean.dto.SettingsDto; import com.neotel.smfcore.core.system.rest.bean.dto.SettingsDto;
import com.neotel.smfcore.core.system.rest.bean.dto.SysSettingsDto; import com.neotel.smfcore.core.system.rest.bean.dto.SysSettingsDto;
import com.neotel.smfcore.core.system.rest.bean.mapstruct.SettingsMapper; import com.neotel.smfcore.core.system.rest.bean.mapstruct.SettingsMapper;
...@@ -76,6 +77,9 @@ public class SettingsController { ...@@ -76,6 +77,9 @@ public class SettingsController {
String permissionPassword = dataCache.getCache(Constants.CACHE_permissionPassword); String permissionPassword = dataCache.getCache(Constants.CACHE_permissionPassword);
String floor = dataCache.getCache(Constants.CACHE_floor); String floor = dataCache.getCache(Constants.CACHE_floor);
Integer preGenerateTaskTimes = dataCache.getCache(Constants.CACHE_preGenerateTask_Times); Integer preGenerateTaskTimes = dataCache.getCache(Constants.CACHE_preGenerateTask_Times);
List<LineConfig> lineConfigList = dataCache.getCache(Constants.CACHE_lineConfigList);
Integer maiZhengMinute = dataCache.getCache(Constants.CACHE_maiZhengMinute);
SysSettingsDto dto = new SysSettingsDto(); SysSettingsDto dto = new SysSettingsDto();
dto.setStartJob(startJob); dto.setStartJob(startJob);
dto.setStopOut(stopOut); dto.setStopOut(stopOut);
...@@ -84,6 +88,8 @@ public class SettingsController { ...@@ -84,6 +88,8 @@ public class SettingsController {
dto.setPermissionPassword(permissionPassword); dto.setPermissionPassword(permissionPassword);
dto.setFloor(floor); dto.setFloor(floor);
dto.setPreGenerateTaskTimes(preGenerateTaskTimes); dto.setPreGenerateTaskTimes(preGenerateTaskTimes);
dto.setLineConfigList(lineConfigList);
dto.setMaiZhengMinute(maiZhengMinute);
return dto; return dto;
} }
...@@ -98,12 +104,24 @@ public class SettingsController { ...@@ -98,12 +104,24 @@ public class SettingsController {
dataCache.updateCache(Constants.CACHE_permissionPassword,sysSettingsDto.getPermissionPassword()); dataCache.updateCache(Constants.CACHE_permissionPassword,sysSettingsDto.getPermissionPassword());
dataCache.updateCache(Constants.CACHE_floor,sysSettingsDto.getFloor()); dataCache.updateCache(Constants.CACHE_floor,sysSettingsDto.getFloor());
dataCache.updateCache(Constants.CACHE_preGenerateTask_Times,sysSettingsDto.getPreGenerateTaskTimes()); dataCache.updateCache(Constants.CACHE_preGenerateTask_Times,sysSettingsDto.getPreGenerateTaskTimes());
List<LineConfig> lineConfigList = sysSettingsDto.getLineConfigList();
if (lineConfigList == null){
lineConfigList = new ArrayList<>();
}
dataCache.updateCache(Constants.CACHE_lineConfigList,lineConfigList);
if (sysSettingsDto.getMaiZhengMinute() != null) {
dataCache.updateCache(Constants.CACHE_maiZhengMinute, sysSettingsDto.getMaiZhengMinute());
}
log.info("更改系统设置:stopout=" + sysSettingsDto.isStopOut() + ",stopjob=" + sysSettingsDto.isStartJob() log.info("更改系统设置:stopout=" + sysSettingsDto.isStopOut() + ",stopjob=" + sysSettingsDto.isStartJob()
+ ",backUpMonth=" + sysSettingsDto.getBackUpMonth() + ",backUpMonth=" + sysSettingsDto.getBackUpMonth()
+ ",preGenerateTask=" + sysSettingsDto.getPreGenerateTask() + ",preGenerateTask=" + sysSettingsDto.getPreGenerateTask()
+ ",permissionPassword=" + sysSettingsDto.getPermissionPassword() + ",permissionPassword=" + sysSettingsDto.getPermissionPassword()
+ ",floor=" + sysSettingsDto.getFloor() + ",floor=" + sysSettingsDto.getFloor()
+",preGenerateTaskTimes=" +sysSettingsDto.getPreGenerateTaskTimes() +",preGenerateTaskTimes=" +sysSettingsDto.getPreGenerateTaskTimes()
+",lineConfigList="+sysSettingsDto.getLineConfigList()
+",maiZhengMinute="+sysSettingsDto.getMaiZhengMinute()
); );
return ResultBean.newOkResult("保存成功"); return ResultBean.newOkResult("保存成功");
} }
......
package com.neotel.smfcore.core.system.rest.bean;
import lombok.Data;
@Data
public class LineConfig {
private String line;
private int minute;
}
package com.neotel.smfcore.core.system.rest.bean.dto; package com.neotel.smfcore.core.system.rest.bean.dto;
import com.neotel.smfcore.core.system.rest.bean.LineConfig;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
@Getter @Getter
@Setter @Setter
public class SysSettingsDto implements Serializable { public class SysSettingsDto implements Serializable {
...@@ -30,4 +34,12 @@ public class SysSettingsDto implements Serializable { ...@@ -30,4 +34,12 @@ public class SysSettingsDto implements Serializable {
@ApiModelProperty("楼层信息") @ApiModelProperty("楼层信息")
private String floor=""; private String floor="";
@ApiModelProperty("线体配置")
private List<LineConfig> lineConfigList;
@ApiModelProperty("迈征配置时间")
private Integer maiZhengMinute;
} }
...@@ -540,8 +540,11 @@ public class TaskService { ...@@ -540,8 +540,11 @@ public class TaskService {
if (outTask != null) { if (outTask != null) {
log.info(outTask.getSourceName()+"barcode为:"+outTask.getBarcode()+"面别为:"+outTask.getSide()); log.info(outTask.getSourceName()+"barcode为:"+outTask.getBarcode()+"面别为:"+outTask.getSide());
if(StringUtils.isNotBlank(outTask.getSide())) {
exportMap.put(cid, outTask.getSide()); exportMap.put(cid, outTask.getSide());
} }
}
return outTask; return outTask;
} }
......
...@@ -517,7 +517,7 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -517,7 +517,7 @@ public class LizhenApi extends DefaultSmfApiListener {
} }
} }
if (items != null && !items.isEmpty()) { if (items != null && !items.isEmpty()) {
return PreWarningItemCache.createAndExecuteLiteOrder(items,2,false); return PreWarningItemCache.createAndExecuteLiteOrder(items,false);
} }
} }
return null; return null;
......
...@@ -232,7 +232,12 @@ public class LizhenController { ...@@ -232,7 +232,12 @@ public class LizhenController {
item.setPartnumber(data.get("PARTNUMBER")); item.setPartnumber(data.get("PARTNUMBER"));
item.setLine(data.get("LINE")); item.setLine(data.get("LINE"));
item.setItemId(data.get("ID")); item.setItemId(data.get("ID"));
try {
item.setPriority(Integer.valueOf(data.get("PRIORITY"))); item.setPriority(Integer.valueOf(data.get("PRIORITY")));
} catch (NumberFormatException e) {
e.printStackTrace();
item.setPriority(0);
}
item.setReel(data.get("REEL")); item.setReel(data.get("REEL"));
item.setBrand(data.get("VENDOR")); item.setBrand(data.get("VENDOR"));
......
...@@ -94,7 +94,7 @@ public class InnerBoxRestController { ...@@ -94,7 +94,7 @@ public class InnerBoxRestController {
String hSerial = request.getParameter("hSerial"); //工单序号 String hSerial = request.getParameter("hSerial"); //工单序号
String outlet = request.getParameter("outlet"); //出口位置 String outlet = request.getParameter("outlet"); //出口位置
String boxSide = request.getParameter("boxSide"); //料箱隔口 String boxSide = request.getParameter("boxSide"); //料箱隔口
log.info("IA 出库更新任务状态--barcode:{},status:{},loc:{},hSerial:{},outlet:{},boxSide:{}", code, status, loc, hSerial, outlet, boxSide); log.info("IA 出库更新任务状态--barcode:{},status:{},loc:{},hSerial:{},outlet:{},boxSide:{},cid:{},outlet:{}", code, status, loc, hSerial, outlet, boxSide,cid,outlet);
CodeBean codeBean = codeResolve.resolveSingleCode(code); CodeBean codeBean = codeResolve.resolveSingleCode(code);
Barcode barcode = codeBean.getBarcode(); Barcode barcode = codeBean.getBarcode();
...@@ -121,7 +121,7 @@ public class InnerBoxRestController { ...@@ -121,7 +121,7 @@ public class InnerBoxRestController {
return ResultBean.newErrorResult(304, "smfcore.task.hasEnd", "任务已完成"); return ResultBean.newErrorResult(304, "smfcore.task.hasEnd", "任务已完成");
} }
status = status.toUpperCase(); status = status.toUpperCase();
log.info("更新任务状态:{}-->{}", opTask.getStatus(), status); //log.info("更新任务状态:{}-->{}", opTask.getStatus(), status);
//调用此接口的肯定是料盘已出仓位的 //调用此接口的肯定是料盘已出仓位的
if(opTask.isExecuting()){ if(opTask.isExecuting()){
......
...@@ -61,6 +61,8 @@ public class PrinterRestController { ...@@ -61,6 +61,8 @@ public class PrinterRestController {
String code = paramMap.get("code"); String code = paramMap.get("code");
log.info("补打印标签:"+code);
CodeBean codeBean = codeResolve.resolveSingleCode(code); CodeBean codeBean = codeResolve.resolveSingleCode(code);
Barcode barcode = codeBean.getBarcode(); Barcode barcode = codeBean.getBarcode();
......
...@@ -19,7 +19,11 @@ import org.springframework.scheduling.annotation.Scheduled; ...@@ -19,7 +19,11 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.concurrent.ListenableFuture; import org.springframework.util.concurrent.ListenableFuture;
import javax.annotation.PostConstruct;
import java.util.*; import java.util.*;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
//@Async //@Async
...@@ -37,10 +41,21 @@ public class KafkaService { ...@@ -37,10 +41,21 @@ public class KafkaService {
Map<String,String> statusMap = Maps.newConcurrentMap(); Map<String,String> statusMap = Maps.newConcurrentMap();
ScheduledExecutorService scheduledThreadPool = Executors.newScheduledThreadPool(1);
@PostConstruct
void init(){
scheduledThreadPool.scheduleAtFixedRate(
() -> {
setMachineStatus();
setHeartbeat();
},5,60, TimeUnit.SECONDS
);
}
/** /**
* 设备状态发送 * 设备状态发送
*/ */
@Scheduled(fixedRate = 1000 * 60 * 1) //@Scheduled(fixedRate = 1000 * 60 * 2)
public void setMachineStatus() { public void setMachineStatus() {
log.info("发送设备状态开始"); log.info("发送设备状态开始");
Collection<Storage> storages = dataCache.getAllStorage().values(); Collection<Storage> storages = dataCache.getAllStorage().values();
...@@ -111,7 +126,7 @@ public class KafkaService { ...@@ -111,7 +126,7 @@ public class KafkaService {
/** /**
* 心跳数据发送 * 心跳数据发送
*/ */
@Scheduled(fixedRate = 1000 * 60 * 5) //@Scheduled(fixedRate = 1000 * 60 * 5)
public void setHeartbeat() { public void setHeartbeat() {
log.info("发送心跳开始"); log.info("发送心跳开始");
//根据machineId,找到设备状态,是否正常 //根据machineId,找到设备状态,是否正常
......
...@@ -328,6 +328,7 @@ public class InnerReportController { ...@@ -328,6 +328,7 @@ public class InnerReportController {
resultMap.put("料号", dto.getPn() == null ? "" : dto.getPn()); resultMap.put("料号", dto.getPn() == null ? "" : dto.getPn());
resultMap.put("需求卷", dto.getNeedReelCount()); resultMap.put("需求卷", dto.getNeedReelCount());
resultMap.put("实发卷", dto.getOutReelCount()); resultMap.put("实发卷", dto.getOutReelCount());
resultMap.put("创建时间",dto.getCreateDate());
results.add(resultMap); results.add(resultMap);
} }
try { try {
......
package com.neotel.smfcore.custom.lizhen.third.maicheng.util; package com.neotel.smfcore.custom.lizhen.third.maicheng.util;
import com.alibaba.fastjson.JSONObject; import com.google.common.collect.Maps;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.utils.StringUtils; import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.custom.lizhen.third.maicheng.api.MaiZhengApi; import com.neotel.smfcore.custom.lizhen.third.maicheng.api.MaiZhengApi;
import com.neotel.smfcore.custom.lizhen.third.maicheng.bean.StationStatus; import com.neotel.smfcore.custom.lizhen.third.maicheng.bean.StationStatus;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -24,10 +23,13 @@ public class StationStatusCache { ...@@ -24,10 +23,13 @@ public class StationStatusCache {
@Autowired @Autowired
private DataCache dataCache; private DataCache dataCache;
public static final String MAICHENG_STATIONSTATUS_CACHE = "MaiChengStationStatusCache"; public static final String MAIZHENG_STATIONSTATUS_CACHE_Map = "MaiZhengStationStatusCacheMap";
private static List<StationStatus> stationStatusList = Lists.newCopyOnWriteArrayList(); public static final String MAIZHENG_STATIONSTATUS_CACHE_Line_List = "MaiZhengStationStatusCacheLineList";
public static List<String> stationStatusLineList = new CopyOnWriteArrayList<>();
private static Map<String, String> stationStatusMap = Maps.newConcurrentMap();
@PostConstruct @PostConstruct
public void init() { public void init() {
...@@ -36,9 +38,13 @@ public class StationStatusCache { ...@@ -36,9 +38,13 @@ public class StationStatusCache {
if (statusList != null && !statusList.isEmpty()) { if (statusList != null && !statusList.isEmpty()) {
updateStatusList(statusList); updateStatusList(statusList);
} else { } else {
List<StationStatus> statusCacheList = dataCache.getCache(MAICHENG_STATIONSTATUS_CACHE); Map<String, String> cacheMap = dataCache.getCache(MAIZHENG_STATIONSTATUS_CACHE_Map);
if (statusCacheList != null && !statusCacheList.isEmpty()) { if (cacheMap != null) {
updateStatusList(statusCacheList); stationStatusMap.putAll(cacheMap);
}
List<String> cacheLineList = dataCache.getCache(MAIZHENG_STATIONSTATUS_CACHE_Line_List);
if (cacheLineList != null) {
stationStatusLineList.addAll(cacheLineList);
} }
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -47,30 +53,39 @@ public class StationStatusCache { ...@@ -47,30 +53,39 @@ public class StationStatusCache {
} }
public void updateStatusList(List<StationStatus> statusList) { public void updateStatusList(List<StationStatus> statusList) {
stationStatusList.clear(); stationStatusMap.clear();
stationStatusList.addAll(statusList); stationStatusLineList.clear();
dataCache.updateCache(MAICHENG_STATIONSTATUS_CACHE, stationStatusList); for (StationStatus stationStatus : statusList) {
} String station = stationStatus.getSTATION();
String partnumber = stationStatus.getPARTNUMBER();
String slot = stationStatus.getSLOT();
String line = stationStatus.getLINE();
String side = stationStatus.getSIDE();
String key = station + "_" + partnumber + "_" + slot + "_" + line+"_"+side;
stationStatusMap.put(key, key);
public List<StationStatus> getAllStationStatus() {
List<StationStatus> statusList = new ArrayList<>(); String trackNumber = "";
if (stationStatusList == null || stationStatusList.isEmpty()) {
stationStatusList = dataCache.getCache(MAICHENG_STATIONSTATUS_CACHE);
}
if (stationStatusList != null && !stationStatusList.isEmpty()) {
for (StationStatus status : stationStatusList) {
String station = status.getSTATION();
if (StringUtils.isNotBlank(station)) { if (StringUtils.isNotBlank(station)) {
String trackNumber = station.substring(station.length() - 1); trackNumber = station.substring(station.length() - 1);
status.setTrackNumber(trackNumber);
} }
statusList.add(status); String cacheLine = line + "_" + side + "_" + trackNumber;
stationStatusLineList.add(cacheLine);
}
dataCache.updateCache(MAIZHENG_STATIONSTATUS_CACHE_Map, stationStatusMap);
if (stationStatusLineList != null && !stationStatusLineList.isEmpty()){
stationStatusLineList = stationStatusLineList.stream().distinct().collect(Collectors.toList());
dataCache.updateCache(MAIZHENG_STATIONSTATUS_CACHE_Line_List, stationStatusLineList);
} }
} }
if (statusList != null && !statusList.isEmpty()){ public static Map<String, String> getStationStatusMap() {
statusList = statusList.stream().distinct().collect(Collectors.toList()); return stationStatusMap;
} }
return statusList;
public static List<String> getStationStatusLineList() {
return stationStatusLineList;
} }
} }
...@@ -13,7 +13,7 @@ api: ...@@ -13,7 +13,7 @@ api:
fetchGRUrl: #http://10.42.25.199:8082/api/wcs/fetchGR #gr标签 fetchGRUrl: #http://10.42.25.199:8082/api/wcs/fetchGR #gr标签
brandQtyUrl: #http://172.30.170.199:8082/api/wcs/brandQty #gr标签满卷数 brandQtyUrl: #http://172.30.170.199:8082/api/wcs/brandQty #gr标签满卷数
importUrl: #http://10.42.222.52:8001/smf-core/ext/forward/getDataLogs #内仓导入外仓picking虚拟仓数据 importUrl: #http://10.42.222.52:8001/smf-core/ext/forward/getDataLogs #内仓导入外仓picking虚拟仓数据
checkReelMeasure: #http://10.190.25.149:8001/Sct/CheckReelMeasure #散料量测接口 checkReelMeasure: #http://10.190.25.124:8001/Sct/CheckReelMeasure #散料量测接口
plant: 2810 plant: 2810
werks: 2810 werks: 2810
outerFactory: outerFactory:
...@@ -40,7 +40,7 @@ lizhen: ...@@ -40,7 +40,7 @@ lizhen:
url: http://172.30.97.63:8001/smf-core/api/Mes/machineCallMaterial url: http://172.30.97.63:8001/smf-core/api/Mes/machineCallMaterial
F4: F4:
name: 4F name: 4F
line: B03-4FSMT-11,B03-4FSMT-01,B03-4FSMT-13,B03-4FSMT-03,B03-4FSMT-14 line: B03-4FSMT-11,B03-4FSMT-01,B03-4FSMT-13,B03-4FSMT-03,B03-4FSMT-14,B03-4FSMT-04
url: http://172.25.252.12:8001/smf-core/api/Mes/machineCallMaterial url: http://172.25.252.12:8001/smf-core/api/Mes/machineCallMaterial
...@@ -102,6 +102,5 @@ app: ...@@ -102,6 +102,5 @@ app:
type: "" type: ""
menu: menu:
show: meInventory,meExpiredReport,meChangeReport,meprohibitedReport show: #innerMaterial
hide: hide:
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!