焊接修改
This commit is contained in:
@@ -13,32 +13,9 @@ namespace BLL
|
||||
/// <summary>
|
||||
/// 包装管理服务类
|
||||
/// </summary>
|
||||
public static class HJGL_PackagingmanageService
|
||||
public static class HJGLPackagingmanageService
|
||||
{
|
||||
public class PackagingManageItem
|
||||
{
|
||||
public string PackagingManageId { get; set; }
|
||||
public string PackagingCode { get; set; }
|
||||
public string ProjectId { get; set; }
|
||||
public string ProjectName { get; set; }
|
||||
public string DriverName { get; set; }
|
||||
public string DriverPhone { get; set; }
|
||||
public string LicensePlateNumber { get; set; }
|
||||
public string ContactName { get; set; }
|
||||
public string ContactPhone { get; set; }
|
||||
public string StackingPosition { get; set; }
|
||||
public int? State { get; set; }
|
||||
public int? TypeInt { get; set; }
|
||||
public string TypeString { get; set; }
|
||||
|
||||
public string ReceiveMan { get; set; }
|
||||
public string ReceiveDate { get; set; }
|
||||
public string PlanStartDate { get; set; }
|
||||
|
||||
public string Code { get; set; }
|
||||
public string TrainNumber { get; set; }
|
||||
public string TrainNumberOld { get; set; }
|
||||
}
|
||||
#region Fields
|
||||
|
||||
/// <summary>
|
||||
/// 未到场
|
||||
@@ -55,14 +32,16 @@ namespace BLL
|
||||
/// </summary>
|
||||
public static int state_2 = 2;
|
||||
|
||||
public static ListItem[] GetState()
|
||||
public static Dictionary<string, int> TypeIntMap = new Dictionary<string, int>
|
||||
{
|
||||
ListItem[] list = new ListItem[3];
|
||||
list[0] = new ListItem("预出库", state_0.ToString());
|
||||
list[1] = new ListItem("已出库", state_1.ToString());
|
||||
list[2] = new ListItem("已到场", state_2.ToString());
|
||||
return list;
|
||||
}
|
||||
{ "预制组件" ,(int)TypeInt.预制组件},
|
||||
{ "预制散件" ,(int)TypeInt.预制散件},
|
||||
{ "其他材料" ,(int)TypeInt.其他材料},
|
||||
};
|
||||
|
||||
#endregion Fields
|
||||
|
||||
#region Enums
|
||||
|
||||
public enum TypeInt : int
|
||||
{
|
||||
@@ -71,16 +50,49 @@ namespace BLL
|
||||
其他材料 = 30,
|
||||
}
|
||||
|
||||
public static Dictionary<string, int> TypeIntMap = new Dictionary<string, int>
|
||||
{
|
||||
{ "预制组件" ,(int)TypeInt.预制组件},
|
||||
{ "预制散件" ,(int)TypeInt.预制散件},
|
||||
{ "其他材料" ,(int)TypeInt.其他材料},
|
||||
};
|
||||
#endregion Enums
|
||||
|
||||
public static string GetTypeString(int? TypeInt)
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// 新增实体
|
||||
/// </summary>
|
||||
/// <param name="newtable"></param>
|
||||
public static void AddHJGL_PackagingManage(Model.HJGL_PackagingManage newtable)
|
||||
{
|
||||
return TypeIntMap.FirstOrDefault(c => c.Value == TypeInt).Key;
|
||||
Model.HJGL_PackagingManage table = new Model.HJGL_PackagingManage
|
||||
{
|
||||
PackagingManageId = newtable.PackagingManageId,
|
||||
PackagingCode = newtable.PackagingCode,
|
||||
ProjectId = newtable.ProjectId,
|
||||
PipelineComponentId = newtable.PipelineComponentId,
|
||||
StackingPosition = newtable.StackingPosition,
|
||||
State = newtable.State,
|
||||
ContactName = newtable.ContactName,
|
||||
ContactPhone = newtable.ContactPhone,
|
||||
Remark = newtable.Remark,
|
||||
ReceiveDate = newtable.ReceiveDate,
|
||||
ReceiveMan = newtable.ReceiveMan,
|
||||
TrainNumber = newtable.TrainNumber,
|
||||
TrainNumberId = newtable.TrainNumberId,
|
||||
TypeInt = newtable.TypeInt,
|
||||
CompileMan = newtable.CompileMan,
|
||||
CompileDate = newtable.CompileDate
|
||||
};
|
||||
var db1 = Funs.DB;
|
||||
db1.HJGL_PackagingManage.InsertOnSubmit(table);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
|
||||
public static void DeleteHJGL_PackagingManageById(string PackagingManageId)
|
||||
{
|
||||
var db1 = Funs.DB;
|
||||
Model.HJGL_PackagingManage table = db1.HJGL_PackagingManage.FirstOrDefault(x => x.PackagingManageId == PackagingManageId);
|
||||
if (table != null)
|
||||
{
|
||||
db1.HJGL_PackagingManage.DeleteOnSubmit(table);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public static Model.HJGL_PackagingManage GetHJGL_PackagingManageById(string PackagingManageId)
|
||||
@@ -103,6 +115,96 @@ namespace BLL
|
||||
return PlanStartDate;
|
||||
}
|
||||
|
||||
public static string GetNewPackagingCode(string projectid)
|
||||
{
|
||||
string code = ProjectService.GetProjectCodeByProjectId(projectid) + "-" + string.Format("{0:yyyyMMdd}", DateTime.Now) + "-";
|
||||
|
||||
var q = GetPackagingManageList(projectid, code);
|
||||
if (q.Total > 0)
|
||||
{
|
||||
code = code + (q.Total + 1).ToString().PadLeft(3, '0');
|
||||
}
|
||||
else
|
||||
{
|
||||
code = code + "001";
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据项目号获取包装编号历史记录
|
||||
/// </summary>
|
||||
/// <param name="projectid"></param>
|
||||
/// <returns></returns>
|
||||
public static List<string> GetPackagingCode(string projectid)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = (from x in db.HJGL_PackagingManage
|
||||
where x.ProjectId.Contains(projectid)
|
||||
select x.PackagingCode).Distinct().ToList();
|
||||
return q;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取装箱明细
|
||||
/// </summary>
|
||||
/// <param name="PackagingManageId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.PackagingManagePrintOutput> GetPackagingDetailById(string PackagingManageId)
|
||||
{
|
||||
var model = GetHJGL_PackagingManageById(PackagingManageId);
|
||||
var result = new List<Model.PackagingManagePrintOutput>();
|
||||
if (model.TypeInt == (int)HJGLPackagingmanageService.TypeInt.预制组件)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.PipelineComponentId))
|
||||
return new List<Model.PackagingManagePrintOutput>();
|
||||
var PipelineComponentIds = model?.PipelineComponentId.Split(',');
|
||||
var query = from com in Funs.DB.HJGL_Pipeline_Component
|
||||
join pipe in Funs.DB.HJGL_Pipeline on com.PipelineId equals pipe.PipelineId into pipeGroup
|
||||
from pipe in pipeGroup.DefaultIfEmpty()
|
||||
join unitwork in Funs.DB.WBS_UnitWork on pipe.UnitWorkId equals unitwork.UnitWorkId into unitworkGroup
|
||||
from unitwork in unitworkGroup.DefaultIfEmpty()
|
||||
where PipelineComponentIds.Contains(com.PipelineComponentId)
|
||||
orderby com.PipelineComponentCode
|
||||
select new Model.PackagingManagePrintOutput
|
||||
{
|
||||
PipelineComponentId = com.PipelineComponentId,
|
||||
PipelineComponentCode = com.PipelineComponentCode,
|
||||
PlanStartDate = pipe != null && pipe.PlanStartDate != null ? pipe.PlanStartDate : DateTime.Now,
|
||||
UnitWorkName = unitwork != null ? unitwork.UnitWorkName : "",
|
||||
num = "1",
|
||||
CU = "个",
|
||||
FlowingSection = pipe != null ? pipe.FlowingSection : ""
|
||||
};
|
||||
result = query.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
var query = HJGLPackagingmanagedetailService.GetPackagingData(PackagingManageId).ToList();
|
||||
var detailList = from x in query
|
||||
select new Model.PackagingManagePrintOutput
|
||||
{
|
||||
PipelineComponentId = x.Id,
|
||||
PipelineComponentCode = x.MaterialCode,
|
||||
num = x.Number.ToString(),
|
||||
CU = x.MaterialUnit,
|
||||
UnitWorkName = x.UnitWorkId == null ? "" : UnitWorkService.GetNameById(x.UnitWorkId),
|
||||
FlowingSection = model.StackingPosition,
|
||||
};
|
||||
result = detailList.ToList();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<Model.HJGL_PackagingManage> GetPackagingManage(string trainNumberId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = (from x in db.HJGL_PackagingManage
|
||||
where x.TrainNumberId == trainNumberId
|
||||
select x).Distinct().ToList();
|
||||
return q;
|
||||
}
|
||||
|
||||
public static (List<PackagingManageItem> Data, int Total) GetPackagingManageList(string projectId, string PackagingCode, int pageIndex = 0, int pageSize = 20)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
@@ -149,6 +251,37 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
public static ListItem[] GetState()
|
||||
{
|
||||
ListItem[] list = new ListItem[3];
|
||||
list[0] = new ListItem("预出库", state_0.ToString());
|
||||
list[1] = new ListItem("已出库", state_1.ToString());
|
||||
list[2] = new ListItem("已到场", state_2.ToString());
|
||||
return list;
|
||||
}
|
||||
|
||||
public static string GetTypeString(int? TypeInt)
|
||||
{
|
||||
return TypeIntMap.FirstOrDefault(c => c.Value == TypeInt).Key;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 管线下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitPipelineDownList(FineUIPro.DropDownList dropName, string projectid, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "string";
|
||||
dropName.DataTextField = "string";
|
||||
dropName.DataSource = GetPackagingCode(projectid);
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 形成出库单
|
||||
/// </summary>
|
||||
@@ -163,145 +296,6 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取装箱明细
|
||||
/// </summary>
|
||||
/// <param name="PackagingManageId"></param>
|
||||
/// <returns></returns>
|
||||
/* public static DataTable GetPackagingDetailById(string PackagingManageId)
|
||||
{
|
||||
DataTable tb = new DataTable();
|
||||
var model = GetHJGL_PackagingManageById(PackagingManageId);
|
||||
if (!string.IsNullOrEmpty(model.PipelineComponentId))
|
||||
{
|
||||
var PipelineComponentIds = model.PipelineComponentId.Split(',');
|
||||
string strSql = @"select com.PipelineComponentId, com.PipelineComponentCode,isnull(pipe.PlanStartDate,getdate()) as PlanStartDate,unitwork.UnitWorkName,'1' as num ,'个' as CU,pipe.FlowingSection
|
||||
from HJGL_Pipeline_Component com
|
||||
left join HJGL_Pipeline pipe on com.PipelineId=pipe.PipelineId
|
||||
left join WBS_UnitWork unitwork on pipe.UnitWorkId=unitwork.UnitWorkId
|
||||
";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
strSql += string.Format("where com.PipelineComponentId in ( {0}) ", "'" + string.Join("','", PipelineComponentIds) + "'");
|
||||
strSql += " order by com.PipelineComponentCode";
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
}
|
||||
return tb;
|
||||
}*/
|
||||
public static List<Model.PackagingManagePrintOutput> GetPackagingDetailById(string PackagingManageId)
|
||||
{
|
||||
var model = GetHJGL_PackagingManageById(PackagingManageId);
|
||||
var result = new List<Model.PackagingManagePrintOutput>();
|
||||
if (string.IsNullOrEmpty(model.PipelineComponentId))
|
||||
return new List<Model.PackagingManagePrintOutput>();
|
||||
|
||||
var PipelineComponentIds = model.PipelineComponentId.Split(',');
|
||||
|
||||
if (model.TypeInt == (int)HJGL_PackagingmanageService.TypeInt.预制组件)
|
||||
{
|
||||
var query = from com in Funs.DB.HJGL_Pipeline_Component
|
||||
join pipe in Funs.DB.HJGL_Pipeline on com.PipelineId equals pipe.PipelineId into pipeGroup
|
||||
from pipe in pipeGroup.DefaultIfEmpty()
|
||||
join unitwork in Funs.DB.WBS_UnitWork on pipe.UnitWorkId equals unitwork.UnitWorkId into unitworkGroup
|
||||
from unitwork in unitworkGroup.DefaultIfEmpty()
|
||||
where PipelineComponentIds.Contains(com.PipelineComponentId)
|
||||
orderby com.PipelineComponentCode
|
||||
select new Model.PackagingManagePrintOutput
|
||||
{
|
||||
PipelineComponentId = com.PipelineComponentId,
|
||||
PipelineComponentCode = com.PipelineComponentCode,
|
||||
PlanStartDate = pipe != null && pipe.PlanStartDate != null ? pipe.PlanStartDate : DateTime.Now,
|
||||
UnitWorkName = unitwork != null ? unitwork.UnitWorkName : "",
|
||||
num = "1",
|
||||
CU = "个",
|
||||
FlowingSection = pipe != null ? pipe.FlowingSection : ""
|
||||
};
|
||||
result = query.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
var query = HJGLPackagingmanagedetailService.GetPackagingData(PackagingManageId).ToList();
|
||||
var detailList = from x in query
|
||||
select new Model.PackagingManagePrintOutput
|
||||
{
|
||||
PipelineComponentId = x.Id,
|
||||
PipelineComponentCode = x.MaterialCode,
|
||||
num = x.Number.ToString(),
|
||||
CU = x.MaterialUnit,
|
||||
UnitWorkName = x.UnitWorkId == null ? "" : UnitWorkService.GetNameById(x.UnitWorkId),
|
||||
FlowingSection = x.FlowingSection,
|
||||
};
|
||||
result = detailList.ToList();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据项目号获取包装编号历史记录
|
||||
/// </summary>
|
||||
/// <param name="projectid"></param>
|
||||
/// <returns></returns>
|
||||
public static List<string> GetPackagingCode(string projectid)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = (from x in db.HJGL_PackagingManage
|
||||
where x.ProjectId.Contains(projectid)
|
||||
select x.PackagingCode).Distinct().ToList();
|
||||
return q;
|
||||
}
|
||||
public static List<Model.HJGL_PackagingManage> GetPackagingManage(string trainNumberId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = (from x in db.HJGL_PackagingManage
|
||||
where x.TrainNumberId==trainNumberId
|
||||
select x).Distinct().ToList();
|
||||
return q;
|
||||
}
|
||||
public static string GetNewPackagingCode(string projectid)
|
||||
{
|
||||
string code = ProjectService.GetProjectCodeByProjectId(projectid) + "-" + string.Format("{0:yyyyMMdd}", DateTime.Now) + "-";
|
||||
|
||||
var q = GetPackagingManageList(projectid, code);
|
||||
if (q.Total > 0)
|
||||
{
|
||||
code = code + (q.Total + 1).ToString().PadLeft(3, '0');
|
||||
}
|
||||
else
|
||||
{
|
||||
code = code + "001";
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增实体
|
||||
/// </summary>
|
||||
/// <param name="newtable"></param>
|
||||
public static void AddHJGL_PackagingManage(Model.HJGL_PackagingManage newtable)
|
||||
{
|
||||
Model.HJGL_PackagingManage table = new Model.HJGL_PackagingManage
|
||||
{
|
||||
PackagingManageId = newtable.PackagingManageId,
|
||||
PackagingCode = newtable.PackagingCode,
|
||||
ProjectId = newtable.ProjectId,
|
||||
PipelineComponentId = newtable.PipelineComponentId,
|
||||
StackingPosition = newtable.StackingPosition,
|
||||
State = newtable.State,
|
||||
ContactName = newtable.ContactName,
|
||||
ContactPhone = newtable.ContactPhone,
|
||||
Remark = newtable.Remark,
|
||||
ReceiveDate = newtable.ReceiveDate,
|
||||
ReceiveMan = newtable.ReceiveMan,
|
||||
TrainNumber = newtable.TrainNumber,
|
||||
TrainNumberId = newtable.TrainNumberId,
|
||||
TypeInt = newtable.TypeInt,
|
||||
CompileMan=newtable.CompileMan,
|
||||
CompileDate = newtable.CompileDate
|
||||
};
|
||||
var db1 = Funs.DB;
|
||||
db1.HJGL_PackagingManage.InsertOnSubmit(table);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
|
||||
public static void UpdateHJGL_PackagingManage(Model.HJGL_PackagingManage newtable)
|
||||
{
|
||||
var db1 = Funs.DB;
|
||||
@@ -326,32 +320,37 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeleteHJGL_PackagingManageById(string PackagingManageId)
|
||||
#endregion Methods
|
||||
|
||||
#region Classes
|
||||
|
||||
public class PackagingManageItem
|
||||
{
|
||||
var db1 = Funs.DB;
|
||||
Model.HJGL_PackagingManage table = db1.HJGL_PackagingManage.FirstOrDefault(x => x.PackagingManageId == PackagingManageId);
|
||||
if (table != null)
|
||||
{
|
||||
db1.HJGL_PackagingManage.DeleteOnSubmit(table);
|
||||
db1.SubmitChanges();
|
||||
}
|
||||
#region Properties
|
||||
|
||||
public string Code { get; set; }
|
||||
public string ContactName { get; set; }
|
||||
public string ContactPhone { get; set; }
|
||||
public string DriverName { get; set; }
|
||||
public string DriverPhone { get; set; }
|
||||
public string LicensePlateNumber { get; set; }
|
||||
public string PackagingCode { get; set; }
|
||||
public string PackagingManageId { get; set; }
|
||||
public string PlanStartDate { get; set; }
|
||||
public string ProjectId { get; set; }
|
||||
public string ProjectName { get; set; }
|
||||
public string ReceiveDate { get; set; }
|
||||
public string ReceiveMan { get; set; }
|
||||
public string StackingPosition { get; set; }
|
||||
public int? State { get; set; }
|
||||
public string TrainNumber { get; set; }
|
||||
public string TrainNumberOld { get; set; }
|
||||
public int? TypeInt { get; set; }
|
||||
public string TypeString { get; set; }
|
||||
|
||||
#endregion Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 管线下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitPipelineDownList(FineUIPro.DropDownList dropName, string projectid, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "string";
|
||||
dropName.DataTextField = "string";
|
||||
dropName.DataSource = GetPackagingCode(projectid);
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
#endregion Classes
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user