/// <summary> /// 得到订单基本信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public DdjbxxModel GetBydsfddxx(string ddbh) { using (IDbConnection conn = new DapperConnection().DbConnection) { DdjbxxModel model = conn.Query <DdjbxxModel>("select * From dd_jbxx_new where ddbh=@ddbh ", new { ddbh = ddbh }).FirstOrDefault(); model.zhxmlist = GetOrderZhxm(ddbh); return(model); } }
/// <summary> /// 企业团检订单详情 /// </summary> /// <param name="ddbh"></param> /// <returns></returns> public DdjbxxModel GetBydsfddxxQy(string ddbh) { DdjbxxModel model = new DdjbxxModel(); using (IDbConnection conn = new DapperConnection().DbConnection) { model = conn.Query <DdjbxxModel>("select a.*,c.jgmc from dd_jbxx_new a join xt_jgb c on a.yybh=c.yybh where ddbh=@ddbh ", new { ddbh = ddbh }).FirstOrDefault(); } model.zhxmlist = GetOrderZhxm(ddbh); return(model); }
/// <summary> /// 退款单详情 /// </summary> /// <param name="ddbh"></param> /// <returns></returns> public DdjbxxModel OrderQdTzDetail(string ddbh) { StringBuilder sd = new StringBuilder(); using (IDbConnection conn = new DapperConnection().DbConnection) { string sql = "select a.*,b.jgmc,d.dsfbz as qdmc,c.tkje,c.tkzt,c.tkyy,c.shyy as tkjjyy from dd_jbxx a join xt_jgb b on a.yybh=b.yybh join qd_tksqjlb c on a.ddbh=c.ddbh join xt_dsfbz d on a.dsfbzid=d.id where a.ddbh=@ddbh"; DdjbxxModel li = conn.Query <DdjbxxModel>(sql, new { ddbh = ddbh }).FirstOrDefault(); if (li != null) { li.zhxmlist = new DdyymxbService().GetOrderZhxm(ddbh); } return(li); } }
/// <summary> /// 结算订单详情 /// </summary> /// <param name="ddbh"></param> /// <returns></returns> public DdjbxxModel JsddDetail(string ddbh) { StringBuilder sd = new StringBuilder(); using (IDbConnection conn = new DapperConnection().DbConnection) { string sql = "select a.*,b.jgmc,d.dsfbz as qdmc,c.tkje,c.tkzt,c.tkyy,e.jstz,e.tzyy,e.sjjsj,f.jjyy from dd_jbxx a left join xt_jgb b on a.yybh=b.yybh left join qd_tksqjlb c on a.ddbh=c.ddbh " + "left join xt_dsfbz d on a.dsfbzid=d.id left join qd_jsjbxxmx e on a.ddbh=e.ddbh left join qd_jsjbxx f on e.jbxxid=f.id where a.ddbh=@ddbh"; DdjbxxModel li = conn.Query <DdjbxxModel>(sql, new { ddbh = ddbh }).FirstOrDefault(); if (li != null) { li.zhxmlist = new DdyymxbService().GetOrderZhxm(ddbh); } return(li); } }
public void ConfirmOrder(DdjbxxModel ddModel, List <DdZhxmModel> zhxmList, QyygxxModel ygModel) { StringBuilder strSql = new StringBuilder(); using (IDbConnection conn = new DapperConnection().DbConnection) { IDbTransaction transaction = conn.BeginTransaction(); try { if (ddModel.jsbz == 0)//自已才更新 { strSql.AppendFormat("UPDATE dbo.qy_ygxx SET sfyy=@sfyy WHERE id=@id"); conn.Execute(strSql.ToString(), new { sfyy = ygModel.sfyy, id = ygModel.id }, transaction); } strSql.Clear(); if (string.IsNullOrEmpty(ddModel.csrq)) { ddModel.csrq = DateTime.Now.ToString("yyyy-MM-dd"); } strSql.Append("insert into dd_jbxx_new("); strSql.Append("trade_no,zffs,ddbh,dsfdd,dsfbzid,ddzt,tcid,tcmc,dwbh,tcjg,jxbjg,ddze,intime,sfout,outtime,dh,xm,xb,hz,zjlx,zjhm,yykssj,yyjssj,sfdj,djtime,sfbg,bgtime,djlsh,sfjx,jxlist,sfjs,csrq,nl,remark,yybh,ddly,dwmc,jsbz,ygzh)"); strSql.Append(" values ("); strSql.Append("'',@zffs,@ddbh,@dsfdd,@dsfbzid,@ddzt,@tcid,@tcmc,@dwbh,@tcjg,@jxbjg,@ddze,@intime,@sfout,@outtime,@dh,@xm,@xb,@hz,@zjlx,@zjhm,@yykssj,@yyjssj,@sfdj,@djtime,@sfbg,@bgtime,@djlsh,@sfjx,@jxlist,@sfjs,@csrq,@nl,@remark,@yybh,@ddly,@dwmc,@jsbz,@ygzh)"); conn.Execute(strSql.ToString(), ddModel, transaction); strSql.Clear(); strSql.Append("insert into dd_zhxm("); strSql.Append("ddbh,zhxmbh,zhxmmc,jg,sfjx,sfdj)"); strSql.Append(" values ("); strSql.Append("@ddbh,@zhxmbh,@zhxmmc,@jg,@sfjx,@sfdj)"); conn.Execute(strSql.ToString(), zhxmList, transaction); transaction.Commit(); } catch (Exception ex) { LogApiHelper.AddLog(ex.Message); transaction.Rollback(); throw; } } }