Exemplo n.º 1
0
        private void btnReadFile_Click(object sender, EventArgs e)
        {
            HZAction action = new HZAction();

            action.BeginRun();
            label1.Text = "服务已启动";
        }
Exemplo n.º 2
0
        //[DllImport("User32.dll", EntryPoint = "FindWindow")]
        //private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

        //[DllImport("user32.dll", EntryPoint = "FindWindowEx")]   //找子窗体
        //private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);

        //[DllImport("User32.dll", EntryPoint = "SendMessage")]   //用于发送信息给窗体
        //private static extern int SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, string lParam);

        //[DllImport("User32.dll", EntryPoint = "ShowWindow")]   //
        //private static extern bool ShowWindow(IntPtr hWnd, int type);

        //const string Id = "af49d266-e4f4-4a63-b73c-f62c1144b584";
        static void Main(string[] args)
        {
            //bool thisInstance;
            //using (var semaphore = new Semaphore(0, 1, Id, out thisInstance))
            //{
            //    if (thisInstance)
            //    {
            //        Console.WriteLine("This is the first instance!");
            //        Console.ReadLine();

            //        // Release resource
            //        semaphore.Release();
            //    }
            //    else
            //    {
            //        Console.WriteLine("There is another instance running.");

            //        // Wait for resource
            //        semaphore.WaitOne();
            //        Console.WriteLine("There is now the only instance.");
            //        Console.ReadLine();
            //    }
            //}

            //Console.Title = "MyConsoleApp";
            //IntPtr ParenthWnd = new IntPtr(0);
            //IntPtr et = new IntPtr(0);
            //ParenthWnd = FindWindow(null, "MyConsoleApp");

            //ShowWindow(ParenthWnd, 2);//隐藏本dos窗体, 0: 后台执行;1:正常启动;2:最小化到任务栏;3:最大化
            Console.WriteLine("程序版本:2016-11-09");
            Console.WriteLine("请勿关闭此窗口,谢谢:)");

            HZAction action = new HZAction();

            action.BeginRun();
            Console.ReadLine();
        }
Exemplo n.º 3
0
 protected override void OnStart(string[] args)
 {
     action = new HZAction();
     action.BeginRun();
 }
Exemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            HZAction ac = new HZAction();

            ac.BeginRun();
        }
Exemplo n.º 5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            action.BeginRun();
            return;

            var xx = XmlHelper.DeserializeFromFile <NEWXMLInfo2>("9.xml");
            var aa = xx.Body.CMA_INFO[0].MAIN_G_NAME;

            GetColumnMap();
            Dictionary <string, string> xmlItems = new Dictionary <string, string>();

            try
            {
                string filePath = "4.txt";

                XmlDocument doc = new XmlDocument();
                doc.Load(filePath);

                var status = doc.GetElementsByTagName("status").Item(0).InnerText;
                xmlItems.Add("status", status);

                var errMsg = doc.GetElementsByTagName("errMsg").Item(0).InnerText;
                xmlItems.Add("errMsg", errMsg);

                var    list = doc.GetElementsByTagName("CBEE_ELIST");
                string val  = "";
                foreach (XmlNode item in list)
                {
                    var child = item.ChildNodes;
                    foreach (XmlNode item2 in child)
                    {
                        if (item2.Name.Equals("INSPECTION_STATUS", StringComparison.CurrentCultureIgnoreCase))
                        {
                            val = item2.InnerText;
                            if (item2.InnerText == "放行" || item2.InnerText == "审核通过")
                            {
                                val = "0";
                            }
                            else if (item2.InnerText == "查验")
                            {
                                val = "1";
                            }
                            xmlItems.Add(item2.Name, val);
                        }
                        else if (item2.Name.Equals("PACK_NO", StringComparison.CurrentCultureIgnoreCase) ||
                                 item2.Name.Equals("GROSS_WEIGHT", StringComparison.CurrentCultureIgnoreCase)
                                 )
                        {
                            val = item2.InnerText;
                            double itemp = 0;
                            if (double.TryParse(val, out itemp))
                            {
                                xmlItems.Add(item2.Name, val);
                            }
                            else
                            {
                                xmlItems.Add(item2.Name, null);
                            }
                        }
                        else
                        {
                            xmlItems.Add(item2.Name, item2.InnerText);
                        }
                    }
                }


                list = doc.GetElementsByTagName("CBEE_ELIST_ITEM");
                foreach (XmlNode item in list)
                {
                    var child = item.ChildNodes;
                    foreach (XmlNode item2 in child)
                    {
                        if (xmlItems.ContainsKey(item2.Name))
                        {
                            xmlItems.Add("CBEE_ELIST_ITEM_" + item2.Name, item2.InnerText);
                        }
                        else
                        {
                            xmlItems.Add(item2.Name, item2.InnerText);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            DataAction da = new DataAction();
            //  var rs = da.UpdateTmp(map, xmlItems);
            //  MessageBox.Show(rs.ToString());
            //   var xmlInfo = XmlHelper.DeserializeFromFile<NEWXMLInfo>(filePath);



            //NEWXMLInfo info = new NEWXMLInfo();
            //info.version = "2.0.0";
            //info.head = new head();
            //info.head.businessType = "CBEE_INFO";
            //info.head.createTime = "2018/8/16 13:50:00";
            //info.head.status = 1;
            //info.head.errMsg = "";
            //info.body = new body();
            //info.body.ENTRYBILL_HEAD = new ENTRYBILL_HEAD();
            //info.body.ENTRYBILL_HEAD.EMS_NO = "";
            //info.body.ENTRYBILL_HEAD.ORDER_NO = "wb180808008";
            //info.body.ENTRYBILL_HEAD.EBC_CODE = "3318961D6D";
            //info.body.ENTRYBILL_HEAD.EBC_NAME = "义乌融易通供应链管理有限公司";
            //info.body.ENTRYBILL_HEAD.LOGISTICS_NO = "wb180808008";
            //info.body.ENTRYBILL_HEAD.LOGISTICS_CODE = "330198Z018";
            //info.body.ENTRYBILL_HEAD.LOGISTICS_NAME = "中外运空运发展股份有限公司浙江分公司";
            //info.body.ENTRYBILL_HEAD.INVT_NO = "29162018E000000122";
            //info.body.ENTRYBILL_HEAD.I_E_FLAG = "E";
            //info.body.ENTRYBILL_HEAD.I_E_DATE = "2017/02/07 00:00:00";
            //info.body.ENTRYBILL_HEAD.AGENT_CODE = "3318961D6D";
            //info.body.ENTRYBILL_HEAD.AGENT_NAME = "义乌融易通供应链管理有限公司";
            //info.body.ENTRYBILL_HEAD.AREA_CODE = "";
            //info.body.ENTRYBILL_HEAD.AREA_NAME = "";
            //info.body.ENTRYBILL_HEAD.TRADE_MODE = "9610";
            //info.body.ENTRYBILL_HEAD.BILL_NO = "20180706004";
            //info.body.ENTRYBILL_HEAD.COUNTRY = "西班牙";
            //info.body.ENTRYBILL_HEAD.PACK_NO = null;
            //info.body.ENTRYBILL_HEAD.GROSS_WEIGHT = 2;
            //info.body.ENTRYBILL_HEAD.DISTRICT_CUSTOMS = "2900";

            //var xml = XmlHelper.Serializer(info);
        }