ZengTao
2024-03-24 9a942fabdc8afdc9610425641739d5b97cbcb79a
Merge branch 'master' of http://10.153.19.25:10101/r/Albania_Mes
9个文件已修改
224 ■■■■■ 已修改文件
.vscode/settings.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Albania_Mes-ui/src/api/home.js 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Albania_Mes-ui/src/views/home/index.vue 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/entity/GlassInfo.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/entity/glassinfo.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vscode/settings.json
@@ -1,5 +1,6 @@
{
    "java.configuration.updateBuildConfiguration": "interactive",
    "java.debug.settings.onBuildFailureProceed": true,
    "java.compile.nullAnalysis.mode": "automatic"
    "java.compile.nullAnalysis.mode": "automatic",
    "java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:disable"
}
Albania_Mes-ui/src/api/home.js
@@ -351,3 +351,30 @@
        data
    })
}
//人工拿走AnewMeasure
export function ManualTake(data) {
    return request({
        url: '/home/ManualTake',
        method: 'post',
        data
    })
}
//重新测量
export function AnewMeasure(data) {
    return request({
        url: '/home/AnewMeasure',
        method: 'post',
        data
    })
}
export function importData(data) {
    return request({
        url: '/home/importData',
        method: 'post',
        data
    })
}
Albania_Mes-ui/src/views/home/index.vue
@@ -451,7 +451,7 @@
            <div id="fileinput" class="container">
                <div class="header">
                    <div class="btn">
                        <button @click="AllAdd">保存</button>
                        <el-button type="primary" @click="importData()">保存</el-button>
                    </div>
                    <div class="inp">
                        <input type="file" id="uploadExcel" multiple @change="Change" />
@@ -511,7 +511,9 @@
                    <el-button type="primary" @click="ManualMatching()" :disabled="SoftEmergencyStopState"
                        style="z-index: 999;">人工匹配</el-button>
                    <el-button type="primary" @click="ManualTake()" :disabled="SoftEmergencyStopState"
                        style="z-index: 999;">人工匹配</el-button>
                        style="z-index: 999;">人工拿走</el-button>
                    <el-button type="primary" @click="AnewMeasure()" :disabled="SoftEmergencyStopState"
                        style="z-index: 999;">重新测量</el-button>
                </div>
                <!--显示-->
                <div style="width:1000px;height: 720px;border: 2px solid #d1d1d1;margin: auto auto;">
