|
@@ -2648,6 +2648,27 @@ const clickToView = (item) => {
|
|
|
proxy
|
|
|
.get("/documents/generateInvoiceAPackPdf", { id: rowData.value.id })
|
|
|
.then((res) => {
|
|
|
+ let arr = [];
|
|
|
+ for (let i = 0; i < res.data.documentsProducts.length; i++) {
|
|
|
+ const ele = res.data.documentsProducts[i];
|
|
|
+ let index = -1;
|
|
|
+ if (i === 0) {
|
|
|
+ arr.push(ele);
|
|
|
+ } else {
|
|
|
+ const isHaveProduct = arr.some((x, i) => {
|
|
|
+ if (x.productId === ele.productId) {
|
|
|
+ index = i;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (isHaveProduct && index >= 0) {
|
|
|
+ arr[index].quantity += ele.quantity;
|
|
|
+ } else {
|
|
|
+ arr.push(ele);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ res.data.documentsProducts = arr;
|
|
|
printDetails.value = res.data;
|
|
|
});
|
|
|
};
|
|
@@ -2694,6 +2715,32 @@ const clickPrint = (status) => {
|
|
|
.then((res) => {
|
|
|
if (res.data.content) {
|
|
|
res.data.content = JSON.parse(res.data.content);
|
|
|
+ if (
|
|
|
+ res.data.content.products &&
|
|
|
+ res.data.content.products.length > 0
|
|
|
+ ) {
|
|
|
+ let arr = [];
|
|
|
+ for (let i = 0; i < res.data.content.products.length; i++) {
|
|
|
+ const ele = res.data.content.products[i];
|
|
|
+ let index = -1;
|
|
|
+ if (i === 0) {
|
|
|
+ arr.push(ele);
|
|
|
+ } else {
|
|
|
+ const isHaveProduct = arr.some((x, i) => {
|
|
|
+ if (x.productId === ele.productId) {
|
|
|
+ index = i;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (isHaveProduct && index >= 0) {
|
|
|
+ arr[index].quantity += ele.quantity;
|
|
|
+ } else {
|
|
|
+ arr.push(ele);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ res.data.content.products = arr;
|
|
|
+ }
|
|
|
}
|
|
|
printCustomsDeclaration.value = res.data;
|
|
|
});
|