- 将ProFinishedProductReceiptService中的_receiptLogService改为局部变量 - 统一GP12和后道标签打印的MQTT主题格式 - 调整标签打印名称以更准确反映业务场景 - 在后道服务中新增标签打印MQTT消息发送功能
145 lines
5.9 KiB
C#
145 lines
5.9 KiB
C#
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
|
||
{
|
||
|
||
/// <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)
|
||
{
|
||
ProFinishedProductReceiptLogService _receiptLogService = new ();
|
||
|
||
try
|
||
{
|
||
model.CreatedTime = DateTime.Now;
|
||
int result = Context.Insertable(model).ExecuteCommand();
|
||
_receiptLogService.AddProFinishedProductReceiptLog(
|
||
new ProFinishedProductReceiptLog
|
||
{
|
||
ReceiptNo = model.ReceiptNo,
|
||
OperatedBy = "系统",
|
||
OperatedTime = DateTime.Now,
|
||
OperationType = "CREATE",
|
||
OperationContent = result > 0 ? "入库单创建成功": "入库单创建失败",
|
||
OperationResult = result > 0 ? "SUCCESS": "FAIL",
|
||
Remark = ""
|
||
});
|
||
return model;
|
||
}
|
||
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);
|
||
}
|
||
|
||
}
|
||
} |