Пример #1
0
 /// <summary>
 /// 转入生产计划
 /// </summary>
 /// <param name="SaleID"></param>
 /// <returns></returns>
 public int ToPlan(int SaleID, int FillMan)
 {
     try
     {
         // DataTable dt = GetList("(ID=" + SaleID + ")").Tables[0];
         Hownet.Model.SalesOrderInfoList modSOI = GetModel(SaleID);
         Hownet.BLL.SysTem           bllST      = new SysTem();
         Hownet.Model.SysTem         modST      = bllST.GetModel(bllST.GetMaxId() - 1);
         Hownet.BLL.ProductionPlan   bllPP      = new ProductionPlan();
         Hownet.Model.ProductionPlan modPP      = new Hownet.Model.ProductionPlan();
         modPP.SalesOrderInfoID = modSOI.ID;         // Convert.ToInt32(dt.Rows[0]["ID"]);
         modPP.MaterielID       = modSOI.MaterielID; // Convert.ToInt32(dt.Rows[0]["MaterielID"]);
         modPP.BrandID          = modSOI.BrandID;    // Convert.ToInt32(dt.Rows[0]["BrandID"]);
         modPP.Num = modSOI.Num;                     // Convert.ToInt32(dt.Rows[0]["Num"]);// bllPP.NewNum(DateTime.Today, modST.NumType);
         // dalPP.NewNum(DateTime.Today, modST.NumType);
         modPP.DateTime        = modSOI.DateTime;    // Convert.ToDateTime(dt.Rows[0]["DateTime"]);// DateTime.Today;
         modPP.LastDate        = modSOI.LastDate;    // Convert.ToDateTime(dt.Rows[0]["LastDate"]);
         modPP.Remark          = modSOI.Remark;      // dt.Rows[0]["Remark"].ToString();
         modPP.PWorkingID      = modPP.BomID = 0;
         modPP.CompanyID       = modSOI.CompanyID;   // Convert.ToInt32(dt.Rows[0]["CompanyID"]);
         modPP.IsTicket        = modPP.IsBom = false;
         modPP.VerifyDate      = Convert.ToDateTime("1900-1-1");
         modPP.VerifyMan       = 0;
         modPP.DeparmentID     = 0;
         modPP.UpData          = 1;
         modPP.FillDate        = DateTime.Today;
         modPP.FilMan          = FillMan;
         modPP.TicketDate      = Convert.ToDateTime("1900-1-1");
         modPP.BedNO           = string.Empty;
         modPP.PackingMethodID = modSOI.PackingMethodID;                       // Convert.ToInt32(dt.Rows[0]["PackingMethodID"]);
         modPP.SewingRemark    = modSOI.Remark + "\r\n" + modSOI.SewingRemark; // dt.Rows[0]["Remark"].ToString() + "\r\n" + dt.Rows[0]["SewingRemark"].ToString();
         modPP.TypeID          = modPP.ParentID = 0;
         modPP.ParentID        = 0;
         modPP.IsVerify        = 1;
         modPP.AssociatedID    = string.Empty;
         modPP.AssociatedMatID = 0;
         //dt.Rows[0]["IsToPlan"] = 1;
         modSOI.IsToPlan = true;
         Update(modSOI);
         // UpdateByDt(dt);
         return(bllPP.Add(modPP));
     }
     catch (Exception ex)
     {
         return(0);
     }
     // return dal.ToPlan(SaleID, FillMan);
 }
