Commit bb317590 zshaohui

1.判断库位与料箱是否相同

2.料箱从货架中取出,料箱放到货架上,获取所有不在库的库位
1 个父辈 d618b12f
......@@ -205,6 +205,8 @@ public class DataInitManager {
addNewFunctionMenu(10, raw, "inventoryHandle", "库存处理", "inventoryHandle", "inventoryHandle/index", "inventoryHandle", functionMenuMap);
addNewFunctionMenu(11, raw, "checkHouse", "检验库位", "checkHouse", "checkHouse/index", "checkHouse", functionMenuMap);
Menu manual = Menu.CreatePMenu("手动出入库", 5, "manual", 2, "manual", raw);
//手动入库
......
......@@ -579,7 +579,7 @@ public class DataCache {
* 修改库存,出库为负,入库为正
*/
public int updateInventory(StoragePos pos, Barcode barcode){
Storage storage = getStorageById(pos.getStorageId());
/*Storage storage = getStorageById(pos.getStorageId());
String cid = storage.getCid();
String partNumber = barcode.getPartNumber();
......@@ -601,7 +601,8 @@ public class DataCache {
}
}
allStorage.put(cid, storage);
return updateInventoryAmount(cid,partNumber,amount);
return updateInventoryAmount(cid,partNumber,amount);*/
return 0;
}
private void updateStorageInventory(String cid, InventoryItem inventoryItem){
......
......@@ -445,6 +445,49 @@ public class StoragePosController {
}
@ApiOperation("判断库位与料箱是否相同")
@RequestMapping("/checkPos")
@AnonymousAccess
public ResultBean checkPos(String posName, String boxStr) {
if (StringUtils.isEmpty(posName)){
return ResultBean.newErrorResult(-1,"smfcore.valueCanotNull","{0}不能为空",new String[]{"库位"});
}
if (StringUtils.isEmpty(boxStr)){
return ResultBean.newErrorResult(-1,"smfcore.valueCanotNull","{0}不能为空",new String[]{"料箱"});
}
//判断库位是否存在
StoragePos pos = storagePosManager.getByPosName(posName);
if (pos == null){
return ResultBean.newErrorResult(-1,"",posName+"不存在");
}
Barcode posBarcode = pos.getBarcode();
if (posBarcode == null){
return ResultBean.newErrorResult(-1,"",posName+"库位中不存在料箱");
}
//判断料箱号是否正确
Barcode barcode = null;
try {
barcode = codeResolve.resolveOneValideBarcode(boxStr);
} catch (ValidateException e) {
e.printStackTrace();
}
if (barcode == null){
return ResultBean.newErrorResult(-1,"",boxStr+"不是有效的料箱条码");
}
if (!barcode.getBarcode().equals(posBarcode.getBarcode())){
return ResultBean.newErrorResult(-1,"",posName+"对应的料箱信息为:"+posBarcode.getBarcode()+"与输入的料箱信息:"+boxStr+"不一致");
}
return ResultBean.newOkResult("");
}
private Query getPosFindCriteria(StoragePosFindCriteria criteria){
if (ObjectUtil.isNotEmpty(criteria.getStorageId()) && criteria.getStorageId().equals("0")) {
criteria.setStorageId(null);
......
......@@ -2,6 +2,7 @@ package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.controller;
import com.alibaba.fastjson.JSONObject;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.ReelLockPosUtil;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.enums.BARCODE_STATUS;
......@@ -813,4 +814,139 @@ public class CtuDeviceController {
}
return ResultBean.newOkResult(resultList);
}
@ApiOperation("料箱从货架中取出")
@RequestMapping("/boxOutFromShelf")
@AnonymousAccess
public ResultBean boxOutFromShelf(String boxStr) {
log.info("料箱:"+boxStr+"从货架中取出");
if (StringUtils.isEmpty(boxStr)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"料箱"});
}
//判断料箱号是否正确
Barcode barcode = null;
try {
barcode = codeResolve.resolveOneValideBarcode(boxStr);
} catch (ValidateException e) {
e.printStackTrace();
}
if (barcode == null) {
return ResultBean.newErrorResult(-1, "", boxStr + "不是有效的料箱条码");
}
//判断料箱是否存在库位中
StoragePos pos = storagePosManager.getByBarcode(boxStr);
if (pos == null){
return ResultBean.newErrorResult(-1,"",boxStr+"不存在库位中");
}
log.info("料箱:"+boxStr+"从货架中取出,对应的库位信息为:"+pos.getPosName());
barcode = pos.getBarcode();
barcode.setStatus(BARCODE_STATUS.OUT_NORMAL);
barcodeManager.save(barcode);
pos.setBarcode(barcode);
storagePosManager.save(pos);
return ResultBean.newOkResult("");
}
@ApiOperation("料箱放到货架上")
@RequestMapping("/boxIntoShelf")
@AnonymousAccess
public ResultBean boxIntoShelf(String boxStr, String posName) {
log.info("料箱:" + boxStr + "放到库位:" + posName);
if (StringUtils.isEmpty(boxStr)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"料箱"});
}
if (StringUtils.isEmpty(posName)) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"库位"});
}
//判断料箱号是否正确
Barcode barcode = null;
try {
barcode = codeResolve.resolveOneValideBarcode(boxStr);
} catch (ValidateException e) {
e.printStackTrace();
}
if (barcode == null) {
return ResultBean.newErrorResult(-1, "", boxStr + "不是有效的料箱条码");
}
//判断库位是否存在
StoragePos newPos = storagePosManager.getByPosName(posName);
if (newPos == null){
return ResultBean.newErrorResult(-1,"",posName+"对应的库位信息不存在");
}
//找到旧的库位
StoragePos oldPos = BoxHandleUtil.locOnePos(barcode);
if (oldPos == null){
return ResultBean.newErrorResult(-1,"",boxStr+"对应的原有库位不存在");
}
//开始互换位置
Barcode newBarcode = newPos.getBarcode();
barcode= oldPos.getBarcode();
newBarcode.setStatus(BARCODE_STATUS.OUT_NORMAL);
newBarcode.setPosName(oldPos.getPosName());
barcodeManager.save(newBarcode);
oldPos.setBarcode(newBarcode);
storagePosManager.save(oldPos);
barcode.setStatus(BARCODE_STATUS.IN_STORE);
barcode.setPosName(newPos.getPosName());
barcodeManager.save(barcode);
newPos.setBarcode(barcode);
storagePosManager.save(newPos);
//判断有没有任务
DataLog dataLog = null;
for (DataLog task : taskService.getAllTasks()) {
if (task.isPutInTask() && !task.isCancel() && !task.isFinished()){
if (task.getBarcode().equals(barcode.getBarcode())){
dataLog = task;
break;
}
}
}
if (dataLog != null){
dataLog.setPosName(newPos.getPosName());
dataLog.setPosId(newPos.getId());
taskService.moveTaskToFinished(dataLog);
taskService.updateFinishedTask(dataLog);
}
return ResultBean.newOkResult("");
}
@ApiOperation("获取所有不在库的库位")
@RequestMapping("/getEmptyPos")
@AnonymousAccess
public ResultBean getEmptyPos() {
List<String> storageIdList = new ArrayList<>();
for (Storage storage : dataCache.getAllStorage().values()) {
if (!storage.isVirtual()) {
storageIdList.add(storage.getId());
}
}
List<String> resultList = new ArrayList<>();
Query query = new Query(Criteria.where("storageId").in(storageIdList));
query.fields().include("barcode.status", "posName");
List<StoragePos> storagePosList = storagePosManager.findByQuery(query);
if (storagePosList != null && !storagePosList.isEmpty()) {
for (StoragePos pos : storagePosList) {
Barcode barcode = pos.getBarcode();
if (barcode == null) {
resultList.add(pos.getPosName());
} else {
if (barcode.getStatus() != BARCODE_STATUS.IN_STORE){
resultList.add(pos.getPosName());
}
}
}
}
return ResultBean.newOkResult(resultList);
}
}
......@@ -26,6 +26,7 @@ import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.dto.QueryPickingD
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.LiteorderCheckType;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.CheckOutUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.common.util.CommonUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.RawOutUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -147,7 +148,7 @@ public class PkCheckOutController {
//throw new ValidateException("","有正在执行的工单,不允许恢复");
return ResultBean.newErrorResult(-1, "", "有正在执行的工单"+resultStr+",不允许出库");
}
RawOutUtil.clearRawOutBox();
String line = "";
List<QueryPickingResult> resultList = LuxsanApi.queryPicking(new QueryPickingRequest(CommonUtil.plantCode));
for (QueryPickingResult result : resultList) {
......
......@@ -59,4 +59,13 @@ public class RawOutUtil {
cacheMap.remove(boxStr);
dataCache.updateCache(CacheNameUtil.CACHE_RAWOUT_BOX, cacheMap);
}
public static void clearRawOutBox() {
Map<String, String> cacheMap = dataCache.getCache(CacheNameUtil.CACHE_RAWOUT_BOX);
if (cacheMap == null) {
cacheMap = new ConcurrentHashMap<>();
}
cacheMap.clear();
dataCache.updateCache(CacheNameUtil.CACHE_RAWOUT_BOX, cacheMap);
}
}
......@@ -48,4 +48,12 @@ public class RawOutLineController {
}
return ResultBean.newOkResult(boxNum);
}
@ApiOperation("获取所有出库流水线的箱子数量详情")
@RequestMapping("/getAllLineBoxNum")
@AnonymousAccess
public ResultBean getAllLineBoxNum() {
return ResultBean.newOkResult(cacheBoxNumMap.values());
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!