|
|
@@ -285,7 +285,8 @@ func (this *HSEScoreController) ImportExcel() {
|
|
|
hseUpdate.ApplyTime = hseTime.ApplyTime
|
|
|
hseUpdate.StartTime = hseTime.StartTime
|
|
|
hseUpdate.SupplierId = supplier.Id
|
|
|
- hseUpdate.TestNumber, _ = strconv.Atoi(sheet.Rows[i].Cells[2].String())
|
|
|
+ //hseUpdate.TestNumber, _ = strconv.Atoi(sheet.Rows[i].Cells[2].String())
|
|
|
+ hseUpdate.TestNumber = sheet.Rows[i].Cells[2].String()
|
|
|
hseUpdate.IdNumber = sheet.Rows[i].Cells[4].String()
|
|
|
hseUpdate.Score, _ = strconv.Atoi(sheet.Rows[i].Cells[5].String())
|
|
|
hseUpdate.ModifiedOn = time.Now()
|
|
|
@@ -300,7 +301,7 @@ func (this *HSEScoreController) ImportExcel() {
|
|
|
hse.ApplyTime = hseTime.ApplyTime
|
|
|
hse.StartTime = hseTime.StartTime
|
|
|
hse.SupplierId = supplier.Id
|
|
|
- hse.TestNumber, _ = strconv.Atoi(sheet.Rows[i].Cells[2].String())
|
|
|
+ hse.TestNumber= sheet.Rows[i].Cells[2].String()
|
|
|
hse.SupplierId = supplier.Id
|
|
|
hse.Name = sheet.Rows[i].Cells[3].String()
|
|
|
hse.IdNumber = sheet.Rows[i].Cells[4].String()
|
|
|
@@ -379,12 +380,8 @@ func (this *HSEScoreController) AddHSEScore() {
|
|
|
}
|
|
|
|
|
|
svc.GetEntityByWhere(OilSupplierName, "Id = "+strconv.Itoa(model.SupplierId), &supplier)
|
|
|
- if supplier.SupplierName == "" {
|
|
|
- errinfo.Message = "找不到该企业"
|
|
|
- errinfo.Code = -2
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- return
|
|
|
+ if supplier.SupplierName != "" {
|
|
|
+ model.SupplierName = supplier.SupplierName
|
|
|
}
|
|
|
if model.IdNumber != "" {
|
|
|
where := "IdNumber = '" + model.IdNumber + "'"
|
|
|
@@ -398,7 +395,6 @@ func (this *HSEScoreController) AddHSEScore() {
|
|
|
}
|
|
|
}
|
|
|
model.ApplyTime = model.ApplyTime.AddDate(3, 0, 0)
|
|
|
- model.SupplierName = supplier.SupplierName
|
|
|
model.CreateOn = time.Now()
|
|
|
model.CreateBy = this.User.Realname
|
|
|
model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
|
|
|
@@ -438,12 +434,8 @@ func (this *HSEScoreController) UpdateHSEScore() {
|
|
|
json.Unmarshal(jsonBlob, &model)
|
|
|
|
|
|
svc.GetEntityByWhere(OilSupplierName, "Id = "+strconv.Itoa(model.SupplierId), &supplier)
|
|
|
- if supplier.SupplierName == "" {
|
|
|
- errinfo.Message = "找不到该企业"
|
|
|
- errinfo.Code = -2
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- return
|
|
|
+ if supplier.SupplierName != "" {
|
|
|
+ model.SupplierName = supplier.SupplierName
|
|
|
}
|
|
|
|
|
|
if this.User.IsCompanyUser == 1 {
|
|
|
@@ -466,7 +458,6 @@ func (this *HSEScoreController) UpdateHSEScore() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- model.SupplierName = supplier.SupplierName
|
|
|
model.ApplyTime = model.ApplyTime.AddDate(3, 0, 0)
|
|
|
model.ModifiedOn = time.Now()
|
|
|
model.ModifiedBy = this.User.Realname
|