fix:物料入库、物料库存相关接口
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
package com.zt.plat.module.qms.resource.material.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料常量
|
||||||
|
*/
|
||||||
|
public class MaterialConstants {
|
||||||
|
// 字典 类型
|
||||||
|
public static final String DICT_MATERIAL_FLOW_TYPE = "jy_material_lifecycle_bsn_type";
|
||||||
|
}
|
||||||
@@ -88,10 +88,10 @@ public class MaterialInfomationController implements BusinessControllerMarker {
|
|||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得物料实例分页")
|
@Operation(summary = "获得物料实例分页")
|
||||||
@PreAuthorize("@ss.hasPermission('qms:material-infomation:query')")
|
// @PreAuthorize("@ss.hasPermission('qms:material-infomation:query')")
|
||||||
public CommonResult<PageResult<MaterialInfomationRespVO>> getMaterialInfomationPage(@Valid MaterialInfomationPageReqVO pageReqVO) {
|
public CommonResult<PageResult<MaterialInfomationRespVO>> getMaterialInfomationPage(@Valid MaterialInfomationPageReqVO pageReqVO) {
|
||||||
PageResult<MaterialInfomationDO> pageResult = materialInfomationService.getMaterialInfomationPage(pageReqVO);
|
PageResult<MaterialInfomationRespVO> pageResult = materialInfomationService.getMaterialInfomationPageWithPdtInfo(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, MaterialInfomationRespVO.class));
|
return success(pageResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import java.util.List;
|
|||||||
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 入库明细,验收入库、盘盈入库等")
|
@Tag(name = "管理后台 - 物料入库明细,验收入库、盘盈入库等")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/qms/resource/material-inventory-inbound-detail")
|
@RequestMapping("/qms/resource/material-inventory-inbound-detail")
|
||||||
@Validated
|
@Validated
|
||||||
@@ -85,8 +85,17 @@ public class MaterialInventoryInboundDetailController implements BusinessControl
|
|||||||
@Operation(summary = "获得入库明细,验收入库、盘盈入库等分页")
|
@Operation(summary = "获得入库明细,验收入库、盘盈入库等分页")
|
||||||
// @PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:query')")
|
// @PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:query')")
|
||||||
public CommonResult<PageResult<MaterialInventoryInboundDetailRespVO>> getMaterialInventoryInboundDetailPage(@Valid MaterialInventoryInboundDetailPageReqVO pageReqVO) {
|
public CommonResult<PageResult<MaterialInventoryInboundDetailRespVO>> getMaterialInventoryInboundDetailPage(@Valid MaterialInventoryInboundDetailPageReqVO pageReqVO) {
|
||||||
PageResult<MaterialInventoryInboundDetailDO> pageResult = materialInventoryInboundDetailService.getMaterialInventoryInboundDetailPage(pageReqVO);
|
PageResult<MaterialInventoryInboundDetailRespVO> pageResult = materialInventoryInboundDetailService.getInventoryInboundDetailPageWithMaterialInfo(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, MaterialInventoryInboundDetailRespVO.class));
|
return success(pageResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "根据入库单id获取物料列表")
|
||||||
|
@Parameter(name = "inboundId", description = "入库单id", required = true)
|
||||||
|
// @PreAuthorize("@ss.hasPermission('qms:material-inventory-inbound-detail:query')")
|
||||||
|
public CommonResult<List<MaterialInventoryInboundDetailRespVO>> getMaterialInfoListByInboundId(@RequestParam("inboundId") Long inboundId) {
|
||||||
|
List<MaterialInventoryInboundDetailRespVO> materialInfoList = materialInventoryInboundDetailService.getMaterialInfoListByInboundId(inboundId);
|
||||||
|
return success(materialInfoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
|
|||||||
@@ -52,8 +52,6 @@ public class MaterialLifecycleController extends AbstractFileUploadController im
|
|||||||
@Resource
|
@Resource
|
||||||
private MaterialLifecycleService materialLifecycleService;
|
private MaterialLifecycleService materialLifecycleService;
|
||||||
|
|
||||||
// QMS_RESOURCE_MATERIAL_COMMON
|
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "新建物料流程")
|
@Operation(summary = "新建物料流程")
|
||||||
// @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:create')")
|
// @PreAuthorize("@ss.hasPermission('qms:material-lifecycle:create')")
|
||||||
|
|||||||
@@ -1,110 +0,0 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.controller.admin;
|
|
||||||
|
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationPageReqVO;
|
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationRespVO;
|
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationSaveReqVO;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
|
|
||||||
import jakarta.validation.constraints.*;
|
|
||||||
import jakarta.validation.*;
|
|
||||||
import jakarta.servlet.http.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
|
||||||
import com.zt.plat.framework.common.pojo.PageParam;
|
|
||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
|
||||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
|
||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
|
||||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
|
||||||
|
|
||||||
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
|
||||||
|
|
||||||
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
|
|
||||||
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
|
|
||||||
|
|
||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLocationDO;
|
|
||||||
import com.zt.plat.module.qms.resource.material.service.MaterialLocationService;
|
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 存放位置")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/qms/material-location")
|
|
||||||
@Validated
|
|
||||||
public class MaterialLocationController implements BusinessControllerMarker {
|
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private MaterialLocationService materialLocationService;
|
|
||||||
|
|
||||||
@PostMapping("/create")
|
|
||||||
@Operation(summary = "创建存放位置")
|
|
||||||
@PreAuthorize("@ss.hasPermission('qms:material-location:create')")
|
|
||||||
public CommonResult<MaterialLocationRespVO> createMaterialLocation(@Valid @RequestBody MaterialLocationSaveReqVO createReqVO) {
|
|
||||||
return success(materialLocationService.createMaterialLocation(createReqVO));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PutMapping("/update")
|
|
||||||
@Operation(summary = "更新存放位置")
|
|
||||||
@PreAuthorize("@ss.hasPermission('qms:material-location:update')")
|
|
||||||
public CommonResult<Boolean> updateMaterialLocation(@Valid @RequestBody MaterialLocationSaveReqVO updateReqVO) {
|
|
||||||
materialLocationService.updateMaterialLocation(updateReqVO);
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@DeleteMapping("/delete")
|
|
||||||
@Operation(summary = "删除存放位置")
|
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
|
||||||
@PreAuthorize("@ss.hasPermission('qms:material-location:delete')")
|
|
||||||
public CommonResult<Boolean> deleteMaterialLocation(@RequestParam("id") Long id) {
|
|
||||||
materialLocationService.deleteMaterialLocation(id);
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@DeleteMapping("/delete-list")
|
|
||||||
@Parameter(name = "ids", description = "编号", required = true)
|
|
||||||
@Operation(summary = "批量删除存放位置")
|
|
||||||
@PreAuthorize("@ss.hasPermission('qms:material-location:delete')")
|
|
||||||
public CommonResult<Boolean> deleteMaterialLocationList(@RequestBody BatchDeleteReqVO req) {
|
|
||||||
materialLocationService.deleteMaterialLocationListByIds(req.getIds());
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/get")
|
|
||||||
@Operation(summary = "获得存放位置")
|
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
||||||
@PreAuthorize("@ss.hasPermission('qms:material-location:query')")
|
|
||||||
public CommonResult<MaterialLocationRespVO> getMaterialLocation(@RequestParam("id") Long id) {
|
|
||||||
MaterialLocationDO materialLocation = materialLocationService.getMaterialLocation(id);
|
|
||||||
return success(BeanUtils.toBean(materialLocation, MaterialLocationRespVO.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/page")
|
|
||||||
@Operation(summary = "获得存放位置分页")
|
|
||||||
@PreAuthorize("@ss.hasPermission('qms:material-location:query')")
|
|
||||||
public CommonResult<PageResult<MaterialLocationRespVO>> getMaterialLocationPage(@Valid MaterialLocationPageReqVO pageReqVO) {
|
|
||||||
PageResult<MaterialLocationDO> pageResult = materialLocationService.getMaterialLocationPage(pageReqVO);
|
|
||||||
return success(BeanUtils.toBean(pageResult, MaterialLocationRespVO.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
|
||||||
@Operation(summary = "导出存放位置 Excel")
|
|
||||||
@PreAuthorize("@ss.hasPermission('qms:material-location:export')")
|
|
||||||
@ApiAccessLog(operateType = EXPORT)
|
|
||||||
public void exportMaterialLocationExcel(@Valid MaterialLocationPageReqVO pageReqVO,
|
|
||||||
HttpServletResponse response) throws IOException {
|
|
||||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
||||||
List<MaterialLocationDO> list = materialLocationService.getMaterialLocationPage(pageReqVO).getList();
|
|
||||||
// 导出 Excel
|
|
||||||
ExcelUtils.write(response, "存放位置.xls", "数据", MaterialLocationRespVO.class,
|
|
||||||
BeanUtils.toBean(list, MaterialLocationRespVO.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -38,10 +38,30 @@ public class MaterialInfomationRespVO {
|
|||||||
@ExcelProperty("名称")
|
@ExcelProperty("名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "型号")
|
||||||
|
@ExcelProperty("型号")
|
||||||
|
private String modelNo;
|
||||||
|
|
||||||
|
@Schema(description = "规格")
|
||||||
|
@ExcelProperty("规格")
|
||||||
|
private String specification;
|
||||||
|
|
||||||
@Schema(description = "技术参数")
|
@Schema(description = "技术参数")
|
||||||
@ExcelProperty("技术参数")
|
@ExcelProperty("技术参数")
|
||||||
private String parameter;
|
private String parameter;
|
||||||
|
|
||||||
|
@Schema(description = "制造商")
|
||||||
|
@ExcelProperty("制造商")
|
||||||
|
private String manufacturer;
|
||||||
|
|
||||||
|
@Schema(description = "单位")
|
||||||
|
@ExcelProperty("单位")
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
@Schema(description = "保质期(天)")
|
||||||
|
@ExcelProperty("保质期(天)")
|
||||||
|
private Integer due;
|
||||||
|
|
||||||
@Schema(description = "上架状态,0-未上架,1-已上架", example = "2")
|
@Schema(description = "上架状态,0-未上架,1-已上架", example = "2")
|
||||||
@ExcelProperty("上架状态,0-未上架,1-已上架")
|
@ExcelProperty("上架状态,0-未上架,1-已上架")
|
||||||
private Integer publishStatus;
|
private Integer publishStatus;
|
||||||
|
|||||||
@@ -24,10 +24,6 @@ public class MaterialInventoryInboundDetailRespVO {
|
|||||||
@ExcelProperty("批次id")
|
@ExcelProperty("批次id")
|
||||||
private Long batchId;
|
private Long batchId;
|
||||||
|
|
||||||
// 物料名称
|
|
||||||
|
|
||||||
// 批次编号
|
|
||||||
|
|
||||||
@Schema(description = "批次工段id", example = "1454")
|
@Schema(description = "批次工段id", example = "1454")
|
||||||
@ExcelProperty("批次工段id")
|
@ExcelProperty("批次工段id")
|
||||||
private Long batchGongduanId;
|
private Long batchGongduanId;
|
||||||
@@ -38,6 +34,26 @@ public class MaterialInventoryInboundDetailRespVO {
|
|||||||
@ExcelProperty("物料实例ID")
|
@ExcelProperty("物料实例ID")
|
||||||
private Long materialInfomationId;
|
private Long materialInfomationId;
|
||||||
|
|
||||||
|
@Schema(description = "物料编码")
|
||||||
|
@ExcelProperty("物料编码")
|
||||||
|
private String infomationCode;
|
||||||
|
|
||||||
|
@Schema(description = "物料名称")
|
||||||
|
@ExcelProperty("物料名称")
|
||||||
|
private String infomationName;
|
||||||
|
|
||||||
|
@Schema(description = "业务类型,验收入库、盘盈入库等")
|
||||||
|
@ExcelProperty("业务类型,验收入库、盘盈入库等")
|
||||||
|
private String businessType;
|
||||||
|
|
||||||
|
@Schema(description = "存放位置名称")
|
||||||
|
@ExcelProperty("存放位置名称")
|
||||||
|
private String locationName;
|
||||||
|
|
||||||
|
@Schema(description = "存放位置编码")
|
||||||
|
@ExcelProperty("存放位置编码")
|
||||||
|
private String locationCode;
|
||||||
|
|
||||||
@Schema(description = "入库人", example = "赵六")
|
@Schema(description = "入库人", example = "赵六")
|
||||||
@ExcelProperty("入库人")
|
@ExcelProperty("入库人")
|
||||||
private String inboundUserName;
|
private String inboundUserName;
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.controller.vo;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import com.zt.plat.framework.common.pojo.PageParam;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 存放位置分页 Request VO")
|
|
||||||
@Data
|
|
||||||
public class MaterialLocationPageReqVO extends PageParam {
|
|
||||||
|
|
||||||
@Schema(description = "上级id", example = "9092")
|
|
||||||
private Long parentId;
|
|
||||||
|
|
||||||
@Schema(description = "名称", example = "赵六")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Schema(description = "编码")
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
@Schema(description = "容量")
|
|
||||||
private String capacity;
|
|
||||||
|
|
||||||
@Schema(description = "位置")
|
|
||||||
private String location;
|
|
||||||
|
|
||||||
@Schema(description = "所属部门")
|
|
||||||
private String systemDepartmentCode;
|
|
||||||
|
|
||||||
@Schema(description = "备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
|
||||||
private LocalDateTime[] createTime;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.controller.vo;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.alibaba.excel.annotation.*;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 存放位置 Response VO")
|
|
||||||
@Data
|
|
||||||
@ExcelIgnoreUnannotated
|
|
||||||
public class MaterialLocationRespVO {
|
|
||||||
|
|
||||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32724")
|
|
||||||
@ExcelProperty("主键")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Schema(description = "上级id", example = "9092")
|
|
||||||
@ExcelProperty("上级id")
|
|
||||||
private Long parentId;
|
|
||||||
|
|
||||||
@Schema(description = "名称", example = "赵六")
|
|
||||||
@ExcelProperty("名称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Schema(description = "编码")
|
|
||||||
@ExcelProperty("编码")
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
@Schema(description = "容量")
|
|
||||||
@ExcelProperty("容量")
|
|
||||||
private String capacity;
|
|
||||||
|
|
||||||
@Schema(description = "位置")
|
|
||||||
@ExcelProperty("位置")
|
|
||||||
private String location;
|
|
||||||
|
|
||||||
@Schema(description = "所属部门")
|
|
||||||
@ExcelProperty("所属部门")
|
|
||||||
private String systemDepartmentCode;
|
|
||||||
|
|
||||||
@Schema(description = "备注")
|
|
||||||
@ExcelProperty("备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
|
||||||
@ExcelProperty("创建时间")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.controller.vo;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import jakarta.validation.constraints.*;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 存放位置新增/修改 Request VO")
|
|
||||||
@Data
|
|
||||||
public class MaterialLocationSaveReqVO {
|
|
||||||
|
|
||||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32724")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Schema(description = "上级id", example = "9092")
|
|
||||||
private Long parentId;
|
|
||||||
|
|
||||||
@Schema(description = "名称", example = "赵六")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Schema(description = "编码")
|
|
||||||
private String code;
|
|
||||||
|
|
||||||
@Schema(description = "容量")
|
|
||||||
private String capacity;
|
|
||||||
|
|
||||||
@Schema(description = "位置")
|
|
||||||
private String location;
|
|
||||||
|
|
||||||
@Schema(description = "所属部门")
|
|
||||||
private String systemDepartmentCode;
|
|
||||||
|
|
||||||
@Schema(description = "备注")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.dal.dataobject;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
|
|
||||||
/**
|
|
||||||
* 存放位置 DO
|
|
||||||
*
|
|
||||||
* @author 后台管理
|
|
||||||
*/
|
|
||||||
@TableName("t_mtrl_loc")
|
|
||||||
@KeySequence("t_mtrl_loc_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
@Builder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
/**
|
|
||||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
|
||||||
*/
|
|
||||||
public class MaterialLocationDO extends BusinessBaseDO {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键
|
|
||||||
*/
|
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
* 上级id
|
|
||||||
*/
|
|
||||||
@TableField("PRN_ID")
|
|
||||||
private Long parentId;
|
|
||||||
/**
|
|
||||||
* 名称
|
|
||||||
*/
|
|
||||||
@TableField("NAME")
|
|
||||||
private String name;
|
|
||||||
/**
|
|
||||||
* 编码
|
|
||||||
*/
|
|
||||||
@TableField("CD")
|
|
||||||
private String code;
|
|
||||||
/**
|
|
||||||
* 容量
|
|
||||||
*/
|
|
||||||
@TableField("CPY")
|
|
||||||
private String capacity;
|
|
||||||
/**
|
|
||||||
* 位置
|
|
||||||
*/
|
|
||||||
@TableField("LOC")
|
|
||||||
private String location;
|
|
||||||
/**
|
|
||||||
* 所属部门
|
|
||||||
*/
|
|
||||||
@TableField("SYS_DEPT_CD")
|
|
||||||
private String systemDepartmentCode;
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
@TableField("RMK")
|
|
||||||
private String remark;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -13,6 +13,7 @@ import com.zt.plat.module.qms.resource.material.controller.vo.MaterialBatchPageR
|
|||||||
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.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 com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
|
||||||
|
import com.zt.plat.module.qms.resource.material.enums.MaterialAcceptStatus;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -92,7 +93,9 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
|
|||||||
// 只查询工段
|
// 只查询工段
|
||||||
.ne(MaterialBatchDO::getParentId, 0)
|
.ne(MaterialBatchDO::getParentId, 0)
|
||||||
.eq(MaterialBatchDO::getSubmitStatus, 1)
|
.eq(MaterialBatchDO::getSubmitStatus, 1)
|
||||||
.notExists("SELECT 1 FROM t_mtrl_lfc_dtl ld WHERE ld.BAT_GONG_ID = t.ID AND ld.DELETED = 0")
|
.ne(MaterialBatchDO::getAcceptanceStatus, MaterialAcceptStatus.accepted.name())
|
||||||
|
// 未处理的不允许再次选择
|
||||||
|
.notExists("SELECT 1 FROM t_mtrl_lfc_dtl ld WHERE ld.BAT_GONG_ID = t.ID AND ld.TMT_STS = 0 AND ld.DELETED = 0")
|
||||||
// .eq(onlyGong != null && visitDeptId != null && onlyGong, MaterialBatchDO::getAssignDepartmentId, visitDeptId)
|
// .eq(onlyGong != null && visitDeptId != null && onlyGong, MaterialBatchDO::getAssignDepartmentId, visitDeptId)
|
||||||
.in(CollUtil.isNotEmpty(pdtIds), MaterialBatchDO::getProductId, pdtIds)
|
.in(CollUtil.isNotEmpty(pdtIds), MaterialBatchDO::getProductId, pdtIds)
|
||||||
.eq(CollUtil.isEmpty(pdtIds) && reqVO.getProductId() != null, MaterialBatchDO::getProductId, reqVO.getProductId())
|
.eq(CollUtil.isEmpty(pdtIds) && reqVO.getProductId() != null, MaterialBatchDO::getProductId, reqVO.getProductId())
|
||||||
@@ -129,7 +132,7 @@ public interface MaterialBatchMapper extends BaseMapperX<MaterialBatchDO> {
|
|||||||
// 只查询工段
|
// 只查询工段
|
||||||
.ne(MaterialBatchDO::getParentId, 0)
|
.ne(MaterialBatchDO::getParentId, 0)
|
||||||
.eq(MaterialBatchDO::getSubmitStatus, 1)
|
.eq(MaterialBatchDO::getSubmitStatus, 1)
|
||||||
.eq(MaterialBatchDO::getAcceptanceStatus, QmsCommonConstant.COMPLETED)
|
.eq(MaterialBatchDO::getAcceptanceStatus, reqVO.getAcceptanceStatus())
|
||||||
// .eq(onlyGong != null && visitDeptId != null && onlyGong, MaterialBatchDO::getAssignDepartmentId, visitDeptId)
|
// .eq(onlyGong != null && visitDeptId != null && onlyGong, MaterialBatchDO::getAssignDepartmentId, visitDeptId)
|
||||||
.in(CollUtil.isNotEmpty(pdtIds), MaterialBatchDO::getProductId, pdtIds)
|
.in(CollUtil.isNotEmpty(pdtIds), MaterialBatchDO::getProductId, pdtIds)
|
||||||
.eq(CollUtil.isEmpty(pdtIds) && reqVO.getProductId() != null, MaterialBatchDO::getProductId, reqVO.getProductId())
|
.eq(CollUtil.isEmpty(pdtIds) && reqVO.getProductId() != null, MaterialBatchDO::getProductId, reqVO.getProductId())
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.dal.mapper;
|
package com.zt.plat.module.qms.resource.material.dal.mapper;
|
||||||
|
|
||||||
|
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.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationPageReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationPageReqVO;
|
||||||
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationRespVO;
|
||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO;
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO;
|
||||||
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,4 +46,42 @@ public interface MaterialInfomationMapper extends BaseMapperX<MaterialInfomation
|
|||||||
.orderByDesc(MaterialInfomationDO::getId));
|
.orderByDesc(MaterialInfomationDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default PageResult<MaterialInfomationRespVO> selectPageWithPdtInfo(MaterialInfomationPageReqVO reqVO) {
|
||||||
|
MPJLambdaWrapper<MaterialInfomationDO> wrapper = new MPJLambdaWrapperX<MaterialInfomationDO>()
|
||||||
|
.select(MaterialInfomationDO::getId,
|
||||||
|
MaterialInfomationDO::getProductId, MaterialInfomationDO::getBatchId, MaterialInfomationDO::getGongduanId,
|
||||||
|
MaterialInfomationDO::getCode, MaterialInfomationDO::getPublishStatus,
|
||||||
|
MaterialInfomationDO::getUsageStatus, MaterialInfomationDO::getManagerDepartmentId,
|
||||||
|
MaterialInfomationDO::getManagerDepartmentName, MaterialInfomationDO::getManagerUserId, MaterialInfomationDO::getManagerUserName,
|
||||||
|
MaterialInfomationDO::getOpenStatus, MaterialInfomationDO::getOpenUserId, MaterialInfomationDO::getOpenUserName,
|
||||||
|
MaterialInfomationDO::getOpenDate, MaterialInfomationDO::getExpirationDate, MaterialInfomationDO::getExpirationFlag,
|
||||||
|
MaterialInfomationDO::getRemainingVolume, MaterialInfomationDO::getUseEndFlag,
|
||||||
|
MaterialInfomationDO::getSystemDepartmentCode, MaterialInfomationDO::getRemark,
|
||||||
|
MaterialInfomationDO::getCreateTime, MaterialInfomationDO::getUpdateTime)
|
||||||
|
.select(MaterialProductDO::getName, MaterialProductDO::getSpecification,
|
||||||
|
MaterialProductDO::getModelNo, MaterialProductDO::getParameter, MaterialProductDO::getManufacturer,
|
||||||
|
MaterialProductDO::getUnit, MaterialProductDO::getDue)
|
||||||
|
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialInfomationDO::getProductId)
|
||||||
|
.eqIfExists(MaterialInfomationDO::getProductId, reqVO.getProductId())
|
||||||
|
.eqIfExists(MaterialInfomationDO::getBatchId, reqVO.getBatchId())
|
||||||
|
.eqIfExists(MaterialInfomationDO::getLocationId, reqVO.getLocationId())
|
||||||
|
.eqIfExists(MaterialInfomationDO::getCode, reqVO.getCode())
|
||||||
|
.eqIfExists(MaterialProductDO::getParameter, reqVO.getParameter())
|
||||||
|
.eqIfExists(MaterialInfomationDO::getPublishStatus, reqVO.getPublishStatus())
|
||||||
|
.eqIfExists(MaterialInfomationDO::getUsageStatus, reqVO.getUsageStatus())
|
||||||
|
.eqIfExists(MaterialInfomationDO::getManagerDepartmentId, reqVO.getManagerDepartmentId())
|
||||||
|
.likeIfExists(MaterialInfomationDO::getManagerDepartmentName, reqVO.getManagerDepartmentName())
|
||||||
|
.eqIfExists(MaterialInfomationDO::getManagerUserId, reqVO.getManagerUserId())
|
||||||
|
.likeIfExists(MaterialInfomationDO::getManagerUserName, reqVO.getManagerUserName())
|
||||||
|
.eqIfExists(MaterialInfomationDO::getOpenStatus, reqVO.getOpenStatus())
|
||||||
|
.eqIfExists(MaterialInfomationDO::getOpenUserId, reqVO.getOpenUserId())
|
||||||
|
.likeIfExists(MaterialInfomationDO::getOpenUserName, reqVO.getOpenUserName())
|
||||||
|
.eqIfExists(MaterialInfomationDO::getExpirationFlag, reqVO.getExpirationFlag())
|
||||||
|
.eqIfExists(MaterialInfomationDO::getUseEndFlag, reqVO.getUseEndFlag())
|
||||||
|
.eqIfExists(MaterialInfomationDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
|
||||||
|
.likeIfExists(MaterialInfomationDO::getRemark, reqVO.getRemark())
|
||||||
|
.orderByDesc(MaterialInfomationDO::getId);
|
||||||
|
return selectJoinPage(reqVO, MaterialInfomationRespVO.class, wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,10 +3,18 @@ package com.zt.plat.module.qms.resource.material.dal.mapper;
|
|||||||
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;
|
||||||
|
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
|
||||||
|
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigWarehouseLocationDO;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundDetailPageReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundDetailPageReqVO;
|
||||||
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInventoryInboundDetailRespVO;
|
||||||
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO;
|
||||||
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryInboundDO;
|
||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryInboundDetailDO;
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInventoryInboundDetailDO;
|
||||||
|
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 入库明细,验收入库、盘盈入库等 Mapper
|
* 入库明细,验收入库、盘盈入库等 Mapper
|
||||||
*
|
*
|
||||||
@@ -32,4 +40,47 @@ public interface MaterialInventoryInboundDetailMapper extends BaseMapperX<Materi
|
|||||||
.orderByDesc(MaterialInventoryInboundDetailDO::getId));
|
.orderByDesc(MaterialInventoryInboundDetailDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default PageResult<MaterialInventoryInboundDetailRespVO> selectPageWithMaterialInfo(MaterialInventoryInboundDetailPageReqVO reqVO){
|
||||||
|
MPJLambdaWrapperX<MaterialInventoryInboundDetailDO> wrapperX = new MPJLambdaWrapperX<MaterialInventoryInboundDetailDO>()
|
||||||
|
.selectAll(MaterialInventoryInboundDetailDO.class)
|
||||||
|
.selectAs(MaterialInfomationDO::getCode, MaterialInventoryInboundDetailRespVO::getInfomationCode)
|
||||||
|
.selectAs(MaterialProductDO::getName, MaterialInventoryInboundDetailRespVO::getInfomationName)
|
||||||
|
.selectAs(MaterialInventoryInboundDO::getBusinessType, MaterialInventoryInboundDetailRespVO::getBusinessType)
|
||||||
|
.selectAs(ConfigWarehouseLocationDO::getName, MaterialInventoryInboundDetailRespVO::getLocationName)
|
||||||
|
.selectAs(ConfigWarehouseLocationDO::getCode, MaterialInventoryInboundDetailRespVO::getLocationCode)
|
||||||
|
.leftJoin(MaterialInfomationDO.class, MaterialInfomationDO::getId, MaterialInventoryInboundDetailDO::getMaterialInfomationId)
|
||||||
|
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialInfomationDO::getProductId)
|
||||||
|
.leftJoin(MaterialInventoryInboundDO.class, MaterialInventoryInboundDO::getId, MaterialInventoryInboundDetailDO::getInboundId)
|
||||||
|
.leftJoin(ConfigWarehouseLocationDO.class, ConfigWarehouseLocationDO::getId, MaterialInfomationDO::getLocationId)
|
||||||
|
.eqIfPresent(MaterialInventoryInboundDetailDO::getInboundId, reqVO.getInboundId())
|
||||||
|
.eqIfPresent(MaterialInventoryInboundDetailDO::getBatchId, reqVO.getBatchId())
|
||||||
|
.eqIfPresent(MaterialInventoryInboundDetailDO::getBatchGongduanId, reqVO.getBatchGongduanId())
|
||||||
|
.eqIfPresent(MaterialInventoryInboundDetailDO::getMaterialInfomationId, reqVO.getMaterialInfomationId())
|
||||||
|
.likeIfPresent(MaterialInventoryInboundDetailDO::getInboundUserName, reqVO.getInboundUserName())
|
||||||
|
.eqIfPresent(MaterialInventoryInboundDetailDO::getInboundUserId, reqVO.getInboundUserId())
|
||||||
|
.likeIfPresent(MaterialInventoryInboundDetailDO::getInboundDepartmentName, reqVO.getInboundDepartmentName())
|
||||||
|
.eqIfPresent(MaterialInventoryInboundDetailDO::getInboundDepartmentId, reqVO.getInboundDepartmentId())
|
||||||
|
.betweenIfPresent(MaterialInventoryInboundDetailDO::getInboundTime, reqVO.getInboundTime())
|
||||||
|
.eqIfPresent(MaterialInventoryInboundDetailDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
|
||||||
|
.eqIfPresent(MaterialInventoryInboundDetailDO::getRemark, reqVO.getRemark())
|
||||||
|
.betweenIfPresent(MaterialInventoryInboundDetailDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(MaterialInventoryInboundDetailDO::getInboundId);
|
||||||
|
return selectJoinPage(reqVO, MaterialInventoryInboundDetailRespVO.class, wrapperX);
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<MaterialInventoryInboundDetailRespVO> selectMaterialInfoListByInboundId(Long inboundId) {
|
||||||
|
MPJLambdaWrapperX<MaterialInventoryInboundDetailDO> wrapperX = new MPJLambdaWrapperX<MaterialInventoryInboundDetailDO>()
|
||||||
|
.selectAll(MaterialInventoryInboundDetailDO.class)
|
||||||
|
.selectAs(MaterialInfomationDO::getCode, MaterialInventoryInboundDetailRespVO::getInfomationCode)
|
||||||
|
.selectAs(MaterialProductDO::getName, MaterialInventoryInboundDetailRespVO::getInfomationName)
|
||||||
|
.selectAs(MaterialInventoryInboundDO::getBusinessType, MaterialInventoryInboundDetailRespVO::getBusinessType)
|
||||||
|
.selectAs(ConfigWarehouseLocationDO::getName, MaterialInventoryInboundDetailRespVO::getLocationName)
|
||||||
|
.selectAs(ConfigWarehouseLocationDO::getCode, MaterialInventoryInboundDetailRespVO::getLocationCode)
|
||||||
|
.leftJoin(MaterialInfomationDO.class, MaterialInfomationDO::getId, MaterialInventoryInboundDetailDO::getMaterialInfomationId)
|
||||||
|
.leftJoin(MaterialProductDO.class, MaterialProductDO::getId, MaterialInfomationDO::getProductId)
|
||||||
|
.leftJoin(MaterialInventoryInboundDO.class, MaterialInventoryInboundDO::getId, MaterialInventoryInboundDetailDO::getInboundId)
|
||||||
|
.leftJoin(ConfigWarehouseLocationDO.class, ConfigWarehouseLocationDO::getId, MaterialInfomationDO::getLocationId)
|
||||||
|
.eqIfPresent(MaterialInventoryInboundDetailDO::getInboundId, inboundId);
|
||||||
|
return selectJoinList(MaterialInventoryInboundDetailRespVO.class, wrapperX);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.dal.mapper;
|
|
||||||
|
|
||||||
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.module.qms.resource.material.controller.vo.MaterialLocationPageReqVO;
|
|
||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLocationDO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 存放位置 Mapper
|
|
||||||
*
|
|
||||||
* @author 后台管理
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface MaterialLocationMapper extends BaseMapperX<MaterialLocationDO> {
|
|
||||||
|
|
||||||
default PageResult<MaterialLocationDO> selectPage(MaterialLocationPageReqVO reqVO) {
|
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<MaterialLocationDO>()
|
|
||||||
.eqIfPresent(MaterialLocationDO::getParentId, reqVO.getParentId())
|
|
||||||
.likeIfPresent(MaterialLocationDO::getName, reqVO.getName())
|
|
||||||
.eqIfPresent(MaterialLocationDO::getCode, reqVO.getCode())
|
|
||||||
.eqIfPresent(MaterialLocationDO::getCapacity, reqVO.getCapacity())
|
|
||||||
.eqIfPresent(MaterialLocationDO::getLocation, reqVO.getLocation())
|
|
||||||
.eqIfPresent(MaterialLocationDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
|
|
||||||
.eqIfPresent(MaterialLocationDO::getRemark, reqVO.getRemark())
|
|
||||||
.betweenIfPresent(MaterialLocationDO::getCreateTime, reqVO.getCreateTime())
|
|
||||||
.orderByDesc(MaterialLocationDO::getId));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.zt.plat.module.qms.resource.material.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料验收状态
|
||||||
|
*/
|
||||||
|
public enum MaterialAcceptStatus {
|
||||||
|
accepted,
|
||||||
|
partAccepted,
|
||||||
|
notAccepted
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.zt.plat.module.qms.resource.material.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum MaterialFlowType {
|
||||||
|
|
||||||
|
acceptance("验收"),
|
||||||
|
|
||||||
|
return_exchange("退换货"),
|
||||||
|
|
||||||
|
config_apply("配置申请");
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
MaterialFlowType(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MaterialFlowType fromName(String name) {
|
||||||
|
for (MaterialFlowType type : MaterialFlowType.values()) {
|
||||||
|
if (type.getName().equals(name)) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("No enum constant with name: " + name);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialBatchDO;
|
|||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO;
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO;
|
||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialProductDO;
|
||||||
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialBatchMapper;
|
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialBatchMapper;
|
||||||
|
import com.zt.plat.module.qms.resource.material.enums.MaterialAcceptStatus;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -54,7 +55,7 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
|
|||||||
public MaterialBatchRespVO createMaterialBatch(MaterialBatchSaveReqVO createReqVO) {
|
public MaterialBatchRespVO createMaterialBatch(MaterialBatchSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
MaterialBatchDO mtrlBat = BeanUtils.toBean(createReqVO, MaterialBatchDO.class);
|
MaterialBatchDO mtrlBat = BeanUtils.toBean(createReqVO, MaterialBatchDO.class);
|
||||||
|
mtrlBat.setAcceptanceStatus(MaterialAcceptStatus.notAccepted.name());
|
||||||
// 批次编号
|
// 批次编号
|
||||||
mtrlBat.setBatchNo(sequenceUtil.genCode(batchSequenceKey));
|
mtrlBat.setBatchNo(sequenceUtil.genCode(batchSequenceKey));
|
||||||
|
|
||||||
@@ -162,6 +163,13 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
|
|||||||
List<MaterialBatchRespVO> voList = pageResult.getList();
|
List<MaterialBatchRespVO> voList = pageResult.getList();
|
||||||
if (CollUtil.isNotEmpty(voList)) {
|
if (CollUtil.isNotEmpty(voList)) {
|
||||||
List<MaterialBatchRespVO> treeVos = this.listTransTree(voList, 0L);
|
List<MaterialBatchRespVO> treeVos = this.listTransTree(voList, 0L);
|
||||||
|
for (MaterialBatchRespVO batch : treeVos) {
|
||||||
|
List<MaterialBatchRespVO> children = batch.getChildren();
|
||||||
|
if (CollUtil.isEmpty(children)) continue;
|
||||||
|
children.forEach(child ->
|
||||||
|
batch.setInboundEndQuantity(batch.getInboundEndQuantity().add(child.getInboundEndQuantity()))
|
||||||
|
);
|
||||||
|
}
|
||||||
pageResult.setList(treeVos);
|
pageResult.setList(treeVos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,7 +279,7 @@ public class MaterialBatchServiceImpl implements MaterialBatchService {
|
|||||||
@Override
|
@Override
|
||||||
public PageResult<MaterialBatchRespVO> getMaterialBatchGongPageWithPdtInfo(MaterialBatchPageReqVO pageReqVO) {
|
public PageResult<MaterialBatchRespVO> getMaterialBatchGongPageWithPdtInfo(MaterialBatchPageReqVO pageReqVO) {
|
||||||
Long pdtId = pageReqVO.getProductId();
|
Long pdtId = pageReqVO.getProductId();
|
||||||
if (QmsCommonConstant.COMPLETED.equals(pageReqVO.getAcceptanceStatus())) {
|
if (MaterialAcceptStatus.accepted.name().equals(pageReqVO.getAcceptanceStatus())) {
|
||||||
// 用于入库
|
// 用于入库
|
||||||
if (pdtId == null) {
|
if (pdtId == null) {
|
||||||
return materialBatchMapper.selectAcceptedGongPage(pageReqVO, List.of());
|
return materialBatchMapper.selectAcceptedGongPage(pageReqVO, List.of());
|
||||||
|
|||||||
@@ -75,4 +75,12 @@ public interface MaterialInfomationService {
|
|||||||
* @param infomationDOS 物料实例
|
* @param infomationDOS 物料实例
|
||||||
*/
|
*/
|
||||||
void saveBatch(List<MaterialInfomationDO> infomationDOS);
|
void saveBatch(List<MaterialInfomationDO> infomationDOS);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得物料实例分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 物料实例分页
|
||||||
|
*/
|
||||||
|
PageResult<MaterialInfomationRespVO> getMaterialInfomationPageWithPdtInfo(@Valid MaterialInfomationPageReqVO pageReqVO);
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,7 @@ import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomation
|
|||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationSaveReqVO;
|
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialInfomationSaveReqVO;
|
||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO;
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialInfomationDO;
|
||||||
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInfomationMapper;
|
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialInfomationMapper;
|
||||||
|
import groovy.util.logging.Slf4j;
|
||||||
import jakarta.annotation.Resource;
|
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;
|
||||||
@@ -27,6 +28,8 @@ import static com.zt.plat.module.qms.enums.ErrorCodeConstants.MATERIAL_INFOMATIO
|
|||||||
*
|
*
|
||||||
* @author 后台管理
|
* @author 后台管理
|
||||||
*/
|
*/
|
||||||
|
@lombok.extern.slf4j.Slf4j
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@Validated
|
@Validated
|
||||||
public class MaterialInfomationServiceImpl implements MaterialInfomationService {
|
public class MaterialInfomationServiceImpl implements MaterialInfomationService {
|
||||||
@@ -103,7 +106,7 @@ public class MaterialInfomationServiceImpl implements MaterialInfomationService
|
|||||||
|
|
||||||
return maps.stream().collect(Collectors.toMap(
|
return maps.stream().collect(Collectors.toMap(
|
||||||
map -> (Long) map.get("PDT_ID"),
|
map -> (Long) map.get("PDT_ID"),
|
||||||
map -> ((Long) map.get("quantity"))
|
map -> (Long) map.get("QUANTITY")
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,4 +115,9 @@ public class MaterialInfomationServiceImpl implements MaterialInfomationService
|
|||||||
materialInfomationMapper.insertBatch(infomationDOS);
|
materialInfomationMapper.insertBatch(infomationDOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MaterialInfomationRespVO> getMaterialInfomationPageWithPdtInfo(MaterialInfomationPageReqVO pageReqVO) {
|
||||||
|
return materialInfomationMapper.selectPageWithPdtInfo(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -67,4 +67,20 @@ public interface MaterialInventoryInboundDetailService {
|
|||||||
* @param detailList 入库明细
|
* @param detailList 入库明细
|
||||||
*/
|
*/
|
||||||
void saveBatch(List<MaterialInventoryInboundDetailDO> detailList);
|
void saveBatch(List<MaterialInventoryInboundDetailDO> detailList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取包含物料信息的入库明细
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 分页数据
|
||||||
|
*/
|
||||||
|
PageResult<MaterialInventoryInboundDetailRespVO> getInventoryInboundDetailPageWithMaterialInfo(@Valid MaterialInventoryInboundDetailPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据入库单ID 获取物料列表
|
||||||
|
*
|
||||||
|
* @param inboundId 入库单ID
|
||||||
|
* @return 物料列表
|
||||||
|
*/
|
||||||
|
List<MaterialInventoryInboundDetailRespVO> getMaterialInfoListByInboundId(Long inboundId);
|
||||||
}
|
}
|
||||||
@@ -91,4 +91,17 @@ public class MaterialInventoryInboundDetailServiceImpl implements MaterialInvent
|
|||||||
materialInventoryInboundDetailMapper.insertBatch(detailList);
|
materialInventoryInboundDetailMapper.insertBatch(detailList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MaterialInventoryInboundDetailRespVO> getInventoryInboundDetailPageWithMaterialInfo(MaterialInventoryInboundDetailPageReqVO pageReqVO) {
|
||||||
|
|
||||||
|
return materialInventoryInboundDetailMapper.selectPageWithMaterialInfo(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MaterialInventoryInboundDetailRespVO> getMaterialInfoListByInboundId(Long inboundId) {
|
||||||
|
|
||||||
|
return materialInventoryInboundDetailMapper.selectMaterialInfoListByInboundId(inboundId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -107,6 +107,7 @@ public class MaterialInventoryInboundServiceImpl implements MaterialInventoryInb
|
|||||||
.setProductId(productId).setBatchId(batchId)
|
.setProductId(productId).setBatchId(batchId)
|
||||||
.setLocationId(createReqVO.getLocationId())
|
.setLocationId(createReqVO.getLocationId())
|
||||||
.setGongduanId(gongduanId)
|
.setGongduanId(gongduanId)
|
||||||
|
.setName(product.getName())
|
||||||
.setSpecification(product.getSpecification()).setModelNo(product.getModelNo())
|
.setSpecification(product.getSpecification()).setModelNo(product.getModelNo())
|
||||||
.setParameter(product.getParameter())
|
.setParameter(product.getParameter())
|
||||||
.setManufacturer(product.getManufacturer()).setUnit(product.getUnit())
|
.setManufacturer(product.getManufacturer()).setUnit(product.getUnit())
|
||||||
|
|||||||
@@ -101,9 +101,9 @@ public interface MaterialLifecycleDetailService {
|
|||||||
* 更新流程明细状态
|
* 更新流程明细状态
|
||||||
*
|
*
|
||||||
* @param lfcId 流程id
|
* @param lfcId 流程id
|
||||||
* @param status 状态
|
* @param isTreat 是否已处理
|
||||||
*/
|
*/
|
||||||
void updateDetailTreatStatusByLfcId(Long lfcId, String status);
|
void updateDetailTreatStatusByLfcId(Long lfcId, Boolean isTreat);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据流程id 获取流程明细数据
|
* 根据流程id 获取流程明细数据
|
||||||
|
|||||||
@@ -125,9 +125,8 @@ public class MaterialLifecycleDetailServiceImpl implements MaterialLifecycleDeta
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateDetailTreatStatusByLfcId(Long lfcId, String status) {
|
public void updateDetailTreatStatusByLfcId(Long lfcId, Boolean isTreat) {
|
||||||
boolean isCompleted = QmsCommonConstant.COMPLETED.equals(status);
|
MaterialLifecycleDetailDO detailUpdate = new MaterialLifecycleDetailDO().setTreatmentStatus(isTreat ? 1 : 0);
|
||||||
MaterialLifecycleDetailDO detailUpdate = new MaterialLifecycleDetailDO().setTreatmentStatus(isCompleted ? 1 : 0);
|
|
||||||
materialLifecycleDetailMapper.update(detailUpdate, Wrappers.lambdaQuery(MaterialLifecycleDetailDO.class)
|
materialLifecycleDetailMapper.update(detailUpdate, Wrappers.lambdaQuery(MaterialLifecycleDetailDO.class)
|
||||||
.eq(MaterialLifecycleDetailDO::getLifecycleId, lfcId));
|
.eq(MaterialLifecycleDetailDO::getLifecycleId, lfcId));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,19 @@ import com.zt.plat.module.bpm.api.task.dto.BpmTaskRespDTO;
|
|||||||
import com.zt.plat.module.qms.api.task.BMPCallbackInterface;
|
import com.zt.plat.module.qms.api.task.BMPCallbackInterface;
|
||||||
import com.zt.plat.module.qms.api.task.dto.QmsBpmDTO;
|
import com.zt.plat.module.qms.api.task.dto.QmsBpmDTO;
|
||||||
import com.zt.plat.module.qms.common.data.service.DataKeyCheckService;
|
import com.zt.plat.module.qms.common.data.service.DataKeyCheckService;
|
||||||
|
import com.zt.plat.module.qms.common.dic.controller.vo.DictionaryBusinessRespVO;
|
||||||
|
import com.zt.plat.module.qms.common.dic.dal.dataobject.DictionaryBusinessDO;
|
||||||
|
import com.zt.plat.module.qms.common.dic.service.DictionaryBusinessService;
|
||||||
import com.zt.plat.module.qms.enums.QmsBpmConstant;
|
import com.zt.plat.module.qms.enums.QmsBpmConstant;
|
||||||
import com.zt.plat.module.qms.enums.QmsCommonConstant;
|
import com.zt.plat.module.qms.enums.QmsCommonConstant;
|
||||||
|
import com.zt.plat.module.qms.resource.material.constant.MaterialConstants;
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.*;
|
import com.zt.plat.module.qms.resource.material.controller.vo.*;
|
||||||
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.MaterialLifecycleDO;
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDO;
|
||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO;
|
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLifecycleDetailDO;
|
||||||
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialLifecycleMapper;
|
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialLifecycleMapper;
|
||||||
|
import com.zt.plat.module.qms.resource.material.enums.MaterialAcceptStatus;
|
||||||
|
import com.zt.plat.module.qms.resource.material.enums.MaterialFlowType;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -76,6 +82,9 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService ,
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DataKeyCheckService dataKeyCheckService;
|
private DataKeyCheckService dataKeyCheckService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DictionaryBusinessService dictionaryBusinessService;
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public MaterialLifecycleRespVO createMaterialLifecycle(MaterialLifecycleSaveReqVO createReqVO) {
|
public MaterialLifecycleRespVO createMaterialLifecycle(MaterialLifecycleSaveReqVO createReqVO) {
|
||||||
@@ -282,18 +291,15 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService ,
|
|||||||
BpmProcessInstanceCreateReqDTO reqDTO = new BpmProcessInstanceCreateReqDTO();
|
BpmProcessInstanceCreateReqDTO reqDTO = new BpmProcessInstanceCreateReqDTO();
|
||||||
reqDTO.setBusinessKey(String.valueOf(lifecycleDO.getId()))
|
reqDTO.setBusinessKey(String.valueOf(lifecycleDO.getId()))
|
||||||
.setVariables(variables);
|
.setVariables(variables);
|
||||||
// TODO 流程key根据业务类型动态获取
|
// 流程key 根据业务类型动态获取
|
||||||
switch (lifecycleDO.getBusinessType()) {
|
List<DictionaryBusinessDO> items = dictionaryBusinessService.queryDictItemsByKey(MaterialConstants.DICT_MATERIAL_FLOW_TYPE);
|
||||||
case "验收":
|
if (CollUtil.isEmpty(items)) throw new ServiceException(1_032_160_000, "流程配置不存在");
|
||||||
reqDTO.setProcessDefinitionKey("QMS_RESOURCE_MATERIAL_ACCEPTANCE");
|
Map<String, String> processKeyMap = items.stream().collect(Collectors.toMap(DictionaryBusinessDO::getName, DictionaryBusinessDO::getCustomConfig));
|
||||||
break;
|
MaterialFlowType materialFlowType = MaterialFlowType.fromName(lifecycleDO.getBusinessType());
|
||||||
case "退换货":
|
Object processKey = JSONUtil.parseObj(processKeyMap.get(materialFlowType.getName())).get("processKey");
|
||||||
reqDTO.setProcessDefinitionKey("QMS_RESOURCE_MATERIAL_RETURN_EXCHANGE");
|
if (processKey == null) throw new ServiceException(1_032_160_000, "流程配置 key 不存在");
|
||||||
break;
|
|
||||||
case "配置申请":
|
reqDTO.setProcessDefinitionKey(processKey.toString());
|
||||||
reqDTO.setProcessDefinitionKey("QMS_RESOURCE_MATERIAL_CONFIG_APPLY");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
CommonResult<String> result = bpmProcessInstanceApi.createProcessInstance(loginUserId, reqDTO);
|
CommonResult<String> result = bpmProcessInstanceApi.createProcessInstance(loginUserId, reqDTO);
|
||||||
if(!result.isSuccess()){
|
if(!result.isSuccess()){
|
||||||
throw exception0(ERROR_CODE_MODULE_COMMON, result.getMsg());
|
throw exception0(ERROR_CODE_MODULE_COMMON, result.getMsg());
|
||||||
@@ -356,12 +362,15 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService ,
|
|||||||
// 根据流程状态处理业务数据
|
// 根据流程状态处理业务数据
|
||||||
if(("1").equals(returnFlag)){
|
if(("1").equals(returnFlag)){
|
||||||
// 驳回。流程需要配置退回到发起节点
|
// 驳回。流程需要配置退回到发起节点
|
||||||
|
materialLifecycleDetailService.updateDetailTreatStatusByLfcId(entity.getId(), true);
|
||||||
entity.setFlowStatus(QmsCommonConstant.REJECTED);
|
entity.setFlowStatus(QmsCommonConstant.REJECTED);
|
||||||
} else if("3".equals(PROCESS_STATUS)){
|
} else if("3".equals(PROCESS_STATUS)){
|
||||||
// 拒绝
|
// 拒绝
|
||||||
|
materialLifecycleDetailService.updateDetailTreatStatusByLfcId(entity.getId(), true);
|
||||||
entity.setFlowStatus(QmsCommonConstant.REFUSED);
|
entity.setFlowStatus(QmsCommonConstant.REFUSED);
|
||||||
} else if("4".equals(PROCESS_STATUS)){
|
} else if("4".equals(PROCESS_STATUS)){
|
||||||
// 作废
|
// 作废
|
||||||
|
materialLifecycleDetailService.updateDetailTreatStatusByLfcId(entity.getId(), true);
|
||||||
entity.setFlowStatus(QmsCommonConstant.VOID);
|
entity.setFlowStatus(QmsCommonConstant.VOID);
|
||||||
} else if("1".equals(PROCESS_STATUS) || "2".equals(PROCESS_STATUS)){
|
} else if("1".equals(PROCESS_STATUS) || "2".equals(PROCESS_STATUS)){
|
||||||
// 通过
|
// 通过
|
||||||
@@ -372,9 +381,9 @@ public class MaterialLifecycleServiceImpl implements MaterialLifecycleService ,
|
|||||||
// 结束审批
|
// 结束审批
|
||||||
entity.setFlowStatus(QmsCommonConstant.COMPLETED);
|
entity.setFlowStatus(QmsCommonConstant.COMPLETED);
|
||||||
// 更新明细处理状态
|
// 更新明细处理状态
|
||||||
materialLifecycleDetailService.updateDetailTreatStatusByLfcId(entity.getId(), QmsCommonConstant.COMPLETED);
|
materialLifecycleDetailService.updateDetailTreatStatusByLfcId(entity.getId(), true);
|
||||||
// 更新批次工段验收状态
|
// 更新批次工段验收状态
|
||||||
materialBatchService.updateMaterialBatchAcceptStatusByLfcId(entity.getId(), QmsCommonConstant.COMPLETED);
|
materialBatchService.updateMaterialBatchAcceptStatusByLfcId(entity.getId(), MaterialAcceptStatus.accepted.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.service;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationPageReqVO;
|
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationRespVO;
|
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationSaveReqVO;
|
|
||||||
import jakarta.validation.*;
|
|
||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLocationDO;
|
|
||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 存放位置 Service 接口
|
|
||||||
*
|
|
||||||
* @author 后台管理
|
|
||||||
*/
|
|
||||||
public interface MaterialLocationService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建存放位置
|
|
||||||
*
|
|
||||||
* @param createReqVO 创建信息
|
|
||||||
* @return 编号
|
|
||||||
*/
|
|
||||||
MaterialLocationRespVO createMaterialLocation(@Valid MaterialLocationSaveReqVO createReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新存放位置
|
|
||||||
*
|
|
||||||
* @param updateReqVO 更新信息
|
|
||||||
*/
|
|
||||||
void updateMaterialLocation(@Valid MaterialLocationSaveReqVO updateReqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除存放位置
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
*/
|
|
||||||
void deleteMaterialLocation(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除存放位置
|
|
||||||
*
|
|
||||||
* @param ids 编号
|
|
||||||
*/
|
|
||||||
void deleteMaterialLocationListByIds(List<Long> ids);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得存放位置
|
|
||||||
*
|
|
||||||
* @param id 编号
|
|
||||||
* @return 存放位置
|
|
||||||
*/
|
|
||||||
MaterialLocationDO getMaterialLocation(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得存放位置分页
|
|
||||||
*
|
|
||||||
* @param pageReqVO 分页查询
|
|
||||||
* @return 存放位置分页
|
|
||||||
*/
|
|
||||||
PageResult<MaterialLocationDO> getMaterialLocationPage(MaterialLocationPageReqVO pageReqVO);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
package com.zt.plat.module.qms.resource.material.service;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationPageReqVO;
|
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationRespVO;
|
|
||||||
import com.zt.plat.module.qms.resource.material.controller.vo.MaterialLocationSaveReqVO;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import com.zt.plat.module.qms.resource.material.dal.dataobject.MaterialLocationDO;
|
|
||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
|
||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
|
||||||
|
|
||||||
import com.zt.plat.module.qms.resource.material.dal.mapper.MaterialLocationMapper;
|
|
||||||
|
|
||||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 存放位置 Service 实现类
|
|
||||||
*
|
|
||||||
* @author 后台管理
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Validated
|
|
||||||
public class MaterialLocationServiceImpl implements MaterialLocationService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private MaterialLocationMapper materialLocationMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MaterialLocationRespVO createMaterialLocation(MaterialLocationSaveReqVO createReqVO) {
|
|
||||||
// 插入
|
|
||||||
MaterialLocationDO materialLocation = BeanUtils.toBean(createReqVO, MaterialLocationDO.class);
|
|
||||||
materialLocationMapper.insert(materialLocation);
|
|
||||||
// 返回
|
|
||||||
return BeanUtils.toBean(materialLocation, MaterialLocationRespVO.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateMaterialLocation(MaterialLocationSaveReqVO updateReqVO) {
|
|
||||||
// 校验存在
|
|
||||||
validateMaterialLocationExists(updateReqVO.getId());
|
|
||||||
// 更新
|
|
||||||
MaterialLocationDO updateObj = BeanUtils.toBean(updateReqVO, MaterialLocationDO.class);
|
|
||||||
materialLocationMapper.updateById(updateObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteMaterialLocation(Long id) {
|
|
||||||
// 校验存在
|
|
||||||
validateMaterialLocationExists(id);
|
|
||||||
// 删除
|
|
||||||
materialLocationMapper.deleteById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deleteMaterialLocationListByIds(List<Long> ids) {
|
|
||||||
// 校验存在
|
|
||||||
validateMaterialLocationExists(ids);
|
|
||||||
// 删除
|
|
||||||
materialLocationMapper.deleteByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void validateMaterialLocationExists(List<Long> ids) {
|
|
||||||
List<MaterialLocationDO> list = materialLocationMapper.selectByIds(ids);
|
|
||||||
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
|
||||||
throw exception(MATERIAL_LOCATION_NOT_EXISTS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void validateMaterialLocationExists(Long id) {
|
|
||||||
if (materialLocationMapper.selectById(id) == null) {
|
|
||||||
throw exception(MATERIAL_LOCATION_NOT_EXISTS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MaterialLocationDO getMaterialLocation(Long id) {
|
|
||||||
return materialLocationMapper.selectById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PageResult<MaterialLocationDO> getMaterialLocationPage(MaterialLocationPageReqVO pageReqVO) {
|
|
||||||
return materialLocationMapper.selectPage(pageReqVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -329,7 +329,8 @@ public class MaterialProductServiceImpl implements MaterialProductService {
|
|||||||
Map<Long, Long> stockQuantityMap = materialInfomationService.getStockQuantityByPdtIds(mtrlIds);
|
Map<Long, Long> stockQuantityMap = materialInfomationService.getStockQuantityByPdtIds(mtrlIds);
|
||||||
if (CollUtil.isNotEmpty(stockQuantityMap)) {
|
if (CollUtil.isNotEmpty(stockQuantityMap)) {
|
||||||
for (MaterialProductRespVO vo : voList) {
|
for (MaterialProductRespVO vo : voList) {
|
||||||
vo.setInventoryQuantity(BigDecimal.valueOf(stockQuantityMap.get(vo.getId())));
|
Long val = stockQuantityMap.get(vo.getId());
|
||||||
|
vo.setInventoryQuantity(BigDecimal.valueOf(val == null ? 0L : val));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zt.plat.module.qms.resource.material.dal.mapper.MaterialLocationMapper">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
|
||||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
|
||||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
|
||||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
|
||||||
-->
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
Reference in New Issue
Block a user