Beispiel #1
0
 protected bool SaveToDB(string path, string tablename)
 {
     try
     {
         DataTable dt = ExcelManage.InputFromExcel(path, tablename);
         if (dt != null && dt.Rows.Count > 0)
         {
             WsSystem wbi = new WsSystem();
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString()))
                 {
                     BasBase bb = new BasBase();
                     bb.CODE    = dt.Rows[i][0].ToString();
                     bb.NAME    = dt.Rows[i][1].ToString();
                     bb.SubCode = dt.Rows[i][2].ToString();
                     bb.SubName = dt.Rows[i][3].ToString();
                     bb.MEMO    = dt.Rows[i][4].ToString();
                     wbi.SaveBaseInfo(bb);
                 }
             }
             return(true);
         }
         else
         {
             Label1.Text = "上传完毕,但数据为空,保存失败";
         }
         return(true);
     }
     catch (Exception ex)
     {
         Label1.Text = ex.ToString();
         return(false);
     }
 }
    protected bool SaveToDB(string path, string tablename)
    {
        try
        {
            DataTable dt = ExcelManage.InputFromExcel(path, tablename);
            if (dt != null && dt.Rows.Count > 0)
            {
                WsSystem wbi = new WsSystem();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString()))
                    {
                        FailItems bb = new FailItems();
                        bb.FailCode = dt.Rows[i][0].ToString();
                        bb.FailType = dt.Rows[i][1].ToString();
                        bb.FailMemo = dt.Rows[i][2].ToString();
                        bb.MEMO1    = dt.Rows[i][3].ToString();

                        wbi.SaveFailItems(bb);
                    }
                }
                return(true);
            }
            else
            {
                Label1.Text = "上传完毕,但数据为空,保存失败";
            }
            return(true);
        }
        catch (Exception ex)
        {
            Label1.Text = ex.ToString();
            return(false);
        }
    }
Beispiel #3
0
 /// <summary>
 /// 点击导出
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void ImgBtnExport_Click(object sender, ImageClickEventArgs e)
 {
     if (ActionValidator("SystemRolesExpert"))
     {
         DataTable dt = DbHelperSql.GetDataTable("SystemRoles", "RloeName,Remarks", (string.IsNullOrEmpty(tbRoleName.Text) ? string.Empty : " RoleName Like '%" + tbRoleName.Text + "%' "), "ID desc").Tables[0]; //导出;
         dt.Columns[0].ColumnName = "角色名称";
         dt.Columns[1].ColumnName = "备注说明";
         ExcelManage.HaikanExcelExport("角色信息列表", dt);
     }
 }
        /// <summary>
        /// 点击导出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BtnExport_Click(object sender, EventArgs e)
        {
            DataTable dt = DbHelperSql.GetDataTable("SystemLog", "UserName,TimeStr,ActionStr,IPAddress", "UserName like '%" + txtUserName.Text.Trim() + "%'  order by ID desc", "").Tables[0]; //导出;

            dt.Columns[0].ColumnName = "用户名";
            dt.Columns[1].ColumnName = "日志时间";
            dt.Columns[2].ColumnName = "操作内容";
            dt.Columns[3].ColumnName = "IP地址";
            ExcelManage.HaikanExcelExport("操作日志", dt);
            AddSystemLog("导出操作日志", "导出");
        }
    protected bool SaveToDB(string path, string tablename)
    {
        try
        {
            DataTable dt = ExcelManage.InputFromExcel(path, tablename);
            if (dt != null && dt.Rows.Count > 0)
            {
                WsSystem wbi = new WsSystem();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString()))
                    {
                        WorkOrderDetails bb = new WorkOrderDetails();
                        bb.WO               = wbi.GetWorkOrderCode();// PubHelper.GetHelper().GetNextID("MES_MASTER.SEQ_ALL_ID").ToString();
                        bb.OrderNumber      = dt.Rows[i][0].ToString();
                        bb.PartsdrawingCode = dt.Rows[i][1].ToString();
                        bb.MachineType      = dt.Rows[i][2].ToString();
                        bb.MachineName      = dt.Rows[i][3].ToString();
                        bb.ProductName      = dt.Rows[i][4].ToString();
                        bb.StartTime        = Convert.ToDateTime(dt.Rows[i][5].ToString());
                        bb.EndTime          = Convert.ToDateTime(dt.Rows[i][6].ToString());
                        bb.BatchNumber      = dt.Rows[i][7].ToString();
                        bb.PlanQuantity     = Convert.ToDecimal(dt.Rows[i][8].ToString());
                        bb.CheckTime        = Convert.ToDateTime(dt.Rows[i][9].ToString());
                        bb.InstockTime      = Convert.ToDateTime(dt.Rows[i][10].ToString());

                        string res = wbi.SaveWorkOrderInfo(bb);
                        if (res != "OK")
                        {
                            Label1.Text = res;
                            return(false);
                        }
                    }
                }
                return(true);
            }
            else
            {
                Label1.Text = "上传完毕,但数据为空,保存失败";
            }
            return(true);
        }
        catch (Exception ex)
        {
            Label1.Text = ex.ToString();
            return(false);
        }
    }
