浏览代码

问题处理

yzc 1 年之前
父节点
当前提交
f118bcf65b
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      hx-jxst/src/main/resources/mapper/sales/SalesContractMapper.xml

+ 2 - 1
hx-jxst/src/main/resources/mapper/sales/SalesContractMapper.xml

@@ -50,9 +50,10 @@
             sc.contract_amount AS contractAmount,
             (
                 SELECT
-                    IFNULL( sum( sjd.price * sjd.quantity ), 0 )
+                    IFNULL(sum( IF ( sj.op_type = 2,( sjd.price * sjd.quantity ),-(sjd.price * sjd.quantity )) ),0)
                 FROM
                     bytesailing_wms.stock_journal_details sjd
+                        LEFT JOIN bytesailing_wms.stock_journal sj ON sjd.stock_journal_id = sj.id
                         JOIN bytesailing_wms.stock_wait_details swd ON sjd.business_details_id = swd.id
                         JOIN bytesailing_wms.stock_wait sw ON swd.stock_wait_id = sw.id
                         JOIN bytesailing_mes.production_task pt ON sw.business_id = pt.id