Kaynağa Gözat

质检指标分类

duhongyu 5 yıl önce
ebeveyn
işleme
192afcf30c

+ 204 - 1
代码/TVShoppingCallCenter_ZLJ/Controllers/IndexCategory/IndexBaseController.cs

@@ -34,6 +34,14 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.IndexCategory
34 34
                 {
35 35
                     return Error("排序过大,请重新输入");
36 36
                 }
37
+            if (input.F_CategoryId<=0)
38
+            {
39
+                return Error("请选择指标分类");
40
+            }
41
+            if (input.F_Score <= 0)
42
+            {
43
+                return Error("请输入分值");
44
+            }
37 45
             string user = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
38 46
             input.F_CreateOn = DateTime.Now;
39 47
             input.F_CreateBy = user;
@@ -41,6 +49,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.IndexCategory
41 49
             var res = await _qc_indexbasereposytory.Add(input);
42 50
             if (res > 0)
43 51
             {
52
+                SetScoreByCategory((int )input.F_CategoryId, (int) input.F_Score, 0);
44 53
                 return Success("添加成功");
45 54
             }
46 55
             else
@@ -48,6 +57,200 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.IndexCategory
48 57
                 return Error("添加失败");
49 58
             }
50 59
         }
51
-     
60
+        /// <summary>
61
+        /// 修改指标
62
+        /// </summary>
63
+        [HttpPost("update")]
64
+        public async Task<IActionResult> UpdateAsync(T_QC_IndexBase input)
65
+        {
66
+            if (input.F_IndexId <=0)
67
+            {
68
+                return Error("请选择指标");
69
+            }
70
+            if (input.F_Sort > 100000)
71
+            {
72
+                return Error("排序过大,请重新输入");
73
+            }
74
+            if (input.F_CategoryId <= 0)
75
+            {
76
+                return Error("请选择指标分类");
77
+            }
78
+            if (input.F_Score <= 0)
79
+            {
80
+                return Error("请输入分值");
81
+            }
82
+            string user = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Sid).Value;
83
+            var model = await _qc_indexbasereposytory.GetSingle(x => x.F_IndexId  == input.F_IndexId);
84
+
85
+            if (model == null)
86
+                return Error("操作失败");
87
+            input.F_DeleteFlag = 0;
88
+            input.F_CreateBy = model.F_CreateBy;
89
+            input.F_CreateOn = model.F_CreateOn;
90
+            input.F_ModifyBy = user;
91
+            input.F_ModifyOn = DateTime .Now ;
92
+            var b = await _qc_indexbasereposytory.Update(input);
93
+            if (b)
94
+            {
95
+                try
96
+                {
97
+                    SetScoreByCategory((int)input.F_CategoryId, (int)input.F_Score, 1, (int)model.F_Score);
98
+                }
99
+                catch
100
+                {
101
+
102
+                }
103
+                return Success("修改成功");
104
+            }
105
+            return Error("修改失败");
106
+        }
107
+        [HttpPost("delete")]
108
+        public async Task<IActionResult> Remove(int id = 0)
109
+        {
110
+
111
+            var model = _qc_indexbasereposytory.GetSingle(x => x.F_CategoryId == id).Result;
112
+            if (model == null)
113
+                return Error("该指标不存在");
114
+            model.F_DeleteFlag = (int)EnumUserCountState.Delete;
115
+
116
+            bool n = _qc_indexbasereposytory.Update(model).Result;
117
+            if (n)
118
+            {
119
+                try
120
+                {
121
+                    SetScoreByCategory((int)model.F_CategoryId, (int)model.F_Score, 2);
122
+                }
123
+              catch
124
+                {
125
+
126
+                }
127
+                return Success("删除成功");
128
+            }
129
+               
130
+            else
131
+                return Error("删除失败");
132
+        }
133
+        /// <summary>
134
+        /// 获取指标列表
135
+        /// </summary>
136
+        /// <param name="keyword"></param>
137
+        /// <param name="pageindex"></param>
138
+        /// <param name="pagesize"></param>
139
+        /// <returns></returns>
140
+        [HttpGet("getlist")]
141
+        public async Task<IActionResult> GetListMark(string keyword, int ParentId = -1, int smstype = -1, int isread = -1, int pageindex = 0, int pagesize = 0)
142
+        {
143
+            // string user = "8000";
144
+
145
+            List<IConditionalModel> conModels = new List<IConditionalModel>();
146
+            #region 条件筛选
147
+            conModels.Add(new ConditionalModel() { FieldName = "F_DeleteFlag", ConditionalType = ConditionalType.Equal, FieldValue = "0" });
148
+            if (!string.IsNullOrEmpty(keyword))
149
+            {
150
+                conModels.Add(new ConditionalCollections()
151
+                {
152
+                    ConditionalList = new List<KeyValuePair<WhereType, ConditionalModel>>()
153
+                    {
154
+                        new  KeyValuePair<WhereType, ConditionalModel>(WhereType.And, new ConditionalModel() { FieldName = "F_Title", ConditionalType = ConditionalType.Like, FieldValue = keyword }),
155
+                        new  KeyValuePair<WhereType, ConditionalModel>( WhereType.Or , new ConditionalModel() { FieldName = "F_Content", ConditionalType = ConditionalType.Like, FieldValue = keyword }),
156
+                         new  KeyValuePair<WhereType, ConditionalModel>( WhereType.Or , new ConditionalModel() { FieldName = "F_Remark", ConditionalType = ConditionalType.Like, FieldValue = keyword })
157
+                    }
158
+                });
159
+            }
160
+            if (ParentId > 0)
161
+            {
162
+                conModels.Add(new ConditionalModel() { FieldName = "F_ParentId", ConditionalType = ConditionalType.Like, FieldValue = ParentId.ToString() });
163
+            }
164
+
165
+
166
+            #endregion
167
+            int recordCount = 0;
168
+            if (pageindex > 0 && pagesize > 0)
169
+            {
170
+                var list = await _qc_indexbasereposytory.GetListByPage(conModels, new MyPageModel() { PageIndex = pageindex, PageSize = pagesize, PageCount = recordCount }, "  F_CreateOn  desc");
171
+                var obj = new
172
+                {
173
+                    state = "success",
174
+                    message = "成功",
175
+                    rows = list,
176
+                    total = list.Totals,
177
+                };
178
+                return Content(obj.ToJson());
179
+            }
180
+            else
181
+            {
182
+                var list = await _qc_indexbasereposytory.GetListALL(conModels, " F_CreateOn  desc");
183
+                var obj = new
184
+                {
185
+                    state = "success",
186
+                    message = "成功",
187
+                    rows = list,
188
+                    total = list.Count(),
189
+                };
190
+                return Content(obj.ToJson());
191
+            }
192
+        }
193
+        /// <summary>
194
+        /// 获取指标详情
195
+        /// </summary>
196
+        /// <param name="id">id</param>
197
+        /// <returns></returns>
198
+        [HttpGet("getdetails")]
199
+        public async Task<IActionResult> GetDetailsAsync(int id)
200
+        {
201
+            if (id <= 0)
202
+                return Error("参数错误");
203
+
204
+            var model = await _qc_indexbasereposytory.GetSingle(x => x.F_IndexId  == id);
205
+            if (model == null)
206
+            {
207
+                return Error("获取失败");
208
+            }
209
+            return Success("获取成功!", model);
210
+        }
211
+        //设置指标分数
212
+        private void SetScoreByCategory(int  categoryid, int source, int type=0,int F_Score=0)
213
+        {
214
+          
215
+            try
216
+            {
217
+                var model = _qc_indexcategoryreposytory.GetSingle(x => x.F_CategoryId == categoryid).Result;
218
+
219
+                if (model != null)
220
+                {
221
+                    if (type ==0)
222
+                    {
223
+                        int a = int.Parse(model.F_Expand1) + source;
224
+                        model.F_Expand1 += a.ToString();
225
+                    }
226
+                    else if (type == 1)
227
+                    {
228
+                        int a = int.Parse(model.F_Expand1)- F_Score + source;
229
+                        model.F_Expand1 += a.ToString();
230
+                    }
231
+                    else
232
+                    {
233
+                        int a = int.Parse(model.F_Expand1) -source;
234
+                        model.F_Expand1 += a.ToString();
235
+                    }
236
+                    int parentid = 0;
237
+                    if (model.F_ParentId!=null )
238
+                        parentid = (int )model.F_ParentId;
239
+                   
240
+                    int score = 0;
241
+                   
242
+                    model.F_Expand1 = score.ToString();
243
+                    if (_qc_indexcategoryreposytory.Update(model).Result )
244
+                    {
245
+                        if (parentid != 0)
246
+                        {
247
+                            SetScoreByCategory(parentid, source, type);
248
+                        }
249
+                    }
250
+                }
251
+            }
252
+            catch { }
253
+        }
254
+
52 255
     }
