自动化立体仓库 - WMS系统
#
lsh
2024-01-19 1607086231421efad1dae82c00f044b0b9070532
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -1,6 +1,7 @@
package com.zy.asrs.service.impl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
@@ -12,11 +13,17 @@
import com.zy.asrs.entity.result.StockVo;
import com.zy.asrs.mapper.TagMapper;
import com.zy.asrs.service.*;
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.utils.MatUtils;
import com.zy.asrs.utils.PostMesDataUtils;
import com.zy.common.model.DetlDto;
import com.zy.common.model.LocTypeDto;
import com.zy.common.model.StartupDto;
import com.zy.common.model.enums.WorkNoType;
import com.zy.common.service.CommonService;
import com.zy.common.utils.NodeUtils;
import com.zy.common.web.WcsController;
import com.zy.common.web.param.SearchLocParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -65,6 +72,14 @@
    private LocDetlRullUpDetailService locDetlRullUpDetailService;
    @Autowired
    private WrkDetlSingleService wrkDetlSingleService;
    @Autowired
    private WrkMastStaService wrkMastStaService;
    @Autowired
    private WrkMastStaLogService wrkMastStaLogService;
    @Autowired
    private StaDescService staDescService;
    @Autowired
    private LocMastService locMastService;
    @Override
    @Transactional
