焊接修改
This commit is contained in:
@@ -43,24 +43,48 @@ namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
string WeldingLocationId = Request.Params["WeldingLocationId"];
|
||||
var q = Funs.DB.Base_WeldingLocation.FirstOrDefault(x => x.WeldingLocationCode == this.txtWeldingLocationCode.Text.Trim() && (x.WeldingLocationId != WeldingLocationId || (WeldingLocationId == null && x.WeldingLocationId != null)));
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("此位置代号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string code = this.txtWeldingLocationCode.Text.Trim();
|
||||
string name = this.txtWeldingLocationName.Text.Trim();
|
||||
|
||||
var q2 = Funs.DB.Base_WeldingLocation.FirstOrDefault(x => x.WeldingLocationName == this.txtWeldingLocationName.Text.Trim() && (x.WeldingLocationId != WeldingLocationId || (WeldingLocationId == null && x.WeldingLocationId != null)));
|
||||
if (q2 != null)
|
||||
// 判断是否为编辑场景(id 不为空)
|
||||
if (!string.IsNullOrEmpty(WeldingLocationId))
|
||||
{
|
||||
Alert.ShowInTop("此位置名称已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
var q = Funs.DB.Base_WeldingLocation.FirstOrDefault(x => x.WeldingLocationCode == code && x.WeldingLocationId != WeldingLocationId);
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("此位置代号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
var q2 = Funs.DB.Base_WeldingLocation.FirstOrDefault(x => x.WeldingLocationName == name && x.WeldingLocationId != WeldingLocationId);
|
||||
if (q2 != null)
|
||||
{
|
||||
Alert.ShowInTop("此位置名称已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 新增场景:只需判断是否存在相同的 code 或 name
|
||||
var q = Funs.DB.Base_WeldingLocation.FirstOrDefault(x => x.WeldingLocationCode == code);
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("此位置代号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
var q2 = Funs.DB.Base_WeldingLocation.FirstOrDefault(x => x.WeldingLocationName == name);
|
||||
if (q2 != null)
|
||||
{
|
||||
Alert.ShowInTop("此位置名称已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Model.Base_WeldingLocation newWeldingLocation = new Model.Base_WeldingLocation
|
||||
{
|
||||
WeldingLocationCode = this.txtWeldingLocationCode.Text.Trim(),
|
||||
WeldingLocationName = this.txtWeldingLocationName.Text.Trim(),
|
||||
WeldingLocationCode = code,
|
||||
WeldingLocationName = name,
|
||||
Remark = this.txtRemark.Text.Trim()
|
||||
};
|
||||
|
||||
@@ -68,13 +92,11 @@ namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
{
|
||||
newWeldingLocation.WeldingLocationId = WeldingLocationId;
|
||||
BLL.Base_WeldingLocationServie.UpdateWeldingLocation(newWeldingLocation);
|
||||
//BLL.Sys_LogService.AddLog(Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_PipingClassMenuId, Const.BtnModify, newPipingClass.PipingClassId);
|
||||
}
|
||||
else
|
||||
{
|
||||
newWeldingLocation.WeldingLocationId = SQLHelper.GetNewID(typeof(Model.Base_WeldingLocation));
|
||||
BLL.Base_WeldingLocationServie.AddWeldingLocation(newWeldingLocation);
|
||||
//BLL.Sys_LogService.AddLog(Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.PersonId, Const.HJGL_PipingClassMenuId, Const.BtnAdd, newPipingClass.PipingClassId);
|
||||
}
|
||||
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
|
||||
Reference in New Issue
Block a user