@@ -655,7 +657,7 @@
    Disabled, SelectPermissionByUserName, currentUsername, CompleteQueue,
    isAllowReorderings,
    UpdateStroageCageByCell, FinishTask, SelectGlassInfo, StorageCageAddGlass, ClaimTasks, ModeChange, UpdateQueue
    UpdateStroageCageByCell, FinishTask, SelectGlassInfo, StorageCageAddGlass, ClaimTasks, ModeChange, UpdateQueue,importData,ManualTake,AnewMeasure
} from "../../api/home";
@@ -1050,7 +1052,21 @@
        },
        //人工拿走
        ManualTake() {
            let s="123";
            ManualTake(s).then(res => {
                if (res.data.message == 200) {
                    console.log(res.data.message);
                }
            })
        },
        //重新测量
        AnewMeasure() {
            let s="123";
            AnewMeasure(s).then(res => {
                if (res.data.message == 200) {
                    console.log(res.data.message);
                }
            })
        },
        Change(event) {
            // 获取到文件夹
@@ -1081,12 +1097,16 @@
        Add() {
        },
        Hide() {
        importData() {
        },
        AllAdd() {
            //添加数据进后台
            console.log(this.dataList);
            //let tbdata=JSON.stringify(this.dataList);
            let tbdata=this.dataList;
            console.log(tbdata);
            importData(tbdata).then(res => {
                if (res.data.message == 200) {
                    //this.$message.success(this.$t('Operation successful'));
                }
            });
        },
        del() {
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -117,6 +117,7 @@
                PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
      
                //String PlcRequest=plcmes.getPlcParameter("GaToMES").getValue();//请求
                //String MesSend=plcmes.getPlcParameter("MESToGaStatus").getValue();//发送
                //double width=plcmes.getPlcParameter("Height").getValue();//宽
                //double height=plcmes.getPlcParameter("width").getValue();//高
                //获取测量的长,宽
@@ -132,14 +133,13 @@
                String PlcRequest = "1";
                String MesSend = "0";
                double width = 402;
                double height = 402;
                
                //匹配
                if ("1".equals(PlcRequest)) {
                if ("1".equals(PlcRequest)&&"0".equals(PlcRequest)) {
                    GlassInfo MesureGlassinfo=HomeService.Normal(width, height, "1");
                }
                Queue LastQueue= QueueMapper.selectLastQueue();
                // String E01id = new String( S7controlLK.getinstance().ReadByte("DB17.0",16));
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
@@ -1,6 +1,7 @@
package com.example.springboot.controller;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -16,6 +17,11 @@
import com.example.springboot.service.OutSliceServive;
import com.example.springboot.service.SpianService;
import com.example.springboot.service.StorageCageService;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import cn.hutool.core.lang.Console;
import com.example.springboot.common.Result;
import com.example.springboot.component.Plchome;
@@ -488,4 +494,19 @@
   public Result UpdateQueue(@RequestBody GlassInfo glassInfo) {
     return storageCageService.UpdateQueue(glassInfo);
   }
    //人工拿走
    @PostMapping("/ManualTake")
    public Result ManualTake(@RequestBody String glassInfo) {
      return storageCageService.ManualTake(glassInfo);
    }
    //重新测量
    @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);
   }
}
springboot-vue3/src/main/java/com/example/springboot/entity/GlassInfo.java
@@ -20,6 +20,7 @@
  private Double thickness;// 厚
  private Integer number;// 数量
  private Integer finishnumber;// 完成数量
  private Integer sumtier;// 完成数量
  private Integer measurenumber;// 测量完成数量
  private Integer cageno;//笼内数量
}
springboot-vue3/src/main/java/com/example/springboot/entity/glassinfo.java
@@ -20,6 +20,7 @@
  private Double thickness;// 厚
  private Integer number;// 数量
  private Integer finishnumber;// 完成数量
  private Integer sumtier;// 完成数量
  private Integer measurenumber;// 测量完成数量
  private Integer cageno;//笼内数量
}
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
@@ -14,6 +14,7 @@
import com.example.springboot.entity.RolePermission;
import java.util.List;
import java.util.Map;
@Mapper
public interface HomeMapper {
@@ -39,8 +40,6 @@
  // 查询5-1笼外层格子状态
  @Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/2750*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/2750*2 else 0 end) as width  from storage_cage where cage<=5  group by cage,cell order by cage desc,cell desc")
  List<StorageCage> selectRack4();
  // 根据任务类型查询当前正在出片,进片的玻璃信息
  @Select("select * from storage_cage where state=#{task_type}")
@@ -155,15 +154,14 @@
  @Select("select * from storage_cage where glass_id=#{glassid}")
  List<StorageCage> SelectStoragesGlassById(String glassid);
  // //根据玻璃id删除出片队列玻璃
  // @Update("update out_slice set state=4 where barcode=#{FrameNo} and (state=0 or state=1 or state=2)")
  // @Update("update out_slice set state=4 where barcode=#{FrameNo} and (state=0
  // or state=1 or state=2)")
  // void DeleteProductionQueueGlass(String id);
  //根据铝框id查询对应玻璃信息
  @Select("select * from north_glass_buffer1 where FrameBarcode=#{FrameBarcode}")
  List<north_glass_buffer1> SelectAluminumFrameInfoById(String FrameBarcode);
  //根据玻璃id查询出片队列信息
  @Select("select * from out_slice where glassid=#{getbarcode}")
