GetDelicacies

来源:互联网 发布:bugzilla linux 下载 编辑:程序博客网 时间:2024/05/16 08:06

#cs ____________________________________

 Au3 版本:
 脚本作者:
 Email:
 QQ/TM:
 脚本版本:
 脚本功能:

#ce _______________脚本开始_________________

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$gui = GUICreate("GetDelicacies",650,580)
$tab = GUICtrlCreateTab(10, 10, 630, 400)
$tabit1 = GUICtrlCreateTabItem(" 食 天 下 ")
GUICtrlSetLimit(-1, 400)

Dim $box[100], $box1[100], $label[100], $input[100], $input1[100], $la[100], $transfer1, $transfer2
Dim $cai[100] = ["小鸡炖蘑菇","猪肉炖粉条","地三鲜","溜肥肠","酸菜小炒","东北乱炖","锅包肉","拌凉菜","红烧肘子"]
Dim $price[100] = ["15  刀/份","15  刀/份","10  刀/份","10  刀/份","10  刀/份","10  刀/份","10  刀/份","10  刀/份","10  刀/份"]
Dim $num[100] = ["1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"]

Dim $delicia[100][2] = [["小鸡炖蘑菇","15 刀/份"],["猪肉炖粉条","15 刀/份"],["地三鲜","10 刀/份"],["溜肥肠","10 刀/份"],["酸菜小炒","10 刀/份"],["东北乱炖","10 刀/份"],["锅包肉","10 刀/份"],["拌凉菜","10 刀/份"],["红烧肘子","30 刀/份"],["酸菜汆肉","18 刀/份"],["血肠","15 刀/份"]]

$fen = "份"
$j = 1
$row = 30
$colum = 35

For $i = 1 To 11
 $m = Mod($i, 3)
 $n = Mod($i, 2)
 
 $box1[$i - 1] = GUICtrlCreateCheckbox($delicia[$i - 1][0],$row, $colum, 75)
 $label[$i - 1] = GUICtrlCreateLabel($delicia[$i - 1][1],$row + 80, $colum + 4)
 $input1[$i - 1] = GUICtrlCreateInput($num[$i],$row + 135, $colum, 20)
 GUICtrlSetLimit(-1, 2)
 $la[$i - 1] = GUICtrlCreateLabel($fen,$row + 160, $colum + 4)
 
 If $m = 0 Then
  $row = 30
  $colum = 35 + 25 * $j
  $j = $j + 1
 ElseIf $m = 1 Then
  $row = 230
 ElseIf $m = 2 Then
  $row = 430
 EndIf
 
 If $n = 1 Then
  GUICtrlSetBkColor($box1[$i - 1], 0xaaff00)
  GUICtrlSetBkColor($input1[$i - 1], 0xeeff00)
 EndIf
Next

$mylist1 = GUICtrlCreateList("想吃你就点吧!", 10, 430, 461, 150)
GUICtrlSetLimit(-1, 200)


GUICtrlCreateLabel("米饭:",480,424,65,24)
GUICtrlSetFont(-1,20)
$rice1 = GUICtrlCreateInput("",550,420,40,30)
GUICtrlSetFont(-1,21)
GUICtrlSetLimit(-1, 2)
GUICtrlCreateLabel("桶",600,424,65,24)
GUICtrlSetFont(-1,20)

$button1 = GUICtrlCreateButton("确 认",500,460,60,30)
$button2 = GUICtrlCreateButton("重 选",580,460,60,30)

$total1 = GUICtrlCreateLabel("总计:",480,500,65,24)
GUICtrlSetFont($total1,20)
$money1 = GUICtrlCreateLabel("000元",560,500,85,30)
GUICtrlSetFont($money1,25)
GUICtrlSetColor($money1,0xff0000)

$transfer1 = GUICtrlCreateButton("提 交",500,540,60,30)
$close1 = GUICtrlCreateButton("关 闭",580,540,60,30)
GUICtrlSetFont($mylist1,20)

$tabit2 = GUICtrlCreateTabItem(" 品 人 生 ")

$j = 1
$row = 30
$colum = 35

