|
@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import static java.util.stream.Collectors.toList;
|
|
@@ -63,7 +64,7 @@ public class EquBarrelServiceImpl extends SuperServiceImpl<EquBarrelMapper, EquB
|
|
|
equBarrelQueryWrap.eq("equ_id", equId);
|
|
|
Page<EquBarrel> page = new Page<>(1L, 10);
|
|
|
IPage<EquBarrel> list = this.pageList(page, equBarrelQueryWrap);
|
|
|
- List<EquBarrel> barrelList = list.getRecords();
|
|
|
+ List<EquBarrel> barrelList = (list!=null)? list.getRecords() : new ArrayList<EquBarrel>();
|
|
|
System.out.println("查询到的料筒" + JSON.toJSONString(barrelList));
|
|
|
|
|
|
// 查询该设备上的所有商品
|
|
@@ -76,7 +77,7 @@ public class EquBarrelServiceImpl extends SuperServiceImpl<EquBarrelMapper, EquB
|
|
|
List<Formula> formulaList = formulaService.list(formulaQueryWrap);
|
|
|
System.out.println("查询到的配方" + JSON.toJSONString(formulaList));
|
|
|
|
|
|
- if (barrelList != null && formulaList != null){
|
|
|
+ if (formulaList != null && formulaList.size()>0 && barrelList.size()>0){
|
|
|
formulaList.forEach(formula -> {
|
|
|
Long formulaMtId = formula.getFormulaMtId();
|
|
|
BigDecimal formulaMtQuantity = formula.getFormulaMtQuantity();
|
|
@@ -87,13 +88,19 @@ public class EquBarrelServiceImpl extends SuperServiceImpl<EquBarrelMapper, EquB
|
|
|
LambdaUpdateWrapper<EquBarrel> equBarrelUpdateWrapper = new LambdaUpdateWrapper<>();
|
|
|
equBarrelUpdateWrapper.set(EquBarrel::getMtrResidue, subtract).eq(EquBarrel::getId, equBarrel.getId());
|
|
|
this.update(null, equBarrelUpdateWrapper);
|
|
|
+
|
|
|
+ //缺料状态判断处理
|
|
|
+ Spe spe = speService.getById(speId);
|
|
|
+ Long goodsId = spe.getGoodsId();
|
|
|
+ LambdaUpdateWrapper<EquAndGoods> equAndGoodsUpdateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ equAndGoodsUpdateWrapper.eq(EquAndGoods::getEquId, equId).eq(EquAndGoods::getGoodsId, goodsId);
|
|
|
+ //余量与余料警告比较
|
|
|
if (subtract.compareTo(equBarrel.getResidueWarn()) != 1) {
|
|
|
- Spe spe = speService.getById(speId);
|
|
|
- Long goodsId = spe.getGoodsId();
|
|
|
- LambdaUpdateWrapper<EquAndGoods> equAndGoodsUpdateWrapper = new LambdaUpdateWrapper<>();
|
|
|
- equAndGoodsUpdateWrapper.eq(EquAndGoods::getEquId, equId).eq(EquAndGoods::getGoodsId, goodsId).set(EquAndGoods::getIsStarving, "0");
|
|
|
- equAndGoodsService.update(null, equAndGoodsUpdateWrapper);
|
|
|
+ equAndGoodsUpdateWrapper.set(EquAndGoods::getIsStarving, "0");
|
|
|
+ }else {
|
|
|
+ equAndGoodsUpdateWrapper.set(EquAndGoods::getIsStarving, "1");
|
|
|
}
|
|
|
+ equAndGoodsService.update(null, equAndGoodsUpdateWrapper);
|
|
|
}
|
|
|
});
|
|
|
});
|