入库模块开发

This commit is contained in:
2025-06-09 15:16:00 +08:00
parent e27d187b7a
commit 4d6d670bf4
31 changed files with 2123 additions and 30 deletions

View File

@@ -0,0 +1,106 @@
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.ConstructionTeam;
import com.zg.project.information.service.IConstructionTeamService;
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-06-09
*/
@RestController
@RequestMapping("/information/construction")
public class ConstructionTeamController extends BaseController
{
@Autowired
private IConstructionTeamService constructionTeamService;
/**
* 查询施工队信息列表
*/
@PreAuthorize("@ss.hasPermi('information:construction:list')")
@GetMapping("/list")
public TableDataInfo list(ConstructionTeam constructionTeam)
{
startPage();
List<ConstructionTeam> list = constructionTeamService.selectConstructionTeamList(constructionTeam);
return getDataTable(list);
}
/**
* 导出施工队信息列表
*/
@PreAuthorize("@ss.hasPermi('information:construction:export')")
@Log(title = "施工队信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ConstructionTeam constructionTeam)
{
List<ConstructionTeam> list = constructionTeamService.selectConstructionTeamList(constructionTeam);
ExcelUtil<ConstructionTeam> util = new ExcelUtil<ConstructionTeam>(ConstructionTeam.class);
util.exportExcel(response, list, "施工队信息数据");
}
/**
* 获取施工队信息详细信息
*/
@PreAuthorize("@ss.hasPermi('information:construction:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(constructionTeamService.selectConstructionTeamById(id));
}
/**
* 新增施工队信息
*/
@PreAuthorize("@ss.hasPermi('information:construction:add')")
@Log(title = "施工队信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ConstructionTeam constructionTeam)
{
return toAjax(constructionTeamService.insertConstructionTeam(constructionTeam));
}
/**
* 修改施工队信息
*/
@PreAuthorize("@ss.hasPermi('information:construction:edit')")
@Log(title = "施工队信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ConstructionTeam constructionTeam)
{
return toAjax(constructionTeamService.updateConstructionTeam(constructionTeam));
}
/**
* 删除施工队信息
*/
@PreAuthorize("@ss.hasPermi('information:construction:remove')")
@Log(title = "施工队信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(constructionTeamService.deleteConstructionTeamByIds(ids));
}
}

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.StockOutType;
import com.zg.project.information.service.IStockOutTypeService;
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-06-09
*/
@RestController
@RequestMapping("/information/outtype")
public class StockOutTypeController extends BaseController
{
@Autowired
private IStockOutTypeService stockOutTypeService;
/**
* 查询出库类型列表
*/
@PreAuthorize("@ss.hasPermi('information:outtype:list')")
@GetMapping("/list")
public TableDataInfo list(StockOutType stockOutType)
{
startPage();
List<StockOutType> list = stockOutTypeService.selectStockOutTypeList(stockOutType);
return getDataTable(list);
}
/**
* 导出出库类型列表
*/
@PreAuthorize("@ss.hasPermi('information:outtype:export')")
@Log(title = "出库类型", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, StockOutType stockOutType)
{
List<StockOutType> list = stockOutTypeService.selectStockOutTypeList(stockOutType);
ExcelUtil<StockOutType> util = new ExcelUtil<StockOutType>(StockOutType.class);
util.exportExcel(response, list, "出库类型数据");
}
/**
* 获取出库类型详细信息
*/
@PreAuthorize("@ss.hasPermi('information:outtype:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(stockOutTypeService.selectStockOutTypeById(id));
}
/**
* 新增出库类型
*/
@PreAuthorize("@ss.hasPermi('information:outtype:add')")
@Log(title = "出库类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody StockOutType stockOutType)
{
return toAjax(stockOutTypeService.insertStockOutType(stockOutType));
}
/**
* 修改出库类型
*/
@PreAuthorize("@ss.hasPermi('information:outtype:edit')")
@Log(title = "出库类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody StockOutType stockOutType)
{
return toAjax(stockOutTypeService.updateStockOutType(stockOutType));
}
/**
* 删除出库类型
*/
@PreAuthorize("@ss.hasPermi('information:outtype:remove')")
@Log(title = "出库类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(stockOutTypeService.deleteStockOutTypeByIds(ids));
}
}

View File

@@ -0,0 +1,146 @@
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;
/**
* 施工队信息对象 construction_team
*
* @author zg
* @date 2025-06-09
*/
public class ConstructionTeam extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 施工队名称 */
@Excel(name = "施工队名称")
private String teamName;
/** 施工队编号 */
@Excel(name = "施工队编号")
private String teamCode;
/** 创建人 */
@Excel(name = "创建人")
private String createdBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdAt;
/** 修改人 */
@Excel(name = "修改人")
private String updatedBy;
/** 修改时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt;
/** 是否删除0正常 1删除 */
@Excel(name = "是否删除", readConverterExp = "0=正常,1=删除")
private String isDelete;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTeamName(String teamName)
{
this.teamName = teamName;
}
public String getTeamName()
{
return teamName;
}
public void setTeamCode(String teamCode)
{
this.teamCode = teamCode;
}
public String getTeamCode()
{
return teamCode;
}
public void setCreatedBy(String createdBy)
{
this.createdBy = createdBy;
}
public String getCreatedBy()
{
return createdBy;
}
public void setCreatedAt(Date createdAt)
{
this.createdAt = createdAt;
}
public Date getCreatedAt()
{
return createdAt;
}
public void setUpdatedBy(String updatedBy)
{
this.updatedBy = updatedBy;
}
public String getUpdatedBy()
{
return updatedBy;
}
public void setUpdatedAt(Date updatedAt)
{
this.updatedAt = updatedAt;
}
public Date getUpdatedAt()
{
return updatedAt;
}
public void setIsDelete(String isDelete)
{
this.isDelete = isDelete;
}
public String getIsDelete()
{
return isDelete;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("teamName", getTeamName())
.append("teamCode", getTeamCode())
.append("createdBy", getCreatedBy())
.append("createdAt", getCreatedAt())
.append("updatedBy", getUpdatedBy())
.append("updatedAt", getUpdatedAt())
.append("isDelete", getIsDelete())
.toString();
}
}

View File

@@ -0,0 +1,146 @@
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;
/**
* 出库类型对象 stock_out_type
*
* @author zg
* @date 2025-06-09
*/
public class StockOutType extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 出库类型名称 */
@Excel(name = "出库类型名称")
private String ckTypeName;
/** 出库类型编号 */
@Excel(name = "出库类型编号")
private String ckTypeCode;
/** 创建人 */
@Excel(name = "创建人")
private String createdBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdAt;
/** 修改人 */
@Excel(name = "修改人")
private String updatedBy;
/** 修改时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date updatedAt;
/** 是否删除0正常 1删除 */
@Excel(name = "是否删除", readConverterExp = "0=正常,1=删除")
private String isDelete;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCkTypeName(String ckTypeName)
{
this.ckTypeName = ckTypeName;
}
public String getCkTypeName()
{
return ckTypeName;
}
public void setCkTypeCode(String ckTypeCode)
{
this.ckTypeCode = ckTypeCode;
}
public String getCkTypeCode()
{
return ckTypeCode;
}
public void setCreatedBy(String createdBy)
{
this.createdBy = createdBy;
}
public String getCreatedBy()
{
return createdBy;
}
public void setCreatedAt(Date createdAt)
{
this.createdAt = createdAt;
}
public Date getCreatedAt()
{
return createdAt;
}
public void setUpdatedBy(String updatedBy)
{
this.updatedBy = updatedBy;
}
public String getUpdatedBy()
{
return updatedBy;
}
public void setUpdatedAt(Date updatedAt)
{
this.updatedAt = updatedAt;
}
public Date getUpdatedAt()
{
return updatedAt;
}
public void setIsDelete(String isDelete)
{
this.isDelete = isDelete;
}
public String getIsDelete()
{
return isDelete;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("ckTypeName", getCkTypeName())
.append("ckTypeCode", getCkTypeCode())
.append("createdBy", getCreatedBy())
.append("createdAt", getCreatedAt())
.append("updatedBy", getUpdatedBy())
.append("updatedAt", getUpdatedAt())
.append("isDelete", getIsDelete())
.toString();
}
}

View File

@@ -0,0 +1,61 @@
package com.zg.project.information.mapper;
import java.util.List;
import com.zg.project.information.domain.ConstructionTeam;
/**
* 施工队信息Mapper接口
*
* @author zg
* @date 2025-06-09
*/
public interface ConstructionTeamMapper
{
/**
* 查询施工队信息
*
* @param id 施工队信息主键
* @return 施工队信息
*/
public ConstructionTeam selectConstructionTeamById(Long id);
/**
* 查询施工队信息列表
*
* @param constructionTeam 施工队信息
* @return 施工队信息集合
*/
public List<ConstructionTeam> selectConstructionTeamList(ConstructionTeam constructionTeam);
/**
* 新增施工队信息
*
* @param constructionTeam 施工队信息
* @return 结果
*/
public int insertConstructionTeam(ConstructionTeam constructionTeam);
/**
* 修改施工队信息
*
* @param constructionTeam 施工队信息
* @return 结果
*/
public int updateConstructionTeam(ConstructionTeam constructionTeam);
/**
* 删除施工队信息
*
* @param id 施工队信息主键
* @return 结果
*/
public int deleteConstructionTeamById(Long id);
/**
* 批量删除施工队信息
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteConstructionTeamByIds(Long[] ids);
}

View File

@@ -0,0 +1,61 @@
package com.zg.project.information.mapper;
import java.util.List;
import com.zg.project.information.domain.StockOutType;
/**
* 出库类型Mapper接口
*
* @author zg
* @date 2025-06-09
*/
public interface StockOutTypeMapper
{
/**
* 查询出库类型
*
* @param id 出库类型主键
* @return 出库类型
*/
public StockOutType selectStockOutTypeById(Long id);
/**
* 查询出库类型列表
*
* @param stockOutType 出库类型
* @return 出库类型集合
*/
public List<StockOutType> selectStockOutTypeList(StockOutType stockOutType);
/**
* 新增出库类型
*
* @param stockOutType 出库类型
* @return 结果
*/
public int insertStockOutType(StockOutType stockOutType);
/**
* 修改出库类型
*
* @param stockOutType 出库类型
* @return 结果
*/
public int updateStockOutType(StockOutType stockOutType);
/**
* 删除出库类型
*
* @param id 出库类型主键
* @return 结果
*/
public int deleteStockOutTypeById(Long id);
/**
* 批量删除出库类型
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteStockOutTypeByIds(Long[] ids);
}

View File

@@ -0,0 +1,61 @@
package com.zg.project.information.service;
import java.util.List;
import com.zg.project.information.domain.ConstructionTeam;
/**
* 施工队信息Service接口
*
* @author zg
* @date 2025-06-09
*/
public interface IConstructionTeamService
{
/**
* 查询施工队信息
*
* @param id 施工队信息主键
* @return 施工队信息
*/
public ConstructionTeam selectConstructionTeamById(Long id);
/**
* 查询施工队信息列表
*
* @param constructionTeam 施工队信息
* @return 施工队信息集合
*/
public List<ConstructionTeam> selectConstructionTeamList(ConstructionTeam constructionTeam);
/**
* 新增施工队信息
*
* @param constructionTeam 施工队信息
* @return 结果
*/
public int insertConstructionTeam(ConstructionTeam constructionTeam);
/**
* 修改施工队信息
*
* @param constructionTeam 施工队信息
* @return 结果
*/
public int updateConstructionTeam(ConstructionTeam constructionTeam);
/**
* 批量删除施工队信息
*
* @param ids 需要删除的施工队信息主键集合
* @return 结果
*/
public int deleteConstructionTeamByIds(Long[] ids);
/**
* 删除施工队信息信息
*
* @param id 施工队信息主键
* @return 结果
*/
public int deleteConstructionTeamById(Long id);
}

View File

@@ -0,0 +1,61 @@
package com.zg.project.information.service;
import java.util.List;
import com.zg.project.information.domain.StockOutType;
/**
* 出库类型Service接口
*
* @author zg
* @date 2025-06-09
*/
public interface IStockOutTypeService
{
/**
* 查询出库类型
*
* @param id 出库类型主键
* @return 出库类型
*/
public StockOutType selectStockOutTypeById(Long id);
/**
* 查询出库类型列表
*
* @param stockOutType 出库类型
* @return 出库类型集合
*/
public List<StockOutType> selectStockOutTypeList(StockOutType stockOutType);
/**
* 新增出库类型
*
* @param stockOutType 出库类型
* @return 结果
*/
public int insertStockOutType(StockOutType stockOutType);
/**
* 修改出库类型
*
* @param stockOutType 出库类型
* @return 结果
*/
public int updateStockOutType(StockOutType stockOutType);
/**
* 批量删除出库类型
*
* @param ids 需要删除的出库类型主键集合
* @return 结果
*/
public int deleteStockOutTypeByIds(Long[] ids);
/**
* 删除出库类型信息
*
* @param id 出库类型主键
* @return 结果
*/
public int deleteStockOutTypeById(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.ConstructionTeamMapper;
import com.zg.project.information.domain.ConstructionTeam;
import com.zg.project.information.service.IConstructionTeamService;
/**
* 施工队信息Service业务层处理
*
* @author zg
* @date 2025-06-09
*/
@Service
public class ConstructionTeamServiceImpl implements IConstructionTeamService
{
@Autowired
private ConstructionTeamMapper constructionTeamMapper;
/**
* 查询施工队信息
*
* @param id 施工队信息主键
* @return 施工队信息
*/
@Override
public ConstructionTeam selectConstructionTeamById(Long id)
{
return constructionTeamMapper.selectConstructionTeamById(id);
}
/**
* 查询施工队信息列表
*
* @param constructionTeam 施工队信息
* @return 施工队信息
*/
@Override
public List<ConstructionTeam> selectConstructionTeamList(ConstructionTeam constructionTeam)
{
return constructionTeamMapper.selectConstructionTeamList(constructionTeam);
}
/**
* 新增施工队信息
*
* @param constructionTeam 施工队信息
* @return 结果
*/
@Override
public int insertConstructionTeam(ConstructionTeam constructionTeam)
{
return constructionTeamMapper.insertConstructionTeam(constructionTeam);
}
/**
* 修改施工队信息
*
* @param constructionTeam 施工队信息
* @return 结果
*/
@Override
public int updateConstructionTeam(ConstructionTeam constructionTeam)
{
return constructionTeamMapper.updateConstructionTeam(constructionTeam);
}
/**
* 批量删除施工队信息
*
* @param ids 需要删除的施工队信息主键
* @return 结果
*/
@Override
public int deleteConstructionTeamByIds(Long[] ids)
{
return constructionTeamMapper.deleteConstructionTeamByIds(ids);
}
/**
* 删除施工队信息信息
*
* @param id 施工队信息主键
* @return 结果
*/
@Override
public int deleteConstructionTeamById(Long id)
{
return constructionTeamMapper.deleteConstructionTeamById(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.StockOutTypeMapper;
import com.zg.project.information.domain.StockOutType;
import com.zg.project.information.service.IStockOutTypeService;
/**
* 出库类型Service业务层处理
*
* @author zg
* @date 2025-06-09
*/
@Service
public class StockOutTypeServiceImpl implements IStockOutTypeService
{
@Autowired
private StockOutTypeMapper stockOutTypeMapper;
/**
* 查询出库类型
*
* @param id 出库类型主键
* @return 出库类型
*/
@Override
public StockOutType selectStockOutTypeById(Long id)
{
return stockOutTypeMapper.selectStockOutTypeById(id);
}
/**
* 查询出库类型列表
*
* @param stockOutType 出库类型
* @return 出库类型
*/
@Override
public List<StockOutType> selectStockOutTypeList(StockOutType stockOutType)
{
return stockOutTypeMapper.selectStockOutTypeList(stockOutType);
}
/**
* 新增出库类型
*
* @param stockOutType 出库类型
* @return 结果
*/
@Override
public int insertStockOutType(StockOutType stockOutType)
{
return stockOutTypeMapper.insertStockOutType(stockOutType);
}
/**
* 修改出库类型
*
* @param stockOutType 出库类型
* @return 结果
*/
@Override
public int updateStockOutType(StockOutType stockOutType)
{
return stockOutTypeMapper.updateStockOutType(stockOutType);
}
/**
* 批量删除出库类型
*
* @param ids 需要删除的出库类型主键
* @return 结果
*/
@Override
public int deleteStockOutTypeByIds(Long[] ids)
{
return stockOutTypeMapper.deleteStockOutTypeByIds(ids);
}
/**
* 删除出库类型信息
*
* @param id 出库类型主键
* @return 结果
*/
@Override
public int deleteStockOutTypeById(Long id)
{
return stockOutTypeMapper.deleteStockOutTypeById(id);
}
}

View File

@@ -0,0 +1,88 @@
package com.zg.project.wisdom.controller;
import com.zg.common.utils.DateUtils;
import com.zg.common.utils.SecurityUtils;
import com.zg.framework.web.controller.BaseController;
import com.zg.framework.web.domain.AjaxResult;
import com.zg.project.wisdom.domain.RkBill;
import com.zg.framework.web.page.TableDataInfo;
import com.zg.project.wisdom.domain.RkInfo;
import com.zg.project.wisdom.service.IRkBillService;
import com.zg.project.wisdom.service.IRkInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/wisdom/bill")
public class RkBillController extends BaseController {
@Autowired
private IRkBillService rkBillService;
@Autowired
private IRkInfoService rkInfoService;
/**
* 分页查询单据主表
*/
@PreAuthorize("@ss.hasPermi('wisdom:stock:list')")
@GetMapping("/list")
public TableDataInfo list(RkBill rkBill) {
startPage();
List<RkBill> list = rkBillService.selectRkBillList(rkBill);
return getDataTable(list);
}
/**
* 根据ID获取详情
*/
@PreAuthorize("@ss.hasPermi('wisdom:stock:query')")
@GetMapping("/{id}")
public AjaxResult getInfo(@PathVariable Long id) {
return AjaxResult.success(rkBillService.selectRkBillById(id));
}
/**
* 新增单据主(如未通过入库明细新增)
*/
@PreAuthorize("@ss.hasPermi('wisdom:stock:add')")
@PostMapping
public AjaxResult add(@RequestBody RkBill rkBill) {
rkBill.setCreateBy(SecurityUtils.getUsername());
rkBill.setCreateTime(DateUtils.getNowDate());
return toAjax(rkBillService.insertRkBill(rkBill));
}
/**
* 修改单据主
*/
@PreAuthorize("@ss.hasPermi('wisdom:stock:edit')")
@PutMapping
public AjaxResult edit(@RequestBody RkBill rkBill) {
rkBill.setUpdateBy(SecurityUtils.getUsername());
rkBill.setUpdateTime(DateUtils.getNowDate());
return toAjax(rkBillService.updateRkBill(rkBill));
}
/**
* 删除单据主(逻辑删除)
*/
@PreAuthorize("@ss.hasPermi('wisdom:stock:remove')")
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(rkBillService.logicDeleteRkBillByIds(ids));
}
@PreAuthorize("@ss.hasPermi('wisdom:stock:query')")
@GetMapping("/detailList")
public TableDataInfo detailList(@RequestParam String billNo) {
RkInfo rkInfo = new RkInfo();
rkInfo.setBillNo(billNo);
startPage();
List<RkInfo> list = rkInfoService.selectRkInfoList(rkInfo);
return getDataTable(list);
}
}

View File

@@ -1,10 +1,13 @@
package com.zg.project.wisdom.controller; package com.zg.project.wisdom.controller;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.zg.project.wisdom.domain.dto.PcRkInfoBatchDTO; import com.zg.project.wisdom.domain.dto.PcRkInfoBatchDTO;
import com.zg.project.wisdom.domain.dto.RkInfoBatchDTO; import com.zg.project.wisdom.domain.dto.RkInfoBatchDTO;
import com.zg.project.wisdom.domain.dto.StockOutDTO;
import com.zg.project.wisdom.service.IGysJhService; import com.zg.project.wisdom.service.IGysJhService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -32,7 +35,7 @@ import com.zg.framework.web.page.TableDataInfo;
* @date 2025-05-28 * @date 2025-05-28
*/ */
@RestController @RestController
@RequestMapping("/pc/wisdom/stock") @RequestMapping("/wisdom/stock")
public class RkInfoController extends BaseController public class RkInfoController extends BaseController
{ {
@Autowired @Autowired
@@ -42,6 +45,7 @@ public class RkInfoController extends BaseController
* 查询库存单据主列表 * 查询库存单据主列表
*/ */
@PreAuthorize("@ss.hasPermi('wisdom:stock:list')") @PreAuthorize("@ss.hasPermi('wisdom:stock:list')")
// @GetMapping("/details/list")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(RkInfo rkInfo) public TableDataInfo list(RkInfo rkInfo)
{ {
@@ -104,4 +108,31 @@ public class RkInfoController extends BaseController
{ {
return toAjax(rkInfoService.deleteRkInfoByIds(ids)); return toAjax(rkInfoService.deleteRkInfoByIds(ids));
} }
/**
* 库龄超过20天统计
* @return
*/
@GetMapping("/warning/stock/over20")
@PreAuthorize("@ss.hasPermi('wisdom:stock:warning')")
public AjaxResult getOverdueStockTopList() {
int total = rkInfoService.countOverdueStock();
List<RkInfo> list = rkInfoService.selectTopOverdueStock(20);
Map<String, Object> result = new HashMap<>();
result.put("total", total);
result.put("list", list);
return AjaxResult.success(result);
}
/**
* 出库操作
* @param
* @return
*/
@PreAuthorize("@ss.hasPermi('wisdom:outbound:add')")
@Log(title = "库存单据主", businessType = BusinessType.UPDATE)
@PostMapping("/updateOutStock")
public AjaxResult updateOutStock(@RequestBody StockOutDTO dto) {
return toAjax(rkInfoService.updateOutStock(dto));
}
} }

View File

@@ -6,15 +6,19 @@ import com.zg.framework.aspectj.lang.enums.BusinessType;
import com.zg.framework.web.controller.BaseController; import com.zg.framework.web.controller.BaseController;
import com.zg.framework.web.domain.AjaxResult; import com.zg.framework.web.domain.AjaxResult;
import com.zg.framework.web.page.TableDataInfo; import com.zg.framework.web.page.TableDataInfo;
import com.zg.project.wisdom.domain.RkBill;
import com.zg.project.wisdom.domain.RkInfo; import com.zg.project.wisdom.domain.RkInfo;
import com.zg.project.wisdom.domain.dto.RkInfoBatchDTO; import com.zg.project.wisdom.domain.dto.RkInfoBatchDTO;
import com.zg.project.wisdom.service.IRkBillService;
import com.zg.project.wisdom.service.IRkInfoService; import com.zg.project.wisdom.service.IRkInfoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 库存单据主Controller * 库存单据主Controller
@@ -23,16 +27,33 @@ import java.util.List;
* @date 2025-05-28 * @date 2025-05-28
*/ */
@RestController @RestController
@RequestMapping("/wisdom/stock") @RequestMapping("/app/wisdom/stock")
public class AppRkInfoController extends BaseController { public class AppRkInfoController extends BaseController {
@Autowired @Autowired
private IRkInfoService rkInfoService; private IRkInfoService rkInfoService;
@Autowired
private IRkBillService rkBillService;
/**
* 查询库存单据主列表
* @param rkBill
* @return
*/
// @PreAuthorize("@ss.hasPermi('wisdom:stock:list')")
// @GetMapping("/list")
// public TableDataInfo list(RkBill rkBill) {
// startPage();
// List<RkBill> list = rkBillService.selectRkBillList(rkBill);
// return getDataTable(list);
// }
/** /**
* 查询库存单据主列表 * 查询库存单据主列表
*/ */
@PreAuthorize("@ss.hasPermi('wisdom:stock:list')") @PreAuthorize("@ss.hasPermi('wisdom:stock:list')")
// @GetMapping("/details/list")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(RkInfo rkInfo) public TableDataInfo list(RkInfo rkInfo)
{ {
@@ -41,6 +62,19 @@ public class AppRkInfoController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
/**
* 根据单据号进行撤销
* @param billNo
* @return
*/
@DeleteMapping("/deleteByBillNo/{billNo}")
@PreAuthorize("@ss.hasPermi('wisdom:stock:deleteByBillNo')")
public AjaxResult deleteByBillNo(@PathVariable String billNo) {
rkInfoService.deleteByBillNo(billNo);
return AjaxResult.success("撤销成功");
}
/** /**
* 导出库存单据主列表 * 导出库存单据主列表
*/ */
@@ -95,4 +129,7 @@ public class AppRkInfoController extends BaseController {
{ {
return toAjax(rkInfoService.deleteRkInfoByIds(ids)); return toAjax(rkInfoService.deleteRkInfoByIds(ids));
} }
} }

View File

@@ -0,0 +1,171 @@
package com.zg.project.wisdom.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zg.framework.aspectj.lang.annotation.Excel;
import com.zg.framework.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 入库单据主表对象 rk_bill
*
* @author zg
* @date 2025-06-06
*/
public class RkBill extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 入库类型 */
// @Excel(name = "入库类型")
private String rkType;
/** 物资类型 */
// @Excel(name = "物资类型")
private String wlType;
/** 所属仓库 */
// @Excel(name = "所属仓库")
private String cangku;
/** 入库类型名称 */
@Excel(name = "入库类型名称")
private String rkTypeName;
/** 物资类型名称 */
@Excel(name = "物资类型名称")
private String wlTypeName;
/** 所属仓库名称 */
@Excel(name = "所属仓库名称")
private String cangkuName;
/** 理货员名称 */
@Excel(name = "理货员名称")
private String lihuoYName;
/** 入库时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date rkTime;
/** 理货员 */
// @Excel(name = "理货员")
private String lihuoY;
/** 单据号 */
@Excel(name = "单据号")
private String billNo;
/** 是否已出库0未出库1已出库 */
@Excel(name = "是否出库", readConverterExp = "0=未出库,1=已出库")
private String isChuku;
/** 是否删除0正常1删除 */
private String isDelete;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getRkType() {
return rkType;
}
public void setRkType(String rkType) {
this.rkType = rkType;
}
public String getWlType() {
return wlType;
}
public void setWlType(String wlType) {
this.wlType = wlType;
}
public String getCangku() {
return cangku;
}
public void setCangku(String cangku) {
this.cangku = cangku;
}
public String getRkTypeName() { return rkTypeName; }
public void setRkTypeName(String rkTypeName) { this.rkTypeName = rkTypeName; }
public String getWlTypeName() { return wlTypeName; }
public void setWlTypeName(String wlTypeName) { this.wlTypeName = wlTypeName; }
public String getCangkuName() { return cangkuName; }
public void setCangkuName(String cangkuName) { this.cangkuName = cangkuName; }
public Date getRkTime() {
return rkTime;
}
public void setRkTime(Date rkTime) {
this.rkTime = rkTime;
}
public String getLihuoY() {
return lihuoY;
}
public void setLihuoY(String lihuoY) {
this.lihuoY = lihuoY;
}
public String getBillNo() {
return billNo;
}
public void setBillNo(String billNo) {
this.billNo = billNo;
}
public String getIsChuku() {
return isChuku;
}
public void setIsChuku(String isChuku) {
this.isChuku = isChuku;
}
public String getIsDelete() {
return isDelete;
}
public void setIsDelete(String isDelete) {
this.isDelete = isDelete;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("rkType", getRkType())
.append("wlType", getWlType())
.append("cangku", getCangku())
.append("rkTime", getRkTime())
.append("lihuoY", getLihuoY())
.append("billNo", getBillNo())
.append("isChuku", getIsChuku())
.append("isDelete", getIsDelete())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@@ -24,6 +24,9 @@ public class RkInfo extends BaseEntity
/** 主键ID */ /** 主键ID */
private Long id; private Long id;
/** 库龄 */
private Long stockAge;
/** 入库类型 */ /** 入库类型 */
// @Excel(name = "入库类型") // @Excel(name = "入库类型")
private String rkType; private String rkType;
@@ -49,7 +52,7 @@ public class RkInfo extends BaseEntity
private String cangkuName; private String cangkuName;
/** 入库时间(用户操作入库的日期) */ /** 入库时间(用户操作入库的日期) */
@Excel(name = "入库时间", readConverterExp = "用=户操作入库的日期") @Excel(name = "入库时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date rkTime; private Date rkTime;
/** 理货员 */ /** 理货员 */
@@ -60,6 +63,10 @@ public class RkInfo extends BaseEntity
@Excel(name = "是否已出库", readConverterExp = "0=已入库1已出库") @Excel(name = "是否已出库", readConverterExp = "0=已入库1已出库")
private String isChuku; private String isChuku;
/** 单据号 */
@Excel(name = "单据号")
private String billNo;
/** 县局 */ /** 县局 */
@Excel(name = "县局") @Excel(name = "县局")
private String xj; private String xj;
@@ -136,8 +143,29 @@ public class RkInfo extends BaseEntity
@Excel(name = "实物ID") @Excel(name = "实物ID")
private String entityId; private String entityId;
@Excel(name = "出库理货员")
private String ckLihuoY;
// @Excel(name = "出库类型编号")
private String ckType;
@Excel(name = "出库类型名称")
private String ckTypeName;
// @Excel(name = "施工队编号")
private String teamCode;
@Excel(name = "施工队名称")
private String teamName;
// 出库时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "领用时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date lyTime;
@Excel(name = "出库备注")
private String ckRemark;
/** 是否删除0 表示正常1 表示已删除) */ /** 是否删除0 表示正常1 表示已删除) */
@Excel(name = "是否删除", readConverterExp = "0=,表=示正常1,表=示已删除") // @Excel(name = "是否删除", readConverterExp = "0=,表=示正常1,表=示已删除")
private String isDelete; private String isDelete;
public String getKeyword() { public String getKeyword() {
@@ -168,6 +196,14 @@ public class RkInfo extends BaseEntity
return rkType; return rkType;
} }
public Long getStockAge() {
return stockAge;
}
public void setStockAge(Long stockAge) {
this.stockAge = stockAge;
}
public void setWlType(String wlType) public void setWlType(String wlType)
{ {
this.wlType = wlType; this.wlType = wlType;
@@ -239,6 +275,14 @@ public class RkInfo extends BaseEntity
return isChuku; return isChuku;
} }
public String getBillNo() {
return billNo;
}
public void setBillNo(String billNo) {
this.billNo = billNo;
}
public void setXj(String xj) public void setXj(String xj)
{ {
this.xj = xj; this.xj = xj;
@@ -427,6 +471,62 @@ public class RkInfo extends BaseEntity
return entityId; return entityId;
} }
public String getCkLihuoY() {
return ckLihuoY;
}
public void setCkLihuoY(String ckLihuoY) {
this.ckLihuoY = ckLihuoY;
}
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 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 getCkRemark() {
return ckRemark;
}
public void setCkRemark(String ckRemark) {
this.ckRemark = ckRemark;
}
public Date getLyTime() {
return lyTime;
}
public void setLyTime(Date lyTime) {
this.lyTime = lyTime;
}
public void setIsDelete(String isDelete) public void setIsDelete(String isDelete)
{ {
this.isDelete = isDelete; this.isDelete = isDelete;
@@ -447,6 +547,7 @@ public class RkInfo extends BaseEntity
.append("rkTime", getRkTime()) .append("rkTime", getRkTime())
.append("lihuoY", getLihuoY()) .append("lihuoY", getLihuoY())
.append("isChuku", getIsChuku()) .append("isChuku", getIsChuku())
.append("billNo", getBillNo())
.append("remark", getRemark()) .append("remark", getRemark())
.append("xj", getXj()) .append("xj", getXj())
.append("xmNo", getXmNo()) .append("xmNo", getXmNo())
@@ -471,6 +572,13 @@ public class RkInfo extends BaseEntity
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("ckLihuoY", getCkLihuoY())
.append("ckType", getCkType())
.append("ckTypeName", getCkTypeName())
.append("teamCode", getTeamCode())
.append("teamName", getTeamName())
.append("lyTime", getLyTime())
.append("ckRemark", getCkRemark())
.append("isDelete", getIsDelete()) .append("isDelete", getIsDelete())
.toString(); .toString();
} }

View File

@@ -0,0 +1,82 @@
package com.zg.project.wisdom.domain.dto;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* 出库请求 DTO用于批量出库操作
* 对应操作 rk_info 表中多个记录出库
*/
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 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 + '\'' +
'}';
}
}

View File

@@ -71,4 +71,10 @@ public interface GysJhMapper
* @param gysJhId * @param gysJhId
*/ */
void updateStatusById(Long gysJhId); void updateStatusById(Long gysJhId);
/**
* 重置状态
* @param sapNos
*/
void resetGysJhStatusBySapNos(List<String> sapNos);
} }

View File

@@ -0,0 +1,36 @@
package com.zg.project.wisdom.mapper;
import com.zg.project.wisdom.domain.RkBill;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface RkBillMapper {
/**
* 新增入库单据主表
*/
int insertRkBill(RkBill bill);
/**
* 查询入库单据主表列表(可选)
*/
List<RkBill> selectRkBillList(RkBill bill);
/**
* 根据单据号查询
*/
RkBill selectRkBillByBillNo(String billNo);
RkBill selectRkBillById(Long id);
int updateRkBill(RkBill rkBill);
int logicDeleteRkBillByIds(@Param("ids") Long[] ids);
/**
* 批量更新出库状态
* @param ids
*/
void updateOutStock(List<Long> ids);
}

View File

@@ -73,4 +73,37 @@ public interface RkInfoMapper
*/ */
List<String> selectUsedPcodes(); List<String> selectUsedPcodes();
/**
* 根据单据编号查询SAP单号
* @param billNo
* @return
*/
List<String> selectSapNoByBillNo(String billNo);
/**
* 根据单据编号删除入库单据
* @param billNo
*/
void deleteByBillNo(String billNo);
/**
* 统计超期库存
* @return
*/
int countOverdueStock();
/**
* 获取最新20条逾期库存列表
* @param
* @return
*/
List<RkInfo> selectTopOverdueStock(@Param("limit") int limit);
/**
* 批量更新出库信息
* @param list
* @return
*/
int batchUpdateOutStock(List<RkInfo> list);
} }

View File

@@ -0,0 +1,13 @@
package com.zg.project.wisdom.service;
import com.zg.project.wisdom.domain.RkBill;
import java.util.List;
public interface IRkBillService {
List<RkBill> selectRkBillList(RkBill rkBill);
RkBill selectRkBillById(Long id);
int insertRkBill(RkBill rkBill);
int updateRkBill(RkBill rkBill);
int logicDeleteRkBillByIds(Long[] ids);
}

View File

@@ -1,9 +1,12 @@
package com.zg.project.wisdom.service; package com.zg.project.wisdom.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.zg.project.wisdom.domain.RkInfo; import com.zg.project.wisdom.domain.RkInfo;
import com.zg.project.wisdom.domain.dto.PcRkInfoBatchDTO; import com.zg.project.wisdom.domain.dto.PcRkInfoBatchDTO;
import com.zg.project.wisdom.domain.dto.RkInfoBatchDTO; import com.zg.project.wisdom.domain.dto.RkInfoBatchDTO;
import com.zg.project.wisdom.domain.dto.StockOutDTO;
/** /**
* 库存单据主Service接口 * 库存单据主Service接口
@@ -67,4 +70,30 @@ public interface IRkInfoService
* @return * @return
*/ */
int batchInsertApp(RkInfoBatchDTO dto); int batchInsertApp(RkInfoBatchDTO dto);
/**
* 根据单据编号删除入库单据
* @param billNo
*/
void deleteByBillNo(String billNo);
/**
* 统计逾期库存数量
* @return
*/
int countOverdueStock();
/**
* 获取最新20条逾期库存列表
* @param i
* @return
*/
List<RkInfo> selectTopOverdueStock(int i);
/**
* 出库操作
* @param dto
* @return
*/
int updateOutStock(StockOutDTO dto);
} }

View File

@@ -0,0 +1,41 @@
package com.zg.project.wisdom.service.impl;
import com.zg.project.wisdom.domain.RkBill;
import com.zg.project.wisdom.mapper.RkBillMapper;
import com.zg.project.wisdom.service.IRkBillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class RkBillServiceImpl implements IRkBillService {
@Autowired
private RkBillMapper rkBillMapper;
@Override
public List<RkBill> selectRkBillList(RkBill rkBill) {
return rkBillMapper.selectRkBillList(rkBill);
}
@Override
public RkBill selectRkBillById(Long id) {
return rkBillMapper.selectRkBillById(id);
}
@Override
public int insertRkBill(RkBill rkBill) {
return rkBillMapper.insertRkBill(rkBill);
}
@Override
public int updateRkBill(RkBill rkBill) {
return rkBillMapper.updateRkBill(rkBill);
}
@Override
public int logicDeleteRkBillByIds(Long[] ids) {
return rkBillMapper.logicDeleteRkBillByIds(ids);
}
}

View File

@@ -1,5 +1,8 @@
package com.zg.project.wisdom.service.impl; 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.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -7,18 +10,18 @@ import java.util.List;
import com.zg.common.exception.ServiceException; import com.zg.common.exception.ServiceException;
import com.zg.common.utils.DateUtils; import com.zg.common.utils.DateUtils;
import com.zg.common.utils.SecurityUtils; import com.zg.common.utils.SecurityUtils;
import com.zg.project.wisdom.domain.GysJh; import com.zg.project.wisdom.domain.RkBill;
import com.zg.project.wisdom.domain.dto.*; import com.zg.project.wisdom.domain.dto.*;
import com.zg.project.wisdom.mapper.GysJhMapper; import com.zg.project.wisdom.mapper.GysJhMapper;
import com.zg.project.wisdom.service.IGysJhService; import com.zg.project.wisdom.mapper.RkBillMapper;
import com.zg.project.wisdom.util.CodeConvertUtil; import com.zg.project.wisdom.utils.BillNoUtil;
import com.zg.project.wisdom.utils.CodeConvertUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zg.project.wisdom.mapper.RkInfoMapper; import com.zg.project.wisdom.mapper.RkInfoMapper;
import com.zg.project.wisdom.domain.RkInfo; import com.zg.project.wisdom.domain.RkInfo;
import com.zg.project.wisdom.service.IRkInfoService; import com.zg.project.wisdom.service.IRkInfoService;
import org.springframework.transaction.annotation.Transactional;
import static com.zg.common.utils.SecurityUtils.getUsername;
/** /**
* 库存单据主Service业务层处理 * 库存单据主Service业务层处理
@@ -36,6 +39,9 @@ public class RkInfoServiceImpl implements IRkInfoService
@Autowired @Autowired
private GysJhMapper gysJhMapper; private GysJhMapper gysJhMapper;
@Autowired
private RkBillMapper rkBillMapper;
/** /**
* 查询库存单据主 * 查询库存单据主
* *
@@ -55,9 +61,21 @@ public class RkInfoServiceImpl implements IRkInfoService
* @return 库存单据主 * @return 库存单据主
*/ */
@Override @Override
public List<RkInfo> selectRkInfoList(RkInfo rkInfo) public List<RkInfo> selectRkInfoList(RkInfo rkInfo) {
{ List<RkInfo> list = rkInfoMapper.selectRkInfoList(rkInfo);
return rkInfoMapper.selectRkInfoList(rkInfo); LocalDate today = LocalDate.now();
for (RkInfo info : list) {
if (info.getRkTime() != null) {
LocalDate rkDate = info.getRkTime().toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDate();
long days = ChronoUnit.DAYS.between(rkDate, today);
info.setStockAge(days);
}
}
return list;
} }
@@ -113,16 +131,34 @@ public class RkInfoServiceImpl implements IRkInfoService
throw new ServiceException("rkList 入库明细列表不能为空"); 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);
// ✅ 构建明细列表
for (PcRkInfoItemDTO item : dto.getRkList()) { for (PcRkInfoItemDTO item : dto.getRkList()) {
RkInfo entity = new RkInfo(); RkInfo entity = new RkInfo();
// 顶层字段
entity.setRkType(dto.getRkType()); entity.setRkType(dto.getRkType());
entity.setWlType(dto.getWlType()); entity.setWlType(dto.getWlType());
entity.setCangku(dto.getCangku()); entity.setCangku(dto.getCangku());
entity.setLihuoY(dto.getLihuoY()); entity.setLihuoY(dto.getLihuoY());
// 明细字段item entity.setBillNo(billNo);
entity.setXj(item.getXj()); entity.setXj(item.getXj());
entity.setXmNo(item.getXmNo()); entity.setXmNo(item.getXmNo());
entity.setXmMs(item.getXmMs()); entity.setXmMs(item.getXmMs());
@@ -137,7 +173,6 @@ public class RkInfoServiceImpl implements IRkInfoService
entity.setGysNo(item.getGysNo()); entity.setGysNo(item.getGysNo());
entity.setGysMc(item.getGysMc()); entity.setGysMc(item.getGysMc());
// 库存字段
entity.setRealQty(item.getRealQty()); entity.setRealQty(item.getRealQty());
entity.setPcode(item.getPcode()); entity.setPcode(item.getPcode());
if (item.getPcode() != null) { if (item.getPcode() != null) {
@@ -156,7 +191,6 @@ public class RkInfoServiceImpl implements IRkInfoService
saveList.add(entity); saveList.add(entity);
// 更新供应计划状态
if (item.getGysJhId() != null) { if (item.getGysJhId() != null) {
gysJhMapper.updateStatusById(item.getGysJhId()); gysJhMapper.updateStatusById(item.getGysJhId());
} }
@@ -169,6 +203,7 @@ public class RkInfoServiceImpl implements IRkInfoService
return rkInfoMapper.batchInsertRkInfo(saveList); return rkInfoMapper.batchInsertRkInfo(saveList);
} }
/** /**
* 新增入库单据APP * 新增入库单据APP
* @param dto * @param dto
@@ -184,6 +219,23 @@ public class RkInfoServiceImpl implements IRkInfoService
throw new ServiceException("rkList 入库明细列表不能为空"); 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);
for (RkInfoItemDTO item : dto.getRkList()) { for (RkInfoItemDTO item : dto.getRkList()) {
List<RkInfoScanDTO> scanList = item.getScanList(); List<RkInfoScanDTO> scanList = item.getScanList();
if (scanList == null || scanList.isEmpty()) { if (scanList == null || scanList.isEmpty()) {
@@ -200,6 +252,8 @@ public class RkInfoServiceImpl implements IRkInfoService
entity.setCangku(dto.getCangku()); entity.setCangku(dto.getCangku());
entity.setLihuoY(dto.getLihuoY()); entity.setLihuoY(dto.getLihuoY());
entity.setBillNo(billNo);
// 明细字段RkInfoItemDTO // 明细字段RkInfoItemDTO
entity.setXj(item.getXj()); entity.setXj(item.getXj());
entity.setXmMs(item.getXmMs()); entity.setXmMs(item.getXmMs());
@@ -249,4 +303,65 @@ public class RkInfoServiceImpl implements IRkInfoService
return rkInfoMapper.batchInsertRkInfo(saveList); return rkInfoMapper.batchInsertRkInfo(saveList);
} }
@Transactional
public void deleteByBillNo(String billNo) {
// 1. 查询 sap_no
List<String> sapNos = rkInfoMapper.selectSapNoByBillNo(billNo);
// 2. 更新供应计划状态
if (sapNos != null && !sapNos.isEmpty()) {
gysJhMapper.resetGysJhStatusBySapNos(sapNos);
}
// 3. 删除入库记录
rkInfoMapper.deleteByBillNo(billNo);
}
/**
* 统计过期库存
* @return
*/
@Override
public int countOverdueStock() {
return rkInfoMapper.countOverdueStock();
}
/**
* 获取最新20条逾期库存列表
* @param i
* @return
*/
@Override
public List<RkInfo> selectTopOverdueStock(int i) {
return rkInfoMapper.selectTopOverdueStock(i);
}
@Override
public int updateOutStock(StockOutDTO dto) {
if (dto == null || dto.getIds() == null || dto.getIds().isEmpty()) {
throw new ServiceException("出库记录ID列表不能为空");
}
Date now = dto.getLyTime() != null ? dto.getLyTime() : DateUtils.getNowDate();
String username = SecurityUtils.getUsername();
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);
}
rkBillMapper.updateOutStock(dto.getIds());
return rkInfoMapper.batchUpdateOutStock(list);
}
} }

View File

@@ -0,0 +1,13 @@
package com.zg.project.wisdom.utils;
import java.text.SimpleDateFormat;
import java.util.Date;
public class BillNoUtil {
public static String generateTodayBillNo() {
String prefix = "RK";
String time = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
return prefix + time;
}
}

View File

@@ -1,4 +1,4 @@
package com.zg.project.wisdom.util; package com.zg.project.wisdom.utils;
/** /**
* 编码转换工具类 - 处理如库位码转十六进制字符串等逻辑 * 编码转换工具类 - 处理如库位码转十六进制字符串等逻辑

View File

@@ -6,8 +6,8 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: master:
# url: jdbc:mysql://192.168.1.20:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://192.168.1.20:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://localhost:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # url: jdbc:mysql://localhost:3306/wisdom?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: shzg password: shzg
# 从库数据源 # 从库数据源

View File

@@ -0,0 +1,86 @@
<?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.ConstructionTeamMapper">
<resultMap type="ConstructionTeam" id="ConstructionTeamResult">
<result property="id" column="id" />
<result property="teamName" column="team_name" />
<result property="teamCode" column="team_code" />
<result property="createdBy" column="created_by" />
<result property="createdAt" column="created_at" />
<result property="updatedBy" column="updated_by" />
<result property="updatedAt" column="updated_at" />
<result property="isDelete" column="is_delete" />
</resultMap>
<sql id="selectConstructionTeamVo">
select id, team_name, team_code, created_by, created_at, updated_by, updated_at, is_delete from construction_team
</sql>
<select id="selectConstructionTeamList" parameterType="ConstructionTeam" resultMap="ConstructionTeamResult">
<include refid="selectConstructionTeamVo"/>
<where>
<if test="teamName != null and teamName != ''"> and team_name like concat('%', #{teamName}, '%')</if>
<if test="teamCode != null and teamCode != ''"> and team_code = #{teamCode}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
<if test="isDelete != null and isDelete != ''"> and is_delete = #{isDelete}</if>
</where>
</select>
<select id="selectConstructionTeamById" parameterType="Long" resultMap="ConstructionTeamResult">
<include refid="selectConstructionTeamVo"/>
where id = #{id}
</select>
<insert id="insertConstructionTeam" parameterType="ConstructionTeam" useGeneratedKeys="true" keyProperty="id">
insert into construction_team
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="teamName != null and teamName != ''">team_name,</if>
<if test="teamCode != null and teamCode != ''">team_code,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedAt != null">updated_at,</if>
<if test="isDelete != null">is_delete,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="teamName != null and teamName != ''">#{teamName},</if>
<if test="teamCode != null and teamCode != ''">#{teamCode},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedAt != null">#{updatedAt},</if>
<if test="isDelete != null">#{isDelete},</if>
</trim>
</insert>
<update id="updateConstructionTeam" parameterType="ConstructionTeam">
update construction_team
<trim prefix="SET" suffixOverrides=",">
<if test="teamName != null and teamName != ''">team_name = #{teamName},</if>
<if test="teamCode != null and teamCode != ''">team_code = #{teamCode},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteConstructionTeamById" parameterType="Long">
delete from construction_team where id = #{id}
</delete>
<delete id="deleteConstructionTeamByIds" parameterType="String">
delete from construction_team where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,86 @@
<?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.StockOutTypeMapper">
<resultMap type="StockOutType" id="StockOutTypeResult">
<result property="id" column="id" />
<result property="ckTypeName" column="ck_type_name" />
<result property="ckTypeCode" column="ck_type_code" />
<result property="createdBy" column="created_by" />
<result property="createdAt" column="created_at" />
<result property="updatedBy" column="updated_by" />
<result property="updatedAt" column="updated_at" />
<result property="isDelete" column="is_delete" />
</resultMap>
<sql id="selectStockOutTypeVo">
select id, ck_type_name, ck_type_code, created_by, created_at, updated_by, updated_at, is_delete from stock_out_type
</sql>
<select id="selectStockOutTypeList" parameterType="StockOutType" resultMap="StockOutTypeResult">
<include refid="selectStockOutTypeVo"/>
<where>
<if test="ckTypeName != null and ckTypeName != ''"> and ck_type_name like concat('%', #{ckTypeName}, '%')</if>
<if test="ckTypeCode != null and ckTypeCode != ''"> and ck_type_code = #{ckTypeCode}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
<if test="isDelete != null and isDelete != ''"> and is_delete = #{isDelete}</if>
</where>
</select>
<select id="selectStockOutTypeById" parameterType="Long" resultMap="StockOutTypeResult">
<include refid="selectStockOutTypeVo"/>
where id = #{id}
</select>
<insert id="insertStockOutType" parameterType="StockOutType" useGeneratedKeys="true" keyProperty="id">
insert into stock_out_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ckTypeName != null and ckTypeName != ''">ck_type_name,</if>
<if test="ckTypeCode != null and ckTypeCode != ''">ck_type_code,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdAt != null">created_at,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedAt != null">updated_at,</if>
<if test="isDelete != null">is_delete,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ckTypeName != null and ckTypeName != ''">#{ckTypeName},</if>
<if test="ckTypeCode != null and ckTypeCode != ''">#{ckTypeCode},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdAt != null">#{createdAt},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedAt != null">#{updatedAt},</if>
<if test="isDelete != null">#{isDelete},</if>
</trim>
</insert>
<update id="updateStockOutType" parameterType="StockOutType">
update stock_out_type
<trim prefix="SET" suffixOverrides=",">
<if test="ckTypeName != null and ckTypeName != ''">ck_type_name = #{ckTypeName},</if>
<if test="ckTypeCode != null and ckTypeCode != ''">ck_type_code = #{ckTypeCode},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteStockOutTypeById" parameterType="Long">
delete from stock_out_type where id = #{id}
</delete>
<delete id="deleteStockOutTypeByIds" parameterType="String">
delete from stock_out_type where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -144,6 +144,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</update> </update>
<update id="resetGysJhStatusBySapNos">
UPDATE gys_jh
SET status = 0
WHERE sap_no IN
<foreach collection="sapNos" item="sapNo" open="(" separator="," close=")">
#{sapNo}
</foreach>
</update>
<delete id="deleteGysJhById" parameterType="Long"> <delete id="deleteGysJhById" parameterType="Long">
delete from gys_jh where id = #{id} delete from gys_jh where id = #{id}
</delete> </delete>

View File

@@ -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="com.zg.project.wisdom.mapper.RkBillMapper">
<!-- 新增单据主表 -->
<insert id="insertRkBill" parameterType="com.zg.project.wisdom.domain.RkBill">
INSERT INTO rk_bill (
rk_type, wl_type, cangku, rk_time, lihuo_y,
bill_no, is_chuku, is_delete,
created_by, created_at
) VALUES (
#{rkType}, #{wlType}, #{cangku}, #{rkTime}, #{lihuoY},
#{billNo}, #{isChuku}, #{isDelete},
#{createBy}, #{createTime}
)
</insert>
<!-- 查询列表(可用于分页或展示) -->
<select id="selectRkBillList"
parameterType="com.zg.project.wisdom.domain.RkBill"
resultType="com.zg.project.wisdom.domain.RkBill">
SELECT
rb.id,
rb.rk_type AS rkType,
st.type_name AS rkTypeName,
rb.wl_type AS wlType,
mt.type_name AS wlTypeName,
rb.cangku AS cangku,
wh.warehouse_name AS cangkuName,
rb.lihuo_y AS lihuoY,
rb.rk_time AS rkTime,
rb.bill_no AS billNo,
rb.is_chuku AS isChuku,
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
WHERE rb.is_delete = '0'
<if test="billNo != null and billNo != ''">
AND rb.bill_no LIKE CONCAT('%', #{billNo}, '%')
</if>
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}
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>
<!-- 修改 -->
<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}
WHERE id = #{id}
</update>
<!-- 批量逻辑删除 -->
<update id="logicDeleteRkBillByIds">
UPDATE rk_bill
SET is_delete = '1'
WHERE id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</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

@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="rkTime" column="rk_time" /> <result property="rkTime" column="rk_time" />
<result property="lihuoY" column="lihuo_y" /> <result property="lihuoY" column="lihuo_y" />
<result property="isChuku" column="is_chuku" /> <result property="isChuku" column="is_chuku" />
<result property="billNo" column="bill_no"/>
<result property="rkTypeName" column="rk_type_name"/> <result property="rkTypeName" column="rk_type_name"/>
<result property="wlTypeName" column="wl_type_name"/> <result property="wlTypeName" column="wl_type_name"/>
<result property="cangkuName" column="cangku_name"/> <result property="cangkuName" column="cangku_name"/>
@@ -32,8 +33,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="dw" column="dw" /> <result property="dw" column="dw" />
<result property="realQty" column="real_qty" /> <result property="realQty" column="real_qty" />
<result property="pcode" column="pcode" /> <result property="pcode" column="pcode" />
<result property="pcodeId" column="pcode_id"/>
<result property="trayCode" column="tray_code" /> <result property="trayCode" column="tray_code" />
<result property="entityId" column="entity_id" /> <result property="entityId" column="entity_id" />
<result property="ckLihuoY" column="ck_lihuo_y"/>
<result property="ckType" column="ck_type"/>
<result property="ckTypeName" column="ck_type_name"/>
<result property="teamCode" column="team_code"/>
<result property="teamName" column="team_name"/>
<result property="lyTime" column="ly_time"/>
<result property="ckRemark" column="ck_remark"/>
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
@@ -44,23 +53,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectRkInfoVo"> <sql id="selectRkInfoVo">
SELECT SELECT
ri.id, ri.id,
ri.bill_no,
ri.rk_type, st.type_name AS rk_type_name, ri.rk_type, st.type_name AS rk_type_name,
ri.wl_type, mt.type_name AS wl_type_name, ri.wl_type, mt.type_name AS wl_type_name,
ri.cangku, wh.warehouse_name AS cangku_name, ri.cangku, wh.warehouse_name AS cangku_name,
ri.rk_time, ri.lihuo_y, ri.is_chuku, ri.remark, ri.rk_time, ri.lihuo_y, ri.is_chuku, ri.remark,
ri.ck_lihuo_y, ri.ck_type, sot.ck_type_name,
ri.team_code, ct.team_name,
ri.ck_remark,
ri.ly_time,
ri.xj, ri.xm_no, ri.xm_ms, ri.wl_no, ri.wl_ms, ri.xj, ri.xm_no, ri.xm_ms, ri.wl_no, ri.wl_ms,
ri.gys_no, ri.gys_mc, ri.jh_amt, ri.ht_dj, ri.sap_no, ri.xh, ri.gys_no, ri.gys_mc, ri.jh_amt, ri.ht_dj, ri.sap_no, ri.xh,
ri.jh_qty, ri.ht_qty, ri.dw, ri.real_qty, ri.jh_qty, ri.ht_qty, ri.dw, ri.real_qty,
ri.pcode, ri.tray_code, ri.entity_id, ri.pcode, ri.pcode_id, ri.tray_code, ri.entity_id,
ri.create_by, ri.create_time, ri.update_by, ri.update_time, ri.is_delete ri.create_by, ri.create_time, ri.update_by, ri.update_time, ri.is_delete
FROM rk_info ri FROM rk_info ri
LEFT JOIN stock_in_type st ON ri.rk_type = st.type_code LEFT JOIN stock_in_type st ON ri.rk_type = st.type_code
LEFT JOIN material_type mt ON ri.wl_type = mt.type_code LEFT JOIN material_type mt ON ri.wl_type = mt.type_code
LEFT JOIN warehouse_info wh ON ri.cangku = wh.warehouse_code LEFT JOIN warehouse_info wh ON ri.cangku = wh.warehouse_code
LEFT JOIN stock_out_type sot ON ri.ck_type = sot.ck_type_code
LEFT JOIN construction_team ct ON ri.team_code = ct.team_code
</sql> </sql>
<insert id="batchInsertRkInfo" parameterType="java.util.List"> <insert id="batchInsertRkInfo" parameterType="java.util.List">
insert into rk_info ( insert into rk_info (
bill_no,
rk_type, wl_type, cangku, lihuo_y, rk_time, rk_type, wl_type, cangku, lihuo_y, rk_time,
wl_no, wl_ms, xm_no, xm_ms, xj, sap_no, gys_no, gys_mc, wl_no, wl_ms, xm_no, xm_ms, xj, sap_no, gys_no, gys_mc,
jh_qty, ht_qty, jh_amt, ht_dj, dw, jh_qty, ht_qty, jh_amt, ht_dj, dw,
@@ -70,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
( (
#{item.billNo},
#{item.rkType}, #{item.wlType}, #{item.cangku}, #{item.lihuoY}, #{item.rkTime}, #{item.rkType}, #{item.wlType}, #{item.cangku}, #{item.lihuoY}, #{item.rkTime},
#{item.wlNo}, #{item.wlMs}, #{item.xmNo}, #{item.xmMs}, #{item.xj}, #{item.sapNo}, #{item.gysNo}, #{item.gysMc}, #{item.wlNo}, #{item.wlMs}, #{item.xmNo}, #{item.xmMs}, #{item.xj}, #{item.sapNo}, #{item.gysNo}, #{item.gysMc},
#{item.jhQty}, #{item.htQty}, #{item.jhAmt}, #{item.htDj}, #{item.dw}, #{item.jhQty}, #{item.htQty}, #{item.jhAmt}, #{item.htDj}, #{item.dw},
@@ -79,11 +97,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</insert> </insert>
<delete id="deleteByBillNo">
DELETE FROM rk_info WHERE bill_no = #{billNo}
</delete>
<select id="selectRkInfoList" parameterType="RkInfo" resultMap="RkInfoResult"> <select id="selectRkInfoList" parameterType="RkInfo" resultMap="RkInfoResult">
<include refid="selectRkInfoVo"/> <include refid="selectRkInfoVo"/>
<where> <where>
and is_chuku = 0 <if test="isChuku != null and isChuku != ''">
and is_chuku = #{isChuku}
</if>
<if test="keyword != null and keyword != ''"> <if test="keyword != null and keyword != ''">
and ( and (
@@ -94,6 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
or gys_no like concat('%', #{keyword}, '%') or gys_no like concat('%', #{keyword}, '%')
or gys_mc like concat('%', #{keyword}, '%') or gys_mc like concat('%', #{keyword}, '%')
or sap_no like concat('%', #{keyword}, '%') or sap_no like concat('%', #{keyword}, '%')
or bill_no like concat('%', #{keyword}, '%')
) )
</if> </if>
@@ -102,10 +127,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="cangku != null and cangku != ''"> and cangku = #{cangku}</if> <if test="cangku != null and cangku != ''"> and cangku = #{cangku}</if>
<if test="rkTime != null "> and rk_time = #{rkTime}</if> <if test="rkTime != null "> and rk_time = #{rkTime}</if>
<if test="lihuoY != null and lihuoY != ''"> and lihuo_y = #{lihuoY}</if> <if test="lihuoY != null and lihuoY != ''"> and lihuo_y = #{lihuoY}</if>
<!-- ✅ 删除这个条件,否则会与强制条件冲突 -->
<!-- <if test="isChuku != null and isChuku != ''"> and is_chuku = #{isChuku}</if> -->
<if test="xj != null and xj != ''"> and xj = #{xj}</if> <if test="xj != null and xj != ''"> and xj = #{xj}</if>
<if test="billNo != null and billNo != ''">
and bill_no = #{billNo}
</if>
<if test="xmNo != null and xmNo != ''"> and xm_no = #{xmNo}</if> <if test="xmNo != null and xmNo != ''"> and xm_no = #{xmNo}</if>
<if test="xmMs != null and xmMs != ''"> and xm_ms = #{xmMs}</if> <if test="xmMs != null and xmMs != ''"> and xm_ms = #{xmMs}</if>
<if test="wlNo != null and wlNo != ''"> and wl_no = #{wlNo}</if> <if test="wlNo != null and wlNo != ''"> and wl_no = #{wlNo}</if>
@@ -121,13 +147,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dw != null and dw != ''"> and dw = #{dw}</if> <if test="dw != null and dw != ''"> and dw = #{dw}</if>
<if test="realQty != null "> and real_qty = #{realQty}</if> <if test="realQty != null "> and real_qty = #{realQty}</if>
<if test="pcode != null and pcode != ''"> and pcode = #{pcode}</if> <if test="pcode != null and pcode != ''"> and pcode = #{pcode}</if>
<if test="lyTime != null"> and ri.ly_time = #{lyTime}</if>
<if test="trayCode != null and trayCode != ''"> and tray_code = #{trayCode}</if> <if test="trayCode != null and trayCode != ''"> and tray_code = #{trayCode}</if>
<if test="entityId != null and entityId != ''"> and entity_id = #{entityId}</if> <if test="entityId != null and entityId != ''"> and entity_id = #{entityId}</if>
<if test="isDelete != null and isDelete != ''"> <if test="isDelete != null and isDelete != ''">
and is_delete = #{isDelete} and ri.is_delete = #{isDelete}
</if> </if>
<if test="isDelete == null or isDelete == ''"> <if test="isDelete == null or isDelete == ''">
and is_delete = 0 and ri.is_delete = 0
</if> </if>
</where> </where>
</select> </select>
@@ -139,14 +166,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="countRkInfoByLocationCode" resultType="int"> <select id="countRkInfoByLocationCode" resultType="int">
SELECT COUNT(1) SELECT COUNT(1)
FROM rk_info FROM rk_info ri
WHERE pcode = #{locationCode} AND is_delete = 0 WHERE ri.pcode = #{locationCode} AND ri.is_delete = 0
</select> </select>
<select id="selectUsedPcodes" resultType="java.lang.String"> <select id="selectUsedPcodes" resultType="java.lang.String">
SELECT DISTINCT pcode SELECT DISTINCT pcode
FROM rk_info FROM rk_info ri
WHERE is_delete = '0' AND is_chuku != '1' WHERE ri.is_delete = '0' AND ri.is_chuku != '1'
</select>
<select id="selectSapNoByBillNo" resultType="java.lang.String">
SELECT DISTINCT sap_no FROM rk_info
WHERE bill_no = #{billNo} AND sap_no IS NOT NULL
</select>
<select id="countOverdueStock" resultType="int">
SELECT COUNT(*) FROM rk_info
WHERE ri.is_delete = 0 AND ri.is_chuku = 0
<![CDATA[
AND DATE(rk_time) <= DATE_SUB(CURDATE(), INTERVAL 20 DAY)
]]>
</select>
<select id="selectTopOverdueStock" resultMap="RkInfoResult">
SELECT * FROM rk_info
WHERE ri.is_delete = 0 AND ri.is_chuku = 0
<![CDATA[
AND DATE(rk_time) <= DATE_SUB(CURDATE(), INTERVAL 20 DAY)
]]>
ORDER BY rk_time DESC
LIMIT #{limit}
</select> </select>
<update id="updateRkInfo" parameterType="RkInfo"> <update id="updateRkInfo" parameterType="RkInfo">
@@ -158,6 +208,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="rkTime != null">rk_time = #{rkTime},</if> <if test="rkTime != null">rk_time = #{rkTime},</if>
<if test="lihuoY != null">lihuo_y = #{lihuoY},</if> <if test="lihuoY != null">lihuo_y = #{lihuoY},</if>
<if test="isChuku != null">is_chuku = #{isChuku},</if> <if test="isChuku != null">is_chuku = #{isChuku},</if>
<if test="billNo != null">bill_no = #{billNo},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="xj != null">xj = #{xj},</if> <if test="xj != null">xj = #{xj},</if>
<if test="xmNo != null">xm_no = #{xmNo},</if> <if test="xmNo != null">xm_no = #{xmNo},</if>
@@ -177,6 +228,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="pcode != null">pcode = #{pcode},</if> <if test="pcode != null">pcode = #{pcode},</if>
<if test="trayCode != null">tray_code = #{trayCode},</if> <if test="trayCode != null">tray_code = #{trayCode},</if>
<if test="entityId != null">entity_id = #{entityId},</if> <if test="entityId != null">entity_id = #{entityId},</if>
<if test="ckLihuoY != null">ck_lihuo_y = #{ckLihuoY},</if>
<if test="ckType != null">ck_type = #{ckType},</if>
<if test="ckTypeName != null">ck_type_name = #{ckTypeName},</if>
<if test="sgdCode != null">sgd_code = #{sgdCode},</if>
<if test="sgdName != null">sgd_name = #{sgdName},</if>
<if test="lyTime != null">ly_time = #{lyTime},</if>
<if test="ckRemark != null">ck_remark = #{ckRemark},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
@@ -194,11 +252,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="deleteRkInfoByIds" parameterType="String"> <update id="deleteRkInfoByIds" parameterType="String">
update rk_info update rk_info
set is_delete = 1 set ri.is_delete = 1
where id in where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</update> </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>
</mapper> </mapper>