For $i = 1 To 9
 $m = Mod($i, 3)
 $n = Mod($i, 2)
 
 $box[$i - 1] = GUICtrlCreateCheckbox($cai[$i - 1],$row, $colum, 75)
 $label[$i - 1] = GUICtrlCreateLabel($price[$i - 1],$row + 80, $colum + 4)
 $input[$i - 1] = GUICtrlCreateInput($num[$i],$row + 135, $colum, 20)
 GUICtrlSetLimit(-1, 2)
 $la[$i - 1] = GUICtrlCreateLabel($fen,$row + 160, $colum + 4)
 
 If $m = 0 Then
  $row = 30
  $colum = 35 + 25 * $j
  $j = $j + 1
 ElseIf $m = 1 Then
  $row = 230
 ElseIf $m = 2 Then
  $row = 430
 EndIf
 
 If $n = 0 Then
  GUICtrlSetBkColor($box[$i - 1], 0x00aa00)
  GUICtrlSetBkColor($input[$i - 1], 0xeeff00)
 EndIf
Next

$mylist2 = GUICtrlCreateList("想吃你就点吧!", 10, 430, 461, 150)
GUICtrlSetLimit(-1, 200)
GUICtrlSetFont($mylist2,20)

GUICtrlCreateLabel("米饭:",480,424,65,24)
GUICtrlSetFont(-1,20)
$rice2 = GUICtrlCreateInput("",550,420,40,30)
GUICtrlSetFont(-1,21)
GUICtrlSetLimit(-1, 2)
GUICtrlCreateLabel("桶",600,424,65,24)
GUICtrlSetFont(-1,20)

$button3 = GUICtrlCreateButton("确 认",500,460,60,30)
$button4 = GUICtrlCreateButton("重 选",580,460,60,30)

$total1 = GUICtrlCreateLabel("总计:",480,500,65,24)
GUICtrlSetFont($total1,20)
$money2 = GUICtrlCreateLabel("000元",560,500,85,30)
GUICtrlSetFont($money2,25)
GUICtrlSetColor($money2,0xff0000)

$transfer2 = GUICtrlCreateButton("提 交",500,540,60,30)
$close2 = GUICtrlCreateButton("关 闭",580,540,60,30)

GUISetState(@SW_SHOW)

