コード例 #1
0
ファイル: ProductExDaoEx.cs プロジェクト: icprog/ZhengDong
        public bool UpdateFoodOutInfo(FishEntity.FoodOutDetailEntityVO model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(" update t_productex set");
            strSql.Append(" salermb=@salermb,");
            strSql.Append(" selfrmb=@selfrmb");
            strSql.Append(" where id=@id");

            MySqlParameter[] parameters =
            {
                new MySqlParameter("@salermb", MySqlDbType.Decimal, 6),
                new MySqlParameter("@selfrmb", MySqlDbType.Decimal, 8),
                new MySqlParameter("@id",      MySqlDbType.Int32, 6)
            };

            parameters[0].Value = model.salermb;
            parameters[1].Value = model.selfrmb;
            parameters[2].Value = model.productid;

            int rows = MySqlHelper.ExecuteSql(strSql.ToString(), parameters);

            return(rows > 0 ? true : false);
        }
コード例 #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public FishEntity.FoodOutDetailEntityVO DataRowToVo(DataRow row)
        {
            FishEntity.FoodOutDetailEntityVO model = new FishEntity.FoodOutDetailEntityVO();
            if (row != null)
            {
                if (row["no"] != null && row["no"].ToString() != "")
                {
                    model.no = int.Parse(row["no"].ToString());
                }

                if (row["solutionid"] != null && row["solutionid"].ToString() != "")
                {
                    model.solutionid = int.Parse(row["solutionid"].ToString());
                }

                if (row["id"] != null && row["id"].ToString() != "")
                {
                    model.id = int.Parse(row["id"].ToString());
                }
                if (row["mid"] != null && row["mid"].ToString() != "")
                {
                    model.mid = int.Parse(row["mid"].ToString());
                }
                if (row["productid"] != null && row["productid"].ToString() != "")
                {
                    model.productid = int.Parse(row["productid"].ToString());
                }
                if (row["productcode"] != null)
                {
                    model.productcode = row["productcode"].ToString();
                }
                if (row["productname"] != null)
                {
                    model.productname = row["productname"].ToString();
                }

                if (row["tons"] != null && row["tons"].ToString() != "")
                {
                    model.tons = decimal.Parse(row["tons"].ToString());
                }
                if (row["package"] != null && row["package"].ToString() != "")
                {
                    model.package = int.Parse(row["package"].ToString());
                }

                if (row["state"] != null)
                {
                    model.state = row["state"].ToString();
                }
                if (row["nature"] != null)
                {
                    model.nature = row["nature"].ToString();
                }
                if (row["brand"] != null)
                {
                    model.brand = row["brand"].ToString();
                }
                if (row["remark"] != null)
                {
                    model.remark = row["remark"].ToString();
                }
                if (row["shipno"] != null)
                {
                    model.shipno = row["shipno"].ToString();
                }
                if (row["billofgoods"] != null)
                {
                    model.billofgoods = row["billofgoods"].ToString();
                }
                if (row["selfrmb"] != null && row["selfrmb"].ToString() != "")
                {
                    model.selfrmb = decimal.Parse(row["selfrmb"].ToString());
                }
                if (row["salermb"] != null && row["salermb"].ToString() != "")
                {
                    model.salermb = decimal.Parse(row["salermb"].ToString());
                }

                //if (row["weight"] != null && row["weight"].ToString() != "")
                //{
                //    model.weight = decimal.Parse(row["weight"].ToString());
                //}
                //if (row["quantity"] != null && row["quantity"].ToString() != "")
                //{
                //    model.quantity = int.Parse(row["quantity"].ToString());
                //}
                //if (row["remainweight"] != null && row["remainweight"].ToString() != "")
                //{
                //    model.remainweight = decimal.Parse(row["remainweight"].ToString());
                //}
                //if (row["remainquantity"] != null && row["remainquantity"].ToString() != "")
                //{
                //    model.remainquantity = int.Parse(row["remainquantity"].ToString());
                //}
                //if (row["homemadeweight"] != null && row["homemadeweight"].ToString() != "")
                //{
                //    model.homemadeweight = decimal.Parse(row["homemadeweight"].ToString());
                //}
                //if (row["homemadepackages"] != null && row["homemadepackages"].ToString() != "")
                //{
                //    model.homemadepackages = int.Parse(row["homemadepackages"].ToString());
                //}
                //if (row["homemadecost"] != null && row["homemadecost"].ToString() != "")
                //{
                //    model.homemadecost = decimal.Parse(row["homemadecost"].ToString());
                //}
                //if (row["homemadeunitprice"] != null && row["homemadeunitprice"].ToString() != "")
                //{
                //model.homemadeunitprice = decimal.Parse(row["homemadeunitprice"].ToString());
                //}

                //if (model.homemadeweight == 0) model.homemadeunitprice = 0;
                //else
                //{
                //    model.homemadeunitprice = model.homemadecost / model.homemadeweight;
                //}

                //if (row["price"] != null && row["price"].ToString() != "")
                //{
                //    model.price = decimal.Parse(row["price"].ToString());
                //}
                //if (row["sgs_protein"] != null && row["sgs_protein"].ToString() != "")
                //{
                //    model.sgs_protein = decimal.Parse(row["sgs_protein"].ToString());
                //}
                //if (row["sgs_tvn"] != null && row["sgs_tvn"].ToString() != "")
                //{
                //    model.sgs_tvn = int.Parse(row["sgs_tvn"].ToString());
                //}
                //if (row["sgs_graypart"] != null && row["sgs_graypart"].ToString() != "")
                //{
                //    model.sgs_graypart = decimal.Parse(row["sgs_graypart"].ToString());
                //}
                //if (row["sgs_sandsalt"] != null && row["sgs_sandsalt"].ToString() != "")
                //{
                //    model.sgs_sandsalt = decimal.Parse(row["sgs_sandsalt"].ToString());
                //}
                //if (row["sgs_amine"] != null && row["sgs_amine"].ToString() != "")
                //{
                //    model.sgs_amine = int.Parse(row["sgs_amine"].ToString());
                //}
                //if (row["sgs_ffa"] != null && row["sgs_ffa"].ToString() != "")
                //{
                //    model.sgs_ffa = decimal.Parse(row["sgs_ffa"].ToString());
                //}
                //if (row["sgs_fat"] != null && row["sgs_fat"].ToString() != "")
                //{
                //    model.sgs_fat = decimal.Parse(row["sgs_fat"].ToString());
                //}
                //if (row["sgs_water"] != null && row["sgs_water"].ToString() != "")
                //{
                //    model.sgs_water = decimal.Parse(row["sgs_water"].ToString());
                //}
                //if (row["sgs_sand"] != null && row["sgs_sand"].ToString() != "")
                //{
                //    model.sgs_sand = decimal.Parse(row["sgs_sand"].ToString());
                //}
                if (row["domestic_protein"] != null && row["domestic_protein"].ToString() != "")
                {
                    model.domestic_protein = decimal.Parse(row["domestic_protein"].ToString());
                }
                if (row["domestic_tvn"] != null && row["domestic_tvn"].ToString() != "")
                {
                    model.domestic_tvn = decimal.Parse(row["domestic_tvn"].ToString());
                }
                if (row["domestic_graypart"] != null && row["domestic_graypart"].ToString() != "")
                {
                    model.domestic_graypart = decimal.Parse(row["domestic_graypart"].ToString());
                }
                if (row["domestic_sandsalt"] != null && row["domestic_sandsalt"].ToString() != "")
                {
                    model.domestic_sandsalt = decimal.Parse(row["domestic_sandsalt"].ToString());
                }
                if (row["domestic_sour"] != null && row["domestic_sour"].ToString() != "")
                {
                    model.domestic_sour = decimal.Parse(row["domestic_sour"].ToString());
                }
                if (row["domestic_lysine"] != null && row["domestic_lysine"].ToString() != "")
                {
                    model.domestic_lysine = decimal.Parse(row["domestic_lysine"].ToString());
                }
                if (row["domestic_methionine"] != null && row["domestic_methionine"].ToString() != "")
                {
                    model.domestic_methionine = decimal.Parse(row["domestic_methionine"].ToString());
                }
                if (row["domestic_amine"] != null && row["domestic_amine"].ToString() != "")
                {
                    model.domestic_amine = decimal.Parse(row["domestic_amine"].ToString());
                }
                if (row["domestic_aminototal"] != null && row["domestic_aminototal"].ToString() != "")
                {
                    model.domestic_aminototal = decimal.Parse(row["domestic_aminototal"].ToString());
                }
                if (row["domestic_fat"] != null && row["domestic_fat"].ToString() != "")
                {
                    model.domestic_fat = decimal.Parse(row["domestic_fat"].ToString());
                }
            }
            return(model);
        }
