入库相关接口开发
This commit is contained in:
@@ -42,6 +42,17 @@ public class PcdeDetailController extends BaseController
|
|||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部库位明细列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('information:pcdedetail:list')")
|
||||||
|
@GetMapping("/getAll")
|
||||||
|
public AjaxResult getAll()
|
||||||
|
{
|
||||||
|
List<PcdeDetail> list = pcdeDetailService.selectPcdeDetailList(new PcdeDetail());
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出库位明细列表
|
* 导出库位明细列表
|
||||||
*/
|
*/
|
||||||
@@ -85,7 +96,7 @@ public class PcdeDetailController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('information:pcdedetail:add')")
|
@PreAuthorize("@ss.hasPermi('information:pcdedetail:add')")
|
||||||
@Log(title = "库位明细", businessType = BusinessType.INSERT)
|
@Log(title = "库位明细", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping("/add")
|
||||||
public AjaxResult add(@RequestBody PcdeDetail pcdeDetail)
|
public AjaxResult add(@RequestBody PcdeDetail pcdeDetail)
|
||||||
{
|
{
|
||||||
return toAjax(pcdeDetailService.insertPcdeDetail(pcdeDetail));
|
return toAjax(pcdeDetailService.insertPcdeDetail(pcdeDetail));
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|||||||
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.project.wisdom.domain.GysJh;
|
import com.zg.project.wisdom.domain.GysJh;
|
||||||
|
import com.zg.project.wisdom.domain.RkInfo;
|
||||||
|
import com.zg.project.wisdom.mapper.RkInfoMapper;
|
||||||
|
import com.zg.project.wisdom.service.IRkInfoService;
|
||||||
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.information.mapper.PcdeDetailMapper;
|
import com.zg.project.information.mapper.PcdeDetailMapper;
|
||||||
@@ -24,6 +27,9 @@ public class PcdeDetailServiceImpl implements IPcdeDetailService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private PcdeDetailMapper pcdeDetailMapper;
|
private PcdeDetailMapper pcdeDetailMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RkInfoMapper rkInfoMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询库位明细
|
* 查询库位明细
|
||||||
*
|
*
|
||||||
@@ -93,6 +99,24 @@ public class PcdeDetailServiceImpl implements IPcdeDetailService
|
|||||||
@Override
|
@Override
|
||||||
public int deletePcdeDetailByIds(Long[] ids)
|
public int deletePcdeDetailByIds(Long[] ids)
|
||||||
{
|
{
|
||||||
|
for (Long id : ids) {
|
||||||
|
// 获取库位信息
|
||||||
|
PcdeDetail pcdeDetail = pcdeDetailMapper.selectPcdeDetailById(id);
|
||||||
|
if (pcdeDetail == null) {
|
||||||
|
throw new ServiceException("ID为 " + id + " 的库位不存在,无法删除");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取库位编号
|
||||||
|
String locationCode = pcdeDetail.getLocationCode();
|
||||||
|
|
||||||
|
// 检查该库位是否仍有关联货物
|
||||||
|
int count = rkInfoMapper.countRkInfoByLocationCode(locationCode);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new ServiceException("库位 [" + locationCode + "] 上还有货物,无法批量删除");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 全部校验通过后再执行删除
|
||||||
return pcdeDetailMapper.deletePcdeDetailByIds(ids);
|
return pcdeDetailMapper.deletePcdeDetailByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,6 +129,22 @@ public class PcdeDetailServiceImpl implements IPcdeDetailService
|
|||||||
@Override
|
@Override
|
||||||
public int deletePcdeDetailById(Long id)
|
public int deletePcdeDetailById(Long id)
|
||||||
{
|
{
|
||||||
|
// 根据主键获取库位明细
|
||||||
|
PcdeDetail pcdeDetail = pcdeDetailMapper.selectPcdeDetailById(id);
|
||||||
|
if (pcdeDetail == null) {
|
||||||
|
throw new ServiceException("库位信息不存在,无法删除");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取库位编号
|
||||||
|
String locationCode = pcdeDetail.getLocationCode();
|
||||||
|
|
||||||
|
// 查询该库位上是否存在库存
|
||||||
|
int count = rkInfoMapper.countRkInfoByLocationCode(locationCode);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new ServiceException("该库位上还有货物,无法删除");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除库位信息
|
||||||
return pcdeDetailMapper.deletePcdeDetailById(id);
|
return pcdeDetailMapper.deletePcdeDetailById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.zg.project.wisdom.mapper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.zg.project.wisdom.domain.RkInfo;
|
import com.zg.project.wisdom.domain.RkInfo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 库存单据主Mapper接口
|
* 库存单据主Mapper接口
|
||||||
@@ -58,4 +59,11 @@ public interface RkInfoMapper
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int batchInsertRkInfo(List<RkInfo> saveList);
|
int batchInsertRkInfo(List<RkInfo> saveList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据库位编码查询入库单据
|
||||||
|
* @param locationCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int countRkInfoByLocationCode(@Param("locationCode") String locationCode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,6 @@ import com.zg.project.wisdom.service.IRkInfoService;
|
|||||||
public class RkInfoServiceImpl implements IRkInfoService
|
public class RkInfoServiceImpl implements IRkInfoService
|
||||||
{
|
{
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IGysJhService gysJhService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RkInfoMapper rkInfoMapper;
|
private RkInfoMapper rkInfoMapper;
|
||||||
|
|
||||||
|
|||||||
@@ -117,6 +117,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where id = #{id} and is_delete = 0
|
where id = #{id} and is_delete = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="countRkInfoByLocationCode" resultType="int">
|
||||||
|
SELECT COUNT(1)
|
||||||
|
FROM rk_info
|
||||||
|
WHERE pcode = #{locationCode} AND is_delete = 0
|
||||||
|
</select>
|
||||||
<update id="updateRkInfo" parameterType="RkInfo">
|
<update id="updateRkInfo" parameterType="RkInfo">
|
||||||
update rk_info
|
update rk_info
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
|||||||
Reference in New Issue
Block a user