Commit 7591be90 LN

SP出库优先外侧库位

1 个父辈 20406b58
...@@ -102,6 +102,7 @@ public class SpBoxHandler extends BaseDeviceHandler { ...@@ -102,6 +102,7 @@ public class SpBoxHandler extends BaseDeviceHandler {
@Override @Override
public StatusBean handleClientRequest(StatusBean statusBean, HttpServletRequest request) { public StatusBean handleClientRequest(StatusBean statusBean, HttpServletRequest request) {
String cid = statusBean.getCid(); String cid = statusBean.getCid();
int isDuoSidePos=statusBean.getDuoSidePos();
Storage storage = dataCache.getStorage(cid); Storage storage = dataCache.getStorage(cid);
if (storage != null) { if (storage != null) {
statusBean.setClientIp(request.getRemoteHost()); statusBean.setClientIp(request.getRemoteHost());
...@@ -343,19 +344,19 @@ public class SpBoxHandler extends BaseDeviceHandler { ...@@ -343,19 +344,19 @@ public class SpBoxHandler extends BaseDeviceHandler {
if (!hasOutTask) { if (!hasOutTask) {
if (isDuoSidePos == 1) { if (isDuoSidePos == 1) {
//先查找B结尾的,再查找F结尾的 //先查找B结尾的,再查找F结尾的
log.info("从" + storage.getName() + "中为" + barcode.getBarcode() + "寻找空的仓位,先查找B结尾的库位"); log.info(isDuoSidePos+"从" + storage.getName() + "中为" + barcode.getBarcode() + "寻找空的仓位,先查找B结尾的库位");
storagePos = storagePosManager.getSpEmptyPosByStorage(storage, barcode, operatingPosIds, "B"); storagePos = storagePosManager.getSpEmptyPosByStorage(storage, barcode, operatingPosIds, "B");
if (storagePos == null) { if (storagePos == null) {
log.info("从" + storage.getName() + "中为" + barcode.getBarcode() + "寻找空的仓位,未找到B结尾的库位,查找F结尾库位"); log.info(isDuoSidePos+"从" + storage.getName() + "中为" + barcode.getBarcode() + "寻找空的仓位,未找到B结尾的库位,查找F结尾库位");
storagePos = storagePosManager.getSpEmptyPosByStorage(storage, barcode, operatingPosIds, "F"); storagePos = storagePosManager.getSpEmptyPosByStorage(storage, barcode, operatingPosIds, "F");
} }
if(storagePos==null){ if(storagePos==null){
log.info("从" + storage.getName() + "中为" + barcode.getBarcode() + "寻找空的仓位,查找所有库位"); log.info(isDuoSidePos+"从" + storage.getName() + "中为" + barcode.getBarcode() + "寻找空的仓位,查找所有库位");
storagePos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds); storagePos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds);
} }
} else { } else {
log.info("从" + storage.getName() + "中为" + barcode.getBarcode() + "寻找空的仓位"); log.info(isDuoSidePos+"从" + storage.getName() + "中为" + barcode.getBarcode() + "寻找空的仓位");
storagePos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds); storagePos = storagePosManager.getEmptyPosByStorage(storage, barcode, operatingPosIds);
} }
...@@ -368,7 +369,7 @@ public class SpBoxHandler extends BaseDeviceHandler { ...@@ -368,7 +369,7 @@ public class SpBoxHandler extends BaseDeviceHandler {
if (storagePos == null) { if (storagePos == null) {
throw new ValidateException("smfcore.error.storage.noPos", "{0}的料格[{1}]已满,无法继续放入", new String[]{storage.getName(), barcode.getPlateSize() + "x" + barcode.getHeight()}); throw new ValidateException("smfcore.error.storage.noPos", "{0}的料格[{1}]已满,无法继续放入", new String[]{storage.getName(), barcode.getPlateSize() + "x" + barcode.getHeight()});
} }
log.info("[" + barcode.getBarcode() + "]寻找到" + storage.getName() + "的空仓位[" + storagePos.getPosName() + "]"); log.info(isDuoSidePos+"[" + barcode.getBarcode() + "]寻找到" + storage.getName() + "的空仓位[" + storagePos.getPosName() + "]");
return storagePos; return storagePos;
} }
...@@ -430,6 +431,7 @@ public class SpBoxHandler extends BaseDeviceHandler { ...@@ -430,6 +431,7 @@ public class SpBoxHandler extends BaseDeviceHandler {
return null; return null;
} }
//锡膏料仓空闲 //锡膏料仓空闲
queueTasks = taskService.getQueueTasks(); queueTasks = taskService.getQueueTasks();
for (DataLog task : queueTasks) { for (DataLog task : queueTasks) {
......
...@@ -7,6 +7,7 @@ import com.neotel.smfcore.common.bean.ResultBean; ...@@ -7,6 +7,7 @@ import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil; import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.utils.QueryHelp; import com.neotel.smfcore.common.utils.QueryHelp;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.api.SmfApi; import com.neotel.smfcore.core.api.SmfApi;
import com.neotel.smfcore.core.api.bean.CodeValidateParam; import com.neotel.smfcore.core.api.bean.CodeValidateParam;
import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE; import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE;
...@@ -48,6 +49,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -48,6 +49,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.*; import java.util.*;
import java.util.regex.Pattern;
@Slf4j @Slf4j
@RestController @RestController
...@@ -157,7 +159,21 @@ public class SpBoxController { ...@@ -157,7 +159,21 @@ public class SpBoxController {
if (outDate == null) { if (outDate == null) {
outDate = new Date(); outDate = new Date();
} }
List<StoragePos> solderPosList = findSolder(storageId, pn, num); //先查找外侧库位
List<StoragePos> solderPosList = findSolder(storageId, pn, num, "F");
int fNum = solderPosList.size();
int bNum = 0;
int oNum = num - fNum;
if (oNum > 0) {
List<StoragePos> oPos = findSolder(storageId, pn, oNum, "");
if (oPos.size() > 0) {
bNum = oPos.size();
solderPosList.addAll(oPos);
}
}
log.info("outSolder 锡膏定时出库,storageId=" + storageId + ",共需要出" + num + ",查找到F库位=" + fNum + ",B库位=" + bNum);
setOutDate(solderPosList, outDate); setOutDate(solderPosList, outDate);
} }
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
...@@ -246,7 +262,7 @@ public class SpBoxController { ...@@ -246,7 +262,7 @@ public class SpBoxController {
return query; return query;
} }
private List<StoragePos> findSolder(String storageId, String pn, int num) { private List<StoragePos> findSolder(String storageId, String pn, int num,String endStr) {
Criteria c = Criteria.where("enabled").is(true).and("barcode").exists(true) Criteria c = Criteria.where("enabled").is(true).and("barcode").exists(true)
.and("barcode.solderStatus").in(SOLDER_STATUS.RETREAT_STORAGE, SOLDER_STATUS.UNDER_REFRIGERATION); .and("barcode.solderStatus").in(SOLDER_STATUS.RETREAT_STORAGE, SOLDER_STATUS.UNDER_REFRIGERATION);
if (!Strings.isNullOrEmpty(storageId)) { if (!Strings.isNullOrEmpty(storageId)) {
...@@ -261,6 +277,11 @@ public class SpBoxController { ...@@ -261,6 +277,11 @@ public class SpBoxController {
Sort sort =storagePosManager.getSortByCheckOutType(checkoutType); Sort sort =storagePosManager.getSortByCheckOutType(checkoutType);
//优先使用二次入库的 //优先使用二次入库的
q.with(Sort.by(Sort.Direction.ASC, "barcode.solderStatus").and(sort)); q.with(Sort.by(Sort.Direction.ASC, "barcode.solderStatus").and(sort));
if (StringUtils.isNotEmpty(endStr)) {
String regex = "" + endStr + "$";
c.and("posName").regex(Pattern.compile(regex));
}
return storagePosManager.findByQuery(q); return storagePosManager.findByQuery(q);
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!