| | |
| | | using AutoMapper; |
| | | using Autofac.Core; |
| | | using AutoMapper; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.Extensions.Logging; |
| | | using SqlSugar; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | |
| | | private readonly IMapper _mapper; |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | public IRepository<Dt_OutboundOrder> Repository => BaseDal; |
| | | |
| | | private readonly ILogger<OutboundOrderService> _logger; |
| | | private readonly IRepository<Dt_OutboundOrderDetail> _outboundOrderDetailRepository; |
| | | |
| | | public OutboundOrderService(IRepository<Dt_OutboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_OutboundOrderDetail> outboundOrderDetailRepository) : base(BaseDal) |
| | | public OutboundOrderService(IRepository<Dt_OutboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_OutboundOrderDetail> outboundOrderDetailRepository, ILogger<OutboundOrderService> logger) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _outboundOrderDetailRepository = outboundOrderDetailRepository; |
| | | _logger = logger; |
| | | } |
| | | |
| | | public WebResponseContent ReceiveOutboundOrder(Dt_OutboundOrder model, int operateType) |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°åºåºåæç»ä¿¡æ¯"); |
| | | } |
| | | //Db.DeleteNav(inboundOrder).Include(x => x.Details).ExecuteCommand(); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | BaseDal.DeleteAndMoveIntoHty(outboundOrder, OperateTypeEnum.èªå¨å é¤); |
| | | //BaseDal.DeleteAndMoveIntoHty(outboundOrder, OperateTypeEnum.èªå¨å é¤); |
| | | foreach (var item in outboundOrder.Details) |
| | | { |
| | | _outboundOrderDetailRepository.DeleteAndMoveIntoHty(item, OperateTypeEnum.èªå¨å é¤); |
| | | // _outboundOrderDetailRepository.DeleteAndMoveIntoHty(item, OperateTypeEnum.èªå¨å é¤);\\ |
| | | _outboundOrderDetailRepository.DeleteData(item); |
| | | } |
| | | BaseDal.DeleteData(outboundOrder); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | _logger.LogInformation(ex.Message); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®IDè·ååºåºå |
| | | /// </summary> |
| | | public async Task<WebResponseContent> GetById(int id) |
| | | { |
| | | var order = await Db.Queryable<Dt_OutboundOrder>().FirstAsync(o=>o.Id==id); |
| | | if (order == null) |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°åºåºåä¿¡æ¯"); |
| | | } |
| | | return WebResponseContent.Instance.OK(null, order); |
| | | } |
| | | |
| | | |
| | | static object lock_code = new object(); |
| | | public string CreateCodeByRule(string ruleCode) |
| | | { |