/// <summary>
        /// 编辑过程检验
        /// </summary>
        /// <param name="user"></param>
        /// <param name="error"></param>
        /// <returns></returns>
        public static bool EditProcessTestingTable(ProcessTestingTable model, ref string error)
        {
            sql = string.Format(@" update ProcessTestingTable set Remark='{0}',ImgUrl='{2}',FileName='{3}',ImportTime='{4}',ImportPerson='{5}' where Id='{1}' ",

                                model.Remark, model.Id, model.ImgUrl, model.FileName, model.ImportTime, model.ImportPerson);
            return(SqlHelper.ExecuteSql(sql, ref error));
        }
        private void LoadPage()
        {
            string sql   = string.Empty;
            string error = string.Empty;

            if (ToolManager.CheckQueryString("Id"))
            {
                sql = string.Format(@" select * from ProcessTestingTable where Id='{0}' ", ToolManager.GetQueryString("Id"));
                ProcessTestingTable processtestingtable = ProcessTestingTableManager.ConvertDataTableToModel(sql);
                this.lblProductionOrderNumber.Text = processtestingtable.ProductionOrderNumber;
                this.lblProductNumber.Text         = processtestingtable.ProductNumber;
                this.lblCustomerProductNumber.Text = processtestingtable.CustomerProductNumber;
                this.txtRemark.Text              = processtestingtable.Remark;
                this.lblVersion.Text             = processtestingtable.Version;
                btnSubmit.Text                   = "修改";
                txtCustomerProductNumber.Visible = false;
                txtProductionOrderNumber.Visible = false;
                txtProductNumber.Visible         = false;
                show = "none";
            }
            else
            {
                show = "";
            }
        }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (ToolManager.CheckQueryString("Id"))
         {
             string sql = string.Format(@" select * from ProcessTestingTable where Id='{0}' ", ToolManager.GetQueryString("Id"));
             model     = ProcessTestingTableManager.ConvertDataTableToModel(sql);
             lbId.Text = model.Id;
             lbProductionOrderNumber.Text = model.ProductionOrderNumber;
             lbProductNumber.Text         = model.ProductNumber;
             lbVersion.Text = model.Version;
             lbCustomerProductNumber.Text = model.CustomerProductNumber;
             txtRemark.Text = model.Remark;
         }
     }
 }
        /// <summary>
        /// DataTable 转对象
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        public static ProcessTestingTable ConvertDataTableToModel(string sql)
        {
            error = string.Empty;
            DataTable           dt = SqlHelper.GetTable(sql, ref error);
            DataRow             dr = dt.Rows[0];
            ProcessTestingTable processtestingtable = new ProcessTestingTable();

            processtestingtable.Id = dr["Id"] == null ? "" : dr["Id"].ToString();
            processtestingtable.ProductionOrderNumber = dr["ProductionOrderNumber"] == null ? "" : dr["ProductionOrderNumber"].ToString();
            processtestingtable.ProductNumber         = dr["ProductNumber"] == null ? "" : dr["ProductNumber"].ToString();
            processtestingtable.CustomerProductNumber = dr["CustomerProductNumber"] == null ? "" : dr["CustomerProductNumber"].ToString();
            processtestingtable.ImportTime            = dr["ImportTime"] == null ? "" : dr["ImportTime"].ToString();
            processtestingtable.ImportPerson          = dr["ImportPerson"] == null ? "" : dr["ImportPerson"].ToString();
            processtestingtable.Remark   = dr["Remark"] == null ? "" : dr["Remark"].ToString();
            processtestingtable.FileName = dr["FileName"] == null ? "" : dr["FileName"].ToString();
            processtestingtable.ImgUrl   = dr["ImgUrl"] == null ? "" : dr["ImgUrl"].ToString();
            processtestingtable.Version  = dr["Version"] == null ? "" : dr["Version"].ToString();
            return(processtestingtable);
        }
