|
@@ -18,6 +18,7 @@ import com.fjhx.entity.stock.Stock;
|
|
|
import com.fjhx.entity.water.WaterTag;
|
|
|
import com.fjhx.mapper.check.CheckInfoMapper;
|
|
|
import com.fjhx.params.check.CheckDetailVo;
|
|
|
+import com.fjhx.params.check.CheckInfoEx;
|
|
|
import com.fjhx.service.WebSocketServer;
|
|
|
import com.fjhx.service.check.CheckDetailService;
|
|
|
import com.fjhx.service.check.CheckInfoService;
|
|
@@ -417,6 +418,44 @@ public class CheckInfoServiceImpl extends ServiceImpl<CheckInfoMapper, CheckInfo
|
|
|
return page;
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Override
|
|
|
+ public void initiateManualCounting(CheckInfoEx checkInfoEx) {
|
|
|
+ Assert.notEmpty(checkInfoEx.getOperUserId(), "操作人id不能为空");
|
|
|
+ Assert.notEmpty(checkInfoEx.getBeginTime(), "开始盘点时间不能为空");
|
|
|
+
|
|
|
+ List<Long> materialIdList = checkInfoEx.getMaterialIdList();
|
|
|
+ Assert.notEmpty(materialIdList, "物料id列表不能为空");
|
|
|
+
|
|
|
+ checkInfoEx.setCheckResult(StatusConstant.YES);
|
|
|
+ checkInfoEx.setType(2);
|
|
|
+ checkInfoEx.setStatus(0);
|
|
|
+ checkInfoEx.setPeopleCheckResult(1);
|
|
|
+ save(checkInfoEx);
|
|
|
+
|
|
|
+ List<Stock> stockList = stockService.list(q -> q.in(Stock::getMaterialId, materialIdList));
|
|
|
+ Map<Long, Stock> collect = stockList.stream().collect(Collectors.toMap(Stock::getMaterialId, item -> item));
|
|
|
+
|
|
|
+ List<CheckDetail> checkDetailList = materialIdList.stream().map(item -> {
|
|
|
+ CheckDetail checkDetail = new CheckDetail();
|
|
|
+ checkDetail.setCheckId(checkInfoEx.getId());
|
|
|
+ checkDetail.setMaterialId(item);
|
|
|
+
|
|
|
+ Stock stock = collect.get(item);
|
|
|
+ if (stock == null) {
|
|
|
+ checkDetail.setStockCount(0);
|
|
|
+ checkDetail.setStockQuantity(BigDecimal.ZERO);
|
|
|
+ } else {
|
|
|
+ checkDetail.setStockCount(stock.getNumber());
|
|
|
+ checkDetail.setStockQuantity(stock.getQuantity());
|
|
|
+ }
|
|
|
+ checkDetail.setCheckResult(1);
|
|
|
+ return checkDetail;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ checkDetailService.saveBatch(checkDetailList);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取在库标签
|
|
|
*/
|