Commit ec6fe17e zshaohui

uid出库卡机种出库

1 个父辈 f4b8321b
...@@ -1015,7 +1015,7 @@ public class LiteOrderCache { ...@@ -1015,7 +1015,7 @@ public class LiteOrderCache {
//禁用的物料信息 //禁用的物料信息
List<String> batchCheckReelList = LuxsanApi.batchCheckReel(subCodeList); List<String> batchCheckReelList = LuxsanApi.batchCheckReel(subCodeList,orderNo,"");
if (batchCheckReelList != null && !batchCheckReelList.isEmpty()){ if (batchCheckReelList != null && !batchCheckReelList.isEmpty()){
for (Barcode subCode : subCodeList){ for (Barcode subCode : subCodeList){
if (disablePosNameList.contains(subCode.getPosName())) { if (disablePosNameList.contains(subCode.getPosName())) {
...@@ -1733,7 +1733,7 @@ public class LiteOrderCache { ...@@ -1733,7 +1733,7 @@ public class LiteOrderCache {
//禁用的物料信息 //禁用的物料信息
List<String> batchCheckReelList = LuxsanApi.batchCheckReel(subCodeList); List<String> batchCheckReelList = LuxsanApi.batchCheckReel(subCodeList,"","");
if (batchCheckReelList != null && !batchCheckReelList.isEmpty()){ if (batchCheckReelList != null && !batchCheckReelList.isEmpty()){
for (Barcode subCode : subCodeList){ for (Barcode subCode : subCodeList){
if (disablePosNameList.contains(subCode.getPosName())) { if (disablePosNameList.contains(subCode.getPosName())) {
...@@ -1962,7 +1962,7 @@ public class LiteOrderCache { ...@@ -1962,7 +1962,7 @@ public class LiteOrderCache {
//禁用的物料信息 //禁用的物料信息
List<String> batchCheckReelList = LuxsanApi.batchCheckReel(subCodeList); List<String> batchCheckReelList = LuxsanApi.batchCheckReel(subCodeList,"","");
if (batchCheckReelList != null && !batchCheckReelList.isEmpty()) { if (batchCheckReelList != null && !batchCheckReelList.isEmpty()) {
for (String reelId : batchCheckReelList) { for (String reelId : batchCheckReelList) {
if (!disableReelList.contains(reelId)) { if (!disableReelList.contains(reelId)) {
......
package com.neotel.smfcore.core.storage.rest; package com.neotel.smfcore.core.storage.rest;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.neotel.smfcore.common.base.IExcelDownLoad; import com.neotel.smfcore.common.base.IExcelDownLoad;
...@@ -34,6 +35,7 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos; ...@@ -34,6 +35,7 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos;
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.custom.lizhen.innerBox.enums.ExtendType; import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType;
import com.neotel.smfcore.custom.luxsan.api.LuxsanApi;
import com.neotel.smfcore.custom.luxsan.factory_c.common.util.DisableBarcodeUtil; import com.neotel.smfcore.custom.luxsan.factory_c.common.util.DisableBarcodeUtil;
import com.neotel.smfcore.custom.siemens.SiemensApi; import com.neotel.smfcore.custom.siemens.SiemensApi;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
...@@ -529,9 +531,11 @@ public class StoragePosController { ...@@ -529,9 +531,11 @@ public class StoragePosController {
String warehouseCode = criteria.getWarehouseCode(); String warehouseCode = criteria.getWarehouseCode();
String box = criteria.getBox(); String box = criteria.getBox();
String partNumber = criteria.getPartNumber(); String partNumber = criteria.getPartNumber();
if (StringUtils.isBlank(stationName)) { if (StringUtils.isBlank(stationName)) {
return ResultBean.newErrorResult(-1, "", "请选择对应的位置"); return ResultBean.newErrorResult(-1, "", "请选择对应的位置");
} }
if (StringUtils.isBlank(partNumber) if (StringUtils.isBlank(partNumber)
&& StringUtils.isBlank(provider) && StringUtils.isBlank(provider)
&& StringUtils.isBlank(batch) && StringUtils.isBlank(batch)
...@@ -540,85 +544,129 @@ public class StoragePosController { ...@@ -540,85 +544,129 @@ public class StoragePosController {
&& StringUtils.isBlank(box)) { && StringUtils.isBlank(box)) {
return ResultBean.newErrorResult(-1, "", "请核实查询条件是否为空"); return ResultBean.newErrorResult(-1, "", "请核实查询条件是否为空");
} }
Query query = getPosFindCriteria(criteria);
List<StoragePos> storagePoss = storagePosManager.findByQuery(query); String model = criteria.getMachineTypes();
if (StringUtils.isEmpty(model)) {
//判断是否有出库任务 return ResultBean.newErrorResult(-1, "", "请选择对应的机种");
boolean hasOutReel = false;
if (storagePoss != null && !storagePoss.isEmpty()) {
String selectMsg = getSelectMsg(partNumber, provider, batch, dateCode);
for (StoragePos pos : storagePoss) {
//先把里边的物料进行标识
Barcode pidBarcode = pos.getBarcode();
if (StringUtils.isNotBlank(box)) {
if (!box.equals(pidBarcode.getBarcode())) {
continue;
} }
Query query = getPosFindCriteria(criteria);
List<StoragePos> storagePosList = storagePosManager.findByQuery(query);
if (storagePosList == null || storagePosList.isEmpty()) {
return ResultBean.newErrorResult(-1, "", "未找到可以出库的物料");
} }
for (StoragePos pos : storagePosList) {
//排除正在执行的库位 //排除正在执行的库位
Collection<String> excludePosIds = taskService.excludePosIds(); Collection<String> excludePosIds = taskService.excludePosIds();
if (excludePosIds != null && !excludePosIds.isEmpty() && excludePosIds.contains(pos.getId())) { if (excludePosIds != null && !excludePosIds.isEmpty() && excludePosIds.contains(pos.getId())) {
log.info("库位:" + pos.getPosName() + "正在执行,跳过"); log.info("库位:" + pos.getPosName() + "正在执行,跳过");
continue; continue;
} }
hasOutReel = true;
List<Barcode> subCodeList = pidBarcode.getSubCodeList(); Barcode barcode = pos.getBarcode();
if (subCodeList != null && !subCodeList.isEmpty()) {
for (Barcode barcode : subCodeList) { //判断有没有输入箱子号
if (barcode.isOut()) { if (StringUtils.isNotEmpty(box) && !box.equals(barcode.getBarcode())) {
continue;
}
List<String> partNumberList = criteria.getPartNumberList();
if (partNumberList != null && !partNumberList.isEmpty()) {
boolean hasCont = false;
for (String pn : partNumberList) {
if (barcode.getPartNumber().startsWith(pn)){
hasCont = true;
break;
}
}
if (!hasCont){
continue; continue;
} }
//开始循环遍历出库的料箱
List<Barcode> needOutList = new ArrayList<>();
List<Barcode> subCodeList = barcode.getSubCodeList();
if (subCodeList != null && !subCodeList.isEmpty()) {
for (Barcode subCode : subCodeList) {
if (subCode.isOut()) {
log.info("当前物料已经被标记出库:" + subCode.getBarcode() + "所在料箱为:" + barcode.getBarcode() + "所在库位为:" + pos.getPosName());
} }
//判断供应商是否相同
if (StringUtils.isNotBlank(provider)) { if (StringUtils.isNotBlank(provider)) {
if (!barcode.getProvider().equals(provider)) { if (!subCode.getProvider().equals(provider)) {
continue; continue;
} }
} }
//判断批次是否相同
List<String> batchList = criteria.getBatchList(); List<String> batchList = criteria.getBatchList();
if (batchList != null && !batchList.isEmpty()) { if (batchList != null && !batchList.isEmpty()) {
if (!batchList.contains(barcode.getBatch())) { if (!batchList.contains(subCode.getBatch())) {
continue; continue;
} }
} }
//判断dc是否相同
List<String> dateCodeList = criteria.getDateCodeList(); List<String> dateCodeList = criteria.getDateCodeList();
if (dateCodeList != null && !dateCodeList.isEmpty()) { if (dateCodeList != null && !dateCodeList.isEmpty()) {
if (!dateCodeList.contains(barcode.getDateCode())) { if (!dateCodeList.contains(subCode.getDateCode())) {
continue; continue;
} }
} }
//判断库别是否相同
if (StringUtils.isNotBlank(warehouseCode)) { if (StringUtils.isNotBlank(warehouseCode)) {
if (!warehouseCode.equals(barcode.getWarehouseCode())) { if (!warehouseCode.equals(subCode.getWarehouseCode())) {
continue;
}
}
//判断PN是否相同
List<String> partNumberList = criteria.getPartNumberList();
if (partNumberList != null && !partNumberList.isEmpty()) {
if (!partNumberList.contains(subCode.getPartNumber())) {
continue; continue;
} }
} }
barcode.setOut(true); needOutList.add(subCode);
barcode.setSelectMsg(selectMsg); }
//保存信息
barcode = barcodeManager.save(barcode);
pidBarcode.UpdateSubCode(barcode);
} }
barcodeManager.saveBarcode(pidBarcode); //如果要出库的物料为空,抛出异常
pos.setBarcode(pidBarcode); if (needOutList == null || needOutList.isEmpty()) {
storagePosManager.save(pos); log.info("料箱为:" + barcode.getBarcode() + "库位为:" + pos.getPosName() + ",没有找到要出库的物料");
continue;
} }
if (hasOutReel) { //批量校验是否可以出库
Barcode barcode = pos.getBarcode(); List<String> disPosNameList = new ArrayList<>();
List<String> batchCheckReelList = LuxsanApi.batchCheckReel(needOutList, "", model);
if (batchCheckReelList != null || batchCheckReelList.isEmpty()) {
for (String reelId : batchCheckReelList) {
for (Barcode subCode : subCodeList) {
if (disPosNameList.contains(subCode.getPosName())) {
continue;
}
if (reelId.equals(subCode.getBarcode())) {
log.info(reelId + "为禁用料,隔口为:" + subCode.getPosName() + "库位为:" + pos.getPosName());
disPosNameList.add(subCode.getPosName());
}
}
}
}
//开始标记,生成出库任务
boolean hasOutTask = false;
for (Barcode needOutBarcode : needOutList) {
if (disPosNameList.contains(needOutBarcode.getPosName())) {
continue;
}
hasOutTask = true;
needOutBarcode.setOut(true);
needOutBarcode = barcodeManager.save(needOutBarcode);
barcode.UpdateSubCode(needOutBarcode);
}
if (hasOutTask) {
barcodeManager.saveBarcode(barcode);
pos.setBarcode(barcode);
storagePosManager.save(pos);
//生成出库任务
Storage storage = dataCache.getStorageById(pos.getStorageId()); Storage storage = dataCache.getStorageById(pos.getStorageId());
DataLog task = new DataLog(storage,barcode , pos); DataLog task = new DataLog(storage, barcode, pos);
task.setType(OP.CHECKOUT); task.setType(OP.CHECKOUT);
task.setPutInDate(pos.getBarcode().getPutInDate()); task.setPutInDate(pos.getBarcode().getPutInDate());
task.setStatus(OP_STATUS.WAIT.name()); task.setStatus(OP_STATUS.WAIT.name());
...@@ -629,21 +677,12 @@ public class StoragePosController { ...@@ -629,21 +677,12 @@ public class StoragePosController {
task.setLoc(stationName); task.setLoc(stationName);
} }
task.setBoxPosName(pos.getPosName()); task.setBoxPosName(pos.getPosName());
if (storage.isVirtual()){
task.setExtendType(ExtendType.VIRTUAL_CHECKOUT);
} else {
task.setExtendType(ExtendType.STORAGE_CHECKOUT);
}
task.setCartonId(barcode.getCartonId()); task.setCartonId(barcode.getCartonId());
taskService.updateQueueTask(task); taskService.updateQueueTask(task);
} }
} }
if (hasOutReel) {
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
}
return ResultBean.newErrorResult(-1, "", "未找到可以出库的物料");
}
private String getSelectMsg(String partNumber, String provider, String batch, String dateCode) { private String getSelectMsg(String partNumber, String provider, String batch, String dateCode) {
......
...@@ -105,6 +105,8 @@ public class StoragePosFindCriteria { ...@@ -105,6 +105,8 @@ public class StoragePosFindCriteria {
private String boxStatus; private String boxStatus;
private String machineTypes;
@ApiModelProperty("料箱状态,是否在库") @ApiModelProperty("料箱状态,是否在库")
@QueryCondition(type = QueryCondition.Type.IN,propName = "barcode.status") @QueryCondition(type = QueryCondition.Type.IN,propName = "barcode.status")
private List<Integer> boxStatusList; private List<Integer> boxStatusList;
......
...@@ -1080,12 +1080,8 @@ public class LuxsanApi extends DefaultSmfApiListener { ...@@ -1080,12 +1080,8 @@ public class LuxsanApi extends DefaultSmfApiListener {
return result; return result;
} }
public static void main(String[] args) {
List<String> batchCheckReel = batchCheckReel(new ArrayList<>());
System.out.println(JSON.toJSONString(batchCheckReel));
}
public static List<String> batchCheckReel(List<Barcode> barcodeList) { public static List<String> batchCheckReel(List<Barcode> barcodeList,String pickingId,String model) {
List<Map<String,Object>> paramList = new ArrayList<>(); List<Map<String,Object>> paramList = new ArrayList<>();
for (Barcode barcode : barcodeList) { for (Barcode barcode : barcodeList) {
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
...@@ -1098,7 +1094,13 @@ public class LuxsanApi extends DefaultSmfApiListener { ...@@ -1098,7 +1094,13 @@ public class LuxsanApi extends DefaultSmfApiListener {
paramMap.put("remark","ALL"); paramMap.put("remark","ALL");
paramMap.put("werks","ALL"); paramMap.put("werks","ALL");
paramMap.put("model","ALL"); paramMap.put("model","ALL");
if (StringUtils.isNotEmpty(model)){
paramMap.put("model",model);
}
paramMap.put("picking","ALL"); paramMap.put("picking","ALL");
if (StringUtils.isNotEmpty(pickingId)){
paramMap.put("picking",pickingId);
}
paramList.add(paramMap); paramList.add(paramMap);
} }
log.info("批量禁用入参为:"+JSON.toJSONString(paramList)); log.info("批量禁用入参为:"+JSON.toJSONString(paramList));
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!