Browse Source

螺杆泵节能

lining 6 years ago
parent
commit
a619ddc09d

+ 56 - 0
src/dashoo.cn/backend/api/business/limsreportscrewpump/limsreportscrewpump.go

@@ -0,0 +1,56 @@
+package limsreportscrewpump
+
+import "time"
+
+type LimsReportScrewPump struct {
+	Id                   int       `xorm:"not null pk autoincr INT(10)"`
+	EId                  int       `xorm:"comment('委托单ID') INT(10)"`
+	TaskBalanceId        int       `xorm:"comment('任务分配表ID') INT(10)"`
+	DataEntryId          int       `xorm:"comment('数据记录表ID') INT(10)"`
+	TestDepartId         int       `xorm:"comment('受检单位ID') INT(10)"`
+	PositionCheckId      int       `xorm:"comment('检测地点ID') INT(10)"`
+	TestDepart           string    `xorm:"comment('受检单位') VARCHAR(100)"`
+	PositionCheck        string    `xorm:"comment('检测地点') VARCHAR(100)"`
+	CheckDate            time.Time `xorm:"comment('监测日期') DATETIME"`
+	WellNumber           string    `xorm:"comment('井号') VARCHAR(10)"`
+	MotorModel           string    `xorm:"comment('电动机型号') VARCHAR(20)"`
+	MotorRatedPower      float64   `xorm:"comment('电动机额定功率') DECIMAL(10,2)"`
+	MotorRatedVoltage    float64   `xorm:"comment('电动机额定电压') DECIMAL(10,2)"`
+	MotorRatedCurrent    float64   `xorm:"comment('电动机额定电流') DECIMAL(10,2)"`
+	MotorRatedSpeed      float64   `xorm:"comment('电动机额定转速') DECIMAL(10,2)"`
+	MotorManufacturer    string    `xorm:"comment('电动机生产厂家') VARCHAR(50)"`
+	PumpModel            string    `xorm:"comment('螺杆泵型号') VARCHAR(20)"`
+	PumpDepth            float64   `xorm:"comment('泵深') DECIMAL(10,2)"`
+	PumpRatedVoltage     float64   `xorm:"comment('螺杆泵额定电压') DECIMAL(10,2)"`
+	PumpRatedCurrent     float64   `xorm:"comment('螺杆泵额定电流') DECIMAL(10,2)"`
+	PumpRatedSpeed       float64   `xorm:"comment('螺杆转数') DECIMAL(10,2)"`
+	PumpManufacturer     string    `xorm:"comment('螺杆泵生产厂家') VARCHAR(50)"`
+	AvgVoltage           float64   `xorm:"comment('平均电压') DECIMAL(10,2)"`
+	AvgCurrent           float64   `xorm:"comment('平均电流') DECIMAL(10,2)"`
+	AvgActivePower       float64   `xorm:"comment('平均有功功率') DECIMAL(10,2)"`
+	AvgReactivePower     float64   `xorm:"comment('平均无功功率') DECIMAL(10,2)"`
+	AvgPowerFactor       float64   `xorm:"comment('平均功率因数') DECIMAL(10,2)"`
+	BackPressure         float64   `xorm:"comment('回压') DECIMAL(10,2)"`
+	OilPressure          float64   `xorm:"comment('油压') DECIMAL(10,2)"`
+	CasingPressure       float64   `xorm:"comment('套压') DECIMAL(10,2)"`
+	ProducedFluidVolume  float64   `xorm:"comment('产液量') DECIMAL(10,2)"`
+	WaterContent         float64   `xorm:"comment('含水量') DECIMAL(10,2)"`
+	CrudeOilDensity      float64   `xorm:"comment('原油密度') DECIMAL(10,2)"`
+	WorkingFluidLevel    float64   `xorm:"comment('动液面') DECIMAL(10,2)"`
+	SuctionDepth         float64   `xorm:"comment('吸入口深度') DECIMAL(10,2)"`
+	StraightOrslope      string    `xorm:"comment('直/斜井') VARCHAR(50)"`
+	OilFieldType         string    `xorm:"comment('油田类型') VARCHAR(50)"`
+	Standard             string    `xorm:"comment('依据标准') VARCHAR(100)"`
+	MonitoringInstrument string    `xorm:"comment('监测使用仪器') VARCHAR(50)"`
+	Temperature          float64   `xorm:"comment('现场环境温度') DECIMAL(10,2)"`
+	Humidity             float64   `xorm:"comment('现场相对湿度') DECIMAL(10,2)"`
+	BeforeCheck          string    `xorm:"comment('仪器使用前检查') VARCHAR(20)"`
+	AfterCheck           string    `xorm:"comment('仪器使用后检查') VARCHAR(20)"`
+	Remark               string    `xorm:"comment('备注') VARCHAR(255)"`
+	CreateUserId         int       `xorm:"INT(11)"`
+	CreateOn             time.Time `xorm:"DATETIME"`
+	CreateBy             string    `xorm:"VARCHAR(50)"`
+	ModifiedOn           time.Time `xorm:"DATETIME"`
+	ModifiedUserId       int       `xorm:"INT(11)"`
+	ModifiedBy           string    `xorm:"VARCHAR(50)"`
+}

+ 17 - 0
src/dashoo.cn/backend/api/business/limsreportscrewpump/limsreportscrewpumpService.go

