Exemple #1
0
 private void btn_Ok_Click(object sender, EventArgs e)
 {
     try
     {
         deviceInfo device    = new deviceInfo();
         log_tabel  condition = new log_tabel();
         if (tbx_Name.Text.Trim() != "")
         {
             condition.addrow("PersonName", tbx_Name.Text.Trim(), log_tabel.operatetype.equal, log_tabel.mark.normal);
         }
         if (dtp_Intime.Text != "")
         {
             condition.addrow("EnlistmentTime", dtp_Intime.Value.ToString("yyyy-MM-dd"), log_tabel.operatetype.equal, log_tabel.mark.Date);
         }
         int Recordcount = device.GetRecordCount(logs.PersonnelInfoList, condition);
         if (Recordcount > 0)
         {
             myPageControl1.PageRecordCount = Recordcount;
             DataTable dt = device.getpage(logs.PersonnelInfoList, condition, myPageControl1.DataStart, myPageControl1.PageRecordNumber);
             DataView.DataSource = dt;
             bindingColName(dt);
         }
         else
         {
             MessageBox.Show("无匹配数据,请重新更改查询条件!");
         }
         tbx_Name.Text   = "";
         dtp_Intime.Text = "";
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #2
0
        private string NewFile_Service(string reporter, string productSN, string docType, string fileName, string filePath, string Ext, string Time)
        {
            string             ret         = "ERROR";
            deviceInfo         devInfo     = new deviceInfo();
            Service1SoapClient test1       = new Service1SoapClient();
            string             productType = devInfo.GetProductType(productSN);
            string             filePathAll = filePath + fileName;

            using (FileStream fileStream = new FileStream(filePathAll, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                // 读取文件的 byte[]
                byte[] bytes = new byte[fileStream.Length];
                fileStream.Read(bytes, 0, bytes.Length);
                fileStream.Close();

                /*
                 *          // 把 byte[] 转换成 Stream
                 *          Stream stream = new MemoryStream(bytes);
                 *          byte[] bytes = new byte[stream.Length];
                 *          stream.Read(bytes, 0, bytes.Length);
                 *      // 设置当前流的位置为流的开始
                 *          stream.Seek(0, SeekOrigin.Begin);
                 */
                try
                {
                    ret = test1.CollectDevice_MES_Doc_New(reporter, deviceInfo.deviceCode, productType, productSN, docType, deviceInfo.folderId, fileName, bytes, Ext, Time);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
            return(ret);
        }
Exemple #3
0
 /// <summary>
 /// ID查重
 /// </summary>
 /// <returns></returns>
 private bool CheckIDIsrepeat()
 {
     if (tbx_PlanID.Text.Trim() != "")
     {
         deviceInfo device    = new deviceInfo();
         string     Condition = tbx_PlanID.Text;
         string     sql       = "select * from PlanManagementInfoList where PlanID ='" + Condition + "'";
         try
         {
             DataSet result = device.gettablebycondition(sql);
             //log_tabel log = new log_tabel();
             //log.addrow("PlanID", tbx_PlanID.Text.Trim(), log_tabel.operatetype.equal, log_tabel.mark.normal);
             //int i = device.GetRecordCount(logs.PlanManagementInfoList, log);
             if (result.Tables[0] != null && result.Tables[0].Rows.Count > 0)
             {
                 MessageBox.Show("预案编号重复 请重新录入!");
                 return(false);
             }
         }
         catch (Exception e)
         {
             throw e;
         }
     }
     return(true);
 }
Exemple #4
0
        /// <summary>
        /// 数据操作
        /// </summary>
        /// <param name="Mess">区别编辑还是新增还是删除</param>
        private void OpreationDB(string Mess)
        {
            BaseDataClass.PersonnelInfoList PersonList = new PersonnelInfoList();
            PersonList.PersonName        = this.tbx_Name.Text.ToString();
            PersonList.PersonID          = this.tbx_ID.Text.ToString();
            PersonList.PersonNation      = this.tbx_Nation.Text.ToString();
            PersonList.Post              = this.tbx_post.Text.ToString();
            PersonList.Unit              = this.tbx_Unit.Text.ToString();
            PersonList.ContactInfo       = this.tbx_contactinfo.Text.ToString();
            PersonList.DateOfBirth       = this.TimePicker_DateOfBirth.Value.ToString("yyyy-MM-dd");
            PersonList.DegreeOfEducation = this.tbx_DegreeOfEducation.Text.ToString();
            PersonList.EnlistmentTime    = this.TimePicker_Intime.Value.ToString("yyyy-MM-dd");
            PersonList.RetiredTime       = this.TimePicker_Outtime.Value.ToString("yyyy-MM-dd");
            PersonList.NativePlace       = this.tbx_place.Text.ToString();
            PersonList.Description       = this.tbx_descrip.Text.ToString();

            deviceInfo PersonInfo = new deviceInfo();
            string     Error      = "";
            bool       Result     = false;

            if (Mess == "添加")
            {
                if (tbx_ID.Text.Trim() != "")
                {
                    deviceInfo device = new deviceInfo();
                    //string sql = "select * from PersonnelListInfo where PersonID =‘" + tbx_ID.Text.Trim()+"’";
                    //DataSet result= device.gettablebycondition(sql);
                    log_tabel log = new log_tabel();
                    log.addrow("PersonID", tbx_ID.Text.Trim(), log_tabel.operatetype.equal, log_tabel.mark.normal);
                    int i = device.GetRecordCount(logs.PersonnelInfoList, log);
                    if (i > 0)
                    {
                        MessageBox.Show("用户编号重复 请重新录入!");
                    }
                    else
                    {
                        Result = PersonInfo.AddBaseList(PersonList, ref Error);
                    }
                }
            }
            if (Mess == "编辑")
            {
                Result = PersonInfo.UpdateBaselist(PersonList, ref Error);
            }
            if (Mess == "删除")
            {
                Result = PersonInfo.DeleteOneRecord(BaseDataClassNames.PersonnelInfoList, PersonList.PersonID, ref Error);
            }
            if (Result == true)
            {
                MessageBox.Show("人员信息" + Mess + "成功");
                ClearText(this.Content);
            }
            else
            {
                MessageBox.Show("人员信息" + Mess + "失败,请稍后再试!");
                ClearText(this.Content);
            }
        }
Exemple #5
0
        /// <summary>
        /// 数据操作
        /// </summary>
        /// <param name="Mess">区别编辑还是新增还是删除</param>
        private void OpreationDB(string Mess)
        {
            BaseDataClass.EquipmentInfoList Equiplist = new EquipmentInfoList();

            Equiplist.EquipmentID    = this.tbx_ID.Text.Trim();
            Equiplist.EquipmentName  = this.tbx_Name.Text.Trim();
            Equiplist.EquipmentModel = this.tbx_EquipNum.Text.Trim();
            Equiplist.EquipmentType  = this.tbx_EquipType.Text.Trim();
            Equiplist.PersonIncharge = this.tbx_PersonIncharge.Text.Trim();
            Equiplist.ReturnDate     = this.TimePicker_ReturnDate.Value.ToString("yyyy-MM-dd");
            Equiplist.AllottedDate   = this.TimePicker_Intime.Value.ToString("yyyy-MM-dd");
            Equiplist.Description    = this.tbx_descrip.Text;
            Equiplist.Unit           = this.tbx_Unit.Text;
            Equiplist.EquipmentState = this.tbx_EquipmentState.Text;
            deviceInfo PersonInfo = new deviceInfo();
            string     Error      = "";
            bool       Result     = false;

            if (Mess == "添加")
            {
                if (tbx_ID.Text.Trim() != "")
                {
                    //deviceInfo device = new deviceInfo();
                    //string sql = "select * from EquipmentInfoList where EquipmentID =" + tbx_ID.Text.Trim();
                    //DataSet result= device.gettablebycondition(sql);
                    deviceInfo device = new deviceInfo();
                    log_tabel  log    = new log_tabel();
                    log.addrow("EquipmentID", tbx_ID.Text.Trim(), log_tabel.operatetype.equal, log_tabel.mark.normal);
                    int i = device.GetRecordCount(logs.EquipmentInfoList, log);
                    if (i > 0)
                    {
                        MessageBox.Show("设备编号重复 请重新录入!");
                    }
                    else
                    {
                        Result = PersonInfo.AddBaseList(Equiplist, ref Error);
                    }
                }
            }
            if (Mess == "编辑")
            {
                Result = PersonInfo.UpdateBaselist(Equiplist, ref Error);
            }
            if (Mess == "删除")
            {
                Result = PersonInfo.DeleteOneRecord(BaseDataClassNames.EquipmentInfoList, Equiplist.EquipmentID, ref Error);
            }
            if (Result == true)
            {
                MessageBox.Show("设备信息" + Mess + "成功");
                ClearText(this.Content);
            }
            else
            {
                MessageBox.Show("设备信息" + Mess + "失败,请稍后再试!");
                ClearText(this.Content);
            }
        }
Exemple #6
0
        /// <summary>
        /// 数据操作
        /// </summary>
        /// <param name="Mess">区别编辑还是新增还是删除</param>
        private void OpreationDB(string Mess)
        {
            BaseDataClass.DutyRecordInfoList DutyLIst = new DutyRecordInfoList();

            DutyLIst.DutyPerson = tbx_Name.Text.Trim();
            DutyLIst.PersonID   = tbx_ID.Text.Trim();
            DutyLIst.DutyDate   = TimePicker_DutyDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
            DutyLIst.DutyEvent  = tbx_DutyEvent.Text;
            if (tbx_DutyEvent.Text == "")
            {
                DutyLIst.DutyEventTime = "";
            }
            DutyLIst.DutyEventTime = TimePicker_DutyEventTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
            DutyLIst.DutyRoute     = tbx_DutyRoute.Text;
            DutyLIst.Description   = tbx_descrip.Text;
            DutyLIst.Mark          = cbx_Plan.SelectedText;//预留字段MARK这里用来保存预案处置结果


            deviceInfo PersonInfo = new deviceInfo();
            string     Error      = "";
            bool       Result     = false;

            if (Mess == "添加")
            {
                Result = PersonInfo.AddBaseList(DutyLIst, ref Error);
            }
            if (Mess == "编辑")
            {
                DutyLIst.ID = Convert.ToInt32(infoList[0].ToString());
                Result      = PersonInfo.UpdateBaselist(DutyLIst, ref Error);
            }
            if (Mess == "删除")
            {
                DutyLIst.ID = Convert.ToInt32(infoList[0].ToString());
                Result      = PersonInfo.DeleteOneRecord(BaseDataClassNames.DutyRecordInfoList, DutyLIst.ID, ref Error);
            }
            if (Result == true)
            {
                MessageBox.Show("设备信息" + Mess + "成功");
                ClearText(this.Content);
                this.Close();
            }
            else
            {
                MessageBox.Show("设备信息" + Mess + "失败,请稍后再试!");
                ClearText(this.Content);
            }
        }
Exemple #7
0
        /// <summary>
        /// 通过姓名联想
        /// </summary>
        /// <param name="Condition"></param>
        private void GetEquipInfoByName(string Condition)
        {
            deviceInfo device = new deviceInfo();
            string     sql    = "select * from PlanManagementInfoList where PlanID like '%" + Condition + "%'";
            DataSet    ds     = device.gettablebycondition(sql);
            DataTable  dt     = ds.Tables[0];

            if (dt.Rows.Count > 0 && dt != null)
            {
                PlanResult = dt;
            }
            else
            {
                MessageBox.Show("找不到符合条件的相关信息,请重新输入!");
            }
        }
Exemple #8
0
        private void NewDuty(DutyRecordInfoList dutyRecordInfo)
        {
            string Error = string.Empty;

            MessageBox.Show("收到新的执勤信息");
            deviceInfo deviceInfo = new deviceInfo();

            try
            {
                bool Result = deviceInfo.AddBaseList(dutyRecordInfo, ref Error);
            }
            catch
            {
            }
            btn_Ok_Click(this, new EventArgs());
        }
Exemple #9
0
        /// <summary>
        /// 通过ID联想
        /// </summary>
        /// <param name="Condition"></param>
        private void GetPersonInfoByID(string Condition)
        {
            deviceInfo device = new deviceInfo();
            string     sql    = "select * from PersonnelInfoList where PersonID like '%" + Condition + "%'";
            DataSet    ds     = device.gettablebycondition(sql);
            DataTable  dt     = ds.Tables[0];

            if (dt.Rows.Count > 0 && dt != null)
            {
                PersonResult = dt;
            }
            else
            {
                MessageBox.Show("找不到符合条件的人员相关信息,请重新输入!");
            }
        }
Exemple #10
0
        private string NewData_Service(string reporter, string productSN, string propertyName, string propertyValue, string Ext, string Time)
        {
            string             ret         = "ERROR";
            deviceInfo         devInfo     = new deviceInfo();
            Service1SoapClient test1       = new Service1SoapClient();
            string             productType = devInfo.GetProductType(productSN);

            try
            {
                ret = test1.CollectDevice_MES_ProcessData_New(reporter, deviceInfo.deviceCode, productType, productSN, propertyName, propertyValue, Ext, Time);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(ret);
        }
Exemple #11
0
 private void btn_Search_Click(object sender, EventArgs e)
 {
     try
     {
         //if (SearchText.Text.Trim() != "")
         //{
         //    string Condition = SearchText.Text.Trim();
         //    deviceInfo device = new deviceInfo();
         //    string sql = "select * from PersonnelInfoList where PersonName like '%" + Condition + "%'";
         //    DataSet ds = device.gettablebycondition(sql);
         //    DataTable dt = ds.Tables[0];
         //    if (dt.Rows.Count > 0 && dt != null)
         //    {
         //        DataView.DataSource = dt;
         //        PersonResult = dt;
         //    }
         //    else
         //    {
         //        MessageBox.Show("找不到符合条件的人员相关信息,请重新输入!");
         //    }
         //}
         if (SearchText.Text.Trim() != "")
         {
             string     name       = "%" + SearchText.Text.Trim() + "%";
             deviceInfo PersonInfo = new deviceInfo();
             log_tabel  log        = new log_tabel();
             log.addrow("EquipmentName", name, log_tabel.operatetype.like, log_tabel.mark.normal);
             int i = PersonInfo.GetRecordCount(logs.EquipmentInfoList, log);
             if (i > 0)
             {
                 DataTable dt = PersonInfo.getpage(logs.PersonnelInfoList, log, myPageControl1.DataStart, myPageControl1.PageRecordNumber);
                 DataView.DataSource = dt;
                 bindingColName(dt);
             }
             else
             {
                 MessageBox.Show("无匹配条件数据,请重新查询");
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #12
0
        private void btn_Ok_Click(object sender, EventArgs e)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new Action <object, EventArgs>(btn_Ok_Click), sender, e);
            }
            else
            {
                try
                {
                    deviceInfo device    = new deviceInfo();
                    log_tabel  condition = new log_tabel();
                    if (tbx_Name.Text.Trim() != "")
                    {
                        condition.addrow("PersonName", tbx_Name.Text.Trim(), log_tabel.operatetype.equal, log_tabel.mark.normal);
                    }
                    if (dtp_Intime.Text != "")
                    {
                        condition.addrow("DutyEventTime", dtp_Intime.Value.ToString("yyyy-MM-dd"), log_tabel.operatetype.lessAndEqual, log_tabel.mark.Date);
                        //condition.addrow("DutyEventTime", "2019-04-06", log_tabel.operatetype.lessAndEqual, log_tabel.mark.Date);
                    }

                    int Recordcount = device.GetRecordCount(logs.DutyRecordInfoList, condition);
                    if (Recordcount > 0)
                    {
                        myPageControl1.PageRecordCount  = Recordcount;
                        myPageControl1.PageRecordNumber = 100;
                        DataTable dt = device.getpage(logs.DutyRecordInfoList, condition, myPageControl1.DataStart, myPageControl1.PageRecordNumber);
                        DataView.DataSource = dt;
                        bindingColName(dt);
                    }
                    else
                    {
                        MessageBox.Show("无匹配数据,请重新更改查询条件!");
                    }
                    tbx_Name.Text   = "";
                    dtp_Intime.Text = "";
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Exemple #13
0
        private void bingdingPlan()
        {
            deviceInfo Plan = new deviceInfo();
            string     sql  = "select * from PlanManagementInfoList";
            DataSet    ds   = Plan.gettablebycondition(sql);

            if (ds != null)
            {
                DataTable dt = ds.Tables[0];
                if (dt != null && dt.Rows.Count > 0)
                {
                    //foreach (DataRow item in dt.Rows)
                    //{
                    cbx_Plan.DataSource    = dt;
                    cbx_Plan.ValueMember   = dt.Columns["PlanID"].ToString();
                    cbx_Plan.DisplayMember = dt.Columns["PlanContent"].ToString();
                    //}
                }
            }
        }
Exemple #14
0
 /// <summary>
 /// 数据操作
 /// </summary>
 /// <param name="Mess">区别编辑还是新增还是删除</param>
 private void OpreationDB(string Mess)
 {
     BaseDataClass.PlanManagementInfoList Planlist = new PlanManagementInfoList();
     try
     {
         Planlist.PlanContent = this.tbx_PlanContent.Text;
         Planlist.PlanID      = this.tbx_PlanID.Text.Trim();
         deviceInfo PersonInfo = new deviceInfo();
         string     Error      = "";
         bool       Result     = false;
         if (Mess == "添加")
         {
             if (CheckIDIsrepeat())
             {
                 Result = PersonInfo.AddBaseList(Planlist, ref Error);
             }
         }
         if (Mess == "编辑")
         {
             Result = PersonInfo.UpdateBaselist(Planlist, ref Error);
         }
         if (Mess == "删除")
         {
             Result = PersonInfo.DeleteOneRecord(BaseDataClassNames.PlanManagementInfoList, Planlist.PlanID, ref Error);
         }
         if (Result == true)
         {
             MessageBox.Show("预案信息" + Mess + "成功");
             ClearText(this.Content);
         }
         else
         {
             MessageBox.Show("预案信息" + Mess + "失败,请稍后再试!");
             ClearText(this.Content);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        /// <summary>
        /// Gets the identification information contained in the attached IC
        /// </summary>
        /// <returns>A struct with the specified data</returns>
        public deviceInfo internal_getDeviceInfo()
        {
            byte[] b;
            msgSendGetReply(section.internalCalls, (byte)internal_Inst.getDeviceInfo, out b);

            deviceInfo D            = new deviceInfo();
            byte       tableVersion = b[0];

            if (tableVersion > maxDeviceInfoTableVersion)
            {
                throw new Exception("USB device requires a newer version of the library to display the device info");
            }

            //only version 1 is currently supported
            D.firmwareVersion = b[3].ToString() + "." + b[2].ToString();
            D.prodID          = (productID)b[4];
            D.description     = productDescriptions[b[4]];
            D.serialNumber    = (ushort)usbI.productInfo.serialNumber;

            return(D);
        }
Exemple #16
0
        private string EndJob_Service(string reporter, string productSN, string Ext, string Time)
        {
            string             ret;
            deviceInfo         devInfo     = new deviceInfo();
            Service1SoapClient test1       = new Service1SoapClient();
            string             productType = devInfo.GetProductType(productSN);

            try
            {
                if (jobNew > 0)
                {
                    jobNew--;
                    string ret1 = test1.CollectDevice_MES_ControlJob_New(reporter, deviceInfo.deviceCode, productType, productSN, deviceInfo.operationGroup, Ext, "1", Time);
                }
                ret = test1.CollectDevice_MES_EndJob_New(reporter, deviceInfo.deviceCode, productType, productSN, deviceInfo.operationGroup, Ext, Time);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(ret);
        }
Exemple #17
0
        private string StartJob_Service(string reporter, string productSN, string Ext, string Time)
        {
            deviceInfo         devInfo     = new deviceInfo();
            Service1SoapClient test1       = new Service1SoapClient();
            string             productType = devInfo.GetProductType(productSN);

            jobNew++;
            string ret;

            try
            {
                ret = test1.CollectDevice_MES_StartJob_New(reporter, deviceInfo.deviceCode, productType, productSN, deviceInfo.operationGroup, Ext, Time);
                if (ret == "OK")
                {
                    string ret1 = test1.CollectDevice_MES_ControlJob_New(reporter, deviceInfo.deviceCode, productType, productSN, deviceInfo.operationGroup, Ext, "0", Time);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(ret);
        }
Exemple #18
0
        /// <summary>
        /// Gets the identification information contained in the attached IC
        /// </summary>
        /// <returns>A struct with the specified data</returns>
        public deviceInfo internal_getDeviceInfo()
        {
            byte[] b;
            msgSendGetReply(section.internalCalls, (byte)internal_Inst.getDeviceInfo, out b);

            deviceInfo D = new deviceInfo();
            byte tableVersion = b[0];
            if (tableVersion > maxDeviceInfoTableVersion)
                throw new Exception("USB device requires a newer version of the library to display the device info");

            //only version 1 is currently supported
            D.firmwareVersion = b[3].ToString() + "." + b[2].ToString();
            D.prodID = (productID)b[4];
            D.description = productDescriptions[b[4]];
            D.serialNumber = (ushort)usbI.productInfo.serialNumber;

            return D;
        }