完成库存
This commit is contained in:
@ -22,7 +22,7 @@ captcha:
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8899
|
||||
port: 8898
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
|
@ -127,12 +127,12 @@ public class BusCailiaoshebeiController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 设计-删除物资-材料设备
|
||||
* 设计-删除物资-材料设备1
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("cailiaoshebei:cailiaoshebei:remove")
|
||||
@Log(title = "物资-材料设备", businessType = BusinessType.DELETE)
|
||||
@Log(title = "设计-删除物资-材料设备", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/remove/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
|
@ -0,0 +1,106 @@
|
||||
package org.dromara.cailiaoshebei.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.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.cailiaoshebei.domain.vo.BusRepertoryVo;
|
||||
import org.dromara.cailiaoshebei.domain.bo.BusRepertoryBo;
|
||||
import org.dromara.cailiaoshebei.service.IBusRepertoryService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 物资-库存详情
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/cailiaoshebei/repertory")
|
||||
public class BusRepertoryController extends BaseController {
|
||||
|
||||
private final IBusRepertoryService busRepertoryService;
|
||||
|
||||
/**
|
||||
* 查询物资-库存详情列表
|
||||
*/
|
||||
@SaCheckPermission("cailiaoshebei:repertory:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<BusRepertoryVo> list(BusRepertoryBo bo, PageQuery pageQuery) {
|
||||
return busRepertoryService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资-库存详情详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("cailiaoshebei:repertory:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<BusRepertoryVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(busRepertoryService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增物资-库存详情
|
||||
*/
|
||||
@SaCheckPermission("cailiaoshebei:repertory:add")
|
||||
@Log(title = "物资-库存详情", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody BusRepertoryBo bo) {
|
||||
return toAjax(busRepertoryService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除物资-库存详情
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("cailiaoshebei:repertory:remove")
|
||||
@Log(title = "物资-库存详情", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(busRepertoryService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 导出物资-库存详情列表
|
||||
// */
|
||||
// @SaCheckPermission("cailiaoshebei:repertory:export")
|
||||
// @Log(title = "物资-库存详情", businessType = BusinessType.EXPORT)
|
||||
// @PostMapping("/export")
|
||||
// public void export(BusRepertoryBo bo, HttpServletResponse response) {
|
||||
// List<BusRepertoryVo> list = busRepertoryService.queryList(bo);
|
||||
// ExcelUtil.exportExcel(list, "物资-库存详情", BusRepertoryVo.class, response);
|
||||
// }
|
||||
|
||||
|
||||
// /**
|
||||
// * 修改物资-库存详情
|
||||
// */
|
||||
// @SaCheckPermission("cailiaoshebei:repertory:edit")
|
||||
// @Log(title = "物资-库存详情", businessType = BusinessType.UPDATE)
|
||||
// @RepeatSubmit()
|
||||
// @PutMapping()
|
||||
// public R<Void> edit(@Validated(EditGroup.class) @RequestBody BusRepertoryBo bo) {
|
||||
// return toAjax(busRepertoryService.updateByBo(bo));
|
||||
// }
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package org.dromara.cailiaoshebei.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.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.cailiaoshebei.domain.vo.BusRepertoryDetailsVo;
|
||||
import org.dromara.cailiaoshebei.domain.bo.BusRepertoryDetailsBo;
|
||||
import org.dromara.cailiaoshebei.service.IBusRepertoryDetailsService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 物资-库存
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/cailiaoshebei/repertoryDetails")
|
||||
public class BusRepertoryDetailsController extends BaseController {
|
||||
|
||||
private final IBusRepertoryDetailsService busRepertoryDetailsService;
|
||||
|
||||
/**
|
||||
* 查询物资-库存列表
|
||||
*/
|
||||
@SaCheckPermission("cailiaoshebei:repertoryDetails:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<BusRepertoryDetailsVo> list(BusRepertoryDetailsBo bo, PageQuery pageQuery) {
|
||||
return busRepertoryDetailsService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物资-库存详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("cailiaoshebei:repertoryDetails:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<BusRepertoryDetailsVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(busRepertoryDetailsService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增物资-库存
|
||||
*/
|
||||
@SaCheckPermission("cailiaoshebei:repertoryDetails:add")
|
||||
@Log(title = "物资-库存", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody BusRepertoryDetailsBo bo) {
|
||||
return toAjax(busRepertoryDetailsService.insertByBo(bo));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除物资-库存
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("cailiaoshebei:repertoryDetails:remove")
|
||||
@Log(title = "物资-库存", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(busRepertoryDetailsService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 导出物资-库存列表
|
||||
// */
|
||||
// @SaCheckPermission("cailiaoshebei:repertoryDetails:export")
|
||||
// @Log(title = "物资-库存", businessType = BusinessType.EXPORT)
|
||||
// @PostMapping("/export")
|
||||
// public void export(BusRepertoryDetailsBo bo, HttpServletResponse response) {
|
||||
// List<BusRepertoryDetailsVo> list = busRepertoryDetailsService.queryList(bo);
|
||||
// ExcelUtil.exportExcel(list, "物资-库存", BusRepertoryDetailsVo.class, response);
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 修改物资-库存
|
||||
// */
|
||||
// @SaCheckPermission("cailiaoshebei:repertoryDetails:edit")
|
||||
// @Log(title = "物资-库存", businessType = BusinessType.UPDATE)
|
||||
// @RepeatSubmit()
|
||||
// @PutMapping()
|
||||
// public R<Void> edit(@Validated(EditGroup.class) @RequestBody BusRepertoryDetailsBo bo) {
|
||||
// return toAjax(busRepertoryDetailsService.updateByBo(bo));
|
||||
// }
|
||||
}
|
@ -99,5 +99,55 @@ public class BusMaterialsorder extends BaseEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 验收数量
|
||||
*/
|
||||
private Integer acceptanceQuantity;
|
||||
|
||||
/**
|
||||
* 实际到货时间
|
||||
*/
|
||||
private Date actualArrival;
|
||||
|
||||
/**
|
||||
* 需求提交时间
|
||||
*/
|
||||
private Date requiredTime;
|
||||
|
||||
/**
|
||||
* 订货时间
|
||||
*/
|
||||
private Date orderTime;
|
||||
|
||||
/**
|
||||
* 验收时间
|
||||
*/
|
||||
private Date receptionTime;
|
||||
|
||||
/**
|
||||
* 物资执行状态(字典)
|
||||
*/
|
||||
private String materialStatus;
|
||||
|
||||
/**
|
||||
* 物资预期类型(字典)
|
||||
*/
|
||||
private String overdueType;
|
||||
|
||||
/**
|
||||
* 逾期原因
|
||||
*/
|
||||
private String cause;
|
||||
|
||||
/**
|
||||
* 签收单据
|
||||
*/
|
||||
private String signatureForm;
|
||||
|
||||
/**
|
||||
* 退货单据
|
||||
*/
|
||||
private String returnedSalesReport;
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,51 @@
|
||||
package org.dromara.cailiaoshebei.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 物资-库存详情对象 bus_repertory
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("bus_repertory")
|
||||
public class BusRepertory extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 设备材料名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
private String specification;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package org.dromara.cailiaoshebei.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 物资-库存对象 bus_repertory_details
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("bus_repertory_details")
|
||||
public class BusRepertoryDetails extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 库存ID
|
||||
*/
|
||||
private Long repertoryId;
|
||||
|
||||
/**
|
||||
* 数据来源ID
|
||||
*/
|
||||
private Long materialsorderId;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
private String materialCode;
|
||||
|
||||
/**
|
||||
* 原始数量
|
||||
*/
|
||||
private int originalQuantity;
|
||||
|
||||
/**
|
||||
* 变更原因
|
||||
*/
|
||||
private String changeReasons;
|
||||
|
||||
/**
|
||||
* 变更数量
|
||||
*/
|
||||
private int changeQuantity;
|
||||
|
||||
/**
|
||||
* 最终数量
|
||||
*/
|
||||
private int finalNumber;
|
||||
|
||||
/**
|
||||
* 操作状态(字典)
|
||||
*/
|
||||
private String operationStatus;
|
||||
|
||||
/**
|
||||
* 操作人
|
||||
*/
|
||||
private String operationName;
|
||||
|
||||
/**
|
||||
* 操作人联系电话
|
||||
*/
|
||||
private String operationPhone;
|
||||
|
||||
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package org.dromara.cailiaoshebei.domain.bo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@ -18,12 +20,14 @@ public class BusCailiaoshebeiListReq implements Serializable {
|
||||
/**
|
||||
* 项目ID(必填)
|
||||
*/
|
||||
@NotNull(message = "项目ID不能为空")
|
||||
private Long projectId;
|
||||
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
* 批次号(必填)
|
||||
*/
|
||||
@NotBlank(message = "项目ID不能为空")
|
||||
private String batchNumber;
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,52 @@
|
||||
package org.dromara.cailiaoshebei.domain.bo;
|
||||
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.cailiaoshebei.domain.BusRepertory;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* 物资-库存详情业务对象 bus_repertory
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = BusRepertory.class, reverseConvertGenerate = false)
|
||||
@Accessors(chain = true)
|
||||
public class BusRepertoryBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@NotNull(message = "ID不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 设备材料名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
private String specification;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package org.dromara.cailiaoshebei.domain.bo;
|
||||
|
||||
import org.dromara.cailiaoshebei.domain.BusRepertoryDetails;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* 物资-库存业务对象 bus_repertory_details
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = BusRepertoryDetails.class, reverseConvertGenerate = false)
|
||||
public class BusRepertoryDetailsBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@NotNull(message = "ID不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
@NotNull(message = "项目ID不能为空")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 库存ID
|
||||
*/
|
||||
@NotNull(message = "库存ID不能为空")
|
||||
private Long repertoryId;
|
||||
|
||||
/**
|
||||
* 数据来源ID
|
||||
*/
|
||||
@NotNull(message = "数据来源ID不能为空")
|
||||
private Long materialsorderId;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
@NotNull(message = "物料编码不能为空")
|
||||
private String materialCode;
|
||||
|
||||
/**
|
||||
* 原始数量
|
||||
*/
|
||||
private Long originalQuantity;
|
||||
|
||||
/**
|
||||
* 变更原因
|
||||
*/
|
||||
@NotBlank(message = "变更原因不能为空")
|
||||
private String changeReasons;
|
||||
|
||||
/**
|
||||
* 变更数量
|
||||
*/
|
||||
@NotNull(message = "变更数量不能为空")
|
||||
private Long changeQuantity;
|
||||
|
||||
/**
|
||||
* 最终数量
|
||||
*/
|
||||
private Long finalNumber;
|
||||
|
||||
/**
|
||||
* 操作状态(字典)
|
||||
*/
|
||||
@NotBlank(message = "操作状态不能为空")
|
||||
private String operationStatus;
|
||||
|
||||
/**
|
||||
* 操作人
|
||||
*/
|
||||
@NotBlank(message = "操作人不能为空")
|
||||
private String operationName;
|
||||
|
||||
/**
|
||||
* 操作人联系电话
|
||||
*/
|
||||
@NotBlank(message = "操作人联系电话不能为空")
|
||||
private String operationPhone;
|
||||
|
||||
|
||||
}
|
@ -9,6 +9,8 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 物资-物资清单业务对象 bus_suppliesprice
|
||||
*
|
||||
@ -34,7 +36,7 @@ public class BusSuppliespriceBo extends BaseEntity {
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
private Long unitPrice;
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/**
|
||||
* 合同号
|
||||
|
@ -0,0 +1,99 @@
|
||||
package org.dromara.cailiaoshebei.domain.vo;
|
||||
|
||||
import org.dromara.cailiaoshebei.domain.BusRepertoryDetails;
|
||||
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;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 物资-库存视图对象 bus_repertory_details
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = BusRepertoryDetails.class)
|
||||
public class BusRepertoryDetailsVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@ExcelProperty(value = "ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
@ExcelProperty(value = "项目ID")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 库存ID
|
||||
*/
|
||||
@ExcelProperty(value = "库存ID")
|
||||
private Long repertoryId;
|
||||
|
||||
/**
|
||||
* 数据来源ID
|
||||
*/
|
||||
@ExcelProperty(value = "数据来源ID")
|
||||
private Long materialsorderId;
|
||||
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
@ExcelProperty(value = "物料编码")
|
||||
private String materialCode;
|
||||
|
||||
/**
|
||||
* 原始数量
|
||||
*/
|
||||
@ExcelProperty(value = "原始数量")
|
||||
private Long originalQuantity;
|
||||
|
||||
/**
|
||||
* 变更原因
|
||||
*/
|
||||
@ExcelProperty(value = "变更原因")
|
||||
private String changeReasons;
|
||||
|
||||
/**
|
||||
* 变更数量
|
||||
*/
|
||||
@ExcelProperty(value = "变更数量")
|
||||
private Long changeQuantity;
|
||||
|
||||
/**
|
||||
* 操作状态(字典)
|
||||
*/
|
||||
@ExcelProperty(value = "操作状态(字典)", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "operation_status")
|
||||
private String operationStatus;
|
||||
|
||||
/**
|
||||
* 操作人
|
||||
*/
|
||||
@ExcelProperty(value = "操作人")
|
||||
private String operationName;
|
||||
|
||||
/**
|
||||
* 操作人联系电话
|
||||
*/
|
||||
@ExcelProperty(value = "操作人联系电话")
|
||||
private String operationPhone;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package org.dromara.cailiaoshebei.domain.vo;
|
||||
|
||||
import org.dromara.cailiaoshebei.domain.BusRepertory;
|
||||
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;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 物资-库存详情视图对象 bus_repertory
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = BusRepertory.class)
|
||||
public class BusRepertoryVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@ExcelProperty(value = "ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
@ExcelProperty(value = "项目ID")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 设备材料名称
|
||||
*/
|
||||
@ExcelProperty(value = "设备材料名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@ExcelProperty(value = "规格型号")
|
||||
private String specification;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package org.dromara.cailiaoshebei.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author 铁憨憨
|
||||
* @Date 2025/8/5 19:25
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class GrossOutputRes implements Serializable {
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private int acceptanceQuantity;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
}
|
@ -1,9 +1,14 @@
|
||||
package org.dromara.cailiaoshebei.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.cailiaoshebei.domain.BusMaterialsorder;
|
||||
import org.dromara.cailiaoshebei.domain.vo.BusMaterialsorderVo;
|
||||
import org.dromara.cailiaoshebei.domain.vo.GrossOutputRes;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物资-设备订货Mapper接口
|
||||
*
|
||||
@ -11,5 +16,10 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
* @date 2025-08-02
|
||||
*/
|
||||
public interface BusMaterialsorderMapper extends BaseMapperPlus<BusMaterialsorder, BusMaterialsorderVo> {
|
||||
// 自定义多表查询方法
|
||||
List<GrossOutputRes> grossOutput(
|
||||
@Param("projectId") Long projectId,
|
||||
@Param("statusArr") String[] statusArr,
|
||||
@Param("yue") String yue);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.cailiaoshebei.mapper;
|
||||
|
||||
import org.dromara.cailiaoshebei.domain.BusRepertoryDetails;
|
||||
import org.dromara.cailiaoshebei.domain.vo.BusRepertoryDetailsVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 物资-库存Mapper接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
public interface BusRepertoryDetailsMapper extends BaseMapperPlus<BusRepertoryDetails, BusRepertoryDetailsVo> {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.cailiaoshebei.mapper;
|
||||
|
||||
import org.dromara.cailiaoshebei.domain.BusRepertory;
|
||||
import org.dromara.cailiaoshebei.domain.vo.BusRepertoryVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 物资-库存详情Mapper接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
public interface BusRepertoryMapper extends BaseMapperPlus<BusRepertory, BusRepertoryVo> {
|
||||
|
||||
}
|
@ -8,6 +8,8 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@ -83,4 +85,13 @@ public interface IBusMaterialsorderService extends IService<BusMaterialsorder>{
|
||||
* 修改订货单的基础头信息和基础信息
|
||||
*/
|
||||
Boolean modifyTheOrderForm(MaterialsorderPcPlanEditReq req);
|
||||
|
||||
|
||||
/**
|
||||
* 总产值
|
||||
* @param projectId 项目,必填
|
||||
* @param yue 年月查询,不必填
|
||||
* @return
|
||||
*/
|
||||
BigDecimal grossOutput(Long projectId,String yue);
|
||||
}
|
||||
|
@ -0,0 +1,80 @@
|
||||
package org.dromara.cailiaoshebei.service;
|
||||
|
||||
import org.dromara.cailiaoshebei.domain.vo.BusRepertoryDetailsVo;
|
||||
import org.dromara.cailiaoshebei.domain.bo.BusRepertoryDetailsBo;
|
||||
import org.dromara.cailiaoshebei.domain.BusRepertoryDetails;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物资-库存Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
public interface IBusRepertoryDetailsService extends IService<BusRepertoryDetails>{
|
||||
|
||||
/**
|
||||
* 查询物资-库存
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 物资-库存
|
||||
*/
|
||||
BusRepertoryDetailsVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询物资-库存列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 物资-库存分页列表
|
||||
*/
|
||||
TableDataInfo<BusRepertoryDetailsVo> queryPageList(BusRepertoryDetailsBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的物资-库存列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 物资-库存列表
|
||||
*/
|
||||
List<BusRepertoryDetailsVo> queryList(BusRepertoryDetailsBo bo);
|
||||
|
||||
/**
|
||||
* 新增物资-库存
|
||||
*
|
||||
* @param bo 物资-库存
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(BusRepertoryDetailsBo bo);
|
||||
|
||||
/**
|
||||
* 修改物资-库存
|
||||
*
|
||||
* @param bo 物资-库存
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(BusRepertoryDetailsBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除物资-库存信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
|
||||
/**
|
||||
* 库存数据变更
|
||||
*
|
||||
* @param bo 物资-库存
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean InventoryDataModification(BusRepertoryDetailsBo bo);
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package org.dromara.cailiaoshebei.service;
|
||||
|
||||
import org.dromara.cailiaoshebei.domain.vo.BusRepertoryVo;
|
||||
import org.dromara.cailiaoshebei.domain.bo.BusRepertoryBo;
|
||||
import org.dromara.cailiaoshebei.domain.BusRepertory;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 物资-库存详情Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
public interface IBusRepertoryService extends IService<BusRepertory>{
|
||||
|
||||
/**
|
||||
* 查询物资-库存详情
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 物资-库存详情
|
||||
*/
|
||||
BusRepertoryVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询物资-库存详情列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 物资-库存详情分页列表
|
||||
*/
|
||||
TableDataInfo<BusRepertoryVo> queryPageList(BusRepertoryBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的物资-库存详情列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 物资-库存详情列表
|
||||
*/
|
||||
List<BusRepertoryVo> queryList(BusRepertoryBo bo);
|
||||
|
||||
/**
|
||||
* 新增物资-库存详情
|
||||
*
|
||||
* @param bo 物资-库存详情
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(BusRepertoryBo bo);
|
||||
|
||||
/**
|
||||
* 修改物资-库存详情
|
||||
*
|
||||
* @param bo 物资-库存详情
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(BusRepertoryBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除物资-库存详情信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -8,6 +8,7 @@ import org.dromara.cailiaoshebei.domain.dto.BusCailiaoshebeiEditPlanDto;
|
||||
import org.dromara.cailiaoshebei.domain.vo.BusCailiaoshebeiListPlanRes;
|
||||
import org.dromara.cailiaoshebei.domain.vo.BusSuppliespriceAddPlanSonRes;
|
||||
import org.dromara.cailiaoshebei.domain.vo.MasterDataListRes;
|
||||
import org.dromara.cailiaoshebei.service.IBusRepertoryService;
|
||||
import org.dromara.cailiaoshebei.service.IBusSuppliespriceService;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
@ -40,6 +41,7 @@ public class BusCailiaoshebeiServiceImpl extends ServiceImpl<BusCailiaoshebeiMap
|
||||
|
||||
private final BusCailiaoshebeiMapper baseMapper;
|
||||
private final IBusSuppliespriceService busSuppliespriceService;
|
||||
private final IBusRepertoryService busRepertoryService;
|
||||
|
||||
|
||||
/**
|
||||
@ -109,7 +111,7 @@ public class BusCailiaoshebeiServiceImpl extends ServiceImpl<BusCailiaoshebeiMap
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean insertByBo(BusCailiaoshebeiAddReq bo) {
|
||||
//2、新增初始化数据信息
|
||||
//1、新增初始化数据信息
|
||||
BusCailiaoshebei add = MapstructUtils.convert(bo, BusCailiaoshebei.class);
|
||||
assert add != null;
|
||||
add.setMaterialCode(BatchNumberGenerator.generateBatchNumber("WL-")); //物料编码);
|
||||
@ -117,6 +119,15 @@ public class BusCailiaoshebeiServiceImpl extends ServiceImpl<BusCailiaoshebeiMap
|
||||
Boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
//2、初始化库存
|
||||
Boolean b = busRepertoryService.insertByBo(
|
||||
new BusRepertoryBo()
|
||||
.setProjectId(add.getProjectId())
|
||||
.setName(add.getName())
|
||||
.setSpecification(add.getSpecification()));
|
||||
if (!b){
|
||||
throw new RuntimeException("初始化库存失败");
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
package org.dromara.cailiaoshebei.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.dromara.cailiaoshebei.domain.BusCailiaoshebeiPici;
|
||||
import org.dromara.cailiaoshebei.domain.BusMaterialbatchdemandplan;
|
||||
import org.dromara.cailiaoshebei.domain.bo.MaterialsorderPcPlanEditReq;
|
||||
import org.dromara.cailiaoshebei.domain.vo.GrossOutputRes;
|
||||
import org.dromara.cailiaoshebei.service.IBusCailiaoshebeiPiciService;
|
||||
import org.dromara.cailiaoshebei.service.IBusMaterialbatchdemandplanService;
|
||||
import org.dromara.common.core.domain.model.LoginUser;
|
||||
@ -27,6 +30,7 @@ import org.dromara.cailiaoshebei.mapper.BusMaterialsorderMapper;
|
||||
import org.dromara.cailiaoshebei.service.IBusMaterialsorderService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -224,4 +228,27 @@ public class BusMaterialsorderServiceImpl extends ServiceImpl<BusMaterialsorderM
|
||||
//3、新增主体详情数据
|
||||
return baseMapper.insertBatch(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal grossOutput(Long projectId, String yue) {
|
||||
//项目id不能为空
|
||||
if (projectId == null){
|
||||
throw new RuntimeException("项目ID不能为空");
|
||||
}
|
||||
//年月可以为空,但是如果有值格式那么就必须是yyyy-MM
|
||||
if (yue != null){
|
||||
if (!yue.matches("\\d{4}-\\d{2}")){
|
||||
throw new RuntimeException("年月格式错误");
|
||||
}
|
||||
}
|
||||
final String[] arr = {"1","2","3"}; //到货的几个状态
|
||||
List<GrossOutputRes> list = baseMapper.grossOutput(projectId, arr, yue);
|
||||
//计算出所有的订单数量
|
||||
BigDecimal resBigDecimal = new BigDecimal(0);
|
||||
for (GrossOutputRes grossOutputRes : list) {
|
||||
BigDecimal multiply = new BigDecimal(grossOutputRes.getAcceptanceQuantity()).multiply(grossOutputRes.getUnitPrice());
|
||||
resBigDecimal = resBigDecimal.add(multiply);
|
||||
}
|
||||
return resBigDecimal;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,193 @@
|
||||
package org.dromara.cailiaoshebei.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
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.springframework.stereotype.Service;
|
||||
import org.dromara.cailiaoshebei.domain.bo.BusRepertoryDetailsBo;
|
||||
import org.dromara.cailiaoshebei.domain.vo.BusRepertoryDetailsVo;
|
||||
import org.dromara.cailiaoshebei.domain.BusRepertoryDetails;
|
||||
import org.dromara.cailiaoshebei.mapper.BusRepertoryDetailsMapper;
|
||||
import org.dromara.cailiaoshebei.service.IBusRepertoryDetailsService;
|
||||
import scala.Int;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 物资-库存Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class BusRepertoryDetailsServiceImpl extends ServiceImpl<BusRepertoryDetailsMapper, BusRepertoryDetails> implements IBusRepertoryDetailsService {
|
||||
|
||||
private final BusRepertoryDetailsMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询物资-库存
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 物资-库存
|
||||
*/
|
||||
@Override
|
||||
public BusRepertoryDetailsVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询物资-库存列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 物资-库存分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<BusRepertoryDetailsVo> queryPageList(BusRepertoryDetailsBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<BusRepertoryDetails> lqw = buildQueryWrapper(bo);
|
||||
Page<BusRepertoryDetailsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的物资-库存列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 物资-库存列表
|
||||
*/
|
||||
@Override
|
||||
public List<BusRepertoryDetailsVo> queryList(BusRepertoryDetailsBo bo) {
|
||||
LambdaQueryWrapper<BusRepertoryDetails> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<BusRepertoryDetails> buildQueryWrapper(BusRepertoryDetailsBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<BusRepertoryDetails> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(BusRepertoryDetails::getId);
|
||||
lqw.eq(bo.getProjectId() != null, BusRepertoryDetails::getProjectId, bo.getProjectId());
|
||||
lqw.eq(bo.getRepertoryId() != null, BusRepertoryDetails::getRepertoryId, bo.getRepertoryId());
|
||||
lqw.eq(bo.getMaterialsorderId() != null, BusRepertoryDetails::getMaterialsorderId, bo.getMaterialsorderId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getMaterialCode()), BusRepertoryDetails::getMaterialCode, bo.getMaterialCode());
|
||||
lqw.eq(bo.getOriginalQuantity() != null, BusRepertoryDetails::getOriginalQuantity, bo.getOriginalQuantity());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getChangeReasons()), BusRepertoryDetails::getChangeReasons, bo.getChangeReasons());
|
||||
lqw.eq(bo.getChangeQuantity() != null, BusRepertoryDetails::getChangeQuantity, bo.getChangeQuantity());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getOperationStatus()), BusRepertoryDetails::getOperationStatus, bo.getOperationStatus());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getOperationName()), BusRepertoryDetails::getOperationName, bo.getOperationName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getOperationPhone()), BusRepertoryDetails::getOperationPhone, bo.getOperationPhone());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增物资-库存
|
||||
*
|
||||
* @param bo 物资-库存
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(BusRepertoryDetailsBo bo) {
|
||||
BusRepertoryDetails entity = new BusRepertoryDetails();
|
||||
BusRepertoryDetails add = MapstructUtils.convert(bo, BusRepertoryDetails.class);
|
||||
validEntityBeforeSave(add);
|
||||
//1、获取当前数据的最后一条数据,如果没有就直接新增,如果有就获取到上一条然后进行计算
|
||||
LambdaQueryWrapper<BusRepertoryDetails> lwr = new LambdaQueryWrapper<>();
|
||||
lwr.eq(bo.getRepertoryId() != null, BusRepertoryDetails::getRepertoryId, bo.getRepertoryId());
|
||||
lwr.orderByDesc(BusRepertoryDetails::getId);
|
||||
BusRepertoryDetails busRepertoryDetails = baseMapper.selectOne(lwr);
|
||||
//2、为空,直接新增
|
||||
if (busRepertoryDetails==null){
|
||||
add.setFinalNumber(add.getOriginalQuantity());
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
//3、不为空,就需要对库存的数据进行操作
|
||||
else{
|
||||
int finalNum = 0;
|
||||
String operationStatus = add.getOperationStatus();
|
||||
if ("1,4".contains(operationStatus)){
|
||||
finalNum = busRepertoryDetails.getFinalNumber()+add.getChangeQuantity();
|
||||
}else if ("2,3".contains(operationStatus)){
|
||||
finalNum = busRepertoryDetails.getFinalNumber()-add.getChangeQuantity();
|
||||
if (finalNum<0){
|
||||
throw new RuntimeException("库存不足");
|
||||
}
|
||||
}
|
||||
add.setOriginalQuantity(busRepertoryDetails.getFinalNumber());
|
||||
add.setFinalNumber(finalNum);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改物资-库存
|
||||
*
|
||||
* @param bo 物资-库存
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(BusRepertoryDetailsBo bo) {
|
||||
BusRepertoryDetails update = MapstructUtils.convert(bo, BusRepertoryDetails.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(BusRepertoryDetails entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除物资-库存信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 库存数据变更
|
||||
*
|
||||
* @param bo 物资-库存
|
||||
* @return 是否变更成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean InventoryDataModification(BusRepertoryDetailsBo bo) {
|
||||
// //1、查询当前库存id下是否有数据),如若没有就新增,有就获取到最新的一条
|
||||
// BusRepertoryDetails details = baseMapper.selectOne(Wrappers.lambdaQuery(BusRepertoryDetails.class).eq(BusRepertoryDetails::getRepertoryId, bo.getRepertoryId()));
|
||||
// if(details == null){
|
||||
// //2、如果没有数据,就直接新增
|
||||
// return insertByBo(bo);
|
||||
// }
|
||||
// //3、如果有数据,就获取到最新的一条数据,进行变更
|
||||
// details.setChangeQuantity(details.getChangeQuantity() + bo.getChangeQuantity());
|
||||
// return updateByBo(details);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,143 @@
|
||||
package org.dromara.cailiaoshebei.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
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.springframework.stereotype.Service;
|
||||
import org.dromara.cailiaoshebei.domain.bo.BusRepertoryBo;
|
||||
import org.dromara.cailiaoshebei.domain.vo.BusRepertoryVo;
|
||||
import org.dromara.cailiaoshebei.domain.BusRepertory;
|
||||
import org.dromara.cailiaoshebei.mapper.BusRepertoryMapper;
|
||||
import org.dromara.cailiaoshebei.service.IBusRepertoryService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 物资-库存详情Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-04
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class BusRepertoryServiceImpl extends ServiceImpl<BusRepertoryMapper, BusRepertory> implements IBusRepertoryService {
|
||||
|
||||
private final BusRepertoryMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询物资-库存详情
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 物资-库存详情
|
||||
*/
|
||||
@Override
|
||||
public BusRepertoryVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询物资-库存详情列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 物资-库存详情分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<BusRepertoryVo> queryPageList(BusRepertoryBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<BusRepertory> lqw = buildQueryWrapper(bo);
|
||||
Page<BusRepertoryVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的物资-库存详情列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 物资-库存详情列表
|
||||
*/
|
||||
@Override
|
||||
public List<BusRepertoryVo> queryList(BusRepertoryBo bo) {
|
||||
LambdaQueryWrapper<BusRepertory> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<BusRepertory> buildQueryWrapper(BusRepertoryBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<BusRepertory> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(BusRepertory::getId);
|
||||
lqw.eq(bo.getProjectId() != null, BusRepertory::getProjectId, bo.getProjectId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getName()), BusRepertory::getName, bo.getName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getSpecification()), BusRepertory::getSpecification, bo.getSpecification());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增物资-库存详情
|
||||
*
|
||||
* @param bo 物资-库存详情
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(BusRepertoryBo bo) {
|
||||
//1、判断是否存在,存在就跳过
|
||||
LambdaQueryWrapper<BusRepertory> eq = Wrappers.lambdaQuery(BusRepertory.class)
|
||||
.eq(BusRepertory::getProjectId, bo.getProjectId())
|
||||
.eq(BusRepertory::getName, bo.getName())
|
||||
.eq(BusRepertory::getSpecification, bo.getSpecification());
|
||||
if (baseMapper.selectCount(eq) > 0) {
|
||||
return true;
|
||||
}
|
||||
//2、不存在就新增
|
||||
BusRepertory add = MapstructUtils.convert(bo, BusRepertory.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改物资-库存详情
|
||||
*
|
||||
* @param bo 物资-库存详情
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(BusRepertoryBo bo) {
|
||||
BusRepertory update = MapstructUtils.convert(bo, BusRepertory.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(BusRepertory entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除物资-库存详情信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@ -4,4 +4,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.cailiaoshebei.mapper.BusMaterialsorderMapper">
|
||||
|
||||
<select id="grossOutput" resultType="org.dromara.cailiaoshebei.domain.vo.GrossOutputRes">
|
||||
select
|
||||
a.acceptanceQuantity,
|
||||
b.unitPrice
|
||||
from
|
||||
bus_materialsorder a
|
||||
left join bus_suppliesprice b on a.suppliesprice_id = b.id
|
||||
<where>
|
||||
<if test="projectId != null">
|
||||
a.project_id = #{projectId}
|
||||
</if>
|
||||
<if test="statusArr != null">
|
||||
and a.material_status in
|
||||
<foreach collection="statusArr" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="yue != null">
|
||||
and DATE_FORMAT(a.actual_arrival, '%Y-%m') = #{yue}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -0,0 +1,7 @@
|
||||
<?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="org.dromara.cailiaoshebei.mapper.BusRepertoryDetailsMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,7 @@
|
||||
<?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="org.dromara.cailiaoshebei.mapper.BusRepertoryMapper">
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user