自动化立体仓库 - WMS系统
zhangc
2024-12-03 9e40c63ecc04d9d7b3dd98cd2f396c0ff2a79e13
添加订单电话更新功能及优化查询
9个文件已修改
89 ■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/OpenController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/OrderController.java 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/OrderMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/OrderService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/OrderServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/OrderSyncScheduler.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/OrderMapper.xml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/order/order.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/OpenController.java
@@ -257,6 +257,12 @@
            case "生产材料出库补料":
                mappingPakOutOrderParam(param, false, "银座生产材料出库补料");
                break;
            case "半成品入库单":
                mappingPakOutOrderParam(param, true, "半成品入库单");
                break;
            case "成品入库单":
                mappingPakOutOrderParam(param, true, "成品入库单");
                break;
            default:
                log.info("未知的单据类型:{}", param);
                mappingPakOutOrderParam(param, param.getPakin() == 1 ? true : false, param.get操作单据());
src/main/java/com/zy/asrs/controller/OrderController.java
@@ -1,5 +1,6 @@
package com.zy.asrs.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
@@ -8,7 +9,6 @@
import com.core.common.*;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.AgvMobileStartPakin;
import com.zy.asrs.entity.param.OrderDomainParam;
import com.zy.asrs.entity.result.WrkTraceVo;
import com.zy.asrs.service.*;
@@ -31,6 +31,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@RestController
@@ -139,7 +140,9 @@
        EntityWrapper<Order> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        convert(param, wrapper);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} else {
        if (!Cools.isEmpty(orderByField)) {
            wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
        } else {
            wrapper.orderBy("settle").orderBy("create_time", false);
        }
        wrapper.eq("status", 1);
@@ -157,7 +160,9 @@
        EntityWrapper<Order> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        convert(param, wrapper);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} else {
        if (!Cools.isEmpty(orderByField)) {
            wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
        } else {
            wrapper.orderBy("settle").orderBy("create_time", false);
        }
        wrapper.eq("status", 1);
@@ -323,6 +328,7 @@
        }
        return R.ok(page);
    }
    @RequestMapping(value = "/order/backStocks/detls/pakin/page/auth")
    @ManagerAuth
    public R backStocksOrderDetls(@RequestParam(defaultValue = "1")Integer curr,
@@ -663,11 +669,16 @@
        }
        Date now = new Date();
        Long userId = getUserId();
        StringBuffer tel = new StringBuffer();
        for (OrderDetl orderDetl : param.getOrderDetlList()) {
            tel.append(orderDetl.getThreeCode().trim()).append(";");
        }
        // 修改主档
        if (!param.getDocType().equals(order.getDocType())) {
            order.setDocType(param.getDocType());
            order.setUpdateBy(userId);
            order.setUpdateTime(now);
            order.setTel(tel.toString());
            if (!orderService.updateById(order)) {
                throw new CoolException("修改订单类型失败");
            }
@@ -680,6 +691,7 @@
        }
        // 2.重组数据
        List<DetlDto> list = new ArrayList<>();
        for (OrderDetl orderDetl : param.getOrderDetlList()) {
            DetlDto dto = new DetlDto(orderDetl.getMatnr(), orderDetl.getAnfme(), orderDetl.getProcessSts());
            if (DetlDto.has(list, dto)) {
@@ -847,7 +859,9 @@
        EntityWrapper<Order> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        convert(param, wrapper);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        if (!Cools.isEmpty(orderByField)) {
            wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
        }
        return R.ok(orderService.selectPage(new Page<>(curr, limit), wrapper));
    }
@@ -950,8 +964,7 @@
        try {
            if (excelVersion == 2003) {
                book = new HSSFWorkbook(inStream);
            }
            else {  // 当 excel 是 2007 时
            } else {  // 当 excel 是 2007 时
                book = new XSSFWorkbook(inStream);
            }
        } catch (Exception e) {
@@ -1277,8 +1290,7 @@
        try {
            if (excelVersion == 2003) {
                book = new HSSFWorkbook(inStream);
            }
            else {  // 当 excel 是 2007 时
            } else {  // 当 excel 是 2007 时
                book = new XSSFWorkbook(inStream);
            }
        } catch (Exception e) {
@@ -1307,4 +1319,22 @@
        return R.ok("导入成功").add(strs);
    }
//    @RequestMapping(value = "/order/sync")
//    @Transactional
//    public R sync() {
//        List<Order> orders = orderService.selectList(new EntityWrapper<Order>().isNull("tel"));
//        for (Order order : orders) {
//            List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId());
//            if (orderDetls.isEmpty()) {
//                return R.ok();
//            }
//            Set<String> collect = orderDetls.stream().map(x -> x.getThreeCode()).collect(Collectors.toSet());
//            if (!collect.isEmpty() && collect.size() > 0) {
//                log.info("订单号{},同步数据{}", order.getId(), collect);
//                orderService.updateTel(order.getId(), JSON.toJSONString(collect));
//            }
//        }
//        return R.ok();
//    }
}
src/main/java/com/zy/asrs/mapper/OrderMapper.java
@@ -13,6 +13,9 @@
@Repository
public interface OrderMapper extends BaseMapper<Order> {
    int updateTel(@Param("orderId")Long orderId, @Param("tel")String tel);
    int updateSettle(@Param("orderId")Long orderId, @Param("settle")Long settle, @Param("userId")Long userId);
    int updateSettle2(@Param("orderId")Long orderId, @Param("settle")Long settle, @Param("plt")Integer plt,@Param("inTime")String inTime);
src/main/java/com/zy/asrs/service/OrderService.java
@@ -12,6 +12,8 @@
    List<OrderDetl> selectWorkingDetls(Long orderId);
    boolean updateTel(Long orderId, String tel);
    boolean updateSettle(Long orderId, Long settle, Long userId);
    boolean updateSettle2(Long orderId, Long settle, Integer pltType,String inTime);
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -886,6 +886,12 @@
        }
        Date now = new Date();
        Order order = orderMapping(param, now, pakin, docName);
        StringBuffer tel = new StringBuffer();
        for (OrderSyncParam.OrderDetl child : param.getChildren()) {
            tel.append(child.getCDefine22()).append(";");
        }
        order.setTel(tel.toString());
        orderService.insert(order);
        param.getChildren().forEach(od -> {
            OrderDetl orderDetl = orderDetlMapping(order, od, now);
src/main/java/com/zy/asrs/service/impl/OrderServiceImpl.java
@@ -90,6 +90,11 @@
    }
    @Override
    public boolean updateTel(Long orderId, String tel) {
        return this.baseMapper.updateTel(orderId, tel) > 0;
    }
    @Override
    public boolean updateSettle(Long orderId, Long settle, Long userId) {
        return this.baseMapper.updateSettle(orderId, settle, userId) > 0;
    }
src/main/java/com/zy/asrs/task/OrderSyncScheduler.java
@@ -1,10 +1,11 @@
package com.zy.asrs.task;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.AgvLocDetl;
import com.zy.asrs.entity.Order;
import com.zy.asrs.entity.OrderDetl;
import com.zy.asrs.service.AgvLocDetlService;
import com.zy.asrs.service.ApiLogService;
import com.zy.asrs.service.OrderDetlService;
@@ -14,11 +15,11 @@
import com.zy.common.entity.Parameter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.stream.Collectors;
/**
 * Created by vincent on 2020/7/7
src/main/resources/mapper/OrderMapper.xml
@@ -42,6 +42,13 @@
    </resultMap>
    <update id="updateTel">
        update man_order
        set tel = #{tel}
        where 1=1
        and id = #{orderId}
    </update>
    <update id="updateSettle">
        update man_order
        set settle = #{settle}
src/main/webapp/views/order/order.html
@@ -59,6 +59,11 @@
                            <input name="order_no" class="layui-input" type="text" placeholder="输入单据编号"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline mr0">
                            <input name="tel" class="layui-input" type="text" placeholder="输入销售单号"/>
                        </div>
                    </div>
                    <div class="layui-inline" style="width: 300px">
                        <div class="layui-input-inline">
                            <input class="layui-input layui-laydate-range" name="create_time" type="text" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px">