|
|
@@ -1143,7 +1143,7 @@ type HsbyBuyMyPayOrder struct {
|
|
|
}
|
|
|
|
|
|
// GetHsbyBuyMyPayOrders 获取待付款信息
|
|
|
-func GetHsbyBuyMyPayOrders(accountIDs string) ([]HsbyBuyMyPayOrder, error) {
|
|
|
+func GetHsbyBuyMyPayOrders(accountIDs string, sellOrderID, sellAccountID int) ([]HsbyBuyMyPayOrder, error) {
|
|
|
// 获取市场信息
|
|
|
markets, err := GetMarkets()
|
|
|
if err != nil {
|
|
|
@@ -1164,7 +1164,7 @@ func GetHsbyBuyMyPayOrders(accountIDs string) ([]HsbyBuyMyPayOrder, error) {
|
|
|
}
|
|
|
|
|
|
orders := make([]HsbyBuyMyPayOrder, 0)
|
|
|
- if err := engine.Table("TRADE_TRADEDETAIL").
|
|
|
+ session := engine.Table("TRADE_TRADEDETAIL").
|
|
|
Select(`to_char(TRADE_TRADEDETAIL.TRADEID) ORDERID,
|
|
|
TRADE_TRADEDETAIL.MARKETID, TRADE_TRADEDETAIL.GOODSID, TRADE_TRADEDETAIL.ACCOUNTID, TRADE_TRADEDETAIL.BUYORSELL,
|
|
|
GOODS.GOODSCODE, GOODS.GOODSNAME, GOODS.DECIMALPLACE, GOODS.AGREEUNIT,
|
|
|
@@ -1182,9 +1182,18 @@ func GetHsbyBuyMyPayOrders(accountIDs string) ([]HsbyBuyMyPayOrder, error) {
|
|
|
Join("LEFT", "HSBY_SUPPLIERINFO HS1", "HS1.VENDORID = HG1.VENDORID").
|
|
|
Join("LEFT", "HSBY_SUPPLIERINFO HS2", "HS2.VENDORID = HG2.VENDORID").
|
|
|
Join("INNER", "TRADE_PAYORDER TP", "TP.TRADEID = TRADE_TRADEDETAIL.TRADEID and TP.PAYFLAG = 1").
|
|
|
- Where(fmt.Sprintf(`TRADE_TRADEDETAIL.BUYORSELL = 0
|
|
|
- and TRADE_TRADEDETAIL.ACCOUNTID in (%s)`, accountIDs)).
|
|
|
- And(fmt.Sprintf("TRADE_TRADEDETAIL.MARKETID in (%s)", marketIDs)).Find(&orders); err != nil {
|
|
|
+ Where(`TRADE_TRADEDETAIL.BUYORSELL = 0`).
|
|
|
+ And(fmt.Sprintf("TRADE_TRADEDETAIL.MARKETID in (%s)", marketIDs))
|
|
|
+ if len(accountIDs) > 0 {
|
|
|
+ session = session.And(fmt.Sprintf("TRADE_TRADEDETAIL.ACCOUNTID in (%s)", accountIDs))
|
|
|
+ }
|
|
|
+ if sellOrderID != 0 {
|
|
|
+ session = session.And("TP.SELLORDERID = ?", sellOrderID)
|
|
|
+ }
|
|
|
+ if sellAccountID != 0 {
|
|
|
+ session = session.And("TP.SELLACCOUNTID = ?", sellAccountID)
|
|
|
+ }
|
|
|
+ if err := session.Find(&orders); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
|