自动化立体仓库 - WMS系统
#
yxFwq
2024-07-29 33cb8b070c31a96bc514d07e3d1d9f6514a057d9
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -11,6 +11,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.entity.vo.JarMastTableVo;
import com.zy.asrs.mapper.TagMapper;
import com.zy.asrs.service.*;
import com.zy.asrs.task.core.ReturnT;
@@ -30,6 +31,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.ArrayList;
import java.util.Date;
@@ -86,6 +88,10 @@
    private WorkService workService;
    @Autowired
    private BareBoardHandler bareBoardHandler;
    @Autowired
    private BasJarMastService basJarMastService;
    @Autowired
    private BasCrnpService basCrnpService;
    @Override
    @Transactional
@@ -1072,9 +1078,10 @@
                smallContainersJar(param);
            } else if (param.getType()==3){//直供产线
                smallContainersSta(param);
            } else if (param.getType()==99){//库内供产线  //出库  测试
                smallContainersBig99(param);
            }
//            else if (param.getType()==99){//库内供产线  //出库  测试
//                smallContainersBig99(param);
//            }
        } catch (Exception e){
            throw new CoolException("失败!!!原因:"+e.getMessage());
        }
@@ -1195,6 +1202,34 @@
            throw new CoolException("品号 matnr,重量范围偏移值为空!!!,请先下发基础档案!!!");
        }
        ArrayList<Integer> crns =new ArrayList<>();
        ArrayList<Integer> crnList =new ArrayList<>();
        crns.add(1);crns.add(2);crns.add(3);crns.add(4);crns.add(5);crns.add(6);crns.add(7);
        for (Integer crnNo : crns){
            // 检测路径
            Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
                    .eq("type_no", 101)
                    .eq("stn_no", param.getDevNo())
                    .eq("crn_no", crnNo);
            StaDesc staDesc = staDescService.selectOne(wrapper);
            if (Cools.isEmpty(staDesc)){
                continue;
            }
            BasCrnp basCrnp = basCrnpService.selectById(crnNo);
            if (basCrnp.getCrnSts()!=3 || !basCrnp.getOutEnable().equals("Y")){
                continue;
            }
            if (!basCrnpService.checkSiteError(crnNo, false)){
                continue;
            }
            crnList.add(crnNo);
        }
        if (crnList.isEmpty()){
            throw new CoolException("无可用堆垛机");
        }
        ArrayList<LocDetl> locDetlArrayList = new ArrayList<>();
        Wrapper<LocDetl> wrapper = new EntityWrapper<LocDetl>().eq("matnr", param.getMatnr()).eq("weight", param.getWeight());
@@ -1210,14 +1245,12 @@
        for (LocDetl locDetl:locDetls){
            LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo()));
            if (locMast.getLocSts().equals("F")){
                if (locDetlArrayList.size()<param.getBatchNum()) {//下
                    locDetlArrayList.add(locDetl);
                if (crnList.contains(locMast.getCrnNo())){
                    if (locDetlArrayList.size()<param.getBatchNum()) {//下
                        locDetlArrayList.add(locDetl);
                    }
                }
            }
        }
        if (locDetlArrayList.isEmpty()){
            throw new CoolException("未找到符合条件的物料明细:品号==》matnr:"+param.getMatnr()+";重量==》wright:"+param.getWeight());
        }
        Integer batchNum = param.getBatchNum();
@@ -1238,8 +1271,10 @@
            for (LocDetl locDetl:locDetls){
                LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo()));
                if (locMast.getLocSts().equals("F")){
                    if (locDetlArrayList.size()<batchNum) {//下
                        locDetlArrayList.add(locDetl);
                    if (crnList.contains(locMast.getCrnNo())){
                        if (locDetlArrayList.size()<batchNum) {//下
                            locDetlArrayList.add(locDetl);
                        }
                    }
                }
            }
@@ -1262,24 +1297,37 @@
            for (LocDetl locDetl:locDetls){
                LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetl.getLocNo()));
                if (locMast.getLocSts().equals("F")){
                    if (locDetlArrayList.size()<batchNum) {//下
                        locDetlArrayList.add(locDetl);
                    if (crnList.contains(locMast.getCrnNo())){
                        if (locDetlArrayList.size()<batchNum) {//下
                            locDetlArrayList.add(locDetl);
                        }
                    }
                }
            }
        }
        if (locDetlArrayList.isEmpty()){
            throw new CoolException("未找到符合条件的物料明细:品号==》matnr:"+param.getMatnr()+";重量==》wright:"+param.getWeight());
        }
        if (locDetlArrayList.size()<batchNum){
            throw new CoolException("库存数量:"+locDetlArrayList.size()+";小于需求数量:"+param.getBatchNum());
        }
        ArrayList<LocDetl> locDetlArraySou = new ArrayList<>();
        for (LocDetl locDetl : locDetlArrayList){
            if (batchNum <= 0){
                return;
            }
            StockOutParam stockOutParam = new StockOutParam(param,locDetl);
            workService.startupFullTakeStore(stockOutParam, userId);
            locDetlArraySou.add(locDetl);
            batchNum --;
        }
        try{
            StockOutParam stockOutParam = new StockOutParam(param,locDetlArraySou);
            workService.startupFullTakeStore(stockOutParam, userId);
        } catch (Exception e){
            throw new CoolException("生成出库任务失败:出库数量:"+locDetlArraySou.size());
        }
    }
    public void smallContainersJar(SmallCompleteParam param) {
@@ -1494,5 +1542,39 @@
        }
    }
    /*
     * 获取硫化罐任务信息  //
     * */
    @Override
    @Transactional
    public List<JarMastTableVo> getJatIdList(Integer id) {
        List<BasJarMast> jarMasts = basJarMastService.selectList(new EntityWrapper<BasJarMast>().eq("jar_id", id));
        if (Cools.isEmpty(jarMasts)){
            return new ArrayList<JarMastTableVo>();
        }
        ArrayList<JarMastTableVo> jarMastTableVos = new ArrayList<>();
        for (BasJarMast jarMast : jarMasts) {
            JarMastTableVo jarMastTableVo = new JarMastTableVo();
            WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", jarMast.getWrkNo()));
            List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", jarMast.getWrkNo()));
            if (wrkDetls.isEmpty()){
                WrkDetl wrkDetl = new WrkDetl();
                wrkDetls.add(wrkDetl);
            }
            if (Cools.isEmpty(wrkMast) || Cools.isEmpty(wrkDetls)){
                continue;
            }
            jarMastTableVo.setJarId(jarMast.getJarId());
            jarMastTableVo.setJarWrkNo(jarMast.getWrkNo().toString());
            jarMastTableVo.setStatus(jarMast.getStatus());
            jarMastTableVo.setStatus$(jarMast.getStatus$());
            jarMastTableVo.setMatnr(wrkDetls.get(0).getMatnr());
            jarMastTableVo.setMaktx(wrkDetls.get(0).getMaktx());
            jarMastTableVo.setWeight(wrkDetls.get(0).getWeight());
            jarMastTableVos.add(jarMastTableVo);
        }
        return jarMastTableVos;
    }
    /*...........................亳州煜星..............以上.............亳州煜星...........................*/
}