Beispiel #6
0
 protected bool SaveToDB(string path, string tablename)
 {
     try
     {
         DataTable dt = ExcelManage.InputFromExcel(path, tablename);
         if (dt != null && dt.Rows.Count > 0)
         {
             WsSystem wbi     = new WsSystem();
             string   orderno = wbi.GetOrderNoCode();
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString()))
                 {
                     OrderDetail bb = new OrderDetail();
                     bb.OrderNo          = orderno;// dt.Rows[i][0].ToString();
                     bb.CustName         = dt.Rows[i][0].ToString();
                     bb.CONTRACT         = dt.Rows[i][1].ToString();
                     bb.ProductName      = dt.Rows[i][2].ToString();
                     bb.PartsdrawingCode = dt.Rows[i][3].ToString();
                     bb.BatchNumber      = dt.Rows[i][4].ToString();
                     bb.OrderQuantity    = Convert.ToDecimal(dt.Rows[i][5].ToString());
                     bb.OutDate          = Convert.ToDateTime(dt.Rows[i][6].ToString());
                     bb.CheckTime        = Convert.ToDateTime(dt.Rows[i][7].ToString());
                     string res = wbi.SaveOrderInfo(bb);
                     if (res != "OK")
                     {
                         Label1.Text = res;
                         return(false);
                     }
                 }
             }
             return(true);
         }
         else
         {
             Label1.Text = "上传完毕,但数据为空,保存失败";
         }
         return(true);
     }
     catch (Exception ex)
     {
         Label1.Text = ex.ToString();
         return(false);
     }
 }
