1
This commit is contained in:
@@ -38,6 +38,104 @@ namespace FineUIPro.Web.HJGL.HotProessManage
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
#region 自动生成热处理委托信息,按管线号生成
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var allJoints = from x in db.HJGL_PW_JointInfo
|
||||
where (from y in db.HJGL_CH_HotProessTrustItem where y.JOT_ID == x.JOT_ID select y).Count() == 0 && x.IS_Proess == "1"
|
||||
select x;
|
||||
var allIsoIds = allJoints.Select(x => x.ISO_ID).Distinct();
|
||||
var allIsos = from x in db.HJGL_PW_IsoInfo
|
||||
join y in db.Base_Project on x.ProjectId equals y.ProjectId
|
||||
where allIsoIds.Contains(x.ISO_ID)
|
||||
select new { x.ISO_ID, x.ProjectId, x.ISO_IsoNo, x.BSU_ID, y.ProjectName, y.ProjectCode };
|
||||
var allProjectUser = from x in db.Project_User
|
||||
join y in db.Sys_User on x.UserId equals y.UserId
|
||||
select new { x.UserId, x.ProjectId, y.UnitId };
|
||||
string HotProessTrustId = string.Empty;
|
||||
List<Model.HJGL_CH_HotProessTrust> trusts = new List<Model.HJGL_CH_HotProessTrust>();
|
||||
List<Model.HJGL_CH_HotProessTrustItem> trustItems = new List<Model.HJGL_CH_HotProessTrustItem>();
|
||||
List<Model.HJGL_CH_HotProessResult> hotProessResults = new List<Model.HJGL_CH_HotProessResult>();
|
||||
foreach (var item in allIsos)
|
||||
{
|
||||
Model.HJGL_CH_HotProessTrust newHotProessTrust = new Model.HJGL_CH_HotProessTrust();
|
||||
newHotProessTrust.ProjectId = item.ProjectId;
|
||||
newHotProessTrust.HotProessTrustCode = BLL.SQLHelper.RunProcNewIdByProjectId("SpGetNewCode2ByProjectIdNoR", "dbo.HJGL_CH_HotProessTrust", "HotProessTrustCode", item.ProjectId, item.ProjectCode + "-" + string.Format("{0:MMdd}", DateTime.Now) + "-");
|
||||
newHotProessTrust.TrustUnitId = item.BSU_ID;
|
||||
newHotProessTrust.ProjectName = item.ProjectName;
|
||||
newHotProessTrust.ConstructionNo = item.ProjectCode;
|
||||
var projectUser = allProjectUser.FirstOrDefault(x => x.ProjectId == item.ProjectId && x.UnitId == item.BSU_ID);
|
||||
if (projectUser != null)
|
||||
{
|
||||
newHotProessTrust.TrstManId = projectUser.UserId;
|
||||
}
|
||||
HotProessTrustId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HotProessTrust));
|
||||
newHotProessTrust.HotProessTrustId = HotProessTrustId;
|
||||
newHotProessTrust.TrustType = "1"; //正常口
|
||||
db.HJGL_CH_HotProessTrust.InsertOnSubmit(newHotProessTrust);
|
||||
db.SubmitChanges();
|
||||
//trusts.Add(newHotProessTrust);
|
||||
var joints = allJoints.Where(x => x.ISO_ID == item.ISO_ID);
|
||||
foreach (var joint in joints)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(joint.ProessTypes))
|
||||
{
|
||||
string[] proessTypes = joint.ProessTypes.Split('|');
|
||||
for (int i = 0; i < proessTypes.Length; i++)
|
||||
{
|
||||
|
||||
Model.HJGL_CH_HotProessTrustItem newItem = new Model.HJGL_CH_HotProessTrustItem();
|
||||
newItem.HotProessTrustId = HotProessTrustId;
|
||||
newItem.JOT_ID = joint.JOT_ID;
|
||||
newItem.ProessTypes = proessTypes[i];
|
||||
//item.TrustDate = Funs.GetNewDateTime(values.Value<string>("TrustDate").ToString());
|
||||
newItem.TrustDate = DateTime.Now;
|
||||
newItem.Remark = string.Empty;
|
||||
newItem.HotProessTrustItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HotProessTrustItem));
|
||||
trustItems.Add(newItem);
|
||||
//if (newItem.ProessTypes.Contains("4") || newItem.ProessTypes.Contains("5")) //需要进入热处理报告的记录
|
||||
//{
|
||||
// Model.HJGL_HotProessItem hotProessItem = new Model.HJGL_HotProessItem();
|
||||
// hotProessItem.HotProessItemId = SQLHelper.GetNewID(typeof(Model.HJGL_HotProessItem));
|
||||
// hotProessItem.JOT_ID = newItem.JOT_ID;
|
||||
// hotProessItem.HotProessTrustId = HotProessTrustId;
|
||||
// hotProessItem.ProessTypes = newItem.ProessTypes;
|
||||
// hotProessItem.SortIndex = BLL.HJGL_HotProessManageEditService.GetSortIndex(HotProessTrustId, newItem.JOT_ID, newItem.ProessTypes);
|
||||
// Model.HJGL_CH_HotProessTrustItem hotProessTrustItem = BLL.HJGL_CH_HotProessTrustService.GetCH_HotProessTrustItemByHotProessTrustIdAndJotId(HotProessTrustId, newItem.JOT_ID);
|
||||
// if (hotProessTrustItem != null)
|
||||
// {
|
||||
// BLL.HJGL_HotProessManageEditService.AddHotProessItem(hotProessItem, "", null);
|
||||
// }
|
||||
// //回写焊口热处理委托时间
|
||||
// BLL.HJGL_PW_JointInfoService.WriteBackHotProessTrustDate(newItem.JOT_ID, newItem.TrustDate);
|
||||
//}
|
||||
//进入热处理结果反馈
|
||||
Model.HJGL_CH_HotProessResult hotProessResult = new Model.HJGL_CH_HotProessResult();
|
||||
hotProessResult.JOT_ID = newItem.JOT_ID;
|
||||
hotProessResult.HotProessTrustId = HotProessTrustId;
|
||||
hotProessResult.ProessTypes = newItem.ProessTypes;
|
||||
hotProessResult.HotProessResultId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HotProessResult));
|
||||
hotProessResults.Add(hotProessResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
db.HJGL_CH_HotProessTrust.InsertAllOnSubmit(trusts);
|
||||
db.SubmitChanges();
|
||||
db.HJGL_CH_HotProessTrustItem.InsertAllOnSubmit(trustItems);
|
||||
db.SubmitChanges();
|
||||
db.HJGL_CH_HotProessResult.InsertAllOnSubmit(hotProessResults);
|
||||
db.SubmitChanges();
|
||||
//已焊接口
|
||||
var allWeldJoints = from x in db.HJGL_PW_JointInfo
|
||||
where x.DReportID != null && x.IS_Proess == "1" && (x.ProessTypes.Contains("4") || x.ProessTypes.Contains("5"))
|
||||
&& (from y in db.HJGL_HotProessItem where y.JOT_ID == x.JOT_ID select y).Count() == 0
|
||||
select x;
|
||||
foreach (var item in allWeldJoints)
|
||||
{
|
||||
BLL.HJGL_HotProessManageEditService.AddHotProessItemByJoint(item);
|
||||
}
|
||||
#endregion
|
||||
|
||||
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
||||
List<Model.HandleStep> myList = new List<Model.HandleStep>();
|
||||
myList = BLL.HJGL_PW_JointInfoService.GetProessTypes();
|
||||
|
||||
Reference in New Issue
Block a user