重构包装管理服务,优化数据结构与接口

移除 APIPackagingManageService,功能迁移至 HJGLPackagingmanageService 并进行重构,新增方法支持包装与组件关联管理、分页查询、状态描述等功能。
更新 PackagingManageController,替换旧服务调用,新增接口方法。
调整数据库结构,新增子表 HJGL_PackagingManageDetail,优化包装与组件的关联存储。
更新前端页面逻辑,适配新数据结构,新增 StackingPosition 字段显示。
优化 Model 层字段定义,调整长度限制,提升性能与一致性。
更新报表模板与项目文件,移除冗余代码,提升代码可维护性。
This commit is contained in:
李鹏飞 2025-10-29 17:00:27 +08:00
parent 98663b00f7
commit d35ff80f3e
19 changed files with 912 additions and 582 deletions

Binary file not shown.

View File

@ -67,10 +67,6 @@
"$type": "Bookmark",
"Name": "ST:2:0:{b9f91511-5ca5-40ec-9726-f3e3a7e534e2}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
},
{
"$type": "Bookmark",
"Name": "ST:130:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
@ -86,6 +82,18 @@
{
"$type": "Bookmark",
"Name": "ST:131:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
},
{
"$type": "Bookmark",
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
}
]
}

View File

@ -67,10 +67,6 @@
"$type": "Bookmark",
"Name": "ST:2:0:{b9f91511-5ca5-40ec-9726-f3e3a7e534e2}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
},
{
"$type": "Bookmark",
"Name": "ST:130:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
@ -87,13 +83,17 @@
"$type": "Bookmark",
"Name": "ST:131:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
},
{
"$type": "Bookmark",
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
},
{
"$type": "Bookmark",
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
}
]
}

View File

@ -0,0 +1,103 @@
Alter VIEW View_HJGL_InstallData
AS
WITH TwOutPutData as (select distinct twRelation.PipelineId,
outdetail.Id as TwOutputDetailId,
twRelation.MaterialCode,
master.Id as OutputMasterId
from Tw_OutputMaster master
join Tw_OutputDetail outdetail on outdetail.OutputMasterId = master.Id
join Tw_InOutPlanMaster planmaster on planmaster.Id = master.InOutPlanMasterId
join Tw_InOutPlanDetail_Relation twRelation
on twRelation.InOutPlanMasterId = planmaster.Id and
outdetail.MaterialCode = twRelation.MaterialCode
where master.TypeInt=70),
PrefabricatedData AS (SELECT pipe.PipeLineMatId as Id,
line.PipelineCode,
pipe.PrefabricatedComponents as Code,
'预制组件' as TypeStr,
'' as Matdef,
CAST(NULL AS DECIMAL(18, 2)) as Number, -- 明确指定数据类型
pack.PackagingCode,
trainnumber.TrainNumber,
line.FlowingSection,
line.UnitWorkId,
line.ProjectId,
pack.StackingPosition
FROM dbo.HJGL_PipeLineMat pipe
INNER JOIN dbo.HJGL_Pipeline line -- 改为INNER JOIN如果管道必须存在
ON pipe.PipelineId = line.PipelineId
LEFT JOIN dbo.HJGL_MaterialCodeLib lib
ON lib.MaterialCode = pipe.MaterialCode
LEFT JOIN HJGL_Pipeline_Component comonent
ON comonent.PipelineComponentCode = pipe.PrefabricatedComponents
LEFT JOIN HJGL_PackagingManageDetail packdetail
ON packdetail.PipelineComponentId = comonent.PipelineComponentId
LEFT JOIN HJGL_PackagingManage pack
ON packdetail.PackagingManageId = pack.PackagingManageId
AND pack.ProjectId = line.ProjectId -- 添加项目关联条件
LEFT JOIN HJGL_TrainNumberManage trainnumber
ON pack.TrainNumberId = trainnumber.Id
WHERE line.PipeArea = '1'
and (pipe.PrefabricatedComponents != ''
AND pipe.PrefabricatedComponents IS NOT NULL)),
LooseComponentsData AS (SELECT distinct pipe.PipeLineMatId as Id,
line.PipelineCode,
pipe.MaterialCode as Code,
'预制散件' as TypeStr,
lib.MaterialDef as Matdef,
cast( packdetail.Number as DECIMAL(18, 2)) as Number,
pack.PackagingCode,
trainnumber.TrainNumber,
line.FlowingSection,
line.UnitWorkId,
line.ProjectId,
pack.StackingPosition
FROM dbo.HJGL_PipeLineMat pipe
INNER JOIN HJGL_Pipeline line -- 改为INNER JOIN
ON pipe.PipelineId = line.PipelineId
LEFT JOIN dbo.HJGL_MaterialCodeLib lib
ON lib.MaterialCode = pipe.MaterialCode
LEFT JOIN HJGL_PackagingManageDetail packdetail
ON packdetail.MaterialCode = pipe.MaterialCode
LEFT JOIN TwOutPutData twOutPutData
ON twOutPutData.PipelineId = pipe.PipelineId and
twOutPutData.MaterialCode = packdetail.MaterialCode
LEFT JOIN HJGL_PackagingManage pack
ON packdetail.PackagingManageId = pack.PackagingManageId
AND pack.ProjectId = line.ProjectId -- 添加项目关联条件
LEFT JOIN HJGL_TrainNumberManage trainnumber
ON pack.TrainNumberId = trainnumber.Id
where line.PipeArea = '1'
and (pipe.PrefabricatedComponents is null or pipe.PrefabricatedComponents = ''))
-- 合并结果
SELECT *
FROM PrefabricatedData
UNION ALL
SELECT *
FROM LooseComponentsData
go
INSERT INTO HJGL_PackagingManageDetail
SELECT NEWID(),
p.PackagingManageId,
HPC.PipelineId,
s.Value,
NULL,
NULL,
'2025-10-29 15:01:32.513',
'C4A62EC0-E5D3-4EBF-A5FA-E56AA89633C0',
NULL
FROM HJGL_PackagingManage p
CROSS APPLY dbo.SplitString(p.PipelineComponentId, ',', 1) s
JOIN HJGL_Pipeline_Component HPC ON s.Value = HPC.PipelineComponentId
WHERE p.PipelineComponentId IS NOT NULL
AND p.PipelineComponentId != ''
AND NOT EXISTS (
SELECT 1
FROM HJGL_PackagingManageDetail pmd
WHERE pmd.PackagingManageId = p.PackagingManageId
AND pmd.PipelineId = HPC.PipelineId
AND pmd.PipelineComponentId = s.Value
-- 如果还有其他判断重复的字段,可以继续添加条件
)

View File

