| | |
| | | public partial class Business |
| | | { |
| | | #region è·åERPå
¥åºå |
| | | //static string SearchInOrderDate = "2025-11-01 00:00:00"; |
| | | //public WebResponseContent GetInOrder() |
| | | //{ |
| | | // WebResponseContent content = new WebResponseContent(); |
| | | // try |
| | | // { |
| | | // var url = "http://121.37.118.63:80/GYZ2/95fck/inOrder"; |
| | | // string GetOutOrderDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | // if (string.IsNullOrEmpty(SearchInOrderDate)) SearchInOrderDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | // var requestData = new { searchDate = SearchInOrderDate }; |
| | | // //SearchInOrderDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | // var result = HttpHelper.Post(url, requestData.ToJsonString()); |
| | | // var response = JsonConvert.DeserializeObject<UpstreamResponse<UpstreamOrderInfo>>(result); |
| | | // if (response == null) return content; |
| | | // if (response.data.Count < 1) |
| | | // { |
| | | // SearchInOrderDate = GetOutOrderDate; |
| | | // return content; |
| | | // } |
| | | // var ordernos = response.data.Select(x => x.order_no).ToList(); |
| | | // var existingOrderNos = _cabinOrderServices.Repository.QueryData(x => ordernos.Contains(x.Order_no)).Select(x => x.Order_no).Distinct().ToList(); |
| | | // var newOrders = response.data.Where(order => !existingOrderNos.Contains(order.order_no)).ToList(); |
| | | // if (newOrders.Count < 1) |
| | | // { |
| | | // SearchInOrderDate = GetOutOrderDate; |
| | | // return content; |
| | | // } |
| | | // int messQty = 0; |
| | | // foreach (var order in newOrders) |
| | | // { |
| | | // try |
| | | // { |
| | | // if (order.order_type == "1") |
| | | // { |
| | | // content = _cabinOrderServices.CreateInboundOrder(order); |
| | | // if (!content.Status) messQty++; |
| | | // } |
| | | // else if (order.order_type == "3")//å
¥åºéæ |
| | | // { |
| | | // #region 转æ¢ä¸ºåºåºå |
| | | // UpstramOutOrderInfo upstramOutOrderInfo = new UpstramOutOrderInfo() |
| | | // { |
| | | // order_no = order.order_no, |
| | | // order_type = order.order_type, |
| | | // warehouse_no = order.warehouse_no, |
| | | // details = new List<UpstreamOutOrderDetail>() |
| | | // }; |
| | | // foreach (var item in order.details) |
| | | // { |
| | | // UpstreamOutOrderDetail detail = new UpstreamOutOrderDetail() |
| | | // { |
| | | // batch_num = item.batch_num, |
| | | // goods_no = item.goods_no, |
| | | // order_qty = item.order_qty, |
| | | // exp_date = item.exp_date, |
| | | // }; |
| | | // upstramOutOrderInfo.details.Add(detail); |
| | | // } |
| | | // #endregion |
| | | // content = _deliveryOrderServices.CreateOutboundOrder(upstramOutOrderInfo); |
| | | // if (!content.Status) messQty++; |
| | | // } |
| | | // else if (order.order_type == "5")//æ¥æº¢å
¥åº |
| | | // { |
| | | // content = _cabinOrderServices.CreateCheckInOrder(order); |
| | | // if (!content.Status) messQty++; |
| | | // } |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // continue; |
| | | // } |
| | | // } |
| | | // if (messQty == 0) SearchInOrderDate = GetOutOrderDate; |
| | | // return content.OK(); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // Console.WriteLine("è·åERPå
¥åºåä¿¡æ¯å¼å¸¸ï¼" + ex.Message); |
| | | // return content.Error(ex.Message); |
| | | // } |
| | | //} |
| | | #endregion |
| | | |
| | | #region è·åERPåºåºå |
| | | //static string SearchOutOrderDate = "2025-11-01 00:00:00"; |
| | | //public WebResponseContent GetOutOrder() |
| | | //{ |
| | | // WebResponseContent content = new WebResponseContent(); |
| | | // try |
| | | // { |
| | | // //var url = "http://121.37.118.63:80/GYZ2/95fck/outOrder"; |
| | | // var url = "http://127.0.0.1:4523/m2/5660322-5340849-default/366751306?apifoxApiId=366751306"; |
| | | // string GetOutOrderDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | // if (string.IsNullOrEmpty(SearchOutOrderDate)) SearchOutOrderDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | // var requestData = new { searchDate = SearchOutOrderDate }; |
| | | // var result = HttpHelper.Post(url, requestData.ToJsonString()); |
| | | // var response = JsonConvert.DeserializeObject<UpstreamResponse<UpstramOutOrderInfo>>(result); |
| | | |
| | | // if (response == null) return content; |
| | | // if (response.data.Count < 1) |
| | | // { |
| | | // SearchOutOrderDate = GetOutOrderDate; |
| | | // return content; |
| | | // } |
| | | // var ordernos = response.data.Select(x => x.order_no).ToList(); |
| | | // var existingOutOrderNos = _deliveryOrderServices.Repository.QueryData(x => ordernos.Contains(x.Out_no)).Select(x => x.Out_no).Distinct().ToList(); |
| | | // var newOutOrders = response.data.Where(outorder => !existingOutOrderNos.Contains(outorder.order_no)).ToList(); |
| | | // if (newOutOrders.Count < 1) |
| | | // { |
| | | // SearchOutOrderDate = GetOutOrderDate; |
| | | // return content; |
| | | // } |
| | | // int messQty = 0; |
| | | // foreach (var outorder in newOutOrders) |
| | | // { |
| | | // if (outorder.order_type == "1")// æ£å¸¸åºåºå |
| | | // { |
| | | // content = _deliveryOrderServices.CreateOutboundOrder(outorder); |
| | | // if (!content.Status) messQty++; |
| | | // } |
| | | // else if (outorder.order_type == "2")//åºåºéè´§ |
| | | // { |
| | | // #region è½¬æ¢æå
¥åºå |
| | | // UpstreamOrderInfo order = new UpstreamOrderInfo() |
| | | // { |
| | | // order_no = outorder.order_no, |
| | | // order_type = outorder.order_type, |
| | | // warehouse_no = outorder.warehouse_no, |
| | | // details = new List<UpstreamOrderDetail>() |
| | | // }; |
| | | // foreach (var item in outorder.details) |
| | | // { |
| | | // UpstreamOrderDetail detail = new UpstreamOrderDetail() |
| | | // { |
| | | // batch_num = item.batch_num, |
| | | // goods_no = item.goods_no, |
| | | // order_qty = item.order_qty, |
| | | // exp_date = item.exp_date, |
| | | // }; |
| | | // order.details.Add(detail); |
| | | // } |
| | | // #endregion |
| | | // content = _cabinOrderServices.CreateInboundOrder(order); |
| | | // if (!content.Status) messQty++; |
| | | // } |
| | | // else if (outorder.order_type == "6")//æ¥æåºåº |
| | | // { |
| | | // content = _deliveryOrderServices.CreateCheckOutOrder(outorder); |
| | | // if (!content.Status) messQty++; |
| | | // } |
| | | // } |
| | | // if (messQty == 0) SearchOutOrderDate = GetOutOrderDate; |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // content.Error(ex.Message); |
| | | // } |
| | | // return content; |
| | | //} |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region è·åERPå
¥åºå |
| | | static string SearchInOrderDate = "2025-11-01 00:00:00"; |
| | | public WebResponseContent GetInOrder() |
| | | { |
| | |
| | | string GetOutOrderDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | if (string.IsNullOrEmpty(SearchInOrderDate)) SearchInOrderDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | var requestData = new { searchDate = SearchInOrderDate }; |
| | | //SearchInOrderDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
| | | var result = HttpHelper.Post(url, requestData.ToJsonString()); |
| | | var response = JsonConvert.DeserializeObject<UpstreamResponse<UpstreamOrderInfo>>(result); |
| | | if (response == null) return content; |
| | |
| | | SearchInOrderDate = GetOutOrderDate; |
| | | return content; |
| | | } |
| | | |
| | | var ordernos = response.data.Select(x => x.order_no).ToList(); |
| | | var existingOrderNos = _cabinOrderServices.Repository.QueryData(x => ordernos.Contains(x.Order_no)).Select(x => x.Order_no).Distinct().ToList(); |
| | | var newOrders = response.data.Where(order => !existingOrderNos.Contains(order.order_no)).ToList(); |
| | | |
| | | // å
³é®ä¿®æ¹ï¼æè®¢åç±»åå嫿£æ¥å¯¹åºç表 |
| | | var inOrderTypes = new List<string> { "1", "5" }; // å
¥åºç±»å |
| | | var outOrderTypes = new List<string> { "3" }; // åºåºç±»å |
| | | |
| | | // æ£æ¥å
¥åºå表ï¼åªæ£æ¥å
¥åºç±»åç订åï¼æ¯å¦åå¨ |
| | | var existingInOrderNos = _cabinOrderServices.Repository.QueryData(x => ordernos.Contains(x.Order_no)) |
| | | .Select(x => x.Order_no).Distinct().ToList(); |
| | | |
| | | // æ£æ¥åºåºå表ï¼åªæ£æ¥åºåºç±»åç订åï¼ |
| | | var existingOutOrderNos = _deliveryOrderServices.Repository.QueryData(x => ordernos.Contains(x.Out_no)) |
| | | .Select(x => x.Out_no).Distinct().ToList(); |
| | | |
| | | // çéæ°è®¢åï¼å
¥åºç±»åæ£æ¥å
¥åºè¡¨ï¼åºåºç±»åæ£æ¥åºåºè¡¨ éåºä¸å
å«å·²åå¨å¨ |
| | | var newOrders = response.data.Where(order => |
| | | (inOrderTypes.Contains(order.order_type) && !existingInOrderNos.Contains(order.order_no)) || |
| | | (outOrderTypes.Contains(order.order_type) && !existingOutOrderNos.Contains(order.order_no)) |
| | | ).ToList(); |
| | | |
| | | if (newOrders.Count < 1) |
| | | { |
| | | SearchInOrderDate = GetOutOrderDate; |
| | | return content; |
| | | } |
| | | |
| | | int messQty = 0; |
| | | foreach (var order in newOrders) |
| | | { |
| | |
| | | { |
| | | order_no = order.order_no, |
| | | order_type = order.order_type, |
| | | client_no=order.supplier_no, |
| | | client_name=order.supplier_name, |
| | | account_time=order.account_time, |
| | | warehouse_no = order.warehouse_no, |
| | | details = new List<UpstreamOutOrderDetail>() |
| | | }; |
| | |
| | | SearchOutOrderDate = GetOutOrderDate; |
| | | return content; |
| | | } |
| | | |
| | | var ordernos = response.data.Select(x => x.order_no).ToList(); |
| | | var existingOutOrderNos = _deliveryOrderServices.Repository.QueryData(x => ordernos.Contains(x.Out_no)).Select(x => x.Out_no).Distinct().ToList(); |
| | | var newOutOrders = response.data.Where(outorder => !existingOutOrderNos.Contains(outorder.order_no)).ToList(); |
| | | if (newOutOrders.Count < 1) |
| | | |
| | | // æè®¢åç±»åå嫿£æ¥å¯¹åºç表 |
| | | var outOrderTypes = new List<string> { "1", "6" }; // åºåºç±»å |
| | | var inOrderTypes = new List<string> { "2" }; // å
¥åºç±»å |
| | | |
| | | // æ£æ¥åºåºå表ï¼åªæ£æ¥åºåºç±»åç订åï¼ |
| | | var existingOutOrderNos = _deliveryOrderServices.Repository.QueryData(x => ordernos.Contains(x.Out_no)) |
| | | .Select(x => x.Out_no).Distinct().ToList(); |
| | | |
| | | // æ£æ¥å
¥åºå表ï¼åªæ£æ¥å
¥åºç±»åç订åï¼ |
| | | var existingInOrderNos = _cabinOrderServices.Repository.QueryData(x => ordernos.Contains(x.Order_no)) |
| | | .Select(x => x.Order_no).Distinct().ToList(); |
| | | |
| | | // çéæ°è®¢åï¼åºåºç±»åæ£æ¥åºåºè¡¨ï¼å
¥åºç±»åæ£æ¥å
¥åºè¡¨ |
| | | var newOrders = response.data.Where(order => |
| | | (outOrderTypes.Contains(order.order_type) && !existingOutOrderNos.Contains(order.order_no)) || |
| | | (inOrderTypes.Contains(order.order_type) && !existingInOrderNos.Contains(order.order_no)) |
| | | ).ToList(); |
| | | |
| | | if (newOrders.Count < 1) |
| | | { |
| | | SearchOutOrderDate = GetOutOrderDate; |
| | | return content; |
| | | } |
| | | |
| | | int messQty = 0; |
| | | foreach (var outorder in newOutOrders) |
| | | foreach (var outorder in newOrders) |
| | | { |
| | | if (outorder.order_type == "1")// æ£å¸¸åºåºå |
| | | { |
| | |
| | | { |
| | | order_no = outorder.order_no, |
| | | order_type = outorder.order_type, |
| | | supplier_no=outorder.client_no, |
| | | supplier_name=outorder.client_name, |
| | | account_time=outorder.account_time, |
| | | warehouse_no = outorder.warehouse_no, |
| | | details = new List<UpstreamOrderDetail>() |
| | | }; |
| | |
| | | if (!content.Status) messQty++; |
| | | } |
| | | } |
| | | |
| | | if (messQty == 0) SearchOutOrderDate = GetOutOrderDate; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | return content; |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | } |
| | | } |