zhangqian
2024-03-18 c4e6bf4b1fdb872ba514ab03efa3c53333d1a120
确认发货
9个文件已修改
522 ■■■■ 已修改文件
api/v1/salesDetails.go 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
constvar/salesDetails.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 166 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 166 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 114 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/salesDetails.go 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/response/salesDetails.go 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/salesDetails.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/salesDetails.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/salesDetails.go
@@ -376,6 +376,37 @@
    ctx.OkWithDetailed(storeList)
}
// ConfirmOutput
// @Tags        SalesDetails
// @Summary    确认发货
// @Produce    application/json
// @Param        object     body request.ConfirmOutput    true    "明细编码"
// @Success    200    {object}    response.ListResponse
// @Router        /api/salesDetails/confirmOutput [post]
func (s *SalesDetailsApi) ConfirmOutput(c *gin.Context) {
    var params request.ConfirmOutput
    ctx, ok := contextx.NewContext(c, &params)
    if !ok {
        return
    }
    if len(params.Products) == 0 || params.SaleDetailNumber == "" {
        ctx.FailWithMsg(ecode.ParamsErr, "参数缺失")
        return
    }
    var flag bool
    for _, p := range params.Products {
        if p.OutputAmount.GreaterThan(decimal.Zero) {
            flag = true
        }
    }
    if !flag {
        ctx.FailWithMsg(ecode.ParamsErr, "发货数量缺失")
        return
    }
    ctx.OkWithDetailed(nil)
}
// GetDeliveryList
// @Tags        SalesDetails
// @Summary    发货明细
constvar/salesDetails.go
@@ -22,5 +22,5 @@
)
func (s SalesDetailsStatus) Valid() bool {
    return s == WaitConfirmed || s == WaitOutbound || s == OverOutbound || s == OverCLose
    return s == WaitConfirmed || s == WaitOutbound || s == OverOutbound || s == OverCLose || s == WaitDecompose || s == InStock
}
docs/docs.go
@@ -7008,6 +7008,36 @@
                }
            }
        },
        "/api/salesDetails/confirmOutput": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "SalesDetails"
                ],
                "summary": "确认发货",
                "parameters": [
                    {
                        "description": "明细编码",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.ConfirmOutput"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/response.ListResponse"
                        }
                    }
                }
            }
        },
        "/api/salesDetails/delete": {
            "delete": {
                "produces": [
@@ -7154,34 +7184,6 @@
                    "SalesDetails"
                ],
                "summary": "获取产品发货信息",
                "parameters": [
                    {
                        "type": "string",
                        "description": "明细编码",
                        "name": "number",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/response.ListResponse"
                        }
                    }
                }
            }
        },
        "/api/salesDetails/getSalesDetailsProductInfo/{number}": {
            "get": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "SalesDetails"
                ],
                "summary": "获取销售明细产品信息",
                "parameters": [
                    {
                        "type": "string",
@@ -15533,6 +15535,33 @@
                }
            }
        },
        "request.ConfirmOutput": {
            "type": "object",
            "properties": {
                "products": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/request.ConfirmOutputProducts"
                    }
                },
                "saleDetailNumber": {
                    "type": "string"
                }
            }
        },
        "request.ConfirmOutputProducts": {
            "type": "object",
            "properties": {
                "number": {
                    "description": "产品编号",
                    "type": "string"
                },
                "outputAmount": {
                    "description": "本次发货数量",
                    "type": "number"
                }
            }
        },
        "request.Contact": {
            "type": "object",
            "properties": {
@@ -19430,6 +19459,12 @@
                        "$ref": "#/definitions/response.OutsourcingInfo"
                    }
                },
                "productInfo": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/response.SalesDetailsProductInfo"
                    }
                },
                "purchaseInfo": {
                    "type": "array",
                    "items": {
@@ -19785,6 +19820,81 @@
                }
            }
        },
        "response.SalesDetailsProductInfo": {
            "type": "object",
            "properties": {
                "amount": {
                    "description": "订单数量",
                    "type": "number"
                },
                "cost": {
                    "description": "产品成本",
                    "type": "string"
                },
                "deliveryAmount": {
                    "description": "发货数量",
                    "type": "integer"
                },
                "finishAmount": {
                    "description": "完成数量",
                    "type": "integer"
                },
                "makeAmount": {
                    "description": "制造数量",
                    "type": "integer"
                },
                "makeFinishAmount": {
                    "description": "制造完成数量",
                    "type": "integer"
                },
                "margin": {
                    "description": "毛利率",
                    "type": "string"
                },
                "outsourcingAmount": {
                    "description": "委外数量",
                    "type": "integer"
                },
                "outsourcingFinishAmount": {
                    "description": "委外完成数量",
                    "type": "integer"
                },
                "price": {
                    "description": "产品价格",
                    "type": "number"
                },
                "productId": {
                    "type": "string"
                },
                "productName": {
                    "type": "string"
                },
                "profit": {
                    "description": "毛利",
                    "type": "string"
                },
                "purchaseAmount": {
                    "description": "采购数量",
                    "type": "integer"
                },
                "purchaseFinishAmount": {
                    "description": "采购完成数量",
                    "type": "integer"
                },
                "specs": {
                    "description": "物料规格",
                    "type": "string"
                },
                "total": {
                    "description": "产品总价",
                    "type": "number"
                },
                "unit": {
                    "description": "单位",
                    "type": "string"
                }
            }
        },
        "response.SalesDetailsResponse": {
            "type": "object",
            "properties": {
docs/swagger.json
@@ -6996,6 +6996,36 @@
                }
            }
        },
        "/api/salesDetails/confirmOutput": {
            "post": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "SalesDetails"
                ],
                "summary": "确认发货",
                "parameters": [
                    {
                        "description": "明细编码",
                        "name": "object",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.ConfirmOutput"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/response.ListResponse"
                        }
                    }
                }
            }
        },
        "/api/salesDetails/delete": {
            "delete": {
                "produces": [
@@ -7142,34 +7172,6 @@
                    "SalesDetails"
                ],
                "summary": "获取产品发货信息",
                "parameters": [
                    {
                        "type": "string",
                        "description": "明细编码",
                        "name": "number",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/response.ListResponse"
                        }
                    }
                }
            }
        },
        "/api/salesDetails/getSalesDetailsProductInfo/{number}": {
            "get": {
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "SalesDetails"
                ],
                "summary": "获取销售明细产品信息",
                "parameters": [
                    {
                        "type": "string",
@@ -15521,6 +15523,33 @@
                }
            }
        },
        "request.ConfirmOutput": {
            "type": "object",
            "properties": {
                "products": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/request.ConfirmOutputProducts"
                    }
                },
                "saleDetailNumber": {
                    "type": "string"
                }
            }
        },
        "request.ConfirmOutputProducts": {
            "type": "object",
            "properties": {
                "number": {
                    "description": "产品编号",
                    "type": "string"
                },
                "outputAmount": {
                    "description": "本次发货数量",
                    "type": "number"
                }
            }
        },
        "request.Contact": {
            "type": "object",
            "properties": {
@@ -19418,6 +19447,12 @@
                        "$ref": "#/definitions/response.OutsourcingInfo"
                    }
                },
                "productInfo": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/response.SalesDetailsProductInfo"
                    }
                },
                "purchaseInfo": {
                    "type": "array",
                    "items": {
@@ -19773,6 +19808,81 @@
                }
            }
        },
        "response.SalesDetailsProductInfo": {
            "type": "object",
            "properties": {
                "amount": {
                    "description": "订单数量",
                    "type": "number"
                },
                "cost": {
                    "description": "产品成本",
                    "type": "string"
                },
                "deliveryAmount": {
                    "description": "发货数量",
                    "type": "integer"
                },
                "finishAmount": {
                    "description": "完成数量",
                    "type": "integer"
                },
                "makeAmount": {
                    "description": "制造数量",
                    "type": "integer"
                },
                "makeFinishAmount": {
                    "description": "制造完成数量",
                    "type": "integer"
                },
                "margin": {
                    "description": "毛利率",
                    "type": "string"
                },
                "outsourcingAmount": {
                    "description": "委外数量",
                    "type": "integer"
                },
                "outsourcingFinishAmount": {
                    "description": "委外完成数量",
                    "type": "integer"
                },
                "price": {
                    "description": "产品价格",
                    "type": "number"
                },
                "productId": {
                    "type": "string"
                },
                "productName": {
                    "type": "string"
                },
                "profit": {
                    "description": "毛利",
                    "type": "string"
                },
                "purchaseAmount": {
                    "description": "采购数量",
                    "type": "integer"
                },
                "purchaseFinishAmount": {
                    "description": "采购完成数量",
                    "type": "integer"
                },
                "specs": {
                    "description": "物料规格",
                    "type": "string"
                },
                "total": {
                    "description": "产品总价",
                    "type": "number"
                },
                "unit": {
                    "description": "单位",
                    "type": "string"
                }
            }
        },
        "response.SalesDetailsResponse": {
            "type": "object",
            "properties": {
docs/swagger.yaml
@@ -3457,6 +3457,24 @@
    required:
    - ids
    type: object
  request.ConfirmOutput:
    properties:
      products:
        items:
          $ref: '#/definitions/request.ConfirmOutputProducts'
        type: array
      saleDetailNumber:
        type: string
    type: object
  request.ConfirmOutputProducts:
    properties:
      number:
        description: 产品编号
        type: string
      outputAmount:
        description: 本次发货数量
        type: number
    type: object
  request.Contact:
    properties:
      birthday:
@@ -6117,6 +6135,10 @@
        items:
          $ref: '#/definitions/response.OutsourcingInfo'
        type: array
      productInfo:
        items:
          $ref: '#/definitions/response.SalesDetailsProductInfo'
        type: array
      purchaseInfo:
        items:
          $ref: '#/definitions/response.Purchase'
@@ -6348,6 +6370,61 @@
        items:
          $ref: '#/definitions/model.SaleType'
        type: array
    type: object
  response.SalesDetailsProductInfo:
    properties:
      amount:
        description: 订单数量
        type: number
      cost:
        description: 产品成本
        type: string
      deliveryAmount:
        description: 发货数量
        type: integer
      finishAmount:
        description: 完成数量
        type: integer
      makeAmount:
        description: 制造数量
        type: integer
      makeFinishAmount:
        description: 制造完成数量
        type: integer
      margin:
        description: 毛利率
        type: string
      outsourcingAmount:
        description: 委外数量
        type: integer
      outsourcingFinishAmount:
        description: 委外完成数量
        type: integer
      price:
        description: 产品价格
        type: number
      productId:
        type: string
      productName:
        type: string
      profit:
        description: 毛利
        type: string
      purchaseAmount:
        description: 采购数量
        type: integer
      purchaseFinishAmount:
        description: 采购完成数量
        type: integer
      specs:
        description: 物料规格
        type: string
      total:
        description: 产品总价
        type: number
      unit:
        description: 单位
        type: string
    type: object
  response.SalesDetailsResponse:
    properties:
@@ -10808,6 +10885,25 @@
      summary: 添加销售明细
      tags:
      - SalesDetails
  /api/salesDetails/confirmOutput:
    post:
      parameters:
      - description: 明细编码
        in: body
        name: object
        required: true
        schema:
          $ref: '#/definitions/request.ConfirmOutput'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/response.ListResponse'
      summary: 确认发货
      tags:
      - SalesDetails
  /api/salesDetails/delete:
    delete:
      parameters:
@@ -10911,24 +11007,6 @@
          schema:
            $ref: '#/definitions/response.ListResponse'
      summary: 获取产品发货信息
      tags:
      - SalesDetails
  /api/salesDetails/getSalesDetailsProductInfo/{number}:
    get:
      parameters:
      - description: 明细编码
        in: path
        name: number
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/response.ListResponse'
      summary: 获取销售明细产品信息
      tags:
      - SalesDetails
  /api/salesDetails/list:
model/request/salesDetails.go
@@ -3,6 +3,7 @@
import (
    "aps_crm/constvar"
    "aps_crm/model"
    "github.com/shopspring/decimal"
)
type AddSalesDetails struct {
@@ -55,3 +56,14 @@
    ClientId     int                              `json:"clientId"`     //客户id
    Number       string                           `json:"number"`       //销售明细单号
}
// ConfirmOutput 发货
type ConfirmOutput struct {
    SaleDetailNumber string                  `json:"saleDetailNumber"`
    Products         []ConfirmOutputProducts `json:"products"`
}
type ConfirmOutputProducts struct {
    Number       string          `json:"number"`       //产品编号
    OutputAmount decimal.Decimal `json:"outputAmount"` //本次发货数量
}
model/response/salesDetails.go
@@ -69,20 +69,20 @@
    AvailableNumber string `json:"availableNumber"` //可用库存
}
type OutputInfo struct {
    Number      string `json:"number"`
    Name        string `json:"name"`
    Number      string `json:"number"`      //产品编码
    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"`     //在库数量
    Status      int    `json:"status"`     //0就绪 1完成
    Specs       string `json:"specs"`      //规格
    CreateTime  string `json:"createTime"` //创建时间
    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"`      //发货数量
    Status      int    `json:"status"`      //0就绪 1完成
    Specs       string `json:"specs"`       //规格
    CreateTime  string `json:"createTime"`  //创建时间
}
type StoreInfo struct {
router/salesDetails.go
@@ -24,6 +24,7 @@
        salesDetailsRouter.POST("getDeliveryPrepareInfo", salesDetailsApi.GetDeliveryPrepareInfo) // 发货准备
        salesDetailsRouter.POST("getDeliveryList", salesDetailsApi.GetDeliveryList)               // 发货明细
        salesDetailsRouter.POST("confirmOutput", salesDetailsApi.ConfirmOutput)                   // 确认发货
    }
}
service/salesDetails.go
@@ -137,6 +137,10 @@
    return model.NewSalesDetailsSearch().SetId(saleDetailID).SetPreload(true).First()
}
func (SalesDetailsService) GetSalesDetailsByNumber(number string) (*model.SalesDetails, error) {
    return model.NewSalesDetailsSearch().SetNumber(number).SetPreload(true).First()
}
func (SalesDetailsService) GetDeliveryOrder(saleDetailID int) ([]*model.DeliveryOrder, error) {
    // get contact list
    orders, err := model.NewDeliveryOrderSearch().SetSalesDetailsID(saleDetailID).FindAll()