/// <summary>
        /// 自动填充设备接收信息
        /// </summary>
        /// <param name="check"></param>
        /// <returns></returns>
        public XVEquipmentReceiveInfo FillEquipmentReceiveInfo4Add(XVEquipmentCheckInfo check, string userId)
        {
            XVEquipmentReceiveInfo rev = new XVEquipmentReceiveInfo();

            rev.EquipmentCheckId = check.RID;
            rev.EquipmentName    = check.EquipmentName;
            rev.CheckUserId      = check.SourceCustId;
            rev.CheckUserName    = check.CheckResult;//字段临时借用:指定检定人名称
            rev.Remark           = "自动接收";

            rev.RID = Guid.NewGuid().ToString();
            rev.ID  = check.RID;

            rev.EquipmentType = check.EquipmentTypeName;
            rev.EquipmentNo   = check.EquipmentNo;
            rev.CustName      = check.CustName;
            rev.Spec          = check.Spec;
            rev.Model         = check.Model;
            rev.Quanlity      = check.Quanlity;
            rev.LastCheckDate = check.LastCheckDate;
            rev.SourceTypeId  = check.SourceTypeId;
            rev.SourceCustId  = check.SourceCustId;
            rev.SourceTime    = check.SourceTime;

            rev.ReceiveDate = check.UseTime;
            rev.ReceiveDesc = check.EquipmentDesc;

            rev.ReceiveUserId = userId;
            //info.ReceiveUserName = XCommon.LoginUsersInfo.UserName;

            rev.CurrentStatus = "接收";
            rev.FlowUserId    = rev.CheckUserId;
            rev.FlowStatus    = "检定";

            rev.InputUserId  = userId;
            rev.InputTime    = XHelper.GetFormatedTime(DateTime.Now);
            rev.UpdateUserId = userId;
            rev.UpdateTime   = XHelper.GetFormatedTime(DateTime.Now);
            rev.ModelStatus  = XModelStatus.Add;


            return(rev);
        }
        protected override bool SaveEdit()
        {
            XEquipmentCheckBusiness business = this.m_Business as XEquipmentCheckBusiness;

            if (chkcopy.Checked == false)
            {
                //2016-11-21,mxj,add
                if (chknumtb.Checked)
                {
                    XVEquipmentCheckInfo info = this.m_CurrentModel as XVEquipmentCheckInfo;
                    string sql      = "update  EquipmentReceive set Quanlity=" + XHelper.GetInt(this.nebQuanlity.Value) + " ,ReceiveDate='" + dtUseTime.Value.ToString("yyyy-MM-dd") + " 00:00:00' ";
                    string sqlwhere = " where  EquipmentCheckId='" + info.RID + "'";

                    if (chkCheckedDate.Checked)
                    {
                        sql = sql + " , CheckedDate='" + dtCheckedDate.Value.ToString("yyyy-MM-dd") + " 00:00:00'";
                    }
                    if (chkVerifyedDate.Checked)
                    {
                        sql = sql + " , VerifyedDate='" + dtVerifyedDate.Value.ToString("yyyy-MM-dd") + " 00:00:00'";
                    }
                    if (chkSignedDate.Checked)
                    {
                        sql = sql + " , SignedDate='" + dtSignedDate.Value.ToString("yyyy-MM-dd") + " 00:00:00'";
                    }


                    sql = sql + sqlwhere;

                    if (SQLHelper.ExecuteCommand(sql) > 0)
                    {
                    }
                }
                return(business.Update(this.m_CurrentModel));
            }
            else
            {
                this.m_CurrentModel.ModelStatus = XModelStatus.Add;

                return(business.Checked(this.m_CurrentModel, XCommon.LoginUsersInfo.RID));
            }
        }
        protected override void FillRowViewInfos(XModelBase model, System.Data.DataRow modelRow)
        {
            XVEquipmentCheckInfo info = model as XVEquipmentCheckInfo;

            info.CustName       = XHelper.GetString(modelRow["CustName"]);
            info.EquipmentState = XHelper.GetString(modelRow["EquipmentState"]);
            info.ColorRGB       = XHelper.GetString(modelRow["ColorRGB"]);

            info.CustAddress       = XHelper.GetString(modelRow["CustAddress"]);
            info.LinkPeople        = XHelper.GetString(modelRow["LinkPeople"]);
            info.MobileNo          = XHelper.GetString(modelRow["MobileNo"]);
            info.WorkTel           = XHelper.GetString(modelRow["WorkTel"]);
            info.CustEmail         = XHelper.GetString(modelRow["CustEmail"]);
            info.Email             = XHelper.GetString(modelRow["Email"]);
            info.WebSite           = XHelper.GetString(modelRow["WebSite"]);
            info.CustDesc          = XHelper.GetString(modelRow["CustDesc"]);
            info.InvoiceTitle      = XHelper.GetString(modelRow["InvoiceTitle"]);
            info.TaxNo             = XHelper.GetString(modelRow["TaxNo"]);
            info.BankName          = XHelper.GetString(modelRow["BankName"]);
            info.BankAccountNo     = XHelper.GetString(modelRow["BankAccountNo"]);
            info.EquipmentTypeName = XHelper.GetString(modelRow["EquipmentTypeName"]);
            //2015-10-14,mxj,add
            info.UserName = XHelper.GetString(modelRow["UserName"]);
        }
