/// <summary> /// 发送LED显示 /// </summary> /// <param name="carNumber">车号</param> /// <param name="IsGross">是否重磅</param> /// <returns></returns> public string SendUnLoadLED(string carNumber, bool IsGross) { CmcsUnLoadLED unLoadLED = null; /*目前为:车辆按照8个卸煤沟顺序排列,如果8个卸煤沟都有车辆 则显示在右下方为待进入卸煤沟车辆 车辆回皮后清除显示 后期需要加入批次功能, * 同一批次进入同一卸煤沟*/ if (IsGross) //重车 添加车号显示 { unLoadLED = commonDAO.SelfDber.Entity <CmcsUnLoadLED>(string.Format("where CarNumber like '%{0}%' order by UnLoadNumber ", carNumber)); //已经存在 if (unLoadLED != null) { return(unLoadLED.UnLoadName); } unLoadLED = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where IsUse=0 order by UnLoadNumber "); if (unLoadLED == null) { unLoadLED = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where nvl(length(CarNumber),0)<8 order by UnLoadNumber "); } if (unLoadLED == null) { return(""); } if (!string.IsNullOrEmpty(unLoadLED.CarNumber)) { unLoadLED.CarNumber += "|" + carNumber; } else { unLoadLED.CarNumber = carNumber; } unLoadLED.IsUse = 1; if (commonDAO.SelfDber.Update(unLoadLED) > 0 && UpdateLEDShow(unLoadLED)) { return(unLoadLED.UnLoadName); } } else//轻车移除车号显示 { unLoadLED = commonDAO.SelfDber.Entity <CmcsUnLoadLED>(string.Format("where CarNumber like '%{0}%' order by UnLoadNumber ", carNumber)); if (unLoadLED == null) { return(""); } if (!string.IsNullOrEmpty(unLoadLED.CarNumber)) { unLoadLED.CarNumber = unLoadLED.CarNumber.Replace(carNumber, "").Replace("|", ""); } if (string.IsNullOrEmpty(unLoadLED.CarNumber)) { unLoadLED.IsUse = 0; } if (commonDAO.SelfDber.Update(unLoadLED) > 0 && UpdateLEDShow(unLoadLED)) { return(unLoadLED.UnLoadName); } } return(""); }
/// <summary> /// ¼ÓÔØÅäÖà /// </summary> void LoadAppConfig() { txtAppIdentifier.Text = commonAppConfig.AppIdentifier; txtSelfConnStr.Text = commonAppConfig.SelfConnStr; chbStartup.Checked = (commonDAO.GetAppletConfigString("¿ª»úÆô¶¯") == "1"); chkIsNormal.Checked = commonDAO.GetCommonAppletConfigString("ÊÇ·ñPDAÈ·ÈÏ") == "1"; // IO¿ØÖÆÆ÷ iptxtIOIP.Value = commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_IPµØÖ·"); txtIOPort.Text = commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_¶Ë¿Ú"); SelectedComboBoxItem(cmbInductorCoil1Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µØ¸Ð1¶Ë¿Ú")); SelectedComboBoxItem(cmbInductorCoil2Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µØ¸Ð2¶Ë¿Ú")); SelectedComboBoxItem(cmbInductorCoil3Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µØ¸Ð3¶Ë¿Ú")); SelectedComboBoxItem(cmbInductorCoil4Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µØ¸Ð4¶Ë¿Ú")); SelectedComboBoxItem(cmbInfraredSensor1Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_¶ÔÉä1¶Ë¿Ú")); SelectedComboBoxItem(cmbInfraredSensor2Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_¶ÔÉä2¶Ë¿Ú")); SelectedComboBoxItem(cmbGate1UpPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µÀÕ¢1Éý¸Ë¶Ë¿Ú")); SelectedComboBoxItem(cmbGate1DownPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µÀÕ¢1½µ¸Ë¶Ë¿Ú")); SelectedComboBoxItem(cmbGate2UpPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µÀÕ¢2Éý¸Ë¶Ë¿Ú")); SelectedComboBoxItem(cmbGate2DownPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_µÀÕ¢2½µ¸Ë¶Ë¿Ú")); SelectedComboBoxItem(cmbSignalLight1Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_ÐźŵÆ1¶Ë¿Ú")); SelectedComboBoxItem(cmbSignalLight2Port, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_ÐźŵÆ2¶Ë¿Ú")); SelectedComboBoxItem(cmbButtonSensorPort, commonDAO.GetAppletConfigString("IO¿ØÖÆÆ÷_°´Å¥¶Ë¿Ú")); // µØ°õÒDZí SelectedComboBoxItem(cmbWberCom, commonDAO.GetAppletConfigString("µØ°õÒDZí_´®¿Ú")); SelectedComboBoxItem(cmbWberBandrate, commonDAO.GetAppletConfigString("µØ°õÒDZí_²¨ÌØÂÊ")); SelectedComboBoxItem(cmbWberDataBits, commonDAO.GetAppletConfigString("µØ°õÒDZí_Êý¾Ýλ")); SelectedComboBoxItem(cmbWberStopBits, commonDAO.GetAppletConfigString("µØ°õÒDZí_ֹͣλ")); SelectedComboBoxItem(cmbWberParity, commonDAO.GetAppletConfigString("µØ°õÒDZí_УÑéλ")); dbtxtMinWeight.Value = commonDAO.GetAppletConfigDouble("µØ°õÒDZí_×îС³ÆÖØ"); dbGrossTareDiffent.Value = commonDAO.GetCommonAppletConfigDouble("ëƤÖزî"); // LEDÏÔʾÆÁ iptxtLED1IP.Value = commonDAO.GetAppletConfigString("LEDÏÔʾÆÁ1_IPµØÖ·"); // ¶Á¿¨Æ÷Íø¿Ú iptxtRwerIP.Value = commonDAO.GetAppletConfigString("¶Á¿¨Æ÷1_IPµØÖ·"); txtRwerPort.Text = commonDAO.GetAppletConfigString("¶Á¿¨Æ÷1_¶Ë¿Ú"); txtRwerTagStartWith.Text = commonDAO.GetAppletConfigString("¶Á¿¨Æ÷_±êÇ©¹ýÂË"); SelectedComboBoxItem(cmbRwerPower, commonDAO.GetAppletConfigString("¶Á¿¨Æ÷1_¹¦ÂÊ")); //ÉãÏñ»ú //chbUseCamera.Checked = commonDAO.GetAppletConfigString("ÉãÏñ»úÆôÓÃ") == "1"; //CmcsCamare video1 = commonDAO.SelfDber.Entity<CmcsCamare>("where EquipmentCode=:EquipmentCode", new { EquipmentCode = commonAppConfig.AppIdentifier + "ÉãÏñÍ·1" }); //if (video1 != null) //{ // iptxtCamera1IP.Value = video1.Ip; // txtCamera1Port.Text = video1.Port.ToString(); // txtCamera1UserName.Text = video1.UserName; // txtCamera1Pwd.Text = video1.Password; // txtCamera1Channel.Text = video1.Channel.ToString(); //} //CmcsCamare video2 = commonDAO.SelfDber.Entity<CmcsCamare>("where EquipmentCode=:EquipmentCode", new { EquipmentCode = commonAppConfig.AppIdentifier + "ÉãÏñÍ·2" }); //if (video2 != null) //{ // iptxtCamera2IP.Value = video2.Ip; // txtCamera2Port.Text = video2.Port.ToString(); // txtCamera2UserName.Text = video2.UserName; // txtCamera2Pwd.Text = video2.Password; // txtCamera2Channel.Text = video2.Channel.ToString(); //} //жú¹µLED iptxtUnloadLED1.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ1_IPµØÖ·"); iptxtUnloadLED2.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ2_IPµØÖ·"); iptxtUnloadLED3.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ3_IPµØÖ·"); iptxtUnloadLED4.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ4_IPµØÖ·"); iptxtUnloadLED5.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ5_IPµØÖ·"); iptxtUnloadLED6.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ6_IPµØÖ·"); iptxtUnloadLED7.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ7_IPµØÖ·"); iptxtUnloadLED8.Value = commonDAO.GetCommonAppletConfigString("жú¹µLEDÏÔʾÆÁ8_IPµØÖ·"); CmcsUnLoadLED unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=1"); if (unLoadLed != null) { txtUnload1Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED1.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=2"); if (unLoadLed != null) { txtUnload2Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED2.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=3"); if (unLoadLed != null) { txtUnload3Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED3.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=4"); if (unLoadLed != null) { txtUnload4Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED4.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=5"); if (unLoadLed != null) { txtUnload5Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED5.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=6"); if (unLoadLed != null) { txtUnload6Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED6.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=7"); if (unLoadLed != null) { txtUnload7Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED7.Value = unLoadLed.IP; } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=8"); if (unLoadLed != null) { txtUnload8Number.Text = unLoadLed.UnLoadName; iptxtUnloadLED8.Value = unLoadLed.IP; } }
/// <summary> /// ±£´æÅäÖà /// </summary> bool SaveAppConfig() { if (!TestDBConnect()) { return(false); } commonAppConfig.AppIdentifier = txtAppIdentifier.Text.Trim(); commonAppConfig.SelfConnStr = txtSelfConnStr.Text; commonAppConfig.Save(); commonDAO.SetAppletConfig("¿ª»úÆô¶¯", Convert.ToInt16(chbStartup.Checked).ToString()); commonDAO.SetCommonAppletConfig("ÊÇ·ñPDAÈ·ÈÏ", chkIsNormal.Checked ? "1" : "0"); try { #if DEBUG #else // Ìí¼Ó¡¢È¡Ïû¿ª»úÆô¶¯ if (chbStartup.Checked) { StartUpUtil.InsertStartUp(Application.ProductName, Application.ExecutablePath); } else { StartUpUtil.DeleteStartUp(Application.ProductName); } #endif } catch { } // IO¿ØÖÆÆ÷ commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_IPµØÖ·", iptxtIOIP.Value); commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_¶Ë¿Ú", txtIOPort.Text); commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µØ¸Ð1¶Ë¿Ú", (cmbInductorCoil1Port.SelectedItem as DataItem).Value); commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µØ¸Ð2¶Ë¿Ú", (cmbInductorCoil2Port.SelectedItem as DataItem).Value); commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µØ¸Ð3¶Ë¿Ú", (cmbInductorCoil3Port.SelectedItem as DataItem).Value); commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µØ¸Ð4¶Ë¿Ú", (cmbInductorCoil4Port.SelectedItem as DataItem).Value); commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_¶ÔÉä1¶Ë¿Ú", (cmbInfraredSensor1Port.SelectedItem as DataItem).Value); commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_¶ÔÉä2¶Ë¿Ú", (cmbInfraredSensor2Port.SelectedItem as DataItem).Value); commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µÀÕ¢1Éý¸Ë¶Ë¿Ú", (cmbGate1UpPort.SelectedItem as DataItem).Value); commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µÀÕ¢1½µ¸Ë¶Ë¿Ú", (cmbGate1DownPort.SelectedItem as DataItem).Value); commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µÀÕ¢2Éý¸Ë¶Ë¿Ú", (cmbGate2UpPort.SelectedItem as DataItem).Value); commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_µÀÕ¢2½µ¸Ë¶Ë¿Ú", (cmbGate2DownPort.SelectedItem as DataItem).Value); commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_ÐźŵÆ1¶Ë¿Ú", (cmbSignalLight1Port.SelectedItem as DataItem).Value); commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_ÐźŵÆ2¶Ë¿Ú", (cmbSignalLight2Port.SelectedItem as DataItem).Value); commonDAO.SetAppletConfig("IO¿ØÖÆÆ÷_°´Å¥¶Ë¿Ú", (cmbButtonSensorPort.SelectedItem as DataItem).Value); // µØ°õÒDZí commonDAO.SetAppletConfig("µØ°õÒDZí_´®¿Ú", (cmbWberCom.SelectedItem as DataItem).Value); commonDAO.SetAppletConfig("µØ°õÒDZí_²¨ÌØÂÊ", (cmbWberBandrate.SelectedItem as DataItem).Value); commonDAO.SetAppletConfig("µØ°õÒDZí_Êý¾Ýλ", (cmbWberDataBits.SelectedItem as DataItem).Value); commonDAO.SetAppletConfig("µØ°õÒDZí_ֹͣλ", (cmbWberStopBits.SelectedItem as DataItem).Value); commonDAO.SetAppletConfig("µØ°õÒDZí_УÑéλ", (cmbWberParity.SelectedItem as DataItem).Value); commonDAO.SetAppletConfig("µØ°õÒDZí_×îС³ÆÖØ", dbtxtMinWeight.Value.ToString()); commonDAO.SetCommonAppletConfig("ëƤÖزî", dbGrossTareDiffent.Value.ToString()); // LEDÏÔʾÆÁ commonDAO.SetAppletConfig("LEDÏÔʾÆÁ1_IPµØÖ·", iptxtLED1IP.Value); // ¶Á¿¨Æ÷Íø¿Ú commonDAO.SetAppletConfig("¶Á¿¨Æ÷1_IPµØÖ·", iptxtRwerIP.Value); commonDAO.SetAppletConfig("¶Á¿¨Æ÷1_¶Ë¿Ú", txtRwerPort.Text); commonDAO.SetAppletConfig("¶Á¿¨Æ÷_±êÇ©¹ýÂË", txtRwerTagStartWith.Text); commonDAO.SetAppletConfig("¶Á¿¨Æ÷1_¹¦ÂÊ", (cmbRwerPower.SelectedItem as DataItem).Value); //ÉãÏñ»ú //commonDAO.SetAppletConfig("ÉãÏñ»úÆôÓÃ", chbUseCamera.Checked ? "1" : "0"); //CmcsCamare video1 = commonDAO.SelfDber.Entity<CmcsCamare>("where EquipmentCode=:EquipmentCode", new { EquipmentCode = commonAppConfig.AppIdentifier + "ÉãÏñÍ·1" }); //if (video1 != null) //{ // video1.Ip = iptxtCamera1IP.Value; // video1.Port = Convert.ToInt32(txtCamera1Port.Text); // video1.UserName = txtCamera1UserName.Text; // video1.Password = txtCamera1Pwd.Text; // video1.Channel = Convert.ToInt32(txtCamera1Channel.Text); // commonDAO.SelfDber.Update(video1); //} //else //{ // video1 = new CmcsCamare(); // video1.Ip = iptxtCamera1IP.Value; // video1.Port = Convert.ToInt32(txtCamera1Port.Text); // video1.UserName = txtCamera1UserName.Text; // video1.Password = txtCamera1Pwd.Text; // video1.Channel = Convert.ToInt32(txtCamera1Channel.Text); // video1.ParentId = "-1"; // commonDAO.SelfDber.Insert(video1); //} //CmcsCamare video2 = commonDAO.SelfDber.Entity<CmcsCamare>("where EquipmentCode=:EquipmentCode", new { EquipmentCode = commonAppConfig.AppIdentifier + "ÉãÏñÍ·2" }); //if (video2 != null) //{ // video2.Ip = iptxtCamera2IP.Value; // video2.Port = Convert.ToInt32(txtCamera2Port.Text); // video2.UserName = txtCamera2UserName.Text; // video2.Password = txtCamera2Pwd.Text; // video2.Channel = Convert.ToInt32(txtCamera2Channel.Text); // commonDAO.SelfDber.Update(video2); //} //else //{ // video2 = new CmcsCamare(); // video2.Ip = iptxtCamera2IP.Value; // video2.Port = Convert.ToInt32(txtCamera2Port.Text); // video2.UserName = txtCamera2UserName.Text; // video2.Password = txtCamera2Pwd.Text; // video2.Channel = Convert.ToInt32(txtCamera2Channel.Text); // video1.ParentId = "-1"; // commonDAO.SelfDber.Insert(video2); //} //жú¹µLED //commonDAO.SetCommonAppletConfig("жú¹µLEDÏÔʾÆÁ1_IPµØÖ·", iptxtUnloadLED1.Value); //commonDAO.SetCommonAppletConfig("жú¹µLEDÏÔʾÆÁ2_IPµØÖ·", iptxtUnloadLED2.Value); //commonDAO.SetCommonAppletConfig("жú¹µLEDÏÔʾÆÁ3_IPµØÖ·", iptxtUnloadLED3.Value); //commonDAO.SetCommonAppletConfig("жú¹µLEDÏÔʾÆÁ4_IPµØÖ·", iptxtUnloadLED4.Value); //commonDAO.SetCommonAppletConfig("жú¹µLEDÏÔʾÆÁ5_IPµØÖ·", iptxtUnloadLED5.Value); //commonDAO.SetCommonAppletConfig("жú¹µLEDÏÔʾÆÁ6_IPµØÖ·", iptxtUnloadLED6.Value); //commonDAO.SetCommonAppletConfig("жú¹µLEDÏÔʾÆÁ7_IPµØÖ·", iptxtUnloadLED7.Value); //commonDAO.SetCommonAppletConfig("жú¹µLEDÏÔʾÆÁ8_IPµØÖ·", iptxtUnloadLED8.Value); CmcsUnLoadLED unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=1"); if (unLoadLed != null) { unLoadLed.UnLoadName = txtUnload1Number.Text; unLoadLed.IP = iptxtUnloadLED1.Value; commonDAO.SelfDber.Update(unLoadLed); } else { unLoadLed = new CmcsUnLoadLED(); unLoadLed.UnLoadNumber = 1; unLoadLed.UnLoadName = txtUnload1Number.Text; unLoadLed.IP = iptxtUnloadLED1.Value; unLoadLed.IsUse = 0; commonDAO.SelfDber.Insert(unLoadLed); } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=2"); if (unLoadLed != null) { unLoadLed.UnLoadName = txtUnload2Number.Text; unLoadLed.IP = iptxtUnloadLED2.Value; commonDAO.SelfDber.Update(unLoadLed); } else { unLoadLed = new CmcsUnLoadLED(); unLoadLed.UnLoadNumber = 2; unLoadLed.UnLoadName = txtUnload2Number.Text; unLoadLed.IP = iptxtUnloadLED2.Value; unLoadLed.IsUse = 0; commonDAO.SelfDber.Insert(unLoadLed); } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=3"); if (unLoadLed != null) { unLoadLed.UnLoadName = txtUnload3Number.Text; unLoadLed.IP = iptxtUnloadLED3.Value; commonDAO.SelfDber.Update(unLoadLed); } else { unLoadLed = new CmcsUnLoadLED(); unLoadLed.UnLoadNumber = 3; unLoadLed.UnLoadName = txtUnload3Number.Text; unLoadLed.IP = iptxtUnloadLED3.Value; unLoadLed.IsUse = 0; commonDAO.SelfDber.Insert(unLoadLed); } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=4"); if (unLoadLed != null) { unLoadLed.UnLoadName = txtUnload4Number.Text; unLoadLed.IP = iptxtUnloadLED4.Value; commonDAO.SelfDber.Update(unLoadLed); } else { unLoadLed = new CmcsUnLoadLED(); unLoadLed.UnLoadNumber = 4; unLoadLed.UnLoadName = txtUnload4Number.Text; unLoadLed.IP = iptxtUnloadLED4.Value; unLoadLed.IsUse = 0; commonDAO.SelfDber.Insert(unLoadLed); } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=5"); if (unLoadLed != null) { unLoadLed.UnLoadName = txtUnload5Number.Text; unLoadLed.IP = iptxtUnloadLED5.Value; commonDAO.SelfDber.Update(unLoadLed); } else { unLoadLed = new CmcsUnLoadLED(); unLoadLed.UnLoadNumber = 5; unLoadLed.UnLoadName = txtUnload5Number.Text; unLoadLed.IP = iptxtUnloadLED5.Value; unLoadLed.IsUse = 0; commonDAO.SelfDber.Insert(unLoadLed); } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=6"); if (unLoadLed != null) { unLoadLed.UnLoadName = txtUnload6Number.Text; unLoadLed.IP = iptxtUnloadLED6.Value; commonDAO.SelfDber.Update(unLoadLed); } else { unLoadLed = new CmcsUnLoadLED(); unLoadLed.UnLoadNumber = 6; unLoadLed.UnLoadName = txtUnload6Number.Text; unLoadLed.IP = iptxtUnloadLED6.Value; unLoadLed.IsUse = 0; commonDAO.SelfDber.Insert(unLoadLed); } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=7"); if (unLoadLed != null) { unLoadLed.UnLoadName = txtUnload7Number.Text; unLoadLed.IP = iptxtUnloadLED7.Value; commonDAO.SelfDber.Update(unLoadLed); } else { unLoadLed = new CmcsUnLoadLED(); unLoadLed.UnLoadNumber = 7; unLoadLed.UnLoadName = txtUnload7Number.Text; unLoadLed.IP = iptxtUnloadLED7.Value; unLoadLed.IsUse = 0; commonDAO.SelfDber.Insert(unLoadLed); } unLoadLed = commonDAO.SelfDber.Entity <CmcsUnLoadLED>("where UnLoadNumber=8"); if (unLoadLed != null) { unLoadLed.UnLoadName = txtUnload8Number.Text; unLoadLed.IP = iptxtUnloadLED8.Value; commonDAO.SelfDber.Update(unLoadLed); } else { unLoadLed = new CmcsUnLoadLED(); unLoadLed.UnLoadNumber = 8; unLoadLed.UnLoadName = txtUnload8Number.Text; unLoadLed.IP = iptxtUnloadLED8.Value; unLoadLed.IsUse = 0; commonDAO.SelfDber.Insert(unLoadLed); } return(true); }
/// <summary> /// 更新卸煤沟LED /// </summary> /// <param name="carNumber">车牌号</param> /// <param name="isAdd">是否显示</param> public bool UpdateLEDShow(CmcsUnLoadLED unLoadLED) { if (unLoadLED == null) { return(false); } string carNumber1 = string.Empty, carNumber2 = string.Empty; if (!string.IsNullOrEmpty(unLoadLED.CarNumber)) { string[] carNumbers = unLoadLED.CarNumber.Split('|'); carNumber1 = carNumbers[0]; if (carNumbers.Length == 2) { carNumber2 = carNumbers[1]; } } #region LED控制卡 string led1SocketIP = unLoadLED.IP; if (!string.IsNullOrEmpty(led1SocketIP)) { if (YB14DynamicAreaLeder.PingReplyTest(led1SocketIP)) { //初始化之前先重置屏幕区域 //YB14DynamicAreaLeder.SendDeleteDynamicAreasCommand(this.LED1nScreenNo, 1, string.Format("{0},{1},{2}", this.LED1DYArea_ID1, this.LED1DYArea_ID2, this.LED1DYArea_ID3)); YB14DynamicAreaLeder.DeleteScreen(this.LED1nScreenNo); int nResult = YB14DynamicAreaLeder.AddScreen(YB14DynamicAreaLeder.CONTROLLER_BX_5E1, this.LED1nScreenNo, YB14DynamicAreaLeder.SEND_MODE_NETWORK, 192, 64, 1, 1, "", 0, led1SocketIP, 5005, ""); if (nResult == YB14DynamicAreaLeder.RETURN_NOERROR) { //屏幕分为3个区域 左 64*64 右上 128*32 右下 128*32 #region 左 nResult = YB14DynamicAreaLeder.AddScreenDynamicArea(this.LED1nScreenNo, this.LED1DYArea_ID1, 0, 10, 1, "", 0, 0, 0, 64, 64, 255, 0, 255, 7, 6, 1); if (nResult == YB14DynamicAreaLeder.RETURN_NOERROR) { nResult = YB14DynamicAreaLeder.AddScreenDynamicAreaFile(this.LED1nScreenNo, this.LED1DYArea_ID1, this.LED1TempFile, 0, "宋体", 48, 0, 120, 1, 3, 0); if (nResult == YB14DynamicAreaLeder.RETURN_NOERROR) { // 初始化成功 this.LED1ConnectStatus = true; } else { this.LED1ConnectStatus = false; Log4Neter.Error("初始化卸煤沟LED控制卡", new Exception(YB14DynamicAreaLeder.GetErrorMessage("AddScreenDynamicAreaFile", nResult))); } } #endregion #region 右上 nResult = YB14DynamicAreaLeder.AddScreenDynamicArea(this.LED1nScreenNo, this.LED1DYArea_ID2, 0, 10, 1, "", 0, 64, 0, 128, 32, 255, 0, 255, 7, 6, 1); if (nResult == YB14DynamicAreaLeder.RETURN_NOERROR) { nResult = YB14DynamicAreaLeder.AddScreenDynamicAreaFile(this.LED1nScreenNo, this.LED1DYArea_ID2, this.LED2TempFile, 0, "宋体", 22, 0, 120, 1, 3, 0); if (nResult == YB14DynamicAreaLeder.RETURN_NOERROR) { // 初始化成功 this.LED1ConnectStatus = true; } else { this.LED1ConnectStatus = false; Log4Neter.Error("初始化卸煤沟LED控制卡", new Exception(YB14DynamicAreaLeder.GetErrorMessage("AddScreenDynamicAreaFile", nResult))); } } #endregion #region 右下 nResult = YB14DynamicAreaLeder.AddScreenDynamicArea(this.LED1nScreenNo, this.LED1DYArea_ID3, 0, 10, 1, "", 0, 64, 32, 128, 32, 255, 0, 255, 7, 6, 1); if (nResult == YB14DynamicAreaLeder.RETURN_NOERROR) { nResult = YB14DynamicAreaLeder.AddScreenDynamicAreaFile(this.LED1nScreenNo, this.LED1DYArea_ID3, this.LED3TempFile, 0, "宋体", 22, 0, 120, 1, 3, 0); if (nResult == YB14DynamicAreaLeder.RETURN_NOERROR) { // 初始化成功 this.LED1ConnectStatus = true; } else { this.LED1ConnectStatus = false; Log4Neter.Error("初始化卸煤沟LED控制卡", new Exception(YB14DynamicAreaLeder.GetErrorMessage("AddScreenDynamicAreaFile", nResult))); } } else { this.LED1ConnectStatus = false; Log4Neter.Error("初始化卸煤沟LED控制卡", new Exception(YB14DynamicAreaLeder.GetErrorMessage("AddScreenDynamicArea", nResult))); } #endregion } else { this.LED1ConnectStatus = false; Log4Neter.Error("初始化卸煤沟LED控制卡", new Exception(YB14DynamicAreaLeder.GetErrorMessage("AddScreen", nResult))); } } else { this.LED1ConnectStatus = false; Log4Neter.Error("初始化卸煤沟LED控制卡", new Exception("网络连接失败")); } } #endregion if (this.LED1ConnectStatus) { UpdateLed1Show(unLoadLED.UnLoadName, !string.IsNullOrEmpty(carNumber1) ? carNumber1 : "等待车辆", !string.IsNullOrEmpty(carNumber2) ? carNumber2 : "等待车辆"); return(true); } return(false); }