/// <summary> /// 订单自动收货确认+自动完结 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void orderReceived(object sender, System.Timers.ElapsedEventArgs e) { string days = conf.OrderReceivedDays; int Days = 0; int.TryParse(days, out Days); if (Days > 0) { List <Lebi_Transport_Order> torders = B_Lebi_Transport_Order.GetList("Time_Add<'" + System.DateTime.Now.AddDays(0 - Days) + "' and Type_id_TransportOrderStatus=220", ""); foreach (Lebi_Transport_Order torder in torders) { torder.Type_id_TransportOrderStatus = 223; torder.Time_Received = System.DateTime.Now; B_Lebi_Transport_Order.Update(torder); EX_Area.UpdateShouHuoCount(torder); Log.Add("自动确认收货", "Order", torder.Order_id.ToString()); } } days = conf.OrderCompleteDays; Days = 0; int.TryParse(days, out Days); if (Days > 0) { List <Lebi_Order> orders = B_Lebi_Order.GetList("Time_Received<'" + System.DateTime.Now.AddDays(0 - Days) + "' and IsReceived_All=1 and IsCompleted=0", ""); foreach (Lebi_Order order in orders) { Order.Order_Completed(order); Log.Add("自动确认完成", "Order", order.id.ToString()); } } }
/// <summary> /// 递归处理运费价格 /// </summary> /// <param name="area"></param> /// <param name="trans"></param> /// <returns></returns> private static List <Lebi_Transport_Price> TransportPrice(Lebi_Area area, List <Lebi_Transport_Price> trans, int supplierid) { if (trans == null) { trans = B_Lebi_Transport_Price.GetList("Area_id=" + area.id + " and Supplier_id=" + supplierid + "", ""); } else { string pids = ""; List <Lebi_Transport_Price> models = B_Lebi_Transport_Price.GetList("Area_id=" + area.id + " and Supplier_id=" + supplierid + "", ""); foreach (Lebi_Transport_Price model in models) { //排除包含的关系 //跳过儿子,孙子在列表中的情况 bool flag = false; foreach (Lebi_Transport_Price tran in trans) { pids = EX_Area.Parentids_Get(tran.Area_id); pids = "," + pids + ","; if (pids.Contains("," + model.Area_id + ",") && model.Transport_id == tran.Transport_id) { flag = true; } } if (!flag) { trans.Add(model); } } } if (area.Parentid > 0) { area = B_Lebi_Area.GetModel(area.Parentid); if (area != null) { trans = TransportPrice(area, trans, supplierid); } } return(trans); }