Эх сурвалжийг харах

新增授权文件上传下载

zhuyiyi 1 сар өмнө
parent
commit
d7ebfa62f6

+ 55 - 0
Web/EDelivery/js/ChangeDelivery.js

@@ -158,6 +158,9 @@ function actionRenderer(e) {
         }
         html += getGridBtn("view", "下载附件", "downAddressFile('" + url + "')");
     }
+    if (record.authCount > 0) {
+        html += getGridBtn("view", "授权下载", "downAuth('" + record.tid + "','" + record.ctid + "')");
+    }
     return html;
 }
 
@@ -676,4 +679,56 @@ function downAddressFile(url) {
     xhr.send(pdata); // 发送下载文件请求
 }
 
+function downAuth(ctid, tid) {
+    postAjax("getCellFile", { tid: tid, ctid: ctid, type: "AUTH_FILE" }, function (data) {
+        for (var i = 0; i < data.length; i++) {
+            downAttaLocal(data[i].url)
+        }
+    });
+}
+function downAttaLocal(url) {
+    var pdata = "url=" + url;
+
+    var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest实例
+    xhr.open('POST', "../plug/uploadFileOss.aspx"); // 打开下载文件请求
+    xhr.responseType = "blob";
+    xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
+    xhr.onloadstart = function () {
+    };
+    xhr.onprogress = function (event) {
+
+    };
+    xhr.onerror = function () {
+        progressHide();
+    }
+    xhr.ontimeout = function () {
+        progressHide();
+    }
+    xhr.onloadend = function () {
+        if (xhr.status === 200) {
+            try {
+                let blob = xhr.response;
+                let fileName = xhr.getResponseHeader("Content-Disposition").split('filename=')[1];
+                fileName = decodeURIComponent(fileName);
+
+                let url = URL.createObjectURL(blob);
+                let a = document.createElement('a');
+                a.href = url;
+                a.download = fileName;
+                document.body.appendChild(a);
+                a.click();
+                document.body.removeChild(a);
+                window.URL.revokeObjectURL(url);
+            } catch (e) {
+                progressHide();
+            }
+
+
+        } else {
+
+        }
+        progressHide();
 
+    };
+    xhr.send(pdata); // 发送下载文件请求
+}

+ 11 - 0
Web/EDelivery/js/DeliveredList.js

@@ -298,6 +298,9 @@ function actionRenderer(e) {
         }
         html += getGridBtn("view", "下载附件", "downAtta('" + url + "')");
     }
+    if (record.authCount > 0) {
+        html += getGridBtn("view", "授权下载", "downAuth('" + record.tid + "','" + record.ctid + "')");
+    }
     html += getGridBtn("word", "重新打单", "rePlaceOrder('" + record.ctid + "','" + record.seller_memo + "')");
 
     return html;
@@ -462,4 +465,12 @@ function printPlace(out_sid, seller_memo) {
     postAjax("getExpressPostData", { express: out_sid, }, function (data) {
         doPrintEn(JSON.stringify(data.data), seller_memo)
     })
+}
+
+function downAuth(ctid, tid) {
+    postAjax("getCellFile", { tid: tid, ctid: ctid, type: "AUTH_FILE" }, function (data) {
+        for (var i = 0; i < data.length; i++) {
+            downAtta(data[i].url)
+        }
+    });
 }

+ 10 - 0
Web/EDelivery/js/PddDelivered.js

@@ -317,6 +317,9 @@ function actionRenderer(e) {
         }
         html += getGridBtn("view", "下载附件", "downAtta('" + url + "')");
     }
+    if (record.authCount > 0) {
+        html += getGridBtn("view", "授权下载", "downAuth('" + record.tid + "','" + record.ctid + "')");
+    }
     html += getGridBtn("word", "重新打单", "rePlaceOrder('" + record.ctid + "','" + record.seller_memo + "')");
     return html;
 }