@@ -0,0 +1,17 @@
+package limsreportscrewpump
+
+import (
+	. "dashoo.cn/cellbank/backend/api/mydb"
+	"github.com/go-xorm/xorm"
+)
+
+type LimsReportScrewPumpService struct {
+	MyServiceBase
+}
+
+func GetLimsReportScrewPumpService(xormEngine *xorm.Engine) *LimsReportScrewPumpService {
+	s := new(LimsReportScrewPumpService)
+	s.DBE = xormEngine
+	return s
+}
+

+ 1 - 0
src/dashoo.cn/backend/api/controllers/base.go

@@ -234,6 +234,7 @@ var (
 	LimsReportPistonPumpUnitName             string = "LimsReportPistonPumpUnit" //柱塞泵机组液体输送系统节能监测原始记录
 	LimsReportMotorName                      string = "LimsReportMotor" // 电动机节能监测原始记录
 	LimsReportElecPumpWellName               string = "LimsReportElecPumpWell" // 电泵井节能监测原始数据记录表
+	LimsReportScrewPumpName                  string = "LimsReportScrewPump" //  螺杆泵节能监测原始数据记录表
 )
 
 //分页信息及数据

+ 629 - 0
src/dashoo.cn/backend/api/controllers/lims/limsreportscrewpump.go

