예제 #1
0
        /// <summary>
        /// 审核/弃审入库单
        /// </summary>
        /// <param name="ID">入库单ID</param>
        /// <param name="t">真为审核入库,假为弃审出库</param>
        public void Verify(int ID, bool t, int Depot)
        {
            Hownet.BLL.SysTem                     bllST   = new SysTem();
            Hownet.Model.SysTem                   modST   = bllST.GetModel(bllST.GetMaxId() - 1);
            Hownet.BLL.StockBackInfo              bllSBI  = new StockBackInfo();
            Hownet.BLL.MaterielList               bllML   = new MaterielList();
            Hownet.Model.MaterielList             modML   = new Hownet.Model.MaterielList();
            Hownet.BLL.Repertory                  bllRep  = new Repertory();
            Hownet.BLL.StockBackInfoList          bllSBIL = new StockBackInfoList();
            Hownet.BLL.RepertoryList              bllRL   = new RepertoryList();
            List <Hownet.Model.StockBackInfoList> liSBIL;

            Hownet.Model.RepertoryList        modRL;
            Hownet.Model.Repertory            modRep;
            Hownet.Model.StockBackInfo        modSBI;
            Hownet.Model.StockBack            modSB = GetModel(ID);
            List <Hownet.Model.StockBackInfo> li    = bllSBI.DataTableToList(bllSBI.GetList("(MainID=" + ID + ")").Tables[0]);

            for (int i = 0; i < li.Count; i++)
            {
                if (li[i].StockInfoID > 0)
                {
                    modSBI            = bllSBI.GetModel(li[i].StockInfoID);
                    modSBI.NotAmount -= li[i].Amount;
                    //if (dt.Rows[i]["NeedIsEnd"] != null && dt.Rows[i]["NeedIsEnd"] != DBNull.Value && dt.Rows[i]["NeedIsEnd"].ToString() != string.Empty)
                    //    modSBI.IsEnd = Convert.ToInt32(dt.Rows[i]["NeedIsEnd"]);

                    bllSBI.Update(modSBI);
                }
                if (li[i].MListID == 0)
                {
                    modML.BrandID    = li[i].BrandID;
                    modML.ColorID    = li[i].ColorID;
                    modML.ColorOneID = li[i].ColorOneID;
                    modML.ColorTwoID = li[i].ColorTwoID;
                    modML.SizeID     = li[i].SizeID;
                    modML.MaterielID = li[i].MaterielID;
                    modML.MeasureID  = li[i].CompanyMeasureID;

                    li[i].MListID = bllML.GetID(modML);
                    bllSBI.Update(li[i]);
                }
                liSBIL = bllSBIL.DataTableToList(bllSBIL.GetList("(InfoID=" + li[i].ID + ")").Tables[0]);
                if (liSBIL.Count > 0)
                {
                    for (int j = 0; j < liSBIL.Count; j++)
                    {
                        if (t)
                        {
                            liSBIL[j].BatchNumber = li[i].MListID;
                            bllSBIL.Update(liSBIL[j]);
                            modRL               = new Hownet.Model.RepertoryList();
                            modRL.A             = 1;
                            modRL.Amount        = modRL.NotAmount = liSBIL[j].Amount;
                            modRL.BatchNumber   = liSBIL[j].BatchNumber;
                            modRL.DateTime      = DateTime.Now;
                            modRL.DepotInfoID   = liSBIL[j].DepotInfoID;
                            modRL.DepotInfoName = string.Empty;
                            modRL.ID            = 0;
                            modRL.IsEnd         = false;
                            modRL.MainID        = ID;
                            modRL.Remark        = liSBIL[j].Remark;
                            modRL.SpecID        = liSBIL[j].SpecID;
                            modRL.SpecName      = string.Empty;
                            modRL.StockListID   = liSBIL[j].ID;
                            modRL.QRID          = liSBIL[j].ID.ToString();
                            bllRL.Add(modRL);
                        }
                        else
                        {
                            bllRL.DeleteByStockInfoID(liSBIL[j].ID);
                        }
                    }
                }
                if ((!modST.MaterielByTask) && (modSB.State != (int)Hownet.BLL.Enums.TableType._采购部收货))
                {
                    modRep              = new Hownet.Model.Repertory();
                    modRep.BrandID      = li[i].BrandID;
                    modRep.ColorID      = li[i].ColorID;
                    modRep.ColorOneID   = li[i].ColorOneID;
                    modRep.ColorTwoID   = li[i].ColorTwoID;
                    modRep.SizeID       = li[i].SizeID;
                    modRep.MaterielID   = li[i].MaterielID;
                    modRep.MeasureID    = li[i].CompanyMeasureID;
                    modRep.MListID      = li[i].MListID;
                    modRep.Amount       = li[i].Amount;
                    modRep.DepartmentID = Depot;
                    modRep.Price        = li[i].Price;
                    modRep.Money        = li[i].Money;
                    bllRep.InOrOut(modRep, t);
                }
                if (modSB.State == (int)Hownet.BLL.Enums.TableType._采购部收货)
                {
                    modRep              = new Hownet.Model.Repertory();
                    modRep.BrandID      = li[i].BrandID;
                    modRep.ColorID      = li[i].ColorID;
                    modRep.ColorOneID   = li[i].ColorOneID;
                    modRep.ColorTwoID   = li[i].ColorTwoID;
                    modRep.SizeID       = li[i].SizeID;
                    modRep.MaterielID   = li[i].MaterielID;
                    modRep.MeasureID    = li[i].CompanyMeasureID;
                    modRep.MListID      = li[i].MListID;
                    modRep.Amount       = li[i].Amount;
                    modRep.DepartmentID = Depot;
                    modRep.Price        = li[i].Price;
                    modRep.Money        = li[i].Money;
                    bllRep.InOrOut(modRep, t);
                }
            }
            // Hownet.Model.StockBack modSB = GetModel(ID);
            if (modSB.State == (int)Hownet.BLL.Enums.TableType.P2D)
            {
                if (modSB.CompanyID > 0)
                {
                    Hownet.BLL.Company   bllCom = new Company();
                    Hownet.Model.Company modCom = bllCom.GetModel(modSB.CompanyID);
                    if (t)//收货
                    {
                        modCom.Weight -= modSB.Weight;
                    }
                    else
                    {
                        modCom.Weight += modSB.Weight;
                    }
                    bllCom.Update(modCom);
                }
            }
        }
