/// <summary>
        /// 对地磅策略判断   该磅房信息
        /// </summary>
        private bool WeighStrategyIf()
        {
            try
            {
                string  WeighStrategy_ID   = cobWeighStrategyRecord.SelectedValue.ToString(); //地磅编号
                string  WeighStrategy_Name = cobWeighStrategyRecord.Text.ToString();          //地磅名称
                int     indexs             = 0;
                int     mark = 0;
                DataSet Ifds = LinQBaseDao.Query("select * from View_WeighStrategy where WeighStrategy_CarType_ID=" + txtCartype_Name.Tag.ToString() + " and WeighStrategy_State='启动'");
                for (int i = 0; i < Ifds.Tables[0].Rows.Count; i++)
                {
                    if (Convert.ToInt32(Ifds.Tables[0].Rows[i]["WeighStrategy_Sort"]) == 1)
                    {
                        mark++;
                    }
                }
                if (mark == Ifds.Tables[0].Rows.Count)
                {
                    #region 此乃无序
                    //查是否有此策略
                    string  Sql = "select * from View_WeighStrategy where CarType_Name='" + txtCartype_Name.Text.Trim() + "' and WeighStrategy_State='启动'";
                    DataSet dst = LinQBaseDao.Query(Sql);
                    if (dst.Tables[0].Rows.Count == 0)
                    {
                        MessageBox.Show("改类型车未配置地磅策略");
                        return(false);
                    }
                    WeightInfo_ID     = null;
                    WeightStrategy_ID = null;
                    string CarType_Name = null; //车辆类型
                    string Sort         = "";   //排序号
                    for (int i = 0; i < dst.Tables[0].Rows.Count; i++)
                    {
                        WeightInfo_ID     += dst.Tables[0].Rows[i]["WeighInfo_ID"] + ",";
                        WeightStrategy_ID += dst.Tables[0].Rows[i]["WeighStrategy_ID"] + ",";
                        CarType_Name      += dst.Tables[0].Rows[i]["CarType_Name"] + ",";
                        Sort += dst.Tables[0].Rows[i]["WeighStrategy_Sort"] + ",";
                    }

                    string[] CarType_Names = CarType_Name.Split(',');
                    string[] infoId        = WeightInfo_ID.Split(',');
                    string[] ID            = WeightStrategy_ID.Split(',');
                    string[] Car_Sort      = Sort.Split(',');
                    for (int i = 0; i < infoId.Count() - 1; i++)
                    {
                        if (infoId[i] == WeighStrategy_ID)//进入说明存在此策略
                        {
                            //此策略是否已通过
                            string  SqlRecord = "select * from view_WeighStrategyRecord where WeighStrategyRecord_WeighInfo_ID=" + cobWeighStrategyRecord.SelectedValue.ToString() + " and WeighStrategyRecord_CarType='" + txtCartype_Name.Text.Trim() + "'";
                            DataSet ds        = LinQBaseDao.Query(SqlRecord);
                            if (ds.Tables[0].Rows.Count > 0)//判断前面是否有数据,没有说明未正常通行
                            {
                                MessageBox.Show("该车辆未按正常地磅策略顺序通行(此地磅已验过,请更换地磅)!");
                                return(false);
                            }
                            indexs++;
                        }
                    }
                    if (indexs == 0)
                    {
                        MessageBox.Show("无此策略,该车未正常通行");
                        return(false);
                    }
                    return(true);

                    #endregion
                }
                else
                {
                    #region  序策略查询
                    string  Sql = "select * from View_WeighStrategy where CarType_Name='" + txtCartype_Name.Text.Trim() + "' order by WeighStrategy_Sort asc";
                    DataSet dst = LinQBaseDao.Query(Sql);
                    WeightInfo_ID     = null;
                    WeightStrategy_ID = null;
                    string CarType_Name = null; //车辆类型
                    string Sort         = "";   //排序号
                    for (int i = 0; i < dst.Tables[0].Rows.Count; i++)
                    {
                        WeightInfo_ID     += dst.Tables[0].Rows[i]["WeighInfo_ID"] + ",";
                        WeightStrategy_ID += dst.Tables[0].Rows[i]["WeighStrategy_ID"] + ",";
                        CarType_Name      += dst.Tables[0].Rows[i]["CarType_Name"] + ",";
                        Sort += dst.Tables[0].Rows[i]["WeighStrategy_Sort"] + ",";
                    }

                    string[] CarType_Names = CarType_Name.Split(',');
                    string[] infoId        = WeightInfo_ID.Split(',');
                    string[] ID            = WeightStrategy_ID.Split(',');
                    string[] Car_Sort      = Sort.Split(',');
                    int      index         = 0;
                    for (int i = 0; i < infoId.Count() - 1; i++)
                    {
                        if (infoId[i] == WeighStrategy_ID)//进入说明存在此策略
                        {
                            #region 地磅策略判断
                            if (i > 0)//此磅房至少为2号磅房
                            {
                                //查询前面一个地磅策略是否通过 排序号 车辆类型名称   txtCarregistration_Carnumber.Tag.ToString()
                                string MyCarType = CarType_Names[i - 1];
                                string MySort    = Car_Sort[i - 1];
                                RraderSort = MySort;
                                string  SqlRecord = "select * from view_WeighStrategyRecord where WeighStrategyRecord_StaffInfo_ID=" + txtCarregistration_Name.Tag.ToString() + " and WeighInfo_ID=" + infoId[i - 1] + " and WeighStrategyRecord_CarType='" + MyCarType + "' and WeighStrategyRecord_CarInfo_ID=" + txtCarregistration_Carnumber.Tag.ToString();
                                DataSet ds        = LinQBaseDao.Query(SqlRecord);
                                if (ds.Tables[0].Rows.Count > 0)                                   //判断前面是否有数据,没有说明未正常通行
                                {
                                    if (!(bool)(ds.Tables[0].Rows[0]["WeighStrategyRecord_mark"])) //判断标识是否通过
                                    {
                                        MessageBox.Show("该车辆未按正常地磅策略顺序通行!");
                                        return(false);
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("未按地磅策略正常通行");
                                    return(false);
                                }

                                //判断当前地磅策略是否执行
                                string  Sqls = "select * from view_WeighStrategyRecord where WeighStrategyRecord_StaffInfo_ID=" + txtCarregistration_Name.Tag.ToString() + " and WeighInfo_ID=" + infoId[i] + " and WeighStrategyRecord_CarType='" + MyCarType + "'and WeighStrategyRecord_CarInfo_ID=" + txtCarregistration_Carnumber.Tag.ToString();
                                DataSet dsts = LinQBaseDao.Query(Sqls);
                                if (dsts.Tables[0].Rows.Count > 0)//判断前面是否有数据,有说明未正常通行
                                {
                                    MessageBox.Show("此磅房策略以通行,请更换磅房名");
                                    return(false);
                                }
                                else
                                {
                                    return(true);
                                }
                            }
                            else
                            {
                                //第一次进入,判断是否选择第一次进入磅房,查询有数据则异常
                                string  SqlRecord = "select * from view_WeighStrategyRecord where WeighStrategyRecord_StaffInfo_ID=" + txtCarregistration_Name.Tag.ToString() + " and WeighStrategyRecord_CarType='" + txtCartype_Name.Text.Trim() + "'and WeighStrategyRecord_CarInfo_ID=" + txtCarregistration_Carnumber.Tag.ToString();
                                DataSet ds        = LinQBaseDao.Query(SqlRecord);
                                if (ds.Tables[0].Rows.Count > 0)
                                {
                                    MessageBox.Show("此磅房验证已验过,请更换地磅房");
                                    return(false);
                                }
                                else
                                {
                                    return(true);
                                }
                            }
                            #endregion
                            index++;
                        }
                    }
                    if (index == 0)//没有此策略地磅
                    {
                        MessageBox.Show("未按正常策略通行");
                        return(false);
                    }
                    return(true);

                    #endregion
                }
            }
            catch
            {
                Console.WriteLine("");
                return(false);
            }
        }
Exemple #2
0
        private void GetData()
        {
            try
            {
                if (CommonalityEntity.isvoic)
                {
                    if (pv.PositionVoice_Content.ToString().Length > 0)
                    {
                        string sbSpeak = string.Empty;
                        sbSpeak += "请," + this.lvwUserList.SelectedRows[0].Cells["Queue_Id"].Value.ToString() + "," + GetNumberGbkString(lvwUserList.SelectedRows[0].Cells["QueueCarNumber"].Value.ToString()) + ",";
                        string str = lvwUserList.SelectedRows[0].Cells["QueueShortNumber"].Value.ToString();//排队号
                        sbSpeak += GetNumberGbkString(str.Substring(str.Length - 4));
                        sbSpeak += ",进,";
                        sbSpeak += GetNumberGbkString(comboxDriveway.Text.Replace("#", "号"));

                        //呼叫准备车辆数量
                        _LEDShowNumber = Convert.ToInt32(combox_LEDShowNumber.Text.Trim());
                        int number = _LEDShowNumber;
                        //呼叫提示下一辆车
                        string strslq = " select top(" + number + ") * from View_LEDShow_zj where  sortnumberinfo_state='启动'  and  车辆类型='" + _carType + "'   and  CarInfo_State='启动'  and  通行状态='排队中'  and 排队号 <> '' order by sortnumberinfo_ID";
                        dtsortnumber = LinQBaseDao.Query(strslq).Tables[0];

                        //正常呼叫时呼叫准备入厂车辆,异常不呼叫准备车辆
                        if (!isUnusual)
                        {
                            if (dtsortnumber.Rows.Count > 1)
                            {
                                for (int i = 0; i < number; i++)
                                {
                                    if (i <= dtsortnumber.Rows.Count - 1)
                                    {
                                        sbSpeak += ",请," + GetNumberGbkString(dtsortnumber.Rows[i]["排队号"].ToString().Substring(str.Length - 4)) + ",做准备";
                                    }
                                }
                            }
                        }
                        //将呼叫内容保存到呼叫表中
                        VoiceCalls vc = new VoiceCalls();
                        vc.VoiceCalls_Content       = sbSpeak;
                        vc.VoiceCalls_Number        = pv.PositionVoice_Count;
                        vc.VoiceCalls_PositionName  = SystemClass.PositionName;
                        vc.VoiceCalls_PositionValue = SystemClass.PosistionValue;
                        if (isUnusual)
                        {
                            vc.VoiceCalls_Remark = "异常呼叫";
                        }
                        else
                        {
                            vc.VoiceCalls_Remark = "";
                        }
                        vc.VoiceCalls_Time   = CommonalityEntity.GetServersTime();
                        vc.VoiceCalls_ISVice = false;
                        if (VoiceCallsDAL.InsertVoiceCalls(vc))
                        {
                            CommonalityEntity.ishujiao = false;
                            Commons.CommonClass.VoiceReade.readCount = SystemClass.HuJiaoCount;
                            Commons.CommonClass.VoiceReade.readTxt   = sbSpeak;
                            Thread myThread = new Thread(new ThreadStart(read));
                            myThread.Priority = ThreadPriority.Highest;
                            myThread.Start();
                            if (myThread.IsAlive)
                            {
                            }
                        }
                        else
                        {
                            MessageBox.Show("呼叫失败!");
                        }
                    }
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("QueueForm GetData()");
            }
        }
        /// <summary>
        /// 执行管理策略方法
        /// 查询语句一般string strSQL = "select * from ManagementStrategy where  ManagementStrategy_CarType_ID= ManagementStrategy_DrivewayStrategy_ID=ManagementStrategy_Type="
        /// 查询条件:车辆类型编号,通行策略编号,管控策略类型(登记、排队、进厂、出厂)
        /// </summary>
        ///<param name="strSql">查询SQl语句</param>
        public void ExecutionMethod(string strSql)
        {
            string s = "";

            try
            {
                Assembly assem = Assembly.GetExecutingAssembly();
                //// Create an object from the assembly, passing in the correct number
                //// and type of arguments for the constructor.
                Object o = assem.CreateInstance(NamespaceAndClass);
                #region 每次执行方法前需置空这些变量
                CheckMethod.listSql.Clear();
                CheckMethod.listMessage.Clear();
                #endregion

                List <string> listStr = GetMethodsReflect();
                #region 循环遍历执行的方法  数据库去获取管控策略
                string  strMethodName = "";//方法名称
                DataSet ds            = LinQBaseDao.Query(strSql);
                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        if (CommonalityEntity.IsUpdatedri)
                        {
                            foreach (DataRow dr in ds.Tables[0].Rows)
                            {
                                strMethodName = dr["ManagementStrategyRecord_Rule"].ToString();
                                if (!string.IsNullOrEmpty(strMethodName))
                                {
                                    if (strMethodName == "ISSAPLoadData")
                                    {
                                        if (CheckProperties.ce.CarType_Name.IndexOf("成品") >= 0)
                                        {
                                            CheckMethod.ISSAPLoadData(CheckProperties.ce.carInfo_Name, "20");
                                        }
                                        else if (CheckProperties.ce.CarType_Name.IndexOf("废纸") >= 0)
                                        {
                                            CheckMethod.ISSAPLoadData(CheckProperties.ce.carInfo_Name, "10");
                                        }
                                        else
                                        {
                                            CheckMethod.ISSAPLoadData(CheckProperties.ce.carInfo_Name, "30");
                                        }
                                        break;
                                    }
                                }
                            }
                            foreach (DataRow dr in ds.Tables[0].Rows)
                            {
                                strMethodName = dr["ManagementStrategyRecord_Rule"].ToString();
                                if (!string.IsNullOrEmpty(strMethodName))
                                {
                                    if (strMethodName == "ISSAPLoadData")
                                    {
                                        continue;
                                    }
                                    try
                                    {
                                        //验证执行的方法是否存在,存在执行方法,不存在做记事本日志记录
                                        if (ISMethod(strMethodName, listStr))
                                        {
                                            //如果存在默认值将默认值赋给CheckMethod.DefaultObj
                                            if (!string.IsNullOrEmpty(dr["ManagementStrategyRecord_Value"].ToString()))
                                            {
                                                CheckMethod.DefaultObj = dr["ManagementStrategyRecord_Value"];
                                            }
                                            //  CommonalityEntity.intCarInOutInfoRecord_ID =CommonalityEntity.GetInt(dr["ManagementStrategy_ID"].ToString());
                                            // 执行指定命名空间类的指定方法
                                            s = strMethodName;
                                            MethodInfo m   = assem.GetType(NamespaceAndClass).GetMethod(strMethodName);
                                            Object     ret = m.Invoke(o, new Object[] { }); //如果有参数将参数按方法的顺序存入new Object[] { }里面使用逗号隔开如“new Object[] { 1,2}”
                                            if (ret != null)
                                            {                                               //判断执行方法的返回值是否为空,不为空将结果放到指定的变量存储
                                            }
                                        }
                                        else
                                        {
                                            CommonClass.CommonalityEntity.WriteTextLog("执行管理策略方法未找到" + strMethodName + "方法?");
                                        }
                                    }
                                    catch (Exception)
                                    {
                                    }
                                }
                            }
                        }
                        else
                        {
                            foreach (DataRow dr in ds.Tables[0].Rows)
                            {
                                strMethodName = dr["ManagementStrategy_Rule"].ToString();
                                if (!string.IsNullOrEmpty(strMethodName))
                                {
                                    if (strMethodName == "ISSAPLoadData")
                                    {
                                        if (CheckProperties.ce.CarType_Name.IndexOf("成品") >= 0)
                                        {
                                            CheckMethod.ISSAPLoadData(CheckProperties.ce.carInfo_Name, "20");
                                        }
                                        else if (CheckProperties.ce.CarType_Name.IndexOf("废纸") >= 0)
                                        {
                                            CheckMethod.ISSAPLoadData(CheckProperties.ce.carInfo_Name, "10");
                                        }
                                        else
                                        {
                                            CheckMethod.ISSAPLoadData(CheckProperties.ce.carInfo_Name, "30");
                                        }
                                        break;
                                    }
                                }
                            }
                            foreach (DataRow dr in ds.Tables[0].Rows)
                            {
                                strMethodName = dr["ManagementStrategy_Rule"].ToString();
                                if (!string.IsNullOrEmpty(strMethodName))
                                {
                                    if (strMethodName == "ISSAPLoadData")
                                    {
                                        continue;
                                    }
                                    try
                                    {
                                        //验证执行的方法是否存在,存在执行方法,不存在做记事本日志记录
                                        if (ISMethod(strMethodName, listStr))
                                        {
                                            //如果存在默认值将默认值赋给CheckMethod.DefaultObj
                                            if (!string.IsNullOrEmpty(dr["ManagementStrategy_Value"].ToString()))
                                            {
                                                CheckMethod.DefaultObj = dr["ManagementStrategy_Value"];
                                            }
                                            //  CommonalityEntity.intCarInOutInfoRecord_ID =CommonalityEntity.GetInt(dr["ManagementStrategy_ID"].ToString());
                                            // 执行指定命名空间类的指定方法
                                            s = strMethodName;

                                            MethodInfo m   = assem.GetType(NamespaceAndClass).GetMethod(strMethodName);
                                            Object     ret = m.Invoke(o, new Object[] { }); //如果有参数将参数按方法的顺序存入new Object[] { }里面使用逗号隔开如“new Object[] { 1,2}”
                                            if (ret != null)
                                            {                                               //判断执行方法的返回值是否为空,不为空将结果放到指定的变量存储
                                            }
                                        }
                                        else
                                        {
                                            CommonClass.CommonalityEntity.WriteTextLog("执行管理策略方法未找到" + strMethodName + "方法?");
                                        }
                                    }
                                    catch (Exception)
                                    {
                                    }
                                }
                            }
                        }
                    }
                }
                #endregion
            }
            catch
            {
                string a = s;
            }
        }
