zhoufan лет назад: 8
Родитель
Сommit
bdd5a0ca5d

+ 77 - 16
CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderController.cs

@@ -1630,17 +1630,35 @@ namespace CallCenterApi.Interface.Controllers.workorder
1630 1630
             {
1631 1631
                 sql += " and F_CreateUser = '" + userModel.F_UserCode + "' ";
1632 1632
             }
1633
+            else if (strusercode.Trim() != "" && strusercode != "undefined")
1634
+            {
1635
+                sql += " and F_CreateUser = '" + strusercode + "' ";
1636
+            }
1633 1637
 
1634 1638
 
1635
-            sql += " and F_WorkOrderId in (select F_WorkOrderId  from T_Bus_AssignedInfo where F_State=1 and F_IsDelete=0 and F_LimitTime<getdate() and isnull(F_FeedbackTime,'')='' ";
1639
+            sql += " and ( F_WorkOrderId in (select F_WorkOrderId  from T_Bus_AssignedInfo where F_State=1 and F_IsDelete=0 and F_LimitTime<getdate() and isnull(F_FeedbackTime,'')='' and F_IsSure in (0,1) ";
1636 1640
 
1637 1641
             if (userModel.F_RoleCode == "WLDW")
1638 1642
             {
1639
-                //sql += " and ( F_MainDeptId = '" + userModel.F_DeptId + "' or ','+F_OtherDeptIds+',' like '%," + userModel.F_DeptId + ",%' )";
1640 1643
                 sql += " and  F_MainDeptId = '" + userModel.F_DeptId + "' ";
1641 1644
             }
1645
+            else if (deptid != 0)
1646
+            {
1647
+                sql += " and  F_MainDeptId = '" + deptid + "' ";
1648
+            }
1649
+
1650
+            sql += ") or F_WorkOrderId in (select F_WorkOrderId from T_Bus_AssignedItemInfo where F_State=1 and F_IsDelete=0 and F_LimitTime<getdate() and ISNULL(F_FeedbackTime, '')='' ";
1651
+
1652
+            if (userModel.F_RoleCode == "WLDW")
1653
+            {
1654
+                sql += " and  F_DeptId = '" + userModel.F_DeptId + "' ";
1655
+            }
1656
+            else if (deptid != 0)
1657
+            {
1658
+                sql += " and  F_DeptId = '" + deptid + "' ";
1659
+            }
1642 1660
 
1643
-            sql += ") ";
1661
+            sql += "))";
1644 1662
 
1645 1663
             if (strstate.Trim() != "" && strstate != "undefined")
