public bool GetSaleBillVouchByCode(string code, out SaleBillVouch_Model model, out string strErrMsg) { try { string strSql = @"Select SaleBillVouchZW.cSOCode as ssocode,csbvcode as ssbvcode, SaleBillVouchZW.sbvid, SaleBillVouchZW.autoid,SaleBillVouchZW.SBVID,SO_SODetails.iquantity as ssoqty,SaleBillVouchZW.iquantity as ssbvqty,cWhCode,cWhName,SaleBillVouchZW.cInvCode,SaleBillVouchZW.cinvname,cinvstd,SaleBillVouchZW.irowno as ssbvrowno,SO_SODetails.iRowNo as ssorowno,cbdefine1 From SaleBillVouchZW left join (select cbdefine1 as cbdefine1,cbdefine5 as cbdefine5,cbdefine6 as cbdefine6,autoid as keyextend_b_autoid_salebillvouchs_extradefine_autoid from salebillvouchs_extradefine) extend_b_autoid_salebillvouchs_extradefine on keyextend_b_autoid_salebillvouchs_extradefine_autoid=salebillvouchzw.autoid join SaleBillVouchZT on SaleBillVouchZT.sbvid=SaleBillVouchZW.sbvid left join SO_SODetails on (SaleBillVouchZW.cSOCode = SO_SODetails.cSOCode and SaleBillVouchZW.iorderrowno = SO_SODetails.iRowNo) where cSource=N'销售' and csbvcode='" + code + "'"; model = new SaleBillVouch_Model(); model.csbvcode = code; model.details = new List <SaleBillDetails_Model>(); using (SqlDataReader dr = OperationSql.ExecuteReaderForERP(System.Data.CommandType.Text, strSql)) { while (dr.Read()) { model.sbvid = dr["SBVID"].ToDBString(); SaleBillDetails_Model SM = new SaleBillDetails_Model(); SM.autoid = dr["autoid"].ToDBString(); SM.cinvcode = dr["cinvcode"].ToDBString(); SM.cinvname = dr["cinvname"].ToDBString(); SM.cinvstd = dr["cinvstd"].ToDBString(); SM.ssorowno = dr["ssorowno"].ToDBString(); SM.ssbvrowno = dr["ssbvrowno"].ToDBString(); SM.cWhCode = dr["cWhCode"].ToDBString(); SM.cWhName = dr["cWhName"].ToDBString(); SM.ssoqty = dr["ssoqty"].ToDecimal(); SM.ssbvqty = dr["ssbvqty"].ToDecimal(); SM.ssocode = dr["ssocode"].ToDBString(); SM.ssbvcode = dr["ssbvcode"].ToDBString(); model.details.Add(SM); } } strErrMsg = ""; return(true); } catch (Exception ex) { strErrMsg = ex.Message; model = null; return(false); } }
public bool GetSaleBillVouchByCode(string code, out SaleBillVouch_Model model, out string strErrMsg) { return(_db.GetSaleBillVouchByCode(code, out model, out strErrMsg)); }