示例#1
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);
        }
示例#2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Hownet.Model.MaterielList> DataTableToList(DataTable dt)
        {
            List <Hownet.Model.MaterielList> modelList = new List <Hownet.Model.MaterielList>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Hownet.Model.MaterielList model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.MaterielList();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["MaterielID"].ToString() != "")
                    {
                        model.MaterielID = int.Parse(dt.Rows[n]["MaterielID"].ToString());
                    }
                    if (dt.Rows[n]["ColorID"].ToString() != "")
                    {
                        model.ColorID = int.Parse(dt.Rows[n]["ColorID"].ToString());
                    }
                    if (dt.Rows[n]["ColorOneID"].ToString() != "")
                    {
                        model.ColorOneID = int.Parse(dt.Rows[n]["ColorOneID"].ToString());
                    }
                    if (dt.Rows[n]["ColorTwoID"].ToString() != "")
                    {
                        model.ColorTwoID = int.Parse(dt.Rows[n]["ColorTwoID"].ToString());
                    }
                    if (dt.Rows[n]["SizeID"].ToString() != "")
                    {
                        model.SizeID = int.Parse(dt.Rows[n]["SizeID"].ToString());
                    }
                    if (dt.Rows[n]["BrandID"].ToString() != "")
                    {
                        model.BrandID = int.Parse(dt.Rows[n]["BrandID"].ToString());
                    }
                    if (dt.Rows[n]["MeasureID"].ToString() != "")
                    {
                        model.MeasureID = int.Parse(dt.Rows[n]["MeasureID"].ToString());
                    }
                    else
                    {
                        model.MeasureID = 0;
                    }
                    if (dt.Rows[n]["SpecID"] != null && dt.Rows[n]["SpecID"].ToString() != "")
                    {
                        model.SpecID = int.Parse(dt.Rows[n]["SpecID"].ToString());
                    }
                    model.A = int.Parse(dt.Rows[n]["A"].ToString());
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#3
0
 public int GetMLID(int MaterielID, int ColorID, int ColorOneID, int ColorTwoID, int SizeID, int BrandID, int MeasureID, int SpecID)
 {
     Hownet.Model.MaterielList modML = new Hownet.Model.MaterielList();
     modML.MaterielID = MaterielID;
     modML.ColorID    = ColorID;
     modML.ColorOneID = ColorOneID;
     modML.ColorTwoID = ColorTwoID;
     modML.SizeID     = SizeID;
     modML.BrandID    = BrandID;
     modML.MeasureID  = MeasureID;
     modML.SpecID     = SpecID;
     return(GetID(modML));
 }
