parent
e327e0ed44
commit
183502d39f
32 changed files with 2229 additions and 0 deletions
@ -0,0 +1,25 @@ |
|||||||
|
package org.springblade.wms.pojo.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import org.springblade.wms.pojo.entity.StWarehouseTransferRecord; |
||||||
|
|
||||||
|
import java.io.Serial; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StWarehouseTransferRecordDTO |
||||||
|
* @description: 转移入库记录表 数据传输对象实体类 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-06 15:50 |
||||||
|
**/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class StWarehouseTransferRecordDTO extends StWarehouseTransferRecord { |
||||||
|
@Serial |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,25 @@ |
|||||||
|
package org.springblade.wms.pojo.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import org.springblade.wms.pojo.entity.StWmsRequest; |
||||||
|
|
||||||
|
import java.io.Serial; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StWmsRequestDTO |
||||||
|
* @description: 仓库提请记录 数据传输对象实体类 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-20 10:53 |
||||||
|
**/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class StWmsRequestDTO extends StWmsRequest { |
||||||
|
@Serial |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,65 @@ |
|||||||
|
package org.springblade.wms.pojo.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import org.springblade.core.tenant.mp.TenantEntity; |
||||||
|
|
||||||
|
import java.io.Serial; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StUserRight |
||||||
|
* @description: 人员权限表 实体类 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-20 14:55 |
||||||
|
**/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@TableName("ST_USER_RIGHT") |
||||||
|
@Schema(description = "StUserRight对象") |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class StUserRight extends TenantEntity { |
||||||
|
|
||||||
|
@Serial |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* 用户ID |
||||||
|
*/ |
||||||
|
@Schema(description = "用户ID") |
||||||
|
private Long userId; |
||||||
|
/** |
||||||
|
* 业务类别 |
||||||
|
*/ |
||||||
|
@Schema(description = "业务类别") |
||||||
|
private String urType; |
||||||
|
/** |
||||||
|
* 业务ID |
||||||
|
*/ |
||||||
|
@Schema(description = "业务ID") |
||||||
|
private Long theId; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Fields UR_TYPE_STOREHOUSE : 库管员 |
||||||
|
*/ |
||||||
|
public static String UR_TYPE_STOREHOUSE = "st_storehouse"; |
||||||
|
/** |
||||||
|
* @Fields JSON_KEY_DEPT : 用于穿梭框前后端识别标识符,部门 |
||||||
|
*/ |
||||||
|
public final static String JSON_KEY_DEPT = "dept-"; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Fields JSON_KEY_USER : 用于穿梭框前后端识别标识符,用户 |
||||||
|
*/ |
||||||
|
public final static String JSON_KEY_USER = "user-"; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Fields JSON_KEY_USER : 用于穿梭框前后端识别标识符,业务 |
||||||
|
*/ |
||||||
|
public final static String JSON_KEY_THEID = "theId-"; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,40 @@ |
|||||||
|
package org.springblade.wms.pojo.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import org.springblade.core.tenant.mp.TenantEntity; |
||||||
|
|
||||||
|
import java.io.Serial; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StWarehouseTransferRecord |
||||||
|
* @description: 转移入库记录表 实体类 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-06 15:39 |
||||||
|
**/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@TableName("ST_WAREHOUSE_TRANSFER_RECORD") |
||||||
|
@Schema(description = "StWarehouseTransferRecord对象") |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class StWarehouseTransferRecord extends TenantEntity { |
||||||
|
|
||||||
|
@Serial |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* 出入库ID(关联st_stock_inout_record表主键) |
||||||
|
*/ |
||||||
|
@Schema(description = "出入库ID(关联st_stock_inout_record表主键)") |
||||||
|
private Long sirId; |
||||||
|
|
||||||
|
/** |
||||||
|
* erp库转移ID(关联st_erp_warehouse_transfer表主键) |
||||||
|
*/ |
||||||
|
@Schema(description = "erp库转移ID(关联st_erp_warehouse_transfer表主键)") |
||||||
|
private Long ewtId; |
||||||
|
} |
||||||
@ -0,0 +1,111 @@ |
|||||||
|
package org.springblade.wms.pojo.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import org.springblade.core.tenant.mp.TenantEntity; |
||||||
|
|
||||||
|
import java.io.Serial; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StWmsRequest |
||||||
|
* @description: 仓库提请记录 实体类 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-20 10:51 |
||||||
|
**/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@TableName("ST_WMS_REQUEST") |
||||||
|
@Schema(description = "StWmsRequest对象") |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class StWmsRequest extends TenantEntity { |
||||||
|
|
||||||
|
@Serial |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* 采购单 |
||||||
|
*/ |
||||||
|
@Schema(description = "采购单") |
||||||
|
private Long boId; |
||||||
|
/** |
||||||
|
* 提请单号 |
||||||
|
*/ |
||||||
|
@Schema(description = "提请单号") |
||||||
|
private String reqCode; |
||||||
|
/** |
||||||
|
* 提请数量 |
||||||
|
*/ |
||||||
|
@Schema(description = "提请数量") |
||||||
|
private Double requestQty; |
||||||
|
/** |
||||||
|
* 审批状态;-1 |
||||||
|
*/ |
||||||
|
@Schema(description = "审批状态;-1") |
||||||
|
private Short approvalStatus; |
||||||
|
/** |
||||||
|
* erp审批状态;-1 |
||||||
|
*/ |
||||||
|
@Schema(description = "erp审批状态;-1") |
||||||
|
private Short erpApprovalStatus; |
||||||
|
/** |
||||||
|
* 备注 |
||||||
|
*/ |
||||||
|
@Schema(description = "备注") |
||||||
|
private String memo; |
||||||
|
|
||||||
|
/** |
||||||
|
* 初始状态(未发送审批) |
||||||
|
*/ |
||||||
|
public static final short APPROVAL_STATUS_NEW = -1; |
||||||
|
|
||||||
|
/** |
||||||
|
* 审批中(审批中) |
||||||
|
*/ |
||||||
|
public static final short APPROVAL_STATUS_CHECKING = 0; |
||||||
|
|
||||||
|
/** |
||||||
|
* 审批完毕(审批通过) |
||||||
|
*/ |
||||||
|
public static final short APPROVAL_STATUS_CHECKED = 1; |
||||||
|
|
||||||
|
/** |
||||||
|
* 变更待审中 |
||||||
|
*/ |
||||||
|
public static final short APPROVAL_STATUS_CHANGE_WAITING_FOR_CHECKUP = 2; |
||||||
|
|
||||||
|
/** |
||||||
|
* 变更中 |
||||||
|
*/ |
||||||
|
public static final short APPROVAL_STATUS_CHANGING = 3; |
||||||
|
|
||||||
|
/** |
||||||
|
* 打回 |
||||||
|
*/ |
||||||
|
public static final short APPROVAL_STATUS_RETURN = 4; |
||||||
|
|
||||||
|
/** |
||||||
|
* 审批未通过 |
||||||
|
*/ |
||||||
|
public static final short APPROVAL_STATUS_UNPASS = 10; |
||||||
|
|
||||||
|
/** |
||||||
|
* 已完成 |
||||||
|
*/ |
||||||
|
public static final short APPROVAL_STATUS_COMPLETE = 20; |
||||||
|
|
||||||
|
/** |
||||||
|
* 已作废 |
||||||
|
*/ |
||||||
|
public static final short APPROVAL_STATUS_CANCEL = 21; |
||||||
|
|
||||||
|
/** |
||||||
|
* 已变更 |
||||||
|
*/ |
||||||
|
public static final short APPROVAL_STATUS_CHANGE_OK = 22; |
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,46 @@ |
|||||||
|
package org.springblade.wms.pojo.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import org.springblade.core.tenant.mp.TenantEntity; |
||||||
|
|
||||||
|
import java.io.Serial; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName SyDockingLog |
||||||
|
* @description: 接口对接日志 实体类 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-16 17:01 |
||||||
|
**/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@TableName("SY_DOCKING_LOG") |
||||||
|
@Schema(description = "SyDockingLog对象") |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class SyDockingLog extends TenantEntity { |
||||||
|
|
||||||
|
@Serial |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* 业务类型;1.生产计划,2.PDM工艺对接,3.自动分派 |
||||||
|
*/ |
||||||
|
@Schema(description = "业务类型;1.生产计划,2.PDM工艺对接,3.自动分派") |
||||||
|
private String readType; |
||||||
|
/** |
||||||
|
* 业务主编码 |
||||||
|
*/ |
||||||
|
@Schema(description = "业务主编码") |
||||||
|
private String code; |
||||||
|
/** |
||||||
|
* 读取结果 |
||||||
|
*/ |
||||||
|
@Schema(description = "读取结果") |
||||||
|
private String readResult; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,23 @@ |
|||||||
|
package org.springblade.wms.pojo.entity; |
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName UserNode |
||||||
|
* @description: |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-20 16:38 |
||||||
|
**/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@AllArgsConstructor |
||||||
|
public class UserNode { |
||||||
|
@Schema(description = "用户ID") |
||||||
|
private String id; |
||||||
|
@Schema(description = "用户姓名") |
||||||
|
private String name; |
||||||
|
} |
||||||
@ -0,0 +1,25 @@ |
|||||||
|
package org.springblade.wms.pojo.vo; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import org.springblade.wms.pojo.entity.StStorehouse; |
||||||
|
|
||||||
|
import java.io.Serial; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StStorehouseVO |
||||||
|
* @description: 库房维护表 视图实体类 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2025-12-18 14:18 |
||||||
|
**/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class StStorehouseVO extends StStorehouse { |
||||||
|
@Serial |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,26 @@ |
|||||||
|
package org.springblade.wms.pojo.vo; |
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import org.springblade.wms.pojo.entity.StWarehouseTransferRecord; |
||||||
|
|
||||||
|
import java.io.Serial; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StWarehouseTransferRecordVO |
||||||
|
* @description: 转移入库记录表 视图实体类 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-06 15:51 |
||||||
|
**/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class StWarehouseTransferRecordVO extends StWarehouseTransferRecord { |
||||||
|
@Serial |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,76 @@ |
|||||||
|
package org.springblade.wms.pojo.vo; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import org.springblade.wms.pojo.entity.StWmsRequest; |
||||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||||
|
|
||||||
|
import java.io.Serial; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StWmsRequestVO |
||||||
|
* @description: 仓库提请记录 视图实体类 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-20 10:55 |
||||||
|
**/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
public class StWmsRequestVO extends StWmsRequest { |
||||||
|
@Serial |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
@TableField(exist = false) |
||||||
|
@Schema(description = "采购单号") |
||||||
|
private String boCode; |
||||||
|
|
||||||
|
@TableField(exist = false) |
||||||
|
@Schema(description = "物料编号") |
||||||
|
private String goodsCode; |
||||||
|
|
||||||
|
@TableField(exist = false) |
||||||
|
@Schema(description = "物料名称") |
||||||
|
private String goodsName; |
||||||
|
|
||||||
|
@TableField(exist = false) |
||||||
|
@Schema(description = "型号/牌号") |
||||||
|
private String materialModel; |
||||||
|
|
||||||
|
@TableField(exist = false) |
||||||
|
@Schema(description = "物料规格") |
||||||
|
private String specifications; |
||||||
|
|
||||||
|
@TableField(exist = false) |
||||||
|
@Schema(description = "采购数量") |
||||||
|
private Double buyQty; |
||||||
|
|
||||||
|
@TableField(exist = false) |
||||||
|
@Schema(description = "等级/生产标识") |
||||||
|
private String grade; |
||||||
|
|
||||||
|
@TableField(exist = false) |
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||||
|
@Schema(description = "申报日期") |
||||||
|
private Date declareDate; |
||||||
|
|
||||||
|
@TableField(exist = false) |
||||||
|
@Schema(description = "提请人") |
||||||
|
private String createName; |
||||||
|
|
||||||
|
@TableField(exist = false) |
||||||
|
@Schema(description = "已提请数量") |
||||||
|
private Double drawQuantity; |
||||||
|
|
||||||
|
@TableField(exist = false) |
||||||
|
@Schema(description = "用户角色名") |
||||||
|
private String userRoleName; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,166 @@ |
|||||||
|
package org.springblade.wms.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||||
|
import io.swagger.v3.oas.annotations.Parameter; |
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||||
|
import jakarta.validation.Valid; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import org.springblade.core.log.exception.ServiceException; |
||||||
|
import org.springblade.core.mp.support.Condition; |
||||||
|
import org.springblade.core.mp.support.Query; |
||||||
|
import org.springblade.core.secure.BladeUser; |
||||||
|
import org.springblade.core.secure.utils.AuthUtil; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springblade.core.tool.utils.Func; |
||||||
|
import org.springblade.wms.pojo.dto.ClassOutboundDTO; |
||||||
|
import org.springblade.wms.pojo.entity.StClassRequest; |
||||||
|
import org.springblade.wms.pojo.entity.StRealtimeStock; |
||||||
|
import org.springblade.wms.pojo.vo.StClassRequestVO; |
||||||
|
import org.springblade.wms.service.IStClassRequestService; |
||||||
|
import org.springblade.wms.wrapper.StClassRequestWrapper; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StTeamRequestController |
||||||
|
* @description: |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-09 11:39 |
||||||
|
**/ |
||||||
|
@RestController |
||||||
|
@AllArgsConstructor |
||||||
|
@RequestMapping("/StTeamRequest") |
||||||
|
@Tag(name = "班组提请领料出库", description = "班组提请领料出库接口") |
||||||
|
public class StTeamRequestController { |
||||||
|
|
||||||
|
private final IStClassRequestService stClassRequestService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 班组提请领料出库 分页 |
||||||
|
*/ |
||||||
|
@GetMapping("/list") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@Operation(summary = "分页", description = "传入stClassRequest") |
||||||
|
public R<IPage<StClassRequestVO>> list( |
||||||
|
@Parameter(hidden = true) @RequestParam Map<String, Object> stClassRequest, Query query) { |
||||||
|
|
||||||
|
if (stClassRequest == null) { |
||||||
|
stClassRequest = new HashMap<>(); |
||||||
|
} |
||||||
|
QueryWrapper<StClassRequest> wrapper = Condition.getQueryWrapper(stClassRequest, StClassRequest.class); |
||||||
|
wrapper.eq("cur_status", StClassRequest.CURSTATUS_RELEASED); |
||||||
|
|
||||||
|
// 2. 数据权限:当前用户工厂
|
||||||
|
BladeUser user = AuthUtil.getUser(); |
||||||
|
if (user != null && user.getDeptId() != null) { |
||||||
|
wrapper.eq("create_dept", user.getDeptId()); |
||||||
|
} |
||||||
|
|
||||||
|
IPage<StClassRequest> pages = stClassRequestService.page(Condition.getPage(query), wrapper); |
||||||
|
return R.data(StClassRequestWrapper.build().pageVO(pages)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 班组提请领料出库 自定义分页 |
||||||
|
*/ |
||||||
|
@GetMapping("/page") |
||||||
|
@ApiOperationSupport(order = 2) |
||||||
|
@Operation(summary = "分页", description = "传入stClassRequest") |
||||||
|
public R<IPage<StClassRequestVO>> page(StClassRequestVO stClassRequest, Query query) { |
||||||
|
/* 1. 固定条件:已发布 */ |
||||||
|
stClassRequest.setCurStatus(StClassRequest.CURSTATUS_RELEASED); |
||||||
|
/* 2. 数据权限:当前用户部门 */ |
||||||
|
BladeUser user = AuthUtil.getUser(); |
||||||
|
if (user != null && user.getDeptId() != null) { |
||||||
|
stClassRequest.setDeptId(user.getDeptId()); |
||||||
|
} |
||||||
|
IPage<StClassRequestVO> pages = stClassRequestService.selectStTeamRequestPage(Condition.getPage(query), stClassRequest); |
||||||
|
return R.data(pages); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 班组提请表 删除 |
||||||
|
*/ |
||||||
|
@PostMapping("/remove") |
||||||
|
@ApiOperationSupport(order = 3) |
||||||
|
@Operation(summary = "逻辑删除", description = "传入ids") |
||||||
|
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { |
||||||
|
return R.status(stClassRequestService.deleteLogic(Func.toLongList(ids))); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 班组提请修改 |
||||||
|
*/ |
||||||
|
@PostMapping("/classRequestOutbound") |
||||||
|
@ApiOperationSupport(order = 4) |
||||||
|
@Operation(summary = "班组提请修改", description = "传入出库列表") |
||||||
|
public R<Void> classRequestOutbound(@Valid @RequestBody List<ClassOutboundDTO> list) { |
||||||
|
if (CollUtil.isEmpty(list)) { |
||||||
|
throw new ServiceException("出库列表不能为空"); |
||||||
|
} |
||||||
|
Long userId = AuthUtil.getUserId(); |
||||||
|
for (ClassOutboundDTO dto : list) { |
||||||
|
stClassRequestService.classRequestOutbound( |
||||||
|
dto.getCrId(), |
||||||
|
dto.getCurrentOutQty(), |
||||||
|
dto.getRlsId(), |
||||||
|
userId); |
||||||
|
} |
||||||
|
return R.success(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 班组提请领料出库 |
||||||
|
*/ |
||||||
|
@PostMapping("/batchOut") |
||||||
|
@ApiOperationSupport(order = 5) |
||||||
|
@Operation(summary = "批量班组提请领料出库", description = "传入 crId 集合") |
||||||
|
public R<Void> batchOut(@RequestBody List<ClassOutboundDTO> list) { |
||||||
|
if (CollUtil.isEmpty(list)) { |
||||||
|
throw new ServiceException("crId 集合不能为空"); |
||||||
|
} |
||||||
|
stClassRequestService.batchOut(list, AuthUtil.getUser()); |
||||||
|
return R.success(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 班组提请领料出库 扫码出库 |
||||||
|
*/ |
||||||
|
@PostMapping("/scanSubmit") |
||||||
|
@ApiOperationSupport(order = 6) |
||||||
|
@Operation(summary = "扫码出库", description = "通过物料编码(条形码)生成其他出库数据") |
||||||
|
public R scanSubmit( @RequestParam String crCode) { |
||||||
|
StClassRequest stClassRequest = stClassRequestService.getByCrCode(crCode); |
||||||
|
|
||||||
|
if (stClassRequest == null) { |
||||||
|
throw new ServiceException("未找到对应库存物料!"); |
||||||
|
} |
||||||
|
|
||||||
|
return R.data(stClassRequest); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 关闭订单 |
||||||
|
*/ |
||||||
|
@PostMapping("/complete") |
||||||
|
@ApiOperationSupport(order = 7) |
||||||
|
@Operation(summary = "关闭订单", description = "传入ID") |
||||||
|
public R<Boolean> complete(@RequestParam Long id) { |
||||||
|
if (Func.isNull(id)) { |
||||||
|
return R.fail("提请ID不能为空,无法完成操作"); |
||||||
|
} |
||||||
|
StClassRequest stClassRequest = stClassRequestService.getById(id); |
||||||
|
stClassRequest.setCurStatus(stClassRequest.CURSTATUS_COMPLETE); |
||||||
|
stClassRequestService.updateById(stClassRequest); |
||||||
|
return R.success(); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,175 @@ |
|||||||
|
package org.springblade.wms.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||||
|
import io.swagger.v3.oas.annotations.Parameter; |
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import jakarta.validation.Valid; |
||||||
|
|
||||||
|
import org.springblade.core.secure.BladeUser; |
||||||
|
import org.springblade.core.secure.annotation.IsAdmin; |
||||||
|
import org.springblade.core.mp.support.Condition; |
||||||
|
import org.springblade.core.mp.support.Query; |
||||||
|
import org.springblade.core.secure.utils.AuthUtil; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springblade.core.tool.utils.Func; |
||||||
|
import org.springblade.system.pojo.entity.Dept; |
||||||
|
import org.springblade.wms.pojo.entity.StClassRequest; |
||||||
|
import org.springblade.wms.pojo.entity.StWmsRequest; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import org.springblade.wms.pojo.vo.StWmsRequestVO; |
||||||
|
import org.springblade.wms.excel.StWmsRequestExcel; |
||||||
|
import org.springblade.wms.wrapper.StWmsRequestWrapper; |
||||||
|
import org.springblade.wms.service.IStWmsRequestService; |
||||||
|
import org.springblade.core.boot.ctrl.BladeController; |
||||||
|
import org.springblade.core.tool.utils.DateUtil; |
||||||
|
import org.springblade.core.excel.util.ExcelUtil; |
||||||
|
import org.springblade.core.tool.constant.BladeConstant; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.List; |
||||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StWmsRequestController |
||||||
|
* @description: 仓库提请记录 控制器 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-20 11:06 |
||||||
|
**/ |
||||||
|
|
||||||
|
@RestController |
||||||
|
@AllArgsConstructor |
||||||
|
@RequestMapping("/stWmsRequest") |
||||||
|
@Tag(name = "仓库提请记录", description = "仓库提请记录接口") |
||||||
|
public class StWmsRequestController extends BladeController { |
||||||
|
|
||||||
|
private final IStWmsRequestService stWmsRequestService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 仓库提请记录 详情 |
||||||
|
*/ |
||||||
|
@GetMapping("/detail") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@Operation(summary = "详情", description = "传入stWmsRequest") |
||||||
|
public R<StWmsRequestVO> detail(StWmsRequest stWmsRequest) { |
||||||
|
StWmsRequest detail = stWmsRequestService.getOne(Condition.getQueryWrapper(stWmsRequest)); |
||||||
|
return R.data(StWmsRequestWrapper.build().entityVO(detail)); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 仓库提请记录 分页 |
||||||
|
*/ |
||||||
|
@GetMapping("/list") |
||||||
|
@ApiOperationSupport(order = 2) |
||||||
|
@Operation(summary = "分页", description = "传入stWmsRequest") |
||||||
|
public R<IPage<StWmsRequestVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> stWmsRequest, Query query) { |
||||||
|
IPage<StWmsRequest> pages = stWmsRequestService.page(Condition.getPage(query), Condition.getQueryWrapper(stWmsRequest, StWmsRequest.class)); |
||||||
|
return R.data(StWmsRequestWrapper.build().pageVO(pages)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 仓库提请记录 自定义分页 |
||||||
|
*/ |
||||||
|
@GetMapping("/page") |
||||||
|
@ApiOperationSupport(order = 3) |
||||||
|
@Operation(summary = "分页", description = "传入stWmsRequest") |
||||||
|
public R<IPage<StWmsRequestVO>> page(StWmsRequestVO stWmsRequest, Query query) { |
||||||
|
BladeUser user = AuthUtil.getUser(); |
||||||
|
String userRoleName = user.getRoleName(); |
||||||
|
stWmsRequest.setUserRoleName(userRoleName); |
||||||
|
if (StrUtil.isNotBlank(userRoleName) && userRoleName.contains("保管员")) { |
||||||
|
stWmsRequest.setApprovalStatus(StWmsRequest.APPROVAL_STATUS_CHECKING); |
||||||
|
} |
||||||
|
IPage<StWmsRequestVO> pages = stWmsRequestService.selectStWmsRequestPage(Condition.getPage(query), stWmsRequest); |
||||||
|
return R.data(pages); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 仓库提请记录 新增 |
||||||
|
*/ |
||||||
|
@PostMapping("/save") |
||||||
|
@ApiOperationSupport(order = 4) |
||||||
|
@Operation(summary = "新增", description = "传入stWmsRequest") |
||||||
|
public R save(@Valid @RequestBody StWmsRequest stWmsRequest) { |
||||||
|
return R.status(stWmsRequestService.save(stWmsRequest)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 仓库提请记录 修改 |
||||||
|
*/ |
||||||
|
@PostMapping("/update") |
||||||
|
@ApiOperationSupport(order = 5) |
||||||
|
@Operation(summary = "修改", description = "传入stWmsRequest") |
||||||
|
public R update(@Valid @RequestBody StWmsRequest stWmsRequest) { |
||||||
|
return R.status(stWmsRequestService.updateById(stWmsRequest)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 仓库提请提交(保存并直接提交) |
||||||
|
*/ |
||||||
|
@PostMapping("/submit") |
||||||
|
@ApiOperationSupport(order = 6) |
||||||
|
@Operation(summary = "提交仓库提请", description = "传入RbWmsRequest") |
||||||
|
public R submit(@Valid @RequestBody StWmsRequest stWmsRequest) { |
||||||
|
stWmsRequestService.saveOrEdit(stWmsRequest, AuthUtil.getUser()); |
||||||
|
return R.success(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 批量提交仓库提请 |
||||||
|
*/ |
||||||
|
@PostMapping("/submit/batch") |
||||||
|
@ApiOperationSupport(order = 7) |
||||||
|
@Operation(summary = "批量提交仓库提请", description = "传入List<StWmsRequest>") |
||||||
|
public R batchSubmit(@Valid @RequestBody List<StWmsRequest> stWmsRequestList) { |
||||||
|
if (stWmsRequestList == null || stWmsRequestList.isEmpty()) { |
||||||
|
return R.fail("批量提请列表不能为空"); |
||||||
|
} |
||||||
|
stWmsRequestService.batchSaveOrEdit(stWmsRequestList, AuthUtil.getUser()); |
||||||
|
return R.success("批量提请提交成功,共处理" + stWmsRequestList.size() + "条数据"); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 仓库提请审批(通过后自动提交) |
||||||
|
*/ |
||||||
|
@PostMapping("/approval/operate") |
||||||
|
@ApiOperationSupport(order = 8) |
||||||
|
@Operation(summary = "审批", description = "传入ids") |
||||||
|
public R<String> approvalOrder( @RequestParam Long id, @RequestParam Short approvalResult) { |
||||||
|
stWmsRequestService.approvalRequest(id, approvalResult, AuthUtil.getUser()); |
||||||
|
return R.success("审批操作成功"); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 仓库提请记录 删除 |
||||||
|
*/ |
||||||
|
@PostMapping("/remove") |
||||||
|
@ApiOperationSupport(order = 9) |
||||||
|
@Operation(summary = "逻辑删除", description = "传入ids") |
||||||
|
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { |
||||||
|
return R.status(stWmsRequestService.deleteLogic(Func.toLongList(ids))); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 导出数据 |
||||||
|
*/ |
||||||
|
@IsAdmin |
||||||
|
@GetMapping("/export-stWmsRequest") |
||||||
|
@ApiOperationSupport(order = 10) |
||||||
|
@Operation(summary = "导出数据", description = "传入stWmsRequest") |
||||||
|
public void exportStWmsRequest(@Parameter(hidden = true) @RequestParam Map<String, Object> stWmsRequest, BladeUser bladeUser, HttpServletResponse response) { |
||||||
|
QueryWrapper<StWmsRequest> queryWrapper = Condition.getQueryWrapper(stWmsRequest, StWmsRequest.class); |
||||||
|
//if (!AuthUtil.isAdministrator()) {
|
||||||
|
// queryWrapper.lambda().eq(StWmsRequest::getTenantId, bladeUser.getTenantId());
|
||||||
|
//}
|
||||||
|
//queryWrapper.lambda().eq(StWmsRequestEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
|
||||||
|
List<StWmsRequestExcel> list = stWmsRequestService.exportStWmsRequest(queryWrapper); |
||||||
|
ExcelUtil.export(response, "仓库提请记录数据" + DateUtil.time(), "仓库提请记录数据表", list, StWmsRequestExcel.class); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,80 @@ |
|||||||
|
package org.springblade.wms.excel; |
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||||
|
import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
||||||
|
import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serial; |
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StWmsRequestExcel |
||||||
|
* @description: 仓库提请记录 Excel实体类 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-20 10:57 |
||||||
|
**/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@ColumnWidth(25) |
||||||
|
@HeadRowHeight(20) |
||||||
|
@ContentRowHeight(18) |
||||||
|
public class StWmsRequestExcel implements Serializable { |
||||||
|
|
||||||
|
@Serial |
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* 是否已删除 |
||||||
|
*/ |
||||||
|
@ColumnWidth(20) |
||||||
|
@ExcelProperty("是否已删除") |
||||||
|
private Long isDeleted; |
||||||
|
/** |
||||||
|
* 采购单 |
||||||
|
*/ |
||||||
|
@ColumnWidth(20) |
||||||
|
@ExcelProperty("采购单") |
||||||
|
private Long boId; |
||||||
|
/** |
||||||
|
* 提请单号 |
||||||
|
*/ |
||||||
|
@ColumnWidth(20) |
||||||
|
@ExcelProperty("提请单号") |
||||||
|
private String reqCode; |
||||||
|
/** |
||||||
|
* 提请数量 |
||||||
|
*/ |
||||||
|
@ColumnWidth(20) |
||||||
|
@ExcelProperty("提请数量") |
||||||
|
private Double requestQty; |
||||||
|
/** |
||||||
|
* 审批状态;-1 |
||||||
|
*/ |
||||||
|
@ColumnWidth(20) |
||||||
|
@ExcelProperty("审批状态;-1") |
||||||
|
private Long approvalStatus; |
||||||
|
/** |
||||||
|
* 备注 |
||||||
|
*/ |
||||||
|
@ColumnWidth(20) |
||||||
|
@ExcelProperty("备注") |
||||||
|
private String memo; |
||||||
|
/** |
||||||
|
* 主键 |
||||||
|
*/ |
||||||
|
@ColumnWidth(20) |
||||||
|
@ExcelProperty("主键") |
||||||
|
private Long id; |
||||||
|
/** |
||||||
|
* 租户ID |
||||||
|
*/ |
||||||
|
@ColumnWidth(20) |
||||||
|
@ExcelProperty("租户ID") |
||||||
|
private String tenantId; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,56 @@ |
|||||||
|
package org.springblade.wms.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
import org.springblade.system.pojo.entity.User; |
||||||
|
import org.springblade.wms.excel.StStorehouseExcel; |
||||||
|
import org.springblade.wms.pojo.entity.StGoodsClass; |
||||||
|
import org.springblade.wms.pojo.entity.StStorehouse; |
||||||
|
import org.springblade.wms.pojo.vo.StStorehouseVO; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StStorehouseMapper |
||||||
|
* @description: 库房维护表 Mapper 接口 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2025-12-18 14:26 |
||||||
|
**/ |
||||||
|
|
||||||
|
public interface StStorehouseMapper extends BaseMapper<StStorehouse> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 自定义分页 |
||||||
|
* |
||||||
|
* @param page 分页参数 |
||||||
|
* @param stStorehouse 查询参数 |
||||||
|
* @return List<StStorehouseVO> |
||||||
|
*/ |
||||||
|
List<StStorehouseVO> selectStStorehousePage(IPage page, StStorehouseVO stStorehouse); |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 获取导出数据 |
||||||
|
* |
||||||
|
* @param queryWrapper 查询条件 |
||||||
|
* @return List<StStorehouseExcel> |
||||||
|
*/ |
||||||
|
List<StStorehouseExcel> exportStStorehouse(@Param("ew") Wrapper<StStorehouse> queryWrapper); |
||||||
|
|
||||||
|
|
||||||
|
StStorehouse checkName(@Param("id") Long id, @Param("shName") String shName); |
||||||
|
|
||||||
|
StStorehouse checkCode(@Param("id") Long id, @Param("shCode") String shCode); |
||||||
|
|
||||||
|
StStorehouse getUniqueByCode(String shCode); |
||||||
|
|
||||||
|
List<StStorehouse> findStorehouseList(Long userId, String urType, boolean choose); |
||||||
|
|
||||||
|
List<StStorehouseVO> selectStorehousePage(IPage<StStorehouseVO> page, StStorehouseVO stStorehouse, Long userId, String urTypeStorehouse); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,105 @@ |
|||||||
|
<?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.springblade.wms.mapper.StStorehouseMapper"> |
||||||
|
|
||||||
|
<!-- 通用查询映射结果 --> |
||||||
|
<resultMap id="stStorehouseResultMap" type="org.springblade.wms.pojo.entity.StStorehouse"> |
||||||
|
<result column="ID" property="id"/> |
||||||
|
<result column="TENANT_ID" property="tenantId"/> |
||||||
|
<result column="CREATE_USER" property="createUser"/> |
||||||
|
<result column="CREATE_DEPT" property="createDept"/> |
||||||
|
<result column="CREATE_TIME" property="createTime"/> |
||||||
|
<result column="UPDATE_USER" property="updateUser"/> |
||||||
|
<result column="UPDATE_TIME" property="updateTime"/> |
||||||
|
<result column="STATUS" property="status"/> |
||||||
|
<result column="IS_DELETED" property="isDeleted"/> |
||||||
|
<result column="SH_CODE" property="shCode"/> |
||||||
|
<result column="SH_NAME" property="shName"/> |
||||||
|
<result column="TYPE" property="type"/> |
||||||
|
<result column="TOOLING_TYPE" property="toolingType"/> |
||||||
|
<result column="SH_LEVEL" property="shLevel"/> |
||||||
|
<result column="DEPT_ID" property="deptId"/> |
||||||
|
<result column="SAVE_USER" property="saveUser"/> |
||||||
|
<result column="MEMO" property="memo"/> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
|
||||||
|
<select id="selectStStorehousePage" resultMap="stStorehouseResultMap"> |
||||||
|
select * from ST_STOREHOUSE where is_deleted = 0 |
||||||
|
</select> |
||||||
|
|
||||||
|
<select id="selectStorehousePage" resultMap="stStorehouseResultMap"> |
||||||
|
SELECT |
||||||
|
t.id, |
||||||
|
t.sh_name |
||||||
|
FROM st_storehouse t |
||||||
|
<where> |
||||||
|
t.is_deleted = 0 |
||||||
|
<if test="stStorehouse.shName != null and stStorehouse.shName != ''"> |
||||||
|
AND t.sh_name LIKE '%' || #{stStorehouse.shName} || '%' |
||||||
|
</if> |
||||||
|
AND t.id IN ( |
||||||
|
SELECT |
||||||
|
sur.the_id |
||||||
|
FROM st_user_right sur |
||||||
|
WHERE |
||||||
|
sur.user_id = #{userId} |
||||||
|
AND sur.is_deleted = 0 |
||||||
|
AND sur.ur_type = #{urTypeStorehouse} |
||||||
|
) |
||||||
|
</where> |
||||||
|
ORDER BY t.create_time DESC |
||||||
|
</select> |
||||||
|
|
||||||
|
<select id="exportStStorehouse" resultType="org.springblade.wms.excel.StStorehouseExcel"> |
||||||
|
SELECT * FROM ST_STOREHOUSE ${ew.customSqlSegment} |
||||||
|
</select> |
||||||
|
|
||||||
|
<!-- 校验名称是否重复 --> |
||||||
|
<select id="checkName" resultMap="stStorehouseResultMap"> |
||||||
|
SELECT * FROM ST_STOREHOUSE |
||||||
|
WHERE IS_DELETED = 0 |
||||||
|
AND SH_NAME = #{shName} |
||||||
|
</select> |
||||||
|
|
||||||
|
<!-- 校验是否重复 --> |
||||||
|
<select id="checkCode" resultMap="stStorehouseResultMap"> |
||||||
|
SELECT * FROM ST_STOREHOUSE |
||||||
|
WHERE IS_DELETED = 0 |
||||||
|
AND SH_CODE = #{shCode} |
||||||
|
</select> |
||||||
|
|
||||||
|
<select id="getUniqueByCode" resultMap="stStorehouseResultMap"> |
||||||
|
SELECT * |
||||||
|
FROM ST_STOREHOUSE |
||||||
|
WHERE SH_CODE = #{shCode} |
||||||
|
AND IS_DELETED = 0 |
||||||
|
AND ROWNUM = 1 |
||||||
|
</select> |
||||||
|
|
||||||
|
<select id="findStorehouseList" resultMap="stStorehouseResultMap"> |
||||||
|
SELECT a.* |
||||||
|
FROM ST_STOREHOUSE a |
||||||
|
LEFT JOIN ST_USER_RIGHT b |
||||||
|
ON a.ID = b.THE_ID |
||||||
|
AND b.UR_TYPE = #{urType} |
||||||
|
AND b.USER_ID = #{userId} |
||||||
|
-- AND b.ID IS NOT NULL |
||||||
|
AND b.IS_DELETED = 0 |
||||||
|
WHERE a.IS_DELETED = 0 |
||||||
|
<!-- <if test="deptId != null">--> |
||||||
|
<!-- AND a.DEPT_ID = #{deptId}--> |
||||||
|
<!-- </if>--> |
||||||
|
<if test="choose != null"> |
||||||
|
<if test="choose"> |
||||||
|
<!-- 已选中:要求关联表有匹配数据(b.ID 不为空) --> |
||||||
|
AND b.ID IS NOT NULL |
||||||
|
</if> |
||||||
|
<if test="!choose"> |
||||||
|
<!-- 未选中:要求关联表无匹配数据(b.ID 为空) --> |
||||||
|
AND b.ID IS NULL |
||||||
|
</if> |
||||||
|
</if> |
||||||
|
</select> |
||||||
|
</mapper> |
||||||
|
|
||||||
@ -0,0 +1,43 @@ |
|||||||
|
package org.springblade.wms.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import org.springblade.core.secure.BladeUser; |
||||||
|
import org.springblade.system.pojo.entity.User; |
||||||
|
import org.springblade.wms.pojo.entity.StUserRight; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StUserRightMapper |
||||||
|
* @description: 人员权限表 Mapper 接口 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-20 15:06 |
||||||
|
**/ |
||||||
|
|
||||||
|
public interface StUserRightMapper extends BaseMapper<StUserRight> { |
||||||
|
List<User> findNoUserRightByTheId(Long theId, String urType); |
||||||
|
|
||||||
|
List<StUserRight> findByTheIdAndUrType(Long theId, String urType); |
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 自定义分页
|
||||||
|
// *
|
||||||
|
// * @param page 分页参数
|
||||||
|
// * @param stUserRight 查询参数
|
||||||
|
// * @return List<StUserRightVO>
|
||||||
|
// */
|
||||||
|
// List<StUserRightVO> selectStUserRightPage(IPage page, StUserRightVO stUserRight);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 获取导出数据
|
||||||
|
// *
|
||||||
|
// * @param queryWrapper 查询条件
|
||||||
|
// * @return List<StUserRightExcel>
|
||||||
|
// */
|
||||||
|
// List<StUserRightExcel> exportStUserRight(@Param("ew") Wrapper<StUserRightEntity> queryWrapper);
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,51 @@ |
|||||||
|
<?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.springblade.wms.mapper.StUserRightMapper"> |
||||||
|
|
||||||
|
<!-- 通用查询映射结果 --> |
||||||
|
<resultMap id="stUserRightResultMap" type="org.springblade.wms.pojo.entity.StUserRight"> |
||||||
|
<result column="ID" property="id"/> |
||||||
|
<result column="TENANT_ID" property="tenantId"/> |
||||||
|
<result column="CREATE_USER" property="createUser"/> |
||||||
|
<result column="CREATE_DEPT" property="createDept"/> |
||||||
|
<result column="CREATE_TIME" property="createTime"/> |
||||||
|
<result column="UPDATE_USER" property="updateUser"/> |
||||||
|
<result column="UPDATE_TIME" property="updateTime"/> |
||||||
|
<result column="STATUS" property="status"/> |
||||||
|
<result column="IS_DELETED" property="isDeleted"/> |
||||||
|
<result column="USER_ID" property="userId"/> |
||||||
|
<result column="UR_TYPE" property="urType"/> |
||||||
|
<result column="THE_ID" property="theId"/> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
<select id="findNoUserRightByTheId" resultType="org.springblade.system.pojo.entity.User"> |
||||||
|
SELECT DISTINCT u.* |
||||||
|
FROM BLADE_USER u |
||||||
|
LEFT JOIN ST_USER_RIGHT r |
||||||
|
ON u.ID = r.USER_ID |
||||||
|
AND r.UR_TYPE = #{urType} |
||||||
|
AND r.THE_ID = #{theId} |
||||||
|
AND r.IS_DELETED = 0 |
||||||
|
WHERE r.ID IS NULL |
||||||
|
AND u.IS_DELETED = 0 |
||||||
|
</select> |
||||||
|
|
||||||
|
<select id="findByTheIdAndUrType" resultMap="stUserRightResultMap"> |
||||||
|
SELECT * |
||||||
|
FROM ST_USER_RIGHT |
||||||
|
WHERE THE_ID = #{theId} |
||||||
|
AND UR_TYPE = #{urType} |
||||||
|
AND IS_DELETED = 0 |
||||||
|
</select> |
||||||
|
|
||||||
|
<!-- <select id="selectStUserRightPage" resultMap="stUserRightResultMap">--> |
||||||
|
<!-- select * from ST_USER_RIGHT where is_deleted = 0--> |
||||||
|
<!-- </select>--> |
||||||
|
|
||||||
|
|
||||||
|
<!-- <select id="exportStUserRight" resultType="org.springblade.wms.excel.StUserRightExcel">--> |
||||||
|
<!-- SELECT * FROM ST_USER_RIGHT ${ew.customSqlSegment}--> |
||||||
|
<!-- </select>--> |
||||||
|
|
||||||
|
</mapper> |
||||||
|
|
||||||
@ -0,0 +1,40 @@ |
|||||||
|
package org.springblade.wms.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import org.springblade.wms.pojo.entity.StWarehouseTransferRecord; |
||||||
|
import org.springblade.wms.pojo.vo.StWarehouseTransferRecordVO; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StWarehouseTransferRecordMapper |
||||||
|
* @description: 转移入库记录表 Mapper 接口 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-06 15:55 |
||||||
|
**/ |
||||||
|
|
||||||
|
public interface StWarehouseTransferRecordMapper extends BaseMapper<StWarehouseTransferRecord> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 自定义分页 |
||||||
|
* |
||||||
|
* @param page 分页参数 |
||||||
|
* @param stWarehouseTransferRecord 查询参数 |
||||||
|
* @return List<StWarehouseTransferRecordVO> |
||||||
|
*/ |
||||||
|
List<StWarehouseTransferRecordVO> selectStWarehouseTransferRecordPage(IPage page, StWarehouseTransferRecordVO stWarehouseTransferRecord); |
||||||
|
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 获取导出数据
|
||||||
|
// *
|
||||||
|
// * @param queryWrapper 查询条件
|
||||||
|
// * @return List<StWarehouseTransferRecordExcel>
|
||||||
|
// */
|
||||||
|
// List<StWarehouseTransferRecordExcel> exportStWarehouseTransferRecord(@Param("ew") Wrapper<StWarehouseTransferRecordEntity> queryWrapper);
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,30 @@ |
|||||||
|
<?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.springblade.wms.mapper.StWarehouseTransferRecordMapper"> |
||||||
|
|
||||||
|
<!-- 通用查询映射结果 --> |
||||||
|
<resultMap id="stWarehouseTransferRecordResultMap" type="org.springblade.wms.pojo.entity.StWarehouseTransferRecord"> |
||||||
|
<result column="ID" property="id"/> |
||||||
|
<result column="TENANT_ID" property="tenantId"/> |
||||||
|
<result column="CREATE_USER" property="createUser"/> |
||||||
|
<result column="CREATE_DEPT" property="createDept"/> |
||||||
|
<result column="CREATE_TIME" property="createTime"/> |
||||||
|
<result column="UPDATE_USER" property="updateUser"/> |
||||||
|
<result column="UPDATE_TIME" property="updateTime"/> |
||||||
|
<result column="STATUS" property="status"/> |
||||||
|
<result column="IS_DELETED" property="isDeleted"/> |
||||||
|
<result column="SIR_ID" property="sirId"/> |
||||||
|
<result column="EWT_ID" property="ewtId"/> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
|
||||||
|
<select id="selectStWarehouseTransferRecordPage" resultMap="stWarehouseTransferRecordResultMap"> |
||||||
|
select * from ST_WAREHOUSE_TRANSFER_RECORD where is_deleted = 0 |
||||||
|
</select> |
||||||
|
|
||||||
|
|
||||||
|
<!-- <select id="exportStWarehouseTransferRecord" resultType="org.springblade.wms.excel.StWarehouseTransferRecordExcel">--> |
||||||
|
<!-- SELECT * FROM ST_WAREHOUSE_TRANSFER_RECORD ${ew.customSqlSegment}--> |
||||||
|
<!-- </select>--> |
||||||
|
|
||||||
|
</mapper> |
||||||
@ -0,0 +1,47 @@ |
|||||||
|
package org.springblade.wms.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
import org.springblade.wms.excel.StWmsRequestExcel; |
||||||
|
import org.springblade.wms.pojo.entity.StWmsRequest; |
||||||
|
import org.springblade.wms.pojo.vo.StWmsRequestVO; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StWmsRequestMapper |
||||||
|
* @description: 仓库提请记录 Mapper 接口 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-20 11:03 |
||||||
|
**/ |
||||||
|
|
||||||
|
public interface StWmsRequestMapper extends BaseMapper<StWmsRequest> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 自定义分页 |
||||||
|
* |
||||||
|
* @param page 分页参数 |
||||||
|
* @param stWmsRequest 查询参数 |
||||||
|
* @return List<StWmsRequestVO> |
||||||
|
*/ |
||||||
|
List<StWmsRequestVO> selectStWmsRequestPage(IPage page, StWmsRequestVO stWmsRequest); |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 获取导出数据 |
||||||
|
* |
||||||
|
* @param queryWrapper 查询条件 |
||||||
|
* @return List<StWmsRequestExcel> |
||||||
|
*/ |
||||||
|
List<StWmsRequestExcel> exportStWmsRequest(@Param("ew") Wrapper<StWmsRequest> queryWrapper); |
||||||
|
|
||||||
|
String getMaxByCodePattern(String codePattern); |
||||||
|
|
||||||
|
void sendErpBuyRequest(Map<String, Object> param); |
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,103 @@ |
|||||||
|
<?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.springblade.wms.mapper.StWmsRequestMapper"> |
||||||
|
|
||||||
|
<!-- 通用查询映射结果 --> |
||||||
|
<resultMap id="stWmsRequestResultMap" type="org.springblade.wms.pojo.entity.StWmsRequest"> |
||||||
|
<result column="UPDATE_TIME" property="updateTime"/> |
||||||
|
<result column="STATUS" property="status"/> |
||||||
|
<result column="IS_DELETED" property="isDeleted"/> |
||||||
|
<result column="BO_ID" property="boId"/> |
||||||
|
<result column="REQ_CODE" property="reqCode"/> |
||||||
|
<result column="REQUEST_QTY" property="requestQty"/> |
||||||
|
<result column="APPROVAL_STATUS" property="approvalStatus"/> |
||||||
|
<result column="MEMO" property="memo"/> |
||||||
|
<result column="ID" property="id"/> |
||||||
|
<result column="TENANT_ID" property="tenantId"/> |
||||||
|
<result column="CREATE_USER" property="createUser"/> |
||||||
|
<result column="CREATE_DEPT" property="createDept"/> |
||||||
|
<result column="CREATE_TIME" property="createTime"/> |
||||||
|
<result column="UPDATE_USER" property="updateUser"/> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
|
||||||
|
<select id="selectStWmsRequestPage" resultType="org.springblade.wms.pojo.vo.StWmsRequestVO"> |
||||||
|
SELECT |
||||||
|
t.*, |
||||||
|
-- 采购单表字段:采购单号、采购数量 |
||||||
|
po.bo_code, |
||||||
|
po.buy_qty, |
||||||
|
po.grade, |
||||||
|
po.batch_quantity, |
||||||
|
po.draw_quantity, |
||||||
|
-- 物料表字段:物料编号、名称、型号/牌号、规格、生产标识 |
||||||
|
g.goods_code AS goodsCode, |
||||||
|
g.goods_name AS goodsName, |
||||||
|
g.material_model AS materialModel, |
||||||
|
g.specifications AS specifications, |
||||||
|
-- 申报日期:复用主表创建时间,贴合页面命名 |
||||||
|
u.name as createName |
||||||
|
FROM ST_WMS_REQUEST t |
||||||
|
-- 左关联采购单表:主表boId关联采购单主键,过滤已删除 |
||||||
|
LEFT JOIN ST_BUY_ORDER po ON t.bo_id = po.id AND po.is_deleted = 0 |
||||||
|
-- 左关联物料表:采购单表goods_id关联物料表主键,过滤已删除 |
||||||
|
LEFT JOIN ST_GOODS g ON po.goods_id = g.id AND g.is_deleted = 0 |
||||||
|
LEFT JOIN BLADE_USER u ON t.create_user = u.id AND u.is_deleted = 0 |
||||||
|
<where> |
||||||
|
t.is_deleted = 0 |
||||||
|
<!-- 核心逻辑:无其他过滤条件时,默认过滤 approvalStatus < 4 --> |
||||||
|
<!-- 若前端传递了approvalStatus,则优先使用传递的值;否则应用默认条件 --> |
||||||
|
<choose> |
||||||
|
<when test="stWmsRequest.userRoleName != null and stWmsRequest.userRoleName.contains('保管员')"> |
||||||
|
AND t.approval_status = #{stWmsRequest.approvalStatus} |
||||||
|
</when> |
||||||
|
<otherwise> |
||||||
|
AND t.approval_status < 4 |
||||||
|
</otherwise> |
||||||
|
</choose> |
||||||
|
|
||||||
|
|
||||||
|
<!-- 新增:页面查询条件 --> |
||||||
|
<!-- 1. 采购单号模糊查询 --> |
||||||
|
<if test="stWmsRequest.boCode != null and stWmsRequest.boCode != ''"> |
||||||
|
AND po.bo_code LIKE '%' || #{stWmsRequest.boCode} || '%' |
||||||
|
</if> |
||||||
|
|
||||||
|
<!-- 2. 物料编号模糊查询 --> |
||||||
|
<if test="stWmsRequest.goodsCode != null and stWmsRequest.goodsCode != ''"> |
||||||
|
AND g.goods_code LIKE '%' || #{stWmsRequest.goodsCode} || '%' |
||||||
|
</if> |
||||||
|
|
||||||
|
<if test="stWmsRequest.reqCode != null and stWmsRequest.reqCode != ''"> |
||||||
|
AND t.req_code LIKE '%' || #{stWmsRequest.reqCode} || '%' |
||||||
|
</if> |
||||||
|
</where> |
||||||
|
ORDER BY t.create_time DESC |
||||||
|
</select> |
||||||
|
|
||||||
|
<select id="getMaxByCodePattern" resultType="java.lang.String"> |
||||||
|
SELECT REQ_CODE |
||||||
|
FROM ( |
||||||
|
SELECT REQ_CODE |
||||||
|
FROM ST_WMS_REQUEST |
||||||
|
WHERE REQ_CODE LIKE #{codePattern} || '%' |
||||||
|
ORDER BY REQ_CODE DESC |
||||||
|
) |
||||||
|
WHERE ROWNUM = 1 |
||||||
|
</select> |
||||||
|
|
||||||
|
<select id="sendErpBuyRequest" statementType="CALLABLE" parameterType="map"> |
||||||
|
{ call dba_mgr.pro_rbinvdeptreqmtn@erp_mes_link( |
||||||
|
#{v_wono, mode=IN, jdbcType=VARCHAR}, |
||||||
|
#{v_applyqty,mode=IN, jdbcType=NUMERIC}, |
||||||
|
#{v_mtnman, mode=IN, jdbcType=VARCHAR}, |
||||||
|
#{v_excnote, mode=OUT, jdbcType=VARCHAR}, |
||||||
|
#{v_excflag, mode=OUT, jdbcType=VARCHAR} |
||||||
|
) } |
||||||
|
</select> |
||||||
|
|
||||||
|
<select id="exportStWmsRequest" resultType="org.springblade.wms.excel.StWmsRequestExcel"> |
||||||
|
SELECT * FROM ST_WMS_REQUEST ${ew.customSqlSegment} |
||||||
|
</select> |
||||||
|
|
||||||
|
</mapper> |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
package org.springblade.wms.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import org.springblade.wms.pojo.entity.SyDockingLog; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName SyDockingLogMapper |
||||||
|
* @description: 接口对接日志 Mapper 接口 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-16 17:08 |
||||||
|
**/ |
||||||
|
|
||||||
|
public interface SyDockingLogMapper extends BaseMapper<SyDockingLog> { |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,22 @@ |
|||||||
|
<?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.springblade.wms.mapper.SyDockingLogMapper"> |
||||||
|
|
||||||
|
<!-- 通用查询映射结果 --> |
||||||
|
<resultMap id="syDockingLogResultMap" type="org.springblade.wms.pojo.entity.SyDockingLog"> |
||||||
|
<result column="ID" property="id"/> |
||||||
|
<result column="TENANT_ID" property="tenantId"/> |
||||||
|
<result column="CREATE_USER" property="createUser"/> |
||||||
|
<result column="CREATE_DEPT" property="createDept"/> |
||||||
|
<result column="CREATE_TIME" property="createTime"/> |
||||||
|
<result column="UPDATE_USER" property="updateUser"/> |
||||||
|
<result column="UPDATE_TIME" property="updateTime"/> |
||||||
|
<result column="STATUS" property="status"/> |
||||||
|
<result column="IS_DELETED" property="isDeleted"/> |
||||||
|
<result column="READ_TYPE" property="readType"/> |
||||||
|
<result column="CODE" property="code"/> |
||||||
|
<result column="READ_RESULT" property="readResult"/> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
|
||||||
|
</mapper> |
||||||
@ -0,0 +1,128 @@ |
|||||||
|
package org.springblade.wms.service.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import com.alibaba.fastjson.JSONArray; |
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import jakarta.annotation.Resource; |
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springblade.core.secure.BladeUser; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springblade.system.feign.IUserClient; |
||||||
|
import org.springblade.system.pojo.entity.User; |
||||||
|
import org.springblade.wms.excel.StStorehouseExcel; |
||||||
|
import org.springblade.wms.mapper.StGoodsClassMapper; |
||||||
|
import org.springblade.wms.mapper.StStorehouseMapper; |
||||||
|
import org.springblade.wms.pojo.entity.MesConstant; |
||||||
|
import org.springblade.wms.pojo.entity.PfUserInfo; |
||||||
|
import org.springblade.wms.pojo.entity.StGoodsClass; |
||||||
|
import org.springblade.wms.pojo.entity.StStorehouse; |
||||||
|
import org.springblade.wms.pojo.vo.StStorehouseVO; |
||||||
|
import org.springblade.wms.service.IStStorehouseService; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StStorehouseServiceImpl |
||||||
|
* @description: 库房维护表 服务实现类 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2025-12-18 14:25 |
||||||
|
**/ |
||||||
|
|
||||||
|
@Service |
||||||
|
public class StStorehouseServiceImpl extends BaseServiceImpl<StStorehouseMapper, StStorehouse> implements IStStorehouseService { |
||||||
|
@Resource |
||||||
|
IUserClient userClient; |
||||||
|
@Override |
||||||
|
public IPage<StStorehouseVO> selectStStorehousePage(IPage<StStorehouseVO> page, StStorehouseVO stStorehouse) { |
||||||
|
return page.setRecords(baseMapper.selectStStorehousePage(page, stStorehouse)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public IPage<StStorehouseVO> selectStorehousePage(IPage<StStorehouseVO> page, StStorehouseVO stStorehouse, Long userId, String urTypeStorehouse) { |
||||||
|
return page.setRecords(baseMapper.selectStorehousePage(page, stStorehouse,userId,urTypeStorehouse)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Boolean checkName(Long id, String shName) { |
||||||
|
StStorehouse stStorehouse = baseMapper.checkName(id, shName); |
||||||
|
return stStorehouse!=null &&stStorehouse.getId()!=id; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Boolean checkCode(Long id, String shCode) { |
||||||
|
StStorehouse stStorehouse = baseMapper.checkCode(id, shCode); |
||||||
|
return stStorehouse!=null &&stStorehouse.getId()!=id; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public StStorehouse getByCode(String shCode) { |
||||||
|
return baseMapper.getUniqueByCode(shCode); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public JSONObject assembleaStorehouse(Long userId, String urType) { |
||||||
|
|
||||||
|
JSONObject rtnObj = new JSONObject(); |
||||||
|
if (userId == null || StringUtils.isBlank(urType)) |
||||||
|
return rtnObj; |
||||||
|
|
||||||
|
//指定人员未分配库房
|
||||||
|
List<StStorehouse> noChooseList = this.findStorehouseList(userId, urType,false); |
||||||
|
JSONArray noChooseArray = new JSONArray(); |
||||||
|
if(noChooseList != null && noChooseList.size() > 0){ |
||||||
|
for(StStorehouse stStorehouse : noChooseList){ |
||||||
|
noChooseArray.add(this.stStorehouseToJSON(stStorehouse)); |
||||||
|
} |
||||||
|
} |
||||||
|
rtnObj.put(MesConstant.TREE_NO_CHOOSE, noChooseArray); |
||||||
|
|
||||||
|
//指定人员选中库房
|
||||||
|
List<StStorehouse> chooseList = this.findStorehouseList(userId, urType,true); |
||||||
|
JSONArray chooseArray = new JSONArray(); |
||||||
|
if (chooseList != null && chooseList.size() > 0) { |
||||||
|
for (StStorehouse storehouse : chooseList) { |
||||||
|
chooseArray.add(this.stStorehouseToJSON(storehouse)); |
||||||
|
} |
||||||
|
} |
||||||
|
rtnObj.put(MesConstant.TREE_CHOOSE, chooseArray); |
||||||
|
|
||||||
|
return rtnObj; |
||||||
|
} |
||||||
|
|
||||||
|
private Object stStorehouseToJSON(StStorehouse stStorehouse) { |
||||||
|
JSONObject obj = new JSONObject(); |
||||||
|
obj.put(MesConstant.TREE_ID, stStorehouse.getId()); |
||||||
|
obj.put(MesConstant.TREE_PID, stStorehouse.getId()); |
||||||
|
obj.put(MesConstant.TREE_LABEL, stStorehouse.getShName()); |
||||||
|
obj.put(MesConstant.TREE_TYPE, MesConstant.TREE_ITEM); |
||||||
|
return obj; |
||||||
|
} |
||||||
|
|
||||||
|
private List<StStorehouse> findStorehouseList(Long userId, String urType, boolean choose) { |
||||||
|
|
||||||
|
R<User> ruser = userClient.userInfoById(userId); |
||||||
|
User user = ruser.getData(); |
||||||
|
//查询已选中库房
|
||||||
|
if(choose){ |
||||||
|
return baseMapper.findStorehouseList(user.getId(), urType,true); |
||||||
|
}else{//查询未选中库房
|
||||||
|
return baseMapper.findStorehouseList(user.getId(), urType,false); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<StStorehouseExcel> exportStStorehouse(Wrapper<StStorehouse> queryWrapper) { |
||||||
|
List<StStorehouseExcel> stStorehouseList = baseMapper.exportStStorehouse(queryWrapper); |
||||||
|
//stStorehouseList.forEach(stStorehouse -> {
|
||||||
|
// stStorehouse.setTypeName(DictCache.getValue(DictEnum.YES_NO, StStorehouse.getType()));
|
||||||
|
//});
|
||||||
|
return stStorehouseList; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,335 @@ |
|||||||
|
package org.springblade.wms.service.impl; |
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil; |
||||||
|
import cn.hutool.core.map.MapUtil; |
||||||
|
import com.alibaba.fastjson.JSONArray; |
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import jakarta.annotation.Resource; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springblade.core.secure.BladeUser; |
||||||
|
import org.springblade.core.secure.utils.AuthUtil; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springblade.system.feign.ISysClient; |
||||||
|
import org.springblade.system.feign.IUserClient; |
||||||
|
import org.springblade.system.pojo.entity.Dept; |
||||||
|
import org.springblade.system.pojo.entity.User; |
||||||
|
import org.springblade.system.feign.ISysClient; |
||||||
|
import org.springblade.system.feign.IUserClient; |
||||||
|
import org.springblade.system.pojo.entity.Dept; |
||||||
|
import org.springblade.wms.mapper.StUserRightMapper; |
||||||
|
import org.springblade.wms.pojo.entity.MesConstant; |
||||||
|
import org.springblade.wms.pojo.entity.PfUserInfo; |
||||||
|
import org.springblade.wms.pojo.entity.StStorehouse; |
||||||
|
import org.springblade.wms.pojo.entity.StUserRight; |
||||||
|
import org.springblade.wms.pojo.vo.DeptUserTreeVO; |
||||||
|
import org.springblade.wms.service.IStUserRightService; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
import org.springframework.transaction.annotation.Transactional; |
||||||
|
import org.springframework.util.CollectionUtils; |
||||||
|
|
||||||
|
import java.util.*; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StUserRightServiceImpl |
||||||
|
* @description: 人员权限表 服务实现类 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-20 15:05 |
||||||
|
**/ |
||||||
|
|
||||||
|
@Service |
||||||
|
public class StUserRightServiceImpl extends BaseServiceImpl<StUserRightMapper, StUserRight> implements IStUserRightService { |
||||||
|
@Resource |
||||||
|
IUserClient userClient; |
||||||
|
@Resource |
||||||
|
ISysClient sysClient; |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
public void saveUserRight(Long shId, Long curUserId, List<Long> userIdList) { |
||||||
|
// 1. 现有权限
|
||||||
|
List<StUserRight> oldList = this.lambdaQuery() |
||||||
|
.eq(StUserRight::getUrType, StUserRight.UR_TYPE_STOREHOUSE) |
||||||
|
.eq(StUserRight::getTheId, shId) |
||||||
|
.isNotNull(StUserRight::getUserId) |
||||||
|
.list(); |
||||||
|
|
||||||
|
Set<Long> oldUserIds = oldList.stream() |
||||||
|
.map(r -> r.getUserId()) |
||||||
|
.filter(Objects::nonNull) |
||||||
|
.collect(Collectors.toSet()); |
||||||
|
|
||||||
|
Set<Long> newUserIds = new HashSet<>(Optional.ofNullable(userIdList).orElse(Collections.emptyList())); |
||||||
|
// newUserIds.add(curUserId);
|
||||||
|
|
||||||
|
// 2. 需要删除的权限
|
||||||
|
List<Long> delIds = oldList.stream() |
||||||
|
.filter(r -> !newUserIds.contains(r.getUserId())) |
||||||
|
.map(StUserRight::getId) |
||||||
|
.filter(Objects::nonNull) |
||||||
|
.collect(Collectors.toList()); |
||||||
|
if (!delIds.isEmpty()) { |
||||||
|
this.removeByIds(delIds); |
||||||
|
} |
||||||
|
|
||||||
|
// 3. 需要新增的权限
|
||||||
|
List<Long> addUserIds = newUserIds.stream() |
||||||
|
.filter(Objects::nonNull) |
||||||
|
.filter(id -> !oldUserIds.contains(id)) |
||||||
|
.collect(Collectors.toList()); |
||||||
|
if (!addUserIds.isEmpty()) { |
||||||
|
List<StUserRight> addList = addUserIds.stream() |
||||||
|
.map(userId -> { |
||||||
|
StUserRight ur = new StUserRight(); |
||||||
|
ur.setUrType(StUserRight.UR_TYPE_STOREHOUSE); |
||||||
|
ur.setTheId(shId); |
||||||
|
ur.setUserId(userId); |
||||||
|
ur.setCreateUser(curUserId); |
||||||
|
return ur; |
||||||
|
}) |
||||||
|
.collect(Collectors.toList()); |
||||||
|
this.saveBatch(addList); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
public void saveStorehouseRight(List<Long> shIdList, Long curUserId) { |
||||||
|
// 1. 现有权限
|
||||||
|
List<StUserRight> oldList = this.lambdaQuery() |
||||||
|
.eq(StUserRight::getUrType, StUserRight.UR_TYPE_STOREHOUSE) |
||||||
|
.eq(StUserRight::getUserId, curUserId) |
||||||
|
.list(); |
||||||
|
Set<Long> oldShIds = oldList.stream() |
||||||
|
.map(StUserRight::getTheId) |
||||||
|
.collect(Collectors.toSet()); |
||||||
|
|
||||||
|
Set<Long> newShIds = new HashSet<>(Optional.ofNullable(shIdList).orElse(Collections.emptyList())); |
||||||
|
|
||||||
|
// 2. 需要删除的权限
|
||||||
|
List<Long> delIds = oldList.stream() |
||||||
|
.filter(r -> !newShIds.contains(r.getTheId())) |
||||||
|
.map(StUserRight::getId) |
||||||
|
.collect(Collectors.toList()); |
||||||
|
if (!delIds.isEmpty()) { |
||||||
|
this.removeByIds(delIds); |
||||||
|
} |
||||||
|
|
||||||
|
// 3. 需要新增的权限
|
||||||
|
List<Long> addShIds = newShIds.stream() |
||||||
|
.filter(id -> !oldShIds.contains(id)) |
||||||
|
.collect(Collectors.toList()); |
||||||
|
if (!addShIds.isEmpty()) { |
||||||
|
List<StUserRight> addList = addShIds.stream() |
||||||
|
.map(shId -> { |
||||||
|
StUserRight ur = new StUserRight(); |
||||||
|
ur.setUrType(StUserRight.UR_TYPE_STOREHOUSE); |
||||||
|
ur.setTheId(shId); |
||||||
|
ur.setUserId(curUserId); |
||||||
|
return ur; |
||||||
|
}) |
||||||
|
.collect(Collectors.toList()); |
||||||
|
this.saveBatch(addList); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public JSONObject assembleaUserRight(Long theId, String urType) { |
||||||
|
JSONObject rtnObj = new JSONObject(); |
||||||
|
if (theId == null || StringUtils.isBlank(urType)) { |
||||||
|
return rtnObj; |
||||||
|
} |
||||||
|
|
||||||
|
List<User> noRightUserList = this.findNoUserInfoByTheId(theId, urType); |
||||||
|
Map<Long, List<User>> noChooseMap = this.assembleUserMap(noRightUserList); |
||||||
|
|
||||||
|
// 2. 获取指定库房有权限人员
|
||||||
|
List<User> hasRightUserList = this.findUserInfoByTheId(theId, urType); |
||||||
|
Map<Long, List<User>> chooseMap = this.assembleUserMap(hasRightUserList); |
||||||
|
|
||||||
|
// 3. 组装部门父子级关系Map(替换PfDepartment为BladeDept)
|
||||||
|
Map<Long, List<Dept>> deptMap = this.assembleDeptMap(); |
||||||
|
|
||||||
|
// 4. 获取所有顶级部门并排序
|
||||||
|
List<Dept> topDeptList = deptMap.get(0L); |
||||||
|
if (topDeptList != null) { |
||||||
|
Collections.sort(topDeptList, new DepartmentComparator()); |
||||||
|
} |
||||||
|
|
||||||
|
// 5. 组装已选/未选树形结构
|
||||||
|
rtnObj.put(MesConstant.TREE_NO_CHOOSE, this.assembleDeptUserTreeJSON(topDeptList, deptMap, noChooseMap)); |
||||||
|
rtnObj.put(MesConstant.TREE_CHOOSE, this.assembleDeptUserTreeJSON(topDeptList, deptMap, chooseMap)); |
||||||
|
|
||||||
|
return rtnObj; |
||||||
|
} |
||||||
|
|
||||||
|
private static class DepartmentComparator implements Comparator<Dept> { |
||||||
|
@Override |
||||||
|
public int compare(Dept o1, Dept o2) { |
||||||
|
if (o1.getSort() != null && o2.getSort() != null) |
||||||
|
return o1.getSort().compareTo(o2.getSort()); |
||||||
|
if (o1.getSort() == null) |
||||||
|
return -1; |
||||||
|
if (o2.getSort() == null) |
||||||
|
return 1; |
||||||
|
return o1.getDeptCode().compareTo(o2.getDeptCode()); |
||||||
|
} |
||||||
|
} |
||||||
|
private JSONArray assembleDeptUserTreeJSON(List<Dept> deptList, Map<Long, List<Dept>> deptMap, Map<Long, List<User>> userMap) { |
||||||
|
JSONArray array = new JSONArray(); |
||||||
|
if (deptList == null || deptList.isEmpty() || userMap == null || userMap.isEmpty()) { |
||||||
|
return array; |
||||||
|
} |
||||||
|
|
||||||
|
for (Dept dept : deptList) { |
||||||
|
Long deptId = dept.getId(); |
||||||
|
JSONArray rtnArray = null; |
||||||
|
|
||||||
|
// 递归处理子部门
|
||||||
|
List<Dept> tempDeptList = deptMap.get(deptId); |
||||||
|
if (tempDeptList != null && !tempDeptList.isEmpty()) { |
||||||
|
Collections.sort(tempDeptList, new DepartmentComparator()); |
||||||
|
rtnArray = this.assembleDeptUserTreeJSON(tempDeptList, deptMap, userMap); |
||||||
|
} |
||||||
|
|
||||||
|
// 组装当前部门下的用户
|
||||||
|
List<User> userList = userMap.get(deptId); |
||||||
|
if (userList != null && !userList.isEmpty()) { |
||||||
|
if (rtnArray == null) { |
||||||
|
rtnArray = new JSONArray(); |
||||||
|
} |
||||||
|
for (User u : userList) { |
||||||
|
rtnArray.add(this.userToJSON(u, deptId)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// 无子集且无用户,跳过该部门
|
||||||
|
if (rtnArray == null || rtnArray.isEmpty()) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
|
||||||
|
// 组装部门JSON并添加子集
|
||||||
|
JSONObject deptObj = deptToJSON(dept, dept.getParentId()); |
||||||
|
deptObj.put(MesConstant.TREE_CHILDERN, rtnArray); |
||||||
|
array.add(deptObj); |
||||||
|
} |
||||||
|
return array; |
||||||
|
} |
||||||
|
|
||||||
|
private JSONObject deptToJSON(Dept dept, Long parentId) { |
||||||
|
if (parentId == null) { |
||||||
|
parentId = dept.getId(); |
||||||
|
} |
||||||
|
JSONObject obj = new JSONObject(); |
||||||
|
obj.put(MesConstant.TREE_ID, StUserRight.JSON_KEY_DEPT + dept.getId()); |
||||||
|
obj.put(MesConstant.TREE_PID, StUserRight.JSON_KEY_DEPT + parentId); |
||||||
|
obj.put(MesConstant.TREE_LABEL, dept.getDeptName()); |
||||||
|
obj.put(MesConstant.TREE_TYPE, MesConstant.TREE_FOLDER); |
||||||
|
return obj; |
||||||
|
} |
||||||
|
|
||||||
|
private Object userToJSON(User user, Long parentId) { |
||||||
|
if (parentId == null) { |
||||||
|
parentId = user.getId(); |
||||||
|
} |
||||||
|
JSONObject obj = new JSONObject(); |
||||||
|
obj.put(MesConstant.TREE_ID, StUserRight.JSON_KEY_USER + user.getId()); |
||||||
|
obj.put(MesConstant.TREE_PID, StUserRight.JSON_KEY_DEPT + parentId); |
||||||
|
obj.put(MesConstant.TREE_LABEL, user.getName()); |
||||||
|
obj.put(MesConstant.TREE_TYPE, MesConstant.TREE_ITEM); |
||||||
|
return obj; |
||||||
|
} |
||||||
|
|
||||||
|
private Map<Long, List<Dept>> assembleDeptMap() { |
||||||
|
List<Dept> deptList = getAllDeptList(); |
||||||
|
Map<Long, List<Dept>> map = new LinkedHashMap<>(); |
||||||
|
|
||||||
|
for (Dept dept : deptList) { |
||||||
|
// BladeDept的parentDeptId字段,无则默认0L
|
||||||
|
Long parentDeptId = dept.getParentId() == null ? 0L : dept.getParentId(); |
||||||
|
List<Dept> tempList = map.get(parentDeptId); |
||||||
|
if (tempList == null) { |
||||||
|
tempList = new LinkedList<>(); |
||||||
|
map.put(parentDeptId, tempList); |
||||||
|
} |
||||||
|
tempList.add(dept); |
||||||
|
} |
||||||
|
return map; |
||||||
|
} |
||||||
|
|
||||||
|
private List<Dept> getAllDeptList() { |
||||||
|
// ========== 方案1:使用现有ISysClient的getDeptChild方法(无需修改接口) ==========
|
||||||
|
// 传入顶级部门ID=0,获取所有子部门(需确保服务端实现返回全量部门)
|
||||||
|
R<List<Dept>> deptChildR = sysClient.getDeptChild(0L); |
||||||
|
// 处理Feign调用结果:判断是否成功,失败返回空列表
|
||||||
|
if (deptChildR.isSuccess() && !CollectionUtils.isEmpty(deptChildR.getData())) { |
||||||
|
return deptChildR.getData(); |
||||||
|
} |
||||||
|
return Collections.emptyList(); |
||||||
|
} |
||||||
|
|
||||||
|
private List<User> findUserInfoByTheId(Long theId, String urType) { |
||||||
|
List<User> userList = new ArrayList<>(); |
||||||
|
if (theId == null || StringUtils.isBlank(urType)) { |
||||||
|
return userList; |
||||||
|
} |
||||||
|
List<StUserRight> crList = this.findByTheIdAndUrType(theId, urType); |
||||||
|
if (crList != null && crList.size() > 0) { |
||||||
|
for (StUserRight stUserRight : crList) { |
||||||
|
R<User> ruser = userClient.userInfoById(stUserRight.getUserId()); |
||||||
|
User user = ruser.getData(); |
||||||
|
userList.add(user); |
||||||
|
} |
||||||
|
} |
||||||
|
return userList; |
||||||
|
} |
||||||
|
|
||||||
|
private List<StUserRight> findByTheIdAndUrType(Long theId, String urType) { |
||||||
|
return baseMapper.findByTheIdAndUrType(theId, urType); |
||||||
|
} |
||||||
|
|
||||||
|
private Map<Long, List<User>> assembleUserMap(List<User> list) { |
||||||
|
Map<Long, List<User>> map = new LinkedHashMap<>(); |
||||||
|
if (list == null || list.isEmpty()) { |
||||||
|
return map; |
||||||
|
} |
||||||
|
for (User u : list) { |
||||||
|
// BladeDept的deptId字段,替换原PfDepartment.getDeptId()
|
||||||
|
String deptId = u.getDeptId(); |
||||||
|
if (deptId == null) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
List<User> userList = map.get(Long.valueOf(deptId)); |
||||||
|
if (userList == null) { |
||||||
|
userList = new ArrayList<>(); |
||||||
|
map.put(Long.valueOf(deptId), userList); |
||||||
|
} |
||||||
|
userList.add(u); |
||||||
|
} |
||||||
|
return map; |
||||||
|
} |
||||||
|
|
||||||
|
private List<User> findNoUserInfoByTheId(Long theId, String urType) { |
||||||
|
return baseMapper.findNoUserRightByTheId(theId, urType); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public IPage<StUserRightVO> selectStUserRightPage(IPage<StUserRightVO> page, StUserRightVO stUserRight) {
|
||||||
|
// return page.setRecords(baseMapper.selectStUserRightPage(page, stUserRight));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public List<StUserRightExcel> exportStUserRight(Wrapper<StUserRightEntity> queryWrapper) {
|
||||||
|
// List<StUserRightExcel> stUserRightList = baseMapper.exportStUserRight(queryWrapper);
|
||||||
|
// //stUserRightList.forEach(stUserRight -> {
|
||||||
|
// // stUserRight.setTypeName(DictCache.getValue(DictEnum.YES_NO, StUserRight.getType()));
|
||||||
|
// //});
|
||||||
|
// return stUserRightList;
|
||||||
|
// }
|
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,39 @@ |
|||||||
|
package org.springblade.wms.service.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springblade.wms.mapper.StWarehouseTransferRecordMapper; |
||||||
|
import org.springblade.wms.pojo.entity.StWarehouseTransferRecord; |
||||||
|
import org.springblade.wms.pojo.vo.StWarehouseTransferRecordVO; |
||||||
|
import org.springblade.wms.service.IStWarehouseTransferRecordService; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StWarehouseTransferRecordServiceImpl |
||||||
|
* @description: 转移入库记录表 服务实现类 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-06 15:54 |
||||||
|
**/ |
||||||
|
|
||||||
|
@Service |
||||||
|
public class StWarehouseTransferRecordServiceImpl extends BaseServiceImpl<StWarehouseTransferRecordMapper, StWarehouseTransferRecord> implements IStWarehouseTransferRecordService { |
||||||
|
|
||||||
|
@Override |
||||||
|
public IPage<StWarehouseTransferRecordVO> selectStWarehouseTransferRecordPage(IPage<StWarehouseTransferRecordVO> page, StWarehouseTransferRecordVO stWarehouseTransferRecord) { |
||||||
|
return page.setRecords(baseMapper.selectStWarehouseTransferRecordPage(page, stWarehouseTransferRecord)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public List<StWarehouseTransferRecordExcel> exportStWarehouseTransferRecord(Wrapper<StWarehouseTransferRecordEntity> queryWrapper) {
|
||||||
|
// List<StWarehouseTransferRecordExcel> stWarehouseTransferRecordList = baseMapper.exportStWarehouseTransferRecord(queryWrapper);
|
||||||
|
// //stWarehouseTransferRecordList.forEach(stWarehouseTransferRecord -> {
|
||||||
|
// // stWarehouseTransferRecord.setTypeName(DictCache.getValue(DictEnum.YES_NO, StWarehouseTransferRecord.getType()));
|
||||||
|
// //});
|
||||||
|
// return stWarehouseTransferRecordList;
|
||||||
|
// }
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,194 @@ |
|||||||
|
package org.springblade.wms.service.impl; |
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import jakarta.annotation.Resource; |
||||||
|
import org.springblade.common.exception.BusinessException; |
||||||
|
import org.springblade.core.log.exception.ServiceException; |
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springblade.core.secure.BladeUser; |
||||||
|
import org.springblade.core.secure.utils.AuthUtil; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springblade.system.feign.IUserClient; |
||||||
|
import org.springblade.system.pojo.entity.User; |
||||||
|
import org.springblade.system.feign.IUserClient; |
||||||
|
import org.springblade.wms.excel.StWmsRequestExcel; |
||||||
|
import org.springblade.wms.mapper.StWmsRequestMapper; |
||||||
|
import org.springblade.wms.pojo.entity.StBuyOrder; |
||||||
|
import org.springblade.wms.pojo.entity.StClassRequest; |
||||||
|
import org.springblade.wms.pojo.entity.StWmsRequest; |
||||||
|
import org.springblade.wms.pojo.vo.StWmsRequestVO; |
||||||
|
import org.springblade.wms.service.IStBuyOrderService; |
||||||
|
import org.springblade.wms.service.IStWmsRequestService; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
import org.springframework.transaction.annotation.Transactional; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.util.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StWmsRequestServiceImpl |
||||||
|
* @description: 仓库提请记录 服务实现类 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-20 11:00 |
||||||
|
**/ |
||||||
|
|
||||||
|
@Service |
||||||
|
public class StWmsRequestServiceImpl extends BaseServiceImpl<StWmsRequestMapper, StWmsRequest> implements IStWmsRequestService { |
||||||
|
|
||||||
|
@Resource |
||||||
|
IStBuyOrderService stBuyOrderService; |
||||||
|
@Resource |
||||||
|
IUserClient userClient; |
||||||
|
@Override |
||||||
|
public IPage<StWmsRequestVO> selectStWmsRequestPage(IPage<StWmsRequestVO> page, StWmsRequestVO stWmsRequest) { |
||||||
|
return page.setRecords(baseMapper.selectStWmsRequestPage(page, stWmsRequest)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional(rollbackFor = Exception.class) // 事务保证:批量操作要么全成,要么全滚
|
||||||
|
public void batchSaveOrEdit(List<StWmsRequest> stWmsRequestList, BladeUser user) { |
||||||
|
// 遍历每个提请对象,复用原有单条处理逻辑
|
||||||
|
for (StWmsRequest stWmsRequest : stWmsRequestList) { |
||||||
|
|
||||||
|
this.saveOrEdit(stWmsRequest, user); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
public void saveOrEdit(StWmsRequest stWmsRequest, BladeUser user) { |
||||||
|
/* 数量校验(原逻辑) */ |
||||||
|
StBuyOrder bo = stBuyOrderService.getById(stWmsRequest.getBoId()); |
||||||
|
if (bo == null) { |
||||||
|
throw new ServiceException("采购订单不存在"); |
||||||
|
} |
||||||
|
double requestQty = stWmsRequest.getRequestQty() == null ? 0D : stWmsRequest.getRequestQty(); |
||||||
|
double afterQty = bo.getDrawQuantity() + requestQty; |
||||||
|
if (afterQty > bo.getBuyQty()) { |
||||||
|
throw new ServiceException("提请数量不可大于采购数量!"); |
||||||
|
} |
||||||
|
|
||||||
|
/* 保存/修改(原逻辑) */ |
||||||
|
if (stWmsRequest.getId() != null) { |
||||||
|
StWmsRequest old = this.getById(stWmsRequest.getId()); |
||||||
|
afterQty = bo.getDrawQuantity() - old.getRequestQty() + requestQty; |
||||||
|
old.setRequestQty(requestQty); |
||||||
|
stWmsRequest.setApprovalStatus(StWmsRequest.APPROVAL_STATUS_CHECKING); |
||||||
|
this.updateById(old); |
||||||
|
} else { |
||||||
|
stWmsRequest.setReqCode(this.nextCode(1)); |
||||||
|
stWmsRequest.setCreateUser(user.getUserId()); // 原 createMan
|
||||||
|
stWmsRequest.setCreateTime(new Date()); |
||||||
|
stWmsRequest.setApprovalStatus(StWmsRequest.APPROVAL_STATUS_CHECKING); |
||||||
|
this.save(stWmsRequest); |
||||||
|
} |
||||||
|
|
||||||
|
/* 更新采购订单已提请数量(原逻辑) */ |
||||||
|
// bo.setDrawQuantity(afterQty);
|
||||||
|
// bo.setSurDrawQty(bo.getBuyQty() - afterQty);
|
||||||
|
// stBuyOrderService.updateById(bo);
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
public void approvalRequest(Long id, Short approvalResult, BladeUser approver) { |
||||||
|
// 1. 校验工艺员权限
|
||||||
|
if(Objects.equals(approver.getRoleName(), "保管员")) { |
||||||
|
// 2. 查询订单并校验状态
|
||||||
|
StWmsRequest wmsRequest = baseMapper.selectById(id); |
||||||
|
|
||||||
|
StBuyOrder bo = stBuyOrderService.getById(wmsRequest.getBoId()); |
||||||
|
double afterQty = bo.getDrawQuantity() + wmsRequest.getRequestQty(); |
||||||
|
if (wmsRequest == null) { |
||||||
|
throw new RuntimeException("仓库提请单不存在!"); |
||||||
|
} |
||||||
|
if (StWmsRequest.APPROVAL_STATUS_CHECKED == wmsRequest.getApprovalStatus()) { |
||||||
|
throw new RuntimeException("该提请单已审批通过,无需重复审批!"); |
||||||
|
} |
||||||
|
if (afterQty > bo.getBuyQty()) { |
||||||
|
wmsRequest.setApprovalStatus(wmsRequest.APPROVAL_STATUS_RETURN); |
||||||
|
baseMapper.updateById(wmsRequest); |
||||||
|
throw new RuntimeException("提请数量不可大于采购数量!"); |
||||||
|
} |
||||||
|
|
||||||
|
// 3. 更新审批状态
|
||||||
|
wmsRequest.setApprovalStatus(approvalResult); |
||||||
|
baseMapper.updateById(wmsRequest); |
||||||
|
|
||||||
|
bo.setDrawQuantity(afterQty); |
||||||
|
bo.setSurDrawQty(bo.getBuyQty() - afterQty); |
||||||
|
stBuyOrderService.updateById(bo); |
||||||
|
|
||||||
|
this.updateStatusByKeyId(id, approvalResult); |
||||||
|
}else { |
||||||
|
throw new RuntimeException("仅保管员可执行审批操作!"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public String nextCode(int next) { |
||||||
|
// 1. 日期前缀
|
||||||
|
String datePrefix = DateUtil.format(new Date(), "yyyyMMdd"); |
||||||
|
String codePattern = "CTQ-" + datePrefix; |
||||||
|
|
||||||
|
// 2. 当天已生成最大序号
|
||||||
|
String maxCode = baseMapper.getMaxByCodePattern(codePattern); |
||||||
|
int lastNum = 0; |
||||||
|
if (StrUtil.isNotBlank(maxCode)) { |
||||||
|
String number = maxCode.substring(codePattern.length()); |
||||||
|
lastNum = Integer.parseInt(number); |
||||||
|
} |
||||||
|
|
||||||
|
// 3. 补零拼接
|
||||||
|
return codePattern + StrUtil.padPre(String.valueOf(lastNum + next), 3, '0'); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
public void updateStatusByKeyId(Long keyId, Short status) { |
||||||
|
StWmsRequest request = this.getById(keyId); |
||||||
|
if (request == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
// request.setApprovalStatus(status);
|
||||||
|
|
||||||
|
/* 发送 ERP(原逻辑) */ |
||||||
|
if (status == StWmsRequest.APPROVAL_STATUS_CHECKED) { |
||||||
|
StBuyOrder stBuyOrder = stBuyOrderService.getById(request.getBoId()); |
||||||
|
R<User> ruser = userClient.userInfoById(request.getCreateUser()); |
||||||
|
User user = ruser.getData(); |
||||||
|
this.sendErpBuyRequest( |
||||||
|
stBuyOrder.getExtraBill(), |
||||||
|
request.getRequestQty(), |
||||||
|
user.getAccount()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void sendErpBuyRequest(String extraBill, Double qty, String ldapName) { |
||||||
|
Map<String, Object> param = new HashMap<>(); |
||||||
|
param.put("v_wono", Optional.ofNullable(extraBill).orElse("")); |
||||||
|
param.put("v_applyqty",Optional.ofNullable(qty).orElse(0D)); |
||||||
|
param.put("v_mtnman", Optional.ofNullable(ldapName).orElse("")); |
||||||
|
|
||||||
|
baseMapper.sendErpBuyRequest(param); |
||||||
|
|
||||||
|
String excFlag = (String) param.get("v_excflag"); |
||||||
|
String excNote = (String) param.get("v_excnote"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<StWmsRequestExcel> exportStWmsRequest(Wrapper<StWmsRequest> queryWrapper) { |
||||||
|
List<StWmsRequestExcel> stWmsRequestList = baseMapper.exportStWmsRequest(queryWrapper); |
||||||
|
//stWmsRequestList.forEach(stWmsRequest -> {
|
||||||
|
// stWmsRequest.setTypeName(DictCache.getValue(DictEnum.YES_NO, StWmsRequest.getType()));
|
||||||
|
//});
|
||||||
|
return stWmsRequestList; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,36 @@ |
|||||||
|
package org.springblade.wms.service.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||||
|
import org.springblade.core.mp.base.BaseService; |
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springblade.wms.mapper.SyDockingLogMapper; |
||||||
|
import org.springblade.wms.pojo.entity.SyDockingLog; |
||||||
|
import org.springblade.wms.service.ISyDockingLogService; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName SyDockingLogServiceImpl |
||||||
|
* @description: 接口对接日志 服务实现类 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-16 17:04 |
||||||
|
**/ |
||||||
|
|
||||||
|
@Service |
||||||
|
public class SyDockingLogServiceImpl extends BaseServiceImpl<SyDockingLogMapper, SyDockingLog> implements ISyDockingLogService { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void sendDockingLog(String readType, String code, String readResult) { |
||||||
|
SyDockingLog dl = new SyDockingLog(); |
||||||
|
dl.setReadType(readType); |
||||||
|
dl.setCode(code); |
||||||
|
dl.setReadResult(readResult); |
||||||
|
dl.setCreateTime(new Date()); |
||||||
|
baseMapper.insert(dl); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,39 @@ |
|||||||
|
package org.springblade.wms.wrapper; |
||||||
|
|
||||||
|
import org.springblade.core.mp.support.BaseEntityWrapper; |
||||||
|
import org.springblade.core.tool.utils.BeanUtil; |
||||||
|
import org.springblade.wms.pojo.entity.StStorehouse; |
||||||
|
import org.springblade.wms.pojo.vo.StStorehouseVO; |
||||||
|
|
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StStorehouseWrapper |
||||||
|
* @description: 库房维护表 包装类,返回视图层所需的字段 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2025-12-18 14:20 |
||||||
|
**/ |
||||||
|
|
||||||
|
public class StStorehouseWrapper extends BaseEntityWrapper<StStorehouse, StStorehouseVO> { |
||||||
|
|
||||||
|
public static StStorehouseWrapper build() { |
||||||
|
return new StStorehouseWrapper(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public StStorehouseVO entityVO(StStorehouse stStorehouse) { |
||||||
|
StStorehouseVO stStorehouseVO = Objects.requireNonNull(BeanUtil.copyProperties(stStorehouse, StStorehouseVO.class)); |
||||||
|
|
||||||
|
//User createUser = UserCache.getUser(stStorehouse.getCreateUser());
|
||||||
|
//User updateUser = UserCache.getUser(stStorehouse.getUpdateUser());
|
||||||
|
//stStorehouseVO.setCreateUserName(createUser.getName());
|
||||||
|
//stStorehouseVO.setUpdateUserName(updateUser.getName());
|
||||||
|
|
||||||
|
return stStorehouseVO; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,39 @@ |
|||||||
|
package org.springblade.wms.wrapper; |
||||||
|
|
||||||
|
import org.springblade.core.mp.support.BaseEntityWrapper; |
||||||
|
import org.springblade.core.tool.utils.BeanUtil; |
||||||
|
import org.springblade.wms.pojo.entity.StWmsRequest; |
||||||
|
import org.springblade.wms.pojo.vo.StWmsRequestVO; |
||||||
|
|
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
/** |
||||||
|
* @version 1.0 |
||||||
|
* @program: jonhon-mes-svr |
||||||
|
* @ClassName StWmsRequestWrapper |
||||||
|
* @description: 仓库提请记录 包装类,返回视图层所需的字段 |
||||||
|
* @autor: WuSiYu |
||||||
|
* @create 2026-01-20 10:58 |
||||||
|
**/ |
||||||
|
|
||||||
|
public class StWmsRequestWrapper extends BaseEntityWrapper<StWmsRequest, StWmsRequestVO> { |
||||||
|
|
||||||
|
public static StWmsRequestWrapper build() { |
||||||
|
return new StWmsRequestWrapper(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public StWmsRequestVO entityVO(StWmsRequest stWmsRequest) { |
||||||
|
StWmsRequestVO stWmsRequestVO = Objects.requireNonNull(BeanUtil.copyProperties(stWmsRequest, StWmsRequestVO.class)); |
||||||
|
|
||||||
|
//User createUser = UserCache.getUser(stWmsRequest.getCreateUser());
|
||||||
|
//User updateUser = UserCache.getUser(stWmsRequest.getUpdateUser());
|
||||||
|
//stWmsRequestVO.setCreateUserName(createUser.getName());
|
||||||
|
//stWmsRequestVO.setUpdateUserName(updateUser.getName());
|
||||||
|
|
||||||
|
return stWmsRequestVO; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
Loading…
Reference in new issue