Esempio n. 1
0
 private void label33_Click(object sender, EventArgs e)
 {
     if (BasicClass.BasicFile.GetPermissions("申购单") != string.Empty)
     {
         Form fr = new Stock.frNeedStock();
         fr.ShowDialog();
     }
     else
     {
         MessageBox.Show("没有权限 ");
     }
 }
Esempio n. 2
0
 private void simpleButton5_Click(object sender, EventArgs e)
 {
     if (gridView1.FocusedRowHandle > -1)
     {
         int TypeID = Convert.ToInt32(gridView1.GetFocusedRowCellValue(_coState));
         int ID     = Convert.ToInt32(gridView1.GetFocusedRowCellValue(_coMainID));
         if (TypeID == (int)BasicClass.Enums.TableType.Stock)
         {
             Form fr = new frStock(ID);
             fr.ShowDialog();
         }
         else if (TypeID == (int)BasicClass.Enums.TableType.NeedStock)
         {
             Form fr = new frNeedStock(ID);
             fr.ShowDialog();
         }
     }
 }
Esempio n. 3
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            if (_DepotID == 0)
            {
                XtraMessageBox.Show("请选择物料存放仓库!");
                return;
            }
            if (DialogResult.Yes == XtraMessageBox.Show("请确认是否将所有已选择的物料的全部申购?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1))
            {
                decimal Amount = 0;
                bool    t      = false;
                for (int i = 0; i < gridView2.RowCount; i++)
                {
                    if (Convert.ToBoolean(gridView2.GetRowCellValue(i, _coIsS)) && Convert.ToDecimal(gridView2.GetRowCellValue(i, _coNAmount)) > 0)
                    {
                        t = true;
                        break;
                    }
                }
                //if (!t)
                //{
                //    XtraMessageBox.Show("没有需采购的数量!");
                //    return;
                //}
                int _sbID  = 0;
                int _sbiID = 0;
                if (t)
                {
                    int       _tabTypeID = (int)BasicClass.Enums.TableType.NeedStock;
                    DataTable dtSB       = BasicClass.GetDataSet.GetDS(BasicClass.Bllstr.bllStockBack, "GetList", new object[] { "ID=0" }).Tables[0];
                    DataRow   dr         = dtSB.NewRow();//请购单主表
                    dr["ID"]          = 0;
                    dr["DataTime"]    = BasicClass.GetDataSet.GetDateTime();
                    dr["Num"]         = BasicClass.GetDataSet.GetOne(BasicClass.Bllstr.bllStockBack, "NewNum", new object[] { BasicClass.GetDataSet.GetDateTime().Date, _tabTypeID, 0 });
                    dr["CompanyID"]   = 0;
                    dr["Remark"]      = string.Empty;
                    dr["StockRemark"] = PP;
                    dr["Money"]       = 0;
                    dr["IsVerify"]    = 4;
                    dr["VerifyDate"]  = DateTime.Parse("1900-1-1");
                    dr["DepotID"]     = labAndLookupEdit1.editVal;
                    dr["LastMoney"]   = dr["BackMoney"] = 0;
                    dr["FillDate"]    = BasicClass.GetDataSet.GetDateTime();
                    dr["VerifyMan"]   = dr["FillMan"] = BasicClass.UserInfo.UserID;
                    dr["State"]       = _tabTypeID;
                    dr["BackDate"]    = DateTime.Parse("1900-1-1");
                    dr["TaskID"]      = 0;
                    dr["A"]           = 1;
                    dtSB.Rows.Add(dr);
                    _sbID = BasicClass.GetDataSet.Add(BasicClass.Bllstr.bllStockBack, dtSB);
                }
                Amount = 0;
                int RelatedID, DemandID, TypeID, MListID, TaskID, StockInfoID;
                RelatedID = DemandID = TypeID = MListID = TaskID = StockInfoID = 0;

                DataRow[] drs;
                DataTable dtSBI = BasicClass.GetDataSet.GetDS(BasicClass.Bllstr.bllStockBackInfo, "GetList", new object[] { "ID=0" }).Tables[0];
                for (int i = 0; i < gridView2.RowCount; i++)
                {
                    _sbiID = 0;
                    if (Convert.ToBoolean(gridView2.GetRowCellValue(i, _coIsS)) && gridView2.GetRowCellValue(i, _coNAmount) != DBNull.Value && Convert.ToDecimal(gridView2.GetRowCellValue(i, _coNAmount)) > 0)
                    {
                        dtSBI.Rows.Clear();
                        DataRow drr = dtSBI.NewRow();
                        drr["ID"]               = 0;
                        drr["MainID"]           = _sbID;
                        drr["StockInfoID"]      = 0;
                        drr["MaterielID"]       = gridView2.GetRowCellValue(i, _coMateriel);
                        drr["ColorID"]          = gridView2.GetRowCellValue(i, _coColorID);
                        drr["ColorOneID"]       = gridView2.GetRowCellValue(i, _coColorOneID);
                        drr["ColorTwoID"]       = gridView2.GetRowCellValue(i, _coColorTwoID);
                        drr["SizeID"]           = gridView2.GetRowCellValue(i, _coSizeID);
                        drr["Price"]            = drr["Money"] = 0;
                        drr["CompanyMeasureID"] = drr["DepotMeasureID"] = gridView2.GetRowCellValue(i, _coMeasureID);
                        drr["Conversion"]       = 1;
                        drr["Remark"]           = string.Empty;
                        drr["Amount"]           = drr["PriceAmount"] = drr["NotAmount"] = drr["NotPriceAmount"] = drr["NeedAmount"] = gridView2.GetRowCellValue(i, _coNAmount);
                        drr["MListID"]          = gridView2.GetRowCellValue(i, _coMListID);
                        drr["CompanyID"]        = 0;
                        drr["BrandID"]          = 0;
                        drr["IsEnd"]            = 0;
                        drr["DemandID"]         = 0;
                        drr["ExcessAmount"]     = 0;
                        drr["A"]            = 1;
                        drr["StringTaskID"] = _strTask;
                        dtSBI.Rows.Add(drr);
                        _sbiID = BasicClass.GetDataSet.Add(BasicClass.Bllstr.bllStockBackInfo, dtSBI);
                    }
                    drs = dtUseRep.Select("(A=1) And (MListID=" + gridView2.GetRowCellValue(i, _coMListID) + ")");
                    if (drs.Length > 0)
                    {
                        for (int j = 0; j < drs.Length; j++)
                        {
                            drs[j]["StockInfoID"] = _sbiID;
                            MListID     = Convert.ToInt32(drs[j]["MListID"]);
                            DemandID    = Convert.ToInt32(drs[j]["DemandID"]);
                            Amount      = Convert.ToDecimal(drs[j]["Amount"]);
                            StockInfoID = _sbID;
                            TypeID      = (int)BasicClass.Enums.PlanUseRep.使用原仓存;
                            TaskID      = Convert.ToInt32(drs[j]["TaskID"]);
                            RelatedID   = Convert.ToInt32(drs[j]["RelatedID"]);
                            //将使用空闲仓存数量转入相应生产计划的库存备料中,并增加到相应物料拆分表的已备料数量中
                            BasicClass.GetDataSet.ExecSql("Hownet.BLL.PlanUseRep", "UpAmount", new object[] { MListID, DemandID, StockInfoID, Amount, TypeID, TaskID, RelatedID, true, _DepotID });
                            //BasicClass.GetDataSet.ExecSql("Hownet.BLL.PlanUseRep", "UpAmount", new object[] { MListID, DemandID, StockInfoID, Amount, (int)BasicClass.Enums.PlanUseRep.已申购数量, TaskID, RelatedID });
                        }
                    }
                    dtUseRep.AcceptChanges();
                }
                //if (dtUseRep.Rows.Count > 0)//更新库存情况,将空闲物料转入计划单
                //{
                //    DataSet dss = new DataSet();
                //    dss.DataSetName = "dss";
                //    dss.Tables.Add(dtUseRep.Copy());
                //    byte[] bb = BasicClass.ZipJpg.Ds2Byte(dss);
                //    BasicClass.GetDataSet.ExecSql(BasicClass.Bllstr.bllRepertory, "UpTaskUseRepertoryAmount", new object[] { bb, _DepotID });
                //}
                //增加明细的申购数量
                BasicClass.GetDataSet.ExecSql(BasicClass.Bllstr.bllStockBackInfo, "StockToDemand", new object[] { _sbID, (int)BasicClass.Enums.PlanUseRep.已申购数量, true });
                string[] ss = _strTask.Split(',');
                if (ss.Length > 0)
                {
                    DataTable dttt  = new DataTable();
                    string    bllPP = "Hownet.BLL.ProductionPlan";
                    for (int i = 0; i < ss.Length; i++)
                    {
                        dttt = BasicClass.GetDataSet.GetDS(bllPP, "GetList", new object[] { "(ID=" + Convert.ToInt32(ss[i]) + ")" }).Tables[0];
                        if (dttt.Rows.Count > 0)
                        {
                            dttt.Rows[0]["PWorkingID"] = (int)BasicClass.Enums.IsVerify.开始备料;
                            BasicClass.GetDataSet.UpData(bllPP, dttt);
                        }
                    }
                }
                for (int i = 0; i < dtRLUse.Rows.Count; i++)
                {
                    BasicClass.GetDataSet.ExecSql("Hownet.BLL.RepertoryList", "UpPlanID", new object[] { Convert.ToInt32(dtRLUse.Rows[i]["RID"]), Convert.ToInt32(dtRLUse.Rows[i]["PID"]) });
                }
                ShowInfo();
                dtPP = BasicClass.GetDataSet.GetDS("Hownet.BLL.ProductionPlan", "GetTaskList", new object[] { _TableTypeID, _NumTypeID, true }).Tables[0];
                gridControl1.DataSource = dtPP;
                if (_sbID > 0)
                {
                    Form fr = new frNeedStock(_sbID);
                    fr.ShowDialog();
                }
            }
        }