|
|
@@ -134,7 +134,7 @@ func (this *OilContractController) GetEntityList() {
|
|
|
}
|
|
|
|
|
|
if ImportUnitName != "" {
|
|
|
- where = where + " and SecondUnitName like '%" + ImportUnitName + "%'"
|
|
|
+ where = where + " and ImportSecondUnit like '%" + ImportUnitName + "%'"
|
|
|
}
|
|
|
|
|
|
if Status != "" {
|
|
|
@@ -524,64 +524,66 @@ func (this *OilContractController) ImportExcel() {
|
|
|
var con1 contract.OilContract
|
|
|
lineNo := strconv.Itoa(i + 1)
|
|
|
fmt.Println(lineNo)
|
|
|
- svc.GetEntityByWhere(OilContractName, "ContractNo = '"+sheet.Rows[i].Cells[0].String()+"'", &con1)
|
|
|
- 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"
|
|
|
+ if sheet.Rows[i].Cells[0].String() != "" {
|
|
|
+ svc.GetEntityByWhere(OilContractName, "ContractNo = '"+sheet.Rows[i].Cells[0].String()+"'", &con1)
|
|
|
+ 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[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[18].String() == "是" {
|
|
|
+ con1.IsInternal = 1
|
|
|
+ }
|
|
|
+ con1.IsForeign = 0
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+ 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
|
|
|
}
|
|
|
- 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[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[18].String() == "是" {
|
|
|
- con1.IsInternal = 1
|
|
|
- }
|
|
|
- con1.IsForeign = 0
|
|
|
- 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()
|
|
|
- }
|
|
|
- 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()
|
|
|
@@ -708,7 +710,7 @@ func (this *OilContractController) DocExport() {
|
|
|
// @router /importbatchsave [post]
|
|
|
func (this *OilContractController) ImportBatchSave() {
|
|
|
|
|
|
- sql := "update OilContract set ImportStatus = 1 where SupplierId != 0 and ContractClass != '' and SecondUnit != 0"
|
|
|
+ sql := "update OilContract set ImportStatus = 1 where SupplierId != 0 and ContractClass != '' and SecondUnit != 0 and ContractNo != ''"
|
|
|
_, err := utils.DBE.Query(sql)
|
|
|
var errinfo ErrorInfo
|
|
|
if err == nil {
|