@ -1,264 +0,0 @@
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
namespace BLL
{
public class APIPackagingManageService
{
public static List<Model.PackagingManageDetailItem> GetPackagingManageList(PackagingManageInput filter, int pageIndex, int pageSize, out int totalCount)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
// base join query to include project and receive person
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
from t in tt.DefaultIfEmpty()
select new { x, n, t };
if (filter != null)
{
if (!string.IsNullOrEmpty(filter.PackagingManageId))
{
baseQuery = baseQuery.Where(z => z.x.PackagingManageId == filter.PackagingManageId);
}
if (!string.IsNullOrEmpty(filter.PackagingCode))
{
baseQuery = baseQuery.Where(z => z.x.PackagingCode.Contains(filter.PackagingCode));
}
if (!string.IsNullOrEmpty(filter.ProjectId))
{
baseQuery = baseQuery.Where(z => z.x.ProjectId == filter.ProjectId);
}
if (!string.IsNullOrEmpty(filter.ProjectName))
{
baseQuery = baseQuery.Where(z => z.n.ProjectName.Contains(filter.ProjectName));
}
if (!string.IsNullOrEmpty(filter.ContactName))
{
baseQuery = baseQuery.Where(z => z.x.ContactName.Contains(filter.ContactName));
}
if (!string.IsNullOrEmpty(filter.ContactPhone))
{
baseQuery = baseQuery.Where(z => z.x.ContactPhone.Contains(filter.ContactPhone));
}
if (!string.IsNullOrEmpty(filter.StackingPosition))
{
baseQuery = baseQuery.Where(z => z.x.StackingPosition.Contains(filter.StackingPosition));
}
if (filter.State != null)
{
baseQuery = baseQuery.Where(z => z.x.State == filter.State);
}
if (!string.IsNullOrEmpty(filter.ReceiveMan))
{
baseQuery = baseQuery.Where(z => z.x.ReceiveMan == filter.ReceiveMan || (z.t != null && z.t.PersonName.Contains(filter.ReceiveMan)));
}
if (!string.IsNullOrEmpty(filter.ReceiveDate))
{
DateTime dt;
if (DateTime.TryParse(filter.ReceiveDate, out dt))
{
var start = dt.Date;
var end = start.AddDays(1);
baseQuery = baseQuery.Where(z => z.x.ReceiveDate != null && z.x.ReceiveDate >= start && z.x.ReceiveDate < end);
}
}
if (!string.IsNullOrEmpty(filter.TrainNumberId))
{
baseQuery = baseQuery.Where(z => z.x.TrainNumber != null && z.x.TrainNumber.Contains(filter.TrainNumberId));
}
}
baseQuery = baseQuery.OrderByDescending(z => (z.x.ReceiveDate ?? DateTime.MinValue)).ThenBy(z => z.x.PackagingCode);
var q = (from z in baseQuery
select new PackagingManageDetailItem
{
PackagingManageId = z.x.PackagingManageId,
PackagingCode = z.x.PackagingCode,
ProjectName = z.n.ProjectName,
ContactName = z.x.ContactName,
ContactPhone = z.x.ContactPhone,
StackingPosition = z.x.StackingPosition,
State = z.x.State,
ReceiveMan = z.t.PersonName,
ReceiveDate = string.Format("{0:g}", z.x.ReceiveDate),
TrainNumber = z.x.TrainNumber,
}).Distinct();
totalCount = q.Count();
if (pageIndex <=0) pageIndex =1;
if (pageSize <=0) pageSize =20;
return q.Skip((pageIndex -1) * pageSize).Take(pageSize).ToList();
}
}
public static Model.PackagingManageItem GetPackagingInformationById(string projectId, string personId, string packagingManageId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
PackagingManageItem packagingManageItem = new PackagingManageItem();
List<PackagingPrepipeItem> packagingPrepipeItem = new List<PackagingPrepipeItem>();
var q = (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
from t in tt.DefaultIfEmpty()
where x.PackagingManageId == packagingManageId
select new PackagingManageDetailItem
{
PackagingManageId = x.PackagingManageId,
PackagingCode = x.PackagingCode,
ProjectName = n.ProjectName,
ProjectId = x.ProjectId,
ContactName = x.ContactName,
ContactPhone = x.ContactPhone,
StackingPosition = x.StackingPosition,
State = x.State,
ReceiveMan = t.PersonName,
ReceiveDate = string.Format("{0:g}", x.ReceiveDate),
TrainNumber = x.TrainNumber,
}).FirstOrDefault();
var tb_packing = (from x in db.HJGL_PackagingManage where x.PackagingManageId == packagingManageId select x).FirstOrDefault();
var PipelineComponentIdList = tb_packing?.PipelineComponentId?.Split(',');
if (PipelineComponentIdList != null && PipelineComponentIdList.Count() > 0)
{
packagingPrepipeItem = (from x in db.HJGL_Pipeline_Component
join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
join z in db.WBS_UnitWork on y.UnitWorkId equals z.UnitWorkId
where PipelineComponentIdList.Contains(x.PipelineComponentId)
select new PackagingPrepipeItem
{
PipelineComponentId = x.PipelineComponentId,
PipelineComponentCode = x.PipelineComponentCode,
PreUnit = "1/个",
UnitWorkName = z.UnitWorkName,
PlanStartDate = string.Format("{0:g}", y.PlanStartDate),
}).ToList();
}
bool isPower = Person_PersonsService.IsGeneralUnitByPersonId(personId, projectId);
if (!isPower)
{
var roleList = Person_PersonsService.GetRoleListByProjectIdPersonId(projectId, personId);
if (roleList.Contains(Const.CQEngineer))
{
isPower = true;
}
}
packagingManageItem.packagingManageDetailItem = q;
packagingManageItem.packagingPrepipeItems = packagingPrepipeItem;
packagingManageItem.isPower = isPower;
return packagingManageItem;
}
}
public static void GetPackingInfoConfirmArrival(string packagingManageId, string PersonId)
{
var q = BLL.HJGLPackagingmanageService.GetHJGL_PackagingManageById(packagingManageId);
if (q != null)
{
q.State = HJGLPackagingmanageService.state_2;
q.ReceiveMan = PersonId;
q.ReceiveDate = DateTime.Now;
HJGLPackagingmanageService.UpdateHJGL_PackagingManage(q);
}
}
public static void getSavePackagingInformationById(string packagingManageId, string PipelineComponentIds)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var table = db.HJGL_PackagingManage.FirstOrDefault(x => x.PackagingManageId == packagingManageId);
if (table != null)
{
if (string.IsNullOrEmpty(table.PipelineComponentId))
{
table.PipelineComponentId = PipelineComponentIds;
}
else
{
HashSet<string> set = new HashSet<string>();
string[] oldIds = table.PipelineComponentId.Split(',');
foreach (var id in oldIds)
{
set.Add(id);
}
string[] newIds = PipelineComponentIds.Split(',');
foreach (var id in newIds)
{
set.Add(id);
}
table.PipelineComponentId = string.Join(",", set);
}
}
BLL.HJGLPackagingmanageService.UpdateHJGL_PackagingManage(table);
var newDetailList = new List<Model.HJGL_PackagingManageDetail>();
foreach (var item in table.PipelineComponentId.Split(','))
{
var ComponentModel = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(item);
if (ComponentModel != null)
{
var model = new Model.HJGL_PackagingManageDetail()
{
Id = SQLHelper.GetNewID(),
PackagingManageId = table.PackagingManageId,
PipelineId = ComponentModel.PipelineId,
PipelineComponentId = item,
CreateTime = DateTime.Now,
};
newDetailList.Add(model);
}
}
HJGLPackagingmanagedetailService.DeleteByPackagingManageId(table.PackagingManageId);
HJGLPackagingmanagedetailService.AddBulk(newDetailList);
}
}
/// <summary>
/// 新增或更新包装信息Id为空则新增否则更新返回创建或更新后的Id。
/// </summary>
public static string AddOrUpdatePackaging(Model.HJGL_PackagingManage model)
{
if (model == null)
throw new ArgumentNullException(nameof(model));
if (string.IsNullOrEmpty(model.PackagingManageId))
{
// 新增
model.PackagingManageId = SQLHelper.GetNewID(typeof(Model.HJGL_PackagingManage));
HJGLPackagingmanageService.AddHJGL_PackagingManage(model);
return model.PackagingManageId;
}
else
{
// 修改
var exist = HJGLPackagingmanageService.GetHJGL_PackagingManageById(model.PackagingManageId);
if (exist == null)
{
HJGLPackagingmanageService.AddHJGL_PackagingManage(model);
return model.PackagingManageId;
}
else
{
HJGLPackagingmanageService.UpdateHJGL_PackagingManage(model);
return model.PackagingManageId;
}
}
}
public static string GetNewPackagingCode(string projectId)
{
return HJGLPackagingmanageService.GetNewPackagingCode(projectId);
}
}
}

View File

@ -16,6 +16,7 @@ namespace BLL
if (model != null)
{
model.ReceiveDate = DateTime.Now;
model.State = ((int)TrainNumberManageService.StateInt.);
TrainNumberManageService.Update(model);
}
else
@ -25,7 +26,7 @@ namespace BLL
var packManagerList = HJGLPackagingmanageService.GetPackagingManage(id);
foreach (var item in packManagerList)
{
BLL.APIPackagingManageService.GetPackingInfoConfirmArrival(item.PackagingManageId, PersonId);
BLL.HJGLPackagingmanageService.GetPackingInfoConfirmArrival(item.PackagingManageId, PersonId);
}
}
@ -89,8 +90,9 @@ namespace BLL
if (string.IsNullOrEmpty(model.Id))
{
// 新增
model.Id = SQLHelper.GetNewID(typeof(Model.HJGL_TrainNumberManage));
model.ReceiveDate = null;
model.ReceiveDate = null;
TrainNumberManageService.Add(model);
return model.Id;
}

View File

@ -201,7 +201,6 @@
<Compile Include="API\HJGL\APIHJGLIndexService.cs" />
<Compile Include="API\HJGL\APIHotProcessHardService.cs" />
<Compile Include="API\HJGL\APINDETrustService.cs" />
<Compile Include="API\HJGL\APIPackagingManageService.cs" />
<Compile Include="API\HJGL\APIPipeJointService.cs" />
<Compile Include="API\HJGL\APIPipelineComponentService.cs" />
<Compile Include="API\HJGL\APIPreWeldingDailyService.cs" />

View File

@ -19,11 +19,6 @@ 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)
{
@ -71,7 +66,7 @@ namespace BLL
};
}
private static IQueryable<Model.HJGL_PackagingManageDetail> GetByQueryModle(Model.HJGL_PackagingManageDetail table)
public static IQueryable<Model.HJGL_PackagingManageDetail> GetByQueryModle(Model.HJGL_PackagingManageDetail table)
{
var q = from x in Funs.DB.HJGL_PackagingManageDetail select x;
if (table == null)
@ -155,7 +150,17 @@ namespace BLL
}
}
public static void DeleteByPipelineComponentId(string pipelineComponentId)
{
Model.HJGL_PackagingManageDetail table = Funs.DB.HJGL_PackagingManageDetail.FirstOrDefault(x => x.PipelineComponentId == pipelineComponentId);
if (table != null)
{
Funs.DB.HJGL_PackagingManageDetail.DeleteOnSubmit(table);
Funs.DB.SubmitChanges();
}
}
public static void DeleteByPackagingManageId(string packagingManageId)
{

View File

@ -1,9 +1,11 @@
using FineUIPro;
using FastReport.DevComponents.DotNetBar;
using FineUIPro;
using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using WIA;
namespace BLL
{
@ -14,6 +16,13 @@ namespace BLL
{
#region Fields
public static Dictionary<string, int> CategoryIntMap = new Dictionary<string, int>
{
{ "打捆" ,(int)CategoryInt.},
{ "装箱" ,(int)CategoryInt.},
{ "散装" ,(int)CategoryInt.},
};
/// <summary>
/// 未到场
/// </summary>
@ -35,28 +44,24 @@ namespace BLL
{ "预制散件" ,(int)TypeInt.},
{ "其他材料" ,(int)TypeInt.},
};
public static Dictionary<string, int> CategoryIntMap = new Dictionary<string, int>
{
{ "打捆" ,(int)CategoryInt.},
{ "装箱" ,(int)CategoryInt.},
{ "散装" ,(int)CategoryInt.},
};
#endregion Fields
#region Enums
public enum CategoryInt : int
{
= 10,
= 20,
= 30,
}
public enum TypeInt : int
{
= 10,
= 20,
= 30,
}
public enum CategoryInt : int
{
= 10,
= 20,
= 30,
}
#endregion Enums
@ -93,6 +98,69 @@ namespace BLL
db1.SubmitChanges();
}
/// <summary>
/// 新增或更新包装信息Id为空则新增否则更新返回创建或更新后的Id。
/// </summary>
/// <param name="model">包装信息实体包含包装编号、项目ID、状态等信息</param>
/// <returns>创建或更新后的包装管理ID</returns>
/// <exception cref="ArgumentNullException">当model为null时抛出异常</exception>
public static string AddOrUpdatePackaging(Model.HJGL_PackagingManage model)
{
if (model == null)
throw new ArgumentNullException(nameof(model));
if (string.IsNullOrEmpty(model.PackagingManageId))
{
// 新增
model.PackagingManageId = SQLHelper.GetNewID(typeof(Model.HJGL_PackagingManage));
AddHJGL_PackagingManage(model);
return model.PackagingManageId;
}
else
{
// 修改
var exist = GetHJGL_PackagingManageById(model.PackagingManageId);
if (exist == null)
{
AddHJGL_PackagingManage(model);
return model.PackagingManageId;
}
else
{
UpdateHJGL_PackagingManage(model);
return model.PackagingManageId;
}
}
}
/// <summary>
/// 添加包装与预制组件关联关系
/// </summary>
/// <param name="packagingManageId">包装管理ID</param>
/// <param name="pipelineComponentId">管道组件ID</param>
/// <exception cref="Exception">当该预制组件已被包装时抛出异常</exception>
public static void AddPipelineComponentToPackaging(string packagingManageId, string pipelineComponentId)
{
var ComponentModel = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(pipelineComponentId);
if (ComponentModel != null)
{
var model = new Model.HJGL_PackagingManageDetail()
{
Id = SQLHelper.GetNewID(),
PackagingManageId = packagingManageId,
PipelineId = ComponentModel.PipelineId,
PipelineComponentId = pipelineComponentId,
CreateTime = DateTime.Now,
CreateUser = null,
};
HJGLPackagingmanagedetailService.Add(model);
}
}
/// <summary>
/// 根据ID删除包装管理记录
/// </summary>
/// <param name="PackagingManageId">包装管理ID</param>
public static void DeleteHJGL_PackagingManageById(string PackagingManageId)
{
var db1 = Funs.DB;
@ -104,6 +172,30 @@ namespace BLL
}
}
/// <summary>
/// 删除包装与预制组件的关联关系
/// </summary>
/// <param name="pipelineComponentId">管道组件ID</param>
public static void DeletePipelineComponentFromPackaging(string pipelineComponentId)
{
HJGLPackagingmanagedetailService.DeleteByPipelineComponentId(pipelineComponentId);
}
/// <summary>
/// 根据分类整数值获取分类字符串描述
/// </summary>
/// <param name="CategoryInt">分类整数值10:打捆, 20:装箱, 30:散装)</param>
/// <returns>分类字符串描述,如果未找到则返回空字符串</returns>
public static string GetCategoryString(int? CategoryInt)
{
return CategoryIntMap.FirstOrDefault(c => c.Value == CategoryInt).Key;
}
/// <summary>
/// 根据包装管理ID获取包装信息实体
/// </summary>
/// <param name="PackagingManageId">包装管理ID</param>
/// <returns>包装信息实体如果未找到则返回null</returns>
public static Model.HJGL_PackagingManage GetHJGL_PackagingManageById(string PackagingManageId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
@ -111,7 +203,11 @@ namespace BLL
return db.HJGL_PackagingManage.FirstOrDefault(x => x.PackagingManageId == PackagingManageId);
}
}
/// <summary>
/// 获取包装中所有组件的最早计划开始日期
/// </summary>
/// <param name="PackagingManageId">包装管理ID</param>
/// <returns>最早计划开始日期字符串,如果没有组件则返回空字符串</returns>
public static string GetMinPlanStartDate(string PackagingManageId)
{
string PlanStartDate = "";
@ -124,6 +220,11 @@ namespace BLL
return PlanStartDate;
}
/// <summary>
/// 根据项目ID生成新的包装编号
/// </summary>
/// <param name="projectid">项目ID</param>
/// <returns>新包装编号,格式为:项目编号-日期-序号PROJ20241029-001</returns>
public static string GetNewPackagingCode(string projectid)
{
string code = ProjectService.GetProjectCodeByProjectId(projectid) + "-" + string.Format("{0:yyyyMMdd}", DateTime.Now) + "-";
@ -143,8 +244,8 @@ namespace BLL
/// <summary>
/// 根据项目号获取包装编号历史记录
/// </summary>
/// <param name="projectid"></param>
/// <returns></returns>
/// <param name="projectid">项目ID</param>
/// <returns>该项目的所有包装编号列表(去重)</returns>
public static List<string> GetPackagingCode(string projectid)
{
Model.SGGLDB db = Funs.DB;
@ -155,25 +256,34 @@ namespace BLL
}
/// <summary>
/// 根据主键获取装箱明细
/// 根据主键获取装箱明细,用于打印输出
/// </summary>
/// <param name="PackagingManageId"></param>
/// <returns></returns>
/// <param name="PackagingManageId">包装管理ID</param>
/// <returns>包装打印输出列表,包含组件信息、单位工程、计划开始日期等</returns>
/// <remarks>
/// 根据包装类型返回不同的数据:
/// - 预制组件从HJGL_PackagingManageDetail表获取关联的组件ID查询详细的组件信息
/// - 预制散件/其他材料从HJGL_PackagingManageDetail表获取散装材料信息
/// </remarks>
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))
// 从子表HJGL_PackagingManageDetail中获取关联的组件ID
var PipelineComponentIdList = (from x in Funs.DB.HJGL_PackagingManageDetail
where x.PackagingManageId == PackagingManageId
select x.PipelineComponentId).ToList();
if (PipelineComponentIdList == null || PipelineComponentIdList.Count == 0)
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)
where PipelineComponentIdList.Contains(com.PipelineComponentId)
orderby com.PipelineComponentCode
select new Model.PackagingManagePrintOutput
{
@ -183,7 +293,8 @@ namespace BLL
UnitWorkName = unitwork != null ? unitwork.UnitWorkName : "",
num = "1",
CU = "个",
FlowingSection = pipe != null ? pipe.FlowingSection : ""
//FlowingSection = pipe != null ? pipe.FlowingSection : ""
FlowingSection = model.StackingPosition
};
result = query.ToList();
}
@ -205,6 +316,88 @@ namespace BLL
return result;
}
/// <summary>
/// 根据ID获取包装信息包含权限验证
/// </summary>
/// <param name="projectId">项目ID用于权限验证</param>
/// <param name="personId">人员ID用于权限验证</param>
/// <param name="packagingManageId">包装管理ID</param>
/// <returns>包含包装详情、组件明细和权限信息的包装管理项</returns>
/// <remarks>
/// 该方法会:
/// 1. 查询包装基本信息及关联的项目、接收人信息
/// 2. 从子表HJGL_PackagingManageDetail中获取关联的组件ID列表
/// 3. 根据组件ID查询详细的组件信息包括管道、单位工程等
/// 4. 验证用户是否有操作权限(总包单位或质检工程师)
/// </remarks>
public static Model.PackagingManageItem GetPackagingInformationById(string projectId, string personId, string packagingManageId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
PackagingManageItem packagingManageItem = new PackagingManageItem();
List<PackagingPrepipeItem> packagingPrepipeItem = new List<PackagingPrepipeItem>();
var q = (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
from t in tt.DefaultIfEmpty()
where x.PackagingManageId == packagingManageId
select new PackagingManageDetailItem
{
PackagingManageId = x.PackagingManageId,
PackagingCode = x.PackagingCode,
ProjectName = n.ProjectName,
ProjectId = x.ProjectId,
ContactName = x.ContactName,
ContactPhone = x.ContactPhone,
StackingPosition = x.StackingPosition,
State = x.State,
ReceiveMan = t.PersonName,
ReceiveDate = string.Format("{0:g}", x.ReceiveDate),
TrainNumber = x.TrainNumber,
}).FirstOrDefault();
// 从子表HJGL_PackagingManageDetail中根据PackagingManageId获取关联的组件ID
var PipelineComponentIdList = (from x in db.HJGL_PackagingManageDetail
where x.PackagingManageId == packagingManageId
select x.PipelineComponentId).ToList();
if (PipelineComponentIdList != null && PipelineComponentIdList.Count() > 0)
{
packagingPrepipeItem = (from x in db.HJGL_Pipeline_Component
join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
join z in db.WBS_UnitWork on y.UnitWorkId equals z.UnitWorkId
where PipelineComponentIdList.Contains(x.PipelineComponentId)
select new PackagingPrepipeItem
{
PipelineComponentId = x.PipelineComponentId,
PipelineComponentCode = x.PipelineComponentCode,
PreUnit = "1/个",
UnitWorkName = z.UnitWorkName,
PlanStartDate = string.Format("{0:g}", y.PlanStartDate),
}).ToList();
}
bool isPower = Person_PersonsService.IsGeneralUnitByPersonId(personId, projectId);
if (!isPower)
{
var roleList = Person_PersonsService.GetRoleListByProjectIdPersonId(projectId, personId);
if (roleList.Contains(Const.CQEngineer))
{
isPower = true;
}
}
packagingManageItem.packagingManageDetailItem = q;
packagingManageItem.packagingPrepipeItems = packagingPrepipeItem;
packagingManageItem.isPower = isPower;
return packagingManageItem;
}
}
/// <summary>
/// 根据车次ID获取包装管理列表
/// </summary>
/// <param name="trainNumberId">车次ID</param>
/// <returns>该车次关联的所有包装管理记录</returns>
public static List<Model.HJGL_PackagingManage> GetPackagingManage(string trainNumberId)
{
Model.SGGLDB db = Funs.DB;
@ -214,7 +407,7 @@ namespace BLL
return q;
}
public static (List<PackagingManageItem> Data, int Total) GetPackagingManageList(string projectId, string PackagingCode, int pageIndex = 0, int pageSize = 20)
public static (List<PackagingManageOutput> Data, int Total) GetPackagingManageList(string projectId, string PackagingCode, int pageIndex = 0, int pageSize = 20)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
@ -226,7 +419,7 @@ namespace BLL
from train in trains.DefaultIfEmpty()
where x.ProjectId == projectId
&& (string.IsNullOrEmpty(PackagingCode) || x.PackagingCode.Contains(PackagingCode))
select new PackagingManageItem
select new PackagingManageOutput
{
PackagingManageId = x.PackagingManageId,
PackagingCode = x.PackagingCode,
@ -262,6 +455,201 @@ namespace BLL
}
}
/// <summary>
/// 获取包装管理列表(带过滤条件)
/// </summary>
/// <param name="filter">过滤条件</param>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">页大小</param>
/// <param name="totalCount">总记录数</param>
/// <returns>包装管理列表</returns>
public static List<Model.PackagingManageDetailItem> GetPackagingManageList(PackagingManageInput filter, int pageIndex, int pageSize, out int totalCount)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
// base join query to include project and receive person
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
from t in tt.DefaultIfEmpty()
select new { x, n, t };
if (filter != null)
{
if (!string.IsNullOrEmpty(filter.PackagingManageId))
{
baseQuery = baseQuery.Where(z => z.x.PackagingManageId == filter.PackagingManageId);
}
if (!string.IsNullOrEmpty(filter.PackagingCode))
{
baseQuery = baseQuery.Where(z => z.x.PackagingCode.Contains(filter.PackagingCode));
}
if (!string.IsNullOrEmpty(filter.ProjectId))
{
baseQuery = baseQuery.Where(z => z.x.ProjectId == filter.ProjectId);
}
if (!string.IsNullOrEmpty(filter.ProjectName))
{
baseQuery = baseQuery.Where(z => z.n.ProjectName.Contains(filter.ProjectName));
}
if (!string.IsNullOrEmpty(filter.ContactName))
{
baseQuery = baseQuery.Where(z => z.x.ContactName.Contains(filter.ContactName));
}
if (!string.IsNullOrEmpty(filter.ContactPhone))
{
baseQuery = baseQuery.Where(z => z.x.ContactPhone.Contains(filter.ContactPhone));
}
if (!string.IsNullOrEmpty(filter.StackingPosition))
{
baseQuery = baseQuery.Where(z => z.x.StackingPosition.Contains(filter.StackingPosition));
}
if (filter.State != null)
{
baseQuery = baseQuery.Where(z => z.x.State == filter.State);
}
if (!string.IsNullOrEmpty(filter.ReceiveMan))
{
baseQuery = baseQuery.Where(z => z.x.ReceiveMan == filter.ReceiveMan || (z.t != null && z.t.PersonName.Contains(filter.ReceiveMan)));
}
if (!string.IsNullOrEmpty(filter.ReceiveDate))
{
DateTime dt;
if (DateTime.TryParse(filter.ReceiveDate, out dt))
{
var start = dt.Date;
var end = start.AddDays(1);
baseQuery = baseQuery.Where(z => z.x.ReceiveDate != null && z.x.ReceiveDate >= start && z.x.ReceiveDate < end);
}
}
if (!string.IsNullOrEmpty(filter.TrainNumberId))
{
baseQuery = baseQuery.Where(z => z.x.TrainNumber != null && z.x.TrainNumber.Contains(filter.TrainNumberId));
}
}
baseQuery = baseQuery.OrderByDescending(z => (z.x.ReceiveDate ?? DateTime.MinValue)).ThenBy(z => z.x.PackagingCode);
var q = (from z in baseQuery
select new PackagingManageDetailItem
{
PackagingManageId = z.x.PackagingManageId,
PackagingCode = z.x.PackagingCode,
ProjectName = z.n.ProjectName,
ContactName = z.x.ContactName,
ContactPhone = z.x.ContactPhone,
StackingPosition = z.x.StackingPosition,
State = z.x.State,
ReceiveMan = z.t.PersonName,
ReceiveDate = string.Format("{0:g}", z.x.ReceiveDate),
TrainNumber = z.x.TrainNumber,
}).Distinct();
totalCount = q.Count();
if (pageIndex <= 0) pageIndex = 1;
if (pageSize <= 0) pageSize = 20;
return q.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
}
}
/// <summary>
/// 包装到场验收,将包装状态更新为已到场并记录验收人和验收时间
/// </summary>
/// <param name="packagingManageId">包装管理ID</param>
/// <param name="PersonId">验收人员ID</param>
/// <remarks>
/// 该方法会将包装状态更新为已到场state_2并设置接收人和接收时间
/// </remarks>
public static void GetPackingInfoConfirmArrival(string packagingManageId, string PersonId)
{
var q = GetHJGL_PackagingManageById(packagingManageId);
if (q != null)
{
q.State = state_2;
q.ReceiveMan = PersonId;
q.ReceiveDate = DateTime.Now;
UpdateHJGL_PackagingManage(q);
}
}
/// <summary>
/// 保存包装信息(组件明细),将组件关联到包装并更新明细表
/// </summary>
/// <param name="packagingManageId">包装管理ID</param>
/// <param name="PipelineComponentIds">组件ID集合多个ID用逗号分隔</param>
/// <remarks>
/// 该方法会:
/// 1. 获取现有的包装明细记录中的组件ID
/// 2. 合并新旧组件ID去重
/// 3. 根据组件ID查询对应的管道信息
/// 4. 删除原有的包装明细记录
/// 5. 批量插入新的包装明细记录到HJGL_PackagingManageDetail表
/// </remarks>
public static void getSavePackagingInformationById(string packagingManageId, string PipelineComponentIds)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
// 获取现有的组件ID列表
var existingComponentIds = (from x in db.HJGL_PackagingManageDetail
where x.PackagingManageId == packagingManageId
select x.PipelineComponentId).ToList();
// 合并新旧组件ID去重
HashSet<string> allComponentIds = new HashSet<string>(existingComponentIds);
if (!string.IsNullOrEmpty(PipelineComponentIds))
{
string[] newIds = PipelineComponentIds.Split(',');
foreach (var id in newIds)
{
if (!string.IsNullOrEmpty(id))
{
allComponentIds.Add(id);
}
}
}
// 创建新的包装明细记录
var newDetailList = new List<Model.HJGL_PackagingManageDetail>();
foreach (var item in allComponentIds)
{
var ComponentModel = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(item);
if (ComponentModel != null)
{
var model = new Model.HJGL_PackagingManageDetail()
{
Id = SQLHelper.GetNewID(),
PackagingManageId = packagingManageId,
PipelineId = ComponentModel.PipelineId,
PipelineComponentId = item,
CreateTime = DateTime.Now,
};
newDetailList.Add(model);
}
}
// 更新数据库:先删除旧记录,再插入新记录
HJGLPackagingmanagedetailService.DeleteByPackagingManageId(packagingManageId);
if (newDetailList.Count > 0)
{
HJGLPackagingmanagedetailService.AddBulk(newDetailList);
}
// 可选同时更新主表的PipelineComponentId字段以保持兼容性
var table = db.HJGL_PackagingManage.FirstOrDefault(x => x.PackagingManageId == packagingManageId);
if (table != null)
{
table.PipelineComponentId = string.Join(",", allComponentIds);
UpdateHJGL_PackagingManage(table);
}
}
}
/// <summary>
/// 获取包装状态下拉框选项
/// </summary>
/// <returns>包装状态列表,包含状态文本和值的映射关系</returns>
public static ListItem[] GetState()
{
ListItem[] list = new ListItem[3];
@ -271,19 +659,22 @@ namespace BLL
return list;
}
/// <summary>
/// 根据类型整数值获取类型字符串描述
/// </summary>
/// <param name="TypeInt">类型整数值10:预制组件, 20:预制散件, 30:其他材料)</param>
/// <returns>类型字符串描述,如果未找到则返回空字符串</returns>
public static string GetTypeString(int? TypeInt)
{
return TypeIntMap.FirstOrDefault(c => c.Value == TypeInt).Key;
}
public static string GetCategoryString(int? CategoryInt)
{
return CategoryIntMap.FirstOrDefault(c => c.Value == CategoryInt).Key;
}
/// <summary>
/// 管线下拉框
/// 初始化包装编号下拉框
/// </summary>
/// <param name="dropName">下拉框名字</param>
/// <param name="isShowPlease">是否显示请选择</param>
/// <param name="dropName">下拉框控件名称</param>
/// <param name="projectid">项目ID</param>
/// <param name="isShowPlease">是否显示"请选择"选项</param>
public static void InitPipelineDownList(FineUIPro.DropDownList dropName, string projectid, bool isShowPlease)
{
dropName.DataValueField = "string";
@ -297,9 +688,10 @@ namespace BLL
}
/// <summary>
/// 形成出库单
/// 形成出库单,将包装状态从未出库更新为已出库
/// </summary>
/// <param name="PackagingManageId"></param>
/// <param name="PackagingManageId">包装管理ID</param>
/// <remarks>仅当包装状态为预出库state_0时才允许更新为已出库state_1</remarks>
public static void PutOutOrder(string PackagingManageId)
{
var model = GetHJGL_PackagingManageById(PackagingManageId);
@ -310,6 +702,10 @@ namespace BLL
}
}
/// <summary>
/// 更新包装管理信息
/// </summary>
/// <param name="newtable">包含更新后信息的包装管理实体</param>
public static void UpdateHJGL_PackagingManage(Model.HJGL_PackagingManage newtable)
{
var db1 = Funs.DB;
@ -334,41 +730,6 @@ namespace BLL
db1.SubmitChanges();
}
}
#endregion Methods
#region Classes
public class PackagingManageItem
{
#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; }
public int? CategoryInt { get; set; }
public string CategoryString { get; set; }
#endregion Properties
}
#endregion Classes
}
}

