VB.NET 委托处理 传递参数
生活随笔
收集整理的這篇文章主要介紹了
VB.NET 委托处理 传递参数
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
代碼Imports?Wireless.Entities
Imports?Wireless.Printer.RemotingConnection
Imports?Wireless.Common
Imports?Dsdt.CasinoManager.BusinessRule
Imports?HNA.PubClass.DishModel
Namespace?DishInterface
????Public?Delegate?Sub?PrintBillDeletate(ByVal?IsLaress?As?Boolean,?ByVal?machineNumber?As?String,?ByVal?data?As?List(Of?BillList),?ByVal?currenttable?As?Table,?ByVal?userStatus?As?LoginUserStatus)
????Public?Class?OrderDishesImpl
????????Private?Shared?_currentTable?As?Table
????????Private?Shared?uStatus?As?Wireless.Entities.LoginUserStatus
????????'種數(shù)(本次點(diǎn)菜)
????????Private?Shared?_orderKindCount?As?Decimal
????????'份數(shù)(本次點(diǎn)菜)
????????Private?Shared?_copiesCount?As?Decimal
????????'''?<summary>
????????'''?點(diǎn)菜?(入單)
????????'''?</summary>
????????'''?<param?name="argOrderDishes"></param>
????????'''?<returns></returns>
????????'''?<remarks></remarks>
????????Public?Shared?Function?OrderDishes(ByVal?argOrderDishes?As?Entities.OrderDishes())?As?String
????????????If?argOrderDishes?Is?Nothing?OrElse?argOrderDishes.Length?<?1?Then
????????????????Throw?New?Exception("獲取菜單數(shù)據(jù)異常!")
????????????End?If
????????????Dim?message?As?String?=?String.Empty
????????????Dim?result?As?String?=?String.Format("{0}?{1}{2}",?MobilFormatUtil.FormatString(argOrderDishes(0).TypeCode,?4),?_
??????????????????????????????????????????????????????????MobilFormatUtil.FormatString(argOrderDishes(0).MachineNumber,?3),?_
?????????????????????????????????????????????????????????vbCrLf)
????????????uStatus?=?GlobalDataProvider.GetLoginUserStatusByMachineNo(argOrderDishes(0).MachineNumber)
????????????If?uStatus?Is?Nothing?Then
????????????????Return?String.Concat(result,?"請(qǐng)先登錄!")
????????????End?If
????????????'將手持設(shè)備的臺(tái)號(hào)(nWireTableId)映射為原有的桌號(hào)(cCode)
????????????For?i?As?Integer?=?0?To?argOrderDishes.Length?-?1
????????????????argOrderDishes(i).TabelNoBillNo?=?TableCollection.All.GetCodeByWirlessId(argOrderDishes(i).TabelNoBillNo)
????????????Next
????????????If?argOrderDishes(0).TabelNoBillNo?Is?Nothing?Then
????????????????Return?String.Concat(result,?"臺(tái)不存在!")
????????????End?If
????????????'取得臺(tái)對(duì)象
????????????_currentTable?=?TableCollection.All.GetTableByCode(argOrderDishes(0).TabelNoBillNo.Trim)
????????????_currentTable?=?TableCollection.All.GetOneTables(_currentTable.ID)
????????????If?_currentTable?Is?Nothing?Then
????????????????Return?String.Concat(result,?"臺(tái)不存在!")
????????????End?If
????????????'取得當(dāng)前臺(tái)所有開臺(tái)?
????????????Dim?_currentOpentTables?As?OpenTableCollection?=?_currentTable.GetOpenTables()
????????????If?_currentOpentTables?Is?Nothing?OrElse?_currentOpentTables.Count?<?1?Then
????????????????Return?String.Concat(result,?"當(dāng)前臺(tái)未開!")
????????????End?If
????????????'NOTE?:取得當(dāng)前開臺(tái)對(duì)象?
????????????Dim?_openTable?As?Dsdt.CasinoManager.BusinessRule.OpenTable?=?_currentOpentTables(0)
????????????'判斷當(dāng)前臺(tái)的賬單狀態(tài)
????????????If?_openTable.CurrentBillState?=?BillState.Printed?Then
????????????????Return?String.Concat(result,?"本單已預(yù)結(jié),請(qǐng)先解凍!")
????????????Else
????????????????Try
????????????????????'執(zhí)行入單操作
????????????????????'本次點(diǎn)菜種數(shù)和份數(shù)
????????????????????_orderKindCount?=?0
????????????????????_copiesCount?=?0
????????????????????If?ExecInsertBillList(argOrderDishes,?False,?-1)?Then
????????????????????????'取得累計(jì)點(diǎn)菜種類和份數(shù)
????????????????????????Dim?billLists?As?BillListCollection?=?_openTable.GetBillLists
????????????????????????Dim?_totalOrderKindCount?As?Decimal?=?billLists.Count
????????????????????????Dim?_totalCopiesCount?As?Decimal
????????????????????????For?Each?item?As?BillList?In?billLists
????????????????????????????_totalCopiesCount?+=?item.Count
????????????????????????Next
????????????????????????message?=?String.Format("點(diǎn)菜成功")
????????????????????????'message?=?String.Format("點(diǎn)菜成功!"?+?vbCrLf,?_
????????????????????????'????????????????????????"{0}?本次點(diǎn)菜:{1}種/{2}份?累計(jì)點(diǎn)菜:{3}種/{4}份",?_
????????????????????????'????????????????????????argOrderDishes(0).TabelNoBillNo,?_
????????????????????????'?????????????????????????_orderKindCount,?_copiesCount,?_
????????????????????????'????????????????????????_totalOrderKindCount,?_totalCopiesCount?_
????????????????????????'????????????????????????)
????????????????????Else
????????????????????????message?=?"點(diǎn)菜失敗!"
????????????????????End?If
????????????????Catch?ex?As?Exception
????????????????????message?=?"點(diǎn)菜失敗!"
????????????????End?Try
????????????End?If
????????????Return?String.Concat(result,?message)
????????End?Function
????????'''?<summary>
????????'''?執(zhí)行入單操作
????????'''?</summary>
????????'''?<param?name="argOrderDishes"></param>
????????'''?<param?name="IsLaress"></param>
????????'''?<param?name="nLargessManId"></param>
????????'''?<returns></returns>
????????'''?<remarks></remarks>
????????Private?Shared?Function?ExecInsertBillList(ByVal?argOrderDishes?As?Entities.OrderDishes(),?ByVal?IsLaress?As?Boolean,?ByVal?nLargessManId?As?Integer)?As?Boolean
????????????Dim?result?As?Boolean
????????????If?argOrderDishes.Length?>?0?Then
????????????????'菜單List
????????????????Dim?data?As?New?List(Of?BillList)
????????????????'將數(shù)據(jù)封裝到BillList列表中
????????????????For?Each?item?As?Entities.OrderDishes?In?argOrderDishes
????????????????????data.Add(InsertDataToBillList(item,?IsLaress,?nLargessManId))
????????????????????_orderKindCount?+=?1
????????????????Next
????????????????If?data.Count?>?0?Then
????????????????????'
????????????????????'If?_currentTable.GetOpenTables()(0).InsertBillList(data,?argOrderDishes(0).MachineNumber,?argOrderDishes(0).MachineNumber)?Then
????????????????????If?_currentTable.GetOpenTables()(0).InsertBillList(data,?uStatus.UserId,?argOrderDishes(0).MachineNumber)?Then
????????????????????????'Print
????????????????????????Dim?printDelegate?As?PrintBillDeletate?=?New?PrintBillDeletate(AddressOf?PrintBill)
????????????????????????printDelegate.BeginInvoke(IsLaress,?argOrderDishes(0).MachineNumber,?data,?_currentTable,?uStatus,?Nothing,?Nothing)
????????????????????????result?=?True
????????????????????Else
????????????????????????result?=?False
????????????????????End?If
????????????????End?If
????????????End?If
????????????Return?result
????????End?Function
????????Private?Shared?Sub?PrintBill(ByVal?IsLaress?As?Boolean,?ByVal?machineNumber?As?String,?ByVal?data?As?List(Of?BillList),?ByVal?currenttable?As?Table,?ByVal?userStatus?As?LoginUserStatus)
????????????Try
????????????????PrintBillListDoc(IsLaress,?data,?machineNumber,?currenttable,?userStatus)???'打印小票
????????????????PrintDoc(data,?machineNumber,?currenttable,?userStatus)?????????????????????'打印總單
????????????Catch?ex?As?Exception
????????????????'note?打印日志
????????????End?Try
????????End?Sub
????????'''?<summary>
????????'''?將數(shù)據(jù)追加到BillList中
????????'''?</summary>
????????'''?<param?name="orderDish"></param>
????????'''?<param?name="IsLaress"></param>
????????'''?<param?name="nLargessManId"></param>
????????'''?<returns></returns>
????????'''?<remarks></remarks>
????????Private?Shared?Function?InsertDataToBillList(ByVal?orderDish?As?Entities.OrderDishes,?ByVal?IsLaress?As?Boolean,?ByVal?nLargessManId?As?Integer)?As?BillList
????????????'菜品?套餐號(hào)為空則是菜品否則為套餐
????????????If?String.IsNullOrEmpty(orderDish.ComboNumber.Trim)?Then
????????????????Return?InsertDishToList(orderDish,?IsLaress,?nLargessManId)
????????????End?If
????????????'套餐
????????????Return?InsertSuitToList(orderDish,?IsLaress,?nLargessManId)
????????End?Function
????????'''?<summary>
????????'''?將套餐子類數(shù)據(jù)追加到BillList對(duì)象中
????????'''?</summary>
????????'''?<param?name="suitMenu"></param>
????????'''?<param?name="cookState"></param>
????????'''?<param?name="IsLaress"></param>
????????'''?<param?name="nLargessManId"></param>
????????'''?<returns></returns>
????????'''?<remarks></remarks>
????????Private?Shared?Function?InsertSuitMenuToList(ByVal?suitMenu?As?SuitMenu,?_
?????????????????????????????????????????????????????ByVal?cookState?As?String,?_
?????????????????????????????????????????????????????ByVal?IsLaress?As?Boolean,?_
?????????????????????????????????????????????????????ByVal?nLargessManId?As?Integer)
????????????If?suitMenu?Is?Nothing?Then
????????????????Return?Nothing
????????????End?If
????????????'消費(fèi)菜式狀態(tài)
????????????Dim?curCookState?As?String?=?cookState.Trim
????????????Dim?curCookStateName?As?String?=?String.Empty
????????????Dim?ckState?As?EnumCookState
????????????If?Not?String.IsNullOrEmpty(curCookState)?Then
????????????????ckState?=?curCookState
????????????????curCookStateName?=?BusinessUtil.GetCookStateName(ckState)
????????????End?If
????????????'名稱
????????????Dim?name?As?String?=?suitMenu.Name
????????????'數(shù)量
????????????Dim?count?As?Decimal?=?suitMenu.Count
????????????'價(jià)格
????????????Dim?price?As?Decimal?=?suitMenu.Price
????????????'備注
????????????Dim?remark?As?String?=?String.Empty
????????????'單價(jià)
????????????Dim?UnitId?As?Integer?=?suitMenu.UnitId
????????????Dim?UnitName?As?String?=?suitMenu.UnitName
????????????'廚房
????????????Dim?CookRoomId?As?Integer?=?suitMenu.CookRoomId
????????????'帳單明細(xì)狀態(tài)
????????????Dim?listState?As?BillListState?=?IIf(IsLaress,?BillListState.Largess,?BillListState.Natural)
????????????'是否收服務(wù)費(fèi)
????????????Dim?IsServerFee?=?False
????????????Dim?IsAgio?=?False
????????????'M:菜品
????????????Dim?Id?As?Integer?=?suitMenu.ID
????????????Dim?IdSource?As?String?=?"SM"
????????????Dim?result?As?BillList?=?New?BillList(Id,?name,?listState,?ckState,?curCookStateName,?CookRoomId,?count,?price,?remark,?_
????????????????????????????????????????????????????????????IdSource,?UnitId,?UnitName,?nLargessManId,?IsServerFee,?IsAgio)
????????????Return?result
????????End?Function
????????'''?<summary>
????????'''?將套餐數(shù)據(jù)追加到BillList對(duì)象中
????????'''?</summary>
????????'''?<returns></returns>
????????'''?<remarks></remarks>
????????Private?Shared?Function?InsertSuitToList(ByVal?orderDish?As?Entities.OrderDishes,?ByVal?IsLaress?As?Boolean,?ByVal?nLargessManId?As?Integer)
????????????'消費(fèi)菜式狀態(tài)
????????????Dim?curCookState?As?String?=?orderDish.WaitState.Trim
????????????Dim?curCookStateName?As?String?=?String.Empty
????????????Dim?ckState?As?EnumCookState
????????????If?Not?String.IsNullOrEmpty(curCookState)?Then
????????????????ckState?=?curCookState
????????????????curCookStateName?=?BusinessUtil.GetCookStateName(ckState)
????????????End?If
????????????'NOTE?根據(jù)CODE取得套餐對(duì)象
????????????Dim?suit?As?Suit?=?GlobalDataProvider.Menus.GetSuitByCode(orderDish.ComboNumber.Trim)
????????????If?suit?Is?Nothing?Then
????????????????Return?Nothing
????????????End?If
????????????'名稱
????????????Dim?name?As?String?=?suit.Name
????????????'數(shù)量
????????????Dim?count?As?Decimal?=?orderDish.Count
????????????'價(jià)格
????????????Dim?price?As?Decimal?=?suit.Price
????????????'備注
????????????Dim?remark?As?String?=?String.Empty
????????????'單價(jià)
????????????Dim?UnitId?As?Integer?=?suit.UnitId
????????????Dim?UnitName?As?String?=?suit.UnitName
????????????'廚房
????????????Dim?CookRoomId?As?Integer?=?suit.CookRoomId
????????????'帳單明細(xì)狀態(tài)
????????????Dim?listState?As?BillListState?=?IIf(IsLaress,?BillListState.Largess,?BillListState.Natural)
????????????'是否收服務(wù)費(fèi)
????????????Dim?IsServerFee?=?suit.IsServerFee
????????????Dim?IsAgio?=?suit.IsAgio
????????????'S:套餐
????????????Dim?Id?As?Integer?=?suit.ID
????????????Dim?IdSource?As?String?=?"S"
????????????Dim?result?As?BillList?=?New?BillList(Id,?name,?listState,?ckState,?curCookStateName,?CookRoomId,?count,?price,?remark,?_
????????????????????????????????????????????????????????????IdSource,?UnitId,?UnitName,?nLargessManId,?IsServerFee,?IsAgio)
????????????'取得套餐子類
????????????Dim?lstSuitMenu?As?List(Of?SuitMenu)?=?GlobalDataProvider.Menus.GetMenusFromSuit(orderDish.ComboNumber.Trim)
????????????If?Not?lstSuitMenu?Is?Nothing?AndAlso?lstSuitMenu.Count?>?0?Then
????????????????For?Each?item?As?SuitMenu?In?lstSuitMenu
????????????????????result.Items.Add(InsertSuitMenuToList(item,?orderDish.WaitState.Trim,?IsLaress,?nLargessManId))
????????????????Next
????????????End?If
????????????Return?result
????????End?Function
????????'''?<summary>
????????'''?將菜品數(shù)據(jù)追加到BillList對(duì)象中
????????'''?</summary>
????????'''?<param?name="orderDish"></param>
????????'''?<param?name="IsLaress"></param>
????????'''?<param?name="nLargessManId"></param>
????????'''?<returns></returns>
????????'''?<remarks></remarks>
????????Private?Shared?Function?InsertDishToList(ByVal?orderDish?As?Entities.OrderDishes,?_
?????????????????????????????????????????????????ByVal?IsLaress?As?Boolean,?_
?????????????????????????????????????????????????ByVal?nLargessManId?As?Integer)?As?BillList
????????????'消費(fèi)菜式狀態(tài)
????????????Dim?curCookState?As?String?=?orderDish.WaitState.Trim
????????????Dim?curCookStateName?As?String?=?String.Empty
????????????Dim?ckState?As?EnumCookState
????????????'If?Not?String.IsNullOrEmpty(curCookState)?Then
????????????'????ckState?=?curCookState
????????????'????curCookStateName?=?BusinessUtil.GetCookStateName(ckState)
????????????'End?If
????????????'NOTE?手持機(jī)無法輸入消費(fèi)菜式狀態(tài)?默認(rèn)為"即起"
????????????ckState?=?EnumCookState.Checked
????????????curCookStateName?=?BusinessUtil.GetCookStateName(ckState)
????????????'Note?NULL?取得菜對(duì)象
????????????Dim?menu?As?Menu?=?GlobalDataProvider.Menus.GetMenuByCode(orderDish.MenuId.Trim)
????????????'菜名
????????????Dim?name?As?String?=?menu.Name
????????????'數(shù)量
????????????Dim?count?As?Decimal?=?orderDish.Count
????????????'總份數(shù)統(tǒng)計(jì)
????????????_copiesCount?+=?count
????????????'價(jià)格
????????????Dim?price?As?Decimal?=?menu.Price
????????????'備注
????????????Dim?remark?As?String?=?menu.Remark
????????????'單價(jià)
????????????Dim?UnitId?As?Integer?=?menu.UnitId
????????????Dim?UnitName?As?String?=?menu.UnitName
????????????'廚房
????????????Dim?CookRoomId?As?Integer?=?menu.CookroomId
????????????'帳單明細(xì)狀態(tài)
????????????Dim?listState?As?BillListState?=?IIf(IsLaress,?BillListState.Largess,?BillListState.Natural)
????????????'是否收服務(wù)費(fèi)
????????????Dim?IsServerFee?=?menu.IsServerFee
????????????Dim?IsAgio?=?menu.IsAgio
????????????'M:菜品
????????????Dim?Id?As?Integer?=?menu.ID
????????????Dim?IdSource?As?String?=?"M"
????????????Dim?dish?As?BillList?=?New?BillList(Id,?name,?listState,?ckState,?curCookStateName,?CookRoomId,?count,?price,?remark,?_
????????????????????????????????????????????????????????????IdSource,?UnitId,?UnitName,?nLargessManId,?IsServerFee,?IsAgio)
????????????'如果有做法,則追加做法對(duì)象
????????????If?Not?String.IsNullOrEmpty(orderDish.MakeWay.Trim)?Then
????????????????'制作方法中的任何一位不是數(shù)字,則認(rèn)為輸入的是內(nèi)容而不是制作法的編號(hào)。
????????????????If?IsNumeric(orderDish.MakeWay.Trim)?Then
????????????????????'?Feihu?Huang?2009/12/29
????????????????????'去做法的時(shí)候,3位取法優(yōu)先,如果不是3位不是做法,則跳1位,取下三位,取到為止
????????????????????Dim?s?As?String
????????????????????s?=?orderDish.MakeWay.Trim
????????????????????Dim?threeBytes?As?String
????????????????????Dim?i?As?Integer
????????????????????Try
????????????????????????For?i?=?0?To?s.Length?-?2
????????????????????????????threeBytes?=?s.Substring(i,?3)
????????????????????????????If?Wireless.Common.MenusClass.IsAFunction(threeBytes)?=?True?Then
????????????????????????????????System.Console.WriteLine(threeBytes)
????????????????????????????????'????'根據(jù)CODE取得菜品做法對(duì)象
????????????????????????????????'orderDish.WaitState.Trim,?_
????????????????????????????????Dim?makeWayItem?As?BillList?=?SetDataToMakeWay(threeBytes,?_
????????????????????????????????"1",?_
???????????????????????????????????????????????????????????????????IsLaress,?_
???????????????????????????????????????????????????????????????????nLargessManId)
????????????????????????????????If?Not?makeWayItem?Is?Nothing?Then
????????????????????????????????????dish.Items.Add(makeWayItem)
????????????????????????????????????dish.MenuRemark?+=?makeWayItem.MenuName?+?","
????????????????????????????????End?If
????????????????????????????????i?=?i?+?2
????????????????????????????End?If
????????????????????????Next
????????????????????????If?Not?dish.MenuRemark?Is?Nothing?AndAlso?dish.MenuRemark.Length?>?0?Then
????????????????????????????dish.MenuRemark?=?dish.MenuRemark.Substring(0,?dish.MenuRemark.Length?-?1)
????????????????????????End?If
????????????????????Catch?ex?As?Exception
????????????????????End?Try
????????????????????''每3位為一做法的Code
????????????????????'Dim?functionCodes()?As?String?=?MobilFormatUtil.SplitStringByLenth(orderDish.MakeWay.Trim,?3)
????????????????????'For?Each?code?As?String?In?functionCodes
????????????????????'????'根據(jù)CODE取得菜品做法對(duì)象
????????????????????'????Dim?makeWayItem?As?BillList?=?SetDataToMakeWay(code,?_
????????????????????'???????????????????????????????????????????????????orderDish.WaitState.Trim,?_
????????????????????'???????????????????????????????????????????????????IsLaress,?_
????????????????????'???????????????????????????????????????????????????nLargessManId)
????????????????????'????If?Not?makeWayItem?Is?Nothing?Then
????????????????????'????????dish.Items.Add(makeWayItem)
????????????????????'????End?If
????????????????????'Next
????????????????End?If
????????????End?If
????????????Return?dish
????????End?Function
????????'''?<summary>
????????'''?將做法數(shù)據(jù)追加到BillList對(duì)象中
????????'''?</summary>
????????'''?<param?name="makeWayCode"></param>
????????'''?<param?name="waitState"></param>
????????'''?<param?name="IsLaress"></param>
????????'''?<param?name="nLargessManId"></param>
????????'''?<returns></returns>
????????'''?<remarks></remarks>
????????Private?Shared?Function?SetDataToMakeWay(ByVal?makeWayCode?As?String,?_
?????????????????????????????????????????????????ByVal?waitState?As?String,?_
?????????????????????????????????????????????????ByVal?IsLaress?As?Boolean,?_
?????????????????????????????????????????????????ByVal?nLargessManId?As?Integer)?As?BillList
????????????'消費(fèi)菜式狀態(tài)
????????????Dim?curCookState?As?String?=?waitState
????????????Dim?curCookStateName?As?String?=?String.Empty
????????????Dim?ckState?As?EnumCookState
????????????If?Not?String.IsNullOrEmpty(curCookState)?Then
????????????????ckState?=?curCookState
????????????????curCookStateName?=?BusinessUtil.GetCookStateName(ckState)
????????????End?If
????????????'NOTE?根據(jù)CODE取得菜品做法對(duì)象
????????????Dim?makeWay?As?MenuFunction?=?GlobalDataProvider.Menus.GetFunctionById(makeWayCode)
????????????If?makeWay?Is?Nothing?Then
????????????????Return?Nothing
????????????End?If
????????????'名稱
????????????Dim?name?As?String?=?makeWay.Name
????????????'數(shù)量
????????????Dim?count?As?Decimal?=?1
????????????'價(jià)格
????????????Dim?price?As?Decimal?=?makeWay.Price
????????????'備注
????????????Dim?remark?As?String?=?String.Empty
????????????'單價(jià)
????????????Dim?UnitId?As?Integer?=?makeWay.UnitId
????????????Dim?UnitName?As?String?=?makeWay.UnitName
????????????'廚房
????????????Dim?CookRoomId?As?Integer?=?-1
????????????'帳單明細(xì)狀態(tài)
????????????Dim?listState?As?BillListState?=?IIf(IsLaress,?BillListState.Largess,?BillListState.Natural)
????????????'是否收服務(wù)費(fèi)
????????????Dim?IsServerFee?=?makeWay.IsServerFee
????????????Dim?IsAgio?=?makeWay.IsAgio
????????????'M:菜品
????????????Dim?Id?As?Integer?=?makeWay.ID
????????????Dim?IdSource?As?String?=?"F"
????????????Dim?makeWayItem?As?BillList?=?New?BillList(Id,?name,?listState,?ckState,?curCookStateName,?CookRoomId,?count,?price,?remark,?_
????????????????????????????????????????????????????????????IdSource,?UnitId,?UnitName,?nLargessManId,?IsServerFee,?IsAgio)
????????????Return?makeWayItem
????????End?Function
#Region?"打印小票"
????????Private?Shared?Sub?PrintBillListDoc(ByVal?IsLaress?As?Boolean,?ByVal?data?As?List(Of?BillList),?ByVal?machineCode?As?String,?ByVal?currenttable?As?Table,?ByVal?userStatus?As?LoginUserStatus)
????????????'TODO?手持設(shè)備的用戶名
????????????'Dim?currentUserName?As?String?=?machineCode
????????????Dim?currentUserName?As?String?=?userStatus.UserName
????????????Dim?BLCol?As?New?BillListCollection
????????????For?Each?l?As?BillList?In?data
????????????????If?l.IsPrintB()?Then
????????????????????BLCol.Add(l)
????????????????End?If
????????????Next
????????????If?BLCol.Count?>?0?Then
????????????????For?Each?BL?As?BillList?In?BLCol
????????????????????If?IsPrintPassPrintCenter?Then
????????????????????????Dim?L?As?New?SystemLicenseRule(True)
????????????????????????Dim?P?As?New?RemotingConnection
????????????????????????Dim?C?As?CookRoom?=?CType(CookRoomCollection.GetOneCookRooms(BL.CookRoomId)(0),?CookRoom)
????????????????????????Dim?BillListDoc?As?New?PrintBillListRpt(IIf(IsLaress,?"贈(zèng)送",?BL.CurrentCookStateName),?currenttable.Name,?_
????????????????????????????????????????????????????currentUserName,?Now.ToString,?BL.MenuName,?BL.Count,?BL.UnitName,?BL.Price,?_
????????????????????????????????????????????????????BL.Count?*?BL.Price,?BL.MenuRemark,?C.PrintAreaCode,?_
????????????????????????????????????????????????????L.CurLicense.name,?currenttable.DepartmentName,?currenttable.HallName,?_
????????????????????????????????????????????????????currenttable.ServerFee,?0,?0,?0,?0,?0)
????????????????????????P.LoadBillListPiaoRpt(BillListDoc)
????????????????????Else
????????????????????End?If
????????????????Next
????????????????'Dim?doc?As?New?Doc_TolBill(cols,?Me._checkedTbl.Name,?AppConfig.CurrentUser.cName,?IIf(cols(0).ListState?=?BillListState.Natural,?"總單",?"贈(zèng)送"))
????????????????'doc.PrintController?=?New?System.Drawing.Printing.StandardPrintController()
????????????????'doc.PrintDoc()
????????????End?If
????????End?Sub
????????'''?<summary>
????????'''?是否用打印中心來打印賬單
????????'''?</summary>
????????'''?<remarks></remarks>
????????Public?Shared?ReadOnly?Property?IsPrintPassPrintCenter()?As?Boolean
????????????Get
????????????????Dim?p?As?New?SystemParamsRule(True)
????????????????Return?p.IsPrintPassPrintCenter
????????????End?Get
????????????''Get
????????????''????Return?_IsPrintPassPrintCenter
????????????''End?Get
????????????''Set(ByVal?value?As?Boolean)
????????????''????Dim?p?As?New?SystemParamsRule(True)
????????????''????_IsPrintPassPrintCenter?=?p.IsPrintPassPrintCenter
????????????''End?Set
????????End?Property
#End?Region
#Region?"打印總單"
????????Private?Shared?Sub?PrintDoc(ByVal?data?As?List(Of?BillList),?ByVal?machineCode?As?String,?ByVal?currenttable?As?Table,?ByVal?userStatus?As?LoginUserStatus)
????????????Dim?Plsts?As?New?BillListCollection
????????????For?Each?l?As?BillList?In?data
????????????????If?l.IsPrintA()?Then
????????????????????Plsts.Add(l)
????????????????End?If
????????????Next
????????????If?Plsts.Count?>?0?Then
????????????????Dim?L?As?New?SystemLicenseRule(True)
????????????????''If?AppConfig.IsPrintPassPrintCenter?Then
????????????????''????''用C1REPORT來打印
????????????????''????Dim?BLdata?As?PrintBillListData?=?New?PrintBillListData("zongdan")
????????????????''????For?Each?BL?As?BillList?In?Plsts
????????????????''????????BLdata.AddOneRow(BL)
????????????????''????Next
????????????????''????Dim?P?As?New?RemotingConnection
????????????????''????'Dim?C?As?CookRoom?=?CType(CookRoomCollection.GetOneCookRooms(lst.CookRoomId)(0),?CookRoom)
????????????????''????Dim?pbr?As?New?PrintBillListRpt("總單",?Me._checkedTbl.Name,?AppConfig.CurrentUser.cName,?_
????????????????''????????????????????????????????Now.ToString,?"",?0,?"",?0,?_
????????????????''????????????????????????????????0,?"",?_PrintArea,?_
????????????????''????????????????????????????????L.CurLicense.name,?_checkedTbl.DepartmentName,?_checkedTbl.HallName,?_
????????????????''????????????????????????????????Me._checkedTbl.ServerFee,?Plsts.TolServerFeeMoney(Me._checkedTbl.ServerFee),?0,?0,?Plsts.TolNaturalMoney,?Plsts.TolLargessMoney)?'C.PrintAreaCode)
????????????????''????P.LoadBillListZongRpt(BLdata._BillListData,?pbr)
????????????????''????''用C1REPORT來打印
????????????????''Else
????????????????''用畫的PrintDocument來打印()
????????????????Dim?msg?As?New?CashBillMsg
????????????????msg.title?=?IIf(Plsts(0).ListState?=?BillListState.Natural,?"總單",?"贈(zèng)送")
????????????????msg.HotelName?=?L.CurLicense.name
????????????????msg.DprtName?=?currenttable.DepartmentName
????????????????msg.HallName?=?currenttable.HallName
????????????????msg.TableCode?=?currenttable.Code
????????????????msg.TableName?=?currenttable.Name
????????????????msg.PrintCount?=?0
????????????????msg.BillCode?=?""
????????????????'TODO?手持設(shè)備的用戶名
????????????????msg.UserCode?=?userStatus.UserCode
????????????????msg.UserName?=?userStatus.UserName
????????????????msg.GuestCount?=?currenttable.GetOpenTables(0).GuestCount
????????????????msg.MenuInTime?=?Now
????????????????msg.ServerFeeRate?=?currenttable.ServerFee
????????????????msg.ServerFee?=?Plsts.TolServerFeeMoney(currenttable.ServerFee)
????????????????msg.AgioRate?=?0
????????????????msg.Agio?=?0
????????????????msg.MenuMoney?=?Plsts.TolAllMoney
????????????????msg.TolMoney?=?Plsts.TolAllMoney?+?Plsts.TolServerFeeMoney(currenttable.ServerFee)
????????????????'Dim?doc?As?New?Doc_TolBill(cols,?Me._checkedTbl.Name,?AppConfig.CurrentUser.cName,?IIf(cols(0).ListState?=?BillListState.Natural,?"總單",?"贈(zèng)送"))
????????????????Dim?doc?As?New?Doc_TolBill(Plsts,?msg)
????????????????doc.PrintController?=?New?System.Drawing.Printing.StandardPrintController()
????????????????doc.PrintDoc()
????????????????''用畫的PrintDocument來打印
????????????????''End?If
????????????End?If
????????End?Sub
#End?Region
????End?Class
End?Namespace
Imports?Wireless.Printer.RemotingConnection
Imports?Wireless.Common
Imports?Dsdt.CasinoManager.BusinessRule
Imports?HNA.PubClass.DishModel
Namespace?DishInterface
????Public?Delegate?Sub?PrintBillDeletate(ByVal?IsLaress?As?Boolean,?ByVal?machineNumber?As?String,?ByVal?data?As?List(Of?BillList),?ByVal?currenttable?As?Table,?ByVal?userStatus?As?LoginUserStatus)
????Public?Class?OrderDishesImpl
????????Private?Shared?_currentTable?As?Table
????????Private?Shared?uStatus?As?Wireless.Entities.LoginUserStatus
????????'種數(shù)(本次點(diǎn)菜)
????????Private?Shared?_orderKindCount?As?Decimal
????????'份數(shù)(本次點(diǎn)菜)
????????Private?Shared?_copiesCount?As?Decimal
????????'''?<summary>
????????'''?點(diǎn)菜?(入單)
????????'''?</summary>
????????'''?<param?name="argOrderDishes"></param>
????????'''?<returns></returns>
????????'''?<remarks></remarks>
????????Public?Shared?Function?OrderDishes(ByVal?argOrderDishes?As?Entities.OrderDishes())?As?String
????????????If?argOrderDishes?Is?Nothing?OrElse?argOrderDishes.Length?<?1?Then
????????????????Throw?New?Exception("獲取菜單數(shù)據(jù)異常!")
????????????End?If
????????????Dim?message?As?String?=?String.Empty
????????????Dim?result?As?String?=?String.Format("{0}?{1}{2}",?MobilFormatUtil.FormatString(argOrderDishes(0).TypeCode,?4),?_
??????????????????????????????????????????????????????????MobilFormatUtil.FormatString(argOrderDishes(0).MachineNumber,?3),?_
?????????????????????????????????????????????????????????vbCrLf)
????????????uStatus?=?GlobalDataProvider.GetLoginUserStatusByMachineNo(argOrderDishes(0).MachineNumber)
????????????If?uStatus?Is?Nothing?Then
????????????????Return?String.Concat(result,?"請(qǐng)先登錄!")
????????????End?If
????????????'將手持設(shè)備的臺(tái)號(hào)(nWireTableId)映射為原有的桌號(hào)(cCode)
????????????For?i?As?Integer?=?0?To?argOrderDishes.Length?-?1
????????????????argOrderDishes(i).TabelNoBillNo?=?TableCollection.All.GetCodeByWirlessId(argOrderDishes(i).TabelNoBillNo)
????????????Next
????????????If?argOrderDishes(0).TabelNoBillNo?Is?Nothing?Then
????????????????Return?String.Concat(result,?"臺(tái)不存在!")
????????????End?If
????????????'取得臺(tái)對(duì)象
????????????_currentTable?=?TableCollection.All.GetTableByCode(argOrderDishes(0).TabelNoBillNo.Trim)
????????????_currentTable?=?TableCollection.All.GetOneTables(_currentTable.ID)
????????????If?_currentTable?Is?Nothing?Then
????????????????Return?String.Concat(result,?"臺(tái)不存在!")
????????????End?If
????????????'取得當(dāng)前臺(tái)所有開臺(tái)?
????????????Dim?_currentOpentTables?As?OpenTableCollection?=?_currentTable.GetOpenTables()
????????????If?_currentOpentTables?Is?Nothing?OrElse?_currentOpentTables.Count?<?1?Then
????????????????Return?String.Concat(result,?"當(dāng)前臺(tái)未開!")
????????????End?If
????????????'NOTE?:取得當(dāng)前開臺(tái)對(duì)象?
????????????Dim?_openTable?As?Dsdt.CasinoManager.BusinessRule.OpenTable?=?_currentOpentTables(0)
????????????'判斷當(dāng)前臺(tái)的賬單狀態(tài)
????????????If?_openTable.CurrentBillState?=?BillState.Printed?Then
????????????????Return?String.Concat(result,?"本單已預(yù)結(jié),請(qǐng)先解凍!")
????????????Else
????????????????Try
????????????????????'執(zhí)行入單操作
????????????????????'本次點(diǎn)菜種數(shù)和份數(shù)
????????????????????_orderKindCount?=?0
????????????????????_copiesCount?=?0
????????????????????If?ExecInsertBillList(argOrderDishes,?False,?-1)?Then
????????????????????????'取得累計(jì)點(diǎn)菜種類和份數(shù)
????????????????????????Dim?billLists?As?BillListCollection?=?_openTable.GetBillLists
????????????????????????Dim?_totalOrderKindCount?As?Decimal?=?billLists.Count
????????????????????????Dim?_totalCopiesCount?As?Decimal
????????????????????????For?Each?item?As?BillList?In?billLists
????????????????????????????_totalCopiesCount?+=?item.Count
????????????????????????Next
????????????????????????message?=?String.Format("點(diǎn)菜成功")
????????????????????????'message?=?String.Format("點(diǎn)菜成功!"?+?vbCrLf,?_
????????????????????????'????????????????????????"{0}?本次點(diǎn)菜:{1}種/{2}份?累計(jì)點(diǎn)菜:{3}種/{4}份",?_
????????????????????????'????????????????????????argOrderDishes(0).TabelNoBillNo,?_
????????????????????????'?????????????????????????_orderKindCount,?_copiesCount,?_
????????????????????????'????????????????????????_totalOrderKindCount,?_totalCopiesCount?_
????????????????????????'????????????????????????)
????????????????????Else
????????????????????????message?=?"點(diǎn)菜失敗!"
????????????????????End?If
????????????????Catch?ex?As?Exception
????????????????????message?=?"點(diǎn)菜失敗!"
????????????????End?Try
????????????End?If
????????????Return?String.Concat(result,?message)
????????End?Function
????????'''?<summary>
????????'''?執(zhí)行入單操作
????????'''?</summary>
????????'''?<param?name="argOrderDishes"></param>
????????'''?<param?name="IsLaress"></param>
????????'''?<param?name="nLargessManId"></param>
????????'''?<returns></returns>
????????'''?<remarks></remarks>
????????Private?Shared?Function?ExecInsertBillList(ByVal?argOrderDishes?As?Entities.OrderDishes(),?ByVal?IsLaress?As?Boolean,?ByVal?nLargessManId?As?Integer)?As?Boolean
????????????Dim?result?As?Boolean
????????????If?argOrderDishes.Length?>?0?Then
????????????????'菜單List
????????????????Dim?data?As?New?List(Of?BillList)
????????????????'將數(shù)據(jù)封裝到BillList列表中
????????????????For?Each?item?As?Entities.OrderDishes?In?argOrderDishes
????????????????????data.Add(InsertDataToBillList(item,?IsLaress,?nLargessManId))
????????????????????_orderKindCount?+=?1
????????????????Next
????????????????If?data.Count?>?0?Then
????????????????????'
????????????????????'If?_currentTable.GetOpenTables()(0).InsertBillList(data,?argOrderDishes(0).MachineNumber,?argOrderDishes(0).MachineNumber)?Then
????????????????????If?_currentTable.GetOpenTables()(0).InsertBillList(data,?uStatus.UserId,?argOrderDishes(0).MachineNumber)?Then
????????????????????????Dim?printDelegate?As?PrintBillDeletate?=?New?PrintBillDeletate(AddressOf?PrintBill)
????????????????????????printDelegate.BeginInvoke(IsLaress,?argOrderDishes(0).MachineNumber,?data,?_currentTable,?uStatus,?Nothing,?Nothing)
????????????????????????result?=?True
????????????????????Else
????????????????????????result?=?False
????????????????????End?If
????????????????End?If
????????????End?If
????????????Return?result
????????End?Function
????????Private?Shared?Sub?PrintBill(ByVal?IsLaress?As?Boolean,?ByVal?machineNumber?As?String,?ByVal?data?As?List(Of?BillList),?ByVal?currenttable?As?Table,?ByVal?userStatus?As?LoginUserStatus)
????????????Try
????????????????PrintBillListDoc(IsLaress,?data,?machineNumber,?currenttable,?userStatus)???'打印小票
????????????????PrintDoc(data,?machineNumber,?currenttable,?userStatus)?????????????????????'打印總單
????????????Catch?ex?As?Exception
????????????????'note?打印日志
????????????End?Try
????????End?Sub
????????'''?<summary>
????????'''?將數(shù)據(jù)追加到BillList中
????????'''?</summary>
????????'''?<param?name="orderDish"></param>
????????'''?<param?name="IsLaress"></param>
????????'''?<param?name="nLargessManId"></param>
????????'''?<returns></returns>
????????'''?<remarks></remarks>
????????Private?Shared?Function?InsertDataToBillList(ByVal?orderDish?As?Entities.OrderDishes,?ByVal?IsLaress?As?Boolean,?ByVal?nLargessManId?As?Integer)?As?BillList
????????????'菜品?套餐號(hào)為空則是菜品否則為套餐
????????????If?String.IsNullOrEmpty(orderDish.ComboNumber.Trim)?Then
????????????????Return?InsertDishToList(orderDish,?IsLaress,?nLargessManId)
????????????End?If
????????????'套餐
????????????Return?InsertSuitToList(orderDish,?IsLaress,?nLargessManId)
????????End?Function
????????'''?<summary>
????????'''?將套餐子類數(shù)據(jù)追加到BillList對(duì)象中
????????'''?</summary>
????????'''?<param?name="suitMenu"></param>
????????'''?<param?name="cookState"></param>
????????'''?<param?name="IsLaress"></param>
????????'''?<param?name="nLargessManId"></param>
????????'''?<returns></returns>
????????'''?<remarks></remarks>
????????Private?Shared?Function?InsertSuitMenuToList(ByVal?suitMenu?As?SuitMenu,?_
?????????????????????????????????????????????????????ByVal?cookState?As?String,?_
?????????????????????????????????????????????????????ByVal?IsLaress?As?Boolean,?_
?????????????????????????????????????????????????????ByVal?nLargessManId?As?Integer)
????????????If?suitMenu?Is?Nothing?Then
????????????????Return?Nothing
????????????End?If
????????????'消費(fèi)菜式狀態(tài)
????????????Dim?curCookState?As?String?=?cookState.Trim
????????????Dim?curCookStateName?As?String?=?String.Empty
????????????Dim?ckState?As?EnumCookState
????????????If?Not?String.IsNullOrEmpty(curCookState)?Then
????????????????ckState?=?curCookState
????????????????curCookStateName?=?BusinessUtil.GetCookStateName(ckState)
????????????End?If
????????????'名稱
????????????Dim?name?As?String?=?suitMenu.Name
????????????'數(shù)量
????????????Dim?count?As?Decimal?=?suitMenu.Count
????????????'價(jià)格
????????????Dim?price?As?Decimal?=?suitMenu.Price
????????????'備注
????????????Dim?remark?As?String?=?String.Empty
????????????'單價(jià)
????????????Dim?UnitId?As?Integer?=?suitMenu.UnitId
????????????Dim?UnitName?As?String?=?suitMenu.UnitName
????????????'廚房
????????????Dim?CookRoomId?As?Integer?=?suitMenu.CookRoomId
????????????'帳單明細(xì)狀態(tài)
????????????Dim?listState?As?BillListState?=?IIf(IsLaress,?BillListState.Largess,?BillListState.Natural)
????????????'是否收服務(wù)費(fèi)
????????????Dim?IsServerFee?=?False
????????????Dim?IsAgio?=?False
????????????'M:菜品
????????????Dim?Id?As?Integer?=?suitMenu.ID
????????????Dim?IdSource?As?String?=?"SM"
????????????Dim?result?As?BillList?=?New?BillList(Id,?name,?listState,?ckState,?curCookStateName,?CookRoomId,?count,?price,?remark,?_
????????????????????????????????????????????????????????????IdSource,?UnitId,?UnitName,?nLargessManId,?IsServerFee,?IsAgio)
????????????Return?result
????????End?Function
????????'''?<summary>
????????'''?將套餐數(shù)據(jù)追加到BillList對(duì)象中
????????'''?</summary>
????????'''?<returns></returns>
????????'''?<remarks></remarks>
????????Private?Shared?Function?InsertSuitToList(ByVal?orderDish?As?Entities.OrderDishes,?ByVal?IsLaress?As?Boolean,?ByVal?nLargessManId?As?Integer)
????????????'消費(fèi)菜式狀態(tài)
????????????Dim?curCookState?As?String?=?orderDish.WaitState.Trim
????????????Dim?curCookStateName?As?String?=?String.Empty
????????????Dim?ckState?As?EnumCookState
????????????If?Not?String.IsNullOrEmpty(curCookState)?Then
????????????????ckState?=?curCookState
????????????????curCookStateName?=?BusinessUtil.GetCookStateName(ckState)
????????????End?If
????????????'NOTE?根據(jù)CODE取得套餐對(duì)象
????????????Dim?suit?As?Suit?=?GlobalDataProvider.Menus.GetSuitByCode(orderDish.ComboNumber.Trim)
????????????If?suit?Is?Nothing?Then
????????????????Return?Nothing
????????????End?If
????????????'名稱
????????????Dim?name?As?String?=?suit.Name
????????????'數(shù)量
????????????Dim?count?As?Decimal?=?orderDish.Count
????????????'價(jià)格
????????????Dim?price?As?Decimal?=?suit.Price
????????????'備注
????????????Dim?remark?As?String?=?String.Empty
????????????'單價(jià)
????????????Dim?UnitId?As?Integer?=?suit.UnitId
????????????Dim?UnitName?As?String?=?suit.UnitName
????????????'廚房
????????????Dim?CookRoomId?As?Integer?=?suit.CookRoomId
????????????'帳單明細(xì)狀態(tài)
????????????Dim?listState?As?BillListState?=?IIf(IsLaress,?BillListState.Largess,?BillListState.Natural)
????????????'是否收服務(wù)費(fèi)
????????????Dim?IsServerFee?=?suit.IsServerFee
????????????Dim?IsAgio?=?suit.IsAgio
????????????'S:套餐
????????????Dim?Id?As?Integer?=?suit.ID
????????????Dim?IdSource?As?String?=?"S"
????????????Dim?result?As?BillList?=?New?BillList(Id,?name,?listState,?ckState,?curCookStateName,?CookRoomId,?count,?price,?remark,?_
????????????????????????????????????????????????????????????IdSource,?UnitId,?UnitName,?nLargessManId,?IsServerFee,?IsAgio)
????????????'取得套餐子類
????????????Dim?lstSuitMenu?As?List(Of?SuitMenu)?=?GlobalDataProvider.Menus.GetMenusFromSuit(orderDish.ComboNumber.Trim)
????????????If?Not?lstSuitMenu?Is?Nothing?AndAlso?lstSuitMenu.Count?>?0?Then
????????????????For?Each?item?As?SuitMenu?In?lstSuitMenu
????????????????????result.Items.Add(InsertSuitMenuToList(item,?orderDish.WaitState.Trim,?IsLaress,?nLargessManId))
????????????????Next
????????????End?If
????????????Return?result
????????End?Function
????????'''?<summary>
????????'''?將菜品數(shù)據(jù)追加到BillList對(duì)象中
????????'''?</summary>
????????'''?<param?name="orderDish"></param>
????????'''?<param?name="IsLaress"></param>
????????'''?<param?name="nLargessManId"></param>
????????'''?<returns></returns>
????????'''?<remarks></remarks>
????????Private?Shared?Function?InsertDishToList(ByVal?orderDish?As?Entities.OrderDishes,?_
?????????????????????????????????????????????????ByVal?IsLaress?As?Boolean,?_
?????????????????????????????????????????????????ByVal?nLargessManId?As?Integer)?As?BillList
????????????'消費(fèi)菜式狀態(tài)
????????????Dim?curCookState?As?String?=?orderDish.WaitState.Trim
????????????Dim?curCookStateName?As?String?=?String.Empty
????????????Dim?ckState?As?EnumCookState
????????????'If?Not?String.IsNullOrEmpty(curCookState)?Then
????????????'????ckState?=?curCookState
????????????'????curCookStateName?=?BusinessUtil.GetCookStateName(ckState)
????????????'End?If
????????????'NOTE?手持機(jī)無法輸入消費(fèi)菜式狀態(tài)?默認(rèn)為"即起"
????????????ckState?=?EnumCookState.Checked
????????????curCookStateName?=?BusinessUtil.GetCookStateName(ckState)
????????????'Note?NULL?取得菜對(duì)象
????????????Dim?menu?As?Menu?=?GlobalDataProvider.Menus.GetMenuByCode(orderDish.MenuId.Trim)
????????????'菜名
????????????Dim?name?As?String?=?menu.Name
????????????'數(shù)量
????????????Dim?count?As?Decimal?=?orderDish.Count
????????????'總份數(shù)統(tǒng)計(jì)
????????????_copiesCount?+=?count
????????????'價(jià)格
????????????Dim?price?As?Decimal?=?menu.Price
????????????'備注
????????????Dim?remark?As?String?=?menu.Remark
????????????'單價(jià)
????????????Dim?UnitId?As?Integer?=?menu.UnitId
????????????Dim?UnitName?As?String?=?menu.UnitName
????????????'廚房
????????????Dim?CookRoomId?As?Integer?=?menu.CookroomId
????????????'帳單明細(xì)狀態(tài)
????????????Dim?listState?As?BillListState?=?IIf(IsLaress,?BillListState.Largess,?BillListState.Natural)
????????????'是否收服務(wù)費(fèi)
????????????Dim?IsServerFee?=?menu.IsServerFee
????????????Dim?IsAgio?=?menu.IsAgio
????????????'M:菜品
????????????Dim?Id?As?Integer?=?menu.ID
????????????Dim?IdSource?As?String?=?"M"
????????????Dim?dish?As?BillList?=?New?BillList(Id,?name,?listState,?ckState,?curCookStateName,?CookRoomId,?count,?price,?remark,?_
????????????????????????????????????????????????????????????IdSource,?UnitId,?UnitName,?nLargessManId,?IsServerFee,?IsAgio)
????????????'如果有做法,則追加做法對(duì)象
????????????If?Not?String.IsNullOrEmpty(orderDish.MakeWay.Trim)?Then
????????????????'制作方法中的任何一位不是數(shù)字,則認(rèn)為輸入的是內(nèi)容而不是制作法的編號(hào)。
????????????????If?IsNumeric(orderDish.MakeWay.Trim)?Then
????????????????????'?Feihu?Huang?2009/12/29
????????????????????'去做法的時(shí)候,3位取法優(yōu)先,如果不是3位不是做法,則跳1位,取下三位,取到為止
????????????????????Dim?s?As?String
????????????????????s?=?orderDish.MakeWay.Trim
????????????????????Dim?threeBytes?As?String
????????????????????Dim?i?As?Integer
????????????????????Try
????????????????????????For?i?=?0?To?s.Length?-?2
????????????????????????????threeBytes?=?s.Substring(i,?3)
????????????????????????????If?Wireless.Common.MenusClass.IsAFunction(threeBytes)?=?True?Then
????????????????????????????????System.Console.WriteLine(threeBytes)
????????????????????????????????'????'根據(jù)CODE取得菜品做法對(duì)象
????????????????????????????????'orderDish.WaitState.Trim,?_
????????????????????????????????Dim?makeWayItem?As?BillList?=?SetDataToMakeWay(threeBytes,?_
????????????????????????????????"1",?_
???????????????????????????????????????????????????????????????????IsLaress,?_
???????????????????????????????????????????????????????????????????nLargessManId)
????????????????????????????????If?Not?makeWayItem?Is?Nothing?Then
????????????????????????????????????dish.Items.Add(makeWayItem)
????????????????????????????????????dish.MenuRemark?+=?makeWayItem.MenuName?+?","
????????????????????????????????End?If
????????????????????????????????i?=?i?+?2
????????????????????????????End?If
????????????????????????Next
????????????????????????If?Not?dish.MenuRemark?Is?Nothing?AndAlso?dish.MenuRemark.Length?>?0?Then
????????????????????????????dish.MenuRemark?=?dish.MenuRemark.Substring(0,?dish.MenuRemark.Length?-?1)
????????????????????????End?If
????????????????????Catch?ex?As?Exception
????????????????????End?Try
????????????????????''每3位為一做法的Code
????????????????????'Dim?functionCodes()?As?String?=?MobilFormatUtil.SplitStringByLenth(orderDish.MakeWay.Trim,?3)
????????????????????'For?Each?code?As?String?In?functionCodes
????????????????????'????'根據(jù)CODE取得菜品做法對(duì)象
????????????????????'????Dim?makeWayItem?As?BillList?=?SetDataToMakeWay(code,?_
????????????????????'???????????????????????????????????????????????????orderDish.WaitState.Trim,?_
????????????????????'???????????????????????????????????????????????????IsLaress,?_
????????????????????'???????????????????????????????????????????????????nLargessManId)
????????????????????'????If?Not?makeWayItem?Is?Nothing?Then
????????????????????'????????dish.Items.Add(makeWayItem)
????????????????????'????End?If
????????????????????'Next
????????????????End?If
????????????End?If
????????????Return?dish
????????End?Function
????????'''?<summary>
????????'''?將做法數(shù)據(jù)追加到BillList對(duì)象中
????????'''?</summary>
????????'''?<param?name="makeWayCode"></param>
????????'''?<param?name="waitState"></param>
????????'''?<param?name="IsLaress"></param>
????????'''?<param?name="nLargessManId"></param>
????????'''?<returns></returns>
????????'''?<remarks></remarks>
????????Private?Shared?Function?SetDataToMakeWay(ByVal?makeWayCode?As?String,?_
?????????????????????????????????????????????????ByVal?waitState?As?String,?_
?????????????????????????????????????????????????ByVal?IsLaress?As?Boolean,?_
?????????????????????????????????????????????????ByVal?nLargessManId?As?Integer)?As?BillList
????????????'消費(fèi)菜式狀態(tài)
????????????Dim?curCookState?As?String?=?waitState
????????????Dim?curCookStateName?As?String?=?String.Empty
????????????Dim?ckState?As?EnumCookState
????????????If?Not?String.IsNullOrEmpty(curCookState)?Then
????????????????ckState?=?curCookState
????????????????curCookStateName?=?BusinessUtil.GetCookStateName(ckState)
????????????End?If
????????????'NOTE?根據(jù)CODE取得菜品做法對(duì)象
????????????Dim?makeWay?As?MenuFunction?=?GlobalDataProvider.Menus.GetFunctionById(makeWayCode)
????????????If?makeWay?Is?Nothing?Then
????????????????Return?Nothing
????????????End?If
????????????'名稱
????????????Dim?name?As?String?=?makeWay.Name
????????????'數(shù)量
????????????Dim?count?As?Decimal?=?1
????????????'價(jià)格
????????????Dim?price?As?Decimal?=?makeWay.Price
????????????'備注
????????????Dim?remark?As?String?=?String.Empty
????????????'單價(jià)
????????????Dim?UnitId?As?Integer?=?makeWay.UnitId
????????????Dim?UnitName?As?String?=?makeWay.UnitName
????????????'廚房
????????????Dim?CookRoomId?As?Integer?=?-1
????????????'帳單明細(xì)狀態(tài)
????????????Dim?listState?As?BillListState?=?IIf(IsLaress,?BillListState.Largess,?BillListState.Natural)
????????????'是否收服務(wù)費(fèi)
????????????Dim?IsServerFee?=?makeWay.IsServerFee
????????????Dim?IsAgio?=?makeWay.IsAgio
????????????'M:菜品
????????????Dim?Id?As?Integer?=?makeWay.ID
????????????Dim?IdSource?As?String?=?"F"
????????????Dim?makeWayItem?As?BillList?=?New?BillList(Id,?name,?listState,?ckState,?curCookStateName,?CookRoomId,?count,?price,?remark,?_
????????????????????????????????????????????????????????????IdSource,?UnitId,?UnitName,?nLargessManId,?IsServerFee,?IsAgio)
????????????Return?makeWayItem
????????End?Function
#Region?"打印小票"
????????Private?Shared?Sub?PrintBillListDoc(ByVal?IsLaress?As?Boolean,?ByVal?data?As?List(Of?BillList),?ByVal?machineCode?As?String,?ByVal?currenttable?As?Table,?ByVal?userStatus?As?LoginUserStatus)
????????????'TODO?手持設(shè)備的用戶名
????????????'Dim?currentUserName?As?String?=?machineCode
????????????Dim?currentUserName?As?String?=?userStatus.UserName
????????????Dim?BLCol?As?New?BillListCollection
????????????For?Each?l?As?BillList?In?data
????????????????If?l.IsPrintB()?Then
????????????????????BLCol.Add(l)
????????????????End?If
????????????Next
????????????If?BLCol.Count?>?0?Then
????????????????For?Each?BL?As?BillList?In?BLCol
????????????????????If?IsPrintPassPrintCenter?Then
????????????????????????Dim?L?As?New?SystemLicenseRule(True)
????????????????????????Dim?P?As?New?RemotingConnection
????????????????????????Dim?C?As?CookRoom?=?CType(CookRoomCollection.GetOneCookRooms(BL.CookRoomId)(0),?CookRoom)
????????????????????????Dim?BillListDoc?As?New?PrintBillListRpt(IIf(IsLaress,?"贈(zèng)送",?BL.CurrentCookStateName),?currenttable.Name,?_
????????????????????????????????????????????????????currentUserName,?Now.ToString,?BL.MenuName,?BL.Count,?BL.UnitName,?BL.Price,?_
????????????????????????????????????????????????????BL.Count?*?BL.Price,?BL.MenuRemark,?C.PrintAreaCode,?_
????????????????????????????????????????????????????L.CurLicense.name,?currenttable.DepartmentName,?currenttable.HallName,?_
????????????????????????????????????????????????????currenttable.ServerFee,?0,?0,?0,?0,?0)
????????????????????????P.LoadBillListPiaoRpt(BillListDoc)
????????????????????Else
????????????????????End?If
????????????????Next
????????????????'Dim?doc?As?New?Doc_TolBill(cols,?Me._checkedTbl.Name,?AppConfig.CurrentUser.cName,?IIf(cols(0).ListState?=?BillListState.Natural,?"總單",?"贈(zèng)送"))
????????????????'doc.PrintController?=?New?System.Drawing.Printing.StandardPrintController()
????????????????'doc.PrintDoc()
????????????End?If
????????End?Sub
????????'''?<summary>
????????'''?是否用打印中心來打印賬單
????????'''?</summary>
????????'''?<remarks></remarks>
????????Public?Shared?ReadOnly?Property?IsPrintPassPrintCenter()?As?Boolean
????????????Get
????????????????Dim?p?As?New?SystemParamsRule(True)
????????????????Return?p.IsPrintPassPrintCenter
????????????End?Get
????????????''Get
????????????''????Return?_IsPrintPassPrintCenter
????????????''End?Get
????????????''Set(ByVal?value?As?Boolean)
????????????''????Dim?p?As?New?SystemParamsRule(True)
????????????''????_IsPrintPassPrintCenter?=?p.IsPrintPassPrintCenter
????????????''End?Set
????????End?Property
#End?Region
#Region?"打印總單"
????????Private?Shared?Sub?PrintDoc(ByVal?data?As?List(Of?BillList),?ByVal?machineCode?As?String,?ByVal?currenttable?As?Table,?ByVal?userStatus?As?LoginUserStatus)
????????????Dim?Plsts?As?New?BillListCollection
????????????For?Each?l?As?BillList?In?data
????????????????If?l.IsPrintA()?Then
????????????????????Plsts.Add(l)
????????????????End?If
????????????Next
????????????If?Plsts.Count?>?0?Then
????????????????Dim?L?As?New?SystemLicenseRule(True)
????????????????''If?AppConfig.IsPrintPassPrintCenter?Then
????????????????''????''用C1REPORT來打印
????????????????''????Dim?BLdata?As?PrintBillListData?=?New?PrintBillListData("zongdan")
????????????????''????For?Each?BL?As?BillList?In?Plsts
????????????????''????????BLdata.AddOneRow(BL)
????????????????''????Next
????????????????''????Dim?P?As?New?RemotingConnection
????????????????''????'Dim?C?As?CookRoom?=?CType(CookRoomCollection.GetOneCookRooms(lst.CookRoomId)(0),?CookRoom)
????????????????''????Dim?pbr?As?New?PrintBillListRpt("總單",?Me._checkedTbl.Name,?AppConfig.CurrentUser.cName,?_
????????????????''????????????????????????????????Now.ToString,?"",?0,?"",?0,?_
????????????????''????????????????????????????????0,?"",?_PrintArea,?_
????????????????''????????????????????????????????L.CurLicense.name,?_checkedTbl.DepartmentName,?_checkedTbl.HallName,?_
????????????????''????????????????????????????????Me._checkedTbl.ServerFee,?Plsts.TolServerFeeMoney(Me._checkedTbl.ServerFee),?0,?0,?Plsts.TolNaturalMoney,?Plsts.TolLargessMoney)?'C.PrintAreaCode)
????????????????''????P.LoadBillListZongRpt(BLdata._BillListData,?pbr)
????????????????''????''用C1REPORT來打印
????????????????''Else
????????????????''用畫的PrintDocument來打印()
????????????????Dim?msg?As?New?CashBillMsg
????????????????msg.title?=?IIf(Plsts(0).ListState?=?BillListState.Natural,?"總單",?"贈(zèng)送")
????????????????msg.HotelName?=?L.CurLicense.name
????????????????msg.DprtName?=?currenttable.DepartmentName
????????????????msg.HallName?=?currenttable.HallName
????????????????msg.TableCode?=?currenttable.Code
????????????????msg.TableName?=?currenttable.Name
????????????????msg.PrintCount?=?0
????????????????msg.BillCode?=?""
????????????????'TODO?手持設(shè)備的用戶名
????????????????msg.UserCode?=?userStatus.UserCode
????????????????msg.UserName?=?userStatus.UserName
????????????????msg.GuestCount?=?currenttable.GetOpenTables(0).GuestCount
????????????????msg.MenuInTime?=?Now
????????????????msg.ServerFeeRate?=?currenttable.ServerFee
????????????????msg.ServerFee?=?Plsts.TolServerFeeMoney(currenttable.ServerFee)
????????????????msg.AgioRate?=?0
????????????????msg.Agio?=?0
????????????????msg.MenuMoney?=?Plsts.TolAllMoney
????????????????msg.TolMoney?=?Plsts.TolAllMoney?+?Plsts.TolServerFeeMoney(currenttable.ServerFee)
????????????????'Dim?doc?As?New?Doc_TolBill(cols,?Me._checkedTbl.Name,?AppConfig.CurrentUser.cName,?IIf(cols(0).ListState?=?BillListState.Natural,?"總單",?"贈(zèng)送"))
????????????????Dim?doc?As?New?Doc_TolBill(Plsts,?msg)
????????????????doc.PrintController?=?New?System.Drawing.Printing.StandardPrintController()
????????????????doc.PrintDoc()
????????????????''用畫的PrintDocument來打印
????????????????''End?If
????????????End?If
????????End?Sub
#End?Region
????End?Class
End?Namespace
?
轉(zhuǎn)載于:https://www.cnblogs.com/callbin/archive/2010/01/03/1638104.html
總結(jié)
以上是生活随笔為你收集整理的VB.NET 委托处理 传递参数的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: VS2005+WINDDK+Driver
- 下一篇: 归并排序,不错~~