示例#4
0
        /// <summary>
        /// 将库存某物料的一些数量,标记为某生产计划单所使用,并在生产计划单的已有库存中,增加该数量
        /// </summary>
        /// <param name="ID">库存ID</param>
        /// <param name="DemandID">物料计划表ID</param>
        /// <param name="TaskID">生产计划单ID</param>
        /// <param name="Amount">变更数量</param>
        /// <param name="DepotID">仓库</param>
        /// <param name="MListID">物料</param>
        public void UpTaskUseRepertoryAmount(byte[] bb, int DepotID)
        {
            DataSet ds = BaseFile.ZipDt.Byte2Ds(bb);

            if (ds.Tables[0].Rows.Count > 0)
            {
                Hownet.BLL.PlanUseRep          bllPUR = new PlanUseRep();
                List <Hownet.Model.PlanUseRep> liPUR  = bllPUR.DataTableToList(ds.Tables[0]);
                Hownet.Model.Repertory         modRep;
                Hownet.BLL.MaterielDemand      bllMD = new MaterielDemand();
                Hownet.Model.MaterielDemand    modMD;
                for (int i = 0; i < liPUR.Count; i++)
                {
                    if (liPUR[i].A == 1)
                    {
                        modRep         = GetModel(liPUR[i].RelatedID);
                        modMD          = bllMD.GetModel(liPUR[i].DemandID);
                        modRep.Amount -= liPUR[i].Amount;//扣减以前的数量
                        Update(modRep);
                        List <Hownet.Model.Repertory> lirep = GetModelList("(PlanID=" + liPUR[i].TaskID + ") And (MListID=" + liPUR[i].MListID + ") And (DepartmentID=" + DepotID + ")");
                        if (lirep.Count == 0)//查找是否有需要转入的记录,没有就以变更数量插入记录
                        {
                            modRep = new Hownet.Model.Repertory();
                            Hownet.BLL.MaterielList   bllML = new MaterielList();
                            Hownet.Model.MaterielList modML = bllML.GetModel(liPUR[i].MListID);
                            modRep.MListID      = liPUR[i].MListID;
                            modRep.Amount       = liPUR[i].Amount;
                            modRep.MeasureID    = modML.MeasureID;
                            modRep.DepartmentID = DepotID;
                            modRep.MaterielID   = modML.MaterielID;
                            modRep.ColorID      = modML.ColorID;
                            modRep.ColorOneID   = modML.ColorOneID;
                            modRep.ColorTwoID   = modML.ColorTwoID;
                            modRep.SizeID       = modML.SizeID;
                            modRep.BrandID      = modML.BrandID;
                            modRep.CompanyID    = 0;
                            modRep.PlanID       = liPUR[i].TaskID;
                            Add(modRep);
                        }
                        else//有记录则加上该数量
                        {
                            lirep[0].Amount += liPUR[i].Amount;
                            Update(lirep[0]);
                        }

                        bllMD.Update(modMD);
                    }
                }
            }
        }
示例#5
0
        /// <summary>
        /// 合并生产计划
        /// </summary>
        /// <param name="StrPPID"></param>
        public int MergePP(string StrPPID)
        {
            Hownet.BLL.AmountInfo bllAI = new AmountInfo();
            string[] ss     = StrPPID.Split(',');
            int      MainID = 0;

            Hownet.Model.ProductionPlan modPP = GetModel(Convert.ToInt32(ss[0]));
            modPP.TypeID      = -1;
            modPP.DeparmentID = -1;
            modPP.UpData      = 1;
            modPP.IsVerify    = 1;
            MainID            = Add(modPP);
            DataTable dt   = dal.GetMergeAmount(StrPPID, (int)Enums.TableType.ProductionPlan).Tables[0];
            DataTable dttt = dt.Clone();

            Hownet.BLL.MaterielList   bllML = new MaterielList();
            Hownet.Model.MaterielList modML;
            Hownet.BLL.Materiel       bllMat = new Materiel();
            Hownet.Model.Materiel     modMat = bllMat.GetModel(modPP.MaterielID);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dttt.Rows.Clear();
                dt.Rows[i]["MainID"] = MainID;
                modML                 = new Hownet.Model.MaterielList();
                modML.BrandID         = modPP.BrandID;
                modML.ColorID         = Convert.ToInt32(dt.Rows[i]["ColorID"]);
                modML.ColorOneID      = Convert.ToInt32(dt.Rows[i]["ColorOneID"]);
                modML.ColorTwoID      = Convert.ToInt32(dt.Rows[i]["ColorTwoID"]);
                modML.MaterielID      = modPP.MaterielID;
                modML.MeasureID       = modMat.MeasureID;
                modML.SizeID          = Convert.ToInt32(dt.Rows[i]["SizeID"]);
                dt.Rows[i]["MListID"] = modML.ID = bllML.GetID(modML);
                dttt.Rows.Add(dt.Rows[i].ItemArray);
                bllAI.AddByDt(dttt);
            }
            for (int i = 0; i < ss.Length; i++)
            {
                modPP             = GetModel(Convert.ToInt32(ss[i]));
                modPP.DeparmentID = MainID;
                modPP.IsVerify    = (int)Enums.IsVerify.合并或拆分;
                Update(modPP);
            }
            return(MainID);
        }
