|  |  |  | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | DataSet ds1; | 
|---|
|  |  |  | string fileip = System.Configuration.ConfigurationManager.AppSettings["FileIP"]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 新增单据-保存按钮 | 
|---|
|  |  |  | ///参数:string sql。 | 
|---|
|  |  |  | ///返回值:object。 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | [Route("Cj_StationOutBill/AddBill")] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 新增单据-保存按钮 | 
|---|
|  |  |  | ///参数:string sql。 | 
|---|
|  |  |  | ///返回值:object。 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | [Route("Cj_StationOutBill/AddBill")] | 
|---|
|  |  |  | [HttpPost] | 
|---|
|  |  |  | public object AddBill([FromBody] JObject oMain) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | ///参数:string sql。 | 
|---|
|  |  |  | ///返回值:object。 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  | [Route("Cj_StationOutBill/list")] | 
|---|
|  |  |  | [Route("Cj_StationOutBill/get_Display")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object list(string sWhere) | 
|---|
|  |  |  | public object get_Display(string sWhere) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | string HRemark = HttpContext.Current.Request.Params["HRemark"];  //备注 | 
|---|
|  |  |  | string HUserName = HttpContext.Current.Request.Params["HUserName"];  //创建人 | 
|---|
|  |  |  | HttpPostedFile files = HttpContext.Current.Request.Files["file"]; | 
|---|
|  |  |  | string path = HttpContext.Current.Server.MapPath("~/Files/" + HBillNo); | 
|---|
|  |  |  | string path = HttpContext.Current.Server.MapPath("~/../Files/" + HBillNo); | 
|---|
|  |  |  | //string path = @"D:\\Files\\"+ HBillNo; | 
|---|
|  |  |  | dynamic dyResult = UpLoadFile(files, path, HBillNo, HRemark, HUserName); | 
|---|
|  |  |  | if (dyResult != null && dyResult.result == 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "上传失败!"; | 
|---|
|  |  |  | objJsonResult.Message = dyResult.returnval; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | File.Delete(fileurl);      //删除指定文件 | 
|---|
|  |  |  | files.SaveAs(fileurl); | 
|---|
|  |  |  | string StrPath = "/Files/"+ HBillNo+"/"+ filename; | 
|---|
|  |  |  | string StrPath = "/files/"+ HBillNo+"/"+ filename; | 
|---|
|  |  |  | if (File.Exists(fileurl)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //这里可以执行一些其它的操作,比如更新数据库 | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Directory.CreateDirectory(fileSavePath); //添加文件夹 | 
|---|
|  |  |  | files.SaveAs(fileurl); | 
|---|
|  |  |  | string StrPath = "/Files/" + HBillNo + "/" + filename; | 
|---|
|  |  |  | string StrPath = "/files/" + HBillNo + "/" + filename; | 
|---|
|  |  |  | if (File.Exists(fileurl)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //这里可以执行一些其它的操作,比如更新数据库 | 
|---|
|  |  |  | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object Filelist(string HBillNo) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var url = fileip + "/Files/" + HBillNo+"/"; | 
|---|
|  |  |  | var url = fileip + "/files/" + HBillNo+"/"; | 
|---|
|  |  |  | //@"C:\\files\\" | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select *,'" + url + "'+CAST(HFileName as varchar(200))as url  from MES_AccessoriesList where HSourceBillNo=" + HBillNo, "MES_AccessoriesList"); | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select *,'" + url + "'+CAST(HFileName as varchar(200))as url  from MES_AccessoriesList where HSourceBillNo='" + HBillNo+"'", "MES_AccessoriesList"); | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "Sucess!"; | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ds = oCN.RunProcReturn("delete from MES_AccessoriesList where HItemID ='" + HItemID + "'", "MES_AccessoriesList"); | 
|---|
|  |  |  | string fileurl = Path.Combine(HttpContext.Current.Server.MapPath("~/Files/" + HSourceBillNo), HFileName); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.RunProc("delete from MES_AccessoriesList where HItemID =" + HItemID); | 
|---|
|  |  |  | string fileurl = Path.Combine(HttpContext.Current.Server.MapPath("~/../Files/" + HSourceBillNo), HFileName); | 
|---|
|  |  |  | File.Delete(fileurl);      //删除指定文件 | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "删除成功!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|