...
|
...
|
@@ -3,6 +3,7 @@ package controllers |
|
|
import (
|
|
|
"errors"
|
|
|
"strconv"
|
|
|
"time"
|
|
|
|
|
|
"github.com/astaxie/beego/logs"
|
|
|
orderCmd "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/orderinfo/command"
|
...
|
...
|
@@ -261,8 +262,13 @@ func (c *OrderInfoController) editOrderPurpose(param postPurposeOrderDetail) err |
|
|
//OrderPurposeDelivery 发货 意向订单转实发单
|
|
|
func (c *OrderInfoController) OrderPurposeDelivery() {
|
|
|
//用与适配前端定义的数据结构
|
|
|
type PostParameter struct {
|
|
|
ShipmentsId string `json:"shipmentsId"` //发货单号
|
|
|
Id string `json:"id"` //订单id
|
|
|
ProductDetail []postPurposeOrderGood `json:"productDetail"`
|
|
|
}
|
|
|
var (
|
|
|
param orderDetail
|
|
|
param PostParameter
|
|
|
err error
|
|
|
)
|
|
|
if err = c.BindJsonData(¶m); err != nil {
|
...
|
...
|
@@ -271,7 +277,24 @@ func (c *OrderInfoController) OrderPurposeDelivery() { |
|
|
return
|
|
|
}
|
|
|
orderSrv := orderService.NewOrderInfoService(nil)
|
|
|
deliveryCommand := orderCmd.OrderDeliveryCommand{}
|
|
|
|
|
|
orderid, _ := strconv.ParseInt(param.Id, 10, 64)
|
|
|
if orderid <= 0 {
|
|
|
c.ResponseError(errors.New("参数错误"))
|
|
|
return
|
|
|
}
|
|
|
goods := []orderCmd.OrderGoodData{}
|
|
|
for _, v := range param.ProductDetail {
|
|
|
g := orderCmd.OrderGoodData{
|
|
|
Id: v.Id, GoodName: v.ProductName, PlanGoodNumber: v.OrderNum,
|
|
|
Price: v.Univalence, PartnerBonusPercent: v.PartnerRatio,
|
|
|
}
|
|
|
goods = append(goods, g)
|
|
|
}
|
|
|
deliveryCommand := orderCmd.OrderDeliveryCommand{
|
|
|
OrderId: orderid, DeliveryCode: param.ShipmentsId,
|
|
|
DeliveryTime: time.Now(), Goods: goods,
|
|
|
}
|
|
|
err = orderSrv.Delivery(deliveryCommand)
|
|
|
if err != nil {
|
|
|
c.ResponseError(err)
|
...
|
...
|
|