Dim $get = ""
$ss = @ComputerName & "-" & @UserName
$msg = 0
While $msg <> $GUI_EVENT_CLOSE
 $msg = GUIGetMsg()

 Select
  Case $msg = $button1 Or $msg = $button3
   
   If $msg = $button1 Then
    $pri = 0
    GUICtrlSetData($mylist1, "")
    StringRegExp(GUICtrlRead($rice1),'[^0-9]{1,2}',4)
    ;判断米饭有没有
    If @error == 0 Then
     MsgBox(0,"ShoeMe","让你写几桶饭,你自己看,你写的 " & GUICtrlRead($rice1) & " 这是啥啊?")
     ContinueLoop
    ElseIf StringLen(GUICtrlRead($rice1)) = 0 Then
     MsgBox(0,"ShowMe","人是铁,饭是钢,不来几桶,也得几筐" & @CR & "大丈夫 ,饭量一定要大,选几桶饭吧。")
     ContinueLoop
    Else
     $pri = GUICtrlRead($rice1)
    EndIf
    ;选择多少菜
    For $i = 1 To 11
     If BitAND(GUICtrlRead($box1[$i - 1]), $GUI_CHECKED) = $GUI_CHECKED Then
      $ss = $ss & "-" & GUICtrlRead($input1[$i - 1]) & "*" & $i
      
      $array = StringRegExp(GUICtrlRead($input1[$i - 1]),'[^0-9]{1,2}',4)
      If @error == 0 Then
       MsgBox(0,"ShowMe","你真的确认预定了 " & GUICtrlRead($input1[$i - 1]) & " 份" & $delicia[$i - 1][0] & @CRLF & "请你将 " & $delicia[$i - 1][0] & " 修改一下,到底要几份?")
       ExitLoop
      Else
       $money = StringSplit($delicia[$i - 1][1]," ")
       $pri = $pri + (GUICtrlRead($input1[$i - 1]) * $money[1])
       
      EndIf
      
      GUICtrlSetData($mylist1, $delicia[$i - 1][0] & "--" & GUICtrlRead($input1[$i - 1]) & "份" & "--" & $delicia[$i - 1][1])
      
     EndIf
    Next
    ;一个菜都不选,是不是脑子有问题啊?
    If StringCompare($ss, @ComputerName) = 0 Then
     MsgBox(0,"ShowMe","你不能不吃菜啊!注意营养啊!")
     ContinueLoop
    EndIf
    ;总要知道花了多少钱啊
    GUICtrlSetData($money1, $pri & "元")
    ;主要传输几个菜几个饭啊
    $get = "first-" & $ss & "#mi-" & GUICtrlRead($rice1) & "#price-" & $pri
    $ss = @ComputerName & "-" & @UserName
   ElseIf $msg = $button3 Then
    $pri = 0
    GUICtrlSetData($mylist2, "")
    $array = StringRegExp(GUICtrlRead($rice2),'[^0-9]{1,2}',4)
    ;判断米饭有没有
    If @error == 0 Then
     MsgBox(0,"ShoeMe","让你写几桶饭,你自己看,你写的 " & GUICtrlRead($rice2) & " 这是啥啊?")
     ContinueLoop
    ElseIf StringLen(GUICtrlRead($rice2)) = 0 Then
     MsgBox(0,"ShowMe","人是铁,饭是钢,不来几桶,也得几筐" & @CR & "大丈夫 ,饭量一定要大,选几桶饭吧。")
     ContinueLoop
    Else
     $pri = GUICtrlRead($rice2)
    EndIf
    ;选择多少菜
    For $i = 1 To 9
     If BitAND(GUICtrlRead($box[$i - 1]), $GUI_CHECKED) = $GUI_CHECKED Then
      $ss = $ss & "-" & GUICtrlRead($input[$i - 1]) & "*" & $i
      $array = StringRegExp(GUICtrlRead($input[$i - 1]),'[^0-9]{1,2}',4)
      If @error == 0 Then
       MsgBox(0,"ShowMe","你真的确认预定了 " & GUICtrlRead($input[$i - 1]) & " 份" & $cai[$i - 1] & @CRLF & "请你将 " & $cai[$i - 1] & " 修改一下,到底要几份?")
       ExitLoop
      Else
       $money = StringSplit($price[$i - 1]," ")
       $pri = $pri + (GUICtrlRead($input[$i - 1]) * $money[1])
      EndIf
      
      GUICtrlSetData($mylist2, $cai[$i - 1] & "--" & GUICtrlRead($input[$i - 1]) & "份" & "--" & $price[$i - 1])
      
     EndIf
    Next
    
    If StringCompare($ss, @ComputerName) = 0 Then
     MsgBox(0,"ShowMe","你不能不吃菜啊!注意营养啊!")
     ContinueLoop
    EndIf
    
    GUICtrlSetData($money2, $pri & "元")
    ;提取方法
    ;$get = allDelica
    $get = "second-" & $ss & "#mi-" & GUICtrlRead($rice2) & "-price-" & $pri
    $ss = @ComputerName & "-" & @UserName
   EndIf
  Case $msg = $button2 Or $msg = $button4
   If $msg = $button2 Then
    GUICtrlSetData($mylist1, "")
    GUICtrlSetData($money1, "000" & "元")
   ElseIf $msg = $button4 Then
    GUICtrlSetData($mylist2, "")
    GUICtrlSetData($money2, "000" & "元")
   EndIf
  Case $msg = $transfer1 Or $msg = $transfer2
       $g_IP = "127.0.0.1"
    ; 开始 TCP 服务
    ;==============================================
    TCPStartup()
    ; 创建一个套接字(socket)监听
    ;==============================================
    $MainSocket = TCPConnect($g_IP, 6677)
    If $MainSocket = -1 Then
     MsgBox(0,"ShowMe","请确认连接服务器正常!")
     TCPShutdown()
     ContinueLoop
    EndIf
    If StringLen($get) = 0 Then
     MsgBox(0,"ShowMe","请点击【确认】按钮,并确认选择了你想吃的东东!")
     $get = ""
     ContinueLoop
    EndIf
    
    TCPSend($MainSocket, "cmd[echo " & $get & "> D:\Gullton\" & @ComputerName & ".cai.log]")
    TCPSend($MainSocket, "cmd[D:\Gullton\]")
    
    TCPCloseSocket($MainSocket)
    TCPShutdown()
    $get = ""
  Case $msg = $close1 Or $msg = $close2
   Exit
 EndSelect
WEnd


;Func allDelica($rest,$user,$caiyao,$caijia,$mi)
; Return
;EndFunc

原创粉丝点击