库位修改以及批量导入

This commit is contained in:
2026-04-15 15:48:48 +08:00
parent 309022aae2
commit 0671f405f6
6 changed files with 44 additions and 33 deletions

View File

@@ -126,11 +126,11 @@ public class PcdeDetailController extends BaseController
/**
* 删除库位明细
*/
// @PreAuthorize("@ss.hasPermi('information:pcdedetail:remove')")
// @Log(title = "库位明细", businessType = BusinessType.DELETE)
// @DeleteMapping("/{ids}")
// public AjaxResult remove(@PathVariable Long[] ids)
// {
// return toAjax(pcdeDetailService.deletePcdeDetailByIds(ids));
// }
@PreAuthorize("@ss.hasPermi('information:pcdedetail:remove')")
@Log(title = "库位明细", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(pcdeDetailService.deletePcdeDetailByIds(ids));
}
}

View File

@@ -50,7 +50,7 @@ public interface IPcdeDetailService
* @param ids 需要删除的库位明细主键集合
* @return 结果
*/
// public int deletePcdeDetailByIds(Long[] ids);
public int deletePcdeDetailByIds(Long[] ids);
/**
* 删除库位明细信息

View File

@@ -95,29 +95,29 @@ public class PcdeDetailServiceImpl implements IPcdeDetailService
* @param ids 需要删除的库位明细主键
* @return 结果
*/
// @Override
// 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.getPcode();
//
// // 检查该库位是否仍有关联货物
// int count = rkInfoMapper.countRkInfoByLocationCode(locationCode);
// if (count > 0) {
// throw new ServiceException("库位 [" + locationCode + "] 上还有货物,无法批量删除");
// }
// }
//
// // 全部校验通过后再执行删除
// return pcdeDetailMapper.deletePcdeDetailByIds(ids);
// }
@Override
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.getPcode();
// 检查该库位是否仍有关联货物
int count = rkInfoMapper.countRkInfoByLocationCode(locationCode);
if (count > 0) {
throw new ServiceException("库位 [" + locationCode + "] 上还有货物,无法批量删除");
}
}
// 全部校验通过后再执行删除
return pcdeDetailMapper.deletePcdeDetailByIds(ids);
}
/**
* 删除库位明细信息

View File

@@ -192,4 +192,7 @@ public interface RkInfoMapper
);
int updateInfoByBillNo(RkInfo rkInfo);
public int countRkInfoByLocationCode(String locationCode);
}

View File

@@ -335,7 +335,6 @@
INSERT IGNORE INTO pcde_detail
(pcode,
scene,
scene_name,
parent_warehouse_code,
parent_warehouse_name,
warehouse_code,
@@ -353,7 +352,6 @@
(
#{item.pcode},
#{item.scene},
#{item.sceneName},
#{item.parentWarehouseCode},
#{item.parentWarehouseName},
#{item.warehouseCode},

View File

@@ -721,4 +721,14 @@
</set>
WHERE bill_no = #{billNo}
</update>
<select id="countRkInfoByLocationCode" parameterType="String" resultType="int">
SELECT COUNT(1)
FROM rk_info
WHERE pcode = #{locationCode}
AND (is_delete = '0' OR is_delete IS NULL)
AND exec_status = 1
AND is_chuku = 0
AND IFNULL(real_qty, 0) > 0
</select>
</mapper>