|
@@ -642,21 +642,22 @@ func (c *TaskController) Add() {
|
|
|
T_reporting := c.GetString("T_reporting")
|
|
|
T_delivery := c.GetString("T_delivery")
|
|
|
|
|
|
- T_project := c.GetString("T_project") // 项目 负责人UUID
|
|
|
- T_province := c.GetString("T_province") // 省
|
|
|
- T_city := c.GetString("T_city") // 市
|
|
|
- T_district := c.GetString("T_district") // 区
|
|
|
- T_province_code := c.GetString("T_province_code") // 省 code
|
|
|
- T_city_code := c.GetString("T_city_code") // 市 code
|
|
|
- T_district_code := c.GetString("T_district_code") // 区 code
|
|
|
- T_category := c.GetString("T_category") // 类别
|
|
|
- T_device_type := c.GetString("T_device_type") // 设备类型
|
|
|
- T_volume := c.GetString("T_volume") // 规格/容积
|
|
|
- T_verify_type := c.GetString("T_verify_type") // 验证类型
|
|
|
- T_subject_matter := c.GetString("T_subject_matter") // 标的物名称
|
|
|
- T_temp_range := c.GetString("T_temp_range") // 验证温度范围
|
|
|
- T_report_number := c.GetString("T_report_number") // 报告编号
|
|
|
- T_report_type := c.GetString("T_report_type") // 报告类型
|
|
|
+ T_project := c.GetString("T_project") // 项目 负责人UUID
|
|
|
+ T_province := c.GetString("T_province") // 省
|
|
|
+ T_city := c.GetString("T_city") // 市
|
|
|
+ T_district := c.GetString("T_district") // 区
|
|
|
+ T_province_code := c.GetString("T_province_code") // 省 code
|
|
|
+ T_city_code := c.GetString("T_city_code") // 市 code
|
|
|
+ T_district_code := c.GetString("T_district_code") // 区 code
|
|
|
+ T_category := c.GetString("T_category") // 类别
|
|
|
+ T_device_type := c.GetString("T_device_type") // 设备类型
|
|
|
+ T_volume := c.GetString("T_volume") // 规格/容积
|
|
|
+ T_verify_type := c.GetString("T_verify_type") // 验证类型
|
|
|
+ T_subject_matter := c.GetString("T_subject_matter") // 标的物名称
|
|
|
+ T_temp_range := c.GetString("T_temp_range") // 验证温度范围
|
|
|
+ T_report_number := c.GetString("T_report_number") // 报告编号
|
|
|
+ T_report_type := c.GetString("T_report_type") // 报告类型
|
|
|
+ T_device_quantity, _ := c.GetInt("T_device_quantity") // 终端数量
|
|
|
|
|
|
// 查询信息采集信息
|
|
|
infoCollection, is := InfoCollection.Read_InfoCollection(T_InfoCollection_id)
|
|
@@ -683,21 +684,22 @@ func (c *TaskController) Add() {
|
|
|
T_Show: 1,
|
|
|
T_State: 1,
|
|
|
|
|
|
- T_project: T_project,
|
|
|
- T_province: T_province,
|
|
|
- T_city: T_city,
|
|
|
- T_district: T_district,
|
|
|
- T_province_code: T_province_code,
|
|
|
- T_city_code: T_city_code,
|
|
|
- T_district_code: T_district_code,
|
|
|
- T_category: T_category,
|
|
|
- T_device_type: T_device_type,
|
|
|
- T_volume: T_volume,
|
|
|
- T_verify_type: T_verify_type,
|
|
|
- T_subject_matter: T_subject_matter,
|
|
|
- T_temp_range: T_temp_range,
|
|
|
- T_report_number: T_report_number,
|
|
|
- T_report_type: T_report_type,
|
|
|
+ T_project: T_project,
|
|
|
+ T_province: T_province,
|
|
|
+ T_city: T_city,
|
|
|
+ T_district: T_district,
|
|
|
+ T_province_code: T_province_code,
|
|
|
+ T_city_code: T_city_code,
|
|
|
+ T_district_code: T_district_code,
|
|
|
+ T_category: T_category,
|
|
|
+ T_device_type: T_device_type,
|
|
|
+ T_volume: T_volume,
|
|
|
+ T_verify_type: T_verify_type,
|
|
|
+ T_subject_matter: T_subject_matter,
|
|
|
+ T_temp_range: T_temp_range,
|
|
|
+ T_report_number: T_report_number,
|
|
|
+ T_report_type: T_report_type,
|
|
|
+ T_device_quantity: T_device_quantity,
|
|
|
}
|
|
|
if T_report_number != "/" {
|
|
|
_, exist := Task.Read_TaskbyT_report_number(T_report_number)
|
|
@@ -1025,21 +1027,22 @@ func (c *TaskController) Up() {
|
|
|
T_sn := c.GetString("T_sn") // T_sn
|
|
|
T_CalibrationExpirationTime := c.GetString("T_CalibrationExpirationTime") // 校准到期时间
|
|
|
|
|
|
- T_project := c.GetString("T_project") // 项目 负责人UUID
|
|
|
- T_province := c.GetString("T_province") // 省
|
|
|
- T_city := c.GetString("T_city") // 市
|
|
|
- T_district := c.GetString("T_district") // 区
|
|
|
- T_province_code := c.GetString("T_province_code") // 省 code
|
|
|
- T_city_code := c.GetString("T_city_code") // 市 code
|
|
|
- T_district_code := c.GetString("T_district_code") // 区 code
|
|
|
- T_category := c.GetString("T_category") // 类别
|
|
|
- T_device_type := c.GetString("T_device_type") // 设备类型
|
|
|
- T_volume := c.GetString("T_volume") // 规格/容积
|
|
|
- T_verify_type := c.GetString("T_verify_type") // 验证类型
|
|
|
- T_subject_matter := c.GetString("T_subject_matter") // 标的物名称
|
|
|
- T_temp_range := c.GetString("T_temp_range") // 验证温度范围
|
|
|
- T_report_number := c.GetString("T_report_number") // 报告编号
|
|
|
- T_report_type := c.GetString("T_report_type") // 报告编号
|
|
|
+ T_project := c.GetString("T_project") // 项目 负责人UUID
|
|
|
+ T_province := c.GetString("T_province") // 省
|
|
|
+ T_city := c.GetString("T_city") // 市
|
|
|
+ T_district := c.GetString("T_district") // 区
|
|
|
+ T_province_code := c.GetString("T_province_code") // 省 code
|
|
|
+ T_city_code := c.GetString("T_city_code") // 市 code
|
|
|
+ T_district_code := c.GetString("T_district_code") // 区 code
|
|
|
+ T_category := c.GetString("T_category") // 类别
|
|
|
+ T_device_type := c.GetString("T_device_type") // 设备类型
|
|
|
+ T_volume := c.GetString("T_volume") // 规格/容积
|
|
|
+ T_verify_type := c.GetString("T_verify_type") // 验证类型
|
|
|
+ T_subject_matter := c.GetString("T_subject_matter") // 标的物名称
|
|
|
+ T_temp_range := c.GetString("T_temp_range") // 验证温度范围
|
|
|
+ T_report_number := c.GetString("T_report_number") // 报告编号
|
|
|
+ T_report_type := c.GetString("T_report_type") // 报告编号
|
|
|
+ T_device_quantity, _ := c.GetInt("T_device_quantity") // 报告编号
|
|
|
|
|
|
T_task_id := c.GetString("T_task_id")
|
|
|
r, is := Task.Read_Task(T_task_id)
|
|
@@ -1049,7 +1052,7 @@ func (c *TaskController) Up() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if T_report_number != "/" {
|
|
|
+ if len(T_report_number) > 0 && T_report_number != "/" {
|
|
|
t, exist := Task.Read_TaskbyT_report_number(T_report_number)
|
|
|
if exist && r.T_task_id != t.T_task_id {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "报告编号已存在!"}
|
|
@@ -1353,6 +1356,10 @@ func (c *TaskController) Up() {
|
|
|
r.T_report_type = T_report_type
|
|
|
clos = append(clos, "T_report_type")
|
|
|
}
|
|
|
+ if T_device_quantity > 0 {
|
|
|
+ r.T_device_quantity = T_device_quantity
|
|
|
+ clos = append(clos, "T_device_quantity")
|
|
|
+ }
|
|
|
|
|
|
if !Task.Update_Task(r, clos...) {
|
|
|
c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改失败!"}
|
|
@@ -2601,20 +2608,21 @@ func (c *TaskController) Copy() {
|
|
|
T_Show: 1,
|
|
|
T_State: 1,
|
|
|
|
|
|
- T_project: r.T_project,
|
|
|
- T_province: r.T_province,
|
|
|
- T_city: r.T_city,
|
|
|
- T_district: r.T_district,
|
|
|
- T_province_code: r.T_province_code,
|
|
|
- T_city_code: r.T_city_code,
|
|
|
- T_district_code: r.T_district_code,
|
|
|
- T_category: r.T_category,
|
|
|
- T_device_type: r.T_device_type,
|
|
|
- T_volume: r.T_volume,
|
|
|
- T_verify_type: r.T_verify_type,
|
|
|
- T_subject_matter: r.T_subject_matter,
|
|
|
- T_temp_range: r.T_temp_range,
|
|
|
- T_report_type: r.T_report_type,
|
|
|
+ T_project: r.T_project,
|
|
|
+ T_province: r.T_province,
|
|
|
+ T_city: r.T_city,
|
|
|
+ T_district: r.T_district,
|
|
|
+ T_province_code: r.T_province_code,
|
|
|
+ T_city_code: r.T_city_code,
|
|
|
+ T_district_code: r.T_district_code,
|
|
|
+ T_category: r.T_category,
|
|
|
+ T_device_type: r.T_device_type,
|
|
|
+ T_volume: r.T_volume,
|
|
|
+ T_verify_type: r.T_verify_type,
|
|
|
+ T_subject_matter: r.T_subject_matter,
|
|
|
+ T_temp_range: r.T_temp_range,
|
|
|
+ T_report_type: r.T_report_type,
|
|
|
+ T_device_quantity: r.T_device_quantity,
|
|
|
}
|
|
|
var_.T_report_number, _ = Task.GenerateNextT_report_number(var_.T_device_type)
|
|
|
id, is := Task.Add_Task(var_)
|
|
@@ -2664,3 +2672,84 @@ func (c *TaskController) GenT_report_number() {
|
|
|
c.ServeJSON()
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// 自动填写布点
|
|
|
+func (c *TaskController) Auto_fill_deploy() {
|
|
|
+ // 验证登录 User_is, User_r
|
|
|
+ User_r, User_is := Account.Verification_Admin(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|
|
|
+ if !User_is {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 201, Msg: "请重新登录!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ T_task_id := c.GetString("T_task_id")
|
|
|
+ T_source, _ := c.GetInt("T_source")
|
|
|
+ task, is := Task.Read_Task(T_task_id)
|
|
|
+ if !is {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "Id 错误!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ verifyTemplate, is := VerifyTemplate.Read_VerifyTemplate(task.T_VerifyTemplate_id)
|
|
|
+ verifyTemplate_R := VerifyTemplate.VerifyTemplateToVerifyTemplate_R(verifyTemplate)
|
|
|
+
|
|
|
+ Map_List := VerifyTemplate.Read_VerifyTemplateMap_List_For_Data(task.T_VerifyTemplate_id, T_source, 0)
|
|
|
+ MapData := VerifyTemplate.Read_VerifyTemplateMapData_List(T_source, T_task_id, task.T_VerifyTemplate_id, Map_List)
|
|
|
+ T_deploy_list := verifyTemplate_R.T_deploy_list
|
|
|
+ //if len(T_deploy_list) == 0 {
|
|
|
+ // // 解析设备列表备注的布点
|
|
|
+ // deviceClassList := Device.Read_DeviceClassList_List_ByT_remark(task.T_class, "")
|
|
|
+ // for _, v := range deviceClassList {
|
|
|
+ // splitList := lib.SplitStringSeparator(v.T_remark, "|")
|
|
|
+ // for _, T_name := range splitList {
|
|
|
+ // T_deploy_list = append(T_deploy_list, VerifyTemplate.VerifyTemplateDeploy{T_name: T_name})
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+
|
|
|
+ // 循环查询布点
|
|
|
+ deployMap := make(map[string]string)
|
|
|
+ for _, deploy := range T_deploy_list {
|
|
|
+ deviceClassList := Device.Read_DeviceClassList_List_ByT_remark(task.T_class, deploy.T_name)
|
|
|
+ var snList []string
|
|
|
+ for _, v := range deviceClassList {
|
|
|
+ snList = append(snList, v.T_sn)
|
|
|
+ }
|
|
|
+ deployMap[deploy.T_name] = strings.Join(snList, "|")
|
|
|
+ }
|
|
|
+ MapDataList := make([]VerifyTemplate.VerifyTemplateMapData, 0)
|
|
|
+
|
|
|
+ for _, v := range MapData {
|
|
|
+ if snList, ok := deployMap[v.T_name]; ok {
|
|
|
+ val := VerifyTemplate.VerifyTemplateMapData{
|
|
|
+ T_source: v.T_source,
|
|
|
+ T_task_id: task.T_task_id,
|
|
|
+ T_VerifyTemplate_id: task.T_VerifyTemplate_id,
|
|
|
+ T_VerifyTemplateMap_id: v.T_VerifyTemplateMap_id,
|
|
|
+ T_Required: v.T_Required,
|
|
|
+ T_Construction: v.T_Construction,
|
|
|
+ T_flow_sort: v.T_flow_sort,
|
|
|
+ T_max_time: v.T_max_time,
|
|
|
+ T_min_time: v.T_min_time,
|
|
|
+
|
|
|
+ T_value: snList,
|
|
|
+ T_start_time: v.T_start_time,
|
|
|
+ }
|
|
|
+ MapDataList = append(MapDataList, val)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ids, is := VerifyTemplate.AddOrUpdate_VerifyTemplateMapData_ADD_History(MapDataList, T_source, User_r.T_uuid)
|
|
|
+ if !is {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "保存失败"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ System.Add_UserLogs_T(User_r.T_uuid, "验证模版标签数据", "自动填写", ids)
|
|
|
+
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: ids}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+}
|