移交优化

This commit is contained in:
夏菊 2024-12-05 18:48:45 +08:00
parent 3984e18e6c
commit 20363206d7
3 changed files with 39 additions and 31 deletions

View File

@ -86,7 +86,7 @@ else CONVERT(DECIMAL(10,2),100*(ISNULL(TtScount,0)*1.0/ISNULL(TtCount,0))) end
ts.PlanPWD,PlanJWD,McPlan,SubmitPackage,ActualPWD,ActualJWD,ActualMC,Commissioning,IaQian,TcccQ,SystemStatus,TurnoverDescription,ts.Remark ts.PlanPWD,PlanJWD,McPlan,SubmitPackage,ActualPWD,ActualJWD,ActualMC,Commissioning,IaQian,TcccQ,SystemStatus,TurnoverDescription,ts.Remark
from( from(
SELECT SubCommissioningsystem as SubSysNo,Type,ProjectId FROM Transfer_LHCSystemList where ProjectId = @ProjectId group by SubCommissioningsystem,Type,ProjectId SELECT SubCommissioningsystem as SubSysNo,SN,Type,ProjectId FROM Transfer_LHCSystemList where ProjectId = @ProjectId group by SubCommissioningsystem,SN,Type,ProjectId
) f ) f
left join Transfer_SystemControl ts on f.ProjectId=ts.ProjectId and f.SubSysNo=ts.SystemNo left join Transfer_SystemControl ts on f.ProjectId=ts.ProjectId and f.SubSysNo=ts.SystemNo
--piping --piping
@ -176,7 +176,7 @@ where f.ProjectId = @ProjectId ";
//strSql += " order by f.Type "; //strSql += " order by f.Type ";
//strSql += " order by f.SubSysNo "; //strSql += " order by f.SubSysNo ";
strSql += " order by f.Type,f.SubSysNo "; strSql += " order by f.Type,f.SN ";
SqlParameter[] parameter = listStr.ToArray(); SqlParameter[] parameter = listStr.ToArray();
return SQLHelper.GetDataTableRunText(strSql, parameter); return SQLHelper.GetDataTableRunText(strSql, parameter);
} }

View File