示例#6
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]);
                    }
                }
            }
        }
示例#7
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);
            }
        }
示例#8
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)
                {
                }
            }
        }
示例#9
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)
                {
                }
            }
        }
示例#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);
     }
 }
示例#11
0
 /// <summary>
 /// 审核外协加工单
 /// </summary>
 /// <param name="MainID"></param>
 /// <param name="IsVerify"></param>
 /// <param name="VerifyManID"></param>
 /// <returns></returns>
 public int  VerifyWX(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();
         List <Hownet.Model.StockBackInfo> li     = bllSBI.DataTableToList(bllSBI.GetList("(MainID=" + modSB.ID + ") And (MListID=0)").Tables[0]);
         Hownet.BLL.MaterielList           bllML  = new MaterielList();
         Hownet.Model.MaterielList         modML;
         if (li.Count > 0)
         {
             for (int i = 0; i < li.Count; i++)
             {
                 modML            = new Hownet.Model.MaterielList();
                 modML.BrandID    = li[i].BrandID;
                 modML.ColorID    = li[i].ColorID;
                 modML.ColorOneID = li[i].ColorOneID;
                 modML.ColorTwoID = li[i].ColorTwoID;
                 modML.MaterielID = li[i].MaterielID;
                 modML.MeasureID  = li[i].CompanyMeasureID;
                 modML.SizeID     = li[i].SizeID;
                 modML.SpecID     = 0;
                 li[i].MListID    = bllML.GetID(modML);
                 bllSBI.Update(li[i]);
             }
         }
         li = bllSBI.DataTableToList(bllSBI.GetList("(MainID=" + modSB.ID * -1 + ") And (MListID=0)").Tables[0]);
         if (li.Count > 0)
         {
             for (int i = 0; i < li.Count; i++)
             {
                 modML            = new Hownet.Model.MaterielList();
                 modML.BrandID    = li[i].BrandID;
                 modML.ColorID    = li[i].ColorID;
                 modML.ColorOneID = li[i].ColorOneID;
                 modML.ColorTwoID = li[i].ColorTwoID;
                 modML.MaterielID = li[i].MaterielID;
                 modML.MeasureID  = li[i].CompanyMeasureID;
                 modML.SizeID     = li[i].SizeID;
                 modML.SpecID     = 0;
                 li[i].MListID    = bllML.GetID(modML);
                 bllSBI.Update(li[i]);
             }
         }
         return(1);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#12
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Hownet.Model.MaterielList model)
 {
     dal.Update(model);
 }
示例#13
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Hownet.Model.MaterielList model)
 {
     return(dal.Add(model));
 }
示例#14
0
 public int GetID(Hownet.Model.MaterielList mdoel)
 {
     return(dal.GetID(mdoel));
 }
