Esempio n. 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="graphPlotData"></param>
 /// <param name="graphNo"></param>
 /// <param name="doneEvent"></param>
 public ThreadCalculate(List<double[]> graphPlotData, int graphNo, ManualResetEvent doneEvent, double maxGraphWidth)
 {
     _Log4NetClass = new LogClass(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
     _GraphPlotData = graphPlotData;
     _doneEvent = doneEvent;
     _GraphNo = graphNo;
     _MaxGraphWidth = maxGraphWidth;
 }
 public void IndexWithoutIdShouldSetIdFromElasticseach()
 {
     var newProject = new LogClass
     {
         Message = "Some Message",
     };
     var response = this._client.Index(newProject);
     Assert.IsTrue(response.IsValid);
     Assert.IsNotNullOrEmpty(response.Id);
     Assert.IsNotNullOrEmpty(response.Type);
     Assert.IsNotNullOrEmpty(response.Index);
     Assert.IsNotNullOrEmpty(response.Version);
 }
Esempio n. 3
0
        /// <summary>
        /// Constructor
        /// </summary>
        public ThreadAnimation()
        {
            _Log4NetClass = new LogClass(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            try
            {
                _AnimationKeyFrameData = new DoubleAnimationUsingKeyFrames[6][];
                //_AnimationClock = new AnimationClock[6][];

                for (int i = 0; i < 6; i++)
                {
                    //_AnimationClock[i] = new AnimationClock[8];
                    _AnimationKeyFrameData[i] = new DoubleAnimationUsingKeyFrames[8];
                }
            }
            catch (Exception ex)
            {
                _Log4NetClass.ShowError(ex.ToString(), "ThreadAnimation");
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Constuctor 
 /// </summary>
 /// <param name="parentUC"></param>
 public GraphModel(UserControl parentUC)
 {
     try
     {
         _ParentUserCtrl = parentUC;
         _Log4NetClass = new LogClass(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
         this._ThreadGraphShape = new ThreadGraphShapes(this);
         this._ThreadGraphShape.OnGraphCreated += this.GraphShapedCompleted;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 5
0
        public RS232()
        {
            try
            {
                InitializeComponent();

                CommPort com = CommPort.Instance;


                int      found    = 0;
                string[] portList = com.GetAvailablePorts();
                for (int i = 0; i < portList.Length; ++i)
                {
                    string name = portList[i];
                    comboBoxPortName.Items.Add(name);
                    if (name == Settings.Port.PortName)
                    {
                        found = i;
                    }
                }
                if (portList.Length > 0)
                {
                    comboBoxPortName.SelectedIndex = found;
                }

                Int32[] baudRates =
                {
                    100,     300,   600,   1200,   2400,   4800, 9600, 14400, 19200,
                    38400, 56000, 57600, 115200, 128000, 256000, 0
                };
                found = 0;
                for (int i = 0; baudRates[i] != 0; ++i)
                {
                    comboBoxBaudRate.Items.Add(baudRates[i].ToString());
                    if (baudRates[i] == Settings.Port.BaudRate)
                    {
                        found = i;
                    }
                }
                comboBoxBaudRate.SelectedIndex = found;

                comboBoxDataBits.Items.Add("5");
                comboBoxDataBits.Items.Add("6");
                comboBoxDataBits.Items.Add("7");
                comboBoxDataBits.Items.Add("8");
                comboBoxDataBits.SelectedIndex = Settings.Port.DataBits - 5;

                foreach (string s in Enum.GetNames(typeof(Parity)))
                {
                    comboBoxParity.Items.Add(s);
                }
                comboBoxParity.SelectedIndex = (int)Settings.Port.Parity;

                foreach (string s in Enum.GetNames(typeof(StopBits)))
                {
                    comboBoxStopBits.Items.Add(s);
                }
                comboBoxStopBits.SelectedIndex = (int)Settings.Port.StopBits;

                foreach (string s in Enum.GetNames(typeof(Handshake)))
                {
                    comboBoxHandshake.Items.Add(s);
                }
                comboBoxHandshake.SelectedIndex = (int)Settings.Port.Handshake;

                com.StatusChanged += OnStatusChanged;

                //com.DataReceived += OnDataReceived;

                com.Open();
            }
            catch (Exception ex)
            {
                LogClass.WriteLogFile("Exception:" + ex.ToString());
            }
        }
Esempio n. 6
0
 public static void PrintError(LogClass logClass, string message, [CallerMemberName] string Caller = "")
 {
     Print(LogLevel.Error, logClass, GetFormattedMessage(logClass, message, Caller));
 }
Esempio n. 7
0
 public static void PrintStub <T>(LogClass logClass, T obj, [CallerMemberName] string caller = "")
 {
     Print(LogLevel.Stub, logClass, GetFormattedMessage(logClass, "Stubbed.", caller), obj);
 }
Esempio n. 8
0
 internal void PrintError(LogClass Class, string Message, [CallerMemberName] string Caller = "")
 {
     Print(LogLevel.Error, Class, GetFormattedMessage(Class, Message, Caller));
 }
Esempio n. 9
0
 public static void SetEnable(LogClass logClass, bool enabled)
 {
     m_EnabledClasses[(int)logClass] = enabled;
 }
Esempio n. 10
0
 /// <summary>
 /// 本类log
 /// </summary>
 /// <param name="s"></param>
 static void Log(string s)
 {
     //  Console.WriteLine("class SqLiteHelper:::" + s);
     LogClass.LogToFile("class SqLiteHelper:::" + s);
 }
Esempio n. 11
0
        public static void Read(Logger Log)
        {
            string IniFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);

            string IniPath = Path.Combine(IniFolder, "Ryujinx.conf");

            IniParser Parser = new IniParser(IniPath);

            AOptimizations.DisableMemoryChecks = !Convert.ToBoolean(Parser.Value("Enable_Memory_Checks"));

            GraphicsConfig.ShadersDumpPath = Parser.Value("Graphics_Shaders_Dump_Path");

            Log.SetEnable(LogLevel.Debug, Convert.ToBoolean(Parser.Value("Logging_Enable_Debug")));
            Log.SetEnable(LogLevel.Stub, Convert.ToBoolean(Parser.Value("Logging_Enable_Stub")));
            Log.SetEnable(LogLevel.Info, Convert.ToBoolean(Parser.Value("Logging_Enable_Info")));
            Log.SetEnable(LogLevel.Warning, Convert.ToBoolean(Parser.Value("Logging_Enable_Warn")));
            Log.SetEnable(LogLevel.Error, Convert.ToBoolean(Parser.Value("Logging_Enable_Error")));

            string[] FilteredLogClasses = Parser.Value("Logging_Filtered_Classes").Split(',', StringSplitOptions.RemoveEmptyEntries);

            //When the classes are specified on the list, we only
            //enable the classes that are on the list.
            //So, first disable everything, then enable
            //the classes that the user added to the list.
            if (FilteredLogClasses.Length > 0)
            {
                foreach (LogClass Class in Enum.GetValues(typeof(LogClass)))
                {
                    Log.SetEnable(Class, false);
                }
            }

            foreach (string LogClass in FilteredLogClasses)
            {
                if (!string.IsNullOrEmpty(LogClass.Trim()))
                {
                    foreach (LogClass Class in Enum.GetValues(typeof(LogClass)))
                    {
                        if (Class.ToString().ToLower().Contains(LogClass.Trim().ToLower()))
                        {
                            Log.SetEnable(Class, true);
                        }
                    }
                }
            }

            JoyConKeyboard = new JoyConKeyboard(

                new JoyConKeyboardLeft
            {
                StickUp     = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Up")),
                StickDown   = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Down")),
                StickLeft   = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Left")),
                StickRight  = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Right")),
                StickButton = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Stick_Button")),
                DPadUp      = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Up")),
                DPadDown    = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Down")),
                DPadLeft    = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Left")),
                DPadRight   = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_DPad_Right")),
                ButtonMinus = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Button_Minus")),
                ButtonL     = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Button_L")),
                ButtonZL    = Convert.ToInt16(Parser.Value("Controls_Left_JoyConKeyboard_Button_ZL"))
            },

                new JoyConKeyboardRight
            {
                StickUp     = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Up")),
                StickDown   = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Down")),
                StickLeft   = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Left")),
                StickRight  = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Right")),
                StickButton = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Stick_Button")),
                ButtonA     = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_A")),
                ButtonB     = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_B")),
                ButtonX     = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_X")),
                ButtonY     = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_Y")),
                ButtonPlus  = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_Plus")),
                ButtonR     = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_R")),
                ButtonZR    = Convert.ToInt16(Parser.Value("Controls_Right_JoyConKeyboard_Button_ZR"))
            });

            JoyConController = new JoyConController(

                Convert.ToBoolean(Parser.Value("GamePad_Enable")),
                Convert.ToInt32(Parser.Value("GamePad_Index")),
                (float)Convert.ToDouble(Parser.Value("GamePad_Deadzone"), CultureInfo.InvariantCulture),
                (float)Convert.ToDouble(Parser.Value("GamePad_Trigger_Threshold"), CultureInfo.InvariantCulture),

                new JoyConControllerLeft
            {
                Stick       = ToID(Parser.Value("Controls_Left_JoyConController_Stick")),
                StickButton = ToID(Parser.Value("Controls_Left_JoyConController_Stick_Button")),
                DPadUp      = ToID(Parser.Value("Controls_Left_JoyConController_DPad_Up")),
                DPadDown    = ToID(Parser.Value("Controls_Left_JoyConController_DPad_Down")),
                DPadLeft    = ToID(Parser.Value("Controls_Left_JoyConController_DPad_Left")),
                DPadRight   = ToID(Parser.Value("Controls_Left_JoyConController_DPad_Right")),
                ButtonMinus = ToID(Parser.Value("Controls_Left_JoyConController_Button_Minus")),
                ButtonL     = ToID(Parser.Value("Controls_Left_JoyConController_Button_L")),
                ButtonZL    = ToID(Parser.Value("Controls_Left_JoyConController_Button_ZL"))
            },

                new JoyConControllerRight
            {
                Stick       = ToID(Parser.Value("Controls_Right_JoyConController_Stick")),
                StickButton = ToID(Parser.Value("Controls_Right_JoyConController_Stick_Button")),
                ButtonA     = ToID(Parser.Value("Controls_Right_JoyConController_Button_A")),
                ButtonB     = ToID(Parser.Value("Controls_Right_JoyConController_Button_B")),
                ButtonX     = ToID(Parser.Value("Controls_Right_JoyConController_Button_X")),
                ButtonY     = ToID(Parser.Value("Controls_Right_JoyConController_Button_Y")),
                ButtonPlus  = ToID(Parser.Value("Controls_Right_JoyConController_Button_Plus")),
                ButtonR     = ToID(Parser.Value("Controls_Right_JoyConController_Button_R")),
                ButtonZR    = ToID(Parser.Value("Controls_Right_JoyConController_Button_ZR"))
            });
        }
Esempio n. 12
0
        public bool kougezhang(PosTranClass posTran)
        {
            StringBuilder tem = new StringBuilder();

            tem.Append(posTran.message_type);
            tem.Append(posTran.ill_code);
            tem.Append(posTran.q_amount);
            tem.Append(posTran.p_amount);
            tem.Append(posTran.f_amount);
            tem.Append(posTran.s_amount);
            tem.Append(posTran.c_amount);
            tem.Append(posTran.e_amount);
            tem.Append(posTran.yy_code);
            tem.Append(posTran.flag);
            tem.Append(posTran.datetime);
            LogClass.WriteLog("个帐参数:" + tem.ToString());
            int aa = HardwareInitialClass.SendPosInfo(tem);

            LogClass.WriteLog("回参:" + tem);
            string[] resultValue = tem.ToString().Split('|');
            string   result      = resultValue[0];

            if (result != "30")
            {
                posTran = null;
                StringBuilder error = new StringBuilder();
                aa = HardwareInitialClass.GetErrorMsg(error);
                LogClass.WriteLog("扣个账失败原因:" + error.ToString());
                return_msg = "扣个账失败原因:" + error.ToString();
                return(false);
            }
            else
            {
                string temm = "没有流水号";
                if (resultValue.Length > 1 && resultValue[1] != null)
                {
                    temm = resultValue[1];
                }
                posTran.liushuihao = temm;

                posTran.GRZHKKQYE  = sb_amount;
                posTran.GRZHZF     = posTran.s_amount;
                posTran.GWYTCXEYE  = posTran.e_amount;
                posTran.TSBZKFQYE  = sp_amount;
                posTran.JFLB       = posTran.flag;
                posTran.ZFLJ       = temm;
                posTran.liushuihao = temm;
                return(true);
            }

            //StringBuilder tem = new StringBuilder();
            //tem.Append("1");
            //tem.Append("        ");
            //tem.Append("000000000001");
            //tem.Append("000000000000");
            //tem.Append("000000000001");
            //tem.Append("000000000002");
            //tem.Append("000000000000");
            //tem.Append("000000000000");
            //tem.Append("     ");
            //tem.Append("1");
            //tem.Append("20170307152323");
            //int aa = HardwareInitialClass.SendPosInfo(tem);
            //string result = (tem.ToString().Split('|'))[0]; ;
            //if (result != "30")
            //    posTran = null;
        }
Esempio n. 13
0
 private bool PeerCoordinationOut(SNP SNPpathBegin, string AddressPathEnd)
 {
     LogClass.WhiteLog("[CC] Sending peerCoordination: " + SNPpathBegin.Address + " to " + AddressPathEnd);
     return(SubnetworkServer.SendPeerCoordination(SNPpathBegin, AddressPathEnd, true));
 }
Esempio n. 14
0
        private void ui_reflush_Tick(object sender, EventArgs e)
        {
            if (frame_pool[flushSeq].time_cost == 0)//帧尚未取
            {
                goto Err;
            }
            //清理上一次list1
            list1.RemoveRange(0, list1.Count);
            myPane1.CurveList.Clear();
            //清理datagridviewer
            if (dt.Rows.Count > 4)
            {
                dt.Rows.Remove(dt.Rows[0]);
            }
            //获取读者锁
            rw1.EnterReadLock();
            for (int i = 0; i < buffernum; i++)
            {
                list1.Add(i * (scantlv / 2.0), frame_pool[flushSeq].buffer[i]);
            }
            //释放读者锁
            rw1.ExitReadLock();
            if (button1.Text == "ON")//显示开关
            {
                // 用list1生产一条曲线,标注是""
                LineItem myCurve1 = myPane1.AddCurve("", list1, Color.Red, SymbolType.None);

                //画到zedGraphControl1控件中
                zedGraphControl1.AxisChange();

                //重绘控件
                Refresh();
            }
            else
            {
                list1.RemoveRange(0, list1.Count);
                myPane1.CurveList.Clear();
                // 用list1生产一条曲线,标注是""
                LineItem myCurve1 = myPane1.AddCurve("", list1, Color.Red, SymbolType.None);
                //画到zedGraphControl1控件中
                zedGraphControl1.AxisChange();
                //重绘控件
                Refresh();
            }
            //更新报警信息
            if (msgque.Count > 0)
            {
                dr    = dt.NewRow();
                dr[0] = msgque.Peek().location;
                dr[1] = msgque.Peek().warningMax;
                dr[2] = msgque.Peek().warningExecRate;
                dr[3] = msgque.Peek().warningAckRate;
                //dr[4] = msgque.Peek().loseFramRate;
                dr[4] = GetZoomString(msgque.Peek().location);
                dt.Rows.Add(dr);
                //如果使能了写文件,报警信息写入
                if (LoseFrameRecordFlag == 1)
                {
                    string s = dr[0].ToString() + "      " + dr[1].ToString() + "      " + dr[2].ToString() + "      " + dr[3].ToString()
                               + "      " + msgque.Peek().loseFramRate.ToString() + "      " + dr[4].ToString() + "\r\n";
                    LogClass.WriteLogFile(s, "报警信息丢帧率.txt");
                }
                msgque.Dequeue();//删除一个元素
            }
            flushSeq++;
Err:
            flushSeq %= 655;
            //   Thread.Sleep(500);//休眠500ms
        }
Esempio n. 15
0
        public static void Read(Logger Log)
        {
            string IniFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);

            string IniPath = Path.Combine(IniFolder, "Ryujinx.conf");

            IniParser Parser = new IniParser(IniPath);

            AOptimizations.DisableMemoryChecks = !Convert.ToBoolean(Parser.Value("Enable_Memory_Checks"));

            Log.SetEnable(LogLevel.Debug, Convert.ToBoolean(Parser.Value("Logging_Enable_Debug")));
            Log.SetEnable(LogLevel.Stub, Convert.ToBoolean(Parser.Value("Logging_Enable_Stub")));
            Log.SetEnable(LogLevel.Info, Convert.ToBoolean(Parser.Value("Logging_Enable_Info")));
            Log.SetEnable(LogLevel.Warning, Convert.ToBoolean(Parser.Value("Logging_Enable_Warn")));
            Log.SetEnable(LogLevel.Error, Convert.ToBoolean(Parser.Value("Logging_Enable_Error")));

            string[] FilteredLogClasses = Parser.Value("Logging_Filtered_Classes").Split(',', StringSplitOptions.RemoveEmptyEntries);

            //When the classes are specified on the list, we only
            //enable the classes that are on the list.
            //So, first disable everything, then enable
            //the classes that the user added to the list.
            if (FilteredLogClasses.Length > 0)
            {
                foreach (LogClass Class in Enum.GetValues(typeof(LogClass)))
                {
                    Log.SetEnable(Class, false);
                }
            }

            foreach (string LogClass in FilteredLogClasses)
            {
                if (!string.IsNullOrEmpty(LogClass.Trim()))
                {
                    foreach (LogClass Class in Enum.GetValues(typeof(LogClass)))
                    {
                        if (Class.ToString().ToLower().Contains(LogClass.Trim().ToLower()))
                        {
                            Log.SetEnable(Class, true);
                        }
                    }
                }
            }

            FakeJoyCon = new JoyCon
            {
                Left = new JoyConLeft
                {
                    StickUp     = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_Stick_Up")),
                    StickDown   = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_Stick_Down")),
                    StickLeft   = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_Stick_Left")),
                    StickRight  = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_Stick_Right")),
                    StickButton = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_Stick_Button")),
                    DPadUp      = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_DPad_Up")),
                    DPadDown    = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_DPad_Down")),
                    DPadLeft    = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_DPad_Left")),
                    DPadRight   = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_DPad_Right")),
                    ButtonMinus = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_Button_Minus")),
                    ButtonL     = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_Button_L")),
                    ButtonZL    = Convert.ToInt16(Parser.Value("Controls_Left_FakeJoycon_Button_ZL"))
                },

                Right = new JoyConRight
                {
                    StickUp     = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Stick_Up")),
                    StickDown   = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Stick_Down")),
                    StickLeft   = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Stick_Left")),
                    StickRight  = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Stick_Right")),
                    StickButton = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Stick_Button")),
                    ButtonA     = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Button_A")),
                    ButtonB     = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Button_B")),
                    ButtonX     = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Button_X")),
                    ButtonY     = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Button_Y")),
                    ButtonPlus  = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Button_Plus")),
                    ButtonR     = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Button_R")),
                    ButtonZR    = Convert.ToInt16(Parser.Value("Controls_Right_FakeJoycon_Button_ZR"))
                }
            };
        }
Esempio n. 16
0
 static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
 {
     LogClass.Error("error.log", "Application_ThreadException : " + e.Exception.Message + "\n StackTrace" + e.Exception.StackTrace);
     // MessageBox.Show("Application_ThreadException : " + e.Exception.Message + "\n StackTrace" + e.Exception.StackTrace );
 }
Esempio n. 17
0
 static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     LogClass.Error("error.log", "CurrentDomain_UnhandledException : " + e.IsTerminating.ToString() + e.ExceptionObject);
     // MessageBox.Show("CurrentDomain_UnhandledException : " + e.IsTerminating.ToString() + e.ExceptionObject);
 }
Esempio n. 18
0
 private bool DeletePeerCoordinationOut(SNP lastSNPinThisDomain, string pathEndAddressFromDifferentDomain)
 {
     LogClass.WhiteLog("[CC] Sending deletePeerCoordination: " + lastSNPinThisDomain.Address + " to " + pathEndAddressFromDifferentDomain);
     return(SubnetworkServer.SendPeerCoordination(lastSNPinThisDomain, pathEndAddressFromDifferentDomain, false));
 }
Esempio n. 19
0
        public bool PeerCoordinationIn(SNP pathBegin, string pathEnd)
        {
            LogClass.Log("[DEBUG] incoming peercoordination from" + pathBegin.Address + " to " + pathEnd);
            string[] existingConnKey     = new string[] { pathBegin.Address, pathEnd };
            string   beginAddressForDict = pathBegin.Address;
            //Lista SNP dla tworzonego aktualnie polaczenia
            List <SNP> SNPList = new List <SNP>();

            //sprawdza, z ktorej domeny przyszedl SNP i podmienia jego adres na adres swojego SNPP brzegowego
            foreach (SubnetworkAddress domainAddress in OtherDomainSNPPAddressTranslation.Keys)
            {
                if (IPAddressExtensions.IsInSameSubnet(IPAddress.Parse(pathBegin.Address), domainAddress.subnetAddress, domainAddress.subnetMask))
                {
                    Tuple <IPAddress, IPAddress> foundTranslation = OtherDomainSNPPAddressTranslation[domainAddress].Find(x => x.Item1.ToString() == pathBegin.Address);
                    IPAddress translatedAddress = foundTranslation.Item2;
                    Console.WriteLine("TRANSALATED FROM" + pathBegin.Address + " TO " + translatedAddress.ToString());
                    pathBegin.Address = translatedAddress.ToString();
                }
            }
            Console.WriteLine("DEFENITELY TRANSALATED TO " + pathBegin.Address);
            //przepustowosc bierzemy z przekazanego SNP

            SNPList.Add(new SNP(pathBegin.Label, pathBegin.Address, pathBegin.OccupiedCapacity, null, null));
            SNPList.Add(new SNP(0, pathEnd, pathBegin.OccupiedCapacity, pathBegin.PathBegin, pathBegin.PathEnd));

            //Zapamietaj SNPlist z polaczeniem mdzy takimi adresami
            existingConnections.Add(existingConnKey, SNPList);

            List <SNPP> SNPPList = RouteTableQuery(pathBegin.Address, pathEnd, pathBegin.OccupiedCapacity);

            for (int index = 0; index < SNPPList.Count; index += 2)
            {
                SNPP             SNPPpathBegin = SNPPList[index];
                SNPP             SNPPpathEnd   = SNPPList[index + 1];
                Tuple <SNP, SNP> SNPpair       = LinkConnectionRequest(SNPPpathBegin, SNPPpathEnd, pathBegin.OccupiedCapacity);
                SNPList.Add(SNPpair.Item1);
                SNPList.Add(SNPpair.Item2);
            }

            //Wysłanie ConnectionRequesta do podsieci, jeżeli na liscie SNP zajdą się 2 adresy brzegowe tej podsieci
            List <SNP> connected = new List <SNP>();

            for (int index = 0; index < SNPList.Count - 1; index++)
            {
                SNP SNPpathBegin = SNPList[index];
                for (int jndex = index + 1; jndex < SNPList.Count; jndex++)
                {
                    SNP SNPpathEnd = SNPList[jndex];

                    if (BelongsToSubnetwork(SNPpathBegin, SNPpathEnd))
                    {
                        LogClass.WhiteLog("[DEBUG] Sending ConnectionRequest between" + SNPpathBegin.Address + SNPpathEnd.Deleting + "and" + SNPpathEnd.Address + SNPpathBegin.Deleting);
                        if (ConnectionRequestOut(SNPpathBegin, SNPpathEnd))
                        {
                            connected.Add(SNPpathBegin);
                            connected.Add(SNPpathEnd);
                            LogClass.Log("Subnetwork Connection set properly.");
                        }
                        else
                        {
                            connected.ForEach(x => x.Deleting = true);
                            for (int i = 0; i < connected.Count; i += 2)
                            {
                                DeleteLinkConnectionRequest(connected.ElementAt(i), connected.ElementAt(i + 1));
                            }

                            for (int i = 0; i < connected.Count; i += 2)
                            {
                                ConnectionRequestOut(connected.ElementAt(i), connected.ElementAt(i + 1));
                                LogClass.WhiteLog("[DEBUG] Sending DeleteConnectionRequest between" + SNPpathBegin.Address + SNPpathEnd.Deleting + "and" + SNPpathEnd.Address + SNPpathBegin.Deleting);
                            }
                            SubnetworkServer.callIgnoreLinkInRC(SNPpathBegin);
                            SubnetworkServer.callIgnoreLinkInRC(SNPpathEnd);

                            LogClass.Log("Epic fail.");
                            return(false);
                        }
                    }
                }
            }

            return(true);  //Jesli polaczenie zestawiono poprawnie
        }
Esempio n. 20
0
        public InterfaceOutPut GetMealTicket_log(string Data)
        {
            InterfaceOutPut      output = new InterfaceOutPut();
            JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
            InData InParams       = javaScriptSerializer.Deserialize <InData>(Data);
            List <SqlParameter> p = new List <SqlParameter>();
            string sql            = "select * from TAB_MealTicket_log where 1=1 {0}";
            string sqlwhere       = "";

            if (string.IsNullOrEmpty(InParams.StartDate) || string.IsNullOrEmpty(InParams.EndDate))
            {
                if (!string.IsNullOrEmpty(InParams.StartDate))
                {
                    sqlwhere += " and dtCreateTime>=@StartDate ";
                    p.Add(new SqlParameter("StartDate", Convert.ToDateTime(InParams.StartDate)));
                }
                if (!string.IsNullOrEmpty(InParams.EndDate))
                {
                    sqlwhere += " and dtCreateTime<=@EndDate ";
                    p.Add(new SqlParameter("EndDate", Convert.ToDateTime(InParams.EndDate)));
                }
            }
            else if (!string.IsNullOrEmpty(InParams.StartDate) && !string.IsNullOrEmpty(InParams.EndDate))
            {
                sqlwhere += " and dtCreateTime between @StartDate and @EndDate ";
                p.Add(new SqlParameter("StartDate", Convert.ToDateTime(InParams.StartDate)));
                p.Add(new SqlParameter("EndDate", Convert.ToDateTime(InParams.EndDate)));
            }
            if (!string.IsNullOrEmpty(InParams.DriverCode))
            {
                sqlwhere += " and strDriverCode=@DriverCode ";
            }
            if (!string.IsNullOrEmpty(InParams.ShenHeCode))
            {
                sqlwhere += " and strFaFangCode=@ShenHeCode";
            }
            p.Add(new SqlParameter("DriverCode", InParams.DriverCode));
            p.Add(new SqlParameter("ShenHeCode", InParams.ShenHeCode));
            try
            {
                sql = string.Format(sql, sqlwhere);
                DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, sql, p.ToArray()).Tables[0];

                MDMealTicket        Ticket = null;
                List <MDMealTicket> list   = list = new List <MDMealTicket>();
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        Ticket                = new MDMealTicket();
                        Ticket.DRIVER_CODE    = dt.Rows[i]["strDriverCode"].ToString();
                        Ticket.DRIVER_NAME    = dt.Rows[i]["strDriverName"].ToString();
                        Ticket.CHEJIAN_NAME   = dt.Rows[i]["strCheJianName"].ToString();
                        Ticket.PAIBAN_CHECI   = dt.Rows[i]["strCheCi"].ToString();
                        Ticket.CHUQIN_TIME    = dt.Rows[i]["dtChuQin"].ToString();
                        Ticket.CANQUAN_A      = dt.Rows[i]["nTicketA"].ToString() == "" ? 0 : Convert.ToInt32(dt.Rows[i]["nTicketA"].ToString());
                        Ticket.CANQUAN_B      = dt.Rows[i]["nTicketB"].ToString() == "" ? 0 : Convert.ToInt32(dt.Rows[i]["nTicketB"].ToString());
                        Ticket.SHENHEREN_CODE = dt.Rows[i]["strFaFangCode"].ToString();
                        Ticket.SHENHEREN_NAME = dt.Rows[i]["strFaFangName"].ToString();
                        Ticket.REC_TIME       = Convert.ToDateTime(dt.Rows[i]["dtCreateTime"].ToString()).ToString("yyyy-MM-dd HH:mm");
                        Ticket.ID             = Convert.ToInt32(dt.Rows[i]["nID"].ToString());
                        list.Add(Ticket);
                    }
                }
                output.result = 0;
                output.data   = list;
            }
            catch (Exception ex)
            {
                output.result    = 1;
                output.resultStr = ex.Message;
                LogClass.log("Interface.GetMealTicket_log:" + ex.Message);
                throw ex;
            }
            return(output);
        }
Esempio n. 21
0
        public CheCi_Out GetKehuoByCheCi(string input)
        {
            CheCi_Out json  = new CheCi_Out();
            CheCi_In  model = null;

            //List<TrainNoBelong> trainNoBelongs = null;
            //string strReg = String.Empty;
            //Regex regex = null;
            //int nBeginNumber, nEndNumber;
            //bool isMatch = false;
            try
            {
                #region 原来的代码
                //model = JsonConvert.DeserializeObject<CheCi_In>(input);
                //trainNoBelongs = GetTrainNoBelongArray();
                //if (trainNoBelongs != null)
                //{
                //    foreach (var trainNoBelong in trainNoBelongs)
                //    {
                //        nBeginNumber = trainNoBelong.nBeginNumber;
                //        nEndNumber = trainNoBelong.nEndNumber;
                //        int CheCi;
                //        json.result = "0";
                //        json.resultStr = "获取车次成功";
                //        //构造正则表达式
                //        if (String.IsNullOrEmpty(trainNoBelong.strTrainNoHead))
                //        {
                //            if (Int32.TryParse(model.TrainNo, out CheCi) && CheCi >= nBeginNumber && CheCi <= nEndNumber)
                //            {
                //                json.data.Kehuo = trainNoBelong.strKehuoName;
                //                isMatch = true;
                //                break;
                //            }
                //        }
                //        else
                //        {
                //            strReg = String.Format("^{0}", trainNoBelong.strTrainNoHead);
                //        }
                //        regex = new Regex(strReg);
                //        Match match = regex.Match(model.TrainNo);
                //        string strNum = String.Empty;
                //        if (match.Success)
                //        {
                //            int num;
                //            strNum = model.TrainNo.Substring(match.Length, model.TrainNo.Length - match.Length);
                //            if (strNum.Length > 0)
                //            {
                //                if ((Int32.TryParse(strNum, out num) && num >= nBeginNumber && num <= nEndNumber))
                //                {
                //                    json.data.Kehuo = trainNoBelong.strKehuoName;
                //                    isMatch = true;
                //                    break;
                //                }
                //            }
                //            else
                //            {
                //                if (trainNoBelong.nBeginNumber == 0 && trainNoBelong.nEndNumber == 0)
                //                {
                //                    json.data.Kehuo = trainNoBelong.strKehuoName;
                //                    isMatch = true;
                //                    break;
                //                }
                //            }

                //        }

                //    }
                //}
                //if (!isMatch)
                //{
                //    //json.result = "1";
                //    //json.resultStr = "根据车次获取客货类型失败,没有找到匹配的规则";
                //    json.data.Kehuo = "";
                //}
                #endregion
                string Remarks = "";
                model             = JsonConvert.DeserializeObject <CheCi_In>(input);
                json.data.Kehuo   = getKeHuoByTrainNo(model.TrainNo, ref Remarks);
                json.data.Remarks = Remarks;
                json.result       = "0";
                json.resultStr    = "获取客货成功";
            }
            catch (Exception ex)
            {
                LogClass.logex(ex, "");
                throw ex;
            }
            return(json);
        }
Esempio n. 22
0
 /// <summary>
 /// 异常记录,有待优化
 /// </summary>
 /// <param name="ex"></param>
 private static void Log(Exception ex)
 {
     LogClass.GetInstance().AddLog(ex);
 }
Esempio n. 23
0
 public void SetEnable(LogClass Class, bool Enabled)
 {
     EnabledClasses[(int)Class] = Enabled;
 }
Esempio n. 24
0
        /// <summary>
        /// 为计划设置机组
        /// </summary>
        public InterfaceOutPut SetGroup(String Data)
        {
            InterfaceOutPut output = new InterfaceOutPut();

            output.result = 1;
            try
            {
                JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
                InSetGroup           InParams             = javaScriptSerializer.Deserialize <InSetGroup>(Data);

                //目标计划已出勤或者已经安排机组则不能安排计划
                string         strSql        = "select nPlanState,strGroupGUID from VIEW_Plan_Trainman where strTrainPlanGUID = @strTrainPlanGUID";
                SqlParameter[] sqlParamsPlan = new SqlParameter[] {
                    new SqlParameter("strTrainPlanGUID", InParams.PlanGUID)
                };
                DataTable dtPlan = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsPlan).Tables[0];
                if (dtPlan.Rows.Count == 0)
                {
                    output.resultStr = "源计划不存在,不能安排人员!";
                    return(output);
                }
                //只有已下发或者已发布的计划才能安排机组
                if ((int.Parse(dtPlan.Rows[0]["nPlanState"].ToString()) != 3) && (int.Parse(dtPlan.Rows[0]["nPlanState"].ToString()) != 4))
                {
                    output.resultStr = "只有已下发或者已发布的计划才能安排机组!";
                    return(output);
                }
                if (dtPlan.Rows[0]["strGroupGUID"].ToString() != "")
                {
                    output.resultStr = "源计划已安排机组,不能重复安排!";
                    return(output);
                }
                //源机组如果已安排计划或者已出勤则不能安排
                strSql = "select strTrainPlanGUID from TAB_Nameplate_Group where strGroupGUID = @strGroupGUID";
                SqlParameter[] sqlParamsGroup = new SqlParameter[] {
                    new SqlParameter("strGroupGUID", InParams.GroupGUID)
                };
                DataTable dtGroup = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsGroup).Tables[0];
                if (dtGroup.Rows.Count == 0)
                {
                    output.resultStr = "指定的机组不存在!";
                    return(output);
                }
                if (dtGroup.Rows[0]["strTrainPlanGUID"].ToString() != "")
                {
                    output.resultStr = "指定的机组已经在值乘别的计划,不能重复安排!";
                    return(output);
                }
                //根据设置判断是否卡控机组内所有人员的寓休不足,后续需加上


                //设置计划的值乘方式为机组所在人员交路的值乘方式
                strSql = @"update TAB_Plan_Train set 
                    nTrainmanTypeID = (select top 1 nTrainmanTypeID from VIEW_Nameplate_Group where strGroupGUID =@strGroupGUID),
            nKehuoID = (select top 1 nKeHuoID from VIEW_Nameplate_Group where strGroupGUID =@strGroupGUID) where strTrainPlanGUID = @strTrainPlanGUID";
                SqlParameter[] sqlParams = new SqlParameter[] {
                    new SqlParameter("strGroupGUID", InParams.GroupGUID),
                    new SqlParameter("strTrainPlanGUID", InParams.PlanGUID)
                };
                SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams);


                //添加人员计划
                strSql = @"insert into TAB_Plan_Trainman (strTrainPlanGUID,strTrainmanGUID1,strTrainmanGUID2,strTrainmanGUID3,strTrainmanGUID4,strGroupGUID,strDutyGUID,strDutySiteGUID)
                    ( select top 1 @strTrainPlanGUID,strTrainmanGUID1,strTrainmanGUID2,strTrainmanGUID3,strTrainmanGUID4,strGroupGUID,@strDutyGUID,@strDutySiteGUID from TAB_Nameplate_Group where strGroupGUID = @strGroupGUID)";
                SqlParameter[] sqlParamsFull = new SqlParameter[] {
                    new SqlParameter("strTrainPlanGUID", InParams.PlanGUID),
                    new SqlParameter("strGroupGUID", InParams.GroupGUID),
                    new SqlParameter("strDutyGUID", InParams.DutyUser.userID),
                    new SqlParameter("strDutySiteGUID", ""),
                };
                SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsFull);

                //设置机组值乘的计划
                strSql = "update TAB_Nameplate_Group set strTrainPlanGUID = @strTrainPlanGUID where strGroupGUID = @strGroupGUID";
                SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams);
                output.result = 0;
            }
            catch (Exception ex)
            {
                output.resultStr = ex.Message;
                LogClass.log("Interface.SetGroup:" + ex.Message);
                throw ex;
            }
            return(output);
        }
