| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 | 
							- package controllers
 
- import (
 
- 	"testbench/models/etc"
 
- 	"fmt"
 
- 	"wb/ctrl"
 
- 	"wb/om"
 
- 	"wb/st"
 
- 	"wb/ut"
 
- )
 
- type ERPController struct {
 
- 	ctrl.ItemController
 
- }
 
- func (this *ERPController) GetData() {
 
- 	types := this.GetString("types")
 
- 	sid := this.GetString("sid")
 
- 	name := this.GetString(etc.Col.Name)
 
- 	num := this.GetString("num")
 
- 	gsmodel := this.GetString("gsmodel")
 
- 	gsratedpower := this.GetString("gsratedpower")
 
- 	ratedrpm := this.GetString("ratedrpm")
 
- 	ratedvoltage := this.GetString("ratedvoltage")
 
- 	ratedfrequency := this.GetString("ratedfrequency")
 
- 	position := this.GetString("position")
 
- 	enum := this.GetString("enum")
 
- 	emodel := this.GetString("emodel")
 
- 	ebrand := this.GetString("ebrand")
 
- 	gnum := this.GetString("gnum")
 
- 	gmodel := this.GetString("gmodel")
 
- 	gbrand := this.GetString("gbrand")
 
- 	cnum := this.GetString("cnum")
 
- 	cmodel := this.GetString("cmodel")
 
- 	cbrand := this.GetString("cbrand")
 
- 	ymodel := this.GetString("ymodel")
 
- 	ynum := this.GetString("ynum")
 
- 	yproductiondate := this.GetString("yproductiondate")
 
- 	yexpiration := this.GetString("yexpiration")
 
- 	maintenance := this.GetString("maintenance")
 
- 	minformation := this.GetString("minformation")
 
- 	gsproductiondate := this.GetString("gsproductiondate")
 
- 	guaranteedate := this.GetString("guaranteedate")
 
- 	wptype := this.GetString("wptype")
 
- 	wpmodel := this.GetString("wpmodel")
 
- 	sprayernum := this.GetString("sprayernum")
 
- 	if types == "genset" {
 
- 		this.ItemGenSet(sid, name, num, gsmodel, gsratedpower, ratedrpm, ratedvoltage, ratedfrequency, position, enum, emodel, ebrand, gnum, gmodel, gbrand, cnum, cmodel, cbrand, ymodel, ynum, yproductiondate, yexpiration, maintenance, minformation, gsproductiondate, guaranteedate)
 
- 		this.SendZeroTableResult(st.Success)
 
- 	}
 
- 	this.ItemWpVehicle(sid, wptype, wpmodel, sprayernum, ymodel, ynum, yproductiondate, yexpiration, cmodel, maintenance, minformation, gsproductiondate, guaranteedate)
 
- 	this.SendZeroTableResult(st.Success)
 
- }
 
