From b6837f097e9cdb2645368aed4ddb03f580c331e4 Mon Sep 17 00:00:00 2001 From: z8018 <1282578289@qq.com> Date: 星期一, 05 五月 2025 17:29:07 +0800 Subject: [PATCH] 1 --- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/OrderDetailsService.cs | 76 +++++++++++++++++++++++++++++++++++--- 1 files changed, 70 insertions(+), 6 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/OrderDetailsService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/OrderDetailsService.cs" index dbc29db..9949841 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/OrderDetailsService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/OrderDetailsService.cs" @@ -40,8 +40,6 @@ using WIDESEAWCS_Core.Enums; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_DTO.BasicInfo; -using WIDESEAWCS_DTO.Enum; -using WIDESEAWCS_DTO.TaskInfo; using WIDESEAWCS_IBasicInfoRepository; using WIDESEAWCS_IBasicInfoService; using WIDESEAWCS_Model.Models; @@ -50,20 +48,31 @@ { public class OrderDetailsService : ServiceBase<OrderDetails, IOrderDetailsRepository>, IOrderDetailsService { - public OrderDetailsService(IOrderDetailsRepository BaseDal) : base(BaseDal) + private readonly IOrderrowsRepository _orderrowsRepository; + public OrderDetailsService(IOrderDetailsRepository BaseDal, IOrderrowsRepository orderrowsRepository) : base(BaseDal) { - + _orderrowsRepository = orderrowsRepository; } private static bool toggle = false; private static int lastStaion = 0; - public int GetOrderDetails(string barcode, List<int> useableStations) + public int GetOrderDetails(string barcode, List<int> useableStations, out ProductInfoDTO productInfo) { OrderDetails? orderDetails = BaseDal.QueryData(x => x.Orderdetails_outid == barcode).FirstOrDefault(); if (orderDetails != null) { + productInfo = new ProductInfoDTO() + { + Code = barcode, + Height = Convert.ToInt32(orderDetails.Orderdetails_thickness), + Length = Convert.ToInt32(orderDetails.Orderdetails_length), + Width = Convert.ToInt32(orderDetails.Orderdetails_width), + }; useableStations = useableStations.OrderByDescending(x => x).ToList(); + if (orderDetails.Orderdetails_width < 60) + useableStations = useableStations.Where(x => x != 1).OrderByDescending(x => x).ToList(); + if (orderDetails.Orderdetails_width <= 800 && orderDetails.Orderdetails_width >= 50)//1,2,3 { if (lastStaion == 0) @@ -74,7 +83,7 @@ else { int index = useableStations.IndexOf(lastStaion); - if(index + 1 < useableStations.Count) + if (index + 1 < useableStations.Count) { lastStaion = useableStations[index + 1]; return lastStaion; @@ -121,6 +130,7 @@ } else { + productInfo = new ProductInfoDTO(); return -1; } } @@ -140,6 +150,60 @@ return toMesBarc; } + public ToMesBarcRes? ToMes(string barcode, int processId) + { + try + { + object obj = new + { + id = barcode, + processId + }; + ToMesBarcRes? toMesBarc = JsonConvert.DeserializeObject<ToMesBarcRes>(HttpHelper.Post($"{ToMesScan_sync}", obj.Serialize())); + return toMesBarc; + } + catch (Exception ex) + { + return null; + } + + } + + public OrderInfo GetOrderInfoByBarcode(string barcode) + { + try + { + OrderDetails orderDetails = BaseDal.QueryFirst(x => x.Orderdetails_outid == barcode); + if (orderDetails == null) + { + throw new Exception("鏈壘鍒版潯鐮佸搴旇鍗曚俊鎭�"); + } + + Orderrows orderrows = _orderrowsRepository.QueryFirst(x => x.id == orderDetails.Orderrowsid); + if (orderrows == null) + { + throw new Exception($"鏈壘鍒板搴旇鍗曞ご淇℃伅"); + } + + OrderInfo orderInfo = new OrderInfo() + { + Barcode = barcode, + Length = orderDetails.Orderdetails_length, + OrderBatch = orderrows.Orderrows_batchid, + OrderHeadId = orderrows.id, + OrderNo = orderrows.Orderrows_orderid, + OrderRowNum = orderrows.Orderrows_id, + Quantity = Convert.ToInt32(orderrows.Orderrows_num), + Thickness = orderDetails.Orderdetails_thickness, + Width = orderDetails.Orderdetails_width, + }; + return orderInfo; + } + catch (Exception ex) + { + throw new Exception(ex.Message); + } + } } } -- Gitblit v1.9.3