| | |
| | | OperationStatus_Waiting //正在等待 |
| | | OperationStatus_Ready //就绪 |
| | | OperationStatus_Finish //完成 |
| | | OperationStatus_Cancel //完成 |
| | | ) |
| | | |
| | | type PostType int |
| | |
| | | } |
| | | util.ResponseFormat(c, code.Success, companies) |
| | | } |
| | | |
| | | // Cancel |
| | | // |
| | | // @Tags 入库/出库 |
| | | // @Summary 取消 |
| | | // @Produce application/json |
| | | // @Param id path int true "id" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/operation/cancel/{id} [put] |
| | | func (slf OperationController) Cancel(c *gin.Context) { |
| | | id, err := strconv.Atoi(c.Param("id")) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "错误的id值") |
| | | return |
| | | } |
| | | if id == 0 { |
| | | util.ResponseFormat(c, code.RequestParamError, "id为0") |
| | | return |
| | | } |
| | | operation, err := models.NewOperationSearch().SetPreload(true).SetID(id).First() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "未找到相关出入库信息:"+err.Error()) |
| | | return |
| | | } |
| | | if operation.Status != constvar.OperationStatus_Ready { |
| | | util.ResponseFormat(c, code.RequestError, "该出入库信息无法取消") |
| | | return |
| | | } |
| | | operation.Status = constvar.OperationStatus_Cancel |
| | | if err := models.NewOperationSearch().Save(operation); err != nil { |
| | | util.ResponseFormat(c, code.SaveFail, err.Error()) |
| | | return |
| | | } |
| | | util.ResponseFormat(c, code.Success, "操作成功") |
| | | } |
| | |
| | | if value, ok := mapStatistics[strconv.Itoa(v.Id)+string(constvar.OperationStatus_Finish)]; ok { |
| | | list[k].FinishCount = value.Count |
| | | } |
| | | if value, ok := mapStatistics[strconv.Itoa(v.Id)+string(constvar.OperationStatus_Cancel)]; ok { |
| | | list[k].FinishCount = value.Count |
| | | } |
| | | } |
| | | util.ResponseFormatListWithPage(c, code.Success, list, cast.ToInt(total), params.Page, params.PageSize) |
| | | } |
| | |
| | | if value, ok := mapStatistics[strconv.Itoa(v.Id)+string(constvar.OperationStatus_Finish)]; ok { |
| | | list[k].FinishCount = value.Count |
| | | } |
| | | if value, ok := mapStatistics[strconv.Itoa(v.Id)+string(constvar.OperationStatus_Cancel)]; ok { |
| | | list[k].FinishCount = value.Count |
| | | } |
| | | } |
| | | util.ResponseFormatListWithPage(c, code.Success, list, cast.ToInt(total), params.Page, params.PageSize) |
| | | } |
| | |
| | | |
| | | util.ResponseFormatListWithPage(c, code.Success, list, int(total), params.Page, params.PageSize) |
| | | } |
| | | |
| | | // CancelDisuse |
| | | // |
| | | // @Tags 产品 |
| | | // @Summary 取消报废 |
| | | // @Produce application/json |
| | | // @Param id path int true "id" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/product/cancelDisuse/{id} [put] |
| | | func (slf ProductController) CancelDisuse(c *gin.Context) { |
| | | id, err := strconv.Atoi(c.Param("id")) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "错误的id值") |
| | | return |
| | | } |
| | | if id == 0 { |
| | | util.ResponseFormat(c, code.RequestParamError, "id为0") |
| | | return |
| | | } |
| | | operation, err := models.NewOperationSearch().SetID(id).First() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "未找到相关信息:"+err.Error()) |
| | | return |
| | | } |
| | | if operation.Status != constvar.OperationStatus_Ready { |
| | | util.ResponseFormat(c, code.RequestError, "该信息无法取消") |
| | | return |
| | | } |
| | | operation.Status = constvar.OperationStatus_Cancel |
| | | if err := models.NewOperationSearch().Save(operation); err != nil { |
| | | util.ResponseFormat(c, code.SaveFail, err.Error()) |
| | | return |
| | | } |
| | | util.ResponseFormat(c, code.Success, "操作成功") |
| | | } |
| | |
| | | operationAPI.PUT("finish/:id", operationController.Finish) |
| | | operationAPI.POST("listTransfer", operationController.ListTransfer) |
| | | operationAPI.GET("getLogisticCompanyList", operationController.GetLogisticCompanyList) |
| | | |
| | | operationAPI.PUT("cancel/:id", operationController.Cancel) |
| | | } |
| | | |
| | | //产品 |
| | |
| | | productAPI.PUT("finishDisuse/:id", productController.FinishDisuse) //报废验证 |
| | | productAPI.POST("updateDisuse", productController.UpdateDisuse) //修改报废信息 |
| | | productAPI.POST("listHistory", productController.ListHistory) //产品位置历史记录 |
| | | productAPI.PUT("cancelDisuse/:id", productController.CancelDisuse) //取消报废 |
| | | |
| | | } |
| | | |