1
heshaofeng
2026-03-25 37454e625df68d40897112b2e8c2e3cf4d7163e3
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Inbound/InboundOrderController.cs
@@ -5,6 +5,7 @@
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using SqlSugar;
using SqlSugar.Extensions;
using System.Net;
using System.Threading.Tasks;
using WIDESEA_BasicService;
@@ -43,12 +44,13 @@
        private readonly ILocationInfoService _locationInfoService;
        private readonly IDailySequenceService _dailySequenceService;
        private readonly IMaterialUnitService _materialUnitService;
        private readonly IRepository<Dt_MaterielInfo> _materialInfoRepository;
        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, IRepository<Dt_Task> taskRepository, ITask_HtyService task_HtyService) : 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, IRepository<Dt_MaterielInfo> materialInfoRepository) : base(service)
        {
            this.erpApiService = erpApiService;
            _invokeMESService = invokeMESService;
@@ -62,11 +64,15 @@
            _outboundOrderDetailService = outboundOrderDetailService;
            _taskRepository = taskRepository;
            _task_HtyService = task_HtyService;
            _materialInfoRepository = materialInfoRepository;
        }
        [HttpPost, Route("Test"), AllowAnonymous, MethodParamsValidate]
        public async Task<WebResponseContent> Test()
        {
            //var seq = await _dailySequenceService.GetNextSequenceAsync();
            //var SDDD= "WSLOT" + DateTime.Now.ToString("yyyyMMdd") + seq.ToString()?.PadLeft(5, '0');
            //var originalTask = _taskRepository.Db.Queryable<Dt_Task>().First();
@@ -91,7 +97,7 @@
            //var  ddddssss = "WSLOT" + DateTime.Now.ToString("yyyyMMddHHmmss") + ssss.ToString().PadLeft(5, '0');
            //erpApiService.GetSuppliersAsync();
            erpApiService.GetMaterialUnitAsync();
            // erpApiService.GetMaterialUnitAsync();
            //var sss = await _invokeMESService.NewMaterielToMes(new WIDESEA_DTO.Basic.MaterielToMesDTO
            //{
@@ -144,7 +150,7 @@
                Dt_InboundOrder dt_InboundOrder = new Dt_InboundOrder() { Details = new List<Dt_InboundOrderDetail>() };
                foreach (var detailitem in item.details)
                {
                    var materialName = _materialInfoRepository.QueryFirst(x => x.MaterielCode == detailitem.materialCode).MaterielName;
                    if (detailitem.barcodes != null && detailitem.barcodes.Any())
                    {
                        foreach (var barcode in detailitem.barcodes)
@@ -153,6 +159,7 @@
                            {
                                lineNo = detailitem.lineNo,
                                MaterielCode = detailitem.materialCode,
                                MaterielName = materialName,
                                SupplyCode = detailitem.supplyCode,
                                BatchNo = detailitem.batchNo,
                                Unit = detailitem.unit,
@@ -161,7 +168,9 @@
                                OutBoxbarcodes = barcode.outBoxbarcodes,
                                BarcodeUnit = barcode.unit,
                                BarcodeQty = barcode.qty,
                                OrderQuantity = barcode.qty
                                OrderQuantity = barcode.qty,
                                Remark = detailitem.remark??"",
                            };
                            dt_InboundOrder.Details.Add(inboundOrderDetail);
@@ -181,6 +190,8 @@
                            OrderQuantity = detailitem.qty,
                            BarcodeUnit = detailitem.unit,
                            BarcodeQty = detailitem.qty,
                            MaterielName = materialName,
                            Remark = detailitem.remark??""
                        };
                        dt_InboundOrder.Details.Add(inboundOrderDetail);
                    }
@@ -190,7 +201,8 @@
                dt_InboundOrder.BusinessType = item.business_type;
                dt_InboundOrder.IsBatch = item.isBatch;
                dt_InboundOrder.FactoryArea = item.factoryArea;
                dt_InboundOrder.CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt();
                dt_InboundOrder.IsTestMaterials = item.isTestMaterials;
                inboundOrders.Add(dt_InboundOrder);
            }
@@ -214,10 +226,16 @@
        }
        [HttpPost, Route("UndoPalletGroup"), AllowAnonymous, MethodParamsValidate]
        public WebResponseContent UndoPalletGroup(string palletCode)
        [HttpPost, Route("UnPalletGroupBarcode"), AllowAnonymous, MethodParamsValidate]
        public WebResponseContent UnPalletGroupBarcode(string orderNo)
        {
            return Service.UndoPalletGroup(palletCode);
            return Service.UnPalletGroupBarcode(orderNo);
        }
        [HttpPost, Route("UndoPalletGroup"), AllowAnonymous, MethodParamsValidate]
        public WebResponseContent UndoPalletGroup(string code)
        {
            return Service.UndoPalletGroup(code);
        }
        /// <summary>
        /// 
@@ -245,5 +263,17 @@
            return await _invokeMESService.BatchOrderFeedbackToMes(request.orderNos, request.inout);
        }
        [HttpPost, Route("HandCloseOrder"), AllowAnonymous, MethodParamsValidate]
        public WebResponseContent HandCloseOrder(List<string> orderIds)
        {
            return Service.HandCloseOrder(orderIds);
        }
        [HttpPost, Route("GetLocationType"), AllowAnonymous, MethodParamsValidate]
        public WebResponseContent GetLocationType(string code)
        {
            return Service.GetLocationType(code);
        }
    }
}