入库管理
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using ZR.Model;
|
||||
using ZR.Model.Dto;
|
||||
using ZR.Model.Business;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ZR.Service.Business.IBusinessService
|
||||
{
|
||||
/// <summary>
|
||||
/// MES成品入库单操作日志表service接口
|
||||
/// </summary>
|
||||
public interface IProFinishedProductReceiptLogService : IBaseService<ProFinishedProductReceiptLog>
|
||||
{
|
||||
PagedInfo<ProFinishedProductReceiptLogDto> GetList(ProFinishedProductReceiptLogQueryDto parm);
|
||||
|
||||
ProFinishedProductReceiptLog GetInfo(long Id);
|
||||
|
||||
ProFinishedProductReceiptLog AddProFinishedProductReceiptLog(ProFinishedProductReceiptLog parm);
|
||||
|
||||
int UpdateProFinishedProductReceiptLog(ProFinishedProductReceiptLog parm);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using ZR.Model;
|
||||
using ZR.Model.Dto;
|
||||
using ZR.Model.Business;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ZR.Service.Business.IBusinessService
|
||||
{
|
||||
/// <summary>
|
||||
/// MES成品入库单主表(含产品信息及标签打印状态)service接口
|
||||
/// </summary>
|
||||
public interface IProFinishedProductReceiptService : IBaseService<ProFinishedProductReceipt>
|
||||
{
|
||||
PagedInfo<ProFinishedProductReceiptDto> GetList(ProFinishedProductReceiptQueryDto parm);
|
||||
|
||||
ProFinishedProductReceipt GetInfo(string ReceiptNo);
|
||||
|
||||
ProFinishedProductReceipt AddProFinishedProductReceipt(ProFinishedProductReceipt parm);
|
||||
|
||||
int UpdateProFinishedProductReceipt(ProFinishedProductReceipt parm);
|
||||
|
||||
}
|
||||
}
|
||||
83
ZR.Service/mes/pro/ProFinishedProductReceiptLogService.cs
Normal file
83
ZR.Service/mes/pro/ProFinishedProductReceiptLogService.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using System;
|
||||
using SqlSugar;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Extensions;
|
||||
using ZR.Model;
|
||||
using ZR.Model.Dto;
|
||||
using ZR.Model.Business;
|
||||
using ZR.Repository;
|
||||
using ZR.Service.Business.IBusinessService;
|
||||
using System.Linq;
|
||||
|
||||
namespace ZR.Service.Business
|
||||
{
|
||||
/// <summary>
|
||||
/// MES成品入库单操作日志表Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IProFinishedProductReceiptLogService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class ProFinishedProductReceiptLogService : BaseService<ProFinishedProductReceiptLog>, IProFinishedProductReceiptLogService
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询MES成品入库单操作日志表列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<ProFinishedProductReceiptLogDto> GetList(ProFinishedProductReceiptLogQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<ProFinishedProductReceiptLog>();
|
||||
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.ToPage<ProFinishedProductReceiptLog, ProFinishedProductReceiptLogDto>(parm);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public ProFinishedProductReceiptLog GetInfo(long Id)
|
||||
{
|
||||
var response = Queryable()
|
||||
.Where(x => x.Id == Id)
|
||||
.First();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加MES成品入库单操作日志表
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public ProFinishedProductReceiptLog AddProFinishedProductReceiptLog(ProFinishedProductReceiptLog model)
|
||||
{
|
||||
return Context.Insertable(model).ExecuteReturnEntity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改MES成品入库单操作日志表
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdateProFinishedProductReceiptLog(ProFinishedProductReceiptLog model)
|
||||
{
|
||||
//var response = Update(w => w.Id == model.Id, it => new ProFinishedProductReceiptLog()
|
||||
//{
|
||||
// ReceiptNo = model.ReceiptNo,
|
||||
// OperatedBy = model.OperatedBy,
|
||||
// OperatedTime = model.OperatedTime,
|
||||
// OperationType = model.OperationType,
|
||||
// OperationContent = model.OperationContent,
|
||||
// OperationResult = model.OperationResult,
|
||||
// Remark = model.Remark,
|
||||
//});
|
||||
//return response;
|
||||
return Update(model, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
153
ZR.Service/mes/pro/ProFinishedProductReceiptService.cs
Normal file
153
ZR.Service/mes/pro/ProFinishedProductReceiptService.cs
Normal file
@@ -0,0 +1,153 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Extensions;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using ZR.Model;
|
||||
using ZR.Model.Business;
|
||||
using ZR.Model.Dto;
|
||||
using ZR.Repository;
|
||||
using ZR.Service.Business.IBusinessService;
|
||||
using ZR.Service.System.IService;
|
||||
|
||||
namespace ZR.Service.Business
|
||||
{
|
||||
/// <summary>
|
||||
/// MES成品入库单主表(含产品信息及标签打印状态)Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IProFinishedProductReceiptService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class ProFinishedProductReceiptService : BaseService<ProFinishedProductReceipt>, IProFinishedProductReceiptService
|
||||
{
|
||||
private readonly IProFinishedProductReceiptLogService _receiptLogService;
|
||||
|
||||
/// <summary>
|
||||
/// 查询MES成品入库单主表(含产品信息及标签打印状态)列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<ProFinishedProductReceiptDto> GetList(ProFinishedProductReceiptQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<ProFinishedProductReceipt>()
|
||||
.AndIF(!string.IsNullOrEmpty(parm.ReceiptType), r => r.ReceiptType.Contains(parm.ReceiptType))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Status), r => r.Status.Contains(parm.Status))
|
||||
.AndIF(parm.StartTime != null, r => r.CreatedTime >= parm.StartTime)
|
||||
.AndIF(parm.EndTime != null, r => r.CreatedTime <= parm.EndTime);
|
||||
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.ToPage<ProFinishedProductReceipt, ProFinishedProductReceiptDto>(parm);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="ReceiptNo"></param>
|
||||
/// <returns></returns>
|
||||
public ProFinishedProductReceipt GetInfo(string ReceiptNo)
|
||||
{
|
||||
var response = Queryable()
|
||||
.Where(x => x.ReceiptNo == ReceiptNo)
|
||||
.First();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加MES成品入库单主表(含产品信息及标签打印状态)
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public ProFinishedProductReceipt AddProFinishedProductReceipt(ProFinishedProductReceipt model)
|
||||
{
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
model.CreatedTime = DateTime.Now;
|
||||
var insertedModel = Context.Insertable(model).ExecuteReturnEntity();
|
||||
|
||||
if (insertedModel != null && !string.IsNullOrEmpty(insertedModel.ReceiptNo))
|
||||
{
|
||||
_receiptLogService.AddProFinishedProductReceiptLog(
|
||||
new ProFinishedProductReceiptLog
|
||||
{
|
||||
ReceiptNo = model.ReceiptNo,
|
||||
OperatedBy = "",
|
||||
OperatedTime = DateTime.Now,
|
||||
OperationType = "CREATE",
|
||||
OperationContent = "入库单创建成功",
|
||||
OperationResult = "SUCCESS",
|
||||
Remark = ""
|
||||
});
|
||||
return insertedModel;
|
||||
} else
|
||||
{
|
||||
throw new Exception("入库单插入失败");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_receiptLogService.AddProFinishedProductReceiptLog(
|
||||
new ProFinishedProductReceiptLog
|
||||
{
|
||||
ReceiptNo = model.ReceiptNo,
|
||||
OperatedBy = "",
|
||||
OperatedTime = DateTime.Now,
|
||||
OperationType = "CREATE",
|
||||
OperationContent = "入库单创建失败",
|
||||
OperationResult = "FAIL",
|
||||
Remark = ""
|
||||
});
|
||||
throw new Exception($"添加成品入库单失败:{ex.Message}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改MES成品入库单主表(含产品信息及标签打印状态)
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdateProFinishedProductReceipt(ProFinishedProductReceipt model)
|
||||
{
|
||||
//var response = Update(w => w.ReceiptNo == model.ReceiptNo, it => new ProFinishedProductReceipt()
|
||||
//{
|
||||
// ReceiptDate = model.ReceiptDate,
|
||||
// SiteNo = model.SiteNo,
|
||||
// WorkOrder = model.WorkOrder,
|
||||
// WarehouseCode = model.WarehouseCode,
|
||||
// ReceiptType = model.ReceiptType,
|
||||
// Status = model.Status,
|
||||
// PartNumber = model.PartNumber,
|
||||
// Description = model.Description,
|
||||
// Color = model.Color,
|
||||
// Specification = model.Specification,
|
||||
// ProductionLine = model.ProductionLine,
|
||||
// Team = model.Team,
|
||||
// ShiftNo = model.ShiftNo,
|
||||
// LabelFrom = model.LabelFrom,
|
||||
// ProductionTime = model.ProductionTime,
|
||||
// BatchCode = model.BatchCode,
|
||||
// Unit = model.Unit,
|
||||
// PackageCode = model.PackageCode,
|
||||
// PackageCount = model.PackageCount,
|
||||
// PackageNum = model.PackageNum,
|
||||
// LabelCode = model.LabelCode,
|
||||
// LabelPrintStatus = model.LabelPrintStatus,
|
||||
// StorageLocation = model.StorageLocation,
|
||||
// QcStatus = model.QcStatus,
|
||||
// CreatedBy = model.CreatedBy,
|
||||
// CreatedTime = model.CreatedTime,
|
||||
// UpdatedBy = model.UpdatedBy,
|
||||
// UpdatedTime = model.UpdatedTime,
|
||||
// ApprovedBy = model.ApprovedBy,
|
||||
// ApprovedTime = model.ApprovedTime,
|
||||
// Remark = model.Remark,
|
||||
//});
|
||||
//return response;
|
||||
return Update(model, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user