Esempio n. 1
0
        public int VerifyInDepot(int MainID, bool t, int TableTypeID)
        {
            Hownet.BLL.AmountInfo bllAI  = new AmountInfo();
            Hownet.BLL.Materiel   bllMat = new Materiel();

            Hownet.Model.ProductTaskMain   modPTM = GetModel(MainID);
            List <Hownet.Model.AmountInfo> liAI   = bllAI.DataTableToList(bllAI.GetList("(MainID=" + MainID + ") And (TableTypeID=" + TableTypeID + ")").Tables[0]);

            Hownet.BLL.Repertory   bllRe = new Repertory();
            Hownet.Model.Repertory modRe;
            Hownet.Model.Materiel  modMat = bllMat.GetModel(modPTM.MaterielID);
            int a = 0;

            if (liAI.Count > 0)
            {
                for (int i = 0; i < liAI.Count; i++)
                {
                    modRe              = new Model.Repertory();
                    modRe.Amount       = liAI[i].Amount;
                    modRe.BrandID      = modPTM.BrandID;
                    modRe.ColorID      = liAI[i].ColorID;
                    modRe.ColorOneID   = liAI[i].ColorOneID;
                    modRe.ColorTwoID   = liAI[i].ColorTwoID;
                    modRe.DepartmentID = modPTM.DeparmentID;
                    modRe.MaterielID   = modPTM.MaterielID;
                    modRe.MeasureID    = modMat.MeasureID;
                    modRe.MListID      = liAI[i].MListID;
                    modRe.SizeID       = liAI[i].SizeID;
                    bllRe.InOrOut(modRe, t);
                }
            }
            return(a);
        }
Esempio n. 2
0
        /// <summary>
        /// 审核/弃审入库单
        /// </summary>
        /// <param name="ID">入库单ID</param>
        /// <param name="t">真为审核出库,假为弃审入库</param>
        public bool CheckIsOK(int ID, bool t, int Depot)
        {
            bool _isOK = true;

            Hownet.BLL.Repertory               bllRep = new Repertory();
            Hownet.Model.Repertory             modRep = new Hownet.Model.Repertory();
            Hownet.BLL.ProduceSellOne          blPSO  = new ProduceSellOne();
            Hownet.BLL.MaterielList            bllML  = new MaterielList();
            Hownet.Model.MaterielList          modML  = new Hownet.Model.MaterielList();
            List <Hownet.Model.ProduceSellOne> li     = blPSO.DataTableToList(blPSO.GetList("(MainID=" + ID + ")").Tables[0]);

            modRep.DepartmentID = Depot;
            for (int i = 0; i < li.Count; i++)
            {
                modRep.BrandID    = modML.BrandID = li[i].BrandID;
                modRep.ColorID    = modML.ColorID = 0;
                modRep.ColorOneID = modML.ColorOneID = 0;
                modRep.ColorTwoID = modML.ColorTwoID = 0;
                modRep.SizeID     = modML.SizeID = 0;
                modRep.MaterielID = modML.MaterielID = li[i].MaterielID;
                modRep.MeasureID  = modML.MeasureID = li[i].MeasureID;
                modRep.MListID    = bllML.GetID(modML);
                if (bllRep.GetAmountByModel(modRep) < li[i].Amount)
                {
                    _isOK = false;
                    break;
                }
            }
            return(_isOK);
        }
