#
luxiaotao1123
2022-02-22 1af20c9696ba73b10e9065d0441c786ae9a28c9f
#
4个文件已修改
116 ■■■■ 已修改文件
src/main/java/zy/cloud/wms/manager/controller/OrderController.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/OrderMapper.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/delivery/delivery.html 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/zy/cloud/wms/manager/controller/OrderController.java
@@ -11,6 +11,7 @@
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.exception.CoolException;
import com.sun.org.apache.xpath.internal.operations.Or;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@@ -19,6 +20,8 @@
import zy.cloud.wms.common.utils.QrCode;
import zy.cloud.wms.common.web.BaseController;
import zy.cloud.wms.manager.entity.Order;
import zy.cloud.wms.manager.entity.OrderDetl;
import zy.cloud.wms.manager.service.OrderDetlService;
import zy.cloud.wms.manager.service.OrderService;
import javax.imageio.ImageIO;
@@ -35,6 +38,8 @@
    @Autowired
    private OrderService orderService;
    @Autowired
    private OrderDetlService orderDetlService;
    @RequestMapping(value = "/order/{id}/auth")
    @ManagerAuth
@@ -90,19 +95,6 @@
        return R.ok();
    }
    @RequestMapping(value = "/order/delete/auth")
    @ManagerAuth
    public R delete(@RequestParam String param){
        List<Order> list = JSONArray.parseArray(param, Order.class);
        if (Cools.isEmpty(list)){
            return R.error();
        }
        for (Order entity : list){
            orderService.delete(new EntityWrapper<>(entity));
        }
        return R.ok();
    }
    @RequestMapping(value = "/orders/delete/auth")
    @ManagerAuth
    @Transactional
@@ -111,6 +103,11 @@
            return R.error();
        }
        for (Long id : ids){
            Order order = orderService.selectById(id);
            if (order == null) {
                continue;
            }
            orderDetlService.delete(new EntityWrapper<OrderDetl>().eq("order_id", order.getId()));
            if (!orderService.deleteById(id)) {
                throw new CoolException("服务器错误,请联系管理员");
            }
src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java
@@ -1,11 +1,9 @@
package zy.cloud.wms.manager.service.impl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.R;
import com.core.common.SnowflakeIdWorker;
import com.core.common.*;
import com.core.exception.CoolException;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -149,6 +147,65 @@
        if (locDetl == null || locDetl.getAnfme() < param.getCount()) {
            return R.error(mat.getMaktx() + "库存不足");
        }
        Date now = new Date();
        Cstmr cstmr = cstmrService.selectByName(param.getCstmr());
        // 生成订单
        Order order = new Order(
                hostId,
                String.valueOf(snowflakeIdWorker.nextId()),    // 编号[非空]
                "HM-" + String.valueOf(snowflakeIdWorker.nextId()).substring(0, 15),    // 订单编号
//                null,    // 订单编号
                DateUtils.convert(now, DateUtils.yyyyMMdd_F),    // 单据日期
                null,    // 单据类型
                null,    // 项目编号
                null,   // 项目名称
                null,    // 调拨项目编号
                null,    // 初始票据号
                null,    // 票据号
                cstmr==null?null:cstmr.getId(),    // 客户编号
                param.getCstmr(),    // 客户
                null,    // 联系方式
                null,    // 操作人员
                null,    // 合计金额
                null,    // 优惠率
                null,    // 优惠金额
                null,    // 销售或采购费用合计
                null,    // 实付金额
                null,    // 付款类型
                null,    // 业务员
                null,    // 结算天数
                null,    // 邮费支付类型
                null,    // 邮费
                null,    // 付款时间
                null,    // 发货时间
                null,    // 物流名称
                null,    // 物流单号
                4L,    // 订单状态
                1,    // 状态
                userId,    // 添加人员
                now,    // 添加时间
                userId,    // 修改人员
                now,    // 修改时间
                "直接出库"    // 备注
        );
        if (!orderService.insert(order)) {
            throw new CoolException("生成订单失败!");
        }
        OrderDetl orderDetl = new OrderDetl();
        orderDetl.setHostId(hostId);
        orderDetl.setOrderId(order.getId());  // 订单内码
        orderDetl.setAnfme(param.getCount());         // 数量
        orderDetl.setCreateBy(userId);
        orderDetl.setCreateTime(now);
        orderDetl.setUpdateBy(userId);
        orderDetl.setUpdateTime(now);
        orderDetl.setStatus(1);
        VersionUtils.setOrderDetl(orderDetl, mat);
        if (!orderDetlService.insert(orderDetl)) {
            throw new CoolException("生成订单失败");
        }
        // 生成拣货单
        Pakout pakout = new Pakout(
                hostId,
                String.valueOf(snowflakeIdWorker.nextId()),    // 任务号[非空]
@@ -173,9 +230,9 @@
                null,    // 重量
                1,    // 状态
                userId,    // 添加人员
                new Date(),    // 添加时间
                now,    // 添加时间
                userId,    // 修改人员
                new Date(),    // 修改时间
                now,    // 修改时间
                null    // 备注
        );
        VersionUtils.setPakout(pakout, mat);
src/main/resources/mapper/OrderMapper.xml
@@ -81,23 +81,17 @@
        <if test="host_id!=null and host_id!='' ">
            and mo.host_id = #{host_id}
        </if>
        <if test="bill_no!=null and bill_no!='' ">
            and mo.bill_no like '%' + #{bill_no} + '%'
        <if test="order_no!=null and order_no!='' ">
            and mo.order_no like '%' + #{order_no} + '%'
        </if>
        <if test="bill_type!=null and bill_type!='' ">
            and bill_type like '%' + #{bill_type} + '%'
        <if test="doc_type!=null and doc_type!='' ">
            and mo.doc_type like '%' + #{doc_type} + '%'
        </if>
        <if test="mat_name!=null and mat_name!='' ">
            and a.mat_name like '%' + #{mat_name} + '%'
        </if>
        <if test="qty!=null and qty!='' ">
            and a.qty = #{qty}
        </if>
        <if test="altme!=null and altme!='' ">
            and a.unit like '%' + #{unit} + '%'
        <if test="maktx!=null and maktx!='' ">
            and mod.maktx like '%' + #{maktx} + '%'
        </if>
        <if test="startTime!=null and endTime!=null">
            and appe_time between #{startTime} and #{endTime}
            and mo.create_time between #{startTime} and #{endTime}
        </if>
    </sql>
src/main/webapp/views/delivery/delivery.html
@@ -26,12 +26,12 @@
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <div class="layui-input-inline mr0">
                            <input name="bill_no" class="layui-input" type="text" placeholder="输入单据编号"/>
                            <input name="order_no" 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="appe_time" type="text" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px">
                            <input class="layui-input layui-laydate-range" name="create_time" type="text" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px">
                        </div>
                    </div>
                    <div class="layui-inline">