add:损益管理
This commit is contained in:
@@ -160,6 +160,7 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
String is_attachment = (String) whereJson.get("is_attachment");
|
||||
String is_reversed = (String) whereJson.get("is_reversed");
|
||||
String sect_type_attr = (String) whereJson.get("sect_type_attr");
|
||||
String stor_id = (String) whereJson.get("stor_id");
|
||||
|
||||
LambdaQueryWrapper<BsrealStorattr> queryWrapper = new LambdaQueryWrapper<>(BsrealStorattr.class)
|
||||
.select(BsrealStorattr::getStor_id, BsrealStorattr::getStor_code, BsrealStorattr::getStor_name)
|
||||
@@ -169,6 +170,7 @@ public class SectattrServiceImpl extends ServiceImpl<SectattrMapper, Sectattr> i
|
||||
.eq(StrUtil.isNotEmpty(is_productstore),BsrealStorattr::getIs_materialstore,is_productstore)
|
||||
.eq(StrUtil.isNotEmpty(is_attachment),BsrealStorattr::getIs_materialstore,is_attachment)
|
||||
.eq(StrUtil.isNotEmpty(is_reversed),BsrealStorattr::getIs_materialstore,is_reversed)
|
||||
.eq(StrUtil.isNotEmpty(stor_id),BsrealStorattr::getStor_id,stor_id)
|
||||
.eq(BsrealStorattr::getIs_delete, BaseDataEnum.IS_YES_NOT.code("否"))
|
||||
.eq(BsrealStorattr::getIs_used, BaseDataEnum.IS_YES_NOT.code("是")
|
||||
);
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
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.IStIvtMoreorlessmstService;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtMoreorlessmst;
|
||||
import org.nl.wms.warehouse_management.service.dto.MoreOrLessInsertDto;
|
||||
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-28
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/moreorLess")
|
||||
@Slf4j
|
||||
public class MoreOrlessController {
|
||||
|
||||
@Autowired
|
||||
private IStIvtMoreorlessmstService iStIvtMoreorlessmstService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询损益单")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||
return new ResponseEntity<>(TableDataInfo.build(iStIvtMoreorlessmstService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增损益单")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody MoreOrLessInsertDto dto) {
|
||||
iStIvtMoreorlessmstService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改损益单")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody MoreOrLessInsertDto dto) {
|
||||
iStIvtMoreorlessmstService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除损益单")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) {
|
||||
iStIvtMoreorlessmstService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/queryMolDtl")
|
||||
@Log("查询损益单明细")
|
||||
public ResponseEntity<Object> queryMolDtl(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(iStIvtMoreorlessmstService.queryMolDtl(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirm")
|
||||
@Log("强制确认")
|
||||
public ResponseEntity<Object> confirm(@RequestBody StIvtMoreorlessmst dao) {
|
||||
iStIvtMoreorlessmstService.confirm(dao);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,17 @@ package org.nl.wms.warehouse_management.enums;
|
||||
public class IOSConstant {
|
||||
|
||||
/**
|
||||
* 更新库存状态:加可用
|
||||
* 是否删除 否
|
||||
*/
|
||||
public final static String IS_DELETE_NO = "0";
|
||||
|
||||
/**
|
||||
* 是否删除 是
|
||||
*/
|
||||
public final static String IS_DELETE_YES = "1";
|
||||
|
||||
/**
|
||||
* 更新库存状态:加可用(插入数据)
|
||||
*/
|
||||
public final static String UPDATE_IVT_TYPE_ADD_CANUSE = "1";
|
||||
|
||||
@@ -27,6 +37,16 @@ public class IOSConstant {
|
||||
*/
|
||||
public final static String UPDATE_IVT_TYPE_SUB_FROZEN_ADD_CANUSE = "4";
|
||||
|
||||
/**
|
||||
* 更新库存状态:加可用(加库存)
|
||||
*/
|
||||
public final static String UPDATE_IVT_TYPE_ADD_CANUSE_IVT = "5";
|
||||
|
||||
/**
|
||||
* 更新库存状态:减可用(减库存)
|
||||
*/
|
||||
public final static String UPDATE_IVT_TYPE_SUB_CANUSE_IVT = "6";
|
||||
|
||||
/**
|
||||
* 移库任务类编码
|
||||
*/
|
||||
|
||||
@@ -35,6 +35,12 @@ public enum IOSEnum {
|
||||
// 移库单明细状态
|
||||
MOVE_DTL_STATUS(MapOf.of("生成", "10", "执行中", "20", "完成", "99")),
|
||||
|
||||
// 损益单状态
|
||||
MORE_MST_STATUS(MapOf.of("生成", "10", "审核", "20", "完成", "99")),
|
||||
|
||||
// 损益类型
|
||||
MORE_TYPE(MapOf.of("损", "1", "溢", "2")),
|
||||
|
||||
;
|
||||
|
||||
private Map<String, String> code;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
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.StIvtMoreorlessdtl;
|
||||
import org.nl.wms.warehouse_management.service.dto.MoreOrLessInsertDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 损溢单明细表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-28
|
||||
*/
|
||||
public interface IStIvtMoreorlessdtlService extends IService<StIvtMoreorlessdtl> {
|
||||
|
||||
/**
|
||||
* 创建明细
|
||||
* @param dto 新增修改实体类
|
||||
*/
|
||||
void createMoreDtl(MoreOrLessInsertDto dto);
|
||||
|
||||
/**
|
||||
* 查询明细
|
||||
* @param whereJson {
|
||||
* mol_id:标识id
|
||||
* }
|
||||
* @return List<JSONObject>
|
||||
*/
|
||||
List<JSONObject> queryMolDtl(Map whereJson);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
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.StIvtMoreorlessmst;
|
||||
import org.nl.wms.warehouse_management.service.dto.MoreOrLessInsertDto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 损溢单主表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-28
|
||||
*/
|
||||
public interface IStIvtMoreorlessmstService extends IService<StIvtMoreorlessmst> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param whereJson : {查询参数}
|
||||
* @param page : 分页对象
|
||||
* @return 返回结果
|
||||
*/
|
||||
IPage<JSONObject> queryAll(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 新增损益单
|
||||
* @param dto:新增修改dto实体类
|
||||
*/
|
||||
void create(MoreOrLessInsertDto dto);
|
||||
|
||||
/**
|
||||
* 修改损益单
|
||||
* @param dto:新增修改dto实体类
|
||||
*/
|
||||
void update(MoreOrLessInsertDto dto);
|
||||
|
||||
/**
|
||||
* 删除损益单
|
||||
* @param ids id集合
|
||||
*/
|
||||
void delete(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 查询损益单明细
|
||||
* @param whereJson {
|
||||
* mol_id: 标识id
|
||||
* }
|
||||
* @return List<JSONObject>
|
||||
*/
|
||||
List<JSONObject> queryMolDtl(Map whereJson);
|
||||
|
||||
/**
|
||||
* 强制确认
|
||||
* @param dao 主表实体类
|
||||
*/
|
||||
void confirm(StIvtMoreorlessmst dao);
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
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-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("st_ivt_moreorlessdtl")
|
||||
public class StIvtMoreorlessdtl implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 损溢单明细id
|
||||
*/
|
||||
@TableId(value = "mol_dtl_id")
|
||||
private String mol_dtl_id;
|
||||
|
||||
/**
|
||||
* 损溢单标识
|
||||
*/
|
||||
private String mol_id;
|
||||
|
||||
/**
|
||||
* 明细序号
|
||||
*/
|
||||
private BigDecimal seq_no;
|
||||
|
||||
/**
|
||||
* 库区编码
|
||||
*/
|
||||
private String sect_code;
|
||||
|
||||
/**
|
||||
* 仓位编码
|
||||
*/
|
||||
private String struct_code;
|
||||
|
||||
/**
|
||||
* 存储载具编码
|
||||
*/
|
||||
private String storagevehicle_code;
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private String material_id;
|
||||
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
private String pcsn;
|
||||
|
||||
/**
|
||||
* 数量计量单位标识
|
||||
*/
|
||||
private String qty_unit_id;
|
||||
|
||||
/**
|
||||
* 数量计量单位名称
|
||||
*/
|
||||
private String qty_unit_name;
|
||||
|
||||
/**
|
||||
* 损溢数量
|
||||
*/
|
||||
private BigDecimal mol_qty;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 来源单编号
|
||||
*/
|
||||
private String source_bill_code;
|
||||
|
||||
|
||||
}
|
||||
@@ -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-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("st_ivt_moreorlessmst")
|
||||
public class StIvtMoreorlessmst implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 损溢单标识
|
||||
*/
|
||||
@TableId(value = "mol_id")
|
||||
private String mol_id;
|
||||
|
||||
/**
|
||||
* 损溢单号
|
||||
*/
|
||||
private String mol_code;
|
||||
|
||||
/**
|
||||
* 损溢单类型
|
||||
*/
|
||||
private String mol_inv_type;
|
||||
|
||||
/**
|
||||
* 损溢类型
|
||||
*/
|
||||
private String mol_type;
|
||||
|
||||
/**
|
||||
* 仓库标识
|
||||
*/
|
||||
private String stor_id;
|
||||
|
||||
/**
|
||||
* 明细数
|
||||
*/
|
||||
private BigDecimal dtl_num;
|
||||
|
||||
/**
|
||||
* 总数量
|
||||
*/
|
||||
private BigDecimal total_qty;
|
||||
|
||||
/**
|
||||
* 生成方式
|
||||
*/
|
||||
private String create_mode;
|
||||
|
||||
/**
|
||||
* 制单人
|
||||
*/
|
||||
private String input_optid;
|
||||
|
||||
/**
|
||||
* 制单人姓名
|
||||
*/
|
||||
private String input_optname;
|
||||
|
||||
/**
|
||||
* 制单时间
|
||||
*/
|
||||
private String input_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 确认人
|
||||
*/
|
||||
private String confirm_optid;
|
||||
|
||||
/**
|
||||
* 确认人姓名
|
||||
*/
|
||||
private String confirm_optname;
|
||||
|
||||
/**
|
||||
* 确认时间
|
||||
*/
|
||||
private String confirm_time;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
|
||||
}
|
||||
@@ -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.StIvtMoreorlessdtl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 损溢单明细表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-28
|
||||
*/
|
||||
public interface StIvtMoreorlessdtlMapper extends BaseMapper<StIvtMoreorlessdtl> {
|
||||
|
||||
/**
|
||||
* 查询明细
|
||||
* @param whereJson {
|
||||
* mol_id 标识id
|
||||
* }
|
||||
* @return List<JSONObject>
|
||||
*/
|
||||
List<JSONObject> queryMolDtl(@Param("param") Map whereJson);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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.StIvtMoreorlessdtlMapper">
|
||||
|
||||
<select id="queryMolDtl" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
dtl.mol_dtl_id,
|
||||
dtl.sect_code,
|
||||
dtl.struct_code,
|
||||
dtl.storagevehicle_code,
|
||||
dtl.material_id,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
dtl.pcsn,
|
||||
dtl.qty_unit_id,
|
||||
dtl.qty_unit_name,
|
||||
dtl.mol_qty,
|
||||
dtl.status,
|
||||
dtl.source_bill_code,
|
||||
ext.canuse_qty AS ivt_qty
|
||||
FROM
|
||||
st_ivt_moreorlessdtl dtl
|
||||
LEFT JOIN st_ivt_moreorlessmst ios ON ios.mol_id = dtl.mol_id
|
||||
LEFT JOIN md_me_materialbase material ON material.material_id = dtl.material_id
|
||||
INNER JOIN md_pb_storagevehicleext ext ON ext.storagevehicle_code = dtl.storagevehicle_code
|
||||
AND ext.material_id = dtl.material_id AND dtl.pcsn = ext.pcsn
|
||||
<where>
|
||||
ios.is_delete = '0'
|
||||
<if test="param.mol_id != null and param.mol_id != ''">
|
||||
AND
|
||||
ios.mol_id = #{param.mol_id}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtMoreorlessmst;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 损溢单主表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Liuxy
|
||||
* @since 2025-05-28
|
||||
*/
|
||||
public interface StIvtMoreorlessmstMapper extends BaseMapper<StIvtMoreorlessmst> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页条件
|
||||
* @param whereJson 查询条件
|
||||
* @return IPage<JSONObject>
|
||||
*/
|
||||
IPage<JSONObject> queryAllByPage(Page<JSONObject> page,@Param("param") Map whereJson);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?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.StIvtMoreorlessmstMapper">
|
||||
|
||||
<select id="queryAllByPage" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
ios.*
|
||||
FROM
|
||||
st_ivt_moreorlessmst ios
|
||||
LEFT JOIN st_ivt_moreorlessdtl dtl ON ios.mol_id = dtl.mol_id
|
||||
<where>
|
||||
ios.is_delete = '0'
|
||||
<if test="param.mol_code != null and param.mol_code != ''">
|
||||
AND
|
||||
ios.mol_code LIKE #{param.mol_code}
|
||||
</if>
|
||||
|
||||
<if test="param.stor_id != null and param.stor_id != ''">
|
||||
AND
|
||||
ios.stor_id = #{param.stor_id}
|
||||
</if>
|
||||
|
||||
<if test="param.struct_code != null and param.struct_code != ''">
|
||||
AND
|
||||
dtl.struct_code LIKE #{param.struct_code}
|
||||
</if>
|
||||
|
||||
<if test="param.mol_type != null and param.mol_type != ''">
|
||||
AND
|
||||
ios.mol_type = #{param.mol_type}
|
||||
</if>
|
||||
|
||||
<if test="param.mol_inv_type != null and param.mol_inv_type != ''">
|
||||
AND
|
||||
ios.mol_inv_type = #{param.mol_inv_type}
|
||||
</if>
|
||||
|
||||
<if test="param.status != null and param.status != ''">
|
||||
AND
|
||||
ios.status = #{param.status}
|
||||
</if>
|
||||
|
||||
<if test="param.begin_time != null and param.begin_time != ''">
|
||||
AND
|
||||
ios.input_time >= #{param.begin_time}
|
||||
</if>
|
||||
<if test="param.end_time != null and param.end_time != ''">
|
||||
AND
|
||||
#{param.end_time} >= ios.input_time
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY ios.input_time Desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,87 @@
|
||||
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/28
|
||||
*/
|
||||
@Data
|
||||
public class MoreOrLessInsertDto {
|
||||
|
||||
/**
|
||||
* 单据标识
|
||||
*/
|
||||
private String mol_id;
|
||||
|
||||
/**
|
||||
* 单据类型
|
||||
*/
|
||||
private String mol_inv_type;
|
||||
|
||||
/**
|
||||
* 损益类型
|
||||
*/
|
||||
private String mol_type;
|
||||
|
||||
/**
|
||||
* 业务日期
|
||||
*/
|
||||
private String biz_date;
|
||||
|
||||
/**
|
||||
* 明细数
|
||||
*/
|
||||
private BigDecimal dtl_num;
|
||||
|
||||
/**
|
||||
* 仓库标识
|
||||
*/
|
||||
private String stor_id;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 总数量
|
||||
*/
|
||||
private BigDecimal total_qty;
|
||||
|
||||
/**
|
||||
* 生成方式
|
||||
*/
|
||||
private String create_mode;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 明细数据:
|
||||
* {
|
||||
* material_code 物料编码
|
||||
* material_id 物料id
|
||||
* material_name 物料名称
|
||||
* pcsn 批次
|
||||
* ivt_qty 库存数量
|
||||
* mol_qty 损益数量
|
||||
* qty_unit_id 计量单位标识
|
||||
* qty_unit_name 计量单位名称
|
||||
* storagevehicle_code 载具编码
|
||||
* sect_code 库区
|
||||
* struct_code 仓位
|
||||
* status 执行状态
|
||||
* remark 备注
|
||||
* source_bill_code 源单据编码(盘点业务使用)
|
||||
* }
|
||||
*/
|
||||
private List<JSONObject> tableData;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package org.nl.wms.warehouse_management.service.impl;
|
||||
|
||||
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.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtMoreorlessdtlService;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtMoreorlessdtl;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.StIvtMoreorlessdtlMapper;
|
||||
import org.nl.wms.warehouse_management.service.dto.MoreOrLessInsertDto;
|
||||
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-28
|
||||
*/
|
||||
@Service
|
||||
public class StIvtMoreorlessdtlServiceImpl extends ServiceImpl<StIvtMoreorlessdtlMapper, StIvtMoreorlessdtl> implements IStIvtMoreorlessdtlService {
|
||||
|
||||
@Override
|
||||
public void createMoreDtl(MoreOrLessInsertDto dto) {
|
||||
// 批量新增明细集合
|
||||
List<StIvtMoreorlessdtl> dtlDaoList = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < dto.getTableData().size(); i++) {
|
||||
JSONObject json = dto.getTableData().get(i);
|
||||
StIvtMoreorlessdtl dao = new StIvtMoreorlessdtl();
|
||||
dao.setMol_dtl_id(IdUtil.getStringId());
|
||||
dao.setMol_id(dto.getMol_id());
|
||||
dao.setSeq_no(BigDecimal.valueOf(i+1));
|
||||
dao.setStruct_code(json.getString("struct_code"));
|
||||
dao.setSect_code(json.getString("sect_code"));
|
||||
dao.setStoragevehicle_code(json.getString("storagevehicle_code"));
|
||||
dao.setMaterial_id(json.getString("material_id"));
|
||||
dao.setPcsn(json.getString("pcsn"));
|
||||
dao.setQty_unit_id(json.getString("qty_unit_id"));
|
||||
dao.setQty_unit_name(json.getString("qty_unit_name"));
|
||||
dao.setMol_qty(json.getBigDecimal("mol_qty"));
|
||||
dao.setStatus(IOSEnum.MORE_MST_STATUS.code("生成"));
|
||||
dao.setSource_bill_code(json.getString("source_bill_code"));
|
||||
dtlDaoList.add(dao);
|
||||
}
|
||||
this.saveBatch(dtlDaoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryMolDtl(Map whereJson) {
|
||||
return this.baseMapper.queryMolDtl(whereJson);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package org.nl.wms.warehouse_management.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.warehouse_management.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_management.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtMoreorlessdtlService;
|
||||
import org.nl.wms.warehouse_management.service.IStIvtMoreorlessmstService;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtMoreorlessdtl;
|
||||
import org.nl.wms.warehouse_management.service.dao.StIvtMoreorlessmst;
|
||||
import org.nl.wms.warehouse_management.service.dao.mapper.StIvtMoreorlessmstMapper;
|
||||
import org.nl.wms.warehouse_management.service.dto.MoreOrLessInsertDto;
|
||||
import org.nl.wms.warehouse_management.service.util.UpdateIvtUtils;
|
||||
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 Liuixy
|
||||
* @since 2025-05-28
|
||||
*/
|
||||
@Service
|
||||
public class StIvtMoreorlessmstServiceImpl extends ServiceImpl<StIvtMoreorlessmstMapper, StIvtMoreorlessmst> implements IStIvtMoreorlessmstService {
|
||||
|
||||
/**
|
||||
* 损益明细服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStIvtMoreorlessdtlService iStIvtMoreorlessdtlService;
|
||||
|
||||
/**
|
||||
* 变更库存工具类
|
||||
*/
|
||||
@Autowired
|
||||
private UpdateIvtUtils updateIvtUtils;
|
||||
|
||||
@Override
|
||||
public IPage<JSONObject> queryAll(Map whereJson, PageQuery page) {
|
||||
return this.baseMapper.queryAllByPage(new Page<>(page.getPage() + 1, page.getSize()),
|
||||
whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void create(MoreOrLessInsertDto dto) {
|
||||
// 主表
|
||||
StIvtMoreorlessmst mstDao = new StIvtMoreorlessmst();
|
||||
mstDao.setMol_id(IdUtil.getStringId());
|
||||
mstDao.setMol_code(CodeUtil.getNewCode("MORE_BILL_CODE"));
|
||||
mstDao.setMol_type(dto.getMol_type());
|
||||
mstDao.setMol_inv_type(dto.getMol_inv_type());
|
||||
mstDao.setStor_id(dto.getStor_id());
|
||||
mstDao.setDtl_num(dto.getDtl_num());
|
||||
mstDao.setTotal_qty(dto.getTotal_qty());
|
||||
mstDao.setCreate_mode(dto.getCreate_mode());
|
||||
mstDao.setInput_optid(SecurityUtils.getCurrentUserId());
|
||||
mstDao.setInput_optname(SecurityUtils.getCurrentNickName());
|
||||
mstDao.setInput_time(DateUtil.now());
|
||||
mstDao.setStatus(dto.getStatus());
|
||||
this.save(mstDao);
|
||||
|
||||
// 明细
|
||||
dto.setMol_id(mstDao.getMol_id());
|
||||
iStIvtMoreorlessdtlService.createMoreDtl(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void update(MoreOrLessInsertDto dto) {
|
||||
StIvtMoreorlessmst mstDao = this.getById(dto.getMol_id());
|
||||
mstDao.setMol_type(dto.getMol_type());
|
||||
mstDao.setStor_id(dto.getStor_id());
|
||||
mstDao.setDtl_num(dto.getDtl_num());
|
||||
mstDao.setTotal_qty(dto.getTotal_qty());
|
||||
mstDao.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
mstDao.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
mstDao.setUpdate_time(DateUtil.now());
|
||||
this.updateById(mstDao);
|
||||
|
||||
// 删除老的所有明细
|
||||
iStIvtMoreorlessdtlService.remove(
|
||||
new QueryWrapper<StIvtMoreorlessdtl>().lambda()
|
||||
.eq(StIvtMoreorlessdtl::getMol_id, mstDao.getMol_id())
|
||||
);
|
||||
// 新增明细
|
||||
iStIvtMoreorlessdtlService.createMoreDtl(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(Set<String> ids) {
|
||||
this.update(
|
||||
new UpdateWrapper<StIvtMoreorlessmst>().lambda()
|
||||
.in(StIvtMoreorlessmst::getMol_id,ids)
|
||||
.set(StIvtMoreorlessmst::getIs_delete, IOSConstant.IS_DELETE_YES)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryMolDtl(Map whereJson) {
|
||||
return iStIvtMoreorlessdtlService.queryMolDtl(whereJson);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void confirm(StIvtMoreorlessmst dao) {
|
||||
// 更新主表
|
||||
dao.setStatus(IOSEnum.MORE_MST_STATUS.code("完成"));
|
||||
dao.setConfirm_optid(SecurityUtils.getCurrentUserId());
|
||||
dao.setConfirm_optname(SecurityUtils.getCurrentNickName());
|
||||
dao.setConfirm_time(DateUtil.now());
|
||||
this.updateById(dao);
|
||||
// 查询所有明细
|
||||
List<StIvtMoreorlessdtl> dtlDaoList = iStIvtMoreorlessdtlService.list(
|
||||
new QueryWrapper<StIvtMoreorlessdtl>().lambda()
|
||||
.eq(StIvtMoreorlessdtl::getMol_id, dao.getMol_id())
|
||||
);
|
||||
// 更新库存
|
||||
for (StIvtMoreorlessdtl dto : dtlDaoList) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("type", dao.getMol_type().equals(IOSEnum.MORE_TYPE.code("损"))
|
||||
? IOSConstant.UPDATE_IVT_TYPE_SUB_CANUSE_IVT : IOSConstant.UPDATE_IVT_TYPE_ADD_CANUSE_IVT);
|
||||
json.put("storagevehicle_code",dto.getStoragevehicle_code());
|
||||
json.put("material_id",dto.getMaterial_id());
|
||||
json.put("pcsn",dto.getPcsn());
|
||||
json.put("qty_unit_id",dto.getQty_unit_id());
|
||||
json.put("qty_unit_name",dto.getQty_unit_name());
|
||||
json.put("change_qty",dto.getMol_qty());
|
||||
json.put("remark","由损益单据【"+dao.getMol_code()+"】变更库存数量【"+dto.getMol_qty()+"】");
|
||||
updateIvtUtils.updateIvt(json);
|
||||
}
|
||||
// 更新明细为完成
|
||||
iStIvtMoreorlessdtlService.update(
|
||||
new UpdateWrapper<StIvtMoreorlessdtl>().lambda()
|
||||
.eq(StIvtMoreorlessdtl::getMol_id, dao.getMol_id())
|
||||
.set(StIvtMoreorlessdtl::getStatus, IOSEnum.MORE_MST_STATUS.code("完成"))
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class UpdateIvtUtils {
|
||||
/**
|
||||
* 更新库存
|
||||
* @param where: {
|
||||
* type: 1-加可用,2-加冻结减可用,3-减冻结
|
||||
* type: 1-加可用(插入数据),2-加冻结减可用,3-减冻结,4-减冻结加可用,5-加可用(加库存),6-减可用(减库存)
|
||||
* storagevehicle_code: 载具编码
|
||||
* material_id: 物料标识
|
||||
* pcsn: 批次
|
||||
@@ -51,7 +51,7 @@ public class UpdateIvtUtils {
|
||||
switch (type) {
|
||||
case IOSConstant.UPDATE_IVT_TYPE_ADD_CANUSE :
|
||||
// 加可用
|
||||
updateAddCanuseIvt(where);
|
||||
updateAddCanuseInsertIvt(where);
|
||||
break;
|
||||
case IOSConstant.UPDATE_IVT_TYPE_ADD_FROZEN :
|
||||
// 加冻结减可用
|
||||
@@ -65,6 +65,14 @@ public class UpdateIvtUtils {
|
||||
// 减冻结加可用
|
||||
updateSubFrozenAddIvt(where);
|
||||
break;
|
||||
case IOSConstant.UPDATE_IVT_TYPE_ADD_CANUSE_IVT :
|
||||
// 加可用(加库存)
|
||||
updateAddCanuseIvt(where);
|
||||
break;
|
||||
case IOSConstant.UPDATE_IVT_TYPE_SUB_CANUSE_IVT :
|
||||
// 减可用(减库存)
|
||||
updateSubCanuseIvt(where);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -100,10 +108,10 @@ public class UpdateIvtUtils {
|
||||
|
||||
|
||||
/**
|
||||
* 加可用
|
||||
* 加可用(插入数据)
|
||||
* @param where 输入参数
|
||||
*/
|
||||
private void updateAddCanuseIvt(JSONObject where) {
|
||||
private void updateAddCanuseInsertIvt(JSONObject where) {
|
||||
// 判断当前载具是否有物料
|
||||
MdPbStoragevehicleext extDao = iMdPbStoragevehicleextService.getOne(
|
||||
new QueryWrapper<MdPbStoragevehicleext>().lambda()
|
||||
@@ -122,6 +130,7 @@ public class UpdateIvtUtils {
|
||||
extParamDao.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
extParamDao.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
extParamDao.setUpdate_time(DateUtil.now());
|
||||
extParamDao.setRemark(where.getString("remark"));
|
||||
iMdPbStoragevehicleextService.save(extParamDao);
|
||||
}
|
||||
|
||||
@@ -223,4 +232,55 @@ public class UpdateIvtUtils {
|
||||
iMdPbStoragevehicleextService.updateById(extDao);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加可用(加库存)
|
||||
* @param where 输入参数
|
||||
*/
|
||||
private void updateAddCanuseIvt(JSONObject where) {
|
||||
MdPbStoragevehicleext extDao = iMdPbStoragevehicleextService.getOne(
|
||||
new QueryWrapper<MdPbStoragevehicleext>().lambda()
|
||||
.eq(MdPbStoragevehicleext::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
||||
.eq(MdPbStoragevehicleext::getMaterial_id, where.getString("material_id"))
|
||||
.eq(MdPbStoragevehicleext::getPcsn, where.getString("pcsn"))
|
||||
);
|
||||
if (ObjectUtil.isEmpty(extDao)) {
|
||||
throw new BadRequestException("当前载具【"+extDao.getStoragevehicle_code()+"】不存在相关物料批次库存,请检查数据!");
|
||||
}
|
||||
|
||||
double canuse_qty = NumberUtil.add(extDao.getCanuse_qty(), where.getDoubleValue("change_qty")).doubleValue();
|
||||
extDao.setCanuse_qty(BigDecimal.valueOf(canuse_qty));
|
||||
extDao.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
extDao.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
extDao.setUpdate_time(DateUtil.now());
|
||||
extDao.setRemark(where.getString("remark"));
|
||||
iMdPbStoragevehicleextService.updateById(extDao);
|
||||
}
|
||||
|
||||
/**
|
||||
* 减可用(减库存)
|
||||
* @param where 输入参数
|
||||
*/
|
||||
private void updateSubCanuseIvt(JSONObject where) {
|
||||
MdPbStoragevehicleext extDao = iMdPbStoragevehicleextService.getOne(
|
||||
new QueryWrapper<MdPbStoragevehicleext>().lambda()
|
||||
.eq(MdPbStoragevehicleext::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
||||
.eq(MdPbStoragevehicleext::getMaterial_id, where.getString("material_id"))
|
||||
.eq(MdPbStoragevehicleext::getPcsn, where.getString("pcsn"))
|
||||
);
|
||||
if (ObjectUtil.isEmpty(extDao)) {
|
||||
throw new BadRequestException("当前载具【"+extDao.getStoragevehicle_code()+"】不存在相关物料批次库存,请检查数据!");
|
||||
}
|
||||
|
||||
double canuse_qty = NumberUtil.sub(extDao.getCanuse_qty(), where.getDoubleValue("change_qty")).doubleValue();
|
||||
if (canuse_qty < 0) {
|
||||
throw new BadRequestException("可用数不能为负数,请检查变动数量!当前可用数为【"+extDao.getCanuse_qty()+"】当前变动数为【"+where.getDoubleValue("change_qty")+"】");
|
||||
}
|
||||
extDao.setCanuse_qty(BigDecimal.valueOf(canuse_qty));
|
||||
extDao.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
extDao.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
extDao.setUpdate_time(DateUtil.now());
|
||||
extDao.setRemark(where.getString("remark"));
|
||||
iMdPbStoragevehicleextService.updateById(extDao);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user