コード例 #3
0
        public bool UpdateFoodOutInfo(FishEntity.FoodOutDetailEntityVO model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(" update t_product set ");
            strSql.Append("domestic_protein=@domestic_protein,");
            strSql.Append("domestic_tvn=@domestic_tvn,");
            strSql.Append("domestic_graypart=@domestic_graypart,");
            strSql.Append("domestic_sandsalt=@domestic_sandsalt,");
            strSql.Append("domestic_sour=@domestic_sour,");
            strSql.Append("domestic_lysine=@domestic_lysine,");
            strSql.Append("domestic_methionine=@domestic_methionine,");
            strSql.Append("domestic_amine=@domestic_amine,");
            strSql.Append("domestic_aminototal=@domestic_aminototal,");
            strSql.Append("domestic_fat=@domestic_fat,");

            strSql.Append("shipno=@shipno,");
            strSql.Append("billofgoods=@billofgoods,");
            strSql.Append("remark=@remark");

            strSql.Append(" where id=@id");

            MySqlParameter[] parameters =
            {
                new MySqlParameter("@domestic_protein",    MySqlDbType.Decimal,   6),
                new MySqlParameter("@domestic_tvn",        MySqlDbType.Decimal,   8),
                new MySqlParameter("@domestic_graypart",   MySqlDbType.Decimal,   6),
                new MySqlParameter("@domestic_sandsalt",   MySqlDbType.Decimal,   6),
                new MySqlParameter("@domestic_sour",       MySqlDbType.Decimal,   6),
                new MySqlParameter("@domestic_lysine",     MySqlDbType.Decimal,   6),
                new MySqlParameter("@domestic_methionine", MySqlDbType.Decimal,   6),
                new MySqlParameter("@domestic_amine",      MySqlDbType.Decimal,   6),
                new MySqlParameter("@domestic_aminototal", MySqlDbType.Decimal,   6),
                new MySqlParameter("@domestic_fat",        MySqlDbType.Decimal,   6),
                new MySqlParameter("@shipno",              MySqlDbType.VarChar,  45),
                new MySqlParameter("@billofgoods",         MySqlDbType.VarChar,  45),
                new MySqlParameter("@remark",              MySqlDbType.VarChar, 500),
                new MySqlParameter("@id",                  MySqlDbType.Int32, 11)
            };

            parameters[0].Value = model.domestic_protein;
            parameters[1].Value = model.domestic_tvn;
            parameters[2].Value = model.domestic_graypart;
            parameters[3].Value = model.domestic_sandsalt;
            parameters[4].Value = model.domestic_sour;
            parameters[5].Value = model.domestic_lysine;
            parameters[6].Value = model.domestic_methionine;
            parameters[7].Value = model.domestic_amine;
            parameters[8].Value = model.domestic_aminototal;
            parameters[9].Value = model.domestic_fat;

            parameters[10].Value = model.shipno;
            parameters[11].Value = model.billofgoods;
            parameters[12].Value = model.remark;

            parameters[13].Value = model.productid;

            int rows = MySqlHelper.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
        protected void Calc()
        {
            decimal tons       = 0;
            decimal tons_hj    = 0;
            int     packages   = 0;
            decimal graypart   = 0;
            decimal lysine     = 0;
            decimal methionine = 0;
            decimal protein    = 0;
            decimal sandsalt   = 0;
            decimal sour       = 0;
            decimal ffa        = 0;
            decimal tvn        = 0;
            decimal amine      = 0;
            decimal unitprice  = 0;
            decimal cost       = 0;
            decimal cost_hj    = 0;
            decimal salermb    = 0;
            decimal selfrmb    = 0;

            //foreach (FishEntity.FoodOutDetailEntityVO d in _details)
            //{
            //    decimal a = d.domestic_graypart.Value;
            //}
            IDictionary <int, FishEntity.FoodOutDetailEntityVO> groups = new Dictionary <int, FishEntity.FoodOutDetailEntityVO>();

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                object obj        = row.Cells["solutionid"].Value;
                int    solutionid = GetInt(obj);
                FishEntity.FoodOutDetailEntityVO finishM = null;
                if (groups.ContainsKey(solutionid))
                {
                    finishM = groups[solutionid];
                }
                else
                {
                    finishM = new FishEntity.FoodOutDetailEntityVO();
                    groups.Add(solutionid, finishM);
                }

                //int no = GetInt(row.Cells["no"].Value);
                //if (no == FinishNo) { continue; }

                tons          = GetDecimal(row.Cells["tons"].EditedFormattedValue);
                tons_hj      += tons;
                finishM.tons += tons;

                packages         = GetInt(row.Cells["package"].EditedFormattedValue);
                finishM.package += packages;

                decimal idx = 0;
                idx       = GetDecimal(row.Cells["domestic_graypart"].Value);
                graypart += tons * idx;
                finishM.domestic_graypart += tons * idx;

                //row.Cells["domestic_graypart_hj"].Value = tons * idx;

                idx     = GetDecimal(row.Cells["domestic_lysine"].Value);
                lysine += tons * idx;
                finishM.domestic_lysine += tons * idx;
                //row.Cells["domestic_lysine_hj"].Value = tons * idx;

                idx         = GetDecimal(row.Cells["domestic_methionine"].Value);
                methionine += tons * idx;
                finishM.domestic_methionine += tons * idx;
                //row.Cells["domestic_methionine_hj"].Value = tons * idx;

                idx      = GetDecimal(row.Cells["domestic_protein"].Value);
                protein += tons * idx;
                finishM.domestic_protein += tons * idx;

                //row.Cells["domestic_protein_hj"].Value = tons * idx;

                idx       = GetDecimal(row.Cells["domestic_sandsalt"].Value);
                sandsalt += tons * idx;
                finishM.domestic_sandsalt += tons * idx;
                //row.Cells["domestic_sandsalt_hj"].Value = tons * idx;

                idx   = GetDecimal(row.Cells["domestic_sour"].Value);
                sour += tons * idx;
                finishM.domestic_sour += tons * idx;
                // row.Cells["domestic_sour_hj"].Value = tons * idx;

                idx  = GetDecimal(row.Cells["domestic_tvn"].Value);
                tvn += tons * idx;
                finishM.domestic_tvn += tons * idx;

                idx = GetDecimal(row.Cells["domestic_amine"].Value);
                finishM.domestic_amine += tons * idx;

                idx = GetDecimal(row.Cells["domestic_aminototal"].Value);
                finishM.domestic_aminototal += tons * idx;

                idx = GetDecimal(row.Cells["domestic_fat"].Value);
                finishM.domestic_fat += tons * idx;
                //row.Cells["domestic_tvn_hj"].Value = tons * idx;

                idx              = GetDecimal(row.Cells["salermb"].Value);
                finishM.salermb += tons * idx;

                idx              = GetDecimal(row.Cells["selfrmb"].Value);
                finishM.selfrmb += tons * idx;

                //idx = GetDecimal(row.Cells["sgs_ffa"].Value);
                // ffa += tons * idx;
                //row.Cells["sgs_ffa_hj"].Value = tons * idx;

                //idx = GetDecimal(row.Cells["sgs_amine"].Value);
                //amine += tons * idx;
                //row.Cells["sgs_amine_hj"].Value = tons * idx;

                //unitprice = GetDecimal(row.Cells["homemadeunitprice"].Value);
                //cost = unitprice * tons;
                //cost_hj += cost;
                //row.Cells["cost"].Value = cost.ToString("f2");

                //FishEntity.FoodOutDetailEntityVO temp = row.DataBoundItem as FishEntity.FoodOutDetailEntityVO;
                //temp.domestic_fat = idx;
            }

            foreach (System.Collections.Generic.KeyValuePair <int, FishEntity.FoodOutDetailEntityVO> pair in groups)
            {
                FishEntity.FoodOutDetailEntityVO f = _details.Find((i) => { return(i.solutionid == pair.Key /*&& i.no == FinishNo*/); });
                if (f == null)
                {
                    continue;
                }

                f.tons    = pair.Value.tons;
                f.package = pair.Value.package;

                f.domestic_amine      = pair.Value.tons == 0 ? 0 : pair.Value.domestic_amine / pair.Value.tons;
                f.domestic_aminototal = pair.Value.tons == 0 ? 0 : pair.Value.domestic_aminototal / pair.Value.tons;
                f.domestic_fat        = pair.Value.tons == 0 ? 0 : pair.Value.domestic_fat / pair.Value.tons;
                f.domestic_graypart   = pair.Value.tons == 0 ? 0 : pair.Value.domestic_graypart / pair.Value.tons;;
                f.domestic_lysine     = pair.Value.tons == 0 ? 0 : pair.Value.domestic_lysine / pair.Value.tons;
                f.domestic_methionine = pair.Value.tons == 0 ? 0 : pair.Value.domestic_methionine / pair.Value.tons;
                f.domestic_protein    = pair.Value.tons == 0 ? 0 : pair.Value.domestic_protein / pair.Value.tons;
                f.domestic_sandsalt   = pair.Value.tons == 0 ? 0 : pair.Value.domestic_sandsalt / pair.Value.tons;
                f.domestic_sour       = pair.Value.tons == 0 ? 0 : pair.Value.domestic_sour / pair.Value.tons;
                f.domestic_tvn        = pair.Value.tons == 0 ? 0 : pair.Value.domestic_tvn / pair.Value.tons;

                f.selfrmb = pair.Value.tons == 0 ? 0 : pair.Value.selfrmb / pair.Value.tons;
                f.salermb = pair.Value.tons == 0 ? 0 : pair.Value.salermb / pair.Value.tons;
            }

            dataGridView1.Invalidate();
        }