@@ -679,7 +694,7 @@
     * */
    @Override
    @Transactional
    public void palletizingComplete(PalletizingCompleteParam param) {
    public void palletizingComplete(PalletizingCompleteParam2 param) {
        Long userId = 7777L;//中控
        //判断param参数
        if (Cools.isEmpty(param.getBarcode())){
@@ -695,7 +710,7 @@
        ArrayList<String> positions = new ArrayList<>();   //木箱位置查重      (orgin)
        ArrayList<String> boxNos = new ArrayList<>();   //木箱唯一编码查重  (batch)
        //判断matLists参数
        for (PalletizingCompleteParam.MatList matList:param.getMatLists()){
        for (PalletizingCompleteParam2.MatList matList:param.getMatLists()){
            if (Cools.isEmpty(matList.getMatnr())){
                throw new CoolException("参数:物料编码 matnr为空");
            }else if (Cools.isEmpty(matList.getPosition())){
@@ -744,7 +759,7 @@
        Date now = new Date();
        for (PalletizingCompleteParam.MatList matList:param.getMatLists()){
        for (PalletizingCompleteParam2.MatList matList:param.getMatLists()){
            long rollUp = new Date().getTime();
            Mat mat = matService.selectByMatnr(matList.getMatnr());
            if (Cools.isEmpty(mat)) {
@@ -767,7 +782,7 @@
            waitPakin.setModiTime(now);
            waitPakin.setRollUp(rollUp);
            if (!Cools.isEmpty(matList.getMatDetlList())){
                for (PalletizingCompleteParam.MatDetlList matDetlList:matList.getMatDetlList()){
                for (PalletizingCompleteParam2.MatDetlList matDetlList:matList.getMatDetlList()){
                    LocDetlRullUpDetail locDetlRullUpDetail = new LocDetlRullUpDetail();
                    locDetlRullUpDetail.setUuid(rollUp);
                    locDetlRullUpDetail.setRollNo(matDetlList.getBoxNoDetl());
@@ -780,6 +795,26 @@
            }
        }
    }
    /*
     * 松盛(1楼):码垛完成下发入库信息
     * */
    @Override
    @Transactional
    public void palletizingCompleteS(PalletizingCompleteParam param) {
        //判断param参数
        if (Cools.isEmpty(param.getBarcode())){
            throw new CoolException("参数:托盘码 barcode为空");
        }
        WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode());
        if (Cools.isEmpty(wrkMast) || wrkMast.getWrkSts()!=2){
            log.error("退库码垛完成,返回托盘码未查询到工作档案!");
            throw new CoolException("参数:托盘码 barcode未查询到工作档案");
        }
        wrkMast.setSheetNo("4");
        wrkMastService.updateById(wrkMast);
    }
@@ -810,14 +845,14 @@
        //判断param参数
        if (Cools.isEmpty(param.getPalletizingNo())){
            throw new CoolException("参数:码垛位编号 palletizingNo为空");
        }else if (Cools.isEmpty(param.getMatLists()) || param.getMatLists().size()==0){
        }else if (Cools.isEmpty(param.getMatList()) || param.getMatList().size()==0){
            throw new CoolException("参数:物料明细 matLists为空");
        }
        ArrayList<WrkDetl> wrkDetlsNew = new ArrayList<>();
        ArrayList<WrkDetlSingle> wrkDetlsOld = new ArrayList<>();
        //判断matLists参数
        for (SingleUnstackingCompleteParam.MatList matList:param.getMatLists()){
        for (SingleUnstackingCompleteParam.MatList matList:param.getMatList()){
            if (Cools.isEmpty(matList.getPosition())){
                throw new CoolException("参数:码垛位置 position为空");
            }else if (Cools.isEmpty(matList.getBoxNo())){
@@ -852,7 +887,7 @@
        wrkMast.setIoType(202); // 入出库状态:202.拆垛后出库
        wrkMast.setIoPri(99D); // 优先级
        wrkMast.setSourceStaNo(param.getDevNo$());
        wrkMast.setStaNo(140); //贴标站点
        wrkMast.setStaNo(144); //贴标站点  直接到尾端
        // 操作人员数据
        wrkMast.setAppeUser(userId);
        wrkMast.setAppeTime(now);
@@ -891,9 +926,10 @@
        //判断param参数
        if (Cools.isEmpty(param.getBarcode())){
            throw new CoolException("参数:托盘码 barcode为空");
        }else if (Cools.isEmpty(param.getPalletizingNo())){
            throw new CoolException("参数:码垛位编号 palletizingNo为空");
        }
//        else if (Cools.isEmpty(param.getPalletizingNo())){
//            throw new CoolException("参数:码垛位编号 palletizingNo为空");
//        }
        WrkMast wrkMastMatrix = wrkMastService.selectByBarcode(param.getBarcode());
        if (Cools.isEmpty(wrkMastMatrix)){
            throw new CoolException("参数:托盘码查询工作档失败:"+param.getBarcode());
@@ -957,19 +993,94 @@
    @Override
    @Transactional
    public void cs2() {
        BasDevp basDevp = basDevpService.selectById(216);
        basDevp.setWrkNo(0);
        basDevp.setBarcode("");
        basDevpService.updateById(basDevp);
//        int[] staNos =new int[]{122};
//        for (Integer staNo:staNos){
//            int[] crnNos =new int[]{6};
//            for (Integer crnNo:crnNos){
//                descSta(staNo,crnNo);
//            }
//        }
    }
    /*
    private void descSta(Integer staNo,Integer crnNo){
//        int[] typeNos =new int[]{1,10,53,101,103,110};
        int[] typeNos =new int[]{10,110};
        for (Integer typeNo:typeNos){
            descSta3(staNo,crnNo,typeNo);
        }
    }
    private void descSta3(Integer staNo,Integer crnNo,Integer typeNo){
        StaDesc staDesc = new StaDesc();
        staDesc.setTypeNo(typeNo);
        staDesc.setStnNo(staNo);
        staDesc.setCrnNo(crnNo);
        staDesc.setCrnStn(CrnNoRC(crnNo,staDesc.getTypeNo()>100));
        descSta2(staDesc);
    }
    private void descSta2(StaDesc staDesc){
        Date now = new Date();
        //入库
        int sameRes = staDescService.selectCount(new EntityWrapper<StaDesc>()
                .eq("type_no", staDesc.getTypeNo())
                .eq("stn_no", staDesc.getStnNo())
                .eq("crn_no", staDesc.getCrnNo())
                .eq("crn_stn", staDesc.getCrnStn()));
        if (sameRes == 0) {
            staDesc.setModiUser(9527L);
            staDesc.setModiTime(now);
            staDesc.setAppeUser(9527L);
            staDesc.setAppeTime(now);
            staDescService.insert(staDesc);
        }
    }
    private Integer CrnNoRC(Integer crnNo,boolean sign){
        Integer crnStn = 0;
        switch (crnNo){
            case 1:
                crnStn = 102;
                break;
            case 2:
                crnStn = 105;
                break;
            case 3:
                crnStn = 108;
                break;
            case 4:
                crnStn = 111;
                break;
            case 5:
                crnStn = 114;
                break;
            case 6:
                crnStn = 117;
                break;
        }
        if (sign){
            return crnStn-2;
        }
        return crnStn;
    }
        /*
     *
     * */
    @Override
    @Transactional
    public void cs3() {
        //拆盘
//        WrkMastSta wrkMastSta1 = new WrkMastSta(new Date(),119);
//        wrkMastSta1.setType(2);
//        wrkMastSta1.setWrkType(2);
//        wrkMastStaService.insert(wrkMastSta1);
//        WrkMastSta wrkMastSta2 = new WrkMastSta(new Date(),121);
//        wrkMastSta2.setType(2);
//        wrkMastSta2.setWrkType(2);
//        wrkMastStaService.insert(wrkMastSta2);
    }
    /*...........................上饶江铜..............以上.............徐工汉云...........................*/