分支自 SuZhouGuanHong/TaiYuanTaiZhong

dengjunjie
2024-05-10 8529ae408d5e41d5982a8caab2a035e360cfc6c6
´úÂë¹ÜÀí/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs
@@ -207,7 +207,7 @@
            catch (Exception ex)
            {
                //WriteDBLog.Error("查询车轮数据", $"错误信息:{ex.Message}", "PCS");
                WriteLog.Write_Log(namea, namea + "报错", "错误信息!", $"错误信息:{ex.Message}");
                WriteLog.Write_Log("报错日志", namea, "错误信息!", $"错误信息:{ex.Message}");
            }
        }
        #endregion
@@ -388,7 +388,7 @@
            catch (Exception ex)
            {
                //WriteDBLog.Error("查询车轮订单", $"错误信息:{ex.Message}", "PCS");
                WriteLog.Write_Log(namea, namea + "报错", "错误信息!", $"错误信息:{ex.Message}");
                WriteLog.Write_Log("报错日志", namea, "错误信息!", $"错误信息:{ex.Message}");
            }
        }
        #endregion
@@ -444,14 +444,6 @@
                        }
                        #endregion
                        var Stations = stationinfoRepository.Find(x => x.area == PipelineJob.area_code(name)).OrderBy(x => x.lastUpdateTime).ToList();
                        #region ä¸‹æ–™ä½æ˜¯å¦ä¸ºç©ºçŠ¶æ€åŒæ­¥ç»™æ¡æž¶
                        foreach (var station in Stations)
                        {
                            client.WriteByOrder(station.stationCode, station.location_state != LocationStateEnum.Stroge.ToString(), name);
                        }
                        #endregion
                        if (finished && !updatefinished)
                        {
@@ -481,11 +473,11 @@
                            #endregion
                            var AreaNr = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "W_AreaNr").First(), client);
                            if (AreaNr == 0)
                            {
                                client.WriteByOrder("W_Storage_update", true, name);//货位状态更新
                                continue;
                            }
                            //if (AreaNr == 0)
                            //{
                            //    client.WriteByOrder("W_Storage_update", true, name);//货位状态更新
                            //    continue;
                            //}
                            #region åˆ¤æ–­åŒºåŸŸå·æ˜¯å¦ä¸€è‡´
                            var area = client.ReadByOrder<Int16>("place_prog", name);//放料完成的区域号
@@ -499,7 +491,7 @@
                            }
                            #endregion
                            var areaCode = PipelineJob.area_code(name);   //根据下料口单元名获取区域代码
                            var areaCode = Pipeline.area_code(name);   //根据下料口单元名获取区域代码
                            var station = stationinfoRepository.Find(x => x.area == areaCode && x.stationCode.Substring(x.stationCode.Length - 1, 1) == AreaNr.ToString()).FirstOrDefault();
                            if (station != null)
                            {
@@ -526,21 +518,6 @@
                                        throw new Exception($"{station.stationCode}已存在车轮SN号:{Wheel_SN}");
                                }
                                station.bindSN = string.IsNullOrEmpty(station.bindSN) ? Wheel_SN : station.bindSN + "," + Wheel_SN;
                                station.billetID = string.IsNullOrEmpty(station.billetID) ? Mes_Work.billetID.ToString() : station.billetID + "," + Mes_Work.billetID;
                                station.quantity++;
                                if (station.quantity == 1)
                                {
                                    station.stationType = Mes_Work.drawingNo;
                                    station.Number = Mes_Work.workOrder;
                                    station.heatNumber = Mes_Work.heatID;
                                    station.tray_status = "StrogeTray";
                                }
                                var count = stationinfoRepository.Update(station, true);
                                if (count < 1)
                                    throw new Exception($"下料位信息更新失败!下料位编号:{station.stationCode}");
                                #region æ¸…空给桁架的下料信息
                                client.WriteByOrder("W_IndexNr", (Int16)0, name);//托盘上的第几个车轮
                                client.WriteByOrder("W_Storage_Type", (Int16)0, name);//托盘类型1-横放;2-竖放(暂时只有横放托盘)
@@ -555,6 +532,24 @@
                                //    $"处理写入桁架信息:\nW_AreaNr:{0}\nW_IndexNr:{0}\nW_Storage_Type:{0}\n\n" +
                                //    $"写入桁架信息:\nW_Storage_update:{true}\nW_Enabl_Load:{false}", "PCS");
                                #endregion
                                #region è´§ä½çŠ¶æ€æ›´æ–°
                                station.bindSN = string.IsNullOrEmpty(station.bindSN) ? Wheel_SN : station.bindSN + "," + Wheel_SN;
                                station.billetID = string.IsNullOrEmpty(station.billetID) ? Mes_Work.billetID.ToString() : station.billetID + "," + Mes_Work.billetID;
                                station.quantity++;
                                if (station.quantity == 1)
                                {
                                    station.stationType = Mes_Work.drawingNo;
                                    station.Number = Mes_Work.workOrder;
                                    station.heatNumber = Mes_Work.heatID;
                                    station.tray_status = "StrogeTray";
                                }
                                var count = stationinfoRepository.Update(station, true);
                                if (count < 1)
                                    throw new Exception($"下料位信息更新失败!下料位编号:{station.stationCode}");
                                #endregion
                                #region ä¿®æ”¹å·¥å•状态
                                var Detail = mes_DetailRepository.FindFirst(x => x.jobID == Mes_Work.jobID && x.SN == Mes_Work.SN);
@@ -571,6 +566,15 @@
                                #endregion
                            }
                        }
                        var Stations = stationinfoRepository.Find(x => x.area == Pipeline.area_code(name)).OrderBy(x => x.lastUpdateTime).ToList();
                        #region ä¸‹æ–™ä½æ˜¯å¦ä¸ºç©ºçŠ¶æ€åŒæ­¥ç»™æ¡æž¶
                        foreach (var station in Stations)
                        {
                            client.WriteByOrder(station.stationCode, station.location_state != LocationStateEnum.Stroge.ToString(), name);
                        }
                        #endregion
                        var Request = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Request_Load").First(), client);
                        if (!Request) continue;
@@ -610,8 +614,8 @@
                        #endregion
                        var wheel = PipelineJob.QueryMateriel(Work.drawingNo);
                        var wheel1 = PipelineJob.QueryMateriel1(Work.drawingNo);
                        var wheel = Pipeline.QueryMateriel(Work.drawingNo);
                        var wheel1 = Pipeline.QueryMateriel1(Work.drawingNo);
                        if (wheel == null && wheel1 == null)
                        {
                            #region æ—¥å¿—记录
@@ -892,13 +896,15 @@
                    }
                    catch (Exception ex)
                    {
                        WriteDBLog.Error(name, $"错误信息:{ex.Message}", "PCS");
                        //WriteDBLog.Error(name, $"错误信息:{ex.Message}", "PCS");
                        WriteLog.Write_Log("报错日志", name, "错误信息!", $"错误信息:{ex.Message}");
                    }
                }
            }
            catch (Exception ex)
            {
                WriteDBLog.Error("下料区", $"错误信息:{ex.Message}", "PCS");
                //WriteDBLog.Error("下料区", $"错误信息:{ex.Message}", "PCS");
                WriteLog.Write_Log("报错日志", "下料区", "错误信息!", $"错误信息:{ex.Message}");
            }
        }
        #endregion