自动化立体仓库 - WMS系统
zhou zhou
2 天以前 b06233aa71b70f7a30ff382ae1ba19c29b134d7c
#库存调整完成
10个文件已修改
1个文件已添加
209 ■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/CheckOrderController.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/CheckOrderDetl.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/LocDetl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/enums/CheckStatusEnum.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/CheckOrderService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/CheckOrderServiceImpl.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/adjustOrder/adjustOrder.js 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/checkOrder/checkOrder.js 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/locDetl/locDetl.js 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/checkOrder/checkOrder.html 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/CheckOrderController.java
@@ -11,8 +11,10 @@
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.CheckTaskListParam;
import com.zy.asrs.entity.param.OpenAdjustmentOrderParam;
import com.zy.asrs.entity.param.OrderDomainParam;
import com.zy.asrs.entity.result.CheckOrderExportDTO;
import com.zy.asrs.enums.CheckStatusEnum;
import com.zy.asrs.enums.OrderTypeEnum;
import com.zy.asrs.service.*;
import com.core.annotations.ManagerAuth;
@@ -41,6 +43,8 @@
    private SnowflakeIdWorker snowflakeIdWorker;
    @Autowired
    private DocTypeService docTypeService;
    @Autowired
    private OpenService openService;
    @PostMapping(value = "/checkOrder/pdaComplete/auth")
    @ManagerAuth(memo = "pda:完成盘点")
