Merge remote-tracking branch 'origin/qms/develop' into qms/develop
This commit is contained in:
commit
5695961008
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
|||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.nflg.wms.admin.pojo.vo.MaterialInventoryVO;
|
||||
import com.nflg.wms.admin.repository.InventoryCheckTaskScanRecordResitory;
|
||||
import com.nflg.wms.admin.service.QmsService;
|
||||
import com.nflg.wms.common.constant.STATE;
|
||||
|
|
@ -344,4 +345,39 @@ public class InventoryController extends BaseController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取库存数量
|
||||
* @param materialNo 物料编号
|
||||
*/
|
||||
@GetMapping("getCount")
|
||||
public ApiResult<MaterialInventoryVO> getCount(@RequestParam String materialNo) {
|
||||
List<WmsInventory> inventories = inventoryService.lambdaQuery()
|
||||
.eq(WmsInventory::getMaterialNo, materialNo)
|
||||
.list();
|
||||
|
||||
// 按工厂分组汇总数量
|
||||
List<MaterialInventoryVO.Item> items = inventories.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
WmsInventory::getFactoryNo,
|
||||
Collectors.reducing(BigDecimal.ZERO, WmsInventory::getNum, BigDecimal::add))
|
||||
)
|
||||
.entrySet()
|
||||
.stream()
|
||||
.map(entry -> new MaterialInventoryVO.Item()
|
||||
.setFactoryNo(entry.getKey())
|
||||
.setNum(entry.getValue())
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
BigDecimal totalNum = inventories.stream()
|
||||
.map(WmsInventory::getNum)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
MaterialInventoryVO vo = new MaterialInventoryVO()
|
||||
.setTotalNum(totalNum)
|
||||
.setItems(items);
|
||||
return ApiResult.success(vo);
|
||||
}
|
||||
}
|
||||
|
|
@ -643,6 +643,7 @@ public class NormalPGIController extends BaseController {
|
|||
@ApiMark(moduleName = "送货单管理", apiName = "收货确认")
|
||||
public ApiResult<Void> takeDelivery(@Valid @RequestBody List<SrmMaterialReceiptQO> request) {
|
||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(request)).throwMessage("收货参数为空");
|
||||
request.removeIf(it -> CollectionUtil.isEmpty(it.getScanCodes()));
|
||||
WmsSrmOrder order = wmsSrmOrderService.lambdaQuery().eq(WmsSrmOrder::getNoteNum, request.get(0).getNoteNum()).one();
|
||||
VUtil.trueThrowBusinessError(Objects.isNull(order)).throwMessage("收货单不存在");
|
||||
List<SAPSyncParamsDTO> sapSyncParamsDTOS = getSapSyncParamsDTOS(request, order);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
package com.nflg.wms.admin.pojo.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物料库存数量视图对象
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class MaterialInventoryVO {
|
||||
|
||||
/**
|
||||
* 库存总数量(所有库存地点合计)
|
||||
*/
|
||||
private BigDecimal totalNum;
|
||||
|
||||
/**
|
||||
* 各库存地点的数量明细
|
||||
*/
|
||||
private List<Item> items;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public static class Item {
|
||||
|
||||
/**
|
||||
* 工厂编号
|
||||
*/
|
||||
private String factoryNo;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal num;
|
||||
}
|
||||
}
|
||||
|
|
@ -49,7 +49,6 @@ public class SrmMaterialReceiptQO {
|
|||
/**
|
||||
* 实际收货数量
|
||||
*/
|
||||
@NotNull
|
||||
private BigDecimal receiptNum;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue