|
|
@@ -112,6 +112,7 @@ func (this *OilContractController) GetEntityList() {
|
|
|
SubPackage := this.GetString("SubPackage")
|
|
|
ImportStatus := this.GetString("ImportStatus")
|
|
|
ContractClass := this.GetString("ContractClass")
|
|
|
+ ClassName := this.GetString("ClassName")
|
|
|
|
|
|
if Id != "" {
|
|
|
where = where + " and Id like '%" + Id + "%'"
|
|
|
@@ -121,6 +122,10 @@ func (this *OilContractController) GetEntityList() {
|
|
|
where = where + " and ContractClass='" + ContractClass + "' "
|
|
|
}
|
|
|
|
|
|
+ if ClassName != "" {
|
|
|
+ where = where + " and ClassName='" + ClassName + "' "
|
|
|
+ }
|
|
|
+
|
|
|
if SupplierId != "" {
|
|
|
where = where + " and SupplierId like '%" + SupplierId + "%'"
|
|
|
}
|
|
|
@@ -531,82 +536,95 @@ func (this *OilContractController) ImportExcel() {
|
|
|
var con1 contract.OilContract
|
|
|
lineNo := strconv.Itoa(i + 1)
|
|
|
fmt.Println(lineNo)
|
|
|
- if sheet.Rows[i].Cells[0].String() != "" {
|
|
|
- svc.GetEntityByWhere(OilContractName, "ContractNo = '"+sheet.Rows[i].Cells[0].String()+"'", &con1)
|
|
|
+ if sheet.Rows[i].Cells[2].String() != "" {
|
|
|
+ svc.GetEntityByWhere(OilContractName, "ContractNo = '"+sheet.Rows[i].Cells[2].String()+"'", &con1)
|
|
|
if con1.Id > 0 {
|
|
|
- con1.ContractName = sheet.Rows[i].Cells[1].String()
|
|
|
- con1.Amount = sheet.Rows[i].Cells[2].String()
|
|
|
+ con1.ContractName = sheet.Rows[i].Cells[3].String()
|
|
|
+ con1.Amount = sheet.Rows[i].Cells[4].String()
|
|
|
if con1.Amount == "" {
|
|
|
con1.Amount = "0"
|
|
|
}
|
|
|
- con1.ClassName = sheet.Rows[i].Cells[3].String()
|
|
|
- con1.ContractSonClass = sheet.Rows[i].Cells[4].String()
|
|
|
- con1.SmallClass = sheet.Rows[i].Cells[5].String()
|
|
|
- con1.SignedDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[6].Value), time.Local)
|
|
|
+ con1.ClassName = sheet.Rows[i].Cells[0].String()
|
|
|
+ if con1.ClassName == "买卖合同" {
|
|
|
+ con1.ContractClass = "01"
|
|
|
+ } else {
|
|
|
+ con1.ContractClass = "03"
|
|
|
+ }
|
|
|
+ //con1.ContractSonClass = sheet.Rows[i].Cells[4].String()
|
|
|
+ //con1.SmallClass = sheet.Rows[i].Cells[5].String()
|
|
|
+ con1.SignedDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[7].Value), time.Local)
|
|
|
con1.Number = sheet.Rows[i].Cells[10].String()
|
|
|
- con1.ChooseWay = sheet.Rows[i].Cells[11].String()
|
|
|
- con1.ContractMark = sheet.Rows[i].Cells[14].String()
|
|
|
- con1.Currency = sheet.Rows[i].Cells[15].String()
|
|
|
- con1.BudgetAmount = sheet.Rows[i].Cells[16].String()
|
|
|
+ //con1.ChooseWay = sheet.Rows[i].Cells[11].String()
|
|
|
+ //con1.ContractMark = sheet.Rows[i].Cells[14].String()
|
|
|
+ //con1.Currency = sheet.Rows[i].Cells[15].String()
|
|
|
+ //con1.BudgetAmount = sheet.Rows[i].Cells[16].String()
|
|
|
if con.BudgetAmount == "" {
|
|
|
con.BudgetAmount = "0"
|
|
|
}
|
|
|
- con1.PerformAmount = sheet.Rows[i].Cells[17].String()
|
|
|
+ //con1.PerformAmount = sheet.Rows[i].Cells[17].String()
|
|
|
if con1.PerformAmount == "" {
|
|
|
con1.PerformAmount = "0"
|
|
|
}
|
|
|
con1.IsYearMoney = con1.PerformAmount
|
|
|
con1.IsInternal = 0
|
|
|
- if sheet.Rows[i].Cells[18].String() == "是" {
|
|
|
- con1.IsInternal = 1
|
|
|
- }
|
|
|
+ //if sheet.Rows[i].Cells[18].String() == "是" {
|
|
|
+ // con1.IsInternal = 1
|
|
|
+ //}
|
|
|
con1.IsForeign = 0
|
|
|
- if sheet.Rows[i].Cells[19].String() == "是" {
|
|
|
- con1.IsForeign = 1
|
|
|
- }
|
|
|
+ //if sheet.Rows[i].Cells[19].String() == "是" {
|
|
|
+ // con1.IsForeign = 1
|
|
|
+ //}
|
|
|
con1.IsDeal = 0
|
|
|
- if sheet.Rows[i].Cells[20].String() == "是" {
|
|
|
- con1.IsDeal = 1
|
|
|
- }
|
|
|
- con1.MoneyFlows = sheet.Rows[i].Cells[21].String()
|
|
|
- con1.MoneyChannel = sheet.Rows[i].Cells[22].String()
|
|
|
- con1.MoneyChannelSon = sheet.Rows[i].Cells[23].String()
|
|
|
- con1.MoneyChannelSmall = sheet.Rows[i].Cells[24].String()
|
|
|
- con1.SingUnit = sheet.Rows[i].Cells[25].String()
|
|
|
- con1.Place = sheet.Rows[i].Cells[28].String()
|
|
|
-
|
|
|
- con1.StartDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[29].Value), time.Local)
|
|
|
- con1.EndDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[30].Value), time.Local)
|
|
|
- con1.YearDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[30].Value), time.Local)
|
|
|
- con1.DisputeResolution = sheet.Rows[i].Cells[31].String()
|
|
|
-
|
|
|
- con1.Remark = sheet.Rows[i].Cells[32].String()
|
|
|
- if con1.ProjectOwner != sheet.Rows[i].Cells[33].String() {
|
|
|
- con1.ProjectOwner = con1.ProjectOwner + "," + sheet.Rows[i].Cells[33].String()
|
|
|
+ //if sheet.Rows[i].Cells[20].String() == "是" {
|
|
|
+ // con1.IsDeal = 1
|
|
|
+ //}
|
|
|
+ //con1.MoneyFlows = sheet.Rows[i].Cells[21].String()
|
|
|
+ //con1.MoneyChannel = sheet.Rows[i].Cells[22].String()
|
|
|
+ //con1.MoneyChannelSon = sheet.Rows[i].Cells[23].String()
|
|
|
+ //con1.MoneyChannelSmall = sheet.Rows[i].Cells[24].String()
|
|
|
+ //con1.SingUnit = sheet.Rows[i].Cells[25].String()
|
|
|
+ //con1.Place = sheet.Rows[i].Cells[28].String()
|
|
|
+
|
|
|
+ con1.StartDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[8].Value), time.Local)
|
|
|
+ con1.EndDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[9].Value), time.Local)
|
|
|
+ con1.YearDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[9].Value), time.Local)
|
|
|
+ //con1.DisputeResolution = sheet.Rows[i].Cells[31].String()
|
|
|
+
|
|
|
+ //con1.Remark = sheet.Rows[i].Cells[32].String()
|
|
|
+ if con1.ProjectOwner != sheet.Rows[i].Cells[6].String() {
|
|
|
+ con1.ProjectOwner = con1.ProjectOwner + "," + sheet.Rows[i].Cells[6].String()
|
|
|
}
|
|
|
- con1.SubmitDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[34].Value), time.Local)
|
|
|
- con1.SealName = sheet.Rows[i].Cells[42].String()
|
|
|
+ //con1.SubmitDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[34].Value), time.Local)
|
|
|
+ //con1.SealName = sheet.Rows[i].Cells[42].String()
|
|
|
//con1.PoNumber = sheet.Rows[i].Cells[31].String()
|
|
|
//con1.ImportStatus = 0
|
|
|
svc.UpdateEntityById(con1.Id, &con1)
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
|
- con.ContractNo = sheet.Rows[i].Cells[0].String()
|
|
|
- con.ContractName = sheet.Rows[i].Cells[1].String()
|
|
|
- con.Amount = sheet.Rows[i].Cells[2].String()
|
|
|
+ con.ClassName = sheet.Rows[i].Cells[0].String()
|
|
|
+ if con.ClassName == "买卖合同" {
|
|
|
+ con.ContractClass = "01"
|
|
|
+ } else {
|
|
|
+ con.ContractClass = "03"
|
|
|
+ }
|
|
|
+ con.ImportSupplierName = sheet.Rows[i].Cells[1].String()
|
|
|
+ con.ContractNo = sheet.Rows[i].Cells[2].String()
|
|
|
+ con.ContractName = sheet.Rows[i].Cells[3].String()
|
|
|
+ con.Amount = sheet.Rows[i].Cells[4].String()
|
|
|
if con.Amount == "" {
|
|
|
con.Amount = "0"
|
|
|
}
|
|
|
- con.ClassName = sheet.Rows[i].Cells[3].String()
|
|
|
+ con.ImportSecondUnit = sheet.Rows[i].Cells[5].String()
|
|
|
+ con.ProjectOwner = sheet.Rows[i].Cells[6].String()
|
|
|
|
|
|
- con.ContractSonClass = sheet.Rows[i].Cells[4].String()
|
|
|
- con.SmallClass = sheet.Rows[i].Cells[5].String()
|
|
|
+ //con.ContractSonClass = sheet.Rows[i].Cells[4].String()
|
|
|
+ //con.SmallClass = sheet.Rows[i].Cells[5].String()
|
|
|
//con.SignedDate = convertToFormatDay(sheet.Rows[i].Cells[6].Value)
|
|
|
- con.SignedDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[6].Value), time.Local)
|
|
|
- con.ImportSecondUnit = sheet.Rows[i].Cells[8].String()
|
|
|
-
|
|
|
- con.ImportSupplierName = sheet.Rows[i].Cells[9].String()
|
|
|
+ con.SignedDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[7].Value), time.Local)
|
|
|
+ con.StartDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[8].Value), time.Local)
|
|
|
+ con.EndDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[9].Value), time.Local)
|
|
|
+ con.YearDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[9].Value), time.Local)
|
|
|
var supp supplier.OilSupplier
|
|
|
svc.GetEntityByWhere(OilSupplierName, "SupplierName = '"+con.ImportSupplierName+"'", &supp)
|
|
|
if supp.Id > 0 {
|
|
|
@@ -614,51 +632,48 @@ func (this *OilContractController) ImportExcel() {
|
|
|
con.SupplierName = supp.SupplierName
|
|
|
}
|
|
|
var org organize.Base_Organize
|
|
|
- svc.GetEntityByWhere("Base_Organize", "FullName = '"+sheet.Rows[i].Cells[8].String()+"'", &org)
|
|
|
+ svc.GetEntityByWhere("Base_Organize", "FullName = '"+sheet.Rows[i].Cells[5].String()+"'", &org)
|
|
|
if org.Id > 0 {
|
|
|
con.SecondUnit = org.Id
|
|
|
con.SecondUnitName = org.Fullname
|
|
|
}
|
|
|
con.Number = sheet.Rows[i].Cells[10].String()
|
|
|
- con.ChooseWay = sheet.Rows[i].Cells[11].String()
|
|
|
- con.ContractMark = sheet.Rows[i].Cells[14].String()
|
|
|
- con.Currency = sheet.Rows[i].Cells[15].String()
|
|
|
- con.BudgetAmount = sheet.Rows[i].Cells[16].String()
|
|
|
+ //con.ChooseWay = sheet.Rows[i].Cells[11].String()
|
|
|
+ //con.ContractMark = sheet.Rows[i].Cells[14].String()
|
|
|
+ //con.Currency = sheet.Rows[i].Cells[15].String()
|
|
|
+ //con.BudgetAmount = sheet.Rows[i].Cells[16].String()
|
|
|
if con.BudgetAmount == "" {
|
|
|
con.BudgetAmount = "0"
|
|
|
}
|
|
|
- con.PerformAmount = sheet.Rows[i].Cells[17].String()
|
|
|
+ //con.PerformAmount = sheet.Rows[i].Cells[17].String()
|
|
|
if con.PerformAmount == "" {
|
|
|
con.PerformAmount = "0"
|
|
|
}
|
|
|
con.IsYearMoney = con.PerformAmount
|
|
|
con.IsInternal = 0
|
|
|
- if sheet.Rows[i].Cells[18].String() == "是" {
|
|
|
- con.IsInternal = 1
|
|
|
- }
|
|
|
+ //if sheet.Rows[i].Cells[18].String() == "是" {
|
|
|
+ // con.IsInternal = 1
|
|
|
+ //}
|
|
|
con.IsForeign = 0
|
|
|
- if sheet.Rows[i].Cells[19].String() == "是" {
|
|
|
- con.IsForeign = 1
|
|
|
- }
|
|
|
+ //if sheet.Rows[i].Cells[19].String() == "是" {
|
|
|
+ // con.IsForeign = 1
|
|
|
+ //}
|
|
|
con.IsDeal = 0
|
|
|
- if sheet.Rows[i].Cells[20].String() == "是" {
|
|
|
- con.IsDeal = 1
|
|
|
- }
|
|
|
- con.MoneyFlows = sheet.Rows[i].Cells[21].String()
|
|
|
- con.MoneyChannel = sheet.Rows[i].Cells[22].String()
|
|
|
- con.MoneyChannelSon = sheet.Rows[i].Cells[23].String()
|
|
|
- con.MoneyChannelSmall = sheet.Rows[i].Cells[24].String()
|
|
|
- con.SingUnit = sheet.Rows[i].Cells[25].String()
|
|
|
- con.Place = sheet.Rows[i].Cells[28].String()
|
|
|
-
|
|
|
- con.StartDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[29].Value), time.Local)
|
|
|
- con.EndDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[30].Value), time.Local)
|
|
|
- con.YearDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[30].Value), time.Local)
|
|
|
- con.DisputeResolution = sheet.Rows[i].Cells[31].String()
|
|
|
- con.Remark = sheet.Rows[i].Cells[32].String()
|
|
|
- con.ProjectOwner = sheet.Rows[i].Cells[33].String()
|
|
|
- con.SubmitDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[34].Value), time.Local)
|
|
|
- con.SealName = sheet.Rows[i].Cells[42].String()
|
|
|
+ //if sheet.Rows[i].Cells[20].String() == "是" {
|
|
|
+ // con.IsDeal = 1
|
|
|
+ //}
|
|
|
+ //con.MoneyFlows = sheet.Rows[i].Cells[21].String()
|
|
|
+ //con.MoneyChannel = sheet.Rows[i].Cells[22].String()
|
|
|
+ //con.MoneyChannelSon = sheet.Rows[i].Cells[23].String()
|
|
|
+ //con.MoneyChannelSmall = sheet.Rows[i].Cells[24].String()
|
|
|
+ //con.SingUnit = sheet.Rows[i].Cells[25].String()
|
|
|
+ //con.Place = sheet.Rows[i].Cells[28].String()
|
|
|
+
|
|
|
+ //con.DisputeResolution = sheet.Rows[i].Cells[31].String()
|
|
|
+ //con.Remark = sheet.Rows[i].Cells[32].String()
|
|
|
+ //con.ProjectOwner = sheet.Rows[i].Cells[33].String()
|
|
|
+ //con.SubmitDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[34].Value), time.Local)
|
|
|
+ //con.SealName = sheet.Rows[i].Cells[42].String()
|
|
|
//con.PoNumber = sheet.Rows[i].Cells[32].String()
|
|
|
con.ImportStatus = 0
|
|
|
con.Status = 1
|
|
|
@@ -812,6 +827,16 @@ func (this *OilContractController) ImportUpdate() {
|
|
|
// excel日期字段格式化 yyyy-mm-dd
|
|
|
func convertToFormatDay(excelDaysString string) string {
|
|
|
if strings.Index(excelDaysString, "/") != -1 {
|
|
|
+ arr := strings.Split(excelDaysString, "/")
|
|
|
+ if len(arr) == 3 {
|
|
|
+ if len(arr[1]) == 1 {
|
|
|
+ arr[1] = "0" + arr[1]
|
|
|
+ }
|
|
|
+ if len(arr[2]) == 1 {
|
|
|
+ arr[2] = "0" + arr[2]
|
|
|
+ }
|
|
|
+ excelDaysString = strings.Join(arr, "-")
|
|
|
+ }
|
|
|
return excelDaysString
|
|
|
}
|
|
|
// 2006-01-02 距离 1900-01-01的天数
|