@@ -459,4 +462,11 @@ function printPlace(out_sid, seller_memo) {
     postAjax("getExpressPostData", { express: out_sid, }, function (data) {
         doPrintEn(JSON.stringify(data.data), seller_memo)
     })
+}
+function downAuth(ctid, tid) {
+    postAjax("getCellFile", { tid: tid, ctid: ctid, type: "AUTH_FILE" }, function (data) {
+        for (var i = 0; i < data.length; i++) {
+            downAtta(data[i].url)
+        }
+    });
 }

+ 55 - 0
Web/EDelivery/js/PddDelivering.js

@@ -188,6 +188,9 @@ function actionRenderer(e) {
         }
         html += getGridBtn("view", "下载附件", "downAtta('" + url + "')");
     }
+    if (record.authCount > 0) {
+        html += getGridBtn("view", "授权下载", "downAuth('" + record.tid + "','" + record.ctid + "')");
+    }
     return html;
 }
 
@@ -676,5 +679,57 @@ function onCopyBuyerNick(e) {
     //rec.ctid
     copyTextPlus(rec.buyer_nick);
 }
+function downAuth(ctid, tid) {
+    postAjax("getCellFile", { tid: tid, ctid: ctid, type: "AUTH_FILE" }, function (data) {
+        for (var i = 0; i < data.length; i++) {
+            downAtta(data[i].url)
+        }
+    });
+}
+function downAtta(url) {
+    var pdata = "url=" + url;
 
+    var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest实例
+    xhr.open('POST', "../plug/uploadFileOss.aspx"); // 打开下载文件请求
+    xhr.responseType = "blob";
+    xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
+    xhr.onloadstart = function () {
+    };
+    xhr.onprogress = function (event) {
+
+    };
+    xhr.onerror = function () {
+        progressHide();
+    }
+    xhr.ontimeout = function () {
+        progressHide();
+    }
+    xhr.onloadend = function () {
+        if (xhr.status === 200) {
+            try {
+                let blob = xhr.response;
+                let fileName = xhr.getResponseHeader("Content-Disposition").split('filename=')[1];
+                fileName = decodeURIComponent(fileName);
+
+                let url = URL.createObjectURL(blob);
+                let a = document.createElement('a');
+                a.href = url;
+                a.download = fileName;
+                document.body.appendChild(a);
+                a.click();
+                document.body.removeChild(a);
+                window.URL.revokeObjectURL(url);
+            } catch (e) {
+                progressHide();
+            }
+
+
+        } else {
+
+        }
+        progressHide();
+
+    };
+    xhr.send(pdata); // 发送下载文件请求
+}
 

+ 55 - 0
Web/EDelivery/js/WaitingDelivery.js

@@ -161,6 +161,9 @@ function actionRenderer(e) {
         }
         html += getGridBtn("view", "下载附件", "downAtta('" + url + "')");
     }
+    if (record.authCount > 0) {
+        html += getGridBtn("view", "授权下载", "downAuth('" + record.tid + "','" + record.ctid + "')");
+    }
     return html;
 }
 function viewCdrImg(id) {
@@ -685,4 +688,56 @@ function cancelWaybillFn() {
     });
 }
 
+function downAuth(ctid, tid) {
+    postAjax("getCellFile", { tid: tid, ctid: ctid, type: "AUTH_FILE" }, function (data) {
+        for (var i = 0; i < data.length; i++) {
+            downAtta(data[i].url)
+        }
+    });
+}
+function downAtta(url) {
+    var pdata = "url=" + url;
 
+    var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest实例
+    xhr.open('POST', "../plug/uploadFileOss.aspx"); // 打开下载文件请求
+    xhr.responseType = "blob";
+    xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
+    xhr.onloadstart = function () {
+    };
+    xhr.onprogress = function (event) {
+
+    };
+    xhr.onerror = function () {
+        progressHide();
+    }
+    xhr.ontimeout = function () {
+        progressHide();
+    }
+    xhr.onloadend = function () {
+        if (xhr.status === 200) {
+            try {
+                let blob = xhr.response;
+                let fileName = xhr.getResponseHeader("Content-Disposition").split('filename=')[1];
+                fileName = decodeURIComponent(fileName);
+
+                let url = URL.createObjectURL(blob);
+                let a = document.createElement('a');
+                a.href = url;
+                a.download = fileName;
+                document.body.appendChild(a);
+                a.click();
+                document.body.removeChild(a);
+                window.URL.revokeObjectURL(url);
+            } catch (e) {
+                progressHide();
+            }
+
+
+        } else {
+
+        }
+        progressHide();
+
+    };
+    xhr.send(pdata); // 发送下载文件请求
+}

