|
|
@@ -0,0 +1,217 @@
|
|
|
+package oilsupplier
|
|
|
+
|
|
|
+import (
|
|
|
+ "dashoo.cn/backend/api/business/oilsupplier/supplierdataentry"
|
|
|
+ "dashoo.cn/backend/api/business/workflow"
|
|
|
+ . "dashoo.cn/backend/api/controllers"
|
|
|
+ "dashoo.cn/utils"
|
|
|
+ "reflect"
|
|
|
+ "strconv"
|
|
|
+)
|
|
|
+
|
|
|
+type SupplierDataEntryController struct {
|
|
|
+ BaseController
|
|
|
+}
|
|
|
+
|
|
|
+type RequestList struct {
|
|
|
+ DocKey string
|
|
|
+ DocAddress string
|
|
|
+ DocName string
|
|
|
+ DataEntryId int
|
|
|
+ DocUrl string
|
|
|
+}
|
|
|
+type AddEntry struct {
|
|
|
+ EntrustNo string
|
|
|
+ ConUserId int
|
|
|
+ Remark string
|
|
|
+ ConUserBy string
|
|
|
+}
|
|
|
+type CopySheet struct {
|
|
|
+ SheetNum int
|
|
|
+}
|
|
|
+
|
|
|
+type DataEntryCallback struct {
|
|
|
+ Id string `json:"Id"`
|
|
|
+ DocUrl string `json:"DocUrl"`
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 从数据录入数据导出到word文档
|
|
|
+// @Description 数据存入word
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /exportword/:tbid [post]
|
|
|
+func (this *SupplierDataEntryController) DocExport() {
|
|
|
+ // 填物资类信息表首页信息
|
|
|
+ Id := this.Ctx.Input.Param(":tbid")
|
|
|
+ var Url string
|
|
|
+ var fileName string
|
|
|
+ var model1 supplierdataentry.SupplierDataEntry
|
|
|
+ var model2 supplierdataentry.SupplierCertDataEntry
|
|
|
+
|
|
|
+ svc := supplierdataentry.GetSupplierDataEntryService(utils.DBE)
|
|
|
+ where1 := "1=1"
|
|
|
+ where1 += " AND Id = '" + Id + "'"
|
|
|
+ where2 := "SupplierId = '" + Id + "'"
|
|
|
+ svc.GetEntityByWhere(OilSupplierName, where1, &model1)
|
|
|
+ svc.GetEntityByWhere(OilSupplierCertName, where2, &model2)
|
|
|
+
|
|
|
+ var tabledata3 []supplierdataentry.SupplierMajorEquipmentDataEntry
|
|
|
+ var tabledata4 []supplierdataentry.SupplierThreeYearsDataEntryView
|
|
|
+ var tabledata5 []supplierdataentry.SupplierPatentDataEntryView
|
|
|
+ var tabledata6 []supplierdataentry.SupplierWinningDataEntryView
|
|
|
+
|
|
|
+ SupplierCertId := strconv.Itoa(model2.Id)
|
|
|
+ where3 := "SupplierCertId = '" + SupplierCertId + "'"
|
|
|
+ /*has3 :=*/ svc.GetEntitysByOrderbyWhere(OilEnterpriseMajorEquipmentName, where3, "1", &tabledata3)
|
|
|
+ /*has4 :=*/ svc.GetEntitysByOrderbyWhere(OilThreeYearsPerformanceName, where3, "1", &tabledata4)
|
|
|
+ /*has5 :=*/ svc.GetEntitysByOrderbyWhere(OilPatentStatisticalName, where3, "1", &tabledata5)
|
|
|
+ /*has6 :=*/ svc.GetEntitysByOrderbyWhere(OilWinningProjectName, where3, "1", &tabledata6)
|
|
|
+
|
|
|
+ //wheretable := "MId=" + strconv.Itoa(model.Id)
|
|
|
+ //svc.GetEntitysByWhere(this.User.AccCode+LimsHeatingFurnaceItemsName, wheretable, &tabledata)
|
|
|
+ //svc.GetEntitysByOrderbyWhere(this.User.AccCode+LimsHeatingFurnaceItemsName, wheretable, "OrderNo desc", &tabledata)
|
|
|
+
|
|
|
+ datamap := StructToMapDemo(model1)
|
|
|
+
|
|
|
+ if model2.SupplierTypeCode == "01" {
|
|
|
+ Url = "http://weed1.labsop.cn:9390/1,248318341f7c"
|
|
|
+ fileName = "物资类供方准入评审表.docx"
|
|
|
+ } else if model2.SupplierTypeCode == "02" {
|
|
|
+ Url = "http://weed1.labsop.cn:9390/5,2479ad04d28b"
|
|
|
+ fileName = "基建类供方准入评审表.docx"
|
|
|
+ datamap["TJInNotify"] = model1.TJInNotify
|
|
|
+
|
|
|
+ } else {
|
|
|
+ Url = "http://weed1.labsop.cn:9390/2,247af827d5ac"
|
|
|
+ fileName = "技术服务类供方准入评审表.docx"
|
|
|
+ }
|
|
|
+
|
|
|
+ //model1
|
|
|
+ datamap["SetupTime"] = model1.SetupTime.Format("2006年01月02日")
|
|
|
+ datamap["QualifCert"] = model1.QualifCert
|
|
|
+ datamap["QualifCertLevel"] = model1.QualifCertLevel
|
|
|
+ datamap["SpecIndustryCert"] = model1.SpecIndustryCert
|
|
|
+ datamap["MaunLicense"] = model1.MaunLicense
|
|
|
+ datamap["HseTraining"] = model1.HseTraining
|
|
|
+ datamap["Fax"] = model1.Fax
|
|
|
+ datamap["CompanyTel"] = model1.CompanyTel
|
|
|
+ datamap["SupplierName"] = model1.SupplierName
|
|
|
+ datamap["SpecTypeCode"] = model1.SpecTypeName
|
|
|
+ datamap["Country"] = model1.Country
|
|
|
+ datamap["MaunAgent"] = model1.MaunAgent
|
|
|
+ datamap["SupplierCertificate"] = model1.SupplierCertificate
|
|
|
+ datamap["MgrUnit"] = model1.MgrUnit
|
|
|
+ datamap["Grade"] = model1.Grade
|
|
|
+ datamap["CommercialNo"] = model1.CommercialNo
|
|
|
+ datamap["CountryTaxNo"] = model1.CountryTaxNo
|
|
|
+ datamap["OrganCode"] = model1.OrganCode
|
|
|
+ datamap["Address"] = model1.Address
|
|
|
+ datamap["ZipCode"] = model1.ZipCode
|
|
|
+ datamap["LinkAddress"] = model1.LinkAddress
|
|
|
+ datamap["LinkZipCode"] = model1.LinkZipCode
|
|
|
+ datamap["QualitySystemCert"] = model1.QualitySystemCert
|
|
|
+ datamap["ProductQualityCert"] = model1.ProductQualityCert
|
|
|
+ datamap["MaunLicense"] = model1.MaunLicense
|
|
|
+ datamap["LegalPerson"] = model1.LegalPerson
|
|
|
+ datamap["CompanyType"] = model1.CompanyType
|
|
|
+ datamap["ContactName"] = model1.ContactName
|
|
|
+ datamap["RegCapital"] = model1.RegCapital
|
|
|
+ datamap["DepositBank"] = model1.DepositBank
|
|
|
+ datamap["BankAccount"] = model1.BankAccount
|
|
|
+ datamap["Mobile"] = model1.Mobile
|
|
|
+ datamap["EMail"] = model1.EMail
|
|
|
+ datamap["BankCreditRating"] = model1.BankCreditRating
|
|
|
+ datamap["BusinessScope"] = model1.BusinessScope
|
|
|
+ datamap["Telphone"] = model1.Telphone
|
|
|
+
|
|
|
+ //model2
|
|
|
+ datamap["WorkerTotal"] = model2.WorkerTotal
|
|
|
+ datamap["ContractNum"] = model2.ContractNum
|
|
|
+ datamap["UniversityNum"] = model2.UniversityNum
|
|
|
+ datamap["TechnicalNum"] = model2.TechnicalNum
|
|
|
+ datamap["AboveProfNum"] = model2.AboveProfNum
|
|
|
+ datamap["MiddleProfNum"] = model2.MiddleProfNum
|
|
|
+ datamap["NationalRegNum"] = model2.NationalRegNum
|
|
|
+ datamap["NationalCertTotal"] = model2.NationalCertTotal
|
|
|
+ datamap["DesignerTotal"] = model2.DesignerTotal
|
|
|
+ datamap["SkillerTotal"] = model2.SkillerTotal
|
|
|
+
|
|
|
+ var interfaceSlice3 = make([]interface{}, len(tabledata3))
|
|
|
+ datamap["MajorEquipments"] = workflow.TableDetailData{
|
|
|
+ DataList: interfaceSlice3,
|
|
|
+ StartRow: 2,
|
|
|
+ NeedDelRow: 1,
|
|
|
+ ReverseRow: 0,
|
|
|
+ Cols: []string{"MajorEquipment", "Specifications", "Number", "Remark"},
|
|
|
+ Merge: []string{},
|
|
|
+ ColsNum: 4,
|
|
|
+ }
|
|
|
+
|
|
|
+ //起止时间如何全部显示
|
|
|
+ var interfaceSlice4 = make([]interface{}, len(tabledata4))
|
|
|
+ for i, d := range tabledata4 {
|
|
|
+ d.StartTimeStr = d.StartTime.Format("2006-01-02")
|
|
|
+ interfaceSlice4[i] = d
|
|
|
+ }
|
|
|
+ datamap["ThreeYears"] = workflow.TableDetailData{
|
|
|
+ DataList: interfaceSlice4,
|
|
|
+ StartRow: 2,
|
|
|
+ NeedDelRow: 1,
|
|
|
+ ReverseRow: 0,
|
|
|
+ Cols: []string{"ProjectName", "BearContent", "OwnerUnit", "StartTimeStr", "StartTimeStr", "Tudge"},
|
|
|
+ Merge: []string{},
|
|
|
+ ColsNum: 5,
|
|
|
+ }
|
|
|
+
|
|
|
+ var interfaceSlice5 = make([]interface{}, len(tabledata5))
|
|
|
+ for i, d := range tabledata5 {
|
|
|
+ d.ApprovalDateStr = d.ApprovalDate.Format("2006-01-02")
|
|
|
+ interfaceSlice5[i] = d
|
|
|
+ }
|
|
|
+ datamap["Patent"] = workflow.TableDetailData{
|
|
|
+ DataList: interfaceSlice5,
|
|
|
+ StartRow: 2,
|
|
|
+ NeedDelRow: 1,
|
|
|
+ ReverseRow: 0,
|
|
|
+ Cols: []string{"Name", "Content", "ApprovalAuthority", "ApprovalDateStr"},
|
|
|
+ Merge: []string{},
|
|
|
+ ColsNum: 4,
|
|
|
+ }
|
|
|
+
|
|
|
+ var interfaceSlice6 = make([]interface{}, len(tabledata6))
|
|
|
+ for i, d := range tabledata6 {
|
|
|
+ d.WinningTimeStr = d.WinningTime.Format("2006-01-02")
|
|
|
+ interfaceSlice6[i] = d
|
|
|
+ }
|
|
|
+ datamap["Winning"] = workflow.TableDetailData{
|
|
|
+ DataList: interfaceSlice6,
|
|
|
+ StartRow: 2,
|
|
|
+ NeedDelRow: 1,
|
|
|
+ ReverseRow: 0,
|
|
|
+ Cols: []string{"AwardName", "WinningTimeStr", "Authorities", "Remark"},
|
|
|
+ Merge: []string{},
|
|
|
+ ColsNum: 4,
|
|
|
+ }
|
|
|
+ datamap["TableComment"] = []string{"MajorEquipments", "ThreeYears", "Patent", "Winning"}
|
|
|
+
|
|
|
+ svcActiviti := workflow.GetActivitiService(utils.DBE)
|
|
|
+
|
|
|
+
|
|
|
+ retDocUrl := svcActiviti.FillWordTemplate(datamap, Url, fileName)
|
|
|
+ var datainfo ErrorDataInfo
|
|
|
+ datainfo.Code = 0
|
|
|
+ datainfo.Item = retDocUrl
|
|
|
+ datainfo.Message = "打印成功"
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+func StructToMapDemo(obj interface{}) map[string]interface{} {
|
|
|
+ obj1 := reflect.TypeOf(obj)
|
|
|
+ obj2 := reflect.ValueOf(obj)
|
|
|
+ var data = make(map[string]interface{})
|
|
|
+ for i := 0; i < obj1.NumField(); i++ {
|
|
|
+ data[obj1.Field(i).Name] = obj2.Field(i).Interface()
|
|
|
+ }
|
|
|
+ return data
|
|
|
+}
|