|
@@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.fjhx.item.entity.product.po.ProductClassify;
|
|
|
import com.fjhx.item.entity.product.po.ProductInfo;
|
|
|
import com.fjhx.item.service.product.ProductClassifyService;
|
|
|
import com.fjhx.item.service.product.ProductInfoService;
|
|
@@ -20,7 +19,6 @@ import com.fjhx.wms.entity.stock.po.Stock;
|
|
|
import com.fjhx.wms.entity.stock.po.StockJournal;
|
|
|
import com.fjhx.wms.entity.stock.po.StockJournalDetails;
|
|
|
import com.fjhx.wms.entity.stock.vo.StockVo;
|
|
|
-import com.fjhx.wms.entity.stock.vo.StockWaitVo;
|
|
|
import com.fjhx.wms.entity.warehouse.po.Warehouse;
|
|
|
import com.fjhx.wms.mapper.stock.StockMapper;
|
|
|
import com.fjhx.wms.service.stock.StockJournalDetailsService;
|
|
@@ -33,7 +31,6 @@ import com.ruoyi.common.core.domain.BaseIdPo;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
@@ -69,7 +66,8 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
|
|
|
wrapper.orderByDesc("s", Stock::getId);
|
|
|
wrapper.eq(Stock::getWarehouseId, dto.getId());
|
|
|
wrapper.like(Stock::getQuantity, dto.getKeyword());
|
|
|
- wrapper.in(Stock::getProductId,dto.getProductIds());
|
|
|
+ wrapper.in(Stock::getProductId, dto.getProductIds());
|
|
|
+ wrapper.eq("pi.definition", dto.getDefinition());
|
|
|
|
|
|
Page<StockVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
List<StockVo> stockVos = page.getRecords();
|
|
@@ -81,14 +79,14 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
|
|
|
item.setProductName(productInfo.getName());
|
|
|
item.setProductSpec(productInfo.getSpec());
|
|
|
item.setProductClassifyId(productInfo.getProductClassifyId());
|
|
|
- item.setDefinition(productInfo.getDefinition());
|
|
|
+ item.setProductDefinition(productInfo.getDefinition());
|
|
|
});
|
|
|
//赋值产品分类
|
|
|
productClassifyService.attributeAssign(stockVos, StockVo::getProductClassifyId, (item, productClassify) -> {
|
|
|
item.setProductClassifyName(productClassify.getName());
|
|
|
});
|
|
|
//赋值仓库名称
|
|
|
- productClassifyService.attributeAssign(stockVos, StockVo::getWarehouseId, (item, warehouse) -> {
|
|
|
+ warehouseService.attributeAssign(stockVos, StockVo::getWarehouseId, (item, warehouse) -> {
|
|
|
item.setWarehouseName(warehouse.getName());
|
|
|
});
|
|
|
return page;
|
|
@@ -153,27 +151,38 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
|
|
|
wrapper.orderByDesc("s", Stock::getId);
|
|
|
wrapper.eq(Stock::getWarehouseId, dto.getId());
|
|
|
wrapper.like(Stock::getQuantity, dto.getKeyword());
|
|
|
+ wrapper.eq("pi.definition", dto.getDefinition());
|
|
|
|
|
|
Page<StockVo> page = this.baseMapper.pageByProduct(dto.getPage(), wrapper);
|
|
|
List<StockVo> stockVos = page.getRecords();
|
|
|
- //获取产品id列表
|
|
|
- List<Long> productIds = stockVos.stream().map(Stock::getProductId).collect(Collectors.toList());
|
|
|
- if (ObjectUtil.isNotEmpty(productIds)) {
|
|
|
- //赋值产品名称
|
|
|
- productInfoService.attributeAssign(stockVos, StockVo::getProductId, (item, productInfo) -> {
|
|
|
- item.setType(productInfo.getType());
|
|
|
- item.setProductName(productInfo.getName());
|
|
|
- //赋值维多利亚扩展产品信息
|
|
|
- String victoriatouristJson = item.getVictoriatouristJson();
|
|
|
- if (ObjectUtil.isNotEmpty(victoriatouristJson)) {
|
|
|
- JSONObject json = JSONObject.parseObject(victoriatouristJson);
|
|
|
- json.put("code", productInfo.getCode());
|
|
|
- json.put("spec", productInfo.getSpec());
|
|
|
- json.put("unit", productInfo.getUnit());
|
|
|
- item.setVictoriatouristJson(json.toJSONString());
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+
|
|
|
+ //赋值产品名称
|
|
|
+ productInfoService.attributeAssign(stockVos, StockVo::getProductId, (item, productInfo) -> {
|
|
|
+ item.setType(productInfo.getType());
|
|
|
+ item.setProductName(productInfo.getName());
|
|
|
+ item.setProductCode(productInfo.getCode());
|
|
|
+ item.setProductUnit(productInfo.getUnit());
|
|
|
+ item.setProductType(productInfo.getType());
|
|
|
+ item.setProductSpec(productInfo.getSpec());
|
|
|
+ item.setProductClassifyId(productInfo.getProductClassifyId());
|
|
|
+ item.setProductDefinition(productInfo.getDefinition());
|
|
|
+
|
|
|
+ //赋值维多利亚扩展产品信息
|
|
|
+ String victoriatouristJson = item.getVictoriatouristJson();
|
|
|
+ if (ObjectUtil.isNotEmpty(victoriatouristJson)) {
|
|
|
+ JSONObject json = JSONObject.parseObject(victoriatouristJson);
|
|
|
+ json.put("code", productInfo.getCode());
|
|
|
+ json.put("spec", productInfo.getSpec());
|
|
|
+ json.put("unit", productInfo.getUnit());
|
|
|
+ item.setVictoriatouristJson(json.toJSONString());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //赋值仓库名称
|
|
|
+ warehouseService.attributeAssign(stockVos, StockVo::getWarehouseId, (item, warehouse) -> {
|
|
|
+ item.setWarehouseName(warehouse.getName());
|
|
|
+ });
|
|
|
+
|
|
|
return page;
|
|
|
}
|
|
|
|
|
@@ -189,7 +198,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
|
|
|
StockJournal stockJournal = new StockJournal();
|
|
|
stockJournal.setOpType(stockDto.getType());
|
|
|
stockJournal.setType(stockDto.getType());
|
|
|
- stockJournal.setCode(stockDto.getType()==1? CodeEnum.SIN_CODE.getCode() : CodeEnum.SOUT_CODE.getCode());
|
|
|
+ stockJournal.setCode(stockDto.getType() == 1 ? CodeEnum.SIN_CODE.getCode() : CodeEnum.SOUT_CODE.getCode());
|
|
|
stockJournal.setWarehouseId(stockDto.getWarehouseId());
|
|
|
stockJournal.setBusinessId(stockDto.getBusinessId());
|
|
|
//保存出入库记录
|
|
@@ -206,7 +215,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
|
|
|
//创建出入库记录
|
|
|
StockJournal stockJournal = new StockJournal();
|
|
|
stockJournal.setOpType(stockDto.getType());
|
|
|
- stockJournal.setCode(stockDto.getType()==1? CodeEnum.SIN_CODE.getCode() : CodeEnum.SOUT_CODE.getCode());
|
|
|
+ stockJournal.setCode(stockDto.getType() == 1 ? CodeEnum.SIN_CODE.getCode() : CodeEnum.SOUT_CODE.getCode());
|
|
|
stockJournal.setType(stockDto.getType());
|
|
|
stockJournal.setWarehouseId(stockDto.getWarehouseId());
|
|
|
stockJournal.setBusinessId(stockDto.getBusinessId());
|
|
@@ -260,14 +269,14 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
|
|
|
if (quantity.compareTo(BigDecimal.ZERO) < 0) {
|
|
|
throw new ServiceException("库存不足无法出库");
|
|
|
}
|
|
|
- }else if(type==3){
|
|
|
+ } else if (type == 3) {
|
|
|
//维多利亚入库增加冻结库存
|
|
|
String victoriatouristJson = oldStocks.getVictoriatouristJson();
|
|
|
JSONObject json = JSONObject.parseObject(victoriatouristJson);
|
|
|
BigDecimal frozenQuantity = json.getBigDecimal("frozen_quantity");
|
|
|
- frozenQuantity = frozenQuantity==null?BigDecimal.ZERO:frozenQuantity;
|
|
|
+ frozenQuantity = frozenQuantity == null ? BigDecimal.ZERO : frozenQuantity;
|
|
|
frozenQuantity = frozenQuantity.add(stock.getQuantity());
|
|
|
- json.put("frozen_quantity",frozenQuantity);
|
|
|
+ json.put("frozen_quantity", frozenQuantity);
|
|
|
newStocks.setVictoriatouristJson(json.toJSONString());
|
|
|
} else {
|
|
|
throw new ServiceException("未知库存操作类型");
|
|
@@ -405,7 +414,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
|
|
|
private Long addJournal(Long warehouseId, JournalType journalType, Long businessId) {
|
|
|
StockJournal stockJournal = new StockJournal();
|
|
|
stockJournal.setType(journalType.getDetailType());
|
|
|
- switch (journalType.getDetailType()){
|
|
|
+ switch (journalType.getDetailType()) {
|
|
|
case 1:
|
|
|
stockJournal.setOpType(1);//入库
|
|
|
stockJournal.setCode(CodeEnum.SIN_CODE.getCode());
|