+ 3 - 2
Web/EOrder/OrderList.aspx

@@ -188,6 +188,7 @@
         <li name="edit" iconcls="icon-stop" onclick="onReturnVisit">客户回访</li>
         <li name="edit" iconcls="icon-dispatch" onclick="onOriFileVisit('ORI_FILE')">上传客户文件</li>
         <li name="edit" iconcls="icon-mation" onclick="onOriFileVisit('PACK_FILE')">查看包裹图片</li>
+        <li name="edit" iconcls="icon-mation" onclick="onOriFileVisit('AUTH_FILE')">授权文件</li>
         <li name="edit" iconcls="icon-split" onclick="onOpenTemplate">查看模板</li>
         <!-- <li name="edit" iconcls="icon-hostrepertory" onclick="onOpenInvoice">发票</li> -->
     </ul>
@@ -1233,7 +1234,7 @@
             ori_ctid = rec.ctid;
             ori_type = type;
             $("#ori_file").hide();
-            if (type == "ORI_FILE") {
+            if (type == "ORI_FILE" || type == "AUTH_FILE") {
                 $("#ori_file").show();
             }
             getFilesList();
@@ -1250,7 +1251,7 @@
                     html += `<div style="display:flex;gap:10px">
                         <div>${data[i].url}</div>
                         <div style="cursor: pointer;" onclick="downCellFile('${data[i].url}')")>下载</div>
-                        ${ori_type == "ORI_FILE" ? delBtn : ""}
+                        ${ori_type == "ORI_FILE"||"AUTH_FILE" ? delBtn : ""}
                     </div>`
                 }
                 $("#oriFile_url").append(html == "" ? "暂无文件" : html);

+ 3 - 2
Web/plug/uploadFileOss.aspx.cs

@@ -30,12 +30,13 @@ public partial class plug_uploadFileOss : System.Web.UI.Page
 
             // 获取路径中的文件名(包含后缀)
             string fileName = System.IO.Path.GetFileName(uri.AbsolutePath);
-            string filePath = "D://temp/" + fileName;
+            string filePath = "D://temp/";
             WebClient webClient = new WebClient();
-            if (Directory.Exists(filePath))
+            if (!Directory.Exists(filePath))
             {
                 Directory.CreateDirectory(filePath);
             }
+            filePath += fileName;
             webClient.DownloadFile(file_url, filePath);
             jiemiUtils.ossFileDecrypt(filePath);
             FileStream fs = new FileStream(filePath, FileMode.Open);

+ 1 - 1
ecomServer/MainForm.cs

@@ -1005,7 +1005,7 @@ namespace ErpServer
                                     int[] uv_productIds = new int[] { 14, 43, 2487, 2531, 2654, 2656 };
                                     if (!uv_productIds.Contains(ProductId) && commonHelper.isMultiSize(dr["seller_memo"].ToString()))
                                     {
-                                        helper.writeLog("自动派单:" + dr["ctid"].ToString() + "-" + res);
+                                        helper.writeLog("自动派单:多尺寸拦截" + dr["ctid"].ToString());
                                         SqlHelper.ExecuteNonQuery(string.Format("update CE_ErpTradeCell set OrderState=0 where ctid='{0}' and OrderState=2;", dr["ctid"].ToString()));
                                         continue;
                                     }