wuyouming666
2023-12-12 fb32fb5bb4be336171dca41e62d3d6c6c5803f34
springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java
@@ -64,7 +64,7 @@
            }
            // 判断选中笼子是否有合适宽度空格
            // 有合适空格时进片
            if (cages1 != null && cages >= 1) {
            if (cages1 != null && cages >= 1&&storageCage2.getDisabled()==0) {
                ids = cages1.getId();// 数据库ID
                tiers = cages1.getTier();// 内外片
                cells = cages1.getCell();// 格子号
@@ -87,16 +87,19 @@
                    //spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids-1, 2);
                    spianMapper.UpdataAddCage2(orderids, glassid, glasslist, cage1,cells, ids-1, 2);
                    spianMapper.UpdataAddCage1(widths, cage1, cells);// 减少格子宽度
                    spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString());// 新增任务
                    spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString(),prctier);// 新增任务
                    S7control.getinstance().WriteWord(adddresslist, datas);
                    System.out.println("汇报时任务|" + datas);
                   
                }else{
                 // 数据库修改笼子表新增一条玻璃
                //spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids, 2);
                spianMapper.UpdataAddCage2(orderids, glassid, glasslist, cage1,cells, ids, 2);
                spianMapper.UpdataAddCage1(widths, cage1, cells);// 减少格子宽度
                spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString());// 新增任务
                spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString(),prctier);// 新增任务
                S7control.getinstance().WriteWord(adddresslist, datas);
                    System.out.println("汇报时任务|" + datas);
                // S7control.getinstance().WriteByte("DB105.16",glassid);
                }
@@ -149,7 +152,7 @@
            spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度
            spianMapper.UpdataGlassCageState(glassid,3);//更改笼子表的玻璃状态
            
            spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增任务
            spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid,state);// 新增任务
            // int state = spianMapper.selectGlassState(cage, cell);//获取格子数量
            if (state == 2) {
                spianMapper.UpdateDBCage1(cage, cell);// 将内片数据更新到外片里
@@ -171,7 +174,7 @@
                datas.add((short) 1);
                datas.add((short) 1);
                spianMapper.OverOutSlice(glassid, 1);//更新出片队列任务状态为进行中
                spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增任务
                spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid,1);// 新增任务
                spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度
                spianMapper.UpdataGlassCageState(glassid,3);//更改笼子表的玻璃状态
                spianMapper.OverOutSlice(glassid,2);//完成出片队列任务
@@ -204,7 +207,7 @@
                    spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 减少新格子宽度
                    spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度
                    spianMapper.UpdataGlassCageState(glassids,3);//更改笼子表的玻璃状态
                    spianMapper.Inserttask(2, 0, cageout.getId(), ids, glassid);// 新增调度任务
                    spianMapper.Inserttask(2, 0, cageout.getId(), ids, glassid,2);// 新增调度任务
                    //spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增出片任务
                    // 传输mes数据,坐标,数据
                    S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务
@@ -228,7 +231,7 @@
                    datas.add((short) 2);
                    datas.add((short) 1);
                    String glassids = spianMapper.SelectGlassid(cage, cell); // 获取被调拨的玻璃id
                    spianMapper.Inserttask(2, 0, cageout.getId() + 1, ids, glassid);// 新增调度任务
                    spianMapper.Inserttask(2, 0, cageout.getId() + 1, ids, glassid,2);// 新增调度任务
                    //spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增出片任务
                    spianMapper.UpdateDBCage(ids, cage, cell,2);// 将原格子数据更新到新格子里
                    spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 减少新格子宽度
@@ -285,4 +288,17 @@
       boolean listbool = list.contains((short) 1);
        return listbool;
    }
    //根据玻璃id完成在进行中的任务
    public void overtask(String glassid){
        spianMapper.UpdateCageOver(glassid, 0);// 更改笼子表出片状态
        spianMapper.UpdatetaskOut(glassid); // 完成上一次出片或者进片任务
        spianMapper.OverOutSlice(glassid, 2);// 完成出片队列任务
        spianMapper.UpdataGlassCage(glassid,0);// 清除出片格子玻璃信息
        String barcode=spianMapper.SelectBarcode(glassid);//获取该玻璃的铝框id
        spianMapper.UpdateAddQueue(glassid);//把进片的玻璃更新到出片队列中
        int barcodeState=spianMapper.SelectOverState(barcode);//获取该铝框的状态
        if(barcodeState==2){//当该铝框所有的玻璃都是完成状态时删除在出片队列的数据
            spianMapper.DeleteQueue(barcode);
        }
    }
}