库存管理 库存记录
This commit is contained in:
@@ -4,6 +4,8 @@ import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.dto.product.OutAndOnDto;
|
||||
import cn.ysk.cashier.dto.product.StockQueryDto;
|
||||
import cn.ysk.cashier.exception.BadRequestException;
|
||||
import cn.ysk.cashier.pojo.product.TbProductSku;
|
||||
import cn.ysk.cashier.repository.product.TbProductSkuRepository;
|
||||
import cn.ysk.cashier.service.TbProductStockOperateService;
|
||||
import cn.ysk.cashier.service.product.StockService;
|
||||
import cn.ysk.cashier.vo.StockVo;
|
||||
@@ -23,6 +25,7 @@ import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@@ -33,6 +36,7 @@ public class StockController {
|
||||
|
||||
private final StockService stockService;
|
||||
private final TbProductStockOperateService stockOperateService;
|
||||
private final TbProductSkuRepository skuRepository;
|
||||
|
||||
@ApiOperation("库存导出")
|
||||
@PostMapping(value = "download")
|
||||
@@ -62,12 +66,17 @@ public class StockController {
|
||||
row = sheet.getRow(i);
|
||||
if(row!=null){
|
||||
if(row.getCell(0)!=null){
|
||||
list.add(new StockVo(
|
||||
Integer.valueOf(row.getCell(0).getRawValue()),
|
||||
row.getCell(1).toString(),
|
||||
row.getCell(4).toString(),
|
||||
row.getCell(3).toString(),
|
||||
row.getCell(5).toString()));
|
||||
Optional<TbProductSku> byId = skuRepository.findById(Integer.valueOf(row.getCell(0).getRawValue()));
|
||||
if(byId.isPresent()){
|
||||
TbProductSku sku = byId.get();
|
||||
list.add(new StockVo(
|
||||
sku.getId(),
|
||||
row.getCell(1).toString(),
|
||||
row.getCell(4).toString(),
|
||||
row.getCell(3).toString(),
|
||||
row.getCell(5).toString(),
|
||||
sku.getStockNumber()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,7 +85,7 @@ public class StockController {
|
||||
outAndOnDto.setShopId(shopId);
|
||||
outAndOnDto.setList(new ArrayList<>(list));
|
||||
outAndOnDto.setType("purchase");
|
||||
outAndOnDto.setRemark("一次性导入库存");
|
||||
outAndOnDto.setRemark("一次性导入 库存数会覆盖");
|
||||
outAndOnDto.setIsImport("true");
|
||||
outAndOnDto.setTime(System.currentTimeMillis());
|
||||
outAndOnDto.setTotalAmount(BigDecimal.ZERO);
|
||||
|
||||
Reference in New Issue
Block a user