예제 #1
0
        public static int  SolitaryHandbarrow2(string HandbarrowBarCode2)
        {
            DateTime beginTime = DateTime.Now;
            DateTime endTime   = DateTime.Now;
            TimeSpan timeS     = new TimeSpan();

            try
            {
                getCell = Interface.ChargeNumberAddess(HandbarrowBarCode2, Number, DoorInfo); //调用接口
                Meg     = [email protected];                                            //返回信息
                Code    = [email protected];                                               //code
            }
            catch (Exception ex)
            {
                Meg  = ex.Message;
                Code = 1001;
            }
            finally
            {
                if (string.IsNullOrEmpty(Meg) && [email protected] == 0)
                {
                    BarcodeList2 = "";
                    endTime      = DateTime.Now;
                    timeS        = endTime - beginTime;
                    ControlHelp.ControlHelp.listBoxInfo("MES返回:" + [email protected] + "信息:" + [email protected] + "  耗时:" + timeS.Milliseconds.ToString());//返回信息
                    List <string> list = strToNull([email protected]);
                    for (int i = 0; i < list.Count; i++)
                    {
                        BarcodeList2 += list[i] + ",";
                    }
                    if (!string.IsNullOrEmpty(BarcodeList2))
                    {
                        BarcodeList2 = InterceptStringHelp.Delectlast(BarcodeList2);
                        //写CSV文件
                        ConfigureHelp.SaveInfoToCSVFileAtLog(beginTime.ToString("yyyy-MM-dd hh:mm:ss"), endTime.ToString("yyyy-MM-dd hh:mm:ss"), timeS.TotalMilliseconds.ToString(),
                                                             string.Format("开始时间代码Error [BeginTime]({0}、{1})", HandbarrowBarCode2, Number),
                                                             Code + "", Meg, 1);
                    }
                }
                else
                {
                    ControlHelp.ControlHelp.listBoxInfo("MES返回:" + [email protected] + "信息:" + [email protected] + "  耗时:" + timeS.Milliseconds.ToString());//返回信息
                    //写CSV文件
                    ConfigureHelp.SaveInfoToCSVFileAtLog(beginTime.ToString("yyyy-MM-dd hh:mm:ss"), endTime.ToString("yyyy-MM-dd hh:mm:ss"), timeS.TotalMilliseconds.ToString(),
                                                         string.Format("开始时间代码Error [BeginTime]({0}、{1})", HandbarrowBarCode2, Number),
                                                         Code + "", Meg, 1);
                    Common.Msg.Warning("条码号:" + HandbarrowBarCode2 + "获取小车内的托盘失败,请重新两个绑定小车");
                }
                //扫到的条形码写入数据库
                string Sql = string.Format(@"UPDATE [db_ND10L].[dbo].[dbo.tb_RnuInfo] SET  Barcode2 ='{0}',BarcodeInclude2='{1}'  WHERE Door='{2}'", HandbarrowBarCode2, BarcodeList2, DoorInfo);
                SqlServerHelp.ExecuteSql(Sql);
            }
            return(Code);
        }
예제 #2
0
        /// <summary>
        /// 查询第二个的条形码
        /// </summary>
        /// <param name="door">炉门条件</param>
        /// <returns></returns>
        public static List <string> QueryBarcodeInfo2(string door)
        {
            string    Sql = string.Format(@"SELECT * FROM[db_ND10L].[dbo].[dbo.tb_RnuInfo] WHERE Door = '{0}'", door);
            DataTable bt  = SqlServerHelp.Query(Sql).Tables[0];

            Barcode2 = bt.Rows[0]["Barcode2"].ToString();
            string[]      list     = InterceptStringHelp.SingleCharacter(bt.Rows[0]["BarcodeInclude2"].ToString().Trim());
            List <string> listTemp = new List <string>();

            foreach (string s in list)
            {
                if (string.IsNullOrEmpty(s))
                {
                    continue;
                }
                listTemp.Add(s);
            }
            return(listTemp);
        }
예제 #3
0
        /// <summary>
        /// 霍尼韦尼扫码返回  例如炉门41 67 69 6E 67 30 30 34 0D (30 30 34为有效数字)
        /// </summary>
        /// <param name="NewData"></param>
        /// <returns></returns>
        private static void UpdateRecevie(string NewData)
        {
            string Value        = "";
            string ValueAddress = "";
            int    Address      = 0;

            NewData = NewData.Replace(" ", "");//剔除空格
            try
            {
                if (NewData.Length == 18)//当前扫码到的值为炉门号41 67 69 6E 67 30 30 34 0D
                {
                    Value = InterceptStringHelp.ExtractString(NewData, 10, 6);
                    for (int i = 0; i < Value.Length / 2; i++)
                    {
                        Address       = PLCSocket.DecimalConversion.HexToTen(NewData.Substring(10 + (i * 2), 2)); // 十六进制转10进制
                        ValueAddress += ((char)Address).ToString();                                               // 十进制转acsii码
                    }
                    delegateAddress fc = new delegateAddress(DoorBarCodeAddress);
                    ControlHelp.ControlHelp.Resource.Invoke(fc, SySetHeip.Prefix.Trim() + ValueAddress); //通过代理调用刷新方法
                }
                if (NewData.Length == 14)                                                                //当前扫码到的值为小车号  小车条码号4C31303031320D
                {
                    Value = InterceptStringHelp.ExtractString(NewData, 6, 6);;
                    for (int i = 0; i < Value.Length / 2; i++)
                    {
                        Address       = PLCSocket.DecimalConversion.HexToTen(NewData.Substring(6 + (i * 2), 2)); // 十六进制转10进制
                        ValueAddress += ((char)Address).ToString();                                              // 十进制转acsii码
                    }
                    SedanBarCode = SySetHeip.Prefix.Trim() + ValueAddress;
                    delegateAddress fc = new delegateAddress(Voluation);
                    ControlHelp.ControlHelp.BarCode1.Invoke(fc, SySetHeip.Prefix.Trim() + ValueAddress); //通过代理调用刷新方法
                }
            }
            catch (Exception ex)
            { MessageBox.Show(ex.Message); }
        }
