53 changed files with 2165 additions and 44 deletions
@ -0,0 +1,35 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using System.Xml.Linq; |
||||
|
|
||||
|
namespace Win_in.Sfs.Basedata.Boms.DTOs; |
||||
|
public class BomComponentDTO |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
|
||||
|
[Display(Name = "根物料号")] |
||||
|
public string Root { get; set; } |
||||
|
[Display(Name = "物料号")] |
||||
|
public string Component { get; set; } |
||||
|
[Display(Name = "单位")] |
||||
|
public string ComponentUom { get; set; } |
||||
|
[Display(Name = "用量")] |
||||
|
public decimal ComponentQty { get; set; } |
||||
|
|
||||
|
[Display(Name = "父物料号")] |
||||
|
public string ParentComponent { get; set; } |
||||
|
[Display(Name = "合计数量")] |
||||
|
public decimal SumQty { get; set; } |
||||
|
|
||||
|
[Display(Name = "层数")] |
||||
|
public int Level { get; set; } |
||||
|
public List<BomComponent> SubComponents { get; set; } |
||||
|
|
||||
|
[Display(Name = "拆解路径")] |
||||
|
public string Path { set; get; } |
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Win_in.Sfs.Shared.Domain.Shared.Enums.Store.Types; |
||||
|
public enum EnumMesStatus |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 执行中
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "执行中")] |
||||
|
Handling = 2, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 已过时
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "已过时")] |
||||
|
OverTime =3 , |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 有更新
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "有更新")] |
||||
|
Update = 4, |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// WEI
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "未开启")] |
||||
|
New =1 , |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store.Types; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class MesRecordDTO : SfsStoreDTOBase<MesRecordDetailDTO>, IHasNumber |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 任务ID
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "任务ID")] |
||||
|
public string JobNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 类型
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "类型")] |
||||
|
public string Type { get; set; } |
||||
|
|
||||
|
|
||||
|
public EnumMesStatus State { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 请求单号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "请求单号")] |
||||
|
public string ScrapRequestNumber { get; set; } |
||||
|
|
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class MesRecordDetailDTO : SfsStoreDetailWithFromToDTOBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 原因代码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "原因代码")] |
||||
|
public string ReasonCode { get; set; } |
||||
|
|
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
using System.Threading; |
||||
|
|
||||
|
public interface IMesRecordAppService : ISfsStoreMasterReadOnlyAppServiceBase<MesRecordDTO, SfsStoreRequestInputBase, MesRecordDetailDTO, SfsStoreRequestInputBase> |
||||
|
{ |
||||
|
Task<MesRecordDTO> CreateAsync(MesRecordEditInput input); |
||||
|
|
||||
|
Task<PagedResultDto<MesRecordDTO>> GetListByTypeAsync( |
||||
|
SfsStoreRequestInputBase requestInput, |
||||
|
string type, |
||||
|
bool includeDetails = false, |
||||
|
CancellationToken cancellationToken = default); |
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class MesRecordDetailInput : SfsStoreDetailWithFromToInputBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 原因代码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "原因代码")] |
||||
|
public string ReasonCode { get; set; } |
||||
|
|
||||
|
} |
@ -0,0 +1,45 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store.Types; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class MesRecordEditInput : SfsStoreCreateOrUpdateInputBase |
||||
|
{ |
||||
|
#region Create
|
||||
|
/// <summary>
|
||||
|
/// 任务ID
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "任务ID")] |
||||
|
public string JobNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 报废记录号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "记录号")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string Number { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 请求单号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "请求单号")] |
||||
|
public string MesRequestNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 报废类型
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "类型")] |
||||
|
public string Type { get; set; } |
||||
|
|
||||
|
|
||||
|
public EnumMesStatus State { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 明细列表
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "明细列表")] |
||||
|
public List<MesRecordDetailInput> Details { get; set; } |
||||
|
#endregion
|
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class MesRecordImportInput : SfsStoreImportInputBase |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 任务ID
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "任务ID")] |
||||
|
public string JobNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 报废请求单号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "请求单号")] |
||||
|
public string MesRequestNumber { get; set; } |
||||
|
|
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public static class MesRecordPermissions |
||||
|
{ |
||||
|
|
||||
|
public const string Default = StorePermissions.GroupName + "." + nameof(MesRecord); |
||||
|
public const string Create = Default + "." + StorePermissions.CreateStr; |
||||
|
public const string Update = Default + "." + StorePermissions.UpdateStr; |
||||
|
public const string Delete = Default + "." + StorePermissions.DeleteStr; |
||||
|
|
||||
|
//完工收货报废记录
|
||||
|
public const string ProductScrapNote = StorePermissions.GroupName + "." + nameof(ProductScrapNote); |
||||
|
//线边报废记录
|
||||
|
public const string WipScrapNote = StorePermissions.GroupName + "." + nameof(WipScrapNote); |
||||
|
|
||||
|
public static void AddMesRecordPermission(this PermissionGroupDefinition permissionGroup) |
||||
|
{ |
||||
|
var scrapNotePermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(MesRecord))); |
||||
|
scrapNotePermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); |
||||
|
scrapNotePermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); |
||||
|
scrapNotePermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); |
||||
|
|
||||
|
permissionGroup.AddPermission(ProductScrapNote, StorePermissionDefinitionProvider.L(nameof(ProductScrapNote))); |
||||
|
permissionGroup.AddPermission(WipScrapNote, StorePermissionDefinitionProvider.L(nameof(WipScrapNote))); |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,55 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Application.Contracts; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 实体DTO
|
||||
|
/// </summary>
|
||||
|
public class InjectioModelPlanDTO : SfsStoreRequestDTOBase<InjectioModelPlanDetailDTO>, IHasNumber |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 车间
|
||||
|
/// </summary>
|
||||
|
//[Display(Name = "车间")]
|
||||
|
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
|
||||
|
//public string Workshop { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 生产线
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "生产线")]
|
||||
|
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
|
||||
|
//public string ProdLine { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 班次
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "班次")]
|
||||
|
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
|
||||
|
//public string Shift { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 班组
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "班组")]
|
||||
|
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
|
||||
|
//public string Team { get; set; }
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划日期
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "计划日期")] |
||||
|
[ExporterHeader(DisplayName = "计划日期", Format = "yyyy-MM-dd HH:mm")] |
||||
|
public DateTime PlanDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "计划时间")] |
||||
|
[ExporterHeader(DisplayName = "计划时间", Format = "yyyy-MM-dd HH:mm")] |
||||
|
public DateTime PlanTime { get; set; } |
||||
|
|
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class InjectioModelPlanDetailDTO : SfsStoreDetailDTOBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 计划数量
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "计划数量")] |
||||
|
public decimal PlanQty { get; set; } |
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 合格数量
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "合格数量")]
|
||||
|
//public decimal GoodQty { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 不合格数量
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "不合格数量")]
|
||||
|
//public decimal NoGoodQty { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 订单行状态 0:无效1:有效
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "订单行状态")]
|
||||
|
//public int LineStatus { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// Bom版本
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "Bom版本")]
|
||||
|
//public string BomVersion { get; set; }
|
||||
|
|
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
using Win_in.Sfs.Shared.Application.Contracts; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public interface IInjectioModelPlanAppService |
||||
|
: ISfsStoreRequestMasterAppServiceBase<InjectioModelPlanDTO, SfsStoreRequestInputBase, InjectioModelPlanEditInput, InjectioModelPlanDetailDTO, SfsStoreRequestInputBase> |
||||
|
, ISfsCheckStatusAppService |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 开始订单明细
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
Task StartDetailAsync(Guid id, Guid detailId); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 停止订单明细
|
||||
|
/// </summary>
|
||||
|
/// <returns></returns>
|
||||
|
Task StopDetailAsync(Guid id, Guid detailId); |
||||
|
|
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
using Volo.Abp.Authorization.Permissions; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public static class InjectioModelPlanPermissions |
||||
|
{ |
||||
|
public const string Default = StorePermissions.GroupName + "." + nameof(InjectioModelPlan); |
||||
|
public const string Create = Default + "." + StorePermissions.CreateStr; |
||||
|
public const string Update = Default + "." + StorePermissions.UpdateStr; |
||||
|
public const string Delete = Default + "." + StorePermissions.DeleteStr; |
||||
|
|
||||
|
public static void AddInjectioModelPlanPermission(this PermissionGroupDefinition permissionGroup) |
||||
|
{ |
||||
|
var productionPlanPermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(InjectioModelPlan))); |
||||
|
productionPlanPermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr)); |
||||
|
productionPlanPermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr)); |
||||
|
productionPlanPermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
public class InjectioModelPlanDetailInput : SfsStoreDetailDTOBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 计划数量
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "计划数量")] |
||||
|
public decimal PlanQty { get; set; } |
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 合格数量
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "合格数量")]
|
||||
|
//public decimal GoodQty { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 不合格数量
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "不合格数量")]
|
||||
|
//public decimal NoGoodQty { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 订单行状态 0:无效1:有效
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "订单行状态")]
|
||||
|
//public int LineStatus { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// Bom版本
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "Bom版本")]
|
||||
|
//public string BomVersion { get; set; }
|
||||
|
|
||||
|
} |
@ -0,0 +1,76 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 新增和更新基础DTO
|
||||
|
/// </summary>
|
||||
|
public class InjectioModelPlanEditInput : SfsStoreRequestCreateOrUpdateInputBase |
||||
|
{ |
||||
|
#region Base
|
||||
|
///// <summary>
|
||||
|
///// 车间
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "车间")]
|
||||
|
//[Required(ErrorMessage = "{0}是必填项")]
|
||||
|
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
|
||||
|
//public string Workshop { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 生产线
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "生产线")]
|
||||
|
//[Required(ErrorMessage = "{0}是必填项")]
|
||||
|
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
|
||||
|
//public string ProdLine { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 班次
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "班次")]
|
||||
|
//[Required(ErrorMessage = "{0}是必填项")]
|
||||
|
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
|
||||
|
//public string Shift { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 班组
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "班组")]
|
||||
|
//[Required(ErrorMessage = "{0}是必填项")]
|
||||
|
//[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
|
||||
|
//public string Team { get; set; }
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划日期
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "计划日期")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public DateTime PlanDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "计划时间")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public DateTime PlanTime { get; set; } |
||||
|
#endregion
|
||||
|
|
||||
|
#region Create
|
||||
|
/// <summary>
|
||||
|
/// 生产计划单号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "生产计划单号")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")] |
||||
|
public string Number { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 明细列表
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "明细列表")] |
||||
|
public List<InjectioModelPlanDetailInput> Details { get; set; } |
||||
|
#endregion
|
||||
|
} |
@ -0,0 +1,101 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Application.Contracts; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
|
||||
|
[Display(Name = "生产计划")] |
||||
|
public class InjectioModelPlanImportInput : SfsStoreImportInputBase |
||||
|
{ |
||||
|
///// <summary>
|
||||
|
///// 生产计划单号
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "生产计划单号")]
|
||||
|
//public string Number { get; protected set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 车间
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "车间")]
|
||||
|
//[Required(ErrorMessage = "{0}是必填项")]
|
||||
|
|
||||
|
//public string Workshop { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 生产线
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "生产线")]
|
||||
|
//[Required(ErrorMessage = "{0}是必填项")]
|
||||
|
|
||||
|
//public string ProdLine { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 班次
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "班次")]
|
||||
|
//[Required(ErrorMessage = "{0}是必填项")]
|
||||
|
//public string Shift { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 班组
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "班组")]
|
||||
|
//[Required(ErrorMessage = "{0}是必填项")]
|
||||
|
//public string Team { get; set; }
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划日期
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "计划日期")] |
||||
|
[ImporterHeader(Name = "计划日期", Format = "yyyy-MM-dd")] |
||||
|
[ExporterHeader(DisplayName = "计划日期", Format = "yyyy-MM-dd")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public DateTime PlanDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "计划时间")] |
||||
|
[ImporterHeader(Name = "计划时间", Format = "yyyy-MM-dd HH:mm")] |
||||
|
[ExporterHeader(DisplayName = "计划时间", Format = "yyyy-MM-dd HH:mm")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public DateTime PlanTime { get; set; } |
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 仓库代码
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "仓库代码")]
|
||||
|
//public string WarehouseCode { get; set; }
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 物品代码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "明细-物品代码")] |
||||
|
[Required(ErrorMessage = "{0}是必填项")] |
||||
|
public string ItemCode { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 数量
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "明细-计划数量")] |
||||
|
public decimal PlanQty { get; set; } |
||||
|
|
||||
|
///// <summary>
|
||||
|
///// Bom版本
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "明细-Bom版本")]
|
||||
|
//public string BomVersion { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 生产批次
|
||||
|
///// </summary>
|
||||
|
//[Display(Name = "明细-生产批次")]
|
||||
|
//public string Lot { get; set; }
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 备注
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "备注")] |
||||
|
public string Remark { get; set; } |
||||
|
|
||||
|
} |
@ -0,0 +1,173 @@ |
|||||
|
using System; |
||||
|
using System.Linq.Expressions; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using DocumentFormat.OpenXml.Bibliography; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.EventBus; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
using Win_in.Sfs.Wms.Store.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application; |
||||
|
|
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using IdentityModel; |
||||
|
using Omu.ValueInjecter; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Domain.Entities; |
||||
|
using Volo.Abp.ObjectMapping; |
||||
|
using Win_in.Sfs.Basedata.Boms; |
||||
|
using Win_in.Sfs.Basedata.Boms.DTOs; |
||||
|
using Win_in.Sfs.Basedata.Domain; |
||||
|
using Win_in.Sfs.Basedata.Domain.Shared; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
using Win_in.Sfs.Shared.Event; |
||||
|
using Win_in.Sfs.Wms.Inventory.Application.Contracts; |
||||
|
|
||||
|
[Authorize] |
||||
|
[Route($"{StoreConsts.RootPath}mes-record")] |
||||
|
public class MesRecordAppService : |
||||
|
SfsStoreWithDetailsAppServiceBase<MesRecord, MesRecordDTO, SfsStoreRequestInputBase, MesRecordEditInput, |
||||
|
MesRecordDetail, MesRecordDetailDTO, SfsStoreRequestInputBase, MesRecordImportInput>, |
||||
|
IMesRecordAppService |
||||
|
{ |
||||
|
private readonly ILocationAppService _locationAppService; |
||||
|
private readonly IBomAppService _bomAppService; |
||||
|
private readonly IItemBasicAppService _itemBasicAppService; |
||||
|
private readonly IBalanceAppService _balanceAppService; |
||||
|
public MesRecordAppService( |
||||
|
IBomAppService bomAppService, |
||||
|
IMesRecordRepository repository, ILocationAppService locationAppService, IItemBasicAppService itemBasicAppService,IBalanceAppService balanceAppService) : base(repository) |
||||
|
{ |
||||
|
_bomAppService = bomAppService; |
||||
|
_locationAppService = locationAppService; |
||||
|
_itemBasicAppService = itemBasicAppService; |
||||
|
_balanceAppService = balanceAppService; |
||||
|
} |
||||
|
|
||||
|
[HttpPost("")] |
||||
|
public override async Task<MesRecordDTO> CreateAsync(MesRecordEditInput input) |
||||
|
{ |
||||
|
var entity = ObjectMapper.Map<MesRecordEditInput, MesRecord>(input); |
||||
|
|
||||
|
var number = string.IsNullOrEmpty(entity.Number) ? await GenerateNumberAsync(nameof(MesRecord), entity.ActiveDate).ConfigureAwait(false) : entity.Number; |
||||
|
entity.SetIdAndNumberWithDetails(GuidGenerator, number); |
||||
|
|
||||
|
SfsInventoryRequestInputBase pm = new SfsInventoryRequestInputBase(); |
||||
|
// pm.Condition.Filters.Add(new Filter() { Column="", Action= });
|
||||
|
// _balanceAppService.GetBalancePagedListByFilterAsync();
|
||||
|
foreach (var detail in entity.Details) |
||||
|
{ |
||||
|
//var fromLocation=await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false);
|
||||
|
//var toLocation =await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
|
||||
|
//var itemBasicDto =await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
|
||||
|
//if (fromLocation == null)
|
||||
|
//{
|
||||
|
// throw new UserFriendlyException($"库位为空");
|
||||
|
//}
|
||||
|
detail.SetIdAndNumber(GuidGenerator, entity.Id, entity.Number); |
||||
|
detail.FromLocationArea = "X"; |
||||
|
detail.FromLocationErpCode = "X"; |
||||
|
detail.FromLocationGroup = "X"; |
||||
|
detail.FromWarehouseCode = "X"; |
||||
|
detail.ToLocationArea = "X"; |
||||
|
detail.ToLocationErpCode = "X"; |
||||
|
detail.ToLocationGroup = "X"; |
||||
|
detail.ToWarehouseCode = "X"; |
||||
|
detail.ToStatus = 0; |
||||
|
detail.Uom = "X"; |
||||
|
detail.StdPackQty = 1; |
||||
|
|
||||
|
#region 添加校验
|
||||
|
|
||||
|
//RecommendBalanceRequestInput rInput = new RecommendBalanceRequestInput();
|
||||
|
//rInput.ItemCode = detail.ItemCode;
|
||||
|
//rInput.Locations = new List<string>() { detail.FromLocationCode };
|
||||
|
//rInput.Qty = detail.Qty;
|
||||
|
//rInput.Statuses = new List<EnumInventoryStatus> { EnumInventoryStatus.OK };
|
||||
|
//var balanceLst = await _balanceAppService.GetRecommendBalancesByLocationsAsync(rInput).ConfigureAwait(false);
|
||||
|
//var first = balanceLst.FirstOrDefault();
|
||||
|
//if (first != null)
|
||||
|
//{
|
||||
|
// if (detail.Qty <= first.Qty)
|
||||
|
// {
|
||||
|
// throw new UserFriendlyException($"库存数量不足");
|
||||
|
// }
|
||||
|
//}
|
||||
|
//else
|
||||
|
//{
|
||||
|
// throw new UserFriendlyException($"库存数量不足");
|
||||
|
//}
|
||||
|
|
||||
|
#endregion
|
||||
|
} |
||||
|
|
||||
|
entity = await _repository.InsertAsync(entity).ConfigureAwait(false); |
||||
|
// await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData<MesRecord>(entity), false).ConfigureAwait(false);
|
||||
|
|
||||
|
var dto = ObjectMapper.Map<MesRecord, MesRecordDTO>(entity); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
[HttpPost("get-bom-list")] |
||||
|
|
||||
|
|
||||
|
public virtual async Task<List<BomComponentDTO>> GetBomList(List<string> p_nodes) |
||||
|
{ |
||||
|
var list = _repository.WithDetails().Where(p => p_nodes.Contains(p.Number)); |
||||
|
|
||||
|
|
||||
|
List<BomComponentDTO> inputs = new List<BomComponentDTO>(); |
||||
|
foreach (var itm in list) |
||||
|
{ |
||||
|
foreach (var detail in itm.Details) |
||||
|
{ |
||||
|
BomComponentDTO dto = new BomComponentDTO(); |
||||
|
dto.SumQty = detail.Qty; |
||||
|
dto.Component = detail.ItemCode; |
||||
|
dto.ComponentUom = detail.Uom; |
||||
|
dto.Root = detail.ItemCode; |
||||
|
dto.Level = 1; |
||||
|
inputs.Add(dto); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
var bomlist= await _bomAppService.GetSubcomponentsRecursiveList(inputs,EnumBomSelectedType.Last).ConfigureAwait(false); |
||||
|
|
||||
|
return bomlist; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
[HttpPost("by-type/{type}")] |
||||
|
public virtual async Task<PagedResultDto<MesRecordDTO>> GetListByTypeAsync( |
||||
|
SfsStoreRequestInputBase requestInput, |
||||
|
string type, |
||||
|
bool includeDetails = false, |
||||
|
CancellationToken cancellationToken = default) |
||||
|
{ |
||||
|
Expression<Func<MesRecord, bool>> expression = p => p.Type == type; |
||||
|
if (requestInput.Condition.Filters?.Count > 0) |
||||
|
{ |
||||
|
expression = expression.And(requestInput.Condition.Filters.ToLambda<MesRecord>()); |
||||
|
} |
||||
|
|
||||
|
return await GetPagedListAsync(expression, requestInput.SkipCount, requestInput.MaxResultCount, |
||||
|
requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,38 @@ |
|||||
|
using AutoMapper; |
||||
|
using Volo.Abp.AutoMapper; |
||||
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application; |
||||
|
|
||||
|
public partial class StoreApplicationAutoMapperProfile : Profile |
||||
|
{ |
||||
|
private void MesRecordAutoMapperProfile() |
||||
|
{ |
||||
|
CreateMap<MesRecord, MesRecordDTO>() |
||||
|
.ReverseMap(); |
||||
|
|
||||
|
CreateMap<MesRecordDetail, MesRecordDetailDTO>(); |
||||
|
|
||||
|
CreateMap<MesRecordDetailInput, MesRecordDetail>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.MasterID) |
||||
|
.Ignore(x => x.TenantId) |
||||
|
.Ignore(x => x.Number) |
||||
|
.Ignore(x => x.Id); |
||||
|
|
||||
|
CreateMap<MesRecordEditInput, MesRecord>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.TenantId) |
||||
|
.Ignore(x => x.Number) |
||||
|
.Ignore(x => x.Id); |
||||
|
; |
||||
|
CreateMap<MesRecordDetailInput, MesRecordDetail>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.MasterID) |
||||
|
.Ignore(x => x.TenantId) |
||||
|
.Ignore(x => x.Number) |
||||
|
.Ignore(x => x.Id); |
||||
|
; |
||||
|
} |
||||
|
} |
@ -0,0 +1,276 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Omu.ValueInjecter; |
||||
|
using Volo.Abp; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Basedata.Boms.DTOs; |
||||
|
using Win_in.Sfs.Basedata.Domain.Shared; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
using Win_in.Sfs.Wms.Store.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产计划
|
||||
|
/// </summary>
|
||||
|
[Authorize] |
||||
|
[Route($"{StoreConsts.RootPath}injection-model-plan")] |
||||
|
public class InjectioModelPlanAppService : |
||||
|
SfsStoreRequestAppServiceBase<InjectioModelPlan, InjectioModelPlanDTO, SfsStoreRequestInputBase, InjectioModelPlanEditInput, InjectioModelPlanDetail, InjectioModelPlanDetailDTO, SfsStoreRequestInputBase, InjectioModelPlanImportInput>, |
||||
|
IInjectioModelPlanAppService |
||||
|
{ |
||||
|
private readonly IBomAppService _bomAppService; |
||||
|
private readonly IInjectioModelPlanManager _InjectioModelPlanManager; |
||||
|
//private readonly IWorkShopAppService _workShopApp;
|
||||
|
/* private readonly IProductionLineAppService _productionLineApp*/ |
||||
|
//private readonly ITeamAppService _teamApp;
|
||||
|
//private readonly IShiftAppService _shiftApp;
|
||||
|
|
||||
|
public InjectioModelPlanAppService(IInjectioModelPlanRepository repository, |
||||
|
IInjectioModelPlanManager InjectioModelPlanManager |
||||
|
, IWorkShopAppService workShopApp |
||||
|
, IBomAppService bomAppService |
||||
|
, IProductionLineAppService productionLineApp |
||||
|
//, ITeamAppService teamApp
|
||||
|
//, IShiftAppService shiftApp
|
||||
|
) : base(repository, InjectioModelPlanManager) |
||||
|
{ |
||||
|
//_workShopApp = workShopApp;
|
||||
|
//_productionLineApp = productionLineApp;
|
||||
|
//_teamApp = teamApp;
|
||||
|
//_shiftApp = shiftApp;
|
||||
|
_InjectioModelPlanManager = InjectioModelPlanManager; |
||||
|
_bomAppService=bomAppService; |
||||
|
base.CreatePolicyName = InjectioModelPlanPermissions.Create; |
||||
|
base.UpdatePolicyName = InjectioModelPlanPermissions.Update; |
||||
|
base.DeletePolicyName = InjectioModelPlanPermissions.Delete; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 新增实体
|
||||
|
/// </summary>
|
||||
|
/// <param name="input"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("")] |
||||
|
public override async Task<InjectioModelPlanDTO> CreateAsync(InjectioModelPlanEditInput input) |
||||
|
{ |
||||
|
//物品分组
|
||||
|
//var splits = input.Details.Select(c => c.ItemCode).Distinct();
|
||||
|
//var inputDetails = new List<InjectioModelPlanDetailInput>();
|
||||
|
//foreach (var split in splits)
|
||||
|
//{
|
||||
|
// //相同物品 数量汇总
|
||||
|
// foreach (var detail in input.Details.Where(c => c.ItemCode == split))
|
||||
|
// {
|
||||
|
// var sumQty = input.Details.Where(c => c.ItemCode == split).Sum(s => s.PlanQty);
|
||||
|
// detail.PlanQty = sumQty;
|
||||
|
// inputDetails.Add(detail);
|
||||
|
// break;
|
||||
|
// }
|
||||
|
//}
|
||||
|
//input.Details.Clear();
|
||||
|
//input.Details.AddRange(inputDetails);
|
||||
|
|
||||
|
var entity = ObjectMapper.Map<InjectioModelPlanEditInput, InjectioModelPlan>(input); |
||||
|
foreach (var itm in input.Details) |
||||
|
{ |
||||
|
InjectioModelPlanDetail plan= new InjectioModelPlanDetail(); |
||||
|
plan.InjectFrom(itm); |
||||
|
entity.Details.Add(plan); |
||||
|
} |
||||
|
await _InjectioModelPlanManager.CreateAsync(entity).ConfigureAwait(false); |
||||
|
var dto = ObjectMapper.Map<InjectioModelPlan, InjectioModelPlanDTO>(entity); |
||||
|
return dto; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 打开计划明细
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <param name="detailId"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("{id}/detail/start/{detailId}")] |
||||
|
public virtual async Task StartDetailAsync(Guid id, Guid detailId) |
||||
|
{ |
||||
|
var entity = await _repository.FindAsync(id).ConfigureAwait(false); |
||||
|
Check.NotNull(entity, EntityClassName); |
||||
|
await entity.StartDetailAsync(detailId).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 关闭计划明细
|
||||
|
/// </summary>
|
||||
|
/// <param name="id"></param>
|
||||
|
/// <param name="detailId"></param>
|
||||
|
/// <returns></returns>
|
||||
|
[HttpPost("{id}/detail/stop/{detailId}")] |
||||
|
public virtual async Task StopDetailAsync(Guid id, Guid detailId) |
||||
|
{ |
||||
|
var entity = await _repository.FindAsync(id).ConfigureAwait(false); |
||||
|
Check.NotNull(entity, EntityClassName); |
||||
|
await entity.StopDetailAsync(detailId).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
[HttpPost("check-status")] |
||||
|
public virtual async Task CheckStatusAsync(string number) |
||||
|
{ |
||||
|
await Task.CompletedTask.ConfigureAwait(false); |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
[HttpPost("get-sumdetails-byNumbers")] |
||||
|
public virtual async Task<List<BomComponentDTO>> GetBomList(List<string> p_nodes) |
||||
|
{ |
||||
|
var list = _repository.WithDetails().Where(p => p_nodes.Contains(p.Number)); |
||||
|
List<BomComponentDTO> inputs = new List<BomComponentDTO>(); |
||||
|
foreach (var itm in list) |
||||
|
{ |
||||
|
foreach (var detail in itm.Details) |
||||
|
{ |
||||
|
BomComponentDTO dto = new BomComponentDTO(); |
||||
|
dto.ComponentQty = detail.PlanQty; |
||||
|
dto.Component = detail.ItemCode; |
||||
|
dto.ComponentUom = detail.Uom; |
||||
|
dto.Root = detail.ItemCode; |
||||
|
dto.Level = 1; |
||||
|
inputs.Add(dto); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
var bomlist = await _bomAppService.GetSubcomponentsRecursiveList(inputs, EnumBomSelectedType.Last).ConfigureAwait(false); |
||||
|
return bomlist; |
||||
|
//if(bomlist.Count==0)
|
||||
|
//{
|
||||
|
// throw new Exception("Bom中没有查到零件BOM结构");
|
||||
|
//}
|
||||
|
//return ExportImportService.Export(bomlist);
|
||||
|
} |
||||
|
|
||||
|
[HttpPost("get-bom-by-detail")] |
||||
|
public virtual async Task<List<BomComponentDTO>> GetBomByPartCode(InjectioModelPlanDetailInput p_input) |
||||
|
{ |
||||
|
|
||||
|
if (string.IsNullOrEmpty(p_input.Number)) |
||||
|
{ |
||||
|
throw new UserFriendlyException("输入值单号为空!"); |
||||
|
} |
||||
|
if (string.IsNullOrEmpty(p_input.ItemCode)) |
||||
|
{ |
||||
|
throw new UserFriendlyException("输入值零件号为空!"); |
||||
|
} |
||||
|
if (p_input.PlanQty>0) |
||||
|
{ |
||||
|
throw new UserFriendlyException("计划数量必须大于0!"); |
||||
|
} |
||||
|
|
||||
|
var first = _repository.WithDetails().FirstOrDefault(p =>p.Number==p_input.Number ); |
||||
|
List<BomComponentDTO> inputs = new List<BomComponentDTO>(); |
||||
|
if (first != null) |
||||
|
{ |
||||
|
var part = first.Details.FirstOrDefault(p => p.ItemCode == p_input.ItemCode); |
||||
|
if (part != null) |
||||
|
{ |
||||
|
BomComponentDTO dto = new BomComponentDTO(); |
||||
|
dto.ComponentQty = part.PlanQty; |
||||
|
dto.Component = part.ItemCode; |
||||
|
dto.ComponentUom = part.Uom; |
||||
|
dto.Root = part.ItemCode; |
||||
|
dto.Level = 1; |
||||
|
inputs.Add(dto); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
throw new UserFriendlyException($"该单号下没有{p_input.ItemCode}零件"); |
||||
|
} |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
throw new UserFriendlyException("没有查到单号"); |
||||
|
} |
||||
|
|
||||
|
var bomlist = await _bomAppService.GetSubcomponentsRecursiveList(inputs, EnumBomSelectedType.Last).ConfigureAwait(false); |
||||
|
|
||||
|
return bomlist; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
#region Import
|
||||
|
|
||||
|
protected virtual async Task CheckImportInputBusinessAsync(InjectioModelPlanImportInput importInput, EnumImportMethod importMethod, List<ValidationResult> validationRresult) |
||||
|
{ |
||||
|
await CheckItemBasicAsync(importInput).ConfigureAwait(false); |
||||
|
await CheckProdLineAsync(importInput).ConfigureAwait(false); |
||||
|
await CheckWarehourseAsync(importInput).ConfigureAwait(false); |
||||
|
await CheckWorkShopAsync(importInput).ConfigureAwait(false); |
||||
|
await CheckTeamAsync(importInput).ConfigureAwait(false); |
||||
|
await CheckShiftAsync(importInput).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
protected async Task CheckItemBasicAsync(InjectioModelPlanImportInput importInput) |
||||
|
{ |
||||
|
var item = await ItemBasicAclService.GetByCodeAsync(importInput.ItemCode).ConfigureAwait(false); |
||||
|
|
||||
|
Check.NotNull(item, "物品代码", "物品不存在"); |
||||
|
} |
||||
|
|
||||
|
protected async Task CheckProdLineAsync(InjectioModelPlanImportInput importInput) |
||||
|
{ |
||||
|
//var item = await _productionLineApp.GetByCodeAsync(importInput.ProdLine).ConfigureAwait(false);
|
||||
|
|
||||
|
//Check.NotNull(item, "生产线", "生产线不存在");
|
||||
|
} |
||||
|
|
||||
|
protected async Task CheckWarehourseAsync(InjectioModelPlanImportInput importInput) |
||||
|
{ |
||||
|
//var item = await WarehouseAclService.GetByCodeAsync(importInput.WarehouseCode).ConfigureAwait(false);
|
||||
|
|
||||
|
//Check.NotNull(item, "仓库代码", "仓库不存在");
|
||||
|
} |
||||
|
|
||||
|
protected async Task CheckWorkShopAsync(InjectioModelPlanImportInput importInput) |
||||
|
{ |
||||
|
//var item = await _workShopApp.GetByCodeAsync(importInput.Workshop).ConfigureAwait(false);
|
||||
|
|
||||
|
//Check.NotNull(item, "车间", "车间不存在");
|
||||
|
} |
||||
|
|
||||
|
protected async Task CheckTeamAsync(InjectioModelPlanImportInput importInput) |
||||
|
{ |
||||
|
//var item = await _teamApp.GetByCodeAsync(importInput.Team).ConfigureAwait(false);
|
||||
|
|
||||
|
//Check.NotNull(item, "班组", "班组不存在");
|
||||
|
} |
||||
|
|
||||
|
protected async Task CheckShiftAsync(InjectioModelPlanImportInput importInput) |
||||
|
{ |
||||
|
//var item = await _shiftApp.GetByCodeAsync(importInput.Shift).ConfigureAwait(false);
|
||||
|
|
||||
|
//Check.NotNull(item, "班次", "班次不存在");
|
||||
|
} |
||||
|
|
||||
|
protected virtual async Task ImportDataAsync(List<InjectioModelPlan> entites, List<InjectioModelPlan> deleteEntities) |
||||
|
{ |
||||
|
await _InjectioModelPlanManager.ImportDataAsync(entites, deleteEntities).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
//protected override Func<InjectioModelPlanImportInput, object> GetEntityExpression()
|
||||
|
//{
|
||||
|
// return p => (p.WarehouseCode, p.Workshop, p.ProdLine, p.Shift, p.Team, p.PlanDate, p.PlanTime);
|
||||
|
//}
|
||||
|
|
||||
|
#endregion Import
|
||||
|
} |
@ -0,0 +1,93 @@ |
|||||
|
using AutoMapper; |
||||
|
using Volo.Abp.AutoMapper; |
||||
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Application; |
||||
|
|
||||
|
public partial class StoreApplicationAutoMapperProfile : Profile |
||||
|
{ |
||||
|
private void InjectioModelPlanAutoMapperProfile() |
||||
|
{ |
||||
|
CreateMap<InjectioModelPlan, InjectioModelPlanDTO>() |
||||
|
.ReverseMap(); |
||||
|
CreateMap<InjectioModelPlan, InjectioModelPlanEditInput>() |
||||
|
.ReverseMap(); |
||||
|
CreateMap<InjectioModelPlanDetail, InjectioModelPlanDetailDTO>() |
||||
|
|
||||
|
.ReverseMap(); |
||||
|
|
||||
|
CreateMap<InjectioModelPlanDetailInput, InjectioModelPlanDetail>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.Uom) |
||||
|
.Ignore(x => x.MasterID) |
||||
|
.Ignore(x => x.TenantId) |
||||
|
.Ignore(x => x.Number) |
||||
|
.Ignore(x => x.Id); |
||||
|
|
||||
|
// CreateMap<PreparationPlan, PreparationPlanEditInput>();
|
||||
|
|
||||
|
CreateMap<InjectioModelPlanImportInput, InjectioModelPlan>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.Details) |
||||
|
.Ignore(x => x.TenantId) |
||||
|
.Ignore(x => x.Number) |
||||
|
.Ignore(x => x.RequestStatus) |
||||
|
.Ignore(x => x.ConcurrencyStamp) |
||||
|
.Ignore(x => x.ExtraProperties) |
||||
|
.Ignore(x => x.ActiveDate) |
||||
|
; |
||||
|
|
||||
|
CreateMap<InjectioModelPlanImportInput, InjectioModelPlanDetail>() |
||||
|
.Ignore(x => x.Uom) |
||||
|
.Ignore(x => x.ItemName).Ignore(x => x.ItemDesc1).Ignore(x => x.ItemDesc2) |
||||
|
.Ignore(x => x.PlanQty) |
||||
|
//.Ignore(x => x.SupplierBatch)
|
||||
|
//.Ignore(x => x.ArriveDate)
|
||||
|
//.Ignore(x => x.ProduceDate)
|
||||
|
//.Ignore(x => x.ExpireDate)
|
||||
|
|
||||
|
.Ignore(x => x.TenantId) |
||||
|
.Ignore(x => x.MasterID) |
||||
|
.Ignore(x => x.Number) |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.Id); |
||||
|
|
||||
|
CreateMap<InjectioModelPlanEditInput, InjectioModelPlan>() |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.Details) |
||||
|
.Ignore(x => x.TenantId) |
||||
|
.Ignore(x => x.Number) |
||||
|
.Ignore(x => x.RequestStatus) |
||||
|
.Ignore(x => x.ConcurrencyStamp) |
||||
|
.Ignore(x => x.ExtraProperties) |
||||
|
.Ignore(x => x.ActiveDate) |
||||
|
; |
||||
|
|
||||
|
CreateMap<InjectioModelPlanDetailInput, InjectioModelPlanDetail>() |
||||
|
.Ignore(x => x.Uom) |
||||
|
.Ignore(x => x.ItemName).Ignore(x => x.ItemDesc1).Ignore(x => x.ItemDesc2) |
||||
|
.Ignore(x => x.PlanQty) |
||||
|
//.Ignore(x => x.SupplierBatch)
|
||||
|
//.Ignore(x => x.ArriveDate)
|
||||
|
//.Ignore(x => x.ProduceDate)
|
||||
|
//.Ignore(x => x.ExpireDate)
|
||||
|
|
||||
|
.Ignore(x => x.TenantId) |
||||
|
.Ignore(x => x.MasterID) |
||||
|
.Ignore(x => x.Number) |
||||
|
.IgnoreAuditedObjectProperties() |
||||
|
.Ignore(x => x.Id); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,5 @@ |
|||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
public interface IMesRecordManager : ISfsStoreManager<MesRecord, MesRecordDetail> |
||||
|
{ |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
public interface IMesRecordRepository : ISfsStoreRepositoryBase<MesRecord> |
||||
|
{ |
||||
|
|
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
using Win_in.Sfs.Shared.Domain.Entities; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared.Enums.Store.Types; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 报废记录
|
||||
|
/// </summary>
|
||||
|
public class MesRecord : SfsStoreAggregateRootBase<MesRecordDetail>, IHasJobNumber |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 任务ID
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public string JobNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
///请求单号
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public string MesRequestNumber { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Mes类型
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public string Type { get; set; } |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Mes类型
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public EnumMesStatus State { get; set; } |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 明细列表
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public override List<MesRecordDetail> Details { get; set; } = new List<MesRecordDetail>(); |
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
public class MesRecordDetail : SfsStoreDetailWithFromToEntityBase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 原因代码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "原因代码")] |
||||
|
public string ReasonCode { get; set; } |
||||
|
|
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
public class MesRecordManager : SfsStoreManagerBase<MesRecord, MesRecordDetail>, IMesRecordManager |
||||
|
{ |
||||
|
|
||||
|
public MesRecordManager( |
||||
|
IMesRecordRepository repository |
||||
|
) : base(repository) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
public interface IInjectioModelPlanManager : ISfsStoreRequestManager<InjectioModelPlan, InjectioModelPlanDetail>, IBulkImportService<InjectioModelPlan> |
||||
|
{ |
||||
|
|
||||
|
} |
@ -0,0 +1,7 @@ |
|||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
public interface IInjectioModelPlanRepository : ISfsStoreRepositoryBase<InjectioModelPlan>, ISfsBulkRepositoryBase<InjectioModelPlan> |
||||
|
{ |
||||
|
} |
@ -0,0 +1,76 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Win_in.Sfs.Shared.Domain.Entities; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产计划
|
||||
|
/// </summary>
|
||||
|
public class InjectioModelPlan : SfsStoreRequestAggregateRootBase<InjectioModelPlanDetail> |
||||
|
{ |
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 车间
|
||||
|
///// </summary>
|
||||
|
//public string Workshop { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 生产线
|
||||
|
///// </summary>
|
||||
|
//public string ProdLine { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 班次
|
||||
|
///// </summary>
|
||||
|
//public string Shift { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 班组
|
||||
|
///// </summary>
|
||||
|
//public string Team { get; set; }
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划日期
|
||||
|
/// </summary>
|
||||
|
public DateTime PlanDate { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划时间
|
||||
|
/// </summary>
|
||||
|
public DateTime PlanTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 明细列表
|
||||
|
/// </summary>
|
||||
|
[IgnoreUpdate] |
||||
|
public override List<InjectioModelPlanDetail> Details { get; set; } = new List<InjectioModelPlanDetail>(); |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 打开订单明细
|
||||
|
/// </summary>
|
||||
|
/// <param name="detailId"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public virtual async Task StartDetailAsync(Guid detailId) |
||||
|
{ |
||||
|
await Task.CompletedTask.ConfigureAwait(false); |
||||
|
var detail = GetDetail(detailId); |
||||
|
//detail.LineStatus = 1;
|
||||
|
ReplaceDetail(detailId, detail); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 关闭订单明细
|
||||
|
/// </summary>
|
||||
|
/// <param name="detailId"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public virtual async Task StopDetailAsync(Guid detailId) |
||||
|
{ |
||||
|
await Task.CompletedTask.ConfigureAwait(false); |
||||
|
var detail = GetDetail(detailId); |
||||
|
//detail.LineStatus = 0;
|
||||
|
ReplaceDetail(detailId, detail); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产计划-明细列表
|
||||
|
/// </summary>
|
||||
|
public class InjectioModelPlanDetail : SfsStoreDetailEntityBase |
||||
|
{ |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计划数量
|
||||
|
/// </summary>
|
||||
|
public decimal PlanQty { get; set; } |
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 合格数量
|
||||
|
///// </summary>
|
||||
|
//public decimal GoodQty { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 不合格数量
|
||||
|
///// </summary>
|
||||
|
//public decimal NoGoodQty { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// Bom版本
|
||||
|
///// </summary>
|
||||
|
//public string BomVersion { get; set; }
|
||||
|
|
||||
|
///// <summary>
|
||||
|
///// 订单行状态 0:无效1:有效
|
||||
|
///// </summary>
|
||||
|
//public int LineStatus { get; set; }
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 计量单位
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "计量单位")] |
||||
|
[MaxLength(SfsPropertyConst.CodeLength)] |
||||
|
public string Uom { get; set; } |
||||
|
} |
@ -0,0 +1,430 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Win_in.Sfs.Basedata.Application.Contracts; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
public class InjectioModelPlanManager : SfsStoreRequestManagerBase<InjectioModelPlan, InjectioModelPlanDetail>, IInjectioModelPlanManager |
||||
|
{ |
||||
|
private readonly IInjectioModelPlanRepository _repository; |
||||
|
private readonly IPreparationPlanManager _preparationPlanManager; |
||||
|
private readonly IWarehouseAppService _warehouseApp; |
||||
|
private readonly IWorkShopAppService _workShopApp; |
||||
|
private readonly IProductionLineAppService _productionLineApp; |
||||
|
private readonly ITeamAppService _teamApp; |
||||
|
private readonly IShiftAppService _shiftApp; |
||||
|
|
||||
|
public InjectioModelPlanManager( |
||||
|
IInjectioModelPlanRepository repository, |
||||
|
IPreparationPlanManager preparationPlanManager, |
||||
|
IWarehouseAppService warehouseApp, |
||||
|
IWorkShopAppService workShopApp, |
||||
|
IProductionLineAppService productionLineApp, |
||||
|
ITeamAppService teamApp, |
||||
|
IShiftAppService shiftApp |
||||
|
) : base(repository) |
||||
|
{ |
||||
|
_repository = repository; |
||||
|
_preparationPlanManager = preparationPlanManager; |
||||
|
_warehouseApp = warehouseApp; |
||||
|
_workShopApp = workShopApp; |
||||
|
_productionLineApp = productionLineApp; |
||||
|
_teamApp = teamApp; |
||||
|
_shiftApp = shiftApp; |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
/// <summary>
|
||||
|
/// 生产计划打开后,根据策略生成完工收货任务
|
||||
|
/// </summary>
|
||||
|
/// <param name="entity"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public virtual async Task HandleAsync(InjectioModelPlan entity) |
||||
|
{ |
||||
|
entity.Status = EnumStoreStatus.Handling; |
||||
|
await Repository.UpdateAsync(entity); |
||||
|
|
||||
|
//发布事件
|
||||
|
var eto = ObjectMapper.Map<InjectioModelPlan, InjectioModelPlanStartedETO>(entity); |
||||
|
await DistributedEventBus.PublishAsync(eto); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产计划打开后,打开完工收货任务
|
||||
|
/// </summary>
|
||||
|
/// <param name="entity"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public virtual async Task OpenAsync(InjectioModelPlan entity) |
||||
|
{ |
||||
|
entity.Status = EnumStoreStatus.New; |
||||
|
await Repository.UpdateAsync(entity); |
||||
|
await _preparationPlanManager.OpenInjectioModelPlanAsync(entity); |
||||
|
|
||||
|
//发布事件
|
||||
|
var eto = ObjectMapper.Map<InjectioModelPlan, InjectioModelPlanOpenedETO>(entity); |
||||
|
await DistributedEventBus.PublishAsync(eto); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生产计划关闭后,关闭完工收货任务
|
||||
|
/// </summary>
|
||||
|
/// <param name="entity"></param>
|
||||
|
/// <returns></returns>
|
||||
|
public virtual async Task CloseAsync(InjectioModelPlan entity) |
||||
|
{ |
||||
|
entity.Status = EnumStoreStatus.Closed; |
||||
|
await Repository.UpdateAsync(entity); |
||||
|
await _preparationPlanManager.CloseInjectioModelPlanAsync(entity); |
||||
|
|
||||
|
//发布事件
|
||||
|
var eto = ObjectMapper.Map<InjectioModelPlan, InjectioModelPlanClosedETO>(entity); |
||||
|
await DistributedEventBus.PublishAsync(eto); |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
#region Import
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 检查导入数据 过滤 数据
|
||||
|
/// </summary>
|
||||
|
public virtual async Task<SfsImportData<InjectioModelPlan, InjectioModelPlanDetail>> BuildAndVerifyImportDataAsync(List<InjectioModelPlan> entities, List<InjectioModelPlanDetail> details, EnumImportMethod importMethod = EnumImportMethod.Update) |
||||
|
{ |
||||
|
var importData = new SfsImportData<InjectioModelPlan, InjectioModelPlanDetail>(); |
||||
|
|
||||
|
//foreach (var entity in entities)
|
||||
|
//{
|
||||
|
// //var exist = await Repository.FindAsync(t => t.Number == entity.Number );
|
||||
|
|
||||
|
// var errs = new List<string>();
|
||||
|
|
||||
|
// await CheckWorkshopAsync(entity, errs).ConfigureAwait(false);
|
||||
|
// await CheckProdLineAsync(entity, errs).ConfigureAwait(false);
|
||||
|
// await CheckTeamAsync(entity, errs).ConfigureAwait(false);
|
||||
|
// await CheckShiftAsync(entity, errs).ConfigureAwait(false);
|
||||
|
|
||||
|
// //if (exist != null)
|
||||
|
// //{
|
||||
|
// // errs.Add("数据已存在");
|
||||
|
// //}
|
||||
|
|
||||
|
// //if (errs.Count > 0)
|
||||
|
// //{
|
||||
|
// // importData.ErrorData.Add(entity, errs);
|
||||
|
// // continue;
|
||||
|
// //}
|
||||
|
|
||||
|
// entity.RequestStatus = EnumRequestStatus.New;
|
||||
|
|
||||
|
// var details1 = details.FindAll(t => t.MasterID == entity.Id);
|
||||
|
|
||||
|
// var isErrDetail = false;
|
||||
|
|
||||
|
// foreach (var detail in details1)
|
||||
|
// {
|
||||
|
// var detialErrs = new List<string>();
|
||||
|
|
||||
|
// if (!string.IsNullOrEmpty(detail.ItemCode))
|
||||
|
// {
|
||||
|
// try
|
||||
|
// {
|
||||
|
// var item = await ItemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
|
||||
|
|
||||
|
// if (item != null)
|
||||
|
// {
|
||||
|
// detail.ItemName = item.Name;
|
||||
|
// detail.ItemDesc1 = item.Desc1;
|
||||
|
// detail.ItemDesc2 = item.Desc2;
|
||||
|
// var validateDays = item.GetValidateDays();
|
||||
|
// detail.ExpireDate = detail.ProduceDate.AddDays(validateDays);
|
||||
|
// }
|
||||
|
|
||||
|
// if (item == null)
|
||||
|
// {
|
||||
|
// detialErrs.Add("物品不存在");
|
||||
|
// }
|
||||
|
// }
|
||||
|
// catch (Exception ex)
|
||||
|
// {
|
||||
|
// if (ex.Message.Contains("不存在,或该唯一值存在多条记录。"))
|
||||
|
// {
|
||||
|
// detialErrs.Add("物品不存在");
|
||||
|
// }
|
||||
|
// else
|
||||
|
// {
|
||||
|
// detialErrs.Add(ex.Message);
|
||||
|
// }
|
||||
|
// }
|
||||
|
// }
|
||||
|
|
||||
|
// if (detialErrs.Count > 0)
|
||||
|
// {
|
||||
|
// importData.ErrorData1.Add(detail, detialErrs);
|
||||
|
|
||||
|
// isErrDetail = true;
|
||||
|
// }
|
||||
|
// }
|
||||
|
|
||||
|
// if (errs.Count > 0 || isErrDetail)
|
||||
|
// {
|
||||
|
// importData.ErrorData.Add(entity, errs);
|
||||
|
|
||||
|
// foreach (var detail in details1)
|
||||
|
// {
|
||||
|
// if (!importData.ErrorData1.ContainsKey(detail))
|
||||
|
// {
|
||||
|
// importData.ErrorData1.Add(detail, new List<string>());
|
||||
|
// }
|
||||
|
|
||||
|
// importData.ErrorData1[detail].AddRange(errs);
|
||||
|
// }
|
||||
|
// }
|
||||
|
// else
|
||||
|
// {
|
||||
|
// importData.InsertDetails.AddRange(details1);
|
||||
|
// entity.Details = details1;
|
||||
|
|
||||
|
// entity.SetIdAndNumberWithDetails(GuidGenerator, await GenerateNumberAsync(nameof(InjectioModelPlan), entity.ActiveDate).ConfigureAwait(false));
|
||||
|
|
||||
|
// if (importMethod == EnumImportMethod.Replace)
|
||||
|
// {
|
||||
|
// //if (exist != null)
|
||||
|
// //{
|
||||
|
// // importData.DeleteEntities.Add(exist);
|
||||
|
// //}
|
||||
|
// //else
|
||||
|
// //{
|
||||
|
|
||||
|
// //}
|
||||
|
|
||||
|
// importData.MergeEntities.Add(entity);
|
||||
|
// }
|
||||
|
// else if (importMethod == EnumImportMethod.Update)
|
||||
|
// {
|
||||
|
// //if (exist != null)
|
||||
|
// //{
|
||||
|
// // importData.DeleteEntities.Add(exist);
|
||||
|
// //}
|
||||
|
// //else
|
||||
|
// //{
|
||||
|
// //}
|
||||
|
|
||||
|
// importData.MergeEntities.Add(entity);
|
||||
|
// }
|
||||
|
// }
|
||||
|
//}
|
||||
|
|
||||
|
return importData; |
||||
|
} |
||||
|
|
||||
|
private async Task CheckShiftAsync(InjectioModelPlan entity, List<string> errs) |
||||
|
{ |
||||
|
//if (!string.IsNullOrEmpty(entity.Shift))
|
||||
|
//{
|
||||
|
// try
|
||||
|
// {
|
||||
|
// var item = await _shiftApp.GetByCodeAsync(entity.Shift).ConfigureAwait(false);
|
||||
|
|
||||
|
// if (item == null)
|
||||
|
// {
|
||||
|
// errs.Add("班次不存在");
|
||||
|
// }
|
||||
|
// }
|
||||
|
// catch (Exception ex)
|
||||
|
// {
|
||||
|
// if (ex.Message.Contains("不存在,或该唯一值存在多条记录。"))
|
||||
|
// {
|
||||
|
// errs.Add("班次不存在");
|
||||
|
// }
|
||||
|
// else
|
||||
|
// {
|
||||
|
// errs.Add(ex.Message);
|
||||
|
// }
|
||||
|
// }
|
||||
|
//}
|
||||
|
} |
||||
|
|
||||
|
private async Task CheckTeamAsync(InjectioModelPlan entity, List<string> errs) |
||||
|
{ |
||||
|
//if (!string.IsNullOrEmpty(entity.Team))
|
||||
|
//{
|
||||
|
// try
|
||||
|
// {
|
||||
|
// var item = await _teamApp.GetByCodeAsync(entity.Team).ConfigureAwait(false);
|
||||
|
|
||||
|
// if (item == null)
|
||||
|
// {
|
||||
|
// errs.Add("班组不存在");
|
||||
|
// }
|
||||
|
// }
|
||||
|
// catch (Exception ex)
|
||||
|
// {
|
||||
|
// if (ex.Message.Contains("不存在,或该唯一值存在多条记录。"))
|
||||
|
// {
|
||||
|
// errs.Add("班组不存在");
|
||||
|
// }
|
||||
|
// else
|
||||
|
// {
|
||||
|
// errs.Add(ex.Message);
|
||||
|
// }
|
||||
|
// }
|
||||
|
//}
|
||||
|
} |
||||
|
|
||||
|
private async Task CheckProdLineAsync(InjectioModelPlan entity, List<string> errs) |
||||
|
{ |
||||
|
//if (!string.IsNullOrEmpty(entity.ProdLine))
|
||||
|
//{
|
||||
|
// try
|
||||
|
// {
|
||||
|
// var item = await _productionLineApp.GetByCodeAsync(entity.ProdLine).ConfigureAwait(false);
|
||||
|
|
||||
|
// if (item == null)
|
||||
|
// {
|
||||
|
// errs.Add("生产线不存在");
|
||||
|
// }
|
||||
|
// }
|
||||
|
// catch (Exception ex)
|
||||
|
// {
|
||||
|
// if (ex.Message.Contains("不存在,或该唯一值存在多条记录。"))
|
||||
|
// {
|
||||
|
// errs.Add("生产线不存在");
|
||||
|
// }
|
||||
|
// else
|
||||
|
// {
|
||||
|
// errs.Add(ex.Message);
|
||||
|
// }
|
||||
|
// }
|
||||
|
//}
|
||||
|
} |
||||
|
|
||||
|
private async Task CheckWorkshopAsync(InjectioModelPlan entity, List<string> errs) |
||||
|
{ |
||||
|
//if (!string.IsNullOrEmpty(entity.Workshop))
|
||||
|
//{
|
||||
|
// try
|
||||
|
// {
|
||||
|
// var item = await _workShopApp.GetByCodeAsync(entity.Workshop).ConfigureAwait(false);
|
||||
|
|
||||
|
// if (item == null)
|
||||
|
// {
|
||||
|
// errs.Add("车间不存在");
|
||||
|
// }
|
||||
|
// }
|
||||
|
// catch (Exception ex)
|
||||
|
// {
|
||||
|
// if (ex.Message.Contains("不存在,或该唯一值存在多条记录。"))
|
||||
|
// {
|
||||
|
// errs.Add("车间不存在");
|
||||
|
// }
|
||||
|
// else
|
||||
|
// {
|
||||
|
// errs.Add(ex.Message);
|
||||
|
// }
|
||||
|
// }
|
||||
|
//}
|
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 执行导入
|
||||
|
/// </summary>
|
||||
|
public virtual async Task ImportDataAsync(List<InjectioModelPlan> mergeEntities, List<InjectioModelPlan> deleteEntities = null) |
||||
|
{ |
||||
|
if (deleteEntities != null && deleteEntities.Count > 0) |
||||
|
{ |
||||
|
await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false); |
||||
|
} |
||||
|
|
||||
|
foreach (var entity in mergeEntities) |
||||
|
{ |
||||
|
entity.SetIdAndNumberWithDetails(GuidGenerator, await GenerateNumberAsync(nameof(InjectioModelPlan), entity.PlanDate).ConfigureAwait(false)); |
||||
|
} |
||||
|
|
||||
|
await _repository.BulkMergeAsync(mergeEntities).ConfigureAwait(false); |
||||
|
|
||||
|
var insertDetails = new List<InjectioModelPlanDetail>(); |
||||
|
|
||||
|
foreach (var item in mergeEntities) |
||||
|
{ |
||||
|
await SetDetailAsync(item.Details).ConfigureAwait(false); |
||||
|
|
||||
|
insertDetails.AddRange(item.Details); |
||||
|
} |
||||
|
|
||||
|
await _repository.BulkInsertAsync(insertDetails).ConfigureAwait(false); |
||||
|
|
||||
|
} |
||||
|
private async Task SetDetailAsync(List<InjectioModelPlanDetail> details) |
||||
|
{ |
||||
|
foreach (var detail in details) |
||||
|
{ |
||||
|
var item = await ItemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); |
||||
|
Check.NotNull(item, "物品代码", $"物品 {detail.ItemCode} 不存在"); |
||||
|
|
||||
|
if (item != null) |
||||
|
{ |
||||
|
detail.ItemName = item.Name; |
||||
|
detail.ItemDesc1 = item.Desc1; |
||||
|
detail.ItemDesc2 = item.Desc2; |
||||
|
var validateDays = item.GetValidateDays(); |
||||
|
//detail.ExpireDate = detail.ProduceDate.AddDays(validateDays);
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#endregion
|
||||
|
|
||||
|
/* |
||||
|
/// <summary>
|
||||
|
/// 赋值ETO
|
||||
|
/// </summary>
|
||||
|
/// <param name="model"></param>
|
||||
|
/// <returns></returns>
|
||||
|
private InjectioModelPlanStartedETO CreateInjectioModelPlanETO(InjectioModelPlan model) |
||||
|
{ |
||||
|
var eto = new InjectioModelPlanStartedETO() |
||||
|
{ |
||||
|
Number = model.Number, |
||||
|
Workshop = model.Workshop, |
||||
|
ProdLine = model.ProdLine, |
||||
|
Shift = model.Shift, |
||||
|
Team = model.Team, |
||||
|
PlanDate = model.PlanDate, |
||||
|
PlanTime = model.PlanTime, |
||||
|
Status = model.Status, |
||||
|
Details = CreateDetailETOList(model.Details) |
||||
|
}; |
||||
|
return eto; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 赋值子表ETO数据
|
||||
|
/// </summary>
|
||||
|
/// <param name="details"></param>
|
||||
|
/// <returns></returns>
|
||||
|
private List<InjectioModelPlanDetailETO> CreateDetailETOList(List<InjectioModelPlanDetail> details) |
||||
|
{ |
||||
|
var list = new List<InjectioModelPlanDetailETO>(); |
||||
|
foreach (var detail in details) |
||||
|
{ |
||||
|
var detailETO = new InjectioModelPlanDetailETO() |
||||
|
{ |
||||
|
Number =detail.Number, |
||||
|
Item = detail.Item, |
||||
|
ItemCode = detail.ItemCode, |
||||
|
PlanQty = detail.PlanQty, |
||||
|
GoodQty = detail.GoodQty, |
||||
|
NoGoodQty = detail.NoGoodQty, |
||||
|
BomVersion = detail.BomVersion, |
||||
|
LineStatus = detail.LineStatus |
||||
|
}; |
||||
|
list.Add(detailETO); |
||||
|
} |
||||
|
return list; |
||||
|
} |
||||
|
*/ |
||||
|
|
||||
|
} |
@ -0,0 +1,65 @@ |
|||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore.Modeling; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; |
||||
|
|
||||
|
public static class MesRecordDbContextModelCreatingExtensions |
||||
|
{ |
||||
|
public static void ConfigureMesRecord(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options) |
||||
|
{ |
||||
|
builder.Entity<MesRecord>(b => |
||||
|
{ |
||||
|
//Configure table & schema name
|
||||
|
b.ToTable(options.TablePrefix + nameof(MesRecord), options.Schema); |
||||
|
//Configure ABP properties
|
||||
|
b.ConfigureByConvention(); |
||||
|
//Configure Sfs base properties
|
||||
|
b.ConfigureSfsStoreBase(); |
||||
|
|
||||
|
//Properties
|
||||
|
b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.MesRequestNumber).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
//Relations
|
||||
|
b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired(); |
||||
|
|
||||
|
//Indexes
|
||||
|
b.HasIndex(q => new { q.Number }).IsUnique(); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<MesRecordDetail>(b => |
||||
|
{ |
||||
|
//Configure table & schema name
|
||||
|
b.ToTable(options.TablePrefix + nameof(MesRecordDetail), options.Schema); |
||||
|
//Configure ABP properties
|
||||
|
b.ConfigureByConvention(); |
||||
|
//Configure Sfs base properties
|
||||
|
b.ConfigureSfsStoreBase(); |
||||
|
//Configure Sfs store detail properties
|
||||
|
b.ConfigureSfsStoreDetailBase(); |
||||
|
|
||||
|
//Properties
|
||||
|
b.Property(q => q.ReasonCode).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.FromStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); |
||||
|
b.Property(q => q.ToStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); |
||||
|
b.Property(q => q.FromPackingCode).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
b.Property(q => q.FromLocationCode).HasMaxLength(SfsPropertyConst.CodeLength); |
||||
|
|
||||
|
//Relations
|
||||
|
|
||||
|
//Indexes
|
||||
|
b.HasIndex( |
||||
|
q => new |
||||
|
{ |
||||
|
q.Number, |
||||
|
q.ItemCode, |
||||
|
q.FromPackingCode, |
||||
|
q.FromLocationCode, |
||||
|
q.ToLocationCode, |
||||
|
q.FromLot, |
||||
|
q.FromStatus |
||||
|
}).IsUnique(); |
||||
|
}); |
||||
|
} |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; |
||||
|
|
||||
|
public class MesRecordEfCoreRepository : SfsStoreEfCoreRepositoryBase<StoreDbContext, MesRecord>, IMesRecordRepository |
||||
|
{ |
||||
|
public MesRecordEfCoreRepository(IDbContextProvider<StoreDbContext> dbContextProvider) : base(dbContextProvider) |
||||
|
{ |
||||
|
} |
||||
|
} |
@ -0,0 +1,60 @@ |
|||||
|
using Microsoft.EntityFrameworkCore; |
||||
|
using Volo.Abp.EntityFrameworkCore.Modeling; |
||||
|
using Win_in.Sfs.Shared.Domain.Shared; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; |
||||
|
|
||||
|
public static class InjectioModelPlanDbContextModelCreatingExtensions |
||||
|
{ |
||||
|
public static void ConfigureInjectioModelPlan(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options) |
||||
|
{ |
||||
|
builder.Entity<InjectioModelPlan>(b => |
||||
|
{ |
||||
|
//Configure table & schema name
|
||||
|
b.ToTable(options.TablePrefix + nameof(InjectioModelPlan), options.Schema); |
||||
|
//Configure ABP properties
|
||||
|
b.ConfigureByConvention(); |
||||
|
//Configure Sfs base properties
|
||||
|
b.ConfigureSfsStoreBase(); |
||||
|
|
||||
|
//Properties
|
||||
|
//b.Property(q => q.Workshop).IsRequired().HasMaxLength(SfsPropertyConst.NameLength);
|
||||
|
//b.Property(q => q.ProdLine).IsRequired().HasMaxLength(SfsPropertyConst.NameLength);
|
||||
|
//b.Property(q => q.Shift).IsRequired().HasMaxLength(SfsPropertyConst.NameLength);
|
||||
|
//b.Property(q => q.Team).IsRequired().HasMaxLength(SfsPropertyConst.NameLength);
|
||||
|
b.Property(q => q.PlanDate).IsRequired(); |
||||
|
b.Property(q => q.PlanTime).IsRequired(); |
||||
|
|
||||
|
b.Property(q => q.RequestStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion<string>(); |
||||
|
|
||||
|
//Relations
|
||||
|
b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired(); |
||||
|
|
||||
|
//Indexes
|
||||
|
b.HasIndex(q => new { q.Number }).IsUnique(); |
||||
|
}); |
||||
|
|
||||
|
builder.Entity<InjectioModelPlanDetail>(b => |
||||
|
{ |
||||
|
//Configure table & schema name
|
||||
|
b.ToTable(options.TablePrefix + nameof(InjectioModelPlanDetail), options.Schema); |
||||
|
//Configure ABP properties
|
||||
|
b.ConfigureByConvention(); |
||||
|
//Configure Sfs base properties
|
||||
|
b.ConfigureSfsStoreBase(); |
||||
|
//Configure Sfs store detail properties
|
||||
|
b.ConfigureSfsStoreDetailBase(); |
||||
|
//Properties
|
||||
|
|
||||
|
//b.Property(q => q.BomVersion).HasMaxLength(SfsPropertyConst.CodeLength);
|
||||
|
//b.Property(q => q.GoodQty).HasDefaultValue(1);
|
||||
|
//b.Property(q => q.NoGoodQty).HasDefaultValue(1);
|
||||
|
|
||||
|
//Relations
|
||||
|
|
||||
|
//Indexes
|
||||
|
b.HasIndex(q => new { q.Number, q.ItemCode }).IsUnique(); |
||||
|
}); |
||||
|
} |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
using Volo.Abp.EntityFrameworkCore; |
||||
|
using Win_in.Sfs.Shared.Domain; |
||||
|
using Win_in.Sfs.Wms.Store.Domain; |
||||
|
|
||||
|
namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore; |
||||
|
|
||||
|
public class InjectioModelPlanEfCoreRepository : SfsStoreEfCoreRepositoryBase<StoreDbContext, InjectioModelPlan>, IInjectioModelPlanRepository, ISfsBulkRepositoryBase<InjectioModelPlan> |
||||
|
{ |
||||
|
public InjectioModelPlanEfCoreRepository(IDbContextProvider<StoreDbContext> dbContextProvider) : base(dbContextProvider) |
||||
|
{ |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue