ResourceExamineAppService.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. using Microsoft.EntityFrameworkCore;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Linq.Dynamic.Core;
  6. using System.Threading.Tasks;
  7. using Volo.Abp.Application.Dtos;
  8. using Volo.Abp.Domain.Repositories;
  9. using Business.Models;
  10. using Microsoft.AspNetCore.Authorization;
  11. using Business.Permissions;
  12. using XCZ;
  13. using Business.ResourceExamineManagement.Dto;
  14. using Bussiness.Model.MES.IC;
  15. using AutoMapper.Internal.Mappers;
  16. using Bussiness.Model.Tech;
  17. using Bussiness.Model.Production;
  18. using Business.Core.MongoDBHelper;
  19. using Business.Core.Utilities;
  20. using Hangfire.Storage.Monitoring;
  21. using Business.BookManagement.Dto;
  22. using Volo.Abp.ObjectMapping;
  23. using Volo.Abp.Application.Services;
  24. namespace Business.ResourceExamineManagement
  25. {
  26. /// <summary>
  27. /// 资源检查
  28. /// </summary>
  29. //[Authorize(BusinessPermissions.ResourceExamine.Default)]
  30. public class ResourceExamineAppService : ApplicationService, IResourceExamineAppService
  31. {
  32. #region 服务
  33. //private IRepository<ic_item, long> _ic_item;
  34. //private IRepository<ic_bom, long> _ic_bom;
  35. ///// <summary>
  36. ///// 工艺路径
  37. ///// </summary>
  38. //private IRepository<mes_technique, long> _mes_technique;
  39. ///// <summary>
  40. ///// 工序
  41. ///// </summary>
  42. //private IRepository<mes_process, long> _mes_process;
  43. ///// <summary>
  44. ///// 工艺关联工序
  45. ///// </summary>
  46. //private IRepository<mes_tech_process, long> _mes_tech_process;
  47. ///// <summary>
  48. ///// 排程占用记录
  49. ///// </summary>
  50. //private IRepository<mes_schedule_occupy, long> _mes_schedule_occupy;
  51. private readonly IMongoDB<mes_technique> _mes_technique;
  52. #endregion
  53. /// <summary>
  54. /// 构造函数
  55. /// </summary>
  56. /// <param name="icitem"></param>
  57. /// <param name="icbom"></param>
  58. public ResourceExamineAppService(
  59. IMongoDB<mes_technique> mes_technique
  60. )
  61. {
  62. _mes_technique = mes_technique;
  63. }
  64. /// <summary>
  65. /// 资源检查
  66. /// </summary>
  67. /// <param name="input"></param>
  68. /// <returns></returns>
  69. /// <exception cref="NotImplementedException"></exception>
  70. public async Task<PschedDto> ReceiveResult(SeorderentryDto input)
  71. {
  72. mes_technique info = new mes_technique();
  73. SnowFlake snow = new SnowFlake();
  74. info.tech_id = snow.NextId();
  75. info.tech_name = "ceshi4444";
  76. info.level = 4;
  77. await _mes_technique.InsertOne(info);
  78. throw new NotImplementedException();
  79. }
  80. /// <summary>
  81. /// BOM预处理
  82. /// </summary>
  83. /// <param name="orderid">订单行id</param>
  84. /// <param name="BomId">Bom主键</param>
  85. /// <param name="Quantity">需要数量</param>
  86. public async Task BomPretreatmentAsync(long? orderid, long? BomId, int Quantity)
  87. {
  88. //if (BomId == null)
  89. //{
  90. // //throw new bu
  91. //}
  92. //var query = (await _ic_bom.GetQueryableAsync()).WhereIf(true, a => a.bom_id == BomId).ToList();
  93. }
  94. /// <summary>
  95. /// 产能计算
  96. /// </summary>
  97. /// <param name="BomId">Bom主键</param>
  98. /// <param name="Quantity">需要数量</param>
  99. public async Task ProductiveExamine(long? BomId, int Quantity)
  100. {
  101. }
  102. /// <summary>
  103. /// 检查在制工单
  104. /// </summary>
  105. /// <param name="bomNumber">Bom编码</param>
  106. /// <param name="Quantity">需要数量</param>
  107. /// <returns></returns>
  108. public async Task CheckMorder(string bomNumber, int Quantity)
  109. {
  110. if (string.IsNullOrEmpty(bomNumber) || Quantity < 0)
  111. {
  112. //TODO:入参异常;
  113. //throw new NotImplementedException();
  114. }
  115. //查询生产工单类型为计划工单并且工单类型为备库工单 并且BOM编码一致数据
  116. // 订单状态为 初始或下达工单
  117. // List =>数量满足Quantity && 生成工单结束日期最早
  118. }
  119. }
  120. }