Merge branch 'master' of http://10.153.19.150:10101/r/CanadaMes
| | |
| | | {
|
| | |
|
| | | "systemTitle": "Login System",
|
| | | "usernamePlaceholder": "Please enter username",
|
| | | "passwordPlaceholder": "Please enter password",
|
| | | "loginButton": "Login",
|
| | | "registerButton": "Register",
|
| | | "resetButton": "Reset",
|
| | | "usernameRequired": "Please enter username",
|
| | | "usernameLength": "Username must be between 5 and 15 characters",
|
| | | "passwordRequired": "Please enter password",
|
| | | "passwordLength": "Password must be between 5 and 15 characters",
|
| | | "loginSuccess": "Login successful",
|
| | | "langBtnCN": "Chinese",
|
| | | "langBtnEN": "English",
|
| | | "langHome": "Home",
|
| | | "langUserManagement": "User Management",
|
| | | "langUserList": "User List",
|
| | | "langUsernamePlaceholder": "Please enter username",
|
| | | "langEmailPlaceholder": "Please enter email",
|
| | | "langSearch": "Search",
|
| | | "langAddUser": "Add User",
|
| | | "langUsername": "Username",
|
| | | "langEmail": "Email",
|
| | | "langCreateTime": "Create Time",
|
| | | "langDisabled": "Disabled",
|
| | | "langAction": "Action",
|
| | | "langEdit": "Edit",
|
| | | "langDelete": "Delete",
|
| | | "langAddUserTitle": "Add User",
|
| | | "langPassword": "Password",
|
| | | "langState": "State",
|
| | | "langSelect": "Please select",
|
| | | "langCancel": "Cancel",
|
| | | "langConfirm": "Confirm",
|
| | | "langEditUserTitle": "Edit User",
|
| | | "northglassMESsystem":"NorthGlassMesSystem",
|
| | | "exit":"exit",
|
| | | "changePassword":"changePassword",
|
| | | "resetPassword": "resetPassword",
|
| | | "home":"Home",
|
| | | "role":"role",
|
| | | "langRoleManagement": "Role Management",
|
| | | "langRoleList": "Role List",
|
| | | "langEnterRoleName": "Please enter role name",
|
| | | "langAddRole": "Add Role",
|
| | | "langName": "Name",
|
| | | "langIsValid": "Is Valid",
|
| | | "langOperation": "Operation",
|
| | | "langPleaseSelect": "Please select",
|
| | | "langValid": "Valid",
|
| | | "langInvalid": "Invalid",
|
| | | "langAddRoleSuccess": "Add role successfully",
|
| | | "langEnterName": "Please enter name",
|
| | | "langLengthBetween": "Length should be between",
|
| | | "langAnd": "and",
|
| | | "langCharacters": "characters",
|
| | | "langEnterState": "Please enter state",
|
| | | "langUpdateState": "Update state successfully",
|
| | | "langEditRole": "Edit Role",
|
| | | "langEditRoleSuccess": "Edit role successfully",
|
| | | "langDeleteRoleConfirm": "Are you sure you want to delete this role?",
|
| | | "langPrompt": "Prompt",
|
| | | "langDeleteRoleSuccess": "Delete role successfully",
|
| | | "langCancelDelete": "Cancelled deleting",
|
| | | "langRoleName":"langRoleName",
|
| | | "updateSuccessMessage":"updateSuccessMessage",
|
| | | "paginationTotal": "Total {total}",
|
| | | "paginationSizes": "Items per page",
|
| | | "paginationPrev": "Previous",
|
| | | "paginationPager": "{currentPage}/{pageCount}",
|
| | | "paginationNext": "Next",
|
| | | "paginationJumper": "Jump to",
|
| | | "breadcrumb": {
|
| | | "home": "Home",
|
| | | "permissionManagement": "Permission Management",
|
| | | "permissionList": "Permission List"
|
| | | },
|
| | | "search": {
|
| | | "placeholder": "Enter keywords"
|
| | | },
|
| | | "button": {
|
| | | "addPermission": "Add Permission",
|
| | | "cancel": "Cancel",
|
| | | "confirm": "Confirm"
|
| | | },
|
| | | "table": {
|
| | | "role": "Role",
|
| | | "permissionDescription": "Permission Description",
|
| | | "permissionValue": "Permission Value",
|
| | | "createTime": "Create Time",
|
| | | "isActive": "Is Active",
|
| | | "operation": "Operation"
|
| | | },
|
| | | "tooltip": {
|
| | | "edit": "Edit",
|
| | | "delete": "Delete"
|
| | | },
|
| | | "dialog": {
|
| | | "addPermission": "Add Permission",
|
| | | "editPermission": "Edit Permission"
|
| | | },
|
| | | "form": {
|
| | | "role": "Role",
|
| | | "select": "Please Select",
|
| | | "permission": "Permission",
|
| | | "isActive": "Is Active"
|
| | | },
|
| | | "操作": "Operation",
|
| | | "有效": "Valid",
|
| | | "无效": "Invalid",
|
| | | "请输入名称": "Please enter a name",
|
| | | "长度在 2 到 15 个字符": "Length between 2 and 15 characters",
|
| | | "请输入状态": "Please enter the status",
|
| | | "添加角色": "Add Role",
|
| | | "修改角色": "Edit Role",
|
| | | "删除角色": "Delete Role",
|
| | | "此操作将永久删除该角色, 是否继续?": "This operation will permanently delete the role. Continue?",
|
| | | "提示": "Reminder",
|
| | | "确定": "Confirm",
|
| | | "取消": "Cancel",
|
| | | "添加角色成功": "Successfully added role",
|
| | | "更新状态成功": "Successfully updated status",
|
| | | "修改角色成功": "Successfully modified role",
|
| | | "删除角色成功": "Successfully deleted role",
|
| | | "修改用户成功":"Successfully modified user",
|
| | | |
| | |
|
| | | "systemTitle": "Login System",
|
| | | "usernamePlaceholder": "Please enter username",
|
| | | "passwordPlaceholder": "Please enter password",
|
| | | "loginButton": "Login",
|
| | | "registerButton": "Register",
|
| | | "resetButton": "Reset",
|
| | | "usernameRequired": "Please enter username",
|
| | | "usernameLength": "Username must be between 5 and 15 characters",
|
| | | "passwordRequired": "Please enter password",
|
| | | "passwordLength": "Password must be between 5 and 15 characters",
|
| | | "loginSuccess": "Login successful",
|
| | | "langBtnCN": "Chinese",
|
| | | "langBtnEN": "English",
|
| | | "langHome": "Home",
|
| | | "langUserManagement": "User Management",
|
| | | "langUserList": "User List",
|
| | | "langUsernamePlaceholder": "Please enter username",
|
| | | "langEmailPlaceholder": "Please enter email",
|
| | | "langSearch": "Search",
|
| | | "langAddUser": "Add User",
|
| | | "langUsername": "Username",
|
| | | "langEmail": "Email",
|
| | | "langCreateTime": "Create Time",
|
| | | "langDisabled": "Disabled",
|
| | | "langAction": "Action",
|
| | | "langEdit": "Edit",
|
| | | "langDelete": "Delete",
|
| | | "langAddUserTitle": "Add User",
|
| | | "langPassword": "Password",
|
| | | "langState": "State",
|
| | | "langSelect": "Please select",
|
| | | "langCancel": "Cancel",
|
| | | "langConfirm": "Confirm",
|
| | | "langEditUserTitle": "Edit User",
|
| | | "northglassMESsystem": "NorthGlassMesSystem",
|
| | | "exit": "exit",
|
| | | "changePassword": "changePassword",
|
| | | "resetPassword": "resetPassword",
|
| | | "home": "Home",
|
| | | "role": "role",
|
| | | "langRoleManagement": "Role Management",
|
| | | "langRoleList": "Role List",
|
| | | "langEnterRoleName": "Please enter role name",
|
| | | "langAddRole": "Add Role",
|
| | | "langName": "Name",
|
| | | "langIsValid": "Is Valid",
|
| | | "langOperation": "Operation",
|
| | | "langPleaseSelect": "Please select",
|
| | | "langValid": "Valid",
|
| | | "langInvalid": "Invalid",
|
| | | "langAddRoleSuccess": "Add role successfully",
|
| | | "langEnterName": "Please enter name",
|
| | | "langLengthBetween": "Length should be between",
|
| | | "langAnd": "and",
|
| | | "langCharacters": "characters",
|
| | | "langEnterState": "Please enter state",
|
| | | "langUpdateState": "Update state successfully",
|
| | | "langEditRole": "Edit Role",
|
| | | "langEditRoleSuccess": "Edit role successfully",
|
| | | "langDeleteRoleConfirm": "Are you sure you want to delete this role?",
|
| | | "langPrompt": "Prompt",
|
| | | "langDeleteRoleSuccess": "Delete role successfully",
|
| | | "langCancelDelete": "Cancelled deleting",
|
| | | "langRoleName": "langRoleName",
|
| | | "updateSuccessMessage": "updateSuccessMessage",
|
| | | "paginationTotal": "Total {total}",
|
| | | "paginationSizes": "Items per page",
|
| | | "paginationPrev": "Previous",
|
| | | "paginationPager": "{currentPage}/{pageCount}",
|
| | | "paginationNext": "Next",
|
| | | "paginationJumper": "Jump to",
|
| | | "breadcrumb": {
|
| | | "home": "Home",
|
| | | "permissionManagement": "Permission Management",
|
| | | "permissionList": "Permission List"
|
| | | },
|
| | | "search": {
|
| | | "placeholder": "Enter keywords"
|
| | | },
|
| | | "button": {
|
| | | "addPermission": "Add Permission",
|
| | | "cancel": "Cancel",
|
| | | "confirm": "Confirm"
|
| | | },
|
| | | "table": {
|
| | | "role": "Role",
|
| | | "permissionDescription": "Permission Description",
|
| | | "permissionValue": "Permission Value",
|
| | | "createTime": "Create Time",
|
| | | "isActive": "Is Active",
|
| | | "operation": "Operation"
|
| | | },
|
| | | "tooltip": {
|
| | | "edit": "Edit",
|
| | | "delete": "Delete"
|
| | | },
|
| | | "dialog": {
|
| | | "addPermission": "Add Permission",
|
| | | "editPermission": "Edit Permission"
|
| | | },
|
| | | "form": {
|
| | | "role": "Role",
|
| | | "select": "Please Select",
|
| | | "permission": "Permission",
|
| | | "isActive": "Is Active"
|
| | | },
|
| | | "操作": "Operation",
|
| | | "有效": "Valid",
|
| | | "无效": "Invalid",
|
| | | "请输入名称": "Please enter a name",
|
| | | "长度在 2 到 15 个字符": "Length between 2 and 15 characters",
|
| | | "请输入状态": "Please enter the status",
|
| | | "添加角色": "Add Role",
|
| | | "修改角色": "Edit Role",
|
| | | "删除角色": "Delete Role",
|
| | | "此操作将永久删除该角色, 是否继续?": "This operation will permanently delete the role. Continue?",
|
| | | "提示": "Reminder",
|
| | | "确定": "Confirm",
|
| | | "取消": "Cancel",
|
| | | "添加角色成功": "Successfully added role",
|
| | | "更新状态成功": "Successfully updated status",
|
| | | "修改角色成功": "Successfully modified role",
|
| | | "删除角色成功": "Successfully deleted role",
|
| | | "translation": {
|
| | | "D01 VFD error": "D01 VFD error",
|
| | | "D02 VFD error": "D02 VFD error",
|
| | |
| | | "State": "State",
|
| | | "Alarm": "Alarm",
|
| | | "Distribute": "Distribute"
|
| | | }
|
| | |
|
| | | } |
| | |
| | | package com.example.springboot.component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import javax.websocket.Session; |
| | | |
| | | import com.example.springboot.controller.SpianController; |
| | | import com.example.springboot.mapper.AlarmMapper; |
| | | |
| | | import cn.hutool.json.JSONArray; |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | List<Boolean> bitlist = S7control.getinstance().ReadBits("DB2.0.0", 100); |
| | | |
| | | List<Short> paramlist = S7control.getinstance().ReadWord("DB100.6", 1); |
| | | |
| | | |
| | | //判断进片请求 |
| | | List<Short> datas1List=S7control.getinstance().ReadWord("DB106.24", 1); |
| | | |
| | | // List<Short> datas1List=S7control.getinstance().ReadWord("DB106.24", 1); |
| | | // List<Short> datas1ListState=S7control.getinstance().ReadWord("DB106.8", 1); |
| | | SpianController spianController=new SpianController(); |
| | | List<Short> datas1List1=new ArrayList<>(); |
| | | List<Short> datas1List2=new ArrayList<>(); |
| | | datas1List1.add((short)1); |
| | | datas1List2.add((short)0); |
| | | //获取prc进片请求数据 |
| | | boolean exist = datas1List1.contains((short)1); |
| | | boolean exist1 = datas1List2.contains((short)0); |
| | | //进片请求为1时 |
| | | if(exist=true){ |
| | | //当进片车空闲时 |
| | | if(exist=true){ |
| | | List<Short> datas1ListID=S7control.getinstance().ReadWord("DB106.26", 13); |
| | | //获取玻璃id |
| | | for(Short list1:datas1ListID) |
| | | spianController.selectAll(list1); |
| | | } |
| | | //System.out.println(exist); |
| | | |
| | | } |
| | | //获取进片id |
| | | // List<Short> datas1ListID=S7control.getinstance().ReadWord("DB106.26", 13); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 查询数据库 |
| | | // 推送到前端 |
| | | |
| | |
| | | new PlcHold().start(); |
| | | new Plcaction().start(); |
| | | new PlcParameter().start(); |
| | | |
| | | new Plchome().start(); |
| | | |
| | | new PlcParameter().start(); |
| | | |
| | | new Plcalarm().start(); |
| | | |
| | | new Plcsign().start(); |
| | | |
| | | new Plcstate().start(); |
| | | } |
| | | } |
| | |
| | | }else{ |
| | | map.put("message2","200"); |
| | | //调用伍上片函数 |
| | | |
| | | } |
| | | return Result.success(map); |
| | | } |
| | |
| | | |
| | | @Autowired |
| | | SpianMapper spianMapper; |
| | | |
| | | |
| | | @Autowired |
| | | SpianService spianservice; |
| | | //出片任务 |
| | | @GetMapping("/all2") |
| | | public Result selectdd(String orderid){ |
| | | |
| | | |
| | | |
| | | //获取优先出片的位置 |
| | | StorageCage cageout=spianMapper.selectOut(orderid); |
| | | int cage =cageout.getCage(); //储存出片位置,笼子格子几号玻璃 |
| | | int cell =cageout.getCell(); |
| | | int tier =cageout.getTier(); |
| | | double glasswidth=cageout.getGlassWidth(); |
| | | //判断玻璃内外片 |
| | | if(tier==2){ |
| | | //判断玻璃可直接出片时 |
| | | return Result.success("执行出片"); |
| | | } |
| | | else{ |
| | | //获取格子的玻璃数量 |
| | | int state= spianMapper.selectGlassState(cage,cell); |
| | | //判断内片是否需要调拨 |
| | | if(state==0){ |
| | | return Result.success("状态为0,直接出片"); |
| | | }else{ |
| | | //玻璃需要调拨时,判断属于哪个半区的笼子 |
| | | if(cage<6){ |
| | | StorageCage cagecell= spianMapper.selectGlassCage(cage,glasswidth,0,6); |
| | | //获取调拨位置进行调拨 |
| | | List<String> adddresslist=new ArrayList<>(); |
| | | adddresslist.add("DB105.6"); |
| | | adddresslist.add("DB105.8"); |
| | | adddresslist.add("DB105.10"); |
| | | adddresslist.add("DB105.14"); |
| | | List<Short> datas=new ArrayList<>(); |
| | | datas.add((short)0); |
| | | datas.add((short)0); |
| | | datas.add((short)0); |
| | | datas.add((short)0); |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | return Result.success(cagecell); //调拨位置的参数内容 |
| | | //判断调拨结束后再次出片 |
| | | }else{ |
| | | StorageCage cagecell= spianMapper.selectGlassCage(cage,glasswidth,5,11); |
| | | //获取调拨位置进行调拨 |
| | | StorageCage ca=cagecell; |
| | | return Result.success(cagecell); //调拨位置的参数内容 |
| | | //判断调拨结束后再次出片 |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | public void selectdd(String orderid){ |
| | | SpianService service=new SpianService(); |
| | | service.selectadd(orderid); |
| | | |
| | | } |
| | | |
| | | @GetMapping("/all") |
| | | //进片任务,传订单id |
| | | //按订单优先进片 |
| | | public Result selectAll(String orderid){ |
| | | //return spianMapper.selectAll(); |
| | | int cage1; |
| | | //String orderid="A001"; |
| | | //获取订单相关度最高的笼子排序 |
| | | List<StorageCage> storageCage=spianMapper.selectAll(orderid); |
| | | for (StorageCage storageCage2 : storageCage) { |
| | | //保存订单优先顺序笼子号 |
| | | cage1=storageCage2.getCage(); |
| | | //判断该笼子号相邻最大的空格数 |
| | | int cages=spianMapper.selectCage(cage1); |
| | | //判断选中笼子是否有空格 |
| | | StorageCage cages1=spianMapper.selectCage1(cage1); |
| | | //有合适空格时进片 |
| | | if(cages>1 &&cages1.getTier()!=null){ |
| | | //执行进片 |
| | | return Result.success(cages1); |
| | | }else{ |
| | | //返回不可进片 |
| | | } |
| | | |
| | | |
| | | } |
| | | return Result.success("不可进片"); |
| | | public void selectAll(Short glassid){ |
| | | SpianService service=new SpianService(); |
| | | service.selectAll(glassid); |
| | | |
| | | } |
| | | |
| | | |
| | | @PostMapping("/save") |
| | | public Result save(@RequestBody StorageCage spian){ |
| | | spianservice.Save(spian); |
| | | return Result.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | public interface SpianMapper { |
| | | //判断相邻笼子是否有空格 |
| | | @Select("select COUNT(if(a.state1=0,cell,null))as cell from (select *,max(state)as state1 from storage_cage a GROUP BY cage,cell)as a where (a.cage=#{cage1}-1 or a.cage=#{cage1}+1)and if(#{cage1}<6,a.cage>0 and a.cage<6,a.cage>5) GROUP BY cage ORDER BY cell desc LIMIT 1") |
| | | @Select("select COUNT(if(a.state1=0,cell,null))as cell,ROUND(id/2)as id from (select *,max(state)as state1 from storage_cage a GROUP BY cage,cell)as a where (a.cage=#{cage1}-1 or a.cage=#{cage1}+1)and if(#{cage1}<6,a.cage>0 and a.cage<6,a.cage>5) GROUP BY cage ORDER BY cell desc LIMIT 1") |
| | | int selectCage(int cage1); |
| | | |
| | | //@Select("(select*from storage_cage as a where a.state=0 and cage%2=0 ORDER BY id LIMIT 1)union (select a.* from storage_cage a inner join (select cage,if(shu2=1,shu3,shu5) as gezi from ( select cage, count(case when state1=1 and state2=0 then cell else null end)as shu1, count(case when state1=0 then cell else null end) as shu2, min(case when state1=1 and state2=0 then cell else null end) as shu3, min(case when state1=0 then cell else null end) as shu4, min(case when state1=0 or state2=0 then cell else null end) as shu5 from (select *,max(state) as state1,min(state) as state2 from storage_cage group by cage,cell) as a where cage%2!=0 GROUP BY cage HAVING shu2>1 or (shu2=1 and shu1>0) ) as sss limit 1)as b on a.cage=b.cage and a.cell=b.gezi and a.state=0 order by tier limit 1) ORDER BY id LIMIT 1;") |
| | | //获取订单号排序的空订单笼子 |
| | | @Select("select cage,COUNT(if(order_id=#{glassid},order_id,null))as orderid from storage_cage where (order_id=#{glassid} or ''='') GROUP BY cage ORDER BY orderid desc; ") |
| | | List<StorageCage> selectAll(String glassid); |
| | | List<StorageCage> selectAll(Short glassid); |
| | | |
| | | //判断该笼子是否有合适宽度空格 |
| | | @Select("select COUNT(*),cage,cell,tier from storage_cage where cage=#{cage1} and state=0 and width>=1500 ORDER BY cell,tier") |
| | | StorageCage selectCage1(int cage1); |
| | | @Select("select COUNT(*),cage,cell,IF(tier=1,0,1)as tier,ROUND(id/2)as id from storage_cage where cage=#{cage1} and state=0 and width>=#{width} ORDER BY cell,tier") |
| | | StorageCage selectCage1(int cage1,double width); |
| | | |
| | | //@Update("update longzi set glass_id = #{glass_id}, width = #{width}, state = #{state} where cell = #{cell}") |
| | | @Update("update longzi set glass_id =123, width =1600, state =1 where cell =24") |
| | |
| | | void insert(StorageTask storageTask); |
| | | |
| | | //出片任务查询 |
| | | @Select("select cage,cell,tier,glasswidth from storage_cage as a where a.order_id=#{orderId} and state=1 order by cage desc,tier desc,cell desc LIMIT 1") |
| | | @Select("select cage,cell,tier,glasswidth,ROUND(id/2)as id from storage_cage as a where a.order_id=#{orderId} and state=1 order by cage desc,tier desc,cell desc LIMIT 1") |
| | | StorageCage selectOut(String orderId); |
| | | |
| | | //判断出片为1时,是否可直接出片 |
| | | @Select("select state from storage_cage where cage=#{cage} and cell=#{cell} and tier=2;") |
| | | int selectGlassState(int cage,int cell); |
| | | //判断该调拨的笼子 |
| | | @Select("select cage,cell,max(state)as shu from storage_cage where width>=#{width} and cage>#{cage1} and cage<#{cage2} GROUP BY cage,cell HAVING shu=0 order by abs(#{cage} - cage) limit 1;") |
| | | StorageCage selectGlassCage(int cage,double width,int cage1,int cage2); |
| | | //修改笼子信息(进片) |
| | | // @Update("update storage_cage set state=1,width=width #{width},glass_id=#{glassid},order_id=#{orderid},glasswidth=#{glasswidth} where cage=#{cage} and cell=#{cell} and tier=#{tier}"); |
| | | |
| | | //判断该调拨的笼子 |
| | | @Select("select cage,cell,max(state)as shu,ROUND(id/2)as id from storage_cage where width>=#{width} and cage>#{cage1} and cage<#{cage2} GROUP BY cage,cell HAVING shu=0 order by abs(#{cage} - cage) limit 1;") |
| | | StorageCage selectGlassCage(int cage,double width,int cage1,int cage2); |
| | | |
| | | //修改笼子信息(出片) |
| | | @Update("update storage_cage set state=#{state},width=width+#{width},glass_id=#{glassid},order_id=#{orderid},glasswidth=0 where cage=#{cage} and cell=#{cell} and tier=#{tier};") |
| | | void UpdataGlassCage(String orderid,String glassid,double width,int cage,int cell,int tier,int state); |
| | | |
| | | //修改笼子信息(进片) |
| | | @Update("update storage_cage set state=#{state},width=width-#{width},glass_id=#{glassid},order_id=#{orderid},glasswidth=#{width} where cage=#{cage} and cell=#{cell} and tier=#{tier};") |
| | | void UpdataAddCage(String orderid,Short glassid,double width,int cage,int cell,int tier,int state); |
| | | // @Insert("insert into user(name, date, address, user_no) values (#{name}, #{date}, #{address}, #{userNo})") |
| | | // void insert (Spian spian); |
| | | |
| | |
| | | package com.example.springboot.service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | |
| | | import com.example.springboot.common.Result; |
| | | import com.example.springboot.component.S7control; |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.mapper.SpianMapper; |
| | | |
| | |
| | | public class SpianService { |
| | | @Autowired |
| | | private SpianMapper spianMapper; |
| | | public void Save(StorageCage spian){ |
| | | if(spian.getId()==null){ |
| | | spianMapper.update(); |
| | | }else{ |
| | | spianMapper.update(); |
| | | @GetMapping("/all2") |
| | | public Result selectadd(String orderid){ |
| | | //定义PRC数据传送数组 |
| | | List<String> adddresslist=new ArrayList<>(); |
| | | adddresslist.add("DB105.6");//出片车起始位置 |
| | | adddresslist.add("DB105.8");//出片车目标位置 |
| | | adddresslist.add("DB105.10");//出片笼玻璃数 |
| | | adddresslist.add("DB105.14");//出片车启动 1为启动 |
| | | List<Short> datas=new ArrayList<>(); |
| | | //获取优先出片的位置 |
| | | StorageCage cageout=spianMapper.selectOut(orderid); |
| | | int cage =cageout.getCage(); //储存出片位置,笼子格子几号玻璃 |
| | | int cell =cageout.getCell(); |
| | | int tier =cageout.getTier(); |
| | | int id=cageout.getId(); |
| | | int ids; |
| | | double glasswidth=cageout.getGlassWidth(); |
| | | //判断玻璃内外片 |
| | | if(tier==2){ |
| | | //判断玻璃可直接出片时 |
| | | //修改数据库笼子表(出片) |
| | | spianMapper.UpdataGlassCage("","",glasswidth, cage, cell, tier, 0); |
| | | datas.add((short)id); |
| | | datas.add((short)1000); |
| | | datas.add((short)1); |
| | | datas.add((short)1); |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | return Result.success(datas); |
| | | } |
| | | else{ |
| | | //获取格子的玻璃数量 |
| | | int state= spianMapper.selectGlassState(cage,cell); |
| | | //判断内片是否需要调拨 |
| | | if(state==0){ |
| | | return Result.success("状态为0,直接出片"); |
| | | }else{ |
| | | //玻璃需要调拨时,判断属于哪个半区的笼子 |
| | | if(cage<6){ |
| | | StorageCage cagecell= spianMapper.selectGlassCage(cage,glasswidth,0,6); |
| | | //获取调拨位置进行调拨 |
| | | ids=cagecell.getId();//调拨目标位ID |
| | | //填入调拨数据 |
| | | datas.add((short)id); |
| | | datas.add((short)ids); |
| | | datas.add((short)2); |
| | | datas.add((short)1); |
| | | //传输mes数据,坐标,数据 |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | //更换玻璃的笼子 |
| | | datas.clear(); // 清空整个列表 |
| | | //判断调拨结束后再次出片,填入出片数据 |
| | | datas.add((short)id); |
| | | datas.add((short)1000); |
| | | datas.add((short)1); |
| | | datas.add((short)1); |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | //修改数据库笼子表(出片) |
| | | spianMapper.UpdataGlassCage("","",glasswidth, cage, cell, tier, 0); |
| | | return Result.success(cagecell); //调拨位置的参数内容 |
| | | |
| | | }else{ |
| | | StorageCage cagecell= spianMapper.selectGlassCage(cage,glasswidth,5,11); |
| | | //获取调拨位置进行调拨 |
| | | ids=cagecell.getId();//调拨目标位ID |
| | | //填入调拨数据 |
| | | datas.add((short)id); |
| | | datas.add((short)ids); |
| | | datas.add((short)2); |
| | | datas.add((short)1); |
| | | //传输mes数据,坐标,数据 |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | datas.clear(); // 清空整个列表 |
| | | //判断调拨结束后再次出片 |
| | | //填入出片数据 |
| | | datas.add((short)id); |
| | | datas.add((short)1000); |
| | | datas.add((short)1); |
| | | datas.add((short)1); |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | return Result.success(cagecell); //调拨位置的参数内容 |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | @GetMapping("/all") |
| | | //进片任务,传订单id |
| | | //按订单优先进片 |
| | | public Result selectAll(Short glassid){ |
| | | //return spianMapper.selectAll(); |
| | | int cage1; |
| | | int ids; |
| | | int tier; |
| | | double widths=1500; |
| | | List<String> adddresslist=new ArrayList<>(); |
| | | adddresslist.add("DB105.0");//进片车起始位置 |
| | | adddresslist.add("DB105.2");//进片车目标位置 |
| | | adddresslist.add("DB105.4");//进片笼玻璃数 |
| | | adddresslist.add("DB105.12");//进片车启动 1为启动 |
| | | List<Short> datas=new ArrayList<>(); |
| | | //String orderid="A001"; |
| | | //获取订单相关度最高的笼子排序 |
| | | List<StorageCage> storageCage=spianMapper.selectAll(glassid); |
| | | for (StorageCage storageCage2 : storageCage) { |
| | | //保存订单优先顺序笼子号 |
| | | cage1=storageCage2.getCage(); |
| | | //判断该笼子号相邻最大的空格数 |
| | | int cages=spianMapper.selectCage(cage1); |
| | | //判断选中笼子是否有合适宽度空格 |
| | | StorageCage cages1=spianMapper.selectCage1(cage1,widths); |
| | | ids=cages1.getId(); |
| | | tier=cages1.getTier(); |
| | | //有合适空格时进片 |
| | | if(cages>1 &&cages1.getTier()!=null){ |
| | | //执行进片 |
| | | datas.add((short)1000); |
| | | datas.add((short)ids); |
| | | datas.add((short)tier); |
| | | datas.add((short)1); |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | //数据库修改笼子表新增一条玻璃 |
| | | spianMapper.UpdataAddCage("glassid", glassid, widths, cages, ids, tier, 1);//还未获取玻璃id |
| | | return Result.success(cages1); |
| | | } |
| | | |
| | | |
| | | } |
| | | return Result.success("不可进片"); |
| | | |
| | | } |
| | | |
| | | } |