liujiandao
2023-12-21 254b140b88bc4bd545292aec4499107db0912be0
controllers/operation.go
@@ -77,8 +77,19 @@
   }
   params.Status = constvar.OperationStatus_Ready
   params.Number = strconv.FormatInt(time.Now().Unix(), 10)
   //params.Number = strconv.FormatInt(time.Now().Unix(), 10)
   params.BaseOperationType = operationType.BaseOperationType
   var numberNum int64
   if err := mysqlx.GetDB().Model(&models.Operation{}).Where("number=?", params.Number).Count(&numberNum).Error; err != nil {
      util.ResponseFormat(c, code.RequestParamError, err.Error())
      return
   }
   if numberNum > 0 {
      util.ResponseFormat(c, code.RequestParamError, "单号已存在")
      return
   }
   if err := models.NewOperationSearch().Create(&params); err != nil {
      logx.Errorf("Operation create err: %v", err)
      util.ResponseFormat(c, code.SaveFail, "添加失败:"+err.Error())
@@ -143,6 +154,10 @@
func (slf OperationController) CheckParams(params models.Operation) error {
   if params.SourceNumber == "" {
      return errors.New("请填入源单号")
   }
   if params.Number == "" {
      return errors.New("请填入单号")
   }
   if params.OperationTypeId == 0 && int(params.BaseOperationType) == 0 {
@@ -574,7 +589,7 @@
            }
         }
         if operation.Source != "" {
            go UpdateOutStatus(operation.Source, operation.Number, 4)
            go UpdateOutStatus(operation.Source, operation.SourceNumber, 4)
         }
      }
@@ -912,7 +927,7 @@
   }
   //更新aps物料申请状态
   if operation.Source == "APS_APPLY_MATERIAL" {
      go UpdateOutStatus(operation.Source, operation.Number, 3)
      go UpdateOutStatus(operation.Source, operation.SourceNumber, 3)
   }
   util.ResponseFormat(c, code.Success, "操作成功")
}