85 lines
2.9 KiB
C#
85 lines
2.9 KiB
C#
using System;
|
|
using SqlSugar;
|
|
using Infrastructure.Attribute;
|
|
using Infrastructure.Extensions;
|
|
using DOAN.Model;
|
|
using DOAN.Model.Dto;
|
|
using DOAN.Model.MES.material.Dto;
|
|
using DOAN.Model.MES.material;
|
|
using DOAN.Repository;
|
|
using DOAN.Service.MES.material.IService;
|
|
using System.Linq;
|
|
|
|
namespace DOAN.Service.MES.material
|
|
{
|
|
/// <summary>
|
|
/// 北泽线边库出入库Service业务层处理
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IMaterialPartsTransactionsService), ServiceLifetime = LifeTime.Transient)]
|
|
public class MaterialPartsTransactionsService : BaseService<MaterialPartsTransactions>, IMaterialPartsTransactionsService
|
|
{
|
|
/// <summary>
|
|
/// 查询北泽线边库出入库列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<MaterialPartsTransactionsDto> GetList(MaterialPartsTransactionsQueryDto parm)
|
|
{
|
|
// var predicate = Expressionable.Create<MaterialPartsTransactions>();
|
|
|
|
var response = Queryable()
|
|
.LeftJoin<MaterialSpareParts>((t,s)=>t.PartId==s.PartId)
|
|
.WhereIF(!string.IsNullOrEmpty(parm.PartName), (t,s)=>s.PartName.Contains(parm.PartName))
|
|
.WhereIF(!string.IsNullOrEmpty(parm.TransactionType), (t,s)=>t.TransactionType==parm.TransactionType)
|
|
.Select((t,s)=>new MaterialPartsTransactionsDto(),true )
|
|
.ToPage_NO_Convert(parm);
|
|
|
|
return response;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="TransactionId"></param>
|
|
/// <returns></returns>
|
|
public MaterialPartsTransactions GetInfo(int TransactionId)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.TransactionId == TransactionId)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加北泽线边库出入库
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public MaterialPartsTransactions AddMaterialPartsTransactions(MaterialPartsTransactions model)
|
|
{
|
|
return Context.Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改北泽线边库出入库
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateMaterialPartsTransactions(MaterialPartsTransactions model)
|
|
{
|
|
//var response = Update(w => w.TransactionId == model.TransactionId, it => new MaterialPartsTransactions()
|
|
//{
|
|
// TransactionType = model.TransactionType,
|
|
// Quantity = model.Quantity,
|
|
// TransactionDate = model.TransactionDate,
|
|
// Remarks = model.Remarks,
|
|
// CreatedBy = model.CreatedBy,
|
|
//});
|
|
//return response;
|
|
return Update(model, true);
|
|
}
|
|
|
|
}
|
|
} |