Beispiel #7
0
 protected bool SaveToDB(string path, string tablename)
 {
     try
     {
         DataTable dt = ExcelManage.InputFromExcel(path, tablename);
         if (dt != null && dt.Rows.Count > 0)
         {
             WsBasic wbi = new WsBasic();
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString()))
                 {
                     BasCustom bc = new BasCustom();
                     bc.CODE          = dt.Rows[i][0].ToString();
                     bc.NAME          = dt.Rows[i][1].ToString();
                     bc.ADDRESS       = dt.Rows[i][2].ToString();
                     bc.TransType     = dt.Rows[i][3].ToString();
                     bc.ReceiveArea   = dt.Rows[i][4].ToString();
                     bc.CONTACT       = dt.Rows[i][5].ToString();
                     bc.MOBILE        = dt.Rows[i][6].ToString();
                     bc.FAX           = dt.Rows[i][7].ToString();
                     bc.InvoiceName   = dt.Rows[i][8].ToString();
                     bc.InvoiceNumber = dt.Rows[i][9].ToString();
                     string result = wbi.SaveCust(bc);
                     if (!string.IsNullOrEmpty(result) && result != "OK")
                     {
                         Label1.Text = result;
                         return(false);
                     }
                 }
             }
             return(true);
         }
         else
         {
             Label1.Text = "上传完毕,但数据为空,保存失败!";
         }
         return(true);
     }
     catch (Exception ex)
     {
         Label1.Text = ex.ToString();
         return(false);
     }
 }
 protected bool SaveToDB(string path, string tablename)
 {
     try
     {
         DataTable dt = ExcelManage.InputFromExcel(path, tablename);
         if (dt != null && dt.Rows.Count > 0)
         {
             WsSystem wbi = new WsSystem();
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString()))
                 {
                     PartsdrawingCode bb = new PartsdrawingCode();
                     bb.ID           = PubHelper.GetHelper().GetNextID("MES_MASTER.SEQ_ALL_ID").ToString();
                     bb.PartsCode    = dt.Rows[i][0].ToString();
                     bb.CustName     = dt.Rows[i][1].ToString();
                     bb.CustCode     = dt.Rows[i][2].ToString();
                     bb.ProductName  = dt.Rows[i][3].ToString();
                     bb.ProductCode  = dt.Rows[i][4].ToString();
                     bb.PlanQuantity = Convert.ToDecimal(dt.Rows[i][5].ToString());
                     bb.QualityCode  = dt.Rows[i][6].ToString();
                     bb.AskQuantity  = Convert.ToDecimal(dt.Rows[i][7].ToString());
                     bb.BatchNumber  = dt.Rows[i][8].ToString();
                     bb.AskDate      = Convert.ToDateTime(dt.Rows[i][9].ToString());
                     bb.ACTIVE       = "1";
                     wbi.SavePartsDrawing(bb);
                 }
             }
             return(true);
         }
         else
         {
             Label1.Text = "上传完毕,但数据为空,保存失败";
         }
         return(true);
     }
     catch (Exception ex)
     {
         Label1.Text = ex.ToString();
         return(false);
     }
 }
    protected bool SaveToDB(string path, string tablename)
    {
        try
        {
            DataTable dt = ExcelManage.InputFromExcel(path, tablename);
            if (dt != null && dt.Rows.Count > 0)
            {
                WsSystem wbi = new WsSystem();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString()))
                    {
                        BasEquipment bb = new BasEquipment();
                        bb.CODE        = dt.Rows[i][0].ToString();
                        bb.COMPANY     = dt.Rows[i][1].ToString();
                        bb.MachineName = dt.Rows[i][2].ToString();
                        bb.MachineType = dt.Rows[i][3].ToString();
                        bb.AxisNumber  = dt.Rows[i][4].ToString();
                        bb.MODEL       = dt.Rows[i][5].ToString();
                        bb.POWER       = dt.Rows[i][6].ToString();
                        bb.LOCATION    = dt.Rows[i][7].ToString();
                        bb.STATUS      = dt.Rows[i][8].ToString();
                        bb.OutCode     = dt.Rows[i][9].ToString();
                        bb.UseDate     = Convert.ToDateTime(string.IsNullOrEmpty(dt.Rows[i][10].ToString())?DateTime.Now.ToShortDateString(): dt.Rows[i][10].ToString());

                        wbi.SaveEquipmentInfo(bb);
                    }
                }
                return(true);
            }
            else
            {
                Label1.Text = "上传完毕,但数据为空,保存失败";
            }
            return(true);
        }
        catch (Exception ex)
        {
            Label1.Text = ex.ToString();
            return(false);
        }
    }
 protected bool SaveToDB(string path, string tablename)
 {
     try
     {
         DataTable dt = ExcelManage.InputFromExcel(path, tablename);
         if (dt != null && dt.Rows.Count > 0)
         {
             WsSystem wbi = new WsSystem();
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString()))
                 {
                     WorkOrderDetails bb = new WorkOrderDetails();
                     bb.WO          = dt.Rows[i][0].ToString();// PubHelper.GetHelper().GetNextID("MES_MASTER.SEQ_ALL_ID").ToString();
                     bb.WorkerName  = dt.Rows[i][1].ToString();
                     bb.WORKER      = wbi.FindUserCodeByUserName(bb.WorkerName);
                     bb.StationName = dt.Rows[i][2].ToString();
                     bb.RouteCode   = dt.Rows[i][3].ToString();
                     string res = wbi.SaveWorkOrderAssign(bb);
                     if (res != "OK")
                     {
                         Label1.Text = res;
                         return(false);
                     }
                 }
             }
             return(true);
         }
         else
         {
             Label1.Text = "上传完毕,但数据为空,保存失败";
         }
         return(true);
     }
     catch (Exception ex)
     {
         Label1.Text = ex.ToString();
         return(false);
     }
 }