Пример #2
0
        public DataSet GetTemPayByPW(DateTime BeginDate, DateTime EndDate, int EmployeeID)
        {
            try
            {
                Hownet.BLL.OtherType          bllOT = new OtherType();
                List <Hownet.Model.OtherType> list  = bllOT.DataTableToList(bllOT.GetTypeList("伙食扣费").Tables[0]);
                DataTable dtPaySet = bllOT.GetNumValue().Tables[0];

                decimal ZhaoCan, WuCan, WanCan, Month;
                ZhaoCan = WuCan = WanCan = Month = 0;
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].Name == "早餐")
                    {
                        ZhaoCan = Convert.ToDecimal(list[i].Value);
                    }
                    else if (list[i].Name == "午餐")
                    {
                        WuCan = Convert.ToDecimal(list[i].Value);
                    }
                    else if (list[i].Name == "晚餐")
                    {
                        WanCan = Convert.ToDecimal(list[i].Value);
                    }
                }

                DataSet                 ds    = dal.GetTemPayByPW(BeginDate, EndDate, EmployeeID);
                Hownet.BLL.MiniEmp      bllME = new MiniEmp();
                DataTable               dtEMP = bllME.GetWorkList().Tables[0];
                Hownet.Model.Pay        modP  = new Hownet.Model.Pay();
                Hownet.BLL.PayCosts     bllPC = new PayCosts();
                Hownet.BLL.SysTem       bllST = new SysTem();
                Hownet.BLL.OrderingList bllOL = new OrderingList();
                Hownet.Model.SysTem     modST = bllST.GetModel(bllST.GetMaxId() - 1);
                DataTable               dtPC  = bllPC.GetListByDay(BeginDate, EndDate, EmployeeID).Tables[0];
                ds.Tables[0].Columns.Add("OneDate", typeof(string));
                ds.Tables[0].Columns.Add("TwoDate", typeof(string));
                ds.Tables[0].Columns.Add("NowMoney", typeof(decimal));
                ds.Tables[0].Columns.Add("FullAttendance", typeof(decimal));
                ds.Tables[0].Columns.Add("Fine", typeof(decimal));
                ds.Tables[0].Columns.Add("Deposit", typeof(decimal));
                ds.Tables[0].Columns.Add("Add1", typeof(decimal));
                ds.Tables[0].Columns.Add("Add2", typeof(decimal));
                ds.Tables[0].Columns.Add("Add3", typeof(decimal));
                ds.Tables[0].Columns.Add("Add4", typeof(decimal));
                ds.Tables[0].Columns.Add("Add5", typeof(decimal));
                ds.Tables[0].Columns.Add("Jian1", typeof(decimal));
                ds.Tables[0].Columns.Add("Jian2", typeof(decimal));
                ds.Tables[0].Columns.Add("Jian3", typeof(decimal));
                ds.Tables[0].Columns.Add("Jian4", typeof(decimal));
                ds.Tables[0].Columns.Add("Jian5", typeof(decimal));
                ds.Tables[0].Columns.Add("ActualMonth", typeof(decimal));
                ds.Tables[0].Columns.Add("NotFact", typeof(bool));
                ds.Tables["Info"].Columns.Add("Money", typeof(decimal));
                decimal price  = 0;
                decimal amount = 0;
                for (int i = 0; i < ds.Tables["Info"].Rows.Count; i++)
                {
                    price  = 0;
                    amount = 0;
                    if (ds.Tables["Info"].Rows[i]["Amount"].ToString() != "")
                    {
                        amount = decimal.Parse(ds.Tables["Info"].Rows[i]["Amount"].ToString());
                    }
                    if (ds.Tables["Info"].Rows[i]["Price"].ToString() != "")
                    {
                        price = decimal.Parse(ds.Tables["Info"].Rows[i]["Price"].ToString());
                    }
                    ds.Tables["Info"].Rows[i]["Money"] = (price * amount).ToString("N4");
                }
                ds.Tables["NoDefault"].Columns.Add("Money", typeof(decimal));

                if ((modST.DoubleNotDefaultWTNum > 0))
                {
                    for (int i = 0; i < ds.Tables["NoDefault"].Rows.Count; i++)
                    {
                        price  = 0;
                        amount = 0;
                        if (ds.Tables["NoDefault"].Rows[i]["Amount"].ToString() != "")
                        {
                            amount = decimal.Parse(ds.Tables["NoDefault"].Rows[i]["Amount"].ToString());
                        }
                        if (ds.Tables["NoDefault"].Rows[i]["Price"].ToString() != "")
                        {
                            price = decimal.Parse(ds.Tables["NoDefault"].Rows[i]["Price"].ToString());
                        }
                        ds.Tables["NoDefault"].Rows[i]["Money"] = (price * amount).ToString("N4");
                    }
                }
                else
                {
                    ds.Tables["NoDefault"].Rows.Clear();
                }
                int     AllowedCount = 0;
                decimal ErrorMoney   = 0;
                if (modST.AutoCaicBoardWages)
                {
                    // bllOL.CaicMoney(EndDate.AddDays(1));
                    AllowedCount = Convert.ToInt32(bllOT.GetList("(Name='允许违规次数')").Tables[0].Rows[0]["Value"]);
                    ErrorMoney   = Convert.ToDecimal(bllOT.GetList("(Name='订餐后未吃')").Tables[0].Rows[0]["Value"]);
                }
                DataRow[] drs;
                DataRow[] ddrs;
                DataRow[] drMEs;
                try
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        ds.Tables[0].Rows[i]["OneDate"] = BeginDate.ToString("yyyy年MM月dd日");
                        ds.Tables[0].Rows[i]["TwoDate"] = EndDate.ToString("yyyy年MM月dd日");
                        if (ds.Tables[0].Rows[i]["Month"].ToString() != "")
                        {
                            modP.Month = decimal.Parse(ds.Tables[0].Rows[i]["Month"].ToString());
                        }
                        else
                        {
                            modP.Month = 0;
                        }
                        drs   = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=62) ");
                        drMEs = dtEMP.Select("(ID=" + ds.Tables[0].Rows[i]["EmployeeID"] + ")");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Payment"] = drs[0]["Money"];
                            modP.Payment = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Payment = 0;
                        }
                        if (modST.AutoCaicBoardWages)
                        {
                            modP.BoardWages = bllOL.GetMoney(Convert.ToInt32(ds.Tables[0].Rows[i]["EmployeeID"]), BeginDate, EndDate.AddDays(1), AllowedCount, ErrorMoney, ZhaoCan, WuCan, WanCan);
                            ds.Tables[0].Rows[i]["BoardWages"] = modP.BoardWages;
                        }
                        else
                        {
                            if (drMEs.Length > 0)
                            {
                                modP.BoardWages = Convert.ToDecimal(drMEs[0]["BoardWages"]);// bllME.GetModel(Convert.ToInt32(ds.Tables[0].Rows[i]["EmployeeID"])).BoardWages;
                                ds.Tables[0].Rows[i]["BoardWages"] = modP.BoardWages;
                            }
                            if (modP.BoardWages == 0)
                            {
                                drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=61)");
                                if (drs.Length > 0)
                                {
                                    ds.Tables[0].Rows[i]["BoardWages"] = drs[0]["Money"];
                                    modP.BoardWages = decimal.Parse(drs[0]["Money"].ToString());
                                }
                                else
                                {
                                    modP.BoardWages = 0;
                                }
                            }
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=60)");//计算补贴
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Repair"] = drs[0]["Money"];
                            modP.Repair = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Repair = 0;
                        }
                        if (modST.DoubleNotDefaultWTNum > 0)
                        {
                            ddrs = ds.Tables["NoDefault"].Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"] + ")");//计算非默认工种的补贴
                            if (ddrs.Length > 0)
                            {
                                for (int m = 0; m < ddrs.Length; m++)
                                {
                                    modP.Repair += Convert.ToDecimal(ddrs[m]["Money"]) * modST.DoubleNotDefaultWTNum;
                                }
                                ds.Tables[0].Rows[i]["Repair"] = modP.Repair;
                            }
                        }
                        if (dtPaySet.Rows.Count > 0)//有工资提成设置
                        {
                            if (drMEs.Length > 0)
                            {
                                if (Convert.ToBoolean(drMEs[0]["IsCaicTiCheng"]))
                                {
                                    Month = Convert.ToDecimal(ds.Tables[0].Rows[i]["Month"]);
                                    if (Month > Convert.ToInt32(dtPaySet.Rows[0][0]))//超过最高提成,直接添加
                                    {
                                        modP.Repair += Month * Convert.ToDecimal(dtPaySet.Rows[0][1]);
                                        ds.Tables[0].Rows[i]["Repair"] = modP.Repair;
                                    }
                                    else if (Month > Convert.ToInt32(dtPaySet.Rows[dtPaySet.Rows.Count - 1][0]))//小于最高提成额度但又大于最低提成额度,然后从大向小比较,
                                    {
                                        for (int j = 0; j < dtPaySet.Rows.Count; j++)
                                        {
                                            if (Month > Convert.ToDecimal(dtPaySet.Rows[j][0]))
                                            {
                                                modP.Repair += Month * Convert.ToDecimal(dtPaySet.Rows[j][1]);
                                                ds.Tables[0].Rows[i]["Repair"] = modP.Repair;
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=91)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["FullAttendance"] = drs[0]["Money"];
                            modP.FullAttendance = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.FullAttendance = 0;
                        }

                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=92)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Fine"] = drs[0]["Money"];
                            modP.Fine = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Fine = 0;
                        }


                        //drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=92)");
                        //if (drs.Length > 0)
                        //{
                        //    ds.Tables[0].Rows[i]["Fine"] = drs[0]["Money"];
                        //    modP.Deposit = decimal.Parse(drs[0]["Money"].ToString());
                        //}
                        //else
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=109)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Deposit"] = drs[0]["Money"];
                            modP.Deposit = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Deposit = 0;
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=7)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Add1"] = drs[0]["Money"];
                            modP.Add1 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Add1 = 0;
                        }

                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=8)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Add2"] = drs[0]["Money"];
                            modP.Add2 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Add2 = 0;
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=9)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Add3"] = drs[0]["Money"];
                            modP.Add3 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Add3 = 0;
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=10)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Add4"] = drs[0]["Money"];
                            modP.Add4 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Add4 = 0;
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=11)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Add5"] = drs[0]["Money"];
                            modP.Add5 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Add5 = 0;
                        }

                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=12)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Jian1"] = drs[0]["Money"];
                            modP.Jian1 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Jian1 = 0;
                        }

                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=13)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Jian2"] = drs[0]["Money"];
                            modP.Jian2 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Jian2 = 0;
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=14)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Jian3"] = drs[0]["Money"];
                            modP.Jian3 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Jian3 = 0;
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=15)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Jian4"] = drs[0]["Money"];
                            modP.Jian4 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Jian4 = 0;
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=16)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Jian5"] = drs[0]["Money"];
                            modP.Jian5 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Jian5 = 0;
                        }
                        ds.Tables[0].Rows[i]["ActualMonth"] = ds.Tables[0].Rows[i]["Month"];
                        ds.Tables[0].Rows[i]["NotFact"]     = false;
                        // ds.Tables[0].Rows[i]["NowMoney"] = modP.Month + modP.Repair - modP.BoardWages - modP.Payment + modP.FullAttendance - modP.Fine - modP.Deposit;
                    }
                }
                catch (Exception ex)
                {
                }

                return(ds);
            }
            catch (Exception ex)
            {
                return(new DataSet());
            }
        }
