/// <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]);
                    }
                }
            }
        }
Beispiel #2
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]);
                    }
                }
            }
        }
 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);
     }
 }
Beispiel #4
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
 }