dengjunjie
2025-07-09 7ca9651f81d7b84f054194d3d46fdbd1d9c8b922
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs
@@ -47,7 +47,7 @@
        /// </summary>
        /// <param name="materielGroupDTO"></param>
        /// <returns></returns>
        public WebResponseContent PdaAddEmptyStockInfo(string barcode)
        public WebResponseContent PdaAddEmptyStockInfo(string barcode, string station)
        {
            try
            {
@@ -59,31 +59,34 @@
                {
                    task = new Dt_Task()
                    {
                        CurrentAddress = "1001",
                        NextAddress = "SC01",
                        SourceAddress = "1001",
                        CurrentAddress = station,
                        NextAddress = "1001",
                        SourceAddress = station,
                        TargetAddress = "SC01",
                        Creater = "System",
                        PalletCode = barcode,
                        Roadway = "SC01",
                        OrderNo = DateTime.Now.ToString("yyMMdd"),
                        TaskNum = _taskRepository.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
                        TaskState = InTaskStatusEnum.AGV_InFinish.ObjToInt(),
                        TaskState = InTaskStatusEnum.InNew.ObjToInt(),
                        TaskType = TaskTypeEnum.PalletInbound.ObjToInt(),
                        CreateDate = DateTime.Now,
                        Dispatchertime = DateTime.Now,
                    };
                    Db.Ado.BeginTran();
                    _stockService.StockInfoService.AddStockEmpty(barcode);
                    WebResponseContent content = _stockService.StockInfoService.AddStockEmpty(barcode);
                    if (!content.Status) throw new Exception(content.Message);
                    _taskRepository.AddData(task);
                    List<WMSTaskDTO> wMSTaskDTOs = _mapper.Map<List<WMSTaskDTO>>(new List<Dt_Task> { task });
                    var ResultData = HttpHelper.PostAsync(WCSInterfaceAddress.ReceiveTask, wMSTaskDTOs.ToJson(), headers: new Dictionary<string, string>());
                    if (ResultData.Result == null) throw new Exception($"向WCS下发空托入库任务超时");
                    WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(ResultData.Result);
                    content = JsonConvert.DeserializeObject<WebResponseContent>(ResultData.Result);
                    if (content == null) throw new Exception($"下发空托入库任务WCS无响应");
                    if (!content.Status) throw new Exception(content.Message);
                    Db.Ado.CommitTran();
                }
                else
                    throw new Exception($"托盘号【{barcode}】已存在任务");
                #endregion
                return WebResponseContent.Instance.OK();
            }
@@ -407,11 +410,11 @@
            return (true, "成功", materielGroupDTO);
        }
        public WebResponseContent QueryOrderInfo(int pageNo, string orderNo)
        public WebResponseContent QueryOrderInfo(int pageNo, string orderNo, int orderType)
        {
            if (string.IsNullOrEmpty(orderNo))
            {
                object obj = Repository.QueryPage(x => true, pageNo, 10, new Dictionary<string, OrderByType> { { nameof(Dt_InboundOrder.CreateDate), OrderByType.Desc } }).Rows.Select(x => new
                object obj = Repository.QueryPage(x => x.OrderType == orderType, pageNo, 10, new Dictionary<string, OrderByType> { { nameof(Dt_InboundOrder.CreateDate), OrderByType.Desc } }).Rows.Select(x => new
                {
                    x.OrderNo,
                    x.UpperOrderNo,
@@ -422,7 +425,7 @@
            }
            else
            {
                object obj = Repository.QueryPage(x => x.OrderNo == orderNo, pageNo, 10, new Dictionary<string, OrderByType> { { nameof(Dt_InboundOrder.CreateDate), OrderByType.Desc } }).Rows.Select(x => new
                object obj = Repository.QueryPage(x => x.OrderNo.Contains(orderNo), pageNo, 10, new Dictionary<string, OrderByType> { { nameof(Dt_InboundOrder.CreateDate), OrderByType.Desc } }).Rows.Select(x => new
                {
                    x.OrderNo,
                    x.UpperOrderNo,
@@ -432,5 +435,14 @@
                return WebResponseContent.Instance.OK(data: obj);
            }
        }
        public WebResponseContent QueryOrderDetailInfo(int pageNo, string orderNo)
        {
            WebResponseContent content = new WebResponseContent();
            Dt_InboundOrder inboundOrder = GetInboundOrder(orderNo);
            List<Dt_InboundOrderDetail> inboundOrderDetails = inboundOrder.Details;
            content.OK(data: inboundOrderDetails);
            return content;
        }
    }
}