示例#1
0
        public List<OrderDeliverQuery> GetDeliver(OrderDeliverQuery store, out int totalCount)
        {
            StringBuilder sql = new StringBuilder();
            StringBuilder sqlcondi = new StringBuilder();

            try
            {
                sql.AppendFormat(@" SELECT od.deliver_id,od.slave_id,od.deliver_status,tpurl.parameterName as Deliver_Store_Url,od.deliver_store,tps.parameterName as deliver_name, ");
                sql.AppendFormat(" od.deliver_code,FROM_UNIXTIME(od.deliver_time) AS delivertime,od.deliver_note,FROM_UNIXTIME(od.deliver_createdate) AS deliverup, ");
                sql.AppendFormat(" od.deliver_updatedate,od.deliver_ipfrom,os.order_id,os.vendor_id,v.vendor_name_full,v.vendor_name_simple ");
                sqlcondi.AppendFormat(" FROM order_deliver od LEFT JOIN order_slave os ON os.slave_id=od.slave_id ");
                sqlcondi.Append(" LEFT JOIN (select parameterCode,parameterName from t_parametersrc where parameterType='Deliver_Store_Url') tpurl on tpurl.parameterCode=od.deliver_store ");
                sqlcondi.Append(" LEFT JOIN (select parameterCode,parameterName from t_parametersrc where parameterType='Deliver_Store') tps on tps.parameterCode=od.deliver_store ");
                sqlcondi.AppendFormat(" LEFT JOIN vendor v ON os.vendor_id=v.vendor_id WHERE os.order_id={0} ORDER BY od.deliver_time ASC ", store.order_id);
                string sqlstr = " SELECT count(*) as search_total " + sqlcondi.ToString();//Deliver_Store_Url
              
                totalCount = 0;
                if (store.IsPage)
                {
                    System.Data.DataTable _dt = _access.getDataTable(sqlstr);
                    if (_dt != null && _dt.Rows.Count > 0)
                    {
                        totalCount = Convert.ToInt32(_dt.Rows[0]["search_total"]);
                    }
                    sqlcondi.AppendFormat(" limit {0},{1}", store.Start, store.Limit);

                }
                return _access.getDataTableForObj<OrderDeliverQuery>(sql.ToString()+sqlcondi.ToString());
            }
            catch (Exception ex)
            {

                throw new Exception("TabShowDao-->GetDeliver " + ex.Message + sql.ToString(), ex);
            }
        }