@@ -0,0 +1,629 @@
+package lims
+
+import (
+"dashoo.cn/business/userRole"
+"dashoo.cn/backend/api/business/baseUser"
+"dashoo.cn/backend/api/business/limsreportscrewpump"
+. "dashoo.cn/backend/api/controllers"
+"dashoo.cn/utils"
+"encoding/json"
+"strings"
+"time"
+)
+
+type LimsReportScrewPumpController struct {
+	BaseController
+}
+
+// @Title 获取列表
+// @Description get user by token
+// @Success 200 {object} []limsreportscrewpump.LimsReportScrewPump
+// @router /list [get]
+func (this *LimsReportScrewPumpController) GetEntityList() {
+
+	//获取分页信息
+	page := this.GetPageInfoForm()
+	where := " 1=1 "
+	orderby := "Id"
+	asc := false
+	Order := this.GetString("Order")
+	Prop := this.GetString("Prop")
+	if Order != "" && Prop != "" {
+		orderby = Prop
+		if Order == "asc" {
+			asc = true
+		}
+	}
+	Id := this.GetString("Id")
+	EId := this.GetString("EId")
+	TaskBalanceId := this.GetString("TaskBalanceId")
+	DataEntryId := this.GetString("DataEntryId")
+	TestDepartId := this.GetString("TestDepartId")
+	PositionCheckId := this.GetString("PositionCheckId")
+	TestDepart := this.GetString("TestDepart")
+	PositionCheck := this.GetString("PositionCheck")
+	CheckDate := this.GetString("CheckDate")
+	WellNumber := this.GetString("WellNumber")
+	MotorModel := this.GetString("MotorModel")
+	MotorRatedPower := this.GetString("MotorRatedPower")
+	MotorRatedVoltage := this.GetString("MotorRatedVoltage")
+	MotorRatedCurrent := this.GetString("MotorRatedCurrent")
+	MotorRatedSpeed := this.GetString("MotorRatedSpeed")
+	MotorManufacturer := this.GetString("MotorManufacturer")
+	PumpModel := this.GetString("PumpModel")
+	PumpDepth := this.GetString("PumpDepth")
+	PumpRatedVoltage := this.GetString("PumpRatedVoltage")
+	PumpRatedCurrent := this.GetString("PumpRatedCurrent")
+	PumpRatedSpeed := this.GetString("PumpRatedSpeed")
+	PumpManufacturer := this.GetString("PumpManufacturer")
+	AvgVoltage := this.GetString("AvgVoltage")
+	AvgCurrent := this.GetString("AvgCurrent")
+	AvgActivePower := this.GetString("AvgActivePower")
+	AvgReactivePower := this.GetString("AvgReactivePower")
+	AvgPowerFactor := this.GetString("AvgPowerFactor")
+	BackPressure := this.GetString("BackPressure")
+	OilPressure := this.GetString("OilPressure")
+	CasingPressure := this.GetString("CasingPressure")
+	ProducedFluidVolume := this.GetString("ProducedFluidVolume")
+	WaterContent := this.GetString("WaterContent")
+	CrudeOilDensity := this.GetString("CrudeOilDensity")
+	WorkingFluidLevel := this.GetString("WorkingFluidLevel")
+	SuctionDepth := this.GetString("SuctionDepth")
+	StraightOrslope := this.GetString("StraightOrslope")
+	OilFieldType := this.GetString("OilFieldType")
+	Standard := this.GetString("Standard")
+	MonitoringInstrument := this.GetString("MonitoringInstrument")
+	Temperature := this.GetString("Temperature")
+	Humidity := this.GetString("Humidity")
+	BeforeCheck := this.GetString("BeforeCheck")
+	AfterCheck := this.GetString("AfterCheck")
+	Remark := this.GetString("Remark")
+	CreateUserId := this.GetString("CreateUserId")
+	CreateOn := this.GetString("CreateOn")
+	CreateBy := this.GetString("CreateBy")
+	ModifiedOn := this.GetString("ModifiedOn")
+	ModifiedUserId := this.GetString("ModifiedUserId")
+	ModifiedBy := this.GetString("ModifiedBy")
+
+	if Id != "" {
+		where = where + " and Id like '%" + Id + "%'"
+	}
+
+
+	if EId != "" {
+		where = where + " and EId like '%" + EId + "%'"
+	}
+
+
+	if TaskBalanceId != "" {
+		where = where + " and TaskBalanceId like '%" + TaskBalanceId + "%'"
+	}
+
+
+	if DataEntryId != "" {
+		where = where + " and DataEntryId like '%" + DataEntryId + "%'"
+	}
+
+
+	if TestDepartId != "" {
+		where = where + " and TestDepartId like '%" + TestDepartId + "%'"
+	}
+
+
+	if PositionCheckId != "" {
+		where = where + " and PositionCheckId like '%" + PositionCheckId + "%'"
+	}
+
+
+	if TestDepart != "" {
+		where = where + " and TestDepart like '%" + TestDepart + "%'"
+	}
+
+
+	if PositionCheck != "" {
+		where = where + " and PositionCheck like '%" + PositionCheck + "%'"
+	}
+
+
+	if CheckDate != "" {
+		where = where + " and CheckDate like '%" + CheckDate + "%'"
+	}
+
+
+	if WellNumber != "" {
+		where = where + " and WellNumber like '%" + WellNumber + "%'"
+	}
+
+
+	if MotorModel != "" {
+		where = where + " and MotorModel like '%" + MotorModel + "%'"
+	}
+
+
+	if MotorRatedPower != "" {
+		where = where + " and MotorRatedPower like '%" + MotorRatedPower + "%'"
+	}
+
+
+	if MotorRatedVoltage != "" {
+		where = where + " and MotorRatedVoltage like '%" + MotorRatedVoltage + "%'"
+	}
+
+
+	if MotorRatedCurrent != "" {
+		where = where + " and MotorRatedCurrent like '%" + MotorRatedCurrent + "%'"
+	}
+
+
+	if MotorRatedSpeed != "" {
+		where = where + " and MotorRatedSpeed like '%" + MotorRatedSpeed + "%'"
+	}
+
+
+	if MotorManufacturer != "" {
+		where = where + " and MotorManufacturer like '%" + MotorManufacturer + "%'"
+	}
+
+
+	if PumpModel != "" {
+		where = where + " and PumpModel like '%" + PumpModel + "%'"
+	}
+
+
+	if PumpDepth != "" {
+		where = where + " and PumpDepth like '%" + PumpDepth + "%'"
+	}
+
+
+	if PumpRatedVoltage != "" {
+		where = where + " and PumpRatedVoltage like '%" + PumpRatedVoltage + "%'"
+	}
+
+
+	if PumpRatedCurrent != "" {
+		where = where + " and PumpRatedCurrent like '%" + PumpRatedCurrent + "%'"
+	}
+
+
+	if PumpRatedSpeed != "" {
+		where = where + " and PumpRatedSpeed like '%" + PumpRatedSpeed + "%'"
+	}
+
+
+	if PumpManufacturer != "" {
+		where = where + " and PumpManufacturer like '%" + PumpManufacturer + "%'"
+	}
+
+
+	if AvgVoltage != "" {
+		where = where + " and AvgVoltage like '%" + AvgVoltage + "%'"
+	}
+
+
+	if AvgCurrent != "" {
+		where = where + " and AvgCurrent like '%" + AvgCurrent + "%'"
+	}
+
+
+	if AvgActivePower != "" {
+		where = where + " and AvgActivePower like '%" + AvgActivePower + "%'"
+	}
+
+
+	if AvgReactivePower != "" {
+		where = where + " and AvgReactivePower like '%" + AvgReactivePower + "%'"
+	}
+
+
+	if AvgPowerFactor != "" {
+		where = where + " and AvgPowerFactor like '%" + AvgPowerFactor + "%'"
+	}
+
+
+	if BackPressure != "" {
+		where = where + " and BackPressure like '%" + BackPressure + "%'"
+	}
+
+
+	if OilPressure != "" {
+		where = where + " and OilPressure like '%" + OilPressure + "%'"
+	}
+
+
+	if CasingPressure != "" {
+		where = where + " and CasingPressure like '%" + CasingPressure + "%'"
+	}
+
+
+	if ProducedFluidVolume != "" {
+		where = where + " and ProducedFluidVolume like '%" + ProducedFluidVolume + "%'"
+	}
+
+
+	if WaterContent != "" {
+		where = where + " and WaterContent like '%" + WaterContent + "%'"
+	}
+
+
+	if CrudeOilDensity != "" {
+		where = where + " and CrudeOilDensity like '%" + CrudeOilDensity + "%'"
+	}
+
+
+	if WorkingFluidLevel != "" {
+		where = where + " and WorkingFluidLevel like '%" + WorkingFluidLevel + "%'"
+	}
+
+
+	if SuctionDepth != "" {
+		where = where + " and SuctionDepth like '%" + SuctionDepth + "%'"
+	}
+
+
+	if StraightOrslope != "" {
+		where = where + " and StraightOrslope like '%" + StraightOrslope + "%'"
+	}
+
+
+	if OilFieldType != "" {
+		where = where + " and OilFieldType like '%" + OilFieldType + "%'"
+	}
+
+
+	if Standard != "" {
+		where = where + " and Standard like '%" + Standard + "%'"
+	}
+
+
+	if MonitoringInstrument != "" {
+		where = where + " and MonitoringInstrument like '%" + MonitoringInstrument + "%'"
+	}
+
+
+	if Temperature != "" {
+		where = where + " and Temperature like '%" + Temperature + "%'"
+	}
+
+
+	if Humidity != "" {
+		where = where + " and Humidity like '%" + Humidity + "%'"
+	}
+
+
+	if BeforeCheck != "" {
+		where = where + " and BeforeCheck like '%" + BeforeCheck + "%'"
+	}
+
+
+	if AfterCheck != "" {
+		where = where + " and AfterCheck like '%" + AfterCheck + "%'"
+	}
+
+
+	if Remark != "" {
+		where = where + " and Remark like '%" + Remark + "%'"
+	}
+
+
+	if CreateUserId != "" {
+		where = where + " and CreateUserId like '%" + CreateUserId + "%'"
+	}
+
+
+	if CreateOn != "" {
+		where = where + " and CreateOn like '%" + CreateOn + "%'"
+	}
+
+
+	if CreateBy != "" {
+		where = where + " and CreateBy like '%" + CreateBy + "%'"
+	}
+
+
+	if ModifiedOn != "" {
+		where = where + " and ModifiedOn like '%" + ModifiedOn + "%'"
+	}
+
+
+	if ModifiedUserId != "" {
+		where = where + " and ModifiedUserId like '%" + ModifiedUserId + "%'"
+	}
+
+
+	if ModifiedBy != "" {
+		where = where + " and ModifiedBy like '%" + ModifiedBy + "%'"
+	}
+
+
+	if CreateOn != "" {
+		dates := strings.Split(CreateOn, ",")
+		if len(dates) == 2 {
+			minDate := dates[0]
+			maxDate := dates[1]
+			where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
+		}
+	}
+
+	svc := limsreportscrewpump.GetLimsReportScrewPumpService(utils.DBE)
+	var list []limsreportscrewpump.LimsReportScrewPump
+	total := svc.GetPagingEntitiesWithOrderBytbl(this.User.AccCode, page.CurrentPage, page.Size, orderby, asc, &list, where)
+	var datainfo DataInfo
+	datainfo.Items = list
+	datainfo.CurrentItemCount = total
+	datainfo.PageIndex = page.CurrentPage
+	datainfo.ItemsPerPage = page.Size
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}
+
+// @Title 获取字典列表
+// @Description get user by token
+// @Success 200 {object} map[string]interface{}
+// @router /dictlist [get]
+func (this *LimsReportScrewPumpController) GetDictList() {
+	dictList := make(map[string]interface{})
+	//dictSvc := items.GetItemsService(utils.DBE)
+	userSvc := baseUser.GetBaseUserService(utils.DBE)
+	//customerSvc := svccustomer.GetCustomerService(utils.DBE)
+	//dictList["WellNo"] = dictSvc.GetKeyValueItems("WellNo", this.User.AccCode)
+	var userEntity userRole.Base_User
+	userSvc.GetEntityById(this.User.Id, &userEntity)
+	dictList["Supervisers"] = userSvc.GetUserListByDepartmentId(this.User.AccCode, userEntity.Departmentid)
+
+	//var dictCustomer []svccustomer.Customer
+	//customerSvc.GetEntitysByWhere(this.User.AccCode + CustomerName, "", &dictCustomer)
+	//dictList["EntrustCorp"] = &dictCustomer
+
+	var datainfo DataInfo
+	datainfo.Items = dictList
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}
+
+// @Title 获取实体
+// @Description 获取实体
+// @Success 200 {object} limsreportscrewpump.LimsReportScrewPump
+// @router /get/:id [get]
+func (this *LimsReportScrewPumpController) GetEntity() {
+	Id := this.Ctx.Input.Param(":id")
+
+	var model limsreportscrewpump.LimsReportScrewPump
+	svc := limsreportscrewpump.GetLimsReportScrewPumpService(utils.DBE)
+	svc.GetEntityByIdBytbl(this.User.AccCode+LimsReportScrewPumpName, Id, &model)
+
+	this.Data["json"] = &model
+	this.ServeJSON()
+}
+
+// @Title 获取实体byDataEntryId
+// @Description 获取实体
+// @Success 200 {object} limsreportscrewpump.LimsReportScrewPump
+// @router /getEntityByDataEntryId/:id [get]
+func (this *LimsReportScrewPumpController) GetEntityByDataEntryId() {
+	Id := this.Ctx.Input.Param(":id")
+	where := "DataEntryId=" + Id
+	var model limsreportscrewpump.LimsReportScrewPump
+	svc := limsreportscrewpump.GetLimsReportScrewPumpService(utils.DBE)
+	//svc.GetEntityByIdBytbl(this.User.AccCode+LimsReportScrewPumpName, Id, &model)
+	has := svc.GetEntityByWhere(this.User.AccCode+LimsReportScrewPumpName, where, &model)
+	var data ErrorDataInfo
+	if (has) {
+		data.Code = 0
+	} else {
+		data.Code = -1
+	}
+	data.Item = model
+	this.Data["json"] = &data
+	this.ServeJSON()
+}
+
+// @Title 添加
+// @Description 新增
+// @Param 	body body limsreportscrewpump.LimsReportScrewPump
+// @Success	200	{object} controllers.Request
+// @router /add [post]
+func (this *LimsReportScrewPumpController) AddEntity() {
+	var model limsreportscrewpump.LimsReportScrewPump
+	var jsonBlob = this.Ctx.Input.RequestBody
+	svc := limsreportscrewpump.GetLimsReportScrewPumpService(utils.DBE)
+
+	json.Unmarshal(jsonBlob, &model)
+	model.CreateOn = time.Now()
+	model.CreateBy = this.User.Realname
+	model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+
+	_, err := svc.InsertEntityBytbl(this.User.AccCode+LimsReportScrewPumpName, &model)
+
+	var errinfo ErrorDataInfo
+	if err == nil {
+		//新增
+		errinfo.Message = "添加成功!"
+		errinfo.Code = 0
+		errinfo.Item = model.Id
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "添加失败!" + utils.AlertProcess(err.Error())
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+}
+
+// @Title 修改实体
+// @Description 修改实体
+// @Param 	body body limsreportscrewpump.LimsReportScrewPump
+// @Success	200	{object} controllers.Request
+// @router /update/:id [post]
+func (this *LimsReportScrewPumpController) UpdateEntity() {
+	id := this.Ctx.Input.Param(":id")
+	var errinfo ErrorInfo
+	if id == "" {
+		errinfo.Message = "操作失败!请求信息不完整"
+		errinfo.Code = -2
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+
+	var model limsreportscrewpump.LimsReportScrewPump
+	svc := limsreportscrewpump.GetLimsReportScrewPumpService(utils.DBE)
+
+	var jsonBlob = this.Ctx.Input.RequestBody
+	json.Unmarshal(jsonBlob, &model)
+	model.ModifiedOn = time.Now()
+	model.ModifiedBy = this.User.Realname
+	model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
+
+	cols := []string{
+
+		"Id",
+
+		"EId",
+
+		"TaskBalanceId",
+
+		"DataEntryId",
+
+		"TestDepartId",
+
+		"PositionCheckId",
+
+		"TestDepart",
+
+		"PositionCheck",
+
+		"CheckDate",
+
+		"WellNumber",
+
+		"MotorModel",
+
+		"MotorRatedPower",
+
+		"MotorRatedVoltage",
+
+		"MotorRatedCurrent",
+
+		"MotorRatedSpeed",
+
+		"MotorManufacturer",
+
+		"PumpModel",
+
+		"PumpDepth",
+
+		"PumpRatedVoltage",
+
+		"PumpRatedCurrent",
+
+		"PumpRatedSpeed",
+
+		"PumpManufacturer",
+
+		"AvgVoltage",
+
+		"AvgCurrent",
+
+		"AvgActivePower",
+
+		"AvgReactivePower",
+
+		"AvgPowerFactor",
+
+		"BackPressure",
+
+		"OilPressure",
+
+		"CasingPressure",
+
+		"ProducedFluidVolume",
+
+		"WaterContent",
+
+		"CrudeOilDensity",
+
+		"WorkingFluidLevel",
+
+		"SuctionDepth",
+
+		"StraightOrslope",
+
+		"OilFieldType",
+
+		"Standard",
+
+		"MonitoringInstrument",
+
+		"Temperature",
+
+		"Humidity",
+
+		"BeforeCheck",
+
+		"AfterCheck",
+
+		"Remark",
+
+		"CreateUserId",
+
+		"CreateOn",
+
+		"CreateBy",
+
+		"ModifiedOn",
+
+		"ModifiedUserId",
+
+		"ModifiedBy",
+
+
+	}
+	err := svc.UpdateEntityBytbl(this.User.AccCode+LimsReportScrewPumpName, id, &model, cols)
+	if err == nil {
+		errinfo.Message = "修改成功!"
+		errinfo.Code = 0
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "修改失败!" + utils.AlertProcess(err.Error())
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+}
+
+// @Title 删除单条信息
+// @Description
+// @Success 200 {object} ErrorInfo
+// @Failure 403 :id 为空
+// @router /delete/:Id [delete]
+func (this *LimsReportScrewPumpController) DeleteEntity() {
+	Id := this.Ctx.Input.Param(":Id")
+	var errinfo ErrorInfo
+	if Id == "" {
+		errinfo.Message = "操作失败!请求信息不完整"
+		errinfo.Code = -2
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+	var model limsreportscrewpump.LimsReportScrewPump
+	var entityempty limsreportscrewpump.LimsReportScrewPump
+	svc := limsreportscrewpump.GetLimsReportScrewPumpService(utils.DBE)
+	opdesc := "删除-" + Id
+	err := svc.DeleteOperationAndWriteLogBytbl(this.User.AccCode+LimsReportScrewPumpName, BaseOperationLogName, Id, &model, &entityempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "钻井日报")
+	if err == nil {
+		errinfo.Message = "删除成功"
+		errinfo.Code = 0
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "删除失败!" + utils.AlertProcess(err.Error())
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+}
+
+

+ 6 - 0
src/dashoo.cn/backend/api/routers/router.go

@@ -464,6 +464,12 @@ func init() {
 				&lims.LimsReportElecPumpWellController{},
 			),
 		),
+		// 螺杆泵节能监测原始数据记录表
+		beego.NSNamespace("/limsreportscrewpump",
+			beego.NSInclude(
+				&lims.LimsReportScrewPumpController{},
+			),
+		),
 	)
 	beego.AddNamespace(ns)
 }

+ 47 - 0
src/dashoo.cn/frontend_web/src/api/lims/limsreportscrewpump.js

@@ -0,0 +1,47 @@
+export default {
+  getList (CreateOn, params, myAxios) {
+    return myAxios({
+      url: '/limsreportscrewpump/list?CreateOn=' + CreateOn,
+      method: 'GET',
+      params: params
+    })
+  },
+  getDictList (myAxios) {
+    return myAxios({
+      url: '/limsreportscrewpump/dictlist/',
+      method: 'GET'
+    })
+  },
+  getEntity (entityId, myAxios) {
+    return myAxios({
+      url: '/limsreportscrewpump/get/' + entityId,
+      method: 'GET'
+    })
+  },
+  getEntityByDataEntryId (entityId, myAxios) {
+    return myAxios({
+      url: '/limsreportscrewpump/getEntityByDataEntryId/' + entityId,
+      method: 'GET'
+    })
+  },
+  addEntity (formData, myAxios) {
+    return myAxios({
+      url: '/limsreportscrewpump/add',
+      method: 'post',
+      data: formData
+    })
+  },
+  updateEntity (entityId, formData, myAxios) {
+    return myAxios({
+      url: '/limsreportscrewpump/update/' + entityId,
+      method: 'post',
+      data: formData
+    })
+  },
+  deleteEntity (entityId, myAxios) {
+    return myAxios({
+      url: '/limsreportscrewpump/delete/' + entityId,
+      method: 'delete'
+    })
+  }
+}

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/lims/reportelecpumpwell/_opera/operation.vue

@@ -420,7 +420,7 @@
         }).catch(err => {
           console.error(err)
         })
