Ejemplo n.º 1
0
 private void dataGridView1_CellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
 {
     /*
      * select fishId 鱼粉ID,billName 提单号,codeNum 采购编号,codeNumContract 采购合同号,a.price 采购价格,c.salermb 市场价格,a.applyDate 入库日期,c.selfstorageweight 重量,c.selfstoragequantity 数量,pileNum 桩角号,db 蛋白,tvn TVN,za 组胺,shy 沙和盐,hf 灰份,domestic_sour 酸价,zf 脂肪,domestic_lysine 赖氨酸,domestic_methionine 蛋氨酸,domestic_aminototal 氨基酸总和,a.remark 备注,country 国别,a.brand 品牌,shipName 船名,b.State4 状态 ,b.type 港口,a.code 入库申请单单号 from t_storageofrequisition a inner join t_product b on a.fishId=b.code inner join t_productex c on b.id=c.id
      */
     if (e.ColumnIndex < 0 && e.RowIndex < 0)
     {
         return;
     }
     _models                 = new FishEntity.BatchSheetsEntity( );
     _models.fishId          = dataGridView1.Rows [e.RowIndex].Cells ["鱼粉ID"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["鱼粉ID"].Value.ToString( );
     _models.codeNum         = dataGridView1.Rows [e.RowIndex].Cells ["采购编号"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["采购编号"].Value.ToString( );
     _models.codeNumContract = dataGridView1.Rows [e.RowIndex].Cells ["采购合同号"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["采购合同号"].Value.ToString( );
     _models.country         = dataGridView1.Rows [e.RowIndex].Cells ["国别"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["国别"].Value.ToString( );
     _models.brand           = dataGridView1.Rows [e.RowIndex].Cells ["品牌"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["品牌"].Value.ToString( );
     _models.protein         = dataGridView1.Rows [e.RowIndex].Cells ["蛋白"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["蛋白"].Value.ToString( );
     _models.tvn             = dataGridView1.Rows [e.RowIndex].Cells ["TVN"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["TVN"].Value.ToString( );
     _models.salt            = dataGridView1.Rows [e.RowIndex].Cells ["沙和盐"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["沙和盐"].Value.ToString( );
     _models.acid            = dataGridView1.Rows [e.RowIndex].Cells ["酸价"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["酸价"].Value.ToString( );
     _models.ash             = dataGridView1.Rows [e.RowIndex].Cells ["灰份"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["灰份"].Value.ToString( );
     _models.histamine       = dataGridView1.Rows [e.RowIndex].Cells ["组胺"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["组胺"].Value.ToString( );
     _models.las             = dataGridView1.Rows [e.RowIndex].Cells ["赖氨酸"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["赖氨酸"].Value.ToString( );
     _models.das             = dataGridView1.Rows [e.RowIndex].Cells ["蛋氨酸"].Value == null ? string.Empty : dataGridView1.Rows [e.RowIndex].Cells ["蛋氨酸"].Value.ToString( );
     _models.tons            = dataGridView1.Rows [e.RowIndex].Cells ["重量"].Value == null ? 0 : Convert.ToDecimal(dataGridView1.Rows [e.RowIndex].Cells ["重量"].Value);
     _models.rkCode          = dataGridView1.Rows [e.RowIndex].Cells ["入库申请单单号"].Value.ToString( );
     this.DialogResult       = DialogResult.OK;
 }
Ejemplo n.º 2
0
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dataGridView1.Columns[e.ColumnIndex].Name.Equals("code", StringComparison.OrdinalIgnoreCase) == true)
     {
         SeeFishDetail(e.ColumnIndex, e.RowIndex);
     }
     if (e.ColumnIndex < 0 && e.RowIndex < 0)
     {
         return;
     }
     if (dataGridView1.Rows[e.RowIndex].Cells["code"].Value.ToString() == "分组小计")
     {
         return;
     }
     _models                 = new FishEntity.BatchSheetsEntity();
     _models.fishId          = dataGridView1.Rows[e.RowIndex].Cells["code"].Value == null ? string.Empty : dataGridView1.Rows[e.RowIndex].Cells["code"].Value.ToString();
     _models.codeNum         = dataGridView1.Rows[e.RowIndex].Cells["codenum"].Value.ToString();
     _models.codeNumContract = dataGridView1.Rows[e.RowIndex].Cells["codenumcontract"].Value.ToString();
     _models.qualitySpe      = dataGridView1.Rows[e.RowIndex].Cells["specification"].Value.ToString();
     _models.price           = dataGridView1.Rows[e.RowIndex].Cells["selfrmb"].Value == null ?0 : Convert.ToDecimal(dataGridView1.Rows[e.RowIndex].Cells["selfrmb"].Value.ToString());
     _models.country         = dataGridView1.Rows[e.RowIndex].Cells["nature"].Value == null ? string.Empty : dataGridView1.Rows[e.RowIndex].Cells["nature"].Value.ToString(); //brand
     _models.brand           = dataGridView1.Rows[e.RowIndex].Cells["brand"].Value == null ? string.Empty : dataGridView1.Rows[e.RowIndex].Cells["brand"].Value.ToString();   //brand
     _models.protein         = dataGridView1.Rows[e.RowIndex].Cells["domestic_protein"].Value == null ? string.Empty : dataGridView1.Rows[e.RowIndex].Cells["domestic_protein"].Value.ToString();
     _models.tvn             = dataGridView1.Rows[e.RowIndex].Cells["domestic_tvn"].Value == null ? string.Empty : dataGridView1.Rows[e.RowIndex].Cells["domestic_tvn"].Value.ToString();
     _models.salt            = dataGridView1.Rows[e.RowIndex].Cells["domestic_sandsalt"].Value == null ? string.Empty : dataGridView1.Rows[e.RowIndex].Cells["domestic_sandsalt"].Value.ToString();
     _models.acid            = dataGridView1.Rows[e.RowIndex].Cells["domestic_sour"].Value == null ? string.Empty : dataGridView1.Rows[e.RowIndex].Cells["domestic_sour"].Value.ToString();
     _models.ash             = dataGridView1.Rows[e.RowIndex].Cells["domestic_graypart"].Value == null ? string.Empty : dataGridView1.Rows[e.RowIndex].Cells["domestic_graypart"].Value.ToString();
     _models.histamine       = dataGridView1.Rows[e.RowIndex].Cells["domestic_amine"].Value == null ? string.Empty : dataGridView1.Rows[e.RowIndex].Cells["domestic_amine"].Value.ToString();
     _models.las             = dataGridView1.Rows[e.RowIndex].Cells["domestic_lysine"].Value == null ? string.Empty : dataGridView1.Rows[e.RowIndex].Cells["domestic_lysine"].Value.ToString();
     _models.das             = dataGridView1.Rows[e.RowIndex].Cells["domestic_methionine"].Value == null ? string.Empty : dataGridView1.Rows[e.RowIndex].Cells["domestic_methionine"].Value.ToString();
     //_models.tons = dataGridView1.Rows[e.RowIndex].Cells["weight"].Value == null ? 0 : Convert.ToDecimal(dataGridView1.Rows[e.RowIndex].Cells["weight"].Value);
     _models.rkCode    = string.Empty;
     this.DialogResult = DialogResult.OK;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 编辑数据
        /// </summary>
        /// <param name="_model"></param>
        /// <param name="_modelsList"></param>
        /// <returns></returns>
        public bool Edit(FishEntity.BatchSheetEntity _model, List <FishEntity.BatchSheetsEntity> _modelsList)
        {
            Hashtable     SQLString = new Hashtable( );
            StringBuilder strSql    = new StringBuilder( );

            strSql.Append("UPDATE t_batchsheet SET productionDate=@productionDate where code=@code");
            MySqlParameter [] parameters =
            {
                new MySqlParameter("@code",           MySqlDbType.VarChar, 45),
                new MySqlParameter("@productionDate", MySqlDbType.Date)
            };
            parameters [0].Value = _model.code;
            parameters [1].Value = _model.productionDate;
            SQLString.Add(strSql, parameters);

            strSql = new StringBuilder( );
            strSql.AppendFormat("SELECT id FROM t_batchsheets where code='{0}'", _model.code);

            DataTable dt = MySqlHelper.Query(strSql.ToString( )).Tables [0];

            foreach (FishEntity.BatchSheetsEntity model in _modelsList)
            {
                if (dt != null && dt.Rows.Count > 0 && dt.Select("id='" + model.id + "'").Length > 0)
                {
                    edit(SQLString, strSql, model);
                }
                else
                {
                    add(SQLString, strSql, model);
                }
            }

            if (Exists_isDel(_model.code) == false)
            {
                if (dt != null && dt.Rows.Count > 0)
                {
                    int id = 0;
                    FishEntity.BatchSheetsEntity model = new FishEntity.BatchSheetsEntity( );
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        id = string.IsNullOrEmpty(dt.Rows [i] ["id"].ToString( )) == true ? 0 : Convert.ToInt32(dt.Rows [i] ["id"].ToString( ));

                        model = _modelsList.Find(x =>
                        {
                            return(x.id == id);
                        });
                        if (model == null)
                        {
                            delete(SQLString, strSql, id);
                        }
                    }
                }
            }

            return(MySqlHelper.ExecuteSqlTran(SQLString));
        }
Ejemplo n.º 4
0
 void add(Hashtable SQLString, StringBuilder strSql, FishEntity.BatchSheetsEntity model)
 {
     strSql = new StringBuilder( );
     strSql.Append("insert into t_batchsheets(");
     strSql.Append("code,fishId,codeNum,codeNumContract,qualitySpe,country,brand,goods,tons,protein,tvn,salt,acid,ash,histamine,las,das,price,cost,isSum)");
     strSql.Append(" values (");
     strSql.Append("@code,@fishId,@codeNum,@codeNumContract,@qualitySpe,@country,@brand,@goods,@tons,@protein,@tvn,@salt,@acid,@ash,@histamine,@las,@das,@price,@cost,@isSum)");
     MySqlParameter [] parameters =
     {
         new MySqlParameter("@code",            MySqlDbType.VarChar, 45),
         new MySqlParameter("@fishId",          MySqlDbType.VarChar, 45),
         new MySqlParameter("@codeNum",         MySqlDbType.VarChar, 45),
         new MySqlParameter("@codeNumContract", MySqlDbType.VarChar, 45),
         new MySqlParameter("@qualitySpe",      MySqlDbType.VarChar, 45),
         new MySqlParameter("@country",         MySqlDbType.VarChar, 45),
         new MySqlParameter("@brand",           MySqlDbType.VarChar, 45),
         new MySqlParameter("@goods",           MySqlDbType.VarChar, 45),
         new MySqlParameter("@tons",            MySqlDbType.Decimal, 10),
         new MySqlParameter("@protein",         MySqlDbType.VarChar, 45),
         new MySqlParameter("@tvn",             MySqlDbType.VarChar, 45),
         new MySqlParameter("@salt",            MySqlDbType.VarChar, 45),
         new MySqlParameter("@acid",            MySqlDbType.VarChar, 45),
         new MySqlParameter("@ash",             MySqlDbType.VarChar, 45),
         new MySqlParameter("@histamine",       MySqlDbType.VarChar, 45),
         new MySqlParameter("@las",             MySqlDbType.VarChar, 45),
         new MySqlParameter("@das",             MySqlDbType.VarChar, 45),
         new MySqlParameter("@price",           MySqlDbType.Decimal, 10),
         new MySqlParameter("@cost",            MySqlDbType.Decimal, 10),
         new MySqlParameter("@isSum",           MySqlDbType.Bit)
     };
     parameters [0].Value  = model.code;
     parameters [1].Value  = model.fishId;
     parameters [2].Value  = model.codeNum;
     parameters [3].Value  = model.codeNumContract;
     parameters [4].Value  = model.qualitySpe;
     parameters [5].Value  = model.country;
     parameters [6].Value  = model.brand;
     parameters [7].Value  = model.goods;
     parameters [8].Value  = model.tons;
     parameters [9].Value  = model.protein;
     parameters [10].Value = model.tvn;
     parameters [11].Value = model.salt;
     parameters [12].Value = model.acid;
     parameters [13].Value = model.ash;
     parameters [14].Value = model.histamine;
     parameters [15].Value = model.las;
     parameters [16].Value = model.das;
     parameters [17].Value = model.price;
     parameters [18].Value = model.cost;
     parameters [19].Value = model.isSum;
     SQLString.Add(strSql, parameters);
 }
Ejemplo n.º 5
0
        private void fishId_DoubleClick(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtdataForm.Text))
            {
                MessageBox.Show("请选择数据来源");
                return;
            }

            if (txtdataForm.Text.Equals("自制仓库"))
            {
                FormNewSelfcontrolWare form = new FormNewSelfcontrolWare( );//FormSelfcontrolWare
                if (form.ShowDialog( ) == DialogResult.OK)
                {
                    FishEntity.BatchSheetsEntity _model = form.getModel;
                    fishId.Text     = _model.fishId;
                    price.Text      = _model.price.ToString( );
                    tvn.Text        = _model.tvn;
                    protein.Text    = _model.protein;
                    ash.Text        = _model.ash;
                    histamine.Text  = _model.histamine;
                    salt.Text       = _model.salt;
                    las.Text        = _model.las;
                    das.Text        = _model.das;
                    country.Text    = _model.country;
                    qualitySpe.Text = _model.qualitySpe;
                    brand.Text      = _model.brand;
                }
            }
            else if (txtdataForm.Text.Equals("自营仓库"))
            {
                FormNewPriWarehouse form = new FormNewPriWarehouse();//
                if (form.ShowDialog() == DialogResult.OK)
                {
                    FishEntity.ProductQuoteVo _model = form.getModel;
                    fishId.Text     = _model.code;
                    price.Text      = _model.confirmrmb.ToString();
                    tvn.Text        = _model.sgs_tvn.ToString();
                    protein.Text    = _model.sgs_protein.ToString();
                    ash.Text        = _model.sgs_graypart.ToString();
                    histamine.Text  = _model.sgs_amine.ToString();
                    FFA.Text        = _model.sgs_ffa.ToString();;
                    salt.Text       = _model.domestic_sandsalt.ToString();
                    las.Text        = _model.domestic_lysine.ToString();
                    das.Text        = _model.domestic_methionine.ToString();
                    qualitySpe.Text = _model.specification;
                    country.Text    = _model.nature;
                    brand.Text      = _model.brand;
                }
            }
            else if (txtdataForm.Text.Equals("报盘"))
            {
                FormQuote form = new FormQuote();//
                if (form.ShowDialog() == DialogResult.OK)
                {
                    FishEntity.ProductQuoteVo _model = form.getModel;
                    fishId.Text     = _model.code;
                    tvn.Text        = _model.quote_tvn.ToString();
                    protein.Text    = _model.quote_protein.ToString();
                    ash.Text        = _model.quote_graypart.ToString();
                    histamine.Text  = _model.quote_amine.ToString();
                    FFA.Text        = _model.quote_ffa.ToString();;
                    salt.Text       = _model.quote_sandsalt.ToString();
                    qualitySpe.Text = _model.specification;
                    brand.Text      = _model.brand;
                    country.Text    = _model.nature;
                }
            }
            else if (txtdataForm.Text.Equals("现货"))
            {
                FormSpot form = new FormSpot();//
                if (form.ShowDialog() == DialogResult.OK)
                {
                    FishEntity.ProductQuoteVo _model = form.getModel;
                    fishId.Text     = _model.code;
                    price.Text      = _model.quotermb.ToString();
                    tvn.Text        = _model.sgs_tvn.ToString();
                    protein.Text    = _model.sgs_protein.ToString();
                    ash.Text        = _model.sgs_graypart.ToString();
                    histamine.Text  = _model.sgs_amine.ToString();
                    FFA.Text        = _model.sgs_ffa.ToString();;
                    salt.Text       = _model.sgs_sandsalt.ToString();
                    qualitySpe.Text = _model.specification;
                    brand.Text      = _model.brand;
                    country.Text    = _model.nature;
                }
            }
            else if (txtdataForm.Text.Equals("确盘"))
            {
                FormConfirm form = new FormConfirm();//
                if (form.ShowDialog() == DialogResult.OK)
                {
                    FishEntity.ProductQuoteVo _model = form.getModel;
                    fishId.Text     = _model.code;
                    price.Text      = _model.quotermb.ToString();
                    tvn.Text        = _model.quote_tvn.ToString();
                    protein.Text    = _model.quote_protein.ToString();
                    ash.Text        = _model.quote_graypart.ToString();
                    histamine.Text  = _model.quote_amine.ToString();
                    FFA.Text        = _model.quote_ffa.ToString();;
                    salt.Text       = _model.quote_sandsalt.ToString();
                    qualitySpe.Text = _model.specification;
                    brand.Text      = _model.brand;
                    country.Text    = _model.nature;
                }
            }
        }
Ejemplo n.º 6
0
 public FishEntity.BatchSheetsEntity getModels(DataRow row)
 {
     FishEntity.BatchSheetsEntity model = new FishEntity.BatchSheetsEntity( );
     if (row != null)
     {
         if (row ["id"] != null && row ["id"].ToString( ) != "")
         {
             model.id = int.Parse(row ["id"].ToString( ));
         }
         if (row ["code"] != null)
         {
             model.code = row ["code"].ToString( );
         }
         if (row ["fishId"] != null)
         {
             model.fishId = row ["fishId"].ToString( );
         }
         if (row ["codeNum"] != null)
         {
             model.codeNum = row ["codeNum"].ToString( );
         }
         if (row ["codeNumContract"] != null)
         {
             model.codeNumContract = row ["codeNumContract"].ToString( );
         }
         if (row ["qualitySpe"] != null)
         {
             model.qualitySpe = row ["qualitySpe"].ToString( );
         }
         if (row ["country"] != null)
         {
             model.country = row ["country"].ToString( );
         }
         if (row ["brand"] != null)
         {
             model.brand = row ["brand"].ToString( );
         }
         if (row ["goods"] != null)
         {
             model.goods = row ["goods"].ToString( );
         }
         if (row ["tons"] != null && row ["tons"].ToString( ) != "")
         {
             model.tons = decimal.Parse(row ["tons"].ToString( ));
         }
         if (row ["protein"] != null)
         {
             model.protein = row ["protein"].ToString( );
         }
         if (row ["tvn"] != null)
         {
             model.tvn = row ["tvn"].ToString( );
         }
         if (row ["salt"] != null)
         {
             model.salt = row ["salt"].ToString( );
         }
         if (row ["acid"] != null)
         {
             model.acid = row ["acid"].ToString( );
         }
         if (row ["ash"] != null)
         {
             model.ash = row ["ash"].ToString( );
         }
         if (row ["histamine"] != null)
         {
             model.histamine = row ["histamine"].ToString( );
         }
         if (row ["las"] != null)
         {
             model.las = row ["las"].ToString( );
         }
         if (row ["das"] != null)
         {
             model.das = row ["das"].ToString( );
         }
         if (row ["price"] != null && row ["price"].ToString( ) != "")
         {
             model.price = decimal.Parse(row ["price"].ToString( ));
         }
         if (row ["cost"] != null && row ["cost"].ToString( ) != "")
         {
             model.cost = decimal.Parse(row ["cost"].ToString( ));
         }
         if (row ["isSum"] != null && row ["isSum"].ToString( ) != "")
         {
             if ((row ["isSum"].ToString( ) == "1") || (row ["isSum"].ToString( ).ToLower( ) == "true"))
             {
                 model.isSum = true;
             }
             else
             {
                 model.isSum = false;
             }
         }
     }
     return(model);
 }
Ejemplo n.º 7
0
        void edit(Hashtable SQLString, StringBuilder strSql, FishEntity.BatchSheetsEntity model)
        {
            strSql = new StringBuilder( );
            strSql.Append("update t_batchsheets set ");
            strSql.Append("code=@code,");
            strSql.Append("fishId=@fishId,");
            strSql.Append("codeNum=@codeNum,");
            strSql.Append("codeNumContract=@codeNumContract,");
            strSql.Append("qualitySpe=@qualitySpe,");
            strSql.Append("country=@country,");
            strSql.Append("brand=@brand,");
            strSql.Append("goods=@goods,");
            strSql.Append("tons=@tons,");
            strSql.Append("protein=@protein,");
            strSql.Append("tvn=@tvn,");
            strSql.Append("salt=@salt,");
            strSql.Append("acid=@acid,");
            strSql.Append("ash=@ash,");
            strSql.Append("histamine=@histamine,");
            strSql.Append("las=@las,");
            strSql.Append("das=@das,");
            strSql.Append("price=@price,");
            strSql.Append("cost=@cost,");
            strSql.Append("isSum=@isSum");
            strSql.Append(" where id=@id");
            MySqlParameter [] parameters =
            {
                new MySqlParameter("@code",            MySqlDbType.VarChar, 45),
                new MySqlParameter("@fishId",          MySqlDbType.VarChar, 45),
                new MySqlParameter("@codeNum",         MySqlDbType.VarChar, 45),
                new MySqlParameter("@codeNumContract", MySqlDbType.VarChar, 45),
                new MySqlParameter("@qualitySpe",      MySqlDbType.VarChar, 45),
                new MySqlParameter("@country",         MySqlDbType.VarChar, 45),
                new MySqlParameter("@brand",           MySqlDbType.VarChar, 45),
                new MySqlParameter("@goods",           MySqlDbType.VarChar, 45),
                new MySqlParameter("@tons",            MySqlDbType.Decimal, 10),
                new MySqlParameter("@protein",         MySqlDbType.VarChar, 45),
                new MySqlParameter("@tvn",             MySqlDbType.VarChar, 45),
                new MySqlParameter("@salt",            MySqlDbType.VarChar, 45),
                new MySqlParameter("@acid",            MySqlDbType.VarChar, 45),
                new MySqlParameter("@ash",             MySqlDbType.VarChar, 45),
                new MySqlParameter("@histamine",       MySqlDbType.VarChar, 45),
                new MySqlParameter("@las",             MySqlDbType.VarChar, 45),
                new MySqlParameter("@das",             MySqlDbType.VarChar, 45),
                new MySqlParameter("@price",           MySqlDbType.Decimal, 10),
                new MySqlParameter("@cost",            MySqlDbType.Decimal, 10),
                new MySqlParameter("@isSum",           MySqlDbType.Bit),
                new MySqlParameter("@id",              MySqlDbType.Int32, 11)
            };
            parameters [0].Value  = model.code;
            parameters [1].Value  = model.fishId;
            parameters [2].Value  = model.codeNum;
            parameters [3].Value  = model.codeNumContract;
            parameters [4].Value  = model.qualitySpe;
            parameters [5].Value  = model.country;
            parameters [6].Value  = model.brand;
            parameters [7].Value  = model.goods;
            parameters [8].Value  = model.tons;
            parameters [9].Value  = model.protein;
            parameters [10].Value = model.tvn;
            parameters [11].Value = model.salt;
            parameters [12].Value = model.acid;
            parameters [13].Value = model.ash;
            parameters [14].Value = model.histamine;
            parameters [15].Value = model.las;
            parameters [16].Value = model.das;
            parameters [17].Value = model.price;
            parameters [18].Value = model.cost;
            parameters [19].Value = model.isSum;
            parameters [20].Value = model.id;

            SQLString.Add(strSql, parameters);
        }