自动化立体仓库 - WMS系统
#
luxiaotao1123
2021-11-23 18bce44b2fc1588d9430f3573c1419236fe64869
#
5个文件已修改
180 ■■■■ 已修改文件
src/main/java/com/zy/asrs/entity/WrkMast.java 65 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/LocDetlMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/LocDetlMapper.xml 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/wrkMast/wrkMast.js 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/WrkMast.java
@@ -289,6 +289,7 @@
    @ApiModelProperty(value= "条码")
    private String barcode;
    // Y:销售订单出库任务
    @ApiModelProperty(value= "")
    @TableField("Pdc_type")
    private String PdcType;
@@ -364,59 +365,59 @@
    }
//    WrkMast wrkMast = new WrkMast(
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    // 工作状态
//            null,    // 入出库类型
//            null,    // 堆垛机
//            null,    //
//            null,    //
//            null,    // 优先级
//            null,    //
//            null,    //
//            null,    // 目标库位
//            null,    // 目标站
//            null,    // 源站
//            null,    // 源库位
//            null,    //
//            null,    //
//            null,    // 拣料
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    // 退出
//            null,    //
//            null,    //
//            null,    // 空板
//            null,    // 工作时间
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    // 堆垛机启动时间
//            null,    // 堆垛机停止时间
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    // 拣料时间
//            null,    // 修改人员
//            null,    // 修改时间
//            null,    // 创建者
//            null,    // 添加时间
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    // 备注
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null,    // 条码
//            null,    //
//            null,    //
//            null,    //
//            null,    //
//            null    // 满板
//    );
src/main/java/com/zy/asrs/mapper/LocDetlMapper.java
@@ -34,7 +34,7 @@
    List<LocDetl> getStockStatisExcel();
    @Select("select sum(anfme) as sum from asr_loc_detl where matnr = #{matnr}")
    @Select("select sum(a.anfme) as sum from asr_loc_detl a left join asr_loc_mast b on a.loc_no = b.loc_no where b.loc_sts = 'F' and a.matnr = #{matnr}")
    Double selectSumAnfmeByMatnr(@Param("matnr") String matnr);
    List<LocDetl> selectPakoutByRule(String matnr);
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -13,6 +13,7 @@
import com.zy.asrs.entity.param.FullStoreParam;
import com.zy.asrs.entity.param.LocDetlAdjustParam;
import com.zy.asrs.entity.param.StockOutParam;
import com.zy.asrs.entity.result.PakoutVo;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.VersionUtils;
import com.zy.common.model.*;
@@ -22,6 +23,7 @@
import com.zy.common.service.wms.WmsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -673,6 +675,18 @@
            // 出库 ===>> F.在库
            if (wrkMast.getIoType() > 100 && wrkMast.getIoType() != 110) {
                locSts = "F";
                // 销售单关联,则生成新的出库任务
                if (wrkMast.getPdcType().equals("Y")) {
                    List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", workNo));
                    for (WrkDetl wrkDetl : wrkDetls) {
                        Double sumAnfme = Optional.ofNullable(locDetlService.getSumAnfme(wrkDetl.getMatnr())).orElse(0.0D);
                        if (sumAnfme < wrkDetl.getAnfme()) {
                            throw new CoolException("取消失败!库存不足以重新生成出库作业");
                        }
                    }
                    // 生成新的出库作业
                    stockOutRe(wrkMast, wrkDetls);
                }
            // 空板出库 ===>> D.空桶/空栈板
            } else if (wrkMast.getIoType() == 110) {
                locSts = "D";
@@ -785,4 +799,54 @@
        }
    }
    @Autowired
    private JdbcTemplate jdbcTemplate;
    private boolean pickSite = false;
    private void stockOutRe(WrkMast wrkMast, List<WrkDetl> wrkDetls) {
        for (WrkDetl wrkDetl : wrkDetls) {
            List<LocDetl> locDetls = locDetlService.selectPakoutByRule(wrkDetl.getMatnr());
            double issued = wrkDetl.getAnfme();
            for (LocDetl locDetl : locDetls) {
                if (issued > 0) {
                    // 生成出库工作档
                    // 全板
                    if (issued>=locDetl.getAnfme()) {
                        BasDevp staNo = basDevpService.checkSiteStatus(103);
                        List<LocDetlDto> detlDtos = new ArrayList<>();
                        LocDetlDto dto = new LocDetlDto();
                        dto.setLocDetl(locDetl);
                        dto.setCount(issued>=locDetl.getAnfme()?locDetl.getAnfme():issued);
                        detlDtos.add(dto);
                        stockOut(staNo, detlDtos, 101, 9527L, null, true, null);
                        // 拣料
                    } else {
                        int priorCount = jdbcTemplate.queryForObject("select isnull(count(*),0) from man_prior where 1=1 and matnr = '" + wrkDetl.getMatnr() + "'", Integer.class);
                        if (priorCount > 0) {
                            BasDevp staNo = basDevpService.checkSiteStatus(103);
                            List<LocDetlDto> detlDtos = new ArrayList<>();
                            LocDetlDto dto = new LocDetlDto();
                            dto.setLocDetl(locDetl);
                            dto.setCount(locDetl.getAnfme());
                            detlDtos.add(dto);
                            stockOut(staNo, detlDtos, 101, 9527L,null, true,locDetl.getAnfme()-issued);
                        } else {
                            BasDevp staNo = basDevpService.checkSiteStatus(pickSite?113:109);
                            List<LocDetlDto> detlDtos = new ArrayList<>();
                            LocDetlDto dto = new LocDetlDto();
                            dto.setLocDetl(locDetl);
                            dto.setCount(issued>=locDetl.getAnfme()?locDetl.getAnfme():issued);
                            detlDtos.add(dto);
                            stockOut(staNo, detlDtos, 103, 9527L, null, true, null);
                        }
                    }
                    // 剩余待出数量递减
                    issued = issued - locDetl.getAnfme();
                }
            }
        }
        pickSite = !pickSite;
    }
}
src/main/resources/mapper/LocDetlMapper.xml
@@ -106,22 +106,22 @@
    </select>
    <select id="selectPakoutByRule" resultMap="BaseResultMap">
        select * from asr_loc_detl
        select a.* from asr_loc_detl a left join asr_loc_mast b on a.loc_no = b.loc_no
        where 1=1
        and matnr = #{matnr}
        and b.loc_sts = 'F'
        and a.matnr = #{matnr}
        order by
        anfme asc,
        DATEPART(yyyy,modi_time),DATEPART(mm,modi_time),DATEPART(dd,modi_time)
        DATEPART(yyyy,a.modi_time),DATEPART(mm,a.modi_time),DATEPART(dd,a.modi_time)
        desc,
        case
        when (left(loc_no, 2) = '01') then 0
        when (left(loc_no, 2) = '02') then 1
        when (left(loc_no, 2) = '03') then 1
        when (left(loc_no, 2) = '04') then 0
        when (left(loc_no, 2) = '05') then 0
        when (left(loc_no, 2) = '06') then 1
        when (left(loc_no, 2) = '07') then 1
        when (left(loc_no, 2) = '08') then 0
        when (left(a.loc_no, 2) = '01') then 0
        when (left(a.loc_no, 2) = '02') then 1
        when (left(a.loc_no, 2) = '03') then 1
        when (left(a.loc_no, 2) = '04') then 0
        when (left(a.loc_no, 2) = '05') then 0
        when (left(a.loc_no, 2) = '06') then 1
        when (left(a.loc_no, 2) = '07') then 1
        when (left(a.loc_no, 2) = '08') then 0
        else 0
        end
        desc
