| | |
| | | params.WarehouseId = operationType.WarehouseId |
| | | } |
| | | |
| | | if params.InventoryDealerType == 0 { |
| | | if params.DealerType == "" { |
| | | CheckInventoryDealerType(¶ms) |
| | | } |
| | | |
| | |
| | | default: |
| | | return |
| | | } |
| | | miniDict, _ := models.NewMiniDictSearch().SetType(dictType).SetName(dictName).First() |
| | | if miniDict != nil { |
| | | params.InventoryDealerType = int(miniDict.ID) |
| | | } else { |
| | | dict := &models.MiniDict{ |
| | | miniDict, err := models.NewMiniDictSearch().SetType(dictType).SetName(dictName).First() |
| | | if err == gorm.ErrRecordNotFound { |
| | | miniDict = &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) |
| | | models.NewMiniDictSearch().Create(miniDict) |
| | | } |
| | | params.DealerType = miniDict.Name |
| | | } |
| | | |
| | | func CheckDetailsRepeat(details []*models.OperationDetails) bool { |
| | |
| | | |
| | | if params.OperationTypeId == 0 && int(params.BaseOperationType) == 0 { |
| | | return errors.New("未识别该记录类型1") |
| | | } |
| | | |
| | | if params.BaseOperationType != 0 { |
| | | if params.WarehouseId == 0 { |
| | | return errors.New("未识别该记录类型2") |
| | | } |
| | | } else if params.OperationTypeId == 0 && params.BaseOperationType != 0 && params.WarehouseId == 0 { |
| | | return errors.New("未识别该记录类型2") |
| | | } |
| | | |
| | | if params.OperationDate == "" { |
| | |
| | | return |
| | | } |
| | | } else { |
| | | fileUrl, err = JialianOperation2(warehouse.FileTemplateCategoryIn, operation) |
| | | fileUrl, err = JialianOperation2(constvar.FileTemplateCategory_JialianInput1, operation) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | |
| | | } |
| | | |
| | | } else { |
| | | fileUrl, err = JialianOperation2(warehouse.FileTemplateCategoryOut, operation) |
| | | fileUrl, err = JialianOperation2(constvar.FileTemplateCategory_JialianOutput1, operation) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |