出库模块开发

This commit is contained in:
2025-06-10 09:37:37 +08:00
parent 4d6d670bf4
commit 52ff615f29
18 changed files with 857 additions and 163 deletions

View File

@@ -131,8 +131,8 @@ public class RkInfoController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('wisdom:outbound:add')")
@Log(title = "库存单据主", businessType = BusinessType.UPDATE)
@PostMapping("/updateOutStock")
public AjaxResult updateOutStock(@RequestBody StockOutDTO dto) {
return toAjax(rkInfoService.updateOutStock(dto));
@PutMapping("/outStock")
public AjaxResult doOutStock(@RequestBody StockOutDTO dto) {
return toAjax(rkInfoService.batchOutStock(dto));
}
}

View File

@@ -57,6 +57,36 @@ public class RkBill extends BaseEntity
// @Excel(name = "理货员")
private String lihuoY;
/** 出库类型 */
private String ckType;
/** 出库类型名称(展示用) */
@Excel(name = "出库类型名称")
private String ckTypeName;
/** 出库时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "出库时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date ckTime;
/** 出库理货员 */
private String ckLihuoY;
/** 出库理货员名称(展示用) */
@Excel(name = "出库理货员名称")
private String ckLihuoYName;
/** 出库备注 */
@Excel(name = "出库备注")
private String ckRemark;
/** 施工队编码 */
private String teamCode;
/** 施工队名称(展示用) */
@Excel(name = "施工队名称")
private String teamName;
/** 单据号 */
@Excel(name = "单据号")
private String billNo;
@@ -125,6 +155,70 @@ public class RkBill extends BaseEntity
this.lihuoY = lihuoY;
}
public String getCkType() {
return ckType;
}
public void setCkType(String ckType) {
this.ckType = ckType;
}
public String getCkTypeName() {
return ckTypeName;
}
public void setCkTypeName(String ckTypeName) {
this.ckTypeName = ckTypeName;
}
public Date getCkTime() {
return ckTime;
}
public void setCkTime(Date ckTime) {
this.ckTime = ckTime;
}
public String getCkLihuoY() {
return ckLihuoY;
}
public void setCkLihuoY(String ckLihuoY) {
this.ckLihuoY = ckLihuoY;
}
public String getCkLihuoYName() {
return ckLihuoYName;
}
public void setCkLihuoYName(String ckLihuoYName) {
this.ckLihuoYName = ckLihuoYName;
}
public String getCkRemark() {
return ckRemark;
}
public void setCkRemark(String ckRemark) {
this.ckRemark = ckRemark;
}
public String getTeamCode() {
return teamCode;
}
public void setTeamCode(String teamCode) {
this.teamCode = teamCode;
}
public String getTeamName() {
return teamName;
}
public void setTeamName(String teamName) {
this.teamName = teamName;
}
public String getBillNo() {
return billNo;
}
@@ -158,6 +252,14 @@ public class RkBill extends BaseEntity
.append("cangku", getCangku())
.append("rkTime", getRkTime())
.append("lihuoY", getLihuoY())
.append("ckType", getCkType())
.append("ckTypeName", getCkTypeName())
.append("ckTime", getCkTime())
.append("ckLihuoY", getCkLihuoY())
.append("ckLihuoYName", getCkLihuoYName())
.append("ckRemark", getCkRemark())
.append("teamCode", getTeamCode())
.append("teamName", getTeamName())
.append("billNo", getBillNo())
.append("isChuku", getIsChuku())
.append("isDelete", getIsDelete())

View File

@@ -67,6 +67,10 @@ public class RkInfo extends BaseEntity
@Excel(name = "单据号")
private String billNo;
/** 出库单据号 */
@Excel(name = "出库单据号")
private String billNoCk;
/** 县局 */
@Excel(name = "县局")
private String xj;
@@ -279,6 +283,14 @@ public class RkInfo extends BaseEntity
return billNo;
}
public String getBillNoCk() {
return billNoCk;
}
public void setBillNoCk(String billNoCk) {
this.billNoCk = billNoCk;
}
public void setBillNo(String billNo) {
this.billNo = billNo;
}
@@ -548,6 +560,7 @@ public class RkInfo extends BaseEntity
.append("lihuoY", getLihuoY())
.append("isChuku", getIsChuku())
.append("billNo", getBillNo())
.append("billNoCk", getBillNoCk())
.append("remark", getRemark())
.append("xj", getXj())
.append("xmNo", getXmNo())