@@ -171,7 +169,9 @@
  //添加出片队列
  @Insert("INSERT INTO out_slice( `glassId`, `barcode`, `glasswidth`, `glassheight`, `state`, `flip`, `sequence`, `time` ,`position` ,`orderid` ,`listid` ,`boxid` ,`glasswidthmm` ,`glassheightmm` ,`framewidthmm` ,`frameheightmm` ,`framestate` ) VALUES ( #{glassid}, #{FrameNo}, #{glasslengthMm}, #{glassheightMm}, #{state}, #{flip}, #{sequence}, now(), #{position}, #{orderid}, #{listid}, #{boxid}, #{glasswidth}, #{glassheight}, #{framewidthmm}, #{frameheightmm}, 0);")
  void AddOutSliceS(String glassid, String flip, String FrameNo, String glasslengthMm, String glassheightMm, int sequence, String position, Short state,String orderid, String listid, String boxid, String glasswidth, String glassheight,String framewidthmm,String frameheightmm);
  void AddOutSliceS(String glassid, String flip, String FrameNo, String glasslengthMm, String glassheightMm,
      int sequence, String position, Short state, String orderid, String listid, String boxid, String glasswidth,
      String glassheight, String framewidthmm, String frameheightmm);
  //出片队列调序
  @Update("update out_slice set sequence=#{sequence} where glassid=#{glassId}")
@@ -180,6 +180,7 @@
  //查询出片队列最大顺序
  @Select("select ifnull(max(sequence),0)+1 from out_slice ")
  Short SelectMaxSquence();
  //查询用户权限
  @Select("select rp.* from role_permission rp inner join user r on rp.role_id=r.role_id and r.username=#{username} and (permission_id=32 or permission_id=33 or permission_id=34 or permission_id=35 or permission_id=36 or permission_id=37 or permission_id=38 or permission_id=39)")
  List<RolePermission> SelectPermissionByUserName(String username);
@@ -231,7 +232,6 @@
  //获取铝框有没有正在出片的玻璃
  @Select("select count(*) from out_slice where barcode=#{frameNo} and state=1")
  Short SelectOutingQueueCount(String frameNo);
  //查询理片笼内信息
  @Select("select * from storage_cage")