Esempio n. 25
0
 private static string GetFormattedMessage(LogClass Class, string Message, string Caller)
 {
     return($"{Class} {Caller}: {Message}");
 }
Esempio n. 26
0
        /// <summary>
        /// 将人员安排到计划的指定位置中
        /// </summary>
        public InterfaceOutPut SetTrainmanToPlan(String Data)
        {
            InterfaceOutPut output = new InterfaceOutPut();

            output.result = 1;
            try
            {
                JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
                InSetTrainmanToPlan  InParams             = javaScriptSerializer.Deserialize <InSetTrainmanToPlan>(Data);

                TF.RunSafty.NamePlate.MD.DutyUser namePlateDutyuser = new NamePlate.MD.DutyUser();
                namePlateDutyuser.strDutyGUID   = InParams.DutyUser.userGUID;
                namePlateDutyuser.strDutyNumber = InParams.DutyUser.userID;
                namePlateDutyuser.strDutyName   = InParams.DutyUser.userName;

                #region 获取计划信息
                //获取计划信息
                string         strSql        = "select nPlanState,strGroupGUID,strTrainmanGUID1,strTrainmanGUID2,strTrainmanGUID3,strTrainmanGUID4,strTrainJiaoluName from VIEW_Plan_Trainman where strTrainPlanGUID = @strTrainPlanGUID";
                SqlParameter[] sqlParamsPlan = new SqlParameter[] {
                    new SqlParameter("strTrainPlanGUID", InParams.TrainPlanGUID)
                };
                DataTable dtPlan = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsPlan).Tables[0];

                //源计划不存在,不能安排人员
                if (dtPlan.Rows.Count == 0)
                {
                    output.resultStr = "源计划不存在,不能安排人员!";
                    return(output);
                }
                //只有已下发或者已发布的计划才能安排机组
                if ((int.Parse(dtPlan.Rows[0]["nPlanState"].ToString()) != 3) && (int.Parse(dtPlan.Rows[0]["nPlanState"].ToString()) != 4))
                {
                    output.resultStr = "只有已下发或者已发布的计划才能安排机组!";
                    return(output);
                }
                //if (dtPlan.Rows[0]["strGroupGUID"].ToString() != "")
                //{
                //    output.resultStr = "计划中已经安排机组,请将源机组移除后再添加!";
                //    return output;
                //}


                #endregion

                #region 获取源人员
                strSql = "select strTrainmanGUID,nTrainmanState from tab_org_trainman where strTrainmanNumber = @strTrainmanNumber";
                SqlParameter[] sqlParamsTrainman = new SqlParameter[] {
                    new SqlParameter("strTrainmanNumber", InParams.TrainmanNumber)
                };
                DataTable dtTrainman = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsTrainman).Tables[0];
                if (dtTrainman.Rows.Count == 0)
                {
                    output.resultStr = "指定的人员不存在!";
                    return(output);
                }
                string strSourceTrainmanGUID = dtTrainman.Rows[0]["strTrainmanGUID"].ToString();
                if (dtTrainman.Rows[0]["nTrainmanState"] != DBNull.Value)
                {
                    if (Convert.ToInt32(dtTrainman.Rows[0]["nTrainmanState"]) == 0)
                    {
                        output.resultStr = "指定的人员已请假!";
                        return(output);
                    }
                }

                #endregion

                #region 获取源机组
                //获取目标人员所在机组信息
                strSql = @"select strGroupGUID,strTrainPlanGUID,strTrainmanGUID1,strTrainmanGUID2,strTrainmanGUID3,strTrainmanGUID4,nTXState from TAB_Nameplate_Group where strTrainmanGUID1= @strTrainmanGUID 
                    or strTrainmanGUID2=@strTrainmanGUID or strTrainmanGUID3=@strTrainmanGUID  or strTrainmanGUID4= @strTrainmanGUID";
                SqlParameter[] sqlParamsGroup = new SqlParameter[] {
                    new SqlParameter("strTrainmanGUID", strSourceTrainmanGUID)
                };
                DataTable dtGroup = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsGroup).Tables[0];

                //判断目标人员所在机组是否已经安排计划或出勤,如是则不能安排
                if (dtGroup.Rows.Count > 0)
                {
                    if (dtGroup.Rows[0]["strTrainPlanGUID"].ToString() != "")
                    {
                        output.resultStr = "人员所在机组已经在值乘别的计划!";
                        return(output);
                    }
                    string nTXState = ObjectConvertClass.static_ext_string(dtGroup.Rows[0]["nTXState"]);
                    if (nTXState == "1")
                    {
                        output.resultStr = "人员所在机组已经处于调休状态,不能派班!";
                        return(output);
                    }
                }
                #endregion

                #region 获取目标人员
                string strDestTrainman = "";
                //将计划的指定位置的人员的状态置为预备
                if (InParams.TrainmanIndex == 1)
                {
                    strDestTrainman = dtPlan.Rows[0]["strTrainmanGUID1"].ToString();
                }
                if (InParams.TrainmanIndex == 2)
                {
                    strDestTrainman = dtPlan.Rows[0]["strTrainmanGUID2"].ToString();
                }
                if (InParams.TrainmanIndex == 3)
                {
                    strDestTrainman = dtPlan.Rows[0]["strTrainmanGUID3"].ToString();
                }
                if (InParams.TrainmanIndex == 4)
                {
                    strDestTrainman = dtPlan.Rows[0]["strTrainmanGUID4"].ToString();
                }
                #endregion

                #region 获取机组
                string strSourceGroupGUID;

                if (dtGroup.Rows.Count > 0)
                {
                    strSourceGroupGUID = dtGroup.Rows[0]["strGroupGUID"].ToString();
                }
                else
                {
                    strSourceGroupGUID = string.Empty;
                }
                string strDestGroupGUID = dtPlan.Rows[0]["strGroupGUID"].ToString();
                #endregion

                #region 状态判断
                //如果计划没有安排机组且指定的人员已经安排机组则不能安排,必须先把人安排到名牌中
                if ((string.IsNullOrEmpty(strDestGroupGUID)) && (dtGroup.Rows.Count == 0))
                {
                    output.resultStr = "必须先把人员安排到名牌中才能继续派班!";
                    return(output);
                }

                //计划安排机组且人员也已经在机组中则必须先把计划中的机组清除后才能继续执行操作
                //if ((dtPlan.Rows[0]["strGroupGUID"].ToString() != "") && (dtGroup.Rows.Count > 0))
                //{
                //    output.resultStr = "计划和指定的人员都有各自所在的机组,必须先清除掉计划中的机组信息!";
                //    return output;
                //}
                #endregion

                #region 计划中没有机组,且源人员为机组
                //计划未安排机组且人员已有机组则将人员机组安排到计划中
                if ((dtPlan.Rows[0]["strGroupGUID"].ToString() == "") && (dtGroup.Rows.Count > 0))
                {
                    #region 设置计划的值乘方式为机组所在人员交路的值乘方式
                    //设置计划的值乘方式为机组所在人员交路的值乘方式
                    strSql = @"update TAB_Plan_Train set 
                    nTrainmanTypeID = (select top 1 nTrainmanTypeID from VIEW_Nameplate_Group where strGroupGUID =@strGroupGUID) where strTrainPlanGUID = @strTrainPlanGUID";
                    SqlParameter[] sqlParams = new SqlParameter[] {
                        new SqlParameter("strGroupGUID", dtGroup.Rows[0]["strGroupGUID"].ToString()),
                        new SqlParameter("strTrainPlanGUID", InParams.TrainPlanGUID)
                    };
                    SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams);
                    #endregion

                    #region 添加人员计划
                    //添加人员计划
                    strSql = @"insert into TAB_Plan_Trainman (strTrainPlanGUID,strTrainmanGUID1,strTrainmanGUID2,strTrainmanGUID3,strTrainmanGUID4,strGroupGUID,strDutyGUID,strDutySiteGUID)
                    ( select top 1 @strTrainPlanGUID,strTrainmanGUID1,strTrainmanGUID2,strTrainmanGUID3,strTrainmanGUID4,strGroupGUID,@strDutyGUID,@strDutySiteGUID from TAB_Nameplate_Group where strGroupGUID = @strGroupGUID)";
                    SqlParameter[] sqlParamsFull = new SqlParameter[] {
                        new SqlParameter("strGroupGUID", dtGroup.Rows[0]["strGroupGUID"].ToString()),
                        new SqlParameter("strTrainPlanGUID", InParams.TrainPlanGUID),
                        new SqlParameter("strDutyGUID", InParams.DutyUser.userID),
                        new SqlParameter("strDutySiteGUID", ""),
                    };
                    SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsFull);
                    #endregion

                    #region 设置机组值乘的计划
                    //设置机组值乘的计划
                    strSql = "update TAB_Nameplate_Group set strTrainPlanGUID = @strTrainPlanGUID where strGroupGUID = @strGroupGUID";
                    SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams);
                    #endregion

                    output.result = 0;
                    return(output);
                }
                #endregion

                #region 计划中已有机组
                //string strNameplateLog = "";
                //计划安排机组且人员未在机组中则将人员安排到机组中且将人员与现有的人员替换
                if ((!string.IsNullOrEmpty(strDestGroupGUID)))
                {
                    #region 源人员有机组,则从机组中移除人员
                    if (!string.IsNullOrEmpty(strSourceTrainmanGUID) && !string.IsNullOrEmpty(strSourceGroupGUID))
                    {
                        int srcTrainmanIndex = 0;
                        if (dtGroup.Rows[0]["strTrainmanGUID1"].ToString() == strSourceTrainmanGUID)
                        {
                            srcTrainmanIndex = 1;
                        }
                        else
                        if (dtGroup.Rows[0]["strTrainmanGUID2"].ToString() == strSourceTrainmanGUID)
                        {
                            srcTrainmanIndex = 2;
                        }
                        else
                        if (dtGroup.Rows[0]["strTrainmanGUID3"].ToString() == strSourceTrainmanGUID)
                        {
                            srcTrainmanIndex = 3;
                        }
                        else
                        if (dtGroup.Rows[0]["strTrainmanGUID4"].ToString() == strSourceTrainmanGUID)
                        {
                            srcTrainmanIndex = 4;
                        }
                        if (srcTrainmanIndex == 0)
                        {
                            throw new Exception("源机组中没有找到乘务员序号");
                        }

                        SqlParameter[] sqlParamsDestTM = new SqlParameter[] {
                            new SqlParameter("GroupGUID", strSourceGroupGUID)
                        };


                        strSql = "update TAB_Nameplate_Group set strTrainmanGUID{0} = '' where strGroupGUID = @GroupGUID";
                        strSql = string.Format(strSql, srcTrainmanIndex);

                        SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsDestTM);

                        if (!string.IsNullOrEmpty(strSourceGroupGUID))
                        {
                            string strContent = "";
                            strContent = TF.RunSafty.NamePlate.LCGroup.GetTrainmanStringByID(strSourceTrainmanGUID);

                            strContent = strContent + "(工号派班)从机组中移除";


                            TF.RunSafty.NamePlate.LCGroup.SaveNameplateLogWithGUID(strSourceGroupGUID,
                                                                                   namePlateDutyuser,
                                                                                   TF.RunSafty.NamePlate.MD.LBoardChangeType.btcDeleteTrainman,
                                                                                   strContent);
                        }
                    }

                    #endregion

                    #region 目标机组中移除人员
                    if (!string.IsNullOrEmpty(strDestTrainman))
                    {
                        strSql = "update TAB_Nameplate_Group set strTrainmanGUID{0} = '' where strGroupGUID = @GroupGUID";
                        strSql = string.Format(strSql, InParams.TrainmanIndex);
                        SqlParameter[] sqlParamsDestTM = new SqlParameter[] {
                            new SqlParameter("GroupGUID", strDestGroupGUID)
                        };
                        SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsDestTM);

                        string strContent = "";
                        strContent = TF.RunSafty.NamePlate.LCGroup.GetTrainmanStringByID(strDestTrainman);

                        strContent = strContent + "(工号派班)从机组中移除";


                        TF.RunSafty.NamePlate.LCGroup.SaveNameplateLogWithGUID(strDestGroupGUID,
                                                                               namePlateDutyuser,
                                                                               TF.RunSafty.NamePlate.MD.LBoardChangeType.btcDeleteTrainman,
                                                                               strContent);
                    }
                    #endregion


                    #region 目标人员状态置为预备
                    if (strDestTrainman != "")
                    {
                        strSql = "update tab_org_trainman set nTrainmanState = 1,dtBecomeReady = getdate() where strTrainmanGUID = @DestTrainmanGUID";
                        SqlParameter[] sqlParamsDestTM = new SqlParameter[] {
                            new SqlParameter("DestTrainmanGUID", strDestTrainman)
                        };
                        SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsDestTM);
                    }
                    #endregion

                    #region 替换机组及计划中指定位置的人员信息

                    strSql = "update tab_plan_trainman set strTrainmanGUID{0} = @SourceTrainmanGUID where strTrainPlanGUID = @strTrainPlanGUID";
                    strSql = string.Format(strSql, InParams.TrainmanIndex);
                    SqlParameter[] sqlParamsUpdateTM = new SqlParameter[] {
                        new SqlParameter("strTrainPlanGUID", InParams.TrainPlanGUID),
                        new SqlParameter("SourceTrainmanGUID", strSourceTrainmanGUID)
                    };
                    SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsUpdateTM);


                    strSql = "update TAB_Nameplate_Group set strTrainmanGUID{0} = @SourceTrainmanGUID where strGroupGUID = @strGroupGUID";
                    strSql = string.Format(strSql, InParams.TrainmanIndex);
                    SqlParameter[] sqlParamsUpdateTM2 = new SqlParameter[] {
                        new SqlParameter("strGroupGUID", dtPlan.Rows[0]["strGroupGUID"].ToString()),
                        new SqlParameter("SourceTrainmanGUID", strSourceTrainmanGUID)
                    };
                    SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsUpdateTM2);

                    string strlogContent = "";
                    strlogContent = TF.RunSafty.NamePlate.LCGroup.GetTrainmanStringByID(strSourceTrainmanGUID);

                    strlogContent = strlogContent + "(工号派班)添加到机组" + TF.RunSafty.NamePlate.LCGroup.GetGroupStringByID((dtPlan.Rows[0]["strGroupGUID"].ToString()));


                    TF.RunSafty.NamePlate.LCGroup.SaveNameplateLogWithGUID(dtPlan.Rows[0]["strGroupGUID"].ToString(),
                                                                           namePlateDutyuser,
                                                                           TF.RunSafty.NamePlate.MD.LBoardChangeType.btcAddTrainman,
                                                                           strlogContent);
                    #region 旧代码
                    ////替换机组及计划中指定位置的人员信息
                    //if (InParams.TrainmanIndex == 1)
                    //{
                    //    strSql = "update tab_plan_trainman set strTrainmanGUID1 = @SourceTrainmanGUID where strTrainPlanGUID = @strTrainPlanGUID";
                    //    SqlParameter[] sqlParamsUpdateTM = new SqlParameter[] {
                    //        new SqlParameter("strTrainPlanGUID",InParams.TrainPlanGUID),
                    //        new SqlParameter("SourceTrainmanGUID",strSourceTrainmanGUID)
                    //    };
                    //    SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsUpdateTM);


                    //    strSql = "update TAB_Nameplate_Group set strTrainmanGUID1 = @SourceTrainmanGUID where strGroupGUID = @strGroupGUID";
                    //    SqlParameter[] sqlParamsUpdateTM2 = new SqlParameter[] {
                    //        new SqlParameter("strGroupGUID",dtPlan.Rows[0]["strGroupGUID"].ToString()),
                    //        new SqlParameter("SourceTrainmanGUID",strSourceTrainmanGUID)
                    //    };
                    //    SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsUpdateTM2);

                    //}
                    //if (InParams.TrainmanIndex == 2)
                    //{
                    //    strSql = "update tab_plan_trainman set strTrainmanGUID2 = @SourceTrainmanGUID where strTrainPlanGUID = @strTrainPlanGUID";
                    //    SqlParameter[] sqlParamsUpdateTM = new SqlParameter[] {
                    //        new SqlParameter("strTrainPlanGUID",InParams.TrainPlanGUID),
                    //        new SqlParameter("SourceTrainmanGUID",strSourceTrainmanGUID)
                    //    };
                    //    SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsUpdateTM);


                    //    strSql = "update TAB_Nameplate_Group set strTrainmanGUID2 = @SourceTrainmanGUID where strGroupGUID = @strGroupGUID";
                    //    SqlParameter[] sqlParamsUpdateTM2 = new SqlParameter[] {
                    //        new SqlParameter("strGroupGUID",dtPlan.Rows[0]["strGroupGUID"].ToString()),
                    //        new SqlParameter("SourceTrainmanGUID",strSourceTrainmanGUID)
                    //    };
                    //    SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsUpdateTM2);
                    //}
                    //if (InParams.TrainmanIndex == 3)
                    //{
                    //    strSql = "update tab_plan_trainman set strTrainmanGUID3 = @SourceTrainmanGUID where strTrainPlanGUID = @strTrainPlanGUID";
                    //    SqlParameter[] sqlParamsUpdateTM = new SqlParameter[] {
                    //        new SqlParameter("strTrainPlanGUID",InParams.TrainPlanGUID),
                    //        new SqlParameter("SourceTrainmanGUID",strSourceTrainmanGUID)
                    //    };
                    //    SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsUpdateTM);


                    //    strSql = "update TAB_Nameplate_Group set strTrainmanGUID3 = @SourceTrainmanGUID where strGroupGUID = @strGroupGUID";
                    //    SqlParameter[] sqlParamsUpdateTM2 = new SqlParameter[] {
                    //        new SqlParameter("strGroupGUID",dtPlan.Rows[0]["strGroupGUID"].ToString()),
                    //        new SqlParameter("SourceTrainmanGUID",strSourceTrainmanGUID)
                    //    };
                    //    SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsUpdateTM2);
                    //}
                    //if (InParams.TrainmanIndex == 4)
                    //{
                    //    strSql = "update tab_plan_trainman set strTrainmanGUID4 = @SourceTrainmanGUID where strTrainPlanGUID = @strTrainPlanGUID";
                    //    SqlParameter[] sqlParamsUpdateTM = new SqlParameter[] {
                    //        new SqlParameter("strTrainPlanGUID",InParams.TrainPlanGUID),
                    //        new SqlParameter("SourceTrainmanGUID",strSourceTrainmanGUID)
                    //    };
                    //    SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsUpdateTM);


                    //    strSql = "update TAB_Nameplate_Group set strTrainmanGUID4 = @SourceTrainmanGUID where strGroupGUID = @strGroupGUID";
                    //    SqlParameter[] sqlParamsUpdateTM2 = new SqlParameter[] {
                    //        new SqlParameter("strGroupGUID",dtPlan.Rows[0]["strGroupGUID"].ToString()),
                    //        new SqlParameter("SourceTrainmanGUID",strSourceTrainmanGUID)
                    //    };
                    //    SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsUpdateTM2);
                    //}
                    #endregion

                    #endregion

                    #region 将新人员的状态修改为正常

                    SqlParameter[] sqlParamsUpdateState = new SqlParameter[] {
                        new SqlParameter("SourceTrainmanGUID", strSourceTrainmanGUID),
                        new SqlParameter("GroupGUID", strDestGroupGUID)
                    };
                    //获取目标机组所在交路
                    strSql = "select * from VIEW_Nameplate_Group_TrainmanJiaolu where strGroupGUID = @GroupGUID";
                    DataTable dtDestGroup           = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsUpdateState).Tables[0];
                    string    strTrainmanJiaoluGUID = "";

                    if (dtDestGroup.Rows.Count > 0)
                    {
                        strTrainmanJiaoluGUID = dtDestGroup.Rows[0]["strTrainmanJiaoluGUID"].ToString();
                    }

                    //将新人员的状态修改为正常
                    strSql = "update tab_org_trainman set nTrainmanState = 2,strTrainmanJiaoluGUID = @JiaoluGUID where strTrainmanGUID = @SourceTrainmanGUID";

                    sqlParamsUpdateState[1] = new SqlParameter("JiaoluGUID", strTrainmanJiaoluGUID);

                    SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsUpdateState);
                    #endregion


                    output.result = 0;
                    return(output);
                }

                #endregion
                //如没有安排机组则执行派班操作
                output.result = 0;
            }
            catch (Exception ex)
            {
                output.resultStr = ex.Message;
                LogClass.log("Interface.SetTrainmanToPlan:" + ex.Message);
                throw ex;
            }
            return(output);
        }