示例#2
0
        public List<OrderDeliverQuery> GetOrderDeliverList(OrderDeliverQuery store, out int totalCount)
        {
            StringBuilder strSql = new StringBuilder();
            StringBuilder search = new StringBuilder();

            List<VendorBrandSetQuery> list = new List<VendorBrandSetQuery>();
            StringBuilder strCount = new StringBuilder();
            try
            {
                strSql.AppendFormat(@"SELECT os.order_id,v.vendor_name_simple,od.deliver_id,od.slave_id,od.deliver_status,od.deliver_store,od.deliver_code,FROM_UNIXTIME(od.deliver_time) as delivertime,od.deliver_note,FROM_UNIXTIME(od.deliver_createdate) as delivercre,FROM_UNIXTIME(od.deliver_updatedate) as deliverup  FROM order_deliver od, order_slave os , vendor v WHERE 1=1  AND os.slave_id=od.slave_id AND os.vendor_id = v.vendor_id ");
                strCount = strCount.Append("SELECT count(*) AS search_total FROM order_deliver od, order_slave os , vendor v WHERE 1=1 AND os.slave_id = od.slave_id AND os.vendor_id = v.vendor_id ");
                switch (store.serchs)
                {
                    case "1":
                        search.AppendFormat(" and os.order_id   like   '%{0}%' ", store.search);
                        break;
                    case "2":
                        search.AppendFormat(" and os.slave_id  like  '%{0}%' ", store.search);
                        break;
                    case "3":
                        search.AppendFormat(" and od.deliver_code LIKE '%{0}%' ", store.search);
                        break;
                    default:
                        break;
                }
                if (store.seldate != 0)
                {
                    search.AppendFormat(" and od.deliver_time >='{0}'  and od.deliver_time <='{1}'  ", store.deliverstart, store.deliverend);
                }
                if (store.selven != 0)
                {
                    search.AppendFormat(" and os.vendor_id = '{0}' ", store.selven);
                }
                totalCount = 0;
                if (store.IsPage)
                {
                    strSql.AppendFormat(search.ToString());
                    strCount.AppendFormat(search.ToString());
                    System.Data.DataTable _dt = _dbAccess.getDataTable(strCount.ToString());
                    if (_dt != null && _dt.Rows.Count > 0)
                    {
                        totalCount = Convert.ToInt32(_dt.Rows[0]["search_total"]);
                    }
                    strSql.AppendFormat(" ORDER BY os.order_id  limit {0},{1}", store.Start, store.Limit);
                }
                else 
                {
                    strSql.AppendFormat(search.ToString());
                }
                return _dbAccess.getDataTableForObj<OrderDeliverQuery>(strSql.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("OrderDeliverDao-->GetOrderDeliverList" + ex.Message + strSql.ToString(), ex);
            }
        }
示例#3
0
 public List<OrderDeliverQuery> GetOrderDeliverList(OrderDeliverQuery query, out int totalCount)
 {
     try
     {
         return _orderdeliverDao.GetOrderDeliverList(query, out totalCount);
     }
     catch (Exception ex)
     {
         throw new Exception("OrderDetailMgr-->GetOrderDeliverList-->" + ex.Message, ex);
     }
 }
 public HttpResponseBase GetDeliver()
 {
     List<OrderDeliverQuery> stores = new List<OrderDeliverQuery>();
     string json = string.Empty;
     try
     {
         OrderDeliverQuery query = new OrderDeliverQuery();
         query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量
         query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "20");//用於分頁的變量
         query.order_id = Convert.ToUInt32(Request.Params["Order_Id"].ToString());
         _tabshow = new TabShowMgr(mySqlConnectionString);
         int totalCount = 0;
         stores = _tabshow.GetDeliver(query, out totalCount);
         IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
         timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
         json = "{success:true,'msg':'user',totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(stores, Formatting.Indented, timeConverter) + "}";//返回json數據
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
         json = "{success:true,totalCount:0,data:[]}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
 public HttpResponseBase GetOrderDeliverInfo()
 {
     List<OrderDeliverQuery> stores = new List<OrderDeliverQuery>();
     string json = string.Empty;
     try
     {
         OrderDeliverQuery query = new OrderDeliverQuery();
         query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量
         query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");//用於分頁的變量
         IOrderDeliverImplMgr _IorderDeliver = new OrderDeliverMgr(mySqlConnectionString);
         query.serchs = Request.Params["serchs"].ToString().Trim();//查詢條件
         if (Request.Params["orderid"] == "" || Request.Params["orderid"] == null)//查詢內容
         {
             query.order_id = 0;
         }
         else
         {
             query.search = Request.Params["orderid"];
         }
         query.seldate = Convert.ToInt32(Request.Params["seldate"] ?? "0");//日期條件
         if (Request.Params["selven"] == "" || Request.Params["selven"] == null)//供應商
         {
             query.selven = 0;
         }
         else
         {
             query.selven = Convert.ToInt32(Request.Params["selven"] ?? "0");
         }
         DateTime dt;
         if (DateTime.TryParse(Request.Params["deliverstart"].ToString(), out dt))//開始時間
         {
             query.deliverstart = Convert.ToInt32(CommonFunction.GetPHPTime(dt.ToString("yyyy-MM-dd HH:mm:ss")));
         }
         if (DateTime.TryParse(Request.Params["deliverend"].ToString(), out dt))//結束時間
         {
             query.deliverend = Convert.ToInt32(CommonFunction.GetPHPTime(dt.ToString("yyyy-MM-dd HH:mm:ss")));
         }
         int totalCount = 0;
         stores = _IorderDeliver.GetOrderDeliverList(query, out totalCount);
         //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
         IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
         timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
         json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(stores, Formatting.Indented, timeConverter) + "}";//返回json數據
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
         json = "{success:true,totalCount:0,data:[]}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
        /// <summary>
        /// 供應商自行出貨確認
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase SelfConfirmShipment()
        {
            string jsonStr = String.Empty;
            BLL.gigade.Model.Vendor vendor = Session["vendor"] as BLL.gigade.Model.Vendor;
            BLL.gigade.Model.OrderSlaveMaster master = new OrderSlaveMaster();
            OrderDeliverQuery query = new OrderDeliverQuery();
            uint Slave_Id = 0;//要出貨的訂單;
            string Select_Did = "";//選中要出貨的出貨單號
            DateTime sendProTime = DateTime.MinValue;//出貨時間
            string delivery_note = "";//出貨單備註
            uint DeliverStores = 0;//物流單號
            string delivery_Code = "";//物流業者
            string IP = "";
            string Description = "";
            #region 獲取條件
            if (!string.IsNullOrEmpty(Request.Params["Slave_Id"]))
            {
                Slave_Id = uint.Parse(Request.Params["Slave_Id"]);
            }
            if (!string.IsNullOrEmpty(Request.Params["Select_Did"]))
            {
                Select_Did = Request.Params["Select_Did"];
            }
            if (!string.IsNullOrEmpty(Request.Params["sendProTime"]))
            {
                sendProTime = DateTime.Parse(Request.Params["sendProTime"]);
            }
            if (!string.IsNullOrEmpty(Request.Params["delivery_note"]))
            {
                delivery_note = Request.Params["delivery_note"];
            }
            if (!string.IsNullOrEmpty(Request.Params["DeliverStores"]))
            {
                DeliverStores = uint.Parse(Request.Params["DeliverStores"]);
            }
            if (!string.IsNullOrEmpty(Request.Params["delivery_Code"]))
            {
                delivery_Code = Request.Params["delivery_Code"];
            }
            #endregion
            string did = Select_Did.TrimEnd(',');//去掉最後一個分割符號
            string[] Sid_Row = did.Split(',');//拆分
            List<OrderDetailQuery> store = new List<OrderDetailQuery>();
            OrderDetailQuery querys = new OrderDetailQuery();
            querys.Slave_Id = Slave_Id;
            querys.Vendor_Id = vendor.vendor_id;
            _OrderDetailMgr = new OrderDetailMgr(mySqlConnectionString);
            store = _OrderDetailMgr.DeliveryInformation(querys, null);//查询出供應商出貨單Vendor delivery
            int reslut = 0;
            if (Sid_Row.Length != store.Count)
            {
                #region 轉換數據
                DataTable All_Did = new DataTable();
                All_Did.Columns.Add("detail_id", typeof(String));
                All_Did.Columns.Add("product_name", typeof(String));
                All_Did.Columns.Add("product_freight_set", typeof(String));
                All_Did.Columns.Add("product_spec_name", typeof(String));
                All_Did.Columns.Add("single_money", typeof(String));
                All_Did.Columns.Add("parent_name", typeof(String));
                All_Did.Columns.Add("parent_num", typeof(String));
                All_Did.Columns.Add("combined_mode", typeof(String));
                All_Did.Columns.Add("item_mode", typeof(String));
                All_Did.Columns.Add("buy_num", typeof(String));
                foreach (var item in store)
                {
                    DataRow dr = All_Did.NewRow();
                    dr[0] = item.Detail_Id;
                    dr[1] = item.Product_Name;
                    dr[2] = item.Product_Freight_Set;
                    dr[3] = item.Product_Spec_Name;
                    dr[4] = item.Single_Money;
                    dr[5] = item.parent_name;
                    dr[6] = item.parent_num;
                    dr[7] = item.Combined_Mode;
                    dr[8] = item.item_mode;
                    dr[9] = item.Buy_Num;
                    All_Did.Rows.Add(dr);
                }
                #endregion
                //
                //調用宋東亞
                _OrderDeliverMgr = new OrderDeliverMgr(mySqlConnectionString);
                _OrderDeliverMgr.DismantleSlave(int.Parse(querys.Slave_Id.ToString()), Select_Did, All_Did);
            }

            master.creator = vendor.vendor_id;
            System.Net.IPAddress[] addlist = Dns.GetHostByName(Dns.GetHostName()).AddressList;
            if (addlist.Length > 0)
            {
                IP = addlist[0].ToString();
            }

            try
            {
                OrderDeliver deliver = new OrderDeliver();
                deliver.slave_id = Slave_Id;
                deliver.deliver_store = DeliverStores;
                deliver.deliver_code = delivery_Code;
                deliver.deliver_note = delivery_note;
                deliver.deliver_time = uint.Parse(CommonFunction.GetPHPTime(sendProTime.ToString("yyyy-MM-dd")).ToString());
                deliver.deliver_ipfrom = IP;
                DataTable _dtSms = new DataTable();
                _dtSms.Columns.Add("sms_id", typeof(String));
                DataRow row = _dtSms.NewRow();//需發簡訊通知的item
                row[0] = 113552;
                _dtSms.Rows.Add(row);
                row = _dtSms.NewRow();
                row[0] = 113550;
                _dtSms.Rows.Add(row);
                Description = "Writer : vendor(" + vendor.vendor_id + ") " + vendor.vendor_name_simple;
                _OrderMgr = new OrderMgr(mySqlConnectionString);
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
                timeConverter.DateTimeFormat = "yyyy-MM-dd";
                _OrderMgr.SelfThingsMethod(_dtSms, deliver, Description);//出貨成功!

                jsonStr = "{success:true}";//返回json數據
                //   jsonStr = "{success:true,msg:\"" + 1 + "\"}";
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                jsonStr = "{success:false,msg:0}";
            }
            this.Response.Clear();
            this.Response.Write(jsonStr.ToString());
            this.Response.End();
            return this.Response;
        }