@@ -289,8 +289,27 @@
  @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);
  
  // 添加出片队列
  @Insert("INSERT INTO glassinfo (`flowcard`, `glasstype`, `mateid`, `glassid`, `tier`, `films`, `width`, `height`, `thickness`, `number`, `finishnumber`, `sumtier`, `measurenumber`)"
      +
      " VALUES (#{flowcard}, #{glasstype}, #{mateid}, #{glassid}, #{tier}, #{films}, #{width}, #{height}, #{thickness}, #{number}, 0, #{sumtier}, 0)")
  void AddGlassinfo(String flowcard, Integer glasstype, Integer mateid, String glassid, Integer tier, String films,
      Double width, Double height, Double thickness, Integer number, Integer sumtier);
  // 最大玻璃类型
  @Select("select max(glasstype)+1 from glassinfo")
  Integer SelectMaxType();
  // 查询全部玻璃类型
  @Select("select CONCAT(IFNULL(width,''),'_',IFNULL(height,''),'_',IFNULL(thickness,''),'_',IFNULL(films,'')) as type,glasstype from glassinfo GROUP BY width,height,thickness,films")
  List<Map> SelectType();
  // 查询总层数
  @Select("SELECT CONCAT(IFNULL(flowcard,''),'_',IFNULL(mateid,'')),count(*) as tiersum FROM `glassinfo` group by flowcard,mateid")
  List<Map> Selecttiersum();
  // 查询笼内玻璃信息
  @Select("select * from storage_cage where cage=#{cage} order by id desc")
  List<StorageCage> SelectStorageCageByCage(Integer cage);
}
springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
@@ -5,11 +5,13 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.springboot.common.Result;
import com.example.springboot.component.PLCAutoMes;
import com.example.springboot.component.Plchome;
import com.example.springboot.component.S7control;
import com.example.springboot.entity.FlowCard;
@@ -17,7 +19,9 @@
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.HomeMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
@Service
public class StorageCageService {
@@ -256,7 +260,6 @@
        return Result.success(map);
    }
    //查询玻璃信息
    public Result SelectGlassInfo(String width,String height,String thickness,String films) {
        List<GlassInfo> glassInfoList = homeMapper.SelectGlassInfo(width,height,thickness,films);
@@ -309,7 +312,8 @@
    //修改测量信息
    public Result UpdateQueue(GlassInfo glassInfo) {
        homeMapper.UpdateQueue(glassInfo.getFlowcard(),glassInfo.getWidth(),glassInfo.getHeight(),glassInfo.getGlasstype());
        homeMapper.UpdateQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(),
                glassInfo.getGlasstype());
        Map<String, Object> map = new HashMap<>();
        map.put("message", "200");
        return Result.success(map);
@@ -319,4 +323,90 @@
        return homeMapper.SelectStorageCageByCage(cage);
    }
    // 人工拿走
    public Result ManualTake(String glassInfo) {
        // 读取DB105区文件
        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
        // 移除
        // S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),
        // (short) 3);
        // plcmes.getPlcParameter("GaToMES").setValue("3");
        Map<String, Object> map = new HashMap<>();
        map.put("message", "200");
        return Result.success(map);
    }
    // 重新测量
    public Result AnewMeasure(String glassInfo) {
        // 读取DB105区文件
        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
        // 重新测量
        // S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),
        // (short) 2);
        // plcmes.getPlcParameter("GaToMES").setValue("2");
        Map<String, Object> map = new HashMap<>();
        map.put("message", "200");
        return Result.success(map);
    }
    // 添加小片信息
    public Result AddGlassinfo(List<Map> IportDataStr) {
        // 筛选处理数据 1.去除无用数据 2.计算配片ID 3.计算ID 4. 计算总层数
        List<Map> TypeDatas = homeMapper.SelectType();
        Map<String, String> TypeData = new HashMap<String, String>();// 得到处理完后所有的类型
        Map<String, Integer> groupby=new HashMap<String, Integer>(); // 得到处理完后所有总层数;
        List<Map> RemoveErrorData = IportDataStr.stream()
                .filter(item -> (item.get("order") != null && item.get("glasstype") != 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&& item.get("matching") != null))
                .collect(Collectors.toList());
        TypeDatas.forEach(item -> {
            TypeData.put(item.get("type").toString(), item.get("glasstype").toString());
        });
        RemoveErrorData.forEach(item -> {
            String key=item.get("order").toString()+"_"+item.get("matching").toString();
            if (groupby.get(key)!=null) {
                Integer Tiers=groupby.get(key)+1;
                groupby.put(key, Tiers);
            }else{
                groupby.put(key, 1);
            }
        });
        System.out.println(RemoveErrorData.size());
        // 处理完成 添加数据库
        for (Map map : RemoveErrorData) {
            String key = map.get("base").toString() + "_" + map.get("height").toString() + "_"
                       + map.get("thickness").toString() + "_" + map.get("films").toString();
            String tierkey = map.get("order").toString() + "_" + map.get("matching").toString();
            String value = TypeData.get(key);
            Integer glasstype;
            if (TypeData.get(key) == null) {
                glasstype = homeMapper.SelectMaxType();
            } else {
                glasstype = Integer.valueOf(value);
            }
            homeMapper.AddGlassinfo(map.get("order").toString(), glasstype,
                    Integer.parseInt(map.get("glasstype").toString()) // 需要计算 配片ID
                    , glasstype+"" // 需要计算 玻璃ID
                    , Integer.parseInt(map.get("tier").toString()), map.get("films").toString(),
                    Double.parseDouble(map.get("base").toString()), Double.parseDouble(map.get("height").toString()),
                    Double.parseDouble(map.get("thickness").toString()),
                    Integer.parseInt(map.get("quantity").toString()),groupby.get(tierkey));// 需要计算总层数
        }
        Map<String, Object> ResultCode = new HashMap<>();
        ResultCode.put("message", "200");
        return Result.success(ResultCode);
    }
}