新火炬后端单体项目初始化代码
已添加1个文件
已修改32个文件
1415 ■■■■ 文件已修改
pom.xml 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/base/service/ILineSideWarehouseService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/base/service/impl/LineSideWarehouseServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/controller/CuttingInboundController.java 164 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/controller/CuttingInventoryController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/controller/CuttingReceiveController.java 282 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/controller/CuttingToolController.java 294 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/entity/CuttingInventory.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/mapper/CuttingReceiveDetailMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/service/ICuttingInboundService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/service/ICuttingReceiveDetailService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/service/impl/CuttingInboundServiceImpl.java 134 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/lsw/controller/LswMaterialController.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/lsw/controller/LswMaterialInboundController.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/lsw/controller/LswMaterialOutboundController.java 176 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/lsw/entity/LswMaterialInbound.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/lsw/entity/LswMaterialInventory.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/lsw/entity/LswMaterialOutbound.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/lsw/enums/MaterialInboundCategory.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/lsw/enums/MaterialInventoryCategoryEnum.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/lsw/enums/MaterialOutboundCategory.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/lsw/service/ILswMaterialInventoryService.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialInboundServiceImpl.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialInventoryServiceImpl.java 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialOutboundServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/wms/config/WebServiceServerConfig.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/wms/controller/WMSTestController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/wms/dto/MESResponse.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/wms/dto/ReceiveWMSScanItemListResponse.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/wms/request/ReceiveWMSScanItemList.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/wms/request/WMSWebServiceSendItem.java 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/wms/service/MESWebServiceSoap.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/wms/service/impl/MESWebServiceSoapImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml
@@ -59,7 +59,7 @@
        <log4j2.version>2.17.0</log4j2.version>
        <logback.version>1.2.9</logback.version>
        <!-- webservice -->
        <cxf.version>3.2.4</cxf.version>
        <cxf.version>3.5.2</cxf.version>
    </properties>
    <repositories>
@@ -229,19 +229,9 @@
        </dependency>
        <!-- CXF webservice -->
<!--        <dependency>-->
<!--            <groupId>org.apache.cxf</groupId>-->
<!--            <artifactId>cxf-spring-boot-starter-jaxws</artifactId>-->
<!--            <version>${cxf.version}</version>-->
<!--        </dependency>-->
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>${cxf.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-transports-http</artifactId>
            <artifactId>cxf-spring-boot-starter-jaxws</artifactId>
            <version>${cxf.version}</version>
        </dependency>
src/main/java/org/jeecg/modules/base/service/ILineSideWarehouseService.java
@@ -26,4 +26,11 @@
     * @return
     */
    List<LineSideWarehouse> queryByProductionType(String productionType);
    /**
     * çº¿è¾¹åº“编码
     * @param warehouseCode
     * @return
     */
    LineSideWarehouse queryByWarehouseCode(String warehouseCode);
}
src/main/java/org/jeecg/modules/base/service/impl/LineSideWarehouseServiceImpl.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.modules.base.entity.LineSideWarehouse;
import org.jeecg.modules.base.mapper.LineSideWarehouseMapper;
import org.jeecg.modules.base.service.ILineSideWarehouseService;
@@ -39,4 +40,13 @@
        String[] types = productionType.split(",");
        return this.getBaseMapper().queryByProductionType(types);
    }
    @Override
    public LineSideWarehouse queryByWarehouseCode(String warehouseCode) {
        LambdaQueryWrapper<LineSideWarehouse> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(LineSideWarehouse::getWarehouseCode, warehouseCode);
        wrapper.eq(LineSideWarehouse::getDelFlag, CommonConstant.DEL_FLAG_0);
        wrapper.eq(LineSideWarehouse::getWarehouseStatus, CommonConstant.STATUS_1);
        return this.getBaseMapper().selectOne(wrapper);
    }
}
src/main/java/org/jeecg/modules/cms/controller/CuttingInboundController.java
@@ -279,163 +279,75 @@
    /*
     * ç”Ÿæˆå”¯ä¸€æ¡ç çš„æ–¹æ³•
     * ç”Ÿæˆå”¯ä¸€æ¡ç çš„æ–¹æ³•(目前还没有编码规则,确定后在这里改)
     */
    private String generateUniqueBarcode(String cuttingId, int index) {
        // æ¡ç ç”Ÿæˆè§„则示例:刀具ID + åºå·(4位) + éšæœºæ•°
        return cuttingId + String.format("%04d", index + 1) + (int) (Math.random() * 10000);
    }
//    @GetMapping("/submit")
//    public Result<?> submit(@RequestParam("orderId") String orderId) {
//        //         cuttingInboundService.submit(orderId);
//        //         return Result.ok("提交成功");
    @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("未找到对应的入库单");
//            }
//
//            // æ£€æŸ¥å…¥åº“单状态,只允许状态为"1"的入库单提交
//            if (!"1".equals(cuttingInbound.getOrderStatus())) {
//                return Result.error("只有状态为未提交的入库单才能执行提交操作");
//            }
//
//            // 2. æ›´æ–°çŠ¶æ€ä¸ºå·²æäº¤
//            cuttingInbound.setOrderStatus("2");
//            boolean updateResult = cuttingInboundService.updateById(cuttingInbound);
//            if (!updateResult) {
//                return Result.error("更新入库单状态失败");
//            }
//            cuttingInboundService.updateById(cuttingInbound);
//
//            // 3. èŽ·å–å…¥åº“æ˜Žç»†
//            // 2. èŽ·å–å…¥åº“æ˜Žç»†
//            List<CuttingInboundDetail> detailList = cuttingInboundDetailService.lambdaQuery()
//                    .eq(CuttingInboundDetail::getOrderId, orderId)
//                    .list();
//
//            // ç”¨äºŽç»Ÿè®¡æ€»æ•°é‡
//            int totalSubmitted = 0;
//
//            // æ‰¹é‡ä¿å­˜çš„列表
//            // 3. æ”¶é›†æ‰€æœ‰éœ€è¦ä¿å­˜çš„æ•°æ®
//            List<CuttingInventory> inventoryList = new ArrayList<>();
//            List<CuttingInboundInventory> inboundInventoryList = new ArrayList<>();
//
//            // 4. æ ¹æ®æ˜Žç»†æ•°é‡ç”Ÿæˆåº“存记录和条码
//            for (CuttingInboundDetail detail : detailList) {
//                // æ ¹æ®æ˜Žç»†ä¸­çš„æ•°é‡ç”Ÿæˆå¯¹åº”数量的库存记录receive_number
//                int quantity = detail.getReceiveNumber() != null ? detail.getReceiveNumber() : 0;
//                for (int i = 0; i < quantity; i++) {
//                    totalSubmitted++;
//                    // ä¸ºæ¯ä¸ªåˆ€å…·ç”Ÿæˆç‹¬ç«‹çš„库存记录
//                    CuttingInventory cuttingInventory = new CuttingInventory();
//                    String inventoryId = UUID.randomUUID().toString().replace("-", "");
//                    cuttingInventory.setId(inventoryId);
//                    cuttingInventory.setCuttingId(detail.getCuttingId());
//                    // ä¸ºæ¯ä¸ªåˆ€å…·ç”Ÿæˆå”¯ä¸€æ¡ç 
//                    cuttingInventory.setCuttingBarcode(generateUniqueBarcode(detail.getCuttingId(), i));
//                    // è®¾ç½®åº“存状态为在库
//                    cuttingInventory.setInventoryStatus("正常");
//                    // è®¾ç½®å½“前寿命为100
//                    cuttingInventory.setCurrentLife(BigDecimal.valueOf(100));
//                    // æ·»åŠ åˆ°æ‰¹é‡ä¿å­˜åˆ—è¡¨
//                    inventoryList.add(cuttingInventory);
//                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("正常");
//                    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(inventoryId);
//                    // æ·»åŠ åˆ°æ‰¹é‡ä¿å­˜åˆ—è¡¨
//                    cuttingInboundInventory.setInventoryId(inventory.getId());
//                    inboundInventoryList.add(cuttingInboundInventory);
//                }
//
//                // 6. æ‰¹é‡ä¿å­˜å…³è”关系(一次性操作)
//                cuttingInboundInventoryService.saveBatch(inboundInventoryList);
//            }
//
//            // æ‰¹é‡ä¿å­˜åº“存记录
//            if (!inventoryList.isEmpty()) {
//                boolean saveResult = cuttingInventoryService.saveBatch(inventoryList);
//                if (!saveResult) {
//                    throw new RuntimeException("保存库存记录失败");
//                }
//            }
//            long endTime = System.currentTimeMillis();
//            log.info("刀具入库提交完成,耗时: {} s", (endTime - startTime)/1000);
//            return Result.ok("提交成功");
//
//            // æ‰¹é‡ä¿å­˜å…³è”关系
//            if (!inboundInventoryList.isEmpty()) {
//                boolean relationSaveResult = cuttingInboundInventoryService.saveBatch(inboundInventoryList);
//                if (!relationSaveResult) {
//                    throw new RuntimeException("保存关联关系失败");
//                }
//            }
//
//            Map<String, Object> result = new HashMap<>();
//            result.put("message", "提交成功");
//            result.put("totalSubmitted", totalSubmitted);
//            return Result.ok(result);
//        } catch (Exception e) {
//            log.error("提交入库单失败,orderId: " + orderId, e);
//            throw new RuntimeException("提交失败: " + e.getMessage(), e);
//            long endTime = System.currentTimeMillis();
//            log.error("提交入库单失败,orderId: " + orderId + ",耗时: " + (endTime - startTime) + " ms", e);
//            return Result.error("提交失败: " + e.getMessage());
//        }
//    }
    @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("正常");
                    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);
    }
}
src/main/java/org/jeecg/modules/cms/controller/CuttingInventoryController.java
@@ -6,6 +6,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.cms.entity.CuttingInventory;
src/main/java/org/jeecg/modules/cms/controller/CuttingReceiveController.java
@@ -43,141 +43,141 @@
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
 /**
/**
 * @Description: åˆ€å…·é¢†ç”¨å•
 * @Author: jeecg-boot
 * @Date:   2025-07-28
 * @Date: 2025-07-28
 * @Version: V1.0
 */
