public static void TryPickPlace() { if (CheckPickPlaceCondition()) { int num = EquipmentInfo.STATION_NUM - 2; if (AppInfo.AppType == AppInfo.APP_TYPE_CAMERA) { num = 2; } string bin = ""; for (int i = num; i >= 0; i--) { StationInfo stationInfo = EquipmentInfo.GetStationInfo(i); if (stationInfo.Work) { bin += '1'; } else { bin += '0'; } } int d = Convert.ToInt32(bin, 2); string param = Convert.ToString(d); string resp; ThreadPool.QueueUserWorkItem(delegate { //LiteDataClient.Instance.BroadcastPickPlace(); Log.Debug("PickPlace " + "1站取放 " + bin); if (EquipmentCmd.Instance.SendCommand("1站取放", param, out resp)) { LiteDataClient.Instance.BroadcastPickPlace(); } }); for (int i = 0; i < EquipmentInfo.STATION_NUM; i++) { StationInfo stationInfo = EquipmentInfo.GetStationInfo(i); stationInfo.Complete = false; } } }
public static bool CheckPickPlaceCondition() { string work = string.Empty; string complete = string.Empty; for (int i = 0; i < EquipmentInfo.STATION_NUM; i++) { StationInfo stationInfo = EquipmentInfo.GetStationInfo(i); if (stationInfo.Work) { work = "1" + work; } else { work = "0" + work; } if (stationInfo.Complete) { complete = "1" + complete; } else { complete = "0" + complete; } } Log.Debug("CheckPickPlaceCondition work = " + work + ", complete = " + complete); for (int i = 0; i < EquipmentInfo.STATION_NUM; i++) { StationInfo stationInfo = EquipmentInfo.GetStationInfo(i); if (stationInfo.Work && !stationInfo.Complete) { return(false); } } return(true); }