|
@@ -8,6 +8,7 @@ import com.fjhx.base.Condition;
|
|
|
import com.fjhx.constants.StatusConstant;
|
|
|
import com.fjhx.entity.product.ProductInfo;
|
|
|
import com.fjhx.entity.stock.StockTransfer;
|
|
|
+import com.fjhx.enums.stock.InTypeEnum;
|
|
|
import com.fjhx.enums.stock.OutTypeEnum;
|
|
|
import com.fjhx.mapper.stock.StockTransferMapper;
|
|
|
import com.fjhx.params.stock.ChangeProduct;
|
|
@@ -24,10 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -44,6 +42,7 @@ public class StockTransferServiceImpl extends ServiceImpl<StockTransferMapper, S
|
|
|
@Autowired
|
|
|
private StockService stockService;
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public Page<Map<String, Object>> getPage(Condition condition) {
|
|
|
|
|
@@ -52,6 +51,7 @@ public class StockTransferServiceImpl extends ServiceImpl<StockTransferMapper, S
|
|
|
wrapper.eq("st", StockTransfer::getOutWarehouseId);
|
|
|
wrapper.eq("st", StockTransfer::getInStatus);
|
|
|
wrapper.keyword(new KeywordData("pi", ProductInfo::getName), new KeywordData("pi", ProductInfo::getCode));
|
|
|
+ wrapper.orderByDesc("st", StockTransfer::getId);
|
|
|
|
|
|
Page<Map<String, Object>> page = baseMapper.getPage(condition.getPage(), wrapper);
|
|
|
List<Map<String, Object>> records = page.getRecords();
|
|
@@ -112,4 +112,30 @@ public class StockTransferServiceImpl extends ServiceImpl<StockTransferMapper, S
|
|
|
stockService.changeQuantity(stockChangeVo);
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Override
|
|
|
+ public void receive(StockTransfer stockTransfer) {
|
|
|
+
|
|
|
+ StockTransfer byId = getById(stockTransfer);
|
|
|
+ Assert.eqTrue(StatusConstant.NO.equals(byId.getInStatus()), "物品已接收");
|
|
|
+
|
|
|
+ byId.setInUser(AuthUtil.getUserId());
|
|
|
+ byId.setInQuantity(stockTransfer.getInQuantity());
|
|
|
+ byId.setInTime(new Date());
|
|
|
+ byId.setInStatus(StatusConstant.YES);
|
|
|
+ updateById(byId);
|
|
|
+
|
|
|
+ StockChangeVo stockChangeVo = new StockChangeVo();
|
|
|
+ stockChangeVo.setDefaultBusinessId(byId.getId());
|
|
|
+ stockChangeVo.setDefaultWarehouseId(byId.getInWarehouseId());
|
|
|
+ stockChangeVo.setDefaultRemarks(byId.getRemark());
|
|
|
+ stockChangeVo.setTypeEnum(InTypeEnum.TRANSFER);
|
|
|
+
|
|
|
+ ChangeProduct changeProduct = new ChangeProduct();
|
|
|
+ changeProduct.setProductId(byId.getProductId());
|
|
|
+ changeProduct.setQuantity(stockTransfer.getInQuantity());
|
|
|
+ stockChangeVo.setChangeDetailsList(Collections.singletonList(changeProduct));
|
|
|
+ stockService.changeQuantity(stockChangeVo);
|
|
|
+ }
|
|
|
+
|
|
|
}
|