Commit 967875a1 zshaohui

1.迈征对接功能提交

1 个父辈 f18b2cc3
正在显示 18 个修改的文件 包含 175 行增加107 行删除
...@@ -20,6 +20,7 @@ import com.neotel.smfcore.core.order.enums.LITEORDER_STATUS; ...@@ -20,6 +20,7 @@ import com.neotel.smfcore.core.order.enums.LITEORDER_STATUS;
import com.neotel.smfcore.core.order.enums.ORDER_COLOR; import com.neotel.smfcore.core.order.enums.ORDER_COLOR;
import com.neotel.smfcore.core.order.service.manager.ILiteOrderItemManager; import com.neotel.smfcore.core.order.service.manager.ILiteOrderItemManager;
import com.neotel.smfcore.core.order.service.manager.ILiteOrderManager; import com.neotel.smfcore.core.order.service.manager.ILiteOrderManager;
import com.neotel.smfcore.core.order.service.po.ItemOutDetail;
import com.neotel.smfcore.core.order.service.po.LiteOrder; import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.order.service.po.LiteOrderItem; import com.neotel.smfcore.core.order.service.po.LiteOrderItem;
import com.neotel.smfcore.core.storage.bean.InventoryItem; import com.neotel.smfcore.core.storage.bean.InventoryItem;
...@@ -168,6 +169,12 @@ public class LiteOrderCache { ...@@ -168,6 +169,12 @@ public class LiteOrderCache {
for (LiteOrder order : for (LiteOrder order :
liteOrders) { liteOrders) {
//迈征工单不自动出库,其他接口通知出库
if (order.isMaiZheng()){
continue;
}
if (order.isNew() || order.isTaskFinished()) { if (order.isNew() || order.isTaskFinished()) {
if (order.isTaskFinished() && order.isMaiZheng()){ if (order.isTaskFinished() && order.isMaiZheng()){
...@@ -344,6 +351,15 @@ public class LiteOrderCache { ...@@ -344,6 +351,15 @@ public class LiteOrderCache {
liteOrderItem.setTotalOutNum(liteOrderItem.getTotalOutNum() + task.getNum()); liteOrderItem.setTotalOutNum(liteOrderItem.getTotalOutNum() + task.getNum());
liteOrderItem.setTotalOutReelCount(liteOrderItem.getTotalOutReelCount() + 1); liteOrderItem.setTotalOutReelCount(liteOrderItem.getTotalOutReelCount() + 1);
liteOrderItem.setOutReelList(task.getBarcode()); liteOrderItem.setOutReelList(task.getBarcode());
//同时设置详情
ItemOutDetail detail = new ItemOutDetail();
detail.setReelNew(task.getBarcode());
detail.setReelNewLong(task.getFullCode());
detail.setX(task.getX());
detail.setY(task.getY());
liteOrderItem.setOutDetailList(detail);
liteOrderItem.setPositionList(task.getPosName()); liteOrderItem.setPositionList(task.getPosName());
liteOrderItem = liteOrderItemManager.save(liteOrderItem); liteOrderItem = liteOrderItemManager.save(liteOrderItem);
} }
......
package com.neotel.smfcore.core.order.service.po;
import lombok.Data;
@Data
public class ItemOutDetail {
private String reelNew;
private String reelNewLong;
private String x;
private String y;
}
...@@ -166,15 +166,11 @@ public class LiteOrder extends BasePo implements Serializable { ...@@ -166,15 +166,11 @@ public class LiteOrder extends BasePo implements Serializable {
//迈征额外参数 //迈征额外参数
private String guid; private String repoOrder;
private String processType; private String cacheID;
private String cacheIndex; private String reelBoxID;
private String cacheSlot;
private String recvIndex;
private String count; private String count;
private String dia;
private String startTime; private String startTime;
private String reelBoxId;
......
...@@ -231,6 +231,7 @@ public class LiteOrderItem extends BasePo implements Serializable ,Comparable<Li ...@@ -231,6 +231,7 @@ public class LiteOrderItem extends BasePo implements Serializable ,Comparable<Li
*/ */
private List<String> outReelList; private List<String> outReelList;
private List<ItemOutDetail> outDetailList;
private String width; private String width;
...@@ -256,6 +257,13 @@ public class LiteOrderItem extends BasePo implements Serializable ,Comparable<Li ...@@ -256,6 +257,13 @@ public class LiteOrderItem extends BasePo implements Serializable ,Comparable<Li
outReelList.add(reel); outReelList.add(reel);
} }
public void setOutDetailList(ItemOutDetail detail) {
if (outDetailList == null){
outDetailList = new ArrayList<>();
}
outDetailList.add(detail);
}
public void setPositionList(String position) { public void setPositionList(String position) {
if (positionList == null){ if (positionList == null){
positionList = new ArrayList<>(); positionList = new ArrayList<>();
......
...@@ -362,6 +362,12 @@ public class DataLog extends BasePo implements Serializable { ...@@ -362,6 +362,12 @@ public class DataLog extends BasePo implements Serializable {
*/ */
private int height = 0; private int height = 0;
//迈征的 弹夹 x,y坐标
private String x;
private String y;
//完整条码
private String fullCode;
/** /**
* 出口位置 * 出口位置
......
...@@ -99,7 +99,9 @@ public class InnerBoxRestController { ...@@ -99,7 +99,9 @@ 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:{},cid:{},outlet:{}", code, status, loc, hSerial, outlet, boxSide,cid,outlet); String x = request.getParameter("x");
String y = request.getParameter("y");
log.info("IA 出库更新任务状态--barcode:{},status:{},loc:{},hSerial:{},outlet:{},boxSide:{},cid:{},outlet:{},x:{},y:{}", code, status, loc, hSerial, outlet, boxSide,cid,outlet,x,y);
CodeBean codeBean = codeResolve.resolveSingleCode(code); CodeBean codeBean = codeResolve.resolveSingleCode(code);
Barcode barcode = codeBean.getBarcode(); Barcode barcode = codeBean.getBarcode();
...@@ -134,6 +136,14 @@ public class InnerBoxRestController { ...@@ -134,6 +136,14 @@ public class InnerBoxRestController {
outFromPos(opTask); outFromPos(opTask);
} }
opTask.setStatus(status); opTask.setStatus(status);
if (StringUtils.isNotEmpty(x)){
opTask.setX(x);
}
if (StringUtils.isNotEmpty(y)){
opTask.setY(y);
}
opTask.setFullCode(barcode.getFullCode());
taskService.moveTaskToFinished(opTask); taskService.moveTaskToFinished(opTask);
//清理锁定库位 //清理锁定库位
ReelLockPosUtil.removeReelLockPosInfo(code); ReelLockPosUtil.removeReelLockPosInfo(code);
......
...@@ -62,7 +62,7 @@ public class StorageExportUtil { ...@@ -62,7 +62,7 @@ public class StorageExportUtil {
//出料口名称 //出料口名称
private final static List<String> exportStrArr = Arrays.asList("UM_2", "UM_3", "UM_4", "UM_5"); private final static List<String> exportStrArr = Arrays.asList("UM_1","UM_2", "UM_3", "UM_4", "UM_5");
//料仓前缀 //料仓前缀
public static final String EXPORT_PREFIX = "Storage_Export"; public static final String EXPORT_PREFIX = "Storage_Export";
......
...@@ -71,6 +71,8 @@ public class KafkaService { ...@@ -71,6 +71,8 @@ public class KafkaService {
//故障 //故障
boolean fault = false; boolean fault = false;
String ip = "";
List<Map<String, String>> msgList = new ArrayList<>(); List<Map<String, String>> msgList = new ArrayList<>();
for (Storage storage : storages) { for (Storage storage : storages) {
if (machineId.equals(storage.getMachineId())) { if (machineId.equals(storage.getMachineId())) {
...@@ -85,6 +87,7 @@ public class KafkaService { ...@@ -85,6 +87,7 @@ public class KafkaService {
fault = true; fault = true;
} }
} }
ip = statusBean.getClientIp();
String msg = statusBean.getMsg(); String msg = statusBean.getMsg();
String errorCode = statusBean.getErrorCode(); String errorCode = statusBean.getErrorCode();
if (StringUtils.isNotBlank(msg) && StringUtils.isNotBlank(errorCode)) { if (StringUtils.isNotBlank(msg) && StringUtils.isNotBlank(errorCode)) {
...@@ -124,7 +127,7 @@ public class KafkaService { ...@@ -124,7 +127,7 @@ public class KafkaService {
status.setMachineID(machineId); status.setMachineID(machineId);
status.setTopicType(KafkaConfig.MACHINESTATUS_TOPIC); status.setTopicType(KafkaConfig.MACHINESTATUS_TOPIC);
status.setCurrentStatus(currentStatus); status.setCurrentStatus(currentStatus);
status.setClientIP(""); status.setClientIP(ip);
if (msgList != null && !msgList.isEmpty()) { if (msgList != null && !msgList.isEmpty()) {
for (Map<String, String> map : msgList) { for (Map<String, String> map : msgList) {
...@@ -336,7 +339,7 @@ public class KafkaService { ...@@ -336,7 +339,7 @@ public class KafkaService {
machineStatus.setCurrentStatus(currentStatus); machineStatus.setCurrentStatus(currentStatus);
machineStatus.setErrorCode(equipMsg.getErrorCode()); machineStatus.setErrorCode(equipMsg.getErrorCode());
machineStatus.setErrorMsg(equipMsg.getMsg()); machineStatus.setErrorMsg(equipMsg.getMsg());
machineStatus.setClientIP(""); machineStatus.setClientIP(statusBean.getClientIp());
String statusStr = JSON.toJSONString(machineStatus); String statusStr = JSON.toJSONString(machineStatus);
log.info("出料口主题为:" + KafkaConfig.MACHINESTATUS_TOPIC + "内容为:" + statusStr); log.info("出料口主题为:" + KafkaConfig.MACHINESTATUS_TOPIC + "内容为:" + statusStr);
ListenableFuture future = kafkaTemplate.send(KafkaConfig.MACHINESTATUS_TOPIC, statusStr); ListenableFuture future = kafkaTemplate.send(KafkaConfig.MACHINESTATUS_TOPIC, statusStr);
...@@ -351,7 +354,7 @@ public class KafkaService { ...@@ -351,7 +354,7 @@ public class KafkaService {
machineStatus.setCurrentStatus(currentStatus); machineStatus.setCurrentStatus(currentStatus);
machineStatus.setErrorCode(""); machineStatus.setErrorCode("");
machineStatus.setErrorMsg(""); machineStatus.setErrorMsg("");
machineStatus.setClientIP(""); machineStatus.setClientIP(statusBean.getClientIp());
String statusStr = JSON.toJSONString(machineStatus); String statusStr = JSON.toJSONString(machineStatus);
log.info("出料口主题为:" + KafkaConfig.MACHINESTATUS_TOPIC + "内容为:" + statusStr); log.info("出料口主题为:" + KafkaConfig.MACHINESTATUS_TOPIC + "内容为:" + statusStr);
ListenableFuture future = kafkaTemplate.send(KafkaConfig.MACHINESTATUS_TOPIC, statusStr); ListenableFuture future = kafkaTemplate.send(KafkaConfig.MACHINESTATUS_TOPIC, statusStr);
......
...@@ -57,7 +57,7 @@ public class MaiZhengApi { ...@@ -57,7 +57,7 @@ public class MaiZhengApi {
public String transReelBox(LiteOrder liteOrder) { public String transReelBox(LiteOrder liteOrder) {
Map<String, Object> paramMap = new HashMap<>(); /*Map<String, Object> paramMap = new HashMap<>();
paramMap.put("GUID", liteOrder.getGuid()); paramMap.put("GUID", liteOrder.getGuid());
paramMap.put("CacheIndex", liteOrder.getCacheIndex()); paramMap.put("CacheIndex", liteOrder.getCacheIndex());
paramMap.put("CacheSlot", liteOrder.getCacheSlot()); paramMap.put("CacheSlot", liteOrder.getCacheSlot());
...@@ -96,14 +96,18 @@ public class MaiZhengApi { ...@@ -96,14 +96,18 @@ public class MaiZhengApi {
} catch (Exception e) { } catch (Exception e) {
log.error("智能仓储备料完成后请求发料报错:" + e.getMessage()); log.error("智能仓储备料完成后请求发料报错:" + e.getMessage());
return e.getMessage(); return e.getMessage();
} }*/
return "";
} }
public void prepareReelBox(String guid, String result) { public void prepareReelBox(String repoOrder, String result,String startTime) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("GUID", guid); paramMap.put("RepoOrder", repoOrder);
paramMap.put("Result", result); paramMap.put("StartTime", startTime);
if ("OK".equals(result)) {
paramMap.put("Result", true);
}
log.info("仓储回复可以开始备料入参为:" + JSON.toJSONString(paramMap)); log.info("仓储回复可以开始备料入参为:" + JSON.toJSONString(paramMap));
try { try {
...@@ -116,7 +120,8 @@ public class MaiZhengApi { ...@@ -116,7 +120,8 @@ public class MaiZhengApi {
public void workIdCancelApi(String guid) { public void workIdCancelApi(String guid) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("GUID", guid); paramMap.put("RepoOrder", guid);
paramMap.put("Reason", "工单异常,手动取消");
log.info("仓储请求取消工单入参为:" + JSON.toJSONString(paramMap)); log.info("仓储请求取消工单入参为:" + JSON.toJSONString(paramMap));
try { try {
String resultStr = HttpHelper.postJson(workIdCancleApi, paramMap); String resultStr = HttpHelper.postJson(workIdCancleApi, paramMap);
......
...@@ -6,13 +6,10 @@ import java.util.List; ...@@ -6,13 +6,10 @@ import java.util.List;
@Data @Data
public class AskReelBox { public class AskReelBox {
private String GUID; private String RepoOrder;
private String ProcessType; private String CacheID;
private String CacheIndex; private String ReelBoxID;
private String CacheSlot;
private String RecvIndex;
private String Count; private String Count;
private String Dia;
private String StartTime; private String StartTime;
private List<AskReelBoxList> List; private List<AskReelBoxList> List;
} }
...@@ -26,8 +26,4 @@ public class AskReelBoxList { ...@@ -26,8 +26,4 @@ public class AskReelBoxList {
private String VENDOR; private String VENDOR;
private String Pitch; private String Pitch;
private String Num; private String Num;
private String Width;
private String Dia;
private String REQ_REEL;
private String REQ_QTY;
} }
...@@ -9,7 +9,7 @@ import java.util.List; ...@@ -9,7 +9,7 @@ import java.util.List;
@Data @Data
public class AskReelIDStateRequest { public class AskReelIDStateRequest {
private String Guid; private String SessionID;
private String Count; private String Count;
......
...@@ -10,8 +10,8 @@ import java.util.List; ...@@ -10,8 +10,8 @@ import java.util.List;
@Data @Data
public class AskReelIDStateResponse { public class AskReelIDStateResponse {
@JSONField(name = "Guid") @JSONField(name = "SessionID")
private String Guid; private String SessionID;
@JSONField(name = "Count") @JSONField(name = "Count")
private String Count; private String Count;
......
...@@ -15,6 +15,6 @@ public class AskReelIDStateResponseList { ...@@ -15,6 +15,6 @@ public class AskReelIDStateResponseList {
private String State; private String State;
@JSONField(name = "WorkID") @JSONField(name = "WorkID")
private String WorkID; private String RepoOrder;
} }
...@@ -94,9 +94,9 @@ public class MaiZhengController { ...@@ -94,9 +94,9 @@ public class MaiZhengController {
public Map<String, String> askReelBox(@RequestBody AskReelBox askReelBox) { public Map<String, String> askReelBox(@RequestBody AskReelBox askReelBox) {
log.info("收到迈征请求数据为:" + JSON.toJSONString(askReelBox)); log.info("收到迈征请求数据为:" + JSON.toJSONString(askReelBox));
String result = "OK"; String result = "OK";
askReelBoxMap.put(askReelBox.getGUID(), askReelBox); askReelBoxMap.put(askReelBox.getRepoOrder(), askReelBox);
Map<String, String> resultMap = new HashMap<>(); Map<String, String> resultMap = new HashMap<>();
resultMap.put("GUID", askReelBox.getGUID()); resultMap.put("RepoOrder", askReelBox.getRepoOrder());
resultMap.put("Result", result); resultMap.put("Result", result);
return resultMap; return resultMap;
} }
...@@ -111,8 +111,9 @@ public class MaiZhengController { ...@@ -111,8 +111,9 @@ public class MaiZhengController {
if (askReelBoxMap != null && !askReelBoxMap.isEmpty()) { if (askReelBoxMap != null && !askReelBoxMap.isEmpty()) {
for (Map.Entry<String, AskReelBox> entry : askReelBoxMap.entrySet()) { for (Map.Entry<String, AskReelBox> entry : askReelBoxMap.entrySet()) {
log.info("开始处理:" + entry.getKey() + "的数据"); log.info("开始处理:" + entry.getKey() + "的数据");
String result = createMaiZhengOrder(entry.getKey(), entry.getValue()); AskReelBox askReelBox = entry.getValue();
maiZhengApi.prepareReelBox(entry.getKey(), result); String result = createMaiZhengOrder(entry.getKey(),askReelBox);
maiZhengApi.prepareReelBox(entry.getKey(), result,askReelBox.getStartTime());
log.info("处理结束:" + entry.getKey() + "的数据,结果为:" + result); log.info("处理结束:" + entry.getKey() + "的数据,结果为:" + result);
} }
askReelBoxMap.clear(); askReelBoxMap.clear();
...@@ -142,14 +143,11 @@ public class MaiZhengController { ...@@ -142,14 +143,11 @@ public class MaiZhengController {
if (liteOrder == null) { if (liteOrder == null) {
liteOrder = new LiteOrder(); liteOrder = new LiteOrder();
} }
liteOrder.setOrderNo(askReelBox.getGUID()); liteOrder.setOrderNo(askReelBox.getRepoOrder());
liteOrder.setGuid(askReelBox.getGUID()); liteOrder.setCacheID(askReelBox.getCacheID());
liteOrder.setCacheIndex(askReelBox.getCacheIndex()); liteOrder.setRepoOrder(askReelBox.getRepoOrder());
liteOrder.setCacheSlot(askReelBox.getCacheSlot()); liteOrder.setReelBoxID(askReelBox.getReelBoxID());
liteOrder.setRecvIndex(askReelBox.getRecvIndex());
liteOrder.setCount(askReelBox.getCount()); liteOrder.setCount(askReelBox.getCount());
liteOrder.setReelBoxId(StorageExportUtil.getMaizhengExport());
liteOrder.setDia(askReelBox.getDia());
liteOrder.setStartTime(askReelBox.getStartTime()); liteOrder.setStartTime(askReelBox.getStartTime());
liteOrder.setMaiZheng(true); liteOrder.setMaiZheng(true);
...@@ -173,8 +171,6 @@ public class MaiZhengController { ...@@ -173,8 +171,6 @@ public class MaiZhengController {
item.setSubSlot(box.getSUBSLOT()); item.setSubSlot(box.getSUBSLOT());
item.setPn(box.getPARTNUMBER()); item.setPn(box.getPARTNUMBER());
item.setReel(box.getREEL()); item.setReel(box.getREEL());
item.setWidth(box.getWidth());
item.setDia(box.getDia());
item.setOrderId(liteOrder.getId()); item.setOrderId(liteOrder.getId());
item.setOrderNo(liteOrder.getOrderNo()); item.setOrderNo(liteOrder.getOrderNo());
...@@ -200,7 +196,7 @@ public class MaiZhengController { ...@@ -200,7 +196,7 @@ public class MaiZhengController {
log.info("收到迈征请求指定Reel的位置:" + JSON.toJSONString(request)); log.info("收到迈征请求指定Reel的位置:" + JSON.toJSONString(request));
String guid = request.getGuid(); String sessionID = request.getSessionID();
String count = request.getCount(); String count = request.getCount();
List<AskReelIDStateResponseList> responseList = new ArrayList<>(); List<AskReelIDStateResponseList> responseList = new ArrayList<>();
...@@ -210,7 +206,7 @@ public class MaiZhengController { ...@@ -210,7 +206,7 @@ public class MaiZhengController {
AskReelIDStateResponseList reelIDResponse = new AskReelIDStateResponseList(); AskReelIDStateResponseList reelIDResponse = new AskReelIDStateResponseList();
reelIDResponse.setState("0"); reelIDResponse.setState("0");
reelIDResponse.setReelID(reelId); reelIDResponse.setReelID(reelId);
reelIDResponse.setWorkID(""); reelIDResponse.setRepoOrder("");
//判断是否在库存中 //判断是否在库存中
StoragePos storagePos = storagePosManager.getByBarcode(reelId); StoragePos storagePos = storagePosManager.getByBarcode(reelId);
if (storagePos != null) { if (storagePos != null) {
...@@ -223,7 +219,7 @@ public class MaiZhengController { ...@@ -223,7 +219,7 @@ public class MaiZhengController {
if (!dataLog.isCancel() && StringUtils.isNotBlank(dataLog.getSourceId()) && dataLog.isCheckOutTask()) { if (!dataLog.isCancel() && StringUtils.isNotBlank(dataLog.getSourceId()) && dataLog.isCheckOutTask()) {
log.info(reelId + ":已经绑定工单发出,工单号为:" + dataLog.getSourceName()); log.info(reelId + ":已经绑定工单发出,工单号为:" + dataLog.getSourceName());
reelIDResponse.setState("2"); reelIDResponse.setState("2");
reelIDResponse.setWorkID(dataLog.getSourceName()); reelIDResponse.setRepoOrder(dataLog.getSourceName());
} }
} }
} }
...@@ -231,7 +227,7 @@ public class MaiZhengController { ...@@ -231,7 +227,7 @@ public class MaiZhengController {
} }
AskReelIDStateResponse response = new AskReelIDStateResponse(); AskReelIDStateResponse response = new AskReelIDStateResponse();
response.setGuid(guid); response.setSessionID(sessionID);
response.setCount(count); response.setCount(count);
response.setList(responseList); response.setList(responseList);
log.info(JSON.toJSONString(response)); log.info(JSON.toJSONString(response));
......
...@@ -3,9 +3,12 @@ package com.neotel.smfcore.custom.lizhen.third.maicheng.controller; ...@@ -3,9 +3,12 @@ package com.neotel.smfcore.custom.lizhen.third.maicheng.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.utils.StringUtils; import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.order.LiteOrderCache;
import com.neotel.smfcore.core.order.service.manager.ILiteOrderManager; import com.neotel.smfcore.core.order.service.manager.ILiteOrderManager;
import com.neotel.smfcore.core.order.service.po.ItemOutDetail;
import com.neotel.smfcore.core.order.service.po.LiteOrder; import com.neotel.smfcore.core.order.service.po.LiteOrder;
import com.neotel.smfcore.core.order.service.po.LiteOrderItem; import com.neotel.smfcore.core.order.service.po.LiteOrderItem;
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.custom.lizhen.innerBox.bean.StorageExport; import com.neotel.smfcore.custom.lizhen.innerBox.bean.StorageExport;
import com.neotel.smfcore.custom.lizhen.innerBox.util.StorageExportUtil; import com.neotel.smfcore.custom.lizhen.innerBox.util.StorageExportUtil;
...@@ -18,10 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -18,10 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap; import java.util.stream.Collectors;
import java.util.List;
import java.util.Map;
@Slf4j @Slf4j
@RestController @RestController
...@@ -38,6 +39,9 @@ public class MaiZhengDeviceController { ...@@ -38,6 +39,9 @@ public class MaiZhengDeviceController {
@Autowired @Autowired
private MaiZhengApi maiZhengApi; private MaiZhengApi maiZhengApi;
@Autowired
private LiteOrderCache liteOrderCache;
@ApiOperation("请求迈征是否可以运送") @ApiOperation("请求迈征是否可以运送")
@RequestMapping("/transReelBox") @RequestMapping("/transReelBox")
@AnonymousAccess @AnonymousAccess
...@@ -73,7 +77,7 @@ public class MaiZhengDeviceController { ...@@ -73,7 +77,7 @@ public class MaiZhengDeviceController {
String material = export.getMaterial(); String material = export.getMaterial();
if (StringUtils.isNotBlank(material)){ if (StringUtils.isNotBlank(material)){
liteOrder.setReelBoxId(material); //liteOrder.setReelBoxId(material);
} }
//请求迈征的接口,是否可以放入 //请求迈征的接口,是否可以放入
...@@ -91,54 +95,87 @@ public class MaiZhengDeviceController { ...@@ -91,54 +95,87 @@ public class MaiZhengDeviceController {
@ApiOperation("获取迈征请求数据") @ApiOperation("获取迈征请求数据")
@RequestMapping("/getTransReelBoxData") @RequestMapping("/getTransReelBoxData")
@AnonymousAccess @AnonymousAccess
public ResultBean getTransReelBoxData(String exportStr) { public ResultBean getTransReelBoxData(String orderNo) {
StorageExport export = StorageExportUtil.getExport(exportStr + StorageExportUtil.OUT_STATION);
log.info(exportStr + "获取到出料口信息为:" + JSON.toJSONString(export));
String hSerial = export.getHSerial();
if (StringUtils.isBlank(hSerial)) {
return ResultBean.newErrorResult(-1, "smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{exportStr, "hSerial"});
}
LiteOrder liteOrder = liteOrderManager.findByOrderNo(hSerial); if (StringUtils.isEmpty(orderNo)){
if (liteOrder == null) { return ResultBean.newErrorResult(-1,"","工单号不能为空");
return ResultBean.newErrorResult(-1, "smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"orderNo", hSerial});
} }
String material = export.getMaterial(); LiteOrder liteOrder = liteOrderManager.findByOrderNo(orderNo);
if (StringUtils.isNotBlank(material)) { if (liteOrder == null) {
liteOrder.setReelBoxId(material); return ResultBean.newErrorResult(-1, "smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"orderNo", orderNo});
} }
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("GUID", liteOrder.getGuid()); paramMap.put("RepoOrder",liteOrder.getOrderNo());
paramMap.put("CacheIndex", liteOrder.getCacheIndex()); paramMap.put("Count",liteOrder.getCount());
paramMap.put("CacheSlot", liteOrder.getCacheSlot()); paramMap.put("CacheID",liteOrder.getCacheID());
paramMap.put("RecvIndex", liteOrder.getRecvIndex()); paramMap.put("ReelBoxID",liteOrder.getReelBoxID());
paramMap.put("Count", liteOrder.getCount()); paramMap.put("StartTime",liteOrder.getStartTime());
paramMap.put("ReelBoxID", liteOrder.getReelBoxId());
paramMap.put("Dia", liteOrder.getDia());
paramMap.put("StartTime", liteOrder.getStartTime());
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
List<LiteOrderItem> orderItemList = liteOrder.getOrderItems(); List<LiteOrderItem> orderItemList = liteOrder.getOrderItems();
for (LiteOrderItem orderItem : orderItemList) { for (LiteOrderItem orderItem : orderItemList) {
List<String> outReelList = orderItem.getOutReelList(); List<ItemOutDetail> outDetailList = orderItem.getOutDetailList();
if (outReelList != null && !outReelList.isEmpty()) { if (outDetailList != null && !outDetailList.isEmpty()){
for (int i = 0; i < outReelList.size(); i++) { for (ItemOutDetail detail : outDetailList) {
Map<String, Object> itemMap = new HashMap<>(); Map<String, Object> map = new HashMap<>();
itemMap.put("Position", orderItem.getPositionList().get(i)); map.put("PARTNUMBER",orderItem.getPn());
itemMap.put("PARTNUMBER", orderItem.getPn()); map.put("ReelNewLong",detail.getReelNewLong());
itemMap.put("REEL", orderItem.getReel()); map.put("ReelNew",detail.getReelNew());
itemMap.put("REELNew", outReelList.get(i)); map.put("ReelOld",orderItem.getReel());
itemMap.put("Width", orderItem.getWidth()); map.put("X",detail.getX());
itemMap.put("Dia", orderItem.getDia()); map.put("Y",detail.getY());
list.add(itemMap); list.add(map);
} }
} }
} }
paramMap.put("List", list); paramMap.put("List", list);
return ResultBean.newOkResult(paramMap); return ResultBean.newOkResult(paramMap);
} }
@ApiOperation("流水线通知服务器出库")
@RequestMapping("/mBoxReady")
@AnonymousAccess
public ResultBean mBoxReady(String boxBarcode) {
//获取迈征出料口信息
StorageExport export = StorageExportUtil.getExport(StorageExportUtil.getMaizhengExport());
log.info("流水线通知服务器出库:"+StorageExportUtil.getMaizhengExport()+"获取到的出料口信息为:"+JSON.toJSONString(export)+"料串为:"+boxBarcode);
int remainCount = 0;
String orderNo = export.getHSerial();
if (StringUtils.isNotEmpty(orderNo)) {
List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog dataLog : allTasks) {
if (orderNo.equals(dataLog.getSourceName())){
if (!dataLog.isCancel() && !dataLog.isFinished()){
remainCount ++;
}
}
}
}
if (remainCount > 0){
return ResultBean.newErrorResult(-1,"",orderNo+"正在执行,剩余数量为:"+remainCount);
}
//获取是迈征的,新建的工单
List<LiteOrder> maiZhengOrderList = new ArrayList<>();
for (LiteOrder order : liteOrderCache.getAllLiteOrder()) {
if (order.isMaiZheng() && order.isNew()){
maiZhengOrderList.add(order);
}
}
if (maiZhengOrderList == null || maiZhengOrderList.isEmpty()){
return ResultBean.newErrorResult(-1,"","没有需要执行的迈征工单");
}
//按时间进行排序,获取到第一个
maiZhengOrderList = maiZhengOrderList.stream().sorted(Comparator.comparing(LiteOrder :: getCreateDate)).collect(Collectors.toList());
LiteOrder liteOrder = maiZhengOrderList.get(0);
liteOrderCache.checkOutLiteOrder(liteOrder.getOrderNo(),false,StorageExportUtil.getMaizhengExport());
return ResultBean.newOkResult("");
}
} }
...@@ -49,24 +49,7 @@ public class MaiZhengUtil { ...@@ -49,24 +49,7 @@ public class MaiZhengUtil {
} }
} }
//判断是否一盘没出
boolean hasOut = false;
List<LiteOrderItem> orderItems = liteOrder.getOrderItems();
for (LiteOrderItem orderItem : orderItems) {
if (orderItem.getTotalOutReelCount() > 0){
hasOut = true;
break;
}
}
if (!hasOut){
maiZhengApi.workIdCancelApi(orderNo);
} else {
if (liteOrder.isTransReelBox()){
maiZhengApi.workIdCancelApi(orderNo); maiZhengApi.workIdCancelApi(orderNo);
} else {
throw new ValidateException("", "工单:"+orderNo+"当前料串未拉走,不允许关闭");
}
}
} }
} }
} }
...@@ -77,8 +77,8 @@ file: ...@@ -77,8 +77,8 @@ file:
#迈征配置 #迈征配置
maizheng: maizheng:
stationStatusApi: #http://10.190.196.124:8300/API/MZSM stationStatusApi: #http://10.190.196.124:8300/API/MZSM
export: #MU3_1 export: UM_1
transReelBoxApi: #http://10.190.196.124:52232/API/TransReelBoxAuto transReelBoxApi: #http://10.190.196.124:52232/API/TransReelBoxAuto
prepareReelBoxApi: #http://10.190.196.124:52232/API/PrepareReelBoxAuto prepareReelBoxApi: http://10.68.16.52:52231/API/Repo/PrepareReelBox
workIdCancleApi: #http://10.190.196.124:52232/API/workIDCancle workIdCancleApi: http://10.68.16.52:52231/API/Repo/RepoOrderCancle
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!