skyouc
2025-04-30 d87b636f92269b4ec97cb5ca00680409755814a9
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/MobileServiceImpl.java
@@ -37,6 +37,7 @@
import com.vincent.rsf.server.system.service.UserLoginService;
import com.vincent.rsf.server.system.service.UserService;
import com.vincent.rsf.server.system.utils.SerialRuleUtils;
import org.apache.commons.codec.digest.Md5Crypt;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -46,6 +47,7 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.Collectors;
@@ -128,10 +130,10 @@
    private DeviceSiteMapper deviceSiteMapper;
    /**
     * @return
     * @author Ryan
     * @description 手持PDA登录接口
     * @params LoginParam param, HttpServletRequest request
     * @return
     * @time 2025/3/10 15:36
     */
    @Override
@@ -163,10 +165,10 @@
    }
    /**
     * @author Ryan
     * @description 扫码获取收货明细
     * @param barcode
     * @return
     * @author Ryan
     * @description 扫码获取收货明细
     * @time 2025/3/10 15:37
     */
    @Override
@@ -174,7 +176,10 @@
        if (StringUtils.isBlank(barcode)) {
            return R.error("标签码不能为空!!");
        }
        List<AsnOrderItem> asnOrderItem = asnOrderItemMapper.selectList(new LambdaQueryWrapper<AsnOrderItem>().eq(AsnOrderItem::getTrackCode, barcode));
        List<AsnOrderItem> asnOrderItem = asnOrderItemMapper.selectList(new LambdaQueryWrapper<AsnOrderItem>()
                .eq(AsnOrderItem::getTrackCode, barcode));
        if (Objects.isNull(asnOrderItem)) {
            throw new CoolException("单据明细不存在!!");
        }
@@ -235,7 +240,9 @@
        }
        List<Map<String, Object>> receipts1 = (List<Map<String, Object>>) params.get("receipts");
        for (Map<String, Object> rcpt : receipts1) {
            if (null == rcpt || Objects.isNull(rcpt)) {continue;}
            if (null == rcpt || Objects.isNull(rcpt)) {
                continue;
            }
            ReceiptDetlsDto dto = JSONObject.parseObject(JSONObject.toJSONString(rcpt), ReceiptDetlsDto.class);
            Matnr matnr = matnrMapper.selectById(dto.getMatnrId());
            if (Objects.isNull(matnr)) {
@@ -267,7 +274,7 @@
                try {
                    if (Objects.isNull(rcpt.get("fieldsindex")) || StringUtils.isBlank(rcpt.get("fieldsindex").toString())) {
                        //获取16位uuid
                        String uuid16 = CommonUtil.randomUUID16();
                        String uuid16 = Cools.md5(dto.getBarcode());
                        rcpt.put("index", uuid16);
                        orderItem.setFieldsIndex(uuid16);
                    }
@@ -296,8 +303,10 @@
                    .setAsnId(asnOrder.getId())
                    .setProdTime(dto.getProdTime())
                    .setWeight(dto.getWeigth())
                    .setStockUnit(dto.getStockUnit())
                    .setBatch(SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_RECEIPT_BATCH, dto))
                    //库存单位为最小单位
                    .setUnit(orderItem.getStockUnit())
                    .setStockUnit(orderItem.getStockUnit())
                    .setBatch(StringUtils.isBlank(orderItem.getBatch()) ? SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_RECEIPT_BATCH, dto) : orderItem.getBatch())
                    .setAnfme(dto.getReceiptQty())
                    .setSplrBatch(dto.getSplrBatch())
                    .setMatnrCode(matnr.getCode())
@@ -305,20 +314,29 @@
                    .setCreateBy(loginUserId)
                    .setMatnrId(matnr.getId())
                    .setMaktx(matnr.getName())
                    //库存单位为最小单位
                    .setUnit(dto.getStockUnit())
                    .setStockUnit(dto.getStockUnit())
                    .setWeight(matnr.getWeight())
                    .setFieldsIndex(orderItem.getFieldsIndex())
                    .setShipperId(matnr.getShipperId());
            //TODO 供应商标识未设置,标识由PO单供应商编码转换
            allOrders.add(item);
            WarehouseAreasItem serviceOne = warehouseAreasItemService.getOne(new LambdaQueryWrapper<WarehouseAreasItem>()
                    .eq(WarehouseAreasItem::getAsnItemId, item.getAsnItemId())
                    .eq(WarehouseAreasItem::getTrackCode, item.getTrackCode())
                    .eq(StringUtils.isNotBlank(item.getSplrBatch()), WarehouseAreasItem::getSplrBatch, item.getSplrBatch()));
            if (!Objects.isNull(serviceOne)) {
                item.setAnfme(item.getAnfme() + serviceOne.getAnfme());
                item.setId(serviceOne.getId());
        }
        if (!warehouseAreasItemService.saveBatch(allOrders)) {
            if (!warehouseAreasItemService.saveOrUpdate(item)) {
            throw new CoolException("收货失败!!");
        }
        }
//        if (!warehouseAreasItemService.saveBatch(allOrders)) {
//            throw new CoolException("收货失败!!");
//        }
//        //获取采购数量
//        double purQty = receipts.stream().mapToDouble(ReceiptDetlsDto::getPurQty).sum();
//
@@ -333,10 +351,10 @@
    }
    /**
     * @author Ryan
     * @description 其它收货
     * @param params
     * @return
     * @author Ryan
     * @description 其它收货
     */
    @Override
    public R otherReceipt(OtherReceiptParams params) {
@@ -350,15 +368,23 @@
        if (Objects.isNull(asnOrderItem)) {
            throw new CoolException("单据明细不存在!!");
        }
        List<Short> shorts = Arrays.asList(AsnExceStatus.ASN_EXCE_STATUS_TASK_CANCEL.val, AsnExceStatus.ASN_EXCE_STATUS_TASK_CLOSE
                .val, AsnExceStatus.ASN_EXCE_STATUS_TASK_DONE.val);
        AsnOrder order = asnOrderMapper.getOne(new LambdaQueryWrapper<AsnOrder>()
                .notIn(AsnOrder::getExceStatus, shorts)
                .eq(AsnOrder::getCode, params.getAsnCode()));
        if (Objects.isNull(order)) {
            throw new CoolException("请检查订单状态是否已完成或已取消!!");
        }
       return getAsnOrderItem(asnOrderItem);
    }
    /**
     * @return
     * @author Ryan
     * @description 获取所有通知单
     * @return
     */
    @Override
    public List<AsnOrder> getAllAsnOrders() {
@@ -367,10 +393,10 @@
    }
    /**
     * @author Ryan
     * @description 获取收货区
     * @param
     * @return
     * @author Ryan
     * @description 获取收货区
     * @time 2025/3/11 10:12
     */
    @Override
