2025-10-29 17:00:27 +08:00
|
|
|
|
using FastReport.DevComponents.DotNetBar;
|
|
|
|
|
|
using FineUIPro;
|
|
|
|
|
|
using Model;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Linq;
|
2025-10-29 17:00:27 +08:00
|
|
|
|
using WIA;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
|
|
|
|
|
|
namespace BLL
|
|
|
|
|
|
{
|
2025-05-12 19:05:13 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 包装管理服务类
|
|
|
|
|
|
/// </summary>
|
2025-09-24 17:31:28 +08:00
|
|
|
|
public static class HJGLPackagingmanageService
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2025-09-24 17:31:28 +08:00
|
|
|
|
#region Fields
|
2025-01-07 19:00:48 +08:00
|
|
|
|
|
2025-10-29 17:00:27 +08:00
|
|
|
|
public static Dictionary<string, int> CategoryIntMap = new Dictionary<string, int>
|
|
|
|
|
|
{
|
|
|
|
|
|
{ "打捆" ,(int)CategoryInt.打捆},
|
|
|
|
|
|
{ "装箱" ,(int)CategoryInt.装箱},
|
|
|
|
|
|
{ "散装" ,(int)CategoryInt.散装},
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 未到场
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static int state_0 = 0;
|
2025-05-12 19:05:13 +08:00
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 已发货
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static int state_1 = 1;
|
2025-05-12 19:05:13 +08:00
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 已到场
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static int state_2 = 2;
|
2025-05-12 19:05:13 +08:00
|
|
|
|
|
2025-09-24 17:31:28 +08:00
|
|
|
|
public static Dictionary<string, int> TypeIntMap = new Dictionary<string, int>
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2025-09-24 17:31:28 +08:00
|
|
|
|
{ "预制组件" ,(int)TypeInt.预制组件},
|
|
|
|
|
|
{ "预制散件" ,(int)TypeInt.预制散件},
|
|
|
|
|
|
{ "其他材料" ,(int)TypeInt.其他材料},
|
|
|
|
|
|
};
|
2025-10-29 17:00:27 +08:00
|
|
|
|
|
2025-09-24 17:31:28 +08:00
|
|
|
|
#endregion Fields
|
|
|
|
|
|
|
|
|
|
|
|
#region Enums
|
2022-09-05 16:36:31 +08:00
|
|
|
|
|
2025-10-24 10:04:03 +08:00
|
|
|
|
public enum CategoryInt : int
|
|
|
|
|
|
{
|
|
|
|
|
|
打捆 = 10,
|
|
|
|
|
|
装箱 = 20,
|
|
|
|
|
|
散装 = 30,
|
|
|
|
|
|
}
|
2025-05-12 19:05:13 +08:00
|
|
|
|
|
2025-10-29 17:00:27 +08:00
|
|
|
|
public enum TypeInt : int
|
|
|
|
|
|
{
|
|
|
|
|
|
预制组件 = 10,
|
|
|
|
|
|
预制散件 = 20,
|
|
|
|
|
|
其他材料 = 30,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-24 17:31:28 +08:00
|
|
|
|
#endregion Enums
|
|
|
|
|
|
|
|
|
|
|
|
#region Methods
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 新增实体
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="newtable"></param>
|
|
|
|
|
|
public static void AddHJGL_PackagingManage(Model.HJGL_PackagingManage newtable)
|
2025-05-08 18:38:55 +08:00
|
|
|
|
{
|
2025-09-24 17:31:28 +08:00
|
|
|
|
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,
|
2025-10-24 10:04:03 +08:00
|
|
|
|
CategoryInt = newtable.CategoryInt,
|
2025-09-24 17:31:28 +08:00
|
|
|
|
CompileMan = newtable.CompileMan,
|
|
|
|
|
|
CompileDate = newtable.CompileDate
|
|
|
|
|
|
};
|
|
|
|
|
|
var db1 = Funs.DB;
|
|
|
|
|
|
db1.HJGL_PackagingManage.InsertOnSubmit(table);
|
|
|
|
|
|
db1.SubmitChanges();
|
|
|
|
|
|
}
|
2025-05-12 19:05:13 +08:00
|
|
|
|
|
2025-10-29 17:00:27 +08:00
|
|
|
|
/// <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>
|
2025-09-24 17:31:28 +08:00
|
|
|
|
public static void DeleteHJGL_PackagingManageById(string PackagingManageId)
|
2025-05-12 19:05:13 +08:00
|
|
|
|
{
|
2025-09-24 17:31:28 +08:00
|
|
|
|
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();
|
|
|
|
|
|
}
|
2025-05-12 19:05:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-29 17:00:27 +08:00
|
|
|
|
/// <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>
|
2022-09-05 16:36:31 +08:00
|
|
|
|
public static Model.HJGL_PackagingManage GetHJGL_PackagingManageById(string PackagingManageId)
|
|
|
|
|
|
{
|
2023-10-10 19:13:59 +08:00
|
|
|
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
|
|
|
|
|
{
|
|
|
|
|
|
return db.HJGL_PackagingManage.FirstOrDefault(x => x.PackagingManageId == PackagingManageId);
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
2025-10-29 17:00:27 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取包装中所有组件的最早计划开始日期
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="PackagingManageId">包装管理ID</param>
|
|
|
|
|
|
/// <returns>最早计划开始日期字符串,如果没有组件则返回空字符串</returns>
|
2022-11-01 17:11:30 +08:00
|
|
|
|
public static string GetMinPlanStartDate(string PackagingManageId)
|
|
|
|
|
|
{
|
|
|
|
|
|
string PlanStartDate = "";
|
2025-08-28 15:41:32 +08:00
|
|
|
|
var tb = GetPackagingDetailById(PackagingManageId);
|
|
|
|
|
|
if (tb == null || tb.Count == 0)
|
2024-10-17 00:01:35 +08:00
|
|
|
|
{
|
|
|
|
|
|
return PlanStartDate;
|
|
|
|
|
|
}
|
2025-08-28 15:41:32 +08:00
|
|
|
|
PlanStartDate = tb.OrderBy(x => x.PlanStartDate).FirstOrDefault()?.PlanStartDate.ToString();
|
2022-11-01 17:11:30 +08:00
|
|
|
|
return PlanStartDate;
|
|
|
|
|
|
}
|
2025-05-12 19:05:13 +08:00
|
|
|
|
|
2025-10-29 17:00:27 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 根据项目ID生成新的包装编号
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="projectid">项目ID</param>
|
|
|
|
|
|
/// <returns>新包装编号,格式为:项目编号-日期-序号(如:PROJ20241029-001)</returns>
|
2025-09-24 17:31:28 +08:00
|
|
|
|
public static string GetNewPackagingCode(string projectid)
|
2022-11-01 17:11:30 +08:00
|
|
|
|
{
|
2025-09-24 17:31:28 +08:00
|
|
|
|
string code = ProjectService.GetProjectCodeByProjectId(projectid) + "-" + string.Format("{0:yyyyMMdd}", DateTime.Now) + "-";
|
2025-05-08 18:38:55 +08:00
|
|
|
|
|
2025-09-24 17:31:28 +08:00
|
|
|
|
var q = GetPackagingManageList(projectid, code);
|
|
|
|
|
|
if (q.Total > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
code = code + (q.Total + 1).ToString().PadLeft(3, '0');
|
2022-11-01 17:11:30 +08:00
|
|
|
|
}
|
2025-09-24 17:31:28 +08:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
code = code + "001";
|
|
|
|
|
|
}
|
|
|
|
|
|
return code;
|
2025-05-12 19:05:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// <summary>
|
2025-09-24 17:31:28 +08:00
|
|
|
|
/// 根据项目号获取包装编号历史记录
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// </summary>
|
2025-10-29 17:00:27 +08:00
|
|
|
|
/// <param name="projectid">项目ID</param>
|
|
|
|
|
|
/// <returns>该项目的所有包装编号列表(去重)</returns>
|
2025-09-24 17:31:28 +08:00
|
|
|
|
public static List<string> GetPackagingCode(string projectid)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2025-09-24 17:31:28 +08:00
|
|
|
|
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;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
2025-05-12 19:05:13 +08:00
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// <summary>
|
2025-10-29 17:00:27 +08:00
|
|
|
|
/// 根据主键获取装箱明细,用于打印输出
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// </summary>
|
2025-10-29 17:00:27 +08:00
|
|
|
|
/// <param name="PackagingManageId">包装管理ID</param>
|
|
|
|
|
|
/// <returns>包装打印输出列表,包含组件信息、单位工程、计划开始日期等</returns>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// 根据包装类型返回不同的数据:
|
|
|
|
|
|
/// - 预制组件:从HJGL_PackagingManageDetail表获取关联的组件ID,查询详细的组件信息
|
|
|
|
|
|
/// - 预制散件/其他材料:从HJGL_PackagingManageDetail表获取散装材料信息
|
|
|
|
|
|
/// </remarks>
|
2025-08-28 15:41:32 +08:00
|
|
|
|
public static List<Model.PackagingManagePrintOutput> GetPackagingDetailById(string PackagingManageId)
|
|
|
|
|
|
{
|
|
|
|
|
|
var model = GetHJGL_PackagingManageById(PackagingManageId);
|
|
|
|
|
|
var result = new List<Model.PackagingManagePrintOutput>();
|
2025-09-24 17:31:28 +08:00
|
|
|
|
if (model.TypeInt == (int)HJGLPackagingmanageService.TypeInt.预制组件)
|
2025-08-28 15:41:32 +08:00
|
|
|
|
{
|
2025-10-29 17:00:27 +08:00
|
|
|
|
// 从子表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)
|
2025-09-24 17:31:28 +08:00
|
|
|
|
return new List<Model.PackagingManagePrintOutput>();
|
2025-10-29 17:00:27 +08:00
|
|
|
|
|
2025-08-28 15:41:32 +08:00
|
|
|
|
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()
|
2025-10-29 17:00:27 +08:00
|
|
|
|
where PipelineComponentIdList.Contains(com.PipelineComponentId)
|
2025-08-28 15:41:32 +08:00
|
|
|
|
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 = "个",
|
2025-10-29 17:00:27 +08:00
|
|
|
|
//FlowingSection = pipe != null ? pipe.FlowingSection : ""
|
|
|
|
|
|
FlowingSection = model.StackingPosition
|
2025-08-28 15:41:32 +08:00
|
|
|
|
};
|
|
|
|
|
|
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),
|
2025-09-24 17:31:28 +08:00
|
|
|
|
FlowingSection = model.StackingPosition,
|
2025-08-28 15:41:32 +08:00
|
|
|
|
};
|
|
|
|
|
|
result = detailList.ToList();
|
|
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
2025-09-24 17:31:28 +08:00
|
|
|
|
|
2025-10-29 17:00:27 +08:00
|
|
|
|
/// <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>
|
2025-05-12 19:05:13 +08:00
|
|
|
|
public static List<Model.HJGL_PackagingManage> GetPackagingManage(string trainNumberId)
|
|
|
|
|
|
{
|
|
|
|
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
|
|
var q = (from x in db.HJGL_PackagingManage
|
2025-09-24 17:31:28 +08:00
|
|
|
|
where x.TrainNumberId == trainNumberId
|
2025-05-12 19:05:13 +08:00
|
|
|
|
select x).Distinct().ToList();
|
|
|
|
|
|
return q;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-29 17:00:27 +08:00
|
|
|
|
public static (List<PackagingManageOutput> Data, int Total) GetPackagingManageList(string projectId, string PackagingCode, int pageIndex = 0, int pageSize = 20)
|
2025-09-24 17:31:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
2025-05-12 19:05:13 +08:00
|
|
|
|
{
|
2025-09-24 17:31:28 +08:00
|
|
|
|
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()
|
|
|
|
|
|
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))
|
2025-10-29 17:00:27 +08:00
|
|
|
|
select new PackagingManageOutput
|
2025-09-24 17:31:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
PackagingManageId = x.PackagingManageId,
|
|
|
|
|
|
PackagingCode = x.PackagingCode,
|
|
|
|
|
|
ProjectName = n.ProjectName,
|
|
|
|
|
|
ContactName = train.ContactName,
|
|
|
|
|
|
ContactPhone = train.ContactPhone,
|
|
|
|
|
|
DriverName = train.DriverName,
|
|
|
|
|
|
DriverPhone = train.DriverPhone,
|
|
|
|
|
|
LicensePlateNumber = train.LicensePlateNumber,
|
|
|
|
|
|
StackingPosition = x.StackingPosition,
|
|
|
|
|
|
State = x.State,
|
|
|
|
|
|
TypeInt = x.TypeInt,
|
2025-10-24 10:04:03 +08:00
|
|
|
|
CategoryInt = x.CategoryInt,
|
2025-09-24 17:31:28 +08:00
|
|
|
|
TypeString = GetTypeString(x.TypeInt),
|
2025-10-24 10:04:03 +08:00
|
|
|
|
CategoryString = GetCategoryString(x.CategoryInt),
|
2025-09-24 17:31:28 +08:00
|
|
|
|
ReceiveMan = train.ContactName,//t.PersonName,
|
|
|
|
|
|
ReceiveDate = x.ReceiveDate.HasValue ? string.Format("{0:g}", x.ReceiveDate) : "",
|
|
|
|
|
|
PlanStartDate = GetMinPlanStartDate(x.PackagingManageId),
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
|
|
var pagedData = baseQuery
|
|
|
|
|
|
.OrderByDescending(x => x.Code)
|
|
|
|
|
|
.Skip((pageIndex) * pageSize)
|
|
|
|
|
|
.Take(pageSize)
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
// 获取总记录数(延迟计数优化)
|
|
|
|
|
|
var totalCount = baseQuery.Count();
|
|
|
|
|
|
return (pagedData, totalCount);
|
2025-05-12 19:05:13 +08:00
|
|
|
|
}
|
2025-09-24 17:31:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-29 17:00:27 +08:00
|
|
|
|
/// <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>
|
2025-09-24 17:31:28 +08:00
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-29 17:00:27 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 根据类型整数值获取类型字符串描述
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="TypeInt">类型整数值(10:预制组件, 20:预制散件, 30:其他材料)</param>
|
|
|
|
|
|
/// <returns>类型字符串描述,如果未找到则返回空字符串</returns>
|
2025-09-24 17:31:28 +08:00
|
|
|
|
public static string GetTypeString(int? TypeInt)
|
|
|
|
|
|
{
|
|
|
|
|
|
return TypeIntMap.FirstOrDefault(c => c.Value == TypeInt).Key;
|
|
|
|
|
|
}
|
2025-10-29 17:00:27 +08:00
|
|
|
|
|
2025-09-24 17:31:28 +08:00
|
|
|
|
/// <summary>
|
2025-10-29 17:00:27 +08:00
|
|
|
|
/// 初始化包装编号下拉框
|
2025-09-24 17:31:28 +08:00
|
|
|
|
/// </summary>
|
2025-10-29 17:00:27 +08:00
|
|
|
|
/// <param name="dropName">下拉框控件名称</param>
|
|
|
|
|
|
/// <param name="projectid">项目ID</param>
|
|
|
|
|
|
/// <param name="isShowPlease">是否显示"请选择"选项</param>
|
2025-09-24 17:31:28 +08:00
|
|
|
|
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)
|
2025-05-12 19:05:13 +08:00
|
|
|
|
{
|
2025-09-24 17:31:28 +08:00
|
|
|
|
Funs.FineUIPleaseSelect(dropName);
|
2025-05-12 19:05:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// <summary>
|
2025-10-29 17:00:27 +08:00
|
|
|
|
/// 形成出库单,将包装状态从未出库更新为已出库
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// </summary>
|
2025-10-29 17:00:27 +08:00
|
|
|
|
/// <param name="PackagingManageId">包装管理ID</param>
|
|
|
|
|
|
/// <remarks>仅当包装状态为预出库(state_0)时才允许更新为已出库(state_1)</remarks>
|
2025-09-24 17:31:28 +08:00
|
|
|
|
public static void PutOutOrder(string PackagingManageId)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2025-09-24 17:31:28 +08:00
|
|
|
|
var model = GetHJGL_PackagingManageById(PackagingManageId);
|
|
|
|
|
|
if (model.State == state_0)
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2025-09-24 17:31:28 +08:00
|
|
|
|
model.State = state_1;
|
|
|
|
|
|
UpdateHJGL_PackagingManage(model);
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-29 17:00:27 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 更新包装管理信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="newtable">包含更新后信息的包装管理实体</param>
|
2022-09-05 16:36:31 +08:00
|
|
|
|
public static void UpdateHJGL_PackagingManage(Model.HJGL_PackagingManage newtable)
|
|
|
|
|
|
{
|
2025-01-07 19:00:48 +08:00
|
|
|
|
var db1 = Funs.DB;
|
|
|
|
|
|
Model.HJGL_PackagingManage table = db1.HJGL_PackagingManage.FirstOrDefault(x => x.PackagingManageId == newtable.PackagingManageId);
|
2022-09-05 16:36:31 +08:00
|
|
|
|
if (table != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
table.PackagingManageId = newtable.PackagingManageId;
|
|
|
|
|
|
table.PackagingCode = newtable.PackagingCode;
|
|
|
|
|
|
table.ProjectId = newtable.ProjectId;
|
|
|
|
|
|
table.PipelineComponentId = newtable.PipelineComponentId;
|
|
|
|
|
|
table.StackingPosition = newtable.StackingPosition;
|
|
|
|
|
|
table.State = newtable.State;
|
|
|
|
|
|
table.ContactName = newtable.ContactName;
|
|
|
|
|
|
table.ContactPhone = newtable.ContactPhone;
|
|
|
|
|
|
table.Remark = newtable.Remark;
|
2023-11-29 18:02:03 +08:00
|
|
|
|
table.ReceiveMan = newtable.ReceiveMan;
|
|
|
|
|
|
table.ReceiveDate = newtable.ReceiveDate;
|
2024-09-28 16:59:44 +08:00
|
|
|
|
table.TrainNumber = newtable.TrainNumber;
|
2025-05-08 18:38:55 +08:00
|
|
|
|
table.TrainNumberId = newtable.TrainNumberId;
|
|
|
|
|
|
table.TypeInt = newtable.TypeInt;
|
2025-10-24 10:04:03 +08:00
|
|
|
|
table.CategoryInt = newtable.CategoryInt;
|
2025-01-07 19:00:48 +08:00
|
|
|
|
db1.SubmitChanges();
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-09-24 17:31:28 +08:00
|
|
|
|
#endregion Methods
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|