skyouc
5 天以前 190d2d153d6737830f6173c7de1b0bc03e6d7dac
no message
1个文件已添加
1个文件已删除
4个文件已修改
361 ■■■■ 已修改文件
rsf-framework/src/main/java/com/vincent/rsf/framework/common/Cools.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/Test/ChineseMD5Util.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/Test/CombinationFinder.java 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/pda/MobileController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/MobileServiceImpl.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaitPakinServiceImpl.java 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-framework/src/main/java/com/vincent/rsf/framework/common/Cools.java
@@ -5,6 +5,7 @@
import java.lang.reflect.*;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.*;
/**
@@ -371,4 +372,47 @@
        return intersection;
    }
    /**
     * 对汉字字符串进行MD5加密
     * @param input 要加密的汉字字符串
     * @return 32位小写MD5哈希值
     * @throws NoSuchAlgorithmException
     */
    public static String md5Chinese(String input) throws NoSuchAlgorithmException {
        if (input == null) {
            return null;
        }
        // 统一使用UTF-8编码
        byte[] inputBytes = input.getBytes(StandardCharsets.UTF_8);
        MessageDigest md = MessageDigest.getInstance("MD5");
        byte[] digest = md.digest(inputBytes);
        // 将字节数组转换为16进制字符串
        StringBuilder sb = new StringBuilder();
        for (byte b : digest) {
            sb.append(String.format("%02x", b));
        }
        return sb.toString();
    }
    /**
     * 验证汉字字符串与MD5哈希是否匹配
     * @param input 要验证的汉字字符串
     * @param md5Hash 存储的MD5哈希值
     * @return 如果匹配返回true,否则false
     */
    public static boolean verifyChinese(String input, String md5Hash) {
        try {
            String computedHash = md5Chinese(input);
            return computedHash.equals(md5Hash.toLowerCase());
        } catch (NoSuchAlgorithmException e) {
            // 理论上不会发生,因为MD5是Java标准库支持的
            return false;
        }
    }
}
rsf-server/src/main/Test/ChineseMD5Util.java
New file
@@ -0,0 +1,70 @@
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class ChineseMD5Util {
    /**
     * 对汉字字符串进行MD5加密
     * @param input 要加密的汉字字符串
     * @return 32位小写MD5哈希值
     * @throws NoSuchAlgorithmException
     */
    public static String md5Chinese(String input) throws NoSuchAlgorithmException {
        if (input == null) {
            return null;
        }
        // 统一使用UTF-8编码
        byte[] inputBytes = input.getBytes(StandardCharsets.UTF_8);
        MessageDigest md = MessageDigest.getInstance("MD5");
        byte[] digest = md.digest(inputBytes);
        // 将字节数组转换为16进制字符串
        StringBuilder sb = new StringBuilder();
        for (byte b : digest) {
            sb.append(String.format("%02x", b));
        }
        return sb.toString();
    }
    /**
     * 验证汉字字符串与MD5哈希是否匹配
     * @param input 要验证的汉字字符串
     * @param md5Hash 存储的MD5哈希值
     * @return 如果匹配返回true,否则false
     */
    public static boolean verifyChinese(String input, String md5Hash) {
        try {
            String computedHash = md5Chinese(input);
            return computedHash.equals(md5Hash.toLowerCase());
        } catch (NoSuchAlgorithmException e) {
            // 理论上不会发生,因为MD5是Java标准库支持的
            return false;
        }
    }
    public static void main(String[] args) {
        try {
            String chineseText = "你好,世界!";
            // 加密
            String md5Hash = md5Chinese(chineseText);
            System.out.println("原文: " + chineseText);
            System.out.println("MD5哈希: " + md5Hash);
            // 验证
            boolean isValid = verifyChinese(chineseText, md5Hash);
            System.out.println("验证结果: " + (isValid ? "匹配" : "不匹配"));
            // 错误验证示例
            boolean isWrongValid = verifyChinese("你好,世界!", md5Hash);
            System.out.println("错误文本验证: " + (isWrongValid ? "匹配" : "不匹配"));
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
    }
}
rsf-server/src/main/Test/CombinationFinder.java
File was deleted
rsf-server/src/main/java/com/vincent/rsf/server/api/controller/pda/MobileController.java
@@ -173,7 +173,7 @@
            return R.error("托盘码不能为空!!");
        }
        if (Objects.isNull(param.getItems()) || param.getItems().isEmpty()) {
            return R.error("跟踪码不能为空!!");
            return R.error("解绑明细不能为空!!");
        }
        return R.ok(mobileService.unBind(param));
    }
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/MobileServiceImpl.java
@@ -273,7 +273,7 @@
                    if (Objects.isNull(rcpt.get("fieldsindex")) || StringUtils.isBlank(rcpt.get("fieldsindex").toString())) {
                        //获取16位uuid
//                        String uuid16 = Cools.md5(dto.getBarcode());
                        String uuid16 = Cools.md5(dto.getId() + dto.getMatnr());
                        String uuid16 = Cools.md5(dto.getMatnr() + dto.getSplrBatch());
                        rcpt.put("index", uuid16);
                        orderItem.setFieldsIndex(uuid16);
                    }
