wuyouming666
2024-04-17 e8005cc7b6caaa85c7fc99cc87e3877516f777d9
更新语句
6个文件已修改
217 ■■■■■ 已修改文件
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/controller/DownStorageCageDetailsController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownGlassCacheLogic.java 150 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageDetailsService.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageDetailsServiceImpl.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/controller/DownStorageCageDetailsController.java
@@ -5,8 +5,11 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/down-storage-cage-details")
@RequestMapping("/api/unLoadGlass/downstorage")
public class DownStorageCageDetailsController {
    @Autowired
@@ -18,5 +21,10 @@
        return "Details added successfully";
    }
    @GetMapping("/leisure")
    public List<Map<String, Object>> getLeisureData() {
        return downStorageCageDetailsService.selectCacheLeisure();
    }
    // Other CRUD operations can be defined here
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownGlassCacheLogic.java
@@ -21,6 +21,10 @@
@Data
@Service
public class DownGlassCacheLogic {
    //下片前理片
    public static final String RESULT_IN = "1";
    public static final String RESULT_OUT = "2";
    public static final String RESULT_IN_OUT = "3";
    @Autowired
    private DownStorageCageDetailsMapper selectInfo;
    private GlassInfoService GlassInfoService;
@@ -28,28 +32,23 @@
    private DownGlassTaskService downGlassTaskService;
    /**
     * @param Number
     *    //识别逻辑    不交互
     * @param Number //识别逻辑    不交互
     */
    public void identify(String Number){
    public void identify(String Number) {
        //查询任务
        PlcParameterObject plcmes= PLCAutoMes.PlcMesObject;
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1);
        String s=S7control.getinstance().ReadWord("DB14.26", 1).get(0)+"";
        boolean isexist=isExist(Number);
        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1);
        String s = S7control.getinstance().ReadWord("DB14.26", 1).get(0) + "";
        boolean isexist = isExist(Number);
        if (isexist) {
            //存在逻辑    1.添加信息 2.回复PLC存在
            //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1);
        }else {
        } else {
            //不存在逻辑  1.回复PLC不存在
            //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 2);
        }
    }
    //下片前理片
    public static final String RESULT_IN = "1";
    public static final String RESULT_OUT = "2";
    public static final String RESULT_IN_OUT = "3";
    public void process() {
        String result = S7control.getinstance().ReadWord("DB14.0", 1).get(0) + "";
@@ -75,44 +74,44 @@
    /**
     * @param Number
     * @return
     *   //下片前理片 进
     * @return //下片前理片 进
     */
    public boolean processInto(String Number){
    public boolean processInto(String Number) {
        GlassInfoService = WebSocketServer.applicationContext.getBean(GlassInfoService.class);
        //按id查询玻璃信息表里的玻璃
        GlassInfo GlassInfo=GlassInfoService.selectGlassId(Number);
        PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
        GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number);
        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
        //存在此玻璃编号
        if(GlassInfo!=null){
        if (GlassInfo != null) {
            //同钢化版图内的栅格号
            List<DownStorageCageDetails> list=selectInfo.SelectIsExistIntoCache(GlassInfo.getTemperingLayoutId(),GlassInfo.getTemperingFeedSequence(),GlassInfo.getWidth());
            List<DownStorageCageDetails> list = selectInfo.SelectIsExistIntoCache(GlassInfo.getTemperingLayoutId(), GlassInfo.getTemperingFeedSequence(), GlassInfo.getWidth());
            //空栅格号
            if (list.size()==0) {
                list=selectInfo.SelectCacheLeisure();
            if (list.size() == 0) {
                list = selectInfo.SelectCacheLeisure();
            }
            //小于此玻璃钢化版图序号的栅格号
            if(list.size()==0){
                list=selectInfo.SelectIsExistIntoCache(GlassInfo.getTemperingLayoutId(),GlassInfo.getWidth());
            if (list.size() == 0) {
                list = selectInfo.SelectIsExistIntoCache(GlassInfo.getTemperingLayoutId(), GlassInfo.getWidth());
            }
            if(list.size()>0){
            if (list.size() > 0) {
                //存在空格  
                //1.生成任务:  起始位置0   结束位置this.slot  任务类型 1   (进片任务)
                //2.回复 1进片
                DownStorageCageDetails item=list.get(0);
                selectInfo.insertCacheTask(GlassInfo.getId()+"","0",item.getSlot()+"","1",GlassInfo.getWidth(),GlassInfo.getHeight(),GlassInfo.getFilmsid(),GlassInfo.getThickness(),GlassInfo.getFlowcardId());
                DownStorageCageDetails item = list.get(0);
                selectInfo.insertCacheTask(GlassInfo.getId() + "", "0", item.getSlot() + "", "1", GlassInfo.getWidth(), GlassInfo.getHeight(), GlassInfo.getFilmsid(), GlassInfo.getThickness(), GlassInfo.getFlowcardId());
                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1);
                S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1);
                return true;
            }
        }else{
        } else {
            // ID编号不存在   不处理/回复PLC  进行报警提示
        }
        //返回结果
        return false;
    }
    //理片 出
    public boolean processOut() {
        // 查询任务
@@ -122,10 +121,38 @@
        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
        List<DownStorageCageDetails> list = selectInfo.SelectCacheOut(1, 5);
        List<DownStorageCageDetails> list2 = selectInfo.SelectCacheOut(6, 10);
        List<DownStorageCageDetails>  list3 = selectInfo.SelectCacheOut(1, 10);
        List<DownStorageCageDetails> list3 = selectInfo.SelectCacheOut(1, 10);
        // 优先 超出尺寸优先人工出片 人工处理
        if (!list3.isEmpty()) {
            DownStorageCageDetails item3 = list3.get(0);
            if (item3.getHeight() >= 1 && item3.getWidth() >= 1) {
                String endcell = "13";
                String SendEndcell = "1";
                selectInfo.insertCacheTask(item3.getGlassId() + "", "0", endcell, "2", item3.getWidth(), item3.getHeight(), item3.getFilmsid(), item3.getThickness(), item3.getFlowCardId());
                S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell);
                S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1");
                return true;
            }
        }
        //同时请求 优先后端出片
        else if (!list3.isEmpty()) {
            DownStorageCageDetails item3 = list3.get(0);
            if (G06.equals("0") && G11.equals("0")) {
                String endcell = "11";
                String SendEndcell = "1";
                selectInfo.insertCacheTask(item3.getGlassId() + "", "0", endcell, "2", item3.getWidth(), item3.getHeight(), item3.getFilmsid(), item3.getThickness(), item3.getFlowCardId());
                S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell);
                S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1");
                return true;
            }
        }
        // 按照顺序符合前端出片
        if (!list.isEmpty()) {
        else if (!list.isEmpty()) {
            DownStorageCageDetails item = list.get(0);
            if (G06.equals("0") && G11.equals("1")) {
                // 出到 G06
@@ -144,20 +171,11 @@
                S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1");
                return true;
            }
            // 超出尺寸优先人工出片 人工处理
        } else if (!list3.isEmpty()) {
            DownStorageCageDetails item3 = list3.get(0);
            if (item3.getHeight() >= 3440 && item3.getWidth() >= 1440) {
                String endcell = "06";
                String SendEndcell = "1";
                selectInfo.insertCacheTask(item3.getGlassId() + "", "0", endcell, "2", item3.getWidth(), item3.getHeight(), item3.getFilmsid(), item3.getThickness(), item3.getFlowCardId());
                S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell);
                S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1");
                return true;
            }
        }
        // 返回结果
        return false;
@@ -173,33 +191,16 @@
     *  //磨边   不交互  理片和磨边机自己交互
     */
    public void processMb(String Number){
          //按id查询玻璃信息表里的玻璃
        GlassInfo GlassInfo=GlassInfoService.selectGlassId(Number);
        PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
        if(GlassInfo!=null){
            //发送任务   ID   长 宽 厚 倒角 工艺功能等
            S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.22").getAddress(),"N10000");
            S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.24").getAddress(), "1000");
            S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.26").getAddress(),"800");
            S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(),"60");
            S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.30").getAddress(), "2");
            S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1");
        }
        //返回结果
    }
    /**
     * @param Number
     * @return
     * 查询消息队列里此玻璃ID的数据
     * @return 查询消息队列里此玻璃ID的数据
     */
    public boolean selectMessageId(String Number){
    public boolean selectMessageId(String Number) {
        //查询是否存在
        GlassInfo GlassInfo=GlassInfoService.selectGlassId(Number);
        if(GlassInfo==null){
        GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number);
        if (GlassInfo == null) {
            //返回 不存在
            return false;
@@ -210,38 +211,35 @@
    /**
     * @param Number
     * @return
     *   删除消息队列里此玻璃ID的数据
     * @return 删除消息队列里此玻璃ID的数据
     */
    public boolean deleteMessageId(String Number){
    public boolean deleteMessageId(String Number) {
        //查询是否存在
        GlassInfo GlassInfo=GlassInfoService.selectGlassId(Number);
        if(GlassInfo==null){
        GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number);
        if (GlassInfo == null) {
            //返回 不存在
            return false;
        }
        //返回 存在
        return true;
    }
    /**
     * @param Number
     * @return
     *   //是否存在此编号玻璃
     * @return //是否存在此编号玻璃
     */
    public boolean isExist(String Number){
    public boolean isExist(String Number) {
        //查询是否存在
        GlassInfo GlassInfo=GlassInfoService.selectGlassId(Number);
        if(GlassInfo==null){
        GlassInfo GlassInfo = GlassInfoService.selectGlassId(Number);
        if (GlassInfo == null) {
            //返回 不存在
            return false;
        }
        //返回 存在
        return true;
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageDetailsService.java
@@ -2,11 +2,14 @@
import com.mes.downstorage.entity.DownStorageCageDetails;
import java.util.List;
import java.util.Map;
public interface DownStorageCageDetailsService {
    void addDownStorageCageDetails(DownStorageCageDetails details);
    List<Map<String, Object>> selectCacheLeisure();
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageDetailsServiceImpl.java
@@ -1,20 +1,44 @@
package com.mes.downstorage.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.downstorage.entity.DownStorageCage;
import com.mes.downstorage.entity.DownStorageCageDetails;
import com.mes.downstorage.mapper.DownStorageCageDetailsMapper;
import com.mes.downstorage.mapper.DownStorageCageMapper;
import com.mes.downstorage.service.DownStorageCageDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service
public class DownStorageCageDetailsServiceImpl extends ServiceImpl<DownStorageCageDetailsMapper, DownStorageCageDetails> implements DownStorageCageDetailsService {
    @Override
    public void addDownStorageCageDetails(DownStorageCageDetails details) {
        this.save(details);
    }
//    @Resource
//    private DownStorageCageDetailsMapper downStorageCageDetailsMapper;
    @Override
    public List<Map<String, Object>> selectCacheLeisure() {
        QueryWrapper<DownStorageCageDetails> queryWrapper = new QueryWrapper<>();
        queryWrapper
                .apply("LEFT JOIN down_storage_cage esc ON esc.slot = down_storage_cage_details.slot")
                .isNull("down_storage_cage_details.slot");
        return listMaps(queryWrapper);
    }
    // Other business methods can be implemented here
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java
@@ -51,11 +51,27 @@
            return ResponseEntity.status(500).body(errorResponse);
        }
    }
    @GetMapping("/gettwo")
    public List<DownWorkstation> gettwoDownWorkstations() {
        return downWorkstationService.getoneDownWorkstations(6,10);
    public ResponseEntity<?> gettwoDownWorkstations() {
        try {
            List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations(1,5);
            // 构建符合预期格式的响应数据
            Map<String, Object> responseData = new HashMap<>();
            responseData.put("code", 200);
            responseData.put("msg", "成功");
            responseData.put("data", data);
            // 返回 ResponseEntity 对象,包含响应数据和状态码
            return ResponseEntity.ok(responseData);
        } catch (Exception e) {
            e.printStackTrace();
            // 如果出现异常,返回错误信息
            Map<String, Object> errorResponse = new HashMap<>();
            errorResponse.put("code", 500);
            errorResponse.put("msg", "服务器内部错误");
            return ResponseEntity.status(500).body(errorResponse);
        }
    }
    @GetMapping("/getflowCardId")
    public ResponseEntity<Map<String, Object>> getflowCardId() {
        Map<String, Object> responseData = new HashMap<>();
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java
@@ -120,8 +120,10 @@
        // 从 SQL Server 数据库中查询数据
        List<DownWorkstationTask> downWorkstationTasks = downWorkstationTaskMapper.selectList();
    }
}