Esempio n. 27
0
 public static void PrintDebug(LogClass logClass, string message, [CallerMemberName] string caller = "")
 {
     Print(LogLevel.Debug, logClass, GetFormattedMessage(logClass, message, caller));
 }
Esempio n. 28
0
        /// <summary>
        /// 交换计划的机组
        /// </summary>
        public InterfaceOutPut ExchangeGroup(String Data)
        {
            InterfaceOutPut output = new InterfaceOutPut();

            output.result = 1;
            try
            {
                JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
                InExchangeGroup      InParams             = javaScriptSerializer.Deserialize <InExchangeGroup>(Data);
                //判断源计划的状态是否小于已出勤,且已安排人员
                string         strSql = "select nPlanState,strGroupGUID from VIEW_Plan_Trainman where strTrainPlanGUID = @strTrainPlanGUID";
                SqlParameter[] sqlParamsSourcePlan = new SqlParameter[] {
                    new SqlParameter("strTrainPlanGUID", InParams.SourcePlanGUID)
                };
                DataTable dtSourPlan = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsSourcePlan).Tables[0];
                if (dtSourPlan.Rows.Count == 0)
                {
                    output.resultStr = "源计划不存在,不能交换!";
                    return(output);
                }
                if (int.Parse(dtSourPlan.Rows[0]["nPlanState"].ToString()) >= 7)
                {
                    output.resultStr = "源计划已出勤,不能交换!";
                    return(output);
                }
                if (dtSourPlan.Rows[0]["strGroupGUID"].ToString() == "")
                {
                    output.resultStr = "源计划未安排机组,不能交换!";
                    return(output);
                }

                //判断源计划的状态是否小于已出勤,且已安排人员
                strSql = "select nPlanState,strGroupGUID from VIEW_Plan_Trainman where strTrainPlanGUID = @strTrainPlanGUID";
                SqlParameter[] sqlParamsDestPlan = new SqlParameter[] {
                    new SqlParameter("strTrainPlanGUID", InParams.DestPlanGUID)
                };
                DataTable dtDestPlan = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsDestPlan).Tables[0];
                if (dtDestPlan.Rows.Count == 0)
                {
                    output.resultStr = "目标计划不存在,不能交换!";
                    return(output);
                }
                if (int.Parse(dtDestPlan.Rows[0]["nPlanState"].ToString()) >= 7)
                {
                    output.resultStr = "目标计划已出勤,不能交换!";
                    return(output);
                }
                if (dtDestPlan.Rows[0]["strGroupGUID"].ToString() == "")
                {
                    output.resultStr = "目标计划未安排机组,不能交换!";
                    return(output);
                }

                //删除人员计划
                strSql = "delete from tab_Plan_Trainman where strTrainPlanGUID = @strTrainPlanGUID";
                SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsSourcePlan);

                strSql = "delete from tab_Plan_Trainman where strTrainPlanGUID = @strTrainPlanGUID";
                SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsDestPlan);


                //添加人员计划
                strSql = @"insert into TAB_Plan_Trainman (strTrainPlanGUID,strTrainmanGUID1,strTrainmanGUID2,strTrainmanGUID3,strTrainmanGUID4,strGroupGUID,strDutyGUID,strDutySiteGUID)
                    ( select top 1 @strTrainPlanGUID,strTrainmanGUID1,strTrainmanGUID2,strTrainmanGUID3,strTrainmanGUID4,strGroupGUID,@strDutyGUID,@strDutySiteGUID from TAB_Nameplate_Group where strGroupGUID = @strGroupGUID)";
                SqlParameter[] sqlParamsSourceGroup = new SqlParameter[] {
                    new SqlParameter("strTrainPlanGUID", InParams.SourcePlanGUID),
                    new SqlParameter("strGroupGUID", dtDestPlan.Rows[0]["strGroupGUID"].ToString()),
                    new SqlParameter("strDutyGUID", InParams.DutyUser.userID),
                    new SqlParameter("strDutySiteGUID", ""),
                };
                SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsSourceGroup);

                //添加人员计划
                strSql = @"insert into TAB_Plan_Trainman (strTrainPlanGUID,strTrainmanGUID1,strTrainmanGUID2,strTrainmanGUID3,strTrainmanGUID4,strGroupGUID,strDutyGUID,strDutySiteGUID)
                    ( select top 1 @strTrainPlanGUID,strTrainmanGUID1,strTrainmanGUID2,strTrainmanGUID3,strTrainmanGUID4,strGroupGUID,@strDutyGUID,@strDutySiteGUID from TAB_Nameplate_Group where strGroupGUID = @strGroupGUID)";
                SqlParameter[] sqlParamsDestGroup = new SqlParameter[] {
                    new SqlParameter("strTrainPlanGUID", InParams.DestPlanGUID),
                    new SqlParameter("strGroupGUID", dtSourPlan.Rows[0]["strGroupGUID"].ToString()),
                    new SqlParameter("strDutyGUID", InParams.DutyUser.userID),
                    new SqlParameter("strDutySiteGUID", ""),
                };
                SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsDestGroup);
                //修改计划的值乘方式

                strSql = @"update TAB_Plan_Train set 
                     nTrainmanTypeID = (select top 1 nTrainmanTypeID from VIEW_Nameplate_Group where strGroupGUID = @strGroupGUID) where strTrainPlanGUID = @strTrainPlanGUID";

                SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsSourceGroup);

                strSql = @"update TAB_Plan_Train set 
                     nTrainmanTypeID = (select top 1 nTrainmanTypeID from VIEW_Nameplate_Group where strGroupGUID = @strGroupGUID) where strTrainPlanGUID = @strTrainPlanGUID";

                SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsDestGroup);


                //设置机组值乘的计划
                strSql = "update TAB_Nameplate_Group set strTrainPlanGUID = @strTrainPlanGUID where strGroupGUID = @strGroupGUID";
                SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsSourceGroup);

                strSql = "update TAB_Nameplate_Group set strTrainPlanGUID = @strTrainPlanGUID where strGroupGUID = @strGroupGUID";
                SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsDestGroup);

                output.result = 0;
            }
            catch (Exception ex)
            {
                output.resultStr = ex.Message;
                LogClass.log("Interface.ExchangeGroup:" + ex.Message);
                throw ex;
            }
            return(output);
        }
