zgq
2021-06-18 99d4eb3bb21d12e5477e8d00305bab8324bbce90
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -22,13 +22,13 @@
        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)
        {
@@ -484,7 +484,8 @@
            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)
            {
@@ -539,7 +540,7 @@
                {
                    File.Delete(fileurl);      //删除指定文件
                    files.SaveAs(fileurl);
                    string StrPath = "/Files/"+ HBillNo+"/"+ filename;
                    string StrPath = "/files/"+ HBillNo+"/"+ filename;
                    if (File.Exists(fileurl)) 
                    {
                        //这里可以执行一些其它的操作,比如更新数据库
@@ -562,7 +563,7 @@
                {
                    Directory.CreateDirectory(fileSavePath); //添加文件夹
                    files.SaveAs(fileurl);
                    string StrPath = "/Files/" + HBillNo + "/" + filename;
                    string StrPath = "/files/" + HBillNo + "/" + filename;
                    if (File.Exists(fileurl))
                    {
                        //这里可以执行一些其它的操作,比如更新数据库
@@ -612,10 +613,11 @@
        [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!";
@@ -644,16 +646,15 @@
        {
            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)
            {