public List<OrderReturnMasterQuery> GetReturnMaster(OrderReturnMasterQuery query, out int totalCount) { StringBuilder sql = new StringBuilder(); StringBuilder sqlCount = new StringBuilder(); StringBuilder sqlFrom = new StringBuilder(); StringBuilder sqlWhere = new StringBuilder(); try { sqlCount.Append("select Count(orm.return_id) as 'totalCount' "); sql.Append(@"select orm.return_id,orm.order_id,orm.vendor_id,v.vendor_name_simple vendor_name,orm.return_status,orm.return_note,orc.orc_remark,orc.orc_service_remark,"); sql.Append(@" orm.bank_note,orm.invoice_deal,orm.package,orm.return_zip,orm.return_address,orm.deliver_code,"); sql.Append(@"orm.return_createdate,FROM_UNIXTIME(orm.return_createdate) as createdate,orm.return_ipfrom,"); sql.Append(@" orm.return_updatedate,CASE orm.return_updatedate when 0 then null ELSE FROM_UNIXTIME(orm.return_updatedate) end as updatedate"); sqlFrom.Append(@" from order_return_master orm left join vendor v on orm.vendor_id=v.vendor_id "); sqlFrom.Append(" LEFT JOIN order_return_content orc on orm.return_id=orc.return_id "); totalCount = 0; sqlWhere.Append(" where 1=1 "); if (query.ven_type == 1) { sqlWhere.AppendFormat(" and orm.order_id like '%{0}%' ", query.content); } else if (query.ven_type == 2) { sqlWhere.AppendFormat(" and orm.return_id like '%{0}%' ", query.content); } if (query.date_type == 1) { sqlWhere.AppendFormat(" and orm.return_createdate >='{0}' and orm.return_createdate<='{1}' ", CommonFunction.GetPHPTime(query.time_start), CommonFunction.GetPHPTime(query.time_end)); } else if (query.date_type == 2) { sqlWhere.Append(" left join order_return_detail ord on ord.return_id = orm.return_id "); sqlWhere.Append(" left join deliver_detail dd on dd.detail_id = ord.detail_id "); sqlWhere.Append(" left join deliver_master dm on dm.deliver_id = dd.deliver_id "); sqlWhere.AppendFormat(" and dm.delivery_date>='{0}' and dm.delivery_date<='{1}' ",query.time_start,query.time_end); } if (query.return_status != 3) { sqlWhere.AppendFormat(" and orm.return_status='{0}' ",query.return_status); } if (query.IsPage) { System.Data.DataTable _dt = _accessMySql.getDataTable(sqlCount.ToString() + sqlFrom.ToString()+sqlWhere.ToString()); if (int.Parse(_dt.Rows[0][0].ToString()) > 0) { totalCount = int.Parse(_dt.Rows[0][0].ToString()); } sqlWhere.Append(@" order by orm.return_createdate desc "); sqlWhere.AppendFormat(" limit {0},{1}", query.Start, query.Limit); } sql.Append(sqlFrom.ToString()+sqlWhere.ToString()); return _accessMySql.getDataTableForObj<OrderReturnMasterQuery>(sql.ToString()); } catch (Exception ex) { throw new Exception("OrderReturnMasterDao.GetReturnMaster-->" + ex.Message + sql.ToString(), ex); } }
public List<OrderReturnMasterQuery> GetReturnMaster(OrderReturnMasterQuery ormQuery, out int totalCount) { try { return _orderReturnMaster.GetReturnMaster(ormQuery, out totalCount); } catch (Exception ex) { throw new Exception("OrderReturnMasterMgr.GetReturnMaster-->" + ex.Message, ex); } }
public int Save(OrderReturnMasterQuery query) { try { return _orderReturnMaster.Save(query); } catch (Exception ex) { throw new Exception("OrderReturnMasterMgr.Save-->" + ex.Message, ex); } }
public List<OrderReturnMasterQuery> GetReturnMasterDown(OrderReturnMasterQuery store, out int totalCount) { try { return _tabshowdao.GetReturnMasterDown(store, out totalCount); } catch (Exception ex) { throw new Exception("TabShowMgr-->GetReturnMasterDown-->" + ex.Message, ex); } }
public HttpResponseBase GetOrderReturnMasterList() { string json = string.Empty; try { int totalCount = 0; OrderReturnMasterQuery query = new OrderReturnMasterQuery(); query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量 query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");// if (!string.IsNullOrEmpty(Request.Params["ven_type"])) { query.ven_type = Convert.ToInt32(Request.Params["ven_type"]); } if (!string.IsNullOrEmpty(Request.Params["search_content"])) { query.content = Request.Params["search_content"]; } if (!string.IsNullOrEmpty(Request.Params["date_type"])) { query.date_type = Convert.ToInt32(Request.Params["date_type"]); } if (!string.IsNullOrEmpty(Request.Params["time_start"])) { query.time_start = Convert.ToDateTime(Request.Params["time_start"]).ToString("yyyy-MM-dd HH:mm:ss"); } if (!string.IsNullOrEmpty(Request.Params["time_end"])) { query.time_end = Convert.ToDateTime(Request.Params["time_end"]).ToString("yyyy-MM-dd HH:mm:ss"); } if (!string.IsNullOrEmpty(Request.Params["return_status"])) { query.return_status = Convert.ToUInt32(Request.Params["return_status"]); } _orderReturnMaster = new OrderReturnMasterMgr(mySqlConnectionString); List<OrderReturnMasterQuery> stores = _orderReturnMaster.GetReturnMaster(query, out totalCount); IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(stores, Formatting.Indented, timeConverter) + "}"; } 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 OrderReturn() { List<OrderReturnMasterQuery> stores = new List<OrderReturnMasterQuery>(); OrderReturnMasterQuery query = new OrderReturnMasterQuery(); _orderReturnMaster=new OrderReturnMasterMgr(mySqlConnectionString); string json = string.Empty; try { if (!string.IsNullOrEmpty(Request.Params["detail_id"])) { query.detailId = Request.Params["detail_id"].ToString(); } if (query.detailId.Length > 0) { query.detailId = query.detailId.Substring(0, query.detailId.Length - 1); } System.Net.IPAddress[] addlist = Dns.GetHostByName(Dns.GetHostName()).AddressList; query.return_ipfrom = addlist[0].ToString(); json = _orderReturnMaster.OrderReturn(query);// "{success:true}";//返回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:flase}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase GetOrderReturnDown() { string json = string.Empty; OrderReturnMasterQuery query = new OrderReturnMasterQuery(); query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量 query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");//用於分頁的變量 if (!string.IsNullOrEmpty(Request.Params["Order_Id"])) { query.detailId = Request.Params["Order_Id"]; } try { List<OrderReturnMasterQuery> store = new List<OrderReturnMasterQuery>(); _tbshow = new TabShowMgr(mySqlConnectionString); int totalCount = 0; store = _tbshow.GetReturnMasterDown(query, out totalCount); IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store, 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 List<OrderReturnMasterQuery> GetReturnMasterDown(OrderReturnMasterQuery store, out int totalCount) { StringBuilder sb = new StringBuilder(); StringBuilder sqlCondi = new StringBuilder(); try { sb.Append(@"SELECT orm.return_id,od.item_id,od.product_name,tp.parameterName as product_freight_set_string,od.buy_num,od.single_money,od.buy_num*od.single_money as subtotal,od.deduct_bonus "); sqlCondi.Append(" from order_detail od "); sqlCondi.Append(" LEFT JOIN order_return_detail o ON o.detail_id=od.detail_id "); sqlCondi.Append(" LEFT JOIN order_return_master orm ON orm.return_id=o.return_id "); sqlCondi.Append(" LEFT JOIN (select parameterCode,parameterName from t_parametersrc where parameterType ='product_freight')tp on tp.parameterCode=od.product_freight_set "); sqlCondi.Append(" where 1=1 "); if (!string.IsNullOrEmpty(store.detailId)) { sqlCondi.AppendFormat(" and orm.order_id= '{0}' ", store.detailId); } totalCount = 0; string sqlcount = " select count(od.item_id) as totalCount " + sqlCondi.ToString(); if (store.IsPage) { System.Data.DataTable _dt = _access.getDataTable(sqlcount); if (_dt != null && _dt.Rows.Count > 0) { totalCount = Convert.ToInt32(_dt.Rows[0]["totalCount"]); } sqlCondi.AppendFormat(" limit {0},{1}", store.Start, store.Limit); } return _access.getDataTableForObj<OrderReturnMasterQuery>(sb.ToString() + sqlCondi.ToString()); } catch (Exception ex) { throw new Exception("TabShowDao-->GetReturnMasterDown " + ex.Message + sb.ToString(), ex); } }
public List<OrderReturnMasterQuery> GetReturn(OrderReturnMasterQuery store, out int totalCount) { StringBuilder sql = new StringBuilder(); StringBuilder sqlcount = new StringBuilder(); try { sql.AppendLine(@"SELECT orm.return_id,orm.order_id,orm.vendor_id,"); sql.AppendLine(@"CASE orm.return_status WHEN '1' THEN '已歸檔' WHEN '2' THEN '刪除' ELSE '待歸檔' END AS return_status_string,orm.return_note,orm.bank_note,"); sql.AppendLine(@"orm.invoice_deal,orm.package,orm.return_zip,"); sql.AppendLine(@"orm.return_address,orm.deliver_code, FROM_UNIXTIME(orm.return_createdate) AS createdate,"); sql.AppendLine(@"orm.return_updatedate,orm.return_ipfrom,"); sql.AppendLine(@"v.vendor_name_simple,v.company_phone,CONCAT(v.company_zip,big,small,v.company_address) as company_address,"); sql.AppendLine(@"ord.return_id,ord.detail_id,od.slave_id,od.item_id,od.product_freight_set,"); sql.AppendLine(@"od.product_name,od.product_spec_name,od.detail_note,pf.parameterName AS product_freight_set_string,"); sql.AppendLine(@"od.single_money,od.buy_num,od.single_money,(od.single_money*od.buy_num) AS subtotal,od.deduct_bonus"); sql.AppendLine(@"FROM order_return_master orm"); sql.AppendLine(@"LEFT JOIN vendor v ON orm.vendor_id=v.vendor_id"); sql.AppendLine(@"LEFT JOIN order_return_detail ord ON ord.return_id=orm.return_id"); sql.AppendLine(@"LEFT JOIN order_detail od ON ord.detail_id=od.detail_id"); sql.AppendLine(@"LEFT JOIN (SELECT * FROM t_parametersrc WHERE parameterType='product_freight') pf ON pf.parameterCode=od.product_freight_set"); sql.AppendLine(@"LEFT JOIN t_zip_code tzc ON tzc.zipcode=v.company_zip"); sql.AppendFormat(@"WHERE orm.order_id={0}", store.order_id); sqlcount.AppendLine(@"SELECT count(*) AS search_total FROM order_return_master orm"); sqlcount.AppendLine(@"LEFT JOIN vendor v ON orm.vendor_id=v.vendor_id"); sqlcount.AppendLine(@"LEFT JOIN order_return_detail ord ON ord.return_id=orm.return_id"); sqlcount.AppendLine(@"LEFT JOIN order_detail od ON ord.detail_id=od.detail_id"); sqlcount.AppendFormat(@"WHERE orm.order_id={0};", store.order_id); totalCount = 0; if (store.IsPage) { System.Data.DataTable _dt = _access.getDataTable(sqlcount.ToString()); if (_dt != null && _dt.Rows.Count > 0) { totalCount = Convert.ToInt32(_dt.Rows[0]["search_total"]); } sql.AppendFormat(" limit {0},{1}", store.Start, store.Limit); } return _access.getDataTableForObj<OrderReturnMasterQuery>(sql.ToString()); } catch (Exception ex) { throw new Exception("TabShowDao-->GetReturn " + ex.Message + sql.ToString(), ex); } }
public StreamReader GetUrl(OrderReturnMasterQuery query, HgDeduct hd) { WebClient wc = new WebClient(); string url = query.HgReturnUrl + "?MERCHANT_POS=" + query.HgMerchandID + "&TERMINAL_POS=" + query.HgTeminalID + "&ENC_IDNO=" + hd.enc_idno + "&CHK_SUM=" + hd.chk_sum + "&TOKEN=" + hd.token + "&ORDER_ID=" + hd.order_id; Stream stream = wc.OpenRead(url); StreamReader sr = new StreamReader(stream); return sr; }
public void Deduct_Refund(OrderMaster om, int deductbonus, int deductcash, int deducthg, OrderReturnMasterQuery query) { #region 購金 int expireDay = 90; BonusMaster bm = new BonusMaster(); bm.user_id = om.User_Id; bm.type_id = 4; bm.bonus_type = 1; DateTime master_start = DateTime.Now; bm.master_start = Convert.ToUInt32(CommonFunction.GetPHPTime(master_start.ToString("yyyy-MM-dd 00:00:00"))); bm.master_createdate = Convert.ToUInt32(CommonFunction.GetPHPTime(DateTime.Now.ToString())); bm.master_updatedate = Convert.ToUInt32(CommonFunction.GetPHPTime(DateTime.Now.ToString())); bm.master_ipfrom = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName()).AddressList.FirstOrDefault().ToString(); bm.master_note = om.Order_Id.ToString(); bm.master_writer = "system"; if (deductbonus > 0) { List<VipUserGroup> vipuserLi = _vipuserGroupDao.GetVipUserByOrderId(om.User_Id, 0, 1); if (vipuserLi.Count!=0) { VipUserGroup vug = vipuserLi.FirstOrDefault(); expireDay = vug.bonus_expire_day; om.Accumulated_Bonus = om.Accumulated_Bonus * vug.bonus_rate; } #region BonusMaster Model bm.master_total = Convert.ToUInt32(deductbonus); bm.master_balance = Convert.ToInt32(deductbonus); DateTime master_end = master_start.AddDays(Convert.ToDouble(expireDay)); bm.master_end = Convert.ToUInt32(CommonFunction.GetPHPTime(master_end.ToString("yyyy-MM-dd 23:59:59"))); #endregion bm.master_writer = "訂單退貨返還購物金"; Bonus_Master_Add(bm); } #endregion #region 抵用券 if (deductcash > 0) { bm.bonus_type = 2; bm.master_total = Convert.ToUInt32(deductcash); bm.master_balance = Convert.ToInt32(deductcash); DateTime master_end = master_start.AddDays(Convert.ToDouble(expireDay)); bm.master_end = Convert.ToUInt32(CommonFunction.GetPHPTime(master_end.ToString("yyyy-MM-dd 23:59:59"))); bm.master_writer = "訂單退貨返還抵用券"; Bonus_Master_Add(bm); } #endregion #region HG點 if (deducthg > 0) { //hg_deduct_reverse(deducthg, om.Order_Id, query); } #endregion }
public string CancelReturnPurchaes(OrderReturnMasterQuery query) { string json = string.Empty; try { int ors_status=0; DataTable _dtStatus = _orderReturnMaster.OrsStatus(query.order_id); if (_dtStatus.Rows.Count == 0) { ors_status = 0; } else { if (_dtStatus.Rows[0][0].ToString() == "") { ors_status = 0; } else { ors_status = Convert.ToInt32(_dtStatus.Rows[0][0]); } } if (ors_status == 0 && query.return_status == 0) { OrderMasterStatusQuery statusquery = new OrderMasterStatusQuery(); OrderDetailQuery detailquery = new OrderDetailQuery(); ArrayList arrList = new ArrayList(); query.return_status = 2; arrList.Add(_orderReturnMaster.UpOrderReturnMaster(query)); DataTable _dt = _orderReturnMaster.GetSerialID(29); statusquery.serial_id = Convert.ToUInt64(_dt.Rows[0][0]); statusquery.order_id = query.order_id; statusquery.order_status = query.return_status; statusquery.status_description = "Writer:(" + query.user_id + ")" + query.user_username + ",return_id:" + query.return_id + ",取消退貨請協助通知營管貨品確實出貨"; statusquery.status_ipfrom = query.return_ipfrom; arrList.Add(_orderReturnMaster.InsertOrderMasterS(statusquery)); List<OrderDetailQuery> odli = _orderDetailDao.OrderDetail(query.return_id); foreach (var item in odli) { detailquery.Slave_Id = item.Slave_Id; detailquery.Parent_Id = item.Parent_Id; detailquery.pack_id = item.pack_id; detailquery.Detail_Id = item.Detail_Id; if (item.item_mode == 1) { arrList.Add(_orderDetailDao.UpdateOrderDetailSome(detailquery)); } else { arrList.Add(_orderDetailDao.UpdateOrderDetail(detailquery)); } } if (_mySqlDao.ExcuteSqlsThrowException(arrList)) { json = "{success:true}"; } else { json = "{success:false}"; } } else { json = "{success:false,msg:'1'}"; } return json; } catch (Exception ex) { throw new Exception("OrderReturnMasterMgr.CancelReturnPurchaes-->" + ex.Message, ex); } }
public void Hg_Deduct_Reverse(int deduct_happygo, uint order_id, OrderReturnMasterQuery query) { StringBuilder sql = new StringBuilder(); MySqlCommand mySqlCmd = new MySqlCommand(); MySqlConnection mySqlConn = new MySqlConnection(connString); try { if (mySqlConn != null && mySqlConn.State == System.Data.ConnectionState.Closed) { mySqlConn.Open(); } mySqlCmd.Connection = mySqlConn; mySqlCmd.Transaction = mySqlConn.BeginTransaction(); mySqlCmd.CommandType = System.Data.CommandType.Text; HgDeduct hd = GetHappyGoEncIdno(order_id); // https://www.gimg.com/shoppings/happygo_deduct_reverse? //MERCHANT_POS=6601000081 // &TERMINAL_POS=13999501 // &ENC_IDNO=hd.enc_idno // &CHK_SUM=hd.chk_sum // &TOKEN=hd.token // &ORDER_ID=hd.order_id // $url = ''; //$url .= HG_REVERSALFULLREDEEM_URL.'?MERCHANT_POS='.HG_MERCHANDID. https://www.gimg.com/shoppings/happygo_deduct_reverse // '&TERMINAL_POS='.HG_TERMINALID.'&ENC_IDNO='.$hg_deduct['enc_idno'].'&CHK_SUM='.$hg_deduct['chk_sum'].'&TOKEN='.$hg_deduct['token'].'&ORDER_ID='.$hg_deduct['order_id']; if (hd != null) { #region phpCode StreamReader sr = GetUrl(query, hd); string strLine = ""; HgDeductReverse hdr = new HgDeductReverse(); //while ((strLine = sr.ReadLine()) != null) //{ // hdr.merchant_pos = query.HgMerchandID; // hdr.terminal_pos = query.HgTeminalID; // hdr.enc_idno= //} //$curl = curl_init($url); //curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //curl_setopt ($curl, CURLOPT_HEADER, 0); //$data = curl_exec($curl);//傳回值 //curl_close($curl); //$xml = simplexml_load_string($data); //$happygo = array( // 'merchant_pos' => (string)$xml->DATA->MERCHANT_POS, // 'terminal_pos' => (string)$xml->DATA->TERMINAL_POS, // 'enc_idno' => (string)$xml->DATA->ENC_IDNO, // 'chk_sum' =>(string) $xml->DATA->CHK_SUM, // 'token' => (string)$xml->DATA->TOKEN, // 'order_id' => (string)$xml->DATA->ORDER_ID, // 'date' =>(string) $xml->DATA->DATE, // 'time' => (string)$xml->DATA->TIME, // 'code' =>(string) $xml->RESPONSE->CODE, // 'message' => (string)$xml->RESPONSE->MESSAGE //); //$sSQL = 'INSERT INTO hg_deduct_reverse ' . $amego_db->sql_build_array('INSERT', $happygo ); //$amego_db->sql_query($sSQL); // if(!$xml->RESPONSE->CODE == 5000) // { // //insert hg_deduct_refund // $this ->accumulated_user_happy_go($deduct_happygo,$nOrder_Id); // } mySqlCmd.CommandText = AccumulatedUserHG(deduct_happygo, hd); sql.Append(mySqlCmd.CommandText); mySqlCmd.ExecuteNonQuery(); sql.Clear(); // * // * 還回購物時扣除的hg點數 // * @param $deduct_hg // */ // function accumulated_user_happy_go( $deduct_happygo = 0 , $nOrder_Id = 0) // { // global $amego_db; // $happygo = array( // 'enc_idno' => '', // 'chk_sum' => '', // 'transaction_date' => date('Y/m/d H:i:s', (time())), // 'merchant' => HG_MERCHANDID, // 'terminal' => HG_TERMINALID, // 'refund_point' => (int) $deduct_happygo, // 'category' => HG_CATEGORY, // 'wallet' => HG_WALLET, // 'note' => '吉甲地台灣好市集訂單編號'.$nOrder_Id.'歸還點數:'.$deduct_happygo.'點', // 'order_id' => (int) $nOrder_Id // ); // if($deduct_happygo != 0 && $nOrder_Id != 0) // { // $hg_deduct = $this ->get_happy_go_enc_idno($nOrder_Id); //QueryHgDecut(order_id) // if($hg_deduct == false) // { // die('取得身分證字號失敗'); // } // $happygo['enc_idno'] = $hg_deduct['enc_idno']; // $happygo['chk_sum'] = $hg_deduct['chk_sum']; // $sSQL = 'INSERT INTO hg_deduct_refund ' . $amego_db->sql_build_array('INSERT', $happygo ); //// echo $sSQL.'歸還抵扣HG點數<br/>';; // $amego_db->sql_query($sSQL); // } // else // { // die('扣除HappyGo點數失敗'); // } // } #endregion } mySqlCmd.Transaction.Commit(); } catch (Exception ex) { mySqlCmd.Transaction.Rollback(); throw new Exception(" OrderCancelMasterDao-->Hg_Deduct_Reverse-->" + ex.Message, ex); } finally { if (mySqlConn != null && mySqlConn.State == System.Data.ConnectionState.Open) { mySqlConn.Close(); } } }
//退款單 public string InsertOrderMoneyReturnSql(OrderReturnMasterQuery ormQuery) { StringBuilder sql = new StringBuilder(); try { sql.Append(" set sql_safe_updates = 0;"); sql.AppendFormat(@"update order_return_master set return_status={0},return_note={1},invoice_deal={2},package={3},", ormQuery.return_status, ormQuery.return_note, ormQuery.invoice_deal, ormQuery.package); sql.AppendFormat(@"return_zip={0},bank_note={1},return_address={2},return_updatedate={3},", ormQuery.return_zip, ormQuery.bank_note, ormQuery.return_address, ormQuery.return_updatedate); sql.AppendFormat(@"deliver_code={0},return_ipfrom={1} ", ormQuery.deliver_code, ormQuery.return_ipfrom); sql.AppendFormat(@" where return_id={0}", ormQuery.return_id); sql.Append(" set sql_safe_updates = 1;"); return sql.ToString(); } catch (Exception ex) { throw new Exception("OrderReturnMasterDao.GetReturnMaster-->" + ex.Message + sql.ToString(), ex); } }
/// <summary> /// 退貨單歸檔 /// </summary> /// <param name="query"></param> /// <returns></returns> public int Save(OrderReturnMasterQuery query) { int id = 0; SerialDao serialDao = new SerialDao(connString); MySqlCommand mySqlCmd = new MySqlCommand(); MySqlConnection mySqlConn = new MySqlConnection(connString); StringBuilder sql = new StringBuilder(); try { if (mySqlConn != null && mySqlConn.State == System.Data.ConnectionState.Closed) { mySqlConn.Open(); } mySqlCmd.Connection = mySqlConn; mySqlCmd.Transaction = mySqlConn.BeginTransaction(); mySqlCmd.CommandType = System.Data.CommandType.Text; //修改退貨單 mySqlCmd.CommandText = UpdateSql(query); sql.Append(mySqlCmd.CommandText); mySqlCmd.ExecuteNonQuery(); //若歸檔 判斷是否成立退款單 #region 歸檔 if (query.return_status == 1) { //查詢訂單內容 OrderMaster om = _ordermasterdao.GetOrderMasterByOrderId4Change(Convert.ToInt32(query.order_id)); // 查退貨單內容詳情 DataTable odli = _orderDetailDao.OrderDetailTable(query.return_id,0); if (odli != null) { int paymoney = 0; int returnmoney = 0; int deductbonus = 0; int deductcash = 0; int accumulated_bonus = 0; int accumulated_happygo = 0; int deduct_happygo = 0; int deduct_happygo_money = 0; foreach (DataRow od in odli.Rows) { // 退款金額 = 商品購買金額 - 購物金 paymoney += (Convert.ToInt32(od["single_money"]) * Convert.ToInt32(od["buy_num"])); deductbonus += Convert.ToInt32(od["deduct_bonus"]); deductcash += Convert.ToInt32(od["deduct_welfare"]); accumulated_bonus += Convert.ToInt32(od["accumulated_bonus"]); accumulated_happygo += Convert.ToInt32(od["accumulated_happygo"]); deduct_happygo += Convert.ToInt32(od["deduct_happygo"]); deduct_happygo_money += Convert.ToInt32(od["deduct_happygo_money"]); } returnmoney += paymoney - (deductbonus + deductcash + deduct_happygo_money);//計算應退還的money // 判斷是否有付款 if (om.Money_Collect_Date > 0 && om.Order_Amount > 0 && returnmoney > 0) { //退款方式 uint moneytype = 0; //if (om.Order_Payment == 1 || om.Order_Payment == 2 || om.Order_Payment == 13 || om.Order_Payment == 16) //{ // moneytype = om.Order_Payment; //} if (om.Order_Payment == 1 || om.Order_Payment == 22) { moneytype = 1; } else if (om.Order_Payment == 2) { moneytype = 2; } else if (om.Order_Payment == 13 || om.Order_Payment == 21) { moneytype = 13; } else if (om.Order_Payment == 16) { moneytype = 16; } #region 新增退款單 mySqlCmd.CommandText = serialDao.Update(46);//46 退款單流水號 sql.Append(mySqlCmd.CommandText); uint moneyId = Convert.ToUInt32(mySqlCmd.ExecuteScalar()); OrderMoneyReturn omr = new OrderMoneyReturn(); omr.money_id = moneyId; omr.money_type = moneytype; omr.money_total = Convert.ToUInt32(returnmoney); omr.money_status = 0; omr.money_source = "return_id:" + query.return_id; mySqlCmd.CommandText = _orderMoneyReturnDao.InsertSql(query, omr); sql.Append(mySqlCmd.CommandText); mySqlCmd.ExecuteNonQuery(); #endregion //取回給予的購物金與happygo點數 //扣除給予會員的購物金 if (accumulated_bonus > 0) { Deduct_User_Bonus(accumulated_bonus, om); } //扣除給予會員的hg點數 if (accumulated_happygo > 0) { Deduct_User_Happy_Go(accumulated_happygo, om.Order_Id); } } //黑貓例外處理 if (om.Money_Collect_Date == 0 && om.Order_Payment == 8) { //扣除給予會員的購物金 if (accumulated_bonus > 0) { Deduct_User_Bonus(accumulated_bonus, om); } //扣除給予會員的hg點數 if (accumulated_happygo > 0) { Deduct_User_Happy_Go(accumulated_happygo, om.Order_Id); } } #region 寫入付款單退款金額 if (returnmoney > 0) { mySqlCmd.CommandText = _ordermasterdao.UpdateMoneyReturn(returnmoney, om.Order_Id); sql.Append(mySqlCmd.CommandText); mySqlCmd.ExecuteNonQuery(); sql.Clear(); } #endregion #region 判斷退回購買扣抵的hp點數 判斷是否要退回購物金 if (deduct_happygo > 0) { Deduct_Refund(om, 0, 0, deduct_happygo, query); } if (accumulated_happygo > 0) { Deduct_Refund(om, deductbonus, 0, 0, query); } #endregion //商品數量補回 //foreach (var od in odli) //{ // if (od.item_mode == 1)//组合商品 // { // List<OrderDetail> childDetail = Get_Combined_Product(query.order_id, od.Parent_Id, od.pack_id); // foreach (var child in childDetail) // { // _itemDao.UpdateItemStock(child.Item_Id, child.Buy_Num * child.parent_num); // } // } // else // { // _itemDao.UpdateItemStock(od.Item_Id, od.Buy_Num); // } //} // mySqlCmd.CommandText = GetTotalCount(query.order_id); sql.Append(mySqlCmd.CommandText); int total = mySqlCmd.ExecuteNonQuery(); //比較訂單全部detail的筆數與(退貨單+取消單)的筆數 if (total == 0) { // 首購會員優惠,因取消訂單時要自動回覆功能 if (om.Priority == 1) { mySqlCmd.CommandText = _ordermasterdao.UpdatePriority(om.Order_Id); sql.Append(mySqlCmd.CommandText); mySqlCmd.ExecuteNonQuery(); mySqlCmd.CommandText = _usersDao.UpdateFirstTime(om.User_Id); sql.Append(mySqlCmd.CommandText); mySqlCmd.ExecuteNonQuery(); } //2.0活動筆數 List<UserRecommend> usRecommandLi = _userRecommendDao.QueryByOrderId(om.Order_Id); string idStr = string.Empty; if (usRecommandLi != null) { foreach (var record in usRecommandLi) { if (string.IsNullOrEmpty(idStr)) { idStr += record; } else { idStr += "," + record.id; } } mySqlCmd.CommandText = _userRecommendDao.UpdateIsCommend(idStr); } sql.Append(mySqlCmd.CommandText); mySqlCmd.ExecuteNonQuery(); } } } #endregion #region 取消退款 if (query.return_status == 2) { OrderMasterStatusQuery statusquery = new OrderMasterStatusQuery(); OrderDetailQuery detailquery = new OrderDetailQuery(); string description = "Writer:(" + query.user_id + ")" + query.user_username + ",return_id:" + query.return_id + ",取消退貨請協助通知營管貨品確實出貨"; string sqlSerial = serialDao.Update(29);//訂單主檔狀態流水號 DataTable _dt = _accessMySql.getDataTable(sqlSerial); statusquery.serial_id = Convert.ToUInt64(_dt.Rows[0][0]); statusquery.order_id = query.order_id; statusquery.order_status = query.return_status; statusquery.status_description = description; statusquery.status_ipfrom = query.return_ipfrom; mySqlCmd.CommandText += InsertOrderMasterS(statusquery); List<OrderDetailQuery> odli = _orderDetailDao.OrderDetail(query.return_id); foreach (var item in odli) { detailquery.Slave_Id = item.Slave_Id; detailquery.Parent_Id = item.Parent_Id; detailquery.pack_id = item.pack_id; detailquery.Detail_Id = item.Detail_Id; if (item.item_mode == 1) { mySqlCmd.CommandText = _orderDetailDao.UpdateOrderDetailSome(detailquery); } else { mySqlCmd.CommandText = _orderDetailDao.UpdateOrderDetail(detailquery); } } mySqlCmd.ExecuteNonQuery(); } #endregion mySqlCmd.Transaction.Commit(); id = 1; } catch (Exception ex) { mySqlCmd.Transaction.Rollback(); throw new Exception("OrderReturnlMasterMgr-->Save-->" + ex.Message + sql.ToString(), ex); } finally { if (mySqlConn != null && mySqlConn.State == System.Data.ConnectionState.Open) { mySqlConn.Close(); } } return 0; }
public string UpOrderReturnMaster(OrderReturnMasterQuery query) { StringBuilder sql = new StringBuilder(); try { sql.AppendFormat("update order_return_master set return_status='{0}' where return_id='{1}';",query.return_status,query.return_id); return sql.ToString(); } catch (Exception ex) { throw new Exception("OrderReturnMasterDao-->UpOrderReturnMaster-->" + ex.Message + sql.ToString(), ex); } }
public string UpdateSql(OrderReturnMasterQuery query) { StringBuilder sql = new StringBuilder(); try { query.Replace4MySQL(); sql.Append(" set sql_safe_updates =0;"); sql.AppendFormat(@"update order_return_master set return_status='{0}',return_note='{1}',invoice_deal='{2}',package='{3}',", query.return_status, query.return_note, query.invoice_deal, query.package); sql.AppendFormat(@"return_zip='{0}',bank_note='{1}',return_address='{2}',return_updatedate='{3}',", query.return_zip, query.bank_note, query.return_address, query.return_updatedate); sql.AppendFormat(@"deliver_code='{0}',return_ipfrom='{1}'", query.deliver_code, query.return_ipfrom); sql.AppendFormat(@" where return_id={0};", query.return_id); sql.Append(" set sql_safe_updates = 1;"); return sql.ToString(); } catch (Exception ex) { throw new Exception("OrderReturnMasterDao.UpdateSql-->" + ex.Message + sql.ToString(), ex); } }
public List<OrderDetailQuery> GetOrderreturn(OrderReturnMasterQuery q) { StringBuilder sql = new StringBuilder(); try { sql.AppendFormat(@" SELECT od.detail_id,od.slave_id,od.item_id,od.item_vendor_id,od.product_name,od.item_code,od.parent_id,od.pack_id,od.single_money, od.buy_num,od.product_freight_set,os.order_id,os.vendor_id,v.vendor_name_simple FROM order_detail od,order_slave os,vendor v WHERE od.detail_id IN ({0}) AND os.slave_id = od.slave_id AND od.detail_status in (4,6,7) AND os.vendor_id = v.vendor_id AND os.slave_status <> '99' ORDER BY slave_id ASC, product_freight_set ASC, item_id ASC;", q.detailId); return _accessMySql.getDataTableForObj<OrderDetailQuery>(sql.ToString()); } catch (Exception ex) { throw new Exception("OrderReturnMasterDao.GetOrderreturn-->" + ex.Message + sql.ToString(), ex); } }
public HttpResponseBase SaveOrderReturnMaster() { string json = string.Empty; try { _orderReturnMaster = new OrderReturnMasterMgr(mySqlConnectionString); OrderReturnMasterQuery query = new OrderReturnMasterQuery(); string return_status = string.Empty; query.return_id = uint.Parse(Request.Params["return_id"]); query.order_id = uint.Parse(Request.Params["order_id"]); if (!string.IsNullOrEmpty(Request.Params["return_note"])) { query.return_note = Request.Params["return_note"]; if (!string.IsNullOrEmpty(Request.Params["invoice_deal"])) { query.invoice_deal = uint.Parse(Request.Params["invoice_deal"]); } if (!string.IsNullOrEmpty(Request.Params["return_deal"])) { query.package = uint.Parse(Request.Params["return_deal"]); } if (!string.IsNullOrEmpty(Request.Params["return_zip"])) { query.return_zip = uint.Parse(Request.Params["return_zip"]); } if (!string.IsNullOrEmpty(Request.Params["return_address"])) { query.return_address = Request.Params["return_address"]; } if (!string.IsNullOrEmpty(Request.Params["deliver_code"])) { query.deliver_code = Request.Params["deliver_code"]; } if (!string.IsNullOrEmpty(Request.Params["return_status"])) { query.return_status = uint.Parse(Request.Params["return_status"]); } if (!string.IsNullOrEmpty(Request.Params["bank_note"])) { query.bank_note = Request.Params["bank_note"]; } query.return_updatedate = Convert.ToUInt32(CommonFunction.GetPHPTime(DateTime.Now.ToString())); query.return_ipfrom = Dns.GetHostByName(Dns.GetHostName()).AddressList.FirstOrDefault().ToString(); if (!string.IsNullOrEmpty(Request.Params["bank_name"])) { query.bank_name = Request.Params["bank_name"]; } if (!string.IsNullOrEmpty(Request.Params["bank_branch"])) { query.bank_branch = Request.Params["bank_branch"]; } if (!string.IsNullOrEmpty(Request.Params["bank_account"])) { query.bank_account = Request.Params["bank_account"]; } if (!string.IsNullOrEmpty(Request.Params["account_name"])) { query.account_name = Request.Params["account_name"]; } query.user_id = (Session["caller"] as Caller).user_id.ToString(); query.user_username = (Session["caller"] as Caller).user_username.ToString(); query.HgReturnUrl = HgReturnUrl; query.HgMerchandID = HgMerchandID; query.HgTeminalID = HgTeminalID; query.HgCategoty = HgCategoty; query.HgWallet = HgWallet; if (_orderReturnMaster.Save(query) > 0) { json = "{success:'true'}"; } else { json = "{success:'false'}"; } } } 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:'false'}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
//確認退款單---執行之前的歸檔邏輯但是除去更新庫存的操作 public bool CouldReturnMoney(OrderReturnStatusQuery query) { StringBuilder sql = new StringBuilder(); ArrayList arrList = new ArrayList(); try { arrList.Add(CouldReturn(query)); arrList.Add(UpOrderReturnMaster(query)); HgBatchAccumulateRefund hgBatch = new HgBatchAccumulateRefund(); HGLogin hgLogin = GetHGLoginData((uint)query.ors_order_id); OrderMaster om = _ordermasterdao.GetOrderMasterByOrderId4Change(Convert.ToInt32(query.ors_order_id)); DataTable _returnDt = GetReturnId(query); DataTable odli = _orderDetailDao.OrderDetailTable(Convert.ToUInt32(query.return_id),0); OrderReturnMasterQuery omQuery = new OrderReturnMasterQuery(); SerialDao serialDao = new SerialDao(connStr); MySqlCommand mySqlCmd = new MySqlCommand(); MySqlConnection mySqlConn = new MySqlConnection(connStr); if (odli != null) { #region hg個字段賦值 if (hgLogin != null) { #region hg_batch_accumulate_refund hgBatch.order_id = (uint)query.ors_order_id; hgBatch.head = "B"; hgBatch.card_no = ""; hgBatch.card_checksum = ""; hgBatch.category_id = "N0699999"; hgBatch.wallet = "991991"; hgBatch.enc_idno = hgLogin.enc_idno; hgBatch.checksum = hgLogin.chk_sum; hgBatch.transaction_time = hgLogin.transaction_time; hgBatch.merchant_pos = hgLogin.merchant_pos; hgBatch.terminal_pos = hgLogin.terminal_pos; hgBatch.refund_point = om.Deduct_Happygo; //hgBatch.order_note = "吉甲地台灣好市集訂單編號" + hgBatch.order_id + "返還" + hgBatch.refund_point + "點"; //吉甲地台灣好市集訂單編號131210039累點取消4點 hgBatch.batch_status = 0; hgBatch.billing_checked = 0; // hgBatch.batch_import_time = Convert.ToInt32(CommonFunction.GetPHPTime()); #endregion } #endregion int paymoney = 0; int returnmoney = 0; int deductbonus = 0; int deductcash = 0; int accumulated_bonus = 0; int accumulated_happygo = 0; int deduct_happygo = 0; int deduct_happygo_money = 0; #region 退款金額 = 商品購買金額 - 購物金 foreach (DataRow od in odli.Rows) { // 退款金額 = 商品購買金額 - 購物金 paymoney += (Convert.ToInt32(od["single_money"]) * Convert.ToInt32(od["buy_num"])); deductbonus += Convert.ToInt32(od["deduct_bonus"]); deductcash += Convert.ToInt32(od["deduct_welfare"]); accumulated_bonus += Convert.ToInt32(od["accumulated_bonus"]); accumulated_happygo += Convert.ToInt32(od["accumulated_happygo"]); deduct_happygo += Convert.ToInt32(od["deduct_happygo"]); deduct_happygo_money += Convert.ToInt32(od["deduct_happygo_money"]); } returnmoney += paymoney - (deductbonus + deductcash + deduct_happygo_money);//計算應退還的money #endregion #region 判斷是否有付款 if (om.Money_Collect_Date > 0 && om.Order_Amount > 0 && returnmoney > 0) { #region 新增退款單 string serial_sql = serialDao.Update(46);//46 退款單流水號 DataTable _moneyDt = GetMoneyIDBySerial(serial_sql); uint moneyId = Convert.ToUInt32(_moneyDt.Rows[0][0]); OrderMoneyReturn omr = new OrderMoneyReturn(); omQuery.order_id = Convert.ToUInt32(query.ors_order_id); omr.money_type = om.Order_Payment; omr.money_total = Convert.ToUInt32(returnmoney); omr.money_status = 0; omr.money_source = "return_id:" + query.return_id; omr.money_id = moneyId; omQuery.return_ipfrom = ""; omQuery.bank_name = query.bank_name; omr.bank_branch = query.bank_branch; omr.bank_account = query.bank_account; omr.account_name = query.account_name; omr.bank_note = query.bank_note; string insertSql = _orderMoneyReturnDao.InsertSql(omQuery, omr); arrList.Add(insertSql); #endregion //取回給予的購物金與happygo點數 if (accumulated_bonus > 0) { Deduct_User_Bonus(accumulated_bonus, om); } //扣除給予會員的hg點數 if (accumulated_happygo > 0) { //插入hg_batch_accumulate_refund arrList.Add(hg_batch_accumulate_refund(hgBatch)); } } #endregion #region 黑貓例外處理 //黑貓例外處理 if (om.Money_Collect_Date == 0 && om.Order_Payment == 8) { //扣除給予會員的購物金 if (accumulated_bonus > 0) { Deduct_User_Bonus(accumulated_bonus, om); } //扣除給予會員的hg點數 if (accumulated_happygo > 0) { //插入hg_batch_accumulate_refund arrList.Add(hg_batch_accumulate_refund(hgBatch)); } } #endregion //寫入付款單退款金額 arrList.Add(_ordermasterdao.UpdateMoneyReturn(returnmoney, om.Order_Id)); //退回購買扣抵的hp點數 #region 判斷退回購買扣抵的hp點數 判斷是否要退回購物金 if (deduct_happygo > 0) { //插入hg_deduct_refund arrList.Add(hg_batch_deduct_refund(hgBatch)); } if (deductbonus > 0) { Deduct_Refund(om, deductbonus, 0, 0, omQuery); } if (deductcash > 0) { Deduct_Refund(om, 0, deductcash, 0, omQuery); } #endregion DataTable _dt = GetTotalCount(om.Order_Id, 1); if (Convert.ToInt32(_dt.Rows[0][0]) == 0) { if (om.Priority == 1) { arrList.Add(UpdatePriority(om.Order_Id)); arrList.Add(UpdateFirstTime(om.user_id)); } } DataTable _dt2 = GetTotalCount(om.Order_Id, 2); #region 更改推薦 if (Convert.ToInt32(_dt2.Rows[0][0]) == 0) { List<UserRecommend> usRecommandLi = _userRecommendDao.QueryByOrderId(om.Order_Id); string idStr = string.Empty; if (usRecommandLi.Count != 0) { foreach (var record in usRecommandLi) { idStr += "," + record.id; } idStr= idStr.TrimStart(','); arrList.Add(_userRecommendDao.UpdateIsCommend(idStr)); } } #endregion if (_mySqlDao.ExcuteSqlsThrowException(arrList)) { return true; } else { return false; } } } catch (Exception ex) { throw new Exception("OrderReturnStatusDao-->CouldReturnMoney-->" + ex.Message, ex); } return true; }
public HttpResponseBase CancelReturnPurchaes() { string json = string.Empty; try { OrderReturnMasterQuery query = new OrderReturnMasterQuery(); if (!string.IsNullOrEmpty(Request.Params["order_id"])) { query.order_id = Convert.ToUInt32(Request.Params["order_id"]); } if (!string.IsNullOrEmpty(Request.Params["return_id"])) { query.return_id = Convert.ToUInt32(Request.Params["return_id"]); } if (!string.IsNullOrEmpty(Request.Params["return_status"])) { query.return_status = Convert.ToUInt32(Request.Params["return_status"]); } query.return_ipfrom = CommonFunction.GetIP4Address(Request.UserHostAddress.ToString()); _orderReturnMaster=new OrderReturnMasterMgr (mySqlConnectionString); json= _orderReturnMaster.CancelReturnPurchaes(query); } 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:'false'}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public string OrderReturn(OrderReturnMasterQuery query) { string josn = ""; List<OrderDetailQuery> orm = new List<OrderDetailQuery>(); List<OrderDetail> od = new List<OrderDetail>(); Serial s = new Serial();//流水號 Serial s1 = new Serial();//流水號 OrderReturnMaster m = new OrderReturnMaster(); StringBuilder sb = new StringBuilder(); ArrayList arrList = new ArrayList(); string r_id=""; uint slave=0; try { orm = _orderReturnMaster.GetOrderreturn(query); if (orm.Count == 0) {//1.判斷detail_id選中的個數,沒有則退出; 查詢該訂單詳細數據,取出需要的字段; return josn = "{success:true,msg:2}";// } uint a = 1; foreach (var item in orm) {//同一出貨商的商品放在同一陣列中,成立獨立的退貨單 if (slave != item.Slave_Id) { // (1)區分出貨商order_slave.slave_id相同的添加到同一個退貨單中. s =_serial.GetSerialById(45);//獲取退貨流水號 s.Serial_Value=s.Serial_Value+ a; m.return_id = uint.Parse(s.Serial_Value.ToString()); r_id += m.return_id.ToString() + ","; m.order_id = item.Order_Id; m.vendor_id = item.Vendor_Id; m.return_status = 0; m.return_note = query.return_note; m.return_ipfrom = query.return_ipfrom; //新增退貨單信息 arrList.Add(_orderReturnMaster.InsertOrderReturnMaster(m)); arrList.Add(_serial.Update(45));//流水號+1 slave = item.Slave_Id; //修改訂單的付款狀態 arrList.Add(_orderReturnMaster.UpdOrderMaster(item.Order_Id, "5")); //新增訂單狀態變更記錄 s1 = _serial.GetSerialById(29);//獲取訂單主檔狀態流水號 s1.Serial_Value = s1.Serial_Value + a; arrList.Add(_orderReturnMaster.InsertOrderMasterStatus(s1.Serial_Value, item.Order_Id, "91", "miaoshu")); arrList.Add(_serial.Update(29));//流水號+1 a++; } //變更相關訂單細項商品狀態,并新增退貨單細項.判斷是否是組合商品并修改商品狀態. arrList.Add(_orderReturnMaster.InsertOrderReturnDetail(s.Serial_Value.ToString(), item.Detail_Id.ToString())); if (item.item_mode == 1) {//變更組合商品內所有商品狀態,獲取時候是否獲取到整個組合商品 od = _orderReturnMaster.Getdetail(item.Slave_Id.ToString(), item.Parent_Id.ToString()); foreach (var item1 in od) { arrList.Add(_orderReturnMaster.UpdOrderDetail(item1.Detail_Id.ToString())); } } else {//不是組合商品就只修改該商品的狀態 arrList.Add(_orderReturnMaster.UpdOrderDetail(item.Detail_Id.ToString())); } } //10000以上代表拋轉過資料,需重拋轉 if (_orderReturnMaster.GetExportFlag(m.order_id.ToString())>0) { arrList.Add(_orderReturnMaster.UpdExportFlag(m.order_id.ToString())); } r_id = r_id.Substring(0, r_id.Length - 1); //執行sql語句 if ( _mySqlDao.ExcuteSqlsThrowException(arrList)) { josn = "{success:true,msg:0,return_id:'"+r_id+"'}"; } else { josn = "{success:true,msg:1}"; } return josn; } catch (Exception ex) { throw new Exception("OrderReturnMasterMgr.OrderReturn-->" + ex.Message, ex); } }