647556386
9 天以前 70aa9b5ca249a84e5867912d551cdafbec76e54e
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs
@@ -13,6 +13,8 @@
using WIDESEA_Core;
using WIDESEA_Core.Attributes;
using WIDESEA_Core.BaseController;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.Enums;
using WIDESEA_DTO.Allocate;
using WIDESEA_DTO.Inbound;
using WIDESEA_DTO.Mes;
@@ -20,6 +22,7 @@
using WIDESEA_IInboundService;
using WIDESEA_InboundService;
using WIDESEA_IOutboundService;
using WIDESEA_ITaskInfoService;
using WIDESEA_Model.Models;
using WIDESEA_OutboundService;
@@ -42,8 +45,10 @@
        private readonly IMaterialUnitService _materialUnitService;
        private readonly IOutStockLockInfoService _outStockLockInfoService;
        private readonly IOutboundOrderDetailService _outboundOrderDetailService;
        private readonly IRepository<Dt_Task> _taskRepository;
        private readonly ITask_HtyService _task_HtyService;
        private readonly ILogger<InboundOrderController> _logger;
        public InboundOrderController(IInboundOrderService service, WIDESEA_IBasicService.IErpApiService erpApiService, WIDESEA_IBasicService.IInvokeMESService invokeMESService, IESSApiService eSSApiService, IDailySequenceService dailySequenceService, ILocationInfoService locationInfoService, ILogger<InboundOrderController> logger, IMaterialUnitService materialUnitService, IInboundService inboundService, IOutStockLockInfoService outStockLockInfoService, IOutboundOrderDetailService outboundOrderDetailService) : base(service)
        public InboundOrderController(IInboundOrderService service, WIDESEA_IBasicService.IErpApiService erpApiService, WIDESEA_IBasicService.IInvokeMESService invokeMESService, IESSApiService eSSApiService, IDailySequenceService dailySequenceService, ILocationInfoService locationInfoService, ILogger<InboundOrderController> logger, IMaterialUnitService materialUnitService, IInboundService inboundService, IOutStockLockInfoService outStockLockInfoService, IOutboundOrderDetailService outboundOrderDetailService, IRepository<Dt_Task> taskRepository, ITask_HtyService task_HtyService) : base(service)
        {
            this.erpApiService = erpApiService;
            _invokeMESService = invokeMESService;
@@ -55,22 +60,32 @@
            _inboundService = inboundService;
            _outStockLockInfoService = outStockLockInfoService;
            _outboundOrderDetailService = outboundOrderDetailService;
            _taskRepository = taskRepository;
            _task_HtyService = task_HtyService;
        }
        [HttpPost, Route("Test"), AllowAnonymous, MethodParamsValidate]
        public async Task<WebResponseContent> Test()
        {
            var originalTask = _taskRepository.Db.Queryable<Dt_Task>().First();
            var result = _task_HtyService.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.人工删除);
            if (result)
            {
                var sddd = "trueee";
            }
            //var originalTask = _taskRepository.Db.Queryable<Dt_Task>().First();
            //_taskRepository.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.自动完成);
            // Service.Db.Deleteable<Dt_InboundOrder>().Where(x=>x.UpperOrderNo== "12020251100040").ExecuteCommand();
            //_inboundService.InboundOrderDetailService.Db.Deleteable<Dt_InboundOrderDetail>()
            // .Where(p => SqlFunc.Subqueryable<Dt_InboundOrder>().Where(s => s.Id == p.OrderId && s.UpperOrderNo == "12020251100040").Any()).ExecuteCommand();
            var purchaseToStockResult = await _materialUnitService.ConvertPurchaseToStockAsync("100513-00303", 1);
            //var purchaseToStockResult = await _materialUnitService.ConvertPurchaseToStockAsync("100513-00303", 1);
            var pdddurchaseToStockResult = await _materialUnitService.ConvertFromToStockAsync("100513-00303", "W013", 1);
            //var pdddurchaseToStockResult = await _materialUnitService.ConvertFromToStockAsync("100513-00303", "W013", 1);
            //var sddd = _locationInfoService.AssignLocation();
            //var sddd = _locationInfoService.AssignLocation(1);
            //var code = sddd.LocationCode;
            //var ssss=await _dailySequenceService.GetNextSequenceAsync();
            //var  ddddssss = "WSLOT" + DateTime.Now.ToString("yyyyMMddHHmmss") + ssss.ToString().PadLeft(5, '0');
@@ -104,7 +119,7 @@
            //await  erpApiService.GetMaterialInfoAsync(new WIDESEA_DTO.Basic.MaterialRequest());
            return WebResponseContent.Instance.OK();
            return WebResponseContent.Instance.OK(result?1:0 );
        }
        /// <summary>
@@ -115,12 +130,12 @@
        [HttpPost, Route("ReceiveInboundOrder"), AllowAnonymous, MethodParamsValidate]
        public async Task<WebResponseContent> ReceiveInboundOrder([FromBody] InboundRequestModel model)
        {
            if(model.inBounds == null || !model.inBounds.Any())
            if (model.inBounds == null || !model.inBounds.Any())
            {
                return WebResponseContent.Instance.Error("入库单不能为空");
            }
            _logger.LogInformation("InboundOrderController ReceiveInboundOrder:  " +  JsonConvert.SerializeObject(model));
            _logger.LogInformation("InboundOrderController ReceiveInboundOrder:  " + JsonConvert.SerializeObject(model));
            List<Dt_InboundOrder> inboundOrders = new List<Dt_InboundOrder>();
            foreach (var item in model.inBounds)
@@ -178,7 +193,7 @@
                inboundOrders.Add(dt_InboundOrder);
            }
            var content =await Service.ReceiveInboundOrder(inboundOrders, model.operationType);
            var content = await Service.ReceiveInboundOrder(inboundOrders, model.operationType);
            if (content.Status) return WebResponseContent.Instance.OK(200);
            else return WebResponseContent.Instance.Error(content.Message);
@@ -224,9 +239,9 @@
        }
        [HttpPost, Route("BatchOrderFeedbackToMes"), AllowAnonymous]
        public async Task<WebResponseContent> BatchOrderFeedbackToMes([FromBody]  BatchOrderFeedbackToMesDto request)
        public async Task<WebResponseContent> BatchOrderFeedbackToMes([FromBody] BatchOrderFeedbackToMesDto request)
        {
           return await _invokeMESService.BatchOrderFeedbackToMes(request.orderNos, request.inout);
            return await _invokeMESService.BatchOrderFeedbackToMes(request.orderNos, request.inout);
        }
    }