Exemplo n.º 1
0
 public static int GetInvcodeInfo(string connectionString, string strInvCode, out CodebarLabel cl, out string errMsg)
 {
     cl = null;
     errMsg = "";
     try
     {
         string SQL = "select a.cInvCode,a.cInvName,a.cInvStd,a.cInvDefine1,b.cComUnitName, a.cInvDefine11, a.cInvDefine2, a.cInvDefine13, a.iInvSCost, a.fRetailPrice, a.cAddress "
                     + " from inventory a left join ComputationUnit b"
                     + " on a.cComUnitCode = b.cComUnitCode"
                     + " where cInvCode='" + strInvCode + "'";
         DataSet Ds_Inv = new DataSet();
         int i = OperationSql.GetDataset(SQL, connectionString, out Ds_Inv, out errMsg);
         if (i != 0)
         {
             return -2;
         }
         else
         {
             if (Ds_Inv.Tables[0].Rows.Count == 0)
             {
                 errMsg = "存货编码错误";
                 return -2;
             }
             else
             {
                 cl = new CodebarLabel();
                 cl.CInvCode = Ds_Inv.Tables[0].Rows[0][0].ToString();
                 cl.CInvName = Ds_Inv.Tables[0].Rows[0][1].ToString();
                 cl.Cstandard = Ds_Inv.Tables[0].Rows[0][2].ToString();
                 //cl.Ccolor = Ds_Inv.Tables[0].Rows[0][3].ToString();
                 cl.Comunitname = Ds_Inv.Tables[0].Rows[0][4].ToString();
                 //cl.Qty = Ds_Inv.Tables[0].Rows[0][5].Equals(DBNull.Value) ? 0 : Convert.ToInt32(Ds_Inv.Tables[0].Rows[0][5]);
                 //cl.Cartonsize = Ds_Inv.Tables[0].Rows[0][6].Equals(DBNull.Value) ? string.Empty : Ds_Inv.Tables[0].Rows[0][6].ToString();
                 cl.Weight = Ds_Inv.Tables[0].Rows[0][7].Equals(DBNull.Value) ? 0.0 : Convert.ToDouble(Ds_Inv.Tables[0].Rows[0][7]);
                 cl.IInvSCost = Ds_Inv.Tables[0].Rows[0][8].Equals(DBNull.Value) ? 0.0 : Convert.ToDouble(Ds_Inv.Tables[0].Rows[0][8]);
                 cl.IInvSaleCost = Ds_Inv.Tables[0].Rows[0][9].Equals(DBNull.Value) ? 0.0 : Convert.ToDouble(Ds_Inv.Tables[0].Rows[0][9]);
                 cl.CAddress = Ds_Inv.Tables[0].Rows[0][10].Equals(DBNull.Value) ? string.Empty : Ds_Inv.Tables[0].Rows[0][10].ToString();
                 return 0;
             }
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         return -1;
     }
 }
Exemplo n.º 2
0
 public static int GetArvInv(string connectionString, string arrivalCode, out List<CodebarLabel> cllist, out string errMsg)
 {
     cllist = null;
     errMsg = "";
     try
     {
         string SQL = "select a.cInvCode,a.cInvName,a.cInvStd,a.cInvDefine1,b.iQuantity, d.cComUnitName, a.cInvDefine11, a.cInvDefine2, a.cInvDefine13, a.iInvSCost, a.fRetailPrice, a.cAddress "
                     + " from inventory a"
                     + " left join pu_arrivalvouchs b on a.cInvCode = b.cInvCode"
                     + " left join pu_arrivalvouch c on b.id = c.id"
                     + " left join ComputationUnit d on a.cComUnitCode = d.cComUnitCode"
                     + " where c.ccode = '" + arrivalCode + "'";
         DataSet Ds_Inv = new DataSet();
         int r = OperationSql.GetDataset(SQL, connectionString, out Ds_Inv, out errMsg);
         if (r != 0)
         {
             return -2;
         }
         else
         {
             if (Ds_Inv.Tables[0].Rows.Count == 0)
             {
                 errMsg = "数据错误";
                 return -2;
             }
             else
             {
                 cllist = new List<CodebarLabel>();
                 for(int i = 0;i<Ds_Inv.Tables[0].Rows.Count; i++)
                 {
                     CodebarLabel cl = new CodebarLabel();
                     cl.CInvCode = Ds_Inv.Tables[0].Rows[i][0].ToString();
                     cl.CInvName = Ds_Inv.Tables[0].Rows[i][1].ToString();
                     cl.Cstandard = Ds_Inv.Tables[0].Rows[i][2].ToString();
                     //cl.Ccolor = Ds_Inv.Tables[0].Rows[i][3].ToString();
                     cl.Cquantity = Convert.ToInt32(Ds_Inv.Tables[0].Rows[i][4]);
                     cl.Comunitname = Ds_Inv.Tables[0].Rows[i][5].ToString();
                     //cl.Qty = Ds_Inv.Tables[0].Rows[i][6].Equals(DBNull.Value) ? 0 : Convert.ToInt32(Ds_Inv.Tables[0].Rows[i][6]);
                     //cl.Cartonsize = Ds_Inv.Tables[0].Rows[i][7].Equals(DBNull.Value) ? string.Empty : Ds_Inv.Tables[0].Rows[i][7].ToString();
                     cl.Weight = Ds_Inv.Tables[0].Rows[i][8].Equals(DBNull.Value) ? 0.0 : Convert.ToDouble(Ds_Inv.Tables[0].Rows[i][8]);
                     cl.IInvSCost = Ds_Inv.Tables[0].Rows[i][9].Equals(DBNull.Value) ? 0.0 : Convert.ToDouble(Ds_Inv.Tables[0].Rows[i][9]);
                     cl.IInvSaleCost = Ds_Inv.Tables[0].Rows[i][10].Equals(DBNull.Value) ? 0.0 : Convert.ToDouble(Ds_Inv.Tables[0].Rows[i][10]);
                     cl.CAddress = Ds_Inv.Tables[0].Rows[i][11].Equals(DBNull.Value) ? string.Empty : Ds_Inv.Tables[0].Rows[i][11].ToString();
                     cllist.Add(cl);
                 }
                 return 0;
             }
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         return -1;
     }
 }
Exemplo n.º 3
0
        public static int GetClsInv(string connectionString, string cInvCode, string cInvName, string cBarCode, out List<CodebarLabel> clist, out string errMsg)
        {
            clist = new List<CodebarLabel>();
            errMsg = string.Empty;
            try
            {
                string SQL = @"select a.cInvCode,a.cInvName,a.cInvStd,a.cInvDefine1,b.cComUnitName, a.cInvDefine11, a.cInvDefine2, a.cInvDefine13, a.iInvSCost, a.fRetailPrice, a.cAddress,a.cBarCode,a.cMassUnit,a.iMassDate
                            from inventory a left join ComputationUnit b
                            on a.cComUnitCode = b.cComUnitCode where 1=1 ";
                //判断存货编码是否为空
                if (!string.IsNullOrEmpty(cInvCode))
                {
                    SQL += string.Format(" and a.cInvCode like '{0}%' ",cInvCode);
                }
                if (!string.IsNullOrEmpty(cInvName))
                {
                    SQL += string.Format(" and a.cInvName like '%{0}%' ", cInvName);
                }
                if (!string.IsNullOrEmpty(cBarCode))
                {
                    SQL += string.Format(" and a.cBarCode like '{0}%' ", cBarCode);
                }

                DataSet ds = new DataSet ();
                int reuslt = OperationSql.GetDataset(SQL, connectionString,out ds, out errMsg);
                if (reuslt != 0)
                {
                    return -2;
                }
                else
                {
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        errMsg = "数据错误";
                        return -2;
                    }
                    else
                    {
                        clist = new List<CodebarLabel>();
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            CodebarLabel cl = new CodebarLabel();
                            cl.CInvCode = ds.Tables[0].Rows[i][0].ToString();
                            cl.CInvName = ds.Tables[0].Rows[i][1].ToString();
                            cl.Cstandard = ds.Tables[0].Rows[i][2].ToString();
                            //cl.Ccolor = ds.Tables[0].Rows[i][3].ToString();
                            cl.Comunitname = ds.Tables[0].Rows[i][4].ToString();
                            //cl.Qty = ds.Tables[0].Rows[i][5].Equals(DBNull.Value) ? 0 : Convert.ToInt32(ds.Tables[0].Rows[i][5]);
                            //cl.Cartonsize = ds.Tables[0].Rows[i][6].Equals(DBNull.Value) ? string.Empty : ds.Tables[0].Rows[i][6].ToString();
                            cl.Weight = ds.Tables[0].Rows[i][7].Equals(DBNull.Value) ? 0.0 : Convert.ToDouble(ds.Tables[0].Rows[i][7]);
                            cl.IInvSCost = ds.Tables[0].Rows[i][8].Equals(DBNull.Value) ? 0.0 : Convert.ToDouble(ds.Tables[0].Rows[i][8]);
                            cl.IInvSaleCost = ds.Tables[0].Rows[i][9].Equals(DBNull.Value) ? 0.0 : Convert.ToDouble(ds.Tables[0].Rows[i][9]);
                            cl.CAddress = ds.Tables[0].Rows[i][10].Equals(DBNull.Value) ? string.Empty : ds.Tables[0].Rows[i][10].ToString();
                            cl.CBarCode = ds.Tables[0].Rows[i][11].ToString();
                            cl.CMassUnit = ds.Tables[0].Rows[i][12] == DBNull.Value ? 2 : Convert.ToInt32(ds.Tables[0].Rows[i][12]);//保质期单位
                            cl.IMassDate = ds.Tables[0].Rows[i][13] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[i][13]);//保质期天数
                            cl.Cquantity = 1;
                            clist.Add(cl);
                        }
                        return 0;
                    }
                }
            }
            catch (Exception ex)
            {
                errMsg = ex.Message;
                return -1;
            }
        }