View File

@@ -1,82 +1,29 @@
package com.zg.project.wisdom.domain.dto;
import com.zg.project.wisdom.domain.dto.StockOutItemDTO;
import lombok.Data;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* 出库请求 DTO:用于批量出库操作
* 对应操作 rk_info 表中多个记录出库
* 出库请求 DTO
*/
@Data
public class StockOutDTO {
/** 出库的 rk_info 主键 ID 集合 */
private List<Long> ids;
/** 领用时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
/** 领用时间(出库时间) */
private Date lyTime;
/** 出库类型编码 */
private String ckType;
/** 施工队编码 */
private String teamCode;
/** 出库理货员姓名 */
/** 出库类型 */
private String ckType;
/** 出库理货员 */
private String ckLihuoY;
// ==== Getter & Setter ====
public List<Long> getIds() {
return ids;
}
public void setIds(List<Long> ids) {
this.ids = ids;
}
public Date getLyTime() {
return lyTime;
}
public void setLyTime(Date lyTime) {
this.lyTime = lyTime;
}
public String getCkType() {
return ckType;
}
public void setCkType(String ckType) {
this.ckType = ckType;
}
public String getTeamCode() {
return teamCode;
}
public void setTeamCode(String teamCode) {
this.teamCode = teamCode;
}
public String getCkLihuoY() {
return ckLihuoY;
}
public void setCkLihuoY(String ckLihuoY) {
this.ckLihuoY = ckLihuoY;
}
@Override
public String toString() {
return "StockOutDTO{" +
"ids=" + ids +
", lyTime=" + lyTime +
", ckType='" + ckType + '\'' +
", teamCode='" + teamCode + '\'' +
", ckLihuoY='" + ckLihuoY + '\'' +
'}';
}
/** 出库列表 */
private List<StockOutItemDTO> ckList;
}

View File

@@ -0,0 +1,16 @@
package com.zg.project.wisdom.domain.dto;
import lombok.Data;
/**
* 出库明细 DTO
*/
@Data
public class StockOutItemDTO {
/** 出库记录 ID库存 ID */
private Long id;
/** 出库备注 */
private String ckRemark;
}

View File

@@ -1,8 +1,10 @@
package com.zg.project.wisdom.mapper;
import com.zg.project.wisdom.domain.RkBill;
import com.zg.project.wisdom.domain.dto.StockOutItemDTO;
import org.apache.ibatis.annotations.Param;
import java.util.ArrayList;
import java.util.List;
public interface RkBillMapper {
@@ -28,9 +30,5 @@ public interface RkBillMapper {
int logicDeleteRkBillByIds(@Param("ids") Long[] ids);
/**
* 批量更新出库状态
* @param ids
*/
void updateOutStock(List<Long> ids);
}

View File

@@ -101,9 +101,8 @@ public interface RkInfoMapper
List<RkInfo> selectTopOverdueStock(@Param("limit") int limit);
/**
* 批量更新出库信息
* @param list
* @return
* 出库操作
* @param update
*/
int batchUpdateOutStock(List<RkInfo> list);
void updateById(RkInfo update);
}

View File

@@ -91,9 +91,9 @@ public interface IRkInfoService
List<RkInfo> selectTopOverdueStock(int i);
/**
* 出库操作
* 批量出库
* @param dto
* @return
*/
int updateOutStock(StockOutDTO dto);
int batchOutStock(StockOutDTO dto);
}

View File

