|
|
@@ -2,9 +2,7 @@ package lims
|
|
|
|
|
|
import (
|
|
|
"dashoo.cn/backend/api/business/devicestatistics"
|
|
|
- "dashoo.cn/backend/api/business/organize"
|
|
|
. "dashoo.cn/backend/api/controllers"
|
|
|
- "dashoo.cn/business2/permission"
|
|
|
"dashoo.cn/utils"
|
|
|
"fmt"
|
|
|
"strconv"
|
|
|
@@ -23,10 +21,10 @@ type DeviceStatisticsController struct {
|
|
|
// @router /list [get]
|
|
|
func (this *DeviceStatisticsController) GetEntityList() {
|
|
|
|
|
|
- svcPerm := permission.GetPermissionService(utils.DBE)
|
|
|
- isauth := svcPerm.IsAuthorized(this.User.Id, "Administrator")
|
|
|
- organizeSvc := organize.GetOrganizeService(utils.DBE)
|
|
|
- thrunitId := organizeSvc.GetMyThrUnitDepartmentId(this.User.DepartmentId)
|
|
|
+ // svcPerm := permission.GetPermissionService(utils.DBE)
|
|
|
+ //isauth := svcPerm.IsAuthorized(this.User.Id, "Administrator")
|
|
|
+ // organizeSvc := organize.GetOrganizeService(utils.DBE)
|
|
|
+ // thrunitId := organizeSvc.GetMyThrUnitDepartmentId(this.User.DepartmentId)
|
|
|
|
|
|
var devicelist []devicestatistics.DeviceStatistics
|
|
|
svc := devicestatistics.GetDeviceStatisticsService(utils.DBE)
|
|
|
@@ -39,7 +37,7 @@ func (this *DeviceStatisticsController) GetEntityList() {
|
|
|
whereYno := "(CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and CheckResult='×'"
|
|
|
whereY := "(CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and CheckResult='○'"
|
|
|
|
|
|
- if isauth || thrunitId == "100001215" {
|
|
|
+ //if isauth || thrunitId == "100001215" {
|
|
|
// 防雷装置(等电位)
|
|
|
var deviceEQ devicestatistics.DeviceStatistics
|
|
|
totalYearNo := svc.GetCountsByDate(this.User.AccCode + LimsReportEquipotentName, whereYno)
|
|
|
@@ -119,20 +117,20 @@ func (this *DeviceStatisticsController) GetEntityList() {
|
|
|
deviceEG.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
|
|
|
}
|
|
|
devicelist = append(devicelist, deviceEG)
|
|
|
- }
|
|
|
+ //}
|
|
|
|
|
|
- if isauth || thrunitId == "100001219" {
|
|
|
+ //if isauth || thrunitId == "100001219" {
|
|
|
whereYno = "(CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and CheckResult LIKE '%不合格%' "
|
|
|
whereY = "(CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and CheckResult LIKE '%合格%' AND CheckResult NOT LIKE '%不合格%'"
|
|
|
//阻火器 LimsReportZuhq
|
|
|
var deviceZHQ devicestatistics.DeviceStatistics
|
|
|
- totalYearNo := svc.GetCountsByDate(this.User.AccCode + LimsReportZuhqName, whereYno)
|
|
|
- totalYear := svc.GetCountsByDate(this.User.AccCode + LimsReportZuhqName, whereY)
|
|
|
- num := svc.GetCountsByDate(this.User.AccCode + LimsReportZuhqName, where)
|
|
|
- whereN :="TemplateTypeId=156"
|
|
|
- numEQ := svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
|
|
|
- numWM :=svc.GetWaitCountsMonth("156")
|
|
|
- numWY :=svc.GetWaitCountsYear("156")
|
|
|
+ totalYearNo = svc.GetCountsByDate(this.User.AccCode + LimsReportZuhqName, whereYno)
|
|
|
+ totalYear = svc.GetCountsByDate(this.User.AccCode + LimsReportZuhqName, whereY)
|
|
|
+ num = svc.GetCountsByDate(this.User.AccCode + LimsReportZuhqName, where)
|
|
|
+ whereN ="TemplateTypeId=156"
|
|
|
+ numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
|
|
|
+ numWM =svc.GetWaitCountsMonth("156")
|
|
|
+ numWY =svc.GetWaitCountsYear("156")
|
|
|
deviceZHQ.DeviceName = "阻火器"
|
|
|
deviceZHQ.DeviceQty = numEQ
|
|
|
deviceZHQ.WaitYear = int(numWY)
|
|
|
@@ -244,7 +242,7 @@ func (this *DeviceStatisticsController) GetEntityList() {
|
|
|
}
|
|
|
devicelist = append(devicelist, deviceWYL)
|
|
|
|
|
|
- }
|
|
|
+ //}
|
|
|
|
|
|
|
|
|
var datainfo ErrorDataInfo
|