aa
This commit is contained in:
@@ -1167,7 +1167,8 @@ func GetDeliveryDetail(ctx *jxcontext.Context, vendorWaybillID string) (queryDyn
|
||||
|
||||
func GetAllDeliveryDetail(ctx *jxcontext.Context, vendorWaybillID, comType string) (result interface{}, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
db = dao.GetDB()
|
||||
getWaybillDetailInfoResult = &txcloudapi.GetWaybillDetailInfoResult{}
|
||||
)
|
||||
jobOrder := &model.JobOrder{
|
||||
VendorWaybillID: vendorWaybillID,
|
||||
@@ -1176,20 +1177,22 @@ func GetAllDeliveryDetail(ctx *jxcontext.Context, vendorWaybillID, comType strin
|
||||
if jobOrder == nil {
|
||||
return result, fmt.Errorf("运单号有误,无法查询!")
|
||||
}
|
||||
if jobOrder.WaybillStatus == model.OrderStatusFinished {
|
||||
return jobOrder.WaybillInfo, err
|
||||
if jobOrder.WaybillStatus >= model.OrderStatusFinished {
|
||||
json.Unmarshal([]byte(jobOrder.WaybillInfo), &getWaybillDetailInfoResult)
|
||||
return getWaybillDetailInfoResult, err
|
||||
}
|
||||
if jobOrder.WaybillQueryTime != utils.ZeroTimeValue {
|
||||
if time.Now().Sub(jobOrder.WaybillQueryTime) <= time.Hour*12 {
|
||||
return jobOrder.WaybillInfo, err
|
||||
json.Unmarshal([]byte(jobOrder.WaybillInfo), &getWaybillDetailInfoResult)
|
||||
return getWaybillDetailInfoResult, err
|
||||
}
|
||||
}
|
||||
getWaybillDetailInfoResult, err := api.TxAPI.GetWaybillDetailInfo(vendorWaybillID, comType)
|
||||
getWaybillDetailInfoResult, err = api.TxAPI.GetWaybillDetailInfo(vendorWaybillID, comType)
|
||||
jobOrder.WaybillQueryTime = time.Now()
|
||||
if waybillInfo, err := json.Marshal(getWaybillDetailInfoResult); err == nil {
|
||||
jobOrder.WaybillInfo = string(waybillInfo)
|
||||
}
|
||||
if getWaybillDetailInfoResult.State == utils.Int2Str(txcloudapi.StatusFinished) {
|
||||
if getWaybillDetailInfoResult.State == utils.Int2Str(txcloudapi.StatusFinished) && jobOrder.WaybillStatus < model.OrderStatusFinished {
|
||||
jobOrder.WaybillStatus = model.OrderStatusFinished
|
||||
}
|
||||
dao.UpdateEntity(db, jobOrder, "WaybillQueryTime", "WaybillInfo", "WaybillStatus")
|
||||
|
||||
@@ -260,6 +260,7 @@ const (
|
||||
|
||||
OrderStatusEndBegin = 100 // 以下的状态就是结束状态
|
||||
OrderStatusFinished = 110 // 订单已完成
|
||||
OrderStatusConfirm = 112 //一件代发订单确认收货
|
||||
OrderStatusCanceled = 115 // 订单已取消
|
||||
OrderStatusEndEnd = 120
|
||||
|
||||
|
||||
@@ -209,6 +209,8 @@ type JobOrder struct {
|
||||
WaybillInfo string `orm:"type(text)" json:"waybillInfo"` //物流信息
|
||||
WaybillQueryTime time.Time `json:"waybillQueryTime"` //上次查询时间
|
||||
WaybillStatus int `json:"waybillStatus"` //运单状态(一件代发)
|
||||
DropShippingConfirmTime time.Time `json:"dropShippingConfirmTime"` //确认收货时间
|
||||
DropShippingConfirmUser string `json:"dropShippingConfirmUser"` //确认收货人
|
||||
}
|
||||
|
||||
func (v *JobOrder) TableIndex() [][]string {
|
||||
|
||||
Reference in New Issue
Block a user