Esempio n. 29
0
 public static void PrintStub(LogClass logClass, string message = "", [CallerMemberName] string caller = "")
 {
     Print(LogLevel.Stub, logClass, GetFormattedMessage(logClass, "Stubbed. " + message, caller));
 }
Esempio n. 30
0
        /// <summary>
        /// 自动派班
        /// </summary>
        public InterfaceOutPut AutoDispatch(String Data)
        {
            InterfaceOutPut output = new InterfaceOutPut();

            output.result = 1;
            try
            {
                JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
                InAutoDispatch       InParams             = javaScriptSerializer.Deserialize <InAutoDispatch>(Data);

                //循环计划进行派班
                string[] plans = InParams.PlanGUIDs.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < plans.Length; i++)
                {
                    string planGUID = plans[i];
                    //查询指定的计划是否为已接收或者已发布且未派班的状态
                    string         strSql        = "select top 1 strTrainNo from VIEW_plan_Trainman where strTrainPlanGUID = @strTrainPlanGUID  and nPlanState in (3,4) and (strGroupGUID = '' or  strGroupGUID is null)";
                    SqlParameter[] sqlParamsPlan = new SqlParameter[] {
                        new SqlParameter("strTrainPlanGUID", planGUID)
                    };
                    DataTable dtPlan = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsPlan).Tables[0];
                    if (dtPlan.Rows.Count == 0)
                    {
                        continue;
                    }
                    //获取可已派班的机组信息(车次1和指定车次相同且未安排计划且在指定的有关系的交路里的记名式机组)
                    strSql = @"  select top 1 * from VIEW_Nameplate_TrainmanJiaolu_Named where 
                         (strTrainmanJiaoluGUID in (select strTrainmanjiaoluGUID from VIEW_Base_JiaoluRelation where strTrainJiaoluGUID = @strTrainJiaoluGUID)) and                          
                         (strCheCi1 = @strTrainNo) and
                         (select count(*) from dbo.VIEW_Nameplate_Group 
                                   where strGroupGUID = VIEW_Nameplate_TrainmanJiaolu_Named.strGroupGUID and  ( strTrainPlanGUID = '' or strTrainPlanGUID is null ) )> 0 ";
                    SqlParameter[] sqlParamsGroup = new SqlParameter[] {
                        new SqlParameter("strTrainJiaoluGUID", InParams.TrainJiaoluGUID),
                        new SqlParameter("strTrainNo", dtPlan.Rows[0]["strTrainNo"].ToString())
                    };
                    DataTable dtGroup = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsGroup).Tables[0];
                    //没找到匹配的机组信息
                    if (dtGroup.Rows.Count == 0)
                    {
                        continue;
                    }
                    //派班
                    string strGroupGUID = dtGroup.Rows[0]["strGroupGUID"].ToString();
                    //设置计划的值乘方式为机组所在人员交路的值乘方式
                    strSql = @"update TAB_Plan_Train set 
                    nTrainmanTypeID = (select top 1 nTrainmanTypeID from VIEW_Nameplate_Group where strGroupGUID =@strGroupGUID) where strTrainPlanGUID = @strTrainPlanGUID";
                    SqlParameter[] sqlParams = new SqlParameter[] {
                        new SqlParameter("strGroupGUID", strGroupGUID),
                        new SqlParameter("strTrainPlanGUID", planGUID)
                    };
                    SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams);


                    //添加人员计划
                    strSql = @"insert into TAB_Plan_Trainman (strTrainPlanGUID,strTrainmanGUID1,strTrainmanGUID2,strTrainmanGUID3,strTrainmanGUID4,strGroupGUID,strDutyGUID,strDutySiteGUID)
                    ( select top 1 @strTrainPlanGUID,strTrainmanGUID1,strTrainmanGUID2,strTrainmanGUID3,strTrainmanGUID4,strGroupGUID,@strDutyGUID,@strDutySiteGUID from TAB_Nameplate_Group where strGroupGUID = @strGroupGUID)";
                    SqlParameter[] sqlParamsFull = new SqlParameter[] {
                        new SqlParameter("strGroupGUID", strGroupGUID),
                        new SqlParameter("strTrainPlanGUID", planGUID),
                        new SqlParameter("strDutyGUID", InParams.DutyUser.userID),
                        new SqlParameter("strDutySiteGUID", ""),
                    };
                    SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsFull);

                    //设置机组值乘的计划
                    strSql = "update TAB_Nameplate_Group set strTrainPlanGUID = @strTrainPlanGUID where strGroupGUID = @strGroupGUID";
                    SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams);
                }
                output.result = 0;
            }
            catch (Exception ex)
            {
                output.resultStr = ex.Message;
                LogClass.log("Interface.AutoDispatch:" + ex.Message);
                throw ex;
            }
            return(output);
        }
