|
|
|
@ -302,9 +302,11 @@ public class MesPackageNoGenerateStepService extends BaseStepService implements
|
|
|
|
|
Integer cachedQty = CollectionUtils.isEmpty(packageDataContextList) ? MesPcnExtConstWords.ZERO : packageDataContextList.size();
|
|
|
|
|
//当前满足标包的差额数量
|
|
|
|
|
Integer needQty = packageRuleContext.getPackSpecQty().intValue() - cachedQty;
|
|
|
|
|
//如果缓存中的个数超过标包, needQty则为负数, 下面去截取条码的时候会下标越界, 所以此场景下将 needQty改为0
|
|
|
|
|
if (needQty < 0) needQty = MesPcnExtConstWords.ZERO;
|
|
|
|
|
|
|
|
|
|
//当前满足标包的差额条码
|
|
|
|
|
List<String> productSnList2Cur;
|
|
|
|
|
List<String> productSnList2Cur = null;
|
|
|
|
|
//除去当前满足标包的差额条码后的剩余条码
|
|
|
|
|
List<String> productSnList2Remain = null;
|
|
|
|
|
|
|
|
|
@ -312,12 +314,18 @@ public class MesPackageNoGenerateStepService extends BaseStepService implements
|
|
|
|
|
if (productSnList.size() <= needQty) {
|
|
|
|
|
productSnList2Cur = productSnList;
|
|
|
|
|
} else {
|
|
|
|
|
productSnList2Cur = productSnList.subList(0, needQty);
|
|
|
|
|
productSnList2Remain = productSnList.subList(needQty, productSnList.size());
|
|
|
|
|
//缓存中的个数已经等于或者超过标包,则不需要截取条码
|
|
|
|
|
if (needQty.compareTo(MesPcnExtConstWords.ZERO) == 0) {
|
|
|
|
|
productSnList2Remain = productSnList;
|
|
|
|
|
} else {
|
|
|
|
|
//根据需要的个数进行截取条码
|
|
|
|
|
productSnList2Cur = productSnList.subList(0, needQty);
|
|
|
|
|
productSnList2Remain = productSnList.subList(needQty, productSnList.size());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//当前的实际打包数量 = 缓存的包装条码明细数量 + 当前满足标包的差额条码的个数
|
|
|
|
|
Integer curQty = cachedQty + productSnList2Cur.size();
|
|
|
|
|
Integer curQty = cachedQty + (CollectionUtils.isEmpty(productSnList2Cur) ? MesPcnExtConstWords.ZERO : productSnList2Cur.size());
|
|
|
|
|
|
|
|
|
|
MesPackage packageDb = null;
|
|
|
|
|
//判断是否存在缓存的包装条码明细信息,如果进行递归则已无包装条码, 则重新生成信息的包装条码
|
|
|
|
|