diff --git a/ZR.Admin.WebApi/Controllers/mes/pro/ProFinishedProductReceiptController.cs b/ZR.Admin.WebApi/Controllers/mes/pro/ProFinishedProductReceiptController.cs new file mode 100644 index 00000000..c7655526 --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/pro/ProFinishedProductReceiptController.cs @@ -0,0 +1,109 @@ +using Microsoft.AspNetCore.Mvc; +using ZR.Model.Dto; +using ZR.Model.Business; +using ZR.Service.Business.IBusinessService; +using ZR.Admin.WebApi.Extensions; +using ZR.Admin.WebApi.Filters; + +//创建时间:2025-11-14 +namespace ZR.Admin.WebApi.Controllers +{ + /// + /// MES成品入库单主表(含产品信息及标签打印状态) + /// + [Verify] + [Route("productManagement/ProFinishedProductReceipt")] + public class ProFinishedProductReceiptController : BaseController + { + /// + /// MES成品入库单主表(含产品信息及标签打印状态)接口 + /// + private readonly IProFinishedProductReceiptService _ProFinishedProductReceiptService; + + public ProFinishedProductReceiptController(IProFinishedProductReceiptService ProFinishedProductReceiptService) + { + _ProFinishedProductReceiptService = ProFinishedProductReceiptService; + } + + /// + /// 查询MES成品入库单主表(含产品信息及标签打印状态)列表 + /// + /// + /// + [HttpGet("list")] + [ActionPermissionFilter(Permission = "productManagement:profinishedproductreceipt:list")] + public IActionResult QueryProFinishedProductReceipt([FromQuery] ProFinishedProductReceiptQueryDto parm) + { + var response = _ProFinishedProductReceiptService.GetList(parm); + return SUCCESS(response); + } + + + /// + /// 查询MES成品入库单主表(含产品信息及标签打印状态)详情 + /// + /// + /// + [HttpGet("{ReceiptNo}")] + [ActionPermissionFilter(Permission = "productManagement:profinishedproductreceipt:query")] + public IActionResult GetProFinishedProductReceipt(string ReceiptNo) + { + var response = _ProFinishedProductReceiptService.GetInfo(ReceiptNo); + + var info = response.Adapt(); + return SUCCESS(info); + } + + /// + /// 添加MES成品入库单主表(含产品信息及标签打印状态) + /// + /// + [HttpPost] + [ActionPermissionFilter(Permission = "productManagement:profinishedproductreceipt:add")] + [Log(Title = "MES成品入库单主表(含产品信息及标签打印状态)", BusinessType = BusinessType.INSERT)] + public IActionResult AddProFinishedProductReceipt([FromBody] ProFinishedProductReceiptDto parm) + { + var modal = parm.Adapt().ToCreate(HttpContext); + + var response = _ProFinishedProductReceiptService.AddProFinishedProductReceipt(modal); + + return SUCCESS(response); + } + + /// + /// 更新MES成品入库单主表(含产品信息及标签打印状态) + /// + /// + [HttpPut] + [ActionPermissionFilter(Permission = "productManagement:profinishedproductreceipt:edit")] + [Log(Title = "MES成品入库单主表(含产品信息及标签打印状态)", BusinessType = BusinessType.UPDATE)] + public IActionResult UpdateProFinishedProductReceipt([FromBody] ProFinishedProductReceiptDto parm) + { + var modal = parm.Adapt().ToUpdate(HttpContext); + var response = _ProFinishedProductReceiptService.UpdateProFinishedProductReceipt(modal); + + return ToResponse(response); + } + + /// + /// 删除MES成品入库单主表(含产品信息及标签打印状态) + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "productManagement:profinishedproductreceipt:delete")] + [Log(Title = "MES成品入库单主表(含产品信息及标签打印状态)", BusinessType = BusinessType.DELETE)] + public IActionResult DeleteProFinishedProductReceipt(string ids) + { + int[] idsArr = Tools.SpitIntArrary(ids); + if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } + + var response = _ProFinishedProductReceiptService.Delete(idsArr); + + return ToResponse(response); + } + + + + + } +} \ No newline at end of file diff --git a/ZR.Admin.WebApi/Controllers/mes/pro/ProFinishedProductReceiptLogController.cs b/ZR.Admin.WebApi/Controllers/mes/pro/ProFinishedProductReceiptLogController.cs new file mode 100644 index 00000000..97d5794f --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/pro/ProFinishedProductReceiptLogController.cs @@ -0,0 +1,109 @@ +using Microsoft.AspNetCore.Mvc; +using ZR.Model.Dto; +using ZR.Model.Business; +using ZR.Service.Business.IBusinessService; +using ZR.Admin.WebApi.Extensions; +using ZR.Admin.WebApi.Filters; + +//创建时间:2025-11-14 +namespace ZR.Admin.WebApi.Controllers +{ + /// + /// MES成品入库单操作日志表 + /// + [Verify] + [Route("productManagement/ProFinishedProductReceiptLog")] + public class ProFinishedProductReceiptLogController : BaseController + { + /// + /// MES成品入库单操作日志表接口 + /// + private readonly IProFinishedProductReceiptLogService _ProFinishedProductReceiptLogService; + + public ProFinishedProductReceiptLogController(IProFinishedProductReceiptLogService ProFinishedProductReceiptLogService) + { + _ProFinishedProductReceiptLogService = ProFinishedProductReceiptLogService; + } + + /// + /// 查询MES成品入库单操作日志表列表 + /// + /// + /// + [HttpGet("list")] + [ActionPermissionFilter(Permission = "productManagement:profinishedproductreceiptlog:list")] + public IActionResult QueryProFinishedProductReceiptLog([FromQuery] ProFinishedProductReceiptLogQueryDto parm) + { + var response = _ProFinishedProductReceiptLogService.GetList(parm); + return SUCCESS(response); + } + + + /// + /// 查询MES成品入库单操作日志表详情 + /// + /// + /// + [HttpGet("{Id}")] + [ActionPermissionFilter(Permission = "productManagement:profinishedproductreceiptlog:query")] + public IActionResult GetProFinishedProductReceiptLog(long Id) + { + var response = _ProFinishedProductReceiptLogService.GetInfo(Id); + + var info = response.Adapt(); + return SUCCESS(info); + } + + /// + /// 添加MES成品入库单操作日志表 + /// + /// + [HttpPost] + [ActionPermissionFilter(Permission = "productManagement:profinishedproductreceiptlog:add")] + [Log(Title = "MES成品入库单操作日志表", BusinessType = BusinessType.INSERT)] + public IActionResult AddProFinishedProductReceiptLog([FromBody] ProFinishedProductReceiptLogDto parm) + { + var modal = parm.Adapt().ToCreate(HttpContext); + + var response = _ProFinishedProductReceiptLogService.AddProFinishedProductReceiptLog(modal); + + return SUCCESS(response); + } + + /// + /// 更新MES成品入库单操作日志表 + /// + /// + [HttpPut] + [ActionPermissionFilter(Permission = "productManagement:profinishedproductreceiptlog:edit")] + [Log(Title = "MES成品入库单操作日志表", BusinessType = BusinessType.UPDATE)] + public IActionResult UpdateProFinishedProductReceiptLog([FromBody] ProFinishedProductReceiptLogDto parm) + { + var modal = parm.Adapt().ToUpdate(HttpContext); + var response = _ProFinishedProductReceiptLogService.UpdateProFinishedProductReceiptLog(modal); + + return ToResponse(response); + } + + /// + /// 删除MES成品入库单操作日志表 + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "productManagement:profinishedproductreceiptlog:delete")] + [Log(Title = "MES成品入库单操作日志表", BusinessType = BusinessType.DELETE)] + public IActionResult DeleteProFinishedProductReceiptLog(string ids) + { + int[] idsArr = Tools.SpitIntArrary(ids); + if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } + + var response = _ProFinishedProductReceiptLogService.Delete(idsArr); + + return ToResponse(response); + } + + + + + } +} \ No newline at end of file diff --git a/ZR.Admin.WebApi/DataProtection/key-e60ed214-33d1-4b35-aa1e-d8d5f9423f06.xml b/ZR.Admin.WebApi/DataProtection/key-e60ed214-33d1-4b35-aa1e-d8d5f9423f06.xml new file mode 100644 index 00000000..1da3a7ff --- /dev/null +++ b/ZR.Admin.WebApi/DataProtection/key-e60ed214-33d1-4b35-aa1e-d8d5f9423f06.xml @@ -0,0 +1,16 @@ + + + 2025-11-14T02:49:12.7305702Z + 2025-11-14T02:49:12.6652806Z + 2026-02-12T02:49:12.6652806Z + + + + + + + +yuBV7XpvuKsyiwxbcTT5sL3f+rT2wOrOh14Tycwnk485eHhYsRPaLzosQaivCvSCEK+lOwkOPg+CQrr/bdO3g== + + + + \ No newline at end of file diff --git a/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-MES成品入库单主表(含产品信息及标签打印状态)-1114144448.zip b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-MES成品入库单主表(含产品信息及标签打印状态)-1114144448.zip new file mode 100644 index 00000000..f10bebed Binary files /dev/null and b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-MES成品入库单主表(含产品信息及标签打印状态)-1114144448.zip differ diff --git a/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-MES成品入库单操作日志表-1114144226.zip b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-MES成品入库单操作日志表-1114144226.zip new file mode 100644 index 00000000..270b6436 Binary files /dev/null and b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-MES成品入库单操作日志表-1114144226.zip differ diff --git a/ZR.Model/MES/pro/DTO/ProFinishedProductReceiptDto.cs b/ZR.Model/MES/pro/DTO/ProFinishedProductReceiptDto.cs new file mode 100644 index 00000000..c9363933 --- /dev/null +++ b/ZR.Model/MES/pro/DTO/ProFinishedProductReceiptDto.cs @@ -0,0 +1,109 @@ +using System.ComponentModel.DataAnnotations; + +namespace ZR.Model.Dto +{ + /// + /// MES成品入库单主表(含产品信息及标签打印状态)查询对象 + /// + public class ProFinishedProductReceiptQueryDto : PagerInfo + { + /// + /// 入库类型 + /// + public string ReceiptType { get; set; } + + /// + /// 单据状态 + /// + public string Status { get; set; } + + public DateTime? StartTime { get; set; } + + public DateTime? EndTime { get; set; } + } + + /// + /// MES成品入库单主表(含产品信息及标签打印状态)输入输出对象 + /// + public class ProFinishedProductReceiptDto + { + [Required(ErrorMessage = "入库单号(主键,规则:RCP+日期+流水号,如RCP20251112001)不能为空")] + public string ReceiptNo { get; set; } + + [Required(ErrorMessage = "入库日期不能为空")] + public DateTime? ReceiptDate { get; set; } + + public string SiteNo { get; set; } + + public string WorkOrder { get; set; } + + [Required(ErrorMessage = "仓库编码(关联仓库表)不能为空")] + public string WarehouseCode { get; set; } + + [Required(ErrorMessage = "入库类型:NORMAL-正常入库;REWORK-返工入库;RETURN-客户退货;OTHER-其他不能为空")] + public string ReceiptType { get; set; } + + [Required(ErrorMessage = "单据状态:DRAFT-草稿;SUBMITTED-已提交;APPROVED-已审核;CANCELED-已取消不能为空")] + public string Status { get; set; } + + [Required(ErrorMessage = "产品编号(对应JSON中的PartNumber,如5615101DSV0000B96)不能为空")] + public string PartNumber { get; set; } + + [Required(ErrorMessage = "产品名称(对应JSON中的Description,如A58左后门把手-手动版-幻彩银)不能为空")] + public string Description { get; set; } + + public string Color { get; set; } + + public string Specification { get; set; } + + public string ProductionLine { get; set; } + + public string Team { get; set; } + + public string ShiftNo { get; set; } + + public string LabelFrom { get; set; } + + public DateTime? ProductionTime { get; set; } + + [Required(ErrorMessage = "批次编码(对应JSON中的BatchCode,如20251016)不能为空")] + public string BatchCode { get; set; } + + [Required(ErrorMessage = "计量单位(如个、箱、台)不能为空")] + public string Unit { get; set; } + + public string PackageCode { get; set; } + + public int? PackageCount { get; set; } + + public int? PackageNum { get; set; } + + public string LabelCode { get; set; } + + [Required(ErrorMessage = "标签打印状态:UNPRINTED-未打印;PRINTED-已打印不能为空")] + public string LabelPrintStatus { get; set; } + + public string StorageLocation { get; set; } + + public string QcStatus { get; set; } + + [Required(ErrorMessage = "创建人(用户ID)不能为空")] + public string CreatedBy { get; set; } + + [Required(ErrorMessage = "创建时间(对应JSON中的CreatedTime)不能为空")] + public DateTime? CreatedTime { get; set; } + + public string UpdatedBy { get; set; } + + public DateTime? UpdatedTime { get; set; } + + public string ApprovedBy { get; set; } + + public DateTime? ApprovedTime { get; set; } + + public string Remark { get; set; } + + + + } +} \ No newline at end of file diff --git a/ZR.Model/MES/pro/DTO/ProFinishedProductReceiptLogDto.cs b/ZR.Model/MES/pro/DTO/ProFinishedProductReceiptLogDto.cs new file mode 100644 index 00000000..18f707a8 --- /dev/null +++ b/ZR.Model/MES/pro/DTO/ProFinishedProductReceiptLogDto.cs @@ -0,0 +1,45 @@ +using System.ComponentModel.DataAnnotations; + +namespace ZR.Model.Dto +{ + /// + /// MES成品入库单操作日志表查询对象 + /// + public class ProFinishedProductReceiptLogQueryDto : PagerInfo + { + public DateTime? StartTime { get; set; } + + public DateTime? EndTime { get; set; } + } + + /// + /// MES成品入库单操作日志表输入输出对象 + /// + public class ProFinishedProductReceiptLogDto + { + [Required(ErrorMessage = "自增主键不能为空")] + [JsonConverter(typeof(ValueToStringConverter))] + public long Id { get; set; } + + [Required(ErrorMessage = "关联入库单号不能为空")] + public string ReceiptNo { get; set; } + + [Required(ErrorMessage = "操作人(用户ID)不能为空")] + public string OperatedBy { get; set; } + + [Required(ErrorMessage = "操作时间不能为空")] + public DateTime? OperatedTime { get; set; } + + [Required(ErrorMessage = "操作类型:CREATE-创建;UPDATE-修改;APPROVE-审核;CANCEL-取消;PRINT_LABEL-打印标签;OTHER-其他不能为空")] + public string OperationType { get; set; } + + public string OperationContent { get; set; } + + public string OperationResult { get; set; } + + public string Remark { get; set; } + + + + } +} \ No newline at end of file diff --git a/ZR.Model/MES/pro/ProFinishedProductReceipt.cs b/ZR.Model/MES/pro/ProFinishedProductReceipt.cs new file mode 100644 index 00000000..6b009e2a --- /dev/null +++ b/ZR.Model/MES/pro/ProFinishedProductReceipt.cs @@ -0,0 +1,196 @@ + +namespace ZR.Model.Business +{ + /// + /// MES成品入库单主表(含产品信息及标签打印状态) + /// + [SugarTable("pro_finished_product_receipt")] + public class ProFinishedProductReceipt + { + /// + /// 入库单号(主键,规则:RCP+日期+流水号,如RCP20251112001) + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "receipt_no")] + public string ReceiptNo { get; set; } + + /// + /// 入库日期 + /// + [SugarColumn(ColumnName = "receipt_date")] + public DateTime? ReceiptDate { get; set; } + + /// + /// 站点编号(对应JSON中的SiteNo) + /// + [SugarColumn(ColumnName = "site_no")] + public string SiteNo { get; set; } + + /// + /// 生产工单号(对应JSON中的WorkOrder) + /// + [SugarColumn(ColumnName = "work_order")] + public string WorkOrder { get; set; } + + /// + /// 仓库编码(关联仓库表) + /// + [SugarColumn(ColumnName = "warehouse_code")] + public string WarehouseCode { get; set; } + + /// + /// 入库类型:NORMAL-正常入库;REWORK-返工入库;RETURN-客户退货;OTHER-其他 + /// + [SugarColumn(ColumnName = "receipt_type")] + public string ReceiptType { get; set; } + + /// + /// 单据状态:DRAFT-草稿;SUBMITTED-已提交;APPROVED-已审核;CANCELED-已取消 + /// + public string Status { get; set; } + + /// + /// 产品编号(对应JSON中的PartNumber,如5615101DSV0000B96) + /// + [SugarColumn(ColumnName = "part_number")] + public string PartNumber { get; set; } + + /// + /// 产品名称(对应JSON中的Description,如A58左后门把手-手动版-幻彩银) + /// + public string Description { get; set; } + + /// + /// 颜色(对应JSON中的Color,如幻彩银) + /// + public string Color { get; set; } + + /// + /// 规格型号(对应JSON中的Specification,如手动版) + /// + public string Specification { get; set; } + + /// + /// 生产线 + /// + [SugarColumn(ColumnName = "production_line")] + public string ProductionLine { get; set; } + + /// + /// 班组(对应JSON中的Team,如B班) + /// + public string Team { get; set; } + + /// + /// 班次(如早班/中班/晚班) + /// + [SugarColumn(ColumnName = "shift_no")] + public string ShiftNo { get; set; } + + /// + /// 标签来源(对应JSON中的LabelFrom,如后道) + /// + [SugarColumn(ColumnName = "label_from")] + public string LabelFrom { get; set; } + + /// + /// 生产时间(对应JSON中的ProductionTime) + /// + [SugarColumn(ColumnName = "production_time")] + public DateTime? ProductionTime { get; set; } + + /// + /// 批次编码(对应JSON中的BatchCode,如20251016) + /// + [SugarColumn(ColumnName = "batch_code")] + public string BatchCode { get; set; } + + /// + /// 计量单位(如个、箱、台) + /// + public string Unit { get; set; } + + /// + /// 包装编码(对应JSON中的PackageCode,如BNW20240401_001) + /// + [SugarColumn(ColumnName = "package_code")] + public string PackageCode { get; set; } + + /// + /// 包装数量(对应JSON中的PackageCout,如1) + /// + [SugarColumn(ColumnName = "package_count")] + public int? PackageCount { get; set; } + + /// + /// 每包数量(对应JSON中的PackageNum,如24) + /// + [SugarColumn(ColumnName = "package_num")] + public int? PackageNum { get; set; } + + /// + /// 标签编码(对应JSON中的LabelCode,如60102853-Y73-01/2025040811//) + /// + [SugarColumn(ColumnName = "label_code")] + public string LabelCode { get; set; } + + /// + /// 标签打印状态:UNPRINTED-未打印;PRINTED-已打印 + /// + [SugarColumn(ColumnName = "label_print_status")] + public string LabelPrintStatus { get; set; } + + /// + /// 存储库位(如A区-1货架-01层) + /// + [SugarColumn(ColumnName = "storage_location")] + public string StorageLocation { get; set; } + + /// + /// 质检状态:PENDING-待检;QUALIFIED-合格;UNQUALIFIED-不合格 + /// + [SugarColumn(ColumnName = "qc_status")] + public string QcStatus { get; set; } + + /// + /// 创建人(用户ID) + /// + [SugarColumn(ColumnName = "created_by")] + public string CreatedBy { get; set; } + + /// + /// 创建时间(对应JSON中的CreatedTime) + /// + [SugarColumn(ColumnName = "created_time")] + public DateTime? CreatedTime { get; set; } + + /// + /// 更新人(用户ID) + /// + [SugarColumn(ColumnName = "updated_by")] + public string UpdatedBy { get; set; } + + /// + /// 更新时间 + /// + [SugarColumn(ColumnName = "updated_time")] + public DateTime? UpdatedTime { get; set; } + + /// + /// 审核人(用户ID) + /// + [SugarColumn(ColumnName = "approved_by")] + public string ApprovedBy { get; set; } + + /// + /// 审核时间 + /// + [SugarColumn(ColumnName = "approved_time")] + public DateTime? ApprovedTime { get; set; } + + /// + /// 备注信息 + /// + public string Remark { get; set; } + + } +} \ No newline at end of file diff --git a/ZR.Model/MES/pro/ProFinishedProductReceiptLog.cs b/ZR.Model/MES/pro/ProFinishedProductReceiptLog.cs new file mode 100644 index 00000000..4608bcc0 --- /dev/null +++ b/ZR.Model/MES/pro/ProFinishedProductReceiptLog.cs @@ -0,0 +1,58 @@ + +namespace ZR.Model.Business +{ + /// + /// MES成品入库单操作日志表 + /// + [SugarTable("pro_finished_product_receipt_log")] + public class ProFinishedProductReceiptLog + { + /// + /// 自增主键 + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public long Id { get; set; } + + /// + /// 关联入库单号 + /// + [SugarColumn(ColumnName = "receipt_no")] + public string ReceiptNo { get; set; } + + /// + /// 操作人(用户ID) + /// + [SugarColumn(ColumnName = "operated_by")] + public string OperatedBy { get; set; } + + /// + /// 操作时间 + /// + [SugarColumn(ColumnName = "operated_time")] + public DateTime? OperatedTime { get; set; } + + /// + /// 操作类型:CREATE-创建;UPDATE-修改;APPROVE-审核;CANCEL-取消;PRINT_LABEL-打印标签;OTHER-其他 + /// + [SugarColumn(ColumnName = "operation_type")] + public string OperationType { get; set; } + + /// + /// 操作内容(如“标签打印成功,编码:XXX”) + /// + [SugarColumn(ColumnName = "operation_content")] + public string OperationContent { get; set; } + + /// + /// 操作结果:SUCCESS-成功;FAIL-失败 + /// + [SugarColumn(ColumnName = "operation_result")] + public string OperationResult { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + + } +} \ No newline at end of file diff --git a/ZR.Service/mes/pro/IService/IProFinishedProductReceiptLogService.cs b/ZR.Service/mes/pro/IService/IProFinishedProductReceiptLogService.cs new file mode 100644 index 00000000..27195f3b --- /dev/null +++ b/ZR.Service/mes/pro/IService/IProFinishedProductReceiptLogService.cs @@ -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 +{ + /// + /// MES成品入库单操作日志表service接口 + /// + public interface IProFinishedProductReceiptLogService : IBaseService + { + PagedInfo GetList(ProFinishedProductReceiptLogQueryDto parm); + + ProFinishedProductReceiptLog GetInfo(long Id); + + ProFinishedProductReceiptLog AddProFinishedProductReceiptLog(ProFinishedProductReceiptLog parm); + + int UpdateProFinishedProductReceiptLog(ProFinishedProductReceiptLog parm); + + } +} diff --git a/ZR.Service/mes/pro/IService/IProFinishedProductReceiptService.cs b/ZR.Service/mes/pro/IService/IProFinishedProductReceiptService.cs new file mode 100644 index 00000000..6c83d328 --- /dev/null +++ b/ZR.Service/mes/pro/IService/IProFinishedProductReceiptService.cs @@ -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 +{ + /// + /// MES成品入库单主表(含产品信息及标签打印状态)service接口 + /// + public interface IProFinishedProductReceiptService : IBaseService + { + PagedInfo GetList(ProFinishedProductReceiptQueryDto parm); + + ProFinishedProductReceipt GetInfo(string ReceiptNo); + + ProFinishedProductReceipt AddProFinishedProductReceipt(ProFinishedProductReceipt parm); + + int UpdateProFinishedProductReceipt(ProFinishedProductReceipt parm); + + } +} diff --git a/ZR.Service/mes/pro/ProFinishedProductReceiptLogService.cs b/ZR.Service/mes/pro/ProFinishedProductReceiptLogService.cs new file mode 100644 index 00000000..1c4be0f3 --- /dev/null +++ b/ZR.Service/mes/pro/ProFinishedProductReceiptLogService.cs @@ -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 +{ + /// + /// MES成品入库单操作日志表Service业务层处理 + /// + [AppService(ServiceType = typeof(IProFinishedProductReceiptLogService), ServiceLifetime = LifeTime.Transient)] + public class ProFinishedProductReceiptLogService : BaseService, IProFinishedProductReceiptLogService + { + /// + /// 查询MES成品入库单操作日志表列表 + /// + /// + /// + public PagedInfo GetList(ProFinishedProductReceiptLogQueryDto parm) + { + var predicate = Expressionable.Create(); + + var response = Queryable() + .Where(predicate.ToExpression()) + .ToPage(parm); + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public ProFinishedProductReceiptLog GetInfo(long Id) + { + var response = Queryable() + .Where(x => x.Id == Id) + .First(); + + return response; + } + + /// + /// 添加MES成品入库单操作日志表 + /// + /// + /// + public ProFinishedProductReceiptLog AddProFinishedProductReceiptLog(ProFinishedProductReceiptLog model) + { + return Context.Insertable(model).ExecuteReturnEntity(); + } + + /// + /// 修改MES成品入库单操作日志表 + /// + /// + /// + 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); + } + + } +} \ No newline at end of file diff --git a/ZR.Service/mes/pro/ProFinishedProductReceiptService.cs b/ZR.Service/mes/pro/ProFinishedProductReceiptService.cs new file mode 100644 index 00000000..0be8a115 --- /dev/null +++ b/ZR.Service/mes/pro/ProFinishedProductReceiptService.cs @@ -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 +{ + /// + /// MES成品入库单主表(含产品信息及标签打印状态)Service业务层处理 + /// + [AppService(ServiceType = typeof(IProFinishedProductReceiptService), ServiceLifetime = LifeTime.Transient)] + public class ProFinishedProductReceiptService : BaseService, IProFinishedProductReceiptService + { + private readonly IProFinishedProductReceiptLogService _receiptLogService; + + /// + /// 查询MES成品入库单主表(含产品信息及标签打印状态)列表 + /// + /// + /// + public PagedInfo GetList(ProFinishedProductReceiptQueryDto parm) + { + var predicate = Expressionable.Create() + .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(parm); + + return response; + } + + /// + /// 获取详情 + /// + /// + /// + public ProFinishedProductReceipt GetInfo(string ReceiptNo) + { + var response = Queryable() + .Where(x => x.ReceiptNo == ReceiptNo) + .First(); + + return response; + } + + /// + /// 添加MES成品入库单主表(含产品信息及标签打印状态) + /// + /// + /// + 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); + } + } + + /// + /// 修改MES成品入库单主表(含产品信息及标签打印状态) + /// + /// + /// + 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); + } + + } +} \ No newline at end of file