Commit 104c4745 zshaohui

1.呼叫空箱和半串/满串接口提交

1 个父辈 acac4332
...@@ -225,6 +225,9 @@ public class DataInitManager { ...@@ -225,6 +225,9 @@ public class DataInitManager {
// 手动单据入库 // 手动单据入库
addNewFunctionMenu(6, manual, "manualWarehouseReceipt", "手动单据转库", "manualWarehouseReceipt", "manualWarehouseReceipt/index", "manualWarehouseReceipt", functionMenuMap); addNewFunctionMenu(6, manual, "manualWarehouseReceipt", "手动单据转库", "manualWarehouseReceipt", "manualWarehouseReceipt/index", "manualWarehouseReceipt", functionMenuMap);
//呼叫空箱
addNewFunctionMenu(7, manual, "getEmpty", "呼叫空箱", "getEmpty", "neolight/getEmpty/index", "getEmpty", functionMenuMap);
Menu doc = Menu.CreatePMenu("单据操作", 5, "doc", 1, "docOp", raw); Menu doc = Menu.CreatePMenu("单据操作", 5, "doc", 1, "docOp", raw);
......
...@@ -555,8 +555,8 @@ public class CDeviceController { ...@@ -555,8 +555,8 @@ public class CDeviceController {
} }
//更新料串缓存信息 //更新料串缓存信息
log.info("先清空:"+materialStr+"位置缓存的信息"); //log.info("先清空:"+materialStr+"位置缓存的信息");
MaterialLocUtil.updateStackerLoc(materialStr,"",null); //MaterialLocUtil.updateStackerLoc(materialStr,"",null);
List<Barcode> barcodeList = new ArrayList<>(); List<Barcode> barcodeList = new ArrayList<>();
for (Barcode subCode : subCodeList) { for (Barcode subCode : subCodeList) {
...@@ -637,10 +637,10 @@ public class CDeviceController { ...@@ -637,10 +637,10 @@ public class CDeviceController {
if (StringUtils.isNotEmpty(targetLoc)){ if (StringUtils.isNotEmpty(targetLoc)){
if (targetLoc.endsWith("BG")){ if (targetLoc.endsWith("BG")){
log.info("自动绑定料串["+materialStr+"]目的地:C2-3F-BG"); log.info("自动绑定料串["+materialStr+"]目的地:C2-3F-BG");
MaterialLocUtil.updateStackerLoc(materialStr,"", "C2-3F-BG"); MaterialLocUtil.updateStackerLoc(materialStr,"", "C2-3F-BG",1,orderItem.getOrderNo());
} else if (targetLoc.endsWith("CG")){ } else if (targetLoc.endsWith("CG")){
log.info("自动绑定料串["+materialStr+"]目的地:C2-3F-CG"); log.info("自动绑定料串["+materialStr+"]目的地:C2-3F-CG");
MaterialLocUtil.updateStackerLoc(materialStr,"", "C2-3F-CG"); MaterialLocUtil.updateStackerLoc(materialStr,"", "C2-3F-CG",1,orderItem.getOrderNo());
} }
} }
...@@ -1222,8 +1222,8 @@ public class CDeviceController { ...@@ -1222,8 +1222,8 @@ public class CDeviceController {
} }
//更新料串缓存信息 //更新料串缓存信息
log.info("先清空:" + stacker + "位置缓存的信息"); // log.info("先清空:" + stacker + "位置缓存的信息");
MaterialLocUtil.updateStackerLoc(stacker, "", null); // MaterialLocUtil.updateStackerLoc(stacker, "", null,);
//code为3时,代表不在此箱子中,直接出库/通知WMS失败 //code为3时,代表不在此箱子中,直接出库/通知WMS失败
List<String> messageList = new ArrayList<>(); List<String> messageList = new ArrayList<>();
...@@ -1320,10 +1320,10 @@ public class CDeviceController { ...@@ -1320,10 +1320,10 @@ public class CDeviceController {
if (StringUtils.isNotEmpty(targetLoc)) { if (StringUtils.isNotEmpty(targetLoc)) {
if (targetLoc.endsWith("BG")) { if (targetLoc.endsWith("BG")) {
log.info("自动绑定料串[" + stacker + "]目的地:C2-3F-BG"); log.info("自动绑定料串[" + stacker + "]目的地:C2-3F-BG");
MaterialLocUtil.updateStackerLoc(stacker, "", "C2-3F-BG"); MaterialLocUtil.updateStackerLoc(stacker, "", "C2-3F-BG",1,orderNo);
} else if (targetLoc.endsWith("CG")) { } else if (targetLoc.endsWith("CG")) {
log.info("自动绑定料串[" + stacker + "]目的地:C2-3F-CG"); log.info("自动绑定料串[" + stacker + "]目的地:C2-3F-CG");
MaterialLocUtil.updateStackerLoc(stacker, "", "C2-3F-CG"); MaterialLocUtil.updateStackerLoc(stacker, "", "C2-3F-CG",1,orderNo);
} }
} }
if (checkType == LiteorderCheckType.PICKING_CHECKOUT) { if (checkType == LiteorderCheckType.PICKING_CHECKOUT) {
...@@ -1478,4 +1478,17 @@ public class CDeviceController { ...@@ -1478,4 +1478,17 @@ public class CDeviceController {
taskService.updateFinishedTask(task); taskService.updateFinishedTask(task);
return task; return task;
} }
@ApiOperation("出料机构料串是否放满")
@RequestMapping("/starckerIsPutInFull")
@AnonymousAccess
public ResultBean starckerIsPutInFull(String stacker,boolean isFull) {
//kafkaService.sendMachineParameterStackerAndBox(stacker, "", 0, "", 0, 6);
log.info("料串["+stacker+"]是否放满:["+isFull+"]");
int status = isFull ? 2 : 1;
MaterialLocUtil.updateStackerLoc(stacker,"","",status,"");
return ResultBean.newOkResult("");
}
} }
...@@ -106,7 +106,7 @@ public class InventoryExpController { ...@@ -106,7 +106,7 @@ public class InventoryExpController {
} }
} }
BoxHandleUtil.manualGenerateTask(barcode, OP_STATUS.FINISHED.name(),barcode.getAmount(), OP.CHECKOUT,barcode.getOrderItemId(),SecurityUtils.getLoginUsername()+"手动清空库存"); BoxHandleUtil.manualGenerateTask(barcode, OP_STATUS.FINISHED.name(),barcode.getAmount(), OP.CHECKOUT,barcode.getOrderItemId(),SecurityUtils.getLoginUsername()+"手动清空库存",true);
barcode.setPosName(""); barcode.setPosName("");
barcode.setOut(false); barcode.setOut(false);
......
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.controller.manual;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.enums.BARCODE_STATUS;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.device.util.DataCache;
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.StoragePos;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.TaskCurrentLoc;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BinCacheUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BoxHandleUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@Api(tags = "")
@Slf4j
@RestController
@RequestMapping("/callEmptyBox")
public class CallEmptyBoxController {
@Autowired
private IStoragePosManager storagePosManager;
@Autowired
private DataCache dataCache;
@Autowired
private TaskService taskService;
static boolean isCall = false;
@ApiOperation("呼叫空箱")
@RequestMapping("/uploadInfo")
@AnonymousAccess
public ResultBean uploadInfo(String warehouseCode, String size, Integer needCount) {
if (isCall){
return ResultBean.newErrorResult(-1,"","有正在计算的出库任务");
}
isCall = true;
if (StringUtils.isEmpty(warehouseCode)) {
isCall = false;
return ResultBean.newErrorResult(-1, "", "库别不能为空");
}
if (StringUtils.isEmpty(size)) {
isCall = false;
return ResultBean.newErrorResult(-1, "", "尺寸不能为空");
}
if (needCount == null || needCount == 0) {
isCall = false;
return ResultBean.newErrorResult(-1, "", "需求隔口数量不能为空");
}
//判断partNumber
String box = "";
if ("7".equals(size)) {
box = "C07";
} else if ("13".equals(size)) {
box = "C13";
} else if ("15".equals(size)) {
box = "C15";
}
//判断有没有可用的料箱
/*List<String> boxList = BinCacheUtil.getBoxList(warehouseCode, "");
if (boxList == null || boxList.isEmpty()) {
log.info(warehouseCode + "未找到可用料箱");
isCall = false;
return ResultBean.newErrorResult(-1,"","没有可用的料箱");
}*/
//排除掉正在使用的仓位
Criteria c = Criteria.where("barcode").exists(true).and("enabled").is(true);//可用
Collection<String> excludePosIds = taskService.excludePosIds();
if (excludePosIds != null && !excludePosIds.isEmpty()) {
c.and("id").nin(excludePosIds);
}
c.and("barcode.partNumber").regex(Pattern.compile(QueryHelp.escapeExprSpecialWord(box), Pattern.CASE_INSENSITIVE));
c.and("barcode.status").is(BARCODE_STATUS.IN_STORE);
//c.and("barcode.barcode").in(boxList);
List<String> storageIdList = new ArrayList<>();
for (Storage storage : dataCache.getAllStorage().values()) {
if (!storage.isVirtual()) {
storageIdList.add(storage.getId());
}
}
c.and("storageId").in(storageIdList);
int count = 0;
boolean hasTask = false;
List<StoragePos> storagePosList = storagePosManager.findByQuery(new Query(c).with(Sort.by(Sort.Direction.DESC, "barcode.amount")));
for (StoragePos pos : storagePosList) {
if (count >= needCount){
break;
}
Barcode barcode = pos.getBarcode();
List<Barcode> subCodeList = barcode.getSubCodeList();
if (subCodeList == null || subCodeList.isEmpty()) {
if ("C07".equals(box)){
count += 6;
} else {
count += 1;
}
//生成出库任务
Storage storage = dataCache.getStorageById(pos.getStorageId());
log.info("生成出库任务,料箱为:"+barcode.getBarcode()+",库别为:"+warehouseCode+",尺寸为:"+size+",库位号为:"+pos.getPosName()+",隔口数量为:6/1");
BoxHandleUtil.generateTask(storage,barcode,pos, OP.CHECKOUT, OP_STATUS.WAIT.name(), TaskCurrentLoc.Manual_FeedingInlet, ExtendType.STORAGE_CHECKOUT,999);
hasTask = true;
} else {
Map<String, Long> countMap = subCodeList.stream().collect(Collectors.groupingBy(Barcode::getPosName, Collectors.counting()));
if ("7".equals(size)) {
int noReelNum = 0;
for (int par = 1; par < 7; par++) {
//箱子+隔口号
String binCode = barcode.getBarcode() + "-0" + par;
if (countMap.get(binCode) == null || countMap.get(binCode) == 0) {
noReelNum = noReelNum + 1;
}
}
if (noReelNum > 0){
count = count + noReelNum;
Storage storage = dataCache.getStorageById(pos.getStorageId());
log.info("生成出库任务,料箱为:"+barcode.getBarcode()+",库别为:"+warehouseCode+",尺寸为:"+size+",库位号为:"+pos.getPosName()+",隔口数量为:"+noReelNum);
BoxHandleUtil.generateTask(storage,barcode,pos, OP.CHECKOUT, OP_STATUS.WAIT.name(), TaskCurrentLoc.Manual_FeedingInlet, ExtendType.STORAGE_CHECKOUT,999);
hasTask = true;
}
} else if ("13".equals(size) || "15".equals(size)) {
String binCode = barcode.getBarcode() + "-01";
if (countMap.get(binCode) == null || countMap.get(binCode) == 0) {
count = count + 1;
Storage storage = dataCache.getStorageById(pos.getStorageId());
log.info("生成出库任务,料箱为:"+barcode.getBarcode()+",库别为:"+warehouseCode+",尺寸为:"+size+",库位号为:"+pos.getPosName()+",隔口数量为:1");
BoxHandleUtil.generateTask(storage,barcode,pos, OP.CHECKOUT, OP_STATUS.WAIT.name(), TaskCurrentLoc.Manual_FeedingInlet, ExtendType.STORAGE_CHECKOUT,999);
hasTask = true;
}
}
}
}
if (hasTask){
isCall = false;
return ResultBean.newOkResult("");
}
isCall = false;
return ResultBean.newErrorResult(-1,"","未找到符合条件的料箱");
}
@ApiOperation("获取所有手动线任务")
@RequestMapping("/getManualTask")
@AnonymousAccess
public ResultBean getManualTask() {
List<DataLog> resultList = new ArrayList<>();
List<DataLog> allTasks = taskService.getAllTasks();
for (DataLog dataLog : allTasks) {
if (dataLog.isCheckOutTask() && !dataLog.isFinished() && !dataLog.isCancel()){
if (TaskCurrentLoc.Manual_FeedingInlet.equals(dataLog.getLoc())){
resultList.add(dataLog);
}
}
}
return ResultBean.newOkResult(resultList);
}
}
...@@ -68,10 +68,11 @@ public class ManualTicketReturnController { ...@@ -68,10 +68,11 @@ public class ManualTicketReturnController {
String binCode = paramMap.get("binCode"); //料格信息 String binCode = paramMap.get("binCode"); //料格信息
String codeStr = paramMap.get("codeStr"); //条码信息 String codeStr = paramMap.get("codeStr"); //条码信息
String boxStr = paramMap.get("boxStr"); //料箱信息 String boxStr = paramMap.get("boxStr"); //料箱信息
//String dstWarehouse = paramMap.get("dstWarehouse"); //目的库别 String srcWarehouse = paramMap.get("srcWarehouse"); //目的库别
String dstWarehouse = paramMap.get("dstWarehouse"); //目的库别
String materialCode = paramMap.get("materialCode"); //料号 String materialCode = paramMap.get("materialCode"); //料号
log.info("人工单据退料,料格信息为:" + binCode + ",单据行:" + ticketCode + "单据号:" + ticketItem + "条码信息为:" + codeStr); log.info("人工单据退料,料格信息为:" + binCode + ",单据行:" + ticketCode + "单据号:" + ticketItem + "条码信息为:" + codeStr+",库别为:"+srcWarehouse+",目的库位为:"+dstWarehouse);
if (StringUtils.isEmpty(ticketCode)) { if (StringUtils.isEmpty(ticketCode)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"单据号"}); return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"单据号"});
...@@ -162,7 +163,10 @@ public class ManualTicketReturnController { ...@@ -162,7 +163,10 @@ public class ManualTicketReturnController {
//判断是否为禁用料 //判断是否为禁用料
barcode = smfApi.canPutInAfterResolve(barcode); barcode = smfApi.canPutInAfterResolve(barcode);
//barcode.setWarehouseCode(dstWarehouse); if (StringUtils.isEmpty(barcode.getWarehouseCode())) {
String wareHouse = StringUtils.isNotEmpty(dstWarehouse) ? dstWarehouse : srcWarehouse;
barcode.setWarehouseCode(wareHouse);
}
//判断隔口能否放入 //判断隔口能否放入
if (boxBarcode != null) { if (boxBarcode != null) {
......
...@@ -148,7 +148,7 @@ public class KafkaService { ...@@ -148,7 +148,7 @@ public class KafkaService {
/** /**
* 原材料仓,入料和出料机构设备状态信息 * 原材料仓,入料和出料机构设备状态信息
*/ */
@Scheduled(fixedRate = 1000 * 60 * 5) @Scheduled(fixedRate = 1000 * 10)
public void setRawMaterialInOutMachineStatus() { public void setRawMaterialInOutMachineStatus() {
log.info("开始推送原材料仓,入料和出料机构设备状态信息"); log.info("开始推送原材料仓,入料和出料机构设备状态信息");
List<String> rawMaterialList = StorageNameConfig.getRawMaterialList(); List<String> rawMaterialList = StorageNameConfig.getRawMaterialList();
......
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util; package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.utils.StringUtils; import com.neotel.smfcore.common.utils.StringUtils;
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;
...@@ -33,6 +34,10 @@ public class BinCacheUtil { ...@@ -33,6 +34,10 @@ public class BinCacheUtil {
private static TaskService taskService; private static TaskService taskService;
private static Map<String, String> boxCacheMap = Maps.newConcurrentMap();
private static long lastQueryBoxMap = 0l;
@Autowired @Autowired
public void setTaskService(TaskService service) { public void setTaskService(TaskService service) {
BinCacheUtil.taskService = service; BinCacheUtil.taskService = service;
...@@ -67,21 +72,24 @@ public class BinCacheUtil { ...@@ -67,21 +72,24 @@ public class BinCacheUtil {
public static Map<String, String> binCodeCacheMap(String warehouseCode,String binCode) { public static Map<String, String> binCodeCacheMap(String warehouseCode,String binCode) {
Map<String, String> cacheMap = new HashMap<>();
List<QueryBinResult> resultList = LuxsanApi.queryBin(new QueryBinRequest(CommonUtil.plantCode, BinEnum.STORAGE_TYPE_C, BinEnum.BIN_STATUS_0, warehouseCode,binCode));
if (resultList != null && !resultList.isEmpty()) {
for (QueryBinResult result : resultList) {
cacheMap.put(result.getBIN_CODE(), result.getWAREHOUSE_CODE());
}
}
List<QueryBinResult> useBinResultList = LuxsanApi.queryBin(new QueryBinRequest(CommonUtil.plantCode, BinEnum.STORAGE_TYPE_C, BinEnum.BIN_STATUS_1, warehouseCode,binCode)); if (lastQueryBoxMap == 0l || System.currentTimeMillis() - lastQueryBoxMap >= 1000 * 60 * 5 || boxCacheMap.isEmpty()){
if (useBinResultList != null && !useBinResultList.isEmpty()) { boxCacheMap = Maps.newConcurrentMap();
for (QueryBinResult result : useBinResultList) { //Map<String, String> cacheMap = new HashMap<>();
cacheMap.put(result.getBIN_CODE(), result.getWAREHOUSE_CODE()); List<QueryBinResult> resultList = LuxsanApi.queryBin(new QueryBinRequest(CommonUtil.plantCode, BinEnum.STORAGE_TYPE_C, BinEnum.BIN_STATUS_0, warehouseCode,binCode));
if (resultList != null && !resultList.isEmpty()) {
for (QueryBinResult result : resultList) {
boxCacheMap.put(result.getBIN_CODE(), result.getWAREHOUSE_CODE());
}
}
List<QueryBinResult> useBinResultList = LuxsanApi.queryBin(new QueryBinRequest(CommonUtil.plantCode, BinEnum.STORAGE_TYPE_C, BinEnum.BIN_STATUS_1, warehouseCode,binCode));
if (useBinResultList != null && !useBinResultList.isEmpty()) {
for (QueryBinResult result : useBinResultList) {
boxCacheMap.put(result.getBIN_CODE(), result.getWAREHOUSE_CODE());
}
} }
} }
return cacheMap; return boxCacheMap;
} }
......
...@@ -293,7 +293,7 @@ public class BoxHandleUtil { ...@@ -293,7 +293,7 @@ public class BoxHandleUtil {
} }
private static DataLog generateTask(Storage storage, Barcode barcode, StoragePos pos, int type, String status, String loc, int extendType, int priority) { public static DataLog generateTask(Storage storage, Barcode barcode, StoragePos pos, int type, String status, String loc, int extendType, int priority) {
//开始入库任务 //开始入库任务
DataLog task = new DataLog(storage, barcode, pos); DataLog task = new DataLog(storage, barcode, pos);
task.setType(type); task.setType(type);
...@@ -562,8 +562,12 @@ public class BoxHandleUtil { ...@@ -562,8 +562,12 @@ public class BoxHandleUtil {
return paramMap.get(partition) == null ? 0 : paramMap.get(partition).intValue(); return paramMap.get(partition) == null ? 0 : paramMap.get(partition).intValue();
} }
public static DataLog manualGenerateTask(Barcode barcode, String opStatus, int opQty, int opType, String orderItemId,String operator){
return manualGenerateTask(barcode,opStatus,opQty,opType,orderItemId,operator,false);
}
public static DataLog manualGenerateTask(Barcode barcode, String opStatus, int opQty, int opType, String orderItemId,String operator) { public static DataLog manualGenerateTask(Barcode barcode, String opStatus, int opQty, int opType, String orderItemId,String operator,boolean clearOrderInfo) {
//生成任务 //生成任务
DataLog task = new DataLog(); DataLog task = new DataLog();
task.setStatus(opStatus); task.setStatus(opStatus);
...@@ -596,6 +600,13 @@ public class BoxHandleUtil { ...@@ -596,6 +600,13 @@ public class BoxHandleUtil {
} }
} }
taskService.updateFinishedTask(task); taskService.updateFinishedTask(task);
if (clearOrderInfo){
task.setSourceName("");
task.setSourceId("");
task.setSubSourceId("");
taskService.updateFinishedTask(task);
}
return task; return task;
} }
} }
...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; ...@@ -4,6 +4,7 @@ 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.device.util.DataCache; import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.order.LiteOrderCache;
import com.neotel.smfcore.custom.luxsan.factory_c.third.bean.MaterialLoc; import com.neotel.smfcore.custom.luxsan.factory_c.third.bean.MaterialLoc;
import com.neotel.smfcore.custom.luxsan.factory_c.third.util.MaterialLocUtil; import com.neotel.smfcore.custom.luxsan.factory_c.third.util.MaterialLocUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
...@@ -25,6 +26,9 @@ import java.util.Map; ...@@ -25,6 +26,9 @@ import java.util.Map;
@RequestMapping("/material/api") @RequestMapping("/material/api")
public class MaterialRestController { public class MaterialRestController {
@Autowired
private LiteOrderCache liteOrderCache;
@ApiOperation("更新料串位置") @ApiOperation("更新料串位置")
@RequestMapping("/updateLoc") @RequestMapping("/updateLoc")
@AnonymousAccess @AnonymousAccess
...@@ -33,7 +37,7 @@ public class MaterialRestController { ...@@ -33,7 +37,7 @@ public class MaterialRestController {
String materialStr = paramMap.get("materialStr"); String materialStr = paramMap.get("materialStr");
String loc = paramMap.get("loc"); String loc = paramMap.get("loc");
log.info("收到料串位置更新,料串为:"+materialStr+",位置为:"+loc); log.info("收到料串位置更新,料串为:"+materialStr+",位置为:"+loc);
MaterialLocUtil.updateStackerLoc(materialStr,loc,null); MaterialLocUtil.updateStackerLoc(materialStr,loc,null,-1,"");
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
...@@ -77,7 +81,7 @@ public class MaterialRestController { ...@@ -77,7 +81,7 @@ public class MaterialRestController {
} }
} }
log.info("手动绑定料串["+stackerCode+"]目的地:" + destination); log.info("手动绑定料串["+stackerCode+"]目的地:" + destination);
MaterialLocUtil.updateStackerLoc(stackerCode,"", destination); MaterialLocUtil.updateStackerLoc(stackerCode,"", destination,2,"");
return ResultBean.newOkResult("绑定成功"); return ResultBean.newOkResult("绑定成功");
} }
...@@ -101,4 +105,25 @@ public class MaterialRestController { ...@@ -101,4 +105,25 @@ public class MaterialRestController {
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
@ApiOperation("根据料串编号,获取工单信息")
@RequestMapping("/getStackerInfo")
@AnonymousAccess
public ResultBean getStackerInfo(@RequestBody Map<String, String> paramMap) {
log.info("获取料串信息:" + JSON.toJSONString(paramMap));
String stacker = paramMap.get("stacker");
MaterialLoc materialLoc = MaterialLocUtil.getStacker(stacker);
Map<String,String> resultMap = new HashMap<>();
resultMap.put("stacker",stacker);
String destination = materialLoc.getDestination();
if (StringUtils.isEmpty(destination)){
destination = "W2-1F";
}
resultMap.put("destination",destination);
resultMap.put("orderNo",materialLoc.getOrderNo());
resultMap.put("executingOrderNo",liteOrderCache.hasExecutingOrder());
return ResultBean.newOkResult(resultMap);
}
} }
...@@ -30,6 +30,17 @@ public class MaterialLoc { ...@@ -30,6 +30,17 @@ public class MaterialLoc {
*/ */
private String destination; private String destination;
/**
* 对应的工单号
*/
private String orderNo = "";
/**
* 0是空串,1是半串,2是满串
*/
private int status = 0;
private Date createDate = new Date(); private Date createDate = new Date();
private Date updateDate = new Date(); private Date updateDate = new Date();
......
...@@ -38,10 +38,11 @@ public class MaterialLocUtil { ...@@ -38,10 +38,11 @@ public class MaterialLocUtil {
MaterialLocUtil.dataCache = cache; MaterialLocUtil.dataCache = cache;
} }
/** /**
* 更新料串位置或目的地 * 更新料串位置或目的地
*/ */
public static synchronized void updateStackerLoc(String stackerCode, String loc, String destination){ public static synchronized void updateStackerLoc(String stackerCode, String loc, String destination,int isFull,String orderNo){
log.info("更新料串["+stackerCode+"]位置为["+loc+"] 目的地为:["+destination+"]"); log.info("更新料串["+stackerCode+"]位置为["+loc+"] 目的地为:["+destination+"]");
MaterialLoc materialLoc = stackerLocMap.get(stackerCode); MaterialLoc materialLoc = stackerLocMap.get(stackerCode);
if (materialLoc == null) { if (materialLoc == null) {
...@@ -56,13 +57,20 @@ public class MaterialLocUtil { ...@@ -56,13 +57,20 @@ public class MaterialLocUtil {
} else { } else {
materialLoc.setLocName(name); materialLoc.setLocName(name);
} }
} }
if (StringUtils.isNotEmpty(destination)) { if (StringUtils.isNotEmpty(destination)) {
materialLoc.setDestination(destination); materialLoc.setDestination(destination);
} }
if (isFull != -1){
materialLoc.setStatus(isFull);
}
if (StringUtils.isNotEmpty(orderNo)){
materialLoc.setOrderNo(orderNo);
}
materialLoc.setUpdateDate(new Date()); materialLoc.setUpdateDate(new Date());
stackerLocMap.put(stackerCode, materialLoc); stackerLocMap.put(stackerCode, materialLoc);
...@@ -85,4 +93,14 @@ public class MaterialLocUtil { ...@@ -85,4 +93,14 @@ public class MaterialLocUtil {
stackerLocMap.remove(stacker); stackerLocMap.remove(stacker);
dataCache.updateCache(CACHE_STACKER_LOC, stackerLocMap); dataCache.updateCache(CACHE_STACKER_LOC, stackerLocMap);
} }
public static MaterialLoc getStacker(String stacker) {
MaterialLoc materialLoc = stackerLocMap.get(stacker);
if (materialLoc == null){
materialLoc = new MaterialLoc();
materialLoc.setStackerCode(stacker);
}
return materialLoc;
}
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!