fix:接口完善,新增库存管理的物料分页列表
This commit is contained in:
@@ -40,12 +40,21 @@ public interface SupplierMapper extends BaseMapperX<SupplierDO> {
|
|||||||
|
|
||||||
default SupplierExtendRespVO selectOneWithCertifications(Long id) {
|
default SupplierExtendRespVO selectOneWithCertifications(Long id) {
|
||||||
return selectJoinOne(SupplierExtendRespVO.class,
|
return selectJoinOne(SupplierExtendRespVO.class,
|
||||||
|
// new MPJLambdaWrapperX<SupplierDO>()
|
||||||
|
// .selectAll(SupplierDO.class)
|
||||||
|
// .selectCollection(SupplierPropertiesDO.class, SupplierExtendRespVO::getSupplierPropertiesList)
|
||||||
|
// .leftJoin(SupplierPropertiesDO.class, SupplierPropertiesDO::getSupplierId, SupplierDO::getId)
|
||||||
|
// .eq(SupplierDO::getId, id)
|
||||||
|
//// .eq(SupplierPropertiesDO::getBusinessType, QmsSupplierConstant.CERTIFICATION_KEY)
|
||||||
new MPJLambdaWrapperX<SupplierDO>()
|
new MPJLambdaWrapperX<SupplierDO>()
|
||||||
.selectAll(SupplierDO.class)
|
.selectAll(SupplierDO.class)
|
||||||
.selectCollection(SupplierPropertiesDO.class, SupplierExtendRespVO::getSupplierPropertiesList)
|
.selectCollection(SupplierPropertiesDO.class, SupplierExtendRespVO::getSupplierPropertiesList)
|
||||||
.leftJoin(SupplierPropertiesDO.class, SupplierPropertiesDO::getSupplierId, SupplierDO::getId)
|
// 将关联条件写在一个 on() 方法内
|
||||||
|
.leftJoin(SupplierPropertiesDO.class, on -> on
|
||||||
|
.eq(SupplierPropertiesDO::getSupplierId, SupplierDO::getId)
|
||||||
|
.eq(SupplierPropertiesDO::getBusinessType, QmsSupplierConstant.CERTIFICATION_KEY)
|
||||||
|
) // 注意这里移除了之前的 .eq 条件
|
||||||
.eq(SupplierDO::getId, id)
|
.eq(SupplierDO::getId, id)
|
||||||
.eq(SupplierPropertiesDO::getBusinessType, QmsSupplierConstant.CERTIFICATION_KEY)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,14 +57,14 @@ public class DeviceConfigBusinessItemController extends AbstractFileUploadContro
|
|||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建设备-检查项目配置")
|
@Operation(summary = "创建设备-检查项目配置")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:device-config-business-item:create')")
|
// @PreAuthorize("@ss.hasPermission('qms:device-config-business-item:create')")
|
||||||
public CommonResult<DeviceConfigBusinessItemRespVO> createDeviceConfigBusinessItem(@Valid @RequestBody DeviceConfigBusinessItemSaveReqVO createReqVO) {
|
public CommonResult<DeviceConfigBusinessItemRespVO> createDeviceConfigBusinessItem(@Valid @RequestBody DeviceConfigBusinessItemSaveReqVO createReqVO) {
|
||||||
return success(deviceConfigBusinessItemService.createDeviceConfigBusinessItem(createReqVO));
|
return success(deviceConfigBusinessItemService.createDeviceConfigBusinessItem(createReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@Operation(summary = "更新设备-检查项目配置")
|
@Operation(summary = "更新设备-检查项目配置")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:device-config-business-item:update')")
|
// @PreAuthorize("@ss.hasPermission('qms:device-config-business-item:update')")
|
||||||
public CommonResult<Boolean> updateDeviceConfigBusinessItem(@Valid @RequestBody DeviceConfigBusinessItemSaveReqVO updateReqVO) {
|
public CommonResult<Boolean> updateDeviceConfigBusinessItem(@Valid @RequestBody DeviceConfigBusinessItemSaveReqVO updateReqVO) {
|
||||||
deviceConfigBusinessItemService.updateDeviceConfigBusinessItem(updateReqVO);
|
deviceConfigBusinessItemService.updateDeviceConfigBusinessItem(updateReqVO);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -73,7 +73,7 @@ public class DeviceConfigBusinessItemController extends AbstractFileUploadContro
|
|||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary = "删除设备-检查项目配置")
|
@Operation(summary = "删除设备-检查项目配置")
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
@PreAuthorize("@ss.hasPermission('qms:device-config-business-item:delete')")
|
// @PreAuthorize("@ss.hasPermission('qms:device-config-business-item:delete')")
|
||||||
public CommonResult<Boolean> deleteDeviceConfigBusinessItem(@RequestParam("id") Long id) {
|
public CommonResult<Boolean> deleteDeviceConfigBusinessItem(@RequestParam("id") Long id) {
|
||||||
deviceConfigBusinessItemService.deleteDeviceConfigBusinessItem(id);
|
deviceConfigBusinessItemService.deleteDeviceConfigBusinessItem(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -82,7 +82,7 @@ public class DeviceConfigBusinessItemController extends AbstractFileUploadContro
|
|||||||
@DeleteMapping("/delete-list")
|
@DeleteMapping("/delete-list")
|
||||||
@Parameter(name = "ids", description = "编号", required = true)
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
@Operation(summary = "批量删除设备-检查项目配置")
|
@Operation(summary = "批量删除设备-检查项目配置")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:device-config-business-item:delete')")
|
// @PreAuthorize("@ss.hasPermission('qms:device-config-business-item:delete')")
|
||||||
public CommonResult<Boolean> deleteDeviceConfigBusinessItemList(@RequestBody BatchDeleteReqVO req) {
|
public CommonResult<Boolean> deleteDeviceConfigBusinessItemList(@RequestBody BatchDeleteReqVO req) {
|
||||||
deviceConfigBusinessItemService.deleteDeviceConfigBusinessItemListByIds(req.getIds());
|
deviceConfigBusinessItemService.deleteDeviceConfigBusinessItemListByIds(req.getIds());
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -91,7 +91,7 @@ public class DeviceConfigBusinessItemController extends AbstractFileUploadContro
|
|||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "获得设备-检查项目配置")
|
@Operation(summary = "获得设备-检查项目配置")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:device-config-business-item:query')")
|
// @PreAuthorize("@ss.hasPermission('qms:device-config-business-item:query')")
|
||||||
public CommonResult<DeviceConfigBusinessItemRespVO> getDeviceConfigBusinessItem(@RequestParam("id") Long id) {
|
public CommonResult<DeviceConfigBusinessItemRespVO> getDeviceConfigBusinessItem(@RequestParam("id") Long id) {
|
||||||
DeviceConfigBusinessItemDO deviceConfigBusinessItem = deviceConfigBusinessItemService.getDeviceConfigBusinessItem(id);
|
DeviceConfigBusinessItemDO deviceConfigBusinessItem = deviceConfigBusinessItemService.getDeviceConfigBusinessItem(id);
|
||||||
return success(BeanUtils.toBean(deviceConfigBusinessItem, DeviceConfigBusinessItemRespVO.class));
|
return success(BeanUtils.toBean(deviceConfigBusinessItem, DeviceConfigBusinessItemRespVO.class));
|
||||||
@@ -99,7 +99,7 @@ public class DeviceConfigBusinessItemController extends AbstractFileUploadContro
|
|||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得设备-检查项目配置分页")
|
@Operation(summary = "获得设备-检查项目配置分页")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:device-config-business-item:query')")
|
// @PreAuthorize("@ss.hasPermission('qms:device-config-business-item:query')")
|
||||||
public CommonResult<PageResult<DeviceConfigBusinessItemRespVO>> getDeviceConfigBusinessItemPage(@Valid DeviceConfigBusinessItemPageReqVO pageReqVO) {
|
public CommonResult<PageResult<DeviceConfigBusinessItemRespVO>> getDeviceConfigBusinessItemPage(@Valid DeviceConfigBusinessItemPageReqVO pageReqVO) {
|
||||||
PageResult<DeviceConfigBusinessItemDO> pageResult = deviceConfigBusinessItemService.getDeviceConfigBusinessItemPage(pageReqVO);
|
PageResult<DeviceConfigBusinessItemDO> pageResult = deviceConfigBusinessItemService.getDeviceConfigBusinessItemPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, DeviceConfigBusinessItemRespVO.class));
|
return success(BeanUtils.toBean(pageResult, DeviceConfigBusinessItemRespVO.class));
|
||||||
@@ -107,7 +107,7 @@ public class DeviceConfigBusinessItemController extends AbstractFileUploadContro
|
|||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@Operation(summary = "导出设备-检查项目配置 Excel")
|
@Operation(summary = "导出设备-检查项目配置 Excel")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:device-config-business-item:export')")
|
// @PreAuthorize("@ss.hasPermission('qms:device-config-business-item:export')")
|
||||||
@ApiAccessLog(operateType = EXPORT)
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
public void exportDeviceConfigBusinessItemExcel(@Valid DeviceConfigBusinessItemPageReqVO pageReqVO,
|
public void exportDeviceConfigBusinessItemExcel(@Valid DeviceConfigBusinessItemPageReqVO pageReqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.controller.admin;
|
package com.zt.plat.module.qms.resource.material.controller.admin;
|
||||||
|
|
||||||
|
import com.zt.plat.framework.datapermission.core.annotation.DeptDataPermissionIgnore;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchPageReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchRespVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchRespVO;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchSaveReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchSaveReqVO;
|
||||||
@@ -39,6 +40,7 @@ import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/qms/resource/material-batch")
|
@RequestMapping("/qms/resource/material-batch")
|
||||||
@Validated
|
@Validated
|
||||||
|
@DeptDataPermissionIgnore(enable = "true")
|
||||||
public class MaterialBatchController implements BusinessControllerMarker {
|
public class MaterialBatchController implements BusinessControllerMarker {
|
||||||
|
|
||||||
|
|
||||||
@@ -47,14 +49,14 @@ public class MaterialBatchController implements BusinessControllerMarker {
|
|||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建物料批次")
|
@Operation(summary = "创建物料批次")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:material-batch:create')")
|
// @PreAuthorize("@ss.hasPermission('qms:material-batch:create')")
|
||||||
public CommonResult<MaterialBatchRespVO> createMaterialBatch(@Validated(AddGroup.class) @RequestBody MaterialBatchSaveReqVO createReqVO) {
|
public CommonResult<MaterialBatchRespVO> createMaterialBatch(@Validated(AddGroup.class) @RequestBody MaterialBatchSaveReqVO createReqVO) {
|
||||||
return success(materialBatchService.createMaterialBatch(createReqVO));
|
return success(materialBatchService.createMaterialBatch(createReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@Operation(summary = "更新物料批次")
|
@Operation(summary = "更新物料批次")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:material-batch:update')")
|
// @PreAuthorize("@ss.hasPermission('qms:material-batch:update')")
|
||||||
public CommonResult<Boolean> updateMaterialBatch(@Validated(UpdateGroup.class) @RequestBody MaterialBatchSaveReqVO updateReqVO) {
|
public CommonResult<Boolean> updateMaterialBatch(@Validated(UpdateGroup.class) @RequestBody MaterialBatchSaveReqVO updateReqVO) {
|
||||||
materialBatchService.updateMaterialBatch(updateReqVO);
|
materialBatchService.updateMaterialBatch(updateReqVO);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -63,7 +65,7 @@ public class MaterialBatchController implements BusinessControllerMarker {
|
|||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary = "删除物料批次")
|
@Operation(summary = "删除物料批次")
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
@PreAuthorize("@ss.hasPermission('qms:material-batch:delete')")
|
// @PreAuthorize("@ss.hasPermission('qms:material-batch:delete')")
|
||||||
public CommonResult<Boolean> deleteMaterialBatch(@RequestParam("id") Long id) {
|
public CommonResult<Boolean> deleteMaterialBatch(@RequestParam("id") Long id) {
|
||||||
materialBatchService.deleteMaterialBatch(id);
|
materialBatchService.deleteMaterialBatch(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -110,7 +112,7 @@ public class MaterialBatchController implements BusinessControllerMarker {
|
|||||||
|
|
||||||
@PostMapping("/assign-gongduan")
|
@PostMapping("/assign-gongduan")
|
||||||
@Operation(summary = "批次工段拆分")
|
@Operation(summary = "批次工段拆分")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:material-batch:create')")
|
// @PreAuthorize("@ss.hasPermission('qms:material-batch:create')")
|
||||||
public CommonResult<List<MaterialBatchRespVO>> assignMaterialBatchGongduan(@Valid @RequestBody List<MaterialBatchSaveReqVO> createReqVOs) {
|
public CommonResult<List<MaterialBatchRespVO>> assignMaterialBatchGongduan(@Valid @RequestBody List<MaterialBatchSaveReqVO> createReqVOs) {
|
||||||
return success(materialBatchService.assignMaterialBatchGongduan(createReqVOs));
|
return success(materialBatchService.assignMaterialBatchGongduan(createReqVOs));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.zt.plat.module.qms.resource.material.controller.admin;
|
||||||
|
|
||||||
|
import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
|
||||||
|
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||||
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
|
import com.zt.plat.framework.datapermission.core.annotation.DeptDataPermissionIgnore;
|
||||||
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductPageReqVO;
|
||||||
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductRespVO;
|
||||||
|
import com.zt.plat.module.qms.resource.material.service.MaterialProductService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 物料库存")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/qms/resource/material-inventory")
|
||||||
|
@Validated
|
||||||
|
@DeptDataPermissionIgnore(enable = "true")
|
||||||
|
public class MaterialInventoryController implements BusinessControllerMarker {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MaterialProductService materialProductService;
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得物料大类分页")
|
||||||
|
public CommonResult<PageResult<MaterialProductRespVO>> getMaterialInventoryPage(@Valid MaterialProductPageReqVO pageReqVO) {
|
||||||
|
// 需要库存数量和预警信息
|
||||||
|
PageResult<MaterialProductRespVO> pageResult = materialProductService.getMaterialInventoryPage(pageReqVO);
|
||||||
|
return success(pageResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ import com.zt.plat.framework.common.pojo.PageParam;
|
|||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
|
import com.zt.plat.framework.datapermission.core.annotation.DeptDataPermissionIgnore;
|
||||||
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductPageReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductRespVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductRespVO;
|
||||||
@@ -36,6 +37,7 @@ import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
|||||||
@RequestMapping("/qms/resource/material-product")
|
@RequestMapping("/qms/resource/material-product")
|
||||||
@Validated
|
@Validated
|
||||||
@FileUploadController(source = "resource.materialproduct")
|
@FileUploadController(source = "resource.materialproduct")
|
||||||
|
@DeptDataPermissionIgnore(enable = "true")
|
||||||
public class MaterialProductController extends AbstractFileUploadController implements BusinessControllerMarker{
|
public class MaterialProductController extends AbstractFileUploadController implements BusinessControllerMarker{
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@@ -51,7 +53,7 @@ public class MaterialProductController extends AbstractFileUploadController impl
|
|||||||
|
|
||||||
@PostMapping("/save-category")
|
@PostMapping("/save-category")
|
||||||
@Operation(summary = "保存分类")
|
@Operation(summary = "保存分类")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:material-product:create-category')")
|
// @PreAuthorize("@ss.hasPermission('qms:material-product:create-category')")
|
||||||
public CommonResult<MaterialProductRespVO> saveMaterialCategory(@Valid @RequestBody MaterialProductSaveReqVO createReqVO) {
|
public CommonResult<MaterialProductRespVO> saveMaterialCategory(@Valid @RequestBody MaterialProductSaveReqVO createReqVO) {
|
||||||
return success(materialProductService.saveMaterialCategory(createReqVO));
|
return success(materialProductService.saveMaterialCategory(createReqVO));
|
||||||
}
|
}
|
||||||
@@ -72,7 +74,7 @@ public class MaterialProductController extends AbstractFileUploadController impl
|
|||||||
|
|
||||||
@PostMapping("/save-material")
|
@PostMapping("/save-material")
|
||||||
@Operation(summary = "保存物料大类")
|
@Operation(summary = "保存物料大类")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:material-product:create')")
|
// @PreAuthorize("@ss.hasPermission('qms:material-product:create')")
|
||||||
public CommonResult<MaterialProductRespVO> saveMaterialProduct(@Valid @RequestBody MaterialProductSaveReqVO createReqVO) {
|
public CommonResult<MaterialProductRespVO> saveMaterialProduct(@Valid @RequestBody MaterialProductSaveReqVO createReqVO) {
|
||||||
return success(materialProductService.saveMaterialProduct(createReqVO));
|
return success(materialProductService.saveMaterialProduct(createReqVO));
|
||||||
}
|
}
|
||||||
@@ -85,6 +87,13 @@ public class MaterialProductController extends AbstractFileUploadController impl
|
|||||||
return success(BeanUtils.toBean(pageResult, MaterialProductRespVO.class));
|
return success(BeanUtils.toBean(pageResult, MaterialProductRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("category-data")
|
||||||
|
@Operation(summary = "获得物料分类和大类")
|
||||||
|
@Parameter(name = "type", description = "category-分类,data-全部")
|
||||||
|
public CommonResult<List<MaterialProductRespVO>> getCategoryAndData(@RequestParam("type") String type) {
|
||||||
|
return success(materialProductService.getCategoryAndData(type));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// @PutMapping("/update")
|
// @PutMapping("/update")
|
||||||
// @Operation(summary = "更新物料")
|
// @Operation(summary = "更新物料")
|
||||||
@@ -97,7 +106,7 @@ public class MaterialProductController extends AbstractFileUploadController impl
|
|||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary = "删除物料分类或大类")
|
@Operation(summary = "删除物料分类或大类")
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
@PreAuthorize("@ss.hasPermission('qms:material-product:delete')")
|
// @PreAuthorize("@ss.hasPermission('qms:material-product:delete')")
|
||||||
public CommonResult<Boolean> deleteMaterialProduct(@RequestParam("id") Long id) {
|
public CommonResult<Boolean> deleteMaterialProduct(@RequestParam("id") Long id) {
|
||||||
materialProductService.deleteMaterialProduct(id);
|
materialProductService.deleteMaterialProduct(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -117,7 +126,7 @@ public class MaterialProductController extends AbstractFileUploadController impl
|
|||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
// @PreAuthorize("@ss.hasPermission('qms:material-product:query')")
|
// @PreAuthorize("@ss.hasPermission('qms:material-product:query')")
|
||||||
public CommonResult<MaterialProductRespVO> getMaterialProduct(@RequestParam("id") Long id) {
|
public CommonResult<MaterialProductRespVO> getMaterialProduct(@RequestParam("id") Long id) {
|
||||||
MaterialProductDO materialProduct = materialProductService.getMaterialProduct(id);
|
MaterialProductDO materialProduct = materialProductService.getMaterialProductInfo(id);
|
||||||
return success(BeanUtils.toBean(materialProduct, MaterialProductRespVO.class));
|
return success(BeanUtils.toBean(materialProduct, MaterialProductRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,10 @@ public class MaterialBatchRespVO {
|
|||||||
@ExcelProperty("分配部门名称")
|
@ExcelProperty("分配部门名称")
|
||||||
private String assignDepartmentName;
|
private String assignDepartmentName;
|
||||||
|
|
||||||
|
@Schema(description = "提交状态,0-未提交,1-已提交", example = "1")
|
||||||
|
@ExcelProperty("提交状态,0-未提交,1-已提交")
|
||||||
|
private Integer submitStatus;
|
||||||
|
|
||||||
@Schema(description = "验收状态", example = "1")
|
@Schema(description = "验收状态", example = "1")
|
||||||
@ExcelProperty("验收状态")
|
@ExcelProperty("验收状态")
|
||||||
private String acceptanceStatus;
|
private String acceptanceStatus;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -82,6 +83,10 @@ public class MaterialProductRespVO {
|
|||||||
@ExcelProperty("单位")
|
@ExcelProperty("单位")
|
||||||
private String unit;
|
private String unit;
|
||||||
|
|
||||||
|
@Schema(description = "库存数量")
|
||||||
|
@ExcelProperty("库存数量")
|
||||||
|
private BigDecimal inventoryQuantity;
|
||||||
|
|
||||||
@Schema(description = "允许按量领取,1-领用时输入量,按量领取;0-领用时不能输入量,整个领走")
|
@Schema(description = "允许按量领取,1-领用时输入量,按量领取;0-领用时不能输入量,整个领走")
|
||||||
@ExcelProperty("允许按量领取,1-领用时输入量,按量领取;0-领用时不能输入量,整个领走")
|
@ExcelProperty("允许按量领取,1-领用时输入量,按量领取;0-领用时不能输入量,整个领走")
|
||||||
private Integer enablePartial;
|
private Integer enablePartial;
|
||||||
|
|||||||
@@ -82,6 +82,11 @@ public class MaterialBatchDO extends BusinessBaseDO {
|
|||||||
*/
|
*/
|
||||||
@TableField("ASN_DEPT_NAME")
|
@TableField("ASN_DEPT_NAME")
|
||||||
private String assignDepartmentName;
|
private String assignDepartmentName;
|
||||||
|
/**
|
||||||
|
* 提交状态,0-未提交,1-已提交
|
||||||
|
*/
|
||||||
|
@TableField("SBM_STS")
|
||||||
|
private Integer submitStatus;
|
||||||
/**
|
/**
|
||||||
* 验收状态
|
* 验收状态
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,12 +1,21 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.dal.mapper;
|
package com.zt.plat.module.qms.resource.material.dal.mapper;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
||||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchPageReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
|
||||||
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物料批次 Mapper
|
* 物料批次 Mapper
|
||||||
*
|
*
|
||||||
@@ -16,6 +25,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
|
public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
|
||||||
|
|
||||||
default PageResult<MaterialBatchDO> selectPage(MaterialBatchPageReqVO reqVO) {
|
default PageResult<MaterialBatchDO> selectPage(MaterialBatchPageReqVO reqVO) {
|
||||||
|
// TODO 需要层级穿透 分类-物料sku-批次
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialBatchDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialBatchDO>()
|
||||||
.eqIfPresent(MaterialBatchDO::getProductId, reqVO.getProductId())
|
.eqIfPresent(MaterialBatchDO::getProductId, reqVO.getProductId())
|
||||||
.likeIfPresent(MaterialBatchDO::getBatchNo, reqVO.getBatchNo())
|
.likeIfPresent(MaterialBatchDO::getBatchNo, reqVO.getBatchNo())
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.dal.mapper;
|
package com.zt.plat.module.qms.resource.material.dal.mapper;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
@@ -9,11 +8,6 @@ import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductPag
|
|||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物料大类 Mapper
|
* 物料大类 Mapper
|
||||||
*
|
*
|
||||||
@@ -22,12 +16,14 @@ import java.util.stream.Collectors;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface MaterialProductMapper extends BaseMapperX<MaterialProductDO> {
|
public interface MaterialProductMapper extends BaseMapperX<MaterialProductDO> {
|
||||||
|
|
||||||
|
// @QmsPermission(deptDataRoleCodes = "ytjyDeptAndSub", moduleDataRoleCodes = "qms_material_manager")
|
||||||
default PageResult<MaterialProductDO> selectPage(MaterialProductPageReqVO reqVO) {
|
default PageResult<MaterialProductDO> selectPage(MaterialProductPageReqVO reqVO) {
|
||||||
PageResult<MaterialProductDO> pageResult = selectPage(reqVO, new LambdaQueryWrapperX<MaterialProductDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialProductDO>()
|
||||||
.eq(MaterialProductDO::getNodeType, DataTypeConstant.DATA_TYPE_DATA)
|
.eq(MaterialProductDO::getNodeType, DataTypeConstant.DATA_TYPE_DATA)
|
||||||
.eqIfPresent(MaterialProductDO::getParentId, reqVO.getParentId())
|
.eqIfPresent(MaterialProductDO::getParentId, reqVO.getParentId())
|
||||||
.likeIfPresent(MaterialProductDO::getIdPath, reqVO.getIdPath())
|
.likeIfPresent(MaterialProductDO::getIdPath, reqVO.getIdPath())
|
||||||
.likeIfPresent(MaterialProductDO::getName, reqVO.getName())
|
.likeIfPresent(MaterialProductDO::getName, reqVO.getName())
|
||||||
|
.likeIfPresent(MaterialProductDO::getCode, reqVO.getCode())
|
||||||
.likeIfPresent(MaterialProductDO::getCustomConfig, reqVO.getCustomConfig())
|
.likeIfPresent(MaterialProductDO::getCustomConfig, reqVO.getCustomConfig())
|
||||||
.likeIfPresent(MaterialProductDO::getCustomForm, reqVO.getCustomForm())
|
.likeIfPresent(MaterialProductDO::getCustomForm, reqVO.getCustomForm())
|
||||||
.likeIfPresent(MaterialProductDO::getCustomData, reqVO.getCustomData())
|
.likeIfPresent(MaterialProductDO::getCustomData, reqVO.getCustomData())
|
||||||
@@ -54,17 +50,6 @@ public interface MaterialProductMapper extends BaseMapperX<MaterialProductDO> {
|
|||||||
.orderByAsc(MaterialProductDO::getSortNo)
|
.orderByAsc(MaterialProductDO::getSortNo)
|
||||||
.orderByAsc(MaterialProductDO::getIdPath)
|
.orderByAsc(MaterialProductDO::getIdPath)
|
||||||
.orderByDesc(MaterialProductDO::getId));
|
.orderByDesc(MaterialProductDO::getId));
|
||||||
List<MaterialProductDO> mtrlDos = pageResult.getList();
|
|
||||||
if (CollUtil.isEmpty(mtrlDos)) return pageResult;
|
|
||||||
Set<Long> prnIds = mtrlDos.stream().map(MaterialProductDO::getParentId).collect(Collectors.toSet());
|
|
||||||
List<MaterialProductDO> prnDos = this.selectByIds(prnIds);
|
|
||||||
if (CollUtil.isEmpty(prnDos)) return pageResult;
|
|
||||||
Map<Long, String> prnIdNameMap = prnDos.stream().collect(Collectors.toMap(MaterialProductDO::getId, MaterialProductDO::getName));
|
|
||||||
for (MaterialProductDO mtrlDo : mtrlDos) {
|
|
||||||
mtrlDo.setCategoryName(prnIdNameMap.get(mtrlDo.getParentId()));
|
|
||||||
}
|
|
||||||
pageResult.setList(mtrlDos);
|
|
||||||
return pageResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -43,8 +43,6 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
|
|||||||
private MaterialBatchMapper materialBatchMapper;
|
private MaterialBatchMapper materialBatchMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SequenceUtil sequenceUtil;
|
private SequenceUtil sequenceUtil;
|
||||||
@Autowired
|
|
||||||
private MaterialProductService materialProductService;
|
|
||||||
|
|
||||||
private final String sequenceKey = "QMS_MATERIAL_BATCH_NO";
|
private final String sequenceKey = "QMS_MATERIAL_BATCH_NO";
|
||||||
|
|
||||||
|
|||||||
@@ -61,4 +61,11 @@ public interface MaterialInfomationService {
|
|||||||
*/
|
*/
|
||||||
PageResult<MaterialInfomationDO> getMaterialInfomationPage(MaterialInfomationPageReqVO pageReqVO);
|
PageResult<MaterialInfomationDO> getMaterialInfomationPage(MaterialInfomationPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据物料大类 id 获取库存数量
|
||||||
|
*
|
||||||
|
* @param mtrlIds ids
|
||||||
|
* @return 大类id-库存数量
|
||||||
|
*/
|
||||||
|
Map<Long, Long> getStockQuantityByPdtIds(List<Long> mtrlIds);
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.service;
|
package com.zt.plat.module.qms.resource.material.service;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationPageReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationPageReqVO;
|
||||||
@@ -12,7 +14,10 @@ import jakarta.annotation.Resource;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.MATERIAL_INFOMATION_NOT_EXISTS;
|
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.MATERIAL_INFOMATION_NOT_EXISTS;
|
||||||
@@ -86,4 +91,20 @@ public class MaterialInfomationServiceImpl implements MaterialInfomationService
|
|||||||
return materialInfomationMapper.selectPage(pageReqVO);
|
return materialInfomationMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, Long> getStockQuantityByPdtIds(List<Long> pdtIds) {
|
||||||
|
QueryWrapper<MaterialInfomationDO> queryWrapper = Wrappers.query(MaterialInfomationDO.class)
|
||||||
|
.select("PDT_ID ,count(*) as quantity")
|
||||||
|
.in("PDT_ID", pdtIds)
|
||||||
|
.eq("USG_STS", 0)
|
||||||
|
.groupBy("PDT_ID");
|
||||||
|
List<Map<String, Object>> maps = materialInfomationMapper.selectMaps(queryWrapper);
|
||||||
|
if (CollUtil.isEmpty(maps)) return new HashMap<>();
|
||||||
|
|
||||||
|
return maps.stream().collect(Collectors.toMap(
|
||||||
|
map -> (Long) map.get("PDT_ID"),
|
||||||
|
map -> ((Long) map.get("quantity"))
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -75,4 +75,28 @@ public interface MaterialProductService {
|
|||||||
* @return 物料大类分页
|
* @return 物料大类分页
|
||||||
*/
|
*/
|
||||||
PageResult<MaterialProductDO> getMaterialProductPage(MaterialProductPageReqVO pageReqVO);
|
PageResult<MaterialProductDO> getMaterialProductPage(MaterialProductPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得物料大类详情
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 物料大类
|
||||||
|
*/
|
||||||
|
MaterialProductDO getMaterialProductInfo(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得物料分类和大类
|
||||||
|
*
|
||||||
|
* @param type 节点类型
|
||||||
|
* @return 列表
|
||||||
|
*/
|
||||||
|
List<MaterialProductRespVO> getCategoryAndData(String type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得物料大类的库存分页信息
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 物料大类分页
|
||||||
|
*/
|
||||||
|
PageResult<MaterialProductRespVO> getMaterialInventoryPage(@Valid MaterialProductPageReqVO pageReqVO);
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,6 @@ import com.zt.plat.framework.common.pojo.PageResult;
|
|||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.zt.plat.module.qms.core.constant.DataTypeConstant;
|
import com.zt.plat.module.qms.core.constant.DataTypeConstant;
|
||||||
import com.zt.plat.module.qms.enums.ErrorCodeConstants;
|
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductPageReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductPageReqVO;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductRespVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductRespVO;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductSaveReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialProductSaveReqVO;
|
||||||
@@ -20,13 +19,14 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*;
|
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*;
|
||||||
import static org.checkerframework.checker.units.qual.Prefix.one;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物料大类 Service 实现类
|
* 物料大类 Service 实现类
|
||||||
@@ -40,10 +40,12 @@ public class MaterialProductServiceImpl implements MaterialProductService {
|
|||||||
@Resource
|
@Resource
|
||||||
private MaterialProductMapper materialProductMapper;
|
private MaterialProductMapper materialProductMapper;
|
||||||
|
|
||||||
@Lazy
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MaterialBatchService materialBatchService;
|
private MaterialBatchService materialBatchService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MaterialInfomationService materialInfomationService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存分类
|
* 保存分类
|
||||||
*
|
*
|
||||||
@@ -294,4 +296,47 @@ public class MaterialProductServiceImpl implements MaterialProductService {
|
|||||||
return materialProductMapper.selectPage(pageReqVO);
|
return materialProductMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MaterialProductDO getMaterialProductInfo(Long id) {
|
||||||
|
MaterialProductDO mtrlDo = this.getMaterialProduct(id);
|
||||||
|
if (mtrlDo == null) return null;
|
||||||
|
MaterialProductDO prnMtrl = materialProductMapper.selectById(mtrlDo.getParentId());
|
||||||
|
if (prnMtrl == null) return mtrlDo;
|
||||||
|
mtrlDo.setCategoryName(prnMtrl.getName());
|
||||||
|
return mtrlDo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MaterialProductRespVO> getCategoryAndData(String type) {
|
||||||
|
List<MaterialProductDO> mtrlDos;
|
||||||
|
if (DataTypeConstant.DATA_TYPE_CATEGORY.equals(type)) {
|
||||||
|
mtrlDos = materialProductMapper.selectList(Wrappers.lambdaQuery(MaterialProductDO.class)
|
||||||
|
.eq(MaterialProductDO::getNodeType, DataTypeConstant.DATA_TYPE_CATEGORY));
|
||||||
|
} else {
|
||||||
|
mtrlDos = materialProductMapper.selectList();
|
||||||
|
}
|
||||||
|
if (CollUtil.isEmpty(mtrlDos)) return List.of();
|
||||||
|
|
||||||
|
return mtrlDos.stream().map(m -> BeanUtils.toBean(m, MaterialProductRespVO.class)).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MaterialProductRespVO> getMaterialInventoryPage(MaterialProductPageReqVO pageReqVO) {
|
||||||
|
PageResult<MaterialProductDO> pageResult = materialProductMapper.selectPage(pageReqVO);
|
||||||
|
List<MaterialProductDO> mtrlDos = pageResult.getList();
|
||||||
|
if (CollUtil.isEmpty(mtrlDos)) return new PageResult<>(new ArrayList<>(), pageResult.getTotal());
|
||||||
|
List<Long> mtrlIds = mtrlDos.stream().map(MaterialProductDO::getId).toList();
|
||||||
|
List<MaterialProductRespVO> voList = mtrlDos.stream().map(m -> BeanUtils.toBean(m, MaterialProductRespVO.class)).toList();
|
||||||
|
// 一次性获取大类下的库存数量
|
||||||
|
Map<Long, Long> stockQuantityMap = materialInfomationService.getStockQuantityByPdtIds(mtrlIds);
|
||||||
|
if (CollUtil.isNotEmpty(stockQuantityMap)) {
|
||||||
|
for (MaterialProductRespVO vo : voList) {
|
||||||
|
vo.setInventoryQuantity(BigDecimal.valueOf(stockQuantityMap.get(vo.getId())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PageResult<>(voList, pageResult.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user