| | |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | operationType, err := models.NewOperationTypeSearch().SetID(uint(params.OperationTypeId)).First() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | |
| | | params.Status = constvar.OperationStatus_Ready |
| | | params.Number = strconv.FormatInt(time.Now().Unix(), 10) |
| | | params.BaseOperationType = operationType.BaseOperationType |
| | | if err := models.NewOperationSearch().Create(¶ms); err != nil { |
| | | logx.Errorf("Operation create err: %v", err) |
| | | util.ResponseFormat(c, code.SaveFail, "添加失败:"+err.Error()) |
| | |
| | | if err := tx.Save(listProdt[k]).Error; err != nil { |
| | | return err |
| | | } |
| | | //TODO:出入库的finish和报废的finish都要增加对location_product_amount表数量的更新,因为此表有ProductCategory字段,所以operation_details表中要增加ProductCategoryId字段 |
| | | //var locAmount models.LocationProductAmount |
| | | //if err := models.NewLocationProductAmountSearch().Orm.Table("wms_location_produt_amount").Joins("inner join wms_location_product on wms_location_produt.id=wms_location_produt_amount.location_product_id").Where("wms_location_produt.product_id=? and wms_location_produt.location_id=?",operation.ToLocationID,v.ID).First(&locAmount).Error;err!=nil { |
| | | // return err |
| | | //} |
| | | } |
| | | } |
| | | |
| | | } |
| | | if operationType.BaseOperationType == constvar.BaseOperationTypeOutgoing { |
| | | for k, v := range listProdt { |