コード例 #5
0
        protected List <FishEntity.FoodOutDetailEntityVO> GetDetails(int billId)
        {
            dataGridView1.EndEdit();

            List <FishEntity.FoodOutDetailEntityVO> listNews = new List <FishEntity.FoodOutDetailEntityVO>();

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                if (row.IsNewRow)
                {
                    continue;
                }
                FishEntity.FoodOutDetailEntityVO product = new FishEntity.FoodOutDetailEntityVO();
                product.mid = billId;

                int solutionid = 0;
                if (row.Cells["solutionid"].Value != null)
                {
                    int.TryParse(row.Cells["solutionid"].Value.ToString(), out solutionid);
                }
                product.solutionid = solutionid;
                //int no = 0;
                //if (row.Cells["no"].Value != null)
                //{
                //    int.TryParse(row.Cells["no"].Value.ToString(), out no);
                //}
                //product.no = no;

                int pid = 0;
                if (row.Cells["productid"].Value != null)
                {
                    int.TryParse(row.Cells["productid"].Value.ToString(), out pid);
                }
                product.productid   = pid;
                product.productname = row.Cells["productname"].Value == null ? string.Empty : row.Cells["productname"].Value.ToString();
                product.productcode = row.Cells["productcode"].Value == null ? string.Empty : row.Cells["productcode"].Value.ToString();
                product.nature      = row.Cells["nature"].Value == null ? string.Empty : row.Cells["nature"].Value.ToString();
                product.brand       = row.Cells["brand"].Value == null ? string.Empty : row.Cells["brand"].Value.ToString();
                product.remark      = row.Cells["remark"].Value == null ? string.Empty : row.Cells["remark"].Value.ToString();
                product.shipno      = row.Cells["shipno"].Value == null ? string.Empty : row.Cells["shipno"].Value.ToString();
                product.billofgoods = row.Cells["billofgoods"].Value == null ? string.Empty : row.Cells["billofgoods"].Value.ToString();

                decimal selfrmb = 0;
                if (row.Cells["selfrmb"].Value != null)
                {
                    decimal.TryParse(row.Cells["selfrmb"].Value.ToString(), out selfrmb);
                }
                product.selfrmb = selfrmb;
                decimal salermb = 0;
                if (row.Cells["salermb"].Value != null)
                {
                    decimal.TryParse(row.Cells["salermb"].Value.ToString(), out salermb);
                }
                product.salermb = salermb;

                product.domestic_graypart   = row.Cells["domestic_graypart"].Value == null ? 0 : decimal.Parse(row.Cells["domestic_graypart"].Value.ToString().Trim());
                product.domestic_lysine     = row.Cells["domestic_lysine"].Value == null ? 0 : decimal.Parse(row.Cells["domestic_lysine"].Value.ToString().Trim());
                product.domestic_methionine = row.Cells["domestic_methionine"].Value == null ? 0 : decimal.Parse(row.Cells["domestic_methionine"].Value.ToString().Trim());
                product.domestic_protein    = row.Cells["domestic_protein"].Value == null ? 0 : decimal.Parse(row.Cells["domestic_protein"].Value.ToString().Trim());
                product.domestic_sandsalt   = row.Cells["domestic_sandsalt"].Value == null ? 0 : decimal.Parse(row.Cells["domestic_sandsalt"].Value.ToString().Trim());
                product.domestic_sour       = row.Cells["domestic_sour"].Value == null ? 0 : decimal.Parse(row.Cells["domestic_sour"].Value.ToString().Trim());
                product.domestic_tvn        = row.Cells["domestic_tvn"].Value == null ? 0 : decimal.Parse(row.Cells["domestic_tvn"].Value.ToString().Trim());
                product.domestic_fat        = row.Cells["domestic_fat"].Value == null ? 0 : decimal.Parse(row.Cells["domestic_fat"].Value.ToString().Trim());
                product.domestic_amine      = row.Cells["domestic_amine"].Value == null ? 0 : decimal.Parse(row.Cells["domestic_amine"].Value.ToString().Trim());
                product.domestic_aminototal = row.Cells["domestic_aminototal"].Value == null ? 0 : decimal.Parse(row.Cells["domestic_aminototal"].Value.ToString().Trim());

                //product.sgs_ffa = row.Cells["sgs_ffa"].Value == null ? 0 : decimal.Parse(row.Cells["sgs_ffa"].Value.ToString().Trim());
                //product.sgs_amine = row.Cells["sgs_amine"].Value == null ? 0 : int.Parse(row.Cells["sgs_amine"].Value.ToString().Trim());

                //product.homemadeunitprice = row.Cells["homemadeunitprice"].Value == null ? 0 : decimal.Parse(row.Cells["homemadeunitprice"].Value.ToString().Trim());

                int did = 0;
                if (row.Cells["id"].Value != null)
                {
                    int.TryParse(row.Cells["id"].Value.ToString(), out did);
                }
                product.id = did;

                int packageInt = 0;

                if (row.Cells["package"].Value != null)
                {
                    int.TryParse(row.Cells["package"].Value.ToString(), out packageInt);
                }
                product.package = packageInt;

                decimal tonsDec = 0;
                if (row.Cells["tons"].Value != null)
                {
                    decimal.TryParse(row.Cells["tons"].Value.ToString(), out tonsDec);
                }
                product.tons = tonsDec;

                //decimal costDec = 0;
                //costDec = GetDecimal(row.Cells["cost"].Value);
                //product.cost = costDec;

                listNews.Add(product);
            }

            return(listNews);
        }
コード例 #6
0
ファイル: ProductBll.cs プロジェクト: icprog/ZhengDong
 public bool UpdateFoodOutInfo(FishEntity.FoodOutDetailEntityVO vo)
 {
     return(dal.UpdateFoodOutInfo(vo));
 }