焊接修改
This commit is contained in:
@@ -21,6 +21,58 @@ namespace BLL
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public static List<Model.HJGL_PackagingManageDetail> GetListByQueryModle(Model.HJGL_PackagingManageDetail table)
|
||||
{
|
||||
return GetByQueryModle(table).ToList();
|
||||
|
||||
}
|
||||
|
||||
public static (List<Model.HJGL_PackagingManageDetail> Data, int Total) GetListByQueryModle(Model.HJGL_PackagingManageDetail table, int pageIndex = 0, int pageSize = 20)
|
||||
{
|
||||
var baseQuery = GetByQueryModle(table);
|
||||
var pagedData = baseQuery
|
||||
.Skip((pageIndex) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
|
||||
// 获取总记录数(延迟计数优化)
|
||||
var totalCount = baseQuery.Count();
|
||||
|
||||
return (pagedData, totalCount);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取分页列表
|
||||
/// </summary>
|
||||
/// <param name="table"></param>
|
||||
/// <param name="grid1"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable GetListData(Model.HJGL_PackagingManageDetail table, Grid grid1)
|
||||
{
|
||||
var q = GetByQueryModle(table);
|
||||
Count = q.Count();
|
||||
if (Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize);
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return from x in q
|
||||
select new
|
||||
{
|
||||
x.Id,
|
||||
x.PackagingManageId,
|
||||
x.PipelineId,
|
||||
x.PipelineComponentId,
|
||||
x.MaterialCode,
|
||||
x.Number,
|
||||
x.CreateTime,
|
||||
x.CreateUser,
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
private static IQueryable<Model.HJGL_PackagingManageDetail> GetByQueryModle(Model.HJGL_PackagingManageDetail table)
|
||||
{
|
||||
var q = from x in Funs.DB.HJGL_PackagingManageDetail select x;
|
||||
@@ -64,128 +116,9 @@ namespace BLL
|
||||
|
||||
return q;
|
||||
}
|
||||
public static List<Model.HJGL_PackagingManageDetail> GetListByQueryModle(Model.HJGL_PackagingManageDetail table)
|
||||
{
|
||||
return GetByQueryModle(table).ToList();
|
||||
|
||||
}
|
||||
public static (List<Model.HJGL_PackagingManageDetail> Data, int Total) GetListByQueryModle(Model.HJGL_PackagingManageDetail table, int pageIndex = 0, int pageSize = 20)
|
||||
{
|
||||
var baseQuery = GetByQueryModle(table);
|
||||
var pagedData = baseQuery
|
||||
.Skip((pageIndex) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
|
||||
// 获取总记录数(延迟计数优化)
|
||||
var totalCount = baseQuery.Count();
|
||||
|
||||
return (pagedData, totalCount);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取分页列表
|
||||
/// </summary>
|
||||
/// <param name="table"></param>
|
||||
/// <param name="grid1"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable GetListData(Model.HJGL_PackagingManageDetail table, Grid grid1)
|
||||
{
|
||||
var q = GetByQueryModle(table);
|
||||
Count = q.Count();
|
||||
if (Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize);
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return from x in q
|
||||
select new
|
||||
{
|
||||
x.Id,
|
||||
x.PackagingManageId,
|
||||
x.PipelineId,
|
||||
x.PipelineComponentId,
|
||||
x.MaterialCode,
|
||||
x.Number,
|
||||
x.CreateTime,
|
||||
x.CreateUser,
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static Model.HJGL_PackagingManageDetail GetModelById(string Id)
|
||||
{
|
||||
return Funs.DB.HJGL_PackagingManageDetail.FirstOrDefault(x => x.Id == Id);
|
||||
}
|
||||
public static IEnumerable<Model.PipelinePrefabricatedComponentsItem> GetPackagingData(string PackagingManageId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(PackagingManageId))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var pack = HJGL_PackagingmanageService.GetHJGL_PackagingManageById(PackagingManageId);
|
||||
if (pack == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var result = new List<Model.PipelinePrefabricatedComponentsItem>();
|
||||
if (pack.TypeInt == (int)HJGL_PackagingmanageService.TypeInt.预制散件)
|
||||
{
|
||||
var q = from detail in Funs.DB.HJGL_PackagingManageDetail
|
||||
join lib in Funs.DB.HJGL_MaterialCodeLib on detail.MaterialCode equals lib.MaterialCode into libJoin
|
||||
from libItem in libJoin.DefaultIfEmpty()
|
||||
join line in Funs.DB.HJGL_Pipeline on detail.PipelineId equals line.PipelineId into lineJoin
|
||||
from lineItem in lineJoin.DefaultIfEmpty()
|
||||
where detail.PackagingManageId == PackagingManageId /*&& (detail.PipelineId != null || detail.PipelineId != "") && (detail.PipelineComponentId == null || detail.PipelineComponentId == "")*/
|
||||
select new PipelinePrefabricatedComponentsItem
|
||||
{
|
||||
Id = detail.Id,
|
||||
MaterialCode = libItem.MaterialCode,
|
||||
MaterialName = libItem.MaterialName,
|
||||
MaterialUnit = libItem.MaterialUnit,
|
||||
MaterialSpec = libItem.MaterialSpec,
|
||||
MaterialMade = libItem.MaterialMade,
|
||||
MaterialDef = libItem.MaterialDef,
|
||||
Number = detail.Number,
|
||||
PipelineId = lineItem.PipelineId,
|
||||
PipelineCode = lineItem.PipelineCode,
|
||||
UnitWorkId = lineItem.UnitWorkId,
|
||||
FlowingSection = lineItem.FlowingSection,
|
||||
|
||||
};
|
||||
result= q.ToList();
|
||||
}
|
||||
else if(pack.TypeInt == (int)HJGL_PackagingmanageService.TypeInt.其他材料)
|
||||
{
|
||||
var q = from detail in Funs.DB.HJGL_PackagingManageDetail
|
||||
join lib in Funs.DB.HJGL_MaterialCodeLib on detail.MaterialCode equals lib.MaterialCode into libJoin
|
||||
from libItem in libJoin.DefaultIfEmpty()
|
||||
join line in Funs.DB.HJGL_Pipeline on detail.PipelineId equals line.PipelineId into lineJoin
|
||||
from lineItem in lineJoin.DefaultIfEmpty()
|
||||
where detail.PackagingManageId == PackagingManageId /*&& (detail.PipelineId == null || detail.PipelineId == "")*/
|
||||
select new PipelinePrefabricatedComponentsItem
|
||||
{
|
||||
Id = detail.Id,
|
||||
MaterialCode = libItem.MaterialCode,
|
||||
MaterialName = libItem.MaterialName,
|
||||
MaterialUnit = libItem.MaterialUnit,
|
||||
MaterialSpec = libItem.MaterialSpec,
|
||||
MaterialMade = libItem.MaterialMade,
|
||||
MaterialDef = libItem.MaterialDef,
|
||||
Number = detail.Number,
|
||||
PipelineId = lineItem.PipelineId,
|
||||
PipelineCode = lineItem.PipelineCode,
|
||||
FlowingSection = lineItem.FlowingSection,
|
||||
|
||||
};
|
||||
result = q.ToList();
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#region Methods
|
||||
|
||||
public static void Add(Model.HJGL_PackagingManageDetail newtable)
|
||||
{
|
||||
@@ -200,10 +133,84 @@ namespace BLL
|
||||
Number = newtable.Number,
|
||||
CreateTime = newtable.CreateTime,
|
||||
CreateUser = newtable.CreateUser,
|
||||
TwOutputDetailId = newtable.TwOutputDetailId,
|
||||
};
|
||||
Funs.DB.HJGL_PackagingManageDetail.InsertOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
public static void AddBulk(List<Model.HJGL_PackagingManageDetail> newtables)
|
||||
{
|
||||
|
||||
Funs.DB.HJGL_PackagingManageDetail.InsertAllOnSubmit(newtables);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
public static void DeleteById(string Id)
|
||||
{
|
||||
|
||||
Model.HJGL_PackagingManageDetail table = Funs.DB.HJGL_PackagingManageDetail.FirstOrDefault(x => x.Id == Id);
|
||||
if (table != null)
|
||||
{
|
||||
Funs.DB.HJGL_PackagingManageDetail.DeleteOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void DeleteByPackagingManageId(string packagingManageId)
|
||||
{
|
||||
|
||||
var list = Funs.DB.HJGL_PackagingManageDetail.Where(x => x.PackagingManageId == packagingManageId).ToList();
|
||||
if (list.Count > 0)
|
||||
{
|
||||
Funs.DB.HJGL_PackagingManageDetail.DeleteAllOnSubmit(list);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Model.HJGL_PackagingManageDetail GetModelById(string Id)
|
||||
{
|
||||
return Funs.DB.HJGL_PackagingManageDetail.FirstOrDefault(x => x.Id == Id);
|
||||
}
|
||||
public static IEnumerable<Model.PipelinePrefabricatedComponentsItem> GetPackagingData(string PackagingManageId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(PackagingManageId))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var pack = HJGLPackagingmanageService.GetHJGL_PackagingManageById(PackagingManageId);
|
||||
if (pack == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var result = new List<Model.PipelinePrefabricatedComponentsItem>();
|
||||
var q = from tb in Funs.DB.HJGL_PackagingManageDetail
|
||||
join lib in Funs.DB.HJGL_MaterialCodeLib on tb.MaterialCode equals lib.MaterialCode into libJoin
|
||||
from libItem in libJoin.DefaultIfEmpty()
|
||||
join twOutDetail in Funs.DB.Tw_OutputDetail on tb.TwOutputDetailId equals twOutDetail.Id into twOutDetailJoin
|
||||
from twOutDetailItem in twOutDetailJoin.DefaultIfEmpty()
|
||||
join twOut in Funs.DB.Tw_OutputMaster on twOutDetailItem.OutputMasterId equals twOut.Id into twOutJoin
|
||||
from twOutItem in twOutJoin.DefaultIfEmpty()
|
||||
join twOutPlan in Funs.DB.Tw_InOutPlanMaster on twOutItem.InOutPlanMasterId equals twOutPlan.Id into twOutPlanJoin
|
||||
from twOutPlanItem in twOutPlanJoin.DefaultIfEmpty()
|
||||
where tb.PackagingManageId == PackagingManageId /*&& (detail.PipelineId != null || detail.PipelineId != "") && (detail.PipelineComponentId == null || detail.PipelineComponentId == "")*/
|
||||
select new PipelinePrefabricatedComponentsItem
|
||||
{
|
||||
Id = tb.Id,
|
||||
MaterialCode = libItem.MaterialCode,
|
||||
MaterialName = libItem.MaterialName,
|
||||
MaterialUnit = libItem.MaterialUnit,
|
||||
MaterialSpec = libItem.MaterialSpec,
|
||||
MaterialMade = libItem.MaterialMade,
|
||||
MaterialDef = libItem.MaterialDef,
|
||||
Number = tb.Number,
|
||||
CusBillCode = twOutItem.CusBillCode,
|
||||
};
|
||||
result = q.ToList();
|
||||
return result;
|
||||
}
|
||||
public static void Update(Model.HJGL_PackagingManageDetail newtable)
|
||||
{
|
||||
|
||||
@@ -218,38 +225,12 @@ namespace BLL
|
||||
table.Number = newtable.Number;
|
||||
table.CreateTime = newtable.CreateTime;
|
||||
table.CreateUser = newtable.CreateUser;
|
||||
table.TwOutputDetailId = newtable.TwOutputDetailId;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
public static void DeleteById(string Id)
|
||||
{
|
||||
|
||||
Model.HJGL_PackagingManageDetail table = Funs.DB.HJGL_PackagingManageDetail.FirstOrDefault(x => x.Id == Id);
|
||||
if (table != null)
|
||||
{
|
||||
Funs.DB.HJGL_PackagingManageDetail.DeleteOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
public static void DeleteByPackagingManageId(string packagingManageId)
|
||||
{
|
||||
|
||||
var list = Funs.DB.HJGL_PackagingManageDetail.Where(x => x.PackagingManageId == packagingManageId).ToList();
|
||||
if (list.Count>0)
|
||||
{
|
||||
Funs.DB.HJGL_PackagingManageDetail.DeleteAllOnSubmit(list);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
public static void AddBulk(List<Model.HJGL_PackagingManageDetail> newtables)
|
||||
{
|
||||
|
||||
Funs.DB.HJGL_PackagingManageDetail.InsertAllOnSubmit(newtables);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
||||
@@ -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