作者 tangxvhui

新增:意向单发货

... ... @@ -474,6 +474,7 @@ func (service OrderInfoService) Delivery(cmd command.OrderDeliveryCommand) error
}
oldOrderData.DeliveryCode = cmd.DeliveryCode
oldOrderData.DeliveryTime = time.Now()
//变更订单类型
oldOrderData.OrderType = domain.OrderReal
err = oldOrderData.Compute()
if err != nil {
... ...
... ... @@ -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(&param); 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)
... ...
... ... @@ -42,7 +42,7 @@ func init() {
beego.NSRouter("/purpose/update", &controllers.OrderInfoController{}, "POST:UpdateOrderPurpose"),
beego.NSRouter("/purpose/detail", &controllers.OrderInfoController{}, "POST:GetOrderPurpose"),
beego.NSRouter("/purpose/del", &controllers.OrderInfoController{}, "POST:RemoveOrderPurpose"),
beego.NSRouter("/purpose/convert", &controllers.OrderInfoController{}, "POST:OrderPurposeDelivery"),
beego.NSRouter("/purpose/sendout", &controllers.OrderInfoController{}, "POST:OrderPurposeDelivery"),
beego.NSRouter("/actual/list", &controllers.OrderController{}, "POST:PageListOrderReal"),
beego.NSRouter("/actual/update", &controllers.OrderController{}, "POST:UpdateOrderReal"),
... ...