wuyouming666
2023-09-18 c07b4f92f7598b6f69d4c709d6651aeab24e69e1
springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java
@@ -150,7 +150,8 @@
        int prcid;
        int tiers;
        int prctier;
        double width;
        double minwidth=0;
        spianMapper.Updatetask(1, 0);//完成任务
            Glass glasslist = spianMapper.selectGlass(glassid);
        if(glasslist==null){
@@ -177,22 +178,24 @@
            cage1 = storageCage2.getCage();
            // 判断该笼子号相邻最大的空格数
            int cages = spianMapper.selectCage(cage1);
            StorageCage cages1 ;
            //判断是否是第二片需要加间隔物
            prctier = spianMapper.selectsum(cage1, storageCage2.getCell());// 传给prc的格子内玻璃数
                if(prctier>0){
                   cages1 = spianMapper.selectCage1(cage1,storageCage2.getCell(),widths+400);
                }else{
                    cages1 = spianMapper.selectCage1(cage1,storageCage2.getCell(),widths);
                }
            // 判断选中笼子是否有合适宽度空格
            StorageCage cages1 = spianMapper.selectCage1(cage1, widths);
            if (cages1 != null) {
             // 有合适空格时进片
            if (cages1 != null&&cages>=1) {
                ids = cages1.getId();// 数据库ID
                tiers = cages1.getTier();// 内外片
                cells = cages1.getCell();// 格子号
                prcid = cages1.getPrcId();// 传给prc的目标地id
               if (glasslist == null) {
                    return (300);
                }
                spianMapper.Inserttask(0, 0, 1000, ids,glassid.toString());//新增任务
                prctier = spianMapper.selectsum(cage1, cells);// 传给prc的格子内玻璃数
                // 有合适空格时进片
                if (cages > 1 && cages1.getTier() != null) {
                width=cages1.getWidth();//格子剩余宽度
                widths=glasslist.getWidth();
                    // 执行进片
                    datas.add((short) 1000);
                    datas.add((short) prcid);
@@ -201,10 +204,10 @@
                    // 数据库修改笼子表新增一条玻璃
                    spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids, 1);
                    spianMapper.UpdataAddCage1(widths, cage1, cells);//减少格子宽度
                    spianMapper.Inserttask(0, 0, 1000, ids,glassid.toString());//新增任务
                    S7control.getinstance().WriteWord(adddresslist, datas);
                    return (200);
                }
                   return (200);
            }
        }
@@ -242,17 +245,18 @@
        double glasswidth = cageout.getGlassWidth();
        // 判断玻璃内外片
        if (tier == 2) {
            int state = spianMapper.selectGlassState(cage, cell);//获取格子数量
            // 判断玻璃可直接出片时
            // 修改数据库笼子表(出片)
            datas.add((short) prcid);
            datas.add((short) 1000);
            datas.add((short) 1);
            datas.add((short) state);
            datas.add((short) 1);
               
            spianMapper.UpdataOutCage1(glasswidth, cage, cell);//增加原格子宽度
            spianMapper.UpdataGlassCage("", "", glasswidth, cage, cell, tier, 0);//清除格子玻璃信息
            spianMapper.Inserttask(1, 0,cageout.getId(),1000,glassid);//新增任务
            int state = spianMapper.selectGlassState(cage, cell);//获取格子数量
            //int state = spianMapper.selectGlassState(cage, cell);//获取格子数量
            if(state==2){
                spianMapper.UpdateDBCage1(cage, cell);// 将内片数据更新到外片里
                spianMapper.UpdateDBCage2(cage, cell);// 清除内片数据