@@ -3,10 +3,9 @@ package com.zg.project.wisdom.service.impl;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.zg.common.exception.ServiceException;
import com.zg.common.utils.DateUtils;
import com.zg.common.utils.SecurityUtils;
@@ -131,22 +130,22 @@ public class RkInfoServiceImpl implements IRkInfoService
throw new ServiceException("rkList 入库明细列表不能为空");
}
// ✅ 生成统一单据号
String billNo = BillNoUtil.generateTodayBillNo();
// ✅ 插入单据主表
RkBill bill = new RkBill();
bill.setBillNo(billNo);
bill.setRkType(dto.getRkType());
bill.setWlType(dto.getWlType());
bill.setCangku(dto.getCangku());
bill.setRkTime(now);
bill.setLihuoY(dto.getLihuoY());
bill.setIsChuku("0");
bill.setIsDelete("0");
bill.setCreateBy(username);
bill.setCreateTime(now);
rkBillMapper.insertRkBill(bill);
// // ✅ 生成统一单据号
// String billNo = BillNoUtil.generateTodayBillNo("RK");
//
// // ✅ 插入单据主表
// RkBill bill = new RkBill();
// bill.setBillNo(billNo);
// bill.setRkType(dto.getRkType());
// bill.setWlType(dto.getWlType());
// bill.setCangku(dto.getCangku());
// bill.setRkTime(now);
// bill.setLihuoY(dto.getLihuoY());
// bill.setIsChuku("0");
// bill.setIsDelete("0");
// bill.setCreateBy(username);
// bill.setCreateTime(now);
// rkBillMapper.insertRkBill(bill);
// ✅ 构建明细列表
for (PcRkInfoItemDTO item : dto.getRkList()) {
@@ -157,7 +156,7 @@ public class RkInfoServiceImpl implements IRkInfoService
entity.setCangku(dto.getCangku());
entity.setLihuoY(dto.getLihuoY());
entity.setBillNo(billNo);
// entity.setBillNo(billNo);
entity.setXj(item.getXj());
entity.setXmNo(item.getXmNo());
@@ -220,7 +219,7 @@ public class RkInfoServiceImpl implements IRkInfoService
}
// ✅ 生成统一的单据号
String billNo = BillNoUtil.generateTodayBillNo();
String billNo = BillNoUtil.generateTodayBillNo("CK");
RkBill bill = new RkBill();
bill.setBillNo(billNo);
@@ -337,31 +336,53 @@ public class RkInfoServiceImpl implements IRkInfoService
}
@Override
public int updateOutStock(StockOutDTO dto) {
if (dto == null || dto.getIds() == null || dto.getIds().isEmpty()) {
throw new ServiceException("出库记录ID列表不能为空");
@Transactional(rollbackFor = Exception.class)
public int batchOutStock(StockOutDTO dto) {
if (dto.getCkList() == null || dto.getCkList().isEmpty()) {
throw new ServiceException("出库数据不能为空");
}
Date now = dto.getLyTime() != null ? dto.getLyTime() : DateUtils.getNowDate();
String username = SecurityUtils.getUsername();
Date now = DateUtils.getNowDate();
List<RkInfo> list = new ArrayList<>();
for (Long id : dto.getIds()) {
RkInfo entity = new RkInfo();
entity.setId(id);
entity.setIsChuku("1");
entity.setLyTime(now);
entity.setCkType(dto.getCkType());
entity.setTeamCode(dto.getTeamCode());
entity.setCkLihuoY(dto.getCkLihuoY());
entity.setUpdateBy(username);
entity.setUpdateTime(now);
list.add(entity);
// Step 1: 提前生成出库单据号(如 CK202406100001
String billNo = BillNoUtil.generateTodayBillNo("CK");
// Step 2: 构造出库主单 rk_bill
RkBill bill = new RkBill();
bill.setBillNo(billNo);
bill.setCkType(dto.getCkType());
bill.setCkTime(dto.getLyTime());
bill.setCkLihuoY(dto.getCkLihuoY());
bill.setTeamCode(dto.getTeamCode());
bill.setIsChuku("1");
bill.setIsDelete("0");
bill.setCreateBy(username);
bill.setCreateTime(now);
bill.setUpdateBy(username);
bill.setUpdateTime(now);
rkBillMapper.insertRkBill(bill);
// Step 3: 批量更新 rk_info出库状态 + 单号 + 单据ID
for (StockOutItemDTO item : dto.getCkList()) {
RkInfo update = new RkInfo();
update.setId(item.getId());
update.setBillNoCk(bill.getBillNo());
update.setBillNoCk(billNo);
update.setIsChuku("1");
update.setCkType(dto.getCkType());
update.setLyTime(dto.getLyTime());
update.setCkLihuoY(dto.getCkLihuoY());
update.setTeamCode(dto.getTeamCode());
update.setCkRemark(item.getCkRemark());
update.setUpdateBy(username);
update.setUpdateTime(now);
rkInfoMapper.updateById(update);
}
rkBillMapper.updateOutStock(dto.getIds());
return rkInfoMapper.batchUpdateOutStock(list);
return dto.getCkList().size();
}
}

View File

@@ -4,8 +4,15 @@ import java.text.SimpleDateFormat;
import java.util.Date;
public class BillNoUtil {
public static String generateTodayBillNo() {
String prefix = "RK";
/**
* 生成当天单据号:支持传入前缀(如 "RK" 或 "CK"
* 示例结果RK20240610153015999
*/
public static String generateTodayBillNo(String prefix) {
if (prefix == null || prefix.trim().isEmpty()) {
prefix = "RK"; // 默认用 RK
}
String time = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
return prefix + time;
}

View File

@@ -0,0 +1,104 @@
package com.zg.project.information.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zg.framework.aspectj.lang.annotation.Log;
import com.zg.framework.aspectj.lang.enums.BusinessType;
import com.zg.project.information.domain.MaterialType;
import com.zg.project.information.service.IMaterialTypeService;
import com.zg.framework.web.controller.BaseController;
import com.zg.framework.web.domain.AjaxResult;
import com.zg.common.utils.poi.ExcelUtil;
import com.zg.framework.web.page.TableDataInfo;
/**
* 物资类型Controller
*
* @author zg
* @date 2025-05-27
*/
@RestController
@RequestMapping("/information/materialtype")
public class MaterialTypeController extends BaseController
{
@Autowired
private IMaterialTypeService materialTypeService;
/**
* 查询物资类型列表
*/
@PreAuthorize("@ss.hasPermi('information:materialtype:list')")
@GetMapping("/list")
public TableDataInfo list(MaterialType materialType)
{
startPage();
List<MaterialType> list = materialTypeService.selectMaterialTypeList(materialType);
return getDataTable(list);
}
/**
* 导出物资类型列表
*/
@PreAuthorize("@ss.hasPermi('information:materialtype:export')")
@Log(title = "物资类型", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MaterialType materialType)
{
List<MaterialType> list = materialTypeService.selectMaterialTypeList(materialType);
ExcelUtil<MaterialType> util = new ExcelUtil<MaterialType>(MaterialType.class);
util.exportExcel(response, list, "物资类型数据");
}
/**
* 获取物资类型详细信息
*/
@PreAuthorize("@ss.hasPermi('information:materialtype:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(materialTypeService.selectMaterialTypeById(id));
}
/**
* 新增物资类型
*/
@PreAuthorize("@ss.hasPermi('information:materialtype:add')")
@Log(title = "物资类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MaterialType materialType)
{
return toAjax(materialTypeService.insertMaterialType(materialType));
}
/**
* 修改物资类型
*/
@PreAuthorize("@ss.hasPermi('information:materialtype:edit')")
@Log(title = "物资类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MaterialType materialType)
{
return toAjax(materialTypeService.updateMaterialType(materialType));
}
/**
* 删除物资类型
*/
@PreAuthorize("@ss.hasPermi('information:materialtype:remove')")
@Log(title = "物资类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(materialTypeService.deleteMaterialTypeByIds(ids));
}
}

View File

@@ -0,0 +1,132 @@
package com.zg.project.information.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zg.framework.aspectj.lang.annotation.Excel;
import com.zg.framework.web.domain.BaseEntity;
/**
* 物资类型对象 material_type
*
* @author zg
* @date 2025-05-27
*/
public class MaterialType extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 物资类型编码 */
@Excel(name = "物资类型编码")
private String typeCode;
/** 物资类型名称 */
@Excel(name = "物资类型名称")
private String typeName;
/** 状态1=启用0=禁用) */
@Excel(name = "状态", readConverterExp = "1==启用0=禁用")
private Long status;
/** 排序值 */
@Excel(name = "排序值")
private Long sort;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdAt;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTypeCode(String typeCode)
{
this.typeCode = typeCode;
}
public String getTypeCode()
{
return typeCode;
}
public void setTypeName(String typeName)
{
this.typeName = typeName;
}
public String getTypeName()
{
return typeName;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
public void setSort(Long sort)
{
this.sort = sort;
}
public Long getSort()
{
return sort;
}
public void setCreatedAt(Date createdAt)
{
this.createdAt = createdAt;
}
public Date getCreatedAt()
{
return createdAt;
}
public void setUpdatedAt(Date updatedAt)
{
this.updatedAt = updatedAt;
}
public Date getUpdatedAt()
{
return updatedAt;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("typeCode", getTypeCode())
.append("typeName", getTypeName())
.append("status", getStatus())
.append("sort", getSort())
.append("remark", getRemark())
.append("createdAt", getCreatedAt())
.append("updatedAt", getUpdatedAt())
.toString();
}
}

View File

@@ -0,0 +1,61 @@
package com.zg.project.information.mapper;
import java.util.List;
import com.zg.project.information.domain.MaterialType;
/**
* 物资类型Mapper接口
*
* @author zg
* @date 2025-05-27
*/
public interface MaterialTypeMapper
{
/**
* 查询物资类型
*
* @param id 物资类型主键
* @return 物资类型
*/
public MaterialType selectMaterialTypeById(Long id);
/**
* 查询物资类型列表
*
* @param materialType 物资类型
* @return 物资类型集合
*/
public List<MaterialType> selectMaterialTypeList(MaterialType materialType);
/**
* 新增物资类型
*
* @param materialType 物资类型
* @return 结果
*/
public int insertMaterialType(MaterialType materialType);
/**
* 修改物资类型
*
* @param materialType 物资类型
* @return 结果
*/
public int updateMaterialType(MaterialType materialType);
/**
* 删除物资类型
*
* @param id 物资类型主键
* @return 结果
*/
public int deleteMaterialTypeById(Long id);
/**
* 批量删除物资类型
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteMaterialTypeByIds(Long[] ids);
}

View File

@@ -0,0 +1,61 @@
package com.zg.project.information.service;
import java.util.List;
import com.zg.project.information.domain.MaterialType;
/**
* 物资类型Service接口
*
* @author zg
* @date 2025-05-27
*/
public interface IMaterialTypeService
{
/**
* 查询物资类型
*
* @param id 物资类型主键
* @return 物资类型
*/
public MaterialType selectMaterialTypeById(Long id);
/**
* 查询物资类型列表
*
* @param materialType 物资类型
* @return 物资类型集合
*/
public List<MaterialType> selectMaterialTypeList(MaterialType materialType);
/**
* 新增物资类型
*
* @param materialType 物资类型
* @return 结果
*/
public int insertMaterialType(MaterialType materialType);
/**
* 修改物资类型
*
* @param materialType 物资类型
* @return 结果
*/
public int updateMaterialType(MaterialType materialType);
/**
* 批量删除物资类型
*
* @param ids 需要删除的物资类型主键集合
* @return 结果
*/
public int deleteMaterialTypeByIds(Long[] ids);
/**
* 删除物资类型信息
*
* @param id 物资类型主键
* @return 结果
*/
public int deleteMaterialTypeById(Long id);
}

View File

@@ -0,0 +1,93 @@
package com.zg.project.information.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zg.project.information.mapper.MaterialTypeMapper;
import com.zg.project.information.domain.MaterialType;
import com.zg.project.information.service.IMaterialTypeService;
/**
* 物资类型Service业务层处理
*
* @author zg
* @date 2025-05-27
*/
@Service
public class MaterialTypeServiceImpl implements IMaterialTypeService
{
@Autowired
private MaterialTypeMapper materialTypeMapper;
/**
* 查询物资类型
*
* @param id 物资类型主键
* @return 物资类型
*/
@Override
public MaterialType selectMaterialTypeById(Long id)
{
return materialTypeMapper.selectMaterialTypeById(id);
}
/**
* 查询物资类型列表
*
* @param materialType 物资类型
* @return 物资类型
*/
@Override
public List<MaterialType> selectMaterialTypeList(MaterialType materialType)
{
return materialTypeMapper.selectMaterialTypeList(materialType);
}
/**
* 新增物资类型
*
* @param materialType 物资类型
* @return 结果
*/
@Override
public int insertMaterialType(MaterialType materialType)
{
return materialTypeMapper.insertMaterialType(materialType);
}
/**
* 修改物资类型
*
* @param materialType 物资类型
* @return 结果
*/
@Override
public int updateMaterialType(MaterialType materialType)
{
return materialTypeMapper.updateMaterialType(materialType);
}
/**
* 批量删除物资类型
*
* @param ids 需要删除的物资类型主键
* @return 结果
*/
@Override
public int deleteMaterialTypeByIds(Long[] ids)
{
return materialTypeMapper.deleteMaterialTypeByIds(ids);
}
/**
* 删除物资类型信息
*
* @param id 物资类型主键
* @return 结果
*/
@Override
public int deleteMaterialTypeById(Long id)
{
return materialTypeMapper.deleteMaterialTypeById(id);
}
}

View File

@@ -0,0 +1,85 @@
<?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="com.zg.project.information.mapper.MaterialTypeMapper">
<resultMap type="MaterialType" id="MaterialTypeResult">
<result property="id" column="id" />
<result property="typeCode" column="type_code" />
<result property="typeName" column="type_name" />
<result property="status" column="status" />
<result property="sort" column="sort" />
<result property="remark" column="remark" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
</resultMap>
<sql id="selectMaterialTypeVo">
select id, type_code, type_name, status, sort, remark, created_at, updated_at from material_type
</sql>
<select id="selectMaterialTypeList" parameterType="MaterialType" resultMap="MaterialTypeResult">
<include refid="selectMaterialTypeVo"/>
<where>
<if test="typeCode != null and typeCode != ''"> and type_code = #{typeCode}</if>
<if test="typeName != null and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if>
<if test="status != null "> and status = #{status}</if>
<if test="sort != null "> and sort = #{sort}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
</where>
</select>
<select id="selectMaterialTypeById" parameterType="Long" resultMap="MaterialTypeResult">
<include refid="selectMaterialTypeVo"/>
where id = #{id}
</select>
<insert id="insertMaterialType" parameterType="MaterialType" useGeneratedKeys="true" keyProperty="id">
insert into material_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeCode != null and typeCode != ''">type_code,</if>
<if test="typeName != null and typeName != ''">type_name,</if>
<if test="status != null">status,</if>
<if test="sort != null">sort,</if>
<if test="remark != null">remark,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedAt != null">updated_at,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeCode != null and typeCode != ''">#{typeCode},</if>
<if test="typeName != null and typeName != ''">#{typeName},</if>
<if test="status != null">#{status},</if>
<if test="sort != null">#{sort},</if>
<if test="remark != null">#{remark},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedAt != null">#{updatedAt},</if>
</trim>
</insert>
<update id="updateMaterialType" parameterType="MaterialType">
update material_type
<trim prefix="SET" suffixOverrides=",">
<if test="typeCode != null and typeCode != ''">type_code = #{typeCode},</if>
<if test="typeName != null and typeName != ''">type_name = #{typeName},</if>
<if test="status != null">status = #{status},</if>
<if test="sort != null">sort = #{sort},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteMaterialTypeById" parameterType="Long">
delete from material_type where id = #{id}
</delete>
<delete id="deleteMaterialTypeByIds" parameterType="String">
delete from material_type where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -8,12 +8,16 @@
<insert id="insertRkBill" parameterType="com.zg.project.wisdom.domain.RkBill">
INSERT INTO rk_bill (
rk_type, wl_type, cangku, rk_time, lihuo_y,
ck_type, ck_time, ck_lihuo_y, ck_remark, team_code,
bill_no, is_chuku, is_delete,
created_by, created_at
created_by, created_at,
updated_by, updated_at
) VALUES (
#{rkType}, #{wlType}, #{cangku}, #{rkTime}, #{lihuoY},
#{ckType}, #{ckTime}, #{ckLihuoY}, #{ckRemark}, #{teamCode},
#{billNo}, #{isChuku}, #{isDelete},
#{createBy}, #{createTime}
#{createBy}, #{createTime},
#{updateBy}, #{updateTime}
)
</insert>
@@ -33,15 +37,28 @@
rb.rk_time AS rkTime,
rb.bill_no AS billNo,
rb.is_chuku AS isChuku,
-- ✅ 出库相关字段(新增)
rb.ck_type AS ckType,
sot.ck_type_name AS ckTypeName,
rb.ck_time AS ckTime,
rb.ck_lihuo_y AS ckLihuoY,
rb.ck_remark AS ckRemark,
rb.team_code AS teamCode,
ct.team_name AS teamName,
rb.is_delete AS isDelete,
rb.created_by AS createBy,
rb.created_at AS createTime,
rb.updated_by AS updateBy,
rb.updated_at AS updateTime
FROM rk_bill rb
LEFT JOIN stock_in_type st ON rb.rk_type = st.type_code
LEFT JOIN material_type mt ON rb.wl_type = mt.type_code
LEFT JOIN warehouse_info wh ON rb.cangku = wh.warehouse_code
LEFT JOIN stock_out_type sot ON rb.ck_type = sot.ck_type_code
LEFT JOIN construction_team ct ON rb.team_code = ct.team_code
WHERE rb.is_delete = '0'
<if test="billNo != null and billNo != ''">
AND rb.bill_no LIKE CONCAT('%', #{billNo}, '%')
@@ -49,37 +66,85 @@
ORDER BY rb.rk_time DESC
</select>
<!-- 根据单据号查询单条 -->
<select id="selectRkBillByBillNo" resultType="com.zg.project.wisdom.domain.RkBill">
SELECT
id, rk_type, wl_type, cangku, rk_time, lihuo_y,
bill_no, is_chuku, is_delete,
created_by AS createBy, created_at AS createTime,
updated_by AS updateBy, updated_at AS updateTime,
remark
FROM rk_bill
WHERE bill_no = #{billNo}
rb.id,
rb.rk_type, st.type_name AS rkTypeName,
rb.wl_type, mt.type_name AS wlTypeName,
rb.cangku, wh.warehouse_name AS cangkuName,
rb.rk_time, rb.lihuo_y,
rb.ck_type, sot.ck_type_name AS ckTypeName,
rb.ck_time, rb.ck_lihuo_y,
rb.ck_remark, rb.team_code, ct.team_name AS teamName,
rb.bill_no, rb.is_chuku, rb.is_delete,
rb.created_by AS createBy, rb.created_at AS createTime,
rb.updated_by AS updateBy, rb.updated_at AS updateTime,
rb.remark
FROM rk_bill rb
LEFT JOIN stock_in_type st ON rb.rk_type = st.type_code
LEFT JOIN material_type mt ON rb.wl_type = mt.type_code
LEFT JOIN warehouse_info wh ON rb.cangku = wh.warehouse_code
LEFT JOIN stock_out_type sot ON rb.ck_type = sot.ck_type_code
LEFT JOIN construction_team ct ON rb.team_code = ct.team_code
WHERE rb.bill_no = #{billNo} AND rb.is_delete = '0'
LIMIT 1
</select>
<!-- 查询详情 -->
<select id="selectRkBillById" resultType="com.zg.project.wisdom.domain.RkBill">
SELECT * FROM rk_bill WHERE id = #{id} AND is_delete = '0'
SELECT
rb.id,
rb.rk_type, st.type_name AS rkTypeName,
rb.wl_type, mt.type_name AS wlTypeName,
rb.cangku, wh.warehouse_name AS cangkuName,
rb.rk_time, rb.lihuo_y,
rb.ck_type, sot.ck_type_name AS ckTypeName,
rb.ck_time, rb.ck_lihuo_y,
rb.ck_remark, rb.team_code, ct.team_name AS teamName,
rb.bill_no, rb.is_chuku, rb.is_delete,
rb.created_by AS createBy, rb.created_at AS createTime,
rb.updated_by AS updateBy, rb.updated_at AS updateTime,
rb.remark
FROM rk_bill rb
LEFT JOIN stock_in_type st ON rb.rk_type = st.type_code
LEFT JOIN material_type mt ON rb.wl_type = mt.type_code
LEFT JOIN warehouse_info wh ON rb.cangku = wh.warehouse_code
LEFT JOIN stock_out_type sot ON rb.ck_type = sot.ck_type_code
LEFT JOIN construction_team ct ON rb.team_code = ct.team_code
WHERE rb.id = #{id} AND rb.is_delete = '0'
</select>
<!-- 修改 -->
<update id="updateRkBill" parameterType="com.zg.project.wisdom.domain.RkBill">
UPDATE rk_bill
SET rk_type = #{rkType},
wl_type = #{wlType},
cangku = #{cangku},
rk_time = #{rkTime},
lihuo_y = #{lihuoY},
bill_no = #{billNo},
is_chuku = #{isChuku},
remark = #{remark},
updated_by = #{updateBy},
updated_at = #{updateTime}
<set>
<if test="rkType != null">rk_type = #{rkType},</if>
<if test="wlType != null">wl_type = #{wlType},</if>
<if test="cangku != null">cangku = #{cangku},</if>
<if test="rkTime != null">rk_time = #{rkTime},</if>
<if test="lihuoY != null">lihuo_y = #{lihuoY},</if>
<if test="ckType != null">ck_type = #{ckType},</if>
<if test="ckTime != null">ck_time = #{ckTime},</if>
<if test="ckLihuoY != null">ck_lihuo_y = #{ckLihuoY},</if>
<if test="ckRemark != null">ck_remark = #{ckRemark},</if>
<if test="teamCode != null">team_code = #{teamCode},</if>
<if test="billNo != null">bill_no = #{billNo},</if>
<if test="isChuku != null">is_chuku = #{isChuku},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null">updated_by = #{updateBy},</if>
<if test="updateTime != null">updated_at = #{updateTime},</if>
</set>
WHERE id = #{id}
</update>
@@ -93,13 +158,4 @@
</foreach>
</update>
<update id="updateOutStock" parameterType="list">
UPDATE rk_bill
SET is_chuku = '1'
WHERE id IN
<foreach collection="list" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>

View File

@@ -259,19 +259,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</update>
<update id="batchUpdateOutStock" parameterType="java.util.List">
<foreach collection="list" item="item" separator=";">
UPDATE rk_info
SET
is_chuku = 1,
ck_time = #{item.ckTime},
ck_type = #{item.ckType},
team_code = #{item.teamCode},
ck_lihuo_y = #{item.ckLihuoY},
update_by = #{item.updateBy},
update_time = #{item.updateTime}
WHERE id = #{item.id} AND is_delete = 0
</foreach>
<update id="updateById" parameterType="RkInfo">
UPDATE rk_info
SET is_chuku = #{isChuku},
ck_remark = #{ckRemark},
ck_type = #{ckType},
ck_time = #{ckTime},
ck_lihuo_y = #{ckLihuoY},
team_code = #{teamCode},
update_by = #{updateBy},
update_time = #{updateTime}
WHERE id = #{id}
</update>
</mapper>