wu
2024-11-07 2d92826d942cd4c06e1f415d4a3896b99ec65e2b
更改配片逻辑
16个文件已修改
1296 ■■■■■ 已修改文件
Albania_Mes-ui/src/api/home.js 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Albania_Mes-ui/src/lang/locales/en-US.json 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Albania_Mes-ui/src/lang/locales/zh-CN.json 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Albania_Mes-ui/src/views/home/index.vue 205 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java 205 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java 163 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/entity/Queue.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/entity/StorageCage.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/mapper/AlbaniaMapper.java 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/mapper/GlassInfoMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/mapper/QueueMapper.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/service/HomeService.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/service/SpianServiceNew.java 308 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java 153 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Albania_Mes-ui/src/api/home.js
@@ -295,9 +295,9 @@
}
export function deleteTasks(num) {
    return request({
        url: '/home/deleteTasks?num='+num,
        url: '/home/deleteTasks',
        method: 'post',
        data:""
        data:{"num":num}
    })
}
@@ -356,6 +356,14 @@
        data:""
    })
}
export function SaveMeasure(films,thickness) {
    return request({
        url: '/home/SaveMeasure?films='+films+'&thickness='+thickness,
        method: 'post',
        data:""
    })
}
export function ModeChange(flowcard,method) {
    return request({
@@ -364,9 +372,9 @@
        data:""
    })
}
export function StartChange(flowcard) {
export function StartChange(flowcard,orderstate) {
    return request({
        url: '/home/StartChange?flowcard='+flowcard,
        url: '/home/StartChange?flowcard='+flowcard+'&orderstate='+orderstate,
        method: 'post',
        data:""
    })
Albania_Mes-ui/src/lang/locales/en-US.json
@@ -15,6 +15,7 @@
  "All Out":"All Out",
  "Operation failed":"Operation canceled",
  "Flowcard":"Flowcard",
  "Mateid":"Mateid",
  "Glasstype":"Glasstype",
  "Mode Change":"Mode Change",
  "Start Task":"Start Task",
@@ -26,6 +27,7 @@
  "'No Of Cage":"'No Of Cage",
  "Finish No":"Finish No",
  "Mate No":"Mate No",
  "Cage GlassNumber":"在笼数量",
  "Order":"Order",
  "Select":"Select",
  "GlassType":"GlassType",
@@ -43,6 +45,7 @@
  "MeasureNumber":"MeasureNumber",
  "results":"results",
  "start work":"start work",
  "stop work":"stop work",
  "Line":"Line",
  "Please select a route":"Please select a route",
  "This route already has a task":"This route already has a task",
@@ -51,7 +54,8 @@
  
  
  "ip":"192.168.10.2",
  "ip2":"192.168.10.2",
  "ip":"localhost",
  "systemTitle": "Login System",
  "usernamePlaceholder": "Please enter username",
  "passwordPlaceholder": "Please enter password",
Albania_Mes-ui/src/lang/locales/zh-CN.json
@@ -14,17 +14,19 @@
  "Productname":"项目名称",
  "All Out":"全部出完",
  "Operation failed":"操作失败",
  "Flowcard":"流程卡",
  "Flowcard":"订单",
  "Mateid":"配片ID",
  "Glasstype":"玻璃类型",
  "Mode Change":"模式更改",
  "Start Task":"开始任务",
  "Stop Task":"停止任务",
  "Start Task":"开始出片",
  "Stop Task":"停止出片",
  "No Of Cage":"笼子号",
  "Task State":"任务状态",
  "Task Method":"任务模式",
  "Task Line":"任务线路",
  "Task State":"出片状态",
  "Task Method":"出片模式",
  "Task Line":"出片线路",
  "Finish No":"完成数量",
  "Mate No":"配对编号",
  "Cage GlassNumber":"在笼数量",
  "Order":"订单",
  "Select":"查询",
  "GlassType":"玻璃类型",
@@ -41,15 +43,17 @@
  "Clear":"清除",
  "MeasureNumber":"测量数量",
  "results":"结果",
  "start work":"开始工程",
  "start work":"开始上片",
  "stop work":"暂停上片",
  "Line":"线路",
  "Please select a route":"请选择线路",
  "This route already has a task":"此路线已存在任务",
  "Save":"保存",
  "Select file":"选择文件",
  "ip":"192.168.10.2",
  "ip1":"localhost",
  "ip2":"192.168.10.2",
  "ip":"localhost",
  "systemTitle": "登录系统",
  "usernamePlaceholder": "请输入用户名",
  "passwordPlaceholder": "请输入密码",
@@ -299,7 +303,7 @@
  "Slot No": "格子",
  "Barcode": "玻璃id",
  "Delete": "删除",
  "Out": "出片",
  "Out": "配片出片",
  "Operation successful": "操作成功",
  "Operation canceled": "操作取消",
  "There is no such order": "没有此订单的玻璃",
Albania_Mes-ui/src/views/home/index.vue
@@ -327,6 +327,11 @@
    display: inline-block;
    cursor: pointer;
}
.bold-center {
    font-weight: bold;
    text-align: center;
}
</style>
<template>
    <el-container>
@@ -432,7 +437,7 @@
                        </div>
                    </div>
                    <el-table :data="this.tasklist1" border style="width: 700px;">
                        <el-table-column prop="glasstype" :label="$t('Glasstype')"></el-table-column>
                        <el-table-column prop="mateid" :label="$t('Mateid')"></el-table-column>
                        <el-table-column prop="storageCage.cage" :label="$t('Cage No')"></el-table-column>
                        <el-table-column prop="storageCage.cell" :label="$t('Slot No')"></el-table-column>
                        <el-table-column prop="storageCage.glassWidth" :label="$t('Width')"></el-table-column>
@@ -447,7 +452,7 @@
                        </el-table-column>
                    </el-table>
                    <el-table :data="this.tasklist2" border style="width: 100%">
                        <el-table-column prop="glassId" :label="$t('Glasstype')"></el-table-column>
                        <el-table-column prop="mateid" :label="$t('Mateid')"></el-table-column>
                        <el-table-column prop="storageCage.cage" :label="$t('Cage No')"></el-table-column>
                        <el-table-column prop="storageCage.cell" :label="$t('Slot No')"></el-table-column>
                        <el-table-column prop="storageCage.glassWidth" :label="$t('Width')"></el-table-column>
@@ -478,7 +483,7 @@
                            <!-- 保存 -->
                            <el-button type="primary" @click="importData()"
                                style="margin-right: 10px;margin-bottom: 10px;">{{
                                $t('Save') }}</el-button>
                                    $t('Save') }}</el-button>
                            <input type="file" id="file-upload" multiple @change="Change" />
                            <label for="file-upload">{{ $t('Select file') }}</label>
                        </div>
@@ -504,17 +509,35 @@
        <el-dialog :visible.sync="Measure" :title="$t('Measure')" top="5vh"><!--测量页面-->
            <!--测量页面主体-->
            <div style="height: 780px;">
            <div style="height: 800px;">
                <!--功能-->
                <div>
                    <!-- <el-button type="primary" @click="ManualMatching()" :disabled="(this.LastQueue.state <= 0)"
                    <el-button type="primary" @click="ManualMatching()" :disabled="(this.LastQueue.state > 1)"
                        style="z-index: 999;">{{ $t('Manual matching') }}</el-button>
                    <el-button type="primary" @click="ManualTake()" :disabled="(this.LastQueue.state <= 0)"
                    <el-button type="primary" @click="ManualTake()" :disabled="(this.LastQueue.state > 1)"
                        style="z-index: 999;">{{
                $t('Manual removal') }}</el-button> -->
                    <el-button type="primary" @click="AnewMeasure()" :disabled="(this.LastQueue.state <= 0)"
                $t('Manual removal') }}</el-button>
                    <el-button type="primary" @click="AnewMeasure()"
                        style="z-index: 999;">{{
                            $t('Remeasure') }}</el-button>
                    <!-- 输入下拉框1 -->
                    <!-- SelectSetting -->
                    <label for="file-upload"  style="font-weight: bold;font-size: 16px;margin-left: 50px;">{{ $t('Films') }}:{{SelectSetting.films }}</label>
                    <el-select v-model="selectedValue1" :placeholder="$t('Films')">
                        <el-option v-for="item in selectedOption1.films" :key="item.value" :label="item.films"
                            :value="item.films">
                        </el-option>
                    </el-select>
                    <!-- 输入下拉框2 -->
                    <label for="file-upload"  style="font-weight: bold;font-size: 16px;">{{ $t('Thickness') }}:{{SelectSetting.thickness }}mm</label>
                    <el-select v-model="selectedValue2" :placeholder="$t('Thickness')">
                        <el-option v-for="item in selectedOption2.thickness" :key="item.value" :label="item.thickness"
                            :value="item.thickness">
                        </el-option>
                    </el-select>
                    <el-button type="primary" @click="SaveMeasure(selectedValue1,selectedValue2)"
                        style="z-index: 999;">{{
                            $t('Save') }}</el-button>
                </div>
                <br>
                <!--显示-->
@@ -544,7 +567,7 @@
                </div>
                <!--显示-->
                <div style="width:20px;height: 720px;float: left;"></div>
                <div style="width:600px;height: 720px;border: 2px solid #d1d1d1;float: left;">
                <div style="width:700px;height: 720px;border: 2px solid #d1d1d1;float: left;">
                    <!--玻璃图  #81b337  padding: 50px 50px;-->
                    <!-- <span class="measuretitle">{{ $t('Width') }}:</span> <span class="measureValue">{{
                this.LastQueue.glasswidth
@@ -564,8 +587,9 @@
                this.LastQueue.state > 0 ? $t('Matching successful') :
                    (this.LastQueue.state == 0 ? $t('Multiple data matching') : $t('Matching failed')) }}</span>
                    <br> -->
                    <el-table :data="this.tasklist3" :row-class-name="rowClassName" style="width: 100%;padding:0;">
                    <el-table :data="this.tasklist3" :height="700"  :row-class-name="rowClassName" style="width: 100%;padding:0;">
                        <el-table-column prop="flowcard" :label="$t('Flowcard')"></el-table-column>
                        <el-table-column prop="mateid" :label="$t('Mateid')"></el-table-column>
                        <el-table-column prop="films" :label="$t('Films')"></el-table-column>
                        <el-table-column prop="width" :label="$t('Width')"></el-table-column>
                        <el-table-column prop="height" :label="$t('Height')"></el-table-column>
@@ -579,16 +603,18 @@
        </el-dialog>
        <el-dialog :visible.sync="StorageCage" :title="$t('StorageCage')" top="5vh">
            <el-table :data="this.StorageCageInfo" :height="700" border style="width: 100%;overflow: auto;">
            <el-table :data="this.StorageCageInfo" :height="700" border style="width: 100%;overflow: auto;"
                :span-method="spanMethod" class="bold-center">
                <el-table-column :min-width="80" prop="cage" :label="$t('Cage No')"></el-table-column>
                <el-table-column :min-width="80" prop="cell" :label="$t('Slot No')"></el-table-column>
                <el-table-column :min-width="80" prop="glasstype" :label="$t('GlassType')"></el-table-column>
                <el-table-column :min-width="80" prop="flowcard" :label="$t('Flowcard')"></el-table-column>
                <el-table-column :min-width="80" prop="mateid" :label="$t('Mateid')"></el-table-column>
                <el-table-column :min-width="80" prop="glassWidth" :label="$t('Width')"></el-table-column>
                <el-table-column :min-width="80" prop="glassHeight" :label="$t('Height')"></el-table-column>
                <el-table-column :min-width="80" prop="thickness" :label="$t('Thickness')"></el-table-column>
                <el-table-column :min-width="80" prop="films" :label="$t('Films')"></el-table-column>
                <el-table-column :min-width="80" prop="number" :label="$t('number')"></el-table-column>
                <el-table-column :min-width="80" prop="width" :label="$t('Width')"></el-table-column>
                <!-- <el-table-column :min-width="80" prop="width" :label="$t('Width')"></el-table-column> -->
                <el-table-column :min-width="250" :label="$t('Operate')">
                    <template slot-scope='scope'>
                        <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
@@ -617,17 +643,18 @@
                :tree-props="{ children: 'glassinfo', hasChildren: 'hasChildren' }">
                <el-table-column prop="flowcard" :label="$t('Order')" width="150" align="center">
                    <template slot-scope='scope'>
                        <div
                           >
                        <div>
                            {{ scope.row.flowcard }}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="glasstype" :label="$t('GlassType')" align="center">
                <el-table-column prop="mateid" :label="$t('Mateid')" align="center">
                </el-table-column>
                <el-table-column prop="number" :label="$t('Order No')" align="center">
                <el-table-column prop="tier" :label="$t('Tier')" align="center">
                </el-table-column>
                <el-table-column prop="cageno" :label="$t('No Of Cage')" align="center">
                <el-table-column prop="number" :label="$t('Number')" align="center">
                </el-table-column>
                <el-table-column prop="cageno" :label="$t('Cage GlassNumber')" align="center">
                </el-table-column>
                <el-table-column prop="finishnumber" :label="$t('Finish No')" align="center">
                </el-table-column>