@Api(tags="刀具领用单")
@Api(tags = "刀具领用单")
@RestController
@RequestMapping("/cms/cuttingReceive")
@Slf4j
public class CuttingReceiveController extends JeecgController<CuttingReceive, ICuttingReceiveService> {
    @Autowired
    private ICuttingReceiveService cuttingReceiveService;
    @Autowired
    private ICuttingReceiveService cuttingReceiveService;
     @Autowired
     private ICuttingReceiveDetailService cuttingReceiveDetailService;
    /**
     * åˆ†é¡µåˆ—表查询
     *
     * @param cuttingReceive
     * @param pageNo
     * @param pageSize
     * @param req
     * @return
     */
    //@AutoLog(value = "刀具领用单-分页列表查询")
    @ApiOperation(value="刀具领用单-分页列表查询", notes="刀具领用单-分页列表查询")
    @GetMapping(value = "/list")
    public Result<IPage<CuttingReceive>> queryPageList(CuttingReceive cuttingReceive,
                                   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                   HttpServletRequest req) {
        QueryWrapper<CuttingReceive> queryWrapper = QueryGenerator.initQueryWrapper(cuttingReceive, req.getParameterMap());
        Page<CuttingReceive> page = new Page<CuttingReceive>(pageNo, pageSize);
        IPage<CuttingReceive> pageList = cuttingReceiveService.page(page, queryWrapper);
        return Result.OK(pageList);
    }
    /**
     *   æ·»åŠ 
     *
     * @param jSONObject
     * @return
     */
    @AutoLog(value = "刀具领用单-添加")
    @ApiOperation(value="刀具领用单-添加", notes="刀具领用单-添加")
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_receive:add")
    @PostMapping(value = "/add")
    public Result<String> add(@RequestBody JSONObject jSONObject) {
        CuttingReceive cuttingReceive = jSONObject.toJavaObject(CuttingReceive.class);
        cuttingReceive.setOrderStatus("1");
        cuttingReceiveService.saveOrUpdate(cuttingReceive);
        //删除原关联数据
        List<CuttingReceiveDetail> cuttingReceiveDetailList = cuttingReceiveDetailService.lambdaQuery().eq(CuttingReceiveDetail::getOrderId,cuttingReceive.getId()).list();
        cuttingReceiveDetailService.removeBatchByIds(cuttingReceiveDetailList);
        //添加新关联数据
        JSONArray jsonArray = jSONObject.getJSONArray("detailData");
        List<CuttingReceiveDetail> list = jsonArray.toJavaList(CuttingReceiveDetail.class);
        for (int i = 0; i < list.size(); i++) {
            CuttingReceiveDetail temp = list.get(i);
            temp.setOrderId(cuttingReceive.getId());
            cuttingReceiveDetailService.save(temp);
        }
        return Result.OK("添加成功!");
    }
    /**
     *  ç¼–辑
     *
     * @param cuttingReceive
     * @return
     */
    @AutoLog(value = "刀具领用单-编辑")
    @ApiOperation(value="刀具领用单-编辑", notes="刀具领用单-编辑")
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_receive:edit")
    @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
    public Result<String> edit(@RequestBody CuttingReceive cuttingReceive) {
        cuttingReceiveService.updateById(cuttingReceive);
        return Result.OK("编辑成功!");
    }
    /**
     *   é€šè¿‡id删除
     *
     * @param id
     * @return
     */
    @AutoLog(value = "刀具领用单-通过id删除")
    @ApiOperation(value="刀具领用单-通过id删除", notes="刀具领用单-通过id删除")
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_receive:delete")
    @DeleteMapping(value = "/delete")
    public Result<String> delete(@RequestParam(name="id",required=true) String id) {
        cuttingReceiveService.removeById(id);
        return Result.OK("删除成功!");
    }
    /**
     *  æ‰¹é‡åˆ é™¤
     *
     * @param ids
     * @return
     */
    @AutoLog(value = "刀具领用单-批量删除")
    @ApiOperation(value="刀具领用单-批量删除", notes="刀具领用单-批量删除")
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_receive:deleteBatch")
    @DeleteMapping(value = "/deleteBatch")
    public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
        this.cuttingReceiveService.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<CuttingReceive> queryById(@RequestParam(name="id",required=true) String id) {
        CuttingReceive cuttingReceive = cuttingReceiveService.getById(id);
        if(cuttingReceive==null) {
            return Result.error("未找到对应数据");
        }
        return Result.OK(cuttingReceive);
    }
    @Autowired
    private ICuttingReceiveDetailService cuttingReceiveDetailService;
    /**
    * å¯¼å‡ºexcel
    *
    * @param request
    * @param cuttingReceive
    */
     * åˆ†é¡µåˆ—表查询
     *
     * @param cuttingReceive
     * @param pageNo
     * @param pageSize
     * @param req
     * @return
     */
    //@AutoLog(value = "刀具领用单-分页列表查询")
    @ApiOperation(value = "刀具领用单-分页列表查询", notes = "刀具领用单-分页列表查询")
    @GetMapping(value = "/list")
    public Result<IPage<CuttingReceive>> queryPageList(CuttingReceive cuttingReceive,
                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                       HttpServletRequest req) {
        QueryWrapper<CuttingReceive> queryWrapper = QueryGenerator.initQueryWrapper(cuttingReceive, req.getParameterMap());
        Page<CuttingReceive> page = new Page<CuttingReceive>(pageNo, pageSize);
        IPage<CuttingReceive> pageList = cuttingReceiveService.page(page, queryWrapper);
        return Result.OK(pageList);
    }
    /**
     * æ·»åŠ 
     *
     * @param jSONObject
     * @return
     */
    @AutoLog(value = "刀具领用单-添加")
    @ApiOperation(value = "刀具领用单-添加", notes = "刀具领用单-添加")
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_receive:add")
    @PostMapping(value = "/add")
    public Result<String> add(@RequestBody JSONObject jSONObject) {
        CuttingReceive cuttingReceive = jSONObject.toJavaObject(CuttingReceive.class);
        cuttingReceive.setOrderStatus("1");
        cuttingReceiveService.saveOrUpdate(cuttingReceive);
        //删除原关联数据
        List<CuttingReceiveDetail> cuttingReceiveDetailList = cuttingReceiveDetailService.lambdaQuery().eq(CuttingReceiveDetail::getOrderId, cuttingReceive.getId()).list();
        cuttingReceiveDetailService.removeBatchByIds(cuttingReceiveDetailList);
        //添加新关联数据
        JSONArray jsonArray = jSONObject.getJSONArray("detailData");
        List<CuttingReceiveDetail> list = jsonArray.toJavaList(CuttingReceiveDetail.class);
        for (int i = 0; i < list.size(); i++) {
            CuttingReceiveDetail temp = list.get(i);
            temp.setOrderId(cuttingReceive.getId());
            cuttingReceiveDetailService.save(temp);
        }
        return Result.OK("添加成功!");
    }
    /**
     * ç¼–辑
     *
     * @param cuttingReceive
     * @return
     */
    @AutoLog(value = "刀具领用单-编辑")
    @ApiOperation(value = "刀具领用单-编辑", notes = "刀具领用单-编辑")
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_receive:edit")
    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
    public Result<String> edit(@RequestBody CuttingReceive cuttingReceive) {
        cuttingReceiveService.updateById(cuttingReceive);
        return Result.OK("编辑成功!");
    }
    /**
     * é€šè¿‡id删除
     *
     * @param id
     * @return
     */
    @AutoLog(value = "刀具领用单-通过id删除")
    @ApiOperation(value = "刀具领用单-通过id删除", notes = "刀具领用单-通过id删除")
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_receive:delete")
    @DeleteMapping(value = "/delete")
    public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
        cuttingReceiveService.removeById(id);
        return Result.OK("删除成功!");
    }
    /**
     * æ‰¹é‡åˆ é™¤
     *
     * @param ids
     * @return
     */
    @AutoLog(value = "刀具领用单-批量删除")
    @ApiOperation(value = "刀具领用单-批量删除", notes = "刀具领用单-批量删除")
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_receive:deleteBatch")
    @DeleteMapping(value = "/deleteBatch")
    public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
        this.cuttingReceiveService.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<CuttingReceive> queryById(@RequestParam(name = "id", required = true) String id) {
        CuttingReceive cuttingReceive = cuttingReceiveService.getById(id);
        if (cuttingReceive == null) {
            return Result.error("未找到对应数据");
        }
        return Result.OK(cuttingReceive);
    }
    /**
     * å¯¼å‡ºexcel
     *
     * @param request
     * @param cuttingReceive
     */
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_receive:exportXls")
    @RequestMapping(value = "/exportXls")
    public ModelAndView exportXls(HttpServletRequest request, CuttingReceive cuttingReceive) {
@@ -185,28 +185,28 @@
    }
    /**
      * é€šè¿‡excel导入数据
    *
    * @param request
    * @param response
    * @return
    */
     * é€šè¿‡excel导入数据
     *
     * @param request
     * @param response
     * @return
     */
    //@RequiresPermissions("cms_cutting_receive:importExcel")
    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
        return super.importExcel(request, response, CuttingReceive.class);
    }
     /**
      * æ ¹æ®é¢†ç”¨id查询领用明细
      *
      * @param orderId
      * @return
      */
     @GetMapping("/detailList")
     public Result<?> detailList(@RequestParam("orderId") String orderId) {
         List<Map<String, Object>> list = cuttingReceiveDetailService.detailList(orderId);
         return Result.ok(list);
     }
    /**
     * æ ¹æ®é¢†ç”¨id查询领用明细
     *
     * @param orderId
     * @return
     */
    @GetMapping("/detailList")
    public Result<?> detailList(@RequestParam("orderId") String orderId) {
        List<Map<String, Object>> list = cuttingReceiveDetailService.detailList(orderId);
        return Result.ok(list);
    }
}
src/main/java/org/jeecg/modules/cms/controller/CuttingToolController.java
@@ -40,145 +40,145 @@
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
 /**
/**
 * @Description: åˆ€å…·ä¿¡æ¯
 * @Author: jeecg-boot
 * @Date:   2025-07-28
 * @Date: 2025-07-28
 * @Version: V1.0
 */
