From 4f38e5827b848298de8e95f59e0ba9b24951e615 Mon Sep 17 00:00:00 2001 From: lixiangyu <lixiangyu@xalxzn.com> Date: 星期二, 16 九月 2025 18:01:18 +0800 Subject: [PATCH] refactor(cms): 优化刀具管理功能和性能 刀具报废功能 - 新增 提交(/subumit)接口 刀具报废功能 - 修改完善其删除功能,同时删除报废单和报废明细 刀具报废功能 - (/add)接口中增加逻辑判断禁制同一个刀具重复申请报废 刀具领用功能 - 完善刀具寿命计算 刀具领用功能 - 完善其删除功能,同时删除领用单和领用明细 刀具入库功能 - 完善其删除功能,同时删除入库单和入库明细 把刀具库存中的库存状态,从“正常”改为“在库”。 --- src/main/java/org/jeecg/modules/cms/controller/CuttingInboundController.java | 67 ++------------------------------- 1 files changed, 5 insertions(+), 62 deletions(-) diff --git a/src/main/java/org/jeecg/modules/cms/controller/CuttingInboundController.java b/src/main/java/org/jeecg/modules/cms/controller/CuttingInboundController.java index 59b2736..5066561 100644 --- a/src/main/java/org/jeecg/modules/cms/controller/CuttingInboundController.java +++ b/src/main/java/org/jeecg/modules/cms/controller/CuttingInboundController.java @@ -10,10 +10,7 @@ import io.micrometer.core.annotation.Timed; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; -import org.jeecg.modules.cms.entity.CuttingInbound; -import org.jeecg.modules.cms.entity.CuttingInboundDetail; -import org.jeecg.modules.cms.entity.CuttingInboundInventory; -import org.jeecg.modules.cms.entity.CuttingInventory; +import org.jeecg.modules.cms.entity.*; import org.jeecg.modules.cms.mapper.CuttingInboundMapper; import org.jeecg.modules.cms.service.ICuttingInboundDetailService; import org.jeecg.modules.cms.service.ICuttingInboundInventoryService; @@ -142,6 +139,9 @@ @DeleteMapping(value = "/delete") public Result<String> delete(@RequestParam(name = "id", required = true) String id) { cuttingInboundService.removeById(id); + //鍒犻櫎鍒�鍏烽鐢ㄦ槑缁嗚〃鐨勬暟鎹� + cuttingInboundDetailService.remove + (new QueryWrapper<CuttingInboundDetail>().eq("order_id", id)); return Result.OK("鍒犻櫎鎴愬姛!"); } @@ -289,64 +289,7 @@ @GetMapping("/submit") @Timed(value = "cutting.inbound.submit", description = "鍒�鍏峰叆搴撴彁浜よ�楁椂") public Result<?> submit(@RequestParam("orderId") String orderId) { -// long startTime = System.currentTimeMillis(); -// try { -// // 1. 鏇存柊鍏ュ簱鍗曠姸鎬� -// CuttingInbound cuttingInbound = cuttingInboundService.getById(orderId); -// if (cuttingInbound == null) { -// return Result.error("鏈壘鍒板搴旂殑鍏ュ簱鍗�"); -// } -// cuttingInbound.setOrderStatus("2"); -// cuttingInboundService.updateById(cuttingInbound); -// -// // 2. 鑾峰彇鍏ュ簱鏄庣粏 -// List<CuttingInboundDetail> detailList = cuttingInboundDetailService.lambdaQuery() -// .eq(CuttingInboundDetail::getOrderId, orderId) -// .list(); -// -// // 3. 鏀堕泦鎵�鏈夐渶瑕佷繚瀛樼殑鏁版嵁 -// List<CuttingInventory> inventoryList = new ArrayList<>(); -// List<CuttingInboundInventory> inboundInventoryList = new ArrayList<>(); -// -// for (CuttingInboundDetail detail : detailList) { -// int quantity = detail.getReceiveNumber() != null ? detail.getReceiveNumber().intValue() : 0; -// -// for (int i = 0; i < quantity; i++) { -// // 鐢熸垚搴撳瓨璁板綍 -// CuttingInventory cuttingInventory = new CuttingInventory(); -// cuttingInventory.setCuttingId(detail.getCuttingId()); -// cuttingInventory.setCuttingBarcode(generateUniqueBarcode(detail.getCuttingId(), i)); -// cuttingInventory.setInventoryStatus("姝e父"); -// cuttingInventory.setCurrentLife(BigDecimal.valueOf(100)); -// inventoryList.add(cuttingInventory); -// } -// } -// -// // 4. 鎵归噺淇濆瓨搴撳瓨璁板綍锛堜竴娆℃�ф搷浣滐級 -// if (!inventoryList.isEmpty()) { -// cuttingInventoryService.saveBatch(inventoryList); -// -// // 5. 涓烘瘡涓繚瀛樼殑搴撳瓨璁板綍鍒涘缓鍏宠仈鍏崇郴 -// for (CuttingInventory inventory : inventoryList) { -// CuttingInboundInventory cuttingInboundInventory = new CuttingInboundInventory(); -// cuttingInboundInventory.setOrderId(orderId); -// cuttingInboundInventory.setInventoryId(inventory.getId()); -// inboundInventoryList.add(cuttingInboundInventory); -// } -// -// // 6. 鎵归噺淇濆瓨鍏宠仈鍏崇郴锛堜竴娆℃�ф搷浣滐級 -// cuttingInboundInventoryService.saveBatch(inboundInventoryList); -// } -// -// long endTime = System.currentTimeMillis(); -// log.info("鍒�鍏峰叆搴撴彁浜ゅ畬鎴愶紝鑰楁椂: {} s", (endTime - startTime)/1000); -// return Result.ok("鎻愪氦鎴愬姛"); -// -// } catch (Exception e) { -// long endTime = System.currentTimeMillis(); -// log.error("鎻愪氦鍏ュ簱鍗曞け璐ワ紝orderId: " + orderId + "锛岃�楁椂: " + (endTime - startTime) + " ms", e); -// return Result.error("鎻愪氦澶辫触: " + e.getMessage()); -// } + return cuttingInboundService.submit(orderId); } } -- Gitblit v1.9.3