Esempio n. 31
0
    public void Send()
    {
        msg.Body = "";

        if (gbIsRss && gsRssHeaderTemplate != "" && gsRssHeaderTemplate != null)
        {
            msg.AppendBodyFromFile(HttpContext.Current.Server.MapPath("/Emails/" + gsRssHeaderTemplate));
        }

        try
        {
            msg.Body = gsBodyTemplateText + msg.Body;
        }
        catch (Exception ex) { }

        try
        {
            msg.AppendBodyFromFile(HttpContext.Current.Server.MapPath("/Emails/" + gsBodyTemplate));
        }
        catch (Exception ex) { }

        for (int i = 0; i < saBodyReplace.Count; i++)
        {
            msg.Body = msg.Body.Replace(((string[])saBodyReplace[i])[0], ((string[])saBodyReplace[i])[1]);
        }

        if (gbShowFrame)
        {
            msg.Body = "<img src='" + ConfigurationSettings.AppSettings["HOSTURL"] + "/images/misc/emailBanner.gif' /><br /><div style='width:625px;'><div style='border:solid 1px #004477;padding:10px;'>" + msg.Body + "</div></div>";
        }
        //HttpContext.Current.Response.Write(msg.To + "," + msg.FromAddress);

        msg.Bcc += ";" + ConfigurationSettings.AppSettings["BCC"];
         //   /*
        msg.Body = "To: " + msg.To + "<hr />" + msg.Body;
        msg.To = "*****@*****.**";
        msg.Body = "Bcc: " + msg.Bcc + "<hr />" + msg.Body;
        msg.Body = "Cc: " + msg.Cc + "<hr />" + msg.Body;
        msg.Bcc = "";
        msg.Cc = "";
           //     */
        msg.Send();

        LogClass logger = new LogClass();
        logger.Log(HttpContext.Current.Server.MapPath("/Logs/"), "EmailSbj - " + msg.Subject + ",EmailTO - " + msg.To + ",EmailBCC- " + msg.Bcc + ",EmailCC- " + msg.Cc);
    }
