|
@@ -3,6 +3,7 @@ package controllers |
|
@@ -3,6 +3,7 @@ package controllers |
3
|
import (
|
3
|
import (
|
4
|
"errors"
|
4
|
"errors"
|
5
|
"strconv"
|
5
|
"strconv"
|
|
|
6
|
+ "time"
|
6
|
|
7
|
|
7
|
"github.com/astaxie/beego/logs"
|
8
|
"github.com/astaxie/beego/logs"
|
8
|
orderCmd "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/orderinfo/command"
|
9
|
orderCmd "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/orderinfo/command"
|
|
@@ -261,8 +262,13 @@ func (c *OrderInfoController) editOrderPurpose(param postPurposeOrderDetail) err |
|
@@ -261,8 +262,13 @@ func (c *OrderInfoController) editOrderPurpose(param postPurposeOrderDetail) err |
261
|
//OrderPurposeDelivery 发货 意向订单转实发单
|
262
|
//OrderPurposeDelivery 发货 意向订单转实发单
|
262
|
func (c *OrderInfoController) OrderPurposeDelivery() {
|
263
|
func (c *OrderInfoController) OrderPurposeDelivery() {
|
263
|
//用与适配前端定义的数据结构
|
264
|
//用与适配前端定义的数据结构
|
|
|
265
|
+ type PostParameter struct {
|
|
|
266
|
+ ShipmentsId string `json:"shipmentsId"` //发货单号
|
|
|
267
|
+ Id string `json:"id"` //订单id
|
|
|
268
|
+ ProductDetail []postPurposeOrderGood `json:"productDetail"`
|
|
|
269
|
+ }
|
264
|
var (
|
270
|
var (
|
265
|
- param orderDetail
|
271
|
+ param PostParameter
|
266
|
err error
|
272
|
err error
|
267
|
)
|
273
|
)
|
268
|
if err = c.BindJsonData(¶m); err != nil {
|
274
|
if err = c.BindJsonData(¶m); err != nil {
|
|
@@ -271,7 +277,24 @@ func (c *OrderInfoController) OrderPurposeDelivery() { |
|
@@ -271,7 +277,24 @@ func (c *OrderInfoController) OrderPurposeDelivery() { |
271
|
return
|
277
|
return
|
272
|
}
|
278
|
}
|
273
|
orderSrv := orderService.NewOrderInfoService(nil)
|
279
|
orderSrv := orderService.NewOrderInfoService(nil)
|
274
|
- deliveryCommand := orderCmd.OrderDeliveryCommand{}
|
280
|
+
|
|
|
281
|
+ orderid, _ := strconv.ParseInt(param.Id, 10, 64)
|
|
|
282
|
+ if orderid <= 0 {
|
|
|
283
|
+ c.ResponseError(errors.New("参数错误"))
|
|
|
284
|
+ return
|
|
|
285
|
+ }
|
|
|
286
|
+ goods := []orderCmd.OrderGoodData{}
|
|
|
287
|
+ for _, v := range param.ProductDetail {
|
|
|
288
|
+ g := orderCmd.OrderGoodData{
|
|
|
289
|
+ Id: v.Id, GoodName: v.ProductName, PlanGoodNumber: v.OrderNum,
|
|
|
290
|
+ Price: v.Univalence, PartnerBonusPercent: v.PartnerRatio,
|
|
|
291
|
+ }
|
|
|
292
|
+ goods = append(goods, g)
|
|
|
293
|
+ }
|
|
|
294
|
+ deliveryCommand := orderCmd.OrderDeliveryCommand{
|
|
|
295
|
+ OrderId: orderid, DeliveryCode: param.ShipmentsId,
|
|
|
296
|
+ DeliveryTime: time.Now(), Goods: goods,
|
|
|
297
|
+ }
|
275
|
err = orderSrv.Delivery(deliveryCommand)
|
298
|
err = orderSrv.Delivery(deliveryCommand)
|
276
|
if err != nil {
|
299
|
if err != nil {
|
277
|
c.ResponseError(err)
|
300
|
c.ResponseError(err)
|