@@ -380,10 +406,10 @@
    }
    /**
     * @author Ryan
     * @description 获取所有启用动态字段
     * @param
     * @return
     * @author Ryan
     * @description 获取所有启用动态字段
     * @time 2025/3/12 09:23
     */
    @Override
@@ -392,10 +418,10 @@
    }
    /**
     * @author Ryan
     * @description 获取组盘明细
     * @param
     * @return
     * @author Ryan
     * @description 获取组盘明细
     * @time 2025/4/7 16:58
     */
    @Override
@@ -422,10 +448,10 @@
    }
    /**
     * @author Ryan
     * @description 解绑
     * @param param
     * @return
     * @author Ryan
     * @description 解绑
     */
    @Override
    public WaitPakin unBind(WaitPakinParam param) {
@@ -434,6 +460,7 @@
    /**
     * 报检功能
     *
     * @param code
     * @param loginUserId
     * @return
@@ -474,10 +501,10 @@
    }
    /**
     * @author Ryan
     * @description 提交报检
     * @param
     * @return
     * @author Ryan
     * @description 提交报检
     * @time 2025/4/1 16:47
     */
    @Override
@@ -500,6 +527,7 @@
    /**
     * 通过物料,质检单获取需要质检单据
     *
     * @param params
     * @return
     */
@@ -545,6 +573,7 @@
    /**
     * 快速质检
     *
     * @param params
     * @return
     */
@@ -563,10 +592,10 @@
    }
    /**
    * @author Ryan
    * @description 人工上架
    * @param
    * @return
     * @author Ryan
     * @description 人工上架
    * @time 2025/4/2 16:33
    */
    @Override
@@ -692,6 +721,7 @@
    /**
     * 获取任务信息
     *
     * @param code
     * @return
     */
@@ -736,10 +766,10 @@
    }
    /**
     * @Author Ryan
     * @param code
     * @desc  任务上架
     * @return
     * @Author Ryan
     * @desc 任务上架
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
@@ -769,10 +799,10 @@
    }
    /**
     * @author Ryan
     * @description 通过容器获取组拖物料
     * @param
     * @return
     * @author Ryan
     * @description 通过容器获取组拖物料
     * @time 2025/4/9 16:57
     */
    @Override
@@ -818,10 +848,10 @@
    }
    /**
     * @author Ryan
     * @description 不良标签
     * @param
     * @return
     * @author Ryan
     * @description 不良标签
     * @time 2025/4/12 08:12
     */
    @Override
@@ -831,10 +861,10 @@
    }
    /**
     * @author Ryan
     * @description 获取入库组拖信息
     * @param barcode
     * @return
     * @author Ryan
     * @description 获取入库组拖信息
     */
    @Override
    public R getPakinInStock(String barcode) {
@@ -850,9 +880,9 @@
    }
    /**
     * @return
     * @author Ryan
     * @description 获取库口站点信息
     * @return
     */
    @Override
    public R getDeviceSites() {
@@ -864,9 +894,9 @@
    }
    /**
     * @return
     * @author Ryan
     * @description 获取推荐库位
     * @return
     */
    @Override
    public R getRecommondLocs() {