120 lines
4.3 KiB
C#
120 lines
4.3 KiB
C#
using System;
|
|
using SqlSugar;
|
|
using Infrastructure.Attribute;
|
|
using Infrastructure.Extensions;
|
|
using ZR.Model;
|
|
using ZR.Model.Dto;
|
|
|
|
using ZR.Repository;
|
|
|
|
using System.Linq;
|
|
using ZR.Service.mes.wms.IService;
|
|
using ZR.Model.MES.wms;
|
|
using ZR.Model.MES.wms.Dto;
|
|
|
|
namespace ZR.Service.mes.wms
|
|
{
|
|
/// <summary>
|
|
/// 物料记录表Service业务层处理
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IWmMaterialService), ServiceLifetime = LifeTime.Transient)]
|
|
public class WmMaterialService : BaseService<WmMaterial>, IWmMaterialService
|
|
{
|
|
/// <summary>
|
|
/// 查询物料记录表列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<WmMaterialDto> GetList(WmMaterialQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<WmMaterial>()
|
|
.AndIF(parm.Partnumber != null, it => it.Partnumber.Contains(parm.Partnumber))
|
|
.AndIF(parm.U8InventoryCode != null, it => it.U8InventoryCode.Contains(parm.U8InventoryCode))
|
|
.AndIF(parm.ProductName != null, it => it.ProductName.Contains(parm.ProductName))
|
|
.AndIF(parm.Color != null, it => it.Color.Contains(parm.Color))
|
|
.AndIF(parm.Specification != null, it => it.Specification.Contains(parm.Specification))
|
|
.AndIF(parm.Description != null, it => it.Description.Contains(parm.Description))
|
|
.AndIF(parm.Search1 != null, it => it.Search1.Contains(parm.Search1) || it.Search2.Contains(parm.Search1))
|
|
.AndIF(parm.Status > -1, it => it.Status == parm.Status);
|
|
|
|
|
|
var response = Queryable()
|
|
.Where(predicate.ToExpression()).OrderByDescending(it=>it.CreatedTime)
|
|
.ToPage<WmMaterial, WmMaterialDto>(parm);
|
|
|
|
|
|
return response;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public WmMaterial GetInfo(string Id)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.Id == Id)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加物料记录表
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public WmMaterial AddWmMaterial(WmMaterial model)
|
|
{
|
|
model.Id= SnowFlakeSingle.Instance.NextId().ToString();
|
|
return Context.Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改物料记录表
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateWmMaterial(WmMaterial model)
|
|
{
|
|
//var response = Update(w => w.Id == model.Id, it => new WmMaterial()
|
|
//{
|
|
// Partnumber = model.Partnumber,
|
|
// U8InventoryCode = model.U8InventoryCode,
|
|
// BlankNum = model.BlankNum,
|
|
// Unit = model.Unit,
|
|
// ProductName = model.ProductName,
|
|
// Color = model.Color,
|
|
// Specification = model.Specification,
|
|
// Description = model.Description,
|
|
// Version = model.Version,
|
|
// Remarks = model.Remarks,
|
|
// Sort = model.Sort,
|
|
// Search1 = model.Search1,
|
|
// Search2 = model.Search2,
|
|
// Status = model.Status,
|
|
// CreatedBy = model.CreatedBy,
|
|
// CreatedTime = model.CreatedTime,
|
|
// UpdatedBy = model.UpdatedBy,
|
|
// UpdatedTime = model.UpdatedTime,
|
|
//});
|
|
//return response;
|
|
return Update(model, true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 通过外箱标签解析后得到的批次号,获取货物仓库内的货物信息
|
|
/// </summary>
|
|
/// <param name="patchCode"></param>
|
|
/// <returns></returns>
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
public WmGoodsNowProduction GetInfoByPatchCode(string patchCode)
|
|
{
|
|
return Context.Queryable<WmGoodsNowProduction>()
|
|
.Where(it => it.PackageCodeClient == patchCode).First();
|
|
|
|
}
|
|
}
|
|
} |