焊接修改

This commit is contained in:
2025-05-08 18:38:55 +08:00
parent 23f7bfbb1d
commit 3a36b8e3ef
38 changed files with 3717 additions and 341 deletions
@@ -21,6 +21,9 @@ namespace BLL
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; }
@@ -32,6 +35,7 @@ namespace BLL
public string Code { get; set; }
public string TrainNumber { get; set; }
public string TrainNumberOld { get; set; }
}
@@ -56,56 +60,19 @@ namespace BLL
list[2] = new ListItem("已到场", state_2.ToString());
return list;
}
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
/// 获取分页列表
/// </summary>
/// <param name="PageIndex">页码</param>
/// <param name="PageSize">每页数量</param>
/// <returns></returns>
public static IEnumerable getListData(string name, Grid Grid1)
public enum TypeInt : int
{
var db1 = Funs.DB;
IQueryable<Model.HJGL_PackagingManage> q1 = (from x in db1.HJGL_PackagingManage
join y in db1.HJGL_Pipeline_Component on x.PipelineComponentId equals y.PipelineComponentId
join z in db1.HJGL_Pipeline on y.PipelineId equals z.PipelineId
select x
);
if (!string.IsNullOrEmpty(name))
{
q1 = q1.Where(e => e.PackagingManageId.Contains(name));
}
count = q1.Count();
if (count == 0)
{
return null;
}
q1 = SortConditionHelper.SortingAndPaging(q1, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in q1
select new
{
x.PackagingManageId,
x.PackagingCode,
x.ProjectId,
x.PipelineComponentId,
x.StackingPosition,
x.State,
x.ContactName,
x.ContactPhone,
x.Remark,
x.TrainNumber
};
= 10,
= 20,
= 30,
}
#endregion
public static Dictionary<string, int> TypeIntMap = new Dictionary<string, int>
{
{ "预制组件" ,(int)TypeInt.},
{ "预制散件" ,(int)TypeInt.},
{ "其他材料" ,(int)TypeInt.},
};
public static Model.HJGL_PackagingManage GetHJGL_PackagingManageById(string PackagingManageId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
@@ -128,37 +95,52 @@ namespace BLL
}
return PlanStartDate;
}
public static List<PackagingManageItem> GetPackagingManageList(string projectId, string PackagingCode, int pageIndex, int pageSize)
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))
{
var q = (from x in db.HJGL_PackagingManage
var baseQuery = (from x in db.HJGL_PackagingManage
join n in db.Base_Project on x.ProjectId equals n.ProjectId
join m in db.Person_Persons on x.ReceiveMan equals m.PersonId into tt
join m in db.Person_Persons on x.ReceiveMan equals m.PersonId into tt
from t in tt.DefaultIfEmpty()
where x.ProjectId == projectId
join train in db.HJGL_TrainNumberManage on x.TrainNumberId equals train.Id into trains
from train in trains.DefaultIfEmpty()
where x.ProjectId == projectId
&& (string.IsNullOrEmpty(PackagingCode) || x.PackagingCode.Contains(PackagingCode))
select new PackagingManageItem
{
PackagingManageId = x.PackagingManageId,
PackagingCode = x.PackagingCode,
ProjectName = n.ProjectName,
ContactName = x.ContactName,
ContactPhone = x.ContactPhone,
ContactName = train.ContactName,
ContactPhone = train.ContactPhone,
DriverName = train.DriverName,
DriverPhone = train.DriverPhone,
LicensePlateNumber = train.LicensePlateNumber,
StackingPosition = x.StackingPosition,
State = x.State,
ReceiveMan = t.PersonName,
ReceiveDate = x.ReceiveDate.HasValue ? string.Format("{0:g}", x.ReceiveDate) : "",
PlanStartDate = GetMinPlanStartDate(x.PackagingManageId),
TrainNumber = x.TrainNumber,
TrainNumberOld = x.TrainNumber,
TrainNumber = train.TrainNumber,
Code = x.PackagingCode.Substring(0, x.PackagingCode.LastIndexOf("-")).Substring(x.PackagingCode.Substring(0, x.PackagingCode.LastIndexOf("-")).LastIndexOf("-") + 1),
}).Distinct();
return q.OrderByDescending(x => x.Code).Skip(pageIndex * pageSize).Take(pageSize).ToList();
var pagedData = baseQuery
.OrderByDescending(x => x.Code)
.Skip((pageIndex) * pageSize)
.Take(pageSize)
.ToList();
// 获取总记录数(延迟计数优化)
var totalCount = baseQuery.Count();
return (pagedData, totalCount);
}
}
}
/// <summary>
/// 形成出库单
/// </summary>
@@ -233,7 +215,9 @@ namespace BLL
Remark = newtable.Remark,
ReceiveDate = newtable.ReceiveDate,
ReceiveMan = newtable.ReceiveMan,
TrainNumber = newtable.TrainNumber
TrainNumber = newtable.TrainNumber,
TrainNumberId = newtable.TrainNumberId,
TypeInt = newtable.TypeInt,
};
var db1 = Funs.DB;
db1.HJGL_PackagingManage.InsertOnSubmit(table);
@@ -259,6 +243,8 @@ namespace BLL
table.ReceiveMan = newtable.ReceiveMan;
table.ReceiveDate = newtable.ReceiveDate;
table.TrainNumber = newtable.TrainNumber;
table.TrainNumberId = newtable.TrainNumberId;
table.TypeInt = newtable.TypeInt;
db1.SubmitChanges();
}
@@ -0,0 +1,201 @@
using FineUIPro;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public static class PackagingmanagedetailService
{
#region
/// <summary>
/// 记录数
/// </summary>
public static int Count
{
get;
set;
}
private static IQueryable<Model.HJGL_PackagingManageDetail> GetByQueryModle(Model.HJGL_PackagingManageDetail table)
{
var q = from x in Funs.DB.HJGL_PackagingManageDetail select x;
if (table == null)
{
return q;
}
if (!string.IsNullOrEmpty(table.Id))
{
q = q.Where(x => x.Id.Contains(table.Id));
}
if (!string.IsNullOrEmpty(table.PackagingManageId))
{
q = q.Where(x => x.PackagingManageId.Contains(table.PackagingManageId));
}
if (!string.IsNullOrEmpty(table.PipelineId))
{
q = q.Where(x => x.PipelineId.Contains(table.PipelineId));
}
if (!string.IsNullOrEmpty(table.PipelineComponentId))
{
q = q.Where(x => x.PipelineComponentId.Contains(table.PipelineComponentId));
}
if (!string.IsNullOrEmpty(table.MaterialCode))
{
q = q.Where(x => x.MaterialCode.Contains(table.MaterialCode));
}
if (table.Number != null)
{
q = q.Where(x => x.Number == table.Number);
}
if (table.CreateTime != null)
{
q = q.Where(x => x.CreateTime == table.CreateTime);
}
if (!string.IsNullOrEmpty(table.CreateUser))
{
q = q.Where(x => x.CreateUser.Contains(table.CreateUser));
}
;
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 GetPackagingData(string PackagingManageId)
{
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
select new
{
detail.Id,
libItem.MaterialCode,
libItem.MaterialName,
libItem.MaterialUnit,
libItem.MaterialSpec,
libItem.MaterialMade,
libItem.MaterialDef,
detail.Number,
lineItem.PipelineId,
lineItem.PipelineCode,
};
return q;
}
public static void Add(Model.HJGL_PackagingManageDetail newtable)
{
Model.HJGL_PackagingManageDetail table = new Model.HJGL_PackagingManageDetail
{
Id = newtable.Id,
PackagingManageId = newtable.PackagingManageId,
PipelineId = newtable.PipelineId,
PipelineComponentId = newtable.PipelineComponentId,
MaterialCode = newtable.MaterialCode,
Number = newtable.Number,
CreateTime = newtable.CreateTime,
CreateUser = newtable.CreateUser,
};
Funs.DB.HJGL_PackagingManageDetail.InsertOnSubmit(table);
Funs.DB.SubmitChanges();
}
public static void Update(Model.HJGL_PackagingManageDetail newtable)
{
Model.HJGL_PackagingManageDetail table = Funs.DB.HJGL_PackagingManageDetail.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.PackagingManageId = newtable.PackagingManageId;
table.PipelineId = newtable.PipelineId;
table.PipelineComponentId = newtable.PipelineComponentId;
table.MaterialCode = newtable.MaterialCode;
table.Number = newtable.Number;
table.CreateTime = newtable.CreateTime;
table.CreateUser = newtable.CreateUser;
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();
}
}
}
}
@@ -0,0 +1,202 @@
using FineUIPro;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace BLL
{
public static class TrainNumberManageService
{
/// <summary>
/// 记录数
/// </summary>
public static int Count
{
get;
set;
}
private static IQueryable<Model.HJGL_TrainNumberManage> GetByQueryModle(Model.HJGL_TrainNumberManage table)
{
var q = from x in Funs.DB.HJGL_TrainNumberManage select x;
if (table == null)
{
return q;
}
if (!string.IsNullOrEmpty(table.Id))
{
q = q.Where(x => x.Id.Contains(table.Id));
}
if (!string.IsNullOrEmpty(table.TrainNumber))
{
q = q.Where(x => x.TrainNumber.Contains(table.TrainNumber));
}
if (!string.IsNullOrEmpty(table.ProjectId))
{
q = q.Where(x => x.ProjectId.Contains(table.ProjectId));
}
if (table.State != null)
{
q = q.Where(x => x.State == table.State);
}
if (!string.IsNullOrEmpty(table.DriverName))
{
q = q.Where(x => x.DriverName.Contains(table.DriverName));
}
if (!string.IsNullOrEmpty(table.DriverPhone))
{
q = q.Where(x => x.DriverPhone.Contains(table.DriverPhone));
}
if (!string.IsNullOrEmpty(table.LicensePlateNumber))
{
q = q.Where(x => x.LicensePlateNumber.Contains(table.LicensePlateNumber));
}
if (!string.IsNullOrEmpty(table.ContactName))
{
q = q.Where(x => x.ContactName.Contains(table.ContactName));
}
if (!string.IsNullOrEmpty(table.ContactPhone))
{
q = q.Where(x => x.ContactPhone.Contains(table.ContactPhone));
}
if (!string.IsNullOrEmpty(table.Remark))
{
q = q.Where(x => x.Remark.Contains(table.Remark));
}
q = q.OrderByDescending(x => x.TrainNumber);
return q;
}
public static List<Model.HJGL_TrainNumberManage> GetListByQueryModle(Model.HJGL_TrainNumberManage table)
{
return GetByQueryModle(table).ToList();
}
public static (List<Model.HJGL_TrainNumberManage> Data, int Total) GetListByQueryModle(Model.HJGL_TrainNumberManage 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_TrainNumberManage 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.TrainNumber,
x.ProjectId,
x.State,
x.DriverName,
x.DriverPhone,
x.LicensePlateNumber,
x.ContactName,
x.ContactPhone,
x.Remark,
};
}
public static Model.HJGL_TrainNumberManage GetModelById(string Id)
{
return Funs.DB.HJGL_TrainNumberManage.FirstOrDefault(x => x.Id == Id);
}
//根据projectid 获取最新车次号
public static string GetNewTrainNumber(string ProjectId)
{
var q = from x in Funs.DB.HJGL_TrainNumberManage
where x.ProjectId == ProjectId
select x.TrainNumber;
var max = q.Count();
var NewTrainNumber=(max+1).ToString().PadLeft(2, '0');
return NewTrainNumber;
}
public static void Add(Model.HJGL_TrainNumberManage newtable)
{
Model.HJGL_TrainNumberManage table = new Model.HJGL_TrainNumberManage
{
Id = newtable.Id,
TrainNumber = newtable.TrainNumber,
ProjectId = newtable.ProjectId,
State = newtable.State,
DriverName = newtable.DriverName,
DriverPhone = newtable.DriverPhone,
LicensePlateNumber = newtable.LicensePlateNumber,
ContactName = newtable.ContactName,
ContactPhone = newtable.ContactPhone,
Remark = newtable.Remark,
};
Funs.DB.HJGL_TrainNumberManage.InsertOnSubmit(table);
Funs.DB.SubmitChanges();
}
public static void Update(Model.HJGL_TrainNumberManage newtable)
{
Model.HJGL_TrainNumberManage table = Funs.DB.HJGL_TrainNumberManage.FirstOrDefault(x => x.Id == newtable.Id);
if (table != null)
{
table.Id = newtable.Id;
table.TrainNumber = newtable.TrainNumber;
table.ProjectId = newtable.ProjectId;
table.State = newtable.State;
table.DriverName = newtable.DriverName;
table.DriverPhone = newtable.DriverPhone;
table.LicensePlateNumber = newtable.LicensePlateNumber;
table.ContactName = newtable.ContactName;
table.ContactPhone = newtable.ContactPhone;
table.Remark = newtable.Remark;
Funs.DB.SubmitChanges();
}
}
public static void DeleteById(string Id)
{
Model.HJGL_TrainNumberManage table = Funs.DB.HJGL_TrainNumberManage.FirstOrDefault(x => x.Id == Id);
if (table != null)
{
Funs.DB.HJGL_TrainNumberManage.DeleteOnSubmit(table);
Funs.DB.SubmitChanges();
}
}
public static void InitDownListOfTrainNumber(FineUIPro.DropDownList dropName, string projectId, bool isShowPlease)
{
Model.HJGL_TrainNumberManage table = new Model.HJGL_TrainNumberManage();
table.ProjectId = projectId;
dropName.DataValueField = "Id";
dropName.DataTextField = "TrainNumber";
dropName.DataSource = GetListByQueryModle(table);
dropName.DataBind();
if (isShowPlease)
{
Funs.FineUIPleaseSelect(dropName);
}
}
}
}