| | |
| | | util.ResponseFormat(c, code.Success, "操作成功") |
| | | } |
| | | |
| | | // outputOperation |
| | | // OutputOperation |
| | | // |
| | | // @Tags 入库/出库 |
| | | // @Summary 打印 |
| | |
| | | if operation.BaseOperationType == constvar.BaseOperationTypeIncoming { |
| | | if companyName == "jialian" { |
| | | // 入库 |
| | | fileUrl, err = JialianOperation(constvar.FileTemplateCategory_JialianInput, operation) |
| | | oT, err := models.NewOperationTypeSearch().SetID(uint(operation.OperationTypeId)).First() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | fileTemplateAttachments, err := models.NewFileTemplateAttachmentSearch().SetWarehouseId(oT.WarehouseId).Find() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | for _, fileTemplateAttachment := range fileTemplateAttachments { |
| | | if fileTemplateAttachment.Category == constvar.FileTemplateCategory_JialianInput1 { |
| | | //fileUrl, err = JialianOperation(constvar.FileTemplateCategory_JialianInput1, operation) |
| | | fileUrl, err = JialianOperation(fileTemplateAttachment.Category, operation) |
| | | // 出库 |
| | | //fileUrl, err = JialianOperation(constvar.FileTemplateCategory_JialianOutput1, operation) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | break |
| | | } else if fileTemplateAttachment.Category == constvar.FileWarehouseCategory_JialianInput2 { |
| | | fileUrl, err = JialianOperation(fileTemplateAttachment.Category, operation) |
| | | // 出库 |
| | | //fileUrl, err = JialianOperation(constvar.FileTemplateCategory_JialianOutput1, operation) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | break |
| | | } |
| | | } |
| | | } else if companyName == "geruimi" { |
| | | fileUrl, err = ExportInputSelfmade(constvar.FileTemplateCategory_Selfmade, operation) |
| | |
| | | } |
| | | } else if operation.BaseOperationType == constvar.BaseOperationTypeOutgoing { // 交货 |
| | | if companyName == "jialian" { |
| | | // 出库 |
| | | fileUrl, err = JialianOperation(constvar.FileTemplateCategory_JialianOutput, operation) |
| | | oT, err := models.NewOperationTypeSearch().SetID(uint(operation.OperationTypeId)).First() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | fileTemplateAttachments, err := models.NewFileTemplateAttachmentSearch().SetWarehouseId(oT.WarehouseId).Find() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | for _, fileTemplateAttachment := range fileTemplateAttachments { |
| | | if fileTemplateAttachment.Category == constvar.FileTemplateCategory_JialianOutput1 { |
| | | //fileUrl, err = JialianOperation(constvar.FileTemplateCategory_JialianInput1, operation) |
| | | fileUrl, err = JialianOperation(fileTemplateAttachment.Category, operation) |
| | | // 出库 |
| | | //fileUrl, err = JialianOperation(constvar.FileTemplateCategory_JialianOutput1, operation) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | break |
| | | } else if fileTemplateAttachment.Category == constvar.FileWarehouseCategory_JialianOutput2 { |
| | | fileUrl, err = JialianOperation(fileTemplateAttachment.Category, operation) |
| | | // 出库 |
| | | //fileUrl, err = JialianOperation(constvar.FileTemplateCategory_JialianOutput1, operation) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | break |
| | | } |
| | | } |
| | | |
| | | } else if companyName == "geruimi" { |
| | | fileUrl, err = ExportInputSelfmade(constvar.FileTemplateCategory_Output, operation) |
| | | if err != nil { |
| | |
| | | defer f.Close() |
| | | |
| | | sheet := "Sheet1" |
| | | if category == constvar.FileTemplateCategory_JialianInput { |
| | | if category == constvar.FileTemplateCategory_JialianInput1 { |
| | | sheet = "入库单" |
| | | } else if category == constvar.FileTemplateCategory_JialianOutput { |
| | | } else if category == constvar.FileTemplateCategory_JialianOutput1 { |
| | | sheet = "出库单" |
| | | } |
| | | |