2023-02-20 001 焊接修改
This commit is contained in:
@@ -0,0 +1,193 @@
|
||||
using FineUIPro;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
|
||||
public static class HJGL_PipelineComponentjointService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
|
||||
#region 获取列表
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
/// </summary>
|
||||
public static int count
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public static List<Model.HJGL_Pipeline_ComponentJoint> GetHJGL_Pipeline_ComponentJointByModle(Model.HJGL_Pipeline_ComponentJoint table)
|
||||
{
|
||||
var q = from x in db.HJGL_Pipeline_ComponentJoint
|
||||
where
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
(string.IsNullOrEmpty(table.PipelineComponentId) || x.PipelineComponentId.Contains(table.PipelineComponentId)) &&
|
||||
(string.IsNullOrEmpty(table.PipelineComponentCode) || x.PipelineComponentCode.Contains(table.PipelineComponentCode)) &&
|
||||
(string.IsNullOrEmpty(table.WeldJointId) || x.WeldJointId.Contains(table.WeldJointId)) &&
|
||||
(string.IsNullOrEmpty(table.WeldJointCode) || x.WeldJointCode.Contains(table.WeldJointCode))
|
||||
select x
|
||||
;
|
||||
|
||||
return q.ToList();
|
||||
}
|
||||
|
||||
/// 获取分页列表
|
||||
/// </summary>
|
||||
/// <param name="PageIndex">页码</param>
|
||||
/// <param name="PageSize">每页数量</param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable getListData(Model.HJGL_Pipeline_ComponentJoint table, Grid Grid1)
|
||||
{
|
||||
var q = GetHJGL_Pipeline_ComponentJointByModle(table);
|
||||
count = q.Count();
|
||||
if (count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
// q= q.Take(Grid1.PageSize * Grid1.PageIndex).Skip(Grid1.PageSize * (Grid1.PageIndex)).ToList();
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return from x in q
|
||||
select new
|
||||
{
|
||||
x.Id,
|
||||
x.PipelineComponentId,
|
||||
x.PipelineComponentCode,
|
||||
x.WeldJointId,
|
||||
x.WeldJointCode,
|
||||
x.State,
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static Model.HJGL_Pipeline_ComponentJoint GetHJGL_Pipeline_ComponentJointById(string Id)
|
||||
{
|
||||
return db.HJGL_Pipeline_ComponentJoint.FirstOrDefault(x => x.Id == Id);
|
||||
}
|
||||
public static Model.HJGL_Pipeline_ComponentJoint GetHJGL_Pipeline_ComponentJointByWeldJointId(string WeldJointId)
|
||||
{
|
||||
return db.HJGL_Pipeline_ComponentJoint.FirstOrDefault(x => x.WeldJointId == WeldJointId);
|
||||
}
|
||||
|
||||
public static void AddHJGL_Pipeline_ComponentJoint(Model.HJGL_Pipeline_ComponentJoint newtable)
|
||||
{
|
||||
|
||||
Model.HJGL_Pipeline_ComponentJoint table = new Model.HJGL_Pipeline_ComponentJoint
|
||||
{
|
||||
Id = newtable.Id,
|
||||
PipelineComponentId = newtable.PipelineComponentId,
|
||||
PipelineComponentCode = newtable.PipelineComponentCode,
|
||||
WeldJointId = newtable.WeldJointId,
|
||||
WeldJointCode = newtable.WeldJointCode,
|
||||
State = newtable.State,
|
||||
};
|
||||
db.HJGL_Pipeline_ComponentJoint.InsertOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
public static void AddBulkHJGL_Pipeline_ComponentJoint(List<Model.HJGL_Pipeline_ComponentJoint> newtables)
|
||||
{
|
||||
|
||||
db.HJGL_Pipeline_ComponentJoint.InsertAllOnSubmit(newtables);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
|
||||
public static void UpdateHJGL_Pipeline_ComponentJoint(Model.HJGL_Pipeline_ComponentJoint newtable)
|
||||
{
|
||||
|
||||
Model.HJGL_Pipeline_ComponentJoint table = db.HJGL_Pipeline_ComponentJoint.FirstOrDefault(x => x.Id == newtable.Id);
|
||||
if (table != null)
|
||||
{
|
||||
table.Id = newtable.Id;
|
||||
table.PipelineComponentId = newtable.PipelineComponentId;
|
||||
table.PipelineComponentCode = newtable.PipelineComponentCode;
|
||||
table.WeldJointId = newtable.WeldJointId;
|
||||
table.WeldJointCode = newtable.WeldJointCode;
|
||||
table.State = newtable.State;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据焊口号更改状态
|
||||
/// </summary>
|
||||
/// <param name="WeldJointId"></param>
|
||||
public static void UpdateStateByWeldJointId(string WeldJointId,DateTime TaskDate)
|
||||
{
|
||||
|
||||
Model.HJGL_Pipeline_ComponentJoint table = db.HJGL_Pipeline_ComponentJoint.FirstOrDefault(x => x.WeldJointId == WeldJointId);
|
||||
if (table != null)
|
||||
{
|
||||
table.State =1;
|
||||
db.SubmitChanges();
|
||||
GetProductionByPipelineComponentId(table.PipelineComponentId, TaskDate);
|
||||
}
|
||||
|
||||
}
|
||||
public static void GetProductionByPipelineComponentId(string PipelineComponentId, DateTime TaskDate)
|
||||
{
|
||||
var q = db.HJGL_Pipeline_ComponentJoint.Where(x => x.PipelineComponentId == PipelineComponentId).ToList();
|
||||
if (q.Count!=0)
|
||||
{
|
||||
var NotProductionNum = (from x in q where x.State == 0 select x).Count(); //未生产数量
|
||||
var ProductionNum = (from x in q where x.State == 1 select x).Count(); //已生产数量
|
||||
if (NotProductionNum == 0) //全部完成
|
||||
{
|
||||
HJGL_PipelineComponentService.UpdateProductionState(PipelineComponentId, 2, TaskDate);
|
||||
|
||||
}
|
||||
else if (ProductionNum == 0)//未动工
|
||||
{
|
||||
HJGL_PipelineComponentService.UpdateProductionState(PipelineComponentId, 0, TaskDate);
|
||||
|
||||
}
|
||||
else //已生产
|
||||
{
|
||||
HJGL_PipelineComponentService.UpdateProductionState(PipelineComponentId, 1, TaskDate);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void DeleteHJGL_Pipeline_ComponentJointById(string Id)
|
||||
{
|
||||
|
||||
Model.HJGL_Pipeline_ComponentJoint table = db.HJGL_Pipeline_ComponentJoint.FirstOrDefault(x => x.Id == Id);
|
||||
if (table != null)
|
||||
{
|
||||
db.HJGL_Pipeline_ComponentJoint.DeleteOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
public static void DeleteHJGL_Pipeline_ComponentJointByPipelineComponentId(string PipelineComponentId)
|
||||
{
|
||||
|
||||
var table = db.HJGL_Pipeline_ComponentJoint.Where(x => x.PipelineComponentId == PipelineComponentId);
|
||||
if (table != null)
|
||||
{
|
||||
db.HJGL_Pipeline_ComponentJoint.DeleteAllOnSubmit(table);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
public static void DeleteALLHJGL_Pipeline_ComponentJoint()
|
||||
{
|
||||
if (db.HJGL_Pipeline_ComponentJoint != null)
|
||||
{
|
||||
db.HJGL_Pipeline_ComponentJoint.DeleteAllOnSubmit(db.HJGL_Pipeline_ComponentJoint);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user