예제 #4
0
        /// <summary>
        ///  霍尼韦尼扫码返回  例如炉门41 67 69 6E 67 30 30 34 0D (30 30 34为有效数字)
        /// </summary>
        /// <param name="NewData"></param>
        public void UpdateRecevie(string NewData)
        {
            string Value        = "";
            string ValueAddress = "";
            int    Address      = 0;

            if (this.InvokeRequired)//等待异步
            {
                UpdateString _myInvoke = new UpdateString(UpdateRecevie);
                this.Invoke(_myInvoke, new object[] { NewData });
            }
            else
            {
                NewData = NewData.Replace(" ", ""); //剔除空格
                if (NewData.Length == 18)           //当前扫码到的值为炉门号41 67 69 6E 67 30 30 34 0D
                {
                    Value = InterceptStringHelp.ExtractString(NewData, 10, 6);
                    for (int i = 0; i < Value.Length / 2; i++)
                    {
                        Address       = DecimalConversion.HexToTen(NewData.Substring(10 + (i * 2), 2)); // 十六进制转10进制
                        ValueAddress += ((char)Address).ToString();                                     // 十进制转acsii码
                    }
                    if (SySetHeip.Prefix.Trim() + ValueAddress == "L10001")                             //扫到哪一个炉门,自动选择该门
                    {
                        OperateShow.Text = "当前1号门操作";
                        DictionaryHelp.Dictionary["Operater1"]();
                    }
                    else if (SySetHeip.Prefix.Trim() + ValueAddress == "L10002")
                    {
                        OperateShow.Text = "当前2号门操作";
                        DictionaryHelp.Dictionary["Operater2"]();
                    }
                    else if (SySetHeip.Prefix.Trim() + ValueAddress == "L10003")
                    {
                        OperateShow.Text = "当前3号门操作";
                        DictionaryHelp.Dictionary["Operater3"]();
                    }
                    else if (SySetHeip.Prefix.Trim() + ValueAddress == "L10004")
                    {
                        OperateShow.Text = "当前4号门操作";
                        DictionaryHelp.Dictionary["Operater4"]();
                    }
                    else if (SySetHeip.Prefix.Trim() + ValueAddress == "L10005")
                    {
                        OperateShow.Text = "当前5号门操作";
                        DictionaryHelp.Dictionary["Operater5"]();
                    }
                    else if (SySetHeip.Prefix.Trim() + ValueAddress == "L10006")
                    {
                        OperateShow.Text = "当前6号门操作";
                        DictionaryHelp.Dictionary["Operater6"]();
                    }
                    else if (SySetHeip.Prefix.Trim() + ValueAddress == "L10007")
                    {
                        OperateShow.Text = "当前7号门操作";
                        DictionaryHelp.Dictionary["Operater7"]();
                    }
                    else if (SySetHeip.Prefix.Trim() + ValueAddress == "L10008")
                    {
                        OperateShow.Text = "当前8号门操作";
                        DictionaryHelp.Dictionary["Operater8"]();
                    }
                }
                if (NewData.Length == 14)//当前扫码到的值为小车号  小车条码号4C31303031320D
                {
                    Value = InterceptStringHelp.ExtractString(NewData, 6, 6);;
                    for (int i = 0; i < Value.Length / 2; i++)
                    {
                        Address       = DecimalConversion.HexToTen(NewData.Substring(6 + (i * 2), 2)); // 十六进制转10进制
                        ValueAddress += ((char)Address).ToString();                                    // 十进制转acsii码
                    }
                    if (!string.IsNullOrEmpty(BarCode1.Text) && !string.IsNullOrEmpty(BarCode2.Text))
                    {
                        BarCode1.Text = "";
                        BarCode2.Text = "";
                    }
                    if (string.IsNullOrEmpty(BarCode1.Text))
                    {
                        BarCode1.Text = SySetHeip.Prefix.Trim() + ValueAddress;
                        ValueAddress  = "";
                    }
                    else
                    {
                        BarCode2.Text = SySetHeip.Prefix.Trim() + ValueAddress;
                        ValueAddress  = "";
                    }
                    if (BarCode1.Text == BarCode2.Text)
                    {
                        Common.Msg.Warning("不能绑定两个相同的条码");
                        BarCode2.Text = "";
                    }
                }
            }
        }