diff --git a/SGGL/FineUIPro.Web/Transfer/Instrumentation.aspx b/SGGL/FineUIPro.Web/Transfer/Instrumentation.aspx index b631a3df..e0ae3e14 100644 --- a/SGGL/FineUIPro.Web/Transfer/Instrumentation.aspx +++ b/SGGL/FineUIPro.Web/Transfer/Instrumentation.aspx @@ -15,7 +15,8 @@ diff --git a/SGGL/FineUIPro.Web/Transfer/Instrumentation.aspx.cs b/SGGL/FineUIPro.Web/Transfer/Instrumentation.aspx.cs index 0395381b..d5a800ee 100644 --- a/SGGL/FineUIPro.Web/Transfer/Instrumentation.aspx.cs +++ b/SGGL/FineUIPro.Web/Transfer/Instrumentation.aspx.cs @@ -81,7 +81,7 @@ namespace FineUIPro.Web.Transfer strSql += " AND Test_Package like @SysSubNo"; listStr.Add(new SqlParameter("@SysSubNo", "%" + this.txtSysSubNo.Text.Trim() + "%")); } - strSql += " order by INSTRUMENTATION "; + //strSql += " order by SN "; SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); diff --git a/SGGL/FineUIPro.Web/Transfer/InstrumentationDataIn.aspx.cs b/SGGL/FineUIPro.Web/Transfer/InstrumentationDataIn.aspx.cs index 0db982b6..00a98327 100644 --- a/SGGL/FineUIPro.Web/Transfer/InstrumentationDataIn.aspx.cs +++ b/SGGL/FineUIPro.Web/Transfer/InstrumentationDataIn.aspx.cs @@ -306,9 +306,19 @@ namespace FineUIPro.Web.Transfer } string result = string.Empty; ir = pds.Rows.Count; + int Sn = 0; if (pds != null && ir > 0) { List list = new List(); + //根据项目id查询sn + var snModel = Funs.DB.Transfer_Instrumentation.Where(x => x.ProjectId == CurrUser.LoginProjectId).OrderByDescending(x => x.SN).FirstOrDefault(); + if (snModel == null && Sn == 0) + { + Sn = 1000; + } + else { + Sn = snModel.SN; + } for (int i = 1; i < ir; i++) { if (!string.IsNullOrEmpty(pds.Rows[i][0].ToString().Trim())) @@ -322,6 +332,10 @@ namespace FineUIPro.Web.Transfer model.Descriptions= pds.Rows[i][1].ToString().Trim(); model.Id = Guid.NewGuid().ToString(); model.ProjectId = CurrUser.LoginProjectId; + + Sn += 1; + model.SN = Sn; + model.INSTRUMENTATION = pds.Rows[i][0].ToString().Trim(); model.SystemName = pds.Rows[i][1+1].ToString().Trim(); model.Subsystem = pds.Rows[i][2 + 1].ToString().Trim(); diff --git a/SGGL/FineUIPro.Web/Transfer/InstrumentationEdit.aspx b/SGGL/FineUIPro.Web/Transfer/InstrumentationEdit.aspx index ad09ff88..a7265c32 100644 --- a/SGGL/FineUIPro.Web/Transfer/InstrumentationEdit.aspx +++ b/SGGL/FineUIPro.Web/Transfer/InstrumentationEdit.aspx @@ -19,6 +19,8 @@ + + diff --git a/SGGL/FineUIPro.Web/Transfer/InstrumentationEdit.aspx.cs b/SGGL/FineUIPro.Web/Transfer/InstrumentationEdit.aspx.cs index 3be30efb..9e1eb6ea 100644 --- a/SGGL/FineUIPro.Web/Transfer/InstrumentationEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/Transfer/InstrumentationEdit.aspx.cs @@ -51,6 +51,7 @@ namespace FineUIPro.Web.Transfer var model = Funs.DB.Transfer_Instrumentation.FirstOrDefault(x => x.Id == Id); if (model != null) { + txtSN.Text = model.SN.ToString(); txtINSTRUMENTATION.Text = model.INSTRUMENTATION; txtSystemName.Text = model.SystemName; txtSubsystem.Text = model.Subsystem; @@ -64,6 +65,14 @@ namespace FineUIPro.Web.Transfer txtDescriptions.Text = model.Descriptions; } } + else + { + var model = Funs.DB.Transfer_Instrumentation.OrderByDescending(x => x.SN).FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId); + if (model == null) + txtSN.Text = "1001"; + else + txtSN.Text = (model.SN + 1).ToString(); + } } } @@ -71,6 +80,7 @@ namespace FineUIPro.Web.Transfer { var model = new Model.Transfer_Instrumentation { + SN = Convert.ToInt32(txtSN.Text), ProjectId = ProjectId, INSTRUMENTATION = txtINSTRUMENTATION.Text, SystemName = txtSystemName.Text, @@ -118,6 +128,7 @@ namespace FineUIPro.Web.Transfer var newModel = Funs.DB.Transfer_Instrumentation.FirstOrDefault(x => x.Id == Id); if (newModel != null) { + newModel.SN = model.SN; newModel.INSTRUMENTATION = txtINSTRUMENTATION.Text; newModel.SystemName = txtSystemName.Text; newModel.Subsystem = txtSubsystem.Text; diff --git a/SGGL/FineUIPro.Web/Transfer/InstrumentationEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/Transfer/InstrumentationEdit.aspx.designer.cs index 010b72ff..d424b9b7 100644 --- a/SGGL/FineUIPro.Web/Transfer/InstrumentationEdit.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/Transfer/InstrumentationEdit.aspx.designer.cs @@ -50,6 +50,15 @@ namespace FineUIPro.Web.Transfer /// protected global::FineUIPro.TextBox txtINSTRUMENTATION; + /// + /// txtSN 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtSN; + /// /// txtSystemName 控件。 /// diff --git a/SGGL/FineUIPro.Web/Transfer/Piping.aspx b/SGGL/FineUIPro.Web/Transfer/Piping.aspx index 0bcbfefc..a2f952fa 100644 --- a/SGGL/FineUIPro.Web/Transfer/Piping.aspx +++ b/SGGL/FineUIPro.Web/Transfer/Piping.aspx @@ -15,7 +15,7 @@ @@ -50,6 +50,9 @@ + <%-- + --%> x.ProjectId == CurrUser.LoginProjectId).OrderByDescending(x => x.SN).FirstOrDefault(); + if (snModel == null && Sn == 0) + { + Sn = 1000; + } + else + { + Sn = snModel.SN; + } if (pds != null && ir > 0) { List list = new List(); @@ -315,6 +326,10 @@ namespace FineUIPro.Web.Transfer Model.Transfer_Piping model = new Model.Transfer_Piping(); model.Id = Guid.NewGuid().ToString(); model.ProjectId = CurrUser.LoginProjectId; + + Sn += 1; + model.SN = Sn; + model.PIPINGLINENUMBER = pds.Rows[i][0].ToString().Trim(); model.Descriptions = pds.Rows[i][1].ToString().Trim(); model.SYSTEM = pds.Rows[i][1 + 1].ToString().Trim(); diff --git a/SGGL/FineUIPro.Web/Transfer/PipingEdit.aspx b/SGGL/FineUIPro.Web/Transfer/PipingEdit.aspx index d273ab05..c36c27d2 100644 --- a/SGGL/FineUIPro.Web/Transfer/PipingEdit.aspx +++ b/SGGL/FineUIPro.Web/Transfer/PipingEdit.aspx @@ -19,6 +19,8 @@ + + diff --git a/SGGL/FineUIPro.Web/Transfer/PipingEdit.aspx.cs b/SGGL/FineUIPro.Web/Transfer/PipingEdit.aspx.cs index 213e5fc9..f1e9f3ad 100644 --- a/SGGL/FineUIPro.Web/Transfer/PipingEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/Transfer/PipingEdit.aspx.cs @@ -50,6 +50,7 @@ namespace FineUIPro.Web.Transfer var model = Funs.DB.Transfer_Piping.FirstOrDefault(x => x.Id == Id); if (model != null) { + txtSN.Text = model.SN.ToString(); txtPIPINGLINENUMBER.Text = model.PIPINGLINENUMBER; txtSYSTEM.Text = model.SYSTEM; txtSubsystem.Text = model.Subsystem; @@ -76,6 +77,14 @@ namespace FineUIPro.Web.Transfer ddlInsulation.SelectedValue = model.Insulation; } } + else + { + var model = Funs.DB.Transfer_Piping.OrderByDescending(x => x.SN).FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId); + if (model == null) + txtSN.Text = "1001"; + else + txtSN.Text = (model.SN + 1).ToString(); + } } } @@ -83,6 +92,7 @@ namespace FineUIPro.Web.Transfer { var model = new Model.Transfer_Piping() { + SN = Convert.ToInt32(txtSN.Text), ProjectId = ProjectId, PIPINGLINENUMBER = txtPIPINGLINENUMBER.Text, SYSTEM = txtSYSTEM.Text, @@ -154,6 +164,7 @@ namespace FineUIPro.Web.Transfer if (!string.IsNullOrEmpty(Id)) { var newModel = Funs.DB.Transfer_Piping.FirstOrDefault(x => x.Id == Id); + newModel.SN = model.SN; newModel.PIPINGLINENUMBER = model.PIPINGLINENUMBER; newModel.SYSTEM = model.SYSTEM; newModel.Subsystem = newModel.Subsystem; diff --git a/SGGL/FineUIPro.Web/Transfer/PipingEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/Transfer/PipingEdit.aspx.designer.cs index 8d516c3e..28e9d97f 100644 --- a/SGGL/FineUIPro.Web/Transfer/PipingEdit.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/Transfer/PipingEdit.aspx.designer.cs @@ -50,6 +50,15 @@ namespace FineUIPro.Web.Transfer /// protected global::FineUIPro.TextBox txtPIPINGLINENUMBER; + /// + /// txtSN 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtSN; + /// /// txtSYSTEM 控件。 /// diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index e6c70b15..4e98c021 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -396054,6 +396054,8 @@ namespace Model private string _Calibration; + private int _SN; + #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -396092,6 +396094,8 @@ namespace Model partial void OnDescriptionsChanged(); partial void OnCalibrationChanging(string value); partial void OnCalibrationChanged(); + partial void OnSNChanging(int value); + partial void OnSNChanged(); #endregion public Transfer_Instrumentation() @@ -396439,6 +396443,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SN", DbType="Int NOT NULL")] + public int SN + { + get + { + return this._SN; + } + set + { + if ((this._SN != value)) + { + this.OnSNChanging(value); + this.SendPropertyChanging(); + this._SN = value; + this.SendPropertyChanged("SN"); + this.OnSNChanged(); + } + } + } + public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; @@ -396926,6 +396950,8 @@ namespace Model private string _Insulation; + private int _SN; + #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -396992,6 +397018,8 @@ namespace Model partial void OnElectricHeatTracingChanged(); partial void OnInsulationChanging(string value); partial void OnInsulationChanged(); + partial void OnSNChanging(int value); + partial void OnSNChanged(); #endregion public Transfer_Piping() @@ -397619,6 +397647,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SN", DbType="Int NOT NULL")] + public int SN + { + get + { + return this._SN; + } + set + { + if ((this._SN != value)) + { + this.OnSNChanging(value); + this.SendPropertyChanging(); + this._SN = value; + this.SendPropertyChanged("SN"); + this.OnSNChanged(); + } + } + } + public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged;