商品盘点相关代码新增
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.inventorymanage.appservice;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingDto;
|
||||
|
||||
/**
|
||||
* 商品盘点 appService
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-11
|
||||
*/
|
||||
public interface IProductStocktakingAppService {
|
||||
|
||||
/**
|
||||
* 添加/编辑商品盘点
|
||||
*
|
||||
* @param productStocktakingDto 盘点信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditProductStocktaking(ProductStocktakingDto productStocktakingDto);
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import com.openhis.web.inventorymanage.dto.InventoryReceiptDto;
|
||||
import com.openhis.web.inventorymanage.dto.InventorySearchParam;
|
||||
|
||||
/**
|
||||
* 采购入库 service
|
||||
* 采购入库 appService
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-08
|
||||
@@ -47,12 +47,12 @@ public interface IPurchaseInventoryAppService {
|
||||
R<?> addOrEditInventoryReceipt(InventoryReceiptDto inventoryReceiptDto);
|
||||
|
||||
/**
|
||||
* 删除方法
|
||||
* 删除单据
|
||||
*
|
||||
* @param supplyRequestId 主表id
|
||||
* @param supplyRequestId 供应请求id
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> deleteInventoryReceipt(Long supplyRequestId);
|
||||
R<?> deleteReceipt(Long supplyRequestId);
|
||||
|
||||
/**
|
||||
* 提交审批
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.openhis.web.inventorymanage.dto.SupplyItemDetailDto;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
|
||||
/**
|
||||
* 单据审批 service
|
||||
* 单据审批 appService
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-05
|
||||
@@ -46,13 +46,13 @@ public interface IReceiptApprovalAppService {
|
||||
List<ItemChargeDetailDto> getItemChargeDetail(List<Long> itemIdList);
|
||||
|
||||
/**
|
||||
* 审批通过
|
||||
* 入库单据审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param request 请求数据
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> approved(String busNo, HttpServletRequest request);
|
||||
R<?> purchaseInventoryApproved(String busNo, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 审批驳回
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.inventorymanage.appservice.impl;
|
||||
|
||||
import com.core.common.utils.DateUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.common.enums.SupplyCategory;
|
||||
import com.openhis.common.enums.SupplyType;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.inventorymanage.appservice.IProductStocktakingAppService;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingDto;
|
||||
|
||||
/**
|
||||
* 商品盘点 impl
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-11
|
||||
*/
|
||||
@Service
|
||||
public class ProductStocktakingAppServiceImpl implements IProductStocktakingAppService {
|
||||
|
||||
@Autowired
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
/**
|
||||
* 添加/编辑商品盘点
|
||||
*
|
||||
* @param productStocktakingDto 盘点信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> addOrEditProductStocktaking(ProductStocktakingDto productStocktakingDto) {
|
||||
// 初始化盘点信息
|
||||
SupplyRequest supplyRequest = new SupplyRequest();
|
||||
BeanUtils.copyProperties(productStocktakingDto, supplyRequest);
|
||||
|
||||
if (productStocktakingDto.getId() != null) {
|
||||
// 更新盘点信息
|
||||
supplyRequestService.updateById(supplyRequest);
|
||||
} else {
|
||||
// 生成待发送的盘点单据
|
||||
supplyRequest
|
||||
// 单据分类:非库存供应
|
||||
.setCategoryEnum(SupplyCategory.STOCK_SUPPLY.getValue())
|
||||
// 单据类型:商品盘点
|
||||
.setTypeEnum(SupplyType.PRODUCT_INVENTORY.getValue())
|
||||
// 申请时间
|
||||
.setApplyTime(DateUtils.getNowDate());
|
||||
supplyRequestService.save(supplyRequest);
|
||||
}
|
||||
// 返回单据id
|
||||
return R.ok(supplyRequest.getId(), null);
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,6 @@ import java.util.HashSet;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.utils.AgeCalculatorUtil;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -21,6 +18,10 @@ import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.SupplyCategory;
|
||||
import com.openhis.common.enums.SupplyStatus;
|
||||
import com.openhis.common.enums.SupplyType;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.inventorymanage.appservice.IPurchaseInventoryAppService;
|
||||
import com.openhis.web.inventorymanage.dto.InventoryReceiptDto;
|
||||
@@ -28,7 +29,6 @@ import com.openhis.web.inventorymanage.dto.InventoryReceiptPageDto;
|
||||
import com.openhis.web.inventorymanage.dto.InventorySearchParam;
|
||||
import com.openhis.web.inventorymanage.mapper.PurchaseInventoryMapper;
|
||||
import com.openhis.workflow.domain.SupplyRequest;
|
||||
import com.openhis.workflow.mapper.SupplyRequestMapper;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
|
||||
/**
|
||||
@@ -128,13 +128,13 @@ public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppSer
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除方法
|
||||
* 删除单据
|
||||
*
|
||||
* @param supplyRequestId 主表id
|
||||
* @param supplyRequestId 供应请求id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> deleteInventoryReceipt(Long supplyRequestId) {
|
||||
public R<?> deleteReceipt(Long supplyRequestId) {
|
||||
// 删除单据
|
||||
boolean result = supplyRequestService.removeById(supplyRequestId);
|
||||
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null))
|
||||
|
||||
@@ -122,14 +122,14 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批通过
|
||||
* 入库单据审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param request 请求数据
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> approved(String busNo, HttpServletRequest request) {
|
||||
public R<?> purchaseInventoryApproved(String busNo, HttpServletRequest request) {
|
||||
// 获取登录者的信息
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
// 获取当前时间
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.inventorymanage.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.inventorymanage.appservice.IProductStocktakingAppService;
|
||||
import com.openhis.web.inventorymanage.appservice.IPurchaseInventoryAppService;
|
||||
import com.openhis.web.inventorymanage.dto.ProductStocktakingDto;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 商品盘点 controller
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/inventory-manage/stocktaking")
|
||||
@Slf4j
|
||||
public class ProductStocktakingController {
|
||||
|
||||
@Autowired
|
||||
private IProductStocktakingAppService productStocktakingAppService;
|
||||
|
||||
@Autowired
|
||||
private IPurchaseInventoryAppService purchaseInventoryAppService;
|
||||
|
||||
/**
|
||||
* 添加/编辑商品盘点
|
||||
*
|
||||
* @param productStocktakingDto 盘点信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/product-stocktaking")
|
||||
public R<?> addOrEditProductStocktaking(@Validated @RequestBody ProductStocktakingDto productStocktakingDto) {
|
||||
return productStocktakingAppService.addOrEditProductStocktaking(productStocktakingDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除盘点单据
|
||||
*
|
||||
* @param supplyRequestId 供应请求id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/product-stocktaking")
|
||||
public R<?> deleteProductStocktaking(@RequestParam Long supplyRequestId) {
|
||||
return purchaseInventoryAppService.deleteReceipt(supplyRequestId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/submit-approval")
|
||||
public R<?> submitApproval(@RequestParam String busNo) {
|
||||
return purchaseInventoryAppService.submitApproval(busNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤回审批
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/withdraw-approval")
|
||||
public R<?> withdrawApproval(@RequestParam String busNo) {
|
||||
return purchaseInventoryAppService.withdrawApproval(busNo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -91,14 +91,14 @@ public class PurchaseInventoryController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除方法
|
||||
* 删除单据
|
||||
*
|
||||
* @param supplyRequestId 主表id
|
||||
* @param supplyRequestId 供应请求id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@DeleteMapping("/inventory-receipt")
|
||||
public R<?> deleteInventoryReceipt(@RequestParam Long supplyRequestId) {
|
||||
return purchaseInventoryAppService.deleteInventoryReceipt(supplyRequestId);
|
||||
return purchaseInventoryAppService.deleteReceipt(supplyRequestId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,15 +31,27 @@ public class ReceiptApprovalController {
|
||||
private IReceiptApprovalAppService receiptApprovalAppService;
|
||||
|
||||
/**
|
||||
* 审批通过
|
||||
* 入库单据审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param request 请求数据
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PostMapping("/approved")
|
||||
@PostMapping("/purchase-inventory")
|
||||
public R<?> purchaseInventoryApproved(@RequestParam String busNo, HttpServletRequest request) {
|
||||
return receiptApprovalAppService.purchaseInventoryApproved(busNo, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品盘点单据审批通过
|
||||
*
|
||||
* @param busNo 单据号
|
||||
* @param request 请求数据
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PostMapping("/receipt-approved")
|
||||
public R<?> approved(@RequestParam String busNo, HttpServletRequest request) {
|
||||
return receiptApprovalAppService.approved(busNo, request);
|
||||
return receiptApprovalAppService.purchaseInventoryApproved(busNo, request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.inventorymanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 商品盘点 dto
|
||||
*
|
||||
* @author zwh
|
||||
* @date 2025-03-11
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ProductStocktakingDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** ID */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 项目 */
|
||||
private String itemTable;
|
||||
|
||||
/** 数量 */
|
||||
@NotNull
|
||||
@Min(1)
|
||||
private Integer itemQuantity;
|
||||
|
||||
/** 物品编码 */
|
||||
@NotNull
|
||||
private Long itemId;
|
||||
|
||||
/** 物品计量单位 */
|
||||
@NotNull
|
||||
private String unitCode;
|
||||
|
||||
/** 目的仓库类型 */
|
||||
@NotNull
|
||||
private Integer purposeTypeEnum;
|
||||
|
||||
/** 目的仓库 */
|
||||
@NotNull
|
||||
private Long purposeLocationId;
|
||||
|
||||
/** 目的仓位 */
|
||||
@NotNull
|
||||
private Long purposeLocationStoreId;
|
||||
|
||||
/** 申请人 */
|
||||
@NotNull
|
||||
private Long applicantId;
|
||||
|
||||
/** 申请时间 */
|
||||
private Date applyTime;
|
||||
|
||||
/** 产品批号 */
|
||||
@NotNull
|
||||
private String lotNumber;
|
||||
|
||||
/** 理由 */
|
||||
private String reason;
|
||||
|
||||
/** 理由类型 */
|
||||
@NotNull
|
||||
private String reasonCode;
|
||||
}
|
||||
@@ -4,29 +4,43 @@
|
||||
|
||||
<select id="selectInventoryReceiptPage"
|
||||
resultType="com.openhis.web.inventorymanage.dto.InventoryReceiptPageDto">
|
||||
SELECT id,
|
||||
bus_no,
|
||||
status_enum,
|
||||
supplier_id,
|
||||
purpose_location_id,
|
||||
approver_id,
|
||||
approval_time,
|
||||
applicant_id,
|
||||
apply_time,
|
||||
purpose_location_id
|
||||
FROM wor_supply_request
|
||||
SELECT T2.id,
|
||||
T2.bus_no,
|
||||
T2.status_enum,
|
||||
T2.supplier_id,
|
||||
T2.purpose_location_id,
|
||||
T2.approver_id,
|
||||
T2.approval_time,
|
||||
T2.applicant_id,
|
||||
T2.apply_time,
|
||||
T2.purpose_location_id,
|
||||
T2.tenant_id
|
||||
FROM (SELECT T1.id,
|
||||
T1.bus_no,
|
||||
T1.status_enum,
|
||||
T1.supplier_id,
|
||||
T1.purpose_location_id,
|
||||
T1.approver_id,
|
||||
T1.approval_time,
|
||||
T1.applicant_id,
|
||||
T1.apply_time,
|
||||
T1.purpose_location_id,
|
||||
T1.tenant_id
|
||||
FROM wor_supply_request AS T1
|
||||
WHERE type_enum = #{purchaseInventory}
|
||||
GROUP BY id,
|
||||
bus_no,
|
||||
status_enum,
|
||||
supplier_id,
|
||||
purpose_location_id,
|
||||
approver_id,
|
||||
approval_time,
|
||||
applicant_id,
|
||||
apply_time,
|
||||
purpose_location_id
|
||||
ORDER BY bus_no desc
|
||||
GROUP BY T1.id,
|
||||
T1.bus_no,
|
||||
T1.status_enum,
|
||||
T1.supplier_id,
|
||||
T1.purpose_location_id,
|
||||
T1.approver_id,
|
||||
T1.approval_time,
|
||||
T1.applicant_id,
|
||||
T1.apply_time,
|
||||
T1.purpose_location_id,
|
||||
T1.tenant_id
|
||||
ORDER BY T1.bus_no desc
|
||||
) AS T2
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -29,7 +29,12 @@ public enum SupplyType {
|
||||
/**
|
||||
* 汇总发药
|
||||
*/
|
||||
DISPENSING_AGGREGATION(3, "汇总发药");
|
||||
DISPENSING_AGGREGATION(3, "汇总发药"),
|
||||
|
||||
/**
|
||||
* 商品盘点
|
||||
*/
|
||||
PRODUCT_INVENTORY(4, "商品盘点");
|
||||
|
||||
private Integer value;
|
||||
private String info;
|
||||
|
||||
@@ -86,6 +86,9 @@ public class SupplyRequest extends HisBaseEntity {
|
||||
/** 理由 */
|
||||
private String reason;
|
||||
|
||||
/** 理由类型 */
|
||||
private String reasonCode;
|
||||
|
||||
/** 源仓库类型 */
|
||||
private Integer sourceTypeEnum;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user