1646 1664
             {
@@ -1666,10 +1684,6 @@ namespace CallCenterApi.Interface.Controllers.workorder
1666 1684
             {
1667 1685
                 sql += " and (F_ComTitle like '%" + strkey + "%' or F_ComContent like '%" + strkey + "%') ";
1668 1686
             }
1669
-            if (strusercode.Trim() != "" && strusercode != "undefined")
1670
-            {
1671
-                sql += " and F_CreateUser = '" + strusercode + "' ";
1672
-            }
1673 1687
 
1674 1688
             if (source != 0)
1675 1689
             {
@@ -1695,11 +1709,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
1695 1709
             {
1696 1710
                 sql += " and F_SourceArea = '" + sourcearea + "' ";
1697 1711
             }
1698
-            if (deptid != 0)
1699
-            {
1700
-                string sqlwhere = "select F_WorkOrderID from T_Bus_AssignedInfo where F_MainDeptId = '" + deptid + "' and F_IsSure in (0,1) and F_State=1 and F_IsDelete=0 ";
1701
-                sql += " and F_WorkOrderID in(" + sqlwhere + ")";
1702
-            }
1712
+
1703 1713
             if (strstarttime.Trim() != "" && strstarttime != "undefined")
1704 1714
             {
1705 1715
                 sql += " and datediff(day,F_CreateTime,'" + strstarttime + "')<=0 ";
@@ -1719,8 +1729,7 @@ namespace CallCenterApi.Interface.Controllers.workorder
1719 1729
                 pagesize = Convert.ToInt32(strpagesize);
1720 1730
             }
1721 1731
 
1722
-            string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,"
1723
-                    + "dbo.GetDictionaryName(F_InfoSource) as SourceName,dbo.GetWorkOrderAssign(F_WorkOrderId) as DeptName ";
1732
+            string cols = "*,dbo.GetUserName(F_CreateUser) as UserName,dbo.GetDictionaryName(F_InfoType) as TypeName,dbo.GetDictionaryName(F_InfoSource) as SourceName ";
1724 1733
 
1725 1734
             if (isdc > 0)
1726 1735
             {
@@ -1749,12 +1758,64 @@ namespace CallCenterApi.Interface.Controllers.workorder
1749 1758
                 out recordCount);
1750 1759
 
1751 1760
             #region 声音文件
1761
+            dt.Columns.Add("DeptName", typeof(string));//交办单位
1762
+            dt.Columns.Add("OtherDeptName", typeof(string));//协办单位
1763
+            dt.Columns.Add("OverState", typeof(string));//超时状态
1764
+            dt.Columns.Add("LimitTime", typeof(string));//限制时间
1765
+            dt.Columns.Add("GapTime", typeof(string));//时间差
1752 1766
             dt.Columns.Add("FilePath", typeof(string));
1753 1767
             dt.Columns.Add("Buttons", typeof(object));
1754 1768
             var configly = configBll.GetModelList(" F_ParamCode='PlayLeaveVoice' ").FirstOrDefault();
1755 1769
             var config = configBll.GetModelList(" F_ParamCode='PlayPath' ").FirstOrDefault();
1770
+            var configcs = configBll.GetModelList(" F_ParamCode='CSYJ' ").FirstOrDefault();
1756 1771
             foreach (DataRow dr in dt.Rows)
1757 1772
             {
1773
+                //获取最新交办信息
1774
+                string iszbdw = "0";
1775
+                string sqljb = "SELECT TOP 1 * FROM T_Bus_AssignedInfo WHERE F_WorkOrderId='" + dr["F_WorkOrderId"].ToString() + "' and F_State=1 and F_IsDelete=0 and F_IsSure<>3 ORDER BY F_Id DESC";
1776
+                var dtjb = DbHelperSQL.Query(sqljb).Tables[0];
1777
+                if (dtjb.Rows.Count > 0)
1778
+                {
1779
+                    if (dtjb.Rows[0]["F_MainDeptId"].ToString() == userModel.F_DeptId.ToString()) { iszbdw = "1"; }
1780
+                    dr["DeptName"] = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + dtjb.Rows[0]["F_MainDeptId"].ToString() + "')");
1781
+                    if (dtjb.Rows[0]["F_OtherDeptIds"] != null && dtjb.Rows[0]["F_OtherDeptIds"].ToString() != "")
1782
+                    {
1783
+                        dr["OtherDeptName"] = DbHelperSQL.GetSingle(" select dbo.GetDeptNames('" + dtjb.Rows[0]["F_OtherDeptIds"].ToString() + "')");
1784
+                    }
1785
+
1786
+                    var lt = dtjb.Rows[0]["F_LimitTime"].ToString();//限制时间
1787
+                    dr["LimitTime"] = lt;
1788
+                    var state = dr["F_WorkState"].ToString();
1789
+                    if (state != "6" && state != "7" && state != "9")
1790
+                    {
1791
+                        var ltime = DateTime.Parse(lt);
1792
+                        TimeSpan ts = ltime.Subtract(DateTime.Now);
1793
+                        int tss = Int32.Parse(Math.Round(ts.TotalSeconds, 0).ToString());
1794
+                        if (tss < 0) { tss = -tss; }
1795
+                        string gshsj = DateTimeConvert.parseTimeSeconds(tss, 1);
1796
+                        if (ltime > DateTime.Now)
1797
+                        {
1798
+                            if (configcs != null)
1799
+                            {
1800
+                                int cs = Int32.Parse(configcs.F_ParamValue);
1801
+                                if (ts.TotalHours > cs)
1802
+                                {
1803
+                                    dr["OverState"] = 1;
1804
+                                }
1805
+                                else
1806
+                                {
1807
+                                    dr["OverState"] = 2;
1808
+                                }
1809
+                            }
1810
+                            dr["GapTime"] = "剩余" + gshsj;
1811
+                        }
1812
+                        else
1813
+                        {
1814
+                            dr["OverState"] = 3;
1815
+                            dr["GapTime"] = "超时" + gshsj;
1816
+                        }
1817
+                    }
1818
+                }
1758 1819
                 if (dr["F_LeaveRecordId"] != null && dr["F_LeaveRecordId"].ToString() != "")
1759 1820
                 {
1760 1821
                     dr["FilePath"] = GetLeavePath(dr["F_LeaveRecordId"].ToString(), config.F_ParamValue);
@@ -1763,9 +1824,9 @@ namespace CallCenterApi.Interface.Controllers.workorder
1763 1824
                 {
1764 1825
                     dr["FilePath"] = GetCallPath(dr["F_CallRecordId"].ToString(), config.F_ParamValue);
1765 1826
                 }
1827
+
1766 1828
                 List<ButtonGroup.button> btns = new List<ButtonGroup.button>();
1767
-                btns.Add(ButtonGroup.oversee());
1768
-                btns.Add(ButtonGroup.supervision());
1829
+                btns.Add(ButtonGroup.query());
1769 1830
                 dr["Buttons"] = btns;
1770 1831
             }
1771 1832
             #endregion