From 0e674f770d785bfd24b5034456c2502dcc6671d2 Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com> Date: 星期二, 17 六月 2025 16:56:50 +0800 Subject: [PATCH] 代码提交 --- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/System/Sys_Log.cs | 10 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 186 ++++++++++++++---- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskCommand.cs | 7 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 4 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/IDt_StationManagerService.cs | 12 - 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Enum/StackerCraneStatus.cs | 13 + 项目代码/WCS/WIDESEAWCS_Client/src/components/DeviceStacker.vue | 6 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneDBName.cs | 4 项目代码/WCS/WIDESEAWCS_Client/src/views/system/Sys_Log.vue | 34 +- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/Dt_StationManagerService.cs | 69 +++--- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs | 211 +++++--------------- 项目代码/WCS/WIDESEAWCS_Client/src/api/http.js | 2 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 29 ++ 项目代码/WCS/WIDESEAWCS_Client/src/uitils/signalr.js | 1 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Enum/AgvStationEnum.cs | 10 15 files changed, 309 insertions(+), 289 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Client/src/api/http.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Client/src/api/http.js" index a92c0c7..80b0362 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Client/src/api/http.js" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Client/src/api/http.js" @@ -20,7 +20,7 @@ } else if (process.env.NODE_ENV == 'production') { - axios.defaults.baseURL = 'http://192.168.20.253:9291/'; + axios.defaults.baseURL = 'http://192.168.76.251:9291/'; } if (!axios.defaults.baseURL.endsWith('/')) { axios.defaults.baseURL+="/"; diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Client/src/components/DeviceStacker.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Client/src/components/DeviceStacker.vue" index 14941d5..09acf63 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Client/src/components/DeviceStacker.vue" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Client/src/components/DeviceStacker.vue" @@ -26,13 +26,13 @@ 宸ヤ綔鐘舵�侊細{{ Stacker.data.stackerCraneWorkStatusDes }} </li> <li class="list-group-item list-group-item-secondary"> - 璧风偣锛歿{ Stacker.data.SourceAddress || '鏆傛棤浠诲姟' }} + 璧风偣锛歿{ Stacker.data.sourceAddress || '鏆傛棤浠诲姟' }} </li> <li class="list-group-item list-group-item-secondary"> - 缁堢偣锛歿{ Stacker.data.TargetAddress || '鏆傛棤浠诲姟' }} + 缁堢偣锛歿{ Stacker.data.targetAddress || '鏆傛棤浠诲姟' }} </li> <li class="list-group-item list-group-item-secondary"> - 鍛戒护鏂瑰紡锛歿{ Stacker.data.Command==1? '鍙栨斁鐗╂枡浣滀笟': '绉诲姩鍒版寚瀹氫綅缃�' }} + 鍛戒护鏂瑰紡锛歿{ Stacker.data.command==1? '鍙栨斁鐗╂枡浣滀笟': '绉诲姩鍒版寚瀹氫綅缃�' }} </li> <li class="list-group-item list-group-item-secondary"> AGV鐢甸噺锛歿{ Stacker.data.electricity+'%' }} diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Client/src/uitils/signalr.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Client/src/uitils/signalr.js" index 4bf7dc0..cc5b526 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Client/src/uitils/signalr.js" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Client/src/uitils/signalr.js" @@ -89,7 +89,6 @@ }); connection.on("StackerData", (data) => { - console.log(data) eventBus.emit("stackerData", data); }); connection.on("LineData", (data) => { diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Client/src/views/system/Sys_Log.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Client/src/views/system/Sys_Log.vue" index 9742628..7a636d0 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Client/src/views/system/Sys_Log.vue" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Client/src/views/system/Sys_Log.vue" @@ -32,23 +32,23 @@ const editFormFields = ref({}); const editFormOptions = ref([]); const searchFormFields = ref({"BeginDate":"","Url":"","LogType":[],"Success":[],"UserIP":"","ServiceIP":"","Role_Id":""}); - const searchFormOptions = ref([[{"title":"璇锋眰鍦板潃","field":"Url","type":"text"},{"title":"鐢ㄦ埛IP","field":"UserIP","type":"text"},{"title":"鏈嶅姟鍣↖P","field":"ServiceIP","type":"text"}],[{"title":"寮�濮嬫椂闂�","field":"BeginDate","type":"datetime"},{"dataKey":"restatus","data":[],"title":"鍝嶅簲鐘舵��","field":"Success","type":"selectList"},{"dataKey":"roles","data":[],"title":"瑙掕壊ID","field":"Role_Id","type":"select"}],[{"dataKey":"log","data":[],"title":"鏃ュ織绫诲瀷","field":"LogType","colSize":12,"type":"checkbox"}]]); - const columns = ref([{field:'Id',title:'Id',type:'int',width:90,hidden:true,readonly:true,require:true,align:'left'}, - {field:'BeginDate',title:'寮�濮嬫椂闂�',type:'datetime',width:140,align:'left',sortable:true}, - {field:'UserName',title:'鐢ㄦ埛鍚嶇О',type:'string',width:90,align:'left'}, - {field:'Url',title:'璇锋眰鍦板潃',type:'string',width:110,align:'left'}, - {field:'LogType',title:'鏃ュ織绫诲瀷',type:'string',bind:{ key:'log',data:[]},width:80,align:'left'}, - {field:'Success',title:'鍝嶅簲鐘舵��',type:'int',bind:{ key:'restatus',data:[]},width:80,align:'left'}, - {field:'ElapsedTime',title:'鏃堕暱',type:'int',width:60,align:'left'}, - {field:'RequestParameter',title:'璇锋眰鍙傛暟',type:'string',width:70,align:'left'}, - {field:'ResponseParameter',title:'鍝嶅簲鍙傛暟',type:'string',width:70,align:'left'}, - {field:'ExceptionInfo',title:'寮傚父淇℃伅',type:'string',width:70,align:'left'}, - {field:'UserIP',title:'鐢ㄦ埛IP',type:'string',width:90,align:'left'}, - {field:'ServiceIP',title:'鏈嶅姟鍣↖P',type:'string',width:90,hidden:true,align:'left'}, - {field:'BrowserType',title:'娴忚鍣ㄧ被鍨�',type:'string',width:90,align:'left'}, - {field:'User_Id',title:'鐢ㄦ埛ID',type:'int',width:90,hidden:true,align:'left'}, - {field:'Role_Id',title:'瑙掕壊ID',type:'int',bind:{ key:'roles',data:[]},width:90,hidden:true,align:'left'}, - {field:'EndDate',title:'缁撴潫鏃堕棿',type:'datetime',width:150,hidden:true,align:'left',sortable:true}]); + const searchFormOptions = ref([[{"title":"璇锋眰鍦板潃","field":"Url","type":"text"},{"title":"鐢ㄦ埛鍚嶇О","field":"userName","type":"text"},{"title":"鏈嶅姟鍣↖P","field":"ServiceIP","type":"text"}],[{"title":"寮�濮嬫椂闂�","field":"BeginDate","type":"datetime"},{"dataKey":"restatus","data":[],"title":"鍝嶅簲鐘舵��","field":"Success","type":"selectList"},{"dataKey":"roles","data":[],"title":"瑙掕壊ID","field":"Role_Id","type":"select"}]]); + const columns = ref([{field:'id',title:'Id',type:'int',width:90,hidden:true,readonly:true,require:true,align:'left'}, + {field:'beginDate',title:'寮�濮嬫椂闂�',type:'datetime',width:140,align:'left',sortable:true}, + {field:'userName',title:'鐢ㄦ埛鍚嶇О',type:'string',width:90,align:'left'}, + {field:'url',title:'璇锋眰鍦板潃',type:'string',width:110,align:'left'}, + {field:'logType',title:'鏃ュ織绫诲瀷',type:'string',bind:{ key:'log',data:[]},width:80,align:'left',hidden:true}, + {field:'success',title:'鍝嶅簲鐘舵��',type:'int',bind:{ key:'restatus',data:[]},width:80,align:'left'}, + {field:'elapsedTime',title:'鏃堕暱',type:'int',width:60,align:'left'}, + {field:'requestParam',title:'璇锋眰鍙傛暟',type:'string',width:70,align:'left'}, + {field:'responseParam',title:'鍝嶅簲鍙傛暟',type:'string',width:70,align:'left'}, + {field:'exceptionInfo',title:'寮傚父淇℃伅',type:'string',width:70,align:'left',hidden:true}, + {field:'userIP',title:'鐢ㄦ埛IP',type:'string',width:90,align:'left'}, + {field:'serviceIP',title:'鏈嶅姟鍣↖P',type:'string',width:90,hidden:true,align:'left'}, + {field:'browserType',title:'娴忚鍣ㄧ被鍨�',type:'string',width:90,align:'left',hidden:true}, + {field:'user_Id',title:'鐢ㄦ埛ID',type:'int',width:90,hidden:true,align:'left'}, + {field:'role_Id',title:'瑙掕壊ID',type:'int',bind:{ key:'roles',data:[]},width:90,hidden:true,align:'left'}, + {field:'endDate',title:'缁撴潫鏃堕棿',type:'datetime',width:150,hidden:true,align:'left',sortable:true}]); const detail = ref({ cnName: "#detailCnName", columns: [], diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/Dt_StationManagerService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/Dt_StationManagerService.cs" index 7713499..7e888ec 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/Dt_StationManagerService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/Dt_StationManagerService.cs" @@ -52,49 +52,40 @@ { } - public class Station_materialList - { - /// <summary> - /// 涓嬫枡浣�-銆嬨�嬩笂鏂欐垨瀛樻斁 - /// </summary> - public static List<int> BoardLoadList = new List<int>() { (int)AgvStationEnum.BoardLoad, (int)AgvStationEnum.PadUse }; - - /// <summary> - /// 涓婃枡锛屼笅鏂欙紝鍨澘浣跨敤锛屽灚鏉垮洖鏀� - /// </summary> - public static List<int> UsebitsList = new List<int>() { (int)AgvStationEnum.BoardUnload,(int)AgvStationEnum.PadRecycle}; - - - public static List<string> StationareaList = new List<string>() {"1003","1004" , "1005","1006","1007" }; - } - public List<Dt_StationManager> QuerypLatform(string deviceNo,List<string> task) - { - return BaseDal.QueryData(x=>x.DeviceCode == deviceNo && x.stationEnable==1 && Station_materialList.UsebitsList.Contains(x.stationMaterial) && !task.Contains(x.stationName)).ToList(); - } - - public List<Dt_StationManager> QuerypLatformarer(string deviceNo) - { - return BaseDal.QueryData((x => x.DeviceCode == deviceNo && x.stationEnable == 1 && Station_materialList.BoardLoadList.Contains(x.stationMaterial)), x=>x.stationMaterial).ToList(); - } - - public List<Dt_StationManager> QuerypLatformmaterial(int Station_Area) - { - return BaseDal.QueryData(x => x.stationArea == Station_Area && x.stationEnable == 1 && (x.stationMaterial == (int)AgvStationEnum.BoardStore || x.stationMaterial == (int)AgvStationEnum.PadStore) ).ToList(); - } - - public List<Dt_StationManager> QuerypStation_Area(int Station_Area) - { - return BaseDal.QueryData(x => x.stationArea == Station_Area && x.stationEnable == 1 && x.stationMaterial == (int)AgvStationEnum.PadStore).ToList(); - } - - public List<Dt_StationManager> QuerypStation_Area2(string Station_remark) - { - return BaseDal.QueryData(x => Station_remark.Contains(x.stationRemark) && x.stationEnable == 1 && x.stationMaterial == (int)AgvStationEnum.PadStore).ToList(); - } public List<Dt_StationManager> GetAllStationByDeviceCode(string DeviceCode) { return BaseDal.QueryData(x => x.DeviceCode == DeviceCode && x.stationEnable == 1).ToList(); } + + public List<Dt_StationManager> QueryPlatform(Dt_StationManager station, List<string> tasks) + { + if (station.stationArea == 3 && station.stationMaterial == 7) + { + return BaseDal.QueryData(x => x.stationArea == station.stationArea && x.stationEnable == 1 && x.stationMaterial == (int)AgvStationEnum.BoardLoad && !tasks.Contains(x.stationName) && !station.stationName.Contains(x.stationName)).OrderBy(y => y.stationMaterial).ToList(); + } + switch (station.stationMaterial) + { + case (int)AgvStationEnum.BoardUnload: + if (station.stationArea == 3) + { + return BaseDal.QueryData(x => x.stationArea == station.stationArea && x.stationEnable == 1 && (x.stationMaterial == (int)AgvStationEnum.BlankingBuffer|| x.stationMaterial == (int)AgvStationEnum.BoardLoad) && !tasks.Contains(x.stationName) && !station.stationName.Contains(x.stationName)).OrderBy(y=>y.stationMaterial).ToList(); + } + else + { + return BaseDal.QueryData(x => x.stationArea == station.stationArea && x.stationEnable == 1 && x.stationMaterial == (int)AgvStationEnum.BlankingBuffer && !tasks.Contains(x.stationName) && !station.stationName.Contains(x.stationName)).ToList(); + } + case (int)AgvStationEnum.BoardStore: + return BaseDal.QueryData(x => x.stationArea == station.stationArea && x.stationEnable == 1 && x.stationMaterial == (int)AgvStationEnum.BoardLoad && !tasks.Contains(x.stationName) && !station.stationName.Contains(x.stationName)).ToList(); + + case (int)AgvStationEnum.PadRecycle: + return BaseDal.QueryData(x => x.stationArea == station.stationArea && x.stationEnable == 1 && (x.stationMaterial == (int)AgvStationEnum.PadStore || x.stationMaterial == (int)AgvStationEnum.PadUse) && !tasks.Contains(x.stationName) && !station.stationName.Contains(x.stationName)).OrderBy(y=>y.stationMaterial).ToList(); + + case (int)AgvStationEnum.PadStore: + return BaseDal.QueryData(x => x.stationArea == station.stationArea && x.stationEnable == 1 && x.stationMaterial == (int)AgvStationEnum.PadUse && !tasks.Contains(x.stationName) && !station.stationName.Contains(x.stationName)).ToList(); + default: + return null; + } + } } } diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Enum/AgvStationEnum.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Enum/AgvStationEnum.cs" index a7ab353..a3b791a 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Enum/AgvStationEnum.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Enum/AgvStationEnum.cs" @@ -20,9 +20,9 @@ [Description("涓嬫枡浣�")] BoardUnload = 2, /// <summary> - /// 缂撳瓨浣� + /// 涓婃枡缂撳瓨浣� /// </summary> - [Description("缂撳瓨浣�")] + [Description("涓婃枡缂撳瓨浣�")] BoardStore = 3, /// <summary> /// 鍨澘浣跨敤浣� @@ -39,6 +39,12 @@ /// </summary> [Description("鍨澘缂撳瓨浣�")] PadStore = 6, + + /// <summary> + /// 涓嬫枡缂撳瓨浣� + /// </summary> + [Description("涓嬫枡缂撳瓨浣�")] + BlankingBuffer = 7, } public enum AgvareaEnum diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/IDt_StationManagerService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/IDt_StationManagerService.cs" index 965e9d0..6fdd417 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/IDt_StationManagerService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/IDt_StationManagerService.cs" @@ -33,21 +33,13 @@ { public interface IDt_StationManagerService : IService<Dt_StationManager> { - public List<Dt_StationManager> QuerypLatform(string deviceNo, List<string> _Task); - - public List<Dt_StationManager> QuerypLatformarer(string deviceNo); - - public List<Dt_StationManager> QuerypLatformmaterial(int Station_Area); - - public List<Dt_StationManager> QuerypStation_Area(int Station_Area); - - public List<Dt_StationManager> QuerypStation_Area2(string Station_remark); - /// <summary> /// 鏍规嵁PLC璁惧鑾峰彇褰撳墠璁惧涓嬬殑鎵�鏈夊惎鐢ㄧ殑绔欏彴 /// </summary> /// <param name="DeviceCode"></param> /// <returns></returns> List<Dt_StationManager> GetAllStationByDeviceCode(string DeviceCode); + + List<Dt_StationManager> QueryPlatform(Dt_StationManager station, List<string> tasks); } } diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" index 9633b2e..bd99071 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" @@ -69,7 +69,9 @@ /// <param name="deviceNo"></param> /// <param name="currentAddress"></param> /// <returns></returns> - List<string> QueryConveyorLineTaskSourceAddress(); + List<string> QueryConveyorLineTask(); + + Dt_Task QueryConveyorLineTask(string stationName); /// <summary> /// 鏌ユ壘璇ュ湴鍧�鏄惁鏈夎捣鐐硅揣缁堢偣浠诲姟 diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/System/Sys_Log.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/System/Sys_Log.cs" index 84c5020..e340bd6 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/System/Sys_Log.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/System/Sys_Log.cs" @@ -44,13 +44,13 @@ /// <summary> /// 璇锋眰鍙傛暟 /// </summary> - [SugarColumn(IsNullable = true, Length = 2000, ColumnDescription = "璇锋眰鍙傛暟")] + [SugarColumn(IsNullable = true, Length = int.MaxValue, ColumnDescription = "璇锋眰鍙傛暟")] public string RequestParam { get; set; } /// <summary> /// 鍝嶅簲鍙傛暟 /// </summary> - [SugarColumn(IsNullable = true, Length = 2000, ColumnDescription = "鍝嶅簲鍙傛暟")] + [SugarColumn(IsNullable = true, Length = int.MaxValue, ColumnDescription = "鍝嶅簲鍙傛暟")] public string ResponseParam { get; set; } /// <summary> @@ -62,19 +62,19 @@ /// <summary> /// 璇锋眰鍦板潃 /// </summary> - [SugarColumn(IsNullable = true, Length = 2000, ColumnDescription = "璇锋眰鍦板潃")] + [SugarColumn(IsNullable = true, Length = 8000, ColumnDescription = "璇锋眰鍦板潃")] public string Url { get; set; } /// <summary> /// 鐢ㄦ埛IP /// </summary> - [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "鐢ㄦ埛IP")] + [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "鐢ㄦ埛IP")] public string UserIP { get; set; } /// <summary> /// 鐢ㄦ埛鍚嶇О /// </summary> - [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "鐢ㄦ埛鍚嶇О")] + [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "鐢ㄦ埛鍚嶇О")] public string UserName { get; set; } /// <summary> diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Enum/StackerCraneStatus.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Enum/StackerCraneStatus.cs" index 623480c..61cebe0 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Enum/StackerCraneStatus.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Enum/StackerCraneStatus.cs" @@ -73,6 +73,12 @@ /// </summary> [Description("鑱旀満")] Automatic = 4, + + /// <summary> + /// 鏁呴殰 + /// </summary> + [Description("鏁呴殰")] + Fault = 5, } public enum StackerCraneWorkStatus @@ -92,7 +98,12 @@ /// 鏈煡 /// </summary> [Description("鏈煡")] - Unkonw + Unkonw, + /// <summary> + /// 鏁呴殰 + /// </summary> + [Description("鏁呴殰")] + Fault = 5, } public enum StackerCraneTaskCompleted { diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" index c2c2a5a..9a3b574 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" @@ -102,7 +102,7 @@ { tasks.Add(item); } - BaseDal.AddData(tasks); + BaseDal.AddData(tasks); _taskExecuteDetailService.AddTaskExecuteDetail(tasks.Select(x => x.TaskNum).ToList(), "鎺ユ敹WMS浠诲姟"); content = WebResponseContent.Instance.OK("鎴愬姛"); } @@ -123,9 +123,24 @@ /// <param name="deviceNo">璁惧缂栧彿</param> /// <param name="currentAddress">褰撳墠鍦板潃</param> /// <returns></returns> - public List<string> QueryConveyorLineTaskSourceAddress() + public List<string> QueryConveyorLineTask() { - return BaseDal.QueryData().Select(task => task.SourceAddress).ToList(); + var query = BaseDal.QueryData(); + return query.SelectMany(x => + new[] { x.SourceAddress, x.TargetAddress } + .Where(address => !string.IsNullOrEmpty(address))) + .ToList(); + } + + /// <summary> + /// 鏌ユ壘璇ョ珯鍙版槸鍚︽湁浠诲姟 + /// </summary> + /// <param name="deviceNo">璁惧缂栧彿</param> + /// <param name="currentAddress">褰撳墠鍦板潃</param> + /// <returns></returns> + public Dt_Task QueryConveyorLineTask(string stationName) + { + return BaseDal.QueryFirst(x => x.SourceAddress == stationName||x.TargetAddress==stationName); } /// <summary> @@ -205,11 +220,11 @@ /// <returns></returns> public Dt_Task? QuertStackerCraneTask(string deviceNo, TaskTypeGroup? taskTypeGroup = null) { - if(taskTypeGroup == null) + if (taskTypeGroup == null) return BaseDal.QueryFirst(x => x.Roadway == deviceNo && (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.Line_InFinish || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew), TaskOrderBy); - if(taskTypeGroup.Value == TaskTypeGroup.InboundGroup) + if (taskTypeGroup.Value == TaskTypeGroup.InboundGroup) return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.Line_InFinish, TaskOrderBy); - if(taskTypeGroup.Value == TaskTypeGroup.OutbondGroup) + if (taskTypeGroup.Value == TaskTypeGroup.OutbondGroup) return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew, TaskOrderBy); return null; } @@ -222,7 +237,7 @@ /// <returns>杩斿洖浠诲姟瀹炰綋瀵硅薄锛屽彲鑳戒负null</returns> public Dt_Task QueryStackerCraneTask(string deviceNo, string currentAddress = "") { - return BaseDal.QueryFirst(x => x.TaskState == (int)TaskOutStatusEnum.OutNew && x.AGVName==deviceNo,TaskOrderBy); + return BaseDal.QueryFirst(x => x.TaskState == (int)AGVTaskStatusEnum.AGVNew && x.AGVName == deviceNo, TaskOrderBy); } diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" index dad3669..e967125 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" @@ -15,9 +15,12 @@ *----------------------------------------------------------------*/ #endregion << 鐗� 鏈� 娉� 閲� >> +using AngleSharp.Dom; using Autofac.Core; using AutoMapper; using HslCommunication; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Newtonsoft.Json; using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; using Quartz; using System.Reflection; @@ -113,8 +116,7 @@ #endregion 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇 // 灏嗕氦浜掍俊鍙疯浆鎹负甯冨皵鏁扮粍 - var writeInteractiveSignal = command.InteractiveSignal; - var structs = BitConverter.GetBytes(writeInteractiveSignal).Reverse().ToArray().ToBoolArray(); + var structs = BitConverter.GetBytes(command.InteractiveSignal).Reverse().ToArray().ToBoolArray(); // 鑾峰彇璁惧鍗忚璇︽儏 List<DeviceProtocolDetailDTO>? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.Where(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand.InteractiveSignal)).ToList(); @@ -130,7 +132,7 @@ MethodInfo? method = GetType().GetMethod(item.ProtocolDetailType); if (method != null) { - method.Invoke(this, new object[] { conveyorLine, station.stationName }); + method.Invoke(this, new object[] { conveyorLine, station }); } } } @@ -149,107 +151,81 @@ /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param> /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>Request outbound /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param> - public async Task RequestInbound(CommonConveyorLine conveyorLine, string childDeviceCode) + public async Task RequestInbound(CommonConveyorLine conveyorLine, Dt_StationManager station) { try { // 杈撳嚭淇℃伅锛岃〃绀虹珯鍙拌姹傚彇璐� - var log = $"銆恵conveyorLine._deviceName}銆戠珯鍙般�恵childDeviceCode}銆戣姹傚彇璐�"; - ConsoleHelper.WriteWarningLine(log); - // 鎺ㄩ�侀�氱煡鍒板墠绔疭ignIR - await _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "Red" }); - WriteInfo(conveyorLine.DeviceName, log); + var log = $"銆恵conveyorLine._deviceName}銆戠珯鍙般�恵station.stationName}銆戣姹傚彇璐�"; + await LogAndWarn(conveyorLine.DeviceName, log); // 鑾峰彇鎵�鏈変换鍔℃簮鍦板潃 - List<string> task = _taskService.QueryConveyorLineTaskSourceAddress(); + List<string> taskSourceAddress = _taskService.QueryConveyorLineTask(); + if (_taskService.QueryConveyorLineTask(station.stationName) != null) + { + ConveyorLineSendFinish(conveyorLine, station.stationName); + await LogAndWarn(conveyorLine.DeviceName, $"銆恵conveyorLine._deviceName}銆戠珯鍙般�恵station.stationName}銆戝瓨鍦ㄤ换鍔�"); + return; + } // 鏍规嵁璁惧缂栧彿鍜屼换鍔℃簮鍦板潃鏌ヨ鎵�鏈夋湭鎵ц鐨勪换鍔� - List<Dt_StationManager> childDeviceCodes = _stationManagerService.QuerypLatform(conveyorLine.DeviceCode, task); //瀵瑰簲姣忎釜ip鎵惧叏閮ㄧ殑涓嬫枡绔欑偣涓庡灚鏉垮洖鏀剁偣绔欏彴鐐� + List<Dt_StationManager> childDeviceCodes = _stationManagerService.QueryPlatform(station, taskSourceAddress); //瀵瑰簲姣忎釜ip鎵惧叏閮ㄧ殑涓嬫枡绔欑偣涓庡灚鏉垮洖鏀剁偣绔欏彴鐐� - + if(childDeviceCodes.Count()==0|| childDeviceCodes == null) + { + ConveyorLineSendFinish(conveyorLine, station.stationName); + await LogAndWarn(conveyorLine.DeviceName, $"銆恵conveyorLine._deviceName}銆戠珯鍙般�恵station.stationName}銆戞湭鎵惧埌鍙墠寰�绔欏彴"); + return; + } + foreach (var item in childDeviceCodes) { - ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(item.stationName); - if (command != null) + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == item.DeviceCode); + if (device != null) { - var structs = BitConverter.GetBytes(command.InteractiveSignal).Reverse().ToArray().ToBoolArray(); - if (structs[1]) + CommonConveyorLine commonConveyorLine = (CommonConveyorLine)device; + ConveyorLineTaskCommand command = commonConveyorLine.ReadCustomer<ConveyorLineTaskCommand>(item.stationName); + if (command != null) { - if (item.stationMaterial == (int)AgvStationEnum.PadRecycle) - { - RequestHcdbst(conveyorLine, item.stationArea, item.stationName, item.stationRemark); - return; - } - else + var structs = BitConverter.GetBytes(command.InteractiveSignal).Reverse().ToArray().ToBoolArray(); + if (structs[2]) { Dt_Task taskDTO = new Dt_Task() { TaskNum = _taskRepository.GetTaskNo().Result, Grade = 1, Roadway = item.stationArea.ToString(), - SourceAddress = childDeviceCode, + SourceAddress = station.stationName, + CurrentAddress= station.stationName, TargetAddress = item.stationName, + NextAddress = item.stationName, TaskState = (int)AGVTaskStatusEnum.AGVNew, - TaskType = item.stationMaterial, + TaskType = (int)AGVTaskTypeEnum.AGVCarry, + AGVName = item.stationArea switch + { + 1 => "AGV01", + 4 => "AGV03", + _ => "AGV02", + } }; _taskService.ReceiveWMSTask(new List<Dt_Task> { taskDTO }); + ConveyorLineSendFinish(conveyorLine,station.stationName); return; } - } - else - { - WriteInfo(conveyorLine.DeviceName, $"绔欏彴{item.stationName}鐘舵�佷笉鍙敤{structs[2]}"); - } - } - else - { - WriteInfo(conveyorLine.DeviceName, $"閫氳杩炴帴閿欒锛寋item.stationName}鏈壘鍒拌鍙栨ā鍧楀湴鍧�"); - } - } - - } - catch (Exception ex) - { - WriteInfo(conveyorLine.DeviceName, ex.Message); - } - } - - /// <summary> - /// 鏍规嵁agv涓嬫枡浠诲姟锛屾妸鏂欐斁鑷充笂鏂欏彛鎴栫紦瀛樹綅 - /// </summary> - /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param> - /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param> - public void RequestOutbound(CommonConveyorLine conveyorLine, string childDeviceCode) - { - try - { - List<Dt_StationManager> station = _stationManagerService.QuerypLatformarer(conveyorLine.DeviceCode); - foreach (var item in station) - { - ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(item.stationName); - if (command != null) - { - var structs = BitConverter.GetBytes(command.InteractiveSignal).Reverse().ToArray().ToBoolArray(); - if (structs[2]) - { - if (item.stationMaterial == (int)AgvStationEnum.BoardLoad) + else { - //Dt_Task agvstack= _taskService.QueryConveyorLineTaskRoadway(AGVStationitem.stationArea); - //if(agvstack != null) - //{ - // _taskService.UpdateTargetAddress(agvstack.TaskId, AGVStationitem.stationName); - //} - //else - //{ - // //鍘绘壘缂撳瓨鍖哄簱瀛� - // RequestHcst(conveyorLine, AGVStationitem.stationArea, AGVStationitem.stationName, AGVStationitem.stationRemark); - //} + await LogAndWarn(conveyorLine.DeviceName, $"绔欏彴{item.stationName}鐘舵�佷笉鍙敤{structs[2]}"); } } else { - WriteInfo(conveyorLine.DeviceName, $"绔欏彴{item.stationName}鐘舵�佷笉鍙敤{structs[2]}"); + WriteInfo(conveyorLine.DeviceName, $"閫氳杩炴帴閿欒锛寋item.stationName}鏈壘鍒拌鍙栨ā鍧楀湴鍧�"); } + } + else + { + var logerror = $"銆恵conveyorLine.DeviceName}銆戠珯鍙帮細銆恵item.stationName}銆戞湭閰嶇疆璁惧琛ㄥご"; + await LogAndWarn(conveyorLine.DeviceName, logerror); } } } @@ -258,88 +234,6 @@ WriteInfo(conveyorLine.DeviceName, ex.Message); } } - - public void RequestHcst(CommonConveyorLine conveyorLine,int Station_Area,string Station_names,string Station_remark) - { - List<Dt_StationManager> AGVStationListdata = _stationManagerService.QuerypLatformmaterial(Station_Area); //鏌ュ嚭缂撳瓨浣� - if (Station_remark != null) //鎵惧瀵瑰簲鐨勬斁璐х珯鍙� - { - AGVStationListdata = _stationManagerService.QuerypStation_Area2(Station_remark); - } - foreach (var item in AGVStationListdata) - { - ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(item.stationName); - if (command != null) - { - var structs = BitConverter.GetBytes(command.InteractiveSignal).Reverse().ToArray().ToBoolArray(); - if (structs[1]) - { - if (_taskService.QueryConveyorLinetaeersuadd(item.stationName)) - { - Dt_Task taskDTO = new Dt_Task() - { - TaskNum = _taskRepository.GetTaskNo().Result, - Grade = 1, - Roadway = item.stationArea.ToString(), - SourceAddress = item.stationName, - CurrentAddress = item.stationName, - TaskState = (int)TaskInStatusEnum.InNew, - TaskType = (int)item.stationMaterial, - TargetAddress = Station_names, - NextAddress = Station_names, - }; - _taskService.ReceiveWMSTask(new List<Dt_Task> { taskDTO }); - } - } - else - { - WriteInfo(conveyorLine.DeviceName, $"閫氳杩炴帴閿欒锛寋item.stationName}鏈壘鍒拌鍙栨ā鍧楀湴鍧�"); - } - } - } - } - - public void RequestHcdbst(CommonConveyorLine conveyorLine, int Station_Area, string Station_names,string Station_remark) - { - List<Dt_StationManager> AGVStationListdata = _stationManagerService.QuerypStation_Area(Station_Area); //鏌ュ嚭缂撳瓨浣� - if(Station_remark !=null) //鎵惧瀵瑰簲鐨勬斁璐х珯鍙� - { - AGVStationListdata= _stationManagerService.QuerypStation_Area2(Station_remark); - } - - foreach (var item in AGVStationListdata) - { - ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(item.stationName); - if (command != null) - { - var structs = BitConverter.GetBytes(command.InteractiveSignal).Reverse().ToArray().ToBoolArray(); - if (structs[1]) - { - if (_taskService.QueryConveyorLinetaeersuadd(item.stationName)) - { - Dt_Task taskDTO = new Dt_Task() - { - TaskNum = _taskRepository.GetTaskNo().Result, - Grade = 1, - Roadway = item.stationArea.ToString(), - SourceAddress = Station_names, - CurrentAddress = Station_names, - TaskState = (int)TaskInStatusEnum.InNew, - TaskType = (int)item.stationMaterial, - TargetAddress = item.stationName, - NextAddress = item.stationName, - }; - _taskService.ReceiveWMSTask(new List<Dt_Task> { taskDTO }); - } - } - else - { - WriteInfo(conveyorLine.DeviceName, $"璇诲彇鏀捐揣淇″彿涓猴細{structs[2]}"); - } - } - } - } - /// <summary> /// 杈撻�佺嚎浜や簰瀹屾垚 /// </summary> @@ -353,5 +247,12 @@ conveyorLine.Communicator.Write(devicePro.DeviceProAddress, true); } + + public async Task LogAndWarn(string deviceName, string log, string color = "red") + { + ConsoleHelper.WriteWarningLine(log); + await _noticeService.Logs(userTokenIds, new { deviceName, log = log, time = DateTime.Now.ToString("G"), color = color }); + WriteInfo(deviceName, log); + } } } diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" index 1de6610..9358c77 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" @@ -10,6 +10,7 @@ using WIDESEAWCS_Core.Caches; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_Core.HttpContextUser; +using WIDESEAWCS_DTO.Enum; using WIDESEAWCS_IBasicInfoRepository; using WIDESEAWCS_ISystemRepository; using WIDESEAWCS_ITaskInfoRepository; @@ -24,6 +25,7 @@ using WIDESEAWCS_QuartzJob.StackerCrane.Enum; using WIDESEAWCS_SignalR; using WIDESEAWCS_Tasks.StackerCraneJob; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; namespace WIDESEAWCS_Tasks @@ -53,7 +55,6 @@ try { CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); - if (commonStackerCrane != null) { if (!commonStackerCrane.IsEventSubscribed) @@ -67,7 +68,10 @@ if (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Idle) { - GetTask(commonStackerCrane); + if (commonStackerCrane.GetValue<StackerCraneDBName, float>(StackerCraneDBName.Electricity) > 20) + { + GetTask(commonStackerCrane); + } } } @@ -87,8 +91,8 @@ commonStackerCrane.DeviceName, commonStackerCrane.CurrentTaskNum, commonStackerCrane.LastTaskNum, - SourceAddress = commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.SourceAddress), - TargetAddress = commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.TargetAddress), + SourceAddress = commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.StartAddress), + TargetAddress = commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.EndAddress), Command = commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.Command), Electricity = commonStackerCrane.GetValue<StackerCraneDBName, float>(StackerCraneDBName.Electricity), }; @@ -116,8 +120,6 @@ CommonStackerCrane? commonStackerCrane = sender as CommonStackerCrane; if (commonStackerCrane != null) { - - Console.Out.WriteLine("TaskCompleted" + e.TaskNum); _taskService.StackCraneTaskCompleted(e.TaskNum); commonStackerCrane.SetValue(StackerCraneDBName.TaskCompleted, 1); @@ -135,39 +137,53 @@ task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode); if (task != null) { - StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); - if (stackerCraneTaskCommand != null) + if (task.Roadway == "3") { - bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); - Thread.Sleep(1000); - if (ReadReceived(commonStackerCrane) == 1) + if (AGVToSandyEdgeRead(commonStackerCrane)) { - WriteConfirm(commonStackerCrane); - _taskService.UpdateTaskStatusToNext(task.TaskNum); + WriteAGVTask(task, commonStackerCrane); + } + else + { + AGVToSandyEdge(commonStackerCrane); + } + + } + else if (task.Roadway == "2") + { + if (AGVToEdgeBandingRead(commonStackerCrane)) + { + WriteAGVTask(task, commonStackerCrane); + } + else + { + AGVToEdgeBanding(commonStackerCrane); } } + else + { + WriteAGVTask(task, commonStackerCrane); + } + } } - - //璇诲彇AGV鐘舵�� - public int ReadAGVstatus(CommonStackerCrane commonStackerCrane) + public void WriteAGVTask(Dt_Task task, CommonStackerCrane commonStackerCrane) { - var deviceProDTO = commonStackerCrane.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == commonStackerCrane.DeviceCode && x.DeviceProParamName == "AGVCraneStatus"); - return deviceProDTO != null ? commonStackerCrane.Communicator.Read<int>(deviceProDTO.DeviceProAddress) : 99; - } - //璇诲彇AGV宸ヤ綔妯″紡 - public int ReadAGVworkingmode(CommonStackerCrane commonStackerCrane) - { - var deviceProDTO = commonStackerCrane.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == commonStackerCrane.DeviceCode && x.DeviceProParamName == "AGVWorkingmode"); - return deviceProDTO != null ? commonStackerCrane.Communicator.Read<int>(deviceProDTO.DeviceProAddress) : 99; - } - - //璇诲彇浠诲姟鍙� - public int Readtasknumber(CommonStackerCrane commonStackerCrane) - { - var deviceProDTO = commonStackerCrane.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == commonStackerCrane.DeviceCode && x.DeviceProParamName == "AGVWorkingmode"); - return deviceProDTO != null ? commonStackerCrane.Communicator.Read<int>(deviceProDTO.DeviceProAddress) : 99; + StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); + if (stackerCraneTaskCommand != null) + { + bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); + Thread.Sleep(2000); + if (ReadReceived(commonStackerCrane) == 1) + { + if (Clear(commonStackerCrane)) + { + _taskService.UpdateTaskStatusToNext(task.TaskNum); + } + + } + } } /// <summary> @@ -179,10 +195,6 @@ { return commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.Received); } - public void WriteConfirm(CommonStackerCrane commonStackerCrane) - { - commonStackerCrane.SetValue(StackerCraneDBName.WriteConfirm, 1); - } /// <summary> /// 璋冨害AGV鍘诲皝杈瑰尯鍩� @@ -191,7 +203,90 @@ /// <param name="value"></param> public void AGVToEdgeBanding(CommonStackerCrane commonStackerCrane) { - commonStackerCrane.SetValue(StackerCraneDBName.AreaWrite, true); + DeviceProDTO? devicePro = commonStackerCrane.DeviceProDTOs.Where(x => x.DeviceProParamType == "AreaWrite" && x.DeviceChildCode == commonStackerCrane.DeviceCode && x.DeviceProParamName == "AreaWrite").OrderBy(x => x.DeviceProOffset).FirstOrDefault(); + commonStackerCrane.Communicator.Write(devicePro.DeviceProAddress, true); + commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 3); + commonStackerCrane.SetValue(StackerCraneDBName.WriteConfirm, 1); + Thread.Sleep(1000); + if (ReadReceived(commonStackerCrane) == 1) + { + Clear(commonStackerCrane); + } + } + + /// <summary> + /// 璇诲彇AGV鏄惁鍦ㄧ爞杈� + /// </summary> + /// <param name="commonStackerCrane"></param> + /// <returns></returns> + public bool AGVToSandyEdgeRead(CommonStackerCrane commonStackerCrane) + { + DeviceProDTO? devicePro = commonStackerCrane.DeviceProDTOs.Where(x => x.DeviceProParamType == "AreaRead" && x.DeviceChildCode == commonStackerCrane.DeviceCode && x.DeviceProParamName == "AreaRead").OrderBy(x => x.DeviceProOffset).FirstOrDefault(); + + if (devicePro == null) + { + ConsoleHelper.WriteColorLine($"銆愭湭鎵惧埌閰嶇疆璋冨害AGV鍖哄煙鍗忚銆�", ConsoleColor.Magenta); + return false; + } + + string[] x = devicePro.DeviceProAddress.Split('.'); + + x[x.Length - 1] = (int.Parse(x[x.Length - 1]) + 1).ToString(); + + string DeviceProAddress = string.Join(".", x); + bool read = commonStackerCrane.Communicator.Read<bool>(DeviceProAddress); + + return read; + } + + public bool Clear(CommonStackerCrane commonStackerCrane) + { + DeviceProDTO? devicePro = commonStackerCrane.DeviceProDTOs.Where(x => x.DeviceProParamType == "WriteConfirm" && x.DeviceChildCode == commonStackerCrane.DeviceCode && x.DeviceProParamName == "WriteConfirm").OrderBy(x => x.DeviceProOffset).FirstOrDefault(); + + if (devicePro == null) + { + ConsoleHelper.WriteColorLine($"銆愭湭鎵惧埌閰嶇疆璋冨害AGV鍖哄煙鍗忚銆�", ConsoleColor.Magenta); + return false; + } + commonStackerCrane.Communicator.Write(devicePro.DeviceProAddress,Convert.ToInt16(0)); + + for (int i = 0; i < 6; i++) + { + if (i == 5) + { + return false; + } + else + { + int read = commonStackerCrane.Communicator.Read<int>(devicePro.DeviceProAddress); + if (read == 0) + { + return true; + } + else + { + commonStackerCrane.Communicator.Write(devicePro.DeviceProAddress, Convert.ToInt16(0)); + } + } + } + return false; + } + + /// <summary> + /// 璇诲彇AGV鏄惁鍦ㄥ皝杈� + /// </summary> + /// <param name="commonStackerCrane"></param> + /// <returns></returns> + public bool AGVToEdgeBandingRead(CommonStackerCrane commonStackerCrane) + { + DeviceProDTO? devicePro = commonStackerCrane.DeviceProDTOs.Where(x => x.DeviceProParamType == "AreaRead" && x.DeviceChildCode == commonStackerCrane.DeviceCode && x.DeviceProParamName == "AreaRead").OrderBy(x => x.DeviceProOffset).FirstOrDefault(); + + if (devicePro == null) + { + ConsoleHelper.WriteColorLine($"銆愭湭鎵惧埌閰嶇疆璋冨害AGV鍖哄煙鍗忚銆�", ConsoleColor.Magenta); + return false; + } + return commonStackerCrane.Communicator.Read<bool>(devicePro.DeviceProAddress); } /// <summary> @@ -203,15 +298,24 @@ { DeviceProDTO? devicePro = commonStackerCrane.DeviceProDTOs.Where(x => x.DeviceProParamType == "AreaWrite" && x.DeviceChildCode == commonStackerCrane.DeviceCode && x.DeviceProParamName == "AreaWrite").OrderBy(x => x.DeviceProOffset).FirstOrDefault(); - if(devicePro == null) + if (devicePro == null) { ConsoleHelper.WriteColorLine($"銆愭湭鎵惧埌閰嶇疆璋冨害AGV鍖哄煙鍗忚銆�", ConsoleColor.Magenta); return; } - var writeBool = commonStackerCrane.Communicator.Read<bool>(devicePro.DeviceProAddress+0.1); - if (!writeBool) + + string[] x = devicePro.DeviceProAddress.Split('.'); + + x[x.Length - 1] = (int.Parse(x[x.Length - 1]) + 1).ToString(); + + string DeviceProAddress = string.Join(".", x); + commonStackerCrane.Communicator.Write(DeviceProAddress, true); + commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 4); + commonStackerCrane.SetValue(StackerCraneDBName.WriteConfirm, 1); + Thread.Sleep(1000); + if (ReadReceived(commonStackerCrane) == 1) { - commonStackerCrane.Communicator.Write(devicePro.DeviceProAddress + 0.1, true); + Clear(commonStackerCrane); } } /// <summary> @@ -234,7 +338,7 @@ stackerCraneTaskCommand.TaskNum = task.TaskNum; stackerCraneTaskCommand.WorkType = 1; - stackerCraneTaskCommand.TaskType = 0; + stackerCraneTaskCommand.WriteConfirm = 1; stackerCraneTaskCommand.StartAddress = Convert.ToInt16(SourceAddress.stationCode); stackerCraneTaskCommand.EndAddress = Convert.ToInt16(TargetAddress.stationCode); diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneDBName.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneDBName.cs" index 48e7556..db2ba09 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneDBName.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneDBName.cs" @@ -78,12 +78,12 @@ /// <summary> /// 璧风偣 /// </summary> - SourceAddress, + StartAddress, /// <summary> /// 缁堢偣 /// </summary> - TargetAddress, + EndAddress, /// <summary> /// AGV鏀跺埌浠诲姟淇″彿 diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskCommand.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskCommand.cs" index 6e6c0c5..73babb5 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskCommand.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskCommand.cs" @@ -47,10 +47,9 @@ /// </summary> public short WorkType { get; set; } - /// <summary> - /// 浠诲姟绫诲瀷 - /// </summary> - public short TaskType { get; set; } + + public short WriteConfirm { get; set; } + #endregion <Public Menber> } } -- Gitblit v1.9.3