53 256
 }

+ 18 - 0
代码/TVShoppingCallCenter_ZLJ/Controllers/IndexCategory/IndexCategoryController.cs

@@ -135,5 +135,23 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.IndexCategory
135 135
                 return Content(obj.ToJson());
136 136
             }
137 137
         }
138
+        /// <summary>
139
+        /// 获取指标列表详情
140
+        /// </summary>
141
+        /// <param name="id">id</param>
142
+        /// <returns></returns>
143
+        [HttpGet("getdetails")]
144
+        public async Task<IActionResult> GetDetailsAsync(int id)
145
+        {
146
+            if (id <= 0)
147
+                return Error("参数错误");
148
+
149
+            var model = await _qc_indexcategoryreposytory.GetSingle(x => x.F_CategoryId  == id);
150
+            if (model == null)
151
+            {
152
+                return Error("获取失败");
153
+            }
154
+            return Success("获取成功!", model);
155
+        }
138 156
     }
139 157
 }

+ 2 - 2
代码/TVShoppingCallCenter_ZLJ/Controllers/InternalMessages/InternalMessagesController.cs

@@ -135,7 +135,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.InternalMessages
135 135
             int recordCount = 0;
136 136
             if (pageindex > 0 && pagesize > 0)
137 137
             {
138
-                var list = await _sys_internalMessagesrepository.GetListByPage(conModels, new MyPageModel() { PageIndex = pageindex, PageSize = pagesize, PageCount = recordCount }, "  SMS_SendTime  desc") ;
138
+                var list = await _sys_internalMessagesrepository.GetListByPage(conModels, new MyPageModel() { PageIndex = pageindex, PageSize = pagesize, PageCount = recordCount }, "  SMS_Remindertime  desc") ;
139 139
                 var row = list!=null ? list.Rows.Where(x => (x.SMS_ReceivingType == 0 && x.SMS_Deptid == dept) || (x.SMS_ReceivingType == 1 && x.SMS_ReceiveUserCode == user)):null ;
140 140
                 var obj = new
141 141
                 {
@@ -148,7 +148,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.InternalMessages
148 148
             }
149 149
             else
150 150
             {
151
-                var list = await _sys_internalMessagesrepository.GetListALL(conModels, " SMS_SendTime  desc");
151
+                var list = await _sys_internalMessagesrepository.GetListALL(conModels, " SMS_Remindertime  desc");
152 152
                 var row = list!=null ? list.Where(x => (x.SMS_ReceivingType == 0 && x.SMS_Deptid == dept) || (x.SMS_ReceivingType == 1 && x.SMS_ReceiveUserCode == user)):null ;
153 153
                 var obj = new
154 154
                 {