#SingleInstance force ;单线程 FileEncoding, UTF-8 ;php pdo是utf-8的 FileInstall, 1.bmp, 1.bmp ;打电话的图标 FileInstall, 2.bmp, 2.bmp ;数据库配置信息 host = 135.230.71.1 api = http://%host%/sqlapi.php ;接口url oldtime = %A_TickCount% ;上次点击时间 ;检查连通性 if Not InStr(ping_info := ping(host),"正常") { MsgBox, 4112, 网络错误, % ping_info ExitApp } ;登陆界面 gui, login:add, text, x0 y0 w60 h20, 工号: gui, login:add, edit, x60 y0 w200 h20 vuser_id, gui, login:add, text, x0 y20 w60 h20, 姓名: gui, login:add, edit, x60 y20 w200 h20 vuser_name, gui, login:add, text, x0 y40 w60 h20, 语种: gui, login:add, DropDownList, x60 y40 w200 h60 vuser_lang, 汉语|英语 gui, login:add, button, x0 y60 w260 h20 glogin, 登陆 gui, login:show, , 坐席登陆 gui, login:+AlwaysOnTop Return login: Gui, login:Submit, NoHide if user_lang= { MsgBox, 4112, 错误, 未选择语种! Return } user_id := StrLen(user_id)=3 ? user_id : SubStr(user_id,1,3) ;只保留前三位 user_id := user_id "#" ;添加# ;检查工号是否在数据库内 if (get_1_result("SELECT count(*) FROM [Database1].[dbo].[用户表] where 工号='" user_id "'")>0) { gui, login:Destroy goto, show } Else { MsgBox, 4112, 错误, 没有此工号! } Return show: ;创建界面 Gui,main:Add,Text,x0 y3 w60 h12,当前任务: Gui,main:Font,Normal s8 c0x0 Bold,Verdana Gui,main:Add,Text,x60 y3 w260 h15 vtask_name, Gui,main:Font Gui,main:Add,Button,x320 y0 w40 h20 gchoose, 选择 Gui,main:Add,Text,x360 y3 w60 h12,任务信息: Gui,main:Font,Normal s8 Bold,Verdana Gui,main:Add,Text,x420 y3 w230 h15 vtask_info, Gui,main:Font Gui,main:Add,Text,x0 y23 w60 h12,联系电话: Gui,main:Font,Normal s9 c0x0 Bold,Verdana Gui,main:Add,Edit,x60 y20 w120 h20 ReadOnly 1 Border vphone, Gui,main:Font Gui,main:Add,Button,x180 y20 w50 h20 gcall,外呼 Gui,main:Add,Text,x230 y23 w60 h12,接通情况: Gui,main:Add,DropDownList,x290 y20 w200 vcalling_result, 通后挂断|无人接听|成功|关机|无法接通|少数民族|停机|用户考虑|空号|拒绝使用|老人小孩|不是机主 Gui,main:Add,Text,x0 y43 w60 h12,备注: Gui,main:Add,Edit,x60 y40 w430 h20 vnote, Gui,main:Add,ListView,x0 y60 w650 h108, 工号|姓名|外呼日期|业务类型|地州|语种|用户号码|接通情况|备注|质检结果|质检备注|质检人|质检时间|提交单位|提交日期|ID|LID|导入时间 Gui,main:Add,Button,x490 y20 w80 h40 gsubmit, 提交 Gui,main:Add,Button,x570 y20 w80 h40 gupdate, 修改 Gui,main:Show,w650 h170 , xx呼叫中心增值业务 Gui,main:+AlwaysOnTop Gui,main:Default Gosub, show_lv ;显示当日已拨打电话 Return submit: ;检查是否频繁提交 if newtime oldtime = %newtime% newtime = %A_TickCount% timediff := newtime-oldtime if timediff { gui, 3:Destroy gui, main:show ;更新 effect_row := get_rowcount("update [Database1].[dbo].[增值业务数据提交] set 接通情况='" e_calling_result "' where id='" e_id "'") } Return call: ;在拨打界面网页内直接输入号码并点击拨打 Clipboard = %phone% WinWait, 客服中心拨打界面 WinActivate, 客服中心拨打界面 error = 1 Loop, 1000 { ImageSearch, x, y, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, 1.bmp if !Errorlevel { x+=30 y+=5 MouseClick, Left, %x%, %y% loop, 20 { Send, {Delete}{BackSpace} } send, ^v error = 0 Break } Sleep, 50 } if error = 0 { Loop, 1000 { ImageSearch, x, y, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, 2.bmp if !Errorlevel { x+=10 y+=5 MouseClick, Left, %x%, %y% Break } Sleep, 50 } } Return show_lv: ;删除现有 LV_Delete() ;获取当日该工号外呼提交数据倒序前20项 result := get_result("select top 20 * from [Database1].[dbo].[增值业务数据提交] where 工号='" user_id "' and 外呼日期=cast(cast(getdate() as date) as nvarchar) and 接通情况 is not null order by id desc") ;按行分割 StringSplit, line, result, `n loop % line0 { ;赋值临时行 tmp_line = % line%A_index% if tmp_line ;不为空 { StringSplit, var, tmp_line, `, LV_Add("",var1,var2,var3,var4,var5,var6,var7,var8,var9,var10,var11,var12,var13,var14,var15,var16,var17,var18) } } ;自动调整列宽 LV_ModifyCol() Return choose: WinGetPos, x, y, , , xx呼叫中心增值业务 gui, main:Hide WinHide, xx呼叫中心增值业务 ;查询目标任务表中放行的目标客户表中的数据 result := get_result("SELECT [地区]+[外呼业务]+[语种]+cast([导入日期] as nvarchar) FROM [Database1].[dbo].[增值业务目标客户] where [地区]+[外呼业务]+[语种]+cast([导入日期] as nvarchar) in (SELECT [地区]+[外呼业务]+[语种]+cast([导入日期] as nvarchar) FROM [Database1].[dbo].[增值业务目标任务] where locked=0 and [语种]='" user_lang "') group by [地区]+[外呼业务]+[语种]+cast([导入日期] as nvarchar)") gui, 2:Destroy StringReplace, tasks, result, `n, |, All gui, 2:add, DropDownList, x0 y0 w300 h600 vctask, %tasks% gui, 2:add, Button, x300 y0 w40 h20 gsubchoose,确定 gui, 2:show, x%x% y%y% , 选择任务 Return subchoose: GuiControlGet, ctask gui, 2:Destroy gui, main:show GuiControl, main:, task_name, %ctask% ;显示任务信息,15间隔重复 SetTimer, show_task_info, 15000 oldtime = %A_TickCount% goto, get_task Return get_task: ;检查是否有该工号占有但是没有提交的数据 提交的数据会有sid if (get_1_result("SELECT count(*) FROM [Database1].[dbo].[增值业务目标客户] where [地区]+[外呼业务]+[语种]+cast([导入日期] as nvarchar)='" ctask "' and 工号='" user_id "' and sid is null") 0 { ;获取已占有数据 tmp_row := get_1_result("SELECT TOP 1 * FROM [Database1].[dbo].[增值业务目标客户] where [地区]+[外呼业务]+[语种]+cast([导入日期] as nvarchar)='" ctask "' and 工号='" user_id "' and sid is null") ;分割数据 StringSplit, tmp_var, tmp_row, `, area := tmp_var1 phone := tmp_var2 business := tmp_var3 id := tmp_var6 GuiControl, main:, phone, %phone% } Else { MsgBox, 4112, 提示, 当前任务已空! } Return show_task_info: GuiControl, main:, task_info, % "当前任务总量:" get_1_result("SELECT count(*) FROM [Database1].[dbo].[增值业务目标客户] where [地区]+[外呼业务]+[语种]+cast([导入日期] as nvarchar)='" ctask "'") Sleep, 2800 GuiControl, main:, task_info, % "当前任务剩余量:" get_1_result("SELECT count(*) FROM [Database1].[dbo].[增值业务目标客户] where [地区]+[外呼业务]+[语种]+cast([导入日期] as nvarchar)='" ctask "' and [工号] is null") Sleep, 2800 GuiControl, main:, task_info, % "您当日的外呼量:" get_1_result("select count(*) from [Database1].[dbo].[增值业务数据提交] where 工号='" user_id "' and 外呼日期=cast(getdate() as date) and 接通情况 is not null") Sleep, 2800 GuiControl, main:, task_info, % "您当日的外呼成功量:" get_1_result("select count(*) from [Database1].[dbo].[增值业务数据提交] where 工号='" user_id "' and 外呼日期=cast(getdate() as date) and 接通情况='成功' and (质检结果 is null or 质检结果='合格')") Sleep, 2800 GuiControl, main:, task_info, % "您当日的质检不合格量:" get_1_result("select count(*) from [Database1].[dbo].[增值业务数据提交] where 工号='" user_id "' and 外呼日期=cast(getdate() as date) and 接通情况='成功' and 质检结果='不合格'") Return ;ping检查网络函数 ping(ip){ RunWait, %ComSpec% /c ping -n 1 %ip% >%A_Temp%ahk_ping.tmp, , Hide FileRead, content, %A_Temp%ahk_ping.tmp StringReplace, content, content, `r, , All StringSplit, var, content, `n If content Contains 请求超时,Request timed out Return "请求超时" If content Contains 找不到主机,could not find host Return "找不到主机" If content Contains 无法访问目标主机,Destination host unreachable Return "无法访问目标主机" Else { time := RegExReplace(var3, "(来自|Reply from) d{1,3}.d{1,3}.d{1,3}.d{1,3}[s的回复|]*: (字节|bytes)=d{1,3} (时间|time)[=1) { clip := ClipboardAll Clipboard = %string% Transform, string, Unicode Clipboard := clip } StringLen, len, string Loop % len { SetFormat, IntegerFast, hex StringMid, out, string, %A_Index%, 1 hex := Asc(out) hex2 := hex StringReplace, hex, hex, 0x, , All SetFormat, IntegerFast, d hex2 := hex2 If (hex2==33 || (hex2>=39 && hex2 =48 && hex2=65 && hex2=97 && hex2