update : 3.6.3

pull/6221/head
Gauthier LO 2024-04-18 13:07:13 +02:00
parent ce95c69801
commit 84a2043b3e
8 changed files with 64 additions and 15 deletions

37
db/views/all_invoices.sql Normal file
View File

@ -0,0 +1,37 @@
CREATE VIEW all_invoices AS
WITH shipping AS (
SELECT
s.id AS id,
s.create_by AS create_by,
s.create_time AS create_time,
s.client_id AS client_id,
s.currency_id AS currency_id,
s.invoice_number AS invoice_number,
IFNULL(s.total_amount + p.total_amount, s.total_amount) AS total_amount,
IFNULL(s.discount_amount + p.discount_amount, s.discount_amount) AS discount_amount,
IFNULL(s.final_amount + p.final_amount, s.final_amount) AS final_amount,
IFNULL(s.paid_amount + p.paid_amount, s.paid_amount) AS paid_amount,
IF(SUBSTRING(s.invoice_number,9,1) = '2', 'shipping', 'complete') AS 'type'
FROM shipping_invoice s
LEFT JOIN purchase_order p ON s.invoice_number = p.invoice_number
AND s.client_id = p.client_id
),
purchase AS (
SELECT
p.id AS id,
p.create_by AS create_by,
p.create_time AS create_time,
p.client_id AS client_id,
p.currency_id AS currency_id,
p.invoice_number AS invoice_number,
p.total_amount AS total_amount,
p.discount_amount AS discount_amount,
p.final_amount AS final_amount,
p.paid_amount AS paid_amount,
IF(SUBSTRING(p.invoice_number,9,1) = '1', 'purchase', 'error') AS 'type'
FROM purchase_order p
WHERE p.invoice_number NOT IN (SELECT invoice_number FROM shipping_invoice)
)
SELECT s.* FROM shipping s
UNION ALL SELECT p.* FROM purchase p
ORDER BY create_time DESC;

View File

@ -17,4 +17,13 @@ SELECT poc.sku_id AS sku_id, SUM(poc.quantity) AS quantity
FROM platform_order_content poc
JOIN platform_order po ON poc.platform_order_id = po.id
WHERE po.order_time BETWEEN DATE_SUB(CURDATE(), INTERVAL 28 DAY) AND CURDATE()
GROUP BY poc.sku_id;
GROUP BY poc.sku_id;
create view sales_42 as
select `poc`.`sku_id` AS `sku_id`, sum(`poc`.`quantity`) AS `quantity`
from (`wia_app`.`platform_order_content` `poc`
join `wia_app`.`platform_order` `po`
on ((`poc`.`platform_order_id` = `po`.`id`)))
where (`po`.`order_time` between (curdate() - interval 42 day) and curdate())
and po.erp_status <> 5
group by `poc`.`sku_id`;

View File

@ -586,8 +586,11 @@ public class PurchaseOrderController {
Map<String, Integer> skuQuantityMap = skuQuantities.stream()
.collect(Collectors.toMap(SkuQuantity::getErpCode, SkuQuantity::getQuantity));
skuQuantityMap.forEach((s, integer) -> log.info("SKU: {} Quantity: {}", s, integer));
Map<String, Integer> skuQtyNotEmptyMap = skuQuantityMap.entrySet().stream()
.filter(entry -> entry.getValue() > 0)
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
InvoiceMetaData metaData = purchaseOrderService.getMetaDataFromInvoiceNumbers(invoiceNumber);
boolean success = providerMabangService.addPurchaseOrderToMabang(skuQuantityMap, metaData, providersHistory);
boolean success = providerMabangService.addPurchaseOrderToMabang(skuQtyNotEmptyMap, metaData, providersHistory);
return success ? invoiceNumber : "failed";
},throttlingExecutorService))
.collect(Collectors.toList());

View File

