| | |
| | | if (!Request) continue; |
| | | |
| | | var Stations = stationinfoRepository.Find(x => x.area == PipelineJob.area_code(name)); |
| | | foreach (var station in Stations) |
| | | { |
| | | if (!station.enable) |
| | | client.WriteByOrder("W_Enabl_Load", false, name);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | } |
| | | |
| | | var NGStation = "X01001003"; |
| | | if (name == "2åå
䏿åº") NGStation = "X02001003"; |
| | | if (name == "3åå
䏿åº") NGStation = "X03001002"; |
| | | var Wheel_Type = (Int32)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_Type").First(), client);//车轮类å |
| | | var Wheel_id = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_id").First(), client).ToString();//车轮SNå· |
| | | foreach (var station in Stations) |
| | | { |
| | | if (!station.enable || station.location_state == LocationStateEnum.Empty.ToString()) |
| | | client.WriteByOrder("W_Enabl_Load", false, name);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | } |
| | | var Wheel_Type = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_Type").First(), client);//车轮类å |
| | | var Wheel_id = client.ReadByOrder<string>("R_Wheel_id", name);//车轮SNå· |
| | | //var Wheel_id = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_id").First(), client).ToString(); |
| | | |
| | | var mes_Detail = mes_DetailRepository.FindFirst(x => x.SN == Wheel_id); |
| | | var mes_Head = mes_HeadRepository.FindFirst(x => x.jobID == mes_Detail.jobID); |
| | | var wheel = PipelineJob.QueryMateriel(mes_Head.drawingNo); |
| | | |
| | | var PartStatus = (Int32)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PartStatus").First(), client);//1:ok;2:nok |
| | | if (PartStatus == 1) |
| | | var PartStatus = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PartStatus").First(), client);//1:ok;2:nok |
| | | if ((Int16)PartStatus == 1) |
| | | { |
| | | var Stationinfo = Stations |
| | | .Where(x => x.enable |
| | | && x.stationCode != NGStation |
| | | && x.location_state == LocationStateEnum.Stroge.ToString() |
| | | && x.quantity < 5 |
| | | && x.stationType == PipelineJob.QueryMateriel(Wheel_Type) |
| | | && x.stationType == mes_Head.drawingNo |
| | | && x.tray_type == (wheel.e < 1100 ? "SmallTray" : "LargeTray") |
| | | && x.Number == mes_Detail.jobID |
| | | && x.heatNumber == mes_Detail.heatID).FirstOrDefault(); |
| | | && x.heatNumber == mes_Detail.heatID) |
| | | .OrderByDescending(x => x.quantity) |
| | | .FirstOrDefault(); |
| | | if (Stationinfo == null) |
| | | Stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault(); |
| | | if (Stationinfo != null) |
| | | { |
| | | var Pipelinedetails = plcRepository.Find(x => x.plcdetail_iotype == Pipelineplc.plcinfo_iotyep && x.plcdetail_number == Stationinfo.stationCode).ToList(); |
| | | var PalletSignal = (Int16)DBExtension.Read(Pipelinedetails.Where(x => x.plcdetail_name == "R_PalletSignal").First(), client);//读åæçä¿¡å·:1:æ,2æ |
| | | var PalletSignal = (Int16)DBExtension.Read(Pipelinedetails.Where(x => x.plcdetail_name == "R_PalletSignal").First(), Pipeline_client);//读åæçä¿¡å·:1:æ,2æ |
| | | //var Wheel_id = client.ReadByOrder<string>("R_Wheel_id", name); |
| | | if (PalletSignal == 1) |
| | | { |
| | | var SNS = Stationinfo.bindSN.Split(","); |
| | |
| | | } |
| | | var area = Convert.ToInt16(Stationinfo.stationCode.Substring(Stationinfo.stationCode.Length - 1, 1)); |
| | | client.WriteByOrder("W_AreaNr", (Int16)area, name);//åºåè´§ä½å· |
| | | client.WriteByOrder("W_IndexNr", (Int16)Stationinfo.quantity + 1, name);//æçä¸ç第å 个车轮 |
| | | client.WriteByOrder("W_IndexNr", (Int16)(Stationinfo.quantity + 1), name);//æçä¸ç第å 个车轮 |
| | | client.WriteByOrder("W_Storage_Type", (Int16)1, name);//æçç±»å1-横æ¾;2-ç«æ¾(ææ¶åªææ¨ªæ¾æç) |
| | | client.WriteByOrder("W_Enabl_Load", true, name);//æ¯å¦å
许 |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | else if (PartStatus == 2) |
| | | else if ((Int16)PartStatus == 2) |
| | | { |
| | | var Stationinfo = Stations |
| | | .Where(x => x.enable |
| | | && x.stationCode == NGStation |
| | | && x.location_state == LocationStateEnum.Stroge.ToString() |
| | | && x.quantity < 5 |
| | | && x.stationType == PipelineJob.QueryMateriel(Wheel_Type) |
| | | && x.stationType == mes_Head.drawingNo |
| | | && x.tray_type == (wheel.e < 1100 ? "SmallTray" : "LargeTray") |
| | | && x.Number == mes_Detail.jobID |
| | | && x.heatNumber == mes_Detail.heatID).FirstOrDefault(); |
| | | if (Stationinfo != null) |
| | |
| | | } |
| | | var area = Convert.ToInt16(Stationinfo.stationCode.Substring(Stationinfo.stationCode.Length - 1, 1)); |
| | | client.WriteByOrder("W_AreaNr", (Int16)area, name);//åºåè´§ä½å· |
| | | client.WriteByOrder("W_IndexNr", (Int16)Stationinfo.quantity + 1, name);//æçä¸ç第å 个车轮 |
| | | client.WriteByOrder("W_IndexNr", (Int16)(Stationinfo.quantity + 1), name);//æçä¸ç第å 个车轮 |
| | | client.WriteByOrder("W_Storage_Type", (Int16)1, name);//æçç±»å1-横æ¾;2-ç«æ¾(ææ¶åªææ¨ªæ¾æç) |
| | | client.WriteByOrder("W_Enabl_Load", true, name);//æ¯å¦å
许 |
| | | return; |
| | |
| | | station.bindSN = station.bindSN == string.Empty ? Wheel_id : station.bindSN + "," + Wheel_id; |
| | | if (station.quantity == 0) |
| | | { |
| | | station.stationType = Wheel_id; |
| | | station.Number = Wheel_id; |
| | | station.heatNumber = Wheel_id; |
| | | station.stationType = mes_Head.drawingNo; |
| | | station.Number = mes_Head.jobID; |
| | | station.heatNumber = mes_Detail.heatID; |
| | | } |
| | | var count = stationinfoRepository.Update(station); |
| | | if (count < 1) |