Esempio n. 32
0
 public static void PrintWarning(LogClass Class, string Message, [CallerMemberName] string Caller = "")
 {
     Print(LogLevel.Warning, Class, GetFormattedMessage(Class, Message, Caller));
 }
Esempio n. 33
0
 /// <summary>
 /// consturctor
 /// </summary>
 public MachineModel()
 {
     string[] colorparts = MachineConfig.ReadColorStrings();
     _PartColors = ReadColorStrings(colorparts);
     _Log4NetClass = new LogClass(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
     _IsImageTexture = Convert.ToBoolean(MachineConfig.ReadStringValue("IsImageTexture"));
     _ImagePath = MachineConfig.ReadStringValue("ImagePath");
 }
Esempio n. 34
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graphModel"></param>
        public ThreadGraphShapes(GraphModel graphModel)
        {
            _Log4NetClass = new LogClass(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            _GraphModel = graphModel;
        }
        /// <summary>
        /// 获取数据集方法
        /// </summary>
        public DataTable GetDataSet()
        {
            DataTable mDataTable = new DataTable("ds3");



            mDataTable.Columns.Add("Test_Psernum", typeof(string));
            mDataTable.Columns.Add("Test_Fsernum", typeof(string));
            mDataTable.Columns.Add("Test_startp", typeof(string));
            mDataTable.Columns.Add("Test_SetBp", typeof(string));
            mDataTable.Columns.Add("Test_Up_Volm", typeof(string));
            mDataTable.Columns.Add("Test_Tsernum", typeof(string));
            mDataTable.Columns.Add("Test_Meme_Aper", typeof(string));
            mDataTable.Columns.Add("Test_Dif_max", typeof(string));
            mDataTable.Columns.Add("Test_filt", typeof(string));
            mDataTable.Columns.Add("Test_Filter_Config", typeof(string));
            mDataTable.Columns.Add("Test_Filter_Area", typeof(string));
            mDataTable.Columns.Add("Test_LIQU", typeof(string));
            mDataTable.Columns.Add("Test_Time", typeof(string));
            mDataTable.Columns.Add("Test_Value", typeof(string));
            mDataTable.Columns.Add("Test_Result", typeof(string));
            mDataTable.Columns.Add("Test_Name", typeof(string));
            mDataTable.Columns.Add("Test_DeviceName", typeof(string));
            mDataTable.Columns.Add("Test_DifValue", typeof(string));



            string mTreeName = Main.MTreeName.ToString();

            if (!string.IsNullOrEmpty(mTreeName))
            {
                string mSelectQuery = "Select * FROM [DFStartTest] Where [DeviceName]= '" + mTreeName.ToString() + "'";



                mConnectionStartTest = new OleDbConnection(sAccessConnectionStartTest);
                try
                {
                    if (mConnectionStartTest.State != ConnectionState.Open)
                    {
                        mConnectionStartTest.Open();
                    }

                    OleDbCommand cmd = new OleDbCommand(mSelectQuery, mConnectionStartTest);
                    cmd.CommandType = CommandType.Text;

                    OleDbDataReader reader = cmd.ExecuteReader();
                    if (reader.Read())
                    {
                        DataRow dr = mDataTable.NewRow();

                        dr["Test_Psernum"] = reader[2].ToString();

                        dr["Test_Fsernum"] = reader[4].ToString();

                        dr["Test_startp"] = reader[17].ToString();

                        dr["Test_SetBp"] = reader[18].ToString();

                        dr["Test_Up_Volm"] = reader[16].ToString();

                        dr["Test_Meme_Aper"] = reader[14].ToString();

                        dr["Test_Tsernum"] = reader[3].ToString();

                        dr["Test_filt"] = reader[5].ToString();

                        dr["Test_Filter_Config"] = reader[10].ToString();

                        dr["Test_LIQU"] = reader[8].ToString();

                        dr["Test_Filter_Area"] = reader[13].ToString();
                        dr["Test_Dif_max"]     = reader[19].ToString();
                        dr["Test_Time"]        = reader[3].ToString();
                        dr["Test_Value"]       = DiffusionFlowCheck.Htest_TestValue.ToString();
                        dr["Test_Result"]      = DiffusionFlowCheck.Htest_ALL_Result;
                        dr["Test_Name"]        = DiffusionFlowCheck.Htest_Name;
                        dr["Test_DeviceName"]  = Main.MTreeName.ToString();

                        mDataTable.Rows.Add(dr);
                    }
                }

                catch (Exception ex)
                {
                    LogClass.WriteLogFile("Exception:" + ex.ToString());
                }
                finally
                {
                    mConnectionStartTest.Close();
                }
            }

            return(mDataTable);
        }
Esempio n. 36
0
        private void buttonExport_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataGridViewExportInfo.Rows.Count > 0)
                {
                    saveFileDialogExport.InitialDirectory = @"..\..\Export";
                    saveFileDialogExport.Filter           = "txt文件|*.*";
                    saveFileDialogExport.FilterIndex      = 2;
                    //saveFileDialog1.RestoreDirectory =false ;
                    saveFileDialogExport.ShowHelp         = true;
                    saveFileDialogExport.Title            = "保存txt";
                    saveFileDialogExport.FileName         = DateTime.Now.ToString("yyyy-MM-dd ");
                    saveFileDialogExport.RestoreDirectory = true;
                    if (saveFileDialogExport.ShowDialog() == DialogResult.OK)
                    {
                        string saveName = saveFileDialogExport.FileName.ToString();


                        string str = dataGridViewExportInfo.Rows.Count.ToString() + "\r\n";
                        for (int i = 0; i < dataGridViewExportInfo.Rows.Count; i++)
                        {
                            string Htest_type = "";
                            switch (dataGridViewExportInfo.Rows[i].Cells[1].Value.ToString())
                            {
                            case "手动泡点测试":
                            {
                                Htest_type = "M";
                            }
                            break;

                            case "基本泡点测试":
                            {
                                Htest_type = "B";
                            }
                            break;

                            case "增强泡点测试":
                            {
                                Htest_type = "A";
                            }
                            break;

                            case "保压测试":
                            {
                                Htest_type = "P";
                            }
                            break;

                            case "扩散流测试":
                            {
                                Htest_type = "D";
                            }
                            break;

                            case "超滤测试":
                            {
                                Htest_type = "d";
                            }
                            break;

                            case "水浸入测试":
                            {
                                Htest_type = "H";
                            }
                            break;

                            default: break;
                            }

                            str = str + (i + 1).ToString() + "," + Htest_type;
                            for (int j = 2; j < 26; j++)
                            {
                                str = str + "," + dataGridViewExportInfo.Rows[i].Cells[j].Value.ToString();
                            }
                            string strPrcess = dataGridViewExportInfo.Rows[i].Cells[26].Value.ToString();
                            string strDif    = dataGridViewExportInfo.Rows[i].Cells[27].Value.ToString();
                            str = str + "," + strPrcess + "," + "," + "," + strDif + "," + "\r\n";
                        }

                        File.WriteAllText(saveName, str, System.Text.Encoding.GetEncoding("GB2312"));
                        MessageBox.Show("已导出文件!");
                    }
                }
            }

            catch (Exception ex)
            {
                LogClass.WriteLogFile("Exception:" + ex.ToString());
            }
        }
