...
|
...
|
@@ -298,16 +298,30 @@ func (c *OrderInfoController) editOrderPurpose(param postPurposeOrderDetail) err |
|
|
return err
|
|
|
}
|
|
|
|
|
|
type postOrderPurposeDelivery struct {
|
|
|
ShipmentsId string `json:"shipmentsId"` //发货单号
|
|
|
Id string `json:"id"` //订单id
|
|
|
ProductDetail []postOrderGood `json:"productDetail"`
|
|
|
}
|
|
|
|
|
|
func (postData postOrderPurposeDelivery) Valid() error {
|
|
|
if len(postData.ShipmentsId) == 0 {
|
|
|
return lib.ThrowError(lib.ARG_ERROR, "发货单号必填")
|
|
|
}
|
|
|
for i := range postData.ProductDetail {
|
|
|
if err := postData.ProductDetail[i].Valid(); err != nil {
|
|
|
return err
|
|
|
}
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
//OrderPurposeDelivery 发货 意向订单转实发单
|
|
|
func (c *OrderInfoController) OrderPurposeDelivery() {
|
|
|
//用与适配前端定义的数据结构
|
|
|
type PostParameter struct {
|
|
|
ShipmentsId string `json:"shipmentsId"` //发货单号
|
|
|
Id string `json:"id"` //订单id
|
|
|
ProductDetail []postOrderGood `json:"productDetail"`
|
|
|
}
|
|
|
|
|
|
var (
|
|
|
param PostParameter
|
|
|
param postOrderPurposeDelivery
|
|
|
err error
|
|
|
)
|
|
|
if err = c.BindJsonData(¶m); err != nil {
|
...
|
...
|
@@ -315,13 +329,16 @@ func (c *OrderInfoController) OrderPurposeDelivery() { |
|
|
c.ResponseError(errors.New("json数据解析失败"))
|
|
|
return
|
|
|
}
|
|
|
orderSrv := orderService.NewOrderInfoService(nil)
|
|
|
|
|
|
orderid, _ := strconv.ParseInt(param.Id, 10, 64)
|
|
|
if orderid <= 0 {
|
|
|
c.ResponseError(errors.New("参数错误"))
|
|
|
return
|
|
|
}
|
|
|
if err = param.Valid(); err != nil {
|
|
|
c.ResponseError(err)
|
|
|
return
|
|
|
}
|
|
|
goods := []orderCmd.OrderGoodData{}
|
|
|
for _, v := range param.ProductDetail {
|
|
|
g := orderCmd.OrderGoodData{
|
...
|
...
|
@@ -334,6 +351,7 @@ func (c *OrderInfoController) OrderPurposeDelivery() { |
|
|
OrderId: orderid, DeliveryCode: param.ShipmentsId,
|
|
|
DeliveryTime: time.Now(), Goods: goods,
|
|
|
}
|
|
|
orderSrv := orderService.NewOrderInfoService(nil)
|
|
|
err = orderSrv.Delivery(deliveryCommand)
|
|
|
if err != nil {
|
|
|
c.ResponseError(err)
|
...
|
...
|
@@ -564,7 +582,7 @@ func (c *OrderInfoController) editOrderReal(param postRealOrderDetail) error { |
|
|
}
|
|
|
updatecmd := orderCmd.UpdateOrderCommand{
|
|
|
Id: param.Id,
|
|
|
OrderType: domain.OrderIntention,
|
|
|
OrderType: domain.OrderReal,
|
|
|
OrderCode: param.OrderId,
|
|
|
DeliveryCode: param.ShipmentsId,
|
|
|
BuyerName: param.BuyerName,
|
...
|
...
|
|