|
@@ -121,10 +121,48 @@ func GobalConfigRegistRouters() {
|
121
|
121
|
beego.Router("/api/changesettleopenconfig", &GobalConfigApiController{}, "Get:ChangeSettleOpenConfig")
|
122
|
122
|
|
123
|
123
|
beego.Router("/api/changegoodoutopen", &GobalConfigApiController{}, "Get:ChangeGoodOutOpen")
|
|
124
|
+
|
|
125
|
+ beego.Router("/api/schedule/config/commit", &GobalConfigApiController{}, "post:PostScheduleConfig")
|
|
126
|
+ beego.Router("/api/schedule/config/get", &GobalConfigApiController{}, "get:GetScheduleConfig")
|
124
|
127
|
}
|
125
|
128
|
|
126
|
129
|
//provinces, _ := service.GetDistrictsByUpid(0)21
|
127
|
130
|
|
|
131
|
+func (c *GobalConfigApiController) PostScheduleConfig() {
|
|
132
|
+ is_show_mode, _ := c.GetInt64("is_show_mode", 0)
|
|
133
|
+ is_show_machine, _ := c.GetInt64("is_show_machine", 0)
|
|
134
|
+ id, _ := c.GetInt64("id", 0)
|
|
135
|
+
|
|
136
|
+ config, _ := service.GetScheduleConfigById(id)
|
|
137
|
+ var err error
|
|
138
|
+ if config.ID == 0 {
|
|
139
|
+ config.IsShowMode = is_show_mode
|
|
140
|
+ config.IsShowMachine = is_show_machine
|
|
141
|
+ config.UserOrgId = c.GetAdminUserInfo().CurrentOrgId
|
|
142
|
+ config.Ctime = time.Now().Unix()
|
|
143
|
+ config.Mtime = time.Now().Unix()
|
|
144
|
+ config.Status = 1
|
|
145
|
+ err = service.CreateScheduleConfig(config)
|
|
146
|
+ } else {
|
|
147
|
+ config.IsShowMachine = is_show_machine
|
|
148
|
+ config.IsShowMode = is_show_mode
|
|
149
|
+ config.Mtime = time.Now().Unix()
|
|
150
|
+ err = service.SaveScheduleConfig(config)
|
|
151
|
+ }
|
|
152
|
+ if err == nil {
|
|
153
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
154
|
+ "config": config,
|
|
155
|
+ })
|
|
156
|
+ }
|
|
157
|
+}
|
|
158
|
+
|
|
159
|
+func (c *GobalConfigApiController) GetScheduleConfig() {
|
|
160
|
+ config, _ := service.GetScheduleConfigByOrgId(c.GetAdminUserInfo().CurrentOrgId)
|
|
161
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
162
|
+ "config": config,
|
|
163
|
+ })
|
|
164
|
+}
|
|
165
|
+
|
128
|
166
|
func (c *GobalConfigApiController) PostStockConfig() {
|
129
|
167
|
is_open, _ := c.GetInt64("is_open", 0)
|
130
|
168
|
adminUserInfo := c.GetAdminUserInfo()
|