1.新增1.3.0采购订单相关接口;
This commit is contained in:
parent
e8a7739fb1
commit
3a44010235
|
@ -161,6 +161,8 @@ func ErpOrderAudit(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
// todo 需要判断是否有审核权限
|
||||
|
||||
var erpOrder model.ErpOrder
|
||||
err = orm.Eloquent.Table("erp_order").Where("bill_sn = ?", req.BillSn).Find(&erpOrder).Error
|
||||
if err != nil {
|
||||
|
|
442
app/admin/apis/purchasemanage/purchase.go
Normal file
442
app/admin/apis/purchasemanage/purchase.go
Normal file
|
@ -0,0 +1,442 @@
|
|||
package purchasemanage
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/gin-gonic/gin"
|
||||
model "go-admin/app/admin/models"
|
||||
orm "go-admin/common/global"
|
||||
"go-admin/logger"
|
||||
"go-admin/tools"
|
||||
"go-admin/tools/app"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ErpPurchaseCreate 新建采购订单
|
||||
// @Summary 新建采购订单
|
||||
// @Tags 采购管理, V1.3.0
|
||||
// @Produce json
|
||||
// @Accept json
|
||||
// @Param request body models.ErpPurchaseCreateReq true "新建采购订单模型"
|
||||
// @Success 200 {object} models.ErpPurchaseOrder
|
||||
// @Router /api/v1/erp_purchase/create [post]
|
||||
func ErpPurchaseCreate(c *gin.Context) {
|
||||
req := new(model.ErpPurchaseCreateReq)
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
logger.Error("ShouldBindJSON err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误"+err.Error())
|
||||
return
|
||||
}
|
||||
sysUser, err := model.GetSysUserByCtx(c)
|
||||
if err != nil {
|
||||
logger.Error("sys user err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "操作失败")
|
||||
return
|
||||
}
|
||||
//if sysUser.StoreId == 0 {
|
||||
// logger.Error("sys user store id null")
|
||||
// app.Error(c, http.StatusBadRequest, errors.New("para err"), "sys user store id null")
|
||||
// return
|
||||
//}
|
||||
|
||||
if len(req.ErpPurchaseCommodities) == 0 {
|
||||
logger.Error("erp purchase commodities is nil")
|
||||
app.Error(c, http.StatusInternalServerError, err, "操作失败")
|
||||
return
|
||||
}
|
||||
|
||||
purchaseOrder, err := model.CreateErpPurchaseOrder(req, sysUser)
|
||||
if err != nil {
|
||||
logger.Error("CreateErpPurchaseOrder err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "新增失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
purchaseOrder.Commodities = req.ErpPurchaseCommodities
|
||||
|
||||
app.OK(c, purchaseOrder, "")
|
||||
return
|
||||
}
|
||||
|
||||
// ErpPurchaseEdit 编辑采购订单
|
||||
// @Summary 编辑采购订单
|
||||
// @Tags 采购管理, V1.3.0
|
||||
// @Produce json
|
||||
// @Accept json
|
||||
// @Param request body models.ErpPurchaseEditReq true "编辑采购订单模型"
|
||||
// @Success 200 {object} models.ErpPurchaseOrder
|
||||
// @Router /api/v1/erp_purchase/edit [post]
|
||||
func ErpPurchaseEdit(c *gin.Context) {
|
||||
req := new(model.ErpPurchaseEditReq)
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
logger.Error("ShouldBindJSON err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
sysUser, err := model.GetSysUserByCtx(c)
|
||||
if err != nil {
|
||||
logger.Error("sys user err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "操作失败")
|
||||
return
|
||||
}
|
||||
//if sysUser.StoreId == 0 {
|
||||
// logger.Error("sys user store id null")
|
||||
// app.Error(c, http.StatusBadRequest, errors.New("para err"), "sys user store id null")
|
||||
// return
|
||||
//}
|
||||
|
||||
if len(req.ErpPurchaseCommodities) == 0 {
|
||||
logger.Error("erp purchase commodities is nil")
|
||||
app.Error(c, http.StatusInternalServerError, err, "操作失败")
|
||||
return
|
||||
}
|
||||
|
||||
// 更新订单信息
|
||||
purchaseOrder, err := model.EditErpPurchaseOrder(req, sysUser)
|
||||
if err != nil {
|
||||
logger.Error("EditErpPurchaseOrder err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "编辑失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
purchaseOrder.Commodities = req.ErpPurchaseCommodities
|
||||
app.OK(c, purchaseOrder, "")
|
||||
return
|
||||
}
|
||||
|
||||
// ErpPurchaseList 查询采购订单列表
|
||||
// @Summary 查询采购订单列表
|
||||
// @Tags 采购管理, V1.3.0
|
||||
// @Produce json
|
||||
// @Accept json
|
||||
// @Param request body models.ErpPurchaseOrderListReq true "查询采购订单列表模型"
|
||||
// @Success 200 {object} models.ErpPurchaseOrderListResp
|
||||
// @Router /api/v1/erp_purchase/list [post]
|
||||
func ErpPurchaseList(c *gin.Context) {
|
||||
req := &model.ErpPurchaseOrderListReq{}
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
logger.Error("ShouldBindJSON err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := req.List()
|
||||
if err != nil {
|
||||
logger.Error("ErpPurchaseList err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "获取失败"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
app.OK(c, resp, "")
|
||||
return
|
||||
}
|
||||
|
||||
// ErpPurchaseDetail 查询采购订单详情
|
||||
// @Summary 查询采购订单详情
|
||||
// @Tags 采购管理, V1.3.0
|
||||
// @Produce json
|
||||
// @Accept json
|
||||
// @Param request body models.ErpPurchaseDetailReq true "查询采购订单详情模型"
|
||||
// @Success 200 {object} models.ErpPurchaseOrder
|
||||
// @Router /api/v1/erp_purchase/detail [post]
|
||||
func ErpPurchaseDetail(c *gin.Context) {
|
||||
req := new(model.ErpPurchaseDetailReq)
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
logger.Error("ShouldBindJSON err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误")
|
||||
return
|
||||
}
|
||||
|
||||
var purchaseOrder model.ErpPurchaseOrder
|
||||
err := orm.Eloquent.Table("erp_purchase_order").Where("id=?", req.ErpPurchaseOrderId).Find(&purchaseOrder).Error
|
||||
if err != nil {
|
||||
logger.Error("purchase order err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusBadRequest, err, "获取失败")
|
||||
return
|
||||
}
|
||||
var purchaseCommodities []model.ErpPurchaseCommodity
|
||||
err = orm.Eloquent.Table("erp_purchase_commodity").Where("erp_purchase_order_id=?", req.ErpPurchaseOrderId).
|
||||
Find(&purchaseCommodities).Error
|
||||
if err != nil {
|
||||
logger.Error("purchase commodities err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusBadRequest, err, "获取失败")
|
||||
return
|
||||
}
|
||||
purchaseOrder.Commodities = purchaseCommodities
|
||||
|
||||
// todo 需要添加实际采购入库信息
|
||||
app.OK(c, purchaseOrder, "")
|
||||
return
|
||||
}
|
||||
|
||||
// ErpPurchaseAudit 审核采购订单
|
||||
// @Summary 审核采购订单
|
||||
// @Tags 采购管理, V1.3.0
|
||||
// @Produce json
|
||||
// @Accept json
|
||||
// @Param request body models.ErpPurchaseAuditReq true "审核采购订单模型"
|
||||
// @Success 200 {object} app.Response
|
||||
// @Router /api/v1/erp_purchase/audit [post]
|
||||
func ErpPurchaseAudit(c *gin.Context) {
|
||||
var req = new(model.ErpPurchaseAuditReq)
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
logger.Error("ShouldBindJSON err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusBadRequest, err, "参数错误:"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
err := tools.Validate(req) //必填参数校验
|
||||
if err != nil {
|
||||
app.Error(c, http.StatusBadRequest, err, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// todo 需要校验当前用户是否有权限
|
||||
|
||||
var erpPurchaseOrder model.ErpPurchaseOrder
|
||||
err = orm.Eloquent.Table("erp_purchase_order").Where("serial_number = ?", req.SerialNumber).Find(&erpPurchaseOrder).Error
|
||||
if err != nil {
|
||||
logger.Error("order err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "审核失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 判断入参state:1-审核,2-取消审核
|
||||
orderState := 0
|
||||
switch req.State {
|
||||
case 1: // 1-审核:待审核状态可以审核
|
||||
if erpPurchaseOrder.State == model.ErpPurchaseOrderUnAudit {
|
||||
if erpPurchaseOrder.PurchaseType == model.ErpProcureOrder { // 采购
|
||||
orderState = model.ErpPurchaseOrderWaitInventory
|
||||
} else if erpPurchaseOrder.PurchaseType == model.ErpRejectOrder { // 退货
|
||||
orderState = model.ErpPurchaseOrderWaitReject
|
||||
} else {
|
||||
logger.Error("order err, PurchaseType is:", logger.Field("PurchaseType", erpPurchaseOrder.PurchaseType))
|
||||
app.Error(c, http.StatusInternalServerError, err, "审核失败:采购类型有误")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
app.OK(c, nil, "订单已审核")
|
||||
return
|
||||
}
|
||||
case 2: // 2-取消审核:2/3可以取消审核
|
||||
if erpPurchaseOrder.State == model.ErpPurchaseOrderWaitInventory || erpPurchaseOrder.State == model.ErpPurchaseOrderWaitReject {
|
||||
orderState = model.ErpPurchaseOrderUnAudit
|
||||
} else if erpPurchaseOrder.State == model.ErpPurchaseOrderUnAudit {
|
||||
app.OK(c, nil, "订单已取消审核")
|
||||
return
|
||||
} else {
|
||||
logger.Error("order err, erpPurchaseOrder.State is:", logger.Field("erpPurchaseOrder.State", erpPurchaseOrder.State))
|
||||
app.Error(c, http.StatusInternalServerError, err, "取消审核失败:[入库/退货中、已终止、已完成]订单不能取消")
|
||||
return
|
||||
}
|
||||
default:
|
||||
logger.Error("order err, req.State is:", logger.Field("req.State", req.State))
|
||||
app.Error(c, http.StatusInternalServerError, err, "审核失败:参数有误")
|
||||
return
|
||||
}
|
||||
|
||||
err = orm.Eloquent.Table("erp_purchase_order").Where("id = ?", erpPurchaseOrder.ID).Updates(map[string]interface{}{
|
||||
"state": orderState,
|
||||
}).Error
|
||||
if err != nil {
|
||||
logger.Error("update erp_purchase_order err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "审核失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
app.OK(c, nil, "操作成功")
|
||||
return
|
||||
}
|
||||
|
||||
// ErpPurchaseDelete 删除采购订单
|
||||
// @Summary 删除采购订单
|
||||
// @Tags 采购管理, V1.3.0
|
||||
// @Produce json
|
||||
// @Accept json
|
||||
// @Param request body models.ErpPurchaseTerminateReq true "删除采购订单模型"
|
||||
// @Success 200 {object} app.Response
|
||||
// @Router /api/v1/erp_purchase/delete [post]
|
||||
func ErpPurchaseDelete(c *gin.Context) {
|
||||
var req = new(model.ErpPurchaseTerminateReq)
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
logger.Error("ShouldBindJSON err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusBadRequest, err, "参数错误:"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
err := tools.Validate(req) //必填参数校验
|
||||
if err != nil {
|
||||
app.Error(c, http.StatusBadRequest, err, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// todo 需要校验当前用户是否有权限
|
||||
|
||||
var erpPurchaseOrder model.ErpPurchaseOrder
|
||||
err = orm.Eloquent.Table("erp_purchase_order").Where("serial_number = ?", req.SerialNumber).Find(&erpPurchaseOrder).Error
|
||||
if err != nil {
|
||||
logger.Error("order err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "删除失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
if erpPurchaseOrder.SerialNumber == "" {
|
||||
logger.Error("order is null")
|
||||
app.Error(c, http.StatusInternalServerError, err, "删除失败:订单不存在")
|
||||
return
|
||||
}
|
||||
|
||||
// 仅待审核订单可删除
|
||||
if erpPurchaseOrder.State != model.ErpPurchaseOrderUnAudit {
|
||||
logger.Error("order err, erpPurchaseOrder.State is:", logger.Field("erpPurchaseOrder.State", erpPurchaseOrder.State))
|
||||
app.Error(c, http.StatusInternalServerError, err, "删除失败:仅待审核订单可删除")
|
||||
return
|
||||
}
|
||||
|
||||
begin := orm.Eloquent.Begin()
|
||||
// 1-删除采购订单表
|
||||
err = begin.Delete(erpPurchaseOrder).Error
|
||||
if err != nil {
|
||||
logger.Error("order delete1 err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "删除失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 2-删除采购订单商品表
|
||||
var commodities []model.ErpPurchaseCommodity
|
||||
err = orm.Eloquent.Table("erp_purchase_commodity").Where("erp_purchase_order_id = ?", erpPurchaseOrder.ID).Find(&commodities).Error
|
||||
if err != nil {
|
||||
logger.Error("query erp_purchase_commodity err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "删除失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
if len(commodities) != 0 {
|
||||
err = begin.Delete(&commodities).Error
|
||||
if err != nil {
|
||||
logger.Error("更新商品订单信息-删除 error")
|
||||
app.Error(c, http.StatusInternalServerError, err, "删除失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
err = begin.Commit().Error
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Error("commit err:", logger.Field("err", err))
|
||||
return
|
||||
}
|
||||
|
||||
app.OK(c, nil, "删除成功")
|
||||
return
|
||||
}
|
||||
|
||||
// ErpPurchaseInventory 入库(退货)
|
||||
// @Summary 入库(退货)
|
||||
// @Tags 采购管理, V1.3.0
|
||||
// @Produce json
|
||||
// @Accept json
|
||||
// @Param request body models.ErpPurchaseInventoryReq true "入库(退货)模型"
|
||||
// @Success 200 {object} app.Response
|
||||
// @Router /api/v1/erp_purchase/inventory [post]
|
||||
func ErpPurchaseInventory(c *gin.Context) {
|
||||
req := new(model.ErpPurchaseInventoryReq)
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
logger.Error("ShouldBindJSON err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误")
|
||||
return
|
||||
}
|
||||
|
||||
err := model.InventoryErpPurchase(req)
|
||||
if err != nil {
|
||||
logger.Error("InventoryErpPurchase err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "操作失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
app.OK(c, nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
// ErpPurchaseTerminate 终止采购
|
||||
// @Summary 终止采购
|
||||
// @Tags 采购管理, V1.3.0
|
||||
// @Produce json
|
||||
// @Accept json
|
||||
// @Param request body models.ErpPurchaseTerminateReq true "终止采购模型"
|
||||
// @Success 200 {object} app.Response
|
||||
// @Router /api/v1/erp_purchase/terminate [post]
|
||||
func ErpPurchaseTerminate(c *gin.Context) {
|
||||
var req = new(model.ErpPurchaseTerminateReq)
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
logger.Error("ShouldBindJSON err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusBadRequest, err, "参数错误:"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
err := tools.Validate(req) //必填参数校验
|
||||
if err != nil {
|
||||
app.Error(c, http.StatusBadRequest, err, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// todo 需要校验当前用户是否有权限
|
||||
|
||||
var erpPurchaseOrder model.ErpPurchaseOrder
|
||||
err = orm.Eloquent.Table("erp_purchase_order").Where("serial_number = ?", req.SerialNumber).Find(&erpPurchaseOrder).Error
|
||||
if err != nil {
|
||||
logger.Error("order err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "审核失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// 仅待入库、待退货订单可以终止
|
||||
orderState := 0
|
||||
if erpPurchaseOrder.State == model.ErpPurchaseOrderWaitInventory || erpPurchaseOrder.State == model.ErpPurchaseOrderWaitReject {
|
||||
orderState = model.ErpPurchaseOrderEnd
|
||||
} else {
|
||||
logger.Error("order err, erpPurchaseOrder.State is:", logger.Field("erpPurchaseOrder.State", erpPurchaseOrder.State))
|
||||
app.Error(c, http.StatusInternalServerError, err, "终止失败:仅待入库、待退货订单可以终止")
|
||||
return
|
||||
}
|
||||
|
||||
err = orm.Eloquent.Table("erp_purchase_order").Where("id = ?", erpPurchaseOrder.ID).Updates(map[string]interface{}{
|
||||
"state": orderState,
|
||||
}).Error
|
||||
if err != nil {
|
||||
logger.Error("update erp_purchase_order err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "审核失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
app.OK(c, nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
// ErpPurchaseExecute 执行(入库/退货)
|
||||
// @Summary 执行(入库/退货)
|
||||
// @Tags 采购管理, V1.3.0
|
||||
// @Produce json
|
||||
// @Accept json
|
||||
// @Param request body models.ErpPurchaseInventoryReq true "执行(入库/退货)模型"
|
||||
// @Success 200 {object} models.ErpPurchaseExecuteResp
|
||||
// @Router /api/v1/erp_purchase/execute [post]
|
||||
func ErpPurchaseExecute(c *gin.Context) {
|
||||
req := new(model.ErpPurchaseInventoryReq)
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
logger.Error("ShouldBindJSON err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := model.ExecuteErpPurchase(req)
|
||||
if err != nil {
|
||||
logger.Error("InventoryErpPurchase err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "操作失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
app.OK(c, resp, "")
|
||||
return
|
||||
}
|
|
@ -749,27 +749,43 @@ func getCommodityNameBySerialNum(serialNumber string) (string, error) {
|
|||
return commodity.Name, nil
|
||||
}
|
||||
|
||||
// generateSerialCode 生成商品串码
|
||||
func generateSerialCode(categoryID uint32) (string, error) {
|
||||
// 生成年月日6位数
|
||||
dateStr := time.Now().Format("060102")
|
||||
// GenerateSerialCode 生成商品串码
|
||||
func GenerateSerialCode(categoryID uint32) (string, error) {
|
||||
max := 1
|
||||
for {
|
||||
if max > 5 {
|
||||
logger.Error("generate SerialCode err")
|
||||
return "", errors.New("generate SerialCode err")
|
||||
}
|
||||
|
||||
// 生成四位随机数
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
randomNumber := rand.Intn(10000)
|
||||
randomStr := fmt.Sprintf("%04d", randomNumber)
|
||||
// 生成年月日6位数
|
||||
dateStr := time.Now().Format("060102")
|
||||
|
||||
// 获取商品分类编号前3位
|
||||
categoryStr, err := getCategoryCode(categoryID)
|
||||
if err != nil {
|
||||
logger.Errorf("getCategoryCode err:", logger.Field("err", err))
|
||||
return "", err
|
||||
// 生成四位随机数
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
randomNumber := rand.Intn(10000)
|
||||
randomStr := fmt.Sprintf("%04d", randomNumber)
|
||||
|
||||
// 获取商品分类编号前3位
|
||||
categoryStr, err := getCategoryCode(categoryID)
|
||||
if err != nil {
|
||||
logger.Errorf("getCategoryCode err:", logger.Field("err", err))
|
||||
return "", err
|
||||
}
|
||||
|
||||
// 拼接串码
|
||||
serialCode := categoryStr + dateStr + randomStr
|
||||
|
||||
// 检查生成的串码是否已存在
|
||||
exist, err := QueryRecordExist(fmt.Sprintf("SELECT * FROM erp_stock_commodity WHERE FIND_IN_SET(%s, imei) > 0", serialCode))
|
||||
if err != nil {
|
||||
logger.Error("exist sn err")
|
||||
}
|
||||
if !exist {
|
||||
return serialCode, nil
|
||||
}
|
||||
}
|
||||
|
||||
// 拼接串码
|
||||
serialCode := categoryStr + dateStr + randomStr
|
||||
|
||||
return serialCode, nil
|
||||
}
|
||||
|
||||
// getCategoryCode 根据商品分类ID查询分类编号前3位
|
||||
|
@ -2198,3 +2214,22 @@ func GetCodeList(req *QueryCodeReq) (*QueryCodeResp, error) {
|
|||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func GetErpCommodityMap(ids []uint32) (map[uint32]ErpCommodity, error) {
|
||||
commodityMap := make(map[uint32]ErpCommodity, 0)
|
||||
if len(ids) == 0 {
|
||||
return commodityMap, nil
|
||||
}
|
||||
var commodities []ErpCommodity
|
||||
err := orm.Eloquent.Table("erp_commodity").Where("id IN (?)", ids).Find(&commodities).Error
|
||||
if err != nil {
|
||||
logger.Error("commodities err:", logger.Field("err", err))
|
||||
return commodityMap, err
|
||||
}
|
||||
|
||||
for i, _ := range commodities {
|
||||
commodityMap[commodities[i].ID] = commodities[i]
|
||||
}
|
||||
|
||||
return commodityMap, nil
|
||||
}
|
||||
|
|
|
@ -758,6 +758,7 @@ func CheckIsOnlinePay(jCashier []ErpOrderCashier) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// NewErpBillSn 生成零售订单号
|
||||
func NewErpBillSn() string {
|
||||
nowTime := time.Now()
|
||||
rand.Seed(nowTime.UnixNano())
|
||||
|
|
836
app/admin/models/purchase.go
Normal file
836
app/admin/models/purchase.go
Normal file
|
@ -0,0 +1,836 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
orm "go-admin/common/global"
|
||||
"go-admin/logger"
|
||||
"gorm.io/gorm"
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
ErpPurchaseOrderUnAudit = 1 // 待审核
|
||||
ErpPurchaseOrderWaitInventory = 2 // 待入库
|
||||
ErpPurchaseOrderWaitReject = 3 // 待退货
|
||||
ErpPurchaseOrderFinished = 4 // 已完成
|
||||
ErpPurchaseOrderEnd = 5 // 已终止
|
||||
ErpPurchaseOrderInInventory = 6 // 入库中,部分入库
|
||||
ErpPurchaseOrderInReject = 7 // 退货中,部分退货
|
||||
|
||||
ErpProcureOrder = "procure" // 采购入库订单
|
||||
ErpRejectOrder = "reject" // 采购退货订单
|
||||
)
|
||||
|
||||
// ErpPurchaseOrder 采购订单表
|
||||
type ErpPurchaseOrder struct {
|
||||
Model
|
||||
SerialNumber string `json:"serial_number" gorm:"index"` // 单据编号
|
||||
PurchaseType string `json:"purchase_type"` // 类型:procure-采购 reject-退货
|
||||
StoreId uint32 `json:"store_id" gorm:"index"` // 门店id
|
||||
StoreName string `json:"store_name"` // 门店名称
|
||||
ErpSupplierId uint32 `json:"erp_supplier_id" gorm:"index"` // 供应商id
|
||||
ErpSupplierName string `json:"erp_supplier_name"` // 供应商名称
|
||||
MakerTime time.Time `json:"maker_time"` // 制单时间
|
||||
MakerId uint32 `json:"maker_id" gorm:"index"` // 制单人id
|
||||
MakerName string `json:"maker_name"` // 制单人名称
|
||||
AuditTime time.Time `json:"audit_time"` // 审核时间
|
||||
AuditorId uint32 `json:"auditor_id" gorm:"index"` // 审核人id
|
||||
AuditorName string `json:"auditor_name"` // 审核人名称
|
||||
State uint32 `json:"state"` // 1-待审核 2-待入库 3-待退货 4-已完成 5-已终止
|
||||
RejectedPurchaseOrderId uint32 `json:"rejected_purchase_order_id"` // 退货采购订单id
|
||||
ErpCashierId uint32 `json:"erp_cashier_id"` // 付款方式/收款方式id
|
||||
ErpCashierName string `json:"erp_cashier_name"` // 付款方式/收款方式名称
|
||||
AccountHolder string `json:"account_holder"` // 收款人
|
||||
OpeningBank string `json:"opening_bank"` // 开户行
|
||||
BankAccount string `json:"bank_account"` // 银行卡号
|
||||
DeliveryTime string `json:"delivery_time"` // 交货日期
|
||||
Commodities []ErpPurchaseCommodity `json:"commodities" gorm:"-"`
|
||||
}
|
||||
|
||||
// ErpPurchaseCommodity 采购订单商品表
|
||||
type ErpPurchaseCommodity struct {
|
||||
Model
|
||||
ErpPurchaseOrderId uint32 `json:"erp_purchase_order_id" gorm:"index"` // 采购订单id
|
||||
ErpCommodityId uint32 `json:"erp_commodity_id" gorm:"index"` // 商品id
|
||||
ErpCommodityName string `json:"erp_commodity_name"` // 商品名称
|
||||
CommoditySerialNumber string `json:"commodity_serial_number" gorm:"index"` // 商品编号
|
||||
IMEIType uint32 `json:"imei_type"` // 1-无串码 2-串码
|
||||
IMEI string `json:"imei"` // 商品串码
|
||||
Count uint32 `json:"count"` // 计划采购数量
|
||||
Price uint32 `json:"price"` // 计划采购单价
|
||||
Amount uint32 `json:"amount"` // 计划采购金额
|
||||
Remark string `json:"remark"` // 备注
|
||||
RejectedPrice uint32 `json:"rejected_price"` // 计划退货单价
|
||||
RejectedCount uint32 `json:"rejected_count"` // 计划退货数量
|
||||
RejectedAmount uint32 `json:"rejected_amount"` // 计划退货金额
|
||||
InventoryCount int32 `json:"inventory_count"` // 入库数量(=执行数量)
|
||||
ExecutionCount uint32 `json:"execute_count" gorm:"-"` // 执行数量
|
||||
ExecutionPrice uint32 `json:"execute_price" gorm:"-"` // 平均采购单价
|
||||
ExecutionEmployeePrice uint32 `json:"execute_employee_price" gorm:"-"` // 平均员工成本价
|
||||
ExecutionAmount uint32 `json:"execute_amount" gorm:"-"` // 执行金额
|
||||
}
|
||||
|
||||
// ErpPurchaseInventory 采购入库执行表
|
||||
type ErpPurchaseInventory struct {
|
||||
Model
|
||||
SerialNumber string `json:"serial_number" gorm:"index"` // 入库编号
|
||||
InventoryType string `json:"inventory_type"` // 采购类型:procure-采购 reject-退货
|
||||
ErpPurchaseOrderId uint32 `json:"erp_purchase_order_id" gorm:"index"` // 商品采购订单id
|
||||
ErpCommodityId uint32 `json:"erp_commodity_id" gorm:"index"` // 商品id
|
||||
ErpCommodityName string `json:"erp_commodity_name"` // 商品名称
|
||||
CommoditySerialNumber string `json:"commodity_serial_number" gorm:"index"` // 商品编号
|
||||
IMEIType uint32 `json:"imei_type"` // 1-无串码 2-串码
|
||||
IMEI string `json:"imei"` // 商品串码
|
||||
Count uint32 `json:"count"` // 数量
|
||||
Price uint32 `json:"price"` // 采购单价
|
||||
ImplementationPrice uint32 `json:"implementation_price"` // 执行单价
|
||||
EmployeePrice uint32 `json:"employee_price"` // 员工成本价
|
||||
InventoryCount int32 `json:"inventory_count"` // 入库数量
|
||||
Amount uint32 `json:"amount"` // 入库金额
|
||||
Remark string `json:"remark"` // 备注
|
||||
|
||||
//ErpPurchaseCommodity *ErpPurchaseCommodity `json:"erp_purchase_commodity" gorm:"-"`
|
||||
}
|
||||
|
||||
// ErpInventoryCommodity 采购入库执行商品表
|
||||
type ErpInventoryCommodity struct {
|
||||
Model
|
||||
SerialNumber string `json:"serial_number" gorm:"index"` // 入库编号
|
||||
InventoryType string `json:"inventory_type"` //
|
||||
ErpPurchaseInventoryId uint32 `json:"erp_purchase_inventory_id"` // 商品采购入库id
|
||||
ErpPurchaseOrderId uint32 `json:"erp_purchase_order_id"` // 商品采购订单id
|
||||
ErpCommodityId uint32 `json:"erp_commodity_id"` // 商品id
|
||||
ErpCommodityName string `json:"erp_commodity_name"` // 商品名称
|
||||
CommoditySerialNumber string `json:"commodity_serial_number"` // 商品编码
|
||||
IMEIType uint32 `json:"imei_type"` // 1-无串码 2-串码
|
||||
IMEI string `json:"imei"` // 串码
|
||||
Count uint32 `json:"count"` //
|
||||
Price uint32 `json:"price"` //
|
||||
EmployeePrice uint32 `json:"employee_price"` // 员工成本
|
||||
ImplementationPrice uint32 `json:"implementation_price"` //
|
||||
Amount uint32 `json:"amount"` //
|
||||
Remark string `json:"remark"` // 备注
|
||||
}
|
||||
|
||||
type ErpPurchaseCreateReq struct {
|
||||
PurchaseType string `json:"purchase_type" binding:"required"` // 采购类型:procure-采购 reject-退货
|
||||
PurchaseOrderSn string `json:"purchase_order_sn"` // 采购退货订单号
|
||||
StoreId uint32 `json:"store_id" binding:"required"` // 门店id
|
||||
DeliveryAddress string `json:"delivery_address" binding:"required"` // 交货地址
|
||||
MakerId uint32 `json:"maker_id" binding:"required"` // 经手人
|
||||
ErpSupplierId uint32 `json:"erp_supplier_id" binding:"required"` // 供应商id
|
||||
ErpCashierId uint32 `json:"erp_cashier_id" binding:"required"` // 付款方式
|
||||
AccountHolder string `json:"account_holder"` // 收款人
|
||||
OpeningBank string `json:"opening_bank" validate:"required"` // 开户行
|
||||
BankAccount string `json:"bank_account" validate:"required"` // 银行卡号
|
||||
DeliveryTime string `json:"delivery_time" binding:"required"` // 交货日期
|
||||
Remark string `json:"remark"` // 备注
|
||||
ErpPurchaseCommodities []ErpPurchaseCommodity `json:"erp_purchase_commodities" binding:"required"` // 采购商品信息
|
||||
}
|
||||
|
||||
type ErpPurchaseEditReq struct {
|
||||
ErpPurchaseOrderId uint32 `json:"erp_purchase_order_id" binding:"required"` // 采购订单id
|
||||
PurchaseType string `json:"purchase_type" binding:"required"` // 采购类型:procure-采购 reject-退货
|
||||
PurchaseOrderSn string `json:"purchase_order_sn"` // 采购退货订单号
|
||||
StoreId uint32 `json:"store_id" binding:"required"` // 门店id
|
||||
DeliveryAddress string `json:"delivery_address" binding:"required"` // 交货地址
|
||||
MakerId uint32 `json:"maker_id" binding:"required"` // 经手人
|
||||
ErpSupplierId uint32 `json:"erp_supplier_id" binding:"required"` // 供应商id
|
||||
ErpCashierId uint32 `json:"erp_cashier_id" binding:"required"` // 付款方式
|
||||
AccountHolder string `json:"account_holder"` // 收款人
|
||||
OpeningBank string `json:"opening_bank" validate:"required"` // 开户行
|
||||
BankAccount string `json:"bank_account" validate:"required"` // 银行卡号
|
||||
DeliveryTime string `json:"delivery_time" binding:"required"` // 交货日期
|
||||
Remark string `json:"remark"` // 备注
|
||||
ErpPurchaseCommodities []ErpPurchaseCommodity `json:"erp_purchase_commodities" binding:"required"` // 采购商品信息
|
||||
}
|
||||
|
||||
type ErpPurchaseOrderListReq struct {
|
||||
SerialNumber string `json:"serial_number"` // 单据编号
|
||||
PurchaseType string `json:"purchase_type"` // 采购类型:procure-采购 reject-退货
|
||||
StoreId uint32 `json:"store_id"` // 门店id
|
||||
ErpSupplierId uint32 `json:"erp_supplier_id"` // 供应商id
|
||||
AuditTimeStart string `json:"audit_time_start"` // 审核开始时间
|
||||
AuditTimeEnd string `json:"audit_time_end"` // 审核结束时间
|
||||
State uint32 `json:"state"` // 状态:1-待审核 2-待入库 3-待退货 4-已完成
|
||||
PageIndex int `json:"pageIndex"` // 页码
|
||||
PageSize int `json:"pageSize"` // 页面条数
|
||||
}
|
||||
|
||||
type ErpPurchaseOrderListResp struct {
|
||||
List []ErpPurchaseOrder `json:"list"`
|
||||
Total int `json:"total"` // 总条数
|
||||
PageIndex int `json:"pageIndex"` // 页码
|
||||
PageSize int `json:"pageSize"` // 页面条数
|
||||
}
|
||||
|
||||
type ErpPurchaseDetailReq struct {
|
||||
ErpPurchaseOrderId uint32 `json:"erp_purchase_order_id" binding:"required"` // 采购订单id
|
||||
}
|
||||
|
||||
// ErpPurchaseInventoryReq 入库(退货)入参;执行(入库/退货)入参
|
||||
type ErpPurchaseInventoryReq struct {
|
||||
ErpPurchaseOrderId uint32 `json:"erp_purchase_order_id" binding:"required"` // 采购订单id
|
||||
InventoryType string `json:"inventory_type" binding:"required"` // 采购类型:procure-采购 reject-退货
|
||||
Inventories []ErpPurchaseInventory `json:"inventories" binding:"required"` // 采购入库执行信息
|
||||
//Commodities []ErpInventoryCommodity `json:"commodities" binding:"required"`
|
||||
}
|
||||
|
||||
// ErpPurchaseAuditReq 审核采购订单入参
|
||||
type ErpPurchaseAuditReq struct {
|
||||
SerialNumber string `json:"serial_number" binding:"required"` // 单据编号
|
||||
State int `json:"state" binding:"required"` // 审核操作: 1-审核 2-取消审核
|
||||
}
|
||||
|
||||
// ErpPurchaseTerminateReq 终止采购入参
|
||||
type ErpPurchaseTerminateReq struct {
|
||||
SerialNumber string `json:"serial_number" binding:"required"` // 单据编号
|
||||
}
|
||||
|
||||
// ErpPurchaseExecuteResp 执行(入库/退货)出参
|
||||
type ErpPurchaseExecuteResp struct {
|
||||
List []ExecuteData `json:"list"`
|
||||
Total int `json:"total"` // 总条数
|
||||
PageIndex int `json:"pageIndex"` // 页码
|
||||
PageSize int `json:"pageSize"` // 页面条数
|
||||
}
|
||||
|
||||
type ExecuteData struct {
|
||||
ErpPurchaseOrderId uint32 `json:"erp_purchase_order_id" gorm:"index"` // 商品采购订单id
|
||||
ErpCommodityId uint32 `json:"erp_commodity_id" gorm:"index"` // 商品id
|
||||
ErpCommodityName string `json:"erp_commodity_name"` // 商品名称
|
||||
CommoditySerialNumber string `json:"commodity_serial_number" gorm:"index"` // 商品编号
|
||||
IMEIType uint32 `json:"imei_type"` // 1-无串码 2-串码
|
||||
IMEI string `json:"imei"` // 商品串码
|
||||
Count uint32 `json:"count"` // 数量
|
||||
ImplementationPrice uint32 `json:"implementation_price"` // 执行单价
|
||||
EmployeePrice uint32 `json:"employee_price"` // 员工成本价
|
||||
}
|
||||
|
||||
func (m *ErpPurchaseOrderListReq) List() (*ErpPurchaseOrderListResp, error) {
|
||||
resp := &ErpPurchaseOrderListResp{
|
||||
PageIndex: m.PageIndex,
|
||||
PageSize: m.PageSize,
|
||||
}
|
||||
page := m.PageIndex - 1
|
||||
if page < 0 {
|
||||
page = 0
|
||||
}
|
||||
if m.PageSize == 0 {
|
||||
m.PageSize = 10
|
||||
}
|
||||
qs := orm.Eloquent.Table("erp_purchase_order")
|
||||
if m.SerialNumber != "" {
|
||||
qs = qs.Where("serial_number=?", m.SerialNumber)
|
||||
} else {
|
||||
if m.PurchaseType != "" {
|
||||
qs = qs.Where("purchase_type=?", m.PurchaseType)
|
||||
}
|
||||
if m.StoreId != 0 {
|
||||
qs = qs.Where("store_id=?", m.StoreId)
|
||||
}
|
||||
if m.ErpSupplierId != 0 {
|
||||
qs = qs.Where("erp_supplier_id=?", m.ErpSupplierId)
|
||||
}
|
||||
if m.State != 0 {
|
||||
qs = qs.Where("state=?", m.State)
|
||||
}
|
||||
if m.AuditTimeStart != "" {
|
||||
parse, err := time.Parse(QueryTimeFormat, m.AuditTimeStart)
|
||||
if err != nil {
|
||||
logger.Errorf("erpPurchaseOrderList err:", err)
|
||||
return nil, err
|
||||
}
|
||||
qs = qs.Where("audit_time > ?", parse)
|
||||
}
|
||||
if m.AuditTimeEnd != "" {
|
||||
parse, err := time.Parse(QueryTimeFormat, m.AuditTimeEnd)
|
||||
if err != nil {
|
||||
logger.Errorf("erpPurchaseOrderList err:", err)
|
||||
return nil, err
|
||||
}
|
||||
parse = parse.AddDate(0, 0, 1)
|
||||
qs = qs.Where("audit_time < ?", parse)
|
||||
}
|
||||
}
|
||||
|
||||
var count int64
|
||||
err := qs.Count(&count).Error
|
||||
if err != nil {
|
||||
logger.Error("count err:", logger.Field("err", err))
|
||||
return resp, err
|
||||
}
|
||||
resp.Total = int(count)
|
||||
var orders []ErpPurchaseOrder
|
||||
err = qs.Order("id DESC").Offset(page * m.PageSize).Limit(m.PageSize).Find(&orders).Error
|
||||
if err != nil && err != RecordNotFound {
|
||||
logger.Error("erp commodity list err:", logger.Field("err", err))
|
||||
return resp, err
|
||||
}
|
||||
|
||||
resp.List = orders
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// NewErpPurchaseSn 生成采购订单号
|
||||
func NewErpPurchaseSn() string {
|
||||
nowTime := time.Now()
|
||||
rand.Seed(nowTime.UnixNano())
|
||||
max := 1
|
||||
for {
|
||||
if max > 5 {
|
||||
logger.Error("create sn err")
|
||||
return ""
|
||||
}
|
||||
random := rand.Int31n(9999) + 1000
|
||||
sn := fmt.Sprintf("%s%d", nowTime.Format("060102"), random)
|
||||
exist, err := QueryRecordExist(fmt.Sprintf("SELECT * FROM erp_purchase_order WHERE serial_number='%s'", sn))
|
||||
if err != nil {
|
||||
logger.Error("exist sn err")
|
||||
}
|
||||
if !exist {
|
||||
return sn
|
||||
}
|
||||
|
||||
max++
|
||||
}
|
||||
}
|
||||
|
||||
func ErpPurchaseCommodityListPerfectInfo(purchaseCommodities []ErpPurchaseCommodity) error {
|
||||
commodityIds := make([]uint32, 0, len(purchaseCommodities))
|
||||
for i, _ := range purchaseCommodities {
|
||||
commodityIds = append(commodityIds, purchaseCommodities[i].ID)
|
||||
}
|
||||
commodityMap, err := GetErpCommodityMap(commodityIds)
|
||||
if err != nil {
|
||||
logger.Error("purchase commodities err:", logger.Field("err", err))
|
||||
return err
|
||||
}
|
||||
|
||||
for i, _ := range purchaseCommodities {
|
||||
v, ok := commodityMap[purchaseCommodities[i].ErpCommodityId]
|
||||
if ok {
|
||||
purchaseCommodities[i].CommoditySerialNumber = v.SerialNumber
|
||||
purchaseCommodities[i].IMEIType = v.IMEIType
|
||||
//purchaseCommodities[i].IMEI = v.IMEI
|
||||
purchaseCommodities[i].ErpCommodityName = v.Name
|
||||
if purchaseCommodities[i].Count != 0 {
|
||||
purchaseCommodities[i].Amount = purchaseCommodities[i].Count * purchaseCommodities[i].Price
|
||||
}
|
||||
if purchaseCommodities[i].RejectedCount != 0 {
|
||||
purchaseCommodities[i].RejectedAmount = purchaseCommodities[i].RejectedCount * purchaseCommodities[i].RejectedPrice
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// IdInit 添加商户和供应商信息
|
||||
func (m *ErpPurchaseOrder) IdInit() error {
|
||||
if m.StoreId != 0 {
|
||||
store, err := GetStore(m.StoreId)
|
||||
if err != nil {
|
||||
logger.Error("get store err:", logger.Field("err", err))
|
||||
return err
|
||||
}
|
||||
m.StoreName = store.Name
|
||||
}
|
||||
|
||||
if m.ErpSupplierId != 0 {
|
||||
supplier, err := GetErpSupplier(m.ErpSupplierId)
|
||||
if err != nil {
|
||||
logger.Error("get supplier err:", logger.Field("err", err))
|
||||
return err
|
||||
}
|
||||
m.ErpSupplierName = supplier.Name
|
||||
}
|
||||
|
||||
if m.ErpCashierId != 0 {
|
||||
cashier, err := GetAccountDetail(int(m.ErpCashierId))
|
||||
if err != nil {
|
||||
logger.Error("get cashier err:", logger.Field("err", err))
|
||||
return err
|
||||
}
|
||||
m.ErpCashierName = cashier.Name
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetPurchaseInventorySn 生成入库编号
|
||||
func GetPurchaseInventorySn() string {
|
||||
count := 0
|
||||
for {
|
||||
if count > 5 {
|
||||
return ""
|
||||
}
|
||||
nowTime := time.Now()
|
||||
sn := nowTime.Format("060102")
|
||||
sn += fmt.Sprintf("%d", nowTime.Unix()%100)
|
||||
rand.Seed(nowTime.UnixNano())
|
||||
sn += fmt.Sprintf("%d", rand.Int31n(100))
|
||||
exist, err := QueryRecordExist(fmt.Sprintf("SELECT * FROM erp_purchase_inventory WHERE serial_number='%s'", sn))
|
||||
if err != nil {
|
||||
logger.Error("sn err:", logger.Field("err", err))
|
||||
count++
|
||||
continue
|
||||
}
|
||||
if err == nil && !exist {
|
||||
return sn
|
||||
}
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func GetErpPurchaseOrderPurchaseCommodityMap(orderId uint32) (map[uint32]ErpPurchaseCommodity, error) {
|
||||
commodityMap := make(map[uint32]ErpPurchaseCommodity, 0)
|
||||
if orderId == 0 {
|
||||
return commodityMap, nil
|
||||
}
|
||||
|
||||
var commodities []ErpPurchaseCommodity
|
||||
err := orm.Eloquent.Table("erp_purchase_commodity").Where("erp_purchase_order_id=?", orderId).Find(&commodities).Error
|
||||
if err != nil {
|
||||
logger.Error("commodities err:", logger.Field("err", err))
|
||||
return commodityMap, err
|
||||
}
|
||||
|
||||
for i, _ := range commodities {
|
||||
commodityMap[commodities[i].ErpCommodityId] = commodities[i]
|
||||
}
|
||||
|
||||
return commodityMap, nil
|
||||
}
|
||||
|
||||
func ErpPurchaseInventoryListIdInit(inventories []ErpPurchaseInventory /*commodities []ErpInventoryCommodity,*/, orderId uint32, inventoryType string) error {
|
||||
//inventorySn := GetPurchaseInventorySn()
|
||||
ids := make([]uint32, 0, len(inventories))
|
||||
for i, _ := range inventories {
|
||||
ids = append(ids, inventories[i].ErpCommodityId)
|
||||
}
|
||||
commodityMap, err := GetErpCommodityMap(ids)
|
||||
if err != nil {
|
||||
logger.Error("commodity map err:", logger.Field("err", err))
|
||||
return err
|
||||
}
|
||||
purchaseCommodityMap, err := GetErpPurchaseOrderPurchaseCommodityMap(orderId)
|
||||
if err != nil {
|
||||
logger.Error("purchase commodity map err:", logger.Field("err", err))
|
||||
return err
|
||||
}
|
||||
commodityCountMap := make(map[uint32]uint32, 0)
|
||||
//for i, _ := range commodities {
|
||||
// purchaseCommodity, _ := purchaseCommodityMap[inventories[i].ErpCommodityId]
|
||||
// v, ok := commodityMap[commodities[i].ErpCommodityId]
|
||||
// if ok {
|
||||
// commodities[i].SerialNumber = inventorySn
|
||||
// commodities[i].InventoryType = inventoryType
|
||||
// commodities[i].ErpPurchaseOrderId = orderId
|
||||
// commodities[i].ErpCommodityName = v.Name
|
||||
// commodities[i].CommoditySerialNumber = v.SerialNumber
|
||||
// commodities[i].IMEIType = v.IMEIType
|
||||
// commodities[i].Price = purchaseCommodity.Price
|
||||
// commodities[i].Amount = commodities[i].Count * commodities[i].ImplementationPrice
|
||||
// if v.IMEIType == 1 {
|
||||
// commodityCountMap[v.ID] += commodities[i].Count
|
||||
// } else {
|
||||
// commodityCountMap[v.ID] += 1
|
||||
// }
|
||||
//
|
||||
// //commodities[i].InventoryCount = int32(inventories[i].Count)
|
||||
// }
|
||||
//}
|
||||
|
||||
for i, _ := range inventories {
|
||||
purchaseCommodity, _ := purchaseCommodityMap[inventories[i].ErpCommodityId]
|
||||
commodityCount, _ := commodityCountMap[inventories[i].ErpCommodityId]
|
||||
v, ok := commodityMap[inventories[i].ErpCommodityId]
|
||||
if ok {
|
||||
inventories[i].ErpPurchaseOrderId = orderId
|
||||
inventories[i].InventoryType = inventoryType
|
||||
inventories[i].ErpCommodityName = v.Name
|
||||
inventories[i].CommoditySerialNumber = v.SerialNumber
|
||||
inventories[i].IMEIType = v.IMEIType
|
||||
inventories[i].Price = purchaseCommodity.Price
|
||||
inventories[i].Count = commodityCount
|
||||
inventories[i].Amount = inventories[i].Count * inventories[i].ImplementationPrice
|
||||
inventories[i].InventoryCount = purchaseCommodity.InventoryCount + int32(inventories[i].Count)
|
||||
if int32(purchaseCommodity.Count) < inventories[i].InventoryCount {
|
||||
return errors.New(fmt.Sprintf("order id:%d purchase commodity id:%d inventory count err", orderId, purchaseCommodity.ID))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreateErpPurchaseOrder 新增采购订单
|
||||
func CreateErpPurchaseOrder(req *ErpPurchaseCreateReq, sysUser *SysUser) (*ErpPurchaseOrder, error) {
|
||||
var err error
|
||||
nowTime := time.Now()
|
||||
|
||||
purchaseOrder := &ErpPurchaseOrder{}
|
||||
if req.PurchaseType == ErpProcureOrder { // 采购入库订单
|
||||
purchaseOrder = &ErpPurchaseOrder{
|
||||
SerialNumber: "cgr" + NewErpPurchaseSn(),
|
||||
PurchaseType: req.PurchaseType,
|
||||
StoreId: req.StoreId,
|
||||
ErpSupplierId: req.ErpSupplierId,
|
||||
MakerTime: nowTime,
|
||||
MakerId: uint32(sysUser.UserId),
|
||||
MakerName: sysUser.NickName,
|
||||
State: ErpPurchaseOrderUnAudit, // 1-待审核
|
||||
ErpCashierId: req.ErpCashierId,
|
||||
AccountHolder: req.AccountHolder,
|
||||
OpeningBank: req.OpeningBank,
|
||||
BankAccount: req.BankAccount,
|
||||
DeliveryTime: req.DeliveryTime,
|
||||
}
|
||||
err = purchaseOrder.IdInit()
|
||||
} else if req.PurchaseType == ErpRejectOrder { // 采购退货订单
|
||||
var erpPurchaseOrder ErpPurchaseOrder
|
||||
err = orm.Eloquent.Table("erp_purchase_order").Where("serial_number=?", req.PurchaseOrderSn).Find(&erpPurchaseOrder).Error
|
||||
if err != nil {
|
||||
logger.Error("purchase order err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
purchaseOrder = &ErpPurchaseOrder{
|
||||
SerialNumber: "cgt" + NewErpPurchaseSn(),
|
||||
PurchaseType: req.PurchaseType,
|
||||
StoreId: erpPurchaseOrder.StoreId,
|
||||
ErpSupplierId: erpPurchaseOrder.ErpSupplierId,
|
||||
MakerTime: nowTime,
|
||||
MakerId: uint32(req.MakerId),
|
||||
//MakerName: sysUser.NickName,
|
||||
State: ErpPurchaseOrderUnAudit, // 1-待审核
|
||||
ErpCashierId: req.ErpCashierId,
|
||||
}
|
||||
err = purchaseOrder.IdInit()
|
||||
} else {
|
||||
logger.Errorf("purchase_type err:", req.PurchaseType)
|
||||
return nil, errors.New("操作失败:采购类型有误")
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
logger.Error("info err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
err = ErpPurchaseCommodityListPerfectInfo(req.ErpPurchaseCommodities)
|
||||
if err != nil {
|
||||
logger.Error("info err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
begin := orm.Eloquent.Begin()
|
||||
err = begin.Create(purchaseOrder).Error
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Error("create purchase order err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for i, _ := range req.ErpPurchaseCommodities {
|
||||
req.ErpPurchaseCommodities[i].ErpPurchaseOrderId = purchaseOrder.ID
|
||||
req.ErpPurchaseCommodities[i].InventoryCount = 0 // todo 数量待核实
|
||||
err = begin.Create(&req.ErpPurchaseCommodities[i]).Error
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Error("create purchase commodity err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
err = begin.Commit().Error
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Error("commit purchase commodity err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return purchaseOrder, nil
|
||||
}
|
||||
|
||||
// EditErpPurchaseOrder 编辑采购订单
|
||||
func EditErpPurchaseOrder(req *ErpPurchaseEditReq, sysUser *SysUser) (*ErpPurchaseOrder, error) {
|
||||
// 查询订单信息
|
||||
var purchaseOrder ErpPurchaseOrder
|
||||
err := orm.Eloquent.Table("erp_purchase_order").Where("id=?", req.ErpPurchaseOrderId).Find(&purchaseOrder).Error
|
||||
if err != nil {
|
||||
logger.Error("purchase order err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if purchaseOrder.State != ErpPurchaseOrderUnAudit { // 只有待审核的订单才能编辑
|
||||
return nil, errors.New("订单不是待审核状态")
|
||||
}
|
||||
begin := orm.Eloquent.Begin()
|
||||
// 1-更新采购订单信息
|
||||
purchaseOrder.StoreId = req.StoreId
|
||||
purchaseOrder.ErpSupplierId = req.ErpSupplierId
|
||||
purchaseOrder.MakerId = req.MakerId
|
||||
purchaseOrder.ErpCashierId = req.ErpCashierId
|
||||
purchaseOrder.AccountHolder = req.AccountHolder
|
||||
purchaseOrder.OpeningBank = req.OpeningBank
|
||||
purchaseOrder.BankAccount = req.BankAccount
|
||||
purchaseOrder.DeliveryTime = req.DeliveryTime
|
||||
err = purchaseOrder.IdInit()
|
||||
if err != nil {
|
||||
logger.Error("purchase IdInit err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = begin.Model(&ErpPurchaseOrder{}).Where("id = ?", req.ErpPurchaseOrderId).Updates(purchaseOrder).Error
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Error("update erp_order err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 2-更新采购订单商品表
|
||||
err = updatePurchaseCommodityData(begin, req.ErpPurchaseOrderId, req)
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Error("update erp_purchase_commodity err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = begin.Commit().Error
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Error("commit err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &purchaseOrder, nil
|
||||
}
|
||||
|
||||
// updatePurchaseCommodityData 更新采购订单商品信息
|
||||
func updatePurchaseCommodityData(gdb *gorm.DB, orderId uint32, req *ErpPurchaseEditReq) error {
|
||||
// 查询现有的零售订单信息
|
||||
var commodities []ErpPurchaseCommodity
|
||||
err := orm.Eloquent.Table("erp_purchase_commodity").Where("erp_purchase_order_id = ?", orderId).Find(&commodities).Error
|
||||
if err != nil {
|
||||
logger.Error("query erp_purchase_commodity err:", logger.Field("err", err))
|
||||
return err
|
||||
}
|
||||
|
||||
var newCommodities []ErpPurchaseCommodity
|
||||
var deletedCommodities []ErpPurchaseCommodity
|
||||
var matchingCommodities []ErpPurchaseCommodity
|
||||
// 找到新增的商品
|
||||
for i, reqCommodity := range req.ErpPurchaseCommodities {
|
||||
// 订单商品表信息添加零售订单id
|
||||
req.ErpPurchaseCommodities[i].ErpPurchaseOrderId = orderId
|
||||
|
||||
var found bool
|
||||
for _, dbCommodity := range commodities {
|
||||
if reqCommodity.ErpCommodityId == dbCommodity.ErpCommodityId {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
newCommodities = append(newCommodities, reqCommodity)
|
||||
}
|
||||
}
|
||||
|
||||
// 找到删除的商品
|
||||
for _, dbCommodity := range commodities {
|
||||
var found bool
|
||||
for _, reqCommodity := range req.ErpPurchaseCommodities {
|
||||
if reqCommodity.ID == dbCommodity.ID {
|
||||
found = true
|
||||
// 找到匹配的商品,加入匹配列表
|
||||
matchingCommodities = append(matchingCommodities, reqCommodity)
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
deletedCommodities = append(deletedCommodities, dbCommodity)
|
||||
}
|
||||
}
|
||||
|
||||
// 2-更新商品订单信息-更新
|
||||
for _, commodity := range matchingCommodities {
|
||||
if err := gdb.Model(&ErpPurchaseCommodity{}).Where("id = ?", commodity.ID).Updates(commodity).Error; err != nil {
|
||||
logger.Error("更新商品订单信息-更新 error")
|
||||
return errors.New("操作失败:" + err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
// 2-更新商品订单信息-新增
|
||||
if len(newCommodities) != 0 {
|
||||
err = gdb.Create(&newCommodities).Error
|
||||
if err != nil {
|
||||
logger.Error("更新商品订单信息-新增 error")
|
||||
return errors.New("操作失败:" + err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
//2-更新商品订单信息-删除
|
||||
if len(deletedCommodities) != 0 {
|
||||
err = gdb.Delete(&deletedCommodities).Error
|
||||
if err != nil {
|
||||
logger.Error("更新商品订单信息-删除 error")
|
||||
return errors.New("操作失败:" + err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// InventoryErpPurchase 采购订单入库
|
||||
func InventoryErpPurchase(req *ErpPurchaseInventoryReq) error {
|
||||
err := checkPurchaseInventory(req)
|
||||
if err != nil {
|
||||
logger.Error("checkPurchaseInventoryReq err:", logger.Field("err", err))
|
||||
return err
|
||||
}
|
||||
|
||||
begin := orm.Eloquent.Begin()
|
||||
for _, v := range req.Inventories {
|
||||
// 更新采购商品表的执行数量
|
||||
err = begin.Model(&ErpPurchaseCommodity{}).
|
||||
Where("erp_purchase_order_id = ? AND erp_commodity_id = ?", v.ErpPurchaseOrderId, v.ErpCommodityId).
|
||||
UpdateColumn("inventory_count", gorm.Expr("inventory_count + ?", v.InventoryCount)).Error
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Error("update inventory count err:", logger.Field("err", err))
|
||||
return err
|
||||
}
|
||||
// 新建采购入库记录
|
||||
err = begin.Create(&v).Error
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Error("create erp inventory commodity err:", logger.Field("err", err))
|
||||
return err
|
||||
}
|
||||
// todo 更新库存信息表
|
||||
}
|
||||
|
||||
err = begin.Commit().Error
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Error("commit err:", logger.Field("err", err))
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// 校验入参数据,执行数量是否超过总数;串码商品的串码是否重复
|
||||
func checkPurchaseInventory(req *ErpPurchaseInventoryReq) error {
|
||||
// 查询现有的零售订单信息
|
||||
var commodities []ErpPurchaseCommodity
|
||||
err := orm.Eloquent.Table("erp_purchase_commodity").Where("erp_purchase_order_id = ?", req.ErpPurchaseOrderId).Find(&commodities).Error
|
||||
if err != nil {
|
||||
logger.Error("query erp_purchase_commodity err:", logger.Field("err", err))
|
||||
return err
|
||||
}
|
||||
|
||||
countMap := make(map[uint32]int32)
|
||||
for _, inventory := range req.Inventories {
|
||||
countMap[inventory.ErpCommodityId] += inventory.InventoryCount
|
||||
|
||||
// 如果该商品是串码商品,判断其串码是否会重复
|
||||
if inventory.IMEI != "" {
|
||||
exist, err := QueryRecordExist(fmt.Sprintf("SELECT * FROM erp_stock_commodity WHERE FIND_IN_SET(%s, imei) > 0", inventory.IMEI))
|
||||
if err != nil {
|
||||
logger.Error("exist sn err")
|
||||
}
|
||||
if exist {
|
||||
return fmt.Errorf("串码重复[%s]", inventory.IMEI)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 入库的商品信息有误,不在之前的商品列表中
|
||||
for commodityID := range countMap {
|
||||
found := false
|
||||
for _, commodity := range commodities {
|
||||
if commodity.ErpCommodityId == commodityID {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
return fmt.Errorf("商品编号[%d]不属于该采购订单", commodityID)
|
||||
}
|
||||
}
|
||||
|
||||
// 本次入库的数量超出该商品未入库数量
|
||||
for _, commodity := range commodities {
|
||||
if inventoryCount, ok := countMap[commodity.ErpCommodityId]; ok {
|
||||
if int32(commodity.Count)-commodity.InventoryCount < inventoryCount {
|
||||
return fmt.Errorf("本次入库商品[%s]数量[%d]超出该商品未入库数量[%d]", commodity.ErpCommodityName,
|
||||
inventoryCount, int32(commodity.Count)-commodity.InventoryCount)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ExecuteErpPurchase 执行(入库/退货)
|
||||
func ExecuteErpPurchase(req *ErpPurchaseInventoryReq) (*ErpPurchaseExecuteResp, error) {
|
||||
err := checkPurchaseInventory(req)
|
||||
if err != nil {
|
||||
logger.Error("checkPurchaseInventoryReq err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp := &ErpPurchaseExecuteResp{
|
||||
List: make([]ExecuteData, 0),
|
||||
}
|
||||
|
||||
for _, inventory := range req.Inventories {
|
||||
if inventory.IMEIType == 2 {
|
||||
// 如果是串码商品,根据 InventoryCount 拆分成对应数量的数据
|
||||
for i := 0; i < int(inventory.InventoryCount); i++ {
|
||||
// 调用函数B生成商品串码
|
||||
imei, err := generateIMEI(inventory.ErpCommodityId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 将拆分后的商品信息添加到执行响应中
|
||||
resp.List = append(resp.List, ExecuteData{
|
||||
ErpPurchaseOrderId: inventory.ErpPurchaseOrderId,
|
||||
ErpCommodityId: inventory.ErpCommodityId,
|
||||
ErpCommodityName: inventory.ErpCommodityName,
|
||||
CommoditySerialNumber: inventory.CommoditySerialNumber,
|
||||
IMEIType: inventory.IMEIType,
|
||||
IMEI: imei,
|
||||
Count: 1,
|
||||
ImplementationPrice: inventory.ImplementationPrice,
|
||||
EmployeePrice: inventory.EmployeePrice,
|
||||
})
|
||||
}
|
||||
} else if inventory.IMEIType == 1 {
|
||||
// 如果是非串码商品,只需拆分为1条数据
|
||||
resp.List = append(resp.List, ExecuteData{
|
||||
ErpPurchaseOrderId: inventory.ErpPurchaseOrderId,
|
||||
ErpCommodityId: inventory.ErpCommodityId,
|
||||
ErpCommodityName: inventory.ErpCommodityName,
|
||||
CommoditySerialNumber: inventory.CommoditySerialNumber,
|
||||
IMEIType: inventory.IMEIType,
|
||||
IMEI: "",
|
||||
Count: inventory.Count,
|
||||
ImplementationPrice: inventory.ImplementationPrice,
|
||||
EmployeePrice: inventory.EmployeePrice,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func generateIMEI(commodityId uint32) (string, error) {
|
||||
commodity, err := GetCommodity(commodityId)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return GenerateSerialCode(commodity.ErpCategoryId)
|
||||
}
|
22
app/admin/router/purchasemanage.go
Normal file
22
app/admin/router/purchasemanage.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package router
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"go-admin/app/admin/apis/purchasemanage"
|
||||
"go-admin/app/admin/middleware"
|
||||
jwt "go-admin/pkg/jwtauth"
|
||||
)
|
||||
|
||||
func registerErpPurchaseManageRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
r := v1.Group("/erp_purchase").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
|
||||
r.POST("create", purchasemanage.ErpPurchaseCreate) // 创建采购订单(入库/退货)
|
||||
r.POST("edit", purchasemanage.ErpPurchaseEdit) // 编辑采购订单
|
||||
r.POST("list", purchasemanage.ErpPurchaseList) // 查询采购订单列表
|
||||
r.POST("detail", purchasemanage.ErpPurchaseDetail) // 查询采购订单详情
|
||||
r.POST("audit", purchasemanage.ErpPurchaseAudit) // 审核采购订单
|
||||
r.POST("delete", purchasemanage.ErpPurchaseDelete) // 删除采购订单
|
||||
r.POST("inventory", purchasemanage.ErpPurchaseInventory) // 入库(退货)
|
||||
r.POST("terminate", purchasemanage.ErpPurchaseTerminate) // 终止
|
||||
r.POST("execute", purchasemanage.ErpPurchaseExecute) // 执行
|
||||
}
|
|
@ -106,4 +106,6 @@ func examplesCheckRoleRouter(r *gin.Engine, authMiddleware *jwtauth.GinJWTMiddle
|
|||
registerInventoryManageRouter(v1, authMiddleware)
|
||||
// 零售订单管理
|
||||
registerErpOrderManageRouter(v1, authMiddleware)
|
||||
// 采购管理
|
||||
registerErpPurchaseManageRouter(v1, authMiddleware)
|
||||
}
|
||||
|
|
808
docs/docs.go
808
docs/docs.go
|
@ -2118,6 +2118,278 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/erp_purchase/audit": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"采购管理",
|
||||
"V1.3.0"
|
||||
],
|
||||
"summary": "审核采购订单",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "审核采购订单模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseAuditReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/app.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/erp_purchase/create": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"采购管理",
|
||||
"V1.3.0"
|
||||
],
|
||||
"summary": "新建采购订单",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "新建采购订单模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseCreateReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseOrder"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/erp_purchase/delete": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"采购管理",
|
||||
"V1.3.0"
|
||||
],
|
||||
"summary": "删除采购订单",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "删除采购订单模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseTerminateReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/app.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/erp_purchase/detail": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"采购管理",
|
||||
"V1.3.0"
|
||||
],
|
||||
"summary": "查询采购订单详情",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "查询采购订单详情模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseDetailReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseOrder"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/erp_purchase/edit": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"采购管理",
|
||||
"V1.3.0"
|
||||
],
|
||||
"summary": "编辑采购订单",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "编辑采购订单模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseEditReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseOrder"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/erp_purchase/inventory": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"采购管理",
|
||||
"V1.3.0"
|
||||
],
|
||||
"summary": "入库(退货)",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "入库(退货)模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseInventoryReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/app.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/erp_purchase/list": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"采购管理",
|
||||
"V1.3.0"
|
||||
],
|
||||
"summary": "查询采购订单列表",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "查询采购订单列表模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseOrderListReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseOrderListResp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/erp_purchase/terminate": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"采购管理",
|
||||
"V1.3.0"
|
||||
],
|
||||
"summary": "终止采购",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "终止采购模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseTerminateReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/app.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/inventory/add_remark": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
|
@ -6876,6 +7148,542 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseAuditReq": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"serial_number",
|
||||
"state"
|
||||
],
|
||||
"properties": {
|
||||
"serial_number": {
|
||||
"description": "单据编号",
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"description": "审核操作: 1-审核 2-取消审核",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseCommodity": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"amount": {
|
||||
"description": "计划采购金额",
|
||||
"type": "integer"
|
||||
},
|
||||
"commodity_serial_number": {
|
||||
"description": "商品编号",
|
||||
"type": "string"
|
||||
},
|
||||
"count": {
|
||||
"description": "计划采购数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_commodity_id": {
|
||||
"description": "商品id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_commodity_name": {
|
||||
"description": "商品名称",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_purchase_order_id": {
|
||||
"description": "采购订单id",
|
||||
"type": "integer"
|
||||
},
|
||||
"execute_amount": {
|
||||
"description": "执行金额",
|
||||
"type": "integer"
|
||||
},
|
||||
"execute_count": {
|
||||
"description": "执行数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"execute_employee_price": {
|
||||
"description": "平均员工成本价",
|
||||
"type": "integer"
|
||||
},
|
||||
"execute_price": {
|
||||
"description": "平均采购单价",
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"imei": {
|
||||
"description": "商品串码",
|
||||
"type": "string"
|
||||
},
|
||||
"imei_type": {
|
||||
"description": "1-无串码 2-串码",
|
||||
"type": "integer"
|
||||
},
|
||||
"inventory_count": {
|
||||
"description": "入库数量(已执行数量)",
|
||||
"type": "integer"
|
||||
},
|
||||
"price": {
|
||||
"description": "计划采购单价",
|
||||
"type": "integer"
|
||||
},
|
||||
"rejected_amount": {
|
||||
"description": "计划退货金额",
|
||||
"type": "integer"
|
||||
},
|
||||
"rejected_count": {
|
||||
"description": "计划退货数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"rejected_price": {
|
||||
"description": "计划退货单价",
|
||||
"type": "integer"
|
||||
},
|
||||
"remark": {
|
||||
"description": "备注",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseCreateReq": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"bank_account",
|
||||
"delivery_address",
|
||||
"delivery_time",
|
||||
"erp_cashier_id",
|
||||
"erp_purchase_commodities",
|
||||
"erp_supplier_id",
|
||||
"maker_id",
|
||||
"opening_bank",
|
||||
"purchase_type",
|
||||
"store_id"
|
||||
],
|
||||
"properties": {
|
||||
"account_holder": {
|
||||
"description": "收款人",
|
||||
"type": "string"
|
||||
},
|
||||
"bank_account": {
|
||||
"description": "银行卡号",
|
||||
"type": "string"
|
||||
},
|
||||
"delivery_address": {
|
||||
"description": "交货地址",
|
||||
"type": "string"
|
||||
},
|
||||
"delivery_time": {
|
||||
"description": "交货日期",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_cashier_id": {
|
||||
"description": "付款方式",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_purchase_commodities": {
|
||||
"description": "采购商品信息",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseCommodity"
|
||||
}
|
||||
},
|
||||
"erp_supplier_id": {
|
||||
"description": "供应商id",
|
||||
"type": "integer"
|
||||
},
|
||||
"maker_id": {
|
||||
"description": "经手人",
|
||||
"type": "integer"
|
||||
},
|
||||
"opening_bank": {
|
||||
"description": "开户行",
|
||||
"type": "string"
|
||||
},
|
||||
"purchase_order_sn": {
|
||||
"description": "采购退货订单号",
|
||||
"type": "string"
|
||||
},
|
||||
"purchase_type": {
|
||||
"description": "采购类型:procure-采购 reject-退货",
|
||||
"type": "string"
|
||||
},
|
||||
"remark": {
|
||||
"description": "备注",
|
||||
"type": "string"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseDetailReq": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"erp_purchase_order_id"
|
||||
],
|
||||
"properties": {
|
||||
"erp_purchase_order_id": {
|
||||
"description": "采购订单id",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseEditReq": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"bank_account",
|
||||
"delivery_address",
|
||||
"delivery_time",
|
||||
"erp_cashier_id",
|
||||
"erp_purchase_commodities",
|
||||
"erp_purchase_order_id",
|
||||
"erp_supplier_id",
|
||||
"maker_id",
|
||||
"opening_bank",
|
||||
"purchase_type",
|
||||
"store_id"
|
||||
],
|
||||
"properties": {
|
||||
"account_holder": {
|
||||
"description": "收款人",
|
||||
"type": "string"
|
||||
},
|
||||
"bank_account": {
|
||||
"description": "银行卡号",
|
||||
"type": "string"
|
||||
},
|
||||
"delivery_address": {
|
||||
"description": "交货地址",
|
||||
"type": "string"
|
||||
},
|
||||
"delivery_time": {
|
||||
"description": "交货日期",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_cashier_id": {
|
||||
"description": "付款方式",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_purchase_commodities": {
|
||||
"description": "采购商品信息",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseCommodity"
|
||||
}
|
||||
},
|
||||
"erp_purchase_order_id": {
|
||||
"description": "采购订单id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_supplier_id": {
|
||||
"description": "供应商id",
|
||||
"type": "integer"
|
||||
},
|
||||
"maker_id": {
|
||||
"description": "经手人",
|
||||
"type": "integer"
|
||||
},
|
||||
"opening_bank": {
|
||||
"description": "开户行",
|
||||
"type": "string"
|
||||
},
|
||||
"purchase_order_sn": {
|
||||
"description": "采购退货订单号",
|
||||
"type": "string"
|
||||
},
|
||||
"purchase_type": {
|
||||
"description": "采购类型:procure-采购 reject-退货",
|
||||
"type": "string"
|
||||
},
|
||||
"remark": {
|
||||
"description": "备注",
|
||||
"type": "string"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseInventory": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"amount": {
|
||||
"description": "入库金额",
|
||||
"type": "integer"
|
||||
},
|
||||
"commodity_serial_number": {
|
||||
"description": "商品编号",
|
||||
"type": "string"
|
||||
},
|
||||
"count": {
|
||||
"description": "数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"employee_price": {
|
||||
"description": "员工成本价",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_commodity_id": {
|
||||
"description": "商品id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_commodity_name": {
|
||||
"description": "商品名称",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_purchase_order_id": {
|
||||
"description": "商品采购订单id",
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"imei": {
|
||||
"description": "商品串码",
|
||||
"type": "string"
|
||||
},
|
||||
"imei_type": {
|
||||
"description": "1-无串码 2-串码",
|
||||
"type": "integer"
|
||||
},
|
||||
"implementation_price": {
|
||||
"description": "执行单价",
|
||||
"type": "integer"
|
||||
},
|
||||
"inventory_count": {
|
||||
"description": "入库数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"inventory_type": {
|
||||
"description": "采购类型:procure-采购 reject-退货",
|
||||
"type": "string"
|
||||
},
|
||||
"price": {
|
||||
"description": "采购单价",
|
||||
"type": "integer"
|
||||
},
|
||||
"remark": {
|
||||
"description": "备注",
|
||||
"type": "string"
|
||||
},
|
||||
"serial_number": {
|
||||
"description": "入库编号",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseInventoryReq": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"erp_purchase_order_id",
|
||||
"inventories",
|
||||
"inventory_type"
|
||||
],
|
||||
"properties": {
|
||||
"erp_purchase_order_id": {
|
||||
"description": "采购订单id",
|
||||
"type": "integer"
|
||||
},
|
||||
"inventories": {
|
||||
"description": "采购信息",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseInventory"
|
||||
}
|
||||
},
|
||||
"inventory_type": {
|
||||
"description": "采购类型:procure-采购 reject-退货",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseOrder": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"account_holder": {
|
||||
"description": "收款人",
|
||||
"type": "string"
|
||||
},
|
||||
"audit_time": {
|
||||
"description": "审核时间",
|
||||
"type": "string"
|
||||
},
|
||||
"auditor_id": {
|
||||
"description": "审核人id",
|
||||
"type": "integer"
|
||||
},
|
||||
"auditor_name": {
|
||||
"description": "审核人名称",
|
||||
"type": "string"
|
||||
},
|
||||
"bank_account": {
|
||||
"description": "银行卡号",
|
||||
"type": "string"
|
||||
},
|
||||
"commodities": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseCommodity"
|
||||
}
|
||||
},
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"delivery_time": {
|
||||
"description": "交货日期",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_cashier_id": {
|
||||
"description": "付款方式/收款方式id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_cashier_name": {
|
||||
"description": "付款方式/收款方式名称",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_supplier_id": {
|
||||
"description": "供应商id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_supplier_name": {
|
||||
"description": "供应商名称",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"maker_id": {
|
||||
"description": "制单人id",
|
||||
"type": "integer"
|
||||
},
|
||||
"maker_name": {
|
||||
"description": "制单人名称",
|
||||
"type": "string"
|
||||
},
|
||||
"maker_time": {
|
||||
"description": "制单时间",
|
||||
"type": "string"
|
||||
},
|
||||
"opening_bank": {
|
||||
"description": "开户行",
|
||||
"type": "string"
|
||||
},
|
||||
"purchase_type": {
|
||||
"description": "类型:procure-采购 reject-退货",
|
||||
"type": "string"
|
||||
},
|
||||
"rejected_purchase_order_id": {
|
||||
"description": "退货采购订单id",
|
||||
"type": "integer"
|
||||
},
|
||||
"serial_number": {
|
||||
"description": "单据编号",
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"description": "1-待审核 2-待入库 3-待退货 4-已完成 5-已终止",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_name": {
|
||||
"description": "门店名称",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseOrderListReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"audit_time_end": {
|
||||
"description": "审核结束时间",
|
||||
"type": "string"
|
||||
},
|
||||
"audit_time_start": {
|
||||
"description": "审核开始时间",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_supplier_id": {
|
||||
"description": "供应商id",
|
||||
"type": "integer"
|
||||
},
|
||||
"pageIndex": {
|
||||
"description": "页码",
|
||||
"type": "integer"
|
||||
},
|
||||
"pageSize": {
|
||||
"description": "页面条数",
|
||||
"type": "integer"
|
||||
},
|
||||
"purchase_type": {
|
||||
"description": "采购类型:procure-采购 reject-退货",
|
||||
"type": "string"
|
||||
},
|
||||
"serial_number": {
|
||||
"description": "单据编号",
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"description": "状态:1-待审核 2-待入库 3-待退货 4-已完成",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseOrderListResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"list": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseOrder"
|
||||
}
|
||||
},
|
||||
"pageIndex": {
|
||||
"description": "页码",
|
||||
"type": "integer"
|
||||
},
|
||||
"pageSize": {
|
||||
"description": "页面条数",
|
||||
"type": "integer"
|
||||
},
|
||||
"total": {
|
||||
"description": "总条数",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseTerminateReq": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"serial_number"
|
||||
],
|
||||
"properties": {
|
||||
"serial_number": {
|
||||
"description": "单据编号",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpStock": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
|
@ -2107,6 +2107,278 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/erp_purchase/audit": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"采购管理",
|
||||
"V1.3.0"
|
||||
],
|
||||
"summary": "审核采购订单",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "审核采购订单模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseAuditReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/app.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/erp_purchase/create": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"采购管理",
|
||||
"V1.3.0"
|
||||
],
|
||||
"summary": "新建采购订单",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "新建采购订单模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseCreateReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseOrder"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/erp_purchase/delete": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"采购管理",
|
||||
"V1.3.0"
|
||||
],
|
||||
"summary": "删除采购订单",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "删除采购订单模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseTerminateReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/app.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/erp_purchase/detail": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"采购管理",
|
||||
"V1.3.0"
|
||||
],
|
||||
"summary": "查询采购订单详情",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "查询采购订单详情模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseDetailReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseOrder"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/erp_purchase/edit": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"采购管理",
|
||||
"V1.3.0"
|
||||
],
|
||||
"summary": "编辑采购订单",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "编辑采购订单模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseEditReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseOrder"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/erp_purchase/inventory": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"采购管理",
|
||||
"V1.3.0"
|
||||
],
|
||||
"summary": "入库(退货)",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "入库(退货)模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseInventoryReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/app.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/erp_purchase/list": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"采购管理",
|
||||
"V1.3.0"
|
||||
],
|
||||
"summary": "查询采购订单列表",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "查询采购订单列表模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseOrderListReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseOrderListResp"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/erp_purchase/terminate": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"采购管理",
|
||||
"V1.3.0"
|
||||
],
|
||||
"summary": "终止采购",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "终止采购模型",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseTerminateReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/app.Response"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/inventory/add_remark": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
|
@ -6865,6 +7137,542 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseAuditReq": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"serial_number",
|
||||
"state"
|
||||
],
|
||||
"properties": {
|
||||
"serial_number": {
|
||||
"description": "单据编号",
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"description": "审核操作: 1-审核 2-取消审核",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseCommodity": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"amount": {
|
||||
"description": "计划采购金额",
|
||||
"type": "integer"
|
||||
},
|
||||
"commodity_serial_number": {
|
||||
"description": "商品编号",
|
||||
"type": "string"
|
||||
},
|
||||
"count": {
|
||||
"description": "计划采购数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_commodity_id": {
|
||||
"description": "商品id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_commodity_name": {
|
||||
"description": "商品名称",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_purchase_order_id": {
|
||||
"description": "采购订单id",
|
||||
"type": "integer"
|
||||
},
|
||||
"execute_amount": {
|
||||
"description": "执行金额",
|
||||
"type": "integer"
|
||||
},
|
||||
"execute_count": {
|
||||
"description": "执行数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"execute_employee_price": {
|
||||
"description": "平均员工成本价",
|
||||
"type": "integer"
|
||||
},
|
||||
"execute_price": {
|
||||
"description": "平均采购单价",
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"imei": {
|
||||
"description": "商品串码",
|
||||
"type": "string"
|
||||
},
|
||||
"imei_type": {
|
||||
"description": "1-无串码 2-串码",
|
||||
"type": "integer"
|
||||
},
|
||||
"inventory_count": {
|
||||
"description": "入库数量(已执行数量)",
|
||||
"type": "integer"
|
||||
},
|
||||
"price": {
|
||||
"description": "计划采购单价",
|
||||
"type": "integer"
|
||||
},
|
||||
"rejected_amount": {
|
||||
"description": "计划退货金额",
|
||||
"type": "integer"
|
||||
},
|
||||
"rejected_count": {
|
||||
"description": "计划退货数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"rejected_price": {
|
||||
"description": "计划退货单价",
|
||||
"type": "integer"
|
||||
},
|
||||
"remark": {
|
||||
"description": "备注",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseCreateReq": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"bank_account",
|
||||
"delivery_address",
|
||||
"delivery_time",
|
||||
"erp_cashier_id",
|
||||
"erp_purchase_commodities",
|
||||
"erp_supplier_id",
|
||||
"maker_id",
|
||||
"opening_bank",
|
||||
"purchase_type",
|
||||
"store_id"
|
||||
],
|
||||
"properties": {
|
||||
"account_holder": {
|
||||
"description": "收款人",
|
||||
"type": "string"
|
||||
},
|
||||
"bank_account": {
|
||||
"description": "银行卡号",
|
||||
"type": "string"
|
||||
},
|
||||
"delivery_address": {
|
||||
"description": "交货地址",
|
||||
"type": "string"
|
||||
},
|
||||
"delivery_time": {
|
||||
"description": "交货日期",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_cashier_id": {
|
||||
"description": "付款方式",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_purchase_commodities": {
|
||||
"description": "采购商品信息",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseCommodity"
|
||||
}
|
||||
},
|
||||
"erp_supplier_id": {
|
||||
"description": "供应商id",
|
||||
"type": "integer"
|
||||
},
|
||||
"maker_id": {
|
||||
"description": "经手人",
|
||||
"type": "integer"
|
||||
},
|
||||
"opening_bank": {
|
||||
"description": "开户行",
|
||||
"type": "string"
|
||||
},
|
||||
"purchase_order_sn": {
|
||||
"description": "采购退货订单号",
|
||||
"type": "string"
|
||||
},
|
||||
"purchase_type": {
|
||||
"description": "采购类型:procure-采购 reject-退货",
|
||||
"type": "string"
|
||||
},
|
||||
"remark": {
|
||||
"description": "备注",
|
||||
"type": "string"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseDetailReq": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"erp_purchase_order_id"
|
||||
],
|
||||
"properties": {
|
||||
"erp_purchase_order_id": {
|
||||
"description": "采购订单id",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseEditReq": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"bank_account",
|
||||
"delivery_address",
|
||||
"delivery_time",
|
||||
"erp_cashier_id",
|
||||
"erp_purchase_commodities",
|
||||
"erp_purchase_order_id",
|
||||
"erp_supplier_id",
|
||||
"maker_id",
|
||||
"opening_bank",
|
||||
"purchase_type",
|
||||
"store_id"
|
||||
],
|
||||
"properties": {
|
||||
"account_holder": {
|
||||
"description": "收款人",
|
||||
"type": "string"
|
||||
},
|
||||
"bank_account": {
|
||||
"description": "银行卡号",
|
||||
"type": "string"
|
||||
},
|
||||
"delivery_address": {
|
||||
"description": "交货地址",
|
||||
"type": "string"
|
||||
},
|
||||
"delivery_time": {
|
||||
"description": "交货日期",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_cashier_id": {
|
||||
"description": "付款方式",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_purchase_commodities": {
|
||||
"description": "采购商品信息",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseCommodity"
|
||||
}
|
||||
},
|
||||
"erp_purchase_order_id": {
|
||||
"description": "采购订单id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_supplier_id": {
|
||||
"description": "供应商id",
|
||||
"type": "integer"
|
||||
},
|
||||
"maker_id": {
|
||||
"description": "经手人",
|
||||
"type": "integer"
|
||||
},
|
||||
"opening_bank": {
|
||||
"description": "开户行",
|
||||
"type": "string"
|
||||
},
|
||||
"purchase_order_sn": {
|
||||
"description": "采购退货订单号",
|
||||
"type": "string"
|
||||
},
|
||||
"purchase_type": {
|
||||
"description": "采购类型:procure-采购 reject-退货",
|
||||
"type": "string"
|
||||
},
|
||||
"remark": {
|
||||
"description": "备注",
|
||||
"type": "string"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseInventory": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"amount": {
|
||||
"description": "入库金额",
|
||||
"type": "integer"
|
||||
},
|
||||
"commodity_serial_number": {
|
||||
"description": "商品编号",
|
||||
"type": "string"
|
||||
},
|
||||
"count": {
|
||||
"description": "数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"employee_price": {
|
||||
"description": "员工成本价",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_commodity_id": {
|
||||
"description": "商品id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_commodity_name": {
|
||||
"description": "商品名称",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_purchase_order_id": {
|
||||
"description": "商品采购订单id",
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"imei": {
|
||||
"description": "商品串码",
|
||||
"type": "string"
|
||||
},
|
||||
"imei_type": {
|
||||
"description": "1-无串码 2-串码",
|
||||
"type": "integer"
|
||||
},
|
||||
"implementation_price": {
|
||||
"description": "执行单价",
|
||||
"type": "integer"
|
||||
},
|
||||
"inventory_count": {
|
||||
"description": "入库数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"inventory_type": {
|
||||
"description": "采购类型:procure-采购 reject-退货",
|
||||
"type": "string"
|
||||
},
|
||||
"price": {
|
||||
"description": "采购单价",
|
||||
"type": "integer"
|
||||
},
|
||||
"remark": {
|
||||
"description": "备注",
|
||||
"type": "string"
|
||||
},
|
||||
"serial_number": {
|
||||
"description": "入库编号",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseInventoryReq": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"erp_purchase_order_id",
|
||||
"inventories",
|
||||
"inventory_type"
|
||||
],
|
||||
"properties": {
|
||||
"erp_purchase_order_id": {
|
||||
"description": "采购订单id",
|
||||
"type": "integer"
|
||||
},
|
||||
"inventories": {
|
||||
"description": "采购信息",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseInventory"
|
||||
}
|
||||
},
|
||||
"inventory_type": {
|
||||
"description": "采购类型:procure-采购 reject-退货",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseOrder": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"account_holder": {
|
||||
"description": "收款人",
|
||||
"type": "string"
|
||||
},
|
||||
"audit_time": {
|
||||
"description": "审核时间",
|
||||
"type": "string"
|
||||
},
|
||||
"auditor_id": {
|
||||
"description": "审核人id",
|
||||
"type": "integer"
|
||||
},
|
||||
"auditor_name": {
|
||||
"description": "审核人名称",
|
||||
"type": "string"
|
||||
},
|
||||
"bank_account": {
|
||||
"description": "银行卡号",
|
||||
"type": "string"
|
||||
},
|
||||
"commodities": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseCommodity"
|
||||
}
|
||||
},
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"delivery_time": {
|
||||
"description": "交货日期",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_cashier_id": {
|
||||
"description": "付款方式/收款方式id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_cashier_name": {
|
||||
"description": "付款方式/收款方式名称",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_supplier_id": {
|
||||
"description": "供应商id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_supplier_name": {
|
||||
"description": "供应商名称",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
},
|
||||
"maker_id": {
|
||||
"description": "制单人id",
|
||||
"type": "integer"
|
||||
},
|
||||
"maker_name": {
|
||||
"description": "制单人名称",
|
||||
"type": "string"
|
||||
},
|
||||
"maker_time": {
|
||||
"description": "制单时间",
|
||||
"type": "string"
|
||||
},
|
||||
"opening_bank": {
|
||||
"description": "开户行",
|
||||
"type": "string"
|
||||
},
|
||||
"purchase_type": {
|
||||
"description": "类型:procure-采购 reject-退货",
|
||||
"type": "string"
|
||||
},
|
||||
"rejected_purchase_order_id": {
|
||||
"description": "退货采购订单id",
|
||||
"type": "integer"
|
||||
},
|
||||
"serial_number": {
|
||||
"description": "单据编号",
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"description": "1-待审核 2-待入库 3-待退货 4-已完成 5-已终止",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_name": {
|
||||
"description": "门店名称",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseOrderListReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"audit_time_end": {
|
||||
"description": "审核结束时间",
|
||||
"type": "string"
|
||||
},
|
||||
"audit_time_start": {
|
||||
"description": "审核开始时间",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_supplier_id": {
|
||||
"description": "供应商id",
|
||||
"type": "integer"
|
||||
},
|
||||
"pageIndex": {
|
||||
"description": "页码",
|
||||
"type": "integer"
|
||||
},
|
||||
"pageSize": {
|
||||
"description": "页面条数",
|
||||
"type": "integer"
|
||||
},
|
||||
"purchase_type": {
|
||||
"description": "采购类型:procure-采购 reject-退货",
|
||||
"type": "string"
|
||||
},
|
||||
"serial_number": {
|
||||
"description": "单据编号",
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"description": "状态:1-待审核 2-待入库 3-待退货 4-已完成",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseOrderListResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"list": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.ErpPurchaseOrder"
|
||||
}
|
||||
},
|
||||
"pageIndex": {
|
||||
"description": "页码",
|
||||
"type": "integer"
|
||||
},
|
||||
"pageSize": {
|
||||
"description": "页面条数",
|
||||
"type": "integer"
|
||||
},
|
||||
"total": {
|
||||
"description": "总条数",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpPurchaseTerminateReq": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"serial_number"
|
||||
],
|
||||
"properties": {
|
||||
"serial_number": {
|
||||
"description": "单据编号",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.ErpStock": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
|
@ -1828,6 +1828,402 @@ definitions:
|
|||
description: 总条数
|
||||
type: integer
|
||||
type: object
|
||||
models.ErpPurchaseAuditReq:
|
||||
properties:
|
||||
serial_number:
|
||||
description: 单据编号
|
||||
type: string
|
||||
state:
|
||||
description: '审核操作: 1-审核 2-取消审核'
|
||||
type: integer
|
||||
required:
|
||||
- serial_number
|
||||
- state
|
||||
type: object
|
||||
models.ErpPurchaseCommodity:
|
||||
properties:
|
||||
amount:
|
||||
description: 计划采购金额
|
||||
type: integer
|
||||
commodity_serial_number:
|
||||
description: 商品编号
|
||||
type: string
|
||||
count:
|
||||
description: 计划采购数量
|
||||
type: integer
|
||||
createdAt:
|
||||
description: 创建时间
|
||||
type: string
|
||||
erp_commodity_id:
|
||||
description: 商品id
|
||||
type: integer
|
||||
erp_commodity_name:
|
||||
description: 商品名称
|
||||
type: string
|
||||
erp_purchase_order_id:
|
||||
description: 采购订单id
|
||||
type: integer
|
||||
execute_amount:
|
||||
description: 执行金额
|
||||
type: integer
|
||||
execute_count:
|
||||
description: 执行数量
|
||||
type: integer
|
||||
execute_employee_price:
|
||||
description: 平均员工成本价
|
||||
type: integer
|
||||
execute_price:
|
||||
description: 平均采购单价
|
||||
type: integer
|
||||
id:
|
||||
description: 数据库记录编号
|
||||
type: integer
|
||||
imei:
|
||||
description: 商品串码
|
||||
type: string
|
||||
imei_type:
|
||||
description: 1-无串码 2-串码
|
||||
type: integer
|
||||
inventory_count:
|
||||
description: 入库数量(已执行数量)
|
||||
type: integer
|
||||
price:
|
||||
description: 计划采购单价
|
||||
type: integer
|
||||
rejected_amount:
|
||||
description: 计划退货金额
|
||||
type: integer
|
||||
rejected_count:
|
||||
description: 计划退货数量
|
||||
type: integer
|
||||
rejected_price:
|
||||
description: 计划退货单价
|
||||
type: integer
|
||||
remark:
|
||||
description: 备注
|
||||
type: string
|
||||
type: object
|
||||
models.ErpPurchaseCreateReq:
|
||||
properties:
|
||||
account_holder:
|
||||
description: 收款人
|
||||
type: string
|
||||
bank_account:
|
||||
description: 银行卡号
|
||||
type: string
|
||||
delivery_address:
|
||||
description: 交货地址
|
||||
type: string
|
||||
delivery_time:
|
||||
description: 交货日期
|
||||
type: string
|
||||
erp_cashier_id:
|
||||
description: 付款方式
|
||||
type: integer
|
||||
erp_purchase_commodities:
|
||||
description: 采购商品信息
|
||||
items:
|
||||
$ref: '#/definitions/models.ErpPurchaseCommodity'
|
||||
type: array
|
||||
erp_supplier_id:
|
||||
description: 供应商id
|
||||
type: integer
|
||||
maker_id:
|
||||
description: 经手人
|
||||
type: integer
|
||||
opening_bank:
|
||||
description: 开户行
|
||||
type: string
|
||||
purchase_order_sn:
|
||||
description: 采购退货订单号
|
||||
type: string
|
||||
purchase_type:
|
||||
description: 采购类型:procure-采购 reject-退货
|
||||
type: string
|
||||
remark:
|
||||
description: 备注
|
||||
type: string
|
||||
store_id:
|
||||
description: 门店id
|
||||
type: integer
|
||||
required:
|
||||
- bank_account
|
||||
- delivery_address
|
||||
- delivery_time
|
||||
- erp_cashier_id
|
||||
- erp_purchase_commodities
|
||||
- erp_supplier_id
|
||||
- maker_id
|
||||
- opening_bank
|
||||
- purchase_type
|
||||
- store_id
|
||||
type: object
|
||||
models.ErpPurchaseDetailReq:
|
||||
properties:
|
||||
erp_purchase_order_id:
|
||||
description: 采购订单id
|
||||
type: integer
|
||||
required:
|
||||
- erp_purchase_order_id
|
||||
type: object
|
||||
models.ErpPurchaseEditReq:
|
||||
properties:
|
||||
account_holder:
|
||||
description: 收款人
|
||||
type: string
|
||||
bank_account:
|
||||
description: 银行卡号
|
||||
type: string
|
||||
delivery_address:
|
||||
description: 交货地址
|
||||
type: string
|
||||
delivery_time:
|
||||
description: 交货日期
|
||||
type: string
|
||||
erp_cashier_id:
|
||||
description: 付款方式
|
||||
type: integer
|
||||
erp_purchase_commodities:
|
||||
description: 采购商品信息
|
||||
items:
|
||||
$ref: '#/definitions/models.ErpPurchaseCommodity'
|
||||
type: array
|
||||
erp_purchase_order_id:
|
||||
description: 采购订单id
|
||||
type: integer
|
||||
erp_supplier_id:
|
||||
description: 供应商id
|
||||
type: integer
|
||||
maker_id:
|
||||
description: 经手人
|
||||
type: integer
|
||||
opening_bank:
|
||||
description: 开户行
|
||||
type: string
|
||||
purchase_order_sn:
|
||||
description: 采购退货订单号
|
||||
type: string
|
||||
purchase_type:
|
||||
description: 采购类型:procure-采购 reject-退货
|
||||
type: string
|
||||
remark:
|
||||
description: 备注
|
||||
type: string
|
||||
store_id:
|
||||
description: 门店id
|
||||
type: integer
|
||||
required:
|
||||
- bank_account
|
||||
- delivery_address
|
||||
- delivery_time
|
||||
- erp_cashier_id
|
||||
- erp_purchase_commodities
|
||||
- erp_purchase_order_id
|
||||
- erp_supplier_id
|
||||
- maker_id
|
||||
- opening_bank
|
||||
- purchase_type
|
||||
- store_id
|
||||
type: object
|
||||
models.ErpPurchaseInventory:
|
||||
properties:
|
||||
amount:
|
||||
description: 入库金额
|
||||
type: integer
|
||||
commodity_serial_number:
|
||||
description: 商品编号
|
||||
type: string
|
||||
count:
|
||||
description: 数量
|
||||
type: integer
|
||||
createdAt:
|
||||
description: 创建时间
|
||||
type: string
|
||||
employee_price:
|
||||
description: 员工成本价
|
||||
type: integer
|
||||
erp_commodity_id:
|
||||
description: 商品id
|
||||
type: integer
|
||||
erp_commodity_name:
|
||||
description: 商品名称
|
||||
type: string
|
||||
erp_purchase_order_id:
|
||||
description: 商品采购订单id
|
||||
type: integer
|
||||
id:
|
||||
description: 数据库记录编号
|
||||
type: integer
|
||||
imei:
|
||||
description: 商品串码
|
||||
type: string
|
||||
imei_type:
|
||||
description: 1-无串码 2-串码
|
||||
type: integer
|
||||
implementation_price:
|
||||
description: 执行单价
|
||||
type: integer
|
||||
inventory_count:
|
||||
description: 入库数量
|
||||
type: integer
|
||||
inventory_type:
|
||||
description: 采购类型:procure-采购 reject-退货
|
||||
type: string
|
||||
price:
|
||||
description: 采购单价
|
||||
type: integer
|
||||
remark:
|
||||
description: 备注
|
||||
type: string
|
||||
serial_number:
|
||||
description: 入库编号
|
||||
type: string
|
||||
type: object
|
||||
models.ErpPurchaseInventoryReq:
|
||||
properties:
|
||||
erp_purchase_order_id:
|
||||
description: 采购订单id
|
||||
type: integer
|
||||
inventories:
|
||||
description: 采购信息
|
||||
items:
|
||||
$ref: '#/definitions/models.ErpPurchaseInventory'
|
||||
type: array
|
||||
inventory_type:
|
||||
description: 采购类型:procure-采购 reject-退货
|
||||
type: string
|
||||
required:
|
||||
- erp_purchase_order_id
|
||||
- inventories
|
||||
- inventory_type
|
||||
type: object
|
||||
models.ErpPurchaseOrder:
|
||||
properties:
|
||||
account_holder:
|
||||
description: 收款人
|
||||
type: string
|
||||
audit_time:
|
||||
description: 审核时间
|
||||
type: string
|
||||
auditor_id:
|
||||
description: 审核人id
|
||||
type: integer
|
||||
auditor_name:
|
||||
description: 审核人名称
|
||||
type: string
|
||||
bank_account:
|
||||
description: 银行卡号
|
||||
type: string
|
||||
commodities:
|
||||
items:
|
||||
$ref: '#/definitions/models.ErpPurchaseCommodity'
|
||||
type: array
|
||||
createdAt:
|
||||
description: 创建时间
|
||||
type: string
|
||||
delivery_time:
|
||||
description: 交货日期
|
||||
type: string
|
||||
erp_cashier_id:
|
||||
description: 付款方式/收款方式id
|
||||
type: integer
|
||||
erp_cashier_name:
|
||||
description: 付款方式/收款方式名称
|
||||
type: string
|
||||
erp_supplier_id:
|
||||
description: 供应商id
|
||||
type: integer
|
||||
erp_supplier_name:
|
||||
description: 供应商名称
|
||||
type: string
|
||||
id:
|
||||
description: 数据库记录编号
|
||||
type: integer
|
||||
maker_id:
|
||||
description: 制单人id
|
||||
type: integer
|
||||
maker_name:
|
||||
description: 制单人名称
|
||||
type: string
|
||||
maker_time:
|
||||
description: 制单时间
|
||||
type: string
|
||||
opening_bank:
|
||||
description: 开户行
|
||||
type: string
|
||||
purchase_type:
|
||||
description: 类型:procure-采购 reject-退货
|
||||
type: string
|
||||
rejected_purchase_order_id:
|
||||
description: 退货采购订单id
|
||||
type: integer
|
||||
serial_number:
|
||||
description: 单据编号
|
||||
type: string
|
||||
state:
|
||||
description: 1-待审核 2-待入库 3-待退货 4-已完成 5-已终止
|
||||
type: integer
|
||||
store_id:
|
||||
description: 门店id
|
||||
type: integer
|
||||
store_name:
|
||||
description: 门店名称
|
||||
type: string
|
||||
type: object
|
||||
models.ErpPurchaseOrderListReq:
|
||||
properties:
|
||||
audit_time_end:
|
||||
description: 审核结束时间
|
||||
type: string
|
||||
audit_time_start:
|
||||
description: 审核开始时间
|
||||
type: string
|
||||
erp_supplier_id:
|
||||
description: 供应商id
|
||||
type: integer
|
||||
pageIndex:
|
||||
description: 页码
|
||||
type: integer
|
||||
pageSize:
|
||||
description: 页面条数
|
||||
type: integer
|
||||
purchase_type:
|
||||
description: 采购类型:procure-采购 reject-退货
|
||||
type: string
|
||||
serial_number:
|
||||
description: 单据编号
|
||||
type: string
|
||||
state:
|
||||
description: 状态:1-待审核 2-待入库 3-待退货 4-已完成
|
||||
type: integer
|
||||
store_id:
|
||||
description: 门店id
|
||||
type: integer
|
||||
type: object
|
||||
models.ErpPurchaseOrderListResp:
|
||||
properties:
|
||||
list:
|
||||
items:
|
||||
$ref: '#/definitions/models.ErpPurchaseOrder'
|
||||
type: array
|
||||
pageIndex:
|
||||
description: 页码
|
||||
type: integer
|
||||
pageSize:
|
||||
description: 页面条数
|
||||
type: integer
|
||||
total:
|
||||
description: 总条数
|
||||
type: integer
|
||||
type: object
|
||||
models.ErpPurchaseTerminateReq:
|
||||
properties:
|
||||
serial_number:
|
||||
description: 单据编号
|
||||
type: string
|
||||
required:
|
||||
- serial_number
|
||||
type: object
|
||||
models.ErpStock:
|
||||
properties:
|
||||
commodities:
|
||||
|
@ -5540,6 +5936,182 @@ paths:
|
|||
summary: 查询门店经营数据
|
||||
tags:
|
||||
- 零售报表
|
||||
/api/v1/erp_purchase/audit:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 审核采购订单模型
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErpPurchaseAuditReq'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/app.Response'
|
||||
summary: 审核采购订单
|
||||
tags:
|
||||
- 采购管理
|
||||
- V1.3.0
|
||||
/api/v1/erp_purchase/create:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 新建采购订单模型
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErpPurchaseCreateReq'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErpPurchaseOrder'
|
||||
summary: 新建采购订单
|
||||
tags:
|
||||
- 采购管理
|
||||
- V1.3.0
|
||||
/api/v1/erp_purchase/delete:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 删除采购订单模型
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErpPurchaseTerminateReq'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/app.Response'
|
||||
summary: 删除采购订单
|
||||
tags:
|
||||
- 采购管理
|
||||
- V1.3.0
|
||||
/api/v1/erp_purchase/detail:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 查询采购订单详情模型
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErpPurchaseDetailReq'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErpPurchaseOrder'
|
||||
summary: 查询采购订单详情
|
||||
tags:
|
||||
- 采购管理
|
||||
- V1.3.0
|
||||
/api/v1/erp_purchase/edit:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 编辑采购订单模型
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErpPurchaseEditReq'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErpPurchaseOrder'
|
||||
summary: 编辑采购订单
|
||||
tags:
|
||||
- 采购管理
|
||||
- V1.3.0
|
||||
/api/v1/erp_purchase/inventory:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 入库(退货)模型
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErpPurchaseInventoryReq'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/app.Response'
|
||||
summary: 入库(退货)
|
||||
tags:
|
||||
- 采购管理
|
||||
- V1.3.0
|
||||
/api/v1/erp_purchase/list:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 查询采购订单列表模型
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErpPurchaseOrderListReq'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErpPurchaseOrderListResp'
|
||||
summary: 查询采购订单列表
|
||||
tags:
|
||||
- 采购管理
|
||||
- V1.3.0
|
||||
/api/v1/erp_purchase/terminate:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 终止采购模型
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErpPurchaseTerminateReq'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/app.Response'
|
||||
summary: 终止采购
|
||||
tags:
|
||||
- 采购管理
|
||||
- V1.3.0
|
||||
/api/v1/inventory/add_remark:
|
||||
post:
|
||||
consumes:
|
||||
|
|
Loading…
Reference in New Issue
Block a user