Exemple #4
0
        /// <summary>
        /// 现场抽包
        /// </summary>
        public void ChoosePacks()
        {
            if (lvwUserList.SelectedRows.Count == 1)
            {
                try
                {
                    string Id = lvwUserList.SelectedRows[0].Cells["DRAW_EXAM_INTERFACE_ID"].Value.ToString();//抽样编号
                    lblDRAW_EXAM_INTERFACE_ID.Text = Id;
                    string SQLid = "select IS_DengJi from dbo.DRAW_EXAM_INTERFACE where DRAW_EXAM_INTERFACE_ID=" + Id;
                    if (LinQBaseDao.GetSingle(SQLid).ToString() == "Y")
                    {
                        lblCNTR_NO.Text     = lvwUserList.SelectedRows[0].Cells["CNTR_NO"].Value.ToString();     //车牌号
                        lblSHIPMENT_NO.Text = lvwUserList.SelectedRows[0].Cells["SHIPMENT_NO"].Value.ToString(); //送货单号
                        lblPO_NO.Text       = lvwUserList.SelectedRows[0].Cells["PO_NO"].Value.ToString();       //采购单号
                        lblPROD_ID.Text     = lvwUserList.SelectedRows[0].Cells["PROD_ID"].Value.ToString();     //货品
                        lblNO_OF_BALES.Text = lvwUserList.SelectedRows[0].Cells["NO_OF_BALES"].Value.ToString(); //总包数
                        string    sql = "select Packets_ID,Packets_DTS,Packets_this from Packets where Packets_QCInfo_DRAW_EXAM_INTERFACE_ID=" + Id;
                        DataTable dt  = LinQBaseDao.Query(sql).Tables[0];
                        string[]  str = null;
                        //if (dt != null && dt.Rows.Count > 0)
                        //{
                        lblPackets_ID.Text  = dt.Rows[0]["Packets_ID"].ToString();  //抽包编号
                        lblPackets_DTS.Text = dt.Rows[0]["Packets_DTS"].ToString(); //DTS抽包
                        str = dt.Rows[0]["Packets_this"].ToString().Split(',');     //现场抽包
                        //  }

                        txtPack1.Text = "";
                        txtPack2.Text = "";
                        txtPack3.Text = "";
                        txtPack4.Text = "";
                        if (str != null && str.Length > 0)
                        {
                            for (int i = 0; i < str.Length; i++)
                            {
                                foreach (Control item in groupBox1.Controls)
                                {
                                    if (item.Name == "txtPack" + (i + 1))
                                    {
                                        if (str[i] != "")
                                        {
                                            if (item != null)
                                            {
                                                item.Text = str[i];
                                            }
                                        }
                                        else
                                        {
                                            item.Text = "";
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("请先登记该车辆信息再抽包!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                catch
                {
                    MessageBox.Show("请先登记该车辆信息再抽包!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (lvwUserList.SelectedRows.Count > 1)
            {
                MessageBox.Show("系统每次只能对一辆车进行抽包!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MessageBox.Show("请先选择车辆信息再抽包!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string Packets_this = "";
                if (txtPack1.Text.Trim() != "")
                {
                    Packets_this += txtPack1.Text.Trim() + ",";
                }
                if (txtPack2.Text.Trim() != "")
                {
                    Packets_this += txtPack2.Text.Trim() + ",";
                }
                if (txtPack3.Text.Trim() != "")
                {
                    Packets_this += txtPack3.Text.Trim() + ",";
                }
                if (txtPack4.Text.Trim() != "")
                {
                    Packets_this += txtPack4.Text.Trim() + ",";
                }
                Packets_this = Packets_this.TrimEnd(',');

                string[] Packets_thisList = Packets_this.Split(',');
                string[] dtsList          = lblPackets_DTS.Text.Split(',');

                foreach (string item in Packets_thisList)
                {
                    foreach (string it in dtsList)
                    {
                        if (it == item)
                        {
                            MessageBox.Show("抽包号码“" + it + "”与DTS重复!");
                            return;
                        }
                    }
                }
                DataTable dtq = LinQBaseDao.Query("select QCInfo_ID from QCInfo where QCInfo_DRAW_EXAM_INTERFACE_ID=" + lblDRAW_EXAM_INTERFACE_ID.Text + " order by QCInfo_ID desc ").Tables[0];
                if (dtq.Rows.Count > 0)
                {
                    int moistcount = Convert.ToInt32(LinQBaseDao.GetSingle("select COUNT(0) from QCRecord where QCRecord_QCInfo_ID =" + dtq.Rows[0][0].ToString() + " and QCRecord_TestItems_ID in (1,3,4)"));
                    if (moistcount > 0)
                    {
                        MessageBox.Show(this, "已开始测水,不能再抽包");
                        return;
                    }
                }

                if (lblPackets_ID.Text.Trim() != "")
                {
                    Expression <Func <Packets, bool> > fnP = n => n.Packets_ID == Convert.ToInt32(lblPackets_ID.Text.Trim());

                    Action <Packets> a = n =>
                    {
                        n.Packets_this = Packets_this;
                    };

                    if (PacketsDAL.Update(fnP, a))
                    {
                        //抽包后修改qcinfo表 抽包总数和总抽包号
                        string bags = lblPackets_DTS.Text + "," + Packets_this;
                        if (dtq.Rows.Count > 0)
                        {
                            Common.GetSumWaterCount(Convert.ToInt32(dtq.Rows[0][0].ToString()));
                            LinQBaseDao.Query("update QCInfo set QCInfo_DRAW='" + bags + "',QCInfo_PumpingPackets=" + bags.Split(',').Count() + ",QCInfo_MOIST_Count=" + Common.SumWaterCount + "  where QCInfo_DRAW_EXAM_INTERFACE_ID=" + lblDRAW_EXAM_INTERFACE_ID.Text);
                        }
                        else
                        {
                            LinQBaseDao.Query("update QCInfo set QCInfo_DRAW='" + bags + "',QCInfo_PumpingPackets=" + bags.Split(',').Count() + " where QCInfo_DRAW_EXAM_INTERFACE_ID=" + lblDRAW_EXAM_INTERFACE_ID.Text);
                        }
                        DialogResult dia = MessageBox.Show("操作成功!是否打印空的水分报表?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
                        if (dia.Equals(DialogResult.Yes))
                        {
                            dayin(lblDRAW_EXAM_INTERFACE_ID.Text);
                        }
                    }
                    else
                    {
                        MessageBox.Show("操作失败!");
                    }

                    Bangding_Load(RegistrationWhere());
                }
            }
            catch (Exception err)
            {
            }
        }
Exemple #6
0
 /// <summary>
 /// 按条件查询信息View_FVN_Driveway_Position
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <View_FVN_Driveway_Position> QueryView(Expression <Func <View_FVN_Driveway_Position, bool> > fun)
 {
     return(LinQBaseDao.Query <View_FVN_Driveway_Position>(new DCCarManagementDataContext(), fun));
 }
Exemple #7
0
        /// <summary>
        /// 保存,如果有同样车牌号的通行策略则把之前的状态注销
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            IList <DrivewayStrategyRecord> iedsr = null;

            try
            {
                if (string.IsNullOrEmpty(txt_carState.Text))
                {
                    PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "请选择状态!", txt_carState, this);
                    return;
                }
                string strsort = "";
                if (SortYesOrNo)
                {
                    strsort = "有序";
                }
                else
                {
                    strsort = "无序";
                }
                if (SetSortList.Count != Driveway_IDList.Count)
                {
                    SortYesOrNo = false;
                }
                else
                {
                    SortYesOrNo = true;
                }
                //得到车辆对象
                Expression <Func <CarInfo, bool> > fn = n => n.CarInfo_ID == Convert.ToInt32(CommonalityEntity.CarInfo_ID);
                CarInfo car = CarInfoDAL.Single(fn);


                LinQBaseDao.Query("delete ManagementStrategyRecord where ManagementStrategyRecord_CarInfo_ID=" + car.CarInfo_ID);
                LinQBaseDao.Query("delete DrivewayStrategyRecord where DrivewayStrategyRecord_CarInfo_ID=" + car.CarInfo_ID);

                //循环选择的通道
                iedsr = new List <DrivewayStrategyRecord>();

                if (SetSortList.Count == Driveway_IDList.Count)
                {
                    for (int i = 0; i < SetSortList.Count; i++)
                    {
                        DataTable tablesDrisn = LinQBaseDao.Query("select Position_Name,Driveway_Name,Driveway_type from View_DrivewayPosition where driveway_warrantystate='正常' and driveway_state='启动' and Driveway_ID=" + SetSortList[i].id + "  order by Position_Name asc, Driveway_Name asc").Tables[0];

                        DrivewayStrategyRecord Newdsr = new DrivewayStrategyRecord();
                        Newdsr.DrivewayStrategyRecord_Name        = txtDrivewayStrategy.Text.Trim();
                        Newdsr.DrivewayStrategyRecord_Driveway_ID = SetSortList[i].id;//通道编号
                        Newdsr.DrivewayStrategyRecord_State       = txt_carState.Text;
                        Newdsr.DrivewayStrategyRecord_Remark      = txt_DrivewayStrategyRecord_Remark.Text.Trim();
                        Newdsr.DrivewayStrategyRecord_OffReason   = txt_DrivewayStrategyRecord_OffReason.Text.Trim();
                        Newdsr.DrivewayStrategyRecord_OffTime     = CommonalityEntity.GetServersTime();
                        Newdsr.DrivewayStrategyRecord_OffName     = HelpClass.common.USERNAME;
                        Newdsr.DrivewayStrategyRecord_CarInfo_ID  = car.CarInfo_ID;
                        Newdsr.DrivewayStrategyRecord_Sort        = SortYesOrNo == true ? SetSortList[i].sort : 1;
                        Newdsr.DrivewayStrategyRecord_Record      = "【" + txt_carInfo_Name.Text.ToString().Trim() + "】 " + tablesDrisn.Rows[0]["Position_Name"] + tablesDrisn.Rows[0]["Driveway_Name"];
                        iedsr.Add(Newdsr);
                    }

                    try
                    {
                        dc.DrivewayStrategyRecord.InsertAllOnSubmit(iedsr);
                        dc.SubmitChanges();



                        DialogResult dr = MessageBox.Show("操作已完成!请继续修改相应的管控策略否则修改无效", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                        if (dr == DialogResult.Yes)
                        {
                            string sids = "";

                            DataTable dt = LinQBaseDao.Query("select DrivewayStrategyRecord_ID, DrivewayStrategyRecord_Driveway_ID from DrivewayStrategyRecord where DrivewayStrategyRecord_CarInfo_ID=" + car.CarInfo_ID + " and DrivewayStrategyRecord_State='启动' order by DrivewayStrategyRecord_Sort ").Tables[0];
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                sids += dt.Rows[i][0].ToString() + ",";
                            }
                            int driid = Convert.ToInt32(dt.Rows[0][1].ToString());
                            sids = sids.TrimEnd(',');
                            string SmallID = LinQBaseDao.GetSingle("select SmallTicket_ID from SmallTicket where SmallTicket_CarInfo_ID=" + car.CarInfo_ID).ToString();

                            DataTable dtpd = LinQBaseDao.Query("select Position_ID, Position_Value,Driveway_Value from View_FVN_Driveway_Position where Driveway_ID=" + driid).Tables[0];
                            if (dtpd.Rows.Count > 0)
                            {
                                string str = "update CarInOutRecord set CarInOutRecord_DrivewayStrategyS='" + sids + "',CarInOutRecord_Update=1,CarInOutRecord_Driveway_ID=" + driid + ",CarInOutRecord_Remark='" + txtDrivewayStrategy.Text.Trim() + "',CarInOutRecord_Sort='" + strsort + "' where CarInOutRecord_CarInfo_ID=" + car.CarInfo_ID;
                                str += " update SortNumberInfo set  SortNumberInfo_PositionValue='" + dtpd.Rows[0][1].ToString() + "',SortNumberInfo_DrivewayValue='" + dtpd.Rows[0][2].ToString() + "' where  SortNumberInfo_SmallTicket_ID in (select SmallTicket_ID from SmallTicket where SmallTicket_CarInfo_ID=" + car.CarInfo_ID + ")";
                                LinQBaseDao.Query(str);

                                sids = "";
                                CommonalityEntity.boolCepyManagementStrategy = false;
                                UpdateManagementStrategyForm up = new UpdateManagementStrategyForm(carname);
                                up.Show();
                            }
                        }
                        BingMethod();
                    }
                    catch
                    {
                        MessageBox.Show("操作失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("DrivewayStrategyRecordForm.btnUpdate_Click()" + "".ToString());
            }
            finally
            {
                SetSortList.Clear();
                Driveway_IDList.Clear();
            }
        }
        /// <summary>
        /// 删除
        /// </summary>
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            try
            {
                if (TV_MenuInfo.SelectedNode.Tag.ToString() != null)
                {
                    int menuID = Convert.ToInt32(TV_MenuInfo.SelectedNode.Tag.ToString());
                    #region --查询模块--
                    if (menuID <= -1)
                    {
                        MessageBox.Show("请选择节点!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    bool Menu_Enabledtxt     = false;
                    bool cob_Menu_Visibletxt = false;
                    Expression <Func <MenuInfo, bool> > funviewinto = n => n.Menu_ControlName == TV_MenuInfo.SelectedNode.Name.ToString();
                    foreach (var n in MenuInfoDAL.Query(funviewinto))
                    {
                        if (n.Menu_Enabled != null)
                        {
                            Menu_Enabledtxt = Convert.ToBoolean(n.Menu_Enabled);
                        }
                        if (n.Menu_Visible != null)
                        {
                            //字典备注
                            cob_Menu_Visibletxt = Convert.ToBoolean(n.Menu_Visible);
                        }
                        break;
                    }

                    #endregion

                    if (txt_Menu_ControlText.ToString() == "" || txt_Menu_ControlText == null)
                    {
                        TV_MenuInfo_NodeMouseDoubleClick(sender, null);
                    }

                    //1.删除菜单时,检查菜单是否配置;若配置了不能删除,需要先解除配置
                    //检测删除的节点是否存在
                    //检测菜单是否可以删除(等待)
                    //检测菜单是否可以编辑
                    //检测菜单是否已经配置
                    //检测是否有删除菜单的权限(等待)不可编辑
                    if (Convert.ToInt32(TV_MenuInfo.SelectedNode.Tag.ToString()) > 0)
                    {
                        Expression <Func <MenuInfo, bool> > fun = n => n.Menu_ID == Convert.ToInt32(TV_MenuInfo.SelectedNode.Tag.ToString());
                    }
                    DataTable table = LinQBaseDao.Query("select * from MenuInfo where Menu_OtherID=" + menuID + "").Tables[0];
                    if (table.Rows.Count > 0)
                    {
                        MessageBox.Show("请先删除子节点!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }

                    if (Menu_Enabledtxt == true || cob_Menu_Visibletxt == true)
                    {
                        LinQBaseDao.Query("update  menuinfo set Menu_MenuType_ID=NULL where   Menu_ID=" + menuID + "");
                        LinQBaseDao.Query("DELETE  PermissionsInfo where Permissions_Menu_ID=" + menuID + "");
                        LinQBaseDao.Query("DELETE  menuinfo where  Menu_ID=" + menuID + "");
                        MessageBox.Show("删除成功!");
                        CommonalityEntity.WriteLogData("删除", "btn_Delete_Click", CommonalityEntity.USERNAME);//添加日志
                    }
                    TV_MenuInfo.Nodes.Clear();
                    InitMenu();//重新绑定控件
                }
                else
                {
                    MessageBox.Show("请选择节点!");
                }
            }
            catch
            {
                MessageBox.Show("无法删除!");
                CommonalityEntity.WriteTextLog("菜单管理MenuInfoManager btn_Delete_Click");
            }
        }
Exemple #9
0
        //申请重置
        private void btnshenqing_Click(object sender, EventArgs e)
        {
            addsqlwhere = " where 1=1";
            if (txtRemark.Text.Trim() == "")
            {
                MessageBox.Show("重置原因不能为空。", "提示");
                return;
            }
            if (gridevewSortReset.SelectedRows.Count > 1)
            {
                MessageBox.Show("每次只能对一辆车进行重置申请。", "提示");
                return;
            }
            else if (gridevewSortReset.SelectedRows.Count == 0)
            {
                MessageBox.Show("请选择一个车辆信息进行重置申请。", "提示");
                return;
            }
            if (txtqian.Text.ToString() == cbohou.SelectedText.ToString())
            {
                MessageBox.Show("重置后状态不能与重置前是相同的状态。", "提示");
                return;
            }
            if (string.IsNullOrEmpty(cbohou.Text))
            {
                MessageBox.Show("请选择重置后状态。", "提示");
                return;
            }
            if (gridevewSortReset.SelectedRows.Count == 1)
            {
                string sqlcc = "select sortReset_SortNumberInfo_SmallTicket_ID from sortReset where sortReset_CarInfo_ID = " + gridevewSortReset.SelectedRows[0].Cells["CarInfo_ID"].Value.ToString() + " and sortReset_Sortjg = 0";
                int    count = LinQBaseDao.Query(sqlcc).Tables[0].Rows.Count;
                if (count >= 1)
                {
                    MessageBox.Show("该车辆已有一条未审批的记录,不能重复添加。", "提示");
                }
                else if (count == 0)
                {
                    addsqlwhere += " and CarInfo_Name = '" + gridevewSortReset.SelectedRows[0].Cells["CarInfo_Name"].Value.ToString() + "'";

                    string    sql   = "select CarInfo_ID,CarInfo_Name,SmallTicket_ID,SmallTicket_Serialnumber,SmallTicket_SortNumber,ICCard_ID,ICCard_Value from View_CarState " + addsqlwhere + "";
                    DataTable table = LinQBaseDao.Query(sql).Tables[0];

                    sortReset sr = new sortReset();
                    sr.sortReset_CarInfo_ID   = Convert.ToInt32(table.Rows[0]["CarInfo_ID"].ToString());
                    sr.sortReset_CarInfo_Name = table.Rows[0]["CarInfo_Name"].ToString();
                    sr.sortReset_QTongxing    = txtqian.Text.Trim();
                    sr.sortReset_HTongxing    = cbohou.Text.Trim();

                    //判断是有小票的还是是有IC卡的车辆信息
                    if (table.Rows[0]["ICCard_Value"].ToString() == "" && table.Rows[0]["ICCard_ID"].ToString() == "")
                    {
                        sr.sortReset_SmallTicket_Serialnumber = table.Rows[0]["SmallTicket_Serialnumber"].ToString();
                    }
                    else if (table.Rows[0]["SmallTicket_Serialnumber"].ToString() == "")
                    {
                        sr.sortReset_SmallTicket_ICCard_ID    = Convert.ToInt32(table.Rows[0]["ICCard_ID"].ToString());
                        sr.sortReset_SmallTicket_ICCard_Value = table.Rows[0]["ICCard_Value"].ToString();
                    }

                    sr.sortReset_SmallTicket_SortNumber        = table.Rows[0]["SmallTicket_SortNumber"].ToString();
                    sr.sortReset_SortNumberInfo_SmallTicket_ID = Convert.ToInt32(table.Rows[0]["SmallTicket_ID"].ToString());
                    sr.sortReset_ShenQingTime = CommonalityEntity.GetServersTime();
                    sr.sortReset_ShenQingRen  = CommonalityEntity.USERNAME;
                    sr.sortReset_Sortjg       = 0;
                    sr.sortReset_Remark       = txtRemark.Text.Trim();

                    if (LinQBaseDao.InsertOne <sortReset>(new DCCarManagementDataContext(), sr))
                    {
                        MessageBox.Show("申请成功!!!", "提示");

                        txtqian.Text         = "";
                        txtchepai.Text       = "";
                        txtmengang.Text      = "";
                        txtpaiduihao.Text    = "";
                        txtxiaopiao.Text     = "";
                        cbohou.SelectedIndex = 0;
                        cbohou.Enabled       = false;
                        btnshenqing.Enabled  = false;
                    }
                    else
                    {
                        CommonalityEntity.WriteLogData("增加", "申请了车牌为" + table.Rows[0]["CarInfo_Name"].ToString() + "的状态重置申请。", CommonalityEntity.USERNAME);
                        MessageBox.Show("申请失败!!!", "提示");
                        txtchepai.Text    = "";
                        txtmengang.Text   = "";
                        txtpaiduihao.Text = "";
                        txtxiaopiao.Text  = "";
                    }
                }
            }
        }
        /// <summary>
        /// 卸货授权
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUnload_Click(object sender, EventArgs e)
        {
            strsql();
            if (sql == "")
            {
                MessageBox.Show("没有该IC卡(小票)号的信息!");
                return;
            }
            DataTable ds = LinQBaseDao.Query(sql).Tables[0];

            if (ds.Rows.Count > 1)
            {
                if (ISFill(ds) == false)
                {
                    return;
                }
                if (Convert.ToBoolean(ds.Rows[0]["CarInOutRecord_ISFulfill"].ToString()))
                {
                    MessageBox.Show("该车辆已通行完成,无需授权!");
                    return;
                }
                string    carinout = ds.Rows[0]["CarInOutRecord_ID"].ToString();
                DataTable tableB   = LinQBaseDao.Query("select * from BusinessRecord where BusinessRecord_CarInOutRecord_ID=" + carinout).Tables[0];
                for (int i = 0; i < tableB.Rows.Count; i++)
                {
                    if (tableB.Rows[i]["BusinessRecord_Type"].ToString() == CommonalityEntity.unloadFirstWeight)
                    {
                        if (tableB.Rows[i]["BusinessRecord_UnloadEmpower"].ToString() == "1")
                        {
                            MessageBox.Show("车辆已授权!");
                            return;
                        }
                        CheckMethod.AbnormalInformation = "";
                        CommonalityEntity.CarInoutid    = carinout;
                        if (Convert.ToBoolean(ds.Rows[0]["CarInOutRecord_Update"].ToString()))
                        {
                            CommonalityEntity.IsUpdatedri = true;
                            sql = "Select * from ManagementStrategyRecord where ManagementStrategyRecord_State='启动' and ManagementStrategyRecord_CarType_ID in(select CarType_ID from CarType where CarType_Name='" + ds.Rows[0]["CarType_Name"].ToString() + "') and ManagementStrategyRecord_ControlInfo_ID in (select ControlInfo_ID from ControlInfo where  ControlInfo_IDValue='450201'  )";
                        }
                        else
                        {
                            CommonalityEntity.IsUpdatedri = false;
                            sql = "Select * from ManagementStrategy where ManagementStrategy_State='启动' and ManagementStrategy_CarType_ID in(select CarType_ID from CarType where CarType_Name='" + ds.Rows[0]["CarType_Name"].ToString() + "') and ManagementStrategy_ControlInfo_ID in (select ControlInfo_ID from ControlInfo where  ControlInfo_IDValue='450201'  )";
                        }
                        checkPr.ExecutionMethod(sql);
                        if (CheckMethod.AbnormalInformation != "")
                        {
                            MessageBox.Show("过磅重量异常,授权失败!");
                            return;
                        }
                        Expression <Func <BusinessRecord, bool> > p = n => n.BusinessRecord_CarInOutRecord_ID == int.Parse(carinout) && n.BusinessRecord_Type == CommonalityEntity.unloadFirstWeight;
                        Action <BusinessRecord> ap = s =>
                        {
                            s.BusinessRecord_UnloadEmpowerPerson = CommonalityEntity.USERNAME;
                            s.BusinessRecord_UnloadEmpowerTime   = CommonalityEntity.GetServersTime();
                            s.BusinessRecord_PrintinvoiceTime    = CommonalityEntity.GetServersTime();
                            s.BusinessRecord_UnloadEmpower       = 1;
                            s.BusinessRecord_Remark = txtRemark.Text.ToString().Trim();
                        };

                        if (BusinessRecordDAL.Update(p, ap))
                        {
                            CommonalityEntity.WriteLogData("新增", "地磅房:车辆" + ds.Rows[0]["CarInfo_Name"].ToString() + "卸货授权", CommonalityEntity.USERNAME);//添加操作日志
                            MessageBox.Show("授权成功");
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("车辆没有过磅,不能授权!");
                return;
            }
        }
        /// <summary>
        /// 得到图片信息
        /// </summary>
        /// <param name="doubleMin">过期时间</param>
        /// <param name="strImagefile">图片存放文件夹路径</param>
        /// <returns></returns>
        //public static List<string> GetImages(double doubleMin, string strImagefile)
        //{
        //    List<string> list = new List<string>();
        //    string[] images = null;
        //    try
        //    {
        //        if (strImagefile != "")
        //        {
        //            images = Directory.GetFiles(strImagefile);
        //            int i = 0;
        //            foreach (string pathStr in images)
        //            {
        //                string fileName = pathStr.Substring(pathStr.LastIndexOf('\\') + 1);//图片名称
        //                string fileKind = fileName.Substring(fileName.LastIndexOf('.') + 1);//图片后缀
        //                if (fileKind.ToLower() != "jpg" && fileKind.ToLower() != "jpeg" && fileKind.ToLower() != "png" && fileKind.ToLower() != "gif" && fileKind.ToLower() != "bmp")
        //                {
        //                    continue;
        //                }
        //                string mi = GetTime(fileName.ToString());//获取时间差

        //                //根据通道编号得到该通道下的摄像机名称
        //                DataSet camera = LinQBaseDao.Query("select * from eh_Camera where Driveway_id=" + common.Driveway_Id + "");
        //                foreach (DataRow dr in camera.Tables[0].Rows)
        //                {
        //                    if (double.Parse(mi) <= doubleMin)//判断是否过期
        //                    {

        //                        if (fileName.Length == 21)//判断图片名称字符长度
        //                        {
        //                            if (dr["Camera_AddCard"].ToString() == fileName.Substring(16, 1))
        //                            {

        //                                list.Add(fileName);
        //                                i++;

        //                            }
        //                        }
        //                        else if (fileName.Length == 22)
        //                        {
        //                            if (dr["Camera_AddCard"].ToString() == fileName.Substring(16, 2))
        //                            {

        //                                if (list.Count < camera.Tables[0].Rows.Count)
        //                                {
        //                                    list.Add(fileName);
        //                                    i++;
        //                                }
        //                            }
        //                        }

        //                        if (i == camera.Tables[0].Rows.Count)
        //                        {
        //                            break;
        //                        }
        //                    }
        //                }
        //                if (i == camera.Tables[0].Rows.Count)
        //                {
        //                    break;
        //                }
        //            }

        //        }
        //    }
        //    catch
        //    { }
        //    return list;
        //}
        #endregion
        /// <summary>
        /// 得到有效的图片
        /// </summary>
        /// <param name="doubleMin">过期时间</param>
        /// <param name="strImagefile">图片存放文件夹路径</param>
        /// <returns></returns>
        public static List <string> GetImages(double doubleMin, string strImagefile)
        {
            List <string> list = new List <string>();

            string[] images = null;
            try
            {
                if (strImagefile != "")
                {
                    images = Directory.GetFiles(strImagefile);
                    var image = from m in images
                                orderby m descending
                                select m;
                    //根据通道编号得到该通道下的摄像机名称
                    DataSet camera = LinQBaseDao.Query("select * from eh_Camera where Driveway_id=" + common.Driveway_Id + "");
                    foreach (DataRow dr in camera.Tables[0].Rows)
                    {
                        foreach (string pathStr in image)
                        {
                            string fileName = pathStr.Substring(pathStr.LastIndexOf('\\') + 1);  //图片名称
                            string fileKind = fileName.Substring(fileName.LastIndexOf('.') + 1); //图片后缀
                            //验证是否为图片
                            if (fileKind.ToLower() != "jpg" && fileKind.ToLower() != "jpeg" && fileKind.ToLower() != "png" && fileKind.ToLower() != "gif" && fileKind.ToLower() != "bmp")
                            {
                                continue;
                            }
                            string mi = GetTime(fileName.ToString()); //获取时间差

                            if (double.Parse(mi) <= doubleMin)        //判断是否过期
                            {
                                if (fileName.Length == 21)            //判断图片名称字符长度
                                {
                                    string camera_addCard = dr["Camera_AddCard"].ToString();
                                    if (dr["Camera_AddCard"].ToString() == fileName.Substring(16, 1))
                                    {
                                        list.Add(fileName);
                                        break;
                                    }
                                }
                                else if (fileName.Length == 22)
                                {
                                    if (dr["Camera_AddCard"].ToString() == fileName.Substring(16, 2))
                                    {
                                        list.Add(fileName);
                                        break;
                                    }
                                }
                            }
                        }
                        if (list.Count == camera.Tables[0].Rows.Count)
                        {
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                common.WriteTextLog("ImageFile GetImages()" + ex.Message);
            }
            return(list);
        }
        /// <summary>
        /// 授权
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOutPass_Click(object sender, EventArgs e)
        {
            strsql();
            if (sql == "")
            {
                MessageBox.Show("没有该IC卡(小票)号的信息!");
                return;
            }
            DataTable ds = LinQBaseDao.Query(sql).Tables[0];

            if (ds.Rows.Count > 1)
            {
                if (ISFill(ds) == false)
                {
                    return;
                }
                string    loadtype = "";
                string    type     = "";
                double    wegiht1  = 0;
                double    wegiht2  = 0;
                string    carinout = ds.Rows[0]["CarInOutRecord_ID"].ToString();
                DataTable tableB   = LinQBaseDao.Query("select * from BusinessRecord where BusinessRecord_CarInOutRecord_ID=" + carinout).Tables[0];
                for (int i = 0; i < tableB.Rows.Count; i++)
                {
                    if (tableB.Rows[i]["BusinessRecord_Type"].ToString() == CommonalityEntity.unloadSecondWeight)
                    {
                        if (tableB.Rows[i]["BusinessRecord_UnloadEmpower"].ToString() == "1")
                        {
                            MessageBox.Show("车辆已卸货确认!");
                            return;
                        }
                        loadtype = CommonalityEntity.unloadSecondWeight;
                        wegiht2  = Convert.ToDouble(tableB.Rows[i]["BusinessRecord_Weight"].ToString());
                    }
                    if (tableB.Rows[i]["BusinessRecord_Type"].ToString() == CommonalityEntity.unloadFirstWeight)
                    {
                        type    = CommonalityEntity.unloadFirstWeight;
                        wegiht1 = Convert.ToDouble(tableB.Rows[i]["BusinessRecord_Weight"].ToString());
                    }
                }
                if (loadtype == CommonalityEntity.unloadSecondWeight && type == "")
                {
                    MessageBox.Show("没有卸货点第一次过磅");
                    return;
                }

                if (loadtype == CommonalityEntity.unloadSecondWeight && type == CommonalityEntity.unloadFirstWeight)
                {
                    Expression <Func <BusinessRecord, bool> > p = n => n.BusinessRecord_CarInOutRecord_ID == int.Parse(carinout) && n.BusinessRecord_Type == CommonalityEntity.unloadSecondWeight;
                    Action <BusinessRecord> ap = s =>
                    {
                        s.BusinessRecord_UnloadEmpowerPerson = CommonalityEntity.USERNAME;
                        s.BusinessRecord_UnloadEmpowerTime   = CommonalityEntity.GetServersTime();
                        s.BusinessRecord_PrintinvoiceTime    = CommonalityEntity.GetServersTime();
                        s.BusinessRecord_UnloadEmpower       = 1;
                        s.BusinessRecord_Remark = txtRemark.Text.ToString().Trim();
                    };

                    if (BusinessRecordDAL.Update(p, ap))
                    {
                        CommonalityEntity.WriteLogData("新增", "地磅房:车辆" + ds.Rows[0]["CarInfo_Name"].ToString() + "卸货确认", CommonalityEntity.USERNAME);//添加操作日志
                        MessageBox.Show("确认成功");
                    }
                }
            }
            else
            {
                MessageBox.Show("车辆没有过磅,不能卸货确认!");
                return;
            }
        }
        private void LoadData()
        {
            strsql();
            if (sql == "")
            {
                MessageBox.Show("没有该IC卡(小票)号的信息!");
                return;
            }
            DataTable ds = LinQBaseDao.Query(sql).Tables[0];

            if (ds.Rows.Count < 1)
            {
                Empty();
                return;
            }

            txtInWeight.Text                  = "";
            txtOutWeight.Text                 = "";
            txtCartype_Name.Text              = ds.Rows[0]["CarType_Name"].ToString();
            txtCartype_Name.Tag               = ds.Rows[0]["CarType_ID"].ToString();
            txtCarregistration_Customer.Text  = ds.Rows[0]["CustomerInfo_Name"].ToString();
            txtCarregistration_Name.Text      = ds.Rows[0]["StaffInfo_Name"].ToString();
            txtCarregistration_Name.Tag       = ds.Rows[0]["StaffInfo_ID"].ToString();
            txtCarregistration_Carnumber.Text = ds.Rows[0]["CarInfo_Name"].ToString();
            txtCarregistration_Carnumber.Tag  = ds.Rows[0]["CarInfo_ID"].ToString();
            CommonalityEntity.CarInfo_ID      = ds.Rows[0]["CarInfo_ID"].ToString();
            // txtCarregistration_License.Text = ds.Rows[0]["StaffInfo_License"].ToString();
            txtCarregistration_Phone.Text        = ds.Rows[0]["StaffInfo_Phone"].ToString();
            txtCarregistration_IdentityCard.Text = ds.Rows[0]["StaffInfo_Identity"].ToString();
            txtCarregistration_Carriage.Text     = ds.Rows[0]["CarInfo_Carriage"].ToString();
            txtCarregistration_Weight.Text       = ds.Rows[0]["CarInfo_Weight"].ToString();
            txtCarregistration_Height.Text       = ds.Rows[0]["CarInfo_Height"].ToString();
            if (Convert.ToBoolean(ds.Rows[0]["CarInfo_Bail"].ToString()) == true)
            {
                ckbCarInfo_Bail.Checked = true;
            }
            else
            {
                ckbCarInfo_Bail.Checked = false;
            }
            txtOperateTime.Text = ds.Rows[0]["CarInfo_Time"].ToString();
            txtOperateUser.Text = ds.Rows[0]["CarInfo_Operate"].ToString();
            txtRemark.Text      = ds.Rows[0]["CarInfo_Remark"].ToString();

            Abnormal();
            txtExecPtion.Text = abnormal;
            if (ISFill(ds) == false)
            {
                return;
            }

            ///////////////
            string caroutid = ds.Rows[0]["CarInOutRecord_ID"].ToString();

            if (ds.Rows.Count > 0)
            {
                DataTable dt = LinQBaseDao.Query("select * from BusinessRecord where BusinessRecord_CarInOutRecord_ID=" + caroutid + "").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        string type = dt.Rows[i]["BusinessRecord_Type"].ToString();
                        if (type == CommonalityEntity.unloadFirstWeight)
                        {
                            txtInWeight.Text = dt.Rows[i]["BusinessRecord_Weight"].ToString();
                        }
                        if (type == CommonalityEntity.unloadSecondWeight)
                        {
                            txtOutWeight.Text = dt.Rows[i]["BusinessRecord_Weight"].ToString();
                        }
                    }
                }
            }
            string        sqll = "Select * from CarPic where CarPic_CarInfo_ID=" + ds.Rows[0]["CarInfo_ID"].ToString();
            List <CarPic> list = new List <CarPic>();

            list = LinQBaseDao.GetItemsForListing <CarPic>(sqll).ToList();
            int    k    = 0;
            string path = SystemClass.SaveFile;

            foreach (var pathStr in list)
            {
                if (k < 7)
                {
                    PictureBox pb = new PictureBox();
                    int        x  = (20 + 165 * k);
                    int        y  = 20;
                    pb.Location      = new Point(x, y);
                    pb.Width         = 145;
                    pb.Height        = 160;
                    pb.SizeMode      = System.Windows.Forms.PictureBoxSizeMode.StretchImage;;
                    pb.MouseHover   += new System.EventHandler(this.pbInImageOne_MouseHover);
                    pb.MouseLeave   += new System.EventHandler(this.pbInImageOne_MouseLeave);
                    pb.Name          = "pictureBox" + (k + 1).ToString();
                    pb.Tag           = path + pathStr.CarPic_Add.ToString();
                    pb.ImageLocation = path + pathStr.CarPic_Add.ToString();
                    this.GroBoxContext.Controls.Add(pb);
                    k++;
                }
            }
            btnSave.Enabled = true;
        }
        /// <summary>
        /// 保存事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string txtserialnumber = txtSerialnumber.Text.ToString().Trim();
                string txtinweight     = txtInWeight.Text.ToString().Trim();
                string txtoutweight    = txtOutWeight.Text.ToString().Trim();
                strsql();
                if (sql == "")
                {
                    MessageBox.Show("没有该IC卡(小票)号的信息!");
                    return;
                }
                DataTable table = LinQBaseDao.Query(sql).Tables[0];
                if (table.Rows.Count > 0)
                {
                    if (Convert.ToBoolean(table.Rows[0]["CarInOutRecord_ISFulfill"].ToString()))
                    {
                        MessageBox.Show("该车辆通行已完成!");
                        return;
                    }
                    if (ISFill(table) == false)
                    {
                        return;
                    }

                    string    carinoutrecord = table.Rows[0]["CarInOutRecord_ID"].ToString();
                    string    weight1        = "";
                    string    weight2        = "";
                    string    type           = "";
                    DataTable tableB         = LinQBaseDao.Query("select * from BusinessRecord where BusinessRecord_CarInOutRecord_ID=" + carinoutrecord).Tables[0];
                    for (int i = 0; i < tableB.Rows.Count; i++)
                    {
                        if (tableB.Rows[i]["BusinessRecord_Type"].ToString() == CommonalityEntity.unloadFirstWeight)
                        {
                            weight1 = tableB.Rows[i]["BusinessRecord_Weight"].ToString();
                        }
                        if (tableB.Rows[i]["BusinessRecord_Type"].ToString() == CommonalityEntity.unloadSecondWeight)
                        {
                            weight2 = tableB.Rows[i]["BusinessRecord_Weight"].ToString();
                        }
                        if (tableB.Rows[i]["BusinessRecord_Type"].ToString() == CommonalityEntity.upWeight)
                        {
                            type = tableB.Rows[i]["BusinessRecord_Type"].ToString();
                        }
                    }
                    //对地磅策略判断   该磅房信息
                    if (Convert.ToInt32(cobWeighStrategyRecord.SelectedValue) < 1)
                    {
                        MessageBox.Show("请选择此磅房名称");
                        return;
                    }
                    if (!WeighStrategyIf())
                    {
                        return;
                    }
                    //判断进门地磅是否重复记录
                    if (txtinweight != "" && txtinweight != weight1)
                    {
                        DataTable ds = LinQBaseDao.Query("select * from BusinessRecord where BusinessRecord_Type='" + CommonalityEntity.unloadFirstWeight + "' and BusinessRecord_CarInOutRecord_ID=" + carinoutrecord + " order by BusinessRecord_ID desc").Tables[0];
                        if (ds.Rows.Count > 0)
                        {
                            if (MessageBox.Show("是否修改" + CommonalityEntity.unloadFirstWeight + "重量?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                LinQBaseDao.Query("update BusinessRecord set BusinessRecord_Weight=" + txtinweight + " where BusinessRecord_CarInOutRecord_ID=" + carinoutrecord + " and BusinessRecord_Type='" + CommonalityEntity.unloadFirstWeight + "'");
                            }
                            else
                            {
                                return;
                            }
                        }
                        else
                        {
                            if (type == CommonalityEntity.upWeight)
                            {
                                string carinfo_po = table.Rows[0]["CarInfo_PO"].ToString();
                                save(carinoutrecord, carinfo_po, CommonalityEntity.unloadFirstWeight, txtinweight);
                                MessageBox.Show(this, "保存成功");
                                CommonalityEntity.strCardNo = "";
                                //记录地磅策略已通过
                                record = new WeighStrategyRecord();
                                record.WeighStrategyRecord_WeighInfo_ID   = Convert.ToInt32(cobWeighStrategyRecord.SelectedValue);
                                record.WeighStrategyRecord_StaffInfo_ID   = Convert.ToInt32(txtCarregistration_Name.Tag.ToString());
                                record.WeighStrategyRecord_CarInfo_ID     = Convert.ToInt32(txtCarregistration_Carnumber.Tag.ToString());
                                record.WeighStrategyRecord_Carnumber      = txtCarregistration_Carnumber.Text.Trim();
                                record.WeighStrategyRecord_StaffInfo_Name = txtCarregistration_Name.Text.Trim();
                                record.WeighStrategyRecord_CarType        = txtCartype_Name.Text.Trim();
                                record.WeighStrategyRecord_mark           = true;
                                record.WeighStrategyRecord_RecordTime     = CommonalityEntity.GetServersTime();
                                record.WeighStrategyRecord_Name           = cobWeighStrategyRecord.Text.Trim();
                                record.WeighStrategyRecord_order          = RraderSort;
                                record.WeighStrategyRecord_Remark         = txtRemark.Text.Trim();
                                if (!WeighStrategyRecordDAL.InsertOneQCRecord(record))
                                {
                                    //MessageBox.Show("地磅房策略通行记录失败!");
                                }
                            }
                            else
                            {
                                MessageBox.Show(this, "保存失败,没有" + CommonalityEntity.upWeight);
                            }
                        }
                    }
                    //判断出门地磅是否重复记录
                    if (txtoutweight != "" && txtoutweight != weight2)
                    {
                        DataTable ds = LinQBaseDao.Query("select * from BusinessRecord where BusinessRecord_Type='" + CommonalityEntity.unloadSecondWeight + "' and BusinessRecord_CarInOutRecord_ID=" + carinoutrecord + " order by BusinessRecord_ID desc").Tables[0];
                        if (ds.Rows.Count > 0)
                        {
                            if (MessageBox.Show("是否修改" + CommonalityEntity.unloadSecondWeight + "重量?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                LinQBaseDao.Query(" update BusinessRecord set BusinessRecord_Weight=" + txtoutweight + " where BusinessRecord_CarInOutRecord_ID=" + carinoutrecord + " and BusinessRecord_Type='" + CommonalityEntity.unloadSecondWeight + "'");
                            }
                            else
                            {
                                return;
                            }
                        }
                        else
                        {
                            DataTable tab = LinQBaseDao.Query("select * from BusinessRecord where BusinessRecord_Type='" + CommonalityEntity.unloadFirstWeight + "' and BusinessRecord_CarInOutRecord_ID=" + carinoutrecord + " order by BusinessRecord_ID desc").Tables[0];
                            if (tab.Rows[0]["BusinessRecord_Type"].ToString() == CommonalityEntity.unloadFirstWeight)
                            {
                                string carinfo_po = tab.Rows[0]["CarInfo_PO"].ToString();
                                save(carinoutrecord, carinfo_po, CommonalityEntity.unloadSecondWeight, txtoutweight);
                                MessageBox.Show(this, "保存成功");
                                CommonalityEntity.strCardNo = "";
                                //记录地磅策略已通过
                                record = new WeighStrategyRecord();
                                record.WeighStrategyRecord_WeighInfo_ID   = Convert.ToInt32(cobWeighStrategyRecord.SelectedValue);
                                record.WeighStrategyRecord_StaffInfo_ID   = Convert.ToInt32(txtCarregistration_Name.Tag.ToString());
                                record.WeighStrategyRecord_CarInfo_ID     = Convert.ToInt32(txtCarregistration_Carnumber.Tag.ToString());
                                record.WeighStrategyRecord_Carnumber      = txtCarregistration_Carnumber.Text.Trim();
                                record.WeighStrategyRecord_StaffInfo_Name = txtCarregistration_Name.Text.Trim();
                                record.WeighStrategyRecord_CarType        = txtCartype_Name.Text.Trim();
                                record.WeighStrategyRecord_mark           = true;
                                record.WeighStrategyRecord_RecordTime     = CommonalityEntity.GetServersTime();
                                record.WeighStrategyRecord_Name           = cobWeighStrategyRecord.Text.Trim();
                                record.WeighStrategyRecord_order          = RraderSort;
                                record.WeighStrategyRecord_Remark         = txtRemark.Text.Trim();
                                if (!WeighStrategyRecordDAL.InsertOneQCRecord(record))
                                {
                                    MessageBox.Show("地磅房策略通行记录失败!");
                                }
                            }
                            else
                            {
                                MessageBox.Show(this, "保存失败,没有" + CommonalityEntity.unloadFirstWeight);
                            }
                        }
                    }
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("卸货点过磅信息 btnSave_Click()" + "".ToString());
            }
        }
 /// <summary>
 /// 保存设置
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         //得到页面对应车辆类型的打印设置
         int carType_ID = int.Parse(comboxCartype.SelectedValue.ToString());
         //得到选择的打印内容
         string print_Content = "";
         if (chkCarNumber.Checked)
         {
             print_Content += chkCarNumber.Text.Trim() + ",";
         }
         if (chkCarType.Checked)
         {
             print_Content += chkCarType.Text.Trim() + ",";
         }
         if (chkStaff_Name.Checked)
         {
             print_Content += chkStaff_Name.Text.Trim() + ",";
         }
         if (chkList.CheckedItems.Count > 0)
         {
             foreach (var item in chkList.CheckedItems)
             {
                 print_Content += item + ",";
             }
         }
         PrintInfo print = new PrintInfo();
         print.Print_Content    = print_Content.Substring(0, print_Content.Length - 1);
         print.Print_CarType_ID = carType_ID;
         print.Print_State      = chkPrint_State.Text.Trim();
         print.Print_Attention  = txtzhuyishixiang.Text.Trim();
         print.Print_Prompt     = txttisi.Text.Trim();
         if (chkPrint_State.Text.Trim() == "启动")
         {
             if (ChkPrintState())
             {
                 DialogResult dlgResult = MessageBox.Show("已经存在启动状态的设置,是否替换?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                 if (dlgResult == DialogResult.OK)
                 {
                     //修改条件
                     Expression <Func <PrintInfo, bool> > funs = n => n.Print_State == "启动" && n.Print_CarType_ID == int.Parse(comboxCartype.SelectedValue.ToString());
                     //需要修改的内容
                     Action <PrintInfo> actions = p =>
                     {
                         p.Print_State = "暂停";
                     };
                     //执行更新
                     PrintInfoDAL.UpdatePrint(funs, actions);
                     PrintInfoDAL.InsertPrint(print);
                 }
                 else
                 {
                     print.Print_State = "暂停";
                     PrintInfoDAL.InsertPrint(print);
                 }
             }
             else
             {
                 PrintInfoDAL.InsertPrint(print);
             }
         }
         else
         {
             PrintInfoDAL.InsertPrint(print);
         }
         DataTable dt    = LinQBaseDao.Query("select PrintInfo_ID,PrintInfo_State from PrintInfo order by PrintInfo_ID desc ").Tables[0];
         string    id    = dt.Rows[0][0].ToString();
         string    state = dt.Rows[0][1].ToString();
         if (state == "启动")
         {
             CommonalityEntity.WriteLogData("新增", "新增并启动编号为:" + id + "打印设置", CommonalityEntity.USERNAME);
         }
         else
         {
             CommonalityEntity.WriteLogData("新增", "新增编号为:" + id + "打印设置", CommonalityEntity.USERNAME);
         }
     }
     catch
     {
         CommonalityEntity.WriteTextLog("PrintSetForm btnAdd_Click()");
     }
     finally
     {
         GetGriddataviewLoad("");
     }
 }
Exemple #16
0
        //直接审批方法
        private void btnshenpi()
        {
            try
            {
                bool ab = true;
                bool bb = true;
                if (txtRemark.Text.Trim() == "")
                {
                    MessageBox.Show("重置原因不能为空。", "提示");
                    return;
                }
                if (gridevewSortReset.SelectedRows.Count <= 0)
                {
                    MessageBox.Show(this, "请选择需要重置的行!");
                    return;
                }
                if (gridevewSortReset.SelectedRows.Count > 1)
                {
                    MessageBox.Show(this, "只能选择一行进行重置!");
                    return;
                }
                string carname = gridevewSortReset.SelectedRows[0].Cells["CarInfo_Name"].Value.ToString();
                //车俩ID
                string carinfoid = gridevewSortReset.SelectedRows[0].Cells["CarInfo_ID"].Value.ToString();
                //小票号ID
                string smallid = gridevewSortReset.SelectedRows[0].Cells["SortNumberInfo_SmallTicket_ID"].Value.ToString();
                //重置后状态
                string htongxing = cbohou.Text.ToString();
                //重置前状态
                string qtongxing = txtqian.Text.ToString();
                //将修改前的呼叫时间储存下来
                string   sqlsntime = "select SortNumberInfo_CallTime from SortNumberInfo where SortNumberInfo_SmallTicket_ID = " + smallid + "";
                DateTime sntime    = Convert.ToDateTime(LinQBaseDao.Query(sqlsntime).Tables[0].Rows[0]["SortNumberInfo_CallTime"]);
                try
                {
                    string strsql = "";
                    if (htongxing == "待通行" || htongxing == "排队中")
                    {
                        //是从其它所有的状态改为带通行时,将这个车辆的呼叫时间修改为当前时间
                        if (htongxing == "待通行")
                        {
                            strsql = "update SortNumberInfo set SortNumberInfo_TongXing='" + htongxing + "' where SortNumberInfo_SmallTicket_ID =" + smallid + "\r\n";
                        }
                        else
                        {
                            strsql = "update SortNumberInfo set SortNumberInfo_TongXing='" + htongxing + "',SortNumberInfo_CallTime='" + CommonalityEntity.GetServersTime() + "' where SortNumberInfo_SmallTicket_ID =" + smallid + "\r\n";
                        }
                        strsql += "   update CarInOutRecord set CarInOutRecord_DrivewayStrategy_IDS=null,CarInOutRecord_ISFulfill=0  where CarInOutRecord_CarInfo_ID=" + carinfoid + "\r\n";
                        strsql += " update SmallTicket set SmallTicket_Allowcounted=0 where SmallTicket_CarInfo_ID=" + carinfoid;
                        LinQBaseDao.Query(strsql);
                    }
                    else if (htongxing == "已进厂")
                    {
                        //是从其它所有的状态改为已出厂时,将业务完成标识改为true
                        strsql = " update CarInOutRecord set CarInOutRecord_ISFulfill=0 where CarInOutRecord_CarInfo_ID= " + carinfoid + "\r\n";
                        //将这个车辆的状态修改为需要的状态
                        strsql += " update SortNumberInfo set SortNumberInfo_TongXing='" + htongxing + "' where SortNumberInfo_SmallTicket_ID= " + smallid;
                        LinQBaseDao.Query(strsql);
                        //单次进出门岗,已进厂车辆修改出厂通行策略
                        DataTable dtstate = LinQBaseDao.Query("select CarInOutRecord_ID,CarInOutRecord_DrivewayStrategyS,CarInOutRecord_DrivewayStrategy_IDS from CarInOutRecord where CarInOutRecord_CarInfo_ID=" + carinfoid).Tables[0];
                        if (dtstate.Rows.Count > 0)
                        {
                            string   drivstr    = dtstate.Rows[0]["CarInOutRecord_DrivewayStrategyS"].ToString();
                            string   carinoutid = dtstate.Rows[0]["CarInOutRecord_ID"].ToString();
                            string[] drivstrs   = drivstr.Split(',');
                            int      count      = 0;
                            foreach (var item in drivstrs)
                            {
                                count++;
                            }
                            if (count == 2)
                            {
                                drivstr = drivstr.Substring(0, drivstr.IndexOf(','));
                                LinQBaseDao.Query("update CarInOutRecord set CarInOutRecord_DrivewayStrategy_IDS='" + drivstr + "',CarInOutRecord_ISFulfill=0 where CarInOutRecord_ID=" + carinoutid);
                                LinQBaseDao.Query("update SmallTicket set SmallTicket_Allowcounted=0 where SmallTicket_CarInfo_ID=" + carinfoid);
                            }
                            else if (count > 2)
                            {
                                string drivstrids = dtstate.Rows[0]["CarInOutRecord_DrivewayStrategy_IDS"].ToString();
                                if (!string.IsNullOrEmpty(drivstrids))
                                {
                                    int ssy = drivstrids.LastIndexOf(',');
                                    if (ssy > 0)
                                    {
                                        string stasd = drivstrids.Substring(ssy + 1, drivstrids.Length - (ssy + 1));
                                        if (!string.IsNullOrEmpty(stasd))
                                        {
                                            DataTable dtv = LinQBaseDao.Query("select Driveway_Type from dbo.View_DrivewayStrategy_Driveway_Position where DrivewayStrategy_ID=" + stasd).Tables[0];
                                            if (dtv.Rows.Count > 0)
                                            {
                                                string dtype = dtv.Rows[0][0].ToString();
                                                if (dtype == "出")
                                                {
                                                    drivstrids = drivstrids.Substring(0, ssy);
                                                    LinQBaseDao.Query("update CarInOutRecord set CarInOutRecord_DrivewayStrategy_IDS='" + drivstrids + "',CarInOutRecord_ISFulfill=0 where CarInOutRecord_ID=" + carinoutid);
                                                    LinQBaseDao.Query("update SmallTicket set SmallTicket_Allowcounted=0 where SmallTicket_CarInfo_ID=" + carinfoid);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                LinQBaseDao.Query("update CarInOutRecord set CarInOutRecord_DrivewayStrategy_IDS=CarInOutRecord_DrivewayStrategyS,CarInOutRecord_ISFulfill=1 where CarInOutRecord_ID=" + carinoutid);
                                LinQBaseDao.Query("update SmallTicket set SmallTicket_Allowcounted=1 where SmallTicket_CarInfo_ID=" + carinfoid);
                            }
                        }
                    }
                    else if (htongxing == "已出厂")
                    {
                        //是从已出厂改为其它所有的状态,将业务完成标识改为true
                        strsql = " update CarInOutRecord set CarInOutRecord_ISFulfill=1,CarInOutRecord_FulfillTime='" + CommonalityEntity.GetServersTime() + "' where CarInOutRecord_CarInfo_ID= " + carinfoid + "\r\n";
                        //将这个车辆的状态修改为需要的状态
                        strsql += " update SortNumberInfo set SortNumberInfo_TongXing='" + htongxing + "' where SortNumberInfo_SmallTicket_ID= " + smallid;
                        LinQBaseDao.Query(strsql);
                    }
                    else
                    {
                        //将这个车辆的状态修改为需要的状态
                        strsql = " update SortNumberInfo set SortNumberInfo_TongXing='" + htongxing + "' where SortNumberInfo_SmallTicket_ID= " + smallid;
                        LinQBaseDao.Query(strsql);
                    }


                    MessageBox.Show("重置成功!!!", "提示");
                    CommonalityEntity.WriteLogData("修改", "车牌:" + carname + "重置状态为:" + htongxing + ",通过了审批", CommonalityEntity.USERNAME);
                    addcz();
                    LogInfoLoad("");
                }
                catch
                {
                    MessageBox.Show("系统繁忙请稍后再试!!!", "提示");
                    CommonalityEntity.WriteTextLog("车牌:" + carname + "重置状态为:" + htongxing + ",审批失败");
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("ResetApplication. btnshenpi()异常:");
            }
        }
Exemple #17
0
 /// <summary>
 /// 查询所有信息预置皮重信息
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <FVNInfo> Query()
 {
     return(LinQBaseDao.Query <FVNInfo>(new DCCarManagementDataContext()));
 }
Exemple #18
0
        /// <summary>
        /// 打印事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            try
            {
                int    rowCount     = 0;
                int    colCount     = 0;
                int    x            = 0;
                int    y            = 0;
                int    rowGap       = 20;
                int    colGap       = 22;
                Font   font         = new Font("宋体", 9);
                Font   headingFont  = new Font("宋体", 10, FontStyle.Underline);
                Font   captionFont  = new Font("宋体", 10, FontStyle.Bold);
                Font   captionFontT = new Font("宋体", 14, FontStyle.Bold);
                Brush  brush        = new SolidBrush(Color.Black);
                string cellValue    = "";
                rowCount = dataGrid.Tables[0].Rows.Count;
                colCount = dataGrid.Tables[0].Columns.Count;

                #region 打印内容
                int ys = 0;
                e.Graphics.DrawString("玖龙公司进出凭证", captionFontT, brush, 80, y, StringFormat.GenericDefault);
                for (int i = 0; i < rowCount; i++)
                {
                    for (int j = 0; j < colCount; j++)
                    {
                        cellValue = dataGrid.Tables[0].Rows[i][j].ToString();
                        x         = rowGap;
                        y        += colGap;//打印标题
                        if (dataGrid.Tables[0].Columns[j].ColumnName == "排队号")
                        {
                            //获取该打印记录中打印小票的排队号
                            string prdSql = dataGrid.Tables[0].Rows[0]["排队号"].ToString();
                            if (string.IsNullOrEmpty(prdSql))
                            {
                                cellValue = "优先进厂";
                            }
                        }
                        e.Graphics.DrawString(dataGrid.Tables[0].Columns[j].ColumnName + ":", captionFont, brush, x, y, StringFormat.GenericDefault);

                        x = 95;//打印内容
                        e.Graphics.DrawString(cellValue, font, brush, x, y, StringFormat.GenericDefault);
                    }
                    y += colGap;
                    e.Graphics.DrawString("通行策略" + ":", captionFont, brush, rowGap, y, StringFormat.GenericDefault);
                    x  = 20;
                    y += colGap;

                    //策略内容
                    //获取该车辆类型的策略



                    string clSql    = "select CarInOutRecord_Update from CarInOutRecord where CarInOutRecord_CarInfo_ID=" + carinfoid;
                    object objdname = LinQBaseDao.GetSingle(clSql);
                    if (objdname != null && Convert.ToBoolean(objdname))
                    {
                        clSql = "select * from View_DrivewayStrategyRecord_Driveway_Position_CarInfo where DrivewayStrategyRecord_carinfo_id =" + carinfoid + " and DrivewayStrategyRecord_State='启动' order by DrivewayStrategyRecord_sort asc";
                        DataSet dataset = LinQBaseDao.Query(clSql);
                        int     k       = 0;
                        rowGap = 20;
                        foreach (DataRow dr in dataset.Tables[0].Rows)
                        {
                            k++;
                            if (k % 2 == 0)
                            {
                                rowGap = 140;
                            }
                            e.Graphics.DrawString(dr["DrivewayStrategyRecord_sort"].ToString() + "-" + dr["Position_Name"].ToString() + "-" + dr["Driveway_Name"].ToString() + "-" + dr["Driveway_Type"].ToString() + "\n", font, brush, rowGap, y, StringFormat.GenericDefault);
                            if (k % 2 == 0)
                            {
                                y     += colGap;
                                rowGap = 20;
                            }
                        }
                    }
                    else
                    {
                        clSql    = "select CarInOutRecord_Remark from CarInOutRecord where CarInOutRecord_CarInfo_ID=" + carinfoid;
                        objdname = LinQBaseDao.GetSingle(clSql);
                        if (objdname != null)
                        {
                            clSql = "select * from View_DrivewayStrategy_Driveway_Position where DrivewayStrategy_Name ='" + objdname + "' and DrivewayStrategy_State='启动' order by DrivewayStrategy_sort asc";
                        }
                        else
                        {
                            clSql = "select * from View_DrivewayStrategy_Driveway_Position where DrivewayStrategy_Name in (select CarType_DriSName from CarType where CarType_ID=" + cartypeid + ") and DrivewayStrategy_State='启动' order by DrivewayStrategy_sort asc";
                        }
                        DataSet dataset = LinQBaseDao.Query(clSql);
                        int     k       = 0;
                        rowGap = 20;
                        foreach (DataRow dr in dataset.Tables[0].Rows)
                        {
                            k++;
                            if (k % 2 == 0)
                            {
                                rowGap = 140;
                            }
                            e.Graphics.DrawString(dr["DrivewayStrategy_sort"].ToString() + "-" + dr["Position_Name"].ToString() + "-" + dr["Driveway_Name"].ToString() + "-" + dr["Driveway_Type"].ToString() + "\n", font, brush, rowGap, y, StringFormat.GenericDefault);
                            if (k % 2 == 0)
                            {
                                y     += colGap;
                                rowGap = 20;
                            }
                        }
                    }
                    rowGap = 20;
                    y     += rowGap;
                    e.Graphics.DrawString("注意事项" + ":", captionFont, brush, rowGap, y, StringFormat.GenericDefault);
                    x = 95;
                    string    prtSql = "select top 1 * from PrintInfo where Print_State='启动' and Print_CarType_ID=" + cartypeid + "";
                    DataTable dtprt  = LinQBaseDao.Query(prtSql).Tables[0];
                    int       ss     = 0;
                    if (dtprt.Rows.Count > 0)
                    {
                        string strattent = dtprt.Rows[0]["Print_Attention"].ToString();
                        if (!string.IsNullOrEmpty(strattent))
                        {
                            string message = strattent;
                            for (int s = 0; s < message.Length; s++)
                            {
                                if (s % 12 == 0 && s != 0)
                                {
                                    strattent = message.Insert(s, "\r\n");
                                    ss++;
                                }
                            }
                            e.Graphics.DrawString(strattent, font, brush, x, y, StringFormat.GenericDefault);
                        }
                    }
                    y += colGap + ss * 15;
                    e.Graphics.DrawString("温馨提示" + ":", captionFont, brush, rowGap, y, StringFormat.GenericDefault);
                    x = 95;
                    if (dtprt.Rows.Count > 0)
                    {
                        string strattent = dtprt.Rows[0]["Print_Prompt"].ToString();
                        if (!string.IsNullOrEmpty(strattent))
                        {
                            string messages = strattent;
                            for (int s = 0; s < messages.Length; s++)
                            {
                                if (s % 12 == 0 && s != 0)
                                {
                                    strattent = strattent.Insert(s, "\r\n");
                                    ys++;
                                }
                            }
                            e.Graphics.DrawString(strattent, font, brush, x, y, StringFormat.GenericDefault);
                        }
                    }
                }
                y += colGap + ys * 15;
                e.Graphics.DrawImage(bmp, 8, y, 450, 120);
                y += colGap + 100;
                e.Graphics.DrawString(Serialnumber, captionFont, brush, rowGap, y, StringFormat.GenericDefault);
                #endregion
            }
            catch
            {
                CommonalityEntity.WriteTextLog("Printer printDocument_PrintPage()");
            }
        }
Exemple #19
0
 /// <summary>
 /// summary>
 /// 按条件查询信息View_PresetTare_Dictionary
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <FVNInfo> Query(Expression <Func <FVNInfo, bool> > fun)
 {
     return(LinQBaseDao.Query <FVNInfo>(new DCCarManagementDataContext(), fun));
 }
Exemple #20
0
        /// <summary>
        /// 导出Execl 全选
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="tablename"></param>
        /// <param name="strsql"></param>
        private void daochu(string filename, string strsql)
        {
            try
            {
                string         saveFileName = "";
                SaveFileDialog saveDialog   = new SaveFileDialog();
                saveDialog.DefaultExt = "xls";
                saveDialog.Filter     = "Excel文件|*.xls";
                saveDialog.FileName   = filename;
                saveDialog.ShowDialog();
                saveFileName = saveDialog.FileName;
                if (saveFileName.IndexOf(":") < 0)
                {
                    return;                                //被点了取消
                }
                ISdao             = true;
                groupBox3.Visible = true;
                btnSet.Text       = "取消导出";

                label19.Text = "正在导出:" + filename;

                ExcelFile excelFile = new ExcelFile();
                // ExcelWorksheet sheet = excelFile.Worksheets.Add(filename);
                DataTable table   = LinQBaseDao.Query(strsql).Tables[0];
                int       columns = table.Columns.Count;
                int       rows    = table.Rows.Count;

                double ss = (double)rows / 60000;
                int    ii = Convert.ToInt32(ss);
                if (ss > ii)
                {
                    ii++;
                }
                progressBar1.Maximum = ii + 1;
                progressBar1.Value   = 0;
                int y = 0;
                for (int s = 1; s < ii + 1; s++)
                {
                    ExcelWorksheet sheet = excelFile.Worksheets.Add(filename + s.ToString());
                    for (int j = 0; j < columns; j++)
                    {
                        sheet.Cells[0, j].Value = table.Columns[j].ColumnName;
                    }
                    for (int i = 0; i < columns; i++)
                    {
                        if (ISdao)
                        {
                            y = 0;
                            for (int j = (s - 1) * 60000; j < rows; j++)
                            {
                                y++;
                                if (y > 60000)
                                {
                                    y = 0;
                                    break;
                                }
                                sheet.Cells[y, i].Value = table.Rows[j][i].ToString();
                            }
                        }
                        else
                        {
                            break;
                        }
                    }
                    if (!ISdao)
                    {
                        break;
                    }
                    progressBar1.Value++;
                }
                excelFile.SaveXls(saveFileName);
                progressBar1.Value++;
                if (progressBar1.Value >= progressBar1.Maximum)
                {
                    label19.Text = filename;
                    btnSet.Text  = "导出完成";
                }
            }
            catch { }
        }
Exemple #21
0
        /// <summary>
        /// 登记方法
        /// </summary>
        private void QcInfoAdd()
        {
            try
            {
                if (lvwUserList.SelectedRows.Count > 0)
                {
                    int           id                   = Convert.ToInt32(lvwUserList.SelectedRows[0].Cells["DRAW_EXAM_INTERFACE_ID"].Value);
                    StringBuilder sbMessage            = new StringBuilder();
                    int           QCInfo_Dictionary_ID = 0;
                    int           QCInfo_STATE         = 0;
                    var           dictionary           = DictionaryDAL.Query();
                    foreach (var m in dictionary)
                    {
                        if (m.Dictionary_Name == "质检中")
                        {
                            QCInfo_Dictionary_ID = m.Dictionary_ID;
                        }
                        if (m.Dictionary_Name == "启动")
                        {
                            QCInfo_STATE = m.Dictionary_ID; //数据状态(启动)
                        }
                    }
                    int irnt = 0;

                    #region ykWarning: 和U9交互 纸种为 LSOP1的不和U9交互 ,测试的时候,可以删除U9交互,发布的时候务必要还原。
                    //#if !DEBUG
                    string PROD_ID = lvwUserList.SelectedRows[0].Cells["PROD_ID"].Value.ToString();
                    if (isIdebarJoinU9(PROD_ID))
                    {
                        DataSet ds = LinQBaseDao.Query("select SHIPMENT_NO,CNTR_NO from dbo.DRAW_EXAM_INTERFACE where DRAW_EXAM_INTERFACE_ID=" + id);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            string SHIPMENT_NO = ds.Tables[0].Rows[0][0].ToString();
                            if (!gainData(SHIPMENT_NO, id))
                            {
                                string CNTR_NO = ds.Tables[0].Rows[0][0].ToString();
                                MessageBox.Show(CNTR_NO + "从U9获取数据失败,不能登记!");
                                return;
                            }
                        }
                        else
                        {
                            MessageBox.Show("登记失败!");
                            return;
                        }
                    }
                    else
                    {
                        DataSet ds = LinQBaseDao.Query("select SHIPMENT_NO,CNTR_NO from dbo.DRAW_EXAM_INTERFACE where DRAW_EXAM_INTERFACE_ID=" + id);
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            RegisterLoosePaperDistribution rpdb = new RegisterLoosePaperDistribution();
                            rpdb.R_DRAW_EXAM_INTERFACE_ID = id;
                            rpdb.issend = false;
                            LinQBaseDao.InsertOne(dc, rpdb);
                        }
                    }
                    //#endif
                    #endregion

                    if (YesNoDengJi(id))
                    {
                        MessageBox.Show("该信息已登记过", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        Bangding_Load(RegistrationWhere());//更新数据
                        ids.Clear();
                        return;
                    }
                    var qf = new QCInfo();

                    qf.QCInfo_Dictionary_ID = QCInfo_Dictionary_ID;
                    qf.QCInfo_STATE         = QCInfo_STATE;
                    int k = QCInfoDAL.GetIntDRAWCount(id);//抽样总次数
                    qf.QCInfo_PumpingPackets = k;
                    #region 周意 规则加上后需要修改
                    //e ReckonWaterTestCount(qf.QCInfo_ID);
                    qf.QCInfo_UnpackBefore_MOIST_PER_COUNT = OneCQCount + TwoCQCount;
                    qf.QCInfo_UnpackBack_MOIST_COUNT       = OneCHCount + TwoCHCount;
                    #endregion
                    qf.QCInfo_DRAW_EXAM_INTERFACE_ID = id;
                    qf.QCInfo_DEGREE    = 1;                                           //检测次数
                    qf.QCInfo_TIME      = DateTime.Now;                                //日期时间
                    qf.QCInfo_Client_ID = Common.CLIENTID;                             //客户端配置编号
                    qf.QCInfo_UserId    = EMEWE.Common.Converter.ToInt(Common.USERID); //记录人:当前登录人

                    //修改抽样表状态
                    Action <DRAW_EXAM_INTERFACE> ap = n =>
                    {
                        //liemrao begin update 20160901
                        //n.IS_DengJi = Convert.ToChar("Y");
                        n.IS_DengJi = "Y";
                        //end update
                    };
                    Expression <Func <DRAW_EXAM_INTERFACE, bool> > p1 = n => n.DRAW_EXAM_INTERFACE_ID == id;
                    bool rboolDRAW_EXAM_INTERFACEDAL = DRAW_EXAM_INTERFACEDAL.Update(p1, ap);
                    if (rboolDRAW_EXAM_INTERFACEDAL)
                    {
                        if (QCInfoDAL.addQCInfoDAL(qf))
                        {
                            irnt++;
                            sbMessage.Append(id + ",");
                            Common.WriteLogData("新增", "登记数据抽样编号为:" + id, Common.NAME); //操作日志
                            #region 抽包
                            getPackets(qf.QCInfo_ID, id);
                            #endregion
                        }
                        else
                        {
                            //修改抽样表状态
                            Action <DRAW_EXAM_INTERFACE> ap2 = n =>
                            {
                                n.IS_DengJi = null;
                            };
                            Expression <Func <DRAW_EXAM_INTERFACE, bool> > p2 = n => n.DRAW_EXAM_INTERFACE_ID == id;
                            DRAW_EXAM_INTERFACEDAL.Update(p2, ap2);
                        }
                    }
                    if (!string.IsNullOrEmpty(sbMessage.ToString()))
                    {
                        DialogResult dia = MessageBox.Show("登记数据抽样编号为:" + sbMessage.ToString() + "成功\r\n是否现场抽包?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                        if (dia.Equals(DialogResult.Yes))
                        {
                            tChoosePacks.Enabled = false;
                            ChoosePacks();
                            tChoosePacks.Enabled = true;
                        }
                    }
                    else//没有选中
                    {
                        MessageBox.Show("请选择列表再开始质检!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            catch
            {
                MessageBox.Show("登记失败", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            finally
            {
                page = new PageControl();
                page.PageMaxCount = tscbxPageSize2.SelectedItem.ToString();
                Bangding_Load(RegistrationWhere());//更新数据
            }
        }
        private void btnUpdate_Click()
        {
            try
            {
                arraylist.Clear();//清空动态数组内的成员
                add();
                int  j            = 0;
                bool Menu_Enabled = true;
                bool Menu_Visible = true;
                if (!chb_Menu_Visible.Checked)
                {
                    Menu_Visible = false;
                }
                if (!chb_Menu_Enabled.Checked)
                {
                    Menu_Enabled = false;
                }
                if (CommonalityEntity.YesNoBoolRoleUser)
                {
                    //删除用户权限,只能删除我拥有的,已经配置的权限
                    if (CommonalityEntity.UserID <= 0)
                    {
                        return;
                    }

                    DataTable dt   = LinQBaseDao.Query("select Permissions_ID from View_MenuInfo_P where Menu_Type=1 and Permissions_UserId=" + CommonalityEntity.UserID + "").Tables[0];
                    string    pids = "";
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            pids += dt.Rows[i][0].ToString() + ",";
                        }
                        LinQBaseDao.Query("delete PermissionsInfo where Permissions_ID in (" + pids.TrimEnd(',') + ")");
                    }

                    for (int i = 0; i < arraylist.Count; i++)
                    {
                        var permissionsInfo = new PermissionsInfo
                        {
                            Permissions_Menu_ID = CommonalityEntity.GetInt(arraylist[i].ToString()),
                            Permissions_Visible = Menu_Visible,
                            Permissions_Enabled = Menu_Enabled,
                            Permissions_Type    = 1,//1为winfrom程序菜单
                            Permissions_UserId  = CommonalityEntity.UserID
                        };
                        if (!PermissionsInfoDAL.InsertOneQCRecord(permissionsInfo))//是否添加失败
                        {
                            j++;
                        }
                    }
                }
                else
                {
                    //删除用户的所有权限
                    Expression <Func <PermissionsInfo, bool> > funmenuinfo = n => n.Permissions_Role_Id == CommonalityEntity.RoleID;
                    if (!PermissionsInfoDAL.DeleteToMany(funmenuinfo))//用户权限菜单是否删除失败
                    {
                        j++;
                    }
                    for (int i = 0; i < arraylist.Count; i++)
                    {
                        var permissionsInfo = new PermissionsInfo
                        {
                            Permissions_Menu_ID = CommonalityEntity.GetInt(arraylist[i].ToString()),
                            //Dictionary_State = DictionaryDAL.GetDictionaryID("启动"),
                            Permissions_Visible = Menu_Visible,
                            Permissions_Enabled = Menu_Enabled,
                            Permissions_Type    = 1,
                            Permissions_Role_Id = CommonalityEntity.RoleID
                        };
                        if (!PermissionsInfoDAL.InsertOneQCRecord(permissionsInfo))//是否添加失败
                        {
                            j++;
                        }
                    }
                }
                if (j == 0)
                {
                    MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    CommonalityEntity.WriteLogData("新增", "新增角色编号为:" + CommonalityEntity.RoleID + "权限的信息", CommonalityEntity.USERNAME);
                }
                else
                {
                    MessageBox.Show("添加失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
                MessageBox.Show("添加失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                CommonalityEntity.WriteTextLog("UserRoleADD.btnUpdate_Click()");
            }
            finally
            {
                this.Close();
            }
            try
            {
                arraylist.Clear();//清空动态数组内的成员
                add();
                CommonalityEntity.arraylist = arraylist;
            }
            catch
            {
                CommonalityEntity.WriteTextLog("UserRoleADD.btnUpdate_Click()");
            }
            finally
            {
                this.Close();
            }
        }
Exemple #23
0
        /// <summary>
        /// 打印事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void printDocument_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            try
            {
                int   y           = 0;
                int   rowGap      = 30;
                int   colGap      = 30;
                int   x           = 1;
                Font  captionFont = new Font("宋体", 18, FontStyle.Bold);
                Brush brush       = new SolidBrush(Color.Black);
                for (int i = 0; i < lvwUserList.SelectedRows.Count; i++)
                {
                    if (count != 0 && i == 0)
                    {
                        i = count + 1;
                    }

                    #region 杨敦钦 填充打印内容 和打印
                    e.Graphics.DrawString("重庆理文造纸有限公司国废质检抽包", captionFont, brush, rowGap, y, StringFormat.GenericDefault);
                    int       id     = Convert.ToInt32(lvwUserList.SelectedRows[i].Cells["DRAW_EXAM_INTERFACE_ID"].Value);
                    string    prtSql = "select CNTR_NO,WEIGHT_TICKET_NO,PROD_ID,DRAW_ONE,DRAW_TWO,DRAW_THREE,DRAW_FOUR,DRAW_FIVE,DRAW_SIX,DRAW_7,DRAW_8,DRAW_9,DRAW_10,DRAW_11,DRAW_12,DRAW_13,DRAW_14 from dbo.DRAW_EXAM_INTERFACE  where  DRAW_EXAM_INTERFACE_ID=" + id;
                    DataTable dtprt  = LinQBaseDao.Query(prtSql).Tables[0];
                    if (dtprt.Rows.Count > 0)
                    {
                        y += colGap;                                                                                           //换行
                        string strattent = dtprt.Rows[0]["CNTR_NO"].ToString();
                        e.Graphics.DrawString("车牌号:" + strattent, captionFont, brush, rowGap, y, StringFormat.GenericDefault); //添加打印内容
                        strattent = dtprt.Rows[0]["WEIGHT_TICKET_NO"].ToString();
                        e.Graphics.DrawString("磅单号:" + strattent, captionFont, brush, 280, y, StringFormat.GenericDefault);    //添加打印内容
                        strattent = dtprt.Rows[0]["PROD_ID"].ToString();
                        e.Graphics.DrawString("货品:" + strattent, captionFont, brush, 540, y, StringFormat.GenericDefault);     //添加打印内容

                        y        += colGap;                                                                                    //换行
                        strattent = "";
                        string   ziduan    = "DRAW_ONE,DRAW_TWO,DRAW_THREE,DRAW_FOUR,DRAW_FIVE,DRAW_SIX,DRAW_7,DRAW_8,DRAW_9,DRAW_10,DRAW_11,DRAW_12,DRAW_13,DRAW_14";
                        string[] danziduan = ziduan.Split(',');
                        for (int j = 0; j < danziduan.Length; j++)
                        {
                            strattent = hbbh(dtprt, strattent, danziduan[j]);
                        }
                        if (strattent != "")
                        {
                            strattent = strattent.Substring(0, strattent.Length - 1);
                        }
                        e.Graphics.DrawString("包号:" + strattent, captionFont, brush, rowGap, y, StringFormat.GenericDefault);//添加打印内容
                        y += 50;
                    }
                    if (x >= 10)
                    {
                        e.HasMorePages = true;//分页
                        x     = 1;
                        count = i;
                        if (i == lvwUserList.SelectedRows.Count - 1)
                        {
                            e.HasMorePages = false;//打印
                        }
                        break;
                    }
                    if (i == lvwUserList.SelectedRows.Count - 1)
                    {
                        e.HasMorePages = false;//打印
                    }
                    x++;
                    #endregion
                }
            }
            catch
            {
            }
        }
 /// <summary>
 /// summary>
 /// 按条件查询信息View_Camera_Driveway_Position
 /// </summary>
 /// <returns></returns>
 public static List <View_FVN_Driveway_Position> GetList(Expression <Func <View_FVN_Driveway_Position, bool> > fun)
 {
     return(LinQBaseDao.Query <View_FVN_Driveway_Position>(new DCCarManagementDataContext(), fun).ToList());
 }
Exemple #25
0
        /// <summary>
        /// 呼叫选中车辆
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCall_Click(object sender, EventArgs e)
        {
            int sortid = 0;

            Control.CheckForIllegalCrossThreadCalls = false;
            //没有显示数据则需要重新设置通道
            if (lvwUserList.Rows.Count <= 0)
            {
                MessageBox.Show("请先进行呼叫设置");
                return;
            }
            try
            {
                isUnusual = false;
                if (pv.PositionVoice_ID <= 0 || string.IsNullOrEmpty(_carType))
                {
                    MessageBox.Show("请先进行呼叫设置");
                    return;
                }
                if (this.lvwUserList.SelectedRows.Count <= 0)
                {
                    MessageBox.Show("请选择需要呼叫的车辆!");
                    return;
                }
                if (CommonalityEntity.CarType.Count <= 0)
                {
                    MessageBox.Show("请先设置通道通行车辆类型");
                    return;
                }

                //状态已改变  直接呼叫下一条
                object objtongx = LinQBaseDao.GetSingle("select SortNumberInfo_TongXing from SortNumberInfo where SortNumberInfo_ID='" + this.lvwUserList.SelectedRows[0].Cells["sortNumberInfo_ID"].Value.ToString() + "'");
                if (objtongx.ToString() != "待通行" && objtongx.ToString() != "排队中")
                {
                    GetGriddataviewLoad("");// 重新加载数据
                    objtongx = LinQBaseDao.GetSingle("select SortNumberInfo_TongXing from SortNumberInfo where SortNumberInfo_ID='" + this.lvwUserList.SelectedRows[0].Cells["sortNumberInfo_ID"].Value.ToString() + "'");
                    if (objtongx.ToString() != "待通行" && objtongx.ToString() != "排队中")
                    {
                        MessageBox.Show("该车辆已不再排队中,请呼叫下一辆车!");
                        GetGriddataviewLoad("");// 重新加载数据
                    }
                }

                if (this.lvwUserList.SelectedRows[0].Cells["sortnumberinfo_state"].Value.ToString() == "注销")
                {
                    MessageBox.Show("车辆排队状态被注销,不能呼叫!");
                    return;
                }

                //emewe 103 取消条件:and Driveway_Position_ID=" + SystemClass.PositionID + ",and 通道名称='" + comboxDriveway.Text.Trim() + "'
                string    strslq = " select * from View_LEDShow_zj where  sortnumberinfo_state='启动'  and 车辆类型='" + _carType + "'   and CarInfo_State='启动'  and  小票号='" + this.lvwUserList.SelectedRows[0].Cells["Queue_Sur"].Value.ToString() + "'";
                DataTable dtled  = LinQBaseDao.Query(strslq).Tables[0];
                if (dtled.Rows.Count <= 0)
                {
                    MessageBox.Show("请设置后进行呼叫车辆");
                    return;
                }
                string queuestate = this.lvwUserList.SelectedRows[0].Cells["Queue_State"].Value.ToString();
                if (queuestate != "待通行" && queuestate != "排队中")
                {
                    MessageBox.Show("请重新设定后呼叫车辆!");
                    GetGriddataviewLoad("");// 重新加载数据
                    return;
                }

                string ManagementStrategy_name = "";
                object objman = LinQBaseDao.GetSingle("select CarInOutRecord_Remark from CarInOutRecord where CarInOutRecord_ID=" + dtled.Rows[0]["CarInOutRecord_ID"].ToString());
                if (objman != null)
                {
                    ManagementStrategy_name = objman.ToString();
                }
                string    sqlMan = "select ManagementStrategy_ID from  ManagementStrategy where ManagementStrategy_DriSName='" + ManagementStrategy_name + "' and ManagementStrategy_ControlInfo_ID in(select ControlInfo_ID from ControlInfo where ControlInfo_Name='进门授权校验')and ManagementStrategy_State='启动' ";
                DataTable dtMan  = LinQBaseDao.Query(sqlMan).Tables[0];
                if (dtMan.Rows.Count > 0)
                {
                    if (this.lvwUserList.SelectedRows[0].Cells["CarInOutRecord_InCheck"].Value.ToString() != "是")
                    {
                        MessageBox.Show("该车辆还没有进门授权,不能呼叫!");
                        return;
                    }
                }

                //未呼叫的
                if (lvwUserList.SelectedRows[0].DefaultCellStyle.BackColor != System.Drawing.Color.Lime)
                {
                    int sum = int.Parse(combox_LEDShowNumber.Text);
                    strslq = " select top(" + sum + ") * from View_LEDShow_zj where  sortnumberinfo_state='启动'  and  车辆类型='" + _carType + "'   and   CarInfo_State='启动'  and   通行状态='排队中'  and 排队号 <> '' order by sortnumberinfo_ID";
                    ///dtsortnumber.Rows[i]["通行状态"].ToString() == "待通行"
                    dtsortnumber = LinQBaseDao.Query(strslq).Tables[0];
                    if (dtsortnumber.Rows.Count >= 1)
                    {
                        sortid = int.Parse(this.lvwUserList.SelectedRows[0].Cells["sortNumberInfo_ID"].Value.ToString());//选中当前的小票号

                        CheckProperties.ce.sortValue = int.Parse(dtsortnumber.Rows[0]["SortNumberInfo_ID"].ToString());
                        //在所有没有呼叫中,必须选择最小的呼叫,否则不能呼叫
                        if (sortid != CheckProperties.ce.sortValue)
                        {
                            MessageBox.Show("按照排队序号进行呼叫");
                            return;
                        }
                        queueCar(this.lvwUserList.SelectedRows[0].Cells[2].Value.ToString(), sortid);
                        GetGriddataviewLoad("");// 重新加载数据
                    }
                    else
                    {
                        MessageBox.Show("该车辆业务类型,不可通行此门岗!!!");
                        return;
                    }
                }
                else//已经呼叫的
                {
                    DialogResult dr = MessageBox.Show("该车已做呼叫,确定重新呼叫该车辆吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (dr == DialogResult.OK)
                    {
                        queueCar(this.lvwUserList.SelectedRows[0].Cells[2].Value.ToString(), sortid);
                        GetGriddataviewLoad("");// 重新加载数据
                    }
                    else
                    {
                        return;
                    }
                }
            }
            catch (Exception err)
            {
                CommonalityEntity.WriteTextLog("QueueForm btnCall_Click()");
            }
        }
        /// <summary>
        /// 查询方法
        /// </summary>
        public void StaffInfo_Select()
        {
            string strcv = "";

            sqlwhere1 = "";
            sqlwhere2 = "";
            SqlWhere();
            tv_StaffInfo.Nodes.Clear();

            if (sqlwhere != "")
            {
                DataSet  ds       = LinQBaseDao.Query(sqlwhere);
                TreeNode nodeTemp = null;

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    SqlWhere1(ds.Tables[0].Rows[i][0].ToString());
                    sqlwhere1 += sqlwhere2;
                    DataSet dst = LinQBaseDao.Query(sqlwhere1);
                    if (dst.Tables[0].Rows.Count > 0)
                    {
                        nodeTemp = new TreeNode();
                        if (!string.IsNullOrEmpty(CommonalityEntity.tabcom2))
                        {
                            nodeTemp.Name = ds.Tables[0].Rows[i][1].ToString();
                            nodeTemp.Tag  = ds.Tables[0].Rows[i][2].ToString();
                        }
                        else
                        {
                            nodeTemp.Tag = ds.Tables[0].Rows[i][1].ToString();
                        }
                        nodeTemp.Text = ds.Tables[0].Rows[i][0].ToString();
                    }
                    //查询是否有相同姓名驾驶员

                    if (dst.Tables[0].Rows.Count > 1)
                    {
                        TreeNode nodeTemps;
                        for (int j = 0; j < dst.Tables[0].Rows.Count; j++)
                        {
                            //添加子节点
                            nodeTemps = new TreeNode();
                            if (!string.IsNullOrEmpty(CommonalityEntity.tabcom2))
                            {
                                nodeTemps.Text = dst.Tables[0].Rows[j][1].ToString();
                                string str = dst.Tables[0].Rows[j][2].ToString();
                                nodeTemps.Tag = dst.Tables[0].Rows[j][2].ToString();
                            }
                            else
                            {
                                nodeTemps.Tag = dst.Tables[0].Rows[j][1].ToString();
                            }
                            nodeTemps.Name = dst.Tables[0].Rows[j][0].ToString();
                            nodeTemp.Nodes.Add(nodeTemps);
                        }
                        if (string.IsNullOrEmpty(strcv))
                        {
                            strcv = "'" + ds.Tables[0].Rows[i][0].ToString() + "'";
                        }
                        else
                        {
                            strcv += ",'" + ds.Tables[0].Rows[i][0].ToString() + "'";
                        }
                        sqlwhere2 = " and " + CommonalityEntity.tabcom1 + " not in(" + strcv + " )";
                    }
                    if (dst.Tables[0].Rows.Count > 0)
                    {
                        tv_StaffInfo.Nodes.Add(nodeTemp);
                    }
                }
            }
        }
Exemple #27
0
        //private void comboxDriveway_DropDown(object sender, EventArgs e)
        //{
        //    GetDriveway();
        //}
        /// <summary>
        /// 异常呼叫
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUnu_Click(object sender, EventArgs e)
        {
            try
            {
                isUnusual = true;
                if (pv.PositionVoice_ID <= 0)
                {
                    MessageBox.Show("请先进行呼叫设置");
                    return;
                }
                if (this.lvwUserList.SelectedRows[0].Cells["sortnumberinfo_state"].Value.ToString() == "注销")
                {
                    MessageBox.Show("车辆排队状态被注销,不能呼叫!");
                    return;
                }
                string    strslq = " select * from View_LEDShow_zj where  sortnumberinfo_state='启动'  and 车辆类型='" + _carType + "' and Driveway_Position_ID=" + SystemClass.PositionID + "    and CarInfo_State='启动' and 通道名称='" + comboxDriveway.Text.Trim() + "' and  通行状态='待通行'  and 排队号 <> ''";
                DataTable dtsort = LinQBaseDao.Query(strslq).Tables[0];
                if (dtsort.Rows.Count > 1)
                {
                    MessageBox.Show("已呼叫车辆未放行,不能继续呼叫!");
                    return;
                }
                DialogResult dlgR = MessageBox.Show("确认呼叫" + this.lvwUserList.SelectedRows[0].Cells["QueueCarNumber"].Value.ToString() + "车辆? 当前呼叫为异常呼叫!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop);
                if (dlgR == DialogResult.OK)
                {
                    #region 记录呼叫异常
                    ur = new UnusualRecord();
                    ur.UnusualRecord_Operate        = CommonalityEntity.USERNAME;
                    ur.UnusualRecord_Reason         = "异常呼叫" + this.lvwUserList.SelectedRows[0].Cells["QueueCarNumber"].Value.ToString() + "车辆";
                    ur.UnusualRecord_Remark         = "异常呼叫";
                    ur.UnusualRecord_State          = "启动";
                    ur.UnusualRecord_Time           = CommonalityEntity.GetServersTime();
                    ur.UnusualRecord_Type           = "异常呼叫";
                    ur.UnusualRecord_UnusualType_ID = 1;
                    ur.UnusualRecord_Site           = "排队信息";
                    ur.UnusualRecord_SiteID         = int.Parse(this.lvwUserList.SelectedRows[0].Cells["sortNumberInfo_ID"].Value.ToString());
                    ur.UnusualRecord_CarInfo_ID     = int.Parse(this.lvwUserList.SelectedRows[0].Cells["CarInfo_ID"].Value.ToString());
                    UnusualRecordDAL.InsertUnusualRecord(ur);//记录异常信息
                    #endregion
                }
                else
                {
                    return;
                }
                //得到排队信息表编号,修改排队状态

                string sortid = this.lvwUserList.SelectedRows[0].Cells["sortNumberInfo_ID"].Value.ToString();
                string strsql = " SortNumberInfo_TongXing ='待通行',SortNumberInfo_CallCount +=1,SortNumberInfo_Remark = '异常呼叫',SortNumberInfo_Number='是'";

                if (this.lvwUserList.SelectedRows[0].Cells["Queue_State"].Value.ToString() == "排队中")
                {
                    strsql += ",SortNumberInfo_CallTime ='" + CommonalityEntity.GetServersTime() + "'";
                }
                strsql = "update SortNumberInfo set " + strsql + " where SortNumberInfo_ID=" + sortid;
                LinQBaseDao.Query(strsql);
                //得到呼叫的内容
                GetData();
            }
            catch
            {
                CommonalityEntity.WriteTextLog("QueueForm btnUnu_Click():");
            }
            finally
            {
                GetGriddataviewLoad("");//重新加载数据
            }
        }
Exemple #28
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Unusualstandard u = new Unusualstandard();


                if (txtPROD.Text.Trim() != "")
                {
                    u.Unusualstandard_PROD = txtPROD.Text.Trim();
                }
                else
                {
                    MessageBox.Show("货品不能为空!");
                    return;
                }
                if (txtDEGRADE_MOISTURE_PERCT.Text.Trim() != "")
                {
                    u.Unusualstandard_DEGRADE_MOISTURE_PERCT = txtDEGRADE_MOISTURE_PERCT.Text.Trim();
                }
                else
                {
                    MessageBox.Show("水分标准不能为空!");
                    return;
                }


                if (txtDEGRADE_MATERIAL_PERCT.Text.Trim() != "")
                {
                    u.Unusualstandard_DEGRADE_MATERIAL_PERCT = txtDEGRADE_MATERIAL_PERCT.Text.Trim();
                }
                else
                {
                    MessageBox.Show("杂质标准不能为空!");
                    return;
                }
                if (txtDEGRADE_OUTTHROWS_PERCT.Text.Trim() != "")
                {
                    u.DEGRADE_OUTTHROWS_PERCT = txtDEGRADE_OUTTHROWS_PERCT.Text.Trim();
                }
                else
                {
                    MessageBox.Show("杂纸标准不能为空!");
                    return;
                }

                if (txtMOISTUREMIN.Text != "")
                {
                    u.Unusualstandard_MOISTUREMIN = Convert.ToInt32(txtMOISTUREMIN.Text);
                }
                else
                {
                    MessageBox.Show("水分接收下限不能为空!");
                    return;
                }

                if (txtMOISTUREMAX.Text != "")
                {
                    u.Unusualstandard_MOISTUREMAX = Convert.ToInt32(txtMOISTUREMAX.Text);
                }
                else
                {
                    MessageBox.Show("水分接收上限不能为空!");
                    return;
                }


                DataTable dt = LinQBaseDao.Query("select * from dbo.Unusualstandard where Unusualstandard_PROD ='" + txtPROD.Text.Trim() + "'").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    MessageBox.Show("货品重名!");
                    return;
                }
                else
                {
                    int result = 0;
                    UnusualstandardDAL.InsertOneQCRecord(u, out result);
                    if (result > 0)
                    {
                        MessageBox.Show("添加成功!");
                        LoadData();
                    }
                }
            }
            catch
            {
            }
        }
        int num = 0;//取数据行编号

        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                //查询所有质检中的数据+完成质检并且规定时间以内的
                DataTable QcInfoDT = LinQBaseDao.Query(" SELECT  * from  QCInfo,DRAW_EXAM_INTERFACE  where   QCInfo_DRAW_EXAM_INTERFACE_ID=DRAW_EXAM_INTERFACE_ID  and     QCInfo_ID in (select QCRecord_QCInfo_ID from  QCRecord,TestItems where QCRecord_TestItems_ID = TestItems_ID and QCRecord_RESULT > 0) and (QCInfo_Dictionary_ID in (7,8) or (QCIInfo_EndTime >= '" + DateTime.Now.AddMinutes(endTime) + "' and QCInfo_Dictionary_ID=19))   order by QCInfo_ID desc ").Tables[0];
                if (QcInfoDT.Rows.Count > 0)
                {
                    //循环质检信息 每次3条信息
                    for (int i = 0; i < 3; i++)
                    {
                        if (num + i >= QcInfoDT.Rows.Count)
                        {
                            num = 0;
                        }

                        int    QCInfo_ID = Convert.ToInt32(QcInfoDT.Rows[num + i]["QCInfo_ID"]); //质检编号
                        string CNTR_NO   = QcInfoDT.Rows[num + i]["CNTR_NO"].ToString();         //车牌
                        string PROD_ID   = QcInfoDT.Rows[num + i]["PROD_ID"].ToString();         //纸种
                        string avgWate   = "";
                        if (QcInfoDT.Rows[num + i]["QCInfo_MOIST_PER_SAMPLE"].ToString() != "")
                        {
                            //总平均水分
                            avgWate = QcInfoDT.Rows[num + i]["QCInfo_MOIST_PER_SAMPLE"].ToString();//平均水分
                        }
                        else
                        {
                            // 拆包后平均水分
                            if (QcInfoDT.Rows[num + i]["QCInfo_UnpackBack_MOIST_PER_SAMPLE"].ToString() != "")
                            {
                                avgWate = QcInfoDT.Rows[num + i]["QCInfo_UnpackBack_MOIST_PER_SAMPLE"].ToString();
                            }
                            else
                            {
                                //拆包前
                                if (QcInfoDT.Rows[num + i]["QCInfo_UnpackBefore_MOIST_PER_SAMPLE"].ToString() != "")
                                {
                                    avgWate = QcInfoDT.Rows[num + i]["QCInfo_UnpackBefore_MOIST_PER_SAMPLE"].ToString();
                                }
                            }
                        }
                        string wate  = ""; //实时水分
                        string state = ""; //状态
                        //根据质检编号查询QCRecord_RESULT > 0 的质检详细信息 排倒序
                        DataTable QCRecordDT = LinQBaseDao.Query("select top(2)* from QCRecord,TestItems where QCRecord_TestItems_ID = TestItems_ID and QCRecord_RESULT > 0 and QCRecord_QCInfo_ID=" + QCInfo_ID + " order by QCRecord_ID desc").Tables[0];
                        if (QCRecordDT.Rows.Count > 0)
                        {
                            string testItem = QCRecordDT.Rows[0]["TestItems_NAME"].ToString();//检测项目名称


                            //根据质检编号查询QCRecord_RESULT > 0 的2条水分质检详细信息 排倒序
                            DataTable wateDT = LinQBaseDao.Query("select top(2)* from QCRecord,TestItems where QCRecord_TestItems_ID = TestItems_ID and QCRecord_RESULT > 0 and QCRecord_QCInfo_ID=" + QCInfo_ID + " and Tes_TestItems_ID=1 order by QCRecord_ID desc").Tables[0];

                            //赋值实时水分,这里有2条就显示2条,否则显示一条
                            if (wateDT.Rows.Count > 1)
                            {
                                string testItemB = wateDT.Rows[1]["TestItems_NAME"].ToString();

                                wate = wateDT.Rows[1]["QCRecord_RESULT"].ToString() + "," + wateDT.Rows[0]["QCRecord_RESULT"].ToString();
                            }
                            else if (wateDT.Rows.Count == 1)
                            {
                                wate = wateDT.Rows[0]["QCRecord_RESULT"].ToString();
                            }

                            if (testItem == "水分检测" || testItem == "拆包后水分检测" || testItem == "拆包前水分检测")
                            {
                                //状态为测水判断
                                state = "测水";
                            }

                            //状态为分拣判断
                            if (testItem == "重量检测" || testItem == "废纸包重" || testItem == "杂质" || testItem == "杂纸")
                            {
                                state = "分拣";
                            }

                            //状态为退货判断
                            if (testItem == "退货还包" || QcInfoDT.Rows[num + i]["QCInfo_RECV_RMA_METHOD"].ToString() == "退货")
                            {
                                state = "退货";
                            }

                            if (QcInfoDT.Rows[num + i]["QCInfo_RECV_RMA_METHOD"].ToString() == "收货")
                            {
                                state = "收货";
                            }



                            switch (i)
                            {
                            //第一行
                            case 0:

                                if (lblCarNoA.Text != CNTR_NO)
                                {
                                    lblCarNoA.Text = CNTR_NO;
                                }
                                if (lbltypeA.Text != PROD_ID)
                                {
                                    lbltypeA.Text = PROD_ID;
                                }

                                if (lblWaterA.Text != wate)
                                {
                                    lblWaterA.Text = wate;
                                }
                                if (lblAVGA.Text != avgWate)
                                {
                                    lblAVGA.Text = avgWate;
                                }


                                if (state == "测水")
                                {
                                    lblOA1.Text = "○";
                                    lblOA2.Text = "";
                                    lblOA3.Text = "";
                                    lblOA4.Text = "";
                                }
                                if (state == "分拣")
                                {
                                    lblOA2.Text = "○";
                                    lblOA1.Text = "";
                                    lblOA3.Text = "";
                                    lblOA4.Text = "";
                                }
                                if (state == "收货")
                                {
                                    lblOA3.Text = "○";
                                    lblOA1.Text = "";
                                    lblOA2.Text = "";
                                    lblOA4.Text = "";
                                }
                                if (state == "退货")
                                {
                                    lblOA4.Text = "○";
                                    lblOA1.Text = "";
                                    lblOA2.Text = "";
                                    lblOA3.Text = "";
                                }

                                break;


                            //第二行
                            case 1:
                                if (lblCarNOB.Text != CNTR_NO)
                                {
                                    lblCarNOB.Text = CNTR_NO;
                                }
                                if (lblTypeB.Text != PROD_ID)
                                {
                                    lblTypeB.Text = PROD_ID;
                                }

                                if (lblWaterB.Text != wate)
                                {
                                    lblWaterB.Text = wate;
                                }
                                if (lblAVGB.Text != avgWate)
                                {
                                    lblAVGB.Text = avgWate;
                                }


                                if (state == "测水")
                                {
                                    lblOB1.Text = "○";
                                    lblOB2.Text = "";
                                    lblOB3.Text = "";
                                    lblOB4.Text = "";
                                }
                                if (state == "分拣")
                                {
                                    lblOB2.Text = "○";

                                    lblOB1.Text = "";
                                    lblOB3.Text = "";
                                    lblOB4.Text = "";
                                }
                                if (state == "收货")
                                {
                                    lblOB3.Text = "○";
                                    lblOB1.Text = "";
                                    lblOB2.Text = "";
                                    lblOB4.Text = "";
                                }
                                if (state == "退货")
                                {
                                    lblOB4.Text = "○";
                                    lblOB1.Text = "";
                                    lblOB2.Text = "";
                                    lblOB3.Text = "";
                                }

                                break;

                            //第三行
                            case 2:
                                if (lblCarNoC.Text != CNTR_NO)
                                {
                                    lblCarNoC.Text = CNTR_NO;
                                }
                                if (lblTypeC.Text != PROD_ID)
                                {
                                    lblTypeC.Text = PROD_ID;
                                }

                                if (lblWaterC.Text != wate)
                                {
                                    lblWaterC.Text = wate;
                                }
                                if (lblAVGC.Text != avgWate)
                                {
                                    lblAVGC.Text = avgWate;
                                }


                                if (state == "测水")
                                {
                                    lblOC1.Text = "○";
                                    lblOC2.Text = "";
                                    lblOC3.Text = "";
                                    lblOC4.Text = "";
                                }
                                if (state == "分拣")
                                {
                                    lblOC2.Text = "○";
                                    lblOC1.Text = "";
                                    lblOC3.Text = "";
                                    lblOC4.Text = "";
                                }
                                if (state == "收货")
                                {
                                    lblOC3.Text = "○";
                                    lblOC1.Text = "";
                                    lblOC2.Text = "";
                                    lblOC4.Text = "";
                                }
                                if (state == "退货")
                                {
                                    lblOC4.Text = "○";
                                    lblOC1.Text = "";
                                    lblOC2.Text = "";
                                    lblOC3.Text = "";
                                }

                                break;

                            default:
                                break;
                            }
                        }
                    }

                    num += 3;
                }
            }
            catch
            {
            }
        }
Exemple #30
0
        public MainFrom mf;//主窗体
        /// <summary>
        /// 单击发送按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSMSSend_Click(object sender, EventArgs e)
        {
            //短信内容

            if (string.IsNullOrEmpty(txtcontent.Text.Trim()))
            {
                MessageBox.Show("请输入短信内容");
                return;
            }

            //质检状态改为暂停质检
            LinQBaseDao.Query("update QCInfo set QCInfo_Dictionary_ID=(select Dictionary_ID from Dictionary where Dictionary_Name='暂停质检') where QCInfo_ID=" + QcinfoID);

            //添加异常信息
            //insert into Unusual values(质检编号,异常类型编号,异常类型编号,'内容','未处理',经手人编号,0)
            Unusual un = new Unusual();

            un.Unusual_QCInfo_ID      = QcinfoID;
            un.Unusual_UnusualType_Id = Convert.ToInt32(cboUnusualType_Name.SelectedValue);
            un.Unusual_TestItems_ID   = Convert.ToInt32(cboUnusualType_Name.SelectedValue);
            un.Unusual_content        = cboUnusualType_Name.Text + "异常:" + txtcontent.Text.Trim();
            un.Unusual_State          = "未处理";
            un.Unusual_ISSMSSend      = false;
            un.Unusual_time           = LinQBaseDao.getDate();

            int u_id = 0;

            if (UnusualDAL.InsertOneQCRecord(un, out u_id))
            {
                MessageBox.Show("短信发送成功!");


                int TestItems_ID = Convert.ToInt32(cboUnusualType_Name.SelectedValue);
                //发送内容及发送人
                DataSet SMSDs = LinQBaseDao.Query("select top(1)* from SMSConfigure where SMSConfigure_TestItems_ID=" + TestItems_ID);//只会存在一条

                #region 取内容
                string[] SMSContent    = SMSDs.Tables[0].Rows[0]["SMSConfigure_SendContent"].ToString().Split(',');
                string[] SMSContentTxt = SMSDs.Tables[0].Rows[0]["SMSConfigure_SendContentText"].ToString().Split(',');
                string   Contents      = SMSSendContent(SMSContent, un.Unusual_Id, SMSContentTxt, un.Unusual_content);//存储短信内容
                #endregion

                #region 取号码、姓名,并对其号码发送短信(号码和姓名同位置是一组数据)
                string[] SMSPhon = SMSDs.Tables[0].Rows[0]["SMSConfigure_ReceivePhone"].ToString().Split(';'); //号码
                string[] SMSName = SMSDs.Tables[0].Rows[0]["SMSConfigure_Receive"].ToString().Split(';');      //姓名

                for (int y = 0; y < SMSPhon.Count(); y++)                                                      //循环要发送的人数的电话号码
                {
                    if (SMSPhon[y] != "")
                    {
                        SmsSend ss = new SmsSend();
                        ss.SmsSend_Phone       = SMSPhon[y];
                        ss.SmsSend_Text        = Contents;
                        ss.SmsSend_userName    = SMSName[y];
                        ss.SmsSend_IsSend      = "0";
                        ss.SmsSend_Unusunal_ID = un.Unusual_Id;
                        bool b = SmsSendDAL.Insert(ss);
                    }
                }



                #endregion



                Emety();
            }
            else
            {
                MessageBox.Show("短信发送失败!");
                return;
            }
        }