- new field GoodsOrder.Flag

- SetOrderPrintStatus
This commit is contained in:
gazebo
2019-03-06 12:22:41 +08:00
parent 19b49a030c
commit acc3cd5731
7 changed files with 81 additions and 15 deletions

View File

@@ -180,6 +180,9 @@ const (
OrderDeliveryFlagMaskScheduleDisabled = 1 // 禁止三方配送调度
OrderDeliveryFlagMaskPurcahseDisabled = 2 // 购物平台已不配送(一般为门店配送类型本身为自配送,或已经转自配送)
)
const (
OrderFlagMaskPrinted = 1 // 已经打印
)
func IsPurchaseVendorExist(vendorID int) bool {
_, ok := VendorNames[vendorID]

View File

@@ -13,13 +13,38 @@ func GetStoreOrderAfterTime(db *DaoDB, storeID int, orderTime time.Time, lastOrd
t2.actual_fee, t2.desired_fee, t2.waybill_created_at, t2.waybill_finished_at
FROM goods_order t1
LEFT JOIN waybill t2 ON t1.vendor_waybill_id = t2.vendor_waybill_id AND t1.waybill_vendor_id = t2.waybill_vendor_id
WHERE IF(t1.jx_store_id <> 0, t1.jx_store_id, t1.store_id) = ? AND t1.order_created_at >= ? AND t1.id > ?
LIMIT 50;
WHERE IF(t1.jx_store_id <> 0, t1.jx_store_id, t1.store_id) = ? AND t1.order_created_at >= ? AND t1.id > ? AND t1.status <= ?;
`
sqlParams := []interface{}{
storeID,
orderTime,
lastOrderSeqID,
model.OrderStatusDelivering,
}
return orderList, GetRows(db, &orderList, sql, sqlParams...)
}
func SetOrderPrintFlag(db *DaoDB, vendorOrderID string, vendorID int, isPrinted bool) (err error) {
var (
sql string
sqlParams []interface{}
)
if isPrinted {
sql = `
UPDATE goods_order
SET flag = flag | ?
WHERE vendor_order_id = ? AND vendor_id = ?
`
sqlParams = append(sqlParams, model.OrderFlagMaskPrinted)
} else {
sql = `
UPDATE goods_order
SET flag = flag & ?
WHERE vendor_order_id = ? AND vendor_id = ?
`
sqlParams = append(sqlParams, ^model.OrderFlagMaskPrinted)
}
sqlParams = append(sqlParams, vendorOrderID, vendorID)
_, err = ExecuteSQL(db, sql, sqlParams...)
return err
}

View File

@@ -46,15 +46,16 @@ type GoodsOrder struct {
StatusTime time.Time `orm:"type(datetime)" json:"-"` // last status time
PickDeadline time.Time `orm:"type(datetime)" json:"pickDeadline"`
ModelTimeInfo `json:"-"`
OriginalData string `orm:"-" json:"-"`
OriginalData string `orm:"-" json:"-"` // 只是用于传递数据
Skus []*OrderSku `orm:"-" json:"-"`
SkuPmFee int64 `json:"-"` //门店商品活动总支出
OrderPmFee int64 `json:"-"` //门店订单活动支出
SkuPmSubsidy int64 `json:"-"` //平台商品活动总补贴
OrderPmSubsidy int64 `json:"-"` //平台订单活动补贴
BoxFee int64 `json:"-"` //餐盒费
PlatformFeeRate int16 `json:"-"` //平台
BillStoreFreightFee int64 `json:"-"` //需要回调,门店所承担的运
Flag int8 `json:"flag"` //非运单调整相关的其它状态
SkuPmFee int64 `json:"-"` //门店商品活动支出
OrderPmFee int64 `json:"-"` //门店订单活动支出
SkuPmSubsidy int64 `json:"-"` //平台商品活动补贴
OrderPmSubsidy int64 `json:"-"` //平台订单活动补贴
BoxFee int64 `json:"-"` //餐盒
PlatformFeeRate int16 `json:"-"` //平台
BillStoreFreightFee int64 `json:"-"` //需要回调,门店所承担的运费
}
func (o *GoodsOrder) TableUnique() [][]string {