@@ -644,7 +671,7 @@
                <el-table-column prop="state" :label="$t('Task State')" align="center">
                    <template slot-scope='scope'>
                        <div
                            :style="{ backgroundColor: scope.row.state === 0 ? '' : '#00FFFF', width: '105%', height: '125%',lineHeight: '50px'}">
                            :style="{ backgroundColor: scope.row.state === 0 ? '' : '#00FFFF', width: '105%', height: '125%', lineHeight: '50px' }">
                            {{ scope.row.state >= 0 ? scope.row.state == 0 ? $t('Stop') : $t('Start') : "" }}
                        </div>
                    </template>
@@ -654,9 +681,11 @@
                        {{ scope.row.state >= 0 ? scope.row.state == 0 ? $t('Stop') : $t('Start') : "" }}
                    </template>
                </el-table-column> -->
                <el-table-column prop="method" :label="$t('Task Method')">
                <el-table-column prop="method" :label="$t('Task Method')" align="center">
                    <template slot-scope='scope'>
                        {{ scope.row.state >= 0 ? scope.row.method == 0 ? $t('Out') : $t('All Out') : "" }}
                        <div style="text-align: center;width: 105%;">
                            {{ scope.row.state >= 0 ? (scope.row.method == 0 ? $t('Out') : $t('All Out')) : "" }}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="line" :label="$t('Task Line')">
@@ -681,24 +710,24 @@
                            {{ $t('Mode Change') }}</el-button>
                        <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
                            v-show="scope.row.state >= 0 ? true : false" @click="StartChange(scope.row.flowcard)">
                            {{ scope.row.orderstate > 0 ? $t('start work') : $t('start work') }}</el-button>
                            v-show="scope.row.state >= 0 ? true : false" @click="StartChange(scope.row.flowcard, scope.row.orderstate)">
                            {{ scope.row.orderstate > 0 ? $t('stop work') : $t('start work') }}</el-button>
                        <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
                            v-show="scope.row.state >= 0 ? true : false"
                            @click="deleteTasks(scope.row.flowcard)">
                            v-show="scope.row.state >= 0 ? true : false" @click="deleteTasks(scope.row.flowcard)">
                            {{ $t('langDelete') }}</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </el-dialog>
        <!-- 人工匹配 -->
        <el-dialog :visible.sync="StorageCageAdd" :title="$t('StorageCageAdd')" top="5vh" width="80%">
            <div style="display: flex;height: 40px;line-height: 40px;">
                <label for="">{{ $t('Width') }}</label>
                <el-input v-model="StorageCageForm.width" autocomplete="off" style="width:15%;" />
                <el-input v-model="StorageCageForm.glasswidthmm" autocomplete="off" style="width:15%;" />
                <label for="">{{ $t('Height') }}</label>
                <el-input v-model="StorageCageForm.height" autocomplete="off" style="width:15%;" />
                <el-input v-model="StorageCageForm.glassheightmm" autocomplete="off" style="width:15%;" />
                <label for="">{{ $t('Thickness') }}</label>
                <el-input v-model="StorageCageForm.thickness" autocomplete="off" style="width:15%;" />
                <label for="">{{ $t('Films') }}</label>
@@ -709,7 +738,7 @@
            <el-table :data="this.StorageCageAddInfo" :height="700" border style="width: 100%;overflow: auto;">
                <el-table-column prop="flowcard" :label="$t('Flowcard')"></el-table-column>
                <el-table-column prop="tier" :label="$t('Tier')"></el-table-column>
                <el-table-column prop="glasstype" :label="$t('GlassType')"></el-table-column>
                <el-table-column prop="mateid" :label="$t('Mateid')"></el-table-column>
                <el-table-column prop="width" :label="$t('Width')"></el-table-column>
                <el-table-column prop="height" :label="$t('Height')"></el-table-column>
                <el-table-column prop="thickness" :label="$t('Thickness')"></el-table-column>
@@ -733,7 +762,7 @@
    Disabled, SelectPermissionByUserName, currentUsername, CompleteQueue,
    isAllowReorderings,
    UpdateStroageCageByCell, FinishTask, SelectGlassInfo, StorageCageAddGlass, ClaimTasks, ModeChange, UpdateQueue, importData, ManualTake, AnewMeasure, StartChange, deleteTasks
    UpdateStroageCageByCell, FinishTask, SelectGlassInfo, StorageCageAddGlass, ClaimTasks, ModeChange, UpdateQueue, importData, ManualTake, AnewMeasure, StartChange, deleteTasks,SaveMeasure
} from "../../api/home";
@@ -747,14 +776,28 @@
            carposition: 0,
            // selected: [],
            selected: Array.from({ length: 1000 }, () => 1),
            selected2: Array.from({ length: 1000 }, () => 1),
            selected3: Array.from({ length: 1000 }, () => 1),
            // selected: '1',
            options: [{
                value: '1',
                label: '1'
            }],
            // mounted() {
            //   this.selected[scope.$index] = '1'; // 假设你想让第一个下拉框默认选中 '选项 1'
            // },
            // 测量下拉框膜系
            selectedOption1: {
                films: [],
              },
              selectedOption2: {
                thickness: [],
              },
            //  selectedOption1: [films],
            //  selectedOption2: [thickness],
            selectedValue1: null, // 用于存储第一个下拉框的选中值
            selectedValue2: null, // 用于存储第二个下拉框的选中值
            // 将值赋给 selectedValue1 和 selectedValue2
            dataList: [],
            tableData1: [],
            Measuermode: false,
@@ -775,8 +818,8 @@
            StorageCageAdd: false,
            StorageCageInfo: [],
            StorageCageForm: {
                width: "",
                height: "",
                glasswidthmm: "",
                glassheightmm: "",
                thickness: "",
                films: ""
            },
@@ -794,6 +837,8 @@
            cagelist2: [],
            cagelist3: [],
            cagelist4: [],
            SelectMeasure: [],
            SelectSetting: [],
            task1: 3,
            task2: 2,
            tasklist1: [],
@@ -847,7 +892,7 @@
            PromptSize: 250,
            reset: false,
            isQueueWarning: false,
            CurrentFrame: [],
            // CurrentFrame: [],
            DeviceList: [1, 1, 1, 1],
            GlassIdList: [],
            Scanningmethod: true,