Exemplo n.º 4
0
 public static int GetClsInv(string connectionString, string classCode, out List<CodebarLabel> cllist, out string errMsg)
 {
     cllist = null;
     errMsg = "";
     try
     {
         string SQL = "select a.cInvCode,a.cInvName,a.cInvStd,a.cInvDefine1,b.cComUnitName, a.cInvDefine11, a.cInvDefine2, a.cInvDefine13, a.iInvSCost, a.fRetailPrice, a.cAddress,a.cBarCode,a.cMassUnit,a.iMassDate "
                     + " from inventory a left join ComputationUnit b"
                     + " on a.cComUnitCode = b.cComUnitCode"
                     + " where a.cInvCCode = '" + classCode + "'";
         DataSet Ds_Inv = new DataSet();
         int r = OperationSql.GetDataset(SQL, connectionString, out Ds_Inv, out errMsg);
         if (r != 0)
         {
             return -2;
         }
         else
         {
             if (Ds_Inv.Tables[0].Rows.Count == 0)
             {
                 errMsg = "数据错误";
                 return -2;
             }
             else
             {
                 cllist = new List<CodebarLabel>();
                 for (int i = 0; i < Ds_Inv.Tables[0].Rows.Count; i++)
                 {
                     CodebarLabel cl = new CodebarLabel();
                     cl.CInvCode = Ds_Inv.Tables[0].Rows[i][0].ToString();
                     cl.CInvName = Ds_Inv.Tables[0].Rows[i][1].ToString();
                     cl.Cstandard = Ds_Inv.Tables[0].Rows[i][2].ToString();
                     //cl.Ccolor = Ds_Inv.Tables[0].Rows[i][3].ToString();
                     cl.Comunitname = Ds_Inv.Tables[0].Rows[i][4].ToString();
                     //cl.Qty = Ds_Inv.Tables[0].Rows[i][5].Equals(DBNull.Value) ? 0 : Convert.ToInt32(Ds_Inv.Tables[0].Rows[i][5]);
                     //cl.Cartonsize = Ds_Inv.Tables[0].Rows[i][6].Equals(DBNull.Value) ? string.Empty : Ds_Inv.Tables[0].Rows[i][6].ToString();
                     cl.Weight = Ds_Inv.Tables[0].Rows[i][7].Equals(DBNull.Value) ? 0.0 : Convert.ToDouble(Ds_Inv.Tables[0].Rows[i][7]);
                     cl.IInvSCost = Ds_Inv.Tables[0].Rows[i][8].Equals(DBNull.Value) ? 0.0 : Convert.ToDouble(Ds_Inv.Tables[0].Rows[i][8]);
                     cl.IInvSaleCost = Ds_Inv.Tables[0].Rows[i][9].Equals(DBNull.Value) ? 0.0 : Convert.ToDouble(Ds_Inv.Tables[0].Rows[i][9]);
                     cl.CAddress = Ds_Inv.Tables[0].Rows[i][10].Equals(DBNull.Value) ? string.Empty : Ds_Inv.Tables[0].Rows[i][10].ToString();
                     cl.CBarCode = Ds_Inv.Tables[0].Rows[i][11].ToString();//条码
                     cl.CMassUnit = Ds_Inv.Tables[0].Rows[i][12] == DBNull.Value ? 2 : Convert.ToInt32(Ds_Inv.Tables[0].Rows[i][12]);//保质期单位
                     cl.IMassDate = Ds_Inv.Tables[0].Rows[i][13] == DBNull.Value ? 0 : Convert.ToInt32(Ds_Inv.Tables[0].Rows[i][13]);//保质期天数
                     cl.Cquantity = 1;
                     cllist.Add(cl);
                 }
                 return 0;
             }
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         return -1;
     }
 }