|
|
@@ -2,10 +2,12 @@ package lims
|
|
|
|
|
|
import (
|
|
|
"dashoo.cn/backend/api/business/devicestatistics"
|
|
|
+ "dashoo.cn/backend/api/business/organize"
|
|
|
. "dashoo.cn/backend/api/controllers"
|
|
|
"dashoo.cn/utils"
|
|
|
"fmt"
|
|
|
"strconv"
|
|
|
+ "strings"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
@@ -13,14 +15,14 @@ type DeviceStatisticsController struct {
|
|
|
BaseController
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
// @Title 获取列表
|
|
|
// @Description get user by token
|
|
|
// @Success 200 {object}
|
|
|
// @router /list [get]
|
|
|
func (this *DeviceStatisticsController) GetEntityList() {
|
|
|
|
|
|
+ unitId := this.GetString("unitCheckId")
|
|
|
+
|
|
|
// svcPerm := permission.GetPermissionService(utils.DBE)
|
|
|
//isauth := svcPerm.IsAuthorized(this.User.Id, "Administrator")
|
|
|
// organizeSvc := organize.GetOrganizeService(utils.DBE)
|
|
|
@@ -31,22 +33,64 @@ func (this *DeviceStatisticsController) GetEntityList() {
|
|
|
//fromdate := GetFirstDateOfMonth(time.Now()).Format("2006-01-02 15:04:05")
|
|
|
//todate := GetLastDateOfMonth(time.Now()).Format("2006-01-02") + " 23:59:59"
|
|
|
|
|
|
- where := "(CreateOn < DATE_ADD(CURDATE()-DAY(CURDATE())+1,INTERVAL 1 MONTH)) and CheckResult != ''"
|
|
|
- //fromdateyear := strconv.Itoa(time.Now().Year()) + "-01-01 00:00:00"
|
|
|
- //todateyear := strconv.Itoa(time.Now().Year()) + "-12-31 23:59:59"
|
|
|
- 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='○'"
|
|
|
+ organizeSvc := organize.GetOrganizeService(utils.DBE)
|
|
|
+
|
|
|
+ thrId := organizeSvc.GetMyThrUnitDepartmentId(this.User.DepartmentId)
|
|
|
+
|
|
|
+ thrIds := ""
|
|
|
+ ethrIds := ""
|
|
|
+ //unitId := ""
|
|
|
+ wheret := ""
|
|
|
+ if thrId == "100001219" || thrId == "100001215" {
|
|
|
+ if unitId != "" {
|
|
|
+ throrg := organizeSvc.GetAllThirdChildByTopId(unitId, "")
|
|
|
+ if throrg == nil {
|
|
|
+ thrIds = "-1"
|
|
|
+ } else {
|
|
|
+ for _, item := range throrg {
|
|
|
+ thrIds += strconv.Itoa(item.Id) + ","
|
|
|
+ }
|
|
|
+ thrIds = strings.Trim(thrIds, ",")
|
|
|
+ ethrIds = organizeSvc.GetAllChildById(unitId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ //if thrId == this.User.DepartmentId {
|
|
|
+ unitId = organizeSvc.GetMyUnitDepartmentId(this.User.DepartmentId)
|
|
|
+ //var throrg []organize.Base_Organize
|
|
|
+ throrg := organizeSvc.GetAllThirdChildByTopId(unitId, "")
|
|
|
+ for _, item := range throrg {
|
|
|
+ thrIds += strconv.Itoa(item.Id) + ","
|
|
|
+ }
|
|
|
+ ethrIds = organizeSvc.GetAllChildById(unitId)
|
|
|
+ thrIds = strings.Trim(thrIds, ",")
|
|
|
+ //} else {
|
|
|
+ // ethrIds = thrId
|
|
|
+ //}
|
|
|
+ }
|
|
|
+ if thrIds != "" {
|
|
|
+ wheret = " and b.TestDepartId in (" + thrIds + ")"
|
|
|
+ }
|
|
|
+ wheree := ""
|
|
|
+ if ethrIds != "" {
|
|
|
+ wheree = " and DepartmentId in (" + ethrIds + ")"
|
|
|
+ }
|
|
|
+
|
|
|
+ where := "(a.CreateOn < DATE_ADD(CURDATE()-DAY(CURDATE())+1,INTERVAL 1 MONTH)) and a.CheckResult != ''" + wheret
|
|
|
+ whereYno := "(a.CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and a.CheckResult='×' " + wheret
|
|
|
+ whereY := "(a.CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and a.CheckResult='○' " + wheret
|
|
|
|
|
|
- //if isauth || thrunitId == "100001215" {
|
|
|
+ if thrId != "100001219" {
|
|
|
// 防雷装置(等电位)
|
|
|
var deviceEQ devicestatistics.DeviceStatistics
|
|
|
- totalYearNo := svc.GetCountsByDate(this.User.AccCode + LimsReportEquipotentName, whereYno)
|
|
|
- totalYear := svc.GetCountsByDate(this.User.AccCode + LimsReportEquipotentName, whereY)
|
|
|
- num := svc.GetCountsByDate(this.User.AccCode + LimsReportEquipotentName, where)
|
|
|
- whereN := "TemplateTypeId=187"
|
|
|
- numEQ := svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
|
|
|
- numWM :=svc.GetWaitCountsMonth("187")
|
|
|
- numWY :=svc.GetWaitCountsYear("187")
|
|
|
+ totalYearNo := svc.GetCountsByDate(this.User.AccCode+LimsReportEquipotentName, whereYno)
|
|
|
+ totalYear := svc.GetCountsByDate(this.User.AccCode+LimsReportEquipotentName, whereY)
|
|
|
+ num := svc.GetCountsByDate(this.User.AccCode+LimsReportEquipotentName, where)
|
|
|
+ whereN := "TemplateTypeId=187 " + wheree
|
|
|
+ numEQ := svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
|
|
|
+ numWM := svc.GetWaitCountsMonth("187")
|
|
|
+ numWY := svc.GetWaitCountsYear("187")
|
|
|
deviceEQ.DeviceName = "防雷装置(等电位)"
|
|
|
deviceEQ.DeviceQty = int(numEQ)
|
|
|
deviceEQ.WaitYear = int(numWY)
|
|
|
@@ -60,13 +104,13 @@ func (this *DeviceStatisticsController) GetEntityList() {
|
|
|
|
|
|
// 防雷装置
|
|
|
var deviceLPT devicestatistics.DeviceStatistics
|
|
|
- totalYearNo = svc.GetCountsByDate(this.User.AccCode + LimsReportLightProtectName, whereYno)
|
|
|
- totalYear = svc.GetCountsByDate(this.User.AccCode + LimsReportLightProtectName, whereY)
|
|
|
- num = svc.GetCountsByDate(this.User.AccCode + LimsReportLightProtectName, where)
|
|
|
- whereN ="TemplateTypeId=286"
|
|
|
- numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
|
|
|
- numWM =svc.GetWaitCountsMonth("286")
|
|
|
- numWY =svc.GetWaitCountsYear("286")
|
|
|
+ totalYearNo = svc.GetCountsByDate(this.User.AccCode+LimsReportLightProtectName, whereYno)
|
|
|
+ totalYear = svc.GetCountsByDate(this.User.AccCode+LimsReportLightProtectName, whereY)
|
|
|
+ num = svc.GetCountsByDate(this.User.AccCode+LimsReportLightProtectName, where)
|
|
|
+ whereN = "TemplateTypeId=286 " + wheree
|
|
|
+ numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
|
|
|
+ numWM = svc.GetWaitCountsMonth("286")
|
|
|
+ numWY = svc.GetWaitCountsYear("286")
|
|
|
deviceLPT.DeviceName = "防雷装置"
|
|
|
deviceLPT.DeviceQty = numEQ
|
|
|
deviceLPT.WaitYear = int(numWY)
|
|
|
@@ -80,13 +124,13 @@ func (this *DeviceStatisticsController) GetEntityList() {
|
|
|
|
|
|
// 漏电保护器
|
|
|
var deviceLP devicestatistics.DeviceStatistics
|
|
|
- totalYearNo = svc.GetCountsByDate(this.User.AccCode + LimsReportLeakProtectName, whereYno)
|
|
|
- totalYear = svc.GetCountsByDate(this.User.AccCode + LimsReportLeakProtectName, whereY)
|
|
|
- num = svc.GetCountsByDate(this.User.AccCode + LimsReportLeakProtectName, where)
|
|
|
- whereN ="TemplateTypeId=181"
|
|
|
- numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
|
|
|
- numWM =svc.GetWaitCountsMonth("181")
|
|
|
- numWY =svc.GetWaitCountsYear("181")
|
|
|
+ totalYearNo = svc.GetCountsByDate(this.User.AccCode+LimsReportLeakProtectName, whereYno)
|
|
|
+ totalYear = svc.GetCountsByDate(this.User.AccCode+LimsReportLeakProtectName, whereY)
|
|
|
+ num = svc.GetCountsByDate(this.User.AccCode+LimsReportLeakProtectName, where)
|
|
|
+ whereN = "TemplateTypeId=181" + wheree
|
|
|
+ numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
|
|
|
+ numWM = svc.GetWaitCountsMonth("181")
|
|
|
+ numWY = svc.GetWaitCountsYear("181")
|
|
|
deviceLP.DeviceName = "漏电保护器"
|
|
|
deviceLP.DeviceQty = numEQ
|
|
|
deviceLP.WaitYear = int(numWY)
|
|
|
@@ -100,13 +144,13 @@ func (this *DeviceStatisticsController) GetEntityList() {
|
|
|
|
|
|
// 电气接地
|
|
|
var deviceEG devicestatistics.DeviceStatistics
|
|
|
- totalYearNo = svc.GetCountsByDate(this.User.AccCode + LimsReportElecGroundName, whereYno)
|
|
|
- totalYear = svc.GetCountsByDate(this.User.AccCode + LimsReportElecGroundName, whereY)
|
|
|
- num = svc.GetCountsByDate(this.User.AccCode + LimsReportElecGroundName, where)
|
|
|
- whereN ="TemplateTypeId=179"
|
|
|
- numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
|
|
|
- numWM =svc.GetWaitCountsMonth("179")
|
|
|
- numWY =svc.GetWaitCountsYear("179")
|
|
|
+ totalYearNo = svc.GetCountsByDate(this.User.AccCode+LimsReportElecGroundName, whereYno)
|
|
|
+ totalYear = svc.GetCountsByDate(this.User.AccCode+LimsReportElecGroundName, whereY)
|
|
|
+ num = svc.GetCountsByDate(this.User.AccCode+LimsReportElecGroundName, where)
|
|
|
+ whereN = "TemplateTypeId=179 " + wheree
|
|
|
+ numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
|
|
|
+ numWM = svc.GetWaitCountsMonth("179")
|
|
|
+ numWY = svc.GetWaitCountsYear("179")
|
|
|
deviceEG.DeviceName = "电气接地"
|
|
|
deviceEG.DeviceQty = numEQ
|
|
|
deviceEG.WaitYear = int(numWY)
|
|
|
@@ -117,20 +161,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" {
|
|
|
- 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 '%不合格%'"
|
|
|
+ if thrId != "100001215" {
|
|
|
+ whereYno = "(a.CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and a.CheckResult LIKE '%不合格%'" + wheret
|
|
|
+ whereY = "(a.CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and a.CheckResult LIKE '%合格%' AND CheckResult NOT LIKE '%不合格%' " + wheret
|
|
|
//阻火器 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" + wheree
|
|
|
+ numEQ := svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
|
|
|
+ numWM := svc.GetWaitCountsMonth("156")
|
|
|
+ numWY := svc.GetWaitCountsYear("156")
|
|
|
deviceZHQ.DeviceName = "阻火器"
|
|
|
deviceZHQ.DeviceQty = numEQ
|
|
|
deviceZHQ.WaitYear = int(numWY)
|
|
|
@@ -144,13 +188,13 @@ func (this *DeviceStatisticsController) GetEntityList() {
|
|
|
|
|
|
// 呼吸阀 LimsReportHuxf
|
|
|
var deviceHXF devicestatistics.DeviceStatistics
|
|
|
- totalYearNo = svc.GetCountsByDate(this.User.AccCode + LimsReportHuxfName, whereYno)
|
|
|
- totalYear = svc.GetCountsByDate(this.User.AccCode + LimsReportHuxfName, whereY)
|
|
|
- num = svc.GetCountsByDate(this.User.AccCode + LimsReportHuxfName, where)
|
|
|
- whereN ="TemplateTypeId=183"
|
|
|
- numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
|
|
|
- numWM =svc.GetWaitCountsMonth("183")
|
|
|
- numWY =svc.GetWaitCountsYear("183")
|
|
|
+ totalYearNo = svc.GetCountsByDate(this.User.AccCode+LimsReportHuxfName, whereYno)
|
|
|
+ totalYear = svc.GetCountsByDate(this.User.AccCode+LimsReportHuxfName, whereY)
|
|
|
+ num = svc.GetCountsByDate(this.User.AccCode+LimsReportHuxfName, where)
|
|
|
+ whereN = "TemplateTypeId=183 " + wheree
|
|
|
+ numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
|
|
|
+ numWM = svc.GetWaitCountsMonth("183")
|
|
|
+ numWY = svc.GetWaitCountsYear("183")
|
|
|
deviceHXF.DeviceName = "呼吸阀"
|
|
|
deviceHXF.DeviceQty = numEQ
|
|
|
deviceHXF.WaitYear = int(numWY)
|
|
|
@@ -164,13 +208,13 @@ func (this *DeviceStatisticsController) GetEntityList() {
|
|
|
|
|
|
// 液压安全阀 LimsReportYeyaqf
|
|
|
var deviceYYF devicestatistics.DeviceStatistics
|
|
|
- totalYearNo = svc.GetCountsByDate(this.User.AccCode + LimsReportYeyaqfName, whereYno)
|
|
|
- totalYear = svc.GetCountsByDate(this.User.AccCode + LimsReportYeyaqfName, whereY)
|
|
|
- num = svc.GetCountsByDate(this.User.AccCode + LimsReportYeyaqfName, where)
|
|
|
- whereN ="TemplateTypeId=154"
|
|
|
- numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
|
|
|
- numWM =svc.GetWaitCountsMonth("154")
|
|
|
- numWY =svc.GetWaitCountsYear("154")
|
|
|
+ totalYearNo = svc.GetCountsByDate(this.User.AccCode+LimsReportYeyaqfName, whereYno)
|
|
|
+ totalYear = svc.GetCountsByDate(this.User.AccCode+LimsReportYeyaqfName, whereY)
|
|
|
+ num = svc.GetCountsByDate(this.User.AccCode+LimsReportYeyaqfName, where)
|
|
|
+ whereN = "TemplateTypeId=154 " + wheree
|
|
|
+ numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
|
|
|
+ numWM = svc.GetWaitCountsMonth("154")
|
|
|
+ numWY = svc.GetWaitCountsYear("154")
|
|
|
deviceYYF.DeviceName = "液压安全阀"
|
|
|
deviceYYF.DeviceQty = numEQ
|
|
|
deviceYYF.WaitYear = int(numWY)
|
|
|
@@ -184,13 +228,13 @@ func (this *DeviceStatisticsController) GetEntityList() {
|
|
|
|
|
|
// 空气泡沫产生器 LimsReportAirFoamGenerator
|
|
|
var deviceKQPM devicestatistics.DeviceStatistics
|
|
|
- totalYearNo = svc.GetCountsByDate(this.User.AccCode + LimsReportKqpmName, whereYno)
|
|
|
- totalYear = svc.GetCountsByDate(this.User.AccCode + LimsReportKqpmName, whereY)
|
|
|
- num = svc.GetCountsByDate(this.User.AccCode + LimsReportKqpmName, where)
|
|
|
- whereN ="TemplateTypeId=189"
|
|
|
- numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
|
|
|
- numWM =svc.GetWaitCountsMonth("189")
|
|
|
- numWY =svc.GetWaitCountsYear("189")
|
|
|
+ totalYearNo = svc.GetCountsByDate(this.User.AccCode+LimsReportKqpmName, whereYno)
|
|
|
+ totalYear = svc.GetCountsByDate(this.User.AccCode+LimsReportKqpmName, whereY)
|
|
|
+ num = svc.GetCountsByDate(this.User.AccCode+LimsReportKqpmName, where)
|
|
|
+ whereN = "TemplateTypeId=189 " + wheree
|
|
|
+ numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
|
|
|
+ numWM = svc.GetWaitCountsMonth("189")
|
|
|
+ numWY = svc.GetWaitCountsYear("189")
|
|
|
deviceKQPM.DeviceName = "空气泡沫产生器"
|
|
|
deviceKQPM.DeviceQty = numEQ
|
|
|
deviceKQPM.WaitYear = int(numWY)
|
|
|
@@ -198,19 +242,19 @@ func (this *DeviceStatisticsController) GetEntityList() {
|
|
|
deviceKQPM.FinishMonth = int(num)
|
|
|
deviceKQPM.FinishYear = int(totalYearNo) + int(totalYear)
|
|
|
if deviceKQPM.FinishYear != 0 {
|
|
|
- deviceKQPM.PassRate,_ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo) + float64(totalYear)))*100), 64)
|
|
|
+ deviceKQPM.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
|
|
|
}
|
|
|
devicelist = append(devicelist, deviceKQPM)
|
|
|
|
|
|
// 游梁式抽油机 LimsReportBeamPumpingUnits
|
|
|
var deviceYL devicestatistics.DeviceStatistics
|
|
|
- totalYearNo = svc.GetCountsByDate(this.User.AccCode + LimsReportBeamPumpingUnitName, whereYno)
|
|
|
- totalYear = svc.GetCountsByDate(this.User.AccCode + LimsReportBeamPumpingUnitName, whereY)
|
|
|
- num = svc.GetCountsByDate(this.User.AccCode + LimsReportBeamPumpingUnitName, where)
|
|
|
- whereN ="TemplateTypeId=141"
|
|
|
- numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
|
|
|
- numWM =svc.GetWaitCountsMonth("141")
|
|
|
- numWY =svc.GetWaitCountsYear("141")
|
|
|
+ totalYearNo = svc.GetCountsByDate(this.User.AccCode+LimsReportBeamPumpingUnitName, whereYno)
|
|
|
+ totalYear = svc.GetCountsByDate(this.User.AccCode+LimsReportBeamPumpingUnitName, whereY)
|
|
|
+ num = svc.GetCountsByDate(this.User.AccCode+LimsReportBeamPumpingUnitName, where)
|
|
|
+ whereN = "TemplateTypeId=141 " + wheree
|
|
|
+ numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
|
|
|
+ numWM = svc.GetWaitCountsMonth("141")
|
|
|
+ numWY = svc.GetWaitCountsYear("141")
|
|
|
deviceYL.DeviceName = "游梁式抽油机"
|
|
|
deviceYL.DeviceQty = numEQ
|
|
|
deviceYL.WaitYear = int(numWY)
|
|
|
@@ -224,13 +268,13 @@ func (this *DeviceStatisticsController) GetEntityList() {
|
|
|
|
|
|
// 无游梁式抽油机 LimsReportNoBeamPumpingUnit
|
|
|
var deviceWYL devicestatistics.DeviceStatistics
|
|
|
- totalYearNo = svc.GetCountsByDate(this.User.AccCode + LimsReportNoBeamPumpingUnitName, whereYno)
|
|
|
- totalYear = svc.GetCountsByDate(this.User.AccCode + LimsReportNoBeamPumpingUnitName, whereY)
|
|
|
- num = svc.GetCountsByDate(this.User.AccCode + LimsReportNoBeamPumpingUnitName, where)
|
|
|
- whereN ="TemplateTypeId=173"
|
|
|
- numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
|
|
|
- numWM =svc.GetWaitCountsMonth("173")
|
|
|
- numWY =svc.GetWaitCountsYear("173")
|
|
|
+ totalYearNo = svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereYno)
|
|
|
+ totalYear = svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereY)
|
|
|
+ num = svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, where)
|
|
|
+ whereN = "TemplateTypeId=173 " + wheree
|
|
|
+ numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
|
|
|
+ numWM = svc.GetWaitCountsMonth("173")
|
|
|
+ numWY = svc.GetWaitCountsYear("173")
|
|
|
deviceWYL.DeviceName = "无游梁式抽油机"
|
|
|
deviceWYL.DeviceQty = numEQ
|
|
|
deviceWYL.WaitYear = int(numWY)
|
|
|
@@ -242,8 +286,7 @@ func (this *DeviceStatisticsController) GetEntityList() {
|
|
|
}
|
|
|
devicelist = append(devicelist, deviceWYL)
|
|
|
|
|
|
- //}
|
|
|
-
|
|
|
+ }
|
|
|
|
|
|
var datainfo ErrorDataInfo
|
|
|
datainfo.Item = devicelist
|
|
|
@@ -252,20 +295,40 @@ func (this *DeviceStatisticsController) GetEntityList() {
|
|
|
|
|
|
}
|
|
|
|
|
|
+// @Title 获取字典列表
|
|
|
+// @Description get user by token
|
|
|
+// @Success 200 {object} map[string]interface{}
|
|
|
+// @router /dictlist [get]
|
|
|
+func (this *DeviceStatisticsController) GetDictList() {
|
|
|
+ dictList := make(map[string]interface{})
|
|
|
+ var unitorg []organize.Base_Organize
|
|
|
+ svc := organize.GetOrganizeService(utils.DBE)
|
|
|
+ //unitId := svc.GetMyUnitDepartmentId(this.User.DepartmentId)
|
|
|
+ //unitorg = svc.GetAllThirdChildByTopId(unitId, "")
|
|
|
|
|
|
+ where := "Category='unit'"
|
|
|
+ svc.GetEntities(&unitorg, where)
|
|
|
+ dictList["unitorg"] = unitorg
|
|
|
|
|
|
+ var datainfo DataInfo
|
|
|
+ datainfo.Items = dictList
|
|
|
+ this.Data["json"] = &datainfo
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
|
|
|
//获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间。
|
|
|
|
|
|
func GetFirstDateOfMonth(d time.Time) time.Time {
|
|
|
- d = d.AddDate(0, 0, -d.Day() + 1)
|
|
|
+ d = d.AddDate(0, 0, -d.Day()+1)
|
|
|
return GetZeroTime(d)
|
|
|
}
|
|
|
+
|
|
|
//获取传入的时间所在月份的最后一天,即某月最后一天的0点。如传入time.Now(), 返回当前月份的最后一天0点时间。
|
|
|
func GetLastDateOfMonth(d time.Time) time.Time {
|
|
|
return GetFirstDateOfMonth(d).AddDate(0, 1, -1)
|
|
|
}
|
|
|
+
|
|
|
//获取某一天的0点时间
|
|
|
func GetZeroTime(d time.Time) time.Time {
|
|
|
return time.Date(d.Year(), d.Month(), d.Day(), 0, 0, 0, 0, d.Location())
|
|
|
-}
|
|
|
+}
|