Beispiel #4
0
        private void txtEquipmentCheckId_TextChanged(object sender, EventArgs e)
        {
            XModelBase selectedModel = this.txtEquipmentCheckId.SelectedModel;

            if (this.txtEquipmentCheckId.SelectedModel != null)
            {
                XVEquipmentCheckInfo equipmentCheckInfo = selectedModel as XVEquipmentCheckInfo;

                this.cboEquipmentType.Text   = equipmentCheckInfo.EquipmentTypeName;
                this.txtEquipmentNo.Text     = equipmentCheckInfo.EquipmentNo;
                this.txtEquipmentCustId.Text = equipmentCheckInfo.CustName;
                this.txtSpec.Text            = equipmentCheckInfo.Spec;
                this.txtModel.Text           = equipmentCheckInfo.Model;
                //2015-08-10,mxj,add增加,数量=====================
                if (equipmentCheckInfo.Quanlity > 0)
                {
                    this.nebQuanlity.Value = equipmentCheckInfo.Quanlity;
                }
                //============================================
                this.dtLastCheckDate.Value = XHelper.GetDateTime(equipmentCheckInfo.LastCheckDate);
                this.cboSourceTypeId.Text  = equipmentCheckInfo.SourceTypeId;
                //this.txtSourceCustId.Text = equipmentCheckInfo.SourceCustId;//2015-07-13,dell
                this.dtSourceTime.Value = XHelper.GetDateTime(equipmentCheckInfo.SourceTime);

                this.txtFactoryName.Text = equipmentCheckInfo.FactoryName;
                this.txtFactoryNo.Text   = equipmentCheckInfo.FactoryNo;
                this.txtCheckAccord.Text = equipmentCheckInfo.CheckAccord;

                //2016-3-29,mxj,add======================
                this.dtReceive.Value = XHelper.GetDateTime(equipmentCheckInfo.UseTime);
                //========================================

                //2015-07-13,mxj,add===========================
                if (equipmentCheckInfo.SourceCustId != null && equipmentCheckInfo.SourceCustId != "")
                {
                    string    sqlget = "select * from StaffInfo where rid='" + equipmentCheckInfo.SourceCustId + "'";
                    DataTable dt     = new DataTable();
                    dt = SQLHelper.GetDataSet(sqlget);
                    bool ishad = false;
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            ishad = true;
                        }
                    }
                    string disname = "";
                    if (ishad)
                    {
                        disname = dt.Rows[0]["UserName"] + "";
                    }
                    else
                    {
                        disname = equipmentCheckInfo.SourceCustId;
                    }
                    this.txtCheckUserId.Text          = disname;
                    this.txtCheckUserId.ValueMember   = equipmentCheckInfo.SourceCustId;
                    this.txtCheckUserId.DisplayMember = disname;
                }
            }
            else
            {
                this.cboEquipmentType.Text   = string.Empty;
                this.txtEquipmentNo.Text     = string.Empty;
                this.txtEquipmentCustId.Text = string.Empty;
                this.txtSpec.Text            = string.Empty;
                this.txtModel.Text           = string.Empty;
                //this.nebQuanlity.Value = 0;
                //this.dtLastCheckDate.Value = XHelper.GetDateTime(equipmentCheckInfo.LastCheckDate);
                this.cboSourceTypeId.Text = string.Empty;
                this.txtSourceCustId.Text = string.Empty;
                //this.dtSourceTime.Value = XHelper.GetDateTime(equipmentCheckInfo.SourceTime);
            }
        }
        /// <summary>
        /// 设置修改时的默认值
        /// </summary>
        protected override void SetDefaultValue()
        {
            XVEquipmentCheckInfo info = this.m_CurrentModel as XVEquipmentCheckInfo;

            if (info.EquipmentType != string.Empty)
            {
                this.txtEquipmentType.Text          = info.EquipmentTypeName;
                this.txtEquipmentType.DisplayMember = info.EquipmentTypeName;
                this.txtEquipmentType.ValueMember   = info.EquipmentType;
            }
            //this.cboEquipmentType.Text = info.EquipmentType;

            if (info.EquipmentCustId != string.Empty)
            {
                this.txtEquipmentCustId.Text          = info.CustName;
                this.txtEquipmentCustId.DisplayMember = info.CustName;
                this.txtEquipmentCustId.ValueMember   = info.EquipmentCustId;
            }
            this.txtEquipmentName.Text = info.EquipmentName;
            this.txtFactoryNo.Text     = info.FactoryNo;
            this.txtSpec.Text          = info.Spec;
            this.txtModel.Text         = info.Model;
            this.txtFactoryName.Text   = info.FactoryName;
            this.dtSourceTime.Value    = XHelper.GetDateTime(info.SourceTime);
            this.dtUseTime.Value       = XHelper.GetDateTime(info.UseTime);

            this.cboSourceTypeId.Text = info.SourceTypeId;
            if (info.EquipmentStatusId != string.Empty)
            {
                this.txtEquipmentStatusId.Text          = info.EquipmentState;
                this.txtEquipmentStatusId.DisplayMember = info.EquipmentState;
                this.txtEquipmentStatusId.ValueMember   = info.EquipmentStatusId;
            }
            this.cboSignStatus.Text = info.SignStatus;
            this.nebQuanlity.Value  = info.Quanlity;
            this.txtLinkMan.Text    = info.LinkMan;
            //2016-11-21,mxj,modify
            this.txtTel.Text = info.Tel;
            //this.txtTel.Text = info.MobileNo;
            this.txtEmail.Text         = info.Email;
            this.txtCheckAccord.Text   = info.CheckAccord;
            this.dtLastCheckDate.Value = XHelper.GetDateTime(info.LastCheckDate);
            this.txtCheckResult.Text   = info.CheckResult;
            this.dtValidDate.Value     = XHelper.GetDateTime(info.ValidDate);
            this.txtCertNo.Text        = info.CertNo;
            this.txtEquipmentDesc.Text = info.EquipmentDesc;
            this.txtRemark.Text        = info.Remark;

            this.txtEquipmentNo.Text = info.EquipmentNo;
            this.txtBillNo.Text      = info.BillNo;


            //this.txtSourceCustId.Text = info.SourceCustId;
            //2015-07-13,mxj,add============================
            if (info.SourceCustId != string.Empty)
            {
                string    sqlget = "select * from StaffInfo where rid='" + info.SourceCustId + "'";
                DataTable dt     = new DataTable();
                dt = SQLHelper.GetDataSet(sqlget);
                bool ishad = false;
                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        ishad = true;
                    }
                }
                string disname = "";
                if (ishad)
                {
                    disname = dt.Rows[0]["UserName"] + "";
                }
                else
                {
                    disname = info.SourceCustId;
                }
                this.txtCheckUserId.Text          = disname;
                this.txtCheckUserId.ValueMember   = info.SourceCustId;
                this.txtCheckUserId.DisplayMember = disname;
            }

            if (this.m_EditStatus == XEditStatus.Edit)
            {
                // info.EquipmentName = this.txtEquipmentName.Text;

                if (cbodevselect.Items != null)
                {
                    for (int i = 0; i < cbodevselect.Items.Count; i++)
                    {
                        cbodevselect.Items.RemoveAt(0);
                    }
                }

                cbodevselect.Items.Add(info.EquipmentName, info.EquipmentName);
                cbodevselect.SelectedIndex = 0;
            }


            m_OldEquipmentNo = this.txtEquipmentNo.Text.Trim();
        }
        /// <summary>
        /// 填充实体信息
        /// </summary>
        protected override void FillModelInfo()
        {
            XVEquipmentCheckInfo info = this.m_CurrentModel as XVEquipmentCheckInfo;

            if (this.m_EditStatus == XEditStatus.AddNew || chkcopy.Checked)
            {
                info.RID = this.GetNewId();
                info.ID  = info.RID;
            }

            info.EquipmentType     = this.txtEquipmentType.ValueMember;
            info.EquipmentTypeName = this.txtEquipmentType.DisplayMember;
            info.EquipmentCustId   = this.txtEquipmentCustId.ValueMember;
            info.CustName          = this.txtEquipmentCustId.DisplayMember;
            info.EquipmentName     = this.txtEquipmentName.Text;
            info.FactoryNo         = this.txtFactoryNo.Text;
            info.Spec        = this.txtSpec.Text;
            info.Model       = this.txtModel.Text;
            info.FactoryName = this.txtFactoryName.Text;
            info.SourceTime  = XHelper.GetFormatedDate(this.dtSourceTime.Value);
            info.UseTime     = XHelper.GetFormatedDate(this.dtUseTime.Value);
            //info.SourceCustId = this.txtSourceCustId.Text;//2015-07-13,mxj,del
            info.SourceTypeId      = this.cboSourceTypeId.Text;
            info.EquipmentStatusId = this.txtEquipmentStatusId.ValueMember;
            info.EquipmentState    = this.txtEquipmentStatusId.DisplayMember;
            info.SignStatus        = this.cboSignStatus.Text;
            info.Quanlity          = XHelper.GetInt(this.nebQuanlity.Value);
            info.LinkMan           = this.txtLinkMan.Text;
            info.MobileNo          = this.txtTel.Text;
            info.Tel           = this.txtTel.Text;//2016-11-21,mxj,启动,实现单条送检设备联系人及电话修改后同步问题
            info.Email         = this.txtEmail.Text;
            info.CheckAccord   = this.txtCheckAccord.Text;
            info.LastCheckDate = XHelper.GetFormatedDate(this.dtLastCheckDate.Value);

            //2015-07-13,mxj,add=======================
            info.SourceCustId = this.txtCheckUserId.ValueMember;


            //20151019,mxj,临时借用传递指定检定人名称===
            //2015-07-13,mxj,add===========================
            if (info.SourceCustId != null && info.SourceCustId != "")
            {
                string    sqlget = "select * from StaffInfo where rid='" + info.SourceCustId + "'";
                DataTable dt     = new DataTable();
                dt = SQLHelper.GetDataSet(sqlget);
                bool ishad = false;
                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        ishad = true;
                    }
                }
                string disname = "";
                if (ishad)
                {
                    disname          = dt.Rows[0]["UserName"] + "";
                    info.CheckResult = disname;
                }
            }

            //==========================================
            info.ValidDate     = XHelper.GetFormatedDate(this.dtValidDate.Value);
            info.CertNo        = this.txtCertNo.Text;
            info.EquipmentDesc = this.txtEquipmentDesc.Text;
            info.Remark        = this.txtRemark.Text;

            info.BillNo = this.txtBillNo.Text.Trim();



            info.EquipmentNo = this.txtEquipmentNo.Text.Trim();

            if (this.txtEquipmentStatusId.SelectedModel != null)
            {
                XCodeEquipmentStateInfo stateInfo = this.txtEquipmentStatusId.SelectedModel as XCodeEquipmentStateInfo;
                info.ColorRGB = stateInfo.ColorRGB;
            }

            base.FillModelInfo();
        }