@ -704,7 +704,6 @@ public class InvoiceController {
public byte[] downloadInventory(@RequestParam("invoiceCode") String invoiceCode, @RequestParam("internalCode") String internalCode, @RequestParam("invoiceEntity") String invoiceEntity) throws IOException {
InvoiceMetaData metaData = new InvoiceMetaData("", invoiceCode, internalCode, invoiceEntity, "");
List<SkuOrderPage> skuOrderPages = skuService.getInventoryByInvoiceNumber(metaData.getInvoiceCode());
System.out.println(skuOrderPages);
return shippingInvoiceService.exportPurchaseInventoryToExcel(skuOrderPages, metaData);
}
@ -797,6 +796,7 @@ public class InvoiceController {
* @param completeClientIds list of clients to invoice complete fees
* @return list of invoice infos
*/
@Transactional
@GetMapping(value = "/breakdown/makeInvoice")
public Result<?> makeBreakdownInvoice(@RequestParam(value = "shipping[]", required = false) List<String> shippingClientIds,
@RequestParam(value = "complete[]", required = false) List<String> completeClientIds) throws IOException {

View File

@ -61,8 +61,8 @@
<select id="getClientBySku" resultType="org.jeecg.modules.business.entity.Client">
SELECT c.*
FROM client c
JOIN client_sku cs ON c.id = cs.client_id
WHERE cs.sku_id = #{skuId};
JOIN client_sku ON c.id = client_sku.client_id
WHERE client_sku.sku_id = #{skuId};
</select>
<select id="getClientFromInvoice" resultType="org.jeecg.modules.business.entity.Client">
SELECT DISTINCT c.*

View File

@ -201,14 +201,14 @@
s28.quantity as sales_four_weeks,
s42.quantity as sales_six_weeks
FROM sku s
JOIN client_sku cs ON s.id = cs.sku_id
JOIN client_sku ON s.id = client_sku.sku_id
JOIN product p ON s.product_id = p.id
LEFT JOIN sku_current_price sp ON s.id = sp.sku_id
LEFT JOIN sales_28 s28 ON s.id = s28.sku_id
LEFT JOIN sales_42 s42 ON s.id = s42.sku_id
LEFT JOIN sales_7 s7 ON s.id = s7.sku_id
LEFT JOIN qtyInOrdersNotShipped ON s.id = qtyInOrdersNotShipped.ID
WHERE cs.client_id = #{clientId}
WHERE client_sku.client_id = #{clientId};
</select>
<select id="getInventoryByInvoiceNumber" resultType="org.jeecg.modules.business.vo.SkuOrderPage">
WITH skusFromInvoice AS (

View File

@ -74,16 +74,16 @@ public class InvoiceServiceImpl extends ServiceImpl<InvoiceMapper, Invoice> impl
shippingInvoiceService.delMain(id);
}
if(Invoice.getType(invoiceNumber).equalsIgnoreCase(COMPLETE.name())) {
platformOrderContentService.cancelInvoice(invoiceNumber);
platformOrderService.removePurchaseInvoiceNumber(invoiceNumber);
platformOrderService.cancelInvoice(invoiceNumber);
purchaseOrderService.cancelInvoice(invoiceNumber);
shippingInvoiceService.delMain(id);
PurchaseOrder purchase = purchaseOrderService.getPurchaseByInvoiceNumberAndClientId(invoiceNumber, clientId);
if(purchase.getInventoryDocumentString() != null && !purchase.getInventoryDocumentString().isEmpty())
shippingInvoiceService.deleteAttachmentFile(purchase.getInventoryDocumentString());
if(purchase.getPaymentDocumentString() != null && !purchase.getPaymentDocumentString().isEmpty())
shippingInvoiceService.deleteAttachmentFile(purchase.getPaymentDocumentString());
platformOrderContentService.cancelInvoice(invoiceNumber);
platformOrderService.removePurchaseInvoiceNumber(invoiceNumber);
platformOrderService.cancelInvoice(invoiceNumber);
purchaseOrderService.cancelInvoice(invoiceNumber);
shippingInvoiceService.delMain(id);
}
savRefundService.cancelInvoice(invoiceNumber);
@ -151,8 +151,8 @@ public class InvoiceServiceImpl extends ServiceImpl<InvoiceMapper, Invoice> impl
if(po.getPaymentDocumentString() != null && !po.getPaymentDocumentString().isEmpty())
shippingInvoiceService.deleteAttachmentFile(po.getPaymentDocumentString());
}
platformOrderService.removePurchaseInvoiceNumbers(purchaseInvoiceNumbers);
purchaseOrderService.cancelBatchInvoice(purchaseInvoiceNumbers);
platformOrderService.removePurchaseInvoiceNumbers(completeInvoiceNumbers);
purchaseOrderService.cancelBatchInvoice(completeInvoiceNumbers);
purchaseOrderContentMapper.deleteFromPurchaseIds(ids);
savRefundService.cancelBatchInvoice(completeInvoiceNumbers);

View File

@ -160,7 +160,7 @@ spring:
slow-sql-millis: 5000
datasource:
master:
url: jdbc:mysql://192.168.31.16:3306/wia_app?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Europe/Paris
url: jdbc:mysql://192.168.31.16:3306/wia_app?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&connectTimeout=5000&socketTimeout=60000
username: admin
password: WIASourcing2023+
driver-class-name: com.mysql.cj.jdbc.Driver