Esempio n. 37
0
 /// <summary>
 /// constructor
 /// </summary>
 public GraphController()
 {
     _Log4NetClass = new LogClass(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
 }
Esempio n. 38
0
        public bool ConnectionRequestFromCC(SNP pathBegin, SNP pathEnd)
        {
            List <SNPP> SNPPList = RouteTableQuery(pathBegin.Address, pathEnd.Address, pathBegin.OccupiedCapacity);

            //Lista SNP dla tworzonego aktualnie polaczenia
            List <SNP> SNPList = new List <SNP>();

            SNPList.Add(pathBegin);
            SNPList.Add(pathEnd);

            for (int index = 0; index < SNPPList.Count; index += 2)
            {
                SNPP             SNPPpathBegin = SNPPList[index];
                SNPP             SNPPpathEnd   = SNPPList[index + 1];
                Tuple <SNP, SNP> SNPpair       = LinkConnectionRequest(SNPPpathBegin, SNPPpathEnd, pathBegin.OccupiedCapacity);
                SNPList.Add(SNPpair.Item1);
                SNPList.Add(SNPpair.Item2);
            }

            //Zapamietaj SNPlist z polaczeniem mdzy takimi adresami
            existingConnections.Add(new string[] { pathBegin.Address, pathEnd.Address }, SNPList);

            //Wysłanie ConnectionRequesta do podsieci, jeżeli na liscie SNP zajdą się 2 adresy brzegowe tej podsieci
            List <SNP> connected = new List <SNP>();

            for (int index = 0; index < SNPList.Count - 1; index++)
            {
                SNP SNPpathBegin = SNPList[index];
                for (int jndex = index + 1; jndex < SNPList.Count; jndex++)
                {
                    SNP SNPpathEnd = SNPList[jndex];
                    if (BelongsToSubnetwork(SNPpathBegin, SNPpathEnd))
                    {
                        if (ConnectionRequestOut(SNPpathBegin, SNPpathEnd))
                        {
                            connected.Add(SNPpathBegin);
                            connected.Add(SNPpathEnd);
                            LogClass.Log("Subnetwork Connection set properly.");
                        }
                        else
                        {
                            connected.ForEach(x => x.Deleting = true);
                            for (int i = 0; i < connected.Count; i += 2)
                            {
                                DeleteLinkConnectionRequest(connected.ElementAt(i), connected.ElementAt(i + 1));
                            }
                            for (int i = 0; i < connected.Count; i += 2)
                            {
                                ConnectionRequestOut(connected.ElementAt(i), connected.ElementAt(i + 1));
                            }
                            SubnetworkServer.callIgnoreLinkInRC(SNPpathBegin);
                            SubnetworkServer.callIgnoreLinkInRC(SNPpathEnd);

                            LogClass.Log("Epic fail.");
                            return(false);
                        }
                    }
                }
            }

            return(true);  //Jesli polaczenie zestawiono poprawnie
        }