-      },
+      }
 
     }
   }

+ 107 - 144
src/dashoo.cn/frontend_web/src/pages/lims/reportscrewpump/_opera/operation.vue

@@ -55,8 +55,7 @@
               </el-col>
               <el-col :span="12">
                 <el-form-item label="额定功率"
-                              prop="MotorRatedPower"
-                              :rules="[ { type: 'number', message: '必须为数字'}]">
+                              prop="MotorRatedPower">
                   <el-input v-model.number="formData.MotorRatedPower" placeholder="请输入" style="width: 100%">
                     <template slot="append">kW</template>
                   </el-input>
@@ -64,27 +63,24 @@
               </el-col>
               <el-col :span="12">
                 <el-form-item label="额定电流"
-                              prop="MotorRatedCurrent"
-                              :rules="[ { type: 'number', message: '必须为数字'}]">
-                  <el-input v-model.number="formData.MotorRatedCurrent" placeholder="请输入" style="width: 100%">
+                              prop="MotorRatedCurrent">
+                  <el-input type="number" step="0.01" v-model.number="formData.MotorRatedCurrent" placeholder="请输入" style="width: 100%">
                     <template slot="append">A</template>
                   </el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
                 <el-form-item label="额定电压"
-                              prop="MotorRatedVoltage"
-                              :rules="[ { type: 'number', message: '必须为数字'}]">
-                  <el-input v-model.number="formData.MotorRatedVoltage" placeholder="请输入" style="width: 100%">
+                              prop="MotorRatedVoltage">
+                  <el-input type="number" step="0.01" v-model.number="formData.MotorRatedVoltage" placeholder="请输入" style="width: 100%">
                     <template slot="append">V</template>
                   </el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
                 <el-form-item label="额定转速"