@Api(tags="刀具信息")
@Api(tags = "刀具信息")
@RestController
@RequestMapping("/cms/cuttingTool")
@Slf4j
public class CuttingToolController extends JeecgController<CuttingTool, ICuttingToolService> {
    @Autowired
    private ICuttingToolService cuttingToolService;
    @Autowired
    private ICuttingToolService cuttingToolService;
     @Autowired
     private ICuttingPropertiesService cuttingPropertiesService;
    /**
     * åˆ†é¡µåˆ—表查询
     *
     * @param cuttingTool
     * @param pageNo
     * @param pageSize
     * @param req
     * @return
     */
    //@AutoLog(value = "刀具信息-分页列表查询")
    @ApiOperation(value="刀具信息-分页列表查询", notes="刀具信息-分页列表查询")
    @GetMapping(value = "/list")
    public Result<IPage<CuttingTool>> queryPageList(CuttingTool cuttingTool,
                                   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                   HttpServletRequest req) {
        QueryWrapper<CuttingTool> queryWrapper = QueryGenerator.initQueryWrapper(cuttingTool, req.getParameterMap());
        Page<CuttingTool> page = new Page<CuttingTool>(pageNo, pageSize);
        IPage<CuttingTool> pageList = cuttingToolService.page(page, queryWrapper);
        return Result.OK(pageList);
    }
    /**
     *   æ·»åŠ 
     *
     * @param cuttingTool
     * @return
     */
    @AutoLog(value = "刀具信息-添加")
    @ApiOperation(value="刀具信息-添加", notes="刀具信息-添加")
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_tool:add")
    @PostMapping(value = "/add")
    public Result<String> add(@RequestBody CuttingTool cuttingTool) {
        cuttingToolService.save(cuttingTool);
        List<CuttingProperties> cuttingPropertiesList = cuttingTool.getCuttingPropertiesList();
        for (CuttingProperties cuttingProperties : cuttingPropertiesList) {
            cuttingProperties.setCuttingId(cuttingTool.getId());
            cuttingPropertiesService.save(cuttingProperties);
        }
        return Result.OK("添加成功!");
    }
    /**
     *  ç¼–辑
     *
     * @param cuttingTool
     * @return
     */
    @AutoLog(value = "刀具信息-编辑")
    @ApiOperation(value="刀具信息-编辑", notes="刀具信息-编辑")
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_tool:edit")
    @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
    public Result<String> edit(@RequestBody CuttingTool cuttingTool) {
        cuttingToolService.saveOrUpdate(cuttingTool);
        List<String> deletePropertiesIds = cuttingTool.getDeletePropertiesIds();
        if (deletePropertiesIds != null) {
            for (String deletePropertiesId : deletePropertiesIds) {
                cuttingPropertiesService.removeById(deletePropertiesId);
            }
        }
        List<CuttingProperties> cuttingPropertiesList = cuttingTool.getCuttingPropertiesList();
        for (CuttingProperties cuttingProperties : cuttingPropertiesList) {
            cuttingProperties.setCuttingId(cuttingTool.getId());
            cuttingPropertiesService.saveOrUpdate(cuttingProperties);
        }
        return Result.OK("编辑成功!");
    }
    /**
     *   é€šè¿‡id删除
     *
     * @param id
     * @return
     */
    @AutoLog(value = "刀具信息-通过id删除")
    @ApiOperation(value="刀具信息-通过id删除", notes="刀具信息-通过id删除")
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_tool:delete")
    @DeleteMapping(value = "/delete")
    public Result<String> delete(@RequestParam(name="id",required=true) String id) {
        cuttingToolService.removeById(id);
        cuttingPropertiesService.remove(new LambdaQueryWrapper<CuttingProperties>().eq(CuttingProperties::getCuttingId, id));
        return Result.OK("删除成功!");
    }
    /**
     *  æ‰¹é‡åˆ é™¤
     *
     * @param ids
     * @return
     */
    @AutoLog(value = "刀具信息-批量删除")
    @ApiOperation(value="刀具信息-批量删除", notes="刀具信息-批量删除")
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_tool:deleteBatch")
    @DeleteMapping(value = "/deleteBatch")
    public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
        this.cuttingToolService.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<CuttingTool> queryById(@RequestParam(name="id",required=true) String id) {
        CuttingTool cuttingTool = cuttingToolService.getById(id);
        if(cuttingTool==null) {
            return Result.error("未找到对应数据");
        }
        return Result.OK(cuttingTool);
    }
    @Autowired
    private ICuttingPropertiesService cuttingPropertiesService;
    /**
    * å¯¼å‡ºexcel
    *
    * @param request
    * @param cuttingTool
    */
     * åˆ†é¡µåˆ—表查询
     *
     * @param cuttingTool
     * @param pageNo
     * @param pageSize
     * @param req
     * @return
     */
    //@AutoLog(value = "刀具信息-分页列表查询")
    @ApiOperation(value = "刀具信息-分页列表查询", notes = "刀具信息-分页列表查询")
    @GetMapping(value = "/list")
    public Result<IPage<CuttingTool>> queryPageList(CuttingTool cuttingTool,
                                                    @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                    HttpServletRequest req) {
        QueryWrapper<CuttingTool> queryWrapper = QueryGenerator.initQueryWrapper(cuttingTool, req.getParameterMap());
        Page<CuttingTool> page = new Page<CuttingTool>(pageNo, pageSize);
        IPage<CuttingTool> pageList = cuttingToolService.page(page, queryWrapper);
        return Result.OK(pageList);
    }
    /**
     * æ·»åŠ 
     *
     * @param cuttingTool
     * @return
     */
    @AutoLog(value = "刀具信息-添加")
    @ApiOperation(value = "刀具信息-添加", notes = "刀具信息-添加")
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_tool:add")
    @PostMapping(value = "/add")
    public Result<String> add(@RequestBody CuttingTool cuttingTool) {
        cuttingToolService.save(cuttingTool);
        List<CuttingProperties> cuttingPropertiesList = cuttingTool.getCuttingPropertiesList();
        for (CuttingProperties cuttingProperties : cuttingPropertiesList) {
            cuttingProperties.setCuttingId(cuttingTool.getId());
            cuttingPropertiesService.save(cuttingProperties);
        }
        return Result.OK("添加成功!");
    }
    /**
     * ç¼–辑
     *
     * @param cuttingTool
     * @return
     */
    @AutoLog(value = "刀具信息-编辑")
    @ApiOperation(value = "刀具信息-编辑", notes = "刀具信息-编辑")
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_tool:edit")
    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
    public Result<String> edit(@RequestBody CuttingTool cuttingTool) {
        cuttingToolService.saveOrUpdate(cuttingTool);
        List<String> deletePropertiesIds = cuttingTool.getDeletePropertiesIds();
        if (deletePropertiesIds != null) {
            for (String deletePropertiesId : deletePropertiesIds) {
                cuttingPropertiesService.removeById(deletePropertiesId);
            }
        }
        List<CuttingProperties> cuttingPropertiesList = cuttingTool.getCuttingPropertiesList();
        for (CuttingProperties cuttingProperties : cuttingPropertiesList) {
            cuttingProperties.setCuttingId(cuttingTool.getId());
            cuttingPropertiesService.saveOrUpdate(cuttingProperties);
        }
        return Result.OK("编辑成功!");
    }
    /**
     * é€šè¿‡id删除
     *
     * @param id
     * @return
     */
    @AutoLog(value = "刀具信息-通过id删除")
    @ApiOperation(value = "刀具信息-通过id删除", notes = "刀具信息-通过id删除")
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_tool:delete")
    @DeleteMapping(value = "/delete")
    public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
        cuttingToolService.removeById(id);
        cuttingPropertiesService.remove(new LambdaQueryWrapper<CuttingProperties>().eq(CuttingProperties::getCuttingId, id));
        return Result.OK("删除成功!");
    }
    /**
     * æ‰¹é‡åˆ é™¤
     *
     * @param ids
     * @return
     */
    @AutoLog(value = "刀具信息-批量删除")
    @ApiOperation(value = "刀具信息-批量删除", notes = "刀具信息-批量删除")
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_tool:deleteBatch")
    @DeleteMapping(value = "/deleteBatch")
    public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
        this.cuttingToolService.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<CuttingTool> queryById(@RequestParam(name = "id", required = true) String id) {
        CuttingTool cuttingTool = cuttingToolService.getById(id);
        if (cuttingTool == null) {
            return Result.error("未找到对应数据");
        }
        return Result.OK(cuttingTool);
    }
    /**
     * å¯¼å‡ºexcel
     *
     * @param request
     * @param cuttingTool
     */
    //@RequiresPermissions("org.jeecg.modules:cms_cutting_tool:exportXls")
    @RequestMapping(value = "/exportXls")
    public ModelAndView exportXls(HttpServletRequest request, CuttingTool cuttingTool) {
@@ -186,30 +186,30 @@
    }
    /**
      * é€šè¿‡excel导入数据
    *
    * @param request
    * @param response
    * @return
    */
     * é€šè¿‡excel导入数据
     *
     * @param request
     * @param response
     * @return
     */
    //@RequiresPermissions("cms_cutting_tool:importExcel")
    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
        return super.importExcel(request, response, CuttingTool.class);
    }
     @GetMapping(value = "/getCuttingToolList")
     public Result<?> getCuttingToolList(@RequestParam("pageNo") Integer pageNo,
                                       @RequestParam("pageSize") Integer pageSize,
                                       @RequestParam Map<String, Object> params) {
         IPage<Map<String, Object>> cuttingToolList = cuttingToolService.getCuttingToolList(pageNo, pageSize, params);
         for (Map<String, Object> record : cuttingToolList.getRecords()) {
             String cuttingId = (String) record.get("id");
             List<CuttingProperties> cuttingPropertiesList = cuttingPropertiesService.selectListByCuttingId(cuttingId);
             record.put("cuttingPropertiesList", cuttingPropertiesList);
         }
         return Result.ok(cuttingToolList);
     }
    //选择刀具的接口
    @GetMapping(value = "/getCuttingToolList")
    public Result<?> getCuttingToolList(@RequestParam("pageNo") Integer pageNo,
                                        @RequestParam("pageSize") Integer pageSize,
                                        @RequestParam Map<String, Object> params) {
        IPage<Map<String, Object>> cuttingToolList = cuttingToolService.getCuttingToolList(pageNo, pageSize, params);
        for (Map<String, Object> record : cuttingToolList.getRecords()) {
            String cuttingId = (String) record.get("id");
            List<CuttingProperties> cuttingPropertiesList = cuttingPropertiesService.selectListByCuttingId(cuttingId);
            record.put("cuttingPropertiesList", cuttingPropertiesList);
        }
        return Result.ok(cuttingToolList);
    }
}
src/main/java/org/jeecg/modules/cms/entity/CuttingInventory.java
@@ -4,10 +4,8 @@
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
@@ -57,6 +55,9 @@
    @ApiModelProperty(value = "刀具ID")
    @Dict(dictTable = "cms_cutting_tool",dicCode="id",dicText = "cutting_code")
    private String cuttingId;
    @TableField(exist = false) // è¡¨ç¤ºè¿™ä¸æ˜¯æ•°æ®åº“字段
    private String cuttingCode;
    /**刀具条码*/
    @Excel(name = "刀具条码", width = 15)
    @ApiModelProperty(value = "刀具条码")