@@ -882,20 +882,20 @@
        }
        List<WaitPakinItem> pakinItems = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>()
                .eq(WaitPakinItem::getPakinId, waitPakin.getId()));
        if (pakinItems.isEmpty()) {
            return R.ok(new ArrayList<>());
        }
        List<Long> list = pakinItems.stream().map(WaitPakinItem::getSource).collect(Collectors.toList());
        LambdaQueryWrapper<WarehouseAreasItem> queryWrapper = new LambdaQueryWrapper<WarehouseAreasItem>().in(WarehouseAreasItem::getId, list);
        List<WarehouseAreasItem> warehouseAreasItems = warehouseAreasItemService.list(queryWrapper);
        for (int i = 0; i < warehouseAreasItems.size(); i++) {
            for (WaitPakinItem pakinItem : pakinItems) {
                if (warehouseAreasItems.get(i).getId().equals(pakinItem.getSource())) {
                    warehouseAreasItems.get(i).setAnfme(pakinItem.getAnfme());
                }
            }
        }
        return R.ok(warehouseAreasItems);
//        if (pakinItems.isEmpty()) {
//            return R.ok(new ArrayList<>());
//        }
//        List<Long> list = pakinItems.stream().map(WaitPakinItem::getSource).collect(Collectors.toList());
//        LambdaQueryWrapper<WarehouseAreasItem> queryWrapper = new LambdaQueryWrapper<WarehouseAreasItem>().in(WarehouseAreasItem::getId, list);
//        List<WarehouseAreasItem> warehouseAreasItems = warehouseAreasItemService.list(queryWrapper);
//        for (int i = 0; i < warehouseAreasItems.size(); i++) {
//            for (WaitPakinItem pakinItem : pakinItems) {
//                if (warehouseAreasItems.get(i).getId().equals(pakinItem.getSource())) {
//                    warehouseAreasItems.get(i).setAnfme(pakinItem.getAnfme());
//                }
//            }
//        }
        return R.ok(pakinItems);
    }
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaitPakinServiceImpl.java
@@ -195,6 +195,7 @@
                throw new CoolException("组托不存在!!");
            }
            List<PakinItem> paramItems = param.getItems();
            if (Objects.isNull(paramItems) || paramItems.isEmpty()) {
                throw new CoolException("解绑物料不能为空!!");
            }
@@ -205,16 +206,39 @@
            if (pakinItems.isEmpty()) {
                throw new CoolException("数据错误:组托明细不存在!!");
            }
            List<Long> ids = pakinItems.stream().map(WaitPakinItem::getId).collect(Collectors.toList());
            if (!waitPakinItemService.removeByIds(ids)) {
                throw new CoolException("组托明细解绑失败!!");
            }
