| | |
| | | // @Tags 入库/出库 |
| | | // @Summary 添加入库/出库 |
| | | // @Produce application/json |
| | | // @Param Authorization header string true "token" |
| | | // @Param object body request.AddOperation true "入库/出库信息" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/operation/operation [post] |
| | |
| | | util.ResponseFormat(c, code.Success, "添加成功") |
| | | } |
| | | |
| | | // CheckInventoryDealerType 检查基础类型,防止类型为空添加其它类型 |
| | | func CheckInventoryDealerType(params *models.Operation) { |
| | | var dictType constvar.MiniDictType |
| | | dictName := "其他" |
| | |
| | | // @Tags 入库/出库 |
| | | // @Summary 入库/出库列表 |
| | | // @Produce application/json |
| | | // @Param Authorization header string true "token" |
| | | // @Param object body request.OperationList true "查询参数" |
| | | // @Success 200 {object} util.ResponseList{data=[]models.Operation} "成功" |
| | | // @Router /api-wms/v1/operation/list [post] |
| | |
| | | // @Tags 入库/出库 |
| | | // @Summary 删除入库/出库信息 |
| | | // @Produce application/json |
| | | // @Param Authorization header string true "token" |
| | | // @Param id path int true "id" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/operation/operation/{id} [delete] |
| | |
| | | // @Tags 入库/出库 |
| | | // @Summary 更改记录状态 |
| | | // @Produce application/json |
| | | // @Param id path int true "id" |
| | | // @Param Authorization header string true "token" |
| | | // @Param id path int true "id" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/operation/finish/{id} [put] |
| | | // @Router /api-wms/v1/operation/finish/{id} [put] |
| | | func (slf OperationController) Finish(c *gin.Context) { |
| | | id, err := strconv.Atoi(c.Param("id")) |
| | | if err != nil { |
| | |
| | | return err |
| | | } |
| | | |
| | | if operation.BaseOperationType == constvar.BaseOperationTypeIncoming { |
| | | if operation.BaseOperationType == constvar.BaseOperationTypeIncoming { // 入库 |
| | | if err := service.FinishOperationInput(c, tx, operation, listDetails, mapLocAmount); err != nil { |
| | | return err |
| | | } |
| | | } |
| | | |
| | | if operation.BaseOperationType == constvar.BaseOperationTypeOutgoing || operation.BaseOperationType == constvar.BaseOperationTypeDisuse { |
| | | if operation.BaseOperationType == constvar.BaseOperationTypeOutgoing || // 出库 |
| | | operation.BaseOperationType == constvar.BaseOperationTypeDisuse { // 报废 |
| | | if err := service.FinishOperationOutput(tx, listDetails, mapLocAmount, operation); err != nil { |
| | | return err |
| | | } |
| | | } |
| | | |
| | | if operation.BaseOperationType == constvar.BaseOperationTypeInternal { |
| | | if operation.BaseOperationType == constvar.BaseOperationTypeInternal { // 内部调拨 |
| | | if err := service.FinishOperationInternal(tx, listDetails, operation); err != nil { |
| | | return err |
| | | } |
| | | } |
| | | |
| | | if operation.BaseOperationType == constvar.BaseOperationTypeAdjust { |
| | | if operation.BaseOperationType == constvar.BaseOperationTypeAdjust { // 库存盘点 |
| | | if err := service.FinishOperationAdjust(tx, listDetails, mapLocAmount, operation); err != nil { |
| | | return err |
| | | } |
| | |
| | | go UpdateOutStatus(operation.Source, operation.SourceNumber, 4) |
| | | } |
| | | } |
| | | |
| | | util.ResponseFormat(c, code.Success, "操作成功") |
| | | } |
| | | |