Commit 8eabae17 hc

fix:手动入库,手动出库

1 个父辈 5b78e07e
......@@ -113,26 +113,32 @@ public class SpBoxCheckOutController {
return ResultBean.newErrorResult(-1, "", codeStr + "不是有效的条码");
}
//3.判断当前需不需要出库
String itemId = binBarcode.getOrderItemId();
if (StringUtils.isEmpty(itemId)){
return ResultBean.newErrorResult(-1,"",codeStr+"没有要出库的任务");
}
//4.获取当前预约单
//3.获取当前预约单
String orderId = binBarcode.getOrderId();
LiteOrder liteOrder = liteOrderManager.get(orderId);
LiteOrder newLiteOrder = liteOrderCache.getLiteOrder(liteOrder.getOrderNo());
if (newLiteOrder == null){
newLiteOrder = liteOrderManager.findByOrderNo(liteOrder.getOrderNo());
}
// 判断是不是工单出库
boolean isOrderCheckout = StringUtils.isNotBlank(orderId);
LiteOrder liteOrder = null;
LiteOrder newLiteOrder = null;
if (isOrderCheckout) {
liteOrder = liteOrderManager.get(orderId);
newLiteOrder = liteOrderCache.getLiteOrder(liteOrder.getOrderNo());
if (newLiteOrder == null){
newLiteOrder = liteOrderManager.findByOrderNo(liteOrder.getOrderNo());
}
//判断所属的工单任务是否完成
String result = handleOrderNo(newLiteOrder, itemId, codeBarcode.getQty());
if (StringUtils.isNotEmpty(result)){
return ResultBean.newErrorResult(-1,"",result);
}
//4.判断当前需不需要出库
String itemId = binBarcode.getOrderItemId();
if (StringUtils.isEmpty(itemId)){
return ResultBean.newErrorResult(-1,"",codeStr+"没有要出库的任务");
}
//判断所属的工单任务是否完成
String result = handleOrderNo(newLiteOrder, itemId, codeBarcode.getQty());
if (StringUtils.isNotEmpty(result)){
return ResultBean.newErrorResult(-1,"",result);
}
}
//4.开始拿出料箱
binBarcode.setAmount(binBarcode.getAmount()-codeBarcode.getQty());
......
package com.neotel.smfcore.custom.luxsan_sp.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StringUtils;
......@@ -22,7 +21,6 @@ import com.neotel.smfcore.custom.luxsan_sp.api.LuxsanSpApi;
import com.neotel.smfcore.custom.luxsan_sp.api.bean.request.SpareInHourseRequest;
import com.neotel.smfcore.custom.luxsan_sp.api.bean.result.SpareInHourseDetail;
import com.neotel.smfcore.custom.luxsan_sp.bean.*;
import com.neotel.smfcore.custom.luxsan_sp.enums.SpareNostatus;
import com.neotel.smfcore.custom.luxsan_sp.service.manager.IReturnNoManager;
import com.neotel.smfcore.custom.luxsan_sp.service.manager.ISpareNoManager;
import com.neotel.smfcore.custom.luxsan_sp.util.*;
......@@ -37,6 +35,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
@Api(tags = "备件仓 料箱入库")
@RestController
......@@ -142,6 +143,22 @@ public class SpBoxPutInController {
if (!binBarcode.getBarcode().startsWith(boxBarcode.getBarcode())) {
return ResultBean.newErrorResult(-1, "", binCodeStr + "不是当前料箱:" + boxStr + "的隔口");
}
// 匹配是否存在该料格
List<Barcode> subCodeList = boxBarcode.getSubCodeList();
if (ObjectUtil.isNull(subCodeList)) {
boxBarcode.setSubCodeList(new ArrayList<>());
subCodeList = boxBarcode.getSubCodeList();
subCodeList.add(binBarcode);
}else {
if (! (subCodeList.stream()
.map(Barcode::getBarcode)
.collect(Collectors.toList())
.contains(binCodeStr))
) {
subCodeList.add(binBarcode);
}
}
//2.解析条码信息
CodeBarcode codeBarcode = CodeUtil.getCodeBarcode(codeStr);
......@@ -152,10 +169,14 @@ public class SpBoxPutInController {
//判断有没有正在执行入库单
SpareNo spareNo = spareNoCache.getExecutIngSpareNo();
ReturnInventoryNo returnInventoryNo = returnNoCache.getExecutingOrderNo();
BaseNo baseNo = null;
boolean isOrderPutIn = false;
if (ObjectUtil.isAllEmpty(spareNo, returnInventoryNo)) {
return ResultBean.newErrorResult(-1,"","没有找到正在执行的入库单或者退库单");
// return ResultBean.newErrorResult(-1,"","没有找到正在执行的入库单或者退库单");
}else {
baseNo = ObjectUtil.isEmpty(spareNo) ? returnInventoryNo : spareNo;
isOrderPutIn = true;
}
BaseNo baseNo = ObjectUtil.isEmpty(spareNo) ? returnInventoryNo : spareNo;
//3.判断与当前隔口的料号是否匹配
......@@ -164,13 +185,25 @@ public class SpBoxPutInController {
// binPartNumber = "";
// }
boolean isOk = false;
boolean isMatch = false;
int binCodeNum = Integer.parseInt(binCodeStr.split("-")[1]);
String codePartNumber = codeBarcode.getPartNumber();
for (Barcode barcode : boxBarcode.getSubCodeList()) {
String pn = barcode.getPartNumber();
int binNum = Integer.parseInt(barcode.getBarcode().split("-")[1]);
if (pn.equals(codePartNumber) && (binNum == Integer.parseInt(binCodeStr.split("-")[1]))) {
isOk = true;
if ((binNum == binCodeNum)) {
// 要入的料格找到了
if (StringUtils.isNotBlank(barcode.getPartNumber())) {
if (pn.equals(codePartNumber)) {
isMatch = true;
}
}else {
if (isOrderPutIn) {
}else {
barcode.setPartNumber(codePartNumber);
}
}
break;
}
}
......@@ -181,15 +214,15 @@ public class SpBoxPutInController {
// return ResultBean.newErrorResult(-1, "", codeStr + "与隔口:" + binCodeStr + "的料号不匹配");
// }
// }
if (!isOk) {
return ResultBean.newErrorResult(-1, "", codeStr + "与隔口:" + binCodeStr + "的料号不匹配");
if (!isMatch) {
return ResultBean.newErrorResult(-1, "", codeStr + "的料号["+codePartNumber+"]与隔口:" + binCodeStr + "的料号["+binBarcode.getPartNumber()+"]不匹配");
}
//判断是否已经完成了
boolean finish = true;
//判断当前入库的是否和入库单一样
if (baseNo != null) {
if (isOrderPutIn) {
List<SpareNoDetail> detailList = baseNo.getDetailList();
SpareNoDetail spareNoDetail = null;
......@@ -256,7 +289,7 @@ public class SpBoxPutInController {
pos.setBarcode(boxBarcode);
pos.setUsed(true);
if (finish){
if (finish && isOrderPutIn){
// 调用入库接口
if (baseNo.getClass().equals(SpareNo.class)) {
List<SpareInHourseDetail> details = new ArrayList<>();
......@@ -274,12 +307,14 @@ public class SpBoxPutInController {
}
}
if (baseNo.getClass().equals(SpareNo.class)) {
spareNoCache.addToMap(spareNo);
spareNoManager.save(spareNo);
}else {
returnNoCache.addToMap(returnInventoryNo);
returnNoManager.save(returnInventoryNo);
if (isOrderPutIn) {
if ( baseNo.getClass().equals(SpareNo.class)) {
spareNoCache.addToMap(spareNo);
spareNoManager.save(spareNo);
}else {
returnNoCache.addToMap(returnInventoryNo);
returnNoManager.save(returnInventoryNo);
}
}
storagePosManager.save(pos);
barcodeManager.save(binBarcode);
......
......@@ -23,6 +23,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@Slf4j
......@@ -86,7 +87,9 @@ public class SpBoxUtil {
if (ObjectUtil.isNull(no)) {
no = returnNoCache.getExecutingOrderNo();
}
spareNoDetails = no.getDetailList();
if (ObjectUtil.isNotNull(no)) {
spareNoDetails = no.getDetailList();
}
} else if (type == 2) {
LiteOrder executingOrder = liteOrderCache.getExecutingOrder();
if (executingOrder == null) {
......@@ -126,28 +129,31 @@ public class SpBoxUtil {
// 正在执行的任务的details
List<SpareNoDetail> activeDetails = getActiveDetails(type);
if (ObjectUtil.isEmpty(activeDetails)) {
return null;
}
for (int i = 1; i <= 6; i++) {
List<Object> par = new ArrayList<>();
String materialBarcode = boxStr + "-0" + i;
String partNumber = getPartNumber(subCodeList, materialBarcode);
for (SpareNoDetail activeDetail : activeDetails) {
if (activeDetail.getPartno().equals(partNumber)) {
par.add(activeDetail.getInQty()); // 该pn总共需要的数量
}else {
par.add(0);
}
SpareNoDetail activeDetail = null;
if (ObjectUtil.isNotNull(activeDetails)) {
activeDetail = activeDetails.stream()
.filter(spareNoDetail -> spareNoDetail.getPartno().equals(partNumber))
.limit(1)
.collect(Collectors.toList()).get(0);
}
if (ObjectUtil.isNull(activeDetail)) {
par.add(0);
}else {
par.add(activeDetail.getInQty()); // 该pn总共需要的数量
}
par.add(getAmount(subCodeList, materialBarcode)); //数量
par.add(i); //隔口号
par.add(partNumber); //料号
for (SpareNoDetail activeDetail : activeDetails) {
if (activeDetail.getPartno().equals(partNumber)) {
par.add(activeDetail.getAlrInQty()); // 该pn已完成数量
}else {
par.add(0);
}
if (ObjectUtil.isNull(activeDetail)) {
par.add(0);
}else {
par.add(activeDetail.getAlrInQty()); // 该pn已完成数量
}
pars.add(par);
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!