public FileResult aj_excelEquipmentDown(q_Equipment_Chiller q)
        {
            HSSFWorkbook wbXLS;
            FileStream fileStream = null;
            MemoryStream outputStream = new MemoryStream();
            try
            {
                db0 = getDB0();
                fileStream = new FileStream(Server.MapPath("~/_Code/RPTExcel/Equipment.xls"), FileMode.Open, FileAccess.ReadWrite);
                wbXLS = new HSSFWorkbook(fileStream);
                ISheet getSheet = wbXLS.GetSheet("設備表");

                Apply_User getUserData = null;
                if (this.UserId != null)
                {
                    getUserData = db0.Apply_User.Where(x => x.USERID == this.UserId).FirstOrDefault();
                }

                SetCellValue(getSheet, "C3", getUserData.USERNAME);
                SetCellValue(getSheet, "E2", DateTime.Now.ToString("yyyy/MM/dd"));
                SetCellValue(getSheet, "E3", getUserData.USERID);

                wbXLS.Write(outputStream);

                outputStream.Position = 0;
                string setFileName = this.UserId + "-01-設備-" + DateTime.Now.ToString("yyyyMMddHHmm") + ".xls";

                if (Request.Browser.Browser == "IE" && Request.Browser.Version == "8.0")
                {
                    byte[] bytes = outputStream.ToArray();
                    Response.Clear();
                    Response.ContentType = "application/xls";
                    Response.AddHeader("content-disposition", "attachment;filename=" + Server.UrlEncode(setFileName));
                    Response.BinaryWrite(bytes);
                    Response.End();
                }

                return File(outputStream, "application/vnd.ms-excel", setFileName);
            }
            catch (Exception ex)
            {
                Log.Write(ex.Message + ex.StackTrace);
                return null;
            }
            finally
            {
                db0.Dispose();
            }
        }
        public async Task<string> aj_excelEquipmentDelete(q_Equipment_Chiller q)
        {
            ReturnAjaxFiles rAjaxResult = new ReturnAjaxFiles();

            #region
            try
            {
                db0 = getDB0();
                if (q.user_id == null)
                {
                    rAjaxResult.result = false;
                    rAjaxResult.message = "未選擇userid";
                    return defJSON(rAjaxResult);
                }
                var getEquipments = db0.Equipment_Chiller.Where(x => x.USERID == this.UserId).ToList();
                #region 刪除設備功能
                //已在申報中的不移除
                foreach (var equip in getEquipments)
                {
                    var checkCIsExist = db0.Apply_Detail_Condenser.Any(x => x.equipment_id == equip.equipment_chiller_id);
                    var checkEIsExist = db0.Apply_Detail_Evaporate.Any(x => x.equipment_id == equip.equipment_chiller_id);
                    if (!checkCIsExist && !checkEIsExist)
                    {
                        db0.Equipment_Chiller.Remove(equip);
                    }
                }
                await db0.SaveChangesAsync();
                #endregion
                rAjaxResult.result = true;
                rAjaxResult.success = true;

            }
            catch (LogicError ex)
            {
                rAjaxResult.result = false;
                rAjaxResult.message = getRecMessage(ex.Message);
            }
            catch (Exception ex)
            {
                rAjaxResult.result = false;
                rAjaxResult.message = ex.Message + ex.StackTrace;
            }
            finally
            {
                db0.Dispose();
            }
            #endregion
            return defJSON(rAjaxResult);
        }