//            List<Long> ids = pakinItems.stream().map(WaitPakinItem::getId).collect(Collectors.toList());
//            if (!waitPakinItemService.removeByIds(ids)) {
//                throw new CoolException("组托明细解绑失败!!");
//            }
            List<WarehouseAreasItem> warehouseAreasItems = warehouseAreasItemService.listByIds(list);
            for (int i1 = 0; i1 < pakinItems.size(); i1++) {
                for (PakinItem item : paramItems) {
                    if (item.getId().equals(pakinItems.get(i1).getSource())) {
                        if (pakinItems.get(i1).getAnfme().compareTo(item.getReceiptQty()) > 0) {
                            if (item.getReceiptQty().compareTo(0.00) == 0) {
                                throw new CoolException("解绑数量不能为零!!");
                            }
                            if (item.getReceiptQty().compareTo(pakinItems.get(i1).getAnfme() - pakinItems.get(i1).getWorkQty() - pakinItems.get(i1).getQty()) > 0) {
                                throw new CoolException("解绑数量不能大于剩余可执行数!!");
                            }
                           pakinItems.get(i1).setAnfme(pakinItems.get(i1).getAnfme() - item.getReceiptQty());
                           if (!waitPakinItemService.updateById(pakinItems.get(i1))) {
                               throw new CoolException("组托明细数量修改失败!!");
                           }
                        } else {
                            if (!waitPakinItemService.removeById(pakinItems.get(i1).getId())) {
                                throw new CoolException("组托明细删除失败!!");
                            }
                        }
                    }
                }
            }
            for (int a = 0; a < paramItems.size(); a++) {
                for (int i = 0; i < warehouseAreasItems.size(); i++) {
                    if (warehouseAreasItems.get(i).getId().equals(pakinItems.get(i1).getId())) {
                        double v = warehouseAreasItems.get(i).getWorkQty() - pakinItems.get(i1).getAnfme();
                    if (warehouseAreasItems.get(i).getId().equals(paramItems.get(a).getId())) {
                        double v = warehouseAreasItems.get(i).getWorkQty() - paramItems.get(a).getReceiptQty();
                        warehouseAreasItems.get(i).setWorkQty(v);
                        if (!warehouseAreasItemService.updateById(warehouseAreasItems.get(i))) {
                            throw new CoolException("收货区数量修改失败!!");
@@ -222,8 +246,9 @@
                    }
                }
            }
            double anfmes = warehouseAreasItems.stream().mapToDouble(WarehouseAreasItem::getAnfme).sum();
            double anfmes = paramItems.stream().mapToDouble(PakinItem::getReceiptQty).sum();
//            double anfmes = warehouseAreasItems.stream().mapToDouble(WarehouseAreasItem::getAnfme).sum();
            if (waitPakins.getAnfme().compareTo(anfmes) <= 0) {
                if (!waitPakinService.removeById(waitPakins.getId())) {
                    throw new CoolException("组托删除失败!!");
@@ -256,27 +281,34 @@
            if (!taskItems.isEmpty()) {
                return R.error("组拖档有明细任务");
            }
        }
        Set<Long> sourceIds = pakinItems.stream().map(WaitPakinItem::getSource).collect(Collectors.toSet());
            Set<Long> sourceIds = pakinItems.stream().map(WaitPakinItem::getSource).collect(Collectors.toSet());
        List<WarehouseAreasItem> areasItems = warehouseAreasItemService.listByIds(sourceIds);
            List<WarehouseAreasItem> areasItems = warehouseAreasItemService.list(new LambdaQueryWrapper<WarehouseAreasItem>()
                    .in(WarehouseAreasItem::getId, sourceIds));
        if (areasItems.isEmpty()) {
            return R.error("收货区数据不存在!!");
        }
        Map<Long, List<WaitPakinItem>> listMap = pakinItems.stream().collect(Collectors.groupingBy(WaitPakinItem::getSource));
        for (WarehouseAreasItem item : areasItems) {
            List<WaitPakinItem> pakin = listMap.get(item.getId());
            if (Objects.isNull(pakin)) {
                continue;
            if (areasItems.isEmpty()) {
                return R.error("收货区数据不存在!!");
            }
            double sum = pakin.stream().mapToDouble(WaitPakinItem::getAnfme).sum();
            item.setWorkQty(item.getWorkQty() - sum)
                    .setAnfme(item.getAnfme() + sum);
            if (!warehouseAreasItemService.updateById(item)) {
                throw new CoolException("收货区数据回滚失败!!");
            Map<Long, List<WaitPakinItem>> listMap = pakinItems.stream().collect(Collectors.groupingBy(WaitPakinItem::getSource));
            for (WarehouseAreasItem item : areasItems) {
                List<WaitPakinItem> pakin = listMap.get(item.getId());
                if (Objects.isNull(pakin)) {
                    continue;
                }
                double sum = pakin.stream().mapToDouble(WaitPakinItem::getAnfme).sum();
                item.setWorkQty(item.getWorkQty() - sum)
                        .setAnfme(item.getAnfme() + sum);
                if (!warehouseAreasItemService.updateById(item)) {
                    throw new CoolException("收货区数据回滚失败!!");
                }
            }
            Set<Long> pakinItemIds = pakinItems.stream().map(WaitPakinItem::getId).collect(Collectors.toSet());
            if (!waitPakinItemService.removeByIds(pakinItemIds)) {
                throw new CoolException("明细删除失败!!");
            }
        }
@@ -284,13 +316,6 @@
            return R.error("Delete Fail");
        }
        Set<Long> pakinItemIds = pakinItems.stream().map(WaitPakinItem::getId).collect(Collectors.toSet());
        if (!waitPakinItemService.removeByIds(pakinItemIds)) {
            throw new CoolException("明细删除失败!!");
        }
        return R.ok("Delete Success").add(pakinIds);
    }
}