| | |
| | | })
|
| | | }
|
| | |
|
| | | export function SwitchScanMethod(scansmethod) {s
|
| | | export function SwitchScanMethod(scansmethod) {
|
| | | return request({
|
| | | url: '/home/SwitchScanMethod?Scanmethod='+scanmethod,
|
| | | url: '/home/SwitchScanMethod?scansmethod='+scansmethod,
|
| | | method: 'post',
|
| | | data:""
|
| | | })
|
| | |
| | | {
|
| | | |
| | | "ip": "localhost",
|
| | | "systemTitle": "Login System",
|
| | | "usernamePlaceholder": "Please enter username",
|
| | |
| | | <div style="display:flex;justify-content: space-around;width: 9zz5%;margin: 0 auto;">
|
| | | <!-- <el-input style="width:15%;" :placeholder="$t('Enter the glass barcode')" v-model="glassid1"
|
| | | :class="ManuallyInfeedGlass == true ? 'hide' : ''"></el-input> -->
|
| | | <el-button type="primary" @click="SelectGlassByGlassIDs(2)" :disabled="ManuallyInfeedGlass"
|
| | | <el-button type="primary" @click="SelectGlassByGlassIDs()" :disabled="ManuallyInfeedGlass"
|
| | | :class="ManuallyInfeedGlass == true ? 'hide' : ''">
|
| | | {{ $t('Manually Infeed Glass') }}</el-button>
|
| | | <el-button type="primary" @click="showform2()" :disabled="OrderInfo"
|
| | |
| | | A01.1:{{ ShowGlassIdList(4) }}</div>
|
| | |
|
| | | <div class="glass A01" style="top: 290px;left: 289px;position: absolute;"
|
| | | @click="ClearGlassId('DB101.10.1,5')">A01.2:{{ ShowGlassIdList(5) }}</div>
|
| | | @click="ClearGlassId('DB101.10.1,5',5)">A01.2:{{ ShowGlassIdList(5) }}</div>
|
| | |
|
| | | <div class="glass A02" style="top: 310px;left: 289px;position: absolute;"
|
| | | @click="ClearGlassId('DB101.10.2,6')">A02:{{ ShowGlassIdList(6) }}</div>
|
| | | @click="ClearGlassId('DB101.10.2,6',6)">A02:{{ ShowGlassIdList(6) }}</div>
|
| | |
|
| | | <div class="glass D03" style="top: 137px;left: 42px;position: absolute;"
|
| | | @click="ClearGlassId('DB101.9.4', 7)">
|
| | |
| | | }}</el-button>
|
| | | </el-form-item>
|
| | | <el-form-item>
|
| | | <el-input style="width:70%;" maxlength="14" :placeholder="$t('Enter the glass barcode')"
|
| | | <el-input style="width:70%;" maxlength="13" :placeholder="$t('Enter the glass barcode')"
|
| | | v-model="glassid1"></el-input>
|
| | | <el-button type="primary" :disabled="Scanningmethod" @click="WriteGlassID()">{{ $t('Add')
|
| | | <el-button type="primary" :disabled="!Scanningmethod" @click="WriteGlassID()">{{ $t('Add')
|
| | | }}</el-button>
|
| | | </el-form-item>
|
| | | <el-form-item>
|
| | | {{ $t('Barcode') }}:
|
| | | <el-input style="width:70%;" maxlength="14" :disabled="true" v-model="glassid1"></el-input>
|
| | | <el-input style="width:70%;" maxlength="14" :disabled="true" v-model="CurrrentGlassId"></el-input>
|
| | | </el-form-item>
|
| | | </div>
|
| | | <div style="display: flex;justify-content: space-around;">
|
| | |
| | | {{ $t('Confirm') }}</el-button>
|
| | | </div>
|
| | | </el-form>
|
| | | <template #footer>
|
| | | <!-- <template #footer>
|
| | | <span class="dialog-footer">
|
| | | <el-button @click="cancel3()">{{ $t('cancel') }}</el-button>
|
| | | </span>
|
| | | </template>
|
| | | </template> -->
|
| | | </el-dialog>
|
| | |
|
| | | <el-dialog :visible.sync="dialogFormVisible6" :title="$t('Outing Queue')" top="5vh">
|
| | |
| | | CurrentFrame: [],
|
| | | DeviceList: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
| | | GlassIdList: [],
|
| | | Scanningmethod: true
|
| | | Scanningmethod: true,
|
| | | CurrrentGlassId:""
|
| | | };
|
| | | },
|
| | | created() {
|
| | |
| | | this.alarm = obj.alarmmg[0];
|
| | | //获取当前扫码方式
|
| | | if (obj.Scanningmethod != null) {
|
| | | if (obj.Scanningmethod == 0) {
|
| | | this.Scanningmethod = true;
|
| | | this.Scanningmethod=obj.Scanningmethod[0];
|
| | | }
|
| | | else {
|
| | | this.Scanningmethod = false;
|
| | | }
|
| | |
|
| | | //获取当前扫码枪玻璃id
|
| | | if(obj.CurrrentGlassId!=null){
|
| | | const specialChars = /[^\w\s]/g;
|
| | | this.CurrrentGlassId=obj.CurrrentGlassId[0].replace(specialChars, "");
|
| | | }
|
| | |
|
| | | //查询当前铝框信息
|
| | |
| | | } else {
|
| | | this.form3 = {};
|
| | | }
|
| | | |
| | | if (obj.form3 != null && obj.form3 != "" && obj.state[0] == 0) {
|
| | | this.loadglassheight1 = 70;
|
| | | this.form5 = obj.form3[0];
|
| | | if(this.form5.glassId!=obj.form3[0].glassId){
|
| | | this.showform3();
|
| | | }
|
| | | this.form5 = obj.form3[0];
|
| | | this.glassid1 = "";
|
| | | if (this.D01RequestState == true) {
|
| | | this.Sizerange(this.form5, 3);
|
| | |
| | | }
|
| | | },
|
| | | //获取扫码位和上片位数据
|
| | | SelectGlassByGlassIDs(parameter) {
|
| | | SelectGlassByGlassIDs() {
|
| | | this.showform3();
|
| | | // if (parameter == 1) {
|
| | | // SelectGlassByGlassID(this.glassid2).then(res => {
|
| | |
| | | //清除玻璃id
|
| | | ClearGlassId(position, num) {
|
| | | if (this.ClearGlassID == false) {
|
| | | if (this.DeviceList[position] == 0) {
|
| | | if (this.GlassIdList[num].length == 14) {
|
| | | console.log(this.DeviceList,num);
|
| | | if (this.DeviceList[num] == 0) {
|
| | | if (this.GlassIdList[num].length < 14) {
|
| | | this.$confirm(this.$t('Are you sure to clear this barcode ?'), this.$t('confirm'), {
|
| | | confirmButtonText: this.$t('Yes'),
|
| | | cancelButtonText: this.$t('No'),
|
| | |
| | | },
|
| | | //切换二维码获取方式
|
| | | SwitchScanMethod(){
|
| | | var Scanmethod;
|
| | | if(this.Scanningmethod == true){
|
| | | this.Scanmethod = 1;
|
| | | }else{
|
| | | this.Scanmethod = 0;
|
| | | }
|
| | | SwitchScanMethod(Scanmethod).then(res => {
|
| | | SwitchScanMethod(!this.Scanningmethod).then(res => {
|
| | | if (res.data.message == 200) {
|
| | | this.$message.success(this.$t('Operation successful'));
|
| | | }
|
| | |
| | | this.storageCageService = storageCageService; |
| | | this.plcParameterObject = new PlcParameterObject(); |
| | | this.plcBitObject = new PlcBitObject(); |
| | | String jsonFilePath = "JsonFile/PlcParameter.json"; |
| | | InitUtil.initword(jsonFilePath); // 初始化 PlcParameterObject |
| | | String jsonFilePath2 = "JsonFile/PlcSign.json"; |
| | | InitUtil.initbit(jsonFilePath2); // 初始化 PlcSign |
| | | // String jsonFilePath = "JsonFile/PlcParameter.json"; |
| | | // InitUtil.initword(jsonFilePath); // 初始化 PlcParameterObject |
| | | // String jsonFilePath2 = "JsonFile/PlcSign.json"; |
| | | // InitUtil.initbit(jsonFilePath2); // 初始化 PlcSign |
| | | |
| | | |
| | | } |
| | |
| | | // \\ TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | if (S7control.getinstance().CheckConnected() == false) { |
| | | // if (S7control.getinstance().CheckConnected() == false) { |
| | | spianService = WebSocketServer.applicationContext.getBean(SpianService.class); |
| | | spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class); |
| | | jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class); |
| | |
| | | // 查询数据库 |
| | | // 推送到前端 |
| | | |
| | | } |
| | | // } |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.example.springboot.component; |
| | | |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | |
| | | import java.io.IOException; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | import com.example.springboot.service.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import com.example.springboot.entity.Out_slice; |
| | | import com.example.springboot.entity.Queue; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.alarmmg; |
| | | import com.example.springboot.entity.north_glass_buffer1; |
| | | import com.example.springboot.mapper.HomeMapper; |
| | | import com.example.springboot.mapper.SpianMapper; |
| | | |
| | | public class PlcLayout extends Thread { |
| | | |
| | | @Autowired |
| | | private HomeMapper homeMapper; |
| | | @Autowired |
| | | // 出片队列是否允许出片 |
| | | public static Boolean isAllowQueue = true; |
| | | public static Boolean isAllowReordering = true; |
| | | // 出片队列警告 |
| | | public static Boolean isQueueWarning = false; |
| | | // 铝框id |
| | | public static String FrameNo = ""; |
| | | // 是否需要手动确认玻璃 |
| | | public static Boolean isConfirm = false; |
| | | // 待确认的出片队列 |
| | | public static List<north_glass_buffer1> AluminumFrame; |
| | | |
| | | // private Configuration config; |
| | | |
| | | private StorageCageService storageCageService; |
| | | |
| | | // public Plchome() throws IOException { |
| | | // config = new Configuration("config.properties"); |
| | | // } |
| | | |
| | | // public static Map b=new HashMap<>(); |
| | | // b.put() |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | JSONObject jsonObject = new JSONObject(); |
| | | |
| | | // 注入mapper |
| | | |
| | | homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class); |
| | | |
| | | |
| | | if (S7control.getinstance().CheckConnected() == true) { |
| | | |
| | | |
| | | |
| | | // 查询报警信息 |
| | | List<alarmmg> alarmmg = homeMapper.SelectAlarmmgInfo(); |
| | | jsonObject.append("alarmmg", alarmmg); |
| | | |
| | | // 复位倒计时 |
| | | // 地址104.9.6 |
| | | List<Boolean> countdown = S7control.getinstance().ReadBits("DB104.9.6", 1); |
| | | for (Boolean countdowns : countdown) { |
| | | jsonObject.append("countdown", countdowns); |
| | | } |
| | | // jsonObject.append("countdown", true); |
| | | // 复位完成信号ss |
| | | List<Boolean> resetss = S7control.getinstance().ReadBits("DB103.284", 1); |
| | | for (Boolean reset : resetss) { |
| | | jsonObject.append("reset", reset); |
| | | } |
| | | |
| | | // 是否急停 |
| | | List<Boolean> emergencystops = S7control.getinstance().ReadBits("DB104.5.1", 1); |
| | | for (Boolean emergencystop : emergencystops) { |
| | | jsonObject.append("emergencystop", emergencystop); |
| | | } |
| | | |
| | | } |
| | | |
| | | // jsonObject.append("params", new short[] { 30, 40, }); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Layout"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | |
| | | if (webserver != null) { |
| | | |
| | | List<String> messages = webserver.getMessages(); |
| | | |
| | | if (!messages.isEmpty()) { |
| | | // // 将最后一个消息转换为整数类型的列表 |
| | | webserver.clearMessages(); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | FileInputStream fileInputStream; |
| | | try { |
| | | // 从文件中读取字节数据存入 fileInputStream |
| | | fileInputStream = new FileInputStream("D:/canadames/Alarm.json"); |
| | | fileInputStream = new FileInputStream("D:/code/canadames/Alarm.json"); |
| | | // 读取 fileInputStream 中字节并将其解码为字符 |
| | | InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8"); |
| | | // 提高读取效率,在 BufferedReader 内包装 InputStreamReader |
| | |
| | | // // TODO: handle exception
|
| | | // }
|
| | |
|
| | | if (S7control.getinstance().CheckConnected() == true) {
|
| | | // if (S7control.getinstance().CheckConnected() == true) {
|
| | | // 获取当前扫码方式
|
| | | List<Short> Scanningmethod = S7control.getinstance().ReadWord("DB103.255", 1);
|
| | |
|
| | | List<Boolean> Scanningmethods = S7control.getinstance().ReadBits("DB101.11.4", 1);
|
| | | if(Scanningmethods!=null){
|
| | | for (Boolean Scanningmethod : Scanningmethods) {
|
| | | jsonObject.append("Scanningmethod", Scanningmethod);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | String CurrrentGlassId = spianService.queGlassid("DB103.256", 14).toString();
|
| | | jsonObject.append("CurrrentGlassId", CurrrentGlassId);
|
| | |
|
| | | // 获取D01-D06,A01,A02,B01,B02状态
|
| | | List<Short> DeviceList = S7control.getinstance().ReadWord("DB103.0", 10);
|
| | | jsonObject.append("DeviceList", DeviceList);
|
| | |
| | | // }
|
| | |
|
| | | // }
|
| | | }
|
| | | // }
|
| | |
|
| | | storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
|
| | | dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
|
| | |
| | | // |
| | | System.out.println("启动完成"); |
| | | |
| | | // new PlcHold().start(); |
| | | new PlcHold().start(); |
| | | |
| | | new Plchome().start(); |
| | | new PlcLayout().start(); |
| | |
| | | new PlcManualonePosition2().start(); |
| | | new PlcServoManualone().start(); |
| | | new PLCManualJog().start(); |
| | | //new Plclog().start(); |
| | | new Plclog().start(); |
| | | |
| | | new PlcInteractionState().start(); |
| | | new PlcParameter1Review().start(); |
| | | // new PlcParameter1Review().start(); |
| | | // new PLCAutomaticParameterSettingReview().start(); |
| | | } |
| | | } |
| | |
| | | @PostMapping("/WriteGlassID") |
| | | public Result WriteGlassID(String glassid) { |
| | | // 扫码位写入玻璃id |
| | | spianService.outmesid(glassid, "DB103.256"); |
| | | spianService.outmesid(glassid, "DB103.286"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | |
| | | |
| | | // 切换PLC获取二维码方式 |
| | | @PostMapping("/SwitchScanMethod") |
| | | public Result SwitchScanMethod(Short scansmethod) { |
| | | S7control.getinstance().WriteWord("DB103.255", scansmethod); |
| | | public Result SwitchScanMethod(Boolean scansmethod) { |
| | | S7control.getinstance().WriteBit("DB101.11.4", scansmethod); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | |
| | | short SelectInTask(); |
| | | |
| | | // 手动完成任务 |
| | | @Update("update storage_task set task_state=2 where task_type=#{task_type} and glass_id=#{glassid}") |
| | | @Update("update storage_task set task_state=1 where task_type=#{task_type} and glass_id=#{glassid}") |
| | | void UpdateTask(@Param("task_type") Integer task_type,String glassid); |
| | | |
| | | // 手动完成进片任务修改笼子数据 |
| | |
| | | void UpdateOutSliceGlass(String glassid); |
| | | |
| | | //查询未完成的任务 |
| | | @Select("select * from storage_task where task_state!=2 and task_type=#{task_type}") |
| | | @Select("select * from storage_task where task_state=0 and task_type=#{task_type}") |
| | | List<StorageTask> SelectTaskByState(int task_type); |
| | | |
| | | //修改出片队列铝框状态 |
| | |
| | | @Update("update storage_cage set state=#{state},glass_id=#{glassid},order_id=#{orderid},glasswidth=#{width} where id=#{id};") |
| | | void UpdataAddCage(String orderid, String glassid, double width, int cage, int cell, int id, int state); |
| | | |
| | | @Update("update storage_cage set state=#{state},glass_id=#{glassid},order_id=#{glass.ordernumber},glasswidth=#{glass.glasslengthmm},glassheight=#{glass.glassheightmm},glasswidthmm=#{glass.glasslength},glassheightmm=#{glass.glassheight},listid=#{glass.listnumber},boxid=#{glass.boxnumber},FrameBarcode=#{glass.FrameBarcode} where id=#{id};") |
| | | @Update("update storage_cage set state=#{state},glass_id=#{glassid},order_id=#{glass.ordernumber},glasswidth=#{glass.glasslengthmm},glassheight=#{glass.glassheightmm},glasswidthmm=#{glass.glasslength},glassheightmm=#{glass.glassheight},listid=#{glass.listnumber},boxid=#{glass.boxnumber},FrameBarcode=#{glass.frameBarcode} where id=#{id};") |
| | | void UpdataAddCage2(String orderid, String glassid, north_glass_buffer1 glass, int cage, int cell, int id,int state); |
| | | |
| | | // 修改笼子信息(多片进片) |
| | |
| | | } else if (storageTask.getGlassId() == B02glassid&&DeviceList.get(3)==0) { |
| | | ClearGlassId("DB101.10.3"); |
| | | outSliceServive.StopTask(storageTask.getGlassId(), types); |
| | | }\ |
| | | } |
| | | } |
| | | // 发送终止进片任务信号 |
| | | } else {// 终止出片任务 |
| | | List<StorageTask> cageLists = homeMapper.SelectTaskByState(types); |
| | | List<StorageTask> cageList2 = homeMapper.SelectTaskByState(2); |
| | | if (cageList2!=null) { |
| | | if (cageList2.size()>0) { |
| | | cageLists.add(cageList2.get(0)); |
| | | } |
| | | for (StorageTask cageList : cageLists) { |
| | | if (cageList.getTaskType().equals("1")) { |
| | | if(cageList.getGlassId() ==A02glassid1&&DeviceList.get(5)==0){ |
| | | |
| | | System.out.println(DeviceList.get(5)); |
| | | if(cageList.getGlassId().equals(A02glassid1)&&DeviceList.get(5)==0){ |
| | | outSliceServive.StopTask(cageList.getGlassId(), types); |
| | | ClearGlassId("DB101.10.1"); |
| | | } |
| | | else if(cageList.getGlassId() ==B01glassid&&DeviceList.get(2)==0){ |
| | | if(cageList.getGlassId().equals(B01glassid)&&DeviceList.get(2)==0){ |
| | | outSliceServive.StopTask(cageList.getGlassId(), types); |
| | | ClearGlassId("DB101.10.2"); |
| | | } |
| | | else if(cageList.getGlassId() ==B02glassid&&DeviceList.get(3)==0){ |
| | | if(cageList.getGlassId().equals(B02glassid)&&DeviceList.get(3)==0){ |
| | | outSliceServive.StopTask(cageList.getGlassId(), types); |
| | | ClearGlassId("DB101.10.3"); |
| | | } |
| | | }else if (cageList.getTaskType().equals("2")) { |
| | | if(cageList.getGlassId() ==A02glassid1&&DeviceList.get(5)==0){ |
| | | if(cageList.getGlassId().equals(A02glassid1)&&DeviceList.get(5)==0){ |
| | | outSliceServive.StopTask(cageList.getGlassId(), 2); |
| | | ClearGlassId("DB101.10.1"); |
| | | } |
| | | else if(cageList.getGlassId() ==B01glassid&&DeviceList.get(2)==0){ |
| | | if(cageList.getGlassId().equals(B01glassid)&&DeviceList.get(2)==0){ |
| | | outSliceServive.StopTask(cageList.getGlassId(), 2); |
| | | ClearGlassId("DB101.10.2"); |
| | | } |
| | | else if(cageList.getGlassId() ==B02glassid&&DeviceList.get(3)==0){ |
| | | if(cageList.getGlassId().equals(B02glassid)&&DeviceList.get(3)==0){ |
| | | outSliceServive.StopTask(cageList.getGlassId(), 2); |
| | | ClearGlassId("DB101.10.3"); |
| | | } |