示例#15
0
        public void InNoList(int MainID)
        {
            try
            {
                DataTable dt = new DataTable();
                if (MainID == 0)
                {
                    dt = dal.GetNoList().Tables[0];
                }
                else
                {
                    dt.Columns.Add("ID", typeof(int));
                    dt.Rows.Add(MainID);
                }
                if (dt.Rows.Count > 0)
                {
                    Hownet.BLL.Size              bllS   = new Size();
                    Hownet.BLL.ClothAmount       bllCA  = new ClothAmount();
                    Hownet.BLL.ProductTaskMain   bllPTM = new ProductTaskMain();
                    Hownet.BLL.Materiel          bllMat = new Materiel();
                    Hownet.BLL.MaterielList      bllML  = new MaterielList();
                    Hownet.Model.AmountInfo      modAI  = new Hownet.Model.AmountInfo();
                    Hownet.Model.ProductTaskMain modPTM = new Hownet.Model.ProductTaskMain();
                    Hownet.Model.MaterielList    modML  = new Hownet.Model.MaterielList();
                    DataTable dtCA   = new DataTable();
                    DataTable dtSize = bllS.GetAllList().Tables[0];
                    DataTable dtMat  = bllMat.GetList("(AttributeID=4)").Tables[0];
                    DataTable dtTem  = new DataTable();
                    int[]     li     = new int[15];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        modPTM = bllPTM.GetModel(Convert.ToInt32(dt.Rows[i]["ID"]));
                        if (GetList("(MainID=" + modPTM.ID + ") And (TableTypeID=1)").Tables[0].Rows.Count == 0)
                        {
                            dtCA = bllCA.GetList("(MainID=" + dt.Rows[i]["ID"] + ") order by ID").Tables[0];


                            //DelInfo(modPTM.ID, 1);
                            if (dtCA.Rows.Count > 0)
                            {
                                for (int j = 0; j < dtCA.Rows.Count; j++)
                                {
                                    if (Convert.ToInt32(dtCA.Rows[j]["ColorID"]) == 0)//颜色ID为0,查询出尺码ID
                                    {
                                        li = new int[15];
                                        for (int s = 1; s < 16; s++)
                                        {
                                            if (dtCA.Rows[j]["Size" + s.ToString()].ToString() != string.Empty)//尺码不为空,查询尺码ID
                                            {
                                                DataRow[] drSize = dtSize.Select("(Name='" + dtCA.Rows[j]["Size" + s.ToString()] + "')");
                                                if (drSize.Length > 0)
                                                {
                                                    li[s - 1] = Convert.ToInt32(drSize[0]["ID"]);
                                                }
                                                else
                                                {
                                                    li[s - 1] = 0;
                                                }
                                            }
                                            else
                                            {
                                                li[s - 1] = 0;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        for (int m = 0; m < 15; m++)
                                        {
                                            if (li[m] > 0)
                                            {
                                                modAI              = new Hownet.Model.AmountInfo();
                                                modAI.A            = 1;
                                                modAI.Amount       = Convert.ToInt32(dtCA.Rows[j]["Size" + (m + 1).ToString()]);
                                                modML.ColorID      = modAI.ColorID = Convert.ToInt32(dtCA.Rows[j]["ColorID"]);
                                                modML.BrandID      = modPTM.BrandID;
                                                modML.ColorOneID   = modAI.ColorOneID = 0;
                                                modML.ColorTwoID   = modAI.ColorTwoID = 0;
                                                modML.MaterielID   = modPTM.MaterielID;
                                                modML.SizeID       = modAI.SizeID = li[m];
                                                modML.MeasureID    = Convert.ToInt32(dtMat.Select("(ID=" + modML.MaterielID + ")")[0]["MeasureID"]);
                                                modAI.ID           = 0;
                                                modAI.MainID       = Convert.ToInt32(dtCA.Rows[j]["MainID"]);
                                                modAI.MListID      = bllML.GetID(modML);
                                                modAI.NotAmount    = modAI.Amount;
                                                modAI.NotDepAmount = modAI.Amount;
                                                modAI.Remark       = string.Empty;
                                                modAI.TableTypeID  = 1;
                                                dtTem              = GetList("(MainID=" + modPTM.ID + ") And (TableTypeID=1) And (MListID=" + modAI.MListID + ")").Tables[0];
                                                if (dtTem.Rows.Count == 0)
                                                {
                                                    Add(modAI);
                                                }
                                                else
                                                {
                                                    Hownet.Model.AmountInfo modAAI = GetModel(Convert.ToInt32(dtTem.Rows[0]["ID"]));
                                                    modAAI.Amount       += modAI.Amount;
                                                    modAAI.NotDepAmount += modAI.NotDepAmount;
                                                    modAAI.NotAmount    += modAI.NotAmount;
                                                    Update(modAAI);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
示例#16
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);
            }
        }
示例#17
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);
                }
            }
        }
示例#18
0
        public void Save(byte[] bb, int ProductWorkID, int TaskID)
        {
            DataTable Main = Hownet.BLL.BaseFile.ZipDt.Byte2Ds(bb).Tables[0];

            Main.Columns.Add("OneAmount", typeof(int));
            for (int i = 0; i < Main.Rows.Count; i++)
            {
                Main.Rows[i]["OneAmount"] = 0;
            }
            Hownet.BLL.ProductWorkingInfo bllPWI    = new ProductWorkingInfo();
            Hownet.BLL.WorkTicket         bllWT     = new WorkTicket();
            Hownet.BLL.WorkTicketInfo     bllWkInfo = new WorkTicketInfo();
            Hownet.Model.WorkTicket       modWK     = new Hownet.Model.WorkTicket();
            Hownet.Model.WorkTicketInfo   modWKI    = new Hownet.Model.WorkTicketInfo();
            Hownet.BLL.ProductTaskMain    bllPTM    = new ProductTaskMain();
            Hownet.Model.ProductTaskMain  modPTM    = bllPTM.GetModel(TaskID);
            Hownet.BLL.AmountInfo         bllPTI    = new AmountInfo();
            Hownet.BLL.MaterielList       bllML     = new MaterielList();
            Hownet.Model.MaterielList     modML     = new Hownet.Model.MaterielList();
            Hownet.BLL.Materiel           bllMat    = new Materiel();
            Hownet.Model.Materiel         modMat    = bllMat.GetModel(modPTM.MaterielID);
            DataTable dtInfo = bllWkInfo.GetListNoA("(ID=0)").Tables[0];

            //DataSet dsPt = bllPTI.GetBoxID(TaskID, 1);

            //DataTable dtPWIAmount = bllPWI.GetOneAmount(ProductWorkID).Tables[0];
            //int _PJAmount = 0, _WAmount = 0;
            ////dtTem.Columns.Add("ColorID", typeof(string));
            ////   dtTem.Columns.Add("SizeID", typeof(string));
            ////   dtTem.Columns.Add("Amount", typeof(string));
            ////   dtTem.Columns.Add("BoxNum", typeof(string));
            //int BoxNum = Main.Rows.Count + 1;
            //int z = 0;
            //int j = 0;
            //for (int g = 0; g < dtPWIAmount.Rows.Count; g++)
            //{
            //    #region 有预设数量分箱
            //    if (Convert.ToInt32(dtPWIAmount.Rows[g]["OneAmount"]) > 0)
            //    {
            //        _PJAmount = Convert.ToInt32(dtPWIAmount.Rows[g]["OneAmount"]);
            //        _WAmount = Convert.ToInt32(_PJAmount * 1.5);
            //        for (int r = 0; r < dsPt.Tables[0].Rows.Count; r++)
            //        {
            //            //某数量少于尾箱数量,直接取该数量
            //            if (int.Parse(dsPt.Tables[0].DefaultView[r]["Amount"].ToString()) < _WAmount)
            //            {
            //                Main.Rows.Add(dsPt.Tables[0].DefaultView[r]["ColorID"], dsPt.Tables[0].DefaultView[r]["SizeID"],
            //                    dsPt.Tables[0].DefaultView[r]["Amount"], BoxNum, _PJAmount);
            //                BoxNum++;
            //            }
            //            else
            //            {
            //                int x = int.Parse(dsPt.Tables[0].DefaultView[r]["Amount"].ToString()) % _PJAmount;
            //                if (x <= (_WAmount - _PJAmount))
            //                {
            //                    z = 3;
            //                }
            //                if (x == 0)
            //                {
            //                    z = 1;
            //                }
            //                if (x > (_WAmount - _PJAmount))
            //                {
            //                    z = 2;
            //                }
            //                switch (z)
            //                {
            //                    case 1:
            //                        {

            //                            for (j = BoxNum; j < (BoxNum + (int.Parse(dsPt.Tables[0].DefaultView[r]["Amount"].ToString()) / _PJAmount)); j++)
            //                            {

            //                                Main.Rows.Add(dsPt.Tables[0].DefaultView[r]["ColorID"], dsPt.Tables[0].DefaultView[r]["SizeID"], _PJAmount,
            //                                    j, _PJAmount);
            //                            }
            //                            BoxNum = j;
            //                            break;
            //                        }
            //                    case 2:
            //                        {

            //                            for (j = BoxNum; j < (BoxNum + int.Parse(dsPt.Tables[0].DefaultView[r]["Amount"].ToString()) / _PJAmount); j++)
            //                            {
            //                                Main.Rows.Add(dsPt.Tables[0].DefaultView[r]["ColorID"],
            //                                    dsPt.Tables[0].DefaultView[r]["SizeID"], _PJAmount, j, _PJAmount);
            //                            }

            //                            Main.Rows.Add(dsPt.Tables[0].DefaultView[r]["ColorID"], dsPt.Tables[0].DefaultView[r]["SizeID"], x, j, _PJAmount);
            //                            BoxNum = j + 1;
            //                            break;
            //                        }
            //                    case 3:
            //                        {

            //                            for (j = BoxNum; j < (BoxNum + int.Parse(dsPt.Tables[0].DefaultView[r]["Amount"].ToString()) / _PJAmount) - 1; j++)
            //                            {
            //                                //  A,ID,ColorID,ColorOneID,ColorTwoID,SizeID,Amount,BoxNum,TaskID,DepartmentID,P2DInfoID,EligibleAmount,InferiorAmount,P2DDepartmentID,MListID,BrandID
            //                                Main.Rows.Add(dsPt.Tables[0].DefaultView[r]["ColorID"], dsPt.Tables[0].DefaultView[r]["SizeID"], _PJAmount, j, _PJAmount);
            //                            }
            //                            Main.Rows.Add(dsPt.Tables[0].DefaultView[r]["ColorID"], dsPt.Tables[0].DefaultView[r]["SizeID"], (_PJAmount + x),
            //                                j, _PJAmount);
            //                            BoxNum = j + 1;
            //                            break;
            //                        }
            //                }
            //            }
            //        }
            //    }
            //    #endregion
            //    #region 各色各码总数分为一箱
            //    if (Convert.ToInt32(dtPWIAmount.Rows[g]["OneAmount"]) == -1)
            //    {
            //        for (int r = 0; r < dsPt.Tables[0].Rows.Count; r++)
            //        {
            //            Main.Rows.Add(dsPt.Tables[0].DefaultView[r]["ColorID"], dsPt.Tables[0].DefaultView[r]["SizeID"],
            //                dsPt.Tables[0].DefaultView[r]["Amount"], BoxNum, -1);
            //            BoxNum++;
            //        }
            //    }
            //    #endregion
            //}
            try
            {
                bool      t         = false;
                DataSet   dsPw      = bllPWI.GetBoxWork(ProductWorkID);
                DataTable dtSpecial = bllPWI.GetList("(MainID=" + ProductWorkID * -1 + ")").Tables[0];//查出特殊工序明细表
                DataRow[] ddrs;
                if (dtSpecial.Rows.Count == 0)
                {
                    #region 没有特殊工序
                    for (int r = 0; r < Main.Rows.Count; r++)
                    {
                        modML              = new Hownet.Model.MaterielList();
                        modML.ColorID      = modWK.ColorID = int.Parse(Main.DefaultView[r]["ColorID"].ToString());
                        modML.SizeID       = modWK.SizeID = int.Parse(Main.DefaultView[r]["SizeID"].ToString());
                        modML.ColorOneID   = modWK.ColorOneID = Convert.ToInt32(Main.DefaultView[r]["ColorOneID"]);
                        modML.ColorTwoID   = modWK.ColorTwoID = Convert.ToInt32(Main.DefaultView[r]["ColorTwoID"]);
                        modWK.BoxNum       = int.Parse(Main.DefaultView[r]["BoxNum"].ToString());
                        modWK.Amount       = int.Parse(Main.DefaultView[r]["Amount"].ToString());
                        modML.MaterielID   = modPTM.MaterielID;
                        modML.BrandID      = modPTM.BrandID;
                        modML.MeasureID    = modMat.MeasureID;
                        modWK.MListID      = bllML.GetID(modML);
                        modWK.TaskID       = TaskID;
                        modWK.DepartmentID = modPTM.DeparmentID;
                        modWK.OneAmount    = Convert.ToInt32(Main.DefaultView[r]["OneAmount"]);
                        int mainID = bllWT.Add(modWK);
                        ddrs = dsPw.Tables[0].Select("(OneAmount=" + modWK.OneAmount + ")");
                        for (int c = 0; c < ddrs.Length; c++)
                        {
                            modWKI.EmployeeID     = 0;
                            modWKI.PWorkingInfoID = int.Parse(ddrs[c]["ID"].ToString());
                            modWKI.WorkingID      = int.Parse(ddrs[c]["WorkingID"].ToString());
                            modWKI.MainID         = mainID;
                            modWKI.OutAmount      = modWKI.Amount = modWKI.NotAmount = modWK.Amount;
                            modWKI.TaskID         = TaskID;

                            //bllWkInfo.Add(modWKI);
                            dtInfo.Rows.Add(0, modWKI.MainID, modWKI.DateTime, modWKI.IsDel, modWKI.PWorkingInfoID, modWKI.EmployeeID, modWKI.BackID, modWKI.Amount, modWKI.NotAmount, modWKI.TaskID, modWKI.WorkingID, modWKI.OutAmount);
                        }
                    }
                }
                #endregion
                #region 特殊工序
                else
                {
                    DataRow[] drs;
                    for (int r = 0; r < Main.Rows.Count; r++)
                    {
                        modML              = new Hownet.Model.MaterielList();
                        modML.ColorID      = modWK.ColorID = int.Parse(Main.DefaultView[r]["ColorID"].ToString());
                        modML.SizeID       = modWK.SizeID = int.Parse(Main.DefaultView[r]["SizeID"].ToString());
                        modML.ColorOneID   = modWK.ColorOneID = Convert.ToInt32(Main.DefaultView[r]["ColorOneID"]);
                        modML.ColorTwoID   = modWK.ColorTwoID = Convert.ToInt32(Main.DefaultView[r]["ColorTwoID"]);
                        modWK.BoxNum       = int.Parse(Main.DefaultView[r]["BoxNum"].ToString());
                        modWK.Amount       = int.Parse(Main.DefaultView[r]["Amount"].ToString());
                        modML.MaterielID   = modPTM.MaterielID;
                        modML.BrandID      = modPTM.BrandID;
                        modML.MeasureID    = modMat.MeasureID;
                        modWK.MListID      = bllML.GetID(modML);
                        modWK.TaskID       = TaskID;
                        modWK.DepartmentID = modPTM.DeparmentID;
                        modWK.OneAmount    = Convert.ToInt32(Main.DefaultView[r]["OneAmount"]);
                        int mainID = bllWT.Add(modWK);
                        for (int c = 0; c < dsPw.Tables[0].Rows.Count; c++)
                        {
                            t = false;
                            modWKI.EmployeeID = 0;
                            int w = int.Parse(dsPw.Tables[0].DefaultView[c]["WorkingID"].ToString());
                            modWKI.WorkingID      = w;
                            modWKI.PWorkingInfoID = int.Parse(dsPw.Tables[0].DefaultView[c]["ID"].ToString());
                            if ((bool.Parse(dsPw.Tables[0].DefaultView[c]["IsSpecial"].ToString())))//判断某道工序是否是特殊工序
                            {
                                //有特定客户、特定尺码、特定颜色的特殊工序
                                drs = dtSpecial.Select("(SpecialWork=" + w + ") and (CompanyID=" + modPTM.CompanyID + ") and (ColorID=" + Main.Rows[r]["ColorID"] + ") And (MaterielID=" + Main.Rows[r]["SizeID"] + ")");
                                if (drs.Length == 0)
                                {
                                    //有特定尺码、特定颜色的特殊工序
                                    drs = dtSpecial.Select("(SpecialWork=" + w + ") and (CompanyID=0) and (ColorID=" + Main.Rows[r]["ColorID"] + ") And (MaterielID=" + Main.Rows[r]["SizeID"] + ")");
                                    if (drs.Length == 0)
                                    {
                                        //有特定尺码、特定客户的特殊工序
                                        drs = dtSpecial.Select("(SpecialWork=" + w + ") and (CompanyID=" + modPTM.CompanyID + ") and (ColorID=0) And (MaterielID=" + Main.Rows[r]["SizeID"] + ")");
                                        if (drs.Length == 0)
                                        {
                                            //有特定客户、特定颜色的特殊工序
                                            drs = dtSpecial.Select("(SpecialWork=" + w + ") and (CompanyID=" + modPTM.CompanyID + ") and (ColorID=" + Main.Rows[r]["ColorID"] + ") And (MaterielID=0)");
                                            if (drs.Length == 0)
                                            {
                                                //只有特定颜色的特殊工序
                                                drs = dtSpecial.Select("(SpecialWork=" + w + ") and (MaterielID=0) And (CompanyID=0) and (ColorID=" + Main.Rows[r]["ColorID"] + ")");
                                                if (drs.Length == 0)
                                                {
                                                    //有只特定客户的特殊工序
                                                    drs = dtSpecial.Select("(SpecialWork=" + w + ") and (CompanyID=" + modPTM.CompanyID + ") and (ColorID=0) and (MaterielID=0)");
                                                    if (drs.Length == 0)
                                                    {
                                                        //有只特定尺码的特殊工序
                                                        drs = dtSpecial.Select("(SpecialWork=" + w + ") and (MaterielID=" + Main.Rows[r]["SizeID"] + ") and (ColorID=0) and (CompanyID=0)");
                                                        if (drs.Length == 0)
                                                        {
                                                            //不分颜色、客户的特殊工序
                                                            drs = dtSpecial.Select("(SpecialWork=" + w + ") and (CompanyID=0) and (ColorID=0)");
                                                            if (drs.Length == 0)
                                                            {
                                                                t = true;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                if (drs.Length > 0)
                                {
                                    modWKI.WorkingID      = int.Parse(drs[0]["WorkingID"].ToString());
                                    modWKI.PWorkingInfoID = int.Parse(drs[0]["ID"].ToString());
                                    if (modWKI.WorkingID == 0)
                                    {
                                        t = true;
                                    }
                                }
                            }
                            modWKI.MainID    = mainID;
                            modWKI.OutAmount = modWKI.Amount = modWKI.NotAmount = modWK.Amount;
                            modWKI.TaskID    = TaskID;
                            if (!t)
                            {
                                //bllWkInfo.Add(modWKI);//有特殊工序的普通工序,则添加记录,否则不添加
                                dtInfo.Rows.Add(0, modWKI.MainID, modWKI.DateTime, modWKI.IsDel, modWKI.PWorkingInfoID, modWKI.EmployeeID, modWKI.BackID, modWKI.Amount, modWKI.NotAmount, modWKI.TaskID, modWKI.WorkingID, modWKI.OutAmount);
                            }
                        }
                    }
                }

                #endregion
                DAL.BaseFile.MakeBox.AddWorkTicketInfo(dtInfo);
            }
            catch (Exception ex)
            {
            }
        }