20260320
This commit is contained in:
@@ -133,6 +133,7 @@
|
||||
<Compile Include="API\HSSE\APITrainingTaskService.cs" />
|
||||
<Compile Include="API\HSSE\APITrainRecordService.cs" />
|
||||
<Compile Include="BaseInfo\ActivityTypeService.cs" />
|
||||
<Compile Include="BaseInfo\MaterialUnitService.cs" />
|
||||
<Compile Include="BaseInfo\QualificationService.cs" />
|
||||
<Compile Include="BaseInfo\ReceivingDocTypeService.cs" />
|
||||
<Compile Include="BaseInfo\SuperviseCheckTypeService.cs" />
|
||||
@@ -484,6 +485,7 @@
|
||||
<Compile Include="HSSE\InApproveManager\GeneralEquipmentInService.cs" />
|
||||
<Compile Include="HSSE\InApproveManager\GeneralEquipmentOutItemService.cs" />
|
||||
<Compile Include="HSSE\InApproveManager\GeneralEquipmentOutService.cs" />
|
||||
<Compile Include="HSSE\InApproveManager\MaterialInAndOutRecordService.cs" />
|
||||
<Compile Include="HSSE\InformationProject\ConstructionStandardIdentifyService.cs" />
|
||||
<Compile Include="HSSE\InformationProject\ConstructionStandardSelectedItemService.cs" />
|
||||
<Compile Include="HSSE\InformationProject\FileCabinetAItemService.cs" />
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
namespace BLL;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
public class MaterialUnitService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据主键获取信息
|
||||
/// </summary>
|
||||
/// <param name="groupId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Base_MaterialUnit GetMaterialUnitById(string materialUnitId)
|
||||
{
|
||||
return Funs.DB.Base_MaterialUnit.FirstOrDefault(e => e.MaterialUnitId == materialUnitId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据名称获取信息
|
||||
/// </summary>
|
||||
/// <param name="groupId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Base_MaterialUnit GetMaterialUnitByName(string materialUnitName)
|
||||
{
|
||||
return Funs.DB.Base_MaterialUnit.FirstOrDefault(e => e.MaterialUnitName == materialUnitName);
|
||||
}
|
||||
|
||||
#region 根据职称ID得到职称名称
|
||||
/// <summary>
|
||||
/// 根据职称ID得到职称名称
|
||||
/// </summary>
|
||||
/// <param name="MaterialUnitId"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetMaterialUnitNameById(string MaterialUnitId)
|
||||
{
|
||||
string MaterialUnitName = string.Empty;
|
||||
if (!string.IsNullOrEmpty(MaterialUnitId))
|
||||
{
|
||||
var q = GetMaterialUnitById(MaterialUnitId);
|
||||
if (q != null)
|
||||
{
|
||||
MaterialUnitName = q.MaterialUnitName;
|
||||
}
|
||||
}
|
||||
|
||||
return MaterialUnitName;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 添加职称信息
|
||||
/// </summary>
|
||||
/// <param name="?"></param>
|
||||
public static void AddMaterialUnit(Model.Base_MaterialUnit postTitle)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_MaterialUnit newMaterialUnit = new Model.Base_MaterialUnit
|
||||
{
|
||||
MaterialUnitId = postTitle.MaterialUnitId,
|
||||
MaterialUnitCode = postTitle.MaterialUnitCode,
|
||||
MaterialUnitName = postTitle.MaterialUnitName,
|
||||
Remark = postTitle.Remark
|
||||
};
|
||||
|
||||
db.Base_MaterialUnit.InsertOnSubmit(newMaterialUnit);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改职称信息
|
||||
/// </summary>
|
||||
/// <param name="teamGroup"></param>
|
||||
public static void UpdateMaterialUnit(Model.Base_MaterialUnit postTitle)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_MaterialUnit newMaterialUnit = db.Base_MaterialUnit.FirstOrDefault(e => e.MaterialUnitId == postTitle.MaterialUnitId);
|
||||
if (newMaterialUnit != null)
|
||||
{
|
||||
newMaterialUnit.MaterialUnitCode = postTitle.MaterialUnitCode;
|
||||
newMaterialUnit.MaterialUnitName = postTitle.MaterialUnitName;
|
||||
newMaterialUnit.Remark = postTitle.Remark;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据职称主键删除对应职称信息
|
||||
/// </summary>
|
||||
/// <param name="materialUnitId"></param>
|
||||
public static void DeleteMaterialUnitById(string materialUnitId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Base_MaterialUnit postTitle = db.Base_MaterialUnit.FirstOrDefault(e => e.MaterialUnitId == materialUnitId);
|
||||
{
|
||||
db.Base_MaterialUnit.DeleteOnSubmit(postTitle);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取类别下拉项
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_MaterialUnit> GetMaterialUnitList()
|
||||
{
|
||||
var list = (from x in Funs.DB.Base_MaterialUnit orderby x.MaterialUnitCode select x).ToList();
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取职称下拉选项
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Base_MaterialUnit> GetMaterialUnitDropDownList()
|
||||
{
|
||||
var list = (from x in Funs.DB.Base_MaterialUnit orderby x.MaterialUnitCode select x).ToList();
|
||||
return list;
|
||||
}
|
||||
|
||||
#region 表下拉框
|
||||
/// <summary>
|
||||
/// 表下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitMaterialUnitDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "MaterialUnitId";
|
||||
dropName.DataTextField = "MaterialUnitName";
|
||||
dropName.DataSource = BLL.MaterialUnitService.GetMaterialUnitList();
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class MaterialInAndOutRecordService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据主键获取物资进出记录
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.MaterialInAndOutRecord GetMaterialInAndOutRecordById(string id)
|
||||
{
|
||||
return Funs.DB.MaterialInAndOutRecord.FirstOrDefault(e => e.Id == id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加物资进出记录
|
||||
/// </summary>
|
||||
/// <param name="GeneralMaterialInAndOutRecord"></param>
|
||||
public static void AddMaterialInAndOutRecord(Model.MaterialInAndOutRecord materialInAndOutRecord)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.MaterialInAndOutRecord newMaterialInAndOutRecord =
|
||||
new Model.MaterialInAndOutRecord
|
||||
{
|
||||
Id = materialInAndOutRecord.Id,
|
||||
ProjectId = materialInAndOutRecord.ProjectId,
|
||||
GoodsCategoryId = materialInAndOutRecord.GoodsCategoryId,
|
||||
GoodsCategoryName = materialInAndOutRecord.GoodsCategoryName,
|
||||
MaterialModel = materialInAndOutRecord.MaterialModel,
|
||||
InOutDate = materialInAndOutRecord.InOutDate,
|
||||
UnitId = materialInAndOutRecord.UnitId,
|
||||
InOrOut = materialInAndOutRecord.InOrOut,
|
||||
Number = materialInAndOutRecord.Number,
|
||||
MaterialUnitId = materialInAndOutRecord.MaterialUnitId,
|
||||
Remark = materialInAndOutRecord.Remark,
|
||||
CompileMan = materialInAndOutRecord.CompileMan,
|
||||
CompileDate = materialInAndOutRecord.CompileDate
|
||||
};
|
||||
db.MaterialInAndOutRecord.InsertOnSubmit(newMaterialInAndOutRecord);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改物资进出记录
|
||||
/// </summary>
|
||||
/// <param name="GeneralMaterialInAndOutRecord"></param>
|
||||
public static void UpdateMaterialInAndOutRecord(Model.MaterialInAndOutRecord materialInAndOutRecord)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.MaterialInAndOutRecord newMaterialInAndOutRecord =
|
||||
db.MaterialInAndOutRecord.FirstOrDefault(e => e.Id == materialInAndOutRecord.Id);
|
||||
if (newMaterialInAndOutRecord != null)
|
||||
{
|
||||
newMaterialInAndOutRecord.GoodsCategoryId = materialInAndOutRecord.GoodsCategoryId;
|
||||
newMaterialInAndOutRecord.GoodsCategoryName = materialInAndOutRecord.GoodsCategoryName;
|
||||
newMaterialInAndOutRecord.MaterialModel = materialInAndOutRecord.MaterialModel;
|
||||
newMaterialInAndOutRecord.InOutDate = materialInAndOutRecord.InOutDate;
|
||||
newMaterialInAndOutRecord.UnitId = materialInAndOutRecord.UnitId;
|
||||
newMaterialInAndOutRecord.InOrOut = materialInAndOutRecord.InOrOut;
|
||||
newMaterialInAndOutRecord.Number = materialInAndOutRecord.Number;
|
||||
newMaterialInAndOutRecord.MaterialUnitId = materialInAndOutRecord.MaterialUnitId;
|
||||
newMaterialInAndOutRecord.Remark = materialInAndOutRecord.Remark;
|
||||
newMaterialInAndOutRecord.CompileMan = materialInAndOutRecord.CompileMan;
|
||||
newMaterialInAndOutRecord.CompileDate = materialInAndOutRecord.CompileDate;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除物资进出记录
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
public static void DeleteMaterialInAndOutRecordById(string id)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.MaterialInAndOutRecord materialInAndOutRecord =
|
||||
db.MaterialInAndOutRecord.FirstOrDefault(e => e.Id == id);
|
||||
if (materialInAndOutRecord != null)
|
||||
{
|
||||
CodeRecordsService.DeleteCodeRecordsByDataId(id); //删除编号
|
||||
CommonService.DeleteAttachFileById(id); //删除附件
|
||||
db.MaterialInAndOutRecord.DeleteOnSubmit(materialInAndOutRecord);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 取物资进出记录列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<dynamic> GetMaterialInAndOutRecordList()
|
||||
{
|
||||
var result = (from record in Funs.DB.MaterialInAndOutRecord
|
||||
join materialUnit in Funs.DB.Base_MaterialUnit on record.MaterialUnitId equals materialUnit
|
||||
.MaterialUnitId into MaterialUnitGroup
|
||||
from materialUnit in MaterialUnitGroup.DefaultIfEmpty()
|
||||
join unit in Funs.DB.Base_Unit on record.UnitId equals unit.UnitId into UnitGroup
|
||||
from unit in UnitGroup.DefaultIfEmpty()
|
||||
join users in Funs.DB.Sys_User on record.CompileMan equals users.UserId into UsersGroup
|
||||
from users in UsersGroup.DefaultIfEmpty()
|
||||
select new
|
||||
{
|
||||
record.Id,
|
||||
record.ProjectId,
|
||||
record.GoodsCategoryId,
|
||||
record.GoodsCategoryName,
|
||||
record.MaterialModel,
|
||||
record.InOutDate,
|
||||
record.InOrOut,
|
||||
record.Number,
|
||||
record.Remark,
|
||||
record.UnitId,
|
||||
record.CompileMan,
|
||||
record.CompileDate,
|
||||
record.MaterialUnitId,
|
||||
MaterialUnitName = materialUnit != null ? materialUnit.MaterialUnitName : null,
|
||||
UnitName = unit != null ? unit.UnitName : null,
|
||||
CompileManName = users != null ? users.UserName : null
|
||||
}
|
||||
).OrderByDescending(x => x.InOutDate).ToList();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user