57 lines
1.2 KiB
Go
57 lines
1.2 KiB
Go
|
package shipment
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"git.kumo.work/shama/service/client"
|
||
|
)
|
||
|
|
||
|
type sale struct {
|
||
|
}
|
||
|
|
||
|
type SaleItem struct {
|
||
|
Id int64 `json:"id"`
|
||
|
SaleId int64 `json:"saleId"`
|
||
|
PiSerial string `json:"piSerial"`
|
||
|
PoSerial string `json:"poSerial"`
|
||
|
}
|
||
|
|
||
|
// All @TITLE 获取销售合同
|
||
|
func (c *sale) All(ctx context.Context, shipmentId int64) (reply []SaleItem, err error) {
|
||
|
xClient, err := client.GetClient(c)
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
err = xClient.Call(ctx, "All", shipmentId, &reply)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
type ArgsSaleAdd struct {
|
||
|
ShipmentId int64 // 订舱单id
|
||
|
SaleIds []int64 // 销售合同
|
||
|
}
|
||
|
|
||
|
// Add @TITLE 添加销售合同
|
||
|
func (c *sale) Add(ctx context.Context, args ArgsSaleAdd) (err error) {
|
||
|
xClient, err := client.GetClient(c)
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
reply := 0
|
||
|
return xClient.Call(ctx, "Add", args, &reply)
|
||
|
}
|
||
|
|
||
|
type ArgsSaleDelete struct {
|
||
|
ShipmentId int64 // 订舱单id
|
||
|
SaleIds []int64 // 销售合同
|
||
|
}
|
||
|
|
||
|
// Delete @TITLE 删除销售合同
|
||
|
func (c *sale) Delete(ctx context.Context, args ArgsSaleDelete) (err error) {
|
||
|
xClient, err := client.GetClient(c)
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
reply := 0
|
||
|
return xClient.Call(ctx, "Delete", args, &reply)
|
||
|
}
|