-                              prop="MotorRatedSpeed"
-                              :rules="[ { type: 'number', message: '必须为数字'}]">
-                  <el-input v-model.number="formData.MotorRatedSpeed" placeholder="请输入" style="width: 100%">
+                              prop="MotorRatedSpeed">
+                  <el-input type="number" step="0.01" v-model.number="formData.MotorRatedSpeed" placeholder="请输入" style="width: 100%">
                     <template slot="append">r/min</template>
                   </el-input>
                 </el-form-item>
@@ -108,36 +104,32 @@
               </el-col>
               <el-col :span="12">
                 <el-form-item label="额定电流"
-                              prop="PumpRatedCurrent"
-                              :rules="[ { type: 'number', message: '必须为数字'}]">
-                  <el-input v-model.number="formData.PumpRatedCurrent" placeholder="请输入" style="width: 100%">
+                              prop="PumpRatedCurrent">
+                  <el-input type="number" step="0.01" v-model.number="formData.PumpRatedCurrent" placeholder="请输入" style="width: 100%">
                     <template slot="append">A</template>
                   </el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
                 <el-form-item label="额定电压"
-                              prop="PumpRatedVoltage"
-                              :rules="[ { type: 'number', message: '必须为数字'}]">
-                  <el-input v-model.number="formData.PumpRatedVoltage" placeholder="请输入" style="width: 100%">
+                              prop="PumpRatedVoltage">
+                  <el-input type="number" step="0.01" v-model.number="formData.PumpRatedVoltage" placeholder="请输入" style="width: 100%">
                     <template slot="append">V</template>
                   </el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
                 <el-form-item label="泵深"