@@ -69,4 +70,11 @@
    @Excel(name = "当前寿命(百分比)", width = 15)
    @ApiModelProperty(value = "当前寿命(百分比)")
    private BigDecimal currentLife;
    // åœ¨CuttingInventory实体类中添加
    @TableField(exist = false) // è¡¨ç¤ºè¿™ä¸æ˜¯æ•°æ®åº“字段
    private String cuttingIdSearch;
    @TableField(exist = false) // è¡¨ç¤ºè¿™ä¸æ˜¯æ•°æ®åº“字段
    private String cuttingBarcodeSearch;
}
src/main/java/org/jeecg/modules/cms/mapper/CuttingReceiveDetailMapper.java
@@ -15,5 +15,5 @@
 */
public interface CuttingReceiveDetailMapper extends BaseMapper<CuttingReceiveDetail> {
    public List<Map<String, Object>> detailList(@Param("orderId") String orderId);
    List<Map<String, Object>> detailList(@Param("orderId") String orderId);
}
src/main/java/org/jeecg/modules/cms/service/ICuttingInboundService.java
@@ -15,4 +15,6 @@
 */
public interface ICuttingInboundService extends IService<CuttingInbound> {
    Result<?> importExcelData(List<CuttingInboundExportVo> list);
    Result<?> submit(String orderId);
}
src/main/java/org/jeecg/modules/cms/service/ICuttingReceiveDetailService.java
@@ -7,6 +7,7 @@
import java.util.Map;
/**
 *
 * @Description: é¢†ç”¨å•明细
 * @Author: jeecg-boot
 * @Date:   2025-07-28
@@ -14,5 +15,5 @@
 */
public interface ICuttingReceiveDetailService extends IService<CuttingReceiveDetail> {
    public List<Map<String, Object>> detailList(String orderId);
    List<Map<String, Object>> detailList(String orderId);
}
src/main/java/org/jeecg/modules/cms/service/impl/CuttingInboundServiceImpl.java
@@ -1,17 +1,25 @@
package org.jeecg.modules.cms.service.impl;
import io.micrometer.core.annotation.Timed;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
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.mapper.CuttingInboundMapper;
import org.jeecg.modules.cms.service.ICuttingInboundInventoryService;
import org.jeecg.modules.cms.service.ICuttingInboundService;
import org.jeecg.modules.cms.service.ICuttingInboundDetailService;
import org.jeecg.modules.cms.service.ICuttingInventoryService;
import org.jeecg.modules.cms.vo.CuttingInboundExportVo;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
@@ -22,10 +30,18 @@
 * @Date:   2025-07-28
 * @Version: V1.0
 */