예제 #2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Hownet.Model.Company model)
 {
     return(dal.Add(model));
 }
예제 #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Hownet.Model.Company model)
 {
     dal.Update(model);
 }
예제 #4
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Hownet.Model.Company> DataTableToList(DataTable dt)
        {
            List <Hownet.Model.Company> modelList = new List <Hownet.Model.Company>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Hownet.Model.Company model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.Company();
                    try
                    {
                        if (dt.Rows[n]["ID"].ToString() != "")
                        {
                            model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                        }
                        else
                        {
                            model.ID = 0;
                        }
                        model.Name     = dt.Rows[n]["Name"].ToString();
                        model.Sn       = dt.Rows[n]["Sn"].ToString();
                        model.LinkMan  = dt.Rows[n]["LinkMan"].ToString();
                        model.Mabile   = dt.Rows[n]["Mabile"].ToString();
                        model.Phone    = dt.Rows[n]["Phone"].ToString();
                        model.Fax      = dt.Rows[n]["Fax"].ToString();
                        model.Email    = dt.Rows[n]["Email"].ToString();
                        model.Country  = dt.Rows[n]["Country"].ToString();
                        model.Province = dt.Rows[n]["Province"].ToString();
                        model.City     = dt.Rows[n]["City"].ToString();
                        model.Address  = dt.Rows[n]["Address"].ToString();
                        model.Remark   = dt.Rows[n]["Remark"].ToString();
                        if (dt.Rows[n]["TypeID"].ToString() != "")
                        {
                            model.TypeID = int.Parse(dt.Rows[n]["TypeID"].ToString());
                        }
                        else
                        {
                            model.TypeID = 0;
                        }
                        if (dt.Rows[n]["IsEnd"].ToString() != "")
                        {
                            model.IsEnd = int.Parse(dt.Rows[n]["IsEnd"].ToString());
                        }
                        else
                        {
                            model.IsEnd = 0;
                        }
                        if (dt.Rows[n]["IsUse"].ToString() != "")
                        {
                            if ((dt.Rows[n]["IsUse"].ToString() == "1") || (dt.Rows[n]["IsUse"].ToString().ToLower() == "true"))
                            {
                                model.IsUse = true;
                            }
                            else
                            {
                                model.IsUse = false;
                            }
                        }
                        if (dt.Rows[n]["LoanMoney"].ToString() != "")
                        {
                            model.LoanMoney = decimal.Parse(dt.Rows[n]["LoanMoney"].ToString());
                        }
                        else
                        {
                            model.LoanMoney = 0;
                        }
                        if (dt.Rows[n]["LoanDate"].ToString() != "")
                        {
                            model.LoanDate = DateTime.Parse(dt.Rows[n]["LoanDate"].ToString());
                        }
                        else
                        {
                            model.LoanDate = DateTime.Parse("1900-1-1");
                        }
                        if (dt.Rows[n]["LastMoney"].ToString() != "")
                        {
                            model.LastMoney = decimal.Parse(dt.Rows[n]["LastMoney"].ToString());
                        }
                        else
                        {
                            model.LastMoney = 0;
                        }
                        if (dt.Rows[n]["UserID"].ToString() != "")
                        {
                            model.UserID = int.Parse(dt.Rows[n]["UserID"].ToString());
                        }
                        else
                        {
                            model.UserID = 0;
                        }
                        model.BankName     = dt.Rows[n]["BankName"].ToString();
                        model.BankNO       = dt.Rows[n]["BankNO"].ToString();
                        model.BankUserName = dt.Rows[n]["BankUserName"].ToString();
                        if (dt.Rows[n]["MaxMoney"].ToString() != "")
                        {
                            model.MaxMoney = decimal.Parse(dt.Rows[n]["MaxMoney"].ToString());
                        }
                        model.County = dt.Rows[n]["County"].ToString();
                        if (dt.Rows[n]["Weight"] != null && dt.Rows[n]["Weight"].ToString() != "")
                        {
                            model.Weight = decimal.Parse(dt.Rows[n]["Weight"].ToString());
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                    model.A = int.Parse(dt.Rows[n]["A"].ToString());
                    modelList.Add(model);
                }
            }
            return(modelList);
        }