View File

@ -6,6 +6,14 @@ namespace BLL
{
public static class TrainNumberManageService
{
public enum StateInt
{
= 0, // 未发货
= 1, // 已发货,未验收
= 2, // 已验收
}
private static IQueryable<Model.HJGL_TrainNumberManage> GetByQueryModle(Model.HJGL_TrainNumberManage table)
{
var q = from x in Funs.DB.HJGL_TrainNumberManage select x;

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Report ScriptLanguage="CSharp" ReportInfo.Created="03/13/2022 11:00:20" ReportInfo.Modified="10/20/2025 10:51:41" ReportInfo.CreatorVersion="2017.1.16.0">
<Report ScriptLanguage="CSharp" ReportInfo.Created="03/13/2022 11:00:20" ReportInfo.Modified="10/29/2025 15:37:48" ReportInfo.CreatorVersion="2017.1.16.0">
<ScriptText>using System;
using System.Collections;
using System.Collections.Generic;
@ -42,7 +42,7 @@ namespace FastReport
}
</ScriptText>
<Dictionary>
<MsSqlDataConnection Name="Connection" ConnectionString="rijcmlqvJIqZbrmqGn7L0P56UFhaUHihKXxbhpqie4wmZgM2ymDKry7UxzO5md9ybQlkfKpN2rHYbp9GtH1LDQPa7z2vVu/kEnNnTKeHt9obmaC7TQDh0IvsUBSuzhGZdfAIK7YyBqykCgeZm5rvA6K5b7zHGdA+7pUpJ/9ZLpp1NuxWRFlf1WEwspad7DkFpDk3K8w"/>
<MsSqlDataConnection Name="Connection" ConnectionString="rijcmlqvJIqZbrmqGn7L0P56UFhaUHihKXxbhpqie4wmZgM2ymDKry7UxzO5md9ybQlkfKpN2rHYbp9GtH1LDQPa7z2vVu/kEnNnTKeHt9obmaC7TQDh0IvsUBSuzhGZdfAIK7YyBqykCgeZm5rvA6K5b7zHGdA+7pUpJ/9ZLpp1NuxWREx77N82LqiqfoELU3fqwIZ"/>
<TableDataSource Name="Data" ReferenceName="Data" DataType="System.Int32" Enabled="true">
<Column Name="PipelineComponentId" DataType="System.String"/>
<Column Name="PipelineComponentCode" DataType="System.String"/>

View File

@ -114,6 +114,10 @@
FieldType="String" HeaderText="流水段" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="150px" ColumnID="StackingPosition" DataField="StackingPosition"
FieldType="String" HeaderText="预制工作包" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
</Columns>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">

View File

@ -229,8 +229,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
private List<View_HJGL_InstallData> BindData(int pageIndex, int pageSize, out int totalCount)
{
var baseQuery=from x in Funs.DB.View_HJGL_InstallData
where x.ProjectId == this.CurrUser.LoginProjectId
var baseQuery=from x in Funs.DB.View_HJGL_InstallData
select x;
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
{

View File

@ -1,7 +1,9 @@
using BLL;
using Model;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
namespace FineUIPro.Web.HJGL.PreDesign
{
@ -38,9 +40,15 @@ namespace FineUIPro.Web.HJGL.PreDesign
if (!string.IsNullOrEmpty(PackagingManageId))
{
var model = HJGLPackagingmanageService.GetHJGL_PackagingManageById(PackagingManageId);
HJGL_PackagingManageDetail filter = new HJGL_PackagingManageDetail
{
PackagingManageId = PackagingManageId
};
var packagingDetails = HJGLPackagingmanagedetailService.GetByQueryModle(filter);
drpTypeInt.Enabled = false;
txtPackagingCode.Text = model.PackagingCode;
dropPipelineComponentCode.Values = model.PipelineComponentId?.Split(',');
dropPipelineComponentCode.Values = packagingDetails.Select(x=>x.PipelineComponentId).ToArray();
txtStackingPosition.Text = model.StackingPosition;
drpTrainNumber.SelectedValue = model.TrainNumberId;
drpTypeInt.SelectedValue = model.TypeInt.ToString();
@ -86,8 +94,8 @@ namespace FineUIPro.Web.HJGL.PreDesign
if (string.IsNullOrEmpty(PackagingManageId))
{
Model.HJGL_PackagingManage table = new Model.HJGL_PackagingManage();
table.PackagingManageId = SQLHelper.GetNewID();
PackagingManageId = SQLHelper.GetNewID();
table.PackagingManageId = PackagingManageId;
table.PackagingCode = txtPackagingCode.Text;
table.ProjectId = this.CurrUser.LoginProjectId;
table.StackingPosition = txtStackingPosition.Text;
@ -102,10 +110,32 @@ namespace FineUIPro.Web.HJGL.PreDesign
if (drpTypeInt.SelectedValue == ((int)HJGLPackagingmanageService.TypeInt.).ToString())
{
table.PipelineComponentId = string.Join(",", dropPipelineComponentCode.Values);
var newDetailList = new List<Model.HJGL_PackagingManageDetail>();
foreach (var item in dropPipelineComponentCode.Values)
{
var ComponentModel = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(item);
if (ComponentModel != null)
{
var model = new Model.HJGL_PackagingManageDetail()
{
Id = SQLHelper.GetNewID(),
PackagingManageId = this.PackagingManageId,
PipelineId = ComponentModel.PipelineId,
PipelineComponentId = item,
CreateTime = DateTime.Now,
CreateUser = this.CurrUser.PersonId,
};
newDetailList.Add(model);
}
}
HJGLPackagingmanagedetailService.DeleteByPackagingManageId(this.PackagingManageId);
HJGLPackagingmanagedetailService.AddBulk(newDetailList);
}
BLL.HJGLPackagingmanageService.AddHJGL_PackagingManage(table);
PackagingManageId = table.PackagingManageId;
}
else
{

View File

@ -43,37 +43,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
var detailList = HJGLPackagingmanageService.GetPackagingDetailById(PackagingManageId);
Grid1.RecordCount = detailList.Count();
Grid1.DataSource = detailList;
Grid1.DataBind();
/* if (pack.TypeInt == (int)HJGL_PackagingmanageService.TypeInt.)
{
DataTable tb = BLL.HJGL_PackagingmanageService.GetPackagingDetailById(PackagingManageId);
Grid1.RecordCount = tb.Rows.Count;
tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
else
{
var result = HJGLPackagingmanagedetailService.GetPackagingData(PackagingManageId).ToList();
var detailList = from x in result
select new
{
PipelineComponentId = x.Id,
PipelineComponentCode = x.MaterialCode,
num = x.Number,
CU = x.MaterialUnit,
UnitWorkName = x.UnitWorkId == null ? "" : UnitWorkService.GetNameById(x.UnitWorkId),
x.FlowingSection,
};
Grid1.RecordCount = detailList.Count();
Grid1.DataSource = detailList;
Grid1.DataBind();
}*/
Grid1.DataBind();
}
#endregion

View File

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class PackagingManageOutput
{
#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; }
public int? CategoryInt { get; set; }
public string CategoryString { get; set; }
#endregion Properties
}
}

View File

@ -12267,7 +12267,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ApproveIdea", DbType="NVarChar(2000)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ApproveIdea", DbType="NVarChar(200)")]
public string ApproveIdea
{
get
@ -97820,10 +97820,10 @@ namespace Model
private string _TrainNumber;
private System.Nullable<int> _TypeInt;
private string _TrainNumberId;
private System.Nullable<int> _TypeInt;
private string _CompileMan;
private System.Nullable<System.DateTime> _CompileDate;
@ -97858,10 +97858,10 @@ namespace Model
partial void OnReceiveDateChanged();
partial void OnTrainNumberChanging(string value);
partial void OnTrainNumberChanged();
partial void OnTypeIntChanging(System.Nullable<int> value);
partial void OnTypeIntChanged();
partial void OnTrainNumberIdChanging(string value);
partial void OnTrainNumberIdChanged();
partial void OnTypeIntChanging(System.Nullable<int> value);
partial void OnTypeIntChanged();
partial void OnCompileManChanging(string value);
partial void OnCompileManChanged();
partial void OnCompileDateChanging(System.Nullable<System.DateTime> value);
@ -98115,26 +98115,6 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TypeInt", DbType="Int")]
public System.Nullable<int> TypeInt
{
get
{
return this._TypeInt;
}
set
{
if ((this._TypeInt != value))
{
this.OnTypeIntChanging(value);
this.SendPropertyChanging();
this._TypeInt = value;
this.SendPropertyChanged("TypeInt");
this.OnTypeIntChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TrainNumberId", DbType="VarChar(50)")]
public string TrainNumberId
{
@ -98155,6 +98135,26 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TypeInt", DbType="Int")]
public System.Nullable<int> TypeInt
{
get
{
return this._TypeInt;
}
set
{
if ((this._TypeInt != value))
{
this.OnTypeIntChanging(value);
this.SendPropertyChanging();
this._TypeInt = value;
this.SendPropertyChanged("TypeInt");
this.OnTypeIntChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompileMan", DbType="NVarChar(50)")]
public string CompileMan
{
@ -109402,7 +109402,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Rectification", DbType="NVarChar(500)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Rectification", DbType="NVarChar(50)")]
public string Rectification
{
get
@ -109528,7 +109528,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Measures", DbType="NVarChar(500)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Measures", DbType="NVarChar(50)")]
public string Measures
{
get
@ -162243,7 +162243,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AttentPerson", DbType="NVarChar(3000)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AttentPerson", DbType="NVarChar(500)")]
public string AttentPerson
{
get
@ -193226,7 +193226,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectDescription", DbType="VarChar(MAX)", UpdateCheck=UpdateCheck.Never)]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectDescription", DbType="VarChar(255)")]
public string ProjectDescription
{
get
@ -193346,7 +193346,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CalculationRule", DbType="VarChar(MAX)", UpdateCheck=UpdateCheck.Never)]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CalculationRule", DbType="VarChar(255)")]
public string CalculationRule
{
get
@ -193406,7 +193406,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ConstructionSubcontractor", DbType="VarChar(100)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ConstructionSubcontractor", DbType="VarChar(50)")]
public string ConstructionSubcontractor
{
get
@ -193790,7 +193790,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPackageEstimate", DbType="Decimal(18,3)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPackageEstimate", DbType="Decimal(18,2)")]
public System.Nullable<decimal> WorkPackageEstimate
{
get
@ -194095,16 +194095,6 @@ namespace Model
private string _ProjectId;
private string _ContractId;
private string _OrderCode;
private System.Nullable<System.DateTime> _OrderInDate;
private System.Nullable<System.DateTime> _OrderOutDate;
private string _MaterialRequisitionUnit;
private System.Nullable<int> _State;
private string _InvoiceCode;
@ -194133,6 +194123,16 @@ namespace Model
private string _CreateUser;
private string _ContractId;
private System.Nullable<System.DateTime> _OrderInDate;
private string _OrderCode;
private System.Nullable<System.DateTime> _OrderOutDate;
private string _MaterialRequisitionUnit;
#region
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
@ -194141,16 +194141,6 @@ namespace Model
partial void OnInvoiceIdChanged();
partial void OnProjectIdChanging(string value);
partial void OnProjectIdChanged();
partial void OnContractIdChanging(string value);
partial void OnContractIdChanged();
partial void OnOrderCodeChanging(string value);
partial void OnOrderCodeChanged();
partial void OnOrderInDateChanging(System.Nullable<System.DateTime> value);
partial void OnOrderInDateChanged();
partial void OnOrderOutDateChanging(System.Nullable<System.DateTime> value);
partial void OnOrderOutDateChanged();
partial void OnMaterialRequisitionUnitChanging(string value);
partial void OnMaterialRequisitionUnitChanged();
partial void OnStateChanging(System.Nullable<int> value);
partial void OnStateChanged();
partial void OnInvoiceCodeChanging(string value);
@ -194179,6 +194169,16 @@ namespace Model
partial void OnCreateDateChanged();
partial void OnCreateUserChanging(string value);
partial void OnCreateUserChanged();
partial void OnContractIdChanging(string value);
partial void OnContractIdChanged();
partial void OnOrderInDateChanging(System.Nullable<System.DateTime> value);
partial void OnOrderInDateChanged();
partial void OnOrderCodeChanging(string value);
partial void OnOrderCodeChanged();
partial void OnOrderOutDateChanging(System.Nullable<System.DateTime> value);
partial void OnOrderOutDateChanged();
partial void OnMaterialRequisitionUnitChanging(string value);
partial void OnMaterialRequisitionUnitChanged();
#endregion
public PHTGL_Invoice()
@ -194226,106 +194226,6 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContractId", DbType="NVarChar(50)")]
public string ContractId
{
get
{
return this._ContractId;
}
set
{
if ((this._ContractId != value))
{
this.OnContractIdChanging(value);
this.SendPropertyChanging();
this._ContractId = value;
this.SendPropertyChanged("ContractId");
this.OnContractIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderCode", DbType="NVarChar(50)")]
public string OrderCode
{
get
{
return this._OrderCode;
}
set
{
if ((this._OrderCode != value))
{
this.OnOrderCodeChanging(value);
this.SendPropertyChanging();
this._OrderCode = value;
this.SendPropertyChanged("OrderCode");
this.OnOrderCodeChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderInDate", DbType="Date")]
public System.Nullable<System.DateTime> OrderInDate
{
get
{
return this._OrderInDate;
}
set
{
if ((this._OrderInDate != value))
{
this.OnOrderInDateChanging(value);
this.SendPropertyChanging();
this._OrderInDate = value;
this.SendPropertyChanged("OrderInDate");
this.OnOrderInDateChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderOutDate", DbType="Date")]
public System.Nullable<System.DateTime> OrderOutDate
{
get
{
return this._OrderOutDate;
}
set
{
if ((this._OrderOutDate != value))
{
this.OnOrderOutDateChanging(value);
this.SendPropertyChanging();
this._OrderOutDate = value;
this.SendPropertyChanged("OrderOutDate");
this.OnOrderOutDateChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialRequisitionUnit", DbType="NVarChar(100)")]
public string MaterialRequisitionUnit
{
get
{
return this._MaterialRequisitionUnit;
}
set
{
if ((this._MaterialRequisitionUnit != value))
{
this.OnMaterialRequisitionUnitChanging(value);
this.SendPropertyChanging();
this._MaterialRequisitionUnit = value;
this.SendPropertyChanged("MaterialRequisitionUnit");
this.OnMaterialRequisitionUnitChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_State", DbType="Int")]
public System.Nullable<int> State
{
@ -194606,6 +194506,106 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContractId", DbType="NVarChar(50)")]
public string ContractId
{
get
{
return this._ContractId;
}
set
{
if ((this._ContractId != value))
{
this.OnContractIdChanging(value);
this.SendPropertyChanging();
this._ContractId = value;
this.SendPropertyChanged("ContractId");
this.OnContractIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderInDate", DbType="Date")]
public System.Nullable<System.DateTime> OrderInDate
{
get
{
return this._OrderInDate;
}
set
{
if ((this._OrderInDate != value))
{
this.OnOrderInDateChanging(value);
this.SendPropertyChanging();
this._OrderInDate = value;
this.SendPropertyChanged("OrderInDate");
this.OnOrderInDateChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderCode", DbType="NVarChar(50)")]
public string OrderCode
{
get
{
return this._OrderCode;
}
set
{
if ((this._OrderCode != value))
{
this.OnOrderCodeChanging(value);
this.SendPropertyChanging();
this._OrderCode = value;
this.SendPropertyChanged("OrderCode");
this.OnOrderCodeChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OrderOutDate", DbType="Date")]
public System.Nullable<System.DateTime> OrderOutDate
{
get
{
return this._OrderOutDate;
}
set
{
if ((this._OrderOutDate != value))
{
this.OnOrderOutDateChanging(value);
this.SendPropertyChanging();
this._OrderOutDate = value;
this.SendPropertyChanged("OrderOutDate");
this.OnOrderOutDateChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialRequisitionUnit", DbType="NVarChar(100)")]
public string MaterialRequisitionUnit
{
get
{
return this._MaterialRequisitionUnit;
}
set
{
if ((this._MaterialRequisitionUnit != value))
{
this.OnMaterialRequisitionUnitChanging(value);
this.SendPropertyChanging();
this._MaterialRequisitionUnit = value;
this.SendPropertyChanged("MaterialRequisitionUnit");
this.OnMaterialRequisitionUnitChanged();
}
}
}
public event PropertyChangingEventHandler PropertyChanging;
public event PropertyChangedEventHandler PropertyChanged;
@ -290638,6 +290638,8 @@ namespace Model
private string _ProjectId;
private string _StackingPosition;
public View_HJGL_InstallData()
{
}
@ -290817,6 +290819,22 @@ namespace Model
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StackingPosition", DbType="NVarChar(50)")]
public string StackingPosition
{
get
{
return this._StackingPosition;
}
set
{
if ((this._StackingPosition != value))
{
this._StackingPosition = value;
}
}
}
}
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.View_HJGL_JointInfoQuery")]
@ -314162,7 +314180,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="NVarChar(200)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", DbType="NVarChar(50)")]
public string Name
{
get
@ -314739,7 +314757,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(200)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(50)")]
public string PackageContent
{
get
@ -314930,7 +314948,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(200)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(50)")]
public string PackageContent
{
get
@ -320269,7 +320287,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(200)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(50)")]
public string PackageContent
{
get
@ -321741,7 +321759,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(200)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PackageContent", DbType="NVarChar(50)")]
public string PackageContent
{
get
@ -331292,7 +331310,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContractNo", DbType="NVarChar(1500)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContractNo", DbType="NVarChar(500)")]
public string ContractNo
{
get
@ -331312,7 +331330,7 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitWorks", DbType="NVarChar(1500)")]
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UnitWorks", DbType="NVarChar(500)")]
public string UnitWorks
{
get

View File

@ -238,6 +238,7 @@
<Compile Include="HJGL\PreDesign\Material\MaterialStockItem.cs" />
<Compile Include="APIItem\HJGL\PackagingManageItem.cs" />
<Compile Include="HJGL\PreDesign\PackagingManage\PackagingManageInput.cs" />
<Compile Include="HJGL\PreDesign\PackagingManage\PackagingManageOutput.cs" />
<Compile Include="HJGL\PreDesign\PackagingManage\PackagingManagePrintOutput.cs" />
<Compile Include="HJGL\PreDesign\PipelineComponent\PipelineComponentPrintDto.cs" />
<Compile Include="HJGL\PipeLineIdCodeItem.cs" />

View File

@ -14,6 +14,29 @@ namespace WebAPI.Controllers
/// </summary>
public class PackagingManageController : ApiController
{
#region Methods
/// <summary>
/// 删除包装与预制组件的关联
/// </summary>
/// <param name="pipelineComponentId"></param>
/// <returns></returns>
[HttpGet]
public Model.ResponeData DeletePipelineComponentFromPackaging(string pipelineComponentId)
{
var responeData = new Model.ResponeData();
try
{
HJGLPackagingmanageService.DeletePipelineComponentFromPackaging(pipelineComponentId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
/// <summary>
/// 获取指定包装信息
/// </summary>
@ -26,7 +49,32 @@ namespace WebAPI.Controllers
var responeData = new Model.ResponeData();
try
{
responeData.data = BLL.APIPackagingManageService.GetPackagingInformationById(projectId, personId, packagingManageId);
responeData.data = BLL.HJGLPackagingmanageService.GetPackagingInformationById(projectId, personId, packagingManageId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
/// <summary>
/// 获取包装信息列表
/// </summary>
/// <param name="filter">过滤条件</param>
/// <param name="pagesize">每页数量</param>
/// <param name="pageindex">页码从1开始</param>
/// <returns>包装信息分页列表</returns>
public Model.ResponeData GetPackagingInformationList([FromUri] PackagingManageInput filter, int pagesize, int pageindex)
{
var responeData = new Model.ResponeData();
try
{
var getDataList = BLL.HJGLPackagingmanageService.GetPackagingManageList(filter, pageindex, pagesize, out int totalCount);
responeData.data = new { totalCount, getDataList };
}
catch (Exception ex)
{
@ -47,7 +95,7 @@ namespace WebAPI.Controllers
var responeData = new Model.ResponeData();
try
{
responeData.data = BLL.APIPackagingManageService.GetNewPackagingCode(projectId);
responeData.data = BLL.HJGLPackagingmanageService.GetNewPackagingCode(projectId);
}
catch (Exception ex)
{
@ -56,32 +104,6 @@ namespace WebAPI.Controllers
}
return responeData;
}
/// <summary>
/// 获取包装信息列表
/// </summary>
/// <param name="filter">过滤条件</param>
/// <param name="pagesize">每页数量</param>
/// <param name="pageindex">页码从1开始</param>
/// <returns>包装信息分页列表</returns>
public Model.ResponeData GetPackagingInformationList([FromUri]PackagingManageInput filter, int pagesize, int pageindex)
{
var responeData = new Model.ResponeData();
try
{
var getDataList = BLL.APIPackagingManageService.GetPackagingManageList(filter, pageindex, pagesize, out int totalCount);
responeData.data = new { totalCount, getDataList };
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
/// <summary>
/// 包装到场验收
/// </summary>
@ -93,7 +115,7 @@ namespace WebAPI.Controllers
var responeData = new Model.ResponeData();
try
{
BLL.APIPackagingManageService.GetPackingInfoConfirmArrival(packagingManageId, PersonId);
BLL.HJGLPackagingmanageService.GetPackingInfoConfirmArrival(packagingManageId, PersonId);
}
catch (Exception ex)
{
@ -115,7 +137,7 @@ namespace WebAPI.Controllers
var responeData = new Model.ResponeData();
try
{
BLL.APIPackagingManageService.getSavePackagingInformationById(packagingManageId, PipelineComponentIds);
BLL.HJGLPackagingmanageService.getSavePackagingInformationById(packagingManageId, PipelineComponentIds);
}
catch (Exception ex)
{
@ -125,6 +147,7 @@ namespace WebAPI.Controllers
return responeData;
}
/// <summary>
/// 新增或更新包装信息Id为空则新增否则更新返回创建或更新后的Id。
/// </summary>
@ -136,7 +159,7 @@ namespace WebAPI.Controllers
var responeData = new Model.ResponeData();
try
{
var id = APIPackagingManageService.AddOrUpdatePackaging(model);
var id = HJGLPackagingmanageService.AddOrUpdatePackaging(model);
responeData.data = new { id };
}
catch (Exception ex)
@ -155,6 +178,7 @@ namespace WebAPI.Controllers
/// <returns>操作结果</returns>
[HttpGet]
public Model.ResponeData SavePackingInformation(string packagingManageId, string trainNumberId)
{
var responeData = new Model.ResponeData();
try
@ -182,6 +206,29 @@ namespace WebAPI.Controllers
}
return responeData;
}
/// <summary>
/// 添加包装与预制组件关联关系
/// </summary>
/// <param name="packagingManageId"></param>
/// <param name="pipelineComponentId"></param>
/// <returns></returns>
[HttpGet]
public Model.ResponeData SavePipelineComponentToPackaging(string packagingManageId, string pipelineComponentId)
{
var responeData = new Model.ResponeData();
try
{
HJGLPackagingmanageService.AddPipelineComponentToPackaging(packagingManageId, pipelineComponentId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion Methods
}
}