示例#1
0
 ///返回貨物運達日期
 private DateTime restDay(DateTime dt, DateTime isAddDay, int days,bool schedule)
 {
     //long num_date = CommonFunction.GetPHPTime(dt.ToString());
     //string dtFlagStr =isAddDay.GetDateTimeFormats()[0] + " 15:00";
     //long  dtFlag = CommonFunction.GetPHPTime(dtFlagStr);///獲得當天15:00的時間蹉
     //long isAddDayInt = CommonFunction.GetPHPTime(isAddDay.ToString("yyyy-MM-dd HH:mm:ss"));
     //days = (isAddDayInt - dtFlag) > 0 ? days + 1 : days;  //判斷時間是否大於15點,大於時,運達天數加1
     days = IsAddDayFun(dt, isAddDay, days, schedule);
     ICalendarImplMgr _cdMgr = new CalendarMgr(connectionString);
     List<Calendar> calendar_list = _cdMgr.GetCalendarInfo(new Calendar { EndDateStr = CommonFunction.GetPHPTime(dt.ToString()).ToString() }); ///獲取行事歷控件中休息時間的集合
     DateTime sourceDt = dt;///定義一個時間用來保存下單時間
     return VerifyTime(dt, days, calendar_list, dt);
 }
示例#2
0
        //public string ArriveTime(uint detailId)
        //{
        //    //add by wwei0216w 2015/5/25
        //    int days = 0;
        //    DateTime date;
        //    try
        //    {
        //        _srMgr = new ScheduleRelationMgr(connection);
        //        ProductItemCustom pi = new ProductItemCustom();
        //        IProductItemImplMgr _productItemMgr = new ProductItemMgr(connection);
        //        IOrderDetailImplMgr _orderDetailMgr = new OrderDetailMgr(connection);
        //        OrderDetailCustom od = _orderDetailMgr.GetArriveDay(detailId).FirstOrDefault();///獲得訂單中關於天數的信息(供應商出貨天數,運達天數....)
        //        if (od.item_mode == 0) //如果是單一商品(既item_mode=0,parent_id = 0)則根據item_id來獲取計算運達天數的信息
        //        {
        //            pi = _productItemMgr.GetProductArriveDay(new ProductItem { Item_Id = od.Item_Id }, "item");
        //        }
        //        else if (od.item_mode != 0)//如果是組合商品(既item_mode !=0,有parent_id的值)則更具parent_id來計算運達天數
        //        {
        //            //組合商品需根據出貨單確定最晚一件到達的時間為運達天數,暫且擱置
        //            return "";
        //        }
        //        else
        //        {
        //            return "";
        //        }
        //        days = pi.Arrive_Days + pi.Deliver_Days;///計算運達天數
        //        date = _srMgr.GetRecentlyTime(Convert.ToInt32(pi.Product_Id), "product");///調用GetRecentlyTime()方法 獲得最近出貨時間

        //        //edit by wwei0216w 2015/6/2 添加item_stock > 0 的判斷,如果 item_stock > 0 則不適用排程的時間,啟用當前時間作為基礎時間
        //        if (date == DateTime.MinValue || date < DateTime.Now || date == null)///如果得到的最近出貨天數  為最小時間   或者   小于當前時間
        //        {
        //            date = DateTime.Now;
        //        }

        //        DateTime isAddDay = CommonFunction.GetNetTime(od.order_date_pay);///轉換時間
        //        date = restDay(date, isAddDay, days);///計算具體到貨日期
        //        if (date == DateTime.MinValue)
        //        {
        //            return "";
        //        }
        //        else
        //        {
        //            return date.ToString("yyyy/MM/dd");
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        throw new Exception("DeliverMasterMgr-->ArriveTime-->" + ex.Message, ex);
        //    }
        //}
        #endregion 

        ///返回貨物運達日期
        private DateTime restDay(DateTime dt, DateTime isAddDay, int days)
        {
            try
            {
                long num_date = CommonFunction.GetPHPTime(dt.ToString());
                days = isAddDay.Hour > 15 ? days + 1 : days;  //判斷時間是否大於15點,大於時,運達天數加1
                ICalendarImplMgr _cdMgr = new CalendarMgr(connection);
                List<Calendar> calendar_list = _cdMgr.GetCalendarInfo(new Calendar { EndDateStr = num_date.ToString() }); ///獲取行事歷控件中休息時間的集合
                return VerifyTime(dt, days, calendar_list);
            }
            catch (Exception ex)
            {
                throw new Exception("DeliverMasterMgr-->restDay-->" + ex.Message, ex);
            }
        }