1、商品资料增加“停止采购”的筛选;
2、库存详情支持门店复选;(新增接口) 3、零售明细、销售明细支持门店复选; 4、采购需求支持单独筛选门店;(复选) 5、采购报表按单页面增加入库时间筛选;
This commit is contained in:
parent
95c4151f98
commit
19e1647154
|
@ -115,6 +115,35 @@ func GetInventoryDetail(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
// GetInventoryDetailNew 查询库存详情(详情页专用,门店复选)
|
||||
// @Summary 查询库存详情(详情页专用,门店复选)
|
||||
// @Tags 库存管理
|
||||
// @Produce json
|
||||
// @Accept json
|
||||
// @Param request body models.NewErpStockCommodityListReq true "查询库存详情模型"
|
||||
// @Success 200 {object} models.ErpStockCommodityListResp
|
||||
// @Router /api/v1/inventory/detail [post]
|
||||
func GetInventoryDetailNew(c *gin.Context) {
|
||||
req := &models.NewErpStockCommodityListReq{}
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
app.Error(c, http.StatusBadRequest, errors.New("param err"), "参数错误")
|
||||
return
|
||||
}
|
||||
|
||||
list, err := req.GetDetailListNew(c)
|
||||
if err != nil {
|
||||
if err.Error() == "该商品在调拨中" {
|
||||
app.Error(c, http.StatusInternalServerError, err, err.Error())
|
||||
} else {
|
||||
app.Error(c, http.StatusInternalServerError, err, "查询失败:"+err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
app.OK(c, list, "OK")
|
||||
return
|
||||
}
|
||||
|
||||
// DeliveryCargo 出库
|
||||
// @Summary 出库
|
||||
// @Tags 库存管理
|
||||
|
|
|
@ -310,6 +310,7 @@ type ErpCommodityListReq struct {
|
|||
IMEI string `json:"imei"` // 串码
|
||||
ErpBarcode string `json:"erp_barcode"` // 商品条码
|
||||
ErpSupplierId uint32 `json:"erp_supplier_id"` // 供应商id
|
||||
PurchaseType uint32 `json:"purchase_type"` // 0-全部,1-正常采购,2-停止采购
|
||||
PageIndex int `json:"pageIndex"` // 页码
|
||||
PageSize int `json:"pageSize"` // 每页展示数据条数
|
||||
IsExport uint32 `json:"is_export"` // 1-导出
|
||||
|
@ -453,6 +454,14 @@ func (m *ErpCommodityListReq) List() (*ErpCommodityListResp, error) {
|
|||
if m.ErpBarcode != "" {
|
||||
qs = qs.Where("erp_barcode LIKE ?", "%"+m.ErpBarcode+"%")
|
||||
}
|
||||
if m.PurchaseType != 0 {
|
||||
switch m.PurchaseType {
|
||||
case 1: // 正常采购
|
||||
qs = qs.Where("stop_purchase = ?", 0)
|
||||
case 2: // 停止采购
|
||||
qs = qs.Where("stop_purchase = ?", 1)
|
||||
}
|
||||
}
|
||||
|
||||
var count int64
|
||||
err := qs.Count(&count).Error
|
||||
|
@ -2653,6 +2662,32 @@ type ErpStockCommodityListReq struct {
|
|||
//Sn string `json:"sn"` // 首次入库订单编号
|
||||
}
|
||||
|
||||
// NewErpStockCommodityListReq 库存详情接口请求参数
|
||||
type NewErpStockCommodityListReq struct {
|
||||
ScanCode string `json:"scan_code"` // 扫码枪扫码数据:串码/条码
|
||||
ErpStockId uint32 `json:"erp_stock_id"` // 库存id
|
||||
ErpCommodityId uint32 `json:"erp_commodity_id"` // 商品id
|
||||
SerialNumber string `json:"serial_number"` // 商品编号
|
||||
CommodityName []string `json:"commodity_name"` // 商品名称
|
||||
ErpCategoryId uint32 `json:"erp_category_id"` // 商品分类Id
|
||||
IsIMEI uint32 `json:"is_imei"` // 是否串码:0-查全部 1-查串码类 2-查非串码
|
||||
IMEI string `json:"imei"` // 串码
|
||||
StoreId []uint32 `json:"store_id"` // 门店编号
|
||||
SupplierId uint32 `json:"supplier_id"` // 供应商id
|
||||
State []uint32 `json:"state"` // 库存状态:1-在库 2-已售 3-采购退货 4-调拨中 5-出库(前端只看1,4)
|
||||
OriginalSn string `json:"original_sn"` // 首次入库订单编号
|
||||
StorageType uint32 `json:"storage_type"` // 首次入库方式:1-系统入库 2-采购入库
|
||||
StockTimeStart string `json:"stock_time_start"` // 最近入库开始时间
|
||||
StockTimeEnd string `json:"stock_time_end"` // 最近入库结束时间
|
||||
Age uint32 `json:"age"` // 最近库龄
|
||||
AllAge uint32 `json:"all_age"` // 总库龄
|
||||
PageIndex int `json:"pageIndex"` // 页码
|
||||
PageSize int `json:"pageSize"` // 每页展示数据条数
|
||||
IsExport uint32 `json:"is_export"` // 是否导出excel:1-导出
|
||||
StockSortFlag uint32 `json:"stock_sort_flag"` // 排序方式:0-按入库时间降序排列(默认),1-按入库时间升序排列
|
||||
//Sn string `json:"sn"` // 首次入库订单编号
|
||||
}
|
||||
|
||||
// ErpStockCommodityListResp 库存详情接口响应参数
|
||||
type ErpStockCommodityListResp struct {
|
||||
List []ErpStockCommodity `json:"list"`
|
||||
|
@ -2776,6 +2811,217 @@ func (m *ErpStockCommodityListReq) GetDetailList(c *gin.Context, nType uint32) (
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
// GetDetailListNew 查看库存详情
|
||||
func (m *NewErpStockCommodityListReq) GetDetailListNew(c *gin.Context) (*ErpStockCommodityListResp, error) {
|
||||
resp := &ErpStockCommodityListResp{
|
||||
PageIndex: m.PageIndex,
|
||||
PageSize: m.PageSize,
|
||||
}
|
||||
page := m.PageIndex - 1
|
||||
if page < 0 {
|
||||
page = 0
|
||||
}
|
||||
if m.PageSize == 0 {
|
||||
m.PageSize = 10
|
||||
}
|
||||
|
||||
if m.ErpStockId != 0 {
|
||||
updateCommodityStock(m.ErpStockId) // 同步详情表的库存id
|
||||
}
|
||||
|
||||
// 出库数据不查询
|
||||
qs := orm.Eloquent.Table("erp_stock_commodity")
|
||||
|
||||
// 非管理员才判断所属门店
|
||||
if !(tools.GetRoleName(c) == "admin" || tools.GetRoleName(c) == "系统管理员") {
|
||||
sysUser, err := GetSysUserByCtx(c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 返回sysUser未过期的门店id列表
|
||||
storeList := GetValidStoreIDs(sysUser.StoreData)
|
||||
if len(m.StoreId) != 0 {
|
||||
if len(CompareLists(storeList, m.StoreId)) == 0 {
|
||||
return nil, errors.New("您没有该门店权限")
|
||||
}
|
||||
} else {
|
||||
if len(storeList) > 0 {
|
||||
if len(storeList) == 1 {
|
||||
qs = qs.Where("store_id = ?", storeList[0])
|
||||
} else {
|
||||
qs = qs.Where("store_id IN (?)", storeList)
|
||||
}
|
||||
} else {
|
||||
return nil, errors.New("用户未绑定门店")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 构建查询条件
|
||||
m.buildQueryConditionsNew(qs)
|
||||
es := qs
|
||||
|
||||
var count int64
|
||||
if err := qs.Count(&count).Error; err != nil {
|
||||
logger.Error("count err:", logger.Field("err", err))
|
||||
return resp, err
|
||||
}
|
||||
|
||||
nTotalCount := &struct {
|
||||
TotalWholesalePrice float64 `json:"total_wholesale_price"`
|
||||
TotalStaffCostPrice float64 `json:"total_staff_cost_price"`
|
||||
}{}
|
||||
err := es.Debug().Select("SUM(wholesale_price) as total_wholesale_price, SUM(staff_cost_price) as total_staff_cost_price").
|
||||
Scan(&nTotalCount).Error
|
||||
if err != nil {
|
||||
logger.Error("count err:", logger.Field("err", err))
|
||||
return resp, err
|
||||
}
|
||||
|
||||
//获取库存商品列表
|
||||
var commodities []ErpStockCommodity
|
||||
if m.IsExport == 1 {
|
||||
err := qs.Find(&commodities).Order("stock_time DESC,id DESC").Error
|
||||
if err != nil && !errors.Is(err, RecordNotFound) {
|
||||
logger.Error("find err:", logger.Field("err", err))
|
||||
return resp, err
|
||||
}
|
||||
ErpStockCommodityListSetAge(commodities)
|
||||
|
||||
listExport, err := InventoryDetailListExport(commodities, c)
|
||||
if err != nil {
|
||||
//logger.Error("list export err:", err)
|
||||
}
|
||||
resp.ExportUrl = listExport
|
||||
} else {
|
||||
if m.StockSortFlag == 1 {
|
||||
err = qs.Offset(page * m.PageSize).Limit(m.PageSize).Order("stock_time ASC,id ASC").Find(&commodities).Error
|
||||
} else {
|
||||
err = qs.Offset(page * m.PageSize).Limit(m.PageSize).Order("stock_time DESC,id DESC").Find(&commodities).Error
|
||||
}
|
||||
if err != nil && !errors.Is(err, RecordNotFound) {
|
||||
//logger.Error("erp commodity list err:", err)
|
||||
return resp, err
|
||||
}
|
||||
ErpStockCommodityListSetAge(commodities)
|
||||
ErpStockCommodityListSetCategoryNumber(commodities)
|
||||
resp.List = commodities
|
||||
}
|
||||
|
||||
if len(commodities) == 1 && commodities[0].State == InAllot && m.ScanCode != "" {
|
||||
return nil, errors.New("该商品在调拨中")
|
||||
}
|
||||
|
||||
//跟之前保持一致
|
||||
resp.Total = int(count)
|
||||
resp.PageIndex = page + 1
|
||||
resp.PageSize = m.PageSize
|
||||
resp.TotalWholesalePrice = math.Round(nTotalCount.TotalWholesalePrice*100) / 100
|
||||
resp.TotalStaffPrice = math.Round((nTotalCount.TotalStaffCostPrice+nTotalCount.TotalWholesalePrice)*100) / 100
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// buildQueryConditions 根据请求参数构建查询条件
|
||||
func (m *NewErpStockCommodityListReq) buildQueryConditionsNew(qs *gorm.DB) {
|
||||
if m.ScanCode != "" {
|
||||
qs = qs.Where("erp_barcode = ? or imei = ?", m.ScanCode, m.ScanCode)
|
||||
qs = qs.Where("state in (?)", []uint32{InStock, InAllot})
|
||||
} else {
|
||||
qs = qs.Where("state in (?)", []uint32{InStock, InAllot})
|
||||
if m.ErpStockId != 0 { //库存id
|
||||
qs = qs.Where("erp_stock_id=?", m.ErpStockId)
|
||||
}
|
||||
|
||||
if m.ErpCommodityId != 0 { //商品id
|
||||
qs = qs.Where("erp_commodity_id=?", m.ErpCommodityId)
|
||||
}
|
||||
|
||||
if m.IsIMEI != 0 { // 是否串码
|
||||
if m.IsIMEI == 1 { // 查串码数据
|
||||
qs = qs.Where("imei_type != ?", NoIMEICommodity)
|
||||
} else if m.IsIMEI == 2 { // 查非串码数据
|
||||
qs = qs.Where("imei_type = ?", NoIMEICommodity)
|
||||
}
|
||||
}
|
||||
|
||||
if m.SerialNumber != "" { //商品编号
|
||||
qs = qs.Where("commodity_serial_number=?", m.SerialNumber)
|
||||
}
|
||||
|
||||
if len(m.CommodityName) != 0 { //商品名称
|
||||
qs = qs.Where("erp_commodity_name IN (?)", m.CommodityName)
|
||||
}
|
||||
|
||||
if m.ErpCategoryId != 0 { //商品分类id
|
||||
categoryList, _ := GetSubcategoryIds(m.ErpCategoryId)
|
||||
if categoryList == nil {
|
||||
categoryList = append(categoryList, m.ErpCategoryId)
|
||||
}
|
||||
|
||||
qs = qs.Where("erp_category_id in ?", categoryList)
|
||||
}
|
||||
|
||||
if m.IMEI != "" { //商品串码
|
||||
qs = qs.Where("imei=?", m.IMEI)
|
||||
}
|
||||
|
||||
if len(m.StoreId) != 0 { //门店编号
|
||||
qs = qs.Where("store_id in ?", m.StoreId)
|
||||
}
|
||||
|
||||
if m.SupplierId != 0 { //供应商id
|
||||
qs = qs.Where("erp_supplier_id=?", m.SupplierId)
|
||||
}
|
||||
|
||||
defaultStates := []int{1, 4}
|
||||
if len(m.State) != 0 {
|
||||
if len(m.State) == 1 {
|
||||
qs = qs.Where("state = ?", m.State[0])
|
||||
} else {
|
||||
qs = qs.Where("state IN (?)", m.State)
|
||||
}
|
||||
} else {
|
||||
qs = qs.Where("state IN (?)", defaultStates)
|
||||
}
|
||||
|
||||
if m.OriginalSn != "" { //首次入库订单编号
|
||||
qs = qs.Where("original_sn=?", m.OriginalSn)
|
||||
}
|
||||
|
||||
if m.StorageType != 0 { //首次入库方式
|
||||
qs = qs.Where("storage_type=?", m.StorageType)
|
||||
}
|
||||
|
||||
if m.StockTimeStart != "" { //最近入库开始时间
|
||||
startTime, err := time.Parse(QueryTimeFormat, m.StockTimeStart)
|
||||
if err == nil {
|
||||
qs = qs.Where("stock_time>?", startTime)
|
||||
} else {
|
||||
//logger.Error("stock time start parse err:", err)
|
||||
}
|
||||
}
|
||||
|
||||
if m.StockTimeEnd != "" { //最近入库结束时间
|
||||
endTime, err := time.Parse(QueryTimeFormat, m.StockTimeEnd)
|
||||
if err == nil {
|
||||
qs = qs.Where("stock_time<?", endTime)
|
||||
} else {
|
||||
//logger.Error("stock time end parse err:", err)
|
||||
}
|
||||
}
|
||||
|
||||
if m.Age != 0 { //最近库龄
|
||||
qs = qs.Where("stock_time<?", time.Now().AddDate(0, 0, int(m.Age)*(-1)))
|
||||
}
|
||||
|
||||
if m.AllAge != 0 { //总库龄
|
||||
qs = qs.Where("first_stock_time<?", time.Now().AddDate(0, 0, int(m.AllAge)*(-1)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// RemoveDuplicates 去除重复数据,只保留 FirstStockTime 最久的记录
|
||||
func RemoveDuplicates(resp *ErpStockCommodityListResp) (*ErpStockCommodityListResp, error) {
|
||||
uniqueItems := make(map[string]ErpStockCommodity)
|
||||
|
|
|
@ -343,7 +343,7 @@ type ErpOrderRetailDetailReq struct {
|
|||
RetailType string `json:"retail_type"` // 销售类型:sale 零售销售; rejected 零售退货
|
||||
Uid int `json:"uid"` // 用户ID
|
||||
Tel string `json:"tel"` // 客户手机号
|
||||
StoreId uint32 `json:"store_id"` // 门店ID
|
||||
StoreId []uint32 `json:"store_id"` // 门店ID
|
||||
ErpCategoryId []uint32 `json:"erp_category_id"` // 分类id
|
||||
ErpCommodityName string `json:"erp_commodity_name"` // 商品名称
|
||||
Salesman uint32 `json:"salesman"` // 销售人员ID
|
||||
|
@ -4627,11 +4627,11 @@ func queryRetailDetailByJoin(req *ErpOrderRetailDetailReq, c *gin.Context) (*Erp
|
|||
orderSumQs = orderSumQs.Where("eo.tel=?", req.Tel)
|
||||
rejectedOrderSumQs = rejectedOrderSumQs.Where("eo.tel=?", req.Tel)
|
||||
}
|
||||
if req.StoreId != 0 { // 门店ID
|
||||
qs = qs.Where("erp_order.store_id=?", req.StoreId)
|
||||
es = es.Where("erp_order.store_id=?", req.StoreId)
|
||||
orderSumQs = orderSumQs.Where("eo.store_id=?", req.StoreId)
|
||||
rejectedOrderSumQs = rejectedOrderSumQs.Where("eo.store_id=?", req.StoreId)
|
||||
if len(req.StoreId) != 0 { // 门店ID
|
||||
qs = qs.Where("erp_order.store_id in ?", req.StoreId)
|
||||
es = es.Where("erp_order.store_id in ?", req.StoreId)
|
||||
orderSumQs = orderSumQs.Where("eo.store_id in ?", req.StoreId)
|
||||
rejectedOrderSumQs = rejectedOrderSumQs.Where("eo.store_id in ?", req.StoreId)
|
||||
}
|
||||
if req.IMEI != "" { // 串码
|
||||
qs = qs.Where("erp_order_commodity.imei=?", req.IMEI)
|
||||
|
@ -5070,9 +5070,9 @@ func queryRetailDetailCommon(req *ErpOrderRetailDetailReq, c *gin.Context) (*Erp
|
|||
qs = qs.Where("tel=?", req.Tel)
|
||||
totalPerQs = totalPerQs.Where("tel=?", req.Tel)
|
||||
}
|
||||
if req.StoreId != 0 { // 门店ID
|
||||
qs = qs.Where("store_id=?", req.StoreId)
|
||||
totalPerQs = totalPerQs.Where("store_id=?", req.StoreId)
|
||||
if len(req.StoreId) != 0 { // 门店ID
|
||||
qs = qs.Where("store_id in ?", req.StoreId)
|
||||
totalPerQs = totalPerQs.Where("store_id in ?", req.StoreId)
|
||||
}
|
||||
// 非管理员才判断所属门店
|
||||
if !(tools.GetRoleName(c) == "admin" || tools.GetRoleName(c) == "系统管理员") {
|
||||
|
@ -5221,16 +5221,16 @@ func queryRetailDetailCommon(req *ErpOrderRetailDetailReq, c *gin.Context) (*Erp
|
|||
return resp, err
|
||||
}
|
||||
|
||||
// 支付方式筛选
|
||||
if req.CashierId != 0 {
|
||||
var filteredData []ErpOrderCashier
|
||||
for _, cashier := range cashierData {
|
||||
if cashier.CashierId == req.CashierId {
|
||||
filteredData = append(filteredData, cashier)
|
||||
}
|
||||
}
|
||||
cashierData = filteredData
|
||||
}
|
||||
//// 支付方式筛选
|
||||
//if req.CashierId != 0 {
|
||||
// var filteredData []ErpOrderCashier
|
||||
// for _, cashier := range cashierData {
|
||||
// if cashier.CashierId == req.CashierId {
|
||||
// filteredData = append(filteredData, cashier)
|
||||
// }
|
||||
// }
|
||||
// cashierData = filteredData
|
||||
//}
|
||||
|
||||
// 退货订单支付汇总:目前零售退货订单暂时不展示各个方式的付款金额
|
||||
var rejectedCashierData []ErpOrderCashier
|
||||
|
@ -7297,7 +7297,7 @@ type ErpOrderSaleDetailReq struct {
|
|||
UserType []uint32 `json:"user_type"` // 会员类别:0-未注册 1-普通会员 2-黄金会员 4-白金会员 5-黑金会员 6-尊享会员 7-黄金&尊享 8-白金&尊享 9-黑金&尊享
|
||||
Uid int `json:"uid"` // 用户ID
|
||||
Tel string `json:"tel"` // 客户手机号
|
||||
StoreId uint32 `json:"store_id"` // 门店ID
|
||||
StoreId []uint32 `json:"store_id"` // 门店ID
|
||||
ErpCategoryId []uint32 `json:"erp_category_id"` // 分类id
|
||||
ErpCommodityName string `json:"erp_commodity_name"` // 商品名称
|
||||
Salesman uint32 `json:"salesman"` // 销售人员ID
|
||||
|
@ -7417,11 +7417,11 @@ func querySaleDetailByJoin(req *ErpOrderSaleDetailReq, c *gin.Context) (*ErpOrde
|
|||
orderSumQs = orderSumQs.Where("eo.tel=?", req.Tel)
|
||||
rejectedOrderSumQs = rejectedOrderSumQs.Where("eo.tel=?", req.Tel)
|
||||
}
|
||||
if req.StoreId != 0 { // 门店ID
|
||||
qs = qs.Where("erp_order.store_id=?", req.StoreId)
|
||||
es = es.Where("erp_order.store_id=?", req.StoreId)
|
||||
orderSumQs = orderSumQs.Where("eo.store_id=?", req.StoreId)
|
||||
rejectedOrderSumQs = rejectedOrderSumQs.Where("eo.store_id=?", req.StoreId)
|
||||
if len(req.StoreId) != 0 { // 门店ID
|
||||
qs = qs.Where("erp_order.store_id in ?", req.StoreId)
|
||||
es = es.Where("erp_order.store_id in ?", req.StoreId)
|
||||
orderSumQs = orderSumQs.Where("eo.store_id in ?", req.StoreId)
|
||||
rejectedOrderSumQs = rejectedOrderSumQs.Where("eo.store_id in ?", req.StoreId)
|
||||
}
|
||||
if req.IMEI != "" { // 串码
|
||||
qs = qs.Where("erp_order_commodity.imei=?", req.IMEI)
|
||||
|
@ -7650,9 +7650,9 @@ func querySaleDetailCommon(req *ErpOrderSaleDetailReq, c *gin.Context) (*ErpOrde
|
|||
qs = qs.Where("tel=?", req.Tel)
|
||||
totalPerQs = totalPerQs.Where("tel=?", req.Tel)
|
||||
}
|
||||
if req.StoreId != 0 { // 门店ID
|
||||
qs = qs.Where("store_id=?", req.StoreId)
|
||||
totalPerQs = totalPerQs.Where("store_id=?", req.StoreId)
|
||||
if len(req.StoreId) != 0 { // 门店ID
|
||||
qs = qs.Where("store_id in ?", req.StoreId)
|
||||
totalPerQs = totalPerQs.Where("store_id in ?", req.StoreId)
|
||||
}
|
||||
// 非管理员才判断所属门店
|
||||
if !(tools.GetRoleName(c) == "admin" || tools.GetRoleName(c) == "系统管理员") {
|
||||
|
|
|
@ -269,17 +269,18 @@ type ErpPurchaseDemandRemark struct {
|
|||
|
||||
// GetErpPurchaseDemandReq 获取采购需求入参
|
||||
type GetErpPurchaseDemandReq struct {
|
||||
ErpSupplierId uint32 `json:"erp_supplier_id"` // 主供应商id
|
||||
ErpCategoryId uint32 `json:"erp_category_id"` // 商品分类id
|
||||
ErpCommoditySerialNumber string `json:"erp_commodity_serial_number"` // 商品编号
|
||||
ErpCommodityName string `json:"erp_commodity_name"` // 商品名称
|
||||
HideFlag string `json:"hide_flag"` // 隐藏标记(默认关闭):ON-开启,隐藏无采购需求的商品,OFF-关闭,展示所有
|
||||
PageIndex int `json:"pageIndex"` // 页码
|
||||
PageSize int `json:"pageSize"` // 每页展示数据条数
|
||||
IsExport uint32 `json:"is_export"` // 1-导出
|
||||
CallType int `json:"call_type"` // 调用类型:1-采购视角;2-店员视角
|
||||
SortField string `json:"sort_field"` // 排序字段:主供应商 erp_supplier_id; 商品编号 erp_commodity_serial_number
|
||||
SortType string `json:"sort_type"` // 排序类型:desc 降序、asc 升序
|
||||
ErpSupplierId uint32 `json:"erp_supplier_id"` // 主供应商id
|
||||
ErpCategoryId uint32 `json:"erp_category_id"` // 商品分类id
|
||||
ErpCommoditySerialNumber string `json:"erp_commodity_serial_number"` // 商品编号
|
||||
ErpCommodityName string `json:"erp_commodity_name"` // 商品名称
|
||||
StoreId []uint32 `json:"store_id"` // 门店id
|
||||
HideFlag string `json:"hide_flag"` // 隐藏标记(默认关闭):ON-开启,隐藏无采购需求的商品,OFF-关闭,展示所有
|
||||
PageIndex int `json:"pageIndex"` // 页码
|
||||
PageSize int `json:"pageSize"` // 每页展示数据条数
|
||||
IsExport uint32 `json:"is_export"` // 1-导出
|
||||
CallType int `json:"call_type"` // 调用类型:1-采购视角;2-店员视角
|
||||
SortField string `json:"sort_field"` // 排序字段:主供应商 erp_supplier_id; 商品编号 erp_commodity_serial_number
|
||||
SortType string `json:"sort_type"` // 排序类型:desc 降序、asc 升序
|
||||
}
|
||||
|
||||
// DemandData 采购需求数据
|
||||
|
@ -336,19 +337,21 @@ type FinishErpPurchaseDemandReq struct {
|
|||
|
||||
// ErpPurchaseReportByOrderReq 采购报表(按单)入参
|
||||
type ErpPurchaseReportByOrderReq struct {
|
||||
SerialNumber string `json:"serial_number"` // 单据编号
|
||||
PurchaseType string `json:"purchase_type"` // 采购类型:procure-采购 reject-退货
|
||||
ErpCommodityName string `json:"erp_commodity_name"` // 商品名称
|
||||
ErpCategoryID uint32 `json:"erp_category_id"` // 商品分类id
|
||||
StoreId []uint32 `json:"store_id"` // 门店id
|
||||
HandlerId uint32 `json:"handler_id"` // 经手人id
|
||||
ErpSupplierId []uint32 `json:"erp_supplier_id"` // 供应商id
|
||||
State uint32 `json:"state"` // 2-待入库 3-待退货 4-已完成 5-已终止
|
||||
AuditTimeStart string `json:"audit_time_start"` // 审核开始时间
|
||||
AuditTimeEnd string `json:"audit_time_end"` // 审核结束时间
|
||||
IsExport uint32 `json:"is_export"` // 1-导出
|
||||
PageIndex int `json:"pageIndex"` // 页码
|
||||
PageSize int `json:"pageSize"` // 页面条数
|
||||
SerialNumber string `json:"serial_number"` // 单据编号
|
||||
PurchaseType string `json:"purchase_type"` // 采购类型:procure-采购 reject-退货
|
||||
ErpCommodityName string `json:"erp_commodity_name"` // 商品名称
|
||||
ErpCategoryID uint32 `json:"erp_category_id"` // 商品分类id
|
||||
StoreId []uint32 `json:"store_id"` // 门店id
|
||||
HandlerId uint32 `json:"handler_id"` // 经手人id
|
||||
ErpSupplierId []uint32 `json:"erp_supplier_id"` // 供应商id
|
||||
State uint32 `json:"state"` // 2-待入库 3-待退货 4-已完成 5-已终止
|
||||
AuditTimeStart string `json:"audit_time_start"` // 审核开始时间
|
||||
AuditTimeEnd string `json:"audit_time_end"` // 审核结束时间
|
||||
InventoryTimeStart string `json:"inventory_time_start"` // 入库开始时间
|
||||
InventoryTimeEnd string `json:"inventory_time_end"` // 入库结束时间
|
||||
IsExport uint32 `json:"is_export"` // 1-导出
|
||||
PageIndex int `json:"pageIndex"` // 页码
|
||||
PageSize int `json:"pageSize"` // 页面条数
|
||||
}
|
||||
|
||||
// ErpPurchaseReportByOrderResp 采购报表(按单)出参
|
||||
|
@ -1960,7 +1963,7 @@ func getErpPurchaseDemandAll(req *GetErpPurchaseDemandReq, c *gin.Context) (*Get
|
|||
}
|
||||
|
||||
// 批量查询门店信息
|
||||
stores, err := GetOnlineStores(c)
|
||||
stores, err := GetOnlineStores(c, req.StoreId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1968,6 +1971,12 @@ func getErpPurchaseDemandAll(req *GetErpPurchaseDemandReq, c *gin.Context) (*Get
|
|||
return nil, errors.New("无有效门店,请配置门店信息")
|
||||
}
|
||||
|
||||
// 组合门店信息
|
||||
var storeIdList []uint32
|
||||
for _, item := range stores {
|
||||
storeIdList = append(storeIdList, item.ID)
|
||||
}
|
||||
|
||||
qs := orm.Eloquent.Debug().Table("erp_commodity").Where("stop_purchase != 1")
|
||||
if req.ErpCategoryId != 0 {
|
||||
categoryInfo, err := GetErpCategory(req.ErpCategoryId)
|
||||
|
@ -2042,11 +2051,7 @@ func getErpPurchaseDemandAll(req *GetErpPurchaseDemandReq, c *gin.Context) (*Get
|
|||
// 批量查询商品上月销售数量
|
||||
var soldOutCommodities []ErpStockCommodity
|
||||
firstDay, lastDay := GetLastMonthRange() // 获取上个月的时间范围
|
||||
// 组合门店信息
|
||||
var storeIdList []uint32
|
||||
for _, item := range stores {
|
||||
storeIdList = append(storeIdList, item.ID)
|
||||
}
|
||||
|
||||
if len(storeIdList) > 1 {
|
||||
err = orm.Eloquent.Table("erp_stock_commodity").
|
||||
Where("state = ? AND updated_at BETWEEN ? AND ? AND store_id in (?) AND erp_commodity_id IN (?)",
|
||||
|
@ -2283,7 +2288,7 @@ func getErpPurchaseDemandHide(req *GetErpPurchaseDemandReq, c *gin.Context) (*Ge
|
|||
}
|
||||
|
||||
// 批量查询门店信息
|
||||
stores, err := GetOnlineStores(c)
|
||||
stores, err := GetOnlineStores(c, req.StoreId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -2714,59 +2719,80 @@ func GetLastMonthRange() (time.Time, time.Time) {
|
|||
}
|
||||
|
||||
// GetOnlineStores 查询有效门店信息
|
||||
func GetOnlineStores(c *gin.Context) ([]Store, error) {
|
||||
func GetOnlineStores(c *gin.Context, reqStoreList []uint32) ([]Store, error) {
|
||||
user, err := GetSysUserByCtx(c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var stores []Store
|
||||
if user.RoleId == 1 { // 系统管理员
|
||||
var stores []Store
|
||||
err = orm.Eloquent.Table("store").Where("cooperative_business_id = ? ",
|
||||
user.CooperativeBusinessId).Find(&stores).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return stores, nil
|
||||
}
|
||||
|
||||
// 解析门店数据
|
||||
if err := json.Unmarshal([]byte(user.StoreData), &user.StoreList); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(user.StoreList) == 0 {
|
||||
return nil, errors.New("no stores found")
|
||||
}
|
||||
|
||||
// 当前时间
|
||||
now := time.Now()
|
||||
|
||||
// 过滤掉过期的门店
|
||||
validStores := make([]Store, 0)
|
||||
for _, store := range user.StoreList {
|
||||
expireTime, err := time.Parse(StoreDateTimeFormat, store.ExpireTime)
|
||||
if err != nil {
|
||||
log.Println("Error parsing time:", err, "ExpireTime:", store.ExpireTime)
|
||||
continue
|
||||
} else {
|
||||
// 解析门店数据
|
||||
if err = json.Unmarshal([]byte(user.StoreData), &user.StoreList); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 包含当天有效时间
|
||||
expireTime = expireTime.Add(24*time.Hour - time.Second)
|
||||
if expireTime.After(now) {
|
||||
tempStore := Store{
|
||||
Name: store.StoreName,
|
||||
if len(user.StoreList) == 0 {
|
||||
return nil, errors.New("no stores found")
|
||||
}
|
||||
|
||||
// 当前时间
|
||||
now := time.Now()
|
||||
|
||||
// 过滤掉过期的门店
|
||||
validStores := make([]Store, 0)
|
||||
for _, store := range user.StoreList {
|
||||
expireTime, err := time.Parse(StoreDateTimeFormat, store.ExpireTime)
|
||||
if err != nil {
|
||||
log.Println("Error parsing time:", err, "ExpireTime:", store.ExpireTime)
|
||||
continue
|
||||
}
|
||||
|
||||
// 包含当天有效时间
|
||||
expireTime = expireTime.Add(24*time.Hour - time.Second)
|
||||
if expireTime.After(now) {
|
||||
tempStore := Store{
|
||||
Name: store.StoreName,
|
||||
}
|
||||
tempStore.ID = uint32(store.StoreID)
|
||||
stores = append(validStores, tempStore)
|
||||
}
|
||||
tempStore.ID = uint32(store.StoreID)
|
||||
validStores = append(validStores, tempStore)
|
||||
}
|
||||
}
|
||||
|
||||
if len(validStores) == 0 {
|
||||
if len(stores) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return validStores, nil
|
||||
// 如果 reqStoreList 不为空,筛选匹配的门店
|
||||
if len(reqStoreList) > 0 {
|
||||
reqStoreSet := make(map[uint32]struct{}, len(reqStoreList))
|
||||
for _, storeID := range reqStoreList {
|
||||
reqStoreSet[storeID] = struct{}{}
|
||||
}
|
||||
|
||||
var matchedStores []Store
|
||||
for _, store := range stores {
|
||||
if _, exists := reqStoreSet[store.ID]; exists {
|
||||
matchedStores = append(matchedStores, store)
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有匹配的门店,返回空结果
|
||||
if len(matchedStores) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return matchedStores, nil
|
||||
}
|
||||
|
||||
return stores, nil
|
||||
}
|
||||
|
||||
type Result struct {
|
||||
|
@ -3465,7 +3491,7 @@ func getReportByOrderFromCommon(req *ErpPurchaseReportByOrderReq, c *gin.Context
|
|||
logger.Errorf("erpPurchaseOrderList err:", err)
|
||||
return nil, err
|
||||
}
|
||||
qs = qs.Where("erp_purchase_order.audit_time > ?", parse)
|
||||
qs = qs.Where("erp_purchase_order.audit_time >= ?", parse)
|
||||
}
|
||||
if req.AuditTimeEnd != "" { // 审核结束时间
|
||||
parse, err := time.Parse(QueryTimeFormat, req.AuditTimeEnd)
|
||||
|
@ -3474,7 +3500,7 @@ func getReportByOrderFromCommon(req *ErpPurchaseReportByOrderReq, c *gin.Context
|
|||
return nil, err
|
||||
}
|
||||
//parse = parse.AddDate(0, 0, 1)
|
||||
qs = qs.Where("erp_purchase_order.audit_time < ?", parse)
|
||||
qs = qs.Where("erp_purchase_order.audit_time <= ?", parse)
|
||||
}
|
||||
if req.ErpCommodityName != "" { // 商品名称
|
||||
qs = qs.Where("erp_purchase_commodity.erp_commodity_name=?", req.ErpCommodityName)
|
||||
|
@ -3495,7 +3521,7 @@ func getReportByOrderFromCommon(req *ErpPurchaseReportByOrderReq, c *gin.Context
|
|||
}
|
||||
resp.Total = int(count)
|
||||
var orders []ErpPurchaseOrder
|
||||
if req.ErpCategoryID != 0 || req.ErpCommodityName != "" || req.IsExport == 1 {
|
||||
if req.ErpCategoryID != 0 || req.ErpCommodityName != "" || req.InventoryTimeStart != "" || req.IsExport == 1 {
|
||||
err = qs.Order("erp_purchase_order.id DESC").Distinct("erp_purchase_order.*").Find(&orders).Error
|
||||
} else {
|
||||
err = qs.Order("erp_purchase_order.id DESC").Distinct("erp_purchase_order.*").
|
||||
|
@ -3548,9 +3574,10 @@ func getReportByOrderFromCommon(req *ErpPurchaseReportByOrderReq, c *gin.Context
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
//if reportByOrderData.CommodityData == nil {
|
||||
// continue
|
||||
//}
|
||||
|
||||
if reportByOrderData.CommodityData == nil && req.InventoryTimeStart != "" {
|
||||
continue
|
||||
}
|
||||
|
||||
reportByOrderData.Amount = nAmount
|
||||
reportByOrderData.Amount = math.Round(reportByOrderData.Amount*100) / 100
|
||||
|
@ -3564,7 +3591,19 @@ func getReportByOrderFromCommon(req *ErpPurchaseReportByOrderReq, c *gin.Context
|
|||
nTotalCount += nCount
|
||||
}
|
||||
|
||||
if req.ErpCategoryID != 0 || req.ErpCommodityName != "" {
|
||||
if req.IsExport == 1 {
|
||||
resp.Total = len(reportByOrderDataList)
|
||||
resp.List = reportByOrderDataList
|
||||
nTotalAmount = math.Round(nTotalAmount*100) / 100
|
||||
resp.Amount = nTotalAmount
|
||||
resp.Count = nTotalCount
|
||||
filePath, err := reportByOrderExport(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp = &ErpPurchaseReportByOrderResp{}
|
||||
resp.ExportUrl = filePath
|
||||
} else if req.ErpCategoryID != 0 || req.ErpCommodityName != "" || req.InventoryTimeStart != "" {
|
||||
resp.Total = len(reportByOrderDataList)
|
||||
// 计算分页所需的切片索引
|
||||
startIndex := page * req.PageSize
|
||||
|
@ -3588,15 +3627,6 @@ func getReportByOrderFromCommon(req *ErpPurchaseReportByOrderReq, c *gin.Context
|
|||
resp.Count = totalCount
|
||||
}
|
||||
|
||||
if req.IsExport == 1 {
|
||||
filePath, err := reportByOrderExport(resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp = &ErpPurchaseReportByOrderResp{}
|
||||
resp.ExportUrl = filePath
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
|
@ -3685,6 +3715,22 @@ func getOrderInventoryInfo(req *ErpPurchaseReportByOrderReq, erpPurchaseOrderId
|
|||
}
|
||||
qs = qs.Where("commodity_serial_number LIKE ?", categoryInfo.Number+"%")
|
||||
}
|
||||
if req.InventoryTimeStart != "" { // 入库开始时间
|
||||
parse, err := time.Parse(QueryTimeFormat, req.InventoryTimeStart)
|
||||
if err != nil {
|
||||
logger.Errorf("erpPurchaseOrderList err:", err)
|
||||
return nil, 0, 0, err
|
||||
}
|
||||
qs = qs.Where("created_at >= ?", parse)
|
||||
}
|
||||
if req.InventoryTimeEnd != "" { // 入库结束时间
|
||||
parse, err := time.Parse(QueryTimeFormat, req.InventoryTimeEnd)
|
||||
if err != nil {
|
||||
logger.Errorf("erpPurchaseOrderList err:", err)
|
||||
return nil, 0, 0, err
|
||||
}
|
||||
qs = qs.Where("created_at <= ?", parse)
|
||||
}
|
||||
|
||||
err := qs.Find(&inventoryList).Error
|
||||
if err != nil {
|
||||
|
@ -3697,6 +3743,10 @@ func getOrderInventoryInfo(req *ErpPurchaseReportByOrderReq, erpPurchaseOrderId
|
|||
// return nil, 0, 0, nil
|
||||
//}
|
||||
|
||||
if len(inventoryList) == 0 && req.InventoryTimeStart != "" {
|
||||
return nil, 0, 0, nil
|
||||
}
|
||||
|
||||
// 使用 map 来组合相同 ErpCommodityId 的数据
|
||||
//commodityMap := make(map[uint32]ErpPurchaseCommodityData)
|
||||
commodityMap := make(map[uint32]map[time.Time]ErpPurchaseCommodityData)
|
||||
|
|
|
@ -9,14 +9,15 @@ import (
|
|||
|
||||
func registerInventoryManageRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
r := v1.Group("/inventory").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
r.POST("list", inventorymanage.GetInventoryList) // 库存列表
|
||||
r.POST("detail", inventorymanage.GetInventoryDetail) // 库存详情
|
||||
r.POST("delivery", inventorymanage.DeliveryCargo) // 出库
|
||||
r.POST("print", inventorymanage.BatchPrint) // 批量打印
|
||||
r.POST("import", inventorymanage.BatchImport) // 库存导入
|
||||
r.POST("add_remark", inventorymanage.AddRemark) // 添加备注
|
||||
r.POST("query_code", inventorymanage.QueryCode) // 查询商品串码或者条码
|
||||
r.POST("query_name", inventorymanage.QueryName) // 通过名称模糊查询商品库存详情
|
||||
r.POST("list", inventorymanage.GetInventoryList) // 库存列表
|
||||
r.POST("detail", inventorymanage.GetInventoryDetail) // 库存详情
|
||||
r.POST("detail_new", inventorymanage.GetInventoryDetailNew) // 库存详情页专用接口,门店复选
|
||||
r.POST("delivery", inventorymanage.DeliveryCargo) // 出库
|
||||
r.POST("print", inventorymanage.BatchPrint) // 批量打印
|
||||
r.POST("import", inventorymanage.BatchImport) // 库存导入
|
||||
r.POST("add_remark", inventorymanage.AddRemark) // 添加备注
|
||||
r.POST("query_code", inventorymanage.QueryCode) // 查询商品串码或者条码
|
||||
r.POST("query_name", inventorymanage.QueryName) // 通过名称模糊查询商品库存详情
|
||||
|
||||
// 产品入库
|
||||
r1 := v1.Group("/inventory/product").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
|
|
170
docs/docs.go
170
docs/docs.go
|
@ -3420,7 +3420,7 @@ const docTemplate = `{
|
|||
"tags": [
|
||||
"库存管理"
|
||||
],
|
||||
"summary": "查询库存详情",
|
||||
"summary": "查询库存详情(详情页专用,门店复选)",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "查询库存详情模型",
|
||||
|
@ -3428,7 +3428,7 @@ const docTemplate = `{
|
|||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpStockCommodityListReq"
|
||||
"$ref": "#/definitions/models.NewErpStockCommodityListReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -8604,6 +8604,10 @@ const docTemplate = `{
|
|||
"description": "每页展示数据条数",
|
||||
"type": "integer"
|
||||
},
|
||||
"purchase_type": {
|
||||
"description": "0-全部,1-正常采购,2-停止采购",
|
||||
"type": "integer"
|
||||
},
|
||||
"serial_number": {
|
||||
"description": "商品编号",
|
||||
"type": "string"
|
||||
|
@ -10101,7 +10105,10 @@ const docTemplate = `{
|
|||
},
|
||||
"store_id": {
|
||||
"description": "门店ID",
|
||||
"type": "integer"
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"tel": {
|
||||
"description": "客户手机号",
|
||||
|
@ -10316,7 +10323,10 @@ const docTemplate = `{
|
|||
},
|
||||
"store_id": {
|
||||
"description": "门店ID",
|
||||
"type": "integer"
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"tel": {
|
||||
"description": "客户手机号",
|
||||
|
@ -10979,6 +10989,10 @@ const docTemplate = `{
|
|||
"description": "收款人",
|
||||
"type": "string"
|
||||
},
|
||||
"amount": {
|
||||
"description": "计划采购金额",
|
||||
"type": "number"
|
||||
},
|
||||
"audit_time": {
|
||||
"description": "审核时间",
|
||||
"type": "string"
|
||||
|
@ -11331,6 +11345,14 @@ const docTemplate = `{
|
|||
"description": "经手人id",
|
||||
"type": "integer"
|
||||
},
|
||||
"inventory_time_end": {
|
||||
"description": "入库结束时间",
|
||||
"type": "string"
|
||||
},
|
||||
"inventory_time_start": {
|
||||
"description": "入库开始时间",
|
||||
"type": "string"
|
||||
},
|
||||
"is_export": {
|
||||
"description": "1-导出",
|
||||
"type": "integer"
|
||||
|
@ -11977,6 +11999,10 @@ const docTemplate = `{
|
|||
"description": "商品分类",
|
||||
"type": "integer"
|
||||
},
|
||||
"is_export": {
|
||||
"description": "1-导出",
|
||||
"type": "integer"
|
||||
},
|
||||
"is_imei": {
|
||||
"description": "是否串码:0-查全部 1-查串码类 2-查非串码",
|
||||
"type": "integer"
|
||||
|
@ -12543,6 +12569,13 @@ const docTemplate = `{
|
|||
"sort_type": {
|
||||
"description": "排序类型:desc 降序、asc 升序",
|
||||
"type": "string"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -14229,6 +14262,104 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"models.NewErpStockCommodityListReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"age": {
|
||||
"description": "最近库龄",
|
||||
"type": "integer"
|
||||
},
|
||||
"all_age": {
|
||||
"description": "总库龄",
|
||||
"type": "integer"
|
||||
},
|
||||
"commodity_name": {
|
||||
"description": "商品名称",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"erp_category_id": {
|
||||
"description": "商品分类Id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_commodity_id": {
|
||||
"description": "商品id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_stock_id": {
|
||||
"description": "库存id",
|
||||
"type": "integer"
|
||||
},
|
||||
"imei": {
|
||||
"description": "串码",
|
||||
"type": "string"
|
||||
},
|
||||
"is_export": {
|
||||
"description": "是否导出excel:1-导出",
|
||||
"type": "integer"
|
||||
},
|
||||
"is_imei": {
|
||||
"description": "是否串码:0-查全部 1-查串码类 2-查非串码",
|
||||
"type": "integer"
|
||||
},
|
||||
"original_sn": {
|
||||
"description": "首次入库订单编号",
|
||||
"type": "string"
|
||||
},
|
||||
"pageIndex": {
|
||||
"description": "页码",
|
||||
"type": "integer"
|
||||
},
|
||||
"pageSize": {
|
||||
"description": "每页展示数据条数",
|
||||
"type": "integer"
|
||||
},
|
||||
"scan_code": {
|
||||
"description": "扫码枪扫码数据:串码/条码",
|
||||
"type": "string"
|
||||
},
|
||||
"serial_number": {
|
||||
"description": "商品编号",
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"description": "库存状态:1-在库 2-已售 3-采购退货 4-调拨中 5-出库(前端只看1,4)",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"stock_sort_flag": {
|
||||
"description": "排序方式:0-按入库时间降序排列(默认),1-按入库时间升序排列",
|
||||
"type": "integer"
|
||||
},
|
||||
"stock_time_end": {
|
||||
"description": "最近入库结束时间",
|
||||
"type": "string"
|
||||
},
|
||||
"stock_time_start": {
|
||||
"description": "最近入库开始时间",
|
||||
"type": "string"
|
||||
},
|
||||
"storage_type": {
|
||||
"description": "首次入库方式:1-系统入库 2-采购入库",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店编号",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"supplier_id": {
|
||||
"description": "供应商id",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.NewUserInviteRecordReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -15536,6 +15667,10 @@ const docTemplate = `{
|
|||
"models.ReportAllotDetailData": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"allot_amount": {
|
||||
"description": "调拨金额",
|
||||
"type": "number"
|
||||
},
|
||||
"audit_time": {
|
||||
"description": "审核时间",
|
||||
"type": "string"
|
||||
|
@ -16078,10 +16213,6 @@ const docTemplate = `{
|
|||
"description": "实际零售价",
|
||||
"type": "number"
|
||||
},
|
||||
"cash_amount": {
|
||||
"description": "现金收款",
|
||||
"type": "number"
|
||||
},
|
||||
"count": {
|
||||
"description": "销售数量",
|
||||
"type": "integer"
|
||||
|
@ -16094,14 +16225,6 @@ const docTemplate = `{
|
|||
"description": "会员优惠",
|
||||
"type": "number"
|
||||
},
|
||||
"other_amount": {
|
||||
"description": "其他付款方式",
|
||||
"type": "number"
|
||||
},
|
||||
"pos_amount": {
|
||||
"description": "pos机收款",
|
||||
"type": "number"
|
||||
},
|
||||
"retail_price": {
|
||||
"description": "指导零售价",
|
||||
"type": "number"
|
||||
|
@ -16122,10 +16245,6 @@ const docTemplate = `{
|
|||
"description": "销售员提成",
|
||||
"type": "number"
|
||||
},
|
||||
"scan_amount": {
|
||||
"description": "扫码付",
|
||||
"type": "number"
|
||||
},
|
||||
"staff_price": {
|
||||
"description": "员工成本价",
|
||||
"type": "number"
|
||||
|
@ -16138,14 +16257,17 @@ const docTemplate = `{
|
|||
"description": "门店提成",
|
||||
"type": "number"
|
||||
},
|
||||
"store_vm_amount": {
|
||||
"description": "商场积分抵扣",
|
||||
"type": "number"
|
||||
},
|
||||
"total_amount": {
|
||||
"description": "订单实收金额",
|
||||
"type": "number"
|
||||
},
|
||||
"total_cashier_data": {
|
||||
"description": "TotalCashierData",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.ErpOrderCashier"
|
||||
}
|
||||
},
|
||||
"total_discount": {
|
||||
"description": "订单总优惠:订单所有商品零售优惠+会员优惠+会员积分抵扣之和",
|
||||
"type": "number"
|
||||
|
|
|
@ -3409,7 +3409,7 @@
|
|||
"tags": [
|
||||
"库存管理"
|
||||
],
|
||||
"summary": "查询库存详情",
|
||||
"summary": "查询库存详情(详情页专用,门店复选)",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "查询库存详情模型",
|
||||
|
@ -3417,7 +3417,7 @@
|
|||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.ErpStockCommodityListReq"
|
||||
"$ref": "#/definitions/models.NewErpStockCommodityListReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -8593,6 +8593,10 @@
|
|||
"description": "每页展示数据条数",
|
||||
"type": "integer"
|
||||
},
|
||||
"purchase_type": {
|
||||
"description": "0-全部,1-正常采购,2-停止采购",
|
||||
"type": "integer"
|
||||
},
|
||||
"serial_number": {
|
||||
"description": "商品编号",
|
||||
"type": "string"
|
||||
|
@ -10090,7 +10094,10 @@
|
|||
},
|
||||
"store_id": {
|
||||
"description": "门店ID",
|
||||
"type": "integer"
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"tel": {
|
||||
"description": "客户手机号",
|
||||
|
@ -10305,7 +10312,10 @@
|
|||
},
|
||||
"store_id": {
|
||||
"description": "门店ID",
|
||||
"type": "integer"
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"tel": {
|
||||
"description": "客户手机号",
|
||||
|
@ -10968,6 +10978,10 @@
|
|||
"description": "收款人",
|
||||
"type": "string"
|
||||
},
|
||||
"amount": {
|
||||
"description": "计划采购金额",
|
||||
"type": "number"
|
||||
},
|
||||
"audit_time": {
|
||||
"description": "审核时间",
|
||||
"type": "string"
|
||||
|
@ -11320,6 +11334,14 @@
|
|||
"description": "经手人id",
|
||||
"type": "integer"
|
||||
},
|
||||
"inventory_time_end": {
|
||||
"description": "入库结束时间",
|
||||
"type": "string"
|
||||
},
|
||||
"inventory_time_start": {
|
||||
"description": "入库开始时间",
|
||||
"type": "string"
|
||||
},
|
||||
"is_export": {
|
||||
"description": "1-导出",
|
||||
"type": "integer"
|
||||
|
@ -11966,6 +11988,10 @@
|
|||
"description": "商品分类",
|
||||
"type": "integer"
|
||||
},
|
||||
"is_export": {
|
||||
"description": "1-导出",
|
||||
"type": "integer"
|
||||
},
|
||||
"is_imei": {
|
||||
"description": "是否串码:0-查全部 1-查串码类 2-查非串码",
|
||||
"type": "integer"
|
||||
|
@ -12532,6 +12558,13 @@
|
|||
"sort_type": {
|
||||
"description": "排序类型:desc 降序、asc 升序",
|
||||
"type": "string"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -14218,6 +14251,104 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"models.NewErpStockCommodityListReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"age": {
|
||||
"description": "最近库龄",
|
||||
"type": "integer"
|
||||
},
|
||||
"all_age": {
|
||||
"description": "总库龄",
|
||||
"type": "integer"
|
||||
},
|
||||
"commodity_name": {
|
||||
"description": "商品名称",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"erp_category_id": {
|
||||
"description": "商品分类Id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_commodity_id": {
|
||||
"description": "商品id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_stock_id": {
|
||||
"description": "库存id",
|
||||
"type": "integer"
|
||||
},
|
||||
"imei": {
|
||||
"description": "串码",
|
||||
"type": "string"
|
||||
},
|
||||
"is_export": {
|
||||
"description": "是否导出excel:1-导出",
|
||||
"type": "integer"
|
||||
},
|
||||
"is_imei": {
|
||||
"description": "是否串码:0-查全部 1-查串码类 2-查非串码",
|
||||
"type": "integer"
|
||||
},
|
||||
"original_sn": {
|
||||
"description": "首次入库订单编号",
|
||||
"type": "string"
|
||||
},
|
||||
"pageIndex": {
|
||||
"description": "页码",
|
||||
"type": "integer"
|
||||
},
|
||||
"pageSize": {
|
||||
"description": "每页展示数据条数",
|
||||
"type": "integer"
|
||||
},
|
||||
"scan_code": {
|
||||
"description": "扫码枪扫码数据:串码/条码",
|
||||
"type": "string"
|
||||
},
|
||||
"serial_number": {
|
||||
"description": "商品编号",
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"description": "库存状态:1-在库 2-已售 3-采购退货 4-调拨中 5-出库(前端只看1,4)",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"stock_sort_flag": {
|
||||
"description": "排序方式:0-按入库时间降序排列(默认),1-按入库时间升序排列",
|
||||
"type": "integer"
|
||||
},
|
||||
"stock_time_end": {
|
||||
"description": "最近入库结束时间",
|
||||
"type": "string"
|
||||
},
|
||||
"stock_time_start": {
|
||||
"description": "最近入库开始时间",
|
||||
"type": "string"
|
||||
},
|
||||
"storage_type": {
|
||||
"description": "首次入库方式:1-系统入库 2-采购入库",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店编号",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"supplier_id": {
|
||||
"description": "供应商id",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.NewUserInviteRecordReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -15525,6 +15656,10 @@
|
|||
"models.ReportAllotDetailData": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"allot_amount": {
|
||||
"description": "调拨金额",
|
||||
"type": "number"
|
||||
},
|
||||
"audit_time": {
|
||||
"description": "审核时间",
|
||||
"type": "string"
|
||||
|
@ -16067,10 +16202,6 @@
|
|||
"description": "实际零售价",
|
||||
"type": "number"
|
||||
},
|
||||
"cash_amount": {
|
||||
"description": "现金收款",
|
||||
"type": "number"
|
||||
},
|
||||
"count": {
|
||||
"description": "销售数量",
|
||||
"type": "integer"
|
||||
|
@ -16083,14 +16214,6 @@
|
|||
"description": "会员优惠",
|
||||
"type": "number"
|
||||
},
|
||||
"other_amount": {
|
||||
"description": "其他付款方式",
|
||||
"type": "number"
|
||||
},
|
||||
"pos_amount": {
|
||||
"description": "pos机收款",
|
||||
"type": "number"
|
||||
},
|
||||
"retail_price": {
|
||||
"description": "指导零售价",
|
||||
"type": "number"
|
||||
|
@ -16111,10 +16234,6 @@
|
|||
"description": "销售员提成",
|
||||
"type": "number"
|
||||
},
|
||||
"scan_amount": {
|
||||
"description": "扫码付",
|
||||
"type": "number"
|
||||
},
|
||||
"staff_price": {
|
||||
"description": "员工成本价",
|
||||
"type": "number"
|
||||
|
@ -16127,14 +16246,17 @@
|
|||
"description": "门店提成",
|
||||
"type": "number"
|
||||
},
|
||||
"store_vm_amount": {
|
||||
"description": "商场积分抵扣",
|
||||
"type": "number"
|
||||
},
|
||||
"total_amount": {
|
||||
"description": "订单实收金额",
|
||||
"type": "number"
|
||||
},
|
||||
"total_cashier_data": {
|
||||
"description": "TotalCashierData",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.ErpOrderCashier"
|
||||
}
|
||||
},
|
||||
"total_discount": {
|
||||
"description": "订单总优惠:订单所有商品零售优惠+会员优惠+会员积分抵扣之和",
|
||||
"type": "number"
|
||||
|
|
|
@ -1620,6 +1620,9 @@ definitions:
|
|||
pageSize:
|
||||
description: 每页展示数据条数
|
||||
type: integer
|
||||
purchase_type:
|
||||
description: 0-全部,1-正常采购,2-停止采购
|
||||
type: integer
|
||||
serial_number:
|
||||
description: 商品编号
|
||||
type: string
|
||||
|
@ -2717,7 +2720,9 @@ definitions:
|
|||
type: string
|
||||
store_id:
|
||||
description: 门店ID
|
||||
type: integer
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
tel:
|
||||
description: 客户手机号
|
||||
type: string
|
||||
|
@ -2871,7 +2876,9 @@ definitions:
|
|||
type: string
|
||||
store_id:
|
||||
description: 门店ID
|
||||
type: integer
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
tel:
|
||||
description: 客户手机号
|
||||
type: string
|
||||
|
@ -3354,6 +3361,9 @@ definitions:
|
|||
account_holder:
|
||||
description: 收款人
|
||||
type: string
|
||||
amount:
|
||||
description: 计划采购金额
|
||||
type: number
|
||||
audit_time:
|
||||
description: 审核时间
|
||||
type: string
|
||||
|
@ -3612,6 +3622,12 @@ definitions:
|
|||
handler_id:
|
||||
description: 经手人id
|
||||
type: integer
|
||||
inventory_time_end:
|
||||
description: 入库结束时间
|
||||
type: string
|
||||
inventory_time_start:
|
||||
description: 入库开始时间
|
||||
type: string
|
||||
is_export:
|
||||
description: 1-导出
|
||||
type: integer
|
||||
|
@ -4084,6 +4100,9 @@ definitions:
|
|||
erp_category_id:
|
||||
description: 商品分类
|
||||
type: integer
|
||||
is_export:
|
||||
description: 1-导出
|
||||
type: integer
|
||||
is_imei:
|
||||
description: 是否串码:0-查全部 1-查串码类 2-查非串码
|
||||
type: integer
|
||||
|
@ -4488,6 +4507,11 @@ definitions:
|
|||
sort_type:
|
||||
description: 排序类型:desc 降序、asc 升序
|
||||
type: string
|
||||
store_id:
|
||||
description: 门店id
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
type: object
|
||||
models.GetErpPurchaseDemandResp:
|
||||
properties:
|
||||
|
@ -5694,6 +5718,78 @@ definitions:
|
|||
visible:
|
||||
type: string
|
||||
type: object
|
||||
models.NewErpStockCommodityListReq:
|
||||
properties:
|
||||
age:
|
||||
description: 最近库龄
|
||||
type: integer
|
||||
all_age:
|
||||
description: 总库龄
|
||||
type: integer
|
||||
commodity_name:
|
||||
description: 商品名称
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
erp_category_id:
|
||||
description: 商品分类Id
|
||||
type: integer
|
||||
erp_commodity_id:
|
||||
description: 商品id
|
||||
type: integer
|
||||
erp_stock_id:
|
||||
description: 库存id
|
||||
type: integer
|
||||
imei:
|
||||
description: 串码
|
||||
type: string
|
||||
is_export:
|
||||
description: 是否导出excel:1-导出
|
||||
type: integer
|
||||
is_imei:
|
||||
description: 是否串码:0-查全部 1-查串码类 2-查非串码
|
||||
type: integer
|
||||
original_sn:
|
||||
description: 首次入库订单编号
|
||||
type: string
|
||||
pageIndex:
|
||||
description: 页码
|
||||
type: integer
|
||||
pageSize:
|
||||
description: 每页展示数据条数
|
||||
type: integer
|
||||
scan_code:
|
||||
description: 扫码枪扫码数据:串码/条码
|
||||
type: string
|
||||
serial_number:
|
||||
description: 商品编号
|
||||
type: string
|
||||
state:
|
||||
description: 库存状态:1-在库 2-已售 3-采购退货 4-调拨中 5-出库(前端只看1,4)
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
stock_sort_flag:
|
||||
description: 排序方式:0-按入库时间降序排列(默认),1-按入库时间升序排列
|
||||
type: integer
|
||||
stock_time_end:
|
||||
description: 最近入库结束时间
|
||||
type: string
|
||||
stock_time_start:
|
||||
description: 最近入库开始时间
|
||||
type: string
|
||||
storage_type:
|
||||
description: 首次入库方式:1-系统入库 2-采购入库
|
||||
type: integer
|
||||
store_id:
|
||||
description: 门店编号
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
supplier_id:
|
||||
description: 供应商id
|
||||
type: integer
|
||||
type: object
|
||||
models.NewUserInviteRecordReq:
|
||||
properties:
|
||||
create_end_time:
|
||||
|
@ -6629,6 +6725,9 @@ definitions:
|
|||
type: object
|
||||
models.ReportAllotDetailData:
|
||||
properties:
|
||||
allot_amount:
|
||||
description: 调拨金额
|
||||
type: number
|
||||
audit_time:
|
||||
description: 审核时间
|
||||
type: string
|
||||
|
@ -7029,9 +7128,6 @@ definitions:
|
|||
amount:
|
||||
description: 实际零售价
|
||||
type: number
|
||||
cash_amount:
|
||||
description: 现金收款
|
||||
type: number
|
||||
count:
|
||||
description: 销售数量
|
||||
type: integer
|
||||
|
@ -7041,12 +7137,6 @@ definitions:
|
|||
member_discount:
|
||||
description: 会员优惠
|
||||
type: number
|
||||
other_amount:
|
||||
description: 其他付款方式
|
||||
type: number
|
||||
pos_amount:
|
||||
description: pos机收款
|
||||
type: number
|
||||
retail_price:
|
||||
description: 指导零售价
|
||||
type: number
|
||||
|
@ -7062,9 +7152,6 @@ definitions:
|
|||
salesman_per:
|
||||
description: 销售员提成
|
||||
type: number
|
||||
scan_amount:
|
||||
description: 扫码付
|
||||
type: number
|
||||
staff_price:
|
||||
description: 员工成本价
|
||||
type: number
|
||||
|
@ -7074,12 +7161,14 @@ definitions:
|
|||
store_per:
|
||||
description: 门店提成
|
||||
type: number
|
||||
store_vm_amount:
|
||||
description: 商场积分抵扣
|
||||
type: number
|
||||
total_amount:
|
||||
description: 订单实收金额
|
||||
type: number
|
||||
total_cashier_data:
|
||||
description: TotalCashierData
|
||||
items:
|
||||
$ref: '#/definitions/models.ErpOrderCashier'
|
||||
type: array
|
||||
total_discount:
|
||||
description: 订单总优惠:订单所有商品零售优惠+会员优惠+会员积分抵扣之和
|
||||
type: number
|
||||
|
@ -10735,7 +10824,7 @@ paths:
|
|||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErpStockCommodityListReq'
|
||||
$ref: '#/definitions/models.NewErpStockCommodityListReq'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
@ -10743,7 +10832,7 @@ paths:
|
|||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErpStockCommodityListResp'
|
||||
summary: 查询库存详情
|
||||
summary: 查询库存详情(详情页专用,门店复选)
|
||||
tags:
|
||||
- 库存管理
|
||||
/api/v1/inventory/import:
|
||||
|
|
Loading…
Reference in New Issue
Block a user