Exemplo n.º 1
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hownet.Model.Pack2DepotMain model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Hownet.Model.Pack2DepotMain> DataTableToList(DataTable dt)
        {
            List <Hownet.Model.Pack2DepotMain> modelList = new List <Hownet.Model.Pack2DepotMain>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Hownet.Model.Pack2DepotMain model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.Pack2DepotMain();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["DateTime"] != null && dt.Rows[n]["DateTime"].ToString() != "")
                    {
                        model.DateTime = DateTime.Parse(dt.Rows[n]["DateTime"].ToString());
                    }
                    if (dt.Rows[n]["DepotID"] != null && dt.Rows[n]["DepotID"].ToString() != "")
                    {
                        model.DepotID = int.Parse(dt.Rows[n]["DepotID"].ToString());
                    }
                    if (dt.Rows[n]["PackID"] != null && dt.Rows[n]["PackID"].ToString() != "")
                    {
                        model.PackID = int.Parse(dt.Rows[n]["PackID"].ToString());
                    }
                    if (dt.Rows[n]["IsVerify"] != null && dt.Rows[n]["IsVerify"].ToString() != "")
                    {
                        model.IsVerify = int.Parse(dt.Rows[n]["IsVerify"].ToString());
                    }
                    if (dt.Rows[n]["Num"] != null && dt.Rows[n]["Num"].ToString() != "")
                    {
                        model.Num = int.Parse(dt.Rows[n]["Num"].ToString());
                    }
                    if (dt.Rows[n]["UpData"] != null && dt.Rows[n]["UpData"].ToString() != "")
                    {
                        model.UpData = int.Parse(dt.Rows[n]["UpData"].ToString());
                    }
                    if (dt.Rows[n]["VerifyMan"] != null && dt.Rows[n]["VerifyMan"].ToString() != "")
                    {
                        model.VerifyMan = int.Parse(dt.Rows[n]["VerifyMan"].ToString());
                    }
                    if (dt.Rows[n]["VerifyDate"] != null && dt.Rows[n]["VerifyDate"].ToString() != "")
                    {
                        model.VerifyDate = DateTime.Parse(dt.Rows[n]["VerifyDate"].ToString());
                    }
                    if (dt.Rows[n]["FillMan"] != null && dt.Rows[n]["FillMan"].ToString() != "")
                    {
                        model.FillMan = int.Parse(dt.Rows[n]["FillMan"].ToString());
                    }
                    if (dt.Rows[n]["FillDate"] != null && dt.Rows[n]["FillDate"].ToString() != "")
                    {
                        model.FillDate = DateTime.Parse(dt.Rows[n]["FillDate"].ToString());
                    }
                    if (dt.Rows[n]["State"] != null && dt.Rows[n]["State"].ToString() != "")
                    {
                        model.State = int.Parse(dt.Rows[n]["State"].ToString());
                    }
                    model.Remark = dt.Rows[n]["Remark"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Hownet.Model.Pack2DepotMain model)
 {
     return(dal.Add(model));
 }
Exemplo n.º 4
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)
            {
            }
        }