Beispiel #11
0
 protected bool SaveToDB(string path, string tablename)
 {
     try
     {
         DataTable dt = ExcelManage.InputFromExcel(path, tablename);
         if (dt != null && dt.Rows.Count > 0)
         {
             WsSystem wbi = new WsSystem();
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString()))
                 {
                     TechnologyWip bb = new TechnologyWip();
                     bb.PARTSDRAWINGNO  = dt.Rows[i][0].ToString();// PubHelper.GetHelper().GetNextID("MES_MASTER.SEQ_ALL_ID").ToString();
                     bb.CustName        = dt.Rows[i][1].ToString();
                     bb.ProductName     = dt.Rows[i][2].ToString();
                     bb.ProcessName     = dt.Rows[i][3].ToString();
                     bb.ProcessEngineer = wbi.FindUserCodeByUserName(bb.ProcessName);
                     bb.PlanDate        = Convert.ToDateTime(dt.Rows[i][4].ToString());
                     bb.STATUS          = 1;
                     bb.StatusMemo      = "分派工艺";
                     wbi.SaveTechnologyInfoForImport(bb);
                 }
             }
             return(true);
         }
         else
         {
             Label1.Text = "上传完毕,但数据为空,保存失败";
         }
         return(true);
     }
     catch (Exception ex)
     {
         Label1.Text = ex.ToString();
         return(false);
     }
 }
Beispiel #12
0
        public ActionResult ExportWorkShopReport()
        {
            try
            {
                DataTable dt = ToDataTable(list);


                string path = Server.MapPath("~/Files");
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                string tempFile = Guid.NewGuid() + ".xlsx";
                string filePath = Path.Combine(path, tempFile);

                ExcelManage.TableToExcel(dt, filePath);
                return(Json(new { ExcelUrl = filePath, Name = "VSS_WorkShopReport_" + System.DateTime.Now.ToString("yyyy-MM-dd") + ".xlsx", stat = true }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { Name = "VSS_WorkShopReport_" + System.DateTime.Now.ToString("yyyy-MM-dd") + ".xlsx", stat = false }, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #13
0
    protected bool SaveToDB(string path, string tablename)
    {
        try
        {
            DataTable dt = ExcelManage.InputFromExcel(path, tablename);
            if (dt != null && dt.Rows.Count > 0)
            {
                WsSystem wbi = new WsSystem();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString()))
                    {
                        BasMateriel bb = new BasMateriel();
                        bb.QPARTNO  = dt.Rows[i][0].ToString();
                        bb.CPARTNO  = dt.Rows[i][1].ToString();
                        bb.NAME     = dt.Rows[i][2].ToString();
                        bb.BasQty   = Convert.ToInt32(dt.Rows[i][3].ToString());
                        bb.CUSTOMER = dt.Rows[i][4].ToString();
                        bb.MEMO     = dt.Rows[i][5].ToString();

                        wbi.SaveMaterielInfo(bb);
                    }
                }
                return(true);
            }
            else
            {
                Label1.Text = "上传完毕,但数据为空,保存失败";
            }
            return(true);
        }
        catch (Exception ex)
        {
            Label1.Text = ex.ToString();
            return(false);
        }
    }