-                              prop="PumpDepth"
-                              :rules="[ { type: 'number', message: '必须为数字'}]">
-                  <el-input v-model.number="formData.PumpDepth" placeholder="请输入" style="width: 100%">
+                              prop="PumpDepth">
+                  <el-input type="number" step="0.01" v-model.number="formData.PumpDepth" placeholder="请输入" style="width: 100%">
                     <template slot="append">m</template>
                   </el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
                 <el-form-item label="螺杆转数"
-                              prop="PumpRatedSpeed"
-                              :rules="[ { type: 'number', message: '必须为数字'}]">
-                  <el-input v-model.number="formData.PumpRatedSpeed" placeholder="请输入" style="width: 100%">
+                              prop="PumpRatedSpeed">
+                  <el-input type="number" step="0.01" v-model.number="formData.PumpRatedSpeed" placeholder="请输入" style="width: 100%">
                     <template slot="append">r/min</template>
                   </el-input>
                 </el-form-item>
@@ -154,107 +146,95 @@
           <el-card>
             <el-col :span="6">
               <el-form-item label="平均运行电压"
-                            prop="AvgVoltage"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.AvgVoltage" placeholder="请输入" style="width: 100%">
+                            prop="AvgVoltage">
+                <el-input type="number" step="0.01" v-model.number="formData.AvgVoltage" placeholder="请输入" style="width: 100%">
                   <template slot="append">V</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
               <el-form-item label="平均运行电流"
