Esempio n. 1
0
        private void InitData()
        {
            try
            {
                using (var db = SugarDao.GetInstance())
                {
                    string sqlWhere = "1=1";

                    if (!string.IsNullOrWhiteSpace(date_begin.Text.Trim()))
                    {
                        sqlWhere += $" and datetime(Date) >= datetime('{DateTime.Parse(date_begin.Text.Trim()):yyyy-MM-dd}')";
                    }

                    if (!string.IsNullOrWhiteSpace(date_end.Text.Trim()))
                    {
                        sqlWhere += $" and datetime(Date) < datetime('{DateTime.Parse(date_end.Text.Trim()).AddDays(1):yyyy-MM-dd}')";
                    }

                    if (!string.IsNullOrWhiteSpace(lue_LogType.EditValue?.ToString()))
                    {
                        sqlWhere += $" and LogType='{lue_LogType.Text}'";
                    }

                    int count    = 0;
                    var dataList = db.Queryable <Log>().Where(sqlWhere).OrderBy(t => t.LogId, OrderByType.Desc).ToPageList(pageIndex, pageSize, ref count);

                    if (dataList == null || !dataList.Any())
                    {
                        gd_list.DataSource = null;
                        gd_list.Refresh();
                        gd_list.RefreshDataSource();
                        return;
                    }

                    gd_list.DataSource = dataList;
                    gd_list.Refresh();
                    gd_list.RefreshDataSource();

                    this.gridView1.BestFitColumns(); //自动调整所有字段宽度
                    gridView1.IndicatorWidth = 30;   //设置显示行号的列宽

                    //设置奇、偶行交替颜色
                    gridView1.OptionsView.EnableAppearanceEvenRow = true;
                    gridView1.OptionsView.EnableAppearanceOddRow  = true;
                    gridView1.Appearance.EvenRow.BackColor        = Color.GhostWhite;
                    gridView1.Appearance.OddRow.BackColor         = Color.White;

                    //view行中值居左
                    this.gridView1.Appearance.Row.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
                    //view列标题居左
                    this.gridView1.Appearance.HeaderPanel.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;

                    if (pageIndex == 1)
                    {
                        InitPageCount(count);
                        lbl_Sum.Text = $"总数:{count}";
                    }
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("业务日志加载失败!" + ex.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 加载下拉列表
        /// </summary> <param name="lue">下拉控件</param>
        private void InitLookUpEdit(LookUpEdit lue)
        {
            try
            {
                using (var db = SugarDao.GetInstance())
                {
                    int i    = 0;
                    var list = new List <SelectItem>()
                    {
                        new SelectItem()
                        {
                            Key = i++.ToString(), Value = LogType.采购入库.ToString()
                        },
                        new SelectItem()
                        {
                            Key = i++.ToString(), Value = LogType.入库明细.ToString()
                        },
                        new SelectItem()
                        {
                            Key = i++.ToString(), Value = LogType.销售出库.ToString()
                        },
                        new SelectItem()
                        {
                            Key = i++.ToString(), Value = LogType.出库明细.ToString()
                        },
                        new SelectItem()
                        {
                            Key = i++.ToString(), Value = LogType.库存修改.ToString()
                        },
                        new SelectItem()
                        {
                            Key = i++.ToString(), Value = LogType.药品信息.ToString()
                        },
                        new SelectItem()
                        {
                            Key = i++.ToString(), Value = LogType.基础信息.ToString()
                        },
                        new SelectItem()
                        {
                            Key = i++.ToString(), Value = LogType.其他.ToString()
                        },
                    };


                    if (list.Count > 0)
                    {
                        var l = list.Select(t => new { t.Key, t.Value }).ToList();

                        lue.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Value", "类型"));
                        lue.Properties.NullText              = "";
                        lue.Properties.ImmediatePopup        = true;                                                    //当用户在输入框按任一可见字符键时立即弹出下拉窗体
                        lue.Properties.TextEditStyle         = DevExpress.XtraEditors.Controls.TextEditStyles.Standard; //要使用户可以输入,这里须设为Standard
                        lue.Properties.SearchMode            = SearchMode.OnlyInPopup;                                  //自动过滤掉不需要显示的数据,可以根据需要变化
                        lue.Properties.AutoSearchColumnIndex = 1;

                        //lue.Properties.NullText = "请选择";
                        //lue.EditValue = "Id";
                        lue.Properties.DisplayMember = "Value";
                        lue.Properties.ShowHeader    = true;
                        //lue.ItemIndex = 0;        //选择第一项
                        lue.Properties.DataSource = list;

                        //自适应宽度
                        lue.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
                        //填充列
                        //lue.Properties.PopulateColumns();
                        //lue.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Character"));
                        //lue.Properties.Columns[0].Visible = false;
                    }
                    else
                    {
                        lue.Properties.NullText = "";
                    }
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("加载数据出错!" + ex.Message);
            }
        }
Esempio n. 3
0
        //上传西服裤子尺码表
        public static bool Import_Excel_trousrs(DataTable table, string Size_Code, out string errmsg)
        {
            using (var db = SugarDao.GetInstance())
                try
                {
                    List <TrousersSize> tszie_list = new List <TrousersSize>();

                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        #region 处理不符合要求得数据
                        DataRow row = table.Rows[i];
                        row.BeginEdit();
                        for (int a = 0; a < table.Columns.Count; a++)
                        {
                            if (row[a].ToString().IndexOf("....") > 0)
                            {
                                row[a] = row[a].ToString().Replace("....", ".");
                            }
                            if (row[a].ToString().IndexOf("...") > 0)
                            {
                                row[a] = row[a].ToString().Replace("...", ".");
                            }
                            if (row[a].ToString().IndexOf("..") > 0)
                            {
                                row[a] = row[a].ToString().Replace("..", ".");
                            }

                            if (row[a].ToString().IndexOf("null") > 0)
                            {
                                row[a] = row[a].ToString().Replace("null", "0");
                            }
                            if (string.IsNullOrEmpty(row[a].ToString()))
                            {
                                row[a] = 0;
                            }
                        }
                        row.EndEdit();
                        #endregion

                        #region 保存尺码



                        TrousersSize tszie = new TrousersSize();
                        foreach (DataRow item in table.Rows)
                        {
                            tszie.Code = item["Code"].ToString();
                            decimal ty = 0;
                            if (decimal.TryParse(item["DZ_HipLength_CP"].ToString(), out ty))
                            {
                                tszie.DZ_HipLength_CP = ty;
                            }
                            else
                            {
                                tszie.DZ_HipLength_CP = 0;
                            }


                            if (decimal.TryParse(item["SZ_HipLength_CP"].ToString(), out ty))
                            {
                                tszie.SZ_HipLength_CP = ty;
                            }
                            else
                            {
                                tszie.SZ_HipLength_CP = 0;
                            }

                            if (decimal.TryParse(item["Crosspiece"].ToString(), out ty))
                            {
                                tszie.Crosspiece = ty;
                            }
                            else
                            {
                                tszie.Crosspiece = 0;
                            }

                            if (decimal.TryParse(item["LegWidth_UnderTheWaves"].ToString(), out ty))
                            {
                                tszie.LegWidth_UnderTheWaves = ty;
                            }
                            else
                            {
                                tszie.LegWidth_UnderTheWaves = 0;
                            }

                            if (decimal.TryParse(item["FrontRise_EvenWaist"].ToString(), out ty))
                            {
                                tszie.FrontRise_EvenWaist = ty;
                            }
                            else
                            {
                                tszie.FrontRise_EvenWaist = 0;
                            }

                            if (decimal.TryParse(item["AfterTheWaves_EvenWaist"].ToString(), out ty))
                            {
                                tszie.AfterTheWaves_EvenWaist = ty;
                            }
                            else
                            {
                                tszie.AfterTheWaves_EvenWaist = 0;
                            }

                            tszie.NetHip        = item["NetHip"].ToString();
                            tszie.CP_WaistWidth = item["CP_WaistWidth"].ToString();
                            tszie.Height        = item["Height"].ToString();
                            tszie.LongPants     = item["LongPants"].ToString();
                            tszie.NetWaist      = item["NetWaist"].ToString();
                            tszie.Size_Code     = Size_Code;
                        }
                        tszie_list.Add(tszie);

                        #endregion
                    }
                    db.InsertRange(tszie_list);
                    db.CommitTran();
                    errmsg = "";
                    return(true);
                }
                catch (Exception ex)
                {
                    db.RollbackTran();                    //回滚事务
                    errmsg = ex.Message;
                    return(false);
                }
        }
Esempio n. 4
0
        /// <summary>
        /// 获取列表信息
        /// </summary>
        /// <param name="pagenum"></param>
        /// <param name="onepagecount"></param>
        /// <param name="totil"></param>
        /// <param name="totilpage"></param>
        /// <param name="exmsg"></param>
        /// <param name="type"></param>
        /// <param name="purch_code"></param>
        /// <returns></returns>
        public List <ProcurementModel> GetProcurementList(int pagenum, int onepagecount, out int totil, out int totilpage, out string exmsg, int?type, string purch_code, string OrderCode, string express_code, string supp_name)
        {
            using (var db = SugarDao.GetInstance(LoginUser.GetConstr()))
            {
                try
                {
                    var getwhere = db.Queryable <busi_purchase>()
                                   .JoinTable <base_users>((s1, s2) => s1.create_user_id == s2.user_id)
                                   .JoinTable <base_supplier>((s1, s3) => s1.supp_id == s3.supp_id)
                                   .Where("s1.del_flag=1 and s2.del_flag=1 and s3.del_flag=1").OrderBy("s1.purch_id DESC");
                    if (type.HasValue && type > 0)
                    {
                        getwhere = getwhere.Where("s1.purch_status=" + type + "");
                    }
                    if (!string.IsNullOrWhiteSpace(purch_code))
                    {
                        getwhere = getwhere.Where("s1.purch_code LIKE '%" + purch_code + "%'");
                    }
                    if (!string.IsNullOrWhiteSpace(OrderCode))
                    {
                        getwhere = getwhere.Where("s1.OrderCode LIKE '%" + OrderCode + "%'");
                    }

                    if (!string.IsNullOrWhiteSpace(express_code))
                    {
                        getwhere = getwhere.Where("s1.express_code LIKE '%" + express_code + "%'");
                    }
                    if (!string.IsNullOrWhiteSpace(supp_name))
                    {
                        getwhere = getwhere.Where("s3.supp_name LIKE '%" + supp_name + "%'");
                    }


                    totil = getwhere.Count();
                    var list = getwhere.Skip(onepagecount * (pagenum - 1)).Take(onepagecount)
                               .Select <base_users, base_supplier, ProcurementModel>((s1, s2, s3) => new ProcurementModel
                    {
                        express_code  = s1.express_code,
                        purch_id      = s1.purch_id,
                        purch_code    = s1.purch_code,
                        purchase_time = s1.create_time,
                        purch_status  = s1.purch_status,
                        emp_name      = s2.user_name,
                        purch_type    = s1.purch_type,
                        supp_name     = s3.supp_name,
                        OrderCode     = s1.OrderCode,
                        isLocked      = s1.isLocked,
                        Locked_userid = s1.Locked_userid,
                    }).ToList();
                    if (totil > 0)
                    {
                        foreach (var item in list)
                        {
                            if (item.purchase_time == null)
                            {
                                item.purchase_timeE = "";
                            }
                            else
                            {
                                item.purchase_timeE = item.purchase_time.Value.ToString("yyyy-MM-dd");
                            }
                            item.purch_statusE = item.purch_status == 1 ? "初始" : (item.purch_status == 2 ? "已采购" : (item.purch_status == 3 ? "待收货" : (item.purch_status == 4 ? "已全部到货" : "")));
                            item.purch_typeE   = item.purch_type == 1 ? "订单采购" : (item.purch_type == 2 ? "库存采购" : "");
                            item.OrderCodeE    = item.OrderCode == null ? "" : item.OrderCode;
                            item.express_codeE = item.express_code == null ? "" : item.express_code;

                            //if (item.isLocked)
                            //{
                            //    var info = db.Queryable<base_users>().InSingle(item.Locked_userid);
                            //    if (info != null)
                            //    {
                            //        item.isLockedE = "已锁定&nbsp;&nbsp;(" + info.user_name + ")";
                            //    }
                            //    else
                            //    {
                            //        item.isLockedE = "已锁定&nbsp;&nbsp;" + "()";
                            //    }

                            //}
                            //else
                            //{
                            //    item.isLockedE = "未锁定";
                            //}
                        }
                    }
                    totilpage = totil / onepagecount;
                    exmsg     = "";
                    if (totil % onepagecount > 0)
                    {
                        totilpage++;
                    }
                    return(list.ToList());
                }
                catch (Exception ex)
                {
                    exmsg     = ex.ToString();
                    totil     = 0;
                    totilpage = 0;
                    return(null);
                }
            }
        }
Esempio n. 5
0
        //上传西服上衣尺码表
        public static bool Import_Excel_jacket(DataTable table, string size_code, string gender, out string errmsg)
        {
            using (var db = SugarDao.GetInstance())
                try
                {
                    db.CommandTimeOut = 3000;                    //设置超时时间

                    List <CoatSize> list = new List <CoatSize>();

                    db.BeginTran();

                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        #region 处理不符合要求得数据

                        DataRow row = table.Rows[i];

                        row.BeginEdit();

                        for (int a = 0; a < table.Columns.Count; a++)
                        {
                            if (row[a].ToString().IndexOf("....") > 0)
                            {
                                row[a] = row[a].ToString().Replace("....", ".");
                            }
                            if (row[a].ToString().IndexOf("...") > 0)
                            {
                                row[a] = row[a].ToString().Replace("...", ".");
                            }
                            if (row[a].ToString().IndexOf("..") > 0)
                            {
                                row[a] = row[a].ToString().Replace("..", ".");
                            }
                        }

                        row.EndEdit();

                        #endregion
                        if (!string.IsNullOrEmpty(gender))
                        {
                            object ruid;
                            if (gender == "男")
                            {
                                XF_SY_NAN_CodeSize cs = new XF_SY_NAN_CodeSize();

                                cs.Height = Convert.ToDecimal(table.Rows[i]["Height"]);

                                cs.FrontLength = table.Rows[i]["FrontLength"] + "";

                                cs.NetBust = table.Rows[i]["NetBust"] + "";

                                cs.FinishedBust = Convert.ToDecimal(table.Rows[i]["FinishedBust"]);

                                cs.InWaist = Convert.ToDecimal(table.Rows[i]["InWaist"]);

                                cs.FinishedHem_NoFork = Convert.ToDecimal(table.Rows[i]["FinishedHem_NoFork"]);

                                cs.FinishedHem_SplitEnds = Convert.ToDecimal(table.Rows[i]["FinishedHem_SplitEnds"]);

                                cs.ShoulderWidth = Convert.ToDecimal(table.Rows[i]["ShoulderWidth"]);

                                cs.Size_Code = size_code;

                                cs.Height = Convert.ToDecimal(table.Rows[i]["Height"]);

                                cs.Sleecve_Show = table.Rows[i]["FK_Sleeve_ID"] + "";

                                cs.CreateDateTime = DateTime.Now;

                                cs.IsDeleted = false;

                                cs.Status = 1;

                                ruid = db.Insert(cs, true);
                            }
                            else
                            {
                                XF_SY_NU_CodeSize cs = new XF_SY_NU_CodeSize();

                                cs.Height = Convert.ToDecimal(table.Rows[i]["Height"]);

                                cs.FrontLength = table.Rows[i]["FrontLength"] + "";

                                cs.NetBust = table.Rows[i]["NetBust"] + "";

                                cs.FinishedBust = Convert.ToDecimal(table.Rows[i]["FinishedBust"]);

                                cs.InWaist = Convert.ToDecimal(table.Rows[i]["InWaist"]);

                                cs.FinishedHem_NoFork = Convert.ToDecimal(table.Rows[i]["FinishedHem_NoFork"]);

                                cs.SleeveWidth = Convert.ToDecimal(table.Rows[i]["SleeveWidth"]);

                                cs.ShoulderWidth = Convert.ToDecimal(table.Rows[i]["ShoulderWidth"]);

                                cs.Size_Code = size_code;

                                cs.Sleecve_Show = table.Rows[i]["FK_Sleeve_ID"] + "";

                                cs.CreateDateTime = DateTime.Now;

                                cs.IsDeleted = false;

                                cs.Status = 1;

                                ruid = db.Insert(cs, true);
                            }


                            string req = table.Rows[i]["FK_Sleeve_ID"] + "";

                            if (req.IndexOf("      ") > 0)
                            {
                                req = req.Replace("      ", "^");
                            }

                            if (req.IndexOf("     ") > 0)
                            {
                                req = req.Replace("     ", "^");
                            }

                            if (req.IndexOf("    ") > 0)
                            {
                                req = req.Replace("    ", "^");
                            }

                            if (req.IndexOf("   ") > 0)
                            {
                                req = req.Replace("   ", "^");
                            }

                            if (req.IndexOf("  ") > 0)
                            {
                                req = req.Replace("  ", "^");
                            }

                            req = req.Replace(" ", "^");

                            req = req.Replace(":", ";");

                            string[] sleeve_arrey = req.Split('^');

                            Sleeve see = new Sleeve();
                            see.FK_CoatSize_ID = Convert.ToInt32(ruid);
                            see.Code           = sleeve_arrey[0].Split(';')[0];
                            see.Length         = Convert.ToDecimal(sleeve_arrey[0].Split(';')[1]);
                            db.Insert(see);
                        }
                    }

                    db.CommitTran();
                    errmsg = "";
                    return(true);
                }
                catch (Exception ex)
                {
                    db.RollbackTran();                    //回滚事务
                    errmsg = ex.Message;
                    return(false);
                }
        }