|
|
@@ -523,47 +523,57 @@ func (this *OilContractController) ImportExcel() {
|
|
|
if con1.Id > 0 {
|
|
|
con1.ContractName = sheet.Rows[i].Cells[1].String()
|
|
|
con1.Amount = sheet.Rows[i].Cells[2].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.Number = sheet.Rows[i].Cells[9].String()
|
|
|
- con1.ChooseWay = sheet.Rows[i].Cells[10].String()
|
|
|
- con1.ContractMark = sheet.Rows[i].Cells[11].String()
|
|
|
- con1.Currency = sheet.Rows[i].Cells[12].String()
|
|
|
- con1.BudgetAmount = sheet.Rows[i].Cells[13].String()
|
|
|
- con1.PerformAmount = sheet.Rows[i].Cells[14].String()
|
|
|
+ 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()
|
|
|
+ if con.BudgetAmount == "" {
|
|
|
+ con.BudgetAmount = "0"
|
|
|
+ }
|
|
|
+ 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[15].String() == "是" {
|
|
|
+ if sheet.Rows[i].Cells[18].String() == "是" {
|
|
|
con1.IsInternal = 1
|
|
|
}
|
|
|
con1.IsForeign = 0
|
|
|
- if sheet.Rows[i].Cells[16].String() == "是" {
|
|
|
+ if sheet.Rows[i].Cells[19].String() == "是" {
|
|
|
con1.IsForeign = 1
|
|
|
}
|
|
|
con1.IsDeal = 0
|
|
|
- if sheet.Rows[i].Cells[17].String() == "是" {
|
|
|
+ if sheet.Rows[i].Cells[20].String() == "是" {
|
|
|
con1.IsDeal = 1
|
|
|
}
|
|
|
- con1.MoneyFlows = sheet.Rows[i].Cells[18].String()
|
|
|
- con1.MoneyChannel = sheet.Rows[i].Cells[19].String()
|
|
|
- con1.MoneyChannelSon = sheet.Rows[i].Cells[20].String()
|
|
|
- con1.MoneyChannelSmall = sheet.Rows[i].Cells[21].String()
|
|
|
- con1.SingUnit = sheet.Rows[i].Cells[22].String()
|
|
|
- con1.Place = sheet.Rows[i].Cells[23].String()
|
|
|
-
|
|
|
- con1.StartDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[24].Value), time.Local)
|
|
|
- con1.EndDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[25].Value), time.Local)
|
|
|
- con1.YearDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[25].Value), time.Local)
|
|
|
- con1.DisputeResolution = sheet.Rows[i].Cells[26].String()
|
|
|
- con1.Remark = sheet.Rows[i].Cells[27].String()
|
|
|
- if con1.ProjectOwner != sheet.Rows[i].Cells[28].String() {
|
|
|
- con1.ProjectOwner = con1.ProjectOwner + "," + sheet.Rows[i].Cells[28].String()
|
|
|
+ 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()
|
|
|
}
|
|
|
- con1.SubmitDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[29].Value), time.Local)
|
|
|
- con1.SealName = sheet.Rows[i].Cells[30].String()
|
|
|
- con1.PoNumber = sheet.Rows[i].Cells[31].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
|
|
|
@@ -571,15 +581,18 @@ func (this *OilContractController) ImportExcel() {
|
|
|
con.ContractNo = sheet.Rows[i].Cells[0].String()
|
|
|
con.ContractName = sheet.Rows[i].Cells[1].String()
|
|
|
con.Amount = sheet.Rows[i].Cells[2].String()
|
|
|
+ if con.Amount == "" {
|
|
|
+ con.Amount = "0"
|
|
|
+ }
|
|
|
con.ClassName = sheet.Rows[i].Cells[3].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[7].String()
|
|
|
+ con.ImportSecondUnit = sheet.Rows[i].Cells[8].String()
|
|
|
|
|
|
- con.ImportSupplierName = sheet.Rows[i].Cells[8].String()
|
|
|
+ con.ImportSupplierName = sheet.Rows[i].Cells[9].String()
|
|
|
var supp supplier.OilSupplier
|
|
|
svc.GetEntityByWhere(OilSupplierName, "SupplierName = '"+con.ImportSupplierName+"'", &supp)
|
|
|
if supp.Id > 0 {
|
|
|
@@ -587,46 +600,52 @@ func (this *OilContractController) ImportExcel() {
|
|
|
con.SupplierName = supp.SupplierName
|
|
|
}
|
|
|
var org organize.Base_Organize
|
|
|
- svc.GetEntityByWhere("Base_Organize", "FullName = '"+sheet.Rows[i].Cells[7].String()+"'", &org)
|
|
|
+ svc.GetEntityByWhere("Base_Organize", "FullName = '"+sheet.Rows[i].Cells[8].String()+"'", &org)
|
|
|
if org.Id > 0 {
|
|
|
con.SecondUnit = org.Id
|
|
|
con.SecondUnitName = org.Fullname
|
|
|
}
|
|
|
- con.Number = sheet.Rows[i].Cells[9].String()
|
|
|
- con.ChooseWay = sheet.Rows[i].Cells[10].String()
|
|
|
- con.ContractMark = sheet.Rows[i].Cells[11].String()
|
|
|
- con.Currency = sheet.Rows[i].Cells[12].String()
|
|
|
- con.BudgetAmount = sheet.Rows[i].Cells[13].String()
|
|
|
- con.PerformAmount = sheet.Rows[i].Cells[14].String()
|
|
|
+ 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()
|
|
|
+ if con.BudgetAmount == "" {
|
|
|
+ con.BudgetAmount = "0"
|
|
|
+ }
|
|
|
+ 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[15].String() == "是" {
|
|
|
+ if sheet.Rows[i].Cells[18].String() == "是" {
|
|
|
con.IsInternal = 1
|
|
|
}
|
|
|
con.IsForeign = 0
|
|
|
- if sheet.Rows[i].Cells[16].String() == "是" {
|
|
|
+ if sheet.Rows[i].Cells[19].String() == "是" {
|
|
|
con.IsForeign = 1
|
|
|
}
|
|
|
con.IsDeal = 0
|
|
|
- if sheet.Rows[i].Cells[17].String() == "是" {
|
|
|
+ if sheet.Rows[i].Cells[20].String() == "是" {
|
|
|
con.IsDeal = 1
|
|
|
}
|
|
|
- con.MoneyFlows = sheet.Rows[i].Cells[18].String()
|
|
|
- con.MoneyChannel = sheet.Rows[i].Cells[19].String()
|
|
|
- con.MoneyChannelSon = sheet.Rows[i].Cells[20].String()
|
|
|
- con.MoneyChannelSmall = sheet.Rows[i].Cells[21].String()
|
|
|
- con.SingUnit = sheet.Rows[i].Cells[22].String()
|
|
|
- con.Place = sheet.Rows[i].Cells[23].String()
|
|
|
-
|
|
|
- con.StartDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[24].Value), time.Local)
|
|
|
- con.EndDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[25].Value), time.Local)
|
|
|
- con.YearDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[25].Value), time.Local)
|
|
|
- con.DisputeResolution = sheet.Rows[i].Cells[26].String()
|
|
|
- con.Remark = sheet.Rows[i].Cells[27].String()
|
|
|
- con.ProjectOwner = sheet.Rows[i].Cells[28].String()
|
|
|
- con.SubmitDate, _ = time.ParseInLocation("2006-01-02", convertToFormatDay(sheet.Rows[i].Cells[29].Value), time.Local)
|
|
|
- con.SealName = sheet.Rows[i].Cells[30].String()
|
|
|
- con.PoNumber = sheet.Rows[i].Cells[31].String()
|
|
|
+ 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()
|
|
|
+ //con.PoNumber = sheet.Rows[i].Cells[32].String()
|
|
|
con.ImportStatus = 0
|
|
|
con.Status = 1
|
|
|
con.SettleStatus = "1"
|
|
|
@@ -744,7 +763,8 @@ func (this *OilContractController) ImportUpdate() {
|
|
|
where += " and Id = " + Id + " and ImportStatus = 0 and ImportSecondUnit = '" + Class + "'"
|
|
|
sql = "update OilContract set SecondUnitName = '" + org.Fullname + "',SupplierName = '" + supp.SupplierName + "', " + Column + " = " + Value + " where " + where
|
|
|
} else {
|
|
|
- where += " and ImportStatus = 0 and ImportSecondUnit = '" + Class + "' and " + Column + " = 0"
|
|
|
+ //where += " and ImportStatus = 0 and ImportSecondUnit = '" + Class + "' and " + Column + " = 0"
|
|
|
+ where += " and ImportStatus = 0 and ImportSecondUnit = '" + Class + "'"
|
|
|
sql = "update OilContract set SecondUnitName = '" + org.Fullname + "'," + Column + " = " + Value + " where " + where
|
|
|
}
|
|
|
_, err = utils.DBE.Query(sql)
|