src/main/webapp/static/js/wrkMast/wrkMast.js
@@ -301,13 +301,24 @@
                break;
            // 取消
            case 'cancel':
                layer.confirm('确认取消该笔工作档?', {title: '工作号:'+data.wrkNo, shadeClose: true}, function(){
                    http.post(baseUrl+"/hand/control/wrkMast", {workNo: data.wrkNo, type:2}, function (res) {
                        $(".layui-laypage-btn")[0].click();
                        layer.msg(data.wrkNo + res.msg);
                    })
                    layer.closeAll();
                });
                if (data.pdcType === "Y") {
                    layer.confirm('当前任务关联ERP销售单,取消将重新生成出库作业,是否继续?', {title: '工作号:'+data.wrkNo, shadeClose: true}, function(){
                        http.post(baseUrl+"/hand/control/wrkMast", {workNo: data.wrkNo, type:2}, function (res) {
                            $(".layui-laypage-btn")[0].click();
                            layer.msg(data.wrkNo + res.msg);
                        })
                        layer.closeAll();
                    });
                } else {
                    layer.confirm('确认取消该笔工作档?', {title: '工作号:'+data.wrkNo, shadeClose: true}, function(){
                        http.post(baseUrl+"/hand/control/wrkMast", {workNo: data.wrkNo, type:2}, function (res) {
                            $(".layui-laypage-btn")[0].click();
                            layer.msg(data.wrkNo + res.msg);
                        })
                        layer.closeAll();
                    });
                }
                break;
            //  拣料入库
            case 'pick':