Exemplo n.º 1
0
 /// <summary>
 /// 读取摄像头信息,并创建对应的摄像机图标以及摄像头列表
 /// </summary>
 void Start()
 {
     Instance = this;
     StartCoroutine("LoadMonitorRecord");
     StartCoroutine("LoadVideoPatrolPlanRecord");
     ShiPinSheBeiPanel.GetComponent <UIPanel>().alpha = 0;
 }
Exemplo n.º 2
0
		private void HandleTargetConnectionStateChanged(object sender, TargetConnectionStateChangedEventArgs args)
		{
			if (TargetConnection.IsTargetConnected == false)
			{
				RealTimeMonitor.ApplicationState.ResetApplicationState();
				SimulationState.ResetSimulationProperties();
				RealTimeMonitor.StopPropertyUpdatesTimer();
			}

			bool isSimulationStartToggleButtonEnabled = TargetConnection.IsTargetConnected && SimulationState.IsModelLoadedOnTarget;
			MainScreen.ChangeSimulationStartToggleButtonState(!SimulationState.IsSimulationRunning, isSimulationStartToggleButtonEnabled);
			MainScreen.ChangeRebootButtonState(TargetConnection.IsTargetConnected);
		}
Exemplo n.º 3
0
		private void HandleStartSimulationToggleButtonClicked(object sender, MouseEventArgs args)
		{
			if(SimulationState.IsSimulationRunning) { SimulationState.StopTargetApplication(); }
			else
			{
				SimulationState.StartTargetApplication();
				RealTimeMonitor.StartPropertyUpdatesTimer();
			}

			bool isSimulationStartToggleButtonEnabled = TargetConnection.IsTargetConnected && SimulationState.IsModelLoadedOnTarget;
			MainScreen.ChangeSimulationStartToggleButtonState(!SimulationState.IsSimulationRunning, isSimulationStartToggleButtonEnabled);

			// Update this at the start of every simulation in case the user removed it
			MainScreen.UpdateStopTimeValue(SimulationState.StopTime);
		}
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            MainScreen            mainScreen              = new MainScreen();
            TargetCommunication   targetConnection        = new TargetCommunication();
            RealTimeModel         realTimeModelProperties = new RealTimeModel();
            RealTimeMonitor       realTimeMonitor         = new RealTimeMonitor();
            SimulationEnvironment simulationState         = new SimulationEnvironment();
            TargetFileSystem      targetFileSystem        = new TargetFileSystem();
            RealTimeLogging       realTimeLogger          = new RealTimeLogging();

            CommunicationController communicationController = new CommunicationController(mainScreen, targetConnection);
            RealTimeModelController realTimeModelController = new RealTimeModelController(mainScreen, targetConnection, realTimeModelProperties, simulationState);
            ApplicationController   applicationController   = new ApplicationController(mainScreen, targetConnection, realTimeModelProperties, realTimeMonitor, simulationState);
            FileSystemController    fileSystemController    = new FileSystemController(mainScreen, targetConnection, targetFileSystem, realTimeLogger, simulationState);

            Application.Run(mainScreen);
        }
