| | |
| | | params.WarehouseId = operationType.WarehouseId |
| | | } |
| | | |
| | | if params.InventoryDealerType == 0 { |
| | | CheckInventoryDealerType(¶ms) |
| | | } |
| | | |
| | | userInfo := middleware.GetUserInfo(c) |
| | | if userInfo == nil { |
| | | util.ResponseFormat(c, code.SetStatusError, "登录用户信息为空,请登录后重试!") |
| | | return |
| | | } |
| | | params.CreatedBy = userInfo.Username |
| | | params.Status = constvar.OperationStatus_Ready |
| | | //params.Number = strconv.FormatInt(time.Now().Unix(), 10) |
| | |
| | | return |
| | | } |
| | | util.ResponseFormat(c, code.Success, "添加成功") |
| | | } |
| | | |
| | | func CheckInventoryDealerType(params *models.Operation) { |
| | | var dictType constvar.MiniDictType |
| | | dictName := "其它" |
| | | switch params.BaseOperationType { |
| | | case constvar.BaseOperationTypeIncoming: |
| | | dictType = constvar.StorageType |
| | | //dictName = "其它入库" |
| | | case constvar.BaseOperationTypeOutgoing: |
| | | dictType = constvar.StockoutType |
| | | //dictName = "其它出库" |
| | | case constvar.BaseOperationTypeInternal: |
| | | dictType = constvar.TransferType |
| | | //dictName = "其它调拨" |
| | | case constvar.BaseOperationTypeDisuse: |
| | | dictType = constvar.DisuseType |
| | | //dictName = "其它报废" |
| | | case constvar.BaseOperationTypeAdjust: |
| | | dictType = constvar.TakeStockType |
| | | //dictName = "其它盘点" |
| | | default: |
| | | return |
| | | } |
| | | miniDict, _ := models.NewMiniDictSearch().SetType(dictType).SetName(dictName).First() |
| | | if miniDict != nil { |
| | | params.InventoryDealerType = int(miniDict.ID) |
| | | } else { |
| | | dict := &models.MiniDict{ |
| | | Type: dictType, |
| | | Name: dictName, |
| | | } |
| | | models.NewMiniDictSearch().Create(dict) |
| | | miniDict, err := models.NewMiniDictSearch().SetType(dictType).SetName(dictName).First() |
| | | if err != nil { |
| | | return |
| | | } |
| | | params.InventoryDealerType = int(miniDict.ID) |
| | | } |
| | | } |
| | | |
| | | func CheckDetailsRepeat(details []*models.OperationDetails) bool { |
| | |
| | | util.ResponseFormat(c, code.RequestError, "查找失败:"+err.Error()) |
| | | return |
| | | } |
| | | //userList, err := service.GetUserList() |
| | | //userMap := make(map[string]string) |
| | | //if err == nil { |
| | | // for _, user := range userList { |
| | | // userMap[user.UserName] = user.NickName |
| | | // } |
| | | //} |
| | | userInfo := middleware.GetUserInfo(c) |
| | | for _, v := range list { |
| | | //if err == nil { |
| | | if userInfo != nil { |
| | | // v.CreatedBy = userMap[v.CreatedBy] |
| | | // v.CheckedBy = userMap[v.CheckedBy] |
| | | v.CreatedBy = userInfo.NickName |
| | | v.CheckedBy = userInfo.NickName |
| | | } |
| | | for _, v1 := range v.Details { |
| | | //v1.SalePrice = decimal.NewFromFloat(1.2345) |
| | | //v1.Cost = decimal.NewFromFloat(9.678) |
| | |
| | | // @Tags 入库/出库 |
| | | // @Summary 获取人员列表 |
| | | // @Produce application/json |
| | | // @Param object body request.OperationCondition true "参数" |
| | | // @Success 200 {object} util.ResponseList{data=[]inventory_order.WorkerInfo} "成功" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/operation/getPersonnelList [get] |
| | | func (slf OperationController) GetPersonnelList(c *gin.Context) { |
| | | cli := inventory_order.NewInventoryOrderServiceClient(init_client.ApsConn) |