| | |
| | | using AutoMapper; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Serialization; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.Utilities; |
| | | using WIDESEA_DTO.Inbound; |
| | | using WIDESEA_DTO.Outbound; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IOutboundRepository; |
| | | using WIDESEA_IOutboundService; |
| | | using WIDESEA_IStockService; |
| | | using WIDESEA_ITaskInfoRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_OutboundService |
| | |
| | | { |
| | | private readonly IMapper _mapper; |
| | | private readonly IMaterielInfoService _materielInfoService; |
| | | private readonly IStockInfoService _stockService; |
| | | private readonly IStockInfoService _stockService; |
| | | private readonly IStockInfoDetailService _stockDetailService; |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | private readonly IBasicRepository _basicRepository; |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly SqlSugarClient _dbBase; |
| | | |
| | | public IOutboundOrderRepository Repository => BaseDal; |
| | | |
| | | public OutboundOrderService(IOutboundOrderRepository BaseDal, IMapper mapper, IMaterielInfoService materielInfoService, IStockInfoDetailService stockDetailService, IStockInfoService stockInfoService) : base(BaseDal) |
| | | public OutboundOrderService(IOutboundOrderRepository BaseDal, IBasicRepository basicRepository, IMapper mapper, IMaterielInfoService materielInfoService, IStockInfoDetailService stockDetailService, IStockInfoService stockInfoService, IUnitOfWorkManage unitOfWorkManage,ITaskRepository taskRepository) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _materielInfoService = materielInfoService; |
| | | _stockDetailService = stockDetailService; |
| | | _stockService = stockInfoService; |
| | | _basicRepository = basicRepository; |
| | | _stockService = stockInfoService; |
| | | _dbBase = unitOfWorkManage.GetDbClient(); |
| | | _taskRepository = taskRepository; |
| | | } |
| | | |
| | | public override WebResponseContent AddData(SaveModel saveModel) |
| | | { |
| | | OutboundOrderAddDTO outboundOrder = saveModel.MainData.DicToModel<OutboundOrderAddDTO>(); |
| | | List<OutboundOrderDetailAddDTO> orderDetailAddDTOs = saveModel.DetailData.DicToIEnumerable<OutboundOrderDetailAddDTO>(); |
| | | outboundOrder.Details = orderDetailAddDTOs.GroupBy(x => x.MaterielCode).Select(x => new OutboundOrderDetailAddDTO |
| | | { |
| | | BatchNo = x.FirstOrDefault()?.BatchNo ?? "", |
| | | MaterielCode = x.Key, |
| | | OrderQuantity = x.Sum(x => x.OrderQuantity), |
| | | Remark = x.FirstOrDefault(v => !string.IsNullOrEmpty(v.Remark))?.Remark ?? "" |
| | | }).ToList(); |
| | | #region æ ¹æ®ç©æç¼å·åå¹¶åºåºæ°é |
| | | //outboundOrder.Details = orderDetailAddDTOs.GroupBy(x => x.MaterielCode).Select(x => new OutboundOrderDetailAddDTO |
| | | //{ |
| | | // BatchNo = x.FirstOrDefault()?.BatchNo ?? "", |
| | | // MaterielCode = x.Key, |
| | | // OrderQuantity = x.Sum(x => x.OrderQuantity), |
| | | // Remark = x.FirstOrDefault(v => !string.IsNullOrEmpty(v.Remark))?.Remark ?? "" |
| | | //}).ToList(); |
| | | #endregion |
| | | outboundOrder.Details = new List<OutboundOrderDetailAddDTO>(); |
| | | outboundOrder.Details.AddRange(orderDetailAddDTOs); |
| | | return AddOutboundOrder(outboundOrder); |
| | | } |
| | | |
| | |
| | | return WebResponseContent.Instance.Error("ç©æéå¤"); |
| | | } |
| | | outboundOrderDetails = outboundOrderDetails.Where(x => (x.Id > 0 && x.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt()) || x.Id == 0).ToList(); |
| | | |
| | | |
| | | List<Dictionary<string, object>> dics = new List<Dictionary<string, object>>(); |
| | | JsonSerializerSettings settings = new JsonSerializerSettings(); |
| | | settings.ContractResolver = new CamelCasePropertyNamesContractResolver(); |
| | |
| | | #endregion |
| | | |
| | | Dt_OutboundOrder outboundOrder = _mapper.Map<Dt_OutboundOrder>(orderAddDTO); |
| | | outboundOrder.OrderNo = DateTime.Now.ToString("yyMMddHHmmss"); |
| | | outboundOrder.OrderStatus = InboundStatusEnum.æªå¼å§.ObjToInt(); |
| | | bool a = BaseDal.Db.InsertNav(outboundOrder).Include(x => x.Details).ExecuteCommand(); |
| | | content = WebResponseContent.Instance.OK(); |