Exemplo n.º 5
0
		private void HandleLoadModelToggleButtonClicked(object sender, MouseEventArgs args)
		{
			if (SimulationState.IsModelLoadedOnTarget)
			{
				// If the model is already loaded, unload the model and clear the corresponding application data
				SimulationState.UnloadRealTimeModel(TargetConnection);
				RealTimeMonitor.ApplicationState.ResetApplicationState();
				RealTimeMonitor.StopPropertyUpdatesTimer();
			}
			else
			{
				// Otherwise, load the model and create a new application state
				SimulationState.LoadRealTimeModel(TargetConnection, RealTimeModelProperties.RealTimeModelFilePath);
				RealTimeMonitor.ApplicationState = new LoadedApplicationState(SimulationState.LoadedApplication);
			}

			bool clearDataWhenDisabled = true;
			bool isLoadApplicationToggleButtonEnabled = TargetConnection.IsTargetConnected && RealTimeModelProperties.IsModelLocationLoaded;
			bool isApplicationControlsEnabled = TargetConnection.IsTargetConnected && SimulationState.IsModelLoadedOnTarget;
			MainScreen.ChangeLoadApplicationToggleButtonState(SimulationState.IsModelLoadedOnTarget, isLoadApplicationToggleButtonEnabled);
			MainScreen.ChangeLoadedModelRichTextBoxState(isApplicationControlsEnabled, clearDataWhenDisabled);
			MainScreen.ChangeStopTimeRichTextBoxState(isApplicationControlsEnabled, clearDataWhenDisabled);
			MainScreen.ChangeSimulationStartToggleButtonState(!SimulationState.IsSimulationRunning, isApplicationControlsEnabled);
		}
        private void msc_Auto_OnComm(object sender, EventArgs e)
        {
            object objIn;
            objIn = msc_Auto.Input;
            poundValue = poundValue + objIn.ToString();
            if (poundValue.IndexOf('=') > -1 && (poundValue.IndexOf('.') > -1))
            {
                if (poundValue.Length >= 8)
                {
                    if (poundValue.IndexOf('=') == 7)
                    {
                        poundValue = poundValue.Remove(poundValue.IndexOf("="));
                        if (poundValue.IndexOf('-') > -1)
                        {
                            poundValue = "";
                        }
                        else
                        {
                            char[] arr = poundValue.ToCharArray();
                            Array.Reverse(arr);
                            poundValue = new string(arr);

                            lblDigital.Text = string.Format("{0:F2}", Convert.ToDecimal(poundValue));
                            poundValue = "";
                        }
                        //��������ж�
                        this.isCG(Convert.ToDouble(lblDigital.Text));

                        if (strCurrentMenu != "Person")
                        {
                            txtHandDigital.Text = lblDigital.Text;
                        }
                        CountNetWeight();

                        RealTimeMonitor monitor = new RealTimeMonitor();
                        monitor.SendBangChengMessage(lblDigital.Text);
                    }
                }
                else
                {
                    poundValue = "";
                }

            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            strCollCode = this.cmbCollName.SelectedValue.ToString();
            strCoalKindCode = this.cmbCoalKind.SelectedValue.ToString();
            #region
            //------------�жϺ���-����-2010-3-12-----
            if (1 == CMainForm.IsHaveRed)
            {
                if (!CMainForm.IsRightPosition)
                {
                    alarmSound.Alarm("����������");
                    return;
                }
            }
            //----------------------------------------
            #endregion

            CoalTraffic.Model.TT_LoadWeight model = new CoalTraffic.Model.TT_LoadWeight();

            if (strCurrentMenu != "Person")
            {
                model.LoadWeight = Convert.ToDecimal(lblDigital.Text);
                model.NetWeight = Convert.ToDecimal(lblDigital.Text) - Convert.ToDecimal(txtEmptyWeight.Text.Trim());
            }
            else
            {
                #region ��֤���ݵ���ȷ��
                if (txtHandDigital.Text.Trim() != "" && CommonMethod.IsDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim())))
                {
                    if (Convert.ToDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim())) < Convert.ToDecimal(lblDigital.Text.Trim()))
                    {
                        alarmSound.Alarm("��������س���������С�ڰ�������");
                        txtHandDigital.Text = "";
                        return;
                    }
                    else
                    {
                        model.LoadWeight = Convert.ToDecimal(CommonMethod.ToDBC(this.txtHandDigital.Text.Trim()));
                        model.NetWeight = Convert.ToDecimal(CommonMethod.ToDBC(this.txtHandDigital.Text.Trim())) - Convert.ToDecimal(txtEmptyWeight.Text.Trim());
                    }
                }
                else
                {
                    alarmSound.Alarm("��������س�������ʽ����");
                    txtHandDigital.Text = "";
                    return;
                }
                #endregion
            }
            if (model.NetWeight > 0.00m)
            {

                #region ��ȡ����ҵ��ص���Ϣ
                SqlParameter[] parameter =
                {
                    new SqlParameter("@CollCode", SqlDbType.VarChar,10),
                    new SqlParameter("@CoalKindCode", SqlDbType.VarChar,4)
                };

                parameter[0].Value = strCollCode;
                parameter[1].Value = strCoalKindCode;
                DataSet dstColieryAccount = DbHelperSQL.RunProcedure("PT_ColieryAccountJudge", parameter, "ColieryAccount");
                #endregion

                string strLeastValue = dstColieryAccount.Tables["ColieryAccount"].Rows[0]["ReturnValue"].ToString();

                if (strLeastValue == "0") //0���������ɹ���
                {
                    #region ��Ƶץͼ
                    if (StaticParameter.IsVideo == "1")
                    {
                        if (byteFrontImage == null && byteBackImage == null && byteUpImage == null && byteRoomImage == null)
                        {
                            //strFrontImage = Guid.NewGuid().ToString().Replace("-", "");
                            //strBackImage = Guid.NewGuid().ToString().Replace("-", "");
                            //strUpImage = Guid.NewGuid().ToString().Replace("-", "");
                            //strRoomImage = Guid.NewGuid().ToString().Replace("-", "");

                            byteFrontImage = this.videoFrontImage.CapturePic();
                            byteBackImage = this.videoBackImage.CapturePic();
                            byteUpImage = this.videoUpImage.CapturePic();
                            byteRoomImage = this.videoRoomImage.CapturePic();
                        }
                    }
                    #endregion

                    #region ʵ�����س�
                    string strWeightCode = strRoomCode + DateTime.Now.ToString("yyyyMMddHHmmss");
                    model.WeightCode = strWeightCode;
                    model.TrafficCode = cementName;//strWeightCode;
                    model.NavicertCode = strNavicertCode;
                    model.MarkedCardCode = strMardedCardCode;
                    model.RemoteCardCode = strRemoteCode;

                    model.CollCode = strCollCode;
                    model.CollName = this.cmbCollName.Text;
                    model.CoalKindCode = this.strCoalKindCode;
                    //���� 2010-05-19 ѡ���Ʒ�ij�������
                    model.CoalKindName = this.cmbCoalKind.Text;
                    //model.CoalKindName = this.txtKindName.Text.Trim();
                    model.CarOwnerName = strCarOwnerName;

                    model.CarNo = txtCarNo.Text;
                    model.CarType = txtCarType.Text;
                    model.EmptyWeight = Convert.ToDecimal(txtEmptyWeight.Text);

                    model.OverWeight = 0;
                    model.RoomCode = strRoomCode;
                    model.RoomName = strRoomName;
                    model.BangType = strBangType;
                    model.Operator = StaticParameter.UserName;

                    model.WeightTime = DateTime.Now;
                    model.RandomCode = CommonMethod.getRandom(4);
                    model.CustomerName = "ˮ��ȥ��";
                    model.IsFirstSite = "1";
                    model.TaxType = "�س�������˰";

                    model.FrontImage = strFrontImage;
                    model.BackImage = strBackImage;
                    model.UpImage = strUpImage;
                    model.RoomImage = strRoomImage;
                    model.FrontImageContent = byteFrontImage;

                    model.BackImageContent = byteBackImage;
                    model.UpImageContent = byteUpImage;
                    model.RoomImageContent = byteRoomImage;
                    model.TaxObject = ConfigurationManager.AppSettings["TaxObject"].ToString();
                    model.EmptyCode = strEmptyCode;
                    #endregion

                    if (bll.Add(model) != "")
                    {
                        if (bll.Add(model) != "-1")
                        {
                            #region ��ӳɹ���������ͬ��
                            try
                            {
                                string strSql = "PT_LoadWeight '" + model.WeightCode + "','" + model.TrafficCode + "','" + model.NavicertCode + "','" + model.MarkedCardCode + "','" + model.RemoteCardCode + "',"
                                 + "'" + model.CollCode + "','" + model.CollName + "','" + model.CoalKindCode + "','" + model.CoalKindName + "','" + model.CarOwnerName + "',"
                                 + "'" + model.CarNo + "','" + model.CarType + "','" + model.LoadWeight + "','" + model.EmptyWeight + "','" + model.NetWeight + "',"
                                 + "'" + model.OverWeight + "','" + model.RoomCode + "','" + model.RoomName + "','" + model.BangType + "','" + model.Operator + "',"
                                 + "'" + model.WeightTime + "','" + model.RandomCode + "','" + model.CustomerName + "','" + model.TaxType + "','" + model.TaxObject + "',"
                                 + "'" + model.IsFirstSite + "','" + model.FrontImage + "','" + model.BackImage + "','" + model.UpImage + "','" + model.RoomImage + "',"
                                 + "null,null,null,null,'" + model.EmptyCode + "'";
                                mq.AddNewSqlText(mq.CheckStation + mq.Prefix + "TT_LoadWeight" + mq.Prefix + mq.AddFlg + mq.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + mq.Prefix + strSql);

                                //����ͼƬ
                                try
                                {
                                    //����ͼƬ ����ashx���ϴ�ͼƬ
                                    System.Net.WebClient webclient = new System.Net.WebClient();
                                    if (byteFrontImage != null)
                                    {
                                        webclient.UploadData(ini.IniReadValue("PicterRoute", "PRoute")+ model.WeightCode + "&filename=1", byteFrontImage);
                                    }
                                    if (byteBackImage != null)
                                    {
                                        webclient.UploadData(ini.IniReadValue("PicterRoute", "PRoute") + model.WeightCode + "&filename=2", byteBackImage);
                                    }
                                    if (byteUpImage != null)
                                    {
                                        webclient.UploadData(ini.IniReadValue("PicterRoute", "PRoute") + model.WeightCode + "&filename=3", byteUpImage);
                                    }
                                    if (byteRoomImage != null)
                                    {
                                        webclient.UploadData(ini.IniReadValue("PicterRoute", "PRoute") + model.WeightCode + "&filename=4", byteRoomImage);
                                    }
                                }
                                catch
                                {

                                }
                                /********************************************************/
                                //Add By ����ӭ ��BSʵʱ��ط�������Ϣ���з����س�������Ϣ
                                /********************************************************/
                                string loadMessage = model.EmptyWeight.ToString() + "," + model.LoadWeight.ToString() + "," + model.NetWeight.ToString() + "," + model.OverWeight.ToString() + "," + model.TaxAmount.ToString() + "," + model.FundAmount.ToString() + "," + model.Operator.ToString() + "," + model.WeightTime.ToString()
                                + "," + model.CarNo.ToString() + "," + model.CarOwnerName.ToString() + "," + model.RoomName.ToString() + "," + model.CollName.ToString() + "," + model.CoalKindName.ToString() + "," +
                                model.NavicertCode.ToString() + "," + model.MarkedCardCode.ToString() + "," + model.RemoteCardCode.ToString() + "," + model.WeightCode.ToString();//������Ϣ��ʽ���ճ�����,�س�����,����,����,˰��,����,������,����ʱ��,���ƺ�,��������,��������,ú������,ú������,׼�˿���,��ʶ����,Զ�̿���,��������
                                RealTimeMonitor monitor = new RealTimeMonitor();//������Ϣ
                                monitor.SendLoadWeightMessage(loadMessage);
                                /********************************************************/

                            }
                            catch { }
                            #endregion

                            string strErro = "";
                            if (StaticParameter.IsHaveMarkedCard == "1")
                            {
                                strErro = "�����ձ�ʶ��";
                            }
                            if (StaticParameter.FormType == "2")  //��Ʊվ�޴�ӡ�� �����ӡ
                            {
                                alarmSound.Alarm("�����ɹ�");
                                CommonMethod.MessageBox("�����ɹ�", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            }
                            else
                            {
                                alarmSound.Alarm("�����ɹ�,���ȷ����ӡ�س�������" + strErro + "");
                                CommonMethod.MessageBox("�����ɹ�,���ȷ����ӡ�س�������" + strErro + "!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                                //�������ó�ر�־λ
                                this.isks = true;

                                Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
                                string strFileName = "";

                                strFileName = StaticParameter.ReportFile;

                                Type type = assembly.GetType("CoalTraffic.Report." + strFileName + "LoadWeightPrint");
                                object obj = Activator.CreateInstance(type, strWeightCode, true); Form formToShow = (Form)obj; formToShow.ShowDialog();
                            }
                        }
                        else
                        {
                            alarmSound.Alarm("�˻�����Ѳ��㱾���Ŀۿ��֪ͨ" + this.cmbCollName.Text.Trim() + "��������");
                        }
                    }
                    else
                    {
                        this.alarmSound.Alarm("��վ�����ݿ��쳣");
                        InsertState = 0;
                        InsertBadReCordInfo("�쳣", txtCarNo.Text.Trim(), strRoomName + "�����ݿ��쳣");
                    }
                }
                else if (strLeastValue == "1")
                {
                    alarmSound.Alarm("��ҵ����������,���ܼ�������");
                }
                else if (strLeastValue == "2")
                {
                    alarmSound.Alarm("����ҵ�������ò�Ʒ,���ܼ�������");
                    InsertState = 0;
                    InsertBadReCordInfo("�쳣", txtCarNo.Text.Trim(), strCollName + "������" + strCoalKindName);
                }
                else if (strLeastValue == "-1")
                {
                    alarmSound.Alarm("����ҵ������,���ܼ�������");
                    InsertState = 0;
                    InsertBadReCordInfo("�쳣", txtCarNo.Text.Trim(), "���Ϊ��" + strCollCode + "����ҵ������");
                }

                btnOK.Enabled = false;
                ClearAll();
                if (StaticParameter.CardType == "IC")
                    icCard.FactoryCodeInitValue = "";
            }
            else
            {
                alarmSound.Alarm("ˮ�ྻ���쳣");
                InsertState = 0;
                InsertBadReCordInfo("�쳣", txtCarNo.Text.Trim(), "���ƺ�Ϊ��" + txtCarNo.Text.Trim() + "������ˮ�ྻ���쳣");
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// �����÷���--��ȡ���ӿؼ���ֵ��������ֵ��ֵ���ؼ�
 /// </summary>
 void SetUIPoundValue()
 {
     if (string.Compare(this.lblDigital.Text, string.Format("{0:F2}", appearance.Weight)) != 0)//�ж��ı�����ʾ������ֵ�Ͱ��ӿؼ���ȡ����ֵ�Dz���ȣ�����0.00��
     {
         this.lblDigital.Text = string.Format("{0:F2}", appearance.Weight);//���ؼ���õ�������ת��Ϊָ����ʽ����ֵ����ʾ�����Ŀؼ�
         ValidateData();//��֤�����Ƿ��ȡ
         #region �˷����Ѿ���ע���ˣ�ͨ����Ϣ���н�������Ϣ����
         RealTimeMonitor monitor = new RealTimeMonitor();//ʵ����������Ϣ������
         //monitor.SendBangChengMessage(appearance.Weight.ToString());
         #endregion
     }
 }
        protected void SetMsComValue()
        {
            if (string.Compare(this.lblDigital.Text, string.Format("{0:F2}", appearance.Weight)) != 0)
            {
            if (appearance.Weight.ToString().Equals("0") || appearance.Weight.ToString().Equals("0.00"))
            {
                lblDigital.Text = "0.00";
            }
            else
            {
                if (CommonMethod.IsNumber(appearance.Weight.ToString()))
                {
                    lblDigital.Text = appearance.Weight.ToString() + ".00";
                }
                else
                {
                    lblDigital.Text = appearance.Weight.ToString();
                }
            }

            if (strCurrentMenu == "Auto")
            {
                txtHandDigital.Text = lblDigital.Text.Trim();
            }

                RealTimeMonitor monitor = new RealTimeMonitor();
                monitor.SendBangChengMessage(lblDigital.Text);
            }
        }
 private void lblDigital_TextChanged(object sender, EventArgs e)
 {
     string IsNorBang = ini.IniReadValue("BcComSetting", "IsNorBang");
     if (IsNorBang == "1")
     {
         RealTimeMonitor monitor = new RealTimeMonitor();
         monitor.SendBangChengMessage(lblDigital.Text);
     }
 }
Exemplo n.º 11
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            Model.TT_BadRecord MBR = new CoalTraffic.Model.TT_BadRecord();
            BLL.TT_BadRecord BBR = new CoalTraffic.BLL.TT_BadRecord();
            Model.TT_LoadWeight MLW = new CoalTraffic.Model.TT_LoadWeight();
            BLL.TT_LoadWeight BLW = new CoalTraffic.BLL.TT_LoadWeight();

            decimal DNetWeight = 0.00m;//根据当前磅秤数据和车皮获得到临时净重---变量

            #region 计算煤炭净重
            if (strCurrentMenu != "Person")
            {
                decimal dDigital, dEmptyWeight;
                if (decimal.TryParse(lblDigital.Text.Trim(), out dDigital) && decimal.TryParse(strEmptyWeight, out dEmptyWeight))//将磅秤的数据(字符串)转为decmal,将空车重量(字符串)转为decmal
                {
                    DNetWeight = Convert.ToDecimal(dDigital - dEmptyWeight);//获得到净重
                }
                else
                {
                    aSound.Alarm("重量数据格式不正确");
                    return;

                }
            }
            else//如果是人工错做,则进行数据校验
            {
                #region 验证数据的正确性
                if (txtHandDigital.Text.Trim() != "" && CommonMethod.IsDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim())))
                {

                    if (Convert.ToDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim())) < Convert.ToDecimal(lblDigital.Text.Trim()))
                    {
                        aSound.Alarm("你输入的重重车量不能小于磅秤重量");
                        txtHandDigital.Text = "";
                        return;
                    }
                    else
                    {
                        DNetWeight = Convert.ToDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim())) - Convert.ToDecimal(strEmptyWeight);
                    }
                }
                else
                {
                    aSound.Alarm("你输入的重车重量格式不对");
                    txtHandDigital.Text = "";
                    return;
                }
                #endregion
            }
            #endregion

            if (DNetWeight > 0.00m)//如果净重大于0,那么就进行视频抓图,重车验票
            {
                #region 视频抓图

                if (StaticParameter.IsVideo == "1")
                {
                    if (byteFrontImage == null && byteBackImage == null && byteUpImage == null && byteRoomImage == null)
                    {
                        strFrontImage = Guid.NewGuid().ToString().Replace("-", "");
                        strBackImage = Guid.NewGuid().ToString().Replace("-", "");
                        strUpImage = Guid.NewGuid().ToString().Replace("-", "");
                        strRoomImage = Guid.NewGuid().ToString().Replace("-", "");

                        byteFrontImage = this.videoFrontImage.CapturePic();
                        byteBackImage = this.videoBackImage.CapturePic();
                        byteUpImage = this.videoUpImage.CapturePic();
                        byteRoomImage = this.videoRoomImage.CapturePic();
                    }
                }
                #endregion

                if (rbCheck.Checked)//重车验票
                {
                    #region 重车验票
                    CoalTraffic.BLL.TT_CheckBang bllCheckBang = new CoalTraffic.BLL.TT_CheckBang();
                    CoalTraffic.Model.TT_CheckBang modelCheckBang = new CoalTraffic.Model.TT_CheckBang();

                    modelCheckBang.RoomCode = strRoomCode;//磅房编号
                    modelCheckBang.NetWeight = DNetWeight;//净重

                    #region 监察该重车是否已经验票
                    bool bolChecked = bllCheckBang.IsChecked(strTrafficCode, modelCheckBang.RoomCode);
                    #endregion

                    decimal dOverWeight = 0.0m;//超重
                    decimal DLimitWeight = 0.0m;//限定重量
                    /*验票站的:通过为1,不通过为0*/
                    if (bolChecked)
                    {
                        modelCheckBang.CheckResult = "重车验票不通过,该过磅单在本磅房中已检验过";
                        modelCheckBang.IsPassed = "0";
                    }
                    else//是第一次验票
                    {
                        #region 验证验证码是否正确
                        if (CommonMethod.ToDBC(this.txtRandCode.Text.Trim()) != strRandomCode && iCount < iTryAgainTime)
                        {
                            //总共是三次机会来输入验证码
                            CommonMethod.MessageBox("您输入的验证码不正确,请重新输入,您还有" + (iTryAgainTime - iCount) + "次输入机会", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            //aSound.Alarm("您输入的验证码不正确,请重新输入,您还有" + (iTryAgainTime - iCount) + "次输入机会");
                            txtRandCode.Text = "";
                            btnOK.Enabled = false;
                            iCount++;
                            return;
                        }//验证码错误并且已经输入3次都是错误,就验票不通过。
                        else if (CommonMethod.ToDBC(this.txtRandCode.Text.Trim()) != strRandomCode && iCount == iTryAgainTime)
                        {
                            modelCheckBang.CheckResult = "重车验票不通过,验票单可能造假"; //验票结果:通过 or 不通过
                            modelCheckBang.IsPassed = "0";
                        }//验证码输入正确
                        else if (CommonMethod.ToDBC(this.txtRandCode.Text.Trim()) == strRandomCode)
                        {
                            modelCheckBang.CheckResult = "重车验票通过";
                            modelCheckBang.IsPassed = "1";
                        }
                        #endregion
                    }

                    #region 实例化检票
                    modelCheckBang.CheckCode = Guid.NewGuid().ToString().Replace("-", "");
                    modelCheckBang.CheckTime = DateTime.Now;
                    modelCheckBang.Operator = StaticParameter.UserName;
                    modelCheckBang.MarkedCardCode = strMardedCardCode;
                    modelCheckBang.NavicertCode = strNavicertCode;
                    modelCheckBang.WeightCode = this.strTrafficCode;

                    modelCheckBang.FrontImage = strFrontImage;
                    modelCheckBang.BackImage = strBackImage;
                    modelCheckBang.UpImage = strUpImage;
                    modelCheckBang.RoomImage = strRoomImage;

                    modelCheckBang.FrontImageContent = byteFrontImage;
                    modelCheckBang.BackImageContent = byteBackImage;
                    modelCheckBang.UpImageContent = byteUpImage;
                    modelCheckBang.RoomImageContent = byteRoomImage;

                    #endregion

                    if (modelCheckBang.IsPassed == "0")//验票不通过,将不通过的信息,插入报警信息
                    {
                        InsertState = 0;
                        InsertBadReCordInfo("不通过", modelCheckBang.CheckResult);//添加验票失败的报警信息,并同步到机房
                    }
                    else//验票通过(验证码等信息通过)
                    {
                        #region 获取最大重车重量
                        //根据运输编号找到该车的过磅重量(最新的)
                        string strsql = "select max(LoadWeight) from TT_LoadWeight where TrafficCode ='" + strTrafficCode + "'";

                        object OMLoadWeight = DbHelperSQL.GetSingle(strsql);

                        if (strCurrentMenu != "Person")//不是人工过磅,获取该车的超重信息
                        {
                            dOverWeight = decimal.Parse(lblDigital.Text.Trim()) - decimal.Parse(OMLoadWeight.ToString());
                        }
                        else//人工过磅,获取该车的超重信息
                        {
                            dOverWeight = Convert.ToDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim())) - Convert.ToDecimal(OMLoadWeight.ToString());
                        }

                        DLimitWeight = StaticParameter.WeightThreshold;//获取配置文件中限定重量
                        #endregion

                        if (dOverWeight >= DLimitWeight)//超重的重量大于限定的重量,再次扣除超重的税费(MLW)
                        {
                            #region 实例化重车过磅(由于超重)
                            string strWeightCode = strRoomCode + DateTime.Now.ToString("yyyyMMddHHmmss");
                            MLW.WeightCode = strWeightCode;
                            MLW.TrafficCode = strTrafficCode;
                            MLW.NavicertCode = strNavicertCode;
                            MLW.MarkedCardCode = strMardedCardCode;
                            MLW.RemoteCardCode = strRemoteCode;

                            MLW.CollCode = strCollCode;
                            MLW.CollName = this.cmbCollName.Text.Trim();
                            MLW.CoalKindCode = this.cmbCoalKind.SelectedValue.ToString();
                            MLW.CoalKindName = this.cmbCoalKind.Text.Trim();

                            MLW.CarOwnerName = txtCarOwner.Text.Trim();
                            MLW.CarNo = txtCarNo.Text.Trim();
                            MLW.CarType = txtCarType.Text.Trim();
                            if (strCurrentMenu != "Person")
                            {
                                MLW.LoadWeight = decimal.Parse(lblDigital.Text.Trim());
                            }
                            else
                            {
                                MLW.LoadWeight = Convert.ToDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim()));
                            }
                            //MLW.EmptyWeight = decimal.Parse(lblEmptyWeight.Text.Trim());
                            MLW.EmptyWeight = decimal.Parse(txtEmptyWeight.Text.Replace("吨", "").Trim());
                            MLW.NetWeight = 0.0m;

                            MLW.OverWeight = decimal.Parse(dOverWeight.ToString());
                            MLW.RoomCode = strRoomCode;
                            MLW.RoomName = strRoomName;
                            MLW.BangType = "重车" + strBangType + "验票";
                            MLW.Operator = StaticParameter.UserName;

                            MLW.WeightTime = DateTime.Now;
                            MLW.RandomCode = CommonMethod.getRandom(4);
                            MLW.CustomerName = "运煤去向";
                            MLW.TaxType = "重车补扣税费";
                            MLW.IsFirstSite = "0";

                            MLW.FrontImage = Guid.NewGuid().ToString().Replace("-", "");
                            MLW.BackImage = Guid.NewGuid().ToString().Replace("-", "");
                            MLW.UpImage = Guid.NewGuid().ToString().Replace("-", "");
                            MLW.RoomImage = Guid.NewGuid().ToString().Replace("-", "");
                            MLW.FrontImageContent = byteFrontImage;

                            MLW.BackImageContent = byteBackImage;
                            MLW.UpImageContent = byteUpImage;
                            MLW.RoomImageContent = byteRoomImage;
                            MLW.TaxObject = ini.IniReadValue("GFSet", "TaxObject");//扣费标准:1以磅房来算,2以煤矿来算,3以片区来算——————ypf20130519
                            MLW.EmptyCode = strEmptyCode;
                            #endregion
                        }
                    }

                    bool ISSound = false;
                    bool IsLoadWeight = true;

                    #region 超重扣税功能---此处将其注释。(王双峰要求)
                    //if ((dOverWeight >= DLimitWeight) && (dOverWeight != 0.0m))//超重的重量大于限定的重量
                    //{
                    //    #region 添加重车(由于超重)过磅记录
                    //    if (BLW.Add(MLW) != "")//添加超重的信息到重车过磅表中,将数据添加到本地数据库
                    //    {
                    //        ISSound = true;

                    //        if (BLW.Add(MLW) != "-1")
                    //        {
                    //            #region 数据上传,更新到服务器,并有服务器进行各个磅房更新

                    //            string strSql = "PT_LoadWeight '" + MLW.WeightCode + "','" + MLW.TrafficCode + "','" + MLW.NavicertCode + "','" + MLW.MarkedCardCode + "','" + MLW.RemoteCardCode + "',"
                    //          + "'" + MLW.CollCode + "','" + MLW.CollName + "','" + MLW.CoalKindCode + "','" + MLW.CoalKindName + "','" + MLW.CarOwnerName + "',"
                    //          + "'" + MLW.CarNo + "','" + MLW.CarType + "','" + MLW.LoadWeight + "','" + MLW.EmptyWeight + "','" + MLW.NetWeight + "',"
                    //          + "'" + MLW.OverWeight + "','" + MLW.RoomCode + "','" + MLW.RoomName + "','" + MLW.BangType + "','" + MLW.Operator + "',"
                    //          + "'" + MLW.WeightTime + "','" + MLW.RandomCode + "','" + MLW.CustomerName + "','" + MLW.TaxType + "','" + MLW.TaxObject + "',"
                    //          + "'" + MLW.IsFirstSite + "','" + MLW.FrontImage + "','" + MLW.BackImage + "','" + MLW.UpImage + "','" + MLW.RoomImage + "',null,null,null,null,'" + MLW.EmptyCode + "'";
                    //            MC.AddNewSqlText(MC.AllStation + MC.Prefix + "TT_LoadWeight" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + strSql);

                    //            //发送图片
                    //            string strIsSendPicToRoom = StaticParameter.IsSendPicToRoom;
                    //            int iSend = MC.ServerStation;
                    //            //是否发送磅房
                    //            if (strIsSendPicToRoom == "1")
                    //                iSend = MC.CheckStation;
                    //            string strPic = "";
                    //            if (MLW.FrontImageContent != null)
                    //            {
                    //                strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                    //                    + MLW.FrontImage + ",jpg," + Convert.ToBase64String(MLW.FrontImageContent, 0, MLW.FrontImageContent.Length);
                    //                MC.AddNewSqlText(strPic);
                    //            }
                    //            if (MLW.BackImageContent != null)
                    //            {
                    //                strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                    //                    + MLW.BackImage + ",jpg," + Convert.ToBase64String(MLW.BackImageContent, 0, MLW.BackImageContent.Length);
                    //                MC.AddNewSqlText(strPic);
                    //            }
                    //            if (MLW.UpImageContent != null)
                    //            {
                    //                strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                    //                    + MLW.UpImage + ",jpg," + Convert.ToBase64String(MLW.UpImageContent, 0, MLW.UpImageContent.Length);
                    //                MC.AddNewSqlText(strPic);
                    //            }
                    //            if (MLW.RoomImageContent != null)
                    //            {
                    //                strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                    //                    + MLW.RoomImage + ",jpg," + Convert.ToBase64String(MLW.RoomImageContent, 0, MLW.RoomImageContent.Length);
                    //                MC.AddNewSqlText(strPic);
                    //            }
                    //            /********************************************************/
                    //            //Add By 鲍永迎 向BS实时监控服务器消息队列发送重车过磅消息
                    //            /********************************************************/
                    //            //string loadMessage = MLW.RoomName + "," + MLW.LoadWeight + "," + MLW.CoalKindName + "," + MLW.NavicertCode + "," + MLW.NetWeight.ToString() + "," + MLW.WeightTime.ToString();//定义消息格式:磅房名称,车主姓名,煤种名称,准运卡号,煤炭净重,过磅时间
                    //            //RealTimeMonitor monitor = new RealTimeMonitor();//发送消息
                    //            //monitor.SendLoadWeightMessage(loadMessage);

                    //            //冯磊 2010-05-18 修改向BS实时监控服务器消息队列发送重车过磅消息
                    //            string loadMessage = MLW.EmptyWeight.ToString() + "," + MLW.LoadWeight.ToString() + "," + MLW.NetWeight.ToString() + "," + MLW.OverWeight.ToString() + "," + MLW.TaxAmount.ToString() + "," + MLW.FundAmount.ToString() + "," + MLW.Operator.ToString() + "," + MLW.WeightTime.ToString()
                    //                + "," + MLW.CarNo.ToString() + "," + MLW.CarOwnerName.ToString() + "," + MLW.RoomName.ToString() + "," + MLW.CollName.ToString() + "," + MLW.CoalKindName.ToString() + "," +
                    //                MLW.NavicertCode.ToString() + "," + MLW.MarkedCardCode.ToString() + "," + MLW.RemoteCardCode.ToString() + "," + MLW.WeightCode.ToString();//定义消息格式:空车重量,重车重量,净重,超重,税费,基金,操作人,过磅时间,车牌号,车主姓名,磅房名称,煤矿名称,煤种名称,准运卡号,标识卡号,远程卡号,过磅单号
                    //            RealTimeMonitor monitor = new RealTimeMonitor();//发送消息
                    //            monitor.SendLoadWeightMessage(loadMessage);
                    //            /********************************************************/
                    //            #endregion//

                    //            if (strMardedCardCode != "" && ini.IniReadValue("RoomSetting", "IsHaveMarkedCard") == "1")
                    //            {
                    //                aSound.Alarm("重车验票过磅通过,点击确定打印重车验票过磅单 并且回收标识卡");
                    //                CommonMethod.MessageBox("重车过磅验票通过,点击确定打印重车验票过磅单并且回收标识卡!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    //            }
                    //            else
                    //            {
                    //                aSound.Alarm("重车验票过磅通过,点击确定打印重车验票过磅单");
                    //                CommonMethod.MessageBox("重车过磅验票通过,点击确定打印重车验票过磅单!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    //            }

                    //            //设置扣税标志位
                    //            this.isks = true;
                    //            #region 打印相关
                    //            Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
                    //            string strFileName = "";
                    //            if (StaticParameter.ReportFile == "FuYuan.")
                    //            {
                    //                strFileName = "ZiChang.";
                    //            }
                    //            else
                    //            {
                    //                strFileName = StaticParameter.ReportFile;
                    //            }
                    //            Type type = assembly.GetType("CoalTraffic.Report." + strFileName + "CheckLoadWeightPrint");
                    //            object obj = Activator.CreateInstance(type, MLW.WeightCode, true);
                    //            Form formToShow = (Form)obj;
                    //            formToShow.ShowDialog();
                    //            #endregion
                    //        }
                    //        else
                    //        {
                    //            aSound.Alarm("账户余额已不足本车的扣款,请通知" + cmbCollName.Text.Trim() + "速来交费");
                    //            IsLoadWeight = false;
                    //        }
                    //    }
                    //    else
                    //    {
                    //        this.aSound.Alarm("该站的数据库异常");
                    //        InsertState = 0;
                    //        InsertBadReCordInfo("异常", strRoomName + "的数据库异常");
                    //    }
                    //    #endregion
                    //}
                    #endregion

                    #region 添加验票信息
                    string isConnection = ini.IniReadValue("Connection", "isConnection");
                    if (IsLoadWeight)
                    {

                        if (bllCheckBang.Add(modelCheckBang) != "")
                        {
                            #region 数据上传
                            try
                            {
                                StringBuilder sbInsertCheckBang = new StringBuilder();
                                sbInsertCheckBang.Append("PT_CheckBang '" + modelCheckBang.CheckCode + "','" + modelCheckBang.WeightCode + "','" + modelCheckBang.NavicertCode + "',");
                                sbInsertCheckBang.Append("'" + modelCheckBang.MarkedCardCode + "','" + modelCheckBang.NetWeight + "','" + modelCheckBang.RoomCode + "',");
                                sbInsertCheckBang.Append("'" + modelCheckBang.IsPassed + "','" + modelCheckBang.CheckResult + "','" + modelCheckBang.CheckTime + "',");
                                sbInsertCheckBang.Append("'" + modelCheckBang.Operator + "','" + modelCheckBang.FrontImage + "',null,");
                                sbInsertCheckBang.Append("'" + modelCheckBang.BackImage + "',null,'" + modelCheckBang.UpImage + "',");
                                sbInsertCheckBang.Append("null,'" + modelCheckBang.RoomImage + "',null");
                                if (isConnection == "0")
                                {
                                    mqServer.AddMsmq(MC.AllStation + MC.Prefix + "TT_CheckBang" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + sbInsertCheckBang.ToString());
                                }
                                else
                                {
                                    MC.AddNewSqlText(MC.AllStation + MC.Prefix + "TT_CheckBang" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + sbInsertCheckBang.ToString());
                                }
                                    //发送图片
                                string strIsSendPicToRoom = StaticParameter.IsSendPicToRoom;
                                int iSend = MC.ServerStation;
                                //是否发送磅房
                                if (strIsSendPicToRoom == "1")
                                    iSend = MC.CheckStation;
                                string strPic = "";
                                if (modelCheckBang.FrontImageContent != null)
                                {
                                    strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                                        + modelCheckBang.FrontImage + ",jpg," + Convert.ToBase64String(modelCheckBang.FrontImageContent, 0, modelCheckBang.FrontImageContent.Length);
                                    if (isConnection == "0")
                                    {
                                        mqServer.AddMsmq(strPic);
                                    }
                                    else
                                    {
                                        MC.AddNewSqlText(strPic);
                                    }
                                }
                                if (modelCheckBang.BackImageContent != null)
                                {
                                    strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                                        + modelCheckBang.BackImage + ",jpg," + Convert.ToBase64String(modelCheckBang.BackImageContent, 0, modelCheckBang.BackImageContent.Length);
                                    if (isConnection == "0")
                                    {
                                        mqServer.AddMsmq(strPic);
                                    }
                                    else
                                    {
                                        MC.AddNewSqlText(strPic);
                                    }
                                }
                                if (modelCheckBang.UpImageContent != null)
                                {
                                    strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                                        + modelCheckBang.UpImage + ",jpg," + Convert.ToBase64String(modelCheckBang.UpImageContent, 0, modelCheckBang.UpImageContent.Length);
                                    if (isConnection == "0")
                                    {
                                        mqServer.AddMsmq(strPic);
                                    }
                                    else
                                    {
                                        MC.AddNewSqlText(strPic);
                                    }
                                }
                                if (modelCheckBang.RoomImageContent != null)
                                {
                                    strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                                        + modelCheckBang.RoomImage + ",jpg," + Convert.ToBase64String(modelCheckBang.RoomImageContent, 0, modelCheckBang.RoomImageContent.Length);
                                    if (isConnection == "0")
                                    {
                                        mqServer.AddMsmq(strPic);
                                    }
                                    else
                                    {
                                        MC.AddNewSqlText(strPic);
                                    }
                                }
                                //CoalTraffic.MessagingService.LocalWeightServiceClient localService = new CoalTraffic.MessagingService.LocalWeightServiceClient();
                                //localService.AddCheckBang(modelCheckBang);
                            }
                            catch { }
                            #endregion

                            if (!ISSound)
                            {
                                aSound.Alarm(modelCheckBang.CheckResult);
                            }

                            spRemote.CardCode = "";
                        }
                        else
                        {
                            if (isConnection == "0")
                            {
                                //ini.IniWriteValue("RoomSetting", "IsHaveMarkedCard", CommonMethod.ToDBC("1"));
                                MessageBox.Show("系统与服务器断开连接,请联系中心机房!");
                                Application.ExitThread();
                                Application.Exit();
                            }
                            else
                            {
                                aSound.Alarm("该站的数据库异常");
                                InsertState = 0;
                                InsertBadReCordInfo("异常", strRoomName + "的数据库异常");
                            }
                        }
                    }
                    #endregion

                    #endregion
                }
                else//重车过磅选项
                {
                    #region 重车过磅

                    #region 读取与煤矿相关的信息
                    SqlParameter[] parameter =
                    {
                        new SqlParameter("@CollCode", SqlDbType.VarChar,10),
                        new SqlParameter("@CoalKindCode", SqlDbType.VarChar,4)
                    };

                    parameter[0].Value = strCollCode;
                    parameter[1].Value = strCoalKindCode;
                    DataSet dstColieryAccount = DbHelperSQL.RunProcedure("PT_ColieryAccountJudge", parameter, "ColieryAccount");
                    #endregion

                    string strLeastValue = dstColieryAccount.Tables["ColieryAccount"].Rows[0]["ReturnValue"].ToString();

                    if (strLeastValue == "0") //0:正常,可过磅
                    {
                        if (strCurrentMenu != "Person")
                        {
                            MLW.LoadWeight = decimal.Parse(lblDigital.Text.Trim());
                        }
                        else
                        {
                            MLW.LoadWeight = Convert.ToDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim()));
                        }

                        #region 实例化重车过磅
                        string strWeightCode = strRoomCode + DateTime.Now.ToString("yyyyMMddHHmmss");
                        MLW.WeightCode = strWeightCode;
                        MLW.TrafficCode = strWeightCode;
                        MLW.NavicertCode = strNavicertCode;
                        MLW.MarkedCardCode = strMardedCardCode;
                        MLW.RemoteCardCode = strRemoteCode;

                        MLW.CollCode = strCollCode;
                        MLW.CollName = cmbCollName.Text;
                        MLW.CoalKindCode = cmbCoalKind.SelectedValue.ToString();
                        MLW.CoalKindName = cmbCoalKind.Text;
                        MLW.CarOwnerName = txtCarOwner.Text.Trim();

                        MLW.CarNo = txtCarNo.Text.Trim();
                        MLW.CarType = txtCarType.Text.Trim();

                        MLW.EmptyWeight = decimal.Parse(strEmptyWeight);
                        MLW.NetWeight = MLW.LoadWeight - MLW.EmptyWeight;
                        MLW.OverWeight = 0.00m;

                        MLW.RoomCode = strRoomCode;
                        MLW.RoomName = strRoomName;
                        MLW.BangType = "重车" + strBangType + "过磅";
                        MLW.Operator = StaticParameter.UserName;

                        MLW.WeightTime = DateTime.Now;
                        MLW.RandomCode = CommonMethod.getRandom(4);
                        MLW.CustomerName = "运煤去向";
                        MLW.TaxType = "重车正常扣税";
                        MLW.IsFirstSite = "1";

                        MLW.FrontImage = strFrontImage;
                        MLW.BackImage = strBackImage;
                        MLW.UpImage = strUpImage;
                        MLW.RoomImage = strRoomImage;
                        MLW.FrontImageContent = byteFrontImage;

                        MLW.BackImageContent = byteBackImage;
                        MLW.UpImageContent = byteUpImage;
                        MLW.RoomImageContent = byteRoomImage;
                        MLW.TaxObject = ConfigurationManager.AppSettings["TaxObject"].ToString();
                        MLW.EmptyCode = strEmptyCode;
                        #endregion

                        #region 添加重车过磅记录
                        string isConnection = ini.IniReadValue("Connection", "isConnection");
                        if (BLW.Add(MLW) != "")
                        {
                            if (BLW.Add(MLW) != "-1")
                            {
                                //MSMQClient MC = new MSMQClient();

                                #region 数据上传
                                string strSql = "PT_LoadWeight '" + MLW.WeightCode + "','" + MLW.TrafficCode + "','" + MLW.NavicertCode + "','" + MLW.MarkedCardCode + "','" + MLW.RemoteCardCode + "',"
                                        + "'" + MLW.CollCode + "','" + MLW.CollName + "','" + MLW.CoalKindCode + "','" + MLW.CoalKindName + "','" + MLW.CarOwnerName + "',"
                                        + "'" + MLW.CarNo + "','" + MLW.CarType + "','" + MLW.LoadWeight + "','" + MLW.EmptyWeight + "','" + MLW.NetWeight + "',"
                                        + "'" + MLW.OverWeight + "','" + MLW.RoomCode + "','" + MLW.RoomName + "','" + MLW.BangType + "','" + MLW.Operator + "',"
                                        + "'" + MLW.WeightTime + "','" + MLW.RandomCode + "','" + MLW.CustomerName + "','" + MLW.TaxType + "','" + MLW.TaxObject + "',"
                                        + "'" + MLW.IsFirstSite + "','" + MLW.FrontImage + "','" + MLW.BackImage + "','" + MLW.UpImage + "','" + MLW.RoomImage + "',null,null,null,null,'" + MLW.EmptyCode + "'";
                                if (isConnection == "0")
                                {
                                    mqServer.AddMsmq(MC.AllStation + MC.Prefix + "TT_LoadWeight" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + strSql);
                                }
                                else
                                {
                                    MC.AddNewSqlText(MC.AllStation + MC.Prefix + "TT_LoadWeight" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + strSql);
                                }
                                //发送图片
                                string strIsSendPicToRoom = StaticParameter.IsSendPicToRoom;
                                int iSend = MC.ServerStation;
                                //是否发送磅房
                                if (strIsSendPicToRoom == "1")
                                    iSend = MC.AllStation;
                                string strPic = "";
                                if (MLW.FrontImageContent != null)
                                {
                                    strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                                        + MLW.FrontImage + ",jpg," + Convert.ToBase64String(MLW.FrontImageContent, 0, MLW.FrontImageContent.Length);
                                    if (isConnection == "0")
                                    {
                                        mqServer.AddMsmq(strPic);
                                    }
                                    else
                                    {
                                        MC.AddNewSqlText(strPic);
                                    }
                                }
                                if (MLW.BackImageContent != null)
                                {
                                    strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                                        + MLW.BackImage + ",jpg," + Convert.ToBase64String(MLW.BackImageContent, 0, MLW.BackImageContent.Length);
                                    if (isConnection == "0")
                                    {
                                        mqServer.AddMsmq(strPic);
                                    }
                                    else
                                    {
                                        MC.AddNewSqlText(strPic);
                                    }
                                }
                                if (MLW.UpImageContent != null)
                                {
                                    strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                                        + MLW.UpImage + ",jpg," + Convert.ToBase64String(MLW.UpImageContent, 0, MLW.UpImageContent.Length);
                                    if (isConnection == "0")
                                    {
                                        mqServer.AddMsmq(strPic);
                                    }
                                    else
                                    {
                                        MC.AddNewSqlText(strPic);
                                    }
                                }
                                if (MLW.RoomImageContent != null)
                                {
                                    strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                                        + MLW.RoomImage + ",jpg," + Convert.ToBase64String(MLW.RoomImageContent, 0, MLW.RoomImageContent.Length);
                                    if (isConnection == "0")
                                    {
                                        mqServer.AddMsmq(strPic);
                                    }
                                    else
                                    {
                                        MC.AddNewSqlText(strPic);
                                    }
                                }
                                /********************************************************/
                                //Add By 鲍永迎 向BS实时监控服务器消息队列发送重车过磅消息
                                /********************************************************/
                                //string loadMessage = MLW.RoomName + "," + MLW.LoadWeight + "," + MLW.CoalKindName + "," + MLW.NavicertCode + "," + MLW.NetWeight.ToString() + "," + MLW.WeightTime.ToString();//定义消息格式:磅房名称,车主姓名,煤种名称,准运卡号,煤炭净重,过磅时间
                                //RealTimeMonitor monitor = new RealTimeMonitor();//发送消息
                                //monitor.SendLoadWeightMessage(loadMessage);

                                string loadMessage = MLW.EmptyWeight.ToString() + "," + MLW.LoadWeight.ToString() + "," + MLW.NetWeight.ToString() + "," + MLW.OverWeight.ToString() + "," + MLW.TaxAmount.ToString() + "," + MLW.FundAmount.ToString() + "," + MLW.Operator.ToString() + "," + MLW.WeightTime.ToString()
                                    + "," + MLW.CarNo.ToString() + "," + MLW.CarOwnerName.ToString() + "," + MLW.RoomName.ToString() + "," + MLW.CollName.ToString() + "," + MLW.CoalKindName.ToString() + "," +
                                    MLW.NavicertCode.ToString() + "," + MLW.MarkedCardCode.ToString() + "," + MLW.RemoteCardCode.ToString() + "," + MLW.WeightCode.ToString();//定义消息格式:空车重量,重车重量,净重,超重,税费,基金,操作人,过磅时间,车牌号,车主姓名,磅房名称,煤矿名称,煤种名称,准运卡号,标识卡号,远程卡号,过磅单号
                                RealTimeMonitor monitor = new RealTimeMonitor();//发送消息
                                monitor.SendLoadWeightMessage(loadMessage);
                                /********************************************************/
                                //try
                                //{
                                //    CoalTraffic.MessagingService.LocalWeightServiceClient Loalclient = new CoalTraffic.MessagingService.LocalWeightServiceClient();
                                //    Loalclient.AddLoadWeight(MLW);
                                //}
                                //catch
                                //{ }
                                #endregion

                                aSound.Alarm("重车过磅通过,点击确定打印重车过磅单");
                                CommonMethod.MessageBox("重车过磅通过,点击确定打印重车过磅单!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                                //设置扣税标志位
                                this.isks = true;
                                Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
                                string strFileName = "";
                                if (StaticParameter.ReportFile == "FuYuan.")
                                {
                                    strFileName = "ZiChang.";
                                }
                                else
                                {
                                    strFileName = StaticParameter.ReportFile;
                                }
                                Type type = assembly.GetType("CoalTraffic.Report." + strFileName + "LoadWeightPrint");
                                object obj = Activator.CreateInstance(type, MLW.WeightCode, true); Form formToShow = (Form)obj; formToShow.ShowDialog();
                            }
                            else
                            {
                                aSound.Alarm("账户余额已不足本车的扣款,请通知" + cmbCollName.Text.Trim() + "速来交费");
                            }
                        }
                        else
                        {
                            if (isConnection == "0")
                            {
                                //ini.IniWriteValue("RoomSetting", "IsHaveMarkedCard", CommonMethod.ToDBC("1"));
                                MessageBox.Show("系统与服务器断开连接,请联系中心机房!");
                                Application.ExitThread();
                                Application.Exit();
                            }
                            else
                            {
                                this.aSound.Alarm("该站的数据库异常");
                                InsertState = 0;
                                InsertBadReCordInfo("异常", strRoomName + "的数据库异常");
                            }
                        }
                        #endregion
                    }
                    else if (strLeastValue == "1")
                    {
                        aSound.Alarm("煤矿余额低于下限,不能继续过磅");
                    }
                    else if (strLeastValue == "2")
                    {
                        aSound.Alarm("该煤矿不生产该煤种,不能继续过磅");
                        InsertState = 0;
                        InsertBadReCordInfo("异常", strCollName + "不生产" + strCoalKindName);
                    }
                    else if (strLeastValue == "-1")
                    {
                        aSound.Alarm("该煤矿不存在,不能继续过磅");
                        InsertState = 0;
                        InsertBadReCordInfo("异常", "编号为:" + strCollCode + "的煤矿不存在");
                    }
                    #endregion
                }

                ClearAllUIControlEmpty();
                this.ClearOwnerValue();
            }
            else
            {
                aSound.Alarm("煤炭净重异常");
                InsertState = 0;
                InsertBadReCordInfo("异常", "车牌号为:" + txtCarNo.Text.Trim() + "车辆的煤炭净重异常");
            }
            this.lblRemoteCode.Text = "";
        }
        void SetUIPoundValue()
        {
            string strWeight = appearance.Weight.ToString();
            if (appearance.Weight.ToString().Equals("0") || appearance.Weight.ToString().Equals("0.00"))
            {
                strWeight = "0.00";
            }
            else
            {
                if (CommonMethod.IsNumber(appearance.Weight.ToString()))
                {
                    strWeight = appearance.Weight.ToString() + ".00";
                }
                else
                {
                    strWeight = appearance.Weight.ToString();
                }
            }
            lblDigital.Text = strWeight;

            if (strCurrentMenu == "Auto")
            {
                txtHandDigital.Text = strWeight;
            }

            RealTimeMonitor monitor = new RealTimeMonitor();
            monitor.SendBangChengMessage(strWeight);
        }
        void SetUIPoundValue()
        {
            string strWeight = null;
            if (string.Compare(this.lblDigital.Text, string.Format("{0:F2}", appearance.Weight)) != 0)
            {
                strWeight = appearance.Weight.ToString();
                if (appearance.Weight.ToString().Equals("0") || appearance.Weight.ToString().Equals("0.00"))
                {
                    lblDigital.Text = "0.00";
                }
                else
                {
                    lblDigital.Text = string.Format("{0:F2}", appearance.Weight);
                }

                if (strCurrentMenu != "Person")
                {
                    txtManDigital.Text = appearance.Weight.ToString();
                }
                ValidateData();

            }

            if ((string.Compare(this.lblDigital.Text, string.Format("{0:F2}", appearance.Weight)) != 0) &&
             (appearance.Weight > Convert.ToDecimal(dValveWeight)))
            {
                //发送磅秤实时数据
                RealTimeMonitor monitor = new RealTimeMonitor();
                monitor.SendBangChengMessage(strWeight);
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            CoalTraffic.Model.TT_EmptyWeight model = new CoalTraffic.Model.TT_EmptyWeight();
            if (txtCarNo.Text.Trim() != "" && txtCarOwnerName.Text.Trim() != "" && txtCarOwnerPhone.Text.Trim() != "" && txtCarOwnerIDCard.Text.Trim() != "" && lblDigital.Text.Trim() != "0.00")
            {
                if (txtCarOwnerIDCard.Text.Trim().Length == 15 || txtCarOwnerIDCard.Text.Trim().Length == 18)
                {
                    if (CommonMethod.isValidICCard(CommonMethod.ToDBC(txtCarOwnerIDCard.Text.Trim())))
                    {
                        if (RbLoadWeight.Checked)
                        {
                            decimal DLimitWeight = decimal.Parse(ini.IniReadValue("RoomSetting", "WeightThreshold"));
                            decimal DOverWeight = 0.00m;
                            if (strCurrentMenu != "Person")
                            {
                                DOverWeight = Math.Abs(Convert.ToDecimal(lblDigital.Text.Trim()) - Convert.ToDecimal(txtEmptyWeight.Text.Trim()));
                            }
                            else
                            {
                                #region 验证数据的正确性
                                if (txtManDigital.Text.Trim() != "" && CommonMethod.IsDecimal(CommonMethod.ToDBC(txtManDigital.Text.Trim())))
                                {
                                    if (Convert.ToDecimal(CommonMethod.ToDBC(txtManDigital.Text.Trim())) >= Convert.ToDecimal(lblDigital.Text.Trim()))
                                    {
                                        DOverWeight = Math.Abs(Convert.ToDecimal(CommonMethod.ToDBC(txtManDigital.Text.Trim())) - Convert.ToDecimal(txtEmptyWeight.Text.Trim()));
                                    }
                                    else
                                    {
                                        alarmSound.Alarm("你输入的重车重量不能小于磅秤重量");
                                        txtManDigital.Text = "";
                                        return;
                                    }
                                }
                                else
                                {
                                    alarmSound.Alarm("你输入的重车重量格式不对");
                                    txtManDigital.Text = "";
                                    return;
                                }
                                #endregion
                            }

                            if (DOverWeight > DLimitWeight)
                            {
                                alarmSound.Alarm("空车重量异常,该车辆可能改装");
                                InsertState = 0;
                                InsertBadReCordInfo("异常", txtCarNo.Text.Trim(), "车牌号为:" + txtCarNo.Text.Trim() + "车辆的空车重量异常,该车辆登记时重量为:" + txtEmptyWeight.Text.Trim() + "现在重量为:" + txtManDigital.Text.Trim() + "");

                                return;
                            }
                        }

                        #region 空车过磅实体
                        model.BangTime = DateTime.Now;
                        model.BangType = strBangType;
                        model.CarCode = strCarCode;
                        model.EmptyCode = strRoomCode + DateTime.Now.ToString("yyyyMMddHHmmss");
                        if (strBangType == "自动")
                        {
                            model.EmptyWeight = Convert.ToDecimal(this.lblDigital.Text);
                        }
                        else
                        {
                            model.EmptyWeight = Convert.ToDecimal(CommonMethod.ToDBC(this.txtManDigital.Text.Trim()));
                        }

                        if (StaticParameter.IsVideo == "1")
                        {
                            if (byteFrontImage == null)
                            {
                                strFrontImage = Guid.NewGuid().ToString().Replace("-", "");
                                byteFrontImage = this.dHVideo.CapturePic();
                            }

                            model.FrontImage = strFrontImage;
                            model.FrontImageContent = byteFrontImage;
                        }
                        else
                        {
                            model.FrontImage = "";
                            model.FrontImageContent = null;
                        }

                        model.NavicertCode = strNavicertCode;
                        model.Operator = StaticParameter.UserName;
                        model.RemoteCardCode = strReadRemoteCode;
                        model.RoomCode = strRoomCode;
                        model.Carno = CommonMethod.ToDBC(txtCarNo.Text.Trim());
                        model.Caronername = CommonMethod.ToDBC(txtCarOwnerName.Text.Trim());
                        model.CarowneridCard = CommonMethod.ToDBC(txtCarOwnerIDCard.Text.Trim());
                        model.Carownerphone = CommonMethod.ToDBC(txtCarOwnerPhone.Text.Trim());
                        model.Randomcode = CommonMethod.getRandom(4);
                        #endregion

                        string strEmptyCode = bll.Add(model);
                        if (strEmptyCode != "")
                        {
                            alarmSound.Alarm("空车过磅成功");
                            CommonMethod.MessageBox("空车过磅成功!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                            //冯磊 2010-05-13 屏蔽了空车过磅打印功能

                            //alarmSound.Alarm("空车过磅成功,点击确定打印空车过磅单");
                            //CommonMethod.MessageBox("空车过磅成功,点击确定打印空车过磅单!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                            //Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
                            //string strFileName = "";
                            //if (StaticParameter.ReportFile == "FuYuan.")
                            //{
                            //    strFileName = "ZiChang.";
                            //}
                            //else
                            //{
                            //    strFileName = StaticParameter.ReportFile;
                            //}

                            //Type type = assembly.GetType("CoalTraffic.Report." + strFileName + "EmptyWeightPrintByEmpty");
                            //object obj = Activator.CreateInstance(type, strEmptyCode, true); Form formToShow = (Form)obj; formToShow.ShowDialog();


                            #region 将数据上传到服务器
                            try
                            {
                                //CoalTraffic.DBUtility.MSMQClient mq = new MSMQClient();
                                string strSql = "PT_EmptyWeight '" + model.EmptyCode + "','" + model.CarCode + "','" + model.RemoteCardCode
                                    + "','" + model.NavicertCode + "','" + model.EmptyWeight + "','" + model.BangType + "','"
                                    + model.RoomCode + "','" + model.FrontImage + "','" + model.Operator + "','" + model.BangTime
                                    + "',null,'" + model.Carno + "','" + model.Caronername + "','" + model.CarowneridCard
                                    + "','" + model.Carownerphone + "','" + model.Randomcode + "'";
                                MC.AddNewSqlText(MC.AllStation + MC.Prefix + "TT_EmptyWeight" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + strSql);


                                //发送图片
                                string strIsSendPicToRoom = StaticParameter.IsSendPicToRoom;
                                int iSend = MC.ServerStation;
                                //是否发送磅房
                                if (strIsSendPicToRoom == "1")
                                    iSend = MC.AllStation;
                                string strPic = "";
                                if (model.FrontImageContent != null)
                                {
                                    strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                                        + model.FrontImage + ",jpg," + Convert.ToBase64String(model.FrontImageContent, 0, model.FrontImageContent.Length);
                                    MC.AddNewSqlText(strPic);
                                }

                                /********************************************************/
                                //Add By 鲍永迎 向BS实时监控服务器消息队列发送空车过磅消息
                                /********************************************************/
                                string strRoomName = ini.IniReadValue("RoomSetting", "RoomName");
                                string emptyMessage = strRoomName + "," + model.CarCode + "," + model.NavicertCode + "," + model.EmptyWeight.ToString() + "," + model.BangTime.ToString();//定义消息格式:磅房名称,车辆信息编号,准运卡号,空车重量,过磅时间
                                RealTimeMonitor monitor = new RealTimeMonitor();//发送消息
                                monitor.SendEmptyWeightMessage(emptyMessage);
                                /********************************************************/
                            }
                            catch { }
                            #endregion

                            ClearAllControls();
                            ClearUserControl();

                        }
                        else
                        {
                            alarmSound.Alarm("该站的数据库异常");
                            InsertState = 0;
                            InsertBadReCordInfo("异常", txtCarNo.Text.Trim(), ini.IniReadValue("RoomSetting", "RoomName") + "的数据库异常");
                        }
                    }
                    else
                    {
                        alarmSound.Alarm("你输入的车主身份证号格式不正确");

                    }
                }
                else
                {
                    alarmSound.Alarm("你输入的车主身份证号长度不正确");
                }
            }
            else
            {
                alarmSound.Alarm("请确保信息的完整性");
            }

        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            CoalTraffic.Model.TT_LoadWeight model = new CoalTraffic.Model.TT_LoadWeight();

            if (cmbCustomers.SelectedValue.ToString() != "-1")
            {
                if (strCurrentMenu == "Auto")
                {
                    model.LoadWeight = Convert.ToDecimal(lblDigital.Text);
                    model.NetWeight = Convert.ToDecimal(lblDigital.Text) - Convert.ToDecimal(txtEmptyWeight.Text.Trim());
                }
                else
                {
                    #region ��֤���ݵ���ȷ��
                    if (txtHandDigital.Text.Trim() != "" && CommonMethod.IsDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim())))
                    {
                        if (Convert.ToDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim())) < Convert.ToDecimal(lblDigital.Text.Trim()))
                        {
                            alarmSound.Alarm("��������س���������С�ڰ�������");
                            txtHandDigital.Text = "";
                            return;
                        }
                        else
                        {
                            model.LoadWeight = Convert.ToDecimal(CommonMethod.ToDBC(this.txtHandDigital.Text.Trim()));
                            model.NetWeight = Convert.ToDecimal(CommonMethod.ToDBC(this.txtHandDigital.Text.Trim())) - Convert.ToDecimal(txtEmptyWeight.Text.Trim());
                        }
                    }
                    else
                    {
                        alarmSound.Alarm("��������س�������ʽ����");
                        txtHandDigital.Text = "";
                        return;
                    }
                    #endregion
                }
                if (model.NetWeight > 0.00m)
                {

                    #region ��ȡ��ú����ص���Ϣ
                    SqlParameter[] parameter =
                {
                    new SqlParameter("@CollCode", SqlDbType.VarChar,10),
                    new SqlParameter("@CoalKindCode", SqlDbType.VarChar,4)
                };

                    parameter[0].Value = strCollCode;
                    parameter[1].Value = strCoalKindCode;
                    DataSet dstColieryAccount = DbHelperSQL.RunProcedure("PT_ColieryAccountJudge", parameter, "ColieryAccount");
                    #endregion

                    string strLeastValue = dstColieryAccount.Tables["ColieryAccount"].Rows[0]["ReturnValue"].ToString();

                    if (strLeastValue == "0") //0���������ɹ���
                    {
                        #region ��Ƶץͼ
                        //ץͼ��Ϣ
                        byte[] byteFrontImage = null;
                        byte[] byteBackImage = null;
                        byte[] byteUpImage = null;
                        byte[] byteRoomImage = null;

                        //ͼƬ�洢��SYS_FileSave������
                        string strFrontImage = "";
                        string strBackImage = "";
                        string strUpImage = "";
                        string strRoomImage = "";

                        if (strIsVideo == "1")
                        {
                            strFrontImage = Guid.NewGuid().ToString().Replace("-", "");
                            strBackImage = Guid.NewGuid().ToString().Replace("-", "");
                            strUpImage = Guid.NewGuid().ToString().Replace("-", "");
                            strRoomImage = Guid.NewGuid().ToString().Replace("-", "");

                            byteFrontImage = ((DHVideo)Form1.PF.Controls["videoFrontImage"]).CapturePic();
                            byteBackImage = ((DHVideo)Form1.PF.Controls["videoBackImage"]).CapturePic();
                            byteUpImage = ((DHVideo)Form1.PF.Controls["videoUpImage"]).CapturePic();
                            byteRoomImage = ((DHVideo)Form1.PF.Controls["videoRoomImage"]).CapturePic();
                        }
                        #endregion

                        #region ʵ�����س�
                        string strWeightCode = strRoomCode + DateTime.Now.ToString("yyyyMMddHHmmss");
                        model.WeightCode = strWeightCode;
                        model.TrafficCode = strWeightCode;
                        model.NavicertCode = strNavicertCode;
                        model.MarkedCardCode = strMardedCardCode;
                        model.RemoteCardCode = strRemoteCode;

                        model.CollCode = strCollCode;
                        model.CollName = this.txtCollName.Text.Trim();
                        model.CoalKindCode = strCoalKindCode;
                        model.CoalKindName = this.txtKindName.Text;
                        model.CarOwnerName = strCarOwnerName;

                        model.CarNo = txtCarNo.Text;
                        model.CarType = txtCarType.Text;
                        model.EmptyWeight = Convert.ToDecimal(txtEmptyWeight.Text);

                        model.OverWeight = 0;
                        model.RoomCode = strRoomCode;
                        model.RoomName = strRoomName;
                        model.BangType = strBangType;
                        model.Operator = StaticParameter.UserName;

                        model.WeightTime = DateTime.Now;
                        model.RandomCode = CommonMethod.getRandom(4);
                        model.CustomerName = cmbCustomers.SelectedValue.ToString();
                        model.IsFirstSite = "1";
                        model.TaxType = "�س�������˰";

                        model.FrontImage = strFrontImage;
                        model.BackImage = strBackImage;
                        model.UpImage = strUpImage;
                        model.RoomImage = strRoomImage;
                        model.FrontImageContent = byteFrontImage;

                        model.BackImageContent = byteBackImage;
                        model.UpImageContent = byteUpImage;
                        model.RoomImageContent = byteRoomImage;
                        model.TaxObject = ConfigurationManager.AppSettings["TaxObject"].ToString();
                        model.EmptyCode = strEmptyCode;
                        #endregion

                        if (bll.Add(model) != "")
                        {
                            #region ��ӳɹ���������ͬ��
                            try
                            {
                                string strSql = "PT_LoadWeight '" + model.WeightCode + "','" + model.TrafficCode + "','" + model.NavicertCode + "','" + model.MarkedCardCode + "','" + model.RemoteCardCode + "',"
                     + "'" + model.CollCode + "','" + model.CollName + "','" + model.CoalKindCode + "','" + model.CoalKindName + "','" + model.CarOwnerName + "',"
                     + "'" + model.CarNo + "','" + model.CarType + "','" + model.LoadWeight + "','" + model.EmptyWeight + "','" + model.NetWeight + "',"
                     + "'" + model.OverWeight + "','" + model.RoomCode + "','" + model.RoomName + "','" + model.BangType + "','" + model.Operator + "',"
                     + "'" + model.WeightTime + "','" + model.RandomCode + "','" + model.CustomerName + "','" + model.TaxType + "','" + model.TaxObject + "',"
                     + "'" + model.IsFirstSite + "','" + model.FrontImage + "','" + model.BackImage + "','" + model.UpImage + "','" + model.RoomImage + "',"
                     + "'" + model.FrontImageContent + "','" + model.BackImageContent + "','" + model.UpImageContent + "','" + model.RoomImageContent + "','" + model.EmptyCode + "'";
                                MC.AddNewSqlText(MC.CheckStation + MC.Prefix + "TT_LoadWeight" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + strSql);

                                /********************************************************/
                                //Add By ����ӭ ��BSʵʱ��ط�������Ϣ���з����س�������Ϣ
                                /********************************************************/
                                string loadMessage = model.RoomName + "," + model.CarOwnerName + "," + model.CoalKindName + "," + model.NavicertCode + "," + model.NetWeight.ToString() + "," + model.WeightTime.ToString();//������Ϣ��ʽ����������,����������ú������,׼�˿��ţ�ú̿���أ�����ʱ��
                                RealTimeMonitor monitor = new RealTimeMonitor();//������Ϣ
                                monitor.SendEmptyWeightMessage(loadMessage);
                                /********************************************************/

                            }
                            catch { }
                            #endregion

                            string strErro = "";
                            if (strIsHaveMarkedCard == "1")
                            {
                                strErro = "�����ձ�ʶ��";
                            }
                            alarmSound.Alarm("�����ɹ�,���ȷ����ӡ�س�������" + strErro + "");
                            CommonMethod.MessageBox("�����ɹ�,���ȷ����ӡ�س�������" + strErro + "!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            new CoalTraffic.Report.LoadWeightPrint(strWeightCode, true).ShowDialog();
                        }
                        else
                        {
                            this.alarmSound.Alarm("��վ�����ݿ��쳣");
                            InsertState = 0;
                            InsertBadReCordInfo("�쳣", txtCarNo.Text.Trim(), ini.IniReadValue("RoomSetting", "RoomName") + "�����ݿ��쳣");
                        }

                    }
                    else if (strLeastValue == "1")
                    {
                        alarmSound.Alarm("ú������������,���ܼ�������");
                    }
                    else if (strLeastValue == "2")
                    {
                        alarmSound.Alarm("��ú��������ú��,���ܼ�������");
                        InsertState = 0;
                        InsertBadReCordInfo("�쳣", txtCarNo.Text.Trim(), strCollName + "������" + strCoalKindName);
                    }
                    else if (strLeastValue == "-1")
                    {
                        alarmSound.Alarm("��ú�󲻴���,���ܼ�������");
                        InsertState = 0;
                        InsertBadReCordInfo("�쳣", txtCarNo.Text.Trim(), "���Ϊ��" + strCollCode + "��ú�󲻴���");
                    }

                    btnOK.Enabled = false;
                    ClearAll();
                    if (strCard == "IC")
                        icCard.FactoryCodeInitValue = "";
                }
                else
                {
                    alarmSound.Alarm("ú̿�����쳣");
                    InsertState = 0;
                    InsertBadReCordInfo("�쳣", txtCarNo.Text.Trim(), "���ƺ�Ϊ��" + txtCarNo.Text.Trim() + "������ú̿�����쳣");
                }
            }
            else
            {
                alarmSound.Alarm("��ѡ���ջ���λ");
            }
        }
 void SetUIPoundValue()
 {
     if (string.Compare(this.lblDigital.Text, string.Format("{0:F2}", appearance.Weight)) != 0)
     {
         this.lblDigital.Text = string.Format("{0:F2}", appearance.Weight);
         ValidateData();
         RealTimeMonitor monitor = new RealTimeMonitor();
         monitor.SendBangChengMessage(appearance.Weight.ToString());
     }
 }
Exemplo n.º 17
0
        protected void SetMsComValue()
        {
            if (string.Compare(this.lblDigital.Text, string.Format("{0:F2}", appearance.Weight)) != 0)
            {
            if (appearance.Weight.ToString().Equals("0") || appearance.Weight.ToString().Equals("0.00"))
            {
                lblDigital.Text = "0.00";
            }
            else
            {
                lblDigital.Text = string.Format("{0:F2}", appearance.Weight);
            }

            if (strCurrentMenu != "Person")
            {
                txtHandDigital.Text = appearance.Weight.ToString();
            }

                RealTimeMonitor monitor = new RealTimeMonitor();
                monitor.SendBangChengMessage(lblDigital.Text);
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// 验证码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        #region 验证码
        private void btnOK_Click(object sender, EventArgs e)
        {
            Model.TT_BadRecord MBR = new CoalTraffic.Model.TT_BadRecord();
            BLL.TT_BadRecord BBR = new CoalTraffic.BLL.TT_BadRecord();
            Model.TT_LoadWeight MLW = new CoalTraffic.Model.TT_LoadWeight();
            BLL.TT_LoadWeight BLW = new CoalTraffic.BLL.TT_LoadWeight();

            decimal DNetWeight = 0.00m;

            #region 计算水泥净重
            if (strCurrentMenu != "Person")
            {
                decimal dDigital, dEmptyWeight;
                if (decimal.TryParse(lblDigital.Text.Trim(), out dDigital) && decimal.TryParse(strEmptyWeight, out dEmptyWeight))
                {
                    DNetWeight = Convert.ToDecimal(dDigital - dEmptyWeight);
                }
                else
                {
                    aSound.Alarm("重量数据格式不正确");
                    return;

                }
            }
            else
            {
                #region 验证数据的正确性
                if (txtHandDigital.Text.Trim() != "" && CommonMethod.IsDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim())))
                {

                    if (Convert.ToDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim())) < Convert.ToDecimal(lblDigital.Text.Trim()))
                    {
                        aSound.Alarm("你输入的重车重量不能小于磅秤重量");
                        txtHandDigital.Text = "";
                        return;
                    }
                    else
                    {
                        DNetWeight = Convert.ToDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim())) - Convert.ToDecimal(strEmptyWeight);
                    }
                }
                else
                {
                    aSound.Alarm("你输入的重车重量格式不对");
                    txtHandDigital.Text = "";
                    return;
                }
                #endregion
            }
            #endregion

            if (DNetWeight > 0.00m)
            {
                #region 视频抓图

                if (StaticParameter.IsVideo == "1")
                {
                    if (byteFrontImage == null && byteBackImage == null && byteUpImage == null && byteRoomImage == null)
                    {
                        strFrontImage = Guid.NewGuid().ToString().Replace("-", "");
                        strBackImage = Guid.NewGuid().ToString().Replace("-", "");
                        strUpImage = Guid.NewGuid().ToString().Replace("-", "");
                        strRoomImage = Guid.NewGuid().ToString().Replace("-", "");

                        byteFrontImage = this.videoFrontImage.CapturePic();
                        byteBackImage = this.videoBackImage.CapturePic();
                        byteUpImage = this.videoUpImage.CapturePic();
                        byteRoomImage = this.videoRoomImage.CapturePic();
                    }
                }
                #endregion


                #region 重车验票
                CoalTraffic.BLL.TT_CheckBang bllCheckBang = new CoalTraffic.BLL.TT_CheckBang();
                CoalTraffic.Model.TT_CheckBang modelCheckBang = new CoalTraffic.Model.TT_CheckBang();

                modelCheckBang.RoomCode = strRoomCode;
                modelCheckBang.NetWeight = DNetWeight;

                #region 监察该重车是否已经验票
                bool bolChecked = bllCheckBang.IsChecked(strTrafficCode, modelCheckBang.RoomCode);
                #endregion

                decimal dOverWeight = 0.0m;
                decimal DLimitWeight = 0.0m;

                if (bolChecked)
                {
                    modelCheckBang.CheckResult = "重车验票不通过,该过磅单在本磅房中已检验过";
                    modelCheckBang.IsPassed = "0";
                }
                else
                {
                    #region 验证验证码是否正确
                    if (CommonMethod.ToDBC(this.txtRandCode.Text.Trim()) != strRandomCode && iCount < iTryAgainTime)
                    {
                        CommonMethod.MessageBox("您输入的验证码不正确,请重新输入,您还有" + (iTryAgainTime - iCount) + "次输入机会", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        //aSound.Alarm("您输入的验证码不正确,请重新输入,您还有" + (iTryAgainTime - iCount) + "次输入机会");
                        txtRandCode.Text = "";
                        btnOK.Enabled = false;
                        iCount++;
                        return;
                    }
                    else if (CommonMethod.ToDBC(this.txtRandCode.Text.Trim()) != strRandomCode && iCount == iTryAgainTime)
                    {
                        modelCheckBang.CheckResult = "重车验票不通过,验票单可能造假"; //验票结果:通过 or 不通过
                        modelCheckBang.IsPassed = "0";
                    }
                    else if (CommonMethod.ToDBC(this.txtRandCode.Text.Trim()) == strRandomCode)
                    {
                        modelCheckBang.CheckResult = "重车验票通过";
                        modelCheckBang.IsPassed = "1";
                    }
                    #endregion
                }

                #region 实例化检票
                modelCheckBang.CheckCode = Guid.NewGuid().ToString().Replace("-", "");
                modelCheckBang.CheckTime = DateTime.Now;
                modelCheckBang.Operator = StaticParameter.UserName;
                modelCheckBang.MarkedCardCode = strMardedCardCode;
                modelCheckBang.NavicertCode = strNavicertCode;
                modelCheckBang.WeightCode = this.strTrafficCode;

                modelCheckBang.FrontImage = strFrontImage;
                modelCheckBang.BackImage = strBackImage;
                modelCheckBang.UpImage = strUpImage;
                modelCheckBang.RoomImage = strRoomImage;

                modelCheckBang.FrontImageContent = byteFrontImage;
                modelCheckBang.BackImageContent = byteBackImage;
                modelCheckBang.UpImageContent = byteUpImage;
                modelCheckBang.RoomImageContent = byteRoomImage;

                #endregion

                if (modelCheckBang.IsPassed == "0")
                {
                    InsertState = 0;
                    InsertBadReCordInfo("不通过", modelCheckBang.CheckResult);
                }
                else
                {
                    #region 获取最大重车重量
                    string strsql = "select max(LoadWeight) from TT_LoadWeight where TrafficCode ='" + strTrafficCode + "'";

                    object OMLoadWeight = DbHelperSQL.GetSingle(strsql);

                    if (strCurrentMenu != "Person")
                    {
                        dOverWeight = decimal.Parse(lblDigital.Text.Trim()) - decimal.Parse(OMLoadWeight.ToString());
                    }
                    else
                    {
                        dOverWeight = Convert.ToDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim())) - Convert.ToDecimal(OMLoadWeight.ToString());
                    }

                    DLimitWeight = StaticParameter.WeightThreshold;
                    #endregion

                    if (dOverWeight >= DLimitWeight)
                    {
                        #region 实例化重车过磅
                        string strWeightCode = strRoomCode + DateTime.Now.ToString("yyyyMMddHHmmss");
                        MLW.WeightCode = strWeightCode;
                        MLW.TrafficCode = strTrafficCode;
                        MLW.NavicertCode = strNavicertCode;
                        MLW.MarkedCardCode = strMardedCardCode;
                        MLW.RemoteCardCode = strRemoteCode;

                        MLW.CollCode = strCollCode;
                        //冯磊 2010-05-19 选择产品改成下拉框
                        //MLW.CollName = strCollName;
                        //MLW.CoalKindCode = strCoalKindCode;
                        //MLW.CoalKindName = strCoalKindName;
                        MLW.CollName = this.txtCompany.Text.Trim();
                        MLW.CoalKindCode = strCoalKindCode;
                        MLW.CoalKindName = this.txtProduce.Text.Trim();

                        MLW.CarOwnerName = txtCarOwner.Text.Trim();
                        MLW.CarNo = txtCarNo.Text.Trim();
                        MLW.CarType = txtCarType.Text.Trim();
                        if (strCurrentMenu != "Person")
                        {
                            MLW.LoadWeight = decimal.Parse(lblDigital.Text.Trim());
                        }
                        else
                        {
                            MLW.LoadWeight = Convert.ToDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim()));
                        }
                        //MLW.EmptyWeight = decimal.Parse(lblEmptyWeight.Text.Trim());
                        MLW.EmptyWeight = decimal.Parse(txtEmptyWeight.Text.Replace("吨", "").Trim());
                        MLW.NetWeight = 0.0m;

                        MLW.OverWeight = decimal.Parse(dOverWeight.ToString());
                        MLW.RoomCode = strRoomCode;
                        MLW.RoomName = strRoomName;
                        MLW.BangType = "重车" + strBangType + "验票";
                        MLW.Operator = StaticParameter.UserName;

                        MLW.WeightTime = DateTime.Now;
                        MLW.RandomCode = CommonMethod.getRandom(4);
                        MLW.CustomerName = "水泥去向";
                        MLW.TaxType = "重车补扣税费";
                        MLW.IsFirstSite = "0";

                        MLW.FrontImage = Guid.NewGuid().ToString().Replace("-", "");
                        MLW.BackImage = Guid.NewGuid().ToString().Replace("-", "");
                        MLW.UpImage = Guid.NewGuid().ToString().Replace("-", "");
                        MLW.RoomImage = Guid.NewGuid().ToString().Replace("-", "");
                        MLW.FrontImageContent = byteFrontImage;

                        MLW.BackImageContent = byteBackImage;
                        MLW.UpImageContent = byteUpImage;
                        MLW.RoomImageContent = byteRoomImage;
                        MLW.TaxObject = ConfigurationManager.AppSettings["TaxObject"].ToString();
                        MLW.EmptyCode = strEmptyCode;
                        #endregion
                    }
                }

                bool ISSound = false;
                bool IsLoadWeight = true;


                if ((dOverWeight >= DLimitWeight) && (dOverWeight != 0.0m))
                {
                    #region 添加重车过磅记录
                    if (BLW.Add(MLW) != "")
                    {
                        ISSound = true;

                        if (BLW.Add(MLW) != "-1")
                        {
                            #region 数据上传

                            string strSql = "PT_LoadWeight '" + MLW.WeightCode + "','" + MLW.TrafficCode + "','" + MLW.NavicertCode + "','" + MLW.MarkedCardCode + "','" + MLW.RemoteCardCode + "',"
                          + "'" + MLW.CollCode + "','" + MLW.CollName + "','" + MLW.CoalKindCode + "','" + MLW.CoalKindName + "','" + MLW.CarOwnerName + "',"
                          + "'" + MLW.CarNo + "','" + MLW.CarType + "','" + MLW.LoadWeight + "','" + MLW.EmptyWeight + "','" + MLW.NetWeight + "',"
                          + "'" + MLW.OverWeight + "','" + MLW.RoomCode + "','" + MLW.RoomName + "','" + MLW.BangType + "','" + MLW.Operator + "',"
                          + "'" + MLW.WeightTime + "','" + MLW.RandomCode + "','" + MLW.CustomerName + "','" + MLW.TaxType + "','" + MLW.TaxObject + "',"
                          + "'" + MLW.IsFirstSite + "','" + MLW.FrontImage + "','" + MLW.BackImage + "','" + MLW.UpImage + "','" + MLW.RoomImage + "',null,null,null,null,'" + MLW.EmptyCode + "'";
                            MC.AddNewSqlText(MC.CheckStation + MC.Prefix + "TT_LoadWeight" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + strSql);

                            //发送图片
                            string strIsSendPicToRoom = StaticParameter.IsSendPicToRoom;
                            int iSend = MC.ServerStation;
                            //是否发送磅房
                            if (strIsSendPicToRoom == "1")
                                iSend = MC.CheckStation;
                            string strPic = "";
                            if (MLW.FrontImageContent != null)
                            {
                                strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                                    + MLW.FrontImage + ",jpg," + Convert.ToBase64String(MLW.FrontImageContent, 0, MLW.FrontImageContent.Length);
                                MC.AddNewSqlText(strPic);
                            }
                            if (MLW.BackImageContent != null)
                            {
                                strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                                    + MLW.BackImage + ",jpg," + Convert.ToBase64String(MLW.BackImageContent, 0, MLW.BackImageContent.Length);
                                MC.AddNewSqlText(strPic);
                            }
                            if (MLW.UpImageContent != null)
                            {
                                strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                                    + MLW.UpImage + ",jpg," + Convert.ToBase64String(MLW.UpImageContent, 0, MLW.UpImageContent.Length);
                                MC.AddNewSqlText(strPic);
                            }
                            if (MLW.RoomImageContent != null)
                            {
                                strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                                    + MLW.RoomImage + ",jpg," + Convert.ToBase64String(MLW.RoomImageContent, 0, MLW.RoomImageContent.Length);
                                MC.AddNewSqlText(strPic);
                            }
                            /********************************************************/
                            //Add By 鲍永迎 向BS实时监控服务器消息队列发送重车过磅消息
                            /********************************************************/
                            //string loadMessage = MLW.RoomName + "," + MLW.LoadWeight + "," + MLW.CoalKindName + "," + MLW.NavicertCode + "," + MLW.NetWeight.ToString() + "," + MLW.WeightTime.ToString();//定义消息格式:磅房名称,车主姓名,煤种名称,准运卡号,煤炭净重,过磅时间
                            //RealTimeMonitor monitor = new RealTimeMonitor();//发送消息
                            //monitor.SendLoadWeightMessage(loadMessage);

                            //冯磊 2010-05-18 修改向BS实时监控服务器消息队列发送重车过磅消息
                            string loadMessage = MLW.EmptyWeight.ToString() + "," + MLW.LoadWeight.ToString() + "," + MLW.NetWeight.ToString() + "," + MLW.OverWeight.ToString() + "," + MLW.TaxAmount.ToString() + "," + MLW.FundAmount.ToString() + "," + MLW.Operator.ToString() + "," + MLW.WeightTime.ToString()
                                + "," + MLW.CarNo.ToString() + "," + MLW.CarOwnerName.ToString() + "," + MLW.RoomName.ToString() + "," + MLW.CollName.ToString() + "," + MLW.CoalKindName.ToString() + "," +
                                MLW.NavicertCode.ToString() + "," + MLW.MarkedCardCode.ToString() + "," + MLW.RemoteCardCode.ToString() + "," + MLW.WeightCode.ToString();//定义消息格式:空车重量,重车重量,净重,超重,税费,基金,操作人,过磅时间,车牌号,车主姓名,磅房名称,煤矿名称,煤种名称,准运卡号,标识卡号,远程卡号,过磅单号
                            RealTimeMonitor monitor = new RealTimeMonitor();//发送消息
                            monitor.SendLoadWeightMessage(loadMessage);
                            /********************************************************/
                            #endregion

                            aSound.Alarm("重车验票过磅通过,点击确定打印重车验票过磅单");
                            CommonMethod.MessageBox("重车过磅验票通过,点击确定打印重车验票过磅单!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            //设置扣税标志位
                            this.isks = true;
                            Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
                            string strFileName = "";
                            if (StaticParameter.ReportFile == "FuYuan.")
                            {
                                strFileName = "ZiChang.";
                            }
                            else
                            {
                                strFileName = StaticParameter.ReportFile;
                            }
                            Type type = assembly.GetType("CoalTraffic.Report." + strFileName + "CheckLoadWeightPrint");
                            object obj = Activator.CreateInstance(type, MLW.WeightCode, true); Form formToShow = (Form)obj; formToShow.ShowDialog();
                        }
                        else
                        {
                            aSound.Alarm("账户余额已不足本车的扣款,请通知" + this.txtCompany.Text.Trim() + "速来交费");
                            IsLoadWeight = false;
                        }
                    }
                    else
                    {
                        this.aSound.Alarm("该站的数据库异常");
                        InsertState = 0;
                        InsertBadReCordInfo("异常", strRoomName + "的数据库异常");
                    }
                    #endregion
                }

                #region 添加验票信息
                if (IsLoadWeight)
                {
                    if (bllCheckBang.Add(modelCheckBang) != "")
                    {
                        #region 数据上传
                        try
                        {
                            StringBuilder sbInsertCheckBang = new StringBuilder();
                            sbInsertCheckBang.Append("PT_CheckBang '" + modelCheckBang.CheckCode + "','" + modelCheckBang.WeightCode + "','" + modelCheckBang.NavicertCode + "',");
                            sbInsertCheckBang.Append("'" + modelCheckBang.MarkedCardCode + "','" + modelCheckBang.NetWeight + "','" + modelCheckBang.RoomCode + "',");
                            sbInsertCheckBang.Append("'" + modelCheckBang.IsPassed + "','" + modelCheckBang.CheckResult + "','" + modelCheckBang.CheckTime + "',");
                            sbInsertCheckBang.Append("'" + modelCheckBang.Operator + "','" + modelCheckBang.FrontImage + "',null,");
                            sbInsertCheckBang.Append("'" + modelCheckBang.BackImage + "',null,'" + modelCheckBang.UpImage + "',");
                            sbInsertCheckBang.Append("null,'" + modelCheckBang.RoomImage + "',null");

                            MC.AddNewSqlText(MC.CheckStation + MC.Prefix + "TT_CheckBang" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + sbInsertCheckBang.ToString());
                            //发送图片
                            string strIsSendPicToRoom = StaticParameter.IsSendPicToRoom;
                            int iSend = MC.ServerStation;
                            //是否发送磅房
                            if (strIsSendPicToRoom == "1")
                                iSend = MC.CheckStation;
                            string strPic = "";
                            if (modelCheckBang.FrontImageContent != null)
                            {
                                strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                                    + modelCheckBang.FrontImage + ",jpg," + Convert.ToBase64String(modelCheckBang.FrontImageContent, 0, modelCheckBang.FrontImageContent.Length);
                                MC.AddNewSqlText(strPic);
                            }
                            if (modelCheckBang.BackImageContent != null)
                            {
                                strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                                    + modelCheckBang.BackImage + ",jpg," + Convert.ToBase64String(modelCheckBang.BackImageContent, 0, modelCheckBang.BackImageContent.Length);
                                MC.AddNewSqlText(strPic);
                            }
                            if (modelCheckBang.UpImageContent != null)
                            {
                                strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                                    + modelCheckBang.UpImage + ",jpg," + Convert.ToBase64String(modelCheckBang.UpImageContent, 0, modelCheckBang.UpImageContent.Length);
                                MC.AddNewSqlText(strPic);
                            }
                            if (modelCheckBang.RoomImageContent != null)
                            {
                                strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix
                                    + modelCheckBang.RoomImage + ",jpg," + Convert.ToBase64String(modelCheckBang.RoomImageContent, 0, modelCheckBang.RoomImageContent.Length);
                                MC.AddNewSqlText(strPic);
                            }
                        }
                        catch { }
                        #endregion

                        if (!ISSound)
                        {
                            aSound.Alarm(modelCheckBang.CheckResult);
                            CommonMethod.MessageBox(modelCheckBang.CheckResult, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                        }

                        spRemote.CardCode = "";
                    }
                    else
                    {
                        aSound.Alarm("该站的数据库异常");
                        InsertState = 0;
                        InsertBadReCordInfo("异常", strRoomName + "的数据库异常");
                    }
                }
                #endregion

                #endregion

                ClearAllUIControlEmpty();
                this.ClearOwnerValue();
            }
            else
            {
                aSound.Alarm("水泥净重异常");
                InsertState = 0;
                InsertBadReCordInfo("异常", "车牌号为:" + txtCarNo.Text.Trim() + "车辆的水泥净重异常");
            }
            this.lblRemoteCode.Text = "";
        }