@@ -342,4 +346,29 @@
        return R.ok();
    }
    @PostMapping(value = "/adjustOrder/create/test")
    @ManagerAuth(memo = "内部测试:生成调整单")
    public R adjustOrderCreateTest(@RequestParam("orderId") Long orderId) {
        CheckOrder checkOrder = checkOrderService.selectById(orderId);
        List<CheckOrderDetl> checkOrderDetls = checkOrderDetlService.selectList(new EntityWrapper<CheckOrderDetl>().eq("order_id", orderId));
        checkOrderDetls.forEach(checkOrderDetl -> { checkOrderDetl.setStatus(1);});
        OpenAdjustmentOrderParam openAdjustmentOrderParam = new OpenAdjustmentOrderParam();
        openAdjustmentOrderParam.setOrderTime(DateUtils.convert(new Date()));
        openAdjustmentOrderParam.setOrderDetails(checkOrderDetls);
        openService.adjustmentOrderCreate(openAdjustmentOrderParam);
        return R.ok();
    }
    @PostMapping(value = "/adjustOrder/complete/auth")
    @ManagerAuth(memo = "完成调整单")
    public R adjustOrderComplete(@RequestParam("orderId") Long orderId) {
        checkOrderService.adjustOrderComplete(orderId,getUserId());
        return R.ok();
    }
}
src/main/java/com/zy/asrs/entity/CheckOrderDetl.java
@@ -3,6 +3,7 @@
import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import com.core.common.SpringUtils;
import com.zy.asrs.enums.CheckStatusEnum;
import com.zy.asrs.service.OrderService;
import com.zy.asrs.entity.Order;
import com.baomidou.mybatisplus.annotations.TableField;
@@ -258,7 +259,7 @@
    /**
     * 状态 1: 未生成  0: 禁用  2:待盘  3:已盘
     */
    @ApiModelProperty(value= "状态 1: 未生成  0: 禁用  2:待盘  3:已盘  4:待调整 5:已调整")
    @ApiModelProperty(value= "状态 1: 未生成  0: 禁用  2:待盘  3:已盘  4:允许  5:禁止 6:已修改")
    private Integer status;
    /**
@@ -552,22 +553,9 @@
    public String getStatus$(){
        if (null == this.status){ return null; }
        switch (this.status){
            case 1:
                return "未生成";
            case 0:
                return "禁用";
            case 2:
                return "待盘";
            case 3:
                return "已盘";
            case 4:
                return "待调整";
            case 5:
                return "已调整";
            default:
                return String.valueOf(this.status);
        }
        String descByType = CheckStatusEnum.getDescByType(this.status);
        if (Cools.isEmpty(descByType)){ return "未定义"; }
        return descByType;
    }
    public String getCreateBy$(){
src/main/java/com/zy/asrs/entity/LocDetl.java
@@ -246,9 +246,12 @@
    public BigDecimal getBookQty() {
        if (diffQty.compareTo(BigDecimal.ZERO) == 0 || diffQty.compareTo(BigDecimal.ZERO) > 0) {
            return new  BigDecimal(anfme.toString());
        if (diffQty.compareTo(BigDecimal.ZERO) == 0 ) {
            return BigDecimal.ZERO;
        }
        if ( diffQty.compareTo(BigDecimal.ZERO) > 0) {
            return new  BigDecimal(anfme.toString());
        }
        return new BigDecimal(anfme.toString()).subtract(diffQty);
    }
src/main/java/com/zy/asrs/enums/CheckStatusEnum.java
New file
@@ -0,0 +1,33 @@
package com.zy.asrs.enums;
public enum CheckStatusEnum {
    //状态 1: 未生成  0: 禁用  2:待盘  3:已盘
    NO_CREATE(1, "未生成"),
    DISABLED(0, "禁用"),
    WAIT_CHECK(2, "待盘"),
    CHECKED(3, "已盘"),
    //调整单
    ALLOW(4, "允许"),
    FORBID(5, "禁止"),
    MODIFIED(6, "已修改");
    public final Integer type;
    public final String desc;
    CheckStatusEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }
    public static String getDescByType(Integer type) {
        for (CheckStatusEnum value : CheckStatusEnum.values()) {
            if (value.type.equals(type)) {
                return value.desc;
            }
        }
        return null;
    }
}
src/main/java/com/zy/asrs/service/CheckOrderService.java
@@ -19,4 +19,6 @@
    List<CheckOrderDetl> getTaskList(String barcode);
    R pdaComplete(CheckTaskListParam checkTaskListParam);
    void adjustOrderComplete(Long orderId, Long userId);
}
src/main/java/com/zy/asrs/service/impl/CheckOrderServiceImpl.java
@@ -7,6 +7,7 @@
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.CheckTaskListParam;
import com.zy.asrs.enums.CheckStatusEnum;
import com.zy.asrs.mapper.CheckOrderMapper;
import com.zy.asrs.service.*;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
@@ -15,8 +16,10 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@Service("checkOrderService")
@@ -148,4 +151,42 @@
        return R.ok();
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void adjustOrderComplete(Long orderId, Long userId) {
        CheckOrder checkOrder = this.selectById(orderId);
        if (Cools.isEmpty(checkOrder)) {
            throw new CoolException("数据错误");
        }
        List<CheckOrderDetl> selectList = checkOrderDetlService.selectList(new EntityWrapper<CheckOrderDetl>().eq("order_id", orderId));
        for (CheckOrderDetl checkOrderDetl : selectList) {
            LocDetl locDetl = locDetlService.selectById(checkOrderDetl.getLocDetlId());
            if (Cools.isEmpty(locDetl)) {
                throw new CoolException("未找到库存数据,数据错误");
            }
            if (checkOrderDetl.getStatus().equals(CheckStatusEnum.ALLOW.type)) {
                BigDecimal decimal = locDetl.getBookQty().add(checkOrderDetl.getDiffQty());
                locDetl.setAnfme(decimal.doubleValue());
            }else if (checkOrderDetl.getStatus().equals(CheckStatusEnum.FORBID.type)) {
                if (locDetl.getDiffQty().compareTo(BigDecimal.ZERO) < 0) {
                    BigDecimal subtract = new BigDecimal(locDetl.getAnfme().toString()).subtract(locDetl.getDiffQty());
                    locDetl.setAnfme(subtract.doubleValue());
                }
            }
            locDetl.setDiffQty(BigDecimal.ZERO);
            locDetl.setModiTime(new Date());
            if (!locDetlService.updateById(locDetl)){
                throw new CoolException("更新库存数据失败");
            }
        }
        checkOrder.setSettle(4L);
        checkOrder.setUpdateTime(new Date());
        if (!this.updateById(checkOrder)){
            throw new CoolException("更新调整单状态失败");
        }
    }
}
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -10,6 +10,7 @@
import com.zy.asrs.entity.param.*;
import com.zy.asrs.entity.result.OpenOrderCompeteResult;
import com.zy.asrs.entity.result.StockVo;
import com.zy.asrs.enums.CheckStatusEnum;
import com.zy.asrs.mapper.TagMapper;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.MatUtils;
@@ -645,7 +646,7 @@
            checkOrderDetl.setAnfme(checkOrderDetl1.getAnfme());
            checkOrderDetl.setDiffQty(checkOrderDetl1.getDiffQty());
            checkOrderDetl.setWorkQty(checkOrderDetl1.getWorkQty());
            checkOrderDetl.setStatus(4);
            checkOrderDetl.setStatus(checkOrderDetl1.getStatus().equals(1)?CheckStatusEnum.ALLOW.type:CheckStatusEnum.FORBID.type);
            checkOrderDetl.setZpallet(locDetl.getZpallet());
            checkOrderDetl.setCreateTime(now);
            checkOrderDetl.setUpdateTime(now);
src/main/webapp/static/js/adjustOrder/adjustOrder.js
@@ -95,7 +95,7 @@
        if (layEvent === 'edit') {
            showEditModel(data);
        }else if (layEvent === 'adjust') {
            pakoutPreview(data.id);
            adjustComplete(data.id);
        }else if (layEvent === 'export') {
            export1(data.id);
        }else if (layEvent === 'del') {
@@ -451,10 +451,10 @@
    }
    function pakoutPreview(id) {
    function adjustComplete(id) {
        let loadIndex = layer.load(2);
        $.ajax({
            url: baseUrl + "/checkOrder/preview/auth",
            url: baseUrl + "/adjustOrder/complete/auth",
            headers: {'token': localStorage.getItem('token')},
            data: {
                orderId: id
@@ -462,10 +462,13 @@
            method: 'POST',
            success: function (res) {
                if (res.code === 200){
                    layer.close(loadIndex);
                    layer.msg(res.msg, {icon: 1});
                    insTb.reload({where: null});
                } else if (res.code === 403){
                    top.location.href = baseUrl+"/";
                } else {
                    layer.close(loadIndex);
                    layer.msg(res.msg, {icon: 2})
                }
            }
src/main/webapp/static/js/checkOrder/checkOrder.js
@@ -96,6 +96,8 @@
            showEditModel(data);
        }else if (layEvent === 'createTask') {
            pakoutPreview(data.id);
        }else if (layEvent === 'createAdjust') {
            createAdjust(data.id);
        }else if (layEvent === 'export') {
            export1(data.id);
        }else if (layEvent === 'del') {
@@ -452,6 +454,39 @@
        });
    }
    function createAdjust(orderId) {
        layer.confirm('确定要生成调整单吗?', {
            shade: .1,
            skin: 'layui-layer-admin'
        }, function (i) {
            layer.close(i);
            layer.load(2);
            $.ajax({
                url: baseUrl+"/adjustOrder/create/test",
                headers: {'token': localStorage.getItem('token')},
                data: {
                    orderId: orderId
                },
                method: 'POST',
                success: function (res) {
                    layer.closeAll('loading');
                    if (res.code === 200){
                        if (insTbCount === 0) {
                            insTb.reload({page: {curr: 1}});
                        } else {
                            $(".layui-laypage-btn")[0].click();
                        }
                        layer.msg(res.msg, {icon: 1});
                    } else if (res.code === 403){
                        top.location.href = baseUrl+"/";
                    }else {
                        layer.msg(res.msg, {icon: 2});
                    }
                }
            })
        });
    }
    function pakoutPreview(id) {
        let loadIndex = layer.load(2);
src/main/webapp/static/js/locDetl/locDetl.js
@@ -9,7 +9,18 @@
        ,{field: 'orderNo', align: 'center',title: '单据编号', hide: true}
        ,{field: 'batch', align: 'center',title: '批号', width: 300, sort:true}
        ,{field: 'anfme', align: 'center',title: '可用数量'}
        ,{field: 'bookQty', align: 'center',title: '账面数量'}
        ,{field: 'diffQty', align: 'center',title: '差异数量',
            templet: function(d) {
                // 根据条件判断字体颜色
                if (d.diffQty < 0 ) {
                    return '<span style="color: #de3434;">' +d.diffQty + '</span>';
                }else if (d.diffQty > 0){
                    return '<span style="color: #19fa02;">' +d.diffQty + '</span>';
                } else {
                    return '<span">' +d.diffQty + '</span>';
                }
            }}
        ,{field: 'bookQty', align: 'center',title: '原数量'}
        ,{field: 'zpallet', align: 'center',title: '托盘条码'}
        ,{field: 'specs', align: 'center',title: '规格'}
        ,{field: 'model', align: 'center',title: '代码', hide: true}
@@ -46,17 +57,7 @@
                    return '<span">' +d.frozen$ + '</span>';
                }
            }}
        ,{field: 'diffQty', align: 'center',title: '盘点数量',
            templet: function(d) {
                // 根据条件判断字体颜色
                if (d.diffQty < 0 ) {
                    return '<span style="color: #de3434;">' +d.diffQty + '</span>';
                }else if (d.diffQty > 0){
                    return '<span style="color: #19fa02;">' +d.diffQty + '</span>';
                } else {
                    return '<span">' +d.diffQty + '</span>';
                }
            }}
    ];
    // cols.push.apply(cols, detlCols);
src/main/webapp/views/checkOrder/checkOrder.html
@@ -113,6 +113,7 @@
    {{# } }}
    {{# if (d.settle == 4) { }}
    <a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs btn-complete" lay-event="export">导出差异单</a>
    <a class="layui-btn layui-btn-primary layui-btn-xs layui-border" lay-event="createAdjust">生成调整单</a>
    {{# } }}
</script>
<!-- 表格操作列 -->