- func (this *ERPController) ItemGenSet(sid, name, num, gsmodel, gsratedpower, ratedrpm, ratedvoltage, ratedfrequency, position, enum, emodel, ebrand, gnum, gmodel, gbrand, cnum, cmodel, cbrand, ymodel, ynum, yproductiondate, yexpiration, maintenance, minformation, gsproductiondate, guaranteedate string) string {
 
- 	res, valueMap := om.Table(etc.Tbl.Genset).Get(om.Params{etc.Col.Sid: sid})
 
- 	genSetParam := om.Params{}
 
- 	sn := valueMap.GetString(etc.Col.Sn)
 
- 	if sn == "" {
 
- 		sn = ut.TUId()
 
- 	}
 
- 	fmt.Println(sid)
 
- 	genSetParam[etc.Col.Sn] = sn
 
- 	genSetParam[etc.Col.CreateTime] = ut.GetCurDbTime()
 
- 	genSetParam["sid"] = sid
 
- 	genSetParam["company"] = "2016091214413329"
 
- 	genSetParam["gsbrand"] = "山华"
 
- 	genSetParam["gsmanufacturer"] = "山东华力机电有限公司"
 
- 	genSetParam[etc.Col.Name] = name
 
- 	genSetParam["num"] = num
 
- 	genSetParam["gsmodel"] = gsmodel
 
- 	genSetParam["gsratedpower"] = gsratedpower
 
- 	genSetParam["ratedrpm"] = ratedrpm
 
- 	genSetParam["ratedvoltage"] = ratedvoltage
 
- 	genSetParam["ratedfrequency"] = ratedfrequency
 
- 	genSetParam["position"] = position
 
- 	genSetParam["enum"] = enum
 
- 	genSetParam["emodel"] = emodel
 
- 	genSetParam["ebrand"] = ebrand
 
- 	genSetParam["gnum"] = gnum
 
- 	genSetParam["gmodel"] = gmodel
 
- 	genSetParam["gbrand"] = gbrand
 
- 	genSetParam["cnum"] = cnum
 
- 	genSetParam["cmodel"] = cmodel
 
- 	genSetParam["cbrand"] = cbrand
 
- 	genSetParam["ymodel"] = ymodel
 
- 	genSetParam["ynum"] = ynum
 
- 	genSetParam["yproductiondate"] = yproductiondate
 
- 	genSetParam["yexpiration"] = yexpiration
 
- 	genSetParam["maintenance"] = maintenance
 
- 	genSetParam["minformation"] = minformation
 
- 	genSetParam["aftermarket"] = "刘明杰"
 
- 	genSetParam["ainformation"] = "0537-7169777"
 
- 	genSetParam["gsproductiondate"] = gsproductiondate
 
- 	genSetParam["guaranteedate"] = guaranteedate
 
- 	if res == st.Success {
 
- 		code, _ := om.Table(etc.Tbl.Genset).Update(genSetParam)
 
- 		return code
 
- 	}
 
- 	code, _ := om.Table(etc.Tbl.Genset).Add(genSetParam)
 
- 	return code
 
- }
 
- func (this *ERPController) ItemWpVehicle(sid, wptype, wpmodel, sprayernum, ymodel, ynum, yproductiondate, yexpiration, cmodel, maintenance, minformation, gsproductiondate, guaranteedate string) string {
 
- 	res, valueMap := om.Table(etc.Tbl.Wp).Get(om.Params{etc.Col.Sid: sid})
 
- 	wpParam := om.Params{}
 
- 	sn := valueMap.GetString(etc.Col.Sn)
 
- 	if sn == "" {
 
- 		sn = ut.TUId()
 
- 	}
 
- 	fmt.Println(sid)
 
- 	wpParam[etc.Col.Sn] = sn
 
- 	wpParam[etc.Col.Creater] = "20160101"
 
- 	wpParam[etc.Col.CreateTime] = ut.GetCurDbTime()
 
- 	wpParam["sid"] = sid
 
- 	wpParam["name"] = sid
 
- 	wpParam["company"] = "2016091214413329"
 
- 	wpParam["gsbrand"] = "山华"
 
- 	wpParam["wpcar"] = "无"
 
- 	wpParam["wpcarmodel"] = "无"
 
- 	wpParam["gmodel"] = "无"
 
- 	wpParam["wprange"] = "0"
 
- 	wpParam["gsratedpower"] = "0"
 
- 	wpParam["ratedvoltage"] = "0"
 
- 	wpParam["wpmanufacturer"] = "无"
 
- 	wpParam["gbrand"] = "无"
 
- 	wpParam["ebrand"] = "无"
 
- 	wpParam["emodel"] = "无"
 
- 	wpParam["wptype"] = wptype
 
- 	wpParam["wpmodel"] = wpmodel
 
- 	wpParam["sprayernum"] = sprayernum
 
- 	wpParam["ymodel"] = ymodel
 
- 	wpParam["ynum"] = ynum
 
- 	wpParam["yproductiondate"] = yproductiondate
 
- 	wpParam["yexpiration"] = yexpiration
 
- 	wpParam["cbrand"] = "无"
 
- 	wpParam["cmodel"] = cmodel
 
- 	wpParam["maintenance"] = maintenance
 
- 	wpParam["minformation"] = minformation
 
- 	wpParam["gsproductiondate"] = gsproductiondate
 
- 	wpParam["guaranteedate"] = guaranteedate
 
- 	wpParam["aftermarket"] = "刘明杰"
 
- 	wpParam["ainformation"] = "0537-7169777"
 
- 	if res == st.Success {
 
- 		code, _ := om.Table(etc.Tbl.Genset).Update(wpParam)
 
- 		return code
 
- 	}
 
- 	code, _ := om.Table(etc.Tbl.Wp).Add(wpParam)
 
- 	return code
 
- }
 
 
  |