Exemple #1
0
 public static int GetArrivalInfo(string connectionString, DateTime dtBegin, DateTime dtEnd, out List<ArrivalInfo> ailist, out string errMsg)
 {
     ailist = null;
     errMsg = "";
     try
     {
         string SQL = "select distinct ccode,ddate,c.cdepname,cmaker,b.cvenname"
                             + " from pu_arrivalvouch a "
                             + " left join vendor b on b.cvencode=a.cvencode"
                             + " left join department c on c.cdepcode=a.cdepcode"
                             + " left join pu_arrivalvouchs d on a.id=d.id"
                             + " left join inventory e on e.cinvcode=d.cinvcode"
                             + " where ddate BETWEEN '" + dtBegin.ToString("yyyy/MM/dd") + "' AND '" + dtEnd.ToString("yyyy/MM/dd") + "'"
                             + " and isnull(d.bgsp,0)=0 and isnull(iquantity,0)>0 and abs(isnull(iQuantity,0)-isnull(fRefuseQuantity,0))>abs(isnull(fValidInQuan,0))";
         DataSet Ds_Arv = new DataSet();
         int r = OperationSql.GetDataset(SQL, connectionString, out Ds_Arv, out errMsg);
         if (r != 0)
         {
             return -2;
         }
         else
         {
             if (Ds_Arv.Tables[0].Rows.Count == 0)
             {
                 errMsg = "没有查询到日期内的到货单";
                 return -2;
             }
             else
             {
                 ailist = new List<ArrivalInfo>();
                 for (int i = 0; i < Ds_Arv.Tables[0].Rows.Count; i++)
                 {
                     ArrivalInfo ai = new ArrivalInfo();
                     ai.ArrivalCode = Ds_Arv.Tables[0].Rows[i][0].ToString();
                     ai.ArrivalDate = (DateTime)Ds_Arv.Tables[0].Rows[i][1];
                     ai.Depname = Ds_Arv.Tables[0].Rows[i][2].ToString();
                     ai.Maker = Ds_Arv.Tables[0].Rows[i][3].ToString();
                     ai.Venname = Ds_Arv.Tables[0].Rows[i][4].ToString();
                     ailist.Add(ai);
                 }
                 return 0;
             }
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         return -1;
     }
 }
Exemple #2
0
 public static int GetArrivalInfo(string connectionString, string arrivalCode, out ArrivalInfo ai, out string errMsg)
 {
     ai = null;
     errMsg = "";
     try
     {
         string SQL = "select distinct ccode,ddate,c.cdepname,cmaker,b.cvenname"
                             + " from pu_arrivalvouch a "
                             + " left join vendor b on b.cvencode=a.cvencode"
                             + " left join department c on c.cdepcode=a.cdepcode"
                             + " left join pu_arrivalvouchs d on a.id=d.id"
                             + " left join inventory e on e.cinvcode=d.cinvcode"
                             + " where ccode = '" + arrivalCode + "'"
                             + " and isnull(d.bgsp,0)=0 and isnull(iquantity,0)>0 and abs(isnull(iQuantity,0)-isnull(fRefuseQuantity,0))>abs(isnull(fValidInQuan,0))";
         DataSet Ds_Arv = new DataSet();
         int i = OperationSql.GetDataset(SQL, connectionString, out Ds_Arv, out errMsg);
         if (i != 0)
         {
             return -2;
         }
         else
         {
             if (Ds_Arv.Tables[0].Rows.Count == 0)
             {
                 errMsg = "到货单号错误";
                 return -2;
             }
             else
             {
                 ai = new ArrivalInfo();
                 ai.ArrivalCode = Ds_Arv.Tables[0].Rows[0][0].ToString();
                 ai.ArrivalDate = (DateTime)Ds_Arv.Tables[0].Rows[0][1];
                 ai.Depname = Ds_Arv.Tables[0].Rows[0][2].ToString();
                 ai.Maker = Ds_Arv.Tables[0].Rows[0][3].ToString();
                 ai.Venname = Ds_Arv.Tables[0].Rows[0][4].ToString();
                 return 0;
             }
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         return -1;
     }
 }