diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/BaseMaterialInfoController.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/BaseMaterialInfoController.java new file mode 100644 index 00000000..3f153334 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/controller/BaseMaterialInfoController.java @@ -0,0 +1,114 @@ +package org.dromara.wms.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.dromara.wms.domain.BaseMaterialInfo; +import org.dromara.wms.domain.bo.BaseMaterialInfoBo; +import org.dromara.wms.domain.vo.BaseMaterialInfoVo; +import org.dromara.wms.service.IBaseMaterialInfoService; +import org.dromara.wms.utils.BarcodePrintUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 物料信息 + * 前端访问路由地址为:/mes/baseMaterialInfo + * + * @author zangch + * @date 2025-01-07 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/baseMaterialInfo") +public class BaseMaterialInfoController extends BaseController { + + private final IBaseMaterialInfoService baseMaterialInfoService; + + /** + * 查询物料信息列表 + */ + @SaCheckPermission("mes:baseMaterialInfo:list") + @GetMapping("/list") + public TableDataInfo list(BaseMaterialInfoBo bo, PageQuery pageQuery) { + return baseMaterialInfoService.queryPageList(bo, pageQuery); + } + + /** + * 导出物料信息列表 + */ + @SaCheckPermission("mes:baseMaterialInfo:export") + @Log(title = "物料信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(BaseMaterialInfoBo bo, HttpServletResponse response) { + List list = baseMaterialInfoService.queryList(bo); + ExcelUtil.exportExcel(list, "物料信息", BaseMaterialInfoVo.class, response); + } + + /** + * 获取物料信息详细信息 + * + * @param materialId 主键 + */ + @SaCheckPermission("mes:baseMaterialInfo:query") + @GetMapping("/{materialId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long materialId) { + return R.ok(baseMaterialInfoService.queryById(materialId)); + } + + /** + * 新增物料信息 + */ + @SaCheckPermission("mes:baseMaterialInfo:add") + @Log(title = "物料信息", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody BaseMaterialInfoBo bo) { + return toAjax(baseMaterialInfoService.insertByBo(bo)); + } + + /** + * 修改物料信息 + */ + @SaCheckPermission("mes:baseMaterialInfo:edit") + @Log(title = "物料信息", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody BaseMaterialInfoBo bo) { + return toAjax(baseMaterialInfoService.updateByBo(bo)); + } + + /** + * 删除物料信息 + * + * @param materialIds 主键串 + */ + @SaCheckPermission("mes:baseMaterialInfo:remove") + @Log(title = "物料信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{materialIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] materialIds) { + return toAjax(baseMaterialInfoService.deleteWithValidByIds(List.of(materialIds), true)); + } + + @GetMapping("materialList") + public R> materialList(BaseMaterialInfo materialInfo){ +// BarcodePrintUtils.print(); + return R.ok(baseMaterialInfoService.materialList(materialInfo)); + } +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/BaseMaterialInfo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/BaseMaterialInfo.java new file mode 100644 index 00000000..4197cbd3 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/BaseMaterialInfo.java @@ -0,0 +1,267 @@ +package org.dromara.wms.domain; + +import org.dromara.common.tenant.core.TenantEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.util.Date; + +import java.io.Serial; + +/** + * 物料信息对象 base_material_info + * + * @author zangch + * @date 2025-01-07 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("base_material_info") +public class BaseMaterialInfo extends TenantEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + @TableId(type = IdType.AUTO) + private Long materialId; + + /** + * ERP信息 + */ + private String erpId; + + /** + * 物料编码 + */ + private String materialCode; + + /** + * 旧物料编码 + */ + private String oldMaterialCode; + + /** + * 物料名称 + */ + private String materialName; + + /** + * 物料类型ID + */ + private Long materialTypeId; + + /** + * 物料大类(1原材料 2半成品 3成品) + */ + private String materialCategories; + + /** + * 物料小类 + */ + private String materialSubclass; + + /** + * 批次标识(0否 1是) + */ + private String batchFlag; + + /** + * 小批次数量 + */ + private Long batchAmount; + + /** + * 计量单位ID + */ + private Long materialUnitId; + + /** + * 计量单位名称 + */ + private String materialUnit; + + /** + * 物料组 + */ + private String materialMatkl; + + /** + * 物料规格 + */ + private String materialSpec; + + /** + * 净重 + */ + private Long netWeight; + + /** + * 毛重 + */ + private Long grossWeight; + + /** + * 绑定标识(1是 0否) + */ + private String alwaysFlag; + + /** + * 所属工厂 + */ + private Long factoryId; + + /** + * 创建组织 + */ + private Long createOrgId; + + /** + * 使用组织 + */ + private Long useOrgId; + + /** + * 所属产线 + */ + private Long prodLineId; + + /** + * 激活标识(1是 0否) + */ + private String activeFlag; + + /** + * 删除标识(0否 1是) + */ + private String deletedFlag; + + /** + * 采购计价单位 + */ + private Long purchasePriceUnitId; + + /** + * 审核日期 + */ + private Date approveDate; + + /** + * erp最后更新日期 + */ + private Date erpModifyDate; + + /** + * 最大库存数量 + */ + private Long maxStockAmount; + + /** + * 最小库存数量 + */ + private Long minStockAmount; + + /** + * 安全库存数量 + */ + private Long safeStockAmount; + + /** + * 申请标识(1是 0否) + */ + private String applyFlag; + + /** + * 物料分类(1ERP同步 2虚拟物料 3MES物料) + */ + private String materialClassfication; + + /** + * 自动出库标识(1是 0否) + */ + private String autoOutstockFlag; + + /** + * 辅料标识(1是 0否) + */ + private String accessoriesFlag; + + /** + * 低值易耗品标识(1是 0否) + */ + private String lowValueConsumableFlag; + + /** + * 品牌 + */ + private String brand; + + /** + * 层级 + */ + private String plyrating; + + /** + * 花纹 + */ + private String pattern; + + /** + * 速度级别 + */ + private String speedLevel; + + /** + * 负荷载重 + */ + private String load; + + /** + * 轮胎标记(1全钢胎 2半钢胎 3工程胎) + */ + private String tireMarkings; + + /** + * 最小停放时间(秒) + */ + private Long minParkingTime; + + /** + * 最大停放时间(秒) + */ + private Long maxParkingTime; + + /** + * 标准重量 + */ + private Long standardWeight; + + /** + * 标准重量上限 + */ + private Long weightUpperLimit; + + /** + * 标准重量下限 + */ + private Long weightLowerLimit; + + /** + * 内胎标记(0无 1有) + */ + private String innerTubeFlag; + + /** + * 销售类型(0内销 1外销) + */ + private String saleType; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/BaseMaterialInfoBo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/BaseMaterialInfoBo.java new file mode 100644 index 00000000..a28ef9d8 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/bo/BaseMaterialInfoBo.java @@ -0,0 +1,269 @@ +package org.dromara.wms.domain.bo; + +import org.dromara.wms.domain.BaseMaterialInfo; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 物料信息业务对象 base_material_info + * + * @author zangch + * @date 2025-01-07 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = BaseMaterialInfo.class, reverseConvertGenerate = false) +public class BaseMaterialInfoBo extends BaseEntity { + + /** + * 主键标识 + */ + private Long materialId; + + /** + * ERP信息 + */ + @NotBlank(message = "ERP信息不能为空", groups = { AddGroup.class, EditGroup.class }) + private String erpId; + + /** + * 物料编码 + */ + @NotBlank(message = "物料编码不能为空", groups = { AddGroup.class, EditGroup.class }) + private String materialCode; + + /** + * 旧物料编码 + */ + private String oldMaterialCode; + + /** + * 物料名称 + */ + @NotBlank(message = "物料名称不能为空", groups = { AddGroup.class, EditGroup.class }) + private String materialName; + + /** + * 物料类型ID + */ + private Long materialTypeId; + + /** + * 物料大类(1原材料 2半成品 3成品) + */ + private String materialCategories; + + /** + * 物料小类 + */ + private String materialSubclass; + + /** + * 批次标识(0否 1是) + */ + private String batchFlag; + + /** + * 小批次数量 + */ + private Long batchAmount; + + /** + * 计量单位ID + */ + private Long materialUnitId; + + /** + * 计量单位名称 + */ + private String materialUnit; + + /** + * 物料组 + */ + private String materialMatkl; + + /** + * 物料规格 + */ + private String materialSpec; + + /** + * 净重 + */ + private Long netWeight; + + /** + * 毛重 + */ + private Long grossWeight; + + /** + * 绑定标识(1是 0否) + */ + private String alwaysFlag; + + /** + * 所属工厂 + */ + private Long factoryId; + + /** + * 创建组织 + */ + private Long createOrgId; + + /** + * 使用组织 + */ + private Long useOrgId; + + /** + * 所属产线 + */ + private Long prodLineId; + + /** + * 激活标识(1是 0否) + */ + private String activeFlag; + + /** + * 删除标识(0否 1是) + */ + private String deletedFlag; + + /** + * 采购计价单位 + */ + private Long purchasePriceUnitId; + + /** + * 审核日期 + */ + private Date approveDate; + + /** + * erp最后更新日期 + */ + private Date erpModifyDate; + + /** + * 最大库存数量 + */ + private Long maxStockAmount; + + /** + * 最小库存数量 + */ + private Long minStockAmount; + + /** + * 安全库存数量 + */ + private Long safeStockAmount; + + /** + * 申请标识(1是 0否) + */ + private String applyFlag; + + /** + * 物料分类(1ERP同步 2虚拟物料 3MES物料) + */ + private String materialClassfication; + + /** + * 自动出库标识(1是 0否) + */ + private String autoOutstockFlag; + + /** + * 辅料标识(1是 0否) + */ + private String accessoriesFlag; + + /** + * 低值易耗品标识(1是 0否) + */ + private String lowValueConsumableFlag; + + /** + * 品牌 + */ + private String brand; + + /** + * 层级 + */ + private String plyrating; + + /** + * 花纹 + */ + private String pattern; + + /** + * 速度级别 + */ + private String speedLevel; + + /** + * 负荷载重 + */ + private String load; + + /** + * 轮胎标记(1全钢胎 2半钢胎 3工程胎) + */ + private String tireMarkings; + + /** + * 最小停放时间(秒) + */ + private Long minParkingTime; + + /** + * 最大停放时间(秒) + */ + private Long maxParkingTime; + + /** + * 标准重量 + */ + private Long standardWeight; + + /** + * 标准重量上限 + */ + private Long weightUpperLimit; + + /** + * 标准重量下限 + */ + private Long weightLowerLimit; + + /** + * 内胎标记(0无 1有) + */ + private String innerTubeFlag; + + /** + * 销售类型(0内销 1外销) + */ + private String saleType; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/BaseMaterialInfoVo.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/BaseMaterialInfoVo.java new file mode 100644 index 00000000..0ea8c6fe --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/domain/vo/BaseMaterialInfoVo.java @@ -0,0 +1,373 @@ +package org.dromara.wms.domain.vo; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.dromara.wms.domain.BaseMaterialInfo; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 物料信息视图对象 base_material_info + * + * @author zangch + * @date 2025-01-07 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = BaseMaterialInfo.class) +public class BaseMaterialInfoVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + @ExcelProperty(value = "主键标识") + private Long materialId; + + /** + * 租户编号 + */ + @ExcelProperty(value = "租户编号") + private String tenantId; + + /** + * ERP信息 + */ + @ExcelProperty(value = "ERP信息") + private String erpId; + + /** + * 物料编码 + */ + @ExcelProperty(value = "物料编码") + private String materialCode; + + /** + * 旧物料编码 + */ + @ExcelProperty(value = "旧物料编码") + private String oldMaterialCode; + + /** + * 物料名称 + */ + @ExcelProperty(value = "物料名称") + private String materialName; + + /** + * 物料类型ID + */ + @ExcelProperty(value = "物料类型ID") + private Long materialTypeId; + + /** + * 物料大类(1原材料 2半成品 3成品) + */ + @ExcelProperty(value = "物料大类(1原材料 2半成品 3成品)", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "mes_material_categories") + private String materialCategories; + + /** + * 物料小类 + */ + @ExcelProperty(value = "物料小类") + private String materialSubclass; + + /** + * 批次标识(0否 1是) + */ + @ExcelProperty(value = "批次标识(0否 1是)", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "mes_batch_flag") + private String batchFlag; + + /** + * 小批次数量 + */ + @ExcelProperty(value = "小批次数量") + private Long batchAmount; + + /** + * 计量单位ID + */ + @ExcelProperty(value = "计量单位ID") + private Long materialUnitId; + + /** + * 计量单位名称 + */ + @ExcelProperty(value = "计量单位名称") + private String materialUnit; + + /** + * 物料组 + */ + @ExcelProperty(value = "物料组") + private String materialMatkl; + + /** + * 物料规格 + */ + @ExcelProperty(value = "物料规格") + private String materialSpec; + + /** + * 净重 + */ + @ExcelProperty(value = "净重") + private Long netWeight; + + /** + * 毛重 + */ + @ExcelProperty(value = "毛重") + private Long grossWeight; + + /** + * 绑定标识(1是 0否) + */ + @ExcelProperty(value = "绑定标识(1是 0否)", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "always_flag") + private String alwaysFlag; + + /** + * 所属工厂 + */ + @ExcelProperty(value = "所属工厂") + private Long factoryId; + + /** + * 创建组织 + */ + @ExcelProperty(value = "创建组织") + private Long createOrgId; + + /** + * 使用组织 + */ + @ExcelProperty(value = "使用组织") + private Long useOrgId; + + /** + * 所属产线 + */ + @ExcelProperty(value = "所属产线") + private Long prodLineId; + + /** + * 激活标识(1是 0否) + */ + @ExcelProperty(value = "激活标识", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "active_flag") + private String activeFlag; + + /** + * 删除标识(0否 1是) + */ + @ExcelProperty(value = "删除标识(0否 1是)", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "deleted_flag") + private String deletedFlag; + + /** + * 采购计价单位 + */ + @ExcelProperty(value = "采购计价单位") + private Long purchasePriceUnitId; + + /** + * 审核日期 + */ + @ExcelProperty(value = "审核日期") + private Date approveDate; + + /** + * erp最后更新日期 + */ + @ExcelProperty(value = "erp最后更新日期") + private Date erpModifyDate; + + /** + * 最大库存数量 + */ + @ExcelProperty(value = "最大库存数量") + private Long maxStockAmount; + + /** + * 最小库存数量 + */ + @ExcelProperty(value = "最小库存数量") + private Long minStockAmount; + + /** + * 安全库存数量 + */ + @ExcelProperty(value = "安全库存数量") + private Long safeStockAmount; + + /** + * 申请标识(1是 0否) + */ + @ExcelProperty(value = "申请标识(1是 0否)", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "apply_flag") + private String applyFlag; + + /** + * 物料分类(1ERP同步 2虚拟物料 3MES物料) + */ + @ExcelProperty(value = "物料分类", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "material_classfication") + private String materialClassfication; + + /** + * 自动出库标识(1是 0否) + */ + @ExcelProperty(value = "自动出库标识(1是 0否)", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "auto_outstock_flag") + private String autoOutstockFlag; + + /** + * 辅料标识(1是 0否) + */ + @ExcelProperty(value = "辅料标识(1是 0否)", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "mes_accessories_flag") + private String accessoriesFlag; + + /** + * 低值易耗品标识(1是 0否) + */ + @ExcelProperty(value = "低值易耗品标识(1是 0否)", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "mes_low_value_consumable_flag") + private String lowValueConsumableFlag; + + /** + * 品牌 + */ + @ExcelProperty(value = "品牌") + private String brand; + + /** + * 层级 + */ + @ExcelProperty(value = "层级") + private String plyrating; + + /** + * 花纹 + */ + @ExcelProperty(value = "花纹") + private String pattern; + + /** + * 速度级别 + */ + @ExcelProperty(value = "速度级别") + private String speedLevel; + + /** + * 负荷载重 + */ + @ExcelProperty(value = "负荷载重") + private String load; + + /** + * 轮胎标记(1全钢胎 2半钢胎 3工程胎) + */ + @ExcelProperty(value = "轮胎标记", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "tire_markings") + private String tireMarkings; + + /** + * 最小停放时间(秒) + */ + @ExcelProperty(value = "最小停放时间", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "秒=") + private Long minParkingTime; + + /** + * 最大停放时间(秒) + */ + @ExcelProperty(value = "最大停放时间", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "秒=") + private Long maxParkingTime; + + /** + * 标准重量 + */ + @ExcelProperty(value = "标准重量") + private Long standardWeight; + + /** + * 标准重量上限 + */ + @ExcelProperty(value = "标准重量上限") + private Long weightUpperLimit; + + /** + * 标准重量下限 + */ + @ExcelProperty(value = "标准重量下限") + private Long weightLowerLimit; + + /** + * 内胎标记(0无 1有) + */ + @ExcelProperty(value = "内胎标记(0无 1有)", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "inner_tube_flag") + private String innerTubeFlag; + + /** + * 销售类型(0内销 1外销) + */ + @ExcelProperty(value = "销售类型(0内销 1外销)", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "sale_type") + private String saleType; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + + /** + * 创建部门 + */ + @ExcelProperty(value = "创建部门") + private Long createDept; + + /** + * 创建人 + */ + @ExcelProperty(value = "创建人") + private Long createBy; + + /** + * 创建时间 + */ + @ExcelProperty(value = "创建时间") + private Date createTime; + + /** + * 更新人 + */ + @ExcelProperty(value = "更新人") + private Long updateBy; + + /** + * 更新时间 + */ + @ExcelProperty(value = "更新时间") + private Date updateTime; + + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/BaseMaterialInfoMapper.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/BaseMaterialInfoMapper.java new file mode 100644 index 00000000..1cc10fb0 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/mapper/BaseMaterialInfoMapper.java @@ -0,0 +1,15 @@ +package org.dromara.wms.mapper; + +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import org.dromara.wms.domain.BaseMaterialInfo; +import org.dromara.wms.domain.vo.BaseMaterialInfoVo; + +/** + * 物料信息Mapper接口 + * + * @author zangch + * @date 2025-01-07 + */ +public interface BaseMaterialInfoMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IBaseMaterialInfoService.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IBaseMaterialInfoService.java new file mode 100644 index 00000000..d5b20a3b --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/IBaseMaterialInfoService.java @@ -0,0 +1,72 @@ +package org.dromara.wms.service; + +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.wms.domain.BaseMaterialInfo; +import org.dromara.wms.domain.bo.BaseMaterialInfoBo; +import org.dromara.wms.domain.vo.BaseMaterialInfoVo; + +import java.util.Collection; +import java.util.List; + +/** + * 物料信息Service接口 + * + * @author zangch + * @date 2025-01-07 + */ +public interface IBaseMaterialInfoService { + + /** + * 查询物料信息 + * + * @param materialId 主键 + * @return 物料信息 + */ + BaseMaterialInfoVo queryById(Long materialId); + + /** + * 分页查询物料信息列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 物料信息分页列表 + */ + TableDataInfo queryPageList(BaseMaterialInfoBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的物料信息列表 + * + * @param bo 查询条件 + * @return 物料信息列表 + */ + List queryList(BaseMaterialInfoBo bo); + + /** + * 新增物料信息 + * + * @param bo 物料信息 + * @return 是否新增成功 + */ + Boolean insertByBo(BaseMaterialInfoBo bo); + + /** + * 修改物料信息 + * + * @param bo 物料信息 + * @return 是否修改成功 + */ + Boolean updateByBo(BaseMaterialInfoBo bo); + + /** + * 校验并批量删除物料信息信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + + List materialList(BaseMaterialInfo materialInfo); +} diff --git a/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/BaseMaterialInfoServiceImpl.java b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/BaseMaterialInfoServiceImpl.java new file mode 100644 index 00000000..1e7cdb26 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/java/org/dromara/wms/service/impl/BaseMaterialInfoServiceImpl.java @@ -0,0 +1,180 @@ +package org.dromara.wms.service.impl; + +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.dromara.wms.domain.BaseMaterialInfo; +import org.dromara.wms.domain.bo.BaseMaterialInfoBo; +import org.dromara.wms.domain.vo.BaseMaterialInfoVo; +import org.dromara.wms.mapper.BaseMaterialInfoMapper; +import org.dromara.wms.service.IBaseMaterialInfoService; +import org.springframework.stereotype.Service; + + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 物料信息Service业务层处理 + * + * @author zangch + * @date 2025-01-07 + */ +@RequiredArgsConstructor +@Service +public class BaseMaterialInfoServiceImpl implements IBaseMaterialInfoService { + + private final BaseMaterialInfoMapper baseMapper; + + /** + * 查询物料信息 + * + * @param materialId 主键 + * @return 物料信息 + */ + @Override + public BaseMaterialInfoVo queryById(Long materialId){ + return baseMapper.selectVoById(materialId); + } + + /** + * 分页查询物料信息列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 物料信息分页列表 + */ + @Override + public TableDataInfo queryPageList(BaseMaterialInfoBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的物料信息列表 + * + * @param bo 查询条件 + * @return 物料信息列表 + */ + @Override + public List queryList(BaseMaterialInfoBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(BaseMaterialInfoBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getMaterialId() != null, BaseMaterialInfo::getMaterialId, bo.getMaterialId()); + lqw.eq(StringUtils.isNotBlank(bo.getErpId()), BaseMaterialInfo::getErpId, bo.getErpId()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialCode()), BaseMaterialInfo::getMaterialCode, bo.getMaterialCode()); + lqw.eq(StringUtils.isNotBlank(bo.getOldMaterialCode()), BaseMaterialInfo::getOldMaterialCode, bo.getOldMaterialCode()); + lqw.like(StringUtils.isNotBlank(bo.getMaterialName()), BaseMaterialInfo::getMaterialName, bo.getMaterialName()); + lqw.eq(bo.getMaterialTypeId() != null, BaseMaterialInfo::getMaterialTypeId, bo.getMaterialTypeId()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialCategories()), BaseMaterialInfo::getMaterialCategories, bo.getMaterialCategories()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialSubclass()), BaseMaterialInfo::getMaterialSubclass, bo.getMaterialSubclass()); + lqw.eq(StringUtils.isNotBlank(bo.getBatchFlag()), BaseMaterialInfo::getBatchFlag, bo.getBatchFlag()); + lqw.eq(bo.getBatchAmount() != null, BaseMaterialInfo::getBatchAmount, bo.getBatchAmount()); + lqw.eq(bo.getMaterialUnitId() != null, BaseMaterialInfo::getMaterialUnitId, bo.getMaterialUnitId()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialUnit()), BaseMaterialInfo::getMaterialUnit, bo.getMaterialUnit()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialMatkl()), BaseMaterialInfo::getMaterialMatkl, bo.getMaterialMatkl()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialSpec()), BaseMaterialInfo::getMaterialSpec, bo.getMaterialSpec()); + lqw.eq(bo.getNetWeight() != null, BaseMaterialInfo::getNetWeight, bo.getNetWeight()); + lqw.eq(bo.getGrossWeight() != null, BaseMaterialInfo::getGrossWeight, bo.getGrossWeight()); + lqw.eq(StringUtils.isNotBlank(bo.getAlwaysFlag()), BaseMaterialInfo::getAlwaysFlag, bo.getAlwaysFlag()); + lqw.eq(bo.getFactoryId() != null, BaseMaterialInfo::getFactoryId, bo.getFactoryId()); + lqw.eq(bo.getCreateOrgId() != null, BaseMaterialInfo::getCreateOrgId, bo.getCreateOrgId()); + lqw.eq(bo.getUseOrgId() != null, BaseMaterialInfo::getUseOrgId, bo.getUseOrgId()); + lqw.eq(bo.getProdLineId() != null, BaseMaterialInfo::getProdLineId, bo.getProdLineId()); + lqw.eq(StringUtils.isNotBlank(bo.getActiveFlag()), BaseMaterialInfo::getActiveFlag, bo.getActiveFlag()); + lqw.eq(StringUtils.isNotBlank(bo.getDeletedFlag()), BaseMaterialInfo::getDeletedFlag, bo.getDeletedFlag()); + lqw.eq(bo.getPurchasePriceUnitId() != null, BaseMaterialInfo::getPurchasePriceUnitId, bo.getPurchasePriceUnitId()); + lqw.between(params.get("beginApproveDate") != null && params.get("endApproveDate") != null, + BaseMaterialInfo::getApproveDate ,params.get("beginApproveDate"), params.get("endApproveDate")); + lqw.eq(bo.getErpModifyDate() != null, BaseMaterialInfo::getErpModifyDate, bo.getErpModifyDate()); + lqw.eq(bo.getMaxStockAmount() != null, BaseMaterialInfo::getMaxStockAmount, bo.getMaxStockAmount()); + lqw.eq(bo.getMinStockAmount() != null, BaseMaterialInfo::getMinStockAmount, bo.getMinStockAmount()); + lqw.eq(bo.getSafeStockAmount() != null, BaseMaterialInfo::getSafeStockAmount, bo.getSafeStockAmount()); + lqw.eq(StringUtils.isNotBlank(bo.getApplyFlag()), BaseMaterialInfo::getApplyFlag, bo.getApplyFlag()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialClassfication()), BaseMaterialInfo::getMaterialClassfication, bo.getMaterialClassfication()); + lqw.eq(StringUtils.isNotBlank(bo.getAutoOutstockFlag()), BaseMaterialInfo::getAutoOutstockFlag, bo.getAutoOutstockFlag()); + lqw.eq(StringUtils.isNotBlank(bo.getAccessoriesFlag()), BaseMaterialInfo::getAccessoriesFlag, bo.getAccessoriesFlag()); + lqw.eq(StringUtils.isNotBlank(bo.getLowValueConsumableFlag()), BaseMaterialInfo::getLowValueConsumableFlag, bo.getLowValueConsumableFlag()); + lqw.eq(StringUtils.isNotBlank(bo.getBrand()), BaseMaterialInfo::getBrand, bo.getBrand()); + lqw.eq(StringUtils.isNotBlank(bo.getPlyrating()), BaseMaterialInfo::getPlyrating, bo.getPlyrating()); + lqw.eq(StringUtils.isNotBlank(bo.getPattern()), BaseMaterialInfo::getPattern, bo.getPattern()); + lqw.eq(StringUtils.isNotBlank(bo.getSpeedLevel()), BaseMaterialInfo::getSpeedLevel, bo.getSpeedLevel()); + lqw.eq(StringUtils.isNotBlank(bo.getLoad()), BaseMaterialInfo::getLoad, bo.getLoad()); + lqw.eq(StringUtils.isNotBlank(bo.getTireMarkings()), BaseMaterialInfo::getTireMarkings, bo.getTireMarkings()); + lqw.eq(bo.getMinParkingTime() != null, BaseMaterialInfo::getMinParkingTime, bo.getMinParkingTime()); + lqw.eq(bo.getMaxParkingTime() != null, BaseMaterialInfo::getMaxParkingTime, bo.getMaxParkingTime()); + lqw.eq(bo.getStandardWeight() != null, BaseMaterialInfo::getStandardWeight, bo.getStandardWeight()); + lqw.eq(bo.getWeightUpperLimit() != null, BaseMaterialInfo::getWeightUpperLimit, bo.getWeightUpperLimit()); + lqw.eq(bo.getWeightLowerLimit() != null, BaseMaterialInfo::getWeightLowerLimit, bo.getWeightLowerLimit()); + lqw.eq(StringUtils.isNotBlank(bo.getInnerTubeFlag()), BaseMaterialInfo::getInnerTubeFlag, bo.getInnerTubeFlag()); + lqw.eq(StringUtils.isNotBlank(bo.getSaleType()), BaseMaterialInfo::getSaleType, bo.getSaleType()); + return lqw; + } + + /** + * 新增物料信息 + * + * @param bo 物料信息 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(BaseMaterialInfoBo bo) { + BaseMaterialInfo add = MapstructUtils.convert(bo, BaseMaterialInfo.class); + validEntityBeforeSave(add); + return true; + } + + /** + * 修改物料信息 + * + * @param bo 物料信息 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(BaseMaterialInfoBo bo) { + BaseMaterialInfo update = MapstructUtils.convert(bo, BaseMaterialInfo.class); + validEntityBeforeSave(update); + return true; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(BaseMaterialInfo entity){ + //TODO 做一些数据校验,如唯一约束 + } + + @Override + public List materialList(BaseMaterialInfo materialInfo) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(BaseMaterialInfo::getMaterialCategories,materialInfo.getMaterialCategories()); + return baseMapper.selectVoList(wrapper); + } + + /** + * 校验并批量删除物料信息信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return true; + } +} diff --git a/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/BaseMaterialInfoMapper.xml b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/BaseMaterialInfoMapper.xml new file mode 100644 index 00000000..eebf4816 --- /dev/null +++ b/ruoyi-modules/hwmom-wms/src/main/resources/mapper/wms/BaseMaterialInfoMapper.xml @@ -0,0 +1,7 @@ + + + + +