| | |
| | | using WIDESEA_Core.EFDbContext; |
| | | using WIDESEA_Core.Extensions; |
| | | using WIDESEA_Core.FreeDB; |
| | | using WIDESEA_Entity.DomainModels; |
| | | using WIDESEA_WCS.IRepositories; |
| | | using WIDESEA_WCS.Jobs; |
| | | using WIDESEA_WCS.Repositories; |
| | |
| | | |
| | | |
| | | ///æ¥æ¾ä¸æåºçè´§ä½ |
| | | var Stations = stationinfoRepository.Find(x => x.area == "6"); |
| | | var Stations = stationinfoRepository.Find(x => x.area == area_code(number)); |
| | | //ç¼åæ¶æªå¯ç¨ç¦æ¢æ¡æ¶è¿å
¥ |
| | | foreach (var station in Stations) |
| | | { |
| | |
| | | Gantry_client.WriteByOrder("W_RequestUnload", false, number);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | } |
| | | |
| | | var Station = Stations?.Where(x => x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderBy(x => x.quantity).First(); |
| | | var Station = Stations?.Where(x => x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderBy(x => x.quantity).FirstOrDefault(); |
| | | if (Station != null) |
| | | { |
| | | var SNS = Station.bindSN.Split(","); |
| | | List<string> list = new List<string>(); |
| | | foreach (var SN in SNS) |
| | | { |
| | | if (!string.IsNullOrEmpty(SN)) |
| | | list.Add(SN); |
| | | } |
| | | //ç¼åæ¶ä¸è½¦è½®æ°éä¸SNå·æ°éä¸ä¸è´ |
| | | if (SNS.Length != Station.quantity) |
| | | if (list.Count != Station.quantity) |
| | | { |
| | | Station.location_state = LocationStateEnum.Abnormal.ToString(); |
| | | stationinfoRepository.Update(Station, true); |
| | |
| | | Gantry_client.WriteByOrder("W_AreaNr", (Int16)area, number);//åºåè´§ä½å· |
| | | Gantry_client.WriteByOrder("W_IndexNr", (Int16)SNS.Length, number);//æçä¸ç第å 个车轮 |
| | | Gantry_client.WriteByOrder("W_Storage_Type", (Int16)1, number); //æçç±»å1-横æ¾;2-ç«æ¾ |
| | | Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)Convert.ToInt16(Station.stationType), number);//车轮类å |
| | | Gantry_client.WriteByOrder("W_Wheel_Type", (Int16)Convert.ToInt16(QueryMateriel(Station.stationType)), number);//车轮类å |
| | | Gantry_client.WriteByOrder("W_Wheel_id", SNS[SNS.Length - 1], number);//车轮SNå· |
| | | Gantry_client.WriteByOrder("W_RequestUnload", true, number); |
| | | } |
| | |
| | | } |
| | | } |
| | | var finished = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_Unlod_finished").First(), Gantry_client);//夹å宿 |
| | | if (finished) |
| | | var updatefinished = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "W_Storage_update").First(), Gantry_client);//è´§ä½ç¶ææ´æ° |
| | | if (!finished && updatefinished) |
| | | Gantry_client.WriteByOrder("W_Storage_update", false, number);//è´§ä½ç¶ææ´æ° |
| | | if (finished && !updatefinished) |
| | | { |
| | | Station.quantity = Station.quantity - 1; |
| | | Station.bindSN = OperStr(SNS); |
| | | if (Station.quantity <= 0) |
| | | { |
| | | Station.stationType = string.Empty; |
| | | //Station.location_state = LocationStateEnum.Empty.ToString(); |
| | | Station.Number = string.Empty; |
| | | Station.heatNumber = string.Empty; |
| | | } |
| | | var count = stationinfoRepository.Update(Station, true); |
| | | if (count < 1) |
| | | throw new Exception($"䏿ä½ä¿¡æ¯æ´æ°å¤±è´¥ï¼ä¸æä½ç¼å·ï¼{Station.stationCode}"); |
| | | Gantry_client.WriteByOrder("W_Storage_update", true, number);//è´§ä½ç¶ææ´æ° |
| | | Gantry_client.WriteByOrder("W_RequestUnload", false, number);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | //finished = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_Unlod_finished").First(), Gantry_client); |
| | | //while (finished) |
| | | //{ |
| | | // finished = (bool)DBExtension.Read(Gantrydetails.Where(x => x.plcdetail_name == "R_Unlod_finished").First(), Gantry_client); |
| | | // Gantry_client.WriteByOrder("W_Storage_update", false, number);//è´§ä½ç¶ææ´æ° |
| | | //} |
| | | } |
| | | //else if (!finished && updatefinished) |
| | | // Gantry_client.WriteByOrder("W_Storage_update", false, number);//è´§ä½ç¶ææ´æ° |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //WritePCSLog.LogAdd(requestin.AreaNr.ToString(), respone.success == 1 ? "æå " : "失败", "WMS", "AGV", json, JsonConvert.SerializeObject(respone), remark, "æ£æµçº¿ä¸æåº", ex.Message); |
| | | } |
| | | } |
| | | public static string area_code(string area_name) |
| | | { |
| | | FreeDB freeDB = new FreeDB(); |
| | | var areainfo = freeDB.Select<dt_areainfo>().Where(x => x.area_name == area_name).First(); |
| | | return areainfo.area_code.ToString(); |
| | | } |
| | | |
| | | private string OperStr(string[] strArrty) |
| | |
| | | |
| | | return Newsn; |
| | | } |
| | | private int QueryMateriel(string type) |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_geometry_dataRepository dataRepository = new dt_geometry_dataRepository(Context); |
| | | var materielinfo = dataRepository.FindFirst(x => x.Description == type); |
| | | return materielinfo.TypeId; |
| | | } |
| | | public static string QueryMateriel(int typeId) |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_geometry_dataRepository dataRepository = new dt_geometry_dataRepository(Context); |
| | | var materielinfo = dataRepository.FindFirst(x => x.TypeId == typeId); |
| | | return materielinfo.Description; |
| | | } |
| | | } |
| | | } |