@ -226,7 +226,8 @@ namespace FineUIPro.Web.Transfer
} }
} }
} }
else { else
{
string row4 = pds.Rows[i][5].ToString(); string row4 = pds.Rows[i][5].ToString();
if (!string.IsNullOrEmpty(row4)) if (!string.IsNullOrEmpty(row4))
{ {
@ -472,9 +473,9 @@ namespace FineUIPro.Web.Transfer
//根据项目id查询sn //根据项目id查询sn
var snModel = Funs.DB.Transfer_LHCSystemList.Where(x => x.ProjectId == CurrUser.LoginProjectId var snModel = Funs.DB.Transfer_LHCSystemList.Where(x => x.ProjectId == CurrUser.LoginProjectId
&& x.Type == Type).OrderByDescending(x => x.SN).FirstOrDefault(); && x.Type == Type).OrderByDescending(x => x.SN).FirstOrDefault();
if (snModel == null && Sn==0) if (snModel == null && Sn == 0)
{ {
Sn = 1001; Sn = Type == "0" ? 1001 : 2001;
model.SN = Sn; model.SN = Sn;
} }
else else
@ -484,7 +485,8 @@ namespace FineUIPro.Web.Transfer
Sn = Convert.ToInt32(snModel.SN + 1); Sn = Convert.ToInt32(snModel.SN + 1);
model.SN = Sn; model.SN = Sn;
} }
else { else
{
Sn += 1; Sn += 1;
model.SN = Sn; model.SN = Sn;
} }
@ -492,24 +494,25 @@ namespace FineUIPro.Web.Transfer
} }
model.SystemNo = pds.Rows[i][0].ToString().Trim(); model.SystemNo = pds.Rows[i][0].ToString().Trim();
model.Commissioningsystemcode= pds.Rows[i][1].ToString().Trim(); model.Commissioningsystemcode = pds.Rows[i][1].ToString().Trim();
model.CommissioningCodeDescription = pds.Rows[i][2].ToString().Trim(); model.CommissioningCodeDescription = pds.Rows[i][2].ToString().Trim();
if (Type == "0") if (Type == "0")
{ {
model.SubCommissioningsystem = pds.Rows[i][3].ToString().Trim(); model.SubCommissioningsystem = pds.Rows[i][3].ToString().Trim();
//model.Turnover_Code= pds.Rows[i][4].ToString().Trim(); //model.Turnover_Code= pds.Rows[i][4].ToString().Trim();
DateTime t1, t2,t3; DateTime t1, t2, t3;
if (DateTime.TryParse(pds.Rows[i][4].ToString(), out t1) && !string.IsNullOrEmpty(pds.Rows[i][4].ToString())) if (DateTime.TryParse(pds.Rows[i][4].ToString(), out t1) && !string.IsNullOrEmpty(pds.Rows[i][4].ToString()))
model.PlanStartofTestingDate = t1; model.PlanStartofTestingDate = t1;
if (DateTime.TryParse(pds.Rows[i][5].ToString(), out t2) && !string.IsNullOrEmpty(pds.Rows[i][5].ToString())) if (DateTime.TryParse(pds.Rows[i][5].ToString(), out t2) && !string.IsNullOrEmpty(pds.Rows[i][5].ToString()))
model.PlanFinishofTestingDate = t2; model.PlanFinishofTestingDate = t2;
model.Status= pds.Rows[i][6].ToString().Trim(); model.Status = pds.Rows[i][6].ToString().Trim();
if (DateTime.TryParse(pds.Rows[i][7].ToString(), out t3) && !string.IsNullOrEmpty(pds.Rows[i][7].ToString())) if (DateTime.TryParse(pds.Rows[i][7].ToString(), out t3) && !string.IsNullOrEmpty(pds.Rows[i][7].ToString()))
model.ActualFinishedDate = t3; model.ActualFinishedDate = t3;
} }
else { else
{
model.Describe = pds.Rows[i][3].ToString().Trim(); model.Describe = pds.Rows[i][3].ToString().Trim();
model.SubCommissioningsystem = pds.Rows[i][4].ToString().Trim(); model.SubCommissioningsystem = pds.Rows[i][4].ToString().Trim();
//model.Turnover_Code = pds.Rows[i][5].ToString().Trim(); //model.Turnover_Code = pds.Rows[i][5].ToString().Trim();

View File

@ -54,10 +54,11 @@ namespace FineUIPro.Web.Transfer
#endregion #endregion
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
if (!IsPostBack) { if (!IsPostBack)
{
Id = Request.Params["Id"]; Id = Request.Params["Id"];
ProjectId = this.CurrUser.LoginProjectId; ProjectId = this.CurrUser.LoginProjectId;
Type= Request.Params["Type"]; Type = Request.Params["Type"];
if (Type == "1") if (Type == "1")
Type1.Hidden = false; Type1.Hidden = false;
else else
@ -91,11 +92,12 @@ namespace FineUIPro.Web.Transfer
ddlSStatus.SelectedValue = model.Status; ddlSStatus.SelectedValue = model.Status;
} }
} }
else { else
{
var model = Funs.DB.Transfer_LHCSystemList.OrderByDescending(x => x.SN).FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId var model = Funs.DB.Transfer_LHCSystemList.OrderByDescending(x => x.SN).FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId
&& x.Type==Type); && x.Type == Type);
if (model == null) if (model == null)
txtSN.Text = "1001"; txtSN.Text = Type == "0" ? "1001" : "2001";
else else
txtSN.Text = (Convert.ToInt32(model.SN) + 1).ToString(); txtSN.Text = (Convert.ToInt32(model.SN) + 1).ToString();
} }
@ -104,25 +106,27 @@ namespace FineUIPro.Web.Transfer
} }
} }
protected void btnSave_Click(object sender, EventArgs e) { protected void btnSave_Click(object sender, EventArgs e)
var model = new Model.Transfer_LHCSystemList() { {
ProjectId=ProjectId, var model = new Model.Transfer_LHCSystemList()
Type=Type, {
SN=Convert.ToInt32(txtSN.Text), ProjectId = ProjectId,
SystemNo= txtSystem_No.Text, Type = Type,
Commissioningsystemcode= txtCommissioningsystemcode.Text, SN = Convert.ToInt32(txtSN.Text),
CommissioningCodeDescription= txtCommissioningCodeDescription.Text, SystemNo = txtSystem_No.Text,
SubCommissioningsystem= txtSubCommissioningsystem.Text, Commissioningsystemcode = txtCommissioningsystemcode.Text,
CommissioningCodeDescription = txtCommissioningCodeDescription.Text,
SubCommissioningsystem = txtSubCommissioningsystem.Text,
PlanStartofTestingDate = Funs.GetNewDateTime(this.txtPlanStartofTestingDate.Text), PlanStartofTestingDate = Funs.GetNewDateTime(this.txtPlanStartofTestingDate.Text),
Describe=txtDescribe.Text, Describe = txtDescribe.Text,
PlanFinishofTestingDate = Funs.GetNewDateTime(this.txtPlanFinishofTestingDate.Text), PlanFinishofTestingDate = Funs.GetNewDateTime(this.txtPlanFinishofTestingDate.Text),
ActualFinishedDate = Funs.GetNewDateTime(this.txtActualFinishedDate.Text), ActualFinishedDate = Funs.GetNewDateTime(this.txtActualFinishedDate.Text),
Status=ddlSStatus.SelectedValue Status = ddlSStatus.SelectedValue
}; };
if (!string.IsNullOrEmpty(Id)) if (!string.IsNullOrEmpty(Id))
{ {
var newModel = Funs.DB.Transfer_LHCSystemList.FirstOrDefault(x => x.Id == Id); var newModel = Funs.DB.Transfer_LHCSystemList.FirstOrDefault(x => x.Id == Id);
if (newModel!=null) if (newModel != null)
{ {
newModel.SN = model.SN; newModel.SN = model.SN;
newModel.SystemNo = model.SystemNo; newModel.SystemNo = model.SystemNo;
@ -137,7 +141,8 @@ namespace FineUIPro.Web.Transfer
newModel.UpdateTime = DateTime.Now; newModel.UpdateTime = DateTime.Now;
} }
} }
else { else
{
model.Id = Guid.NewGuid().ToString(); model.Id = Guid.NewGuid().ToString();
Funs.DB.Transfer_LHCSystemList.InsertOnSubmit(model); Funs.DB.Transfer_LHCSystemList.InsertOnSubmit(model);
} }