Esempio n. 3
0
        /// <summary>
        /// 当生产计划被标记为完成等状态时,更新该生产计划库存数量到空闲库存
        /// </summary>
        /// <param name="MainID"></param>
        public void UpPlanMD(int MainID)
        {
            Hownet.BLL.Repertory          bllRep = new Repertory();
            List <Hownet.Model.Repertory> li     = bllRep.DataTableToList(bllRep.GetList("(PlanID=" + MainID + ")").Tables[0]);
            List <Hownet.Model.Repertory> ll;

            Hownet.Model.Repertory modRep = new Hownet.Model.Repertory();
            if (li.Count > 0)
            {
                for (int i = 0; i < li.Count; i++)
                {
                    if (li[i].Amount > 0)
                    {
                        ll = bllRep.DataTableToList(bllRep.GetList("(PlanID=0) And (DepartmentID=" + li[i].DepartmentID + ") And (MListID=" + li[i].MListID + ")").Tables[0]);
                        if (ll.Count > 0)
                        {
                            ll[0].Amount += li[i].Amount;
                            bllRep.Update(ll[0]);
                        }
                        else
                        {
                            modRep        = bllRep.GetModel(li[i].ID);
                            modRep.PlanID = 0;
                            bllRep.Add(modRep);
                        }
                        li[i].Amount = 0;
                        bllRep.Update(li[i]);
                    }
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="MainID"></param>
        /// <param name="t">真为审核,假为弃审</param>
        public void Verify(int MainID, bool t)
        {
            Hownet.BLL.ProduceSell               bllPS = new ProduceSell();
            Hownet.Model.ProduceSell             modPS = bllPS.GetModel(MainID);
            Hownet.BLL.MaterielList              bllML = new MaterielList();
            Hownet.Model.MaterielList            modML = new Hownet.Model.MaterielList();
            Hownet.BLL.Repertory                 bllRe = new Repertory();
            Hownet.Model.Repertory               modRe = new Hownet.Model.Repertory();
            List <Hownet.Model.WMSInventoryInfo> li    = GetModelList("(MainID=" + MainID + ")");

            if (li.Count > 0)
            {
                for (int i = 0; i < li.Count; i++)
                {
                    if (li[i].RepertoryID > 0)
                    {
                        modRe        = bllRe.GetModel(li[i].RepertoryID);
                        modRe.Amount = li[i].NowAmount;
                        bllRe.Update(modRe);
                    }
                    else
                    {
                        modRe              = new Hownet.Model.Repertory();
                        modML              = new Hownet.Model.MaterielList();
                        modRe.BrandID      = modML.BrandID = li[i].BrandID;
                        modRe.ColorID      = modML.ColorID = li[i].ColorID;
                        modRe.ColorOneID   = modML.ColorOneID = li[i].ColorOneID;
                        modRe.ColorTwoID   = modML.ColorTwoID = li[i].ColorTwoID;
                        modRe.CompanyID    = li[i].CompanyID;
                        modRe.DepartmentID = modPS.Depot;
                        modRe.MaterielID   = modML.MaterielID = li[i].MaterielID;
                        modRe.MeasureID    = modML.MeasureID = li[i].MeasureID;
                        modRe.SizeID       = modML.SizeID = li[i].SizeID;
                        modRe.MListID      = li[i].MListID = bllML.GetID(modML);
                        modRe.Amount       = li[i].NowAmount;
                        li[i].RepertoryID  = bllRe.Add(modRe);
                        Update(li[i]);
                    }
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 审核/弃审入库单
        /// </summary>
        /// <param name="ID">入库单ID</param>
        /// <param name="t">真为审核出库,假为弃审入库</param>
        public void VerifyProcess(int ID, bool t, int Depot)
        {
            Hownet.BLL.Repertory               bllRep = new Repertory();
            Hownet.Model.Repertory             modRep = new Hownet.Model.Repertory();
            Hownet.BLL.ProduceSellOne          blPSO  = new ProduceSellOne();
            Hownet.BLL.MaterielList            bllML  = new MaterielList();
            Hownet.Model.MaterielList          modML  = new Hownet.Model.MaterielList();
            List <Hownet.Model.ProduceSellOne> li     = blPSO.DataTableToList(blPSO.GetList("(MainID=" + ID + ")").Tables[0]);

            modRep.DepartmentID = Depot;
            for (int i = 0; i < li.Count; i++)
            {
                modRep.BrandID    = modML.BrandID = li[i].BrandID;
                modRep.ColorID    = modML.ColorID = 0;
                modRep.ColorOneID = modML.ColorOneID = 0;
                modRep.ColorTwoID = modML.ColorTwoID = 0;
                modRep.SizeID     = modML.SizeID = 0;
                modRep.MaterielID = modML.MaterielID = li[i].MaterielID;
                modRep.Amount     = li[i].Amount;
                modRep.MeasureID  = modML.MeasureID = li[i].MeasureID;
                modRep.MListID    = bllML.GetID(modML);
                bllRep.InOrOut(modRep, !t);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 审核/弃审入库单
        /// </summary>
        /// <param name="ID">入库单ID</param>
        /// <param name="t">真为审核出库,假为弃审入库</param>
        public void Verify(int ID, bool t, int Depot)
        {
            Hownet.BLL.ProduceSellInfo bllPSI = new ProduceSellInfo();
            Hownet.BLL.Repertory       bllRep = new Repertory();
            Hownet.BLL.MaterielList    bllML  = new MaterielList();
            Hownet.BLL.RepertoryList   bllRL  = new RepertoryList();
            Hownet.Model.RepertoryList modRL  = new Model.RepertoryList();
            //Hownet.BLL.Measure bllMea = new Measure();
            Hownet.Model.Repertory              modRep = new Hownet.Model.Repertory();
            Hownet.Model.MaterielList           modML  = new Hownet.Model.MaterielList();
            List <Hownet.Model.ProduceSellInfo> li     = bllPSI.DataTableToList(bllPSI.GetList("(MainID=" + ID + ")").Tables[0]);

            Hownet.BLL.AmountInfo   bllAI = new AmountInfo();
            Hownet.Model.AmountInfo modAI;
            Hownet.BLL.OtherType    bllOT = new OtherType();
            DataTable dtOT      = bllOT.GetList("(Name='仓储单位')").Tables[0];
            int       measureid = 0;

            if (dtOT.Rows.Count > 0)
            {
                measureid = Convert.ToInt32(dtOT.Rows[0]["Value"]);
            }
            //DataTable dt = bllMea.GetList("(Name='件')").Tables[0];
            //if (dt.Rows.Count > 0)
            //    modRep.MeasureID = int.Parse(dt.Rows[0]["ID"].ToString());
            //else
            //    modRep.MeasureID = 0;
            for (int i = 0; i < li.Count; i++)
            {
                try
                {
                    modAI             = bllAI.GetModel(li[i].SalesInfoID);
                    modRep.BrandID    = modML.BrandID = li[i].BrandID;
                    modRep.ColorID    = modML.ColorID = li[i].ColorID;
                    modRep.ColorOneID = modML.ColorOneID = li[i].ColorOneID;
                    modRep.ColorTwoID = modML.ColorTwoID = li[i].ColorTwoID;
                    modRep.SizeID     = modML.SizeID = li[i].SizeID;
                    if (measureid > 0)
                    {
                        modRep.MeasureID = modML.MeasureID = measureid;
                    }
                    else
                    {
                        modRep.MeasureID = modML.MeasureID = li[i].MeasureID;
                    }
                    modRep.MaterielID   = modML.MaterielID = li[i].MaterielID;
                    modRep.Amount       = li[i].Amount;
                    modRep.DepartmentID = Depot;

                    if (li[i].MListID == 0)
                    {
                        modRep.MListID = li[i].MListID = bllML.GetID(modML);
                        bllPSI.Update(li[i]);
                    }
                    else
                    {
                        modRep.MListID = li[i].MListID;
                    }

                    if (li[i].RepertoryID == 0)
                    {
                        if (Depot > 0)
                        {
                            bllRep.InOrOut(modRep, !t);
                        }
                    }
                    if (li[i].RepertoryID > 0)
                    {
                        modRep = bllRep.GetModel(li[i].RepertoryID);
                        if (t)
                        {
                            modRep.Amount -= li[i].Amount;
                        }
                        else
                        {
                            modRep.Amount += li[i].Amount;
                        }
                        bllRep.Update(modRep);
                    }

                    if (li[i].RepertoryListID > 0)
                    {
                        modRL = bllRL.GetModel(li[i].RepertoryListID);
                        if (t)
                        {
                            modRL.Amount -= li[i].Amount;
                        }
                        else
                        {
                            modRL.Amount += li[i].Amount;
                        }
                        bllRL.Update(modRL);
                    }
                    if (modAI != null)
                    {
                        modAI.NotAmount = Convert.ToInt32(li[i].Amount);
                        bllAI.UpNotAmount(modAI, t);
                    }
                }

                catch (Exception ex)
                {
                }
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 审核/弃审入库单
        /// </summary>
        /// <param name="ID">入库单ID</param>
        /// <param name="t">真为审核入库,假为弃审出库</param>
        public void Verify(int ID, bool t, int VerifyMan, int DepotID, int TypeID)
        {
            if (TypeID == (int)Enums.TableType.P2D)
            {
                try
                {
                    Hownet.BLL.Product2DepotInfo bllP2DI = new Product2DepotInfo();
                    Hownet.BLL.AmountInfo        bllAI   = new AmountInfo();
                    Hownet.BLL.Repertory         bllRep  = new Repertory();
                    Hownet.BLL.MaterielList      bllML   = new MaterielList();
                    Hownet.BLL.Materiel          bllMat  = new Materiel();
                    Hownet.Model.AmountInfo      modAI   = new Hownet.Model.AmountInfo();
                    Hownet.Model.Repertory       modRep  = new Model.Repertory();
                    Hownet.Model.MaterielList    modML   = new Hownet.Model.MaterielList();
                    Hownet.BLL.RepertoryList     bllRL   = new RepertoryList();
                    Hownet.Model.RepertoryList   modRL   = new Model.RepertoryList();
                    DataTable dtRL = new DataTable();
                    Hownet.Model.Product2Depot modP2D = GetModel(ID);
                    DataTable dtP2DI = bllP2DI.GetList("(MainID=" + ID + ")").Tables[0];
                    List <Hownet.Model.Product2DepotInfo> li = bllP2DI.DataTableToList(bllP2DI.GetList("(MainID=" + ID + ")").Tables[0]);
                    modAI.TableTypeID = 1;
                    Hownet.BLL.OtherType bllOT = new Hownet.BLL.OtherType();
                    DataTable            dtOT  = bllOT.GetTypeList("成品单位").Tables[0];
                    decimal one = 1;
                    decimal two = 1;
                    int     dM  = 0;

                    if (dtOT.Rows.Count > 0)
                    {
                        one = Convert.ToDecimal(dtOT.Select("(Name='车间换算')")[0]["Value"]);
                        two = Convert.ToDecimal(dtOT.Select("(Name='仓储换算')")[0]["Value"]);
                        dM  = Convert.ToInt32(dtOT.Select("(Name='仓储单位')")[0]["Value"]);
                    }


                    for (int i = 0; i < li.Count; i++)
                    {
                        modRep = new Model.Repertory();
                        modRep.DepartmentID = DepotID;
                        modRep.BrandName    = modRep.ColorName = modRep.ColorOneName = modRep.ColorTwoName = modRep.CompanyName = modRep.DeparmentName = modRep.DepotInfoName = modRep.MaterielName = modRep.MeasureName = modRep.Remark = modRep.SizeName = modRep.SpecName = modRep.SupplierName = modRep.SupplierSN = string.Empty;

                        modRep.BrandID    = modML.BrandID = li[i].BrandID;
                        modRep.ColorID    = modML.ColorID = li[i].ColorID;
                        modRep.ColorOneID = modML.ColorOneID = li[i].ColorOneID;
                        modRep.ColorTwoID = modML.ColorTwoID = li[i].ColorTwoID;
                        modRep.SizeID     = modML.SizeID = li[i].SizeID;
                        modRep.MaterielID = modML.MaterielID = li[i].MaterielID;
                        modRep.MeasureID  = modML.MeasureID = bllMat.GetModel(li[i].MaterielID).MeasureID;
                        modAI.MainID      = li[i].TaskID;
                        modRep.Amount     = modAI.NotAmount = li[i].Amount;
                        modRep.MListID    = modAI.MListID = li[i].MListID;
                        if (li[i].MListID == 0)
                        {
                            modAI.MListID = li[i].MListID = bllML.GetID(modML);
                            bllP2DI.Update(li[i]);
                            if (dM > 0)
                            {
                                modML.MeasureID = dM;
                            }
                            modRep.MListID = bllML.GetID(modML);
                        }
                        else
                        {
                            if (dM > 0)
                            {
                                modML.MeasureID = dM;
                            }
                            modRep.MListID = bllML.GetID(modML);
                        }
                        if (li[i].TaskID > 0)
                        {
                            if (t)
                            {
                                if (one > 1 || two > 1)
                                {
                                    modAI.Amount -= ((int)(li[i].Amount * two / one));
                                }
                                else
                                {
                                    modAI.Amount -= li[i].Amount;
                                }
                                if (modAI.Amount < 0)
                                {
                                    modAI.Amount = 0;
                                }
                            }
                            else
                            {
                                if (one > 1 || two > 1)
                                {
                                    modAI.Amount += ((int)(li[i].Amount * two / one));
                                }
                                else
                                {
                                    modAI.Amount += li[i].Amount;
                                }
                            }


                            bllAI.UpNotAmount(modAI, t);
                        }
                        if (dM > 0)
                        {
                            modRep.MeasureID = dM;
                        }
                        else
                        {
                            modRep.MeasureID = modML.MeasureID;
                        }
                        modRep.ID = bllRep.InOrOut(modRep, t);
                        if (li[i].DepotInfoID > 0)
                        {
                            dtRL = bllRL.GetList("(BatchNumber=" + li[i].MListID + ") And (DepotInfoID=" + li[i].DepotInfoID + ")").Tables[0];

                            if (dtRL.Rows.Count == 0)
                            {
                                if (t)
                                {
                                    modRL               = new Model.RepertoryList();
                                    modRL.A             = 1;
                                    modRL.NotAmount     = modRL.Amount = li[i].Amount;
                                    modRL.BatchNumber   = li[i].MListID;
                                    modRL.DateTime      = DateTime.Now;
                                    modRL.DepotInfoID   = li[i].DepotInfoID;
                                    modRL.DepotInfoName = string.Empty;
                                    modRL.ID            = 0;
                                    modRL.IsEnd         = false;
                                    modRL.MainID        = modRep.ID;
                                    modRL.PlanID        = 0;
                                    modRL.QRID          = li[i].MListID.ToString();
                                    modRL.Remark        = string.Empty;
                                    modRL.SpecID        = 0;
                                    modRL.SpecName      = string.Empty;
                                    modRL.StockListID   = 0;
                                    bllRL.Add(modRL);
                                }
                            }
                            else if (dtRL.Rows.Count == 1)
                            {
                                modRL = bllRL.GetModel(Convert.ToInt32(dtRL.Rows[0]["ID"]));
                                if (t)
                                {
                                    modRL.Amount += li[i].Amount;
                                }
                                else
                                {
                                    modRL.Amount -= li[i].Amount;
                                }
                                bllRL.Update(modRL);
                            }
                            else if (dtRL.Rows.Count > 1)
                            {
                                List <Hownet.Model.RepertoryList> liRL = bllRL.DataTableToList(dtRL);
                                for (int j = 1; j < liRL.Count; j++)
                                {
                                    liRL[0].Amount += liRL[j].Amount;
                                    bllRL.Delete(liRL[j].ID);
                                }
                                if (t)
                                {
                                    liRL[0].Amount += li[i].Amount;
                                }
                                else
                                {
                                    liRL[0].Amount -= li[i].Amount;
                                }
                                bllRL.Update(liRL[0]);
                            }
                        }
                    }
                    if (t)
                    {
                        modP2D.IsVerify   = 3;
                        modP2D.VerifyDate = DateTime.Today;
                        modP2D.VerifyMan  = VerifyMan;
                    }
                    else
                    {
                        modP2D.IsVerify   = 1;
                        modP2D.VerifyDate = DateTime.Parse("1900-1-1");
                        modP2D.VerifyMan  = 0;
                    }
                    Update(modP2D);
                }
                catch (Exception ex)
                {
                }
            }
            else if (TypeID == (int)Enums.TableType.P2Pack)
            {
                try
                {
                    Hownet.BLL.Product2DepotInfo bllP2DI = new Product2DepotInfo();
                    Hownet.BLL.AmountInfo        bllAI   = new AmountInfo();
                    Hownet.BLL.PackAmount        bllPA   = new PackAmount();
                    Hownet.BLL.MaterielList      bllML   = new MaterielList();
                    Hownet.BLL.Materiel          bllMat  = new Materiel();
                    Hownet.Model.AmountInfo      modAI   = new Hownet.Model.AmountInfo();
                    Hownet.Model.PackAmount      modPA   = new Hownet.Model.PackAmount();
                    Hownet.Model.MaterielList    modML   = new Hownet.Model.MaterielList();
                    Hownet.Model.Product2Depot   modP2D  = GetModel(ID);
                    Hownet.BLL.OtherType         bllOT   = new OtherType();
                    DataTable dtOT          = bllOT.GetTypeList("成品单位").Tables[0];
                    int       TaskMeasureID = 0;
                    DataRow[] drs           = dtOT.Select("(Name='车间单位')");
                    if (drs.Length == 1)
                    {
                        TaskMeasureID = Convert.ToInt32(drs[0]["Value"]);
                    }
                    List <Hownet.Model.Product2DepotInfo> li = bllP2DI.DataTableToList(bllP2DI.GetList("(MainID=" + ID + ")").Tables[0]);
                    modAI.TableTypeID  = 1;
                    modPA.DepartmentID = DepotID;
                    for (int i = 0; i < li.Count; i++)
                    {
                        if (li[i].MaterielID > 0)
                        {
                            modPA.BrandID    = modML.BrandID = li[i].BrandID;
                            modPA.ColorID    = modML.ColorID = li[i].ColorID;
                            modPA.ColorOneID = modML.ColorOneID = li[i].ColorOneID;
                            modPA.ColorTwoID = modML.ColorTwoID = li[i].ColorTwoID;
                            modPA.SizeID     = modML.SizeID = li[i].SizeID;
                            modPA.MaterielID = modML.MaterielID = li[i].MaterielID;
                            modML.MeasureID  = bllMat.GetModel(li[i].MaterielID).MeasureID;
                            if (TaskMeasureID > 0)
                            {
                                modPA.MeasureID = TaskMeasureID;
                            }
                            else
                            {
                                modPA.MeasureID = modML.MeasureID;
                            }
                            modAI.MainID = li[i].TaskID;
                            modPA.PlanID = li[i].TaskID;
                            modPA.Remark = string.Empty;
                            modPA.Amount = modAI.NotAmount = li[i].Amount;

                            if (li[i].ColorID > 0 && li[i].SizeID > 0)
                            {
                                if (li[i].MListID == 0)
                                {
                                    modAI.MListID = modPA.MListID = li[i].MListID = bllML.GetID(modML);
                                    bllP2DI.Update(li[i]);
                                }
                                else
                                {
                                    modAI.MListID = modPA.MListID = li[i].MListID;
                                }
                                bllAI.UpNotAmount(modAI, t);
                                bllPA.InOrOut(modPA, t);
                            }
                        }
                        else
                        {
                            bllP2DI.Delete(li[i].ID);
                        }
                    }
                    if (t)
                    {
                        modP2D.IsVerify   = 3;
                        modP2D.VerifyDate = DateTime.Today;
                        modP2D.VerifyMan  = VerifyMan;
                    }
                    else
                    {
                        modP2D.IsVerify   = 1;
                        modP2D.VerifyDate = DateTime.Parse("1900-1-1");
                        modP2D.VerifyMan  = 0;
                    }
                    Update(modP2D);
                }
                catch (Exception ex)
                {
                }
            }
        }
Esempio n. 8
0
 public int MDPP(int MainID)
 {
     try
     {
         Hownet.BLL.MaterielDemand bllMD  = new MaterielDemand();
         Hownet.BLL.Repertory      bllRep = new Repertory();
         DataTable dt = dal.GetPPMDList(MainID).Tables[0];
         List <Hownet.Model.MaterielDemand> li = bllMD.DataTableToList(bllMD.GetList("(ProduceTaskID=" + MainID + ") And (TableTypeID=41)").Tables[0]);
         for (int i = 0; i < li.Count; i++)
         {
             for (int j = 0; j < dt.Rows.Count; j++)
             {
                 if (li[i].MListID == Convert.ToInt32(dt.Rows[j]["MListID"]))
                 {
                     li[i].RepertoryAmount += Convert.ToDecimal(dt.Rows[j]["RepertoryAmount"]);
                     bllMD.Update(li[i]);
                     break;
                 }
             }
         }
         dal.UpPPMDList(MainID);
         List <Hownet.Model.Repertory> liRe = bllRep.DataTableToList(bllRep.GetList("(PlanID=" + MainID + ")").Tables[0]);
         DataTable dtRep = bllRep.GetPPList(MainID).Tables[0];
         Hownet.Model.Repertory modRe = new Hownet.Model.Repertory();
         bool t = false;
         for (int i = 0; i < dtRep.Rows.Count; i++)
         {
             t = false;
             for (int j = 0; j < liRe.Count; j++)
             {
                 if (liRe[j].MListID == Convert.ToInt32(dtRep.Rows[i]["MListID"]) && liRe[j].DepartmentID == Convert.ToInt32(dtRep.Rows[i]["DepartmentID"]))
                 {
                     liRe[j].Amount += Convert.ToDecimal(dtRep.Rows[i]["Amount"]);
                     t = true;
                     break;
                 }
             }
             if (!t)
             {
                 modRe              = new Hownet.Model.Repertory();
                 modRe.A            = 3;
                 modRe.Amount       = Convert.ToDecimal(dtRep.Rows[i]["Amount"]);
                 modRe.BrandID      = Convert.ToInt32(dtRep.Rows[i]["BrandID"]);
                 modRe.ColorID      = Convert.ToInt32(dtRep.Rows[i]["ColorID"]);
                 modRe.ColorOneID   = Convert.ToInt32(dtRep.Rows[i]["ColorOneID"]);
                 modRe.ColorTwoID   = Convert.ToInt32(dtRep.Rows[i]["ColorTwoID"]);
                 modRe.CompanyID    = 0;
                 modRe.DepartmentID = Convert.ToInt32(dtRep.Rows[i]["DepartmentID"]);
                 modRe.ID           = 0;
                 modRe.MaterielID   = Convert.ToInt32(dtRep.Rows[i]["MaterielID"]);
                 modRe.MeasureID    = Convert.ToInt32(dtRep.Rows[i]["MeasureID"]);
                 modRe.MListID      = Convert.ToInt32(dtRep.Rows[i]["MListID"]);
                 modRe.PlanID       = MainID;
                 modRe.Remark       = string.Empty;
                 modRe.SizeID       = Convert.ToInt32(dtRep.Rows[i]["SizeID"]);
                 modRe.ID           = bllRep.Add(modRe);
                 liRe.Add(modRe);
             }
         }
         bllRep.DelPPList(MainID);
         return(1);
     }
     catch
     {
         return(0);
     }
 }
Esempio n. 9
0
        public void Verify(int MainID, bool IsVerify)
        {
            Hownet.BLL.Pack2DepotMain          bllPDM = new Pack2DepotMain();
            Hownet.Model.Pack2DepotMain        modPDM = bllPDM.GetModel(MainID);
            List <Hownet.Model.Pack2DepotInfo> li     = DataTableToList(GetList("(MainID=" + MainID + ")").Tables[0]);

            Hownet.BLL.Repertory       bllRep = new Repertory();
            Hownet.BLL.PackAmount      bllPA  = new PackAmount();
            Hownet.BLL.RepertoryList   bllRL  = new RepertoryList();
            Hownet.BLL.MaterielList    bllML  = new MaterielList();
            Hownet.Model.MaterielList  modML  = new Model.MaterielList();
            Hownet.Model.RepertoryList modRL  = new Model.RepertoryList();
            DataTable dtRL = new DataTable();

            Hownet.Model.PackAmount modPA  = new Hownet.Model.PackAmount();
            Hownet.Model.Repertory  modRep = new Hownet.Model.Repertory();
            modRep.BrandName = modRep.ColorName = modRep.ColorOneName = modRep.ColorTwoName = modRep.CompanyName = modRep.DeparmentName = modRep.DepotInfoName = modRep.MaterielName = modRep.MeasureName = modRep.Remark = modRep.SizeName = modRep.SpecName = modRep.SupplierName = modRep.SupplierSN = string.Empty;

            Hownet.BLL.OtherType bllOT = new Hownet.BLL.OtherType();
            DataTable            dtOT  = bllOT.GetTypeList("成品单位").Tables[0];
            decimal one = 1;
            decimal two = 1;
            int     dM  = 0;

            if (dtOT.Rows.Count > 0)
            {
                one = Convert.ToDecimal(dtOT.Select("(Name='车间换算')")[0]["Value"]);
                two = Convert.ToDecimal(dtOT.Select("(Name='仓储换算')")[0]["Value"]);
                dM  = Convert.ToInt32(dtOT.Select("(Name='仓储单位')")[0]["Value"]);
            }
            try
            {
                for (int i = 0; i < li.Count; i++)
                {
                    modPA = bllPA.GetModel(li[i].PackAmountID);
                    if (IsVerify)
                    {
                        if (one > 1 || two > 1)
                        {
                            if (one > 0)
                            {
                                modPA.Amount -= ((int)(li[i].NowAmount * two / one));
                            }
                        }
                        else
                        {
                            modPA.Amount -= li[i].NowAmount;
                        }
                        if (modPA.Amount < 0)
                        {
                            modPA.Amount = 0;
                        }
                    }
                    else
                    {
                        if (one > 1 || two > 1)
                        {
                            if (one > 0)
                            {
                                modPA.Amount += ((int)(li[i].NowAmount * two / one));
                            }
                        }
                        else
                        {
                            modPA.Amount += li[i].NowAmount;
                        }
                    }
                    bllPA.Update(modPA);

                    modRep           = new Hownet.Model.Repertory();
                    modRep.BrandName = modRep.ColorName = modRep.ColorOneName = modRep.ColorTwoName = modRep.CompanyName = modRep.DeparmentName = modRep.DepotInfoName = modRep.MaterielName = modRep.MeasureName = modRep.Remark = modRep.SizeName = modRep.SpecName = modRep.SupplierName = modRep.SupplierSN = string.Empty;

                    modRep.DepartmentID = modPDM.DepotID;
                    modRep.BrandID      = modML.BrandID = li[i].BrandID;
                    modRep.ColorID      = modML.ColorID = li[i].ColorID;
                    modRep.ColorOneID   = modML.ColorOneID = li[i].ColorOneID;
                    modRep.ColorTwoID   = modML.ColorTwoID = li[i].ColorTwoID;
                    modRep.SizeID       = modML.SizeID = li[i].SizeID;
                    modRep.MaterielID   = modML.MaterielID = li[i].MaterielID;
                    if (dM > 0)
                    {
                        modRep.MeasureID = dM;
                    }
                    else
                    {
                        modRep.MeasureID = li[i].MeasureID;
                    }
                    modML.MeasureID = modRep.MeasureID;
                    modRep.Amount   = li[i].NowAmount;
                    modRep.MListID  = li[i].MListID;
                    if (li[i].DepotBrandID > 0)
                    {
                        modRep.BrandID = modML.BrandID = li[i].DepotBrandID;
                        modRep.MListID = bllML.GetID(modML);
                    }
                    modRep.ID = bllRep.InOrOut(modRep, IsVerify);
                    if (li[i].DepotInfoID > 0)
                    {
                        dtRL = bllRL.GetList("(BatchNumber=" + li[i].MListID + ") And (DepotInfoID=" + li[i].DepotInfoID + ")").Tables[0];

                        if (dtRL.Rows.Count == 0)
                        {
                            if (IsVerify)
                            {
                                modRL               = new Model.RepertoryList();
                                modRL.A             = 1;
                                modRL.NotAmount     = modRL.Amount = li[i].NowAmount;
                                modRL.BatchNumber   = li[i].MListID;
                                modRL.DateTime      = DateTime.Now;
                                modRL.DepotInfoID   = li[i].DepotInfoID;
                                modRL.DepotInfoName = string.Empty;
                                modRL.ID            = 0;
                                modRL.IsEnd         = false;
                                modRL.MainID        = modRep.ID;
                                modRL.PlanID        = 0;
                                modRL.QRID          = li[i].MListID.ToString();
                                modRL.Remark        = string.Empty;
                                modRL.SpecID        = 0;
                                modRL.SpecName      = string.Empty;
                                modRL.StockListID   = 0;
                                bllRL.Add(modRL);
                            }
                        }
                        else if (dtRL.Rows.Count == 1)
                        {
                            modRL = bllRL.GetModel(Convert.ToInt32(dtRL.Rows[0]["ID"]));
                            if (IsVerify)
                            {
                                modRL.Amount += li[i].NowAmount;
                            }
                            else
                            {
                                modRL.Amount -= li[i].NowAmount;
                            }
                            bllRL.Update(modRL);
                        }
                        else if (dtRL.Rows.Count > 1)
                        {
                            List <Hownet.Model.RepertoryList> liRL = bllRL.DataTableToList(dtRL);
                            for (int j = 1; j < liRL.Count; j++)
                            {
                                liRL[0].Amount += liRL[j].Amount;
                                bllRL.Delete(liRL[j].ID);
                            }
                            if (IsVerify)
                            {
                                liRL[0].Amount += li[i].NowAmount;
                            }
                            else
                            {
                                liRL[0].Amount -= li[i].NowAmount;
                            }
                            bllRL.Update(liRL[0]);
                        }
                    }
                }
                if (!IsVerify)
                {
                    modPDM.IsVerify   = 1;
                    modPDM.VerifyDate = Convert.ToDateTime("1900-1-1");
                    modPDM.VerifyMan  = 0;
                    bllPDM.Update(modPDM);
                }
            }
            catch (Exception ex)
            {
            }
        }
Esempio n. 10
0
 /// <summary>
 /// 审核外协来料单
 /// </summary>
 /// <param name="MainID"></param>
 /// <param name="IsVerify"></param>
 /// <param name="VerifyManID"></param>
 /// <returns></returns>
 public int VerifyWXIn(int MainID, bool IsVerify, int VerifyManID)
 {
     try
     {
         Hownet.Model.StockBack modSB = GetModel(MainID);
         if (IsVerify)
         {
             modSB.IsVerify   = 3;
             modSB.VerifyDate = DateTime.Now;
             modSB.VerifyMan  = VerifyManID;
         }
         else
         {
             modSB.IsVerify   = 1;
             modSB.VerifyDate = Convert.ToDateTime("1900-1-1");
             modSB.VerifyMan  = 0;
         }
         Update(modSB);
         Hownet.BLL.StockBackInfo          bllSBI = new StockBackInfo();
         Hownet.BLL.MaterielList           bllML  = new MaterielList();
         Hownet.Model.MaterielList         modML  = new Hownet.Model.MaterielList();
         Hownet.Model.StockBackInfo        modSBI;
         List <Hownet.Model.StockBackInfo> li = bllSBI.DataTableToList(bllSBI.GetList("(MainID=" + modSB.ID + ")").Tables[0]);
         Hownet.BLL.Repertory   bllR          = new Repertory();
         Hownet.Model.Repertory modR;
         if (li.Count > 0)
         {
             for (int i = 0; i < li.Count; i++)
             {
                 if (li[i].StockInfoID > 0)
                 {
                     modSBI = bllSBI.GetModel(li[i].StockInfoID);
                     if (IsVerify)
                     {
                         modSBI.NotPriceAmount += li[i].Amount;
                         modSBI.NotAmount      -= li[i].Amount;
                     }
                     else
                     {
                         modSBI.NotPriceAmount -= li[i].Amount;
                         modSBI.NotAmount      += li[i].Amount;
                     }
                     li[i].NotPriceAmount = modSBI.NotPriceAmount;
                     li[i].NotAmount      = modSBI.NotAmount;
                     bllSBI.Update(li[i]);
                     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;
                     modML.SpecID     = 0;
                     li[i].MListID    = bllML.GetID(modML);
                     bllSBI.Update(li[i]);
                 }
                 modR               = new Hownet.Model.Repertory();
                 modR.Amount        = li[i].Amount;
                 modR.MListID       = li[i].MListID;
                 modR.MeasureID     = li[i].CompanyMeasureID;
                 modR.DepartmentID  = modSB.DepotID;
                 modR.BrandID       = li[i].BrandID;
                 modR.BrandName     = li[i].BrandName;
                 modR.ColorID       = li[i].ColorID;
                 modR.ColorName     = li[i].ColorName;
                 modR.ColorOneID    = li[i].ColorOneID;
                 modR.ColorOneName  = li[i].ColorOneName;
                 modR.ColorTwoID    = li[i].ColorTwoID;
                 modR.ColorTwoName  = li[i].ColorTwoName;
                 modR.CompanyID     = li[i].CompanyID;
                 modR.CompanyName   = string.Empty;
                 modR.DeparmentName = string.Empty;
                 modR.DepartmentID  = modSB.DepotID;
                 modR.DepotInfoID   = 0;
                 modR.DepotInfoName = string.Empty;
                 modR.ID            = 0;
                 modR.MaterielID    = li[i].MaterielID;
                 modR.MaterielName  = li[i].MaterielName;
                 modR.MeasureName   = string.Empty;
                 modR.PlanID        = 0;
                 modR.Remark        = string.Empty;
                 modR.SizeID        = li[i].SizeID;
                 modR.SizeName      = li[i].SizeName;
                 modR.SpecID        = li[i].SpecID;
                 modR.SpecName      = li[i].SpecName;
                 modR.SupplierID    = 0;
                 modR.SupplierName  = string.Empty;
                 modR.SupplierSN    = string.Empty;
                 bllR.InOrOut(modR, IsVerify);
             }
         }
         return(1);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
Esempio n. 11
0
 /// <summary>
 /// 审核外协领料单
 /// </summary>
 /// <param name="MainID"></param>
 /// <param name="IsVerify">真为入库,假为出库</param>
 /// <param name="VerifyManID"></param>
 /// <returns></returns>
 public int VerifyWXOut(int MainID, bool IsVerify, int VerifyManID)
 {
     try
     {
         Hownet.Model.StockBack modSB = GetModel(MainID);
         if (IsVerify)
         {
             modSB.IsVerify   = 3;
             modSB.VerifyDate = DateTime.Now;
             modSB.VerifyMan  = VerifyManID;
         }
         else
         {
             modSB.IsVerify   = 1;
             modSB.VerifyDate = Convert.ToDateTime("1900-1-1");
             modSB.VerifyMan  = 0;
         }
         Update(modSB);
         Hownet.BLL.StockBackInfo          bllSBI = new StockBackInfo();
         Hownet.Model.StockBackInfo        modSBI;
         List <Hownet.Model.StockBackInfo> li = bllSBI.DataTableToList(bllSBI.GetList("(MainID=" + modSB.ID + ")").Tables[0]);
         Hownet.BLL.Repertory   bllR          = new Repertory();
         Hownet.Model.Repertory modR;
         if (li.Count > 0)
         {
             for (int i = 0; i < li.Count; i++)
             {
                 if (li[i].StockInfoID > 0)
                 {
                     modSBI = bllSBI.GetModel(li[i].StockInfoID);
                     if (IsVerify)
                     {
                         modSBI.NotPriceAmount += li[i].Amount;
                         modSBI.NotAmount      -= li[i].Amount;
                     }
                     else
                     {
                         modSBI.NotPriceAmount -= li[i].Amount;
                         modSBI.NotAmount      += li[i].Amount;
                     }
                     li[i].NotPriceAmount = modSBI.NotPriceAmount;
                     li[i].NotAmount      = modSBI.NotAmount;
                     bllSBI.Update(li[i]);
                     bllSBI.Update(modSBI);
                 }
                 if (li[i].DemandID > 0)
                 {
                     modR = bllR.GetModel(li[i].DemandID);
                     if (IsVerify)
                     {
                         modR.Amount -= li[i].Amount;
                         if (modR.Amount < 0)
                         {
                             modR.Amount = 0;
                         }
                     }
                     else
                     {
                         modR.Amount += li[i].Amount;
                     }
                     bllR.Update(modR);
                 }
             }
         }
         return(1);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
Esempio n. 12
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);
                }
            }
        }
Esempio n. 13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="MListID"></param>
 /// <param name="DemandID"></param>
 /// <param name="StockInfoID"></param>
 /// <param name="Amount"></param>
 /// <param name="TypeID"></param>
 /// <param name="TaskID"></param>
 /// <param name="RelatedID"></param>
 /// <param name="t">真的添加记录,假为删除记录</param>
 public void UpAmount(int MListID, int DemandID, int StockInfoID, decimal Amount, int TypeID, int TaskID, int RelatedID, bool t, int DepotID)
 {
     #region 使用原仓存
     if (TypeID == (int)Hownet.BLL.BaseFile.MaterielDemandClass.PlanUseRep.使用原仓存)
     {
         if (t)
         {
             //查看之前使用库存的记录,将本次使用原仓存的数更新到数据表。
             Hownet.BLL.Repertory        bllRep = new Repertory();
             Hownet.BLL.MaterielDemand   bllMD  = new MaterielDemand();
             Hownet.Model.Repertory      modRep = bllRep.GetModel(RelatedID); //需要转出的空闲物料
             Hownet.Model.MaterielDemand modMD  = bllMD.GetModel(DemandID);
             modRep.Amount = modRep.Amount - Amount;                          //扣掉有使用的空余数量
             bllRep.Update(modRep);
             modMD.RepertoryAmount += Amount;                                 //更新物料拆分表的已备料数量
             bllMD.Update(modMD);
             //是否此前有本计划单的备料
             DataTable dt = bllRep.GetList("(MListID=" + MListID + ") And  (PlanID=" + TaskID + ") And (DepartmentID=" + DepotID + ")").Tables[0];
             if (dt.Rows.Count > 0)
             {
                 //已有,则加上本次数量
                 dt.Rows[0]["Amount"] = Convert.ToDecimal(dt.Rows[0]["Amount"]) + Amount;
                 bllRep.UpdateByDt(dt);
             }
             else
             {
                 //没有则插入此数量
                 modRep.Amount       = Amount;
                 modRep.PlanID       = TaskID;
                 modRep.DepartmentID = DepotID;
                 bllRep.Add(modRep);
             }
         }
         else
         {
         }
     }
     #endregion
     #region 已申购数量
     else if (TypeID == (int)Hownet.BLL.BaseFile.MaterielDemandClass.PlanUseRep.已申购数量)
     {
         if (t)
         {
             //更新这个生产计划中该物料的已申购数量
             DataTable dt = GetList("(StockInfoID=" + StockInfoID + ") And (TypeID=" + (int)Hownet.BLL.BaseFile.MaterielDemandClass.PlanUseRep.已申购数量 + ")").Tables[0];
             if (dt.Rows.Count > 0)
             {
                 dt.Rows[0]["Amount"]    = Convert.ToDecimal(dt.Rows[0]["Amount"]) + Amount;
                 dt.Rows[0]["NotAmount"] = Convert.ToDecimal(dt.Rows[0]["NotAmount"]) + Amount;
                 UpdateByDt(dt);
             }
             else
             {
                 DataRow dr = dt.NewRow();
                 dr["RelatedID"]   = RelatedID;
                 dr["Amount"]      = Amount;
                 dr["DemandID"]    = DemandID;
                 dr["TypeID"]      = (int)Hownet.BLL.BaseFile.MaterielDemandClass.PlanUseRep.已申购数量;
                 dr["MListID"]     = MListID;
                 dr["TaskID"]      = TaskID;
                 dr["StockInfoID"] = 0;
                 dr["NotAmount"]   = Amount;
                 dr["IsEnd"]       = 0;
                 dr["A"]           = 1;
                 dt.Rows.Add(dr);
                 AddByDt(dt);
             }
         }
         else
         {
         }
     }
     #endregion
     #region 已采购数量
     else if (TypeID == (int)BLL.BaseFile.MaterielDemandClass.PlanUseRep.已采购数量)
     {
     }
     #endregion
 }
Esempio n. 14
0
        /// <param name="t">真为审核入库,假为弃审出库</param>
        public bool VerifyStock(int MainID, int PackID, bool t, int VerifyMan)
        {
            try
            {
                Hownet.BLL.StockBack     bllSB  = new StockBack();
                Hownet.BLL.StockBackInfo bllSBI = new StockBackInfo();
                Hownet.BLL.Repertory     bllRep = new Repertory();
                Hownet.BLL.Deparment     bllDep = new Deparment();

                Hownet.BLL.PackAmount   bllPA  = new PackAmount();
                Hownet.BLL.MaterielList bllML  = new MaterielList();
                Hownet.BLL.Materiel     bllMat = new Materiel();

                Hownet.Model.PackAmount    modPA  = new Hownet.Model.PackAmount();
                Hownet.Model.MaterielList  modML  = new Hownet.Model.MaterielList();
                Hownet.Model.StockBack     modSB  = bllSB.GetModel(MainID);
                Hownet.Model.StockBackInfo modSBI = new Hownet.Model.StockBackInfo();
                Hownet.Model.Repertory     modRep = new Hownet.Model.Repertory();
                Hownet.Model.Deparment     modDep = bllDep.GetModel(PackID);


                List <Hownet.Model.StockBackInfo> li = bllSBI.DataTableToList(bllSBI.GetList("(MainID=" + MainID + ")").Tables[0]);

                modPA.DepartmentID = PackID;
                for (int i = 0; i < li.Count; i++)
                {
                    modRep.BrandID      = modPA.BrandID = modML.BrandID = li[i].BrandID;
                    modRep.ColorID      = modPA.ColorID = modML.ColorID = li[i].ColorID;
                    modRep.ColorOneID   = modPA.ColorOneID = modML.ColorOneID = li[i].ColorOneID;
                    modRep.ColorTwoID   = modPA.ColorTwoID = modML.ColorTwoID = li[i].ColorTwoID;
                    modRep.SizeID       = modPA.SizeID = modML.SizeID = li[i].SizeID;
                    modRep.MaterielID   = modPA.MaterielID = modML.MaterielID = li[i].MaterielID;
                    modRep.MeasureID    = modPA.MeasureID = modML.MeasureID = bllMat.GetModel(li[i].MaterielID).MeasureID;
                    modRep.PlanID       = modPA.PlanID = 0;
                    modRep.Remark       = modPA.Remark = string.Empty;
                    modRep.DepartmentID = modPA.DepartmentID = modSB.DepotID;
                    modRep.Amount       = modPA.Amount = li[i].Amount;
                    modSBI = bllSBI.GetModel(li[i].StockInfoID);
                    if (modSBI != null)
                    {
                        if (t)
                        {
                            modSBI.NotAmount -= li[i].Amount;
                        }
                        else
                        {
                            modSBI.NotAmount += li[i].Amount;
                        }
                        bllSBI.Update(modSBI);
                    }
                    if (li[i].MListID == 0)
                    {
                        modRep.MListID = modPA.MListID = li[i].MListID = bllML.GetID(modML);
                        bllSBI.Update(li[i]);
                    }
                    else
                    {
                        modRep.MListID = modPA.MListID = li[i].MListID;
                    }
                    if (modDep.TypeID == 39)
                    {
                        bllPA.InOrOut(modPA, t);
                    }
                    else if (modDep.TypeID == 42)
                    {
                        bllRep.InOrOut(modRep, t);
                    }
                }
                if (t)
                {
                    modSB.IsVerify   = 3;
                    modSB.VerifyDate = DateTime.Today;
                    modSB.VerifyMan  = VerifyMan;
                }
                else
                {
                    modSB.IsVerify   = 1;
                    modSB.VerifyDate = DateTime.Parse("1900-1-1");
                    modSB.VerifyMan  = 0;
                }
                bllSB.Update(modSB);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }