public int GetArrivalRowNo(Barcode_Model model) { string strSql = string.Format(@"select a.ivouchrowno from pu_arrbody a join pu_ArrHead b on a.id = b.id join copypolist c on a.iposid = c.id where c.cordercode = '{0}' and c.ivouchrowno = '{1}' and b.ccode = '{2}'", model.VOUCHERNO, model.ROWNO, model.ArrivalCode); return(OperationSql.ExecuteScalarForERP(CommandType.Text, strSql, null).ToInt32()); }
public bool GetOldSaleBillVouch(SaleBillDetails_Model detail, out List <SaleBillDetails_Model> list, out string strErrMsg) { try { string strSql = @"select * from T_temptrans where ssbvcode = '" + detail.ssbvcode + "' and ssbvrowno = '" + detail.ssbvrowno + "'"; list = new List <SaleBillDetails_Model>(); using (SqlDataReader dr = OperationSql.ExecuteReader(System.Data.CommandType.Text, strSql)) { while (dr.Read()) { SaleBillDetails_Model SM = new SaleBillDetails_Model(); 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.ssoqty = dr["ssoqty"].ToDecimal(); SM.ssbvqty = dr["ssbvqty"].ToDecimal(); SM.ssocode = dr["ssocode"].ToDBString(); SM.ssbvcode = dr["ssbvcode"].ToDBString(); SM.creater = dr["creater"].ToString(); SM.createdate = dr["createdate"].ToString(); SM.verifydate = dr["verifydate"].ToString(); SM.qty = dr["qty"].ToDecimal(); SM.dsocode = dr["dsocode"].ToDBString(); SM.dsorowno = dr["dsorowno"].ToDBString(); SM.dsoqty = dr["dsoqty"].ToDecimal(); SM.RealQty = dr["RealQty"].ToDecimal(); //获取autoid SM.autoid = OperationSql.ExecuteScalarForERP(System.Data.CommandType.Text, @"Select SaleBillVouchZW.autoid 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 = '" + SM.ssbvcode + "' and SaleBillVouchZW.cinvcode ='" + SM.cinvcode + "'").ToString(); list.Add(SM); } } strErrMsg = ""; return(true); } catch (Exception ex) { strErrMsg = ex.Message; list = null; return(false); } }
public bool QueryTempTrans(string cinvcode, string cinvstd, string ssocode, string ssbvcode, string dsocode, string dsbvcode, out List <SaleBillDetails_Model> list, out string strErrMsg) { try { //先判断查询条件中是否有被借销售发票号 string strSql; if (dsbvcode != null && dsocode == null) { strSql = @"Select distinct SO_SODetails.cSOCode 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 = '" + dsbvcode + "'"; dsocode = OperationSql.ExecuteScalarForERP(System.Data.CommandType.Text, strSql).ToDBString(); } strSql = @"select * from T_temptrans where (1=1) "; if (cinvcode != null) { strSql += " and cinvcode = '" + cinvcode + "' "; } if (cinvstd != null) { strSql += " and cinvstd like '%" + cinvstd + "%' "; } if (ssocode != null) { strSql += " and ssocode = '" + ssocode + "' "; } if (ssbvcode != null) { strSql += " and ssbvcode = '" + ssbvcode + "' "; } if (dsocode != null) { strSql += " and dsocode = '" + dsocode + "' "; } list = new List <SaleBillDetails_Model>(); using (SqlDataReader dr = OperationSql.ExecuteReader(System.Data.CommandType.Text, strSql)) { while (dr.Read()) { SaleBillDetails_Model SM = new SaleBillDetails_Model(); 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.ssoqty = dr["ssoqty"].ToDecimal(); SM.ssbvqty = dr["ssbvqty"].ToDecimal(); SM.ssocode = dr["ssocode"].ToDBString(); SM.ssbvcode = dr["ssbvcode"].ToDBString(); SM.creater = dr["creater"].ToString(); SM.createdate = dr["createdate"].ToString(); SM.verifydate = dr["verifydate"].ToString(); SM.qty = dr["qty"].ToDecimal(); SM.dsocode = dr["dsocode"].ToDBString(); SM.dsorowno = dr["dsorowno"].ToDBString(); SM.dsoqty = dr["dsoqty"].ToDecimal(); SM.RealQty = dr["RealQty"].ToDecimal(); list.Add(SM); } } strErrMsg = ""; return(true); } catch (Exception ex) { list = null; strErrMsg = ex.Message; return(false); } }