-                            prop="AvgCurrent"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.AvgCurrent" placeholder="请输入" style="width: 100%">
+                            prop="AvgCurrent">
+                <el-input type="number" step="0.01" v-model.number="formData.AvgCurrent" placeholder="请输入" style="width: 100%">
                   <template slot="append">A</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
               <el-form-item label="平均有功功率"
-                            prop="AvgActivePower"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.AvgActivePower" placeholder="请输入" style="width: 100%">
+                            prop="AvgActivePower">
+                <el-input type="number" step="0.01" v-model.number="formData.AvgActivePower" placeholder="请输入" style="width: 100%">
                   <template slot="append">kW</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
               <el-form-item label="平均无功功率"
-                            prop="AvgReactivePower"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.AvgReactivePower" placeholder="请输入" style="width: 100%">
+                            prop="AvgReactivePower">
+                <el-input type="number" step="0.01" v-model.number="formData.AvgReactivePower" placeholder="请输入" style="width: 100%">
                   <template slot="append">kvar</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
               <el-form-item label="平均功率因数"
-                            prop="AvgPowerFactor"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.AvgPowerFactor" placeholder="请输入" style="width: 100%">
+                            prop="AvgPowerFactor">
+                <el-input type="number" step="0.01" v-model.number="formData.AvgPowerFactor" placeholder="请输入" style="width: 100%">
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
               <el-form-item label="油压"
-                            prop="OilPressure"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.OilPressure" placeholder="请输入" style="width: 100%">
+                            prop="OilPressure">
+                <el-input type="number" step="0.01" v-model.number="formData.OilPressure" placeholder="请输入" style="width: 100%">
                   <template slot="append">MPa</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
               <el-form-item label="套压"
-                            prop="CasingPressure"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.CasingPressure" placeholder="请输入" style="width: 100%">
+                            prop="CasingPressure">
+                <el-input type="number" step="0.01" v-model.number="formData.CasingPressure" placeholder="请输入" style="width: 100%">
                   <template slot="append">MPa</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
               <el-form-item label="产液量"
-                            prop="ProducedFluidVolume"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.ProducedFluidVolume" placeholder="请输入" style="width: 100%">
+                            prop="ProducedFluidVolume">
+                <el-input type="number" step="0.01" v-model.number="formData.ProducedFluidVolume" placeholder="请输入" style="width: 100%">
                   <template slot="append">t/d</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
               <el-form-item label="含水率"
-                            prop="WaterContent"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.WaterContent" placeholder="请输入" style="width: 100%">
+                            prop="WaterContent">
+                <el-input type="number" step="0.01" v-model.number="formData.WaterContent" placeholder="请输入" style="width: 100%">
                   <template slot="append">%</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
               <el-form-item label="原油密度"
-                            prop="CrudeOilDensity"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.CrudeOilDensity" placeholder="请输入" style="width: 100%">
+                            prop="CrudeOilDensity">
+                <el-input type="number" step="0.01" v-model.number="formData.CrudeOilDensity" placeholder="请输入" style="width: 100%">
                   <template slot="append">kg/m3</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
               <el-form-item label="动液面"
-                            prop="WorkingFluidLevel"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.WorkingFluidLevel" placeholder="请输入" style="width: 100%">
+                            prop="WorkingFluidLevel">
+                <el-input type="number" step="0.01" v-model.number="formData.WorkingFluidLevel" placeholder="请输入" style="width: 100%">
                   <template slot="append">m</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
               <el-form-item label="吸入口深度"
-                            prop="SuctionDepth"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.SuctionDepth" placeholder="请输入" style="width: 100%">
+                            prop="SuctionDepth">
+                <el-input type="number" step="0.01" v-model.number="formData.SuctionDepth" placeholder="请输入" style="width: 100%">
                   <template slot="append">m</template>
                 </el-input>
               </el-form-item>
@@ -285,18 +265,16 @@
             </el-col>
             <el-col :span="6">
               <el-form-item label="现场环境温度"
-                            prop="Temperature"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.trim="formData.Temperature" placeholder="请输入" style="width: 100%">
+                            prop="Temperature">
+                <el-input type="number" step="0.01" v-model.number="formData.Temperature" placeholder="请输入" style="width: 100%">
                   <template slot="append">℃</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
               <el-form-item label="现场相对湿度"
-                            prop="Humidity"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.trim="formData.Humidity" placeholder="请输入" style="width: 100%">
+                            prop="Humidity">
+                <el-input type="number" step="0.01" v-model.number="formData.Humidity" placeholder="请输入" style="width: 100%">
                   <template slot="append">%</template>
                 </el-input>
               </el-form-item>
@@ -334,6 +312,7 @@
   import {
     mapGetters
   } from 'vuex'
