From 399e7d565f19f59a8da82277da8f3eab527c2c56 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期二, 09 九月 2025 19:40:20 +0800
Subject: [PATCH] art: 上料接口,上下料查询接口

---
 src/main/java/org/jeecg/modules/mes/controller/MesMaterialLoadingController.java |  214 ++++++++++++++++++++---------------------------------
 1 files changed, 82 insertions(+), 132 deletions(-)

diff --git a/src/main/java/org/jeecg/modules/mes/controller/MesMaterialLoadingController.java b/src/main/java/org/jeecg/modules/mes/controller/MesMaterialLoadingController.java
index 92aa658..277a813 100644
--- a/src/main/java/org/jeecg/modules/mes/controller/MesMaterialLoadingController.java
+++ b/src/main/java/org/jeecg/modules/mes/controller/MesMaterialLoadingController.java
@@ -1,6 +1,5 @@
 package org.jeecg.modules.mes.controller;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.Api;
@@ -9,153 +8,104 @@
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.base.controller.JeecgController;
-import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.modules.mes.entity.MesMaterialLoading;
 import org.jeecg.modules.mes.service.IMesMaterialLoadingService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.util.Arrays;
 
 /**
-* @Description: 涓婃枡
-* @Author: jeecg-boot
-* @Date:   2025-07-07
-* @Version: V1.0
-*/
-@Api(tags="涓婃枡")
+ * @Description: 涓婃枡
+ * @Author: jeecg-boot
+ * @Date: 2025-07-07
+ * @Version: V1.0
+ */
+@Api(tags = "涓婃枡")
 @RestController
 @RequestMapping("/mes/mesMaterialLoading")
 @Slf4j
 public class MesMaterialLoadingController extends JeecgController<MesMaterialLoading, IMesMaterialLoadingService> {
-   @Autowired
-   private IMesMaterialLoadingService mesMaterialLoadingService;
+    @Autowired
+    private IMesMaterialLoadingService mesMaterialLoadingService;
 
-   /**
-    * 鍒嗛〉鍒楄〃鏌ヨ
-    *
-    * @param mesMaterialLoading
-    * @param pageNo
-    * @param pageSize
-    * @param req
-    * @return
-    */
-   //@AutoLog(value = "涓婃枡-鍒嗛〉鍒楄〃鏌ヨ")
-   @ApiOperation(value="涓婃枡-鍒嗛〉鍒楄〃鏌ヨ", notes="涓婃枡-鍒嗛〉鍒楄〃鏌ヨ")
-   @GetMapping(value = "/list")
-   public Result<IPage<MesMaterialLoading>> queryPageList(MesMaterialLoading mesMaterialLoading,
-                                  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-                                  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-                                  HttpServletRequest req) {
-       QueryWrapper<MesMaterialLoading> queryWrapper = QueryGenerator.initQueryWrapper(mesMaterialLoading, req.getParameterMap());
-       Page<MesMaterialLoading> page = new Page<MesMaterialLoading>(pageNo, pageSize);
-       IPage<MesMaterialLoading> pageList = mesMaterialLoadingService.page(page, queryWrapper);
-       return Result.OK(pageList);
-   }
+    /**
+     * 鍒嗛〉鍒楄〃鏌ヨ
+     *
+     * @param mesMaterialLoading
+     * @param pageNo
+     * @param pageSize
+     * @return
+     */
+    @ApiOperation(value = "涓婃枡-鍒嗛〉鍒楄〃鏌ヨ", notes = "涓婃枡-鍒嗛〉鍒楄〃鏌ヨ")
+    @GetMapping(value = "/list")
+    public Result<IPage<MesMaterialLoading>> queryPageList(MesMaterialLoading mesMaterialLoading,
+                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+        Page<MesMaterialLoading> page = new Page<>(pageNo, pageSize);
+        IPage<MesMaterialLoading> pageList = mesMaterialLoadingService.queryPageList(page, mesMaterialLoading);
+        return Result.OK(pageList);
+    }
 
-   /**
-    *   娣诲姞
-    *
-    * @param mesMaterialLoading
-    * @return
-    */
-   @AutoLog(value = "涓婃枡-娣诲姞")
-   @ApiOperation(value="涓婃枡-娣诲姞", notes="涓婃枡-娣诲姞")
-   //@RequiresPermissions("org.jeecg.modules:mes_material_loading:add")
-   @PostMapping(value = "/add")
-   public Result<String> add(@RequestBody MesMaterialLoading mesMaterialLoading) {
-       mesMaterialLoadingService.save(mesMaterialLoading);
-       return Result.OK("娣诲姞鎴愬姛锛�");
-   }
+    /**
+     *   娣诲姞
+     *
+     * @param mesMaterialLoading
+     * @return
+     */
+    @AutoLog(value = "涓婃枡-娣诲姞")
+    @ApiOperation(value = "涓婃枡-娣诲姞", notes = "涓婃枡-娣诲姞")
+    @PostMapping(value = "/add")
+    public Result<String> add(@RequestBody MesMaterialLoading mesMaterialLoading) {
+        boolean b = mesMaterialLoadingService.loading(mesMaterialLoading);
+        if (!b) {
+            Result.error("涓婃枡澶辫触锛�");
+        }
+        return Result.OK("涓婃枡鎴愬姛锛�");
+    }
 
-   /**
-    *  缂栬緫
-    *
-    * @param mesMaterialLoading
-    * @return
-    */
-   @AutoLog(value = "涓婃枡-缂栬緫")
-   @ApiOperation(value="涓婃枡-缂栬緫", notes="涓婃枡-缂栬緫")
-   //@RequiresPermissions("org.jeecg.modules:mes_material_loading:edit")
-   @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
-   public Result<String> edit(@RequestBody MesMaterialLoading mesMaterialLoading) {
-       mesMaterialLoadingService.updateById(mesMaterialLoading);
-       return Result.OK("缂栬緫鎴愬姛!");
-   }
+    /**
+     *  缂栬緫
+     *
+     * @param mesMaterialLoading
+     * @return
+     */
+    @AutoLog(value = "涓婃枡-缂栬緫")
+    @ApiOperation(value = "涓婃枡-缂栬緫", notes = "涓婃枡-缂栬緫")
+    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> edit(@RequestBody MesMaterialLoading mesMaterialLoading) {
+        mesMaterialLoadingService.updateById(mesMaterialLoading);
+        return Result.OK("缂栬緫鎴愬姛!");
+    }
 
-   /**
-    *   閫氳繃id鍒犻櫎
-    *
-    * @param id
-    * @return
-    */
-   @AutoLog(value = "涓婃枡-閫氳繃id鍒犻櫎")
-   @ApiOperation(value="涓婃枡-閫氳繃id鍒犻櫎", notes="涓婃枡-閫氳繃id鍒犻櫎")
-   //@RequiresPermissions("org.jeecg.modules:mes_material_loading:delete")
-   @DeleteMapping(value = "/delete")
-   public Result<String> delete(@RequestParam(name="id",required=true) String id) {
-       mesMaterialLoadingService.removeById(id);
-       return Result.OK("鍒犻櫎鎴愬姛!");
-   }
+    /**
+     * 閫氳繃id鏌ヨ
+     *
+     * @param id
+     * @return
+     */
+    //@AutoLog(value = "涓婃枡-閫氳繃id鏌ヨ")
+    @ApiOperation(value = "涓婃枡-閫氳繃id鏌ヨ", notes = "涓婃枡-閫氳繃id鏌ヨ")
+    @GetMapping(value = "/queryById")
+    public Result<MesMaterialLoading> queryById(@RequestParam(name = "id", required = true) String id) {
+        MesMaterialLoading mesMaterialLoading = mesMaterialLoadingService.getById(id);
+        if (mesMaterialLoading == null) {
+            return Result.error("鏈壘鍒板搴旀暟鎹�");
+        }
+        return Result.OK(mesMaterialLoading);
+    }
 
-   /**
-    *  鎵归噺鍒犻櫎
-    *
-    * @param ids
-    * @return
-    */
-   @AutoLog(value = "涓婃枡-鎵归噺鍒犻櫎")
-   @ApiOperation(value="涓婃枡-鎵归噺鍒犻櫎", notes="涓婃枡-鎵归噺鍒犻櫎")
-   //@RequiresPermissions("org.jeecg.modules:mes_material_loading:deleteBatch")
-   @DeleteMapping(value = "/deleteBatch")
-   public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-       this.mesMaterialLoadingService.removeByIds(Arrays.asList(ids.split(",")));
-       return Result.OK("鎵归噺鍒犻櫎鎴愬姛!");
-   }
-
-   /**
-    * 閫氳繃id鏌ヨ
-    *
-    * @param id
-    * @return
-    */
-   //@AutoLog(value = "涓婃枡-閫氳繃id鏌ヨ")
-   @ApiOperation(value="涓婃枡-閫氳繃id鏌ヨ", notes="涓婃枡-閫氳繃id鏌ヨ")
-   @GetMapping(value = "/queryById")
-   public Result<MesMaterialLoading> queryById(@RequestParam(name="id",required=true) String id) {
-       MesMaterialLoading mesMaterialLoading = mesMaterialLoadingService.getById(id);
-       if(mesMaterialLoading==null) {
-           return Result.error("鏈壘鍒板搴旀暟鎹�");
-       }
-       return Result.OK(mesMaterialLoading);
-   }
-
-   /**
-   * 瀵煎嚭excel
-   *
-   * @param request
-   * @param mesMaterialLoading
-   */
-   //@RequiresPermissions("org.jeecg.modules:mes_material_loading:exportXls")
-   @RequestMapping(value = "/exportXls")
-   public ModelAndView exportXls(HttpServletRequest request, MesMaterialLoading mesMaterialLoading) {
-       return super.exportXls(request, mesMaterialLoading, MesMaterialLoading.class, "涓婃枡");
-   }
-
-   /**
-     * 閫氳繃excel瀵煎叆鏁版嵁
-   *
-   * @param request
-   * @param response
-   * @return
-   */
-   //@RequiresPermissions("mes_material_loading:importExcel")
-   @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-   public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-       return super.importExcel(request, response, MesMaterialLoading.class);
-   }
-
+    /**
+     * 閫氳繃loadingId鏌ヨ涓嬫枡淇℃伅
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("/queryUnloadingByLoadingId")
+    public Result<?> queryUnloadingByLoadingId(HttpServletRequest request, HttpServletResponse response) {
+        String loadingId = request.getParameter("loadingId");
+        return Result.OK(mesMaterialLoadingService.queryUnloadingByLoadingId(loadingId));
+    }
 }

--
Gitblit v1.9.3