add:盘点管理
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
attr.sect_code AS turnout_sect_code,
|
||||
attr.sect_id,
|
||||
attr.struct_id,
|
||||
attr.struct_name,
|
||||
attr.struct_code AS turnout_struct_code
|
||||
FROM
|
||||
md_pb_storagevehicleext ext
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package org.nl.wms.warehouse_management.controller;
|
||||
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.base.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtCheckmstService;
|
||||
import org.nl.wms.warehouse_management.service.dto.CheckInsertDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 盘点 控制层
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-29
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/check")
|
||||
@Slf4j
|
||||
public class CheckController {
|
||||
|
||||
@Autowired
|
||||
private IStIvtCheckmstService iStIvtCheckmstService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询盘点单")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iStIvtCheckmstService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增盘点单")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody CheckInsertDto dto) {
|
||||
iStIvtCheckmstService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改盘点单")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody CheckInsertDto dto) {
|
||||
iStIvtCheckmstService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除盘点单")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
iStIvtCheckmstService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getDtl")
|
||||
@Log("获取明细")
|
||||
public ResponseEntity<Object> getDtl(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(iStIvtCheckmstService.getDtl(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/saveCheck")
|
||||
@Log("保存盘点")
|
||||
public ResponseEntity<Object> saveCheck(@RequestBody CheckInsertDto dto) {
|
||||
iStIvtCheckmstService.saveCheck(dto);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirm")
|
||||
@Log("确认盘点")
|
||||
public ResponseEntity<Object> confirm(@RequestBody CheckInsertDto dto) {
|
||||
iStIvtCheckmstService.confirm(dto);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,6 +17,11 @@ public class IOSConstant {
|
||||
*/
|
||||
public final static String IS_DELETE_YES = "1";
|
||||
|
||||
/**
|
||||
* 创建方式
|
||||
*/
|
||||
public final static String CREATE_TYPE = "1";
|
||||
|
||||
/**
|
||||
* 更新库存状态:加可用(插入数据)
|
||||
*/
|
||||
|
||||
@@ -35,12 +35,21 @@ public enum IOSEnum {
|
||||
// 移库单明细状态
|
||||
MOVE_DTL_STATUS(MapOf.of("生成", "10", "执行中", "20", "完成", "99")),
|
||||
|
||||
// 损益单据类型
|
||||
MORE_MST_TYPE(MapOf.of("手工损益", "1001", "盘点损益", "1002")),
|
||||
|
||||
// 损益单状态
|
||||
MORE_MST_STATUS(MapOf.of("生成", "10", "审核", "20", "完成", "99")),
|
||||
|
||||
// 损益类型
|
||||
MORE_TYPE(MapOf.of("损", "1", "溢", "2")),
|
||||
|
||||
// 盘点单主表状态
|
||||
CHECK_MST_STATUS(MapOf.of("生成", "10", "盘点中", "20", "完成", "99")),
|
||||
|
||||
// 盘点明细状态
|
||||
CHECK_DTL_STATUS(MapOf.of("生成", "10", "盘点中", "20", "已盘点", "30", "完成", "99")),
|
||||
|
||||
;
|
||||
|
||||
private Map<String, String> code;
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.nl.wms.warehouse_management.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtCheckdtl;
|
||||
import org.nl.wms.warehouse_management.service.dto.CheckInsertDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 盘点单明细表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-29
|
||||
*/
|
||||
public interface IStIvtCheckdtlService extends IService<StIvtCheckdtl> {
|
||||
|
||||
/**
|
||||
* 新增明细
|
||||
* @param dto 新增修改实体dto
|
||||
*/
|
||||
void createCheckDtl(CheckInsertDto dto);
|
||||
|
||||
/**
|
||||
* 获取明细
|
||||
* @param whereJson {
|
||||
* check_id:主表标识
|
||||
* }
|
||||
* @return List<JSONObject>
|
||||
*/
|
||||
List<JSONObject> getDtl(Map whereJson);
|
||||
|
||||
/**
|
||||
* 创建损益单据
|
||||
* @param list 明细实体类集合
|
||||
*/
|
||||
void createMore(List<StIvtCheckdtl> list, String check_id);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package org.nl.wms.warehouse_management.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtCheckmst;
|
||||
import org.nl.wms.warehouse_management.service.dto.CheckInsertDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 盘点单主表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-29
|
||||
*/
|
||||
public interface IStIvtCheckmstService extends IService<StIvtCheckmst> {
|
||||
/**
|
||||
* 分页查询
|
||||
* @param whereJson : {查询参数}
|
||||
* @param page : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
IPage<StIvtCheckmst> queryAll(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 新增盘点单
|
||||
* @param dto 新增修改实体dto
|
||||
*/
|
||||
void create(CheckInsertDto dto);
|
||||
|
||||
/**
|
||||
* 修改盘点单
|
||||
* @param dto:新增修改dto实体类
|
||||
*/
|
||||
void update(CheckInsertDto dto);
|
||||
|
||||
/**
|
||||
* 删除盘点单
|
||||
* @param ids 标识集合
|
||||
*/
|
||||
void delete(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 获取明细
|
||||
* @param whereJson {
|
||||
* check_id: 主表标识
|
||||
* }
|
||||
* @return List<JSONObject>
|
||||
*/
|
||||
List<JSONObject> getDtl(Map whereJson);
|
||||
|
||||
/**
|
||||
* 到村盘点单
|
||||
* @param dto 新增修改dto实体类
|
||||
*/
|
||||
void saveCheck(CheckInsertDto dto);
|
||||
|
||||
/**
|
||||
* 确认盘点
|
||||
* @param dto 新增修改dto实体类
|
||||
*/
|
||||
void confirm(CheckInsertDto dto);
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public interface IStIvtMoreorlessmstService extends IService<StIvtMoreorlessmst>
|
||||
* 新增损益单
|
||||
* @param dto:新增修改dto实体类
|
||||
*/
|
||||
void create(MoreOrLessInsertDto dto);
|
||||
String create(MoreOrLessInsertDto dto);
|
||||
|
||||
/**
|
||||
* 修改损益单
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
package org.nl.wms.warehouse_management.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 盘点单明细表
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("st_ivt_checkdtl")
|
||||
public class StIvtCheckdtl implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 盘点单明细id
|
||||
*/
|
||||
@TableId(value = "checkdtl_id")
|
||||
private String checkdtl_id;
|
||||
|
||||
/**
|
||||
* 盘点单标识
|
||||
*/
|
||||
private String check_id;
|
||||
|
||||
/**
|
||||
* 明细序号
|
||||
*/
|
||||
private BigDecimal seq_no;
|
||||
|
||||
/**
|
||||
* 盘点库区
|
||||
*/
|
||||
private String sect_code;
|
||||
|
||||
/**
|
||||
* 盘点货位
|
||||
*/
|
||||
private String struct_code;
|
||||
|
||||
/**
|
||||
* 盘点站台
|
||||
*/
|
||||
private String checkpoint_code;
|
||||
|
||||
/**
|
||||
* 存储载具编码
|
||||
*/
|
||||
private String storagevehicle_code;
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private String material_id;
|
||||
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
private String pcsn;
|
||||
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
private BigDecimal base_qty;
|
||||
|
||||
/**
|
||||
* 基本计量单位
|
||||
*/
|
||||
private String qty_unit_id;
|
||||
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
private String qty_unit_name;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 是否已下发
|
||||
*/
|
||||
private String is_down;
|
||||
|
||||
/**
|
||||
* 盘点数量
|
||||
*/
|
||||
private BigDecimal fac_qty;
|
||||
|
||||
/**
|
||||
* 盘点结果
|
||||
*/
|
||||
private String check_result;
|
||||
|
||||
/**
|
||||
* 盘点人
|
||||
*/
|
||||
private String check_optid;
|
||||
|
||||
/**
|
||||
* 盘点人姓名
|
||||
*/
|
||||
private String check_optname;
|
||||
|
||||
/**
|
||||
* 盘点时间
|
||||
*/
|
||||
private String check_time;
|
||||
|
||||
/**
|
||||
* 明细备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package org.nl.wms.warehouse_management.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 盘点单主表
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("st_ivt_checkmst")
|
||||
public class StIvtCheckmst implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 盘点单标识
|
||||
*/
|
||||
@TableId(value = "check_id")
|
||||
private String check_id;
|
||||
|
||||
/**
|
||||
* 盘点单号
|
||||
*/
|
||||
private String check_code;
|
||||
|
||||
/**
|
||||
* 盘点单类型
|
||||
*/
|
||||
private String check_type;
|
||||
|
||||
/**
|
||||
* 仓库标识
|
||||
*/
|
||||
private String stor_id;
|
||||
|
||||
/**
|
||||
* 仓库名称
|
||||
*/
|
||||
private String stor_name;
|
||||
|
||||
/**
|
||||
* 明细数
|
||||
*/
|
||||
private BigDecimal dtl_num;
|
||||
|
||||
/**
|
||||
* 生成方式
|
||||
*/
|
||||
private String create_mode;
|
||||
|
||||
/**
|
||||
* 制单人
|
||||
*/
|
||||
private String input_optid;
|
||||
|
||||
/**
|
||||
* 制单人姓名
|
||||
*/
|
||||
private String input_optname;
|
||||
|
||||
/**
|
||||
* 制单时间
|
||||
*/
|
||||
private String input_time;
|
||||
|
||||
/**
|
||||
* 审核人
|
||||
*/
|
||||
private String audit_optid;
|
||||
|
||||
/**
|
||||
* 审核人姓名
|
||||
*/
|
||||
private String audit_optname;
|
||||
|
||||
/**
|
||||
* 审核时间
|
||||
*/
|
||||
private String audit_time;
|
||||
|
||||
/**
|
||||
* 确认人
|
||||
*/
|
||||
private String confirm_optid;
|
||||
|
||||
/**
|
||||
* 确认人姓名
|
||||
*/
|
||||
private String confirm_optname;
|
||||
|
||||
/**
|
||||
* 确认时间
|
||||
*/
|
||||
private String confirm_time;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 是否已上传
|
||||
*/
|
||||
private String is_upload;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.nl.wms.warehouse_management.service.dao.mapper;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtCheckdtl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 盘点单明细表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-29
|
||||
*/
|
||||
public interface StIvtCheckdtlMapper extends BaseMapper<StIvtCheckdtl> {
|
||||
|
||||
/**
|
||||
* 获取明细
|
||||
* @param whereJson {
|
||||
* check_id 主表标识
|
||||
* }
|
||||
* @return List<JSONObject>
|
||||
*/
|
||||
List<JSONObject> getDtl(@Param("param") Map whereJson);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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.nl.wms.warehouse_management.service.dao.mapper.StIvtCheckdtlMapper">
|
||||
|
||||
<select id="getDtl" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
dtl.*,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
sect.sect_name,
|
||||
attr.struct_name
|
||||
FROM
|
||||
st_ivt_checkdtl dtl
|
||||
LEFT JOIN st_ivt_checkmst ios ON ios.check_id = dtl.check_id
|
||||
LEFT JOIN md_me_materialbase material ON material.material_id = dtl.material_id
|
||||
LEFT JOIN st_ivt_sectattr sect ON sect.sect_code = dtl.sect_code
|
||||
LEFT JOIN st_ivt_structattr attr ON attr.struct_code = dtl.struct_code
|
||||
<where>
|
||||
ios.is_delete = '0'
|
||||
<if test="param.check_id != null and param.check_id != ''">
|
||||
AND
|
||||
ios.check_id = #{param.check_id}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.nl.wms.warehouse_management.service.dao.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtCheckmst;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 盘点单主表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-29
|
||||
*/
|
||||
public interface StIvtCheckmstMapper extends BaseMapper<StIvtCheckmst> {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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.nl.wms.warehouse_management.service.dao.mapper.StIvtCheckmstMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,75 @@
|
||||
package org.nl.wms.warehouse_management.service.dto;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 盘点新增修改dto实体类
|
||||
* @author Liuxy
|
||||
* 2025/5/29
|
||||
*/
|
||||
@Data
|
||||
public class CheckInsertDto {
|
||||
|
||||
/**
|
||||
* 单据标识
|
||||
*/
|
||||
private String check_id;
|
||||
|
||||
/**
|
||||
* 单据类型
|
||||
*/
|
||||
private String check_type;
|
||||
|
||||
/**
|
||||
* 生成方式
|
||||
*/
|
||||
private String create_mode;
|
||||
|
||||
/**
|
||||
* 明细数
|
||||
*/
|
||||
private BigDecimal dtl_num;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 仓库id
|
||||
*/
|
||||
private String stor_id;
|
||||
|
||||
/**
|
||||
* 仓库名称
|
||||
*/
|
||||
private String stor_name;
|
||||
|
||||
/**
|
||||
* 明细数据:
|
||||
* {
|
||||
* sect_code 库区
|
||||
* struct_code 货位
|
||||
* storagevehicle_code 载具编码
|
||||
* material_id 物料id
|
||||
* material_code 物料编码
|
||||
* pcsn 批次
|
||||
* base_qty 库存数量
|
||||
* fac_qty 盘点数量
|
||||
* qty_unit_id 计量单位标识
|
||||
* qty_unit_name 计量单位名称
|
||||
* status 状态
|
||||
* remark 备注
|
||||
* }
|
||||
*/
|
||||
private List<JSONObject> tableData;
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package org.nl.wms.warehouse_management.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtCheckdtlService;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtCheckmstService;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtMoreorlessmstService;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtCheckdtl;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtCheckmst;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.StIvtCheckdtlMapper;
|
||||
import org.nl.wms.warehouse_management.service.dto.CheckInsertDto;
|
||||
import org.nl.wms.warehouse_management.service.dto.MoreOrLessInsertDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 盘点单明细表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-29
|
||||
*/
|
||||
@Service
|
||||
public class StIvtCheckdtlServiceImpl extends ServiceImpl<StIvtCheckdtlMapper, StIvtCheckdtl> implements IStIvtCheckdtlService {
|
||||
|
||||
/**
|
||||
* 盘点单主表服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStIvtCheckmstService iStIvtCheckmstService;
|
||||
|
||||
/**
|
||||
* 损益单主表服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStIvtMoreorlessmstService iStIvtMoreorlessmstService;
|
||||
|
||||
@Override
|
||||
public void createCheckDtl(CheckInsertDto dto) {
|
||||
// 批量新增集合
|
||||
List<StIvtCheckdtl> dtlDaoList = new ArrayList<>();
|
||||
for (int i = 0; i < dto.getTableData().size(); i++) {
|
||||
JSONObject json = dto.getTableData().get(i);
|
||||
StIvtCheckdtl dao = new StIvtCheckdtl();
|
||||
dao.setCheckdtl_id(IdUtil.getStringId());
|
||||
dao.setCheck_id(dto.getCheck_id());
|
||||
dao.setSeq_no(BigDecimal.valueOf(i+1));
|
||||
dao.setSect_code(json.getString("sect_code"));
|
||||
dao.setStruct_code(json.getString("struct_code"));
|
||||
dao.setStoragevehicle_code(json.getString("storagevehicle_code"));
|
||||
dao.setMaterial_id(json.getString("material_id"));
|
||||
dao.setPcsn(json.getString("pcsn"));
|
||||
dao.setBase_qty(json.getBigDecimal("base_qty"));
|
||||
dao.setFac_qty(json.getBigDecimal("fac_qty"));
|
||||
dao.setQty_unit_id(json.getString("qty_unit_id"));
|
||||
dao.setQty_unit_name(json.getString("qty_unit_name"));
|
||||
dao.setStatus(json.getString("status"));
|
||||
dao.setRemark(json.getString("remark"));
|
||||
dtlDaoList.add(dao);
|
||||
}
|
||||
this.saveBatch(dtlDaoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> getDtl(Map whereJson) {
|
||||
return this.baseMapper.getDtl(whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMore(List<StIvtCheckdtl> dtlDaoList, String check_id) {
|
||||
StIvtCheckmst mstDao = iStIvtCheckmstService.getById(check_id);
|
||||
for (StIvtCheckdtl dao : dtlDaoList) {
|
||||
// 组织创建损益单据主数据
|
||||
MoreOrLessInsertDto moreDto = new MoreOrLessInsertDto();
|
||||
moreDto.setMol_inv_type(IOSEnum.MORE_MST_TYPE.code("盘点损益"));
|
||||
// 根据库存数量以及盘点数量来判断损益类型
|
||||
double base_qty = dao.getBase_qty().doubleValue();
|
||||
double fac_qty = dao.getFac_qty().doubleValue();
|
||||
double mol_qty;
|
||||
if (base_qty == fac_qty) {
|
||||
continue;
|
||||
} else if (base_qty > fac_qty) {
|
||||
moreDto.setMol_type(IOSEnum.MORE_TYPE.code("损"));
|
||||
mol_qty = NumberUtil.sub(base_qty, fac_qty);
|
||||
} else {
|
||||
moreDto.setMol_type(IOSEnum.MORE_TYPE.code("溢"));
|
||||
mol_qty = NumberUtil.sub(fac_qty, base_qty);
|
||||
}
|
||||
moreDto.setBiz_date(DateUtil.today());
|
||||
moreDto.setDtl_num(BigDecimal.valueOf(1));
|
||||
moreDto.setStor_id(mstDao.getStor_id());
|
||||
moreDto.setRemark("由明细标识【"+dao.getCheck_optid()+"】创建");
|
||||
moreDto.setTotal_qty(BigDecimal.valueOf(mol_qty));
|
||||
moreDto.setCreate_mode(IOSConstant.CREATE_TYPE);
|
||||
moreDto.setStatus(IOSEnum.MORE_MST_STATUS.code("生成"));
|
||||
|
||||
// 创建损益单明细数据
|
||||
List<JSONObject> tableData = new ArrayList<>();
|
||||
JSONObject jsonDtl = new JSONObject();
|
||||
jsonDtl.put("material_id", dao.getMaterial_id());
|
||||
jsonDtl.put("pcsn", dao.getPcsn());
|
||||
jsonDtl.put("ivt_qty", base_qty);
|
||||
jsonDtl.put("mol_qty", mol_qty);
|
||||
jsonDtl.put("qty_unit_id", dao.getQty_unit_id());
|
||||
jsonDtl.put("qty_unit_name", dao.getQty_unit_name());
|
||||
jsonDtl.put("storagevehicle_code", dao.getStoragevehicle_code());
|
||||
jsonDtl.put("sect_code", dao.getSect_code());
|
||||
jsonDtl.put("struct_code", dao.getStruct_code());
|
||||
jsonDtl.put("status", IOSEnum.MORE_MST_STATUS.code("生成"));
|
||||
jsonDtl.put("remark", "由明细标识【"+dao.getCheck_optid()+"】创建");
|
||||
jsonDtl.put("source_bill_code", mstDao.getCheck_code());
|
||||
tableData.add(jsonDtl);
|
||||
moreDto.setTableData(tableData);
|
||||
//调用创建
|
||||
String mol_id = iStIvtMoreorlessmstService.create(moreDto);
|
||||
// 调用强制确认
|
||||
iStIvtMoreorlessmstService.confirm(iStIvtMoreorlessmstService.getById(mol_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
package org.nl.wms.warehouse_management.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata_manage.enums.BaseDataEnum;
|
||||
import org.nl.wms.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtCheckdtlService;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtCheckmstService;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtCheckdtl;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtCheckmst;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.StIvtCheckmstMapper;
|
||||
import org.nl.wms.warehouse_management.service.dto.CheckInsertDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 盘点单主表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-29
|
||||
*/
|
||||
@Service
|
||||
public class StIvtCheckmstServiceImpl extends ServiceImpl<StIvtCheckmstMapper, StIvtCheckmst> implements IStIvtCheckmstService {
|
||||
|
||||
@Autowired
|
||||
private IStIvtCheckdtlService iStIvtCheckdtlService;
|
||||
|
||||
@Override
|
||||
public IPage<StIvtCheckmst> queryAll(Map whereJson, PageQuery page) {
|
||||
String check_code = MapUtil.getStr(whereJson, "check_code");
|
||||
String stor_id = MapUtil.getStr(whereJson, "stor_id");
|
||||
String status = MapUtil.getStr(whereJson, "status");
|
||||
String check_type = MapUtil.getStr(whereJson, "check_type");
|
||||
String create_mode = MapUtil.getStr(whereJson, "create_mode");
|
||||
String begin_time = MapUtil.getStr(whereJson, "begin_time");
|
||||
String end_time = MapUtil.getStr(whereJson, "end_time");
|
||||
// 查询条件
|
||||
LambdaQueryWrapper<StIvtCheckmst> queryWrapper = new QueryWrapper<StIvtCheckmst>().lambda();
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(check_code), StIvtCheckmst::getCheck_code, check_code);
|
||||
queryWrapper.eq(ObjectUtil.isNotEmpty(stor_id), StIvtCheckmst::getStor_id, stor_id);
|
||||
queryWrapper.eq(ObjectUtil.isNotEmpty(check_type), StIvtCheckmst::getCheck_type, check_type);
|
||||
queryWrapper.eq(ObjectUtil.isNotEmpty(status), StIvtCheckmst::getStatus, status);
|
||||
queryWrapper.eq(ObjectUtil.isNotEmpty(create_mode), StIvtCheckmst::getCreate_mode, create_mode);
|
||||
queryWrapper.ge(ObjectUtil.isNotEmpty(begin_time), StIvtCheckmst::getInput_time, begin_time);
|
||||
queryWrapper.lt(ObjectUtil.isNotEmpty(end_time), StIvtCheckmst::getInput_time, end_time);
|
||||
queryWrapper.eq(StIvtCheckmst::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
queryWrapper.orderByDesc(StIvtCheckmst::getInput_time);
|
||||
return this.baseMapper.selectPage(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
queryWrapper
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void create(CheckInsertDto dto) {
|
||||
// 主表
|
||||
StIvtCheckmst mstDao = new StIvtCheckmst();
|
||||
mstDao.setCheck_id(IdUtil.getStringId());
|
||||
mstDao.setCheck_code(CodeUtil.getNewCode("CHECK_BILL_CODE"));
|
||||
mstDao.setCheck_type(dto.getCheck_type());
|
||||
mstDao.setStor_id(dto.getStor_id());
|
||||
mstDao.setStor_name(dto.getStor_name());
|
||||
mstDao.setDtl_num(dto.getDtl_num());
|
||||
mstDao.setCreate_mode(dto.getCreate_mode());
|
||||
mstDao.setStatus(dto.getStatus());
|
||||
mstDao.setRemark(dto.getRemark());
|
||||
mstDao.setInput_optid(SecurityUtils.getCurrentUserId());
|
||||
mstDao.setInput_optname(SecurityUtils.getCurrentNickName());
|
||||
mstDao.setInput_time(DateUtil.now());
|
||||
this.save(mstDao);
|
||||
// 明细
|
||||
dto.setCheck_id(mstDao.getCheck_id());
|
||||
iStIvtCheckdtlService.createCheckDtl(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void update(CheckInsertDto dto) {
|
||||
StIvtCheckmst mstDao = this.getById(dto.getCheck_id());
|
||||
mstDao.setStor_id(dto.getStor_id());
|
||||
mstDao.setCheck_type(dto.getCheck_type());
|
||||
mstDao.setDtl_num(dto.getDtl_num());
|
||||
this.updateById(mstDao);
|
||||
// 删除老明细
|
||||
iStIvtCheckdtlService.remove(
|
||||
new QueryWrapper<StIvtCheckdtl>().lambda()
|
||||
.eq(StIvtCheckdtl::getCheck_id, mstDao.getCheck_id())
|
||||
);
|
||||
// 新增明细
|
||||
iStIvtCheckdtlService.createCheckDtl(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Set<String> ids) {
|
||||
this.update(
|
||||
new UpdateWrapper<StIvtCheckmst>().lambda()
|
||||
.in(StIvtCheckmst::getCheck_id,ids)
|
||||
.set(StIvtCheckmst::getIs_delete, IOSConstant.IS_DELETE_YES)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> getDtl(Map whereJson) {
|
||||
return iStIvtCheckdtlService.getDtl(whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveCheck(CheckInsertDto dto) {
|
||||
StIvtCheckmst mstDao = this.getById(dto.getCheck_id());
|
||||
mstDao.setStatus(IOSEnum.CHECK_MST_STATUS.code("盘点中"));
|
||||
this.updateById(mstDao);
|
||||
// 更新明细
|
||||
iStIvtCheckdtlService.remove(
|
||||
new QueryWrapper<StIvtCheckdtl>().lambda()
|
||||
.eq(StIvtCheckdtl::getCheck_id, mstDao.getCheck_id())
|
||||
);
|
||||
iStIvtCheckdtlService.createCheckDtl(dto);
|
||||
iStIvtCheckdtlService.update(
|
||||
new UpdateWrapper<StIvtCheckdtl>().lambda()
|
||||
.eq(StIvtCheckdtl::getCheck_id, dto.getCheck_id())
|
||||
.set(StIvtCheckdtl::getStatus, IOSEnum.CHECK_DTL_STATUS.code("盘点中"))
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void confirm(CheckInsertDto dto) {
|
||||
// 更新主表
|
||||
StIvtCheckmst mstDao = this.getById(dto.getCheck_id());
|
||||
mstDao.setStatus(IOSEnum.CHECK_MST_STATUS.code("完成"));
|
||||
mstDao.setConfirm_optid(SecurityUtils.getCurrentUserId());
|
||||
mstDao.setConfirm_optname(SecurityUtils.getCurrentNickName());
|
||||
mstDao.setConfirm_time(DateUtil.now());
|
||||
this.updateById(mstDao);
|
||||
// 更新明细
|
||||
iStIvtCheckdtlService.update(
|
||||
new UpdateWrapper<StIvtCheckdtl>().lambda()
|
||||
.eq(StIvtCheckdtl::getCheck_id, dto.getCheck_id())
|
||||
.set(StIvtCheckdtl::getStatus, IOSEnum.CHECK_DTL_STATUS.code("完成"))
|
||||
);
|
||||
// 创建损益单
|
||||
iStIvtCheckdtlService.createMore(iStIvtCheckdtlService.list(
|
||||
new QueryWrapper<StIvtCheckdtl>().lambda()
|
||||
.eq(StIvtCheckdtl::getCheck_id,mstDao.getCheck_id())
|
||||
),mstDao.getCheck_id());
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class StIvtMoreorlessmstServiceImpl extends ServiceImpl<StIvtMoreorlessms
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void create(MoreOrLessInsertDto dto) {
|
||||
public String create(MoreOrLessInsertDto dto) {
|
||||
// 主表
|
||||
StIvtMoreorlessmst mstDao = new StIvtMoreorlessmst();
|
||||
mstDao.setMol_id(IdUtil.getStringId());
|
||||
@@ -79,6 +79,7 @@ public class StIvtMoreorlessmstServiceImpl extends ServiceImpl<StIvtMoreorlessms
|
||||
// 明细
|
||||
dto.setMol_id(mstDao.getMol_id());
|
||||
iStIvtMoreorlessdtlService.createMoreDtl(dto);
|
||||
return mstDao.getMol_id();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user