| | |
| | | productList[k].Price = decimal.NewFromFloat(v.SalePrice).Round(2) |
| | | productList[k].Amount = decimal.NewFromFloat(1) |
| | | productList[k].Total = productList[k].Price.Mul(productList[k].Amount).Round(2) |
| | | productList[k].Unit = v.Unit |
| | | } |
| | | |
| | | if err != nil { |
| | |
| | | return |
| | | } |
| | | number := c.Param("number") |
| | | if number == "" || number == "undefined" { |
| | | ctx.Ok() |
| | | return |
| | | } |
| | | first, err := model.NewSalesDetailsSearch().SetNumber(number).SetPreload(true).First() |
| | | if err != nil { |
| | | ctx.FailWithMsg(ecode.UnknownErr, "明细详情查找失败") |
| | |
| | | ctx.FailWithMsg(ecode.UnknownErr, "内部错误") |
| | | return |
| | | } |
| | | ctx.OkWithDetailed(info.List) |
| | | var list []response.WorkOrderInfo |
| | | for _, orderInfo := range info.List { |
| | | var wo response.WorkOrderInfo |
| | | wo.OrderId = orderInfo.OrderId |
| | | wo.ProductName = orderInfo.ProductName |
| | | wo.OrderStatus = orderInfo.OrderStatus |
| | | wo.WorkOrderId = orderInfo.WorkOrderId |
| | | wo.WorkOrderStatus = orderInfo.WorkOrderStatus |
| | | wo.StartTime = orderInfo.StartTime |
| | | wo.EndTime = orderInfo.EndTime |
| | | list = append(list, wo) |
| | | } |
| | | ctx.OkWithDetailed(list) |
| | | } |
| | |
| | | "aps_crm/pkg/contextx" |
| | | "aps_crm/pkg/ecode" |
| | | "aps_crm/pkg/logx" |
| | | "aps_crm/pkg/structx" |
| | | "aps_crm/proto/product_inventory" |
| | | "aps_crm/utils" |
| | | "github.com/gin-gonic/gin" |
| | |
| | | ctx.FailWithMsg(ecode.UnknownErr, "grpc调用错误") |
| | | return |
| | | } |
| | | ctx.OkWithDetailed(info.ProductList) |
| | | var list []response.ProductInfo |
| | | err = structx.AssignTo(info.ProductList, &list) |
| | | if err != nil { |
| | | ctx.FailWithMsg(ecode.UnknownErr, "转换错误") |
| | | return |
| | | } |
| | | ctx.OkWithDetailed(list) |
| | | } |
| | | |
| | | // CreateOperation |
| | |
| | | return |
| | | } |
| | | |
| | | errCode := salesLeadsService.PushSalesLeads(params.Id, params.Step, params.Reason) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | if params.Step == constvar.SalesStatusFail { |
| | | errCode := salesLeadsService.DeleteSalesLeads([]int{params.Id}) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | } else { |
| | | errCode := salesLeadsService.PushSalesLeads(params.Id, params.Step, params.Reason) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | } |
| | | |
| | | ctx.Ok() |
| | | } |
| | |
| | | Amount decimal.Decimal `json:"amount" gorm:"column:amount;type:decimal(12,2);comment:产品数量"` |
| | | Total decimal.Decimal `json:"total" gorm:"column:total;type:decimal(10,2);comment:产品总价"` |
| | | Desc string `json:"desc" gorm:"column:desc;type:varchar(255);comment:产品描述"` |
| | | Unit string `json:"unit" gorm:"column:unit;type:varchar(255);comment:单位"` |
| | | gorm.Model `json:"-"` |
| | | } |
| | | |
New file |
| | |
| | | package response |
| | | |
| | | type WorkOrderInfo struct { |
| | | OrderId string `json:"orderId"` |
| | | ProductName string `json:"productName"` |
| | | OrderStatus string `json:"orderStatus"` |
| | | WorkOrderId string `json:"workOrderId"` |
| | | WorkOrderStatus string `json:"workOrderStatus"` |
| | | StartTime string `json:"startTime"` |
| | | EndTime string `json:"endTime"` |
| | | } |
| | | |
| | | type ProductInfo struct { |
| | | Id string `json:"id"` |
| | | Name string `json:"name"` |
| | | OrderAmount string `json:"orderAmount"` //订单数量 |
| | | Unit string `json:"unit"` |
| | | Invoice string `json:"invoice"` //发货单 |
| | | Carrier string `json:"carrier"` //承运商 |
| | | Waybill string `json:"waybill"` //运单号 |
| | | SalePrice string `json:"salePrice"` //销售单价 |
| | | Valorem string `json:"valorem"` //价税合计 |
| | | Warehouse string `json:"warehouse"` |
| | | Amount string `json:"amount"` //在库数量 |
| | | AvailableNumber string `json:"availableNumber"` //可用库存 |
| | | } |