+  import api from '@/api/lims/limsreportscrewpump'
 
   export default {
     computed: {
@@ -344,6 +323,10 @@
     name: '',
     data () {
       return {
+        Id: '',
+        EId: '',
+        TaskBalanceId: '',
+        DataEntryId: '',
         formData: {
           Id: '',
           EId: '',
@@ -354,7 +337,7 @@
           TestDepart: '',
           PositionCheck: '',
           WellNumber: '',
-          CheckDate: '',
+          CheckDate: new Date(),
           MotorModel: '',
           MotorRatedPower: '',
           MotorRatedVoltage: '',
@@ -403,94 +386,74 @@
         }
       }
     },
+    created () {
+      // this.EId = this.$route.query.eid
+      // this.TaskBalanceId = this.$route.query.tbid
+      this.DataEntryId = 15// this.$route.query.deid
+      this.formData.DataEntryId = parseInt(this.DataEntryId)
+      this.initData()
+    },
     methods: {
       saveEntity () {
         this.$refs['formData'].validate((valid) => {
           if (valid) {
-            alert('submit!')
+            if (this.formData.Id > 0) {
+              this.updateEntity()
+            } else {
+              this.addEntity()
+            }
           } else {
-            console.log('error submit!!')
             return false
           }
         })
       },
-      numberCheck (str) {
-        switch (str) {
-          case 'TrafficTest1':
-            this.formData.TrafficTest1 = this.formData.TrafficTest1.replace(/[^0-9.-]/g, '')
-            break
-          case 'TrafficTest2':
-            this.formData.TrafficTest2 = this.formData.TrafficTest2.replace(/[^0-9.-]/g, '')
-            break
-          case 'TrafficTest3':
-            this.formData.TrafficTest3 = this.formData.TrafficTest3.replace(/[^0-9.-]/g, '')
-            break
-          case 'PumpSuction1':
-            this.formData.PumpSuction1 = this.formData.PumpSuction1.replace(/[^0-9.-]/g, '')
-            break
-          case 'PumpSuction2':
-            this.formData.PumpSuction2 = this.formData.PumpSuction2.replace(/[^0-9.-]/g, '')
-            break
-          case 'PumpSuction3':
-            this.formData.PumpSuction3 = this.formData.PumpSuction3.replace(/[^0-9.-]/g, '')
-            break
-          case 'PumpDischarge1':
-            this.formData.PumpDischarge1 = this.formData.PumpDischarge1.replace(/[^0-9.-]/g, '')
-            break
-          case 'PumpDischarge2':
-            this.formData.PumpDischarge2 = this.formData.PumpDischarge2.replace(/[^0-9.-]/g, '')
-            break
-          case 'PumpDischarge3':
-            this.formData.PumpDischarge3 = this.formData.PumpDischarge3.replace(/[^0-9.-]/g, '')
-            break
-          case 'ThrottlePressure1':
-            this.formData.ThrottlePressure1 = this.formData.ThrottlePressure1.replace(/[^0-9.-]/g, '')
-            break
-          case 'ThrottlePressure2':
-            this.formData.ThrottlePressure2 = this.formData.ThrottlePressure2.replace(/[^0-9.-]/g, '')
-            break
-          case 'ThrottlePressure3':
-            this.formData.ThrottlePressure3 = this.formData.ThrottlePressure3.replace(/[^0-9.-]/g, '')
-            break
-          case 'TestVoltage1':
-            this.formData.TestVoltage1 = this.formData.TestVoltage1.replace(/[^0-9.-]/g, '')
-            break
-          case 'TestVoltage2':
-            this.formData.TestVoltage2 = this.formData.TestVoltage2.replace(/[^0-9.-]/g, '')
-            break
-          case 'TestVoltage3':
-            this.formData.TestVoltage3 = this.formData.TestVoltage3.replace(/[^0-9.-]/g, '')
-            break
-          case 'TestCurrent1':
-            this.formData.TestCurrent1 = this.formData.TestCurrent1.replace(/[^0-9.-]/g, '')
-            break
-          case 'TestCurrent2':
-            this.formData.TestCurrent2 = this.formData.TestCurrent2.replace(/[^0-9.-]/g, '')
-            break
-          case 'TestCurrent3':
-            this.formData.TestCurrent3 = this.formData.TestCurrent3.replace(/[^0-9.-]/g, '')
-            break
-          case 'MotorPower1':
-            this.formData.MotorPower1 = this.formData.MotorPower1.replace(/[^0-9.-]/g, '')
-            break
-          case 'MotorPower2':
-            this.formData.MotorPower2 = this.formData.MotorPower2.replace(/[^0-9.-]/g, '')
-            break
-          case 'MotorPower3':
-            this.formData.MotorPower3 = this.formData.MotorPower3.replace(/[^0-9.-]/g, '')
-            break
-          case 'MotorFactor1':
-            this.formData.MotorFactor1 = this.formData.MotorFactor1.replace(/[^0-9.-]/g, '')
-            break
-          case 'MotorFactor2':
-            this.formData.MotorFactor2 = this.formData.MotorFactor2.replace(/[^0-9.-]/g, '')
-            break
-          case 'MotorFactor3':
-            this.formData.MotorFactor3 = this.formData.MotorFactor3.replace(/[^0-9.-]/g, '')
-            break
-        }
+      addEntity () {
+        api.addEntity(this.formData, this.$axios).then(res => {
+          if (res.data.code === 0) {
+            this.formData.Id = res.data.item
+            this.initData()
+            this.$message({
+              type: 'success',
+              message: res.data.message
+            })
+          } else {
+            this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
+        }).catch(err => {
+          console.error(err)
+        })
+      },
+      updateEntity () {
+        api.updateEntity(this.formData.Id, this.formData, this.$axios).then(res => {
+          if (res.data.code === 0) {
+            this.initData()
+            this.$message({
+              type: 'success',
+              message: res.data.message
+            })
+          } else {
+            this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
+        }).catch(err => {
+          console.error(err)
+        })
+      },
+      initData () {
+        api.getEntityByDataEntryId(this.formData.DataEntryId, this.$axios).then(res => {
+          if (res.data.code === 0) {
+            this.formData = res.data.item
+          } else {
+          }
+        }).catch(err => {
+          console.error(err)
+        })
       }
-
     }
   }
 </script>