@@ -859,11 +904,13 @@
    created() {
        this.load();
    },
    activated() {
        this.init();
    }
    ,
    methods: {
        showform(i) {
            if (i == 1) {
@@ -912,6 +959,23 @@
                    this.tasklist3 = obj.glassInfoFlowCard[0];
                    this.tasklist2 = obj.StoragTaskeTaskFeed[0];
                    this.tasklist1 = obj.StoragTaskeTaskOut[0];
                    this.SelectSetting=obj.SelectSetting[0];
                    this.selectedOption1.films = obj.SelectMeasure[0];
                    this.selectedOption2.thickness = obj.SelectMeasure[0];
                    // if(obj.StorageCageForm.length == 0){
                    //     this.StorageCageForm.glasswidthmm = ""
                    //     this.StorageCageForm.glassheightmm = ""
                    //     this.StorageCageForm.films = ""
                    //     this.StorageCageForm.thickness = ""
                    // }else{
                    //     this.StorageCageForm = obj.StorageCageForm[0];
                    // }
                    // console.log(obj.StorageCageForm[0]);
                    //在这里写下拉选的v-for的名称
                    if (obj.alarmmg[0].length > 0) {
                        if (this.alarm.length > 0) {
                            if (this.alarm[this.alarm.length - 1].id != obj.alarmmg[0][obj.alarmmg[0].length - 1].id) {
@@ -952,6 +1016,7 @@
                    this.$forceUpdate();
                }.bind(this);
                //关闭事件
                socket.onclose = function () {
                    console.log("websocket已关闭");
@@ -966,6 +1031,7 @@
                });
            }
        },
        load() {
            //加载用户权限
            currentUsername().then(res => {
@@ -1005,6 +1071,7 @@
                this.cageinfo = res.data.cageinfo;
                this.currentPages = 1;
            });
        },
        //添加理片笼玻璃
        StorageCageAddGlass(index) {
@@ -1056,25 +1123,46 @@
                }
            });
        },//选择开始工程
        StartChange(flowcard) {
            StartChange(flowcard).then(res => {
        StartChange(flowcard,orderstate) {
            if(orderstate==1){
            StartChange(flowcard,0).then(res => {
                if (res.data.message == 200) {
                    this.$message.success(this.$t('Operation successful'));
                }
            });
        }else{
            StartChange(flowcard,1).then(res => {
                if (res.data.message == 200) {
                    this.$message.success(this.$t('Operation successful'));
                }
            });
        }
        },
        //选择开始工程
        deleteTasks(flowcard) {
            deleteTasks(flowcard).then(res => {
                console.log("@" + flowcard + "@");
                if (res.data.message == 200) {
                    this.$message.success(this.$t('Operation successful'));
                }
            });
        },
        //选择开始工程
        deleteTasks(flowcard) {
            deleteTasks(flowcard).then(res => {
                console.log("@"+flowcard+"@");
                if (res.data.message == 200) {
        //保存测量膜系的参数
        SaveMeasure(films,thickness) {
            console.log('Films:', films);  // 打印 films
            console.log('Thickness:', thickness);  // 打印 thickness
            SaveMeasure(films,thickness).then(res => {
                if (res.data.message >= 1) {
                    this.$message.success(this.$t('Operation successful'));
                }
            });
        },
        //查询玻璃信息
        SelectGlassInfo() {
            SelectGlassInfo(this.StorageCageForm.width, this.StorageCageForm.height, this.StorageCageForm.thickness, this.StorageCageForm.films).then(res => {
            console.log(this.StorageCageForm.glasswidthmm);
            SelectGlassInfo(this.StorageCageForm.glasswidthmm, this.StorageCageForm.glassheightmm, this.StorageCageForm.thickness, this.StorageCageForm.films).then(res => {
                this.StorageCageAddInfo = res.data.StorageCageAddInfo;
            })
        },
@@ -1112,7 +1200,35 @@
                }
            });
        },
        spanMethod({ rowIndex, columnIndex }) {
            let zhi1 = this.StorageCageInfo[rowIndex].cage;
            let zhi2 = 0;
            if (rowIndex > 0) {
                zhi2 = this.StorageCageInfo[rowIndex - 1].cage;
            }
            if (columnIndex === 0) { // 仅处理 cage 列
                // console.log(columnIndex,rowIndex);
                if (zhi1 != zhi2) {
                    const currentCage = this.StorageCageInfo[rowIndex].cage;
                    let span = { rowspan: 1, colspan: 1 };
                    // 检查后续行,找到相同的 cage 值
                    for (let i = rowIndex + 1; i < this.StorageCageInfo.length; i++) {
                        if (this.StorageCageInfo[i].cage === currentCage) {
                            span.rowspan++;
                        } else {
                            break;
                        }
                    }
                    return span;
                } else {
                    return { rowspan: 0, colspan: 0 };
                }
            }
            // 其他列保持默认,不合并
            return { rowspan: 1, colspan: 1 };
        },
        //改变每页容纳的数据量
        handleSizeChange: function (size) {
            this.pagesize = size;
@@ -1234,6 +1350,7 @@
            importData(tbdata).then(res => {
                if (res.data.message == 200) {
                    this.$message.success(this.$t('Operation successful'));
                    this.dataList = null;
                }
            });
        },
springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java
@@ -1,4 +1,7 @@
package com.example.springboot.component;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import com.example.springboot.service.SpianServiceNew;
import com.example.springboot.service.StorageCageService;
@@ -6,16 +9,14 @@
import com.example.springboot.entity.device.PlcParameterObject;
import com.example.springboot.mapper.AlbaniaMapper;
public class PlcHoldNew extends Thread {
  @Autowired
  private AlbaniaMapper albaniaMapper;
  private SpianServiceNew spianService;
  private StorageCageService storageCageService;
  int aaa;
  String huibao = "";
  @Override
  public void run() {
@@ -23,101 +24,137 @@
    while (this != null) {
      try {
        Thread.sleep(500);
        Thread.sleep(300);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
      storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
      spianService = WebSocketServer.applicationContext.getBean(SpianServiceNew.class);
      albaniaMapper = WebSocketServer.applicationContext.getBean(AlbaniaMapper.class);
      //读取DB14区文件
      PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
      if(plcmes.getPlcParameter("PLCToMES").getValue()!=null){
      // spianService.Mestast("NG0001-1",40,1,0,"MESID1",1);
      // spianService.Mestast("NG0001-2",40,2,0,"MESID2",2);
      // spianService.Mestast("NG0001-3",40,2,1,"MESID3",3);
      String ExportTOMES1=plcmes.getPlcParameter("ExportTOMES1").getValue();//出片请求一线
      String ExportToMES2=plcmes.getPlcParameter("ExportToMES2").getValue();//出片请求二线
      String PLCToMES=plcmes.getPlcParameter("PLCToMES").getValue();//运送车请求
      String IDStatus1=plcmes.getPlcParameter("IDStatus1").getValue();//1号任务完成
      String MESToPLCStatus1=plcmes.getPlcParameter("MESToPLCStatus1").getValue();//1号确认字
      String MESToPLC=plcmes.getPlcParameter("MESToPLC").getValue();//发送任务字
      // String scan=plcmes.getPlcParameter("scan").getValue();//发送扫码信息
      // if(scan.equals("1")==true){
      //   spianService.scan(scan);
      // }
      //一号线请求
      if(ExportTOMES1!=null&&MESToPLC!=null){
      if (ExportTOMES1.equals("1") == true&&MESToPLC.equals("0")==true) {
        spianService.selectout(1);
      }
    }
      // //二线号请求时
    //   if(ExportToMES2!=null &&MESToPLC!=null){
    //   if (ExportToMES2.equals("1") == true&&MESToPLC.equals("0")==true) {
    //     spianService.selectout(2);
    //   }
    // }
      //进片请求时
      GlassInfo glass=albaniaMapper.SelectGlass();
      if(PLCToMES!=null && glass!=null&&MESToPLC!=null){
      if(PLCToMES.equals("1")==true&&MESToPLC.equals("0")==true){
        spianService.selectAll(glass);
      }
    }
    // System.out.println("IDStatus1:"+IDStatus1+"MESToPLCStatus1:"+MESToPLCStatus1);
      //任务完成时
      if(IDStatus1.equals("1")==true && MESToPLCStatus1.equals("0")==true){
        //完成确认字
        for(int i=1;i<7;i++){
          String Tastover=plcmes.getPlcParameter("IDStatus"+i).getValue();//PLC理片任务状态汇报
          String Glassid=plcmes.getPlcParameter("MESID"+i).getValueString();//MES玻璃ID
          GlassInfo id=albaniaMapper.SelectTaskId(Glassid);
            if(id!=null&&Tastover.equals("1")){
              //调用完成任务 Glassid
              storageCageService.FinishTask(id.getId());
            }
              S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStatus"+i).getAddress(), (short) 1);//完成确认字
              System.out.println("完成确认字MESToPLCStatus");
      spianService.selectout(1);
      // 读取DB14区文件
      PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
      if (plcmes.getPlcParameter("PLCToMES").getValue() != null) {
        String ExportTOMES1 = plcmes.getPlcParameter("ExportTOMES1").getValue();// 出片请求一线
        String PLCToMES = plcmes.getPlcParameter("PLCToMES").getValue();// 运送车请求
        String IDStatus1 = plcmes.getPlcParameter("IDStatus1").getValue();// 1号任务完成
        String MESToPLCStatus1 = plcmes.getPlcParameter("MESToPLCStatus1").getValue();// 1号确认字
        String MESToPLC = plcmes.getPlcParameter("MESToPLC").getValue();// 发送任务字
        int taskcont = albaniaMapper.SelectTaskcount(); // 正在进行的任务数量
        int outtask = albaniaMapper.SelectOutTaskCount(); // 等待补发的出片任务数量
        if(outtask>0){
          spianService.mateOut();
        }
        // String scan=plcmes.getPlcParameter("scan").getValue();//发送扫码信息
        // if(scan.equals("1")==true){
        // spianService.scan(scan);
        // }
        // 获取当前时间
        String currentTime = new Date().toString();
        if (!huibao.equals(IDStatus1)) {
          System.out.println("汇报记录:" + IDStatus1 + "时间" + currentTime);
        }
        huibao = IDStatus1;
        // 一号线请求
        if (ExportTOMES1 != null && MESToPLC != null && taskcont == 0) {
          if (ExportTOMES1.equals("1") == true && MESToPLC.equals("0") == true && PLCToMES.equals("1") == true
              && MESToPLCStatus1.equals("0") == true) {
            System.out
                .println("出片状态:MESToPLC:" + MESToPLC + "PLCToMES:" + PLCToMES + "MESToPLCStatus1:" + MESToPLCStatus1);
            spianService.selectout(1);
            try {
              Thread.sleep(200); // 每100毫秒检查一次
            } catch (InterruptedException e) {
              Thread.currentThread().interrupt(); // 处理线程中断
            }
              S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short) 0);//清除任务发送字
              System.out.println("清除任务发送字MESToPLC");
          }
      //汇报取消时
      if(IDStatus1.equals("0")==true &&MESToPLCStatus1.equals("1")){
        //取消确认字
        for(int i=1;i<7;i++){
          String Tastover=plcmes.getPlcParameter("IDStatus"+i).getValue();//依次获取任务汇报
          if(Tastover.equals("0")){
            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStatus"+i).getAddress(), (short) 0);//清除确认字
            System.out.println("清除确认字MESToPLCStatus");
          }
        }
        PLCToMES = plcmes.getPlcParameter("PLCToMES").getValue();// 运送车请求
        IDStatus1 = plcmes.getPlcParameter("IDStatus1").getValue();// 1号任务完成
        MESToPLCStatus1 = plcmes.getPlcParameter("MESToPLCStatus1").getValue();// 1号确认字
        MESToPLC = plcmes.getPlcParameter("MESToPLC").getValue();// 发送任务字
        // 运送车请求和测量完成请求
        GlassInfo glass = albaniaMapper.SelectGlass();
        if (PLCToMES != null && glass != null && MESToPLC != null && taskcont == 0) {
          if (PLCToMES.equals("1") == true && MESToPLC.equals("0") == true && MESToPLCStatus1.equals("0") == true) {
            try {
              Thread.sleep(100); // 每100毫秒检查一次
            } catch (InterruptedException e) {
              Thread.currentThread().interrupt(); // 处理线程中断
            }
            System.out
                .println("进片状态:MESToPLC:" + MESToPLC + "PLCToMES:" + PLCToMES + "MESToPLCStatus1:" + MESToPLCStatus1);
            spianService.selectAll(glass);
          }
        }
        // 任务完成时
        if ((IDStatus1.equals("1") && MESToPLCStatus1.equals("0")) ||
            (IDStatus1.equals("4") && MESToPLCStatus1.equals("0"))) {
          // 完成确认字
          for (int i = 1; i < 7; i++) {
            String Tastover = plcmes.getPlcParameter("IDStatus" + i).getValue();// PLC理片任务状态汇报
            String Glassid = plcmes.getPlcParameter("MESID" + i).getValueString();// MES玻璃ID
            GlassInfo id = albaniaMapper.SelectTaskId(Glassid);
            if (Tastover.equals("1")) {
              // 调用完成任务 Glassid
              storageCageService.FinishTask();
              System.out.println("完成任务ID:" + id);
            } else if (Tastover.equals("4")) {
              storageCageService.FinishTask();
              System.out.println("完成失败任务ID:" + id);
            }
            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStatus" + i).getAddress(), (short) 1);// 完成确认字
          }
          System.out.println("完成确认字MESToPLCStatus");
          // 清除任务地址
          for (int i = 1; i < 7; i++) {
            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStart" + i).getAddress(), (short) 0);// 清除任务地址
            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCTarget" + i).getAddress(), (short) 0);// 清除任务地址
          }
          System.out.println("清除任务地址");
          while (true) {
            String currentValue = plcmes.getPlcParameter("MESToPLC").getValue();
            // 检查 MESToPLC 的值是否为 0
            if (currentValue.equals("0")) {
              System.out.println("MESToPLC 已变为 0,停止循环写入");
              break; // 退出循环
            }
            // 如果不为 0,继续写入
            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(),
                (short) 0);// 清除任务发送字
            System.out.println("继续写入 MESToPLC,当前值:" + currentValue);
            // 加上延时,避免占用过多 CPU 资源
            try {
              Thread.sleep(100); // 例如每秒检查一次
            } catch (InterruptedException e) {
              e.printStackTrace();
            }
          }
        }
        // 汇报取消时
        if ((IDStatus1.equals("0")) && MESToPLCStatus1.equals("1")) {
          // 取消确认字
          for (int i = 1; i < 7; i++) {
            String Tastover = plcmes.getPlcParameter("IDStatus" + i).getValue();// 依次获取任务汇报
            if (Tastover.equals("0")) {
              S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStatus" + i).getAddress(), (short) 0);// 清除确认字
            }
          }
          System.out.println("清除确认字MESToPLCStatus");
        }
      }
  }
      // 查询数据库
      // 推送到前端
    }
  }
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -3,12 +3,15 @@
import cn.hutool.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.example.springboot.service.*;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import com.example.springboot.entity.Flowcard;
import com.example.springboot.entity.Glass;
import com.example.springboot.entity.GlassInfo;
import com.example.springboot.entity.MeasureSetting;
import com.example.springboot.entity.Out_slice;
@@ -77,7 +80,7 @@
                storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
                glassInfoMapper = WebSocketServer.applicationContext.getBean(GlassInfoMapper.class);
                // 获取其车的位置
                if (S7control.getinstance().CheckConnected() == true&&false) {
                if (S7control.getinstance().CheckConnected() == true && false) {
                    double carposition = 0;
                    float car = S7control.getinstance().readFloat32("DB10.1992");
                    carposition = (-40 + (car / (carend - carstart) * 595));
@@ -117,8 +120,8 @@
                // 是否需要人工确认上片玻璃
                jsonObject.append("isConfirm", isConfirm);
                // 查询当前铝框信息
                Out_slice CurrentFrame = outSliceServive.SelectCurrentFrame();
                jsonObject.append("CurrentFrame", CurrentFrame);
                // Out_slice CurrentFrame = outSliceServive.SelectCurrentFrame();
                // jsonObject.append("CurrentFrame", CurrentFrame);
                // 读取DB105区文件
                PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
@@ -132,40 +135,41 @@
                // String MesSend = "0";
                // double width = 727;
                // double height = 414;
                //匹配
            //    System.err.println(PlcRequest+","+MesSend+","+width+","+height);
                if (plcmes.getPlcParameter("GaToMES").getValue() != null) {
                String PlcRequest = plcmes.getPlcParameter("GaToMES").getValue();// 请求
                String MesSend = plcmes.getPlcParameter("MESToGaStatus").getValue();// 发送
                double width = Double.valueOf(plcmes.getPlcParameter("width").getValue());//
               // 宽
                double height =Double.valueOf(plcmes.getPlcParameter("Height").getValue());// 高
                if ("0".equals(PlcRequest) && istest) {
                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),
                (short) 0);
                }
                // System.out.println("PlcRequest:" + PlcRequest+"MesSend:" + MesSend+"width:" + width+"height:" + height);
                if ("1".equals(PlcRequest) && "0".equals(MesSend)) {
                boolean is = HomeService.Normal(width, height, "1");
                if (is && istest) {
                // 测量成功
                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1);
                }
                else if (istest) {
                // 重新测量
                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),
                (short) 4);
                }
                }
                // 匹配
                // System.err.println(PlcRequest+","+MesSend+","+width+","+height);
                if (plcmes.getPlcParameter("GaToMES").getValue() != null) {
                    String PlcRequest = plcmes.getPlcParameter("GaToMES").getValue();// 请求
                    String MesSend = plcmes.getPlcParameter("MESToGaStatus").getValue();// 发送
                    double width = Double.valueOf(plcmes.getPlcParameter("width").getValue());//
                    // 宽
                    double height = Double.valueOf(plcmes.getPlcParameter("Height").getValue());// 高
                    if ("0".equals(PlcRequest) && istest) {
                        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),
                                (short) 0);
                    }
                    // System.out.println("PlcRequest:" + PlcRequest+"MesSend:" + MesSend+"width:" +
                    // width+"height:" + height);
                    if ("1".equals(PlcRequest) && "0".equals(MesSend)) {
                        boolean is = HomeService.Normal(width, height, "1");
                        if (is && istest) {
                            // 测量成功
                            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),
                                    (short) 1);
                        } else if (istest) {
                            // 重新测量
                            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),
                                    (short) 4);
                        }
                    }
                }
                // S7control.getinstance().WriteWord("DB14.170", (short)0);
                // 正在上片订单中的所有小片信息
                // 正在上片订单中的所有小片信息
                List<GlassInfo> glassInfoFlowCard = glassInfoMapper.selectOrderState(1);
                jsonObject.append("glassInfoFlowCard", glassInfoFlowCard);