Пример #3
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);
                }
            }
        }
Пример #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Hownet.Model.SysTem model)
 {
     dal.Update(model);
 }
Пример #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Hownet.Model.SysTem model)
 {
     return(dal.Add(model));
 }
Пример #6
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Hownet.Model.SysTem> DataTableToList(DataTable dt)
        {
            List <Hownet.Model.SysTem> modelList = new List <Hownet.Model.SysTem>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Hownet.Model.SysTem model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.SysTem();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    else
                    {
                        model.ID = 0;
                    }
                    model.CompanyName  = dt.Rows[n]["CompanyName"].ToString();
                    model.LinkMan      = dt.Rows[n]["LinkMan"].ToString();
                    model.Phone        = dt.Rows[n]["Phone"].ToString();
                    model.Fax          = dt.Rows[n]["Fax"].ToString();
                    model.HDSerie      = dt.Rows[n]["HDSerie"].ToString();
                    model.Registration = dt.Rows[n]["Registration"].ToString();
                    model.BanKName     = dt.Rows[n]["BanKName"].ToString();
                    model.BankNO       = dt.Rows[n]["BankNO"].ToString();
                    model.BankUserName = dt.Rows[n]["BankUserName"].ToString();
                    model.Address      = dt.Rows[n]["Address"].ToString();
                    if (dt.Rows[n]["Direct2Depot"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Direct2Depot"].ToString() == "1") || (dt.Rows[n]["Direct2Depot"].ToString().ToLower() == "true"))
                        {
                            model.Direct2Depot = true;
                        }
                        else
                        {
                            model.Direct2Depot = false;
                        }
                    }
                    if (dt.Rows[n]["Sell4Depot"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Sell4Depot"].ToString() == "1") || (dt.Rows[n]["Sell4Depot"].ToString().ToLower() == "true"))
                        {
                            model.Sell4Depot = true;
                        }
                        else
                        {
                            model.Sell4Depot = false;
                        }
                    }
                    if (dt.Rows[n]["AutoClient"].ToString() != "")
                    {
                        if ((dt.Rows[n]["AutoClient"].ToString() == "1") || (dt.Rows[n]["AutoClient"].ToString().ToLower() == "true"))
                        {
                            model.AutoClient = true;
                        }
                        else
                        {
                            model.AutoClient = false;
                        }
                    }
                    if (dt.Rows[n]["BoxOrPic"].ToString() != "")
                    {
                        if ((dt.Rows[n]["BoxOrPic"].ToString() == "1") || (dt.Rows[n]["BoxOrPic"].ToString().ToLower() == "true"))
                        {
                            model.BoxOrPic = true;
                        }
                        else
                        {
                            model.BoxOrPic = false;
                        }
                    }
                    if (dt.Rows[n]["NumType"].ToString() != "")
                    {
                        model.NumType = int.Parse(dt.Rows[n]["NumType"].ToString());
                    }
                    else
                    {
                        model.NumType = 0;
                    }
                    model.Mobile = dt.Rows[n]["Mobile"].ToString();
                    if (dt.Rows[n]["SellMoney"].ToString() != "")
                    {
                        model.SellMoney = int.Parse(dt.Rows[n]["SellMoney"].ToString());
                    }
                    else
                    {
                        model.SellMoney = 0;
                    }
                    if (dt.Rows[n]["CustOder"].ToString() != "")
                    {
                        if ((dt.Rows[n]["CustOder"].ToString() == "1") || (dt.Rows[n]["CustOder"].ToString().ToLower() == "true"))
                        {
                            model.CustOder = true;
                        }
                        else
                        {
                            model.CustOder = false;
                        }
                    }
                    if (dt.Rows[n]["NotPermissions"].ToString() != "")
                    {
                        if ((dt.Rows[n]["NotPermissions"].ToString() == "1") || (dt.Rows[n]["NotPermissions"].ToString().ToLower() == "true"))
                        {
                            model.NotPermissions = true;
                        }
                        else
                        {
                            model.NotPermissions = false;
                        }
                    }
                    if (dt.Rows[n]["DepotAllowNegative"].ToString() != "")
                    {
                        if ((dt.Rows[n]["DepotAllowNegative"].ToString() == "1") || (dt.Rows[n]["DepotAllowNegative"].ToString().ToLower() == "true"))
                        {
                            model.DepotAllowNegative = true;
                        }
                        else
                        {
                            model.DepotAllowNegative = false;
                        }
                    }
                    if (dt.Rows[n]["IsChangedSales"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsChangedSales"].ToString() == "1") || (dt.Rows[n]["IsChangedSales"].ToString().ToLower() == "true"))
                        {
                            model.IsChangedSales = true;
                        }
                        else
                        {
                            model.IsChangedSales = false;
                        }
                    }
                    if (dt.Rows[n]["BackDepotWorking"].ToString() != "")
                    {
                        model.BackDepotWorking = int.Parse(dt.Rows[n]["BackDepotWorking"].ToString());
                    }
                    else
                    {
                        model.BackDepotWorking = 0;
                    }
                    if (dt.Rows[n]["OderOne"].ToString() != "")
                    {
                        model.OderOne = int.Parse(dt.Rows[n]["OderOne"].ToString());
                    }
                    else
                    {
                        model.OderOne = 0;
                    }
                    if (dt.Rows[n]["OderTwo"].ToString() != "")
                    {
                        model.OderTwo = int.Parse(dt.Rows[n]["OderTwo"].ToString());
                    }
                    else
                    {
                        model.OderTwo = 0;
                    }
                    if (dt.Rows[n]["OderThree"].ToString() != "")
                    {
                        model.OderThree = int.Parse(dt.Rows[n]["OderThree"].ToString());
                    }
                    else
                    {
                        model.OderThree = 0;
                    }
                    if (dt.Rows[n]["AutoCaicBoardWages"].ToString() != "")
                    {
                        if ((dt.Rows[n]["AutoCaicBoardWages"].ToString() == "1") || (dt.Rows[n]["AutoCaicBoardWages"].ToString().ToLower() == "true"))
                        {
                            model.AutoCaicBoardWages = true;
                        }
                        else
                        {
                            model.AutoCaicBoardWages = false;
                        }
                    }
                    if (dt.Rows[n]["DefaultRawDepot"].ToString() != "")
                    {
                        model.DefaultRawDepot = int.Parse(dt.Rows[n]["DefaultRawDepot"].ToString());
                    }
                    else
                    {
                        model.DefaultRawDepot = 0;
                    }
                    if (dt.Rows[n]["DefaultDepot"].ToString() != "")
                    {
                        model.DefaultDepot = int.Parse(dt.Rows[n]["DefaultDepot"].ToString());
                    }
                    else
                    {
                        model.DefaultDepot = 0;
                    }
                    if (dt.Rows[n]["IsShowMoney"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsShowMoney"].ToString() == "1") || (dt.Rows[n]["IsShowMoney"].ToString().ToLower() == "true"))
                        {
                            model.IsShowMoney = true;
                        }
                        else
                        {
                            model.IsShowMoney = false;
                        }
                    }
                    if (dt.Rows[n]["CompanyByUser"].ToString() != "")
                    {
                        if ((dt.Rows[n]["CompanyByUser"].ToString() == "1") || (dt.Rows[n]["CompanyByUser"].ToString().ToLower() == "true"))
                        {
                            model.CompanyByUser = true;
                        }
                        else
                        {
                            model.CompanyByUser = false;
                        }
                    }
                    if (dt.Rows[n]["DoubleNotDefaultWTNum"].ToString() != "")
                    {
                        model.DoubleNotDefaultWTNum = decimal.Parse(dt.Rows[n]["DoubleNotDefaultWTNum"].ToString());
                    }
                    else
                    {
                        model.DoubleNotDefaultWTNum = 0;
                    }
                    if (dt.Rows[n]["OrderDays"].ToString() != "")
                    {
                        model.OrderDays = int.Parse(dt.Rows[n]["OrderDays"].ToString());
                    }
                    if (dt.Rows[n]["OrderNeedEat"].ToString() != "")
                    {
                        if ((dt.Rows[n]["OrderNeedEat"].ToString() == "1") || (dt.Rows[n]["OrderNeedEat"].ToString().ToLower() == "true"))
                        {
                            model.OrderNeedEat = true;
                        }
                        else
                        {
                            model.OrderNeedEat = false;
                        }
                    }
                    if (dt.Rows[n]["IsCheckNoWork"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsCheckNoWork"].ToString() == "1") || (dt.Rows[n]["IsCheckNoWork"].ToString().ToLower() == "true"))
                        {
                            model.IsCheckNoWork = true;
                        }
                        else
                        {
                            model.IsCheckNoWork = false;
                        }
                    }
                    if (dt.Rows[n]["IsCanEditAmount"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsCanEditAmount"].ToString() == "1") || (dt.Rows[n]["IsCanEditAmount"].ToString().ToLower() == "true"))
                        {
                            model.IsCanEditAmount = true;
                        }
                        else
                        {
                            model.IsCanEditAmount = false;
                        }
                    }
                    if (dt.Rows[n]["IsAutoClose"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsAutoClose"].ToString() == "1") || (dt.Rows[n]["IsAutoClose"].ToString().ToLower() == "true"))
                        {
                            model.IsAutoClose = true;
                        }
                        else
                        {
                            model.IsAutoClose = false;
                        }
                    }
                    if (dt.Rows[n]["IsTicketNotNeedCaic"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsTicketNotNeedCaic"].ToString() == "1") || (dt.Rows[n]["IsTicketNotNeedCaic"].ToString().ToLower() == "true"))
                        {
                            model.IsTicketNotNeedCaic = true;
                        }
                        else
                        {
                            model.IsTicketNotNeedCaic = false;
                        }
                    }
                    if (dt.Rows[n]["IsShowOutEmp"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsShowOutEmp"].ToString() == "1") || (dt.Rows[n]["IsShowOutEmp"].ToString().ToLower() == "true"))
                        {
                            model.IsShowOutEmp = true;
                        }
                        else
                        {
                            model.IsShowOutEmp = false;
                        }
                    }
                    model.DataVer = dt.Rows[n]["DataVer"].ToString();
                    if (dt.Rows[n]["MaterielByTask"] != null && dt.Rows[n]["MaterielByTask"].ToString() != "")
                    {
                        if ((dt.Rows[n]["MaterielByTask"].ToString() == "1") || (dt.Rows[n]["MaterielByTask"].ToString().ToLower() == "true"))
                        {
                            model.MaterielByTask = true;
                        }
                        else
                        {
                            model.MaterielByTask = false;
                        }
                    }
                    if (dt.Rows[n]["SumByWorking"] != null && dt.Rows[n]["SumByWorking"].ToString() != "")
                    {
                        if ((dt.Rows[n]["SumByWorking"].ToString() == "1") || (dt.Rows[n]["SumByWorking"].ToString().ToLower() == "true"))
                        {
                            model.SumByWorking = true;
                        }
                        else
                        {
                            model.SumByWorking = false;
                        }
                    }
                    model.A = int.Parse(dt.Rows[n]["A"].ToString());
                    modelList.Add(model);
                }
            }
            return(modelList);
        }