Browse Source

备件出库bug 35262

lyhzzz 2 years ago
parent
commit
344c01f9fe

+ 2 - 0
src/main/java/com/fdkankan/sale/service/IPartService.java

@@ -24,6 +24,8 @@ public interface IPartService extends IService<Part> {
 
 
     void inStock(Part part,Long userId);
     void inStock(Part part,Long userId);
 
 
+    void outStockCheck(Integer partId,Integer count,Long userId,String repairId);
+
     void outStock(Integer partId,Integer count,Long userId,String repairId);
     void outStock(Integer partId,Integer count,Long userId,String repairId);
 
 
     void recovery(Integer partId, Integer partCount, Long userId, String repairId);
     void recovery(Integer partId, Integer partCount, Long userId, String repairId);

+ 5 - 1
src/main/java/com/fdkankan/sale/service/impl/PartServiceImpl.java

@@ -81,7 +81,7 @@ public class PartServiceImpl extends ServiceImpl<IPartMapper, Part> implements I
     }
     }
 
 
     @Override
     @Override
-    public void outStock(Integer partId, Integer count,Long userId,String repairId) {
+    public void outStockCheck(Integer partId, Integer count,Long userId,String repairId) {
         Part part = this.getById(partId);
         Part part = this.getById(partId);
         if(part == null){
         if(part == null){
             throw new BusinessException(ResultCode.PART_NOT_EXITS);
             throw new BusinessException(ResultCode.PART_NOT_EXITS);
@@ -89,6 +89,10 @@ public class PartServiceImpl extends ServiceImpl<IPartMapper, Part> implements I
         if(part.getPartStock() - count < 0){
         if(part.getPartStock() - count < 0){
             throw new BusinessException(ResultCode.PART_STOCK_ERROR.code(),part.getPartName()+"_"+ResultCode.PART_STOCK_ERROR.message());
             throw new BusinessException(ResultCode.PART_STOCK_ERROR.code(),part.getPartName()+"_"+ResultCode.PART_STOCK_ERROR.message());
         }
         }
+
+    }
+    @Override
+    public void outStock(Integer partId, Integer count,Long userId,String repairId) {
         LambdaUpdateWrapper<Part> wrapper = new LambdaUpdateWrapper<>();
         LambdaUpdateWrapper<Part> wrapper = new LambdaUpdateWrapper<>();
         wrapper.eq(Part::getPartId,partId);
         wrapper.eq(Part::getPartId,partId);
         wrapper.setSql("part_stock = part_stock -" + count);
         wrapper.setSql("part_stock = part_stock -" + count);

+ 3 - 0
src/main/java/com/fdkankan/sale/service/impl/RepairSupplyService.java

@@ -113,6 +113,9 @@ public class RepairSupplyService {
         }
         }
         List<RepairRegisterPartVo> partVoList = this.partInfo(param.getRepairId(),0);
         List<RepairRegisterPartVo> partVoList = this.partInfo(param.getRepairId(),0);
         for (RepairRegisterPartVo partVo : partVoList) {
         for (RepairRegisterPartVo partVo : partVoList) {
+            partService.outStockCheck(partVo.getPartId(),partVo.getPartCount(),userId,repair.getRepairId());
+        }
+        for (RepairRegisterPartVo partVo : partVoList) {
             partService.outStock(partVo.getPartId(),partVo.getPartCount(),userId,repair.getRepairId());
             partService.outStock(partVo.getPartId(),partVo.getPartCount(),userId,repair.getRepairId());
         }
         }
         priceListService.outStock(repair.getRepairId());
         priceListService.outStock(repair.getRepairId());