diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tyre/BaseInventoryController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tyre/BaseInventoryController.java index f287f8c9..4e74141a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tyre/BaseInventoryController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tyre/BaseInventoryController.java @@ -6,9 +6,11 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.BaseInventory; import com.ruoyi.system.domain.BaseTyre; +import com.ruoyi.system.domain.vo.InboundBatchPreviewVo; import com.ruoyi.system.service.IBaseInventoryService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -137,4 +139,64 @@ public class BaseInventoryController extends BaseController { return baseInventoryService.OutInventoryByPda(baseInventory,baseTyre); } + + /** + * 批量入库预览接口:按入库编码查询批次下的轮胎列表,并统计已入库 / 待入库数量。 + * + * @param inboundCode 入库编码 + * @return 批次预览结果 + */ + @RequiresPermissions("tyre:inventory:add") + @PostMapping("/batchInbound/preview") + @ResponseBody + public AjaxResult batchInboundPreview(@RequestParam("inboundCode") String inboundCode) + { + InboundBatchPreviewVo data = baseInventoryService.previewBatchByCode(inboundCode); + return AjaxResult.success("批次预览成功", data); + } + + /** + * 批量入库执行接口:按入库编码将批次内所有待入库轮胎写入库存,逐条独立事务保证失败隔离。 + * + * @param inboundCode 入库编码 + * @return 入库处理结果 + */ + @RequiresPermissions("tyre:inventory:add") + @Log(title = "轮胎批量入库", businessType = BusinessType.IMPORT) + @PostMapping("/batchInbound") + @ResponseBody + public AjaxResult batchInboundSave(@RequestParam("inboundCode") String inboundCode) + { + int rows = baseInventoryService.batchInboundByCode(inboundCode, ShiroUtils.getLoginName()); + return rows > 0 ? AjaxResult.success("批量入库完成,成功处理 " + rows + " 条", rows) : AjaxResult.error("批量入库失败或无可入库轮胎"); + } + + /** + * 批量入库撤回接口:按入库编码撤回批次入库,仅处理当前仍在库状态的记录。 + * + * @param inboundCode 入库编码 + * @return 撤回处理结果 + */ + @RequiresPermissions("tyre:inventory:add") + @Log(title = "轮胎批量入库撤回", businessType = BusinessType.UPDATE) + @PostMapping("/batchInbound/rollback") + @ResponseBody + public AjaxResult batchInboundRollback(@RequestParam("inboundCode") String inboundCode) + { + int rows = baseInventoryService.rollbackBatchInboundByCode(inboundCode, ShiroUtils.getLoginName()); + return rows > 0 ? AjaxResult.success("批量撤回完成,成功处理 " + rows + " 条", rows) : AjaxResult.error("批量撤回失败或无可撤回轮胎"); + } + + /** + * 批量入库页面路由:返回批量入库 Thymeleaf 模板视图名。 + * + * @return 模板路径 + */ + @RequiresPermissions("tyre:inventory:add") + @GetMapping("/batchInbound") + public String batchInbound() + { + return prefix + "/batchInbound"; + } + } diff --git a/ruoyi-admin/src/main/resources/templates/tyre/inventory/batchInbound.html b/ruoyi-admin/src/main/resources/templates/tyre/inventory/batchInbound.html new file mode 100644 index 00000000..0f6b6852 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/tyre/inventory/batchInbound.html @@ -0,0 +1,181 @@ + + +
+