diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tyre/BaseTyreController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tyre/BaseTyreController.java index 48554e37..51ec1248 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tyre/BaseTyreController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tyre/BaseTyreController.java @@ -12,11 +12,13 @@ import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.vo.BaseTyreVo; +import com.ruoyi.system.service.IBaseInventoryService; import com.ruoyi.system.service.IBaseTyreService; import com.ruoyi.system.service.IRecordCheckService; import com.ruoyi.system.service.IRecordTyreInstallService; import com.ruoyi.system.service.IRecordWarehousingService; import com.ruoyi.system.service.ITyreStatDetailService; +import com.ruoyi.system.domain.vo.InboundBatchPreviewVo; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -58,6 +60,9 @@ public class BaseTyreController extends BaseController @Autowired private ITyreStatDetailService tyreStatDetailService; + @Autowired + private IBaseInventoryService baseInventoryService; + @RequiresPermissions("tyre:tyre:view") @GetMapping() public String tyre() @@ -491,4 +496,54 @@ public class BaseTyreController extends BaseController return prefix + "/typreDetill2"; } + /** + * 收货弹窗页面入口 + */ + @RequiresPermissions("tyre:tyre:receive") + @GetMapping("/receive") + public String receive() + { + return prefix + "/receive"; + } + + /** + * 收货预览:按入库编码查询批次下的轮胎列表并统计已入库/待入库数量 + */ + @RequiresPermissions("tyre:tyre:receive") + @PostMapping("/receive/preview") + @ResponseBody + public AjaxResult receivePreview(@RequestParam("inboundCode") String inboundCode) + { + InboundBatchPreviewVo data = baseInventoryService.previewBatchByCode(inboundCode); + return AjaxResult.success("批次预览成功", data); + } + + /** + * 收货确认入库:按入库编码将批次内所有待入库轮胎一次性写入库存 + */ + @RequiresPermissions("tyre:tyre:receive") + @Log(title = "轮胎收货", businessType = BusinessType.IMPORT) + @PostMapping("/receive") + @ResponseBody + public AjaxResult receiveSubmit(@RequestParam("inboundCode") String inboundCode) + { + int rows = baseInventoryService.batchInboundByCode(inboundCode, ShiroUtils.getLoginName()); + return rows > 0 ? AjaxResult.success("收货完成,成功处理 " + rows + " 条", rows) + : AjaxResult.error("收货失败或无可入库轮胎"); + } + + /** + * 收货撤回:按入库编码撤回仍在库的轮胎(不提供页面入口,仅供管理员后端调用) + */ + @RequiresPermissions("tyre:tyre:receive") + @Log(title = "轮胎收货撤回", businessType = BusinessType.UPDATE) + @PostMapping("/receive/rollback") + @ResponseBody + public AjaxResult receiveRollback(@RequestParam("inboundCode") String inboundCode) + { + int rows = baseInventoryService.rollbackBatchInboundByCode(inboundCode, ShiroUtils.getLoginName()); + return rows > 0 ? AjaxResult.success("收货撤回完成,成功处理 " + rows + " 条", rows) + : AjaxResult.error("收货撤回失败或无可撤回轮胎"); + } + } diff --git a/ruoyi-admin/src/main/resources/templates/tyre/tyre/receive.html b/ruoyi-admin/src/main/resources/templates/tyre/tyre/receive.html new file mode 100644 index 00000000..7f6eee43 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/tyre/tyre/receive.html @@ -0,0 +1,115 @@ + + + + + + +
+
+
+
+
+ + +
+ 查询 +
+ + +
+
+
+ + + + diff --git a/ruoyi-admin/src/main/resources/templates/tyre/tyre/tyre.html b/ruoyi-admin/src/main/resources/templates/tyre/tyre/tyre.html index cb0c7b47..0004586e 100644 --- a/ruoyi-admin/src/main/resources/templates/tyre/tyre/tyre.html +++ b/ruoyi-admin/src/main/resources/templates/tyre/tyre/tyre.html @@ -80,6 +80,9 @@ 导入 + + 收货 +
@@ -223,6 +226,10 @@ }; $.table.init(options); }); + function openReceive() { + var url = ctx + "tyre/tyre/receive"; + $.modal.openOptions({ title: "收货", url: url, width: 720, height: 520 }); + }