@Slf4j
@Service
public class CuttingInboundServiceImpl extends ServiceImpl<CuttingInboundMapper, CuttingInbound> implements ICuttingInboundService {
    @Autowired
    private ICuttingInboundDetailService cuttingInboundDetailService; // æ³¨å…¥ä»Žè¡¨æœåŠ¡
    @Autowired
    private ICuttingInventoryService cuttingInventoryService;
    @Autowired
    private ICuttingInboundInventoryService cuttingInboundInventoryService;
    /**
     * é€šè¿‡Excel导入刀具入库单数据
     *
@@ -35,39 +51,7 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Result<?> importExcelData(List<CuttingInboundExportVo> list) {
//        try {
//            for (CuttingInboundExportVo exportVo : list) {
//                // ä¿å­˜ä¸»è¡¨æ•°æ®
//                CuttingInbound cuttingInbound = new CuttingInbound();
//                cuttingInbound.setReceiver(exportVo.getReceiver());
//                cuttingInbound.setReceiveTime(exportVo.getReceiveTime());
//                cuttingInbound.setReceiveComment(exportVo.getReceiveComment());
//                cuttingInbound.setConfirmer(exportVo.getConfirmer());
//                cuttingInbound.setConfirmTime(exportVo.getConfirmTime());
//                cuttingInbound.setConfirmComment(exportVo.getConfirmComment());
//                cuttingInbound.setOrderStatus(exportVo.getOrderStatus());
//
//                // ä¿å­˜ä¸»è¡¨æ•°æ®ä»¥èŽ·å–ID
//                this.save(cuttingInbound);
//
//                // èŽ·å–ä¸»è¡¨ID
//                String orderId = cuttingInbound.getId();
//
//                // å¤„理从表数据
//                List<CuttingInboundDetail> detailList = exportVo.getDetailList();
//                if (detailList != null && !detailList.isEmpty()) {
//                    for (CuttingInboundDetail detail : detailList) {
//                        detail.setOrderId(orderId); // è®¾ç½®å¤–键关联
//                        cuttingInboundDetailService.save(detail);
//                    }
//                }
//            }
//            return Result.ok("导入成功");
//        } catch (Exception e) {
//            log.error("导入失败", e);
//            return Result.error("导入失败: " + e.getMessage());
//        }
//    }
        for (CuttingInboundExportVo exportVo : list) {
            // ä¿å­˜ä¸»è¡¨æ•°æ®
            CuttingInbound cuttingInbound = new CuttingInbound();
@@ -96,4 +80,88 @@
        }
        return Result.ok("导入成功");
    }
    /*
     * ç”Ÿæˆå”¯ä¸€æ¡ç çš„æ–¹æ³•(确定编码生成规则后在此处重写)
     */
    private String generateUniqueBarcode(String cuttingId, int index) {
        // æ¡ç ç”Ÿæˆè§„则示例:刀具ID + åºå·(4位) + éšæœºæ•°
        return cuttingId + String.format("%04d", index + 1) + (int) (Math.random() * 10000);
    }
    @Override
    @Timed(value = "cutting.inbound.submit", description = "刀具入库提交耗时")
    public synchronized Result<?> submit(String orderId) {
        long startTime = System.currentTimeMillis();
        try {
            // 1. æ›´æ–°å…¥åº“单状态
            CuttingInbound cuttingInbound = this.getById(orderId);
            if (cuttingInbound == null) {
                return Result.error("未找到对应的入库单");
            }
            // æ£€æŸ¥å…¥åº“单状态,只允许状态为"1"的入库单提交
            if (!"1".equals(cuttingInbound.getOrderStatus())) {
                return Result.error("只有状态为未提交的入库单才能执行提交操作");
            }
            cuttingInbound.setOrderStatus("2");
            boolean updateResult = this.updateById(cuttingInbound);
            if (!updateResult) {
                return Result.error("更新入库单状态失败,可能已被其他用户处理");
            }
            // 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("正常");
                    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("刀具入库提交完成,耗时: {} ms", (endTime - startTime));
            return Result.ok("提交成功");
        } catch (Exception e) {
            long endTime = System.currentTimeMillis();
            log.error("提交入库单失败,orderId: " + orderId + ",耗时: " + (endTime - startTime) + " ms", e);
            return Result.error("提交失败: " + e.getMessage());
        }
    }
}
src/main/java/org/jeecg/modules/lsw/controller/LswMaterialController.java
@@ -8,6 +8,7 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.constant.CommonConstant;
@@ -23,6 +24,8 @@
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
@@ -167,8 +170,12 @@
    @ApiOperation(value = "线边库物料信息-根据物料类型查询", notes = "线边库物料信息-根据物料类型查询")
    @GetMapping(value = "/queryByMaterialCategory")
    public Result<List<LswMaterial>> queryByMaterialCategory(@RequestParam("materialCategory") String materialCategory) {
        if (StringUtils.isBlank(materialCategory)) {
            return Result.ok(Collections.emptyList());
        }
        String[] split = materialCategory.split(",");
        LambdaQueryWrapper<LswMaterial> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(LswMaterial::getMaterialCategory, materialCategory);
        queryWrapper.in(LswMaterial::getMaterialCategory, Arrays.asList(split));
        queryWrapper.eq(LswMaterial::getDelFlag, CommonConstant.DEL_FLAG_0);
        queryWrapper.eq(LswMaterial::getMaterialStatus, CommonConstant.STATUS_1);
        queryWrapper.orderByAsc(LswMaterial::getMaterialNumber);
src/main/java/org/jeecg/modules/lsw/controller/LswMaterialInboundController.java
@@ -6,11 +6,12 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
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.lsw.entity.LswMaterial;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.lsw.entity.LswMaterialInbound;
import org.jeecg.modules.lsw.service.ILswMaterialInboundService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -66,11 +67,21 @@
    */
   @AutoLog(value = "物料入库单-添加")
   @ApiOperation(value="物料入库单-添加", notes="物料入库单-添加")
   //@RequiresPermissions("org.jeecg.modules:lsw_material_inbound:add")
   @PostMapping(value = "/add")
   public Result<String> add(@RequestBody LswMaterialInbound lswMaterialInbound) {
       lswMaterialInboundService.save(lswMaterialInbound);
       return Result.OK("添加成功!");
       if(lswMaterialInbound == null){
           return Result.error("入库信息不能为空!");
       }
       LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
       if(sysUser == null){
           return Result.error("用户信息获取失败!");
       }
       lswMaterialInbound.setReceiver(sysUser.getUsername());
       boolean b = lswMaterialInboundService.inboundMaterial(lswMaterialInbound);
       if(!b) {
           return Result.error("入库失败!");
       }
       return Result.OK("入库成功!");
   }
   /**
src/main/java/org/jeecg/modules/lsw/controller/LswMaterialOutboundController.java
@@ -7,164 +7,50 @@
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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.lsw.entity.LswMaterialInbound;
import org.jeecg.modules.lsw.entity.LswMaterialOutbound;
import org.jeecg.modules.lsw.service.ILswMaterialOutboundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Map;
/**
* @Description: ç‰©æ–™å‡ºåº“单
* @Author: jeecg-boot
* @Date:   2025-06-30
* @Version: V1.0
*/
@Api(tags="物料出库单")
 * @Description: ç‰©æ–™å‡ºåº“单
 * @Author: jeecg-boot
 * @Date: 2025-06-30
 * @Version: V1.0
 */
@Api(tags = "物料出库单")
@RestController
@RequestMapping("/lswmaterialoutbound/lswMaterialOutbound")
@RequestMapping("/lsw/materialOutbound")
@Slf4j
public class LswMaterialOutboundController extends JeecgController<LswMaterialOutbound, ILswMaterialOutboundService> {
   @Autowired
   private ILswMaterialOutboundService lswMaterialOutboundService;
    @Autowired
    private ILswMaterialOutboundService lswMaterialOutboundService;
   /**
    * åˆ†é¡µåˆ—表查询
    *
    * @param lswMaterialOutbound
    * @param pageNo
    * @param pageSize
    * @param req
    * @return
    */
   //@AutoLog(value = "物料出库单-分页列表查询")
   @ApiOperation(value="物料出库单-分页列表查询", notes="物料出库单-分页列表查询")
   @GetMapping(value = "/list")
   public Result<IPage<LswMaterialOutbound>> queryPageList(LswMaterialOutbound lswMaterialOutbound,
                                  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                  HttpServletRequest req) {
       QueryWrapper<LswMaterialOutbound> queryWrapper = QueryGenerator.initQueryWrapper(lswMaterialOutbound, req.getParameterMap());
       Page<LswMaterialOutbound> page = new Page<LswMaterialOutbound>(pageNo, pageSize);
       IPage<LswMaterialOutbound> pageList = lswMaterialOutboundService.page(page, queryWrapper);
       return Result.OK(pageList);
   }
   /**
    *   æ·»åŠ 
    *
    * @param lswMaterialOutbound
    * @return
    */
   @AutoLog(value = "物料出库单-添加")
   @ApiOperation(value="物料出库单-添加", notes="物料出库单-添加")
   //@RequiresPermissions("org.jeecg.modules:lsw_material_outbound:add")
   @PostMapping(value = "/add")
   public Result<String> add(@RequestBody LswMaterialOutbound lswMaterialOutbound) {
       lswMaterialOutboundService.save(lswMaterialOutbound);
       return Result.OK("添加成功!");
   }
   /**
    *  ç¼–辑
    *
    * @param lswMaterialOutbound
    * @return
    */
   @AutoLog(value = "物料出库单-编辑")
   @ApiOperation(value="物料出库单-编辑", notes="物料出库单-编辑")
   //@RequiresPermissions("org.jeecg.modules:lsw_material_outbound:edit")
   @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
   public Result<String> edit(@RequestBody LswMaterialOutbound lswMaterialOutbound) {
       lswMaterialOutboundService.updateById(lswMaterialOutbound);
       return Result.OK("编辑成功!");
   }
   /**
    *   é€šè¿‡id删除
    *
    * @param id
    * @return
    */
   @AutoLog(value = "物料出库单-通过id删除")
   @ApiOperation(value="物料出库单-通过id删除", notes="物料出库单-通过id删除")
   //@RequiresPermissions("org.jeecg.modules:lsw_material_outbound:delete")
   @DeleteMapping(value = "/delete")
   public Result<String> delete(@RequestParam(name="id",required=true) String id) {
       lswMaterialOutboundService.removeById(id);
       return Result.OK("删除成功!");
   }
   /**
    *  æ‰¹é‡åˆ é™¤
    *
    * @param ids
    * @return
    */
   @AutoLog(value = "物料出库单-批量删除")
   @ApiOperation(value="物料出库单-批量删除", notes="物料出库单-批量删除")
   //@RequiresPermissions("org.jeecg.modules:lsw_material_outbound:deleteBatch")
   @DeleteMapping(value = "/deleteBatch")
   public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
       this.lswMaterialOutboundService.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<LswMaterialOutbound> queryById(@RequestParam(name="id",required=true) String id) {
       LswMaterialOutbound lswMaterialOutbound = lswMaterialOutboundService.getById(id);
       if(lswMaterialOutbound==null) {
           return Result.error("未找到对应数据");
       }
       return Result.OK(lswMaterialOutbound);
   }
   /**
   * å¯¼å‡ºexcel
   *
   * @param request
   * @param lswMaterialOutbound
   */
   //@RequiresPermissions("org.jeecg.modules:lsw_material_outbound:exportXls")
   @RequestMapping(value = "/exportXls")
   public ModelAndView exportXls(HttpServletRequest request, LswMaterialOutbound lswMaterialOutbound) {
       return super.exportXls(request, lswMaterialOutbound, LswMaterialOutbound.class, "物料出库单");
   }
   /**
     * é€šè¿‡excel导入数据
   *
   * @param request
   * @param response
   * @return
   */
   //@RequiresPermissions("lsw_material_outbound:importExcel")
   @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
   public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
       return super.importExcel(request, response, LswMaterialOutbound.class);
   }
    @GetMapping(value = "/searchlikeQuery")
    public Result<?> searchlikeQuery(LswMaterialOutbound lswMaterialOutbound,
                                     @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                     @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                     HttpServletRequest req){
        IPage<Map<String, Object>> pageList = lswMaterialOutboundService.getlswMaterialOutboundListData(pageNo,pageSize,req);
    /**
     * åˆ†é¡µåˆ—表查询
     *
     * @param lswMaterialOutbound
     * @param pageNo
     * @param pageSize
     * @param req
     * @return
     */
    @ApiOperation(value = "物料出库单-分页列表查询", notes = "物料出库单-分页列表查询")
    @GetMapping(value = "/list")
    public Result<IPage<LswMaterialOutbound>> queryPageList(LswMaterialOutbound lswMaterialOutbound,
                                                            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                            HttpServletRequest req) {
        QueryWrapper<LswMaterialOutbound> queryWrapper = QueryGenerator.initQueryWrapper(lswMaterialOutbound, req.getParameterMap());
        Page<LswMaterialOutbound> page = new Page<LswMaterialOutbound>(pageNo, pageSize);
        IPage<LswMaterialOutbound> pageList = lswMaterialOutboundService.page(page, queryWrapper);
        return Result.OK(pageList);
    }
src/main/java/org/jeecg/modules/lsw/entity/LswMaterialInbound.java
@@ -97,6 +97,7 @@
    /**接收人*/
    @Excel(name = "接收人", width = 15)
    @ApiModelProperty(value = "接收人")
    @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname")
    private String receiver;
    /**接收时间*/
    @Excel(name = "接收时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
src/main/java/org/jeecg/modules/lsw/entity/LswMaterialInventory.java
@@ -1,7 +1,6 @@
package org.jeecg.modules.lsw.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
@@ -9,12 +8,10 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.modules.lsw.enums.MaterialInventoryStatusEnum;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@@ -43,14 +40,6 @@
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建日期")
    private Date createTime;
    /**更新人*/
    @ApiModelProperty(value = "更新人")
    private String updateBy;
    /**更新日期*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新日期")
    private Date updateTime;
    /**物料ID*/
    @ApiModelProperty(value = "物料ID")
    private String materialId;
@@ -80,16 +69,17 @@
    /**热处理标识*/
    @Excel(name = "热处理标识", width = 15)
    @ApiModelProperty(value = "热处理标识")
    private String heatTreatmentFlag = CommonConstant.STATUS_0;
    private String heatTreatmentFlag;
    public LswMaterialInventory(){}
    public LswMaterialInventory(LswMaterialInbound inbound, String materialId, String inventoryCategory) {
    public LswMaterialInventory(LswMaterialInbound inbound, String materialId, String inventoryCategory, String heatTreatmentFlag) {
        this.warehouseId = inbound.getWarehouseId();
        this.quantity = inbound.getQuantity();
        this.batchNumber = inbound.getBatchNumber();
        this.inventoryStatus = MaterialInventoryStatusEnum.NORMAL.name();
        this.inventoryCategory = inventoryCategory;
        this.materialId = materialId;
        this.heatTreatmentFlag = heatTreatmentFlag;
    }
}
src/main/java/org/jeecg/modules/lsw/entity/LswMaterialOutbound.java
@@ -68,7 +68,6 @@
    /**产线ID*/
    @Excel(name = "产线ID", width = 15)
    @ApiModelProperty(value = "产线ID")
    @Dict(dictTable = "base_factory", dicCode = "id", dicText = "factory_name")
    private String factoryId;
    /**库存ID*/
    @Excel(name = "库存ID", width = 15)
@@ -77,6 +76,7 @@
    /**线边库ID*/
    @Excel(name = "线边库ID", width = 15)
    @ApiModelProperty(value = "线边库ID")
    @Dict(dictTable = "base_line_side_warehouse", dicCode = "id", dicText = "warehouse_name")
    private String warehouseId;
    /**批次号*/
    @Excel(name = "批次号", width = 15)
@@ -85,6 +85,7 @@
    /**出库人*/
    @Excel(name = "出库人", width = 15)
    @ApiModelProperty(value = "出库人")
    @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname")
    private String outboundStaff;
    /**出库时间*/
    @Excel(name = "出库时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@@ -96,4 +97,9 @@
    @Excel(name = "出库数量", width = 15)
    @ApiModelProperty(value = "出库数量")
    private BigDecimal quantity;
    /**出库类型*/
    @Excel(name = "出库类型", width = 15)
    @ApiModelProperty(value = "出库类型")
    @Dict(dicCode = "material_outbound_category")
    private String outboundCategory;
}
src/main/java/org/jeecg/modules/lsw/enums/MaterialInboundCategory.java
@@ -5,6 +5,7 @@
    PRODUCTION_INBOUND,//生产下线
    HEAT_TREATMENT_INBOUND,//热处理
    SMALL_INNER_RING,//小内圈
    MATERIAL_INNER_TRANSFER //内部调拨
    MATERIAL_INNER_TRANSFER, //内部调拨
    PRODUCTION_UNLOADING, //下料
    ;
}
src/main/java/org/jeecg/modules/lsw/enums/MaterialInventoryCategoryEnum.java
@@ -3,5 +3,6 @@
public enum MaterialInventoryCategoryEnum {
    INBOUND, //入库
    UNLOADING, //下料
    TRANSFER, //调拨
    ;
}
src/main/java/org/jeecg/modules/lsw/enums/MaterialOutboundCategory.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
package org.jeecg.modules.lsw.enums;
public enum MaterialOutboundCategory {
    MATERIAL_LOADING, //上料
    WAREHOUSE_TRANSFER, //移库
    MATERIAL_INNER_TRANSFER, //内部调拨
    ;
}
src/main/java/org/jeecg/modules/lsw/service/ILswMaterialInventoryService.java
@@ -10,17 +10,26 @@
/**
 * @Description: ç‰©æ–™åº“存信息
 * @Author: jeecg-boot
 * @Date:   2025-06-30
 * @Date: 2025-06-30
 * @Version: V1.0
 */
public interface ILswMaterialInventoryService extends IService<LswMaterialInventory> {
    /** é€šè¿‡ç‰©æ–™ç¼–码和线边库id查询物料库存 */
    /** é€šè¿‡ç‰©æ–™ç¼–码和线边库id查询物料库存 */
    List<LswMaterialInventoryVo> selectLineSideMaterialInventoryByMaterialNumber(List<String> bomMaterialNumberList, String factoryId);
    /**
     * åº“存统计
     * @param materialId ç‰©æ–™ID
     * @return
     */
    /**
     * åº“存统计
     * @param materialId ç‰©æ–™ID
     * @return
     */
    List<MaterialInventoryStatisticsVO> statisticsInventory(String materialId);
    /**
     * æŸ¥è¯¢æœªå‡ºåº“信息
     * @param materialNumber
     * @param batchNumber
     * @param warehouseId
     * @return
     */
    LswMaterialInventory queryByMaterialNumberAndBatchNumber(String materialNumber, String batchNumber, String warehouseId);
}
src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialInboundServiceImpl.java
@@ -5,12 +5,20 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.modules.base.entity.LineSideWarehouse;
import org.jeecg.modules.base.service.ILineSideWarehouseService;
import org.jeecg.modules.lsw.entity.LswMaterial;
import org.jeecg.modules.lsw.entity.LswMaterialInbound;
import org.jeecg.modules.lsw.entity.LswMaterialInventory;
import org.jeecg.modules.lsw.entity.LswMaterialOutbound;
import org.jeecg.modules.lsw.enums.MaterialInboundCategory;
import org.jeecg.modules.lsw.enums.MaterialInventoryCategoryEnum;
import org.jeecg.modules.lsw.enums.MaterialOutboundCategory;
import org.jeecg.modules.lsw.mapper.LswMaterialInboundMapper;
import org.jeecg.modules.lsw.service.ILswMaterialInboundService;
import org.jeecg.modules.lsw.service.ILswMaterialInventoryService;
import org.jeecg.modules.lsw.service.ILswMaterialOutboundService;
import org.jeecg.modules.lsw.service.ILswMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -33,6 +41,10 @@
    private ILswMaterialInventoryService inventoryService;
    @Autowired
    private ILswMaterialService materialService;
    @Autowired
    private ILineSideWarehouseService lineSideWarehouseService;
    @Autowired
    private ILswMaterialOutboundService materialOutboundService;
    @Override
    public IPage<Map<String, Object>> getlswMaterialInboundListData(Integer pageNo, Integer pageSize, HttpServletRequest req) {
@@ -60,20 +72,67 @@
                || StringUtils.isBlank(materialInbound.getFactoryId())
                || StringUtils.isBlank(materialInbound.getWarehouseId())
                || materialInbound.getQuantity() == null
                || materialInbound.getQuantity().intValue() > 0
                || StringUtils.isBlank(materialInbound.getBatchNumber())) {
            return false;
                || materialInbound.getQuantity().intValue() < 1
                || StringUtils.isBlank(materialInbound.getBatchNumber())
                || StringUtils.isBlank(materialInbound.getOriginalCode())
                || StringUtils.isBlank(materialInbound.getOriginalName())
                || StringUtils.isBlank(materialInbound.getInboundCategory())) {
            throw new JeecgBootException("参数错误!");
        }
        LswMaterial material = materialService.queryByMaterialNumber(materialInbound.getMaterialNumber());
        if(material == null) {
            return false;
        if (material == null) {
            throw new JeecgBootException("物料编号不存在!");
        }
        LineSideWarehouse warehouse = lineSideWarehouseService.getById(materialInbound.getWarehouseId());
        if (warehouse == null) {
            throw new JeecgBootException("线边库不存在!");
        }
        String heatTreatmentFlag = CommonConstant.STATUS_0;
        if (materialInbound.getInboundCategory().equals(MaterialInboundCategory.HEAT_TREATMENT_INBOUND.name())) {
            heatTreatmentFlag = CommonConstant.STATUS_1;
        }
        //库存类型
        String inventoryCategory = MaterialInventoryCategoryEnum.INBOUND.name();
        if (materialInbound.getInboundCategory().equals(MaterialInboundCategory.MATERIAL_INNER_TRANSFER.name())) {
            inventoryCategory = MaterialInventoryCategoryEnum.TRANSFER.name();
            //查询来源线边库
            LineSideWarehouse lineSideWarehouse = lineSideWarehouseService.queryByWarehouseCode(materialInbound.getOriginalCode());
            if (lineSideWarehouse == null) {
                throw new JeecgBootException("未找到来源线边库!");
            }
            //调拨 å‡ºåº“原始库存
            LswMaterialInventory originalInventory = inventoryService.queryByMaterialNumberAndBatchNumber(materialInbound.getMaterialNumber(), materialInbound.getBatchNumber(), lineSideWarehouse.getId());
            if (originalInventory == null) {
                throw new JeecgBootException("未找到来源线边库库存!");
            }
            if (materialInbound.getQuantity().compareTo(originalInventory.getQuantity()) != 0) {
                throw new JeecgBootException("调拨数量需要等于来源库存数量!");
            }
            //出库信息
            LswMaterialOutbound outbound = new LswMaterialOutbound();
            outbound.setWarehouseId(lineSideWarehouse.getId());
            outbound.setFactoryId(lineSideWarehouse.getFactoryId());
            outbound.setOutboundStaff(materialInbound.getReceiver());
            outbound.setMaterialName(materialInbound.getMaterialName());
            outbound.setMaterialNumber(materialInbound.getMaterialNumber());
            outbound.setQuantity(originalInventory.getQuantity());
            outbound.setBatchNumber(originalInventory.getBatchNumber());
            outbound.setInventoryId(originalInventory.getId());
            outbound.setOutboundCategory(MaterialOutboundCategory.MATERIAL_INNER_TRANSFER.name());
            //调拨出库
            boolean b = materialOutboundService.outboundMaterial(outbound);
            if (!b) {
                throw new JeecgBootException("调拨出库失败!");
            }
        } else if (materialInbound.getInboundCategory().equals(MaterialInboundCategory.PRODUCTION_UNLOADING.name())) {
            inventoryCategory = MaterialInventoryCategoryEnum.UNLOADING.name();
        }
        //保存入库信息
        materialInbound.setDelFlag(CommonConstant.DEL_FLAG_0);
        materialInbound.setReceiveTime(new Date());
        super.save(materialInbound);
        //保存库存信息
        LswMaterialInventory lswMaterialInventory = new LswMaterialInventory(materialInbound, material.getId(), material.getMaterialCategory());
        LswMaterialInventory lswMaterialInventory = new LswMaterialInventory(materialInbound, material.getId(), inventoryCategory, heatTreatmentFlag);
        inventoryService.save(lswMaterialInventory);
        return true;
    }
src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialInventoryServiceImpl.java
@@ -1,36 +1,55 @@
package org.jeecg.modules.lsw.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.lsw.entity.LswMaterial;
import org.jeecg.modules.lsw.entity.LswMaterialInventory;
import org.jeecg.modules.lsw.enums.MaterialInventoryStatusEnum;
import org.jeecg.modules.lsw.mapper.LswMaterialInventoryMapper;
import org.jeecg.modules.lsw.service.ILswMaterialInventoryService;
import org.jeecg.modules.lsw.service.ILswMaterialService;
import org.jeecg.modules.lsw.vo.LswMaterialInventoryVo;
import org.jeecg.modules.lsw.vo.MaterialInventoryStatisticsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
/**
 * @Description: ç‰©æ–™åº“存信息
 * @Author: jeecg-boot
 * @Date:   2025-06-30
 * @Date: 2025-06-30
 * @Version: V1.0
 */
@Service
public class LswMaterialInventoryServiceImpl extends ServiceImpl<LswMaterialInventoryMapper, LswMaterialInventory> implements ILswMaterialInventoryService {
    @Autowired
    private LswMaterialInventoryMapper lswMaterialInventoryMapper;
    @Autowired
    private LswMaterialInventoryMapper lswMaterialInventoryMapper;
    @Autowired
    private ILswMaterialService materialService;
    @Override
    public List<LswMaterialInventoryVo> selectLineSideMaterialInventoryByMaterialNumber(List<String> bomMaterialNumberList, String factoryId) {
        return lswMaterialInventoryMapper.selectLineSideMaterialInventoryByMaterialNumber(bomMaterialNumberList, factoryId);
        return lswMaterialInventoryMapper.selectLineSideMaterialInventoryByMaterialNumber(bomMaterialNumberList, factoryId);
    }
    @Override
    public List<MaterialInventoryStatisticsVO> statisticsInventory(String materialId) {
        return lswMaterialInventoryMapper.statisticsInventory(materialId);
    }
    @Override
    public List<MaterialInventoryStatisticsVO> statisticsInventory(String materialId) {
        return lswMaterialInventoryMapper.statisticsInventory(materialId);
    }
    @Override
    public LswMaterialInventory queryByMaterialNumberAndBatchNumber(String materialNumber, String batchNumber, String warehouseId) {
        LswMaterial material = materialService.queryByMaterialNumber(materialNumber);
        if (material == null) {
            return null;
        }
        LambdaQueryWrapper<LswMaterialInventory> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(LswMaterialInventory::getWarehouseId, warehouseId);
        queryWrapper.eq(LswMaterialInventory::getMaterialId, material.getId());
        queryWrapper.eq(LswMaterialInventory::getBatchNumber, batchNumber);
        queryWrapper.eq(LswMaterialInventory::getInventoryStatus, MaterialInventoryStatusEnum.NORMAL.name());
        return lswMaterialInventoryMapper.selectOne(queryWrapper);
    }
}
src/main/java/org/jeecg/modules/lsw/service/impl/LswMaterialOutboundServiceImpl.java
@@ -62,13 +62,13 @@
                || StringUtils.isBlank(outbound.getFactoryId())
                || StringUtils.isBlank(outbound.getWarehouseId())
                || outbound.getQuantity() == null
                || outbound.getQuantity().intValue() > 0
                || outbound.getQuantity().intValue() < 1
                || StringUtils.isBlank(outbound.getBatchNumber())
        || StringUtils.isBlank(outbound.getInventoryId())) {
                || StringUtils.isBlank(outbound.getInventoryId())) {
            return false;
        }
        LswMaterialInventory inventory = materialInventoryService.getById(outbound.getInventoryId());
        if(inventory == null) {
        if (inventory == null) {
            return false;
        }
        //更新库存状态
src/main/java/org/jeecg/modules/wms/config/WebServiceServerConfig.java
@@ -1,7 +1,6 @@
package org.jeecg.modules.wms.config;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.jeecg.modules.wms.service.MESWebServiceSoap;
@@ -16,12 +15,9 @@
@Configuration
public class WebServiceServerConfig {
    @Autowired
    private MESWebServiceSoap webServiceSoap;
    @Bean(name = Bus.DEFAULT_BUS_ID)
    public Bus springBus() {
        return new SpringBus();
    }
    private Bus bus;
    @Autowired
    private MESWebServiceSoap mesWebServiceSoap;
    @Bean(name = "cxfServlet")  // æ³¨å…¥servlet bean name不能dispatcherServlet ,否则会覆盖dispatcherServlet
    public ServletRegistrationBean<CXFServlet> cxfServlet() {
@@ -31,9 +27,10 @@
    @Bean
    public Endpoint endpoint() {
        // å‚数二,是SEI实现类对象
        Endpoint endpoint = new EndpointImpl(this.springBus(), webServiceSoap);
        Endpoint endpoint = new EndpointImpl(bus, mesWebServiceSoap);
        // å‘布服务
        endpoint.publish("/MESWebService");
        return endpoint;
    }
}
src/main/java/org/jeecg/modules/wms/controller/WMSTestController.java
@@ -5,7 +5,7 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.wms.dto.WSResponse;
import org.jeecg.modules.wms.dto.MESResponse;
import org.jeecg.modules.wms.request.*;
import org.jeecg.modules.wms.service.MESWebServiceSoap;
import org.jeecg.modules.wms.service.WMSWebServiceClient;
@@ -35,7 +35,7 @@
        MESWebServiceSoap service = (MESWebServiceSoap) factory.create();
        ReceiveWMSScanItemList request = new ReceiveWMSScanItemList();
        request.setWmsWebServiceSendItemList(list);
        WSResponse response = service.receiveWMSScanItemList(request);
        MESResponse response = service.receiveWMSScanItemList(request);
        return Result.ok(response);
    }
src/main/java/org/jeecg/modules/wms/dto/MESResponse.java
@@ -11,13 +11,13 @@
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "WSResponse",  propOrder = {
@XmlType(name = "MESResponse",  propOrder = {
        "errorCode",
        "errorDesc"
})
}, namespace = "http://xhj008.server.webservice.com/")
public class MESResponse {
    @XmlElement(name = "ErrorCode")
    @XmlElement(name = "ErrorCode", namespace = "http://xhj008.server.webservice.com/")
    protected String errorCode;
    @XmlElement(name = "ErrorDesc")
    @XmlElement(name = "ErrorDesc", namespace = "http://xhj008.server.webservice.com/")
    protected String errorDesc;
}
src/main/java/org/jeecg/modules/wms/dto/ReceiveWMSScanItemListResponse.java
@@ -8,11 +8,11 @@
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
        "receiveWMSScanItemListResult"
})
@XmlRootElement(name = "ReceiveWMSScanItemListResponse")
}, namespace = "http://xhj008.server.webservice.com/")
@XmlRootElement(name = "ReceiveWMSScanItemListResponse", namespace = "http://xhj008.server.webservice.com/")
@Getter
@Setter
public class ReceiveWMSScanItemListResponse {
    @XmlElement(name = "ReceiveWMSScanItemListResult")
    @XmlElement(name = "ReceiveWMSScanItemListResult", namespace = "http://xhj008.server.webservice.com/")
    protected MESResponse receiveWMSScanItemListResult;
}
src/main/java/org/jeecg/modules/wms/request/ReceiveWMSScanItemList.java
@@ -9,13 +9,13 @@
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
        "wmsWebServiceSendItemList"
})
@XmlRootElement(name = "ReceiveWMSScanItemList")
}, namespace = "http://xhj008.server.webservice.com/")
@XmlRootElement(name = "ReceiveWMSScanItemList", namespace = "http://xhj008.server.webservice.com/")
@Getter
@Setter
public class ReceiveWMSScanItemList {
    @XmlElementWrapper(name = "ArrayOfWMSWebServiceSendItem")
    @XmlElement(name = "WMSWebServiceSendItem", nillable = true)
    @XmlElementWrapper(name = "ArrayOfWMSWebServiceSendItem", namespace = "http://xhj008.server.webservice.com/")
    @XmlElement(name = "WMSWebServiceSendItem", nillable = true, namespace = "http://xhj008.server.webservice.com/")
    protected List<WMSWebServiceSendItem> wmsWebServiceSendItemList;
}
src/main/java/org/jeecg/modules/wms/request/WMSWebServiceSendItem.java
@@ -31,62 +31,62 @@
        "stageID",
        "remark",
        "orderCode"
})
}, namespace = "http://xhj008.server.webservice.com/")
@XmlAccessorType(XmlAccessType.FIELD)
public class WMSWebServiceSendItem {
    /**工厂编码 */
    @XmlElement(name = "FactoryCode")
    @XmlElement(name = "FactoryCode", namespace = "http://xhj008.server.webservice.com/")
    private String factoryCode;
    /** ç‰©æ–™ç¼–码 */
    @XmlElement(name = "SkuCode")
    @XmlElement(name = "SkuCode", namespace = "http://xhj008.server.webservice.com/")
    private String skuCode;
    /** é¢„留号 */
    @XmlElement(name = "ReservationOrder")
    @XmlElement(name = "ReservationOrder", namespace = "http://xhj008.server.webservice.com/")
    private String reservationOrder;
    /** MES移库单号 */
    @XmlElement(name = "Align")
    @XmlElement(name = "Align", namespace = "http://xhj008.server.webservice.com/")
    private String align;
    /** æ‰˜å· */
    @XmlElement(name = "Pallet")
    @XmlElement(name = "Pallet", namespace = "http://xhj008.server.webservice.com/")
    private String pallet;
    /** åŒ…装编码 */
    @XmlElement(name = "PackageNo")
    @XmlElement(name = "PackageNo", namespace = "http://xhj008.server.webservice.com/")
    private String packageNo;
    /** æ‰¹æ¬¡å· */
    @XmlElement(name = "TrackLot")
    @XmlElement(name = "TrackLot", namespace = "http://xhj008.server.webservice.com/")
    private String trackLot;
    /** ç³»åˆ—号 */
    @XmlElement(name = "Series")
    @XmlElement(name = "Series", namespace = "http://xhj008.server.webservice.com/")
    private String series;
    /** MES库存ID */
    @XmlElement(name = "MesStockID")
    @XmlElement(name = "MesStockID", namespace = "http://xhj008.server.webservice.com/")
    private String mesStockID;
    /** æ•°é‡ */
    @XmlElement(name = "Quantity")
    @XmlElement(name = "Quantity", namespace = "http://xhj008.server.webservice.com/")
    private BigDecimal quantity;
    /** SAP批次号 */
    @XmlElement(name = "SapTrackLot")
    @XmlElement(name = "SapTrackLot", namespace = "http://xhj008.server.webservice.com/")
    private String sapTrackLot;
    /** å‘送库存地 */
    @XmlElement(name = "Section")
    @XmlElement(name = "Section", namespace = "http://xhj008.server.webservice.com/")
    private String section;
    /** ç›®æ ‡åº“存地 */
    @XmlElement(name = "DestSection")
    @XmlElement(name = "DestSection", namespace = "http://xhj008.server.webservice.com/")
    private String destSection;
    /** ä¾›åº”商代码 */
    @XmlElement(name = "SupplierCode")
    @XmlElement(name = "SupplierCode", namespace = "http://xhj008.server.webservice.com/")
    private String supplierCode;
    /** ä¾›åº”商批次号 */
    @XmlElement(name = "SupplierTrackLot")
    @XmlElement(name = "SupplierTrackLot", namespace = "http://xhj008.server.webservice.com/")
    private String supplierTrackLot;
    /** é˜¶æ®µID */
    @XmlElement(name = "StageID")
    @XmlElement(name = "StageID", namespace = "http://xhj008.server.webservice.com/")
    private String stageID;
    /** å¤‡æ³¨ */
    @XmlElement(name = "Remark")
    @XmlElement(name = "Remark", namespace = "http://xhj008.server.webservice.com/")
    private String remark;
    /** è®¢å•编码 */
    @XmlElement(name = "OrderCode")
    @XmlElement(name = "OrderCode", namespace = "http://xhj008.server.webservice.com/")
    private String orderCode;
}
src/main/java/org/jeecg/modules/wms/service/MESWebServiceSoap.java
@@ -1,18 +1,27 @@
package org.jeecg.modules.wms.service;
import org.jeecg.modules.wms.dto.WSResponse;
import org.jeecg.modules.wms.dto.MESResponse;
import org.jeecg.modules.wms.request.ReceiveWMSScanItemList;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
@WebService(name = "MESWebServiceSoap", targetNamespace = "http://xhj008.server.webservice.com/")
public interface MESWebServiceSoap {
    /**
     * æŽ¥æ”¶WMS移库信息
     * @param request
     * @param wmsWebServiceSendItemList
     * @return
     */
    @WebMethod
    WSResponse receiveWMSScanItemList(ReceiveWMSScanItemList request);
    @WebMethod(operationName = "ReceiveWMSScanItemList", action = "http://xhj008.server.webservice.com/ReceiveWMSScanItemList")
    @RequestWrapper(localName = "ReceiveWMSScanItemList", targetNamespace = "http://xhj008.server.webservice.com/", className = "ReceiveWMSScanItemList")
    @ResponseWrapper(localName = "ReceiveWMSScanItemListResponse", targetNamespace = "http://xhj008.server.webservice.com/", className = "ReceiveWMSScanItemListResponse")
    @WebResult(name = "ReceiveWMSScanItemListResult", targetNamespace = "http://xhj008.server.webservice.com/")
    MESResponse receiveWMSScanItemList(
            @WebParam(name = "wmsWebServiceSendItemList", targetNamespace = "http:/xhj008.server.webservice.com/")
            ReceiveWMSScanItemList wmsWebServiceSendItemList);
}
src/main/java/org/jeecg/modules/wms/service/impl/MESWebServiceSoapImpl.java
@@ -11,6 +11,7 @@
import org.jeecg.modules.lsw.entity.LswMaterialInbound;
import org.jeecg.modules.lsw.entity.LswMaterialInventory;
import org.jeecg.modules.lsw.entity.LswMaterialOutbound;
import org.jeecg.modules.lsw.enums.MaterialInboundCategory;
import org.jeecg.modules.lsw.service.ILswMaterialInboundService;
import org.jeecg.modules.lsw.service.ILswMaterialInventoryService;
import org.jeecg.modules.lsw.service.ILswMaterialOutboundService;
@@ -21,7 +22,7 @@
import org.jeecg.modules.mes.enums.TransferOrderStatusEnum;
import org.jeecg.modules.mes.service.IMesMaterialTransferRequestService;
import org.jeecg.modules.mes.service.IMesTransferOrderPrintService;
import org.jeecg.modules.wms.dto.WSResponse;
import org.jeecg.modules.wms.dto.MESResponse;
import org.jeecg.modules.wms.request.ReceiveWMSScanItemList;
import org.jeecg.modules.wms.request.WMSWebServiceSendItem;
import org.jeecg.modules.wms.service.MESWebServiceSoap;
@@ -34,7 +35,7 @@
@Slf4j
@Service
@Service("MESWebServiceSoap")
@WebService(name = "MESWebServiceSoap", targetNamespace = "http://xhj008.server.webservice.com", endpointInterface = "org.jeecg.modules.wms.service.MESWebServiceSoap")
public class MESWebServiceSoapImpl implements MESWebServiceSoap {
@@ -56,8 +57,8 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    @ApiLog(apiName = "接收WMS的移库信息(ReceiveWMSScanItemList(MES)", apiCategory = ApiLogCategoryEnum.WMS)
    public WSResponse receiveWMSScanItemList(ReceiveWMSScanItemList request) {
        WSResponse response = new WSResponse();
    public MESResponse receiveWMSScanItemList(ReceiveWMSScanItemList request) {
        MESResponse response = new MESResponse();
        if (request == null || CollectionUtil.isEmpty(request.getWmsWebServiceSendItemList())) {
            response.setErrorCode("N");
            response.setErrorDesc("传入的参数为空!");
@@ -98,6 +99,8 @@
                //添加入库信息
                LswMaterialInbound inbound = new LswMaterialInbound();
                inbound.setOriginalCode(transferRequest.getOriginalWarehouseId());
                inbound.setOriginalName("WMS");
                inbound.setWarehouseId(transferRequest.getTargetWarehouseId());
                inbound.setReceiver("WMS");
                inbound.setMaterialNumber(transferRequest.getMaterialNumber());
@@ -105,6 +108,7 @@
                inbound.setBatchNumber(item.getTrackLot());
                inbound.setQuantity(item.getQuantity());
                inbound.setFactoryId(warehouse.getFactoryId());
                inbound.setInboundCategory(MaterialInboundCategory.MATERIAL_TRANSFER_REQUEST.name());
                boolean b = materialInboundService.inboundMaterial(inbound);
                if (!b) {
                    errorCount++;