Beispiel #5
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string fileName = this.fuFileUrl.FileName;

            if (string.IsNullOrEmpty(fileName))
            {
                lbSubmit.Text = "请选择文件";
                return;
            }
            string sql = string.Format(@" select * from ProcessTestingTable where Id='{0}' ", lbId.Text);

            model              = ProcessTestingTableManager.ConvertDataTableToModel(sql);
            model.ImportTime   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            model.ImportPerson = ToolCode.Tool.GetUser().UserNumber;

            string dataName = string.Concat(DateTime.Now.ToString("yyyyMMddHHmmss"), Path.GetExtension(fileName));

            this.fuFileUrl.SaveAs(Server.MapPath(string.Concat("/UpLoadFileData/", dataName)));
            model.ImgUrl   = string.Concat("../UpLoadFileData/", dataName);
            model.FileName = fileName;
            string error  = string.Empty;
            bool   result = ProcessTestingTableManager.EditProcessTestingTable(model, ref error);

            lbSubmit.Text = result == true ? "修改成功!" : "修改失败:原因:" + error;
            if (result)
            {
                Tool.WriteLog(Tool.LogType.Operating, "编辑过程检验信息" + model.Id, "编辑成功");
                Response.Write(ToolManager.GetClosePageJS());
                Response.End();

                return;
            }
            else
            {
                Tool.WriteLog(Tool.LogType.Operating, "编辑过程检验信息" + model.Id, error);
                return;
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string error = string.Empty;

            Model.ProcessTestingTable processtestingtable = new ProcessTestingTable();
            processtestingtable.ProductionOrderNumber = this.txtProductionOrderNumber.Text.Trim();
            processtestingtable.ProductNumber         = this.txtProductNumber.Text.Trim();
            processtestingtable.CustomerProductNumber = this.txtCustomerProductNumber.Text.Trim();
            processtestingtable.ImportTime            = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            processtestingtable.ImportPerson          = ToolCode.Tool.GetUser().UserNumber;
            processtestingtable.Remark  = this.txtRemark.Text.Trim();
            processtestingtable.Version = txtVersion.Text.ToUpper().Trim();
            bool      result = false;
            string    sql    = string.Empty;
            DataTable dt;

            if (btnSubmit.Text.Equals("添加"))
            {
                processtestingtable.Id = Guid.NewGuid().ToString();

                if (string.IsNullOrEmpty(processtestingtable.ProductionOrderNumber) ||
                    string.IsNullOrEmpty(processtestingtable.ImportTime) || string.IsNullOrEmpty(processtestingtable.ImportPerson))
                {
                    lbSubmit.Text = "请将带*号的内容填写完整!";
                    return;
                }

                sql = string.Format("select count(*) from ProductPlanDetail where PlanNumber='{0}'", processtestingtable.ProductionOrderNumber);
                string num = SqlHelper.GetScalar(sql);
                if (num == "0")
                {
                    lbSubmit.Text = "未知的开工单编号!";
                    return;
                }
                sql = string.Format("select count(*) from ProductPlanDetail where CustomerProductNumber='{0}' and PlanNumber='{1}' and Version='{2}'",
                                    processtestingtable.CustomerProductNumber, processtestingtable.ProductionOrderNumber, processtestingtable.Version);
                num = SqlHelper.GetScalar(sql);
                if (num == "0")
                {
                    lbSubmit.Text = "未知的客户产成品编号!";
                    return;
                }
                sql = string.Format(@"select  ProductNumber from ProductPlanDetail  where CustomerProductNumber='{0}' and PlanNumber='{1}' and Version='{2}'",
                                    processtestingtable.CustomerProductNumber, processtestingtable.ProductionOrderNumber, processtestingtable.Version);
                dt = SqlHelper.GetTable(sql);
                if (dt.Rows.Count > 0)
                {
                    processtestingtable.ProductNumber = dt.Rows[0]["ProductNumber"].ToString();
                }
                else
                {
                    lbSubmit.Text = "未知的客户产成品编号";
                    return;
                }
                string strFileName = this.fuFileUrl.FileName;
                if (strFileName == "")
                {
                    lbSubmit.Text = "请选择文件!";
                    return;
                }
                string dataName = string.Concat(DateTime.Now.ToString("yyyyMMddHHmmss"), Path.GetExtension(this.fuFileUrl.PostedFile.FileName));

                this.fuFileUrl.SaveAs(Server.MapPath(string.Concat("/UpLoadFileData/", dataName)));
                processtestingtable.ImgUrl = string.Concat("../UpLoadFileData/", dataName);


                processtestingtable.FileName = strFileName;

                result        = ProcessTestingTableManager.AddProcessTestingTable(processtestingtable, ref error);
                lbSubmit.Text = result == true ? "添加成功!" : "添加失败,原因:" + error;
                if (result)
                {
                    Tool.WriteLog(Tool.LogType.Operating, "增加过程检验信息" + processtestingtable.Id, "增加成功");
                    ToolCode.Tool.ResetControl(this.Controls);
                    return;
                }
                else
                {
                    Tool.WriteLog(Tool.LogType.Operating, "增加过程检验信息" + processtestingtable.Id, "增加失败!原因" + error);
                    return;
                }
            }
            else
            {
                processtestingtable.Id = ToolManager.GetQueryString("Id");
                result        = ProcessTestingTableManager.EditProcessTestingTable(processtestingtable, ref error);
                lbSubmit.Text = result == true ? "修改成功!" : "修改失败:原因:" + error;
                if (result)
                {
                    Tool.WriteLog(Tool.LogType.Operating, "编辑过程检验信息" + processtestingtable.Id, "编辑成功");
                    return;
                }
                else
                {
                    Tool.WriteLog(Tool.LogType.Operating, "编辑过程检验信息" + processtestingtable.Id, "编辑成功!原因" + error);
                    return;
                }
            }
        }