@@ -201,6 +205,16 @@
                List<StorageTask> StoragTaskeTaskOut = storageCageService.SelectStorageTask(1);
                jsonObject.append("StoragTaskeTaskOut", StoragTaskeTaskOut);
                // 查询所有玻璃厚度和膜系
                List<GlassInfo> SelectMeasure = storageCageService.SelectMeasure();
                jsonObject.append("SelectMeasure", SelectMeasure);
                // 查询当前膜系厚度
                MeasureSetting SelectSetting = storageCageService.SelectSetting();
                jsonObject.append("SelectSetting", SelectSetting);
                // 查询现在的玻璃厚度和膜系
                Map StorageCageForm = storageCageService.StorageCageForm();
                jsonObject.append("StorageCageForm", StorageCageForm);
                // //查询当前订单任务
                List<Flowcard> OrderTask = storageCageService.SelectOrderTask();
                jsonObject.append("OrderTask", OrderTask);
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
@@ -62,22 +62,20 @@
  private JdbcConnections jdbcConnections;
  @GetMapping("/WriteWord")
  public Result WriteWord(String address,float value,String type)  {
    if("0".equals(type)){
      System.err.println("写入word"+address+"+"+value);
      S7control.getinstance().WriteWord(address, (short)value);
    }
    else if("3".equals(type)){
      System.err.println("写入time"+address+"+"+value);
      S7control.getinstance().writetime(address, (long)value);
    }
    else{
      System.err.println("写入float"+address+"+"+value);
  public Result WriteWord(String address, float value, String type) {
    if ("0".equals(type)) {
      System.err.println("写入word" + address + "+" + value);
      S7control.getinstance().WriteWord(address, (short) value);
    } else if ("3".equals(type)) {
      System.err.println("写入time" + address + "+" + value);
      S7control.getinstance().writetime(address, (long) value);
    } else {
      System.err.println("写入float" + address + "+" + value);
      S7control.getinstance().writeFloat32(address, value);
    }
    Map<String, Object> map = new HashMap<>();
    map.put("message", "200");
    return Result.success(map);
@@ -85,16 +83,16 @@
  // 写入bit
  @GetMapping("/WriteBit")
  public Result WriteBit(String address,short value)  {
  public Result WriteBit(String address, short value) {
    boolean values;
    if (value == 0) {
      values=false;
    }else{
      values=true;
      values = false;
    } else {
      values = true;
    }
    S7control.getinstance().WriteBit(address, values);
    System.err.println("写入bit"+address+"+"+values);
    System.err.println("写入bit" + address + "+" + values);
    Map<String, Object> map = new HashMap<>();
    map.put("message", "200");
    return Result.success(map);
@@ -159,6 +157,7 @@
      map.put("message2", "500");
    } else {
      // 调用伍上片函数
      System.out.println("调用上片函数");
      short results = spianService.selectAll(glassid);
      if (results == 200) {
        map.put("message2", "200");
@@ -321,7 +320,7 @@
  @PostMapping("/InsertQueueGlassId")
  public Result InsertQueueGlassId(Short id, @RequestBody Queue queue) {
    return storageCageService.InsertQueueGlassId(id, queue);
  }
  // 确认扫码位玻璃信息
@@ -416,6 +415,7 @@
    map.put("message", "200");
    return Result.success(map);
  }
  // 手动完成任务
  @PostMapping("/CompleteQueue")
  public Result CompleteQueue(String id, String frameid, String glassid) {
@@ -493,69 +493,82 @@
  // 切换PLC获取二维码方式
  @PostMapping("/UpdateStroageCageByCell")
  public Result UpdateStroageCageByCell(Integer cell,Integer num) {
    return storageCageService.UpdateStroageCageByCell(cell,num);
  public Result UpdateStroageCageByCell(Integer cell, Integer num) {
    return storageCageService.UpdateStroageCageByCell(cell, num);
  }
  //手动完成任务
  // 手动完成任务
  @PostMapping("/FinishTask")
  public Result FinishTask(Integer id) {
    return storageCageService.FinishTask(id);
    return storageCageService.FinishTask();
  }
  //查询玻璃信息
  // 查询玻璃信息
  @PostMapping("/SelectGlassInfo")
  public Result SelectGlassInfo(String width,String height,String thickness,String films) {
    return storageCageService.SelectGlassInfo(width,height,thickness,films);
  public Result SelectGlassInfo(String width, String height, String thickness, String films) {
    return storageCageService.SelectGlassInfo(width, height, thickness, films);
  }
  //添加玻璃信息到笼子
  // 添加玻璃信息到笼子
  @PostMapping("/StorageCageAddGlass")
  public Result StorageCageAddGlass(String cell,@RequestBody GlassInfo glassInfo) {
    return storageCageService.StorageCageAddGlass(cell,glassInfo);
  public Result StorageCageAddGlass(String cell, @RequestBody GlassInfo glassInfo) {
    return storageCageService.StorageCageAddGlass(cell, glassInfo);
  }
  //领取/暂停任务
  @PostMapping("/ClaimTasks")
  public Result ClaimTasks(String flowcard,Integer state, Integer line) {
    return storageCageService.ClaimTasks(flowcard,state,line);
  }
  //修改出片方式
  @PostMapping("/ModeChange")
  public Result ModeChange(String flowcard,Integer method) {
    return storageCageService.ModeChange(flowcard,method);
  }
   //添加玻璃信息到测量信息
   @PostMapping("/UpdateQueue")
   public Result UpdateQueue(@RequestBody GlassInfo glassInfo) {
     return storageCageService.UpdateQueue(glassInfo);
   }
    //人工拿走
    @PostMapping("/ManualTake")
    public Result ManualTake(@RequestBody String glassInfo) {
      return storageCageService.ManualTake(glassInfo);
    }
    //开始工程
    @PostMapping("/StartChange")
    public Result StartChange(String flowcard) {
      return storageCageService.StartChange(flowcard);
    }
    //重新测量
    @PostMapping("/AnewMeasure")
    public Result AnewMeasure(@RequestBody String glassInfo) {
      return storageCageService.AnewMeasure(glassInfo);
    }
   //导入数据 :添加玻璃信息
   @PostMapping("/importData")
   public Result importData(@RequestBody List<Map> IportDataStr) {
     return storageCageService.AddGlassinfo(IportDataStr);
   }
    //删除订单
    @PostMapping("/deleteTasks")
    public Result deleteTasks(@RequestBody String flowcard){
      return storageCageService.deleteTasks(flowcard);
    }
  // 领取/暂停任务
  @PostMapping("/ClaimTasks")
  public Result ClaimTasks(String flowcard, Integer state, Integer line) {
    return storageCageService.ClaimTasks(flowcard, state, line);
  }
  // 修改出片方式
  @PostMapping("/ModeChange")
  public Result ModeChange(String flowcard, Integer method) {
    return storageCageService.ModeChange(flowcard, method);
  }
  // 添加玻璃信息到测量信息
  @PostMapping("/UpdateQueue")
  public Result UpdateQueue(@RequestBody GlassInfo glassInfo) {
    return storageCageService.UpdateQueue(glassInfo);
  }
  // 人工拿走
  @PostMapping("/ManualTake")
  public Result ManualTake(@RequestBody String glassInfo) {
    return storageCageService.ManualTake(glassInfo);
  }
  // 开始工程
  @PostMapping("/StartChange")
  public Result StartChange(String flowcard,int orderstate) {
    return storageCageService.StartChange(flowcard,orderstate);
  }
  // 重新测量
  @PostMapping("/AnewMeasure")
  public Result AnewMeasure(@RequestBody String glassInfo) {
    return storageCageService.AnewMeasure(glassInfo);
  }
  // 导入数据 :添加玻璃信息
  @PostMapping("/importData")
  public Result importData(@RequestBody List<Map> IportDataStr) {
    return storageCageService.AddGlassinfo(IportDataStr);
  }
  // 删除订单
  @PostMapping("/deleteTasks")
  public Result deleteTasks(@RequestBody Map num) {
    System.out.println("控制器:" + num);
    return storageCageService.deleteTasks(num);
  }
  // 保存膜系设置
  @PostMapping("/SaveMeasure")
  public Result SaveMeasure(String films, Integer thickness) {
    System.out.println("控制器:" + films+thickness);
    return storageCageService.SaveMeasure(films,thickness);
  }
}
springboot-vue3/src/main/java/com/example/springboot/entity/Queue.java
@@ -13,7 +13,7 @@
    private int glasstype;//类型
    private int state;//状态
    private String time;//修改时间
    private int mateid;//配片id
    public int getid() {
        return id;
    }
@@ -110,4 +110,12 @@
        this.time = time;
    }
    public int getmateid() {
        return mateid;
    }
    public void setmateid(int mateid) {
        this.mateid = mateid;
    }
}
springboot-vue3/src/main/java/com/example/springboot/entity/StorageCage.java
@@ -84,5 +84,9 @@
     * 玻璃数量
     */
    private Integer number;
    /**
     * 配片ID
     */
    private Integer mateid;
}
springboot-vue3/src/main/java/com/example/springboot/mapper/AlbaniaMapper.java
@@ -1,4 +1,6 @@
package com.example.springboot.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
@@ -7,6 +9,7 @@
import org.springframework.stereotype.Repository;
import com.example.springboot.entity.GlassInfo;
import com.example.springboot.entity.StorageCage;
import com.example.springboot.entity.StorageTask;
@Mapper
@Repository
@@ -26,9 +29,12 @@
    //增加任务记录
    @Insert("INSERT INTO `albania`.`storage_task`(`task_type`, `task_state`, `shelf_rack`, `load_rack`,start_time,glass_id,glasstype,flowcard,mateid,tier) VALUES (#{tasktype},#{taskstate},#{shelfrack},#{loadrack},now(),#{glassid},#{glasstype},#{flowcard},#{mateid},#{tier});")
    void Inserttask(int tasktype, int taskstate, int shelfrack, int loadrack, String glassid, int glasstype,String flowcard,int mateid,int tier);
    //增加代发任务记录
    @Insert("INSERT INTO `albania`.`out_task`(`task_type`, `task_state`, `shelf_rack`, `load_rack`,start_time,glass_id,glasstype,flowcard,mateid,tier) VALUES (#{tasktype},#{taskstate},#{shelfrack},#{loadrack},now(),#{glassid},#{glasstype},#{flowcard},#{mateid},#{tier});")
    void InsertOutTask(int tasktype, int taskstate, int shelfrack, int loadrack, String glassid, int glasstype,String flowcard,int mateid,int tier);
    //新增一条笼子数据
    @Update("UPDATE `albania`.`storage_cage` SET `glass_id` =#{glassid}, `width` =width-#{glasswidth}, `glasswidth` =#{glasswidth}, `glassheight` =#{glassheight}, `glasswidthmm` =#{glasswidth}, `glassheightmm` = #{glassheight},  `state` = #{state}, `glasstype` = #{glasstype}, `number` = #{number} WHERE `id` =#{id};")
    void AddCage(int id,String glassid,Double glasswidth,Double glassheight,int state,int glasstype,int number);
    @Update("UPDATE `albania`.`storage_cage` SET `glass_id` =#{glassid}, `width` =width-#{glasswidth}, `glasswidth` =#{glasswidth}, `glassheight` =#{glassheight}, `glasswidthmm` =#{glasswidth}, `glassheightmm` = #{glassheight},  `state` = #{state}, `glasstype` = #{glasstype}, `number` = #{number},thickness=#{thickness},films=#{films},flowcard=#{flowcard},mateid=#{mateid}  WHERE `id` =#{id};")
    void AddCage(int id,String glassid,Double glasswidth,Double glassheight,int state,int glasstype,int number,Double thickness,String films,String flowcard,int mateid);
    //获取进片数据
    @Select("select glassid,flowcard,glasswidth as width,glassheight as height,glasswidthmm,glassheightmm,glasstype,thickness  from queue where state=1 limit 1")
    GlassInfo SelectGlass();
@@ -38,29 +44,40 @@
    //二号线查询任务
    @Select("select * from v_cagerelease2 where mateid not in(select mateid from v_cagerelease2 where surplus=0 group by mateid)LIMIT 1;")
    GlassInfo SelectOutGlass2();
    //待出片任务查询
    @Select("select * from out_task where task_state=0")
    List<StorageTask> SelectOutTask();
    //流程卡任务查询
    @Select("select G.flowcard,G.glasstype,G.number,G.mateid,G.tier,G.starttime,G.finishnumber,IF((G.number-G.finishnumber-ku.KuCount)<0,G.number,ku.KuCount) as 'surplus',G.totaltier as id,G.width,G.glassid from (select Gfd.flowcard,Ggf.glasstype,Ggf.number,Ggf.mateid,Ggf.tier,Ggf.finishnumber,Gfd.starttime,Gfd.totaltier,Ggf.width,Ggf.glassid  from flowcard as Gfd LEFT JOIN glassinfo as Ggf on Gfd.flowcard=Ggf.flowcard where Gfd.state=1 and Gfd.line=#{line}) as G left join (select glasstype,sum(number) AS KuCount from storage_cage where flowcard is not null group by glasstype) as ku on G.glasstype=ku.glasstype where G.mateid not in(select mateid from v_cagerelease1 where surplus=0 group by mateid)order by `g`.`starttime`,`g`.`mateid`,`g`.`finishnumber`,`g`.`tier`LIMIT 1;")
    @Select("select  G.flowcard,G.glasstype,G.number,G.mateid,G.tier,G.starttime,G.finishnumber,IF((G.number-G.finishnumber-ku.KuCount)<0,G.number,IFNULL(ku.KuCount,0)) as 'surplus',G.totaltier as id,G.width,G.glassid from (select Gfd.flowcard,Ggf.glasstype,Ggf.number,Ggf.mateid,Ggf.tier,Ggf.finishnumber,Gfd.starttime,Gfd.totaltier,Ggf.width,Ggf.glassid  from flowcard as Gfd LEFT JOIN glassinfo as Ggf on Gfd.flowcard=Ggf.flowcard where Gfd.state=1 and Gfd.line=1) as G left join (select glasstype,sum(number) AS KuCount from storage_cage where glasstype is not null and disabled=0 group by glasstype) as ku on G.glasstype=ku.glasstype where G.mateid not in(select mateid from v_cagerelease1 where surplus=0 group by mateid) HAVING surplus>0  order by `g`.`starttime`,`g`.`mateid`,`g`.`finishnumber`,`g`.`tier`LIMIT 1;")
    GlassInfo SelectOutGlass(int line);
    // @Select("select SQL_NO_CACHE G.flowcard,G.glasstype,G.number,G.mateid,G.tier,G.starttime,G.finishnumber,IF((G.number-G.finishnumber-ku.KuCount)<0,G.number,ku.KuCount) as 'surplus',G.totaltier as id,G.width,G.glassid from (select Gfd.flowcard,Ggf.glasstype,Ggf.number,Ggf.mateid,Ggf.tier,Ggf.finishnumber,Gfd.starttime,Gfd.totaltier,Ggf.width,Ggf.glassid  from flowcard as Gfd LEFT JOIN glassinfo as Ggf on Gfd.flowcard=Ggf.flowcard where Gfd.state=1 and Gfd.line=#{line}) as G left join (select glasstype,sum(number) AS KuCount from storage_cage where flowcard is not null group by glasstype) as ku on G.glasstype=ku.glasstype where G.mateid not in(select mateid from v_cagerelease1 where surplus=0 group by mateid)  HAVING surplus>0 order by `g`.`starttime`,`g`.`mateid`,`g`.`finishnumber`,`g`.`tier`LIMIT 1;")
    // GlassInfo SelectOutGlass(int line);
    //获取该类型在库存的位置
    @Select("select * from storage_cage where glasstype=#{glasstype} and number>0 limit 1")
    StorageCage SelectCageGlass(int glasstype);
    //发送出片后增加已发数量
    @Update("update glassinfo set finishnumber=finishnumber+1 where flowcard=#{flowcard} and mateid=#{mateid} and tier=#{tier};")
    @Update("update glassinfo set finishnumber=ifnull(finishnumber,0)+1 where flowcard=#{flowcard} and mateid=#{mateid} and tier=#{tier};")
    void AddFinishNumber(String flowcard,int mateid,int tier);
    //获取当前任务的id
    @Select("select id from storage_task where task_state=0 and glass_id=#{glassid} ORDER BY id desc LIMIT 1")
    GlassInfo SelectTaskId(String glassid);
    //获取当前未完成任务的数量
    @Select("select count(*) from storage_task where task_state=0")
    int SelectTaskcount();
    //获取当前未完成任务的数量
    @Select("select count(*) from out_task where task_state=0")
    int SelectOutTaskCount();
    //删除测量表的信息
    @Delete("delete from queue where glassid=#{glassid}")
    int DeleteQueue(String glassid);
    //判断是否是直出模式
    @Select("select method from flowcard where state=1 and line=#{line} ORDER BY starttime LIMIT 1;")
    @Select("select method,flowcard from flowcard where state=1 and line=#{line} ORDER BY starttime LIMIT 1;")
    GlassInfo SelectMethod(int line);
    //直出模式任务查询
    @Select("select b.flowcard,b.glassid,b.glasstype,b.mateid,b.width,b.tier,a.totaltier as id,IFNULL(c.number,0)as number,b.glassid from flowcard a  left join glassinfo b on a.flowcard=b.flowcard left join(select sum(number)as number,glasstype from storage_cage GROUP BY glasstype)c on b.glasstype=c.glasstype where a.line=1 and c.number>0 limit 1")
    @Select("select  b.flowcard,b.glassid,b.glasstype,b.mateid,b.width,b.tier,a.totaltier as id,IFNULL(c.number,0)as number,b.glassid from flowcard a  left join glassinfo b on a.flowcard=b.flowcard left join(select sum(number)as number,glasstype from storage_cage GROUP BY glasstype)c on b.glasstype=c.glasstype where a.line=1 and c.number>0 and b.finishnumber<b.number  ORDER BY b.finishnumber,b.tier asc limit 1")
    GlassInfo SelectOutGlass2(int line);
    //查询直通模式下最后一块
    @Select("select b.tier from flowcard a  left join glassinfo b on a.flowcard=b.flowcard left join(select sum(number)as number,glasstype from storage_cage GROUP BY glasstype)c on b.glasstype=c.glasstype where a.line=#{line} and c.number>0 ORDER BY b.tier desc LIMIT 1")
    @Select("select IFNULL(b.tier, 0) from flowcard a  left join glassinfo b on a.flowcard=b.flowcard left join(select sum(number)as number,glasstype from storage_cage GROUP BY glasstype)c on b.glasstype=c.glasstype where a.line=#{line} and c.number>0 ORDER BY b.tier desc LIMIT 1")
    int SelectOutGlassend(int line);
    //增加笼子表宽高
    @Select("update storage_cage a set a.glasswidth=#{width},a.glassheight=#{height} where id=#{id} ")
@@ -68,6 +85,25 @@
    //更改队列表状态
    @Update("update queue set state=2 where glassid=#{glassid};")
    void UpdateQueueState(String glassid);
     //更改队列表状态
     @Select("select*from glassinfo  where glasstype=#{glasstype} limit 1;")
     GlassInfo SelectGlassinfo(Integer glasstype);
    //查询纯配片模式可出配片id
    @Select("select gls.flowcard,gls.mateid,gls.tier,gls.glasstype,kc.number from glassinfo as gls left join (select glasstype,sum(number) as number from storage_cage where number>0 and disabled=0 GROUP BY glasstype)as kc on gls.glasstype=kc.glasstype where gls.flowcard=#{flowcard} and gls.number>gls.finishnumber and kc.number>0 GROUP BY gls.flowcard, gls.mateid, gls.tier, gls.glasstype, kc.number,mateid  order by gls.mateid;")
    List<GlassInfo> SelectOutGlass3(String flowcard);
    //判断此配片id是否有足够的玻璃
    @Select("SELECT  CASE WHEN storage.number >= required.number THEN '足够' ELSE '不足' END AS status FROM (SELECT a.glasstype, COUNT(a.glasstype) AS number FROM glassinfo a WHERE a.flowcard =#{flowcard} AND a.mateid =#{mateid} GROUP BY a.glasstype) AS required LEFT JOIN (SELECT a.glasstype, SUM(a.number) AS number FROM storage_cage a WHERE a.number > 0 and disabled=0 GROUP BY a.glasstype) AS storage ON required.glasstype = storage.glasstype;")
    List<String> SelectOutGlass4(String flowcard,int mateid);
    //查询此配片id需要的玻璃类型
    @Select("select glasstype,width,sumtier from glassinfo where flowcard=#{flowcard} and mateid=#{mateid}")
    List<GlassInfo> SelectOutGlass5(String flowcard,int mateid);
    //判断此组玻璃是否能一次上车
    @Select("select sum(width)+(sumtier-1)*300 as width,mateid from glassinfo where flowcard=#{flowcard} and mateid=#{mateid} GROUP BY mateid,sumtier")
    GlassInfo SelectOutGlass6(String flowcard,int mateid);
    //查询此配片id所需的类型
    @Select("select * from glassinfo where flowcard=#{flowcard} and mateid=#{mateid}")
    List<GlassInfo> SelectOutGlass7(String flowcard,int mateid);
    //查询此配片id是否有可出片数量
    @Select("SELECT  CASE WHEN number >finishnumber THEN '足够' ELSE '不足' END AS status FROM  glassinfo a WHERE a.flowcard =#{flowcard} AND a.mateid =#{mateid}")
    List<String> SelectOutGlass8(String flowcard,int mateid);
}
springboot-vue3/src/main/java/com/example/springboot/mapper/GlassInfoMapper.java
@@ -13,13 +13,13 @@
@Repository
public interface GlassInfoMapper extends BaseMapper<GlassInfo> {
    @Select("select gi.* from flowcard as fd LEFT JOIN glassinfo as gi on fd.flowcard=gi.flowcard where fd.orderstate=1 and gi.flowcard is not null and  gi.width<=#{maxwidth} and gi.width>=#{minwidth} and gi.height<=#{maxheight} and gi.height>=#{minheight} and gi.films>=#{Films} and gi.thickness>=#{Thickness}  and gi.measurenumber<gi.number")
    @Select("select gi.* from flowcard as fd LEFT JOIN glassinfo as gi on fd.flowcard=gi.flowcard where fd.orderstate=1 and gi.flowcard is not null and  gi.width<=#{maxwidth} and gi.width>=#{minwidth} and gi.height<=#{maxheight} and gi.height>=#{minheight} and gi.films=#{Films} and gi.thickness>=#{Thickness}  and gi.measurenumber<gi.number")
    List<GlassInfo> selectGlassInfos(@Param("maxwidth") double maxwidth, @Param("minwidth") double minwidth, @Param("maxheight") double maxheight, @Param("minheight") double minheight,Integer Thickness,String Films);
    // @Select("SELECT COUNT(*) FROM role_permission WHERE role_id = #{roleId} AND permission_id = #{permissionId}")
    // boolean checkExists(@Param("roleId") int roleId, @Param("permissionId") int permissionId);
    @Select("SELECT g.* FROM flowcard as f left join glassinfo as g on f.flowcard=g.flowcard WHERE f.orderstate = #{orderstate}")
    @Select("SELECT g.* FROM flowcard as f left join glassinfo as g on f.flowcard=g.flowcard WHERE f.orderstate = #{orderstate} and state!=2")
    List<GlassInfo> selectOrderState(@Param("orderstate") int orderstate);
    @Update("UPDATE glassinfo SET measurenumber = measurenumber+1 WHERE id = #{id}")
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
@@ -5,6 +5,7 @@
import com.example.springboot.entity.CarPosition;
import com.example.springboot.entity.Flowcard;
import com.example.springboot.entity.GlassInfo;
import com.example.springboot.entity.MeasureSetting;
import com.example.springboot.entity.StorageCage;
import com.example.springboot.entity.StorageTask;
import com.example.springboot.entity.alarmmg;
@@ -238,7 +239,7 @@
  List<StorageCage> SelectStorageCageInfo();
  // 删除格子内玻璃信息
  @Update("update storage_cage set films=null,width=5000,glasswidth=null,glassheight=null,glasswidthmm=null,glassheightmm=null,thickness=null,glasstype=null,number=null where cell=#{cell}")
  @Update("update storage_cage set films=null,width=4300,glasswidth=null,glassheight=null,glasswidthmm=null,glassheightmm=null,thickness=null,glasstype=null,number=null,glass_id=null,flowcard=null,mateid=null where cell=#{cell}")
  void DeleteStroageCageByCell(Integer cell);
  // 修改格子玻璃数量
@@ -246,7 +247,7 @@
  void updateStroageCageByCell(Integer cell, Integer num);
  // 计算格子内剩余宽度
  @Update("update storage_cage set width=5000-if(glasswidth is null,0,glasswidth+300)*number where cell=#{cell}")
  @Update("update storage_cage set width=4300-if(glasswidth is null,0,glasswidth+300)*number where cell=#{cell}")
  void UpdateStroageCageWidthByCell(Integer cell);
  // 根据任务类型获取任务
@@ -254,8 +255,8 @@
  List<StorageTask> SelectStorageTask(int task_type);
  // 根据id任务
  @Select("select * from storage_task where id=#{id}")
  StorageTask SelectStorageTaskById(int id);
  @Select("select * from storage_task where task_state=0 ORDER BY id asc LIMIT 1")
  StorageTask SelectStorageTaskById();
  // 根据格子查询玻璃信息
  @Select("select * from storage_cage where cell=#{cell}")
@@ -263,12 +264,15 @@
  // 手动完成任务
  @Select("update storage_task set task_state=1 where id=#{id}")
  void FinishTask(Integer id);
  @Select("select gi.* from glassinfo gi inner join flowcard fc on gi.flowcard=fc.flowcard where fc.state!=2 and position(#{width} in gi.width) and position(#{height} in gi.height) and position(#{thickness} in gi.thickness) and position(#{films} in gi.films) group by gi.id")
  void FinishTask(Integer id, int state);
  //人工匹配测量查询
  @Select("select gi.* from glassinfo gi inner join flowcard fc on gi.flowcard=fc.flowcard where fc.state!=2 and fc.orderstate=1 and position(#{width} in gi.width) and position(#{height} in gi.height) and position(#{thickness} in gi.thickness) and position(#{films} in gi.films) group by gi.id")
  List<GlassInfo> SelectGlassInfo(String width, String height, String thickness, String films);
  // @Select("select b.* from flowcard a left join glassinfo b on a.flowcard=b.flowcard INNER JOIN measuresetting c where a.orderstate=1 and a.state!=2 and b.width BETWEEN  #{width} - c.errorwidth AND #{width} + c.errorwidth and b.height BETWEEN  #{height} - c.errorheight AND #{height} + c.errorheight and b.films=#{films} and b.thickness=#{thickness}")
  // List<GlassInfo> SelectGlassInfo(String width, String height, String thickness, String films);
  @Update("update storage_cage set glasstype=#{glassInfo.glasstype},glasswidth=#{glassInfo.width},glassheight=#{glassInfo.height},thickness=#{glassInfo.thickness},films=#{glassInfo.films},number=0 where cell=#{cell}")
  @Update("update storage_cage set glasstype=#{glassInfo.glasstype},mateid=#{glassInfo.mateid},glass_id=#{glassInfo.glassid},flowcard=#{glassInfo.flowcard},glasswidth=#{glassInfo.width},glassheight=#{glassInfo.height},thickness=#{glassInfo.thickness},films=#{glassInfo.films},number=0 where cell=#{cell}")
  void StorageCageAddGlass(String cell, GlassInfo glassInfo);
  @Select("select * from flowcard where state!=2")
@@ -276,7 +280,7 @@
  // @Select("select gi.*,sum(sc.number) as cageno from glassinfo gi left join storage_cage sc on gi.glasstype=sc.glasstype where gi.flowcard=#{flowcard} group by gi.id order by gi.mateid,gi.tier")
  // List<GlassInfo> SelectOrderView(String flowcard);
  @Select("select gi.id, gi.glasstype, gi.mateid, gi.glassid, gi.tier, gi.films, gi.width, gi.height, gi.thickness, gi.number, gi.finishnumber, gi.sumtier, gi.measurenumber,sum(sc.number) as cageno from glassinfo gi left join storage_cage sc on gi.glasstype=sc.glasstype where gi.flowcard=#{flowcard} group by gi.id order by gi.mateid,gi.tier")
  @Select("select gi.id, gi.glasstype, gi.mateid, gi.glassid, gi.tier, gi.films, gi.width, gi.height, gi.thickness, gi.number, gi.finishnumber, gi.sumtier, gi.measurenumber,sum(sc.number) as cageno,IFNULL(c.orderstate,0) as orderstate from  glassinfo gi left join storage_cage sc on gi.glasstype=sc.glasstype left join flowcard c on gi.flowcard=c.flowcard where gi.flowcard=#{flowcard} group by gi.id order by gi.mateid,gi.tier")
  List<GlassInfo> SelectOrderView(String flowcard);
@@ -293,15 +297,22 @@
  @Select("select orderstate from flowcard  where flowcard=#{flowcard} limit 1")
  int selectStartChange(String flowcard);
  @Delete("DELETE from flowcard  where flowcard=#{flowcard}")
  // @Delete("DELETE from flowcard  where flowcard=#{flowcard}")
  // int deleteFlowcard(String flowcard);
  // @Delete("DELETE from glassinfo  where flowcard=#{flowcard}")
  // int deleteGlassinfo(String flowcard);
  @Update("Update  flowcard set state=2, flowcard=CONCAT('已删除', #{flowcard}),orderstate=0  where flowcard=#{flowcard}")
  int deleteFlowcard(String flowcard);
  @Delete("DELETE from glassinfo  where flowcard=#{flowcard}")
  @Update("Update  glassinfo set flowcard=CONCAT('已删除', #{flowcard}) where flowcard=#{flowcard}")
  int deleteGlassinfo(String flowcard);
  @Update("update queue set glassid=concat(#{flowcard},'-',#{tier}),flowcard=#{flowcard},glasswidth=#{width},glassheight=#{height},glasstype=#{glasstype},thickness=#{thickness},state=1 where state<=0")
  void UpdateQueue(String flowcard, double width, double height, Integer glasstype, Double thickness, Integer tier);
  @Update("update queue set glassid=concat(#{flowcard},'-',#{tier}),flowcard=#{flowcard},glasswidth=#{width},glassheight=#{height},glasstype=#{glasstype},thickness=#{thickness},mateid=#{mateid},state=1 where state<=0")
  void UpdateQueue(String flowcard, double width, double height, Integer glasstype, Double thickness, Integer tier,int mateid);
  //人工匹配新增一条
  @Insert("INSERT INTO queue (flowcard,glassid,glasswidth,glassheight,glasstype,thickness,mateid,state) VALUES (#{flowcard},concat(#{flowcard},'-',#{tier}),#{width},#{height},#{glasstype},#{thickness},#{mateid},1)")
  int AddQueue(String flowcard, double width, double height, Integer glasstype, Double thickness, Integer tier,int mateid);
  @Update("update glassinfo set finishnumber=ifnull(finishnumber,0)+1 where flowcard=#{flowcard} and mateid=#{mateid} and tier=#{geTier}")
  void AddGlassNo(String flowcard, Integer mateid, Integer geTier);
@@ -316,8 +327,17 @@
  @Select("select max(glasstype)+1 from glassinfo")
  Integer SelectMaxType();
    // 最大玻璃类型
    @Select("select glasstype from glassinfo where CONCAT(width,'_',height,'_',thickness,'_',films)=#{key} limit 1")
    @Select("select glasstype from glassinfo where CONCAT(width,'_',height,'_',thickness,'_',films,'_',flowcard)=#{key} limit 1")
    Integer SelectMaxTypes(String key);
    //查询所有玻璃膜系和厚度
  @Select("select films,thickness from glassinfo GROUP BY films,thickness")
  List<GlassInfo> SelectMeasure();
  @Select("select*from measuresetting")
  MeasureSetting SelectMeasureSetting();
  //查询当前测量宽高和膜系厚度
  @Select("select ifnull(a.glasswidthmm,0) as glasswidthmm,ifnull(a.glassheightmm,0) as glassheightmm,ifnull(b.films,'') as films,ifnull(b.thickness,0) as thickness from queue a INNER JOIN measuresetting b where state!=2 ORDER BY a.id asc LIMIT 1")
  Map SelectMeasureWidthHeight();
  // 查询全部玻璃类型
  @Select("select CONCAT(IFNULL(width,''),'_',IFNULL(height,''),'_',IFNULL(thickness,''),'_',IFNULL(films,'')) as type,glasstype from glassinfo GROUP BY width,height,thickness,films,glasstype")
@@ -336,9 +356,12 @@
                    +" select #{flowcard}, 0, #{number}, 0, 0, 0, now() where 0=( select count(*) from flowcard where flowcard=#{flowcard});")
  void InsertFlowcard(String flowcard, Integer number);
    @Delete("Delete from queue where glassid=#{glassId}")
    @Delete("DELETE FROM queue WHERE id = (SELECT id FROM ( SELECT id FROM queue WHERE glassid = #{glassId} ORDER BY time ASC LIMIT 1) AS temp);")
    void DeletequeueByGlassid(String glassId);
    @Select("select count(*) from flowcard where line=#{line} and state=1 and flowcard!=#{flowcard}")
    int SelectTaskCount(String flowcard,Integer line);
  //修改测量设定膜系和厚度
    @Update("UPDATE measuresetting SET `films` = #{films}, `thickness` = #{thickness} WHERE `id` = 1;")
    int SaveMeasure(String films, Integer thickness);
}
springboot-vue3/src/main/java/com/example/springboot/mapper/QueueMapper.java
@@ -30,8 +30,8 @@
    // @Update("UPDATE role_permission SET state = #{state} WHERE role_id = #{roleId} AND permission_id = #{permissionId}")
    // void updateState(@Param("roleId") int roleId, @Param("permissionId") int permissionId, @Param("state") int state);
    @Insert("insert into queue (glassid,flowcard,listid,boxid,glasswidth,glassheight,glasswidthmm,glassheightmm,glasstype,state,time,thickness) "+
                        "select id,flowcard,null,null,width,height,#{glasswidthmm},#{glassheightmm},glasstype,#{state},NOW(),thickness from glassinfo where id=#{glassid}")
    @Insert("insert into queue (glassid,flowcard,listid,boxid,glasswidth,glassheight,glasswidthmm,glassheightmm,glasstype,state,time,thickness,mateid) "+
                        "select id,flowcard,null,null,width,height,#{glasswidthmm},#{glassheightmm},glasstype,#{state},NOW(),thickness,mateid from glassinfo where id=#{glassid}")
    int insert(@Param("glassid") Integer glassid, @Param("glasswidthmm") double glasswidthmm, @Param("glassheightmm") double glassheightmm,@Param("state") int state);
    
    @Insert("insert into queue (glassid,flowcard,listid,boxid,glasswidth,glassheight,glasswidthmm,glassheightmm,glasstype,state,time) "+
@@ -41,4 +41,7 @@
    @Delete("delete from queue where state<=0")
    void DeleteErrorQueue();
    @Delete("delete from queue where state<=3")
    void DeleteQueue();
}
springboot-vue3/src/main/java/com/example/springboot/service/HomeService.java
@@ -42,7 +42,7 @@
        List<GlassInfo> Results = new ArrayList<GlassInfo>();
        // 获取匹配设置
        MeasureSetting MeasureSetting = MeasureSettingMapper.SelectMeasureSetting(line);
        System.out.println("获取匹配设置:"+MeasureSetting);
        if (height > 0 && width > 0 && MeasureSetting != null) {
            // 有效参数 请求=1 长/宽>0
            double maxheight = height + MeasureSetting.getErrorHeight();
@@ -53,6 +53,8 @@
            String Films = MeasureSetting.getFilms();
            // 查询当前测量数据 
            List<GlassInfo> GlassInfos = GlassInfoMapper.selectGlassInfos(maxwidth, minwidth, maxheight, minheight,Thickness,Films);
            System.out.println("厚度"+Thickness+"膜"+Films);
            System.out.println("GlassInfos数量:"+GlassInfos.size());
            if(Thickness==0||Films==""){
                System.out.println("厚度"+Thickness+"膜"+Films);
                return null;
springboot-vue3/src/main/java/com/example/springboot/service/SpianServiceNew.java
@@ -1,4 +1,5 @@
package com.example.springboot.service;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
@@ -12,128 +13,193 @@
import com.example.springboot.mapper.AlbaniaMapper;
import com.google.common.primitives.Bytes;
@Service
public class SpianServiceNew {
    @Autowired
    private AlbaniaMapper albaniaMapper;
     //读取DB105区文件
    private PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
public Short selectAll(GlassInfo glassInfo) {
    if(glassInfo==null){
        //有进片请求但是测量台没有玻璃
        return 400;
    }
    System.out.println(glassInfo+"初始");
    //定义初始字段
    StorageCage cage;
    String glassid=glassInfo.getGlassid();
    Double width=glassInfo.getWidth();
    Double height=glassInfo.getHeight();
    String flowcard=glassInfo.getFlowcard();
    int glasstype=glassInfo.getGlasstype();
    //判断是否有同类型的
    cage=albaniaMapper.SelectCage(glasstype,width, 300);
    //如果有同类型时直接增加
    if(cage!=null){
        //发送plc任务
        Mestast(glassid, 1001, cage.getId(), 1,"MESID1",1);
        System.out.println("任务发送玻璃id:"+glassid+"起始位置:"+1001+"格子号:"+cage.getId()+"启动:"+1);
    }else{
         //判断玻璃是否进入大片笼
         if(glassInfo.getThickness()>=15){
            cage=albaniaMapper.SelectNewCell(3,5);
        }else{
            cage=albaniaMapper.SelectNewCell(0,4);
            System.out.println(cage+"理片笼判断");
        }
        //当返回的格子号为空时,返回400笼子已满
        if(cage!=null){
            albaniaMapper.AddCage(cage.getId(), glassid,width, height, 1, glasstype, 0);
            Mestast(glassid,1001,cage.getId(),1,"MESID1",1);
            System.out.println("任务发送玻璃id:"+glassid+"起始位置:"+1001+"格子号:"+cage.getId()+"启动:"+1);
            albaniaMapper.UpdateStorage(width,height,cage.getId());
        }else{
            return(400);
        }
    }
    //增加任务记录
    albaniaMapper.Inserttask(0, 0, 1001, cage.getId(), glassid,glasstype, flowcard,0,0);
    albaniaMapper.UpdateQueueState(glassid);
    return(200);
    @Autowired
    private StorageCageService storageCageService;
    // 读取DB105区文件
    private PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
}
    public Short selectAll(GlassInfo glassInfo) {
        if (glassInfo == null) {
            // 有进片请求但是测量台没有玻璃
            return 400;
        }
    //出片
        System.out.println(glassInfo + "初始");
        // 定义初始字段
        StorageCage cage;
        String glassid = glassInfo.getGlassid();
        Double width = glassInfo.getWidth();
        Double height = glassInfo.getHeight();
        String flowcard = glassInfo.getFlowcard();
        Integer glasstype = glassInfo.getGlasstype();
        Double thickness = glassInfo.getThickness();
        GlassInfo glassfilms = albaniaMapper.SelectGlassinfo(glasstype);
        // 判断是否有同类型的
        cage = albaniaMapper.SelectCage(glasstype, width, 300);
        // 如果有同类型时直接增加
        if (cage != null) {
            // 发送plc任务
            Mestast(glassid, 1001, cage.getId(), 1, "MESID1", 1);
            System.out.println("任务发送玻璃id:" + glassid + "起始位置:" + 1001 + "格子号:" + cage.getId() + "启动:" + 1);
        } else {
            // 判断玻璃是否进入大片笼
            if (glassInfo.getThickness() >= 15) {
                cage = albaniaMapper.SelectNewCell(3, 5);
            } else {
                cage = albaniaMapper.SelectNewCell(0, 4);
                // System.out.println(cage + "理片笼判断");
            }
            // 当返回的格子号为空时,返回400笼子已满
            if (cage != null) {
                albaniaMapper.AddCage(cage.getId(), glassid, width, height, 1, glasstype, 0, thickness,
                        glassfilms.getFilms(),glassfilms.getFlowcard(),glassfilms.getMateid());
                Mestast(glassid, 1001, cage.getId(), 1, "MESID1", 1);
                System.out.println("任务发送玻璃id:" + glassid + "起始位置:" + 1001 + "格子号:" + cage.getId() + "启动:" + 1);
                albaniaMapper.UpdateStorage(width, height, cage.getId());
            } else {
                return (400);
            }
        }
        // 增加任务记录
        albaniaMapper.Inserttask(0, 0, 1001, cage.getId(), glassid, glasstype, flowcard, glassfilms.getMateid(), 0);
        albaniaMapper.UpdateQueueState(glassid);
        return (200);
    }
    //补充出片
    public Short mateOut() {
        double carwidth = -300;
        list<StorageTask> glassmate = albaniaMapper.SelectMateOut();
        return (200);
    }
    // 出片
    public Short selectout(int line) {
        GlassInfo glassmate=new GlassInfo();
        GlassInfo method=new GlassInfo();
        StorageCage glass=new StorageCage();
        int glassend=0;
        method=albaniaMapper.SelectMethod(line);
        if(method==null){
        GlassInfo glassmate = new GlassInfo();
        GlassInfo method = new GlassInfo();
        StorageCage glass = new StorageCage();
        int glassend = 0;
        double carwidth = -300;
        method = albaniaMapper.SelectMethod(line);
        if (method == null) {
            return (400);
        }
        double width=0;
            for(int i=1;i<=7;i++){
                //如果不是直通模式只出有完整配片的流程卡
                if(method.getMethod()==0){
                    glassmate= albaniaMapper.SelectOutGlass(1);
                }else{
                    //直通模式时按顺序直出
                    glassmate= albaniaMapper.SelectOutGlass2(1);
                    //获取直通模式最后一块
                    glassend=albaniaMapper.SelectOutGlassend(1);
                }
                System.err.println("method:"+method+"glassmate:"+glassmate);
                System.err.println(line);
                if(glassmate==null){
                    //未领取任务
                    System.out.println("未领取任务");
        double width = 0;
        for (int i = 1; i <= 7; i++) {
            // 如果不是直通模式只出有完整配片的流程卡
            if (method.getMethod() == 0) {
                // glassmate= albaniaMapper.SelectOutGlass(1);
                //判断有数量的配片id
                List<GlassInfo> peipianid = albaniaMapper.SelectOutGlass3(method.getFlowcard());
                if (peipianid.size() == 0) {
                    System.out.println("peipianid:"+peipianid);
                    return (400);
                }else{
                glass= albaniaMapper.SelectCageGlass(glassmate.getGlasstype());
                System.out.println("glassmate:"+glassmate+"glassend:"+glassend+"glass:"+glass);
                  if(glass!=null){
                    //发送任务之前判断车上的剩余宽度是否大于此玻璃
                    width=width+glassmate.getWidth()+300;
                    //大于车上空余宽度时提前发送出片启动
                    if(width>5000){
                        //本次配片完成发送启动命令
                        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short)1);//出片任务启动
                        return (200);//结束
                      }
                    //发送配片数据
                    Mestast(glass.getGlassId(), glass.getId(),40, 0,"MESID"+i,i);
                    albaniaMapper.AddFinishNumber(glassmate.getFlowcard(), glassmate.getMateid(), glassmate.getTier());
                    albaniaMapper.Inserttask(1, 0, glass.getId(), 2001, glassmate.getGlassid(), glassmate.getGlasstype(),glass.getFlowcard(),glassmate.getMateid(),glassmate.getTier());
                      if(glassmate.getTier()==glassmate.getId()||glassmate.getTier()==glassend){//当配片数量等于成品小片总片数时
                        //本次配片完成发送启动命令
                        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short)1);//出片任务启动
                        System.out.println("任务类型:1,任务状态:0,起始:"+glass.getId()+",目标"+"40");
                        return (200);//结束
                      }
                    }else{
                        return (400);//结束
                } else {
                    for (int j = 0; j < peipianid.size(); j++) {
                        // 判断配片宽度是否够上大车
                        // GlassInfo glasswidth = albaniaMapper.SelectOutGlass6(peipianid.get(j).getFlowcard(),peipianid.get(j).getMateid());
                        // if (glasswidth.getWidth() <= 4300) {
                            //是否有足够的库存数量
                            List<String> peipiancage = albaniaMapper.SelectOutGlass4(peipianid.get(j).getFlowcard(),peipianid.get(j).getMateid());
                            //是否有足够的可出片数量
                            List<String> peipiancage2 = albaniaMapper.SelectOutGlass8(peipianid.get(j).getFlowcard(),peipianid.get(j).getMateid());
                            // System.out.println("peipiancage:"+peipiancage+peipianid.get(j).getMateid());
                            // System.out.println("peipiancage2:"+peipiancage2);
                            if (!peipiancage.contains("不足")&&!peipiancage2.contains("不足")) {
                                List<GlassInfo> chupian = albaniaMapper.SelectOutGlass7(peipianid.get(j).getFlowcard(),peipianid.get(j).getMateid());
                                for (int k = 0; k < chupian.size(); k++) {
                                      glass = albaniaMapper.SelectCageGlass(chupian.get(k).getGlasstype());
                                      carwidth= carwidth+glass.getGlassWidth()+300;
                                      if (carwidth<=4300) {
                                          // 发送配片数据
                                    //   Mestast(chupian.get(k).getGlassid(), glass.getId(), 2001, 0, "MESID" + (k+1), k+1);
                                      albaniaMapper.AddFinishNumber(chupian.get(k).getFlowcard(), chupian.get(k).getMateid(), chupian.get(k).getTier());
                                      storageCageService.UpdateStroageCageByCell(glass.getId(), -1);// 玻璃数量-1
                                      albaniaMapper.Inserttask(1, 0, glass.getId(), 2001, chupian.get(k).getGlassid(),
                                      chupian.get(k).getGlasstype(), chupian.get(k).getFlowcard(), chupian.get(k).getMateid(), chupian.get(k).getTier());
                                      }else {
                                        albaniaMapper.AddFinishNumber(chupian.get(k).getFlowcard(), chupian.get(k).getMateid(), chupian.get(k).getTier());
                                        storageCageService.UpdateStroageCageByCell(glass.getId(), -1);// 玻璃数量-1
                                        albaniaMapper.InsertOutTask(1, 0, glass.getId(), 2001, chupian.get(k).getGlassid(),
                                        chupian.get(k).getGlasstype(), chupian.get(k).getFlowcard(), chupian.get(k).getMateid(), chupian.get(k).getTier());
                                      }
                                }
                                // 本次配片完成发送启动命令
                                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short) 1);// 出片任务启动
                                return (200);// 结束
                            }
                        // }
                        //  else {
                        //     continue;
                        // }
                    }
                    System.out.println("未有完整配片");
                    return (400);
                }
            } else {
                // 直通模式时按顺序直出
                glassmate= albaniaMapper.SelectOutGlass(1);
                // glassmate = albaniaMapper.SelectOutGlass2(1);
                // // 获取直通模式最后一块
                // glassend = albaniaMapper.SelectOutGlassend(1);
            }
        return(200);// 结束
            System.err.println("出片:" + glassmate);
            if (glassmate == null && i > 1) {
                // 本次配片完成发送启动命令
                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short) 1);// 出片任务启动
                System.out.println("出完任务:1,任务状态:0,起始:" + glass.getId() + ",目标" + "2001");
                return (200);// 结束
            }
            if (glassmate == null) {
                // 未领取任务
                System.out.println("未领取任务:" + i);
                return (400);
            } else {
                glass = albaniaMapper.SelectCageGlass(glassmate.getGlasstype());
                System.out.println("glassmate:" + glassmate  + "glass:" + glass);
                if (glass != null) {
                    // 发送任务之前判断车上的剩余宽度是否大于此玻璃
                    width = width + glassmate.getWidth() + 300;
                    // 大于车上空余宽度时提前发送出片启动
                    if (width > 4300) {
                        // 本次配片完成发送启动命令
                        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short) 1);// 出片任务启动
                        return (200);// 结束
                    }
                    // 发送配片数据
                    Mestast(glass.getGlassId(), glass.getId(), 2001, 0, "MESID" + i, i);
                    albaniaMapper.AddFinishNumber(glassmate.getFlowcard(), glassmate.getMateid(), glassmate.getTier());
                    storageCageService.UpdateStroageCageByCell(glass.getId(), -1);// 玻璃数量-1
                    albaniaMapper.Inserttask(1, 0, glass.getId(), 2001, glassmate.getGlassid(),
                    glassmate.getGlasstype(), glass.getFlowcard(), glassmate.getMateid(), glassmate.getTier());
                    // if (glassmate.getTier() == glassmate.getId() || glassmate.getTier() == glassend|| method.getMethod() == 1) {// 当配片数量等于成品小片总片数时
                    //     // 本次配片完成发送启动命令
                    //     S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short) 1);// 出片任务启动
                    //     System.out.println("任务类型:1,任务状态:0,起始:" + glass.getId() + ",目标" + "2001");
                    //     return (200);// 结束
                    // }
                } else {
                    return (400);// 结束
                }
            }
        }
        return (200);// 结束
    }
    // 派发任务玻璃id
    public void outmesid(String glassid, String address) {
      //读取DB105区文件
      PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
        // 读取DB105区文件
        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
        // System.out.println("outmesid:" + glassid);
        List<Byte> glassidlist = new ArrayList();
        char ds[] = glassid.toCharArray();
@@ -141,7 +207,7 @@
            glassidlist.add((byte) iditem);
        }
        byte[] bytes = Bytes.toArray(glassidlist);
        //writeString
        // writeString
        System.out.println("outmesidbytes:" + bytes.length);
        System.out.println(plcmes.getPlcParameter(address).getAddress());
        System.out.println();
@@ -158,7 +224,7 @@
                writedstrIdOut.append((char) iditem);
            }
        }
        return writedstrIdOut;
        return writedstrIdOut;
    }
    // char数组转化成bit数组
@@ -180,22 +246,30 @@
        return listbool;
    }
    //下发理片任务
    public void Mestast(String glassid,int MESToPLCStart1,int MESToPLCTarget1,int MESToPLC,String address,int i) {
        S7control.getinstance().writeString(plcmes.getPlcParameter(address).getAddress(),glassid);//玻璃id
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStart"+i).getAddress(), (short) MESToPLCStart1);//起始位置
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCTarget"+i).getAddress(), (short) MESToPLCTarget1);//目标位置
        if(MESToPLC!=0){
            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short)MESToPLC);//mes理片任务类型
        }
    // 下发理片任务
    public void Mestast(String glassid, int MESToPLCStart1, int MESToPLCTarget1, int MESToPLC, String address, int i) {
        // System.out.println("下发理片任务数据:");
        // System.out.println("玻璃 ID: " + glassid);
        // System.out.println("起始位置: " + MESToPLCStart1);
        // System.out.println("目标位置: " + MESToPLCTarget1);
        // System.out.println("任务类型: " + MESToPLC);
        // System.out.println("地址: " + address);
        // System.out.println("索引: " + i);
        S7control.getinstance().writeString(plcmes.getPlcParameter(address).getAddress(), glassid);// 玻璃id
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStart" + i).getAddress(),
                (short) MESToPLCStart1);// 起始位置
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCTarget" + i).getAddress(),
                (short) MESToPLCTarget1);// 目标位置
        if (MESToPLC != 0) {
            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLC").getAddress(), (short) MESToPLC);// mes理片任务类型
        }
    }
    // 扫码增加队列任务
    public boolean scan(String address) {
        List<Short> list = S7control.getinstance().ReadWord(address, 1);// 返回为ture时为1
        boolean listbool = list.contains((short) 1);
        return listbool;
    }
}
springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
@@ -16,10 +16,12 @@
import com.example.springboot.component.S7control;
import com.example.springboot.entity.Flowcard;
import com.example.springboot.entity.GlassInfo;
import com.example.springboot.entity.MeasureSetting;
import com.example.springboot.entity.Queue;
import com.example.springboot.entity.StorageCage;
import com.example.springboot.entity.StorageTask;
import com.example.springboot.entity.device.PlcParameterObject;
import com.example.springboot.mapper.AlbaniaMapper;
import com.example.springboot.mapper.HomeMapper;
import com.example.springboot.mapper.QueueMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -37,6 +39,8 @@
    @Autowired
    private SpianService spianService;
    @Autowired
    private AlbaniaMapper albaniaMapper;
    public void EndTask(int types) {
        String A01glassid1 = spianService.queGlassid("DB103.128", 14).toString();
@@ -200,6 +204,7 @@
        } else {
            if (id == 1) {
                // 调用伍存储过程
                System.out.println("调用上片函数");
                zhi = spianService.selectAll(queue.getglassId());
                if (zhi == 200) {
                    homeMapper.InsertQueueGlassId(queue, id);
@@ -233,7 +238,7 @@
    // 查询进/出片任务
    public List<StorageTask> SelectStorageTask(int task_type) {
        List<StorageTask> storageTasks = new ArrayList<>();
        String loadrack="0";
        String loadrack = "0";
        if (task_type == 0) {
            storageTasks = homeMapper.SelectStorageTask(task_type);
        } else {
@@ -241,30 +246,85 @@
        }
        for (StorageTask storageTask : storageTasks) {
            if (task_type == 0) {
                loadrack=storageTask.getLoadrack();
            }else{
                loadrack=storageTask.getShelfRack();
                loadrack = storageTask.getLoadrack();
            } else {
                loadrack = storageTask.getShelfRack();
            }
            storageTask.setstorageCage(homeMapper.SelectStorageByCell(loadrack));
        }
        return storageTasks;
    }
    // 查询进/出片任务
    public List<GlassInfo> SelectMeasure() {
        return homeMapper.SelectMeasure();
    }
     // 查询当前膜系厚度
     public MeasureSetting SelectSetting() {
        return homeMapper.SelectMeasureSetting();
    }
     // 查询测量宽高厚膜系
     public Map StorageCageForm() {
        return homeMapper.SelectMeasureWidthHeight();
    }
    // 手动完成任务
    public Result FinishTask(Integer id) {
        StorageTask storageTask = homeMapper.SelectStorageTaskById(id);// 获取任务信息
        homeMapper.FinishTask(storageTask.getId());// 完成任务
        if (storageTask.getTaskType().equals("0")) {
            UpdateStroageCageByCell(Integer.parseInt(storageTask.getLoadrack()), 1);// 玻璃数量+1
            homeMapper.DeletequeueByGlassid(storageTask.getGlassId());
        } else {
            StorageCage storageCage = homeMapper.SelectStorageByCell(storageTask.getShelfRack());
            if (storageCage.getNumber() > 1) {
                UpdateStroageCageByCell(Integer.parseInt(storageTask.getShelfRack()), -1);// 玻璃数量-1
            } else {
                UpdateStroageCageByCell(Integer.parseInt(storageTask.getShelfRack()), 0);// 清除格内信息
    public Result FinishTask() {
        for (int i = 1; i < 7; i++) {
            int taskcont = albaniaMapper.SelectTaskcount(); // 正在进行的任务数量
            System.out.println("任务数量:"+taskcont);
            if (taskcont == 0) {
                break;
            }
            homeMapper.AddGlassNo(storageTask.getFlowcard(), storageTask.getMateid(), storageTask.geTier());// 添加出片完成数量
            StorageTask storageTask = homeMapper.SelectStorageTaskById();// 获取任务信息
            if (storageTask.getTaskType().equals("0")) {
                System.out.println("完成进片任务:"+storageTask.getId());
                homeMapper.FinishTask(storageTask.getId(), 1);// 完成任务
                UpdateStroageCageByCell(Integer.parseInt(storageTask.getLoadrack()), 1);// 玻璃数量+1
                homeMapper.DeletequeueByGlassid(storageTask.getGlassId());
            } else {
                System.out.println("完成出片任务:"+storageTask.getId());
                homeMapper.FinishTask(storageTask.getId(), 1);// 完成任务
                StorageCage storageCage = homeMapper.SelectStorageByCell(storageTask.getShelfRack());
                if (storageCage.getNumber()==null||storageCage.getNumber() ==0) {
                    UpdateStroageCageByCell(Integer.parseInt(storageTask.getShelfRack()), 0);// 清除格内信息
                }
                // homeMapper.AddGlassNo(storageTask.getFlowcard(), storageTask.getMateid(), storageTask.geTier());// 添加出片完成数量
            }
        }
        Map<String, Object> map = new HashMap<>();
        map.put("message", "200");
        return Result.success(map);
    }
    // 自动完成任务
    public Result LoseTask() {
        for (int i = 1; i < 7; i++) {
            int taskcont = albaniaMapper.SelectTaskcount(); // 正在进行的任务数量
            System.out.println("任务数量:"+taskcont);
            if (taskcont == 0) {
                break;
            }
            StorageTask storageTask = homeMapper.SelectStorageTaskById();// 获取任务信息
            if (storageTask.getTaskType().equals("0")) {
                System.out.println("完成进片任务:"+storageTask.getId());
                homeMapper.FinishTask(storageTask.getId(), 1);// 完成任务
                UpdateStroageCageByCell(Integer.parseInt(storageTask.getLoadrack()), 1);// 玻璃数量+1
                homeMapper.DeletequeueByGlassid(storageTask.getGlassId());
            } else {
                System.out.println("完成出片任务:"+storageTask.getId());
                homeMapper.FinishTask(storageTask.getId(), 1);// 完成任务
                StorageCage storageCage = homeMapper.SelectStorageByCell(storageTask.getShelfRack());
                if (storageCage.getNumber() > 1) {
                    UpdateStroageCageByCell(Integer.parseInt(storageTask.getShelfRack()), -1);// 玻璃数量-1
                } else {
                    UpdateStroageCageByCell(Integer.parseInt(storageTask.getShelfRack()), 0);// 清除格内信息
                }
                homeMapper.AddGlassNo(storageTask.getFlowcard(), storageTask.getMateid(), storageTask.geTier());// 添加出片完成数量
            }
        }
        Map<String, Object> map = new HashMap<>();
        map.put("message", "200");
@@ -297,21 +357,21 @@
        return OrderTask;
    }
    // 开始任务
    // 开始出片
    public Result ClaimTasks(String flowcard, Integer state, Integer line) {
        int count=homeMapper.SelectTaskCount(flowcard,line);
        int count = homeMapper.SelectTaskCount(flowcard, line);
        Map<String, Object> map = new HashMap<>();
        if(count==0){
        if (count == 0) {
            if (state == 1) {
                homeMapper.ClaimTasks(flowcard, 0, line);
            } else {
                homeMapper.ClaimTasks(flowcard, 1, line);
            }
            map.put("message", "200");
        }else{
        } else {
            map.put("message", "300");
        }
        return Result.success(map);
    }
@@ -329,8 +389,10 @@
    // 修改测量信息
    public Result UpdateQueue(GlassInfo glassInfo) {
        homeMapper.UpdateQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(),
                glassInfo.getGlasstype(), glassInfo.getThickness(), glassInfo.getTier());
        // 删除数据
        QueueMapper.DeleteQueue();
        homeMapper.AddQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(),
                glassInfo.getGlasstype(), glassInfo.getThickness(), glassInfo.getTier(),glassInfo.getMateid());
        Map<String, Object> map = new HashMap<>();
        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1);
@@ -357,20 +419,31 @@
        return Result.success(map);
    }
    // 开始工程
    public Result StartChange(String flowcard) {
        homeMapper.StartChange(flowcard, 1);
    // 开始上片
    public Result StartChange(String flowcard,int orderstate) {
        homeMapper.StartChange(flowcard, orderstate);
        Map<String, Object> map = new HashMap<>();
        int state=homeMapper.selectStartChange(flowcard);
        int state = homeMapper.selectStartChange(flowcard);
        map.put("message", "200");
        return Result.success(map);
    }
     // 删除工程
     public Result deleteTasks(String flowcard) {
        int aa=homeMapper.deleteFlowcard(flowcard.trim());
    // 删除工程
    public Result deleteTasks(Map num) {
        String flowcard = (String) num.get("num");
        int aa = homeMapper.deleteFlowcard(flowcard.trim());
        homeMapper.deleteGlassinfo(flowcard.trim());
        System.out.println(flowcard);
        Map<String, Object> map = new HashMap<>();
        map.put("message", aa);
        map.put("message", flowcard.trim());
        return Result.success(map);
    }
    // 保存测量设置
    public Result SaveMeasure(String films, Integer thickness) {
        int Measure = homeMapper.SaveMeasure(films, thickness);
        Map<String, Object> map = new HashMap<>();
        map.put("message", Measure);
        return Result.success(map);
    }
@@ -398,7 +471,7 @@
        Map<String, Integer> OrderFinishedProduct = new HashMap<String, Integer>(); // 得到处理完后订单成品总数量;
        // "order zong 0 1 10 2 10"
        List<Map> RemoveErrorData = IportDataStr.stream()
                .filter(item -> (item.get("order") != null && item.get("glasstype") != null && item.get("tier") != null
                .filter(item -> (item.get("order") != null && item.get("tier") != null
                        &&
                        item.get("films") != null && item.get("base") != null && item.get("height") != null
                        && item.get("thickness") != null && item.get("quantity") != null
@@ -437,22 +510,22 @@
        int count = 1;
        for (Map map : RemoveErrorData) {
            String key = map.get("base").toString() + "_" + map.get("height").toString() + "_"
                    + map.get("thickness").toString() + "_" + map.get("films").toString();
                    + map.get("thickness").toString() + "_" + map.get("films").toString()+ "_" + map.get("order").toString();
            String tierkey = map.get("order").toString() + "_" + map.get("matching").toString();
            String value = TypeData.get(key);
            Integer glasstype;
            System.out.println(key+":"+TypeData.get(key));
            System.out.println(key + ":" + TypeData.get(key));
            if (TypeData.get(key) == null) {
                glasstype = homeMapper.SelectMaxTypes(key);
                if(glasstype==null){
                glasstype = homeMapper.SelectMaxType();
                 }
                if (glasstype == null) {
                    glasstype = homeMapper.SelectMaxType();
                }
                if (glasstype == null) {
                    glasstype = 1;
                }
                }
            } else {
                glasstype = Integer.valueOf(value);
            }