//确定 private void BtnOK_Click(object sender, EventArgs e) { BtnOK.Enabled = false; BtnOK.Enabled = true; m_Seat = dao.get_seat("text='" + text.Text + "' or oId='" + text.Text + "'"); //m_Seat = db.Seat.FirstOrDefault(x => x.text == text.Text || x.oId == text.Text); if (m_Seat == null) { BathClass.printErrorMsg("所选择台位不存在"); return; } if (m_Status != -1) { if (m_Status != (int)m_Seat.status) { BathClass.printErrorMsg("所选择台位不可用"); return; } } else if (!m_StatusList.Contains((int)m_Seat.status)) { BathClass.printErrorMsg("所选择台位不可用"); return; } this.DialogResult = DialogResult.OK; }
//创建单个台位按钮 private static void createButton(int x, int y, CSeat table, Control sp, EventHandler btn_Click, EventHandler btn_MouseHover, ContextMenuStrip cm) { Button btn = new Button(); Single bf = 13F; int l = table.text.Length; if (l == 3) { bf = 13F; } else if (l == 4) { bf = 10f; } btn.Font = new Font("SimSun", bf); btn.Location = new System.Drawing.Point(x, y); btn.Name = table.id.ToString(); btn.Text = table.text; btn.Size = new System.Drawing.Size(btn_size, btn_size); btn.FlatStyle = FlatStyle.Popup; btn.UseVisualStyleBackColor = true; if (cm != null) { btn.ContextMenuStrip = cm; } btn.TabStop = false; btn.Click += btn_Click; btn.MouseHover += btn_MouseHover; btn_status(btn, table.status); sp.Controls.Add(btn); }
//构造函数 public OrderCheckForm(CSeat seat, string con_str, COptions options) { m_con_str = con_str; m_Seat = seat; m_options = options; dao = new DAO(con_str); InitializeComponent(); }
//构造函数 public DepositForm(CSeat seat) { db = new BathDBDataContext(LogIn.connectionString); m_Seat = seat; dao = new DAO(LogIn.connectionString); //m_Seat = db.Seat.FirstOrDefault(x => x.systemId == seat.systemId); InitializeComponent(); }
private List <string> m_Orders = new List <string>();//用以记录当前所点订单,区分退单和删除 //构造函数 public OrderForm(CSeat seat, Employee user, string con_str, bool has_user) { //st = DateTime.Now; //db = new BathDBDataContext(con_str); //m_Seat = db.Seat.FirstOrDefault(x => x.systemId == seat.systemId); m_Seat = seat; m_user = user; m_has_user = has_user; m_con_str = con_str; InitializeComponent(); abcOrderPanel.Dock = DockStyle.Fill; touchOrderPanel.Dock = DockStyle.Fill; abcOrderPanel.Visible = false; }
private Thread m_thread_seatCard;//手牌线程 public OpenSeatForm(CSeat seat, bool open) { m_open = open; //var db = new BathDBDataContext(LogIn.connectionString); m_Seats.Add(seat); seat_length = seat.text.Length; dao = new DAO(LogIn.connectionString); chainId = dao.chainId(); seatlock = LogIn.options.启用手牌锁.Value; lock_type = LogIn.options.手牌锁类型; auto_seat_card = MConvert <bool> .ToTypeOrDefault(LogIn.options.自动感应手牌, false); InitializeComponent(); seatBox.Enabled = MConvert <bool> .ToTypeOrDefault(LogIn.options.允许手工输入手牌号开牌, false); dgv_show(); }
private bool set_one_seat_status(CSeat seat) { string systemId = dao.systemId(); StringBuilder sb = new StringBuilder(); sb.Append("update [Seat] set openEmployee='" + LogIn.m_User.id + "',openTime=getdate(),systemId='"); sb.Append(systemId + "',status=2 where text='" + seat.text + "' "); var menu = dao.get_seat_menu(seat.text); if (menu != null) { sb.Append(@" insert into [Orders](menu, text,systemId,number,money,inputTime,inputEmployee,paid) "); sb.Append(@"values('" + menu.name + "','" + seat.text + "','" + systemId + "',1," + menu.price + ",getdate(),'"); sb.Append(LogIn.m_User.id + "','False')"); } sb.Append("insert into [SystemIds](systemId) values('" + systemId + "') "); if (!dao.execute_command(sb.ToString())) { BathClass.printErrorMsg("手牌:" + seat.text + "开牌失败"); return(false); } return(true); }
//构造函数 public OpenCardForm(CSeat seat) { m_Seat = seat; InitializeComponent(); }
//F6开牌 private void tool_open_seat() { //BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); string text = tSeat.Text; m_Seat = dao.get_seat("text='" + text + "' or oId='" + text + "'"); //m_Seat = db_new.Seat.FirstOrDefault(x => x.text == text || x.oId == text); if (m_Seat == null) { BathClass.printErrorMsg("手牌不可用!"); return; } switch (m_Seat.status) { case SeatStatus.AVILABLE: //可用 case SeatStatus.PAIED: //已经结账 BathClass.printErrorMsg("手牌未开牌"); break; case SeatStatus.USING: //正在使用 case SeatStatus.DEPOSITLEFT: //押金离场 if (!dao.get_authority(LogIn.m_User, "完整点单") && !dao.get_authority(LogIn.m_User, "可见本人点单")) { BathClass.printErrorMsg("权限不够!"); break; } if (MConvert <bool> .ToTypeOrDefault(m_Seat.paying, false)) { BathClass.printErrorMsg("正在结账!"); break; } //if (BathClass.ToBool(m_Seat.ordering)) //{ // BathClass.printErrorMsg("正在录单!"); // break; //} //m_Seat.ordering = true; //db_new.SubmitChanges(); OrderForm orderForm = new OrderForm(m_Seat, LogIn.m_User, LogIn.connectionString, false); orderForm.ShowDialog(); //m_Seat.ordering = false; //db_new.SubmitChanges(); break; case SeatStatus.LOCKING: //锁定 BathClass.printErrorMsg("手牌已经锁定!"); break; case SeatStatus.STOPPED: //停用 BathClass.printErrorMsg("手牌已经停用!"); break; case SeatStatus.WARNING: //警告 OrderCheckForm orderCheckForm = new OrderCheckForm(m_Seat, LogIn.connectionString, LogIn.options); orderCheckForm.ShowDialog(); break; case SeatStatus.REPAIED: BathClass.printErrorMsg("补救台位不能录单"); break; default: break; } tSeat.Text = ""; }
//点击台位按钮 private void btn_Click(object sender, EventArgs e) { Button btn = sender as Button; btn.Enabled = false; btn.Enabled = true; //BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); //m_Seat = db_new.Seat.FirstOrDefault(x => x.text == btn.Text); m_Seat = dao.get_seat("text", btn.Text); SeatStatus status = m_Seat.status; switch (status) { case SeatStatus.AVILABLE: //可用 case SeatStatus.PAIED: //已经结账 BathClass.printErrorMsg("手牌未开牌"); break; case SeatStatus.USING: //正在使用 case SeatStatus.DEPOSITLEFT: //押金离场 if (!dao.get_authority(LogIn.m_User, "完整点单") && !dao.get_authority(LogIn.m_User, "可见本人点单")) { BathClass.printErrorMsg("权限不够!"); break; } if (MConvert <bool> .ToTypeOrDefault(m_Seat.paying, false)) { BathClass.printErrorMsg("正在结账!"); break; } //if (BathClass.ToBool(m_Seat.ordering)) //{ // BathClass.printErrorMsg("正在录单!"); // break; //} //m_Seat.ordering = true; //db_new.SubmitChanges(); OrderForm orderForm = new OrderForm(m_Seat, LogIn.m_User, LogIn.connectionString, false); orderForm.ShowDialog(); //m_Seat.ordering = false; //db_new.SubmitChanges(); break; case SeatStatus.LOCKING: //锁定 BathClass.printErrorMsg("手牌已经锁定!"); break; case SeatStatus.STOPPED: //停用 BathClass.printErrorMsg("台位已经停用!"); break; case SeatStatus.WARNING: //警告 OrderCheckForm orderCheckForm = new OrderCheckForm(m_Seat, LogIn.connectionString, LogIn.options); orderCheckForm.ShowDialog(); break; case SeatStatus.REPAIED: BathClass.printErrorMsg("补救台位不能录单"); break; default: break; } }
public ChangeRoomForm(CSeat seat, string oper) { m_seat = seat; m_oper = oper; InitializeComponent(); }
public ReserveOverDueForm(Seat seat) { dao = new DAO(LogIn.connectionString); m_seat = dao.get_seat("text='" + seat.text + "'"); InitializeComponent(); }
//非自动感应手牌 private void open_seat_noauto() { try { if (!seatlock) { BathClass.printErrorMsg("未启用手牌锁"); return; } if (lock_type == "欧亿达") { Thread.Sleep(500); if (OYD.FKOPEN() != 1) { return; } OYD.CH375SetTimeout(0, 5000, 5000); } byte[] buff = new byte[200]; string seat_text = ""; int rt = -1; if (lock_type == "欧亿达") { Thread.Sleep(500); rt = OYD.OYEDA_id(buff); } else if (lock_type == "锦衣卫") { rt = JYW.ReadID(buff); } else if (lock_type == "RF") { rt = RF.RF_RFID(ref seat_text); } if (rt != 0) { return; } CSeat seat = null; if (lock_type == "欧亿达") { seat_text = Encoding.Default.GetString(buff, 0, 20).Trim(); seat_text = seat_text.Substring(0, 16); } else if (lock_type == "锦衣卫") { seat_text = BathClass.byteToHexStr(buff); seat_text = seat_text.Substring(0, 16); } seat = dao.get_seat("oId", seat_text); if (seat == null) { BathClass.printErrorMsg("手牌" + seat_text + "不存在"); return; } if (seat.status == SeatStatus.AVILABLE || seat.status == SeatStatus.PAIED) { if (lock_type == "欧亿达") { Thread.Sleep(500); } if ((lock_type == "欧亿达" && OYD.OYEDA_fk(buff) != 0) || (lock_type == "锦衣卫" && JYW.FK(buff) != 0) || (lock_type == "RF" && RF.RF_FK(seat_text) != 0)) { return; } if (!set_one_seat_status(seat)) { return; } if (!m_Seats.Select(x => x.text).Contains(seat.text)) { m_Seats.Add(seat); } } else if (seat.status == SeatStatus.USING || seat.status == SeatStatus.DEPOSITLEFT) { if (!m_Seats.Select(x => x.text).Contains(seat.text)) { m_Seats.Add(seat); } } dgv_show(); } catch (System.Exception e) { MessageBox.Show(e.Message); } }
private void open_one_seat(CSeat seat, bool child) { string systemId = dao.systemId(); StringBuilder sb = new StringBuilder(); if (seat.status == SeatStatus.PAIED) { sb.Append(dao.reset_seat_string() + "text='" + seat.text + "')"); //BathClass.reset_seat(seat); //dc.SubmitChanges(); } sb.Append("update [Seat] set openEmployee='" + LogIn.m_User.id + "',openTime=getdate(),systemId='"); sb.Append(systemId + "',status=2"); //seat.openEmployee = LogIn.m_User.id.ToString(); //seat.openTime = BathClass.Now(LogIn.connectionString); //seat.systemId = BathClass.systemId(dc, LogIn.connectionString); //seat.status = 2; if (!seatlock) { sb.Append(", chainId='" + chainId + "' "); } //seat.chainId = chainId; sb.Append("where text='" + seat.text + "'"); var menu = dao.get_seat_menu(seat.text); //SeatType seatType = dc.SeatType.FirstOrDefault(x => x.id == seat.typeId); //var menu = dc.Menu.FirstOrDefault(x => x.id == seatType.menuId); if (menu != null) { sb.Append(@" insert into [Orders](menu, text,systemId,number,money,inputTime,inputEmployee,paid) "); sb.Append(@"values('" + menu.name + "','" + seat.text + "','" + systemId + "',1," + menu.price + ",getdate(),'"); sb.Append(LogIn.m_User.id + "','False')"); //Orders order = new Orders(); //order.menu = menu.name; //order.text = seat.text; //order.systemId = seat.systemId; //order.number = 1; //order.money = menu.price; //order.inputTime = BathClass.Now(LogIn.connectionString); //order.inputEmployee = LogIn.m_User.id.ToString(); //order.paid = false; //dc.Orders.InsertOnSubmit(order); } if (child) { var child_menu = dao.get_Menu("name", "儿童浴资"); //var child_menu = dc.Menu.FirstOrDefault(x => x.name == "儿童浴资"); if (child_menu != null) { sb.Append(@" insert into [Orders](menu, text,systemId,number,money,inputTime,inputEmployee,paid) "); sb.Append(@"values('儿童浴资','" + seat.text + "','" + systemId + "',1," + child_menu.price + ",getdate(),'"); sb.Append(LogIn.m_User.id + "','False')"); //Orders order = new Orders(); //order.menu = child_menu.name; //order.text = seat.text; //order.systemId = seat.systemId; //order.number = 1; //order.money = child_menu.price; //order.inputTime = BathClass.Now(LogIn.connectionString); //order.inputEmployee = LogIn.m_User.id.ToString(); //order.paid = false; //dc.Orders.InsertOnSubmit(order); } } sb.Append("insert into [SystemIds](systemId) values('" + systemId + "') "); //var id = new SystemIds(); //id.systemId = seat.systemId; //dc.SystemIds.InsertOnSubmit(id); //BathClass.SubmitChanges(dc); if (!dao.execute_command(sb.ToString())) { BathClass.printErrorMsg("手牌:" + seat.text + "开牌失败"); return; } }
//手牌线程 private void seat_card_thread() { while (true) { if (_close) { break; } try { if (lock_type == "欧亿达") { Thread.Sleep(500); if (OYD.FKOPEN() != 1) { continue; } OYD.CH375SetTimeout(0, 5000, 5000); } byte[] buff = new byte[200]; string seat_text = ""; int rt = -1; if (lock_type == "欧亿达") { Thread.Sleep(500); rt = OYD.OYEDA_id(buff); } else if (lock_type == "锦衣卫") { rt = JYW.ReadID(buff); } else if (lock_type == "RF") { rt = RF.RF_RFID(ref seat_text); } if (rt != 0) { continue; } CSeat seat = null; if (lock_type == "欧亿达") { seat_text = Encoding.Default.GetString(buff, 0, 20).Trim(); seat_text = seat_text.Substring(0, 16); } else if (lock_type == "锦衣卫") { seat_text = BathClass.byteToHexStr(buff); seat_text = seat_text.Substring(0, 16); } seat = dao.get_seat("oId", seat_text); if (seat == null) { if (this.InvokeRequired) { this.Invoke(new delegate_print_msg(BathClass.printErrorMsg), new object[] { "手牌" + seat_text + "不存在" }); } else { BathClass.printErrorMsg("手牌" + seat_text + "不存在"); } continue; } if (seat.status == SeatStatus.AVILABLE || seat.status == SeatStatus.PAIED) { if (lock_type == "欧亿达") { Thread.Sleep(500); } if ((lock_type == "欧亿达" && OYD.OYEDA_fk(buff) != 0) || (lock_type == "锦衣卫" && JYW.FK(buff) != 0) || (lock_type == "RF" && RF.RF_FK(seat_text) != 0)) { continue; } if (!set_one_seat_status(seat)) { continue; } if (!m_Seats.Select(x => x.text).Contains(seat.text)) { m_Seats.Add(seat); } } else if (seat.status == SeatStatus.USING || seat.status == SeatStatus.DEPOSITLEFT) { if (!m_Seats.Select(x => x.text).Contains(seat.text)) { m_Seats.Add(seat); } } if (this.InvokeRequired) { this.Invoke(new delegate_dgv_show(dgv_show)); } else { dgv_show(); } } catch (Exception ex) { } } }
//确定 private void btnOk_Click(object sender, EventArgs e) { if (btnOk.Text == "读房间") { m_newSeat = dao.get_seat("text", TextNewRoom.Text); if (m_newSeat == null) { BathClass.printErrorMsg("房间:" + TextNewRoom.Text + "未定义!"); TextNewRoom.SelectAll(); return; } if (m_newSeat.status != SeatStatus.AVILABLE && m_newSeat.status != SeatStatus.PAIED && m_newSeat.status != SeatStatus.RESERVE) { BathClass.printErrorMsg("房间号" + roomNumber.Text + "不可用"); return; } btnOk.Text = "开新房"; LabelInfo.Text = "请放置新房卡......"; byte[] buff = new byte[200]; int hotelId = MConvert <int> .ToTypeOrDefault(IOUtil.get_config_by_key(ConfigKeys.KEY_HOTELID), -1); if (hotelId == -1) { BathClass.printErrorMsg("未定义酒店标志!"); return; } int rt = RoomProRFL.CardErase(1, hotelId, buff); RoomProRFL.Buzzer(1, 40); if (rt != 0) { BathClass.printErrorMsg("退房失败!"); return; } } else if (btnOk.Text == "开新房") { int cardNo = 0; byte[] buff = new byte[200]; //int rt = RoomProRFL.initializeUSB(1); string BDate = m_seat.openTime.Value.ToString("yyMMddHHmm"); string EDate = m_seat.dueTime.Value.ToString("yyMMddHHmm"); int hotelId = MConvert <int> .ToTypeOrDefault(IOUtil.get_config_by_key(ConfigKeys.KEY_HOTELID), -1); if (hotelId == -1) { BathClass.printErrorMsg("未定义酒店标志!"); return; } int rt = RoomProRFL.GuestCard(1, hotelId, cardNo, 0, 0, 1, BDate, EDate, m_newSeat.oId, buff); RoomProRFL.Buzzer(1, 40); if (rt != 0) { BathClass.printErrorMsg("开房失败!"); return; } string cmd_str = @"update [Orders] set text='" + m_newSeat.text + "' where systemId='" + m_seat.systemId + "' "; cmd_str += @"update [Seat] set systemId='" + m_seat.systemId + "'"; cmd_str += ",openTime='" + m_seat.openTime.Value.ToString("yyyy-MM-dd HH:mm:ss") + "',openEmployee='" + m_oper + "',chainId='" + m_seat.chainId + "',status=" + (int)m_seat.status + ",ordering='False'" + ",deposit=" + m_seat.deposit + ",depositBank=" + m_seat.depositBank + ",dueTime='" + m_seat.dueTime.Value.ToString("yyyy-MM-dd HH:mm:ss") + "'"; if (m_seat.name != null && m_seat.name != "") { cmd_str += ",name='" + m_seat.name + "'"; } if (m_seat.phone != null && m_seat.phone != "") { cmd_str += ",phone='" + m_seat.phone + "'"; } if (m_seat.note != null && m_seat.note != "") { cmd_str += ",note='" + m_seat.note + "'"; } cmd_str += " where id=" + m_newSeat.id; cmd_str += dao.reset_seat_string() + "text='" + m_seat.text + "')"; if (!dao.execute_command(cmd_str)) { BathClass.printErrorMsg("更换手牌失败,请重试!"); return; } this.DialogResult = DialogResult.OK; this.Close(); } }
public OpenDepositForm(CSeat seat) { m_seat = seat; InitializeComponent(); }
//构造函数 public MemberForm(CSeat seat) { m_Seat = seat; InitializeComponent(); }
public OpenRoomForm(CSeat seat) { m_seat = seat; InitializeComponent(); }
public RepayActListForm(CSeat seat, Employee user) { m_user = user; m_seat_text = seat.text; InitializeComponent(); }
public static void reprint_bill(CSeat seat, DAO dao, bool use_pad) { if (seat.status != SeatStatus.PAIED) { BathClass.printErrorMsg("已经重新开牌,不能重打账单!"); return; } var account = dao.get_account("abandon is null and systemId like '%" + seat.systemId + "%'"); if (account == null) { return; } var seats_txt = account.text.Split('|'); string state_str = ""; int count = seats_txt.Count(); for (int i = 0; i < count; i++) { state_str += "text='" + seats_txt[i] + "'"; if (i != count - 1) { state_str += " or "; } } var seats_reprint = dao.get_seats(state_str); List <string> m_rooms = new List <string>(); foreach (var s in seats_reprint) { m_rooms.Add(dao.get_seat_room(s.text)); } DataGridView dgv = new DataGridView(); DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn(); col.HeaderText = "手牌"; dgv.Columns.Add(col); DataGridViewTextBoxColumn coll = new DataGridViewTextBoxColumn(); coll.HeaderText = "房间"; dgv.Columns.Add(coll); DataGridViewTextBoxColumn col1 = new DataGridViewTextBoxColumn(); col1.HeaderText = "项目名称"; dgv.Columns.Add(col1); DataGridViewTextBoxColumn col2 = new DataGridViewTextBoxColumn(); col2.HeaderText = "技师"; dgv.Columns.Add(col2); DataGridViewTextBoxColumn col3 = new DataGridViewTextBoxColumn(); col3.HeaderText = "单价"; dgv.Columns.Add(col3); DataGridViewTextBoxColumn col4 = new DataGridViewTextBoxColumn(); col4.HeaderText = "数量"; dgv.Columns.Add(col4); DataGridViewTextBoxColumn col5 = new DataGridViewTextBoxColumn(); col5.HeaderText = "金额"; dgv.Columns.Add(col5); List <string> printCols = new List <string>(); printCols.Add("手牌"); if (use_pad) { printCols.Add("房间"); } printCols.Add("项目名称"); printCols.Add("单价"); printCols.Add("数量"); printCols.Add("金额"); var use_disAssemble = MConvert <bool> .ToTypeOrDefault(LogIn.options.启用大项拆分, false); var co_name = LogIn.options.companyName; if (account != null) { try { var db = new BathDBDataContext(LogIn.connectionString); var orders = db.HisOrders.Where(x => x.deleteEmployee == null && x.accountId == account.id).OrderBy(x => x.text); foreach (var order in orders) { var cmenu = db.Menu.FirstOrDefault(x => x.name == order.menu); var price = ""; if (cmenu != null) { price = cmenu.price.ToString(); if (use_disAssemble && db.BigCombo.FirstOrDefault(x => x.menuid == cmenu.id) != null) { var substIDs = BathClass.disAssemble(db.BigCombo.FirstOrDefault(x => x.menuid == cmenu.id).substmenuid, Constants.SplitChar); for (int i = 0; i < substIDs.Count; i++) { var menu = db.Menu.FirstOrDefault(x => x.id == substIDs[i]); dgv.Rows.Add(order.text, order.roomId, menu.name, order.technician, menu.price, order.number, menu.price * MConvert <double> .ToTypeOrDefault(order.number, 0)); } continue; } } dgv.Rows.Add(order.text, order.roomId, order.menu, order.technician, price, order.number, order.money); } PrintBill.Print_DataGridView(seats_reprint, m_rooms, account, "存根单", dgv, printCols, co_name); } catch (System.Exception ex) { BathClass.printErrorMsg(ex.ToString()); } } else { double money = 0; try { var db = new BathDBDataContext(LogIn.connectionString); var orders = db.Orders.Where(x => x.text == seat.text && x.systemId != seat.systemId && x.deleteEmployee == null).OrderBy(x => x.text); foreach (var order in orders) { var cmenu = db.Menu.FirstOrDefault(x => x.name == order.menu); var price = ""; if (cmenu != null) { price = cmenu.price.ToString(); } dgv.Rows.Add(order.text, order.roomId, order.menu, order.technician, price, order.number, order.money); } if (dgv.Rows.Count != 0) { BathClass.printErrorMsg("未检测到转账单或者结账单"); return; } PrintSeatBill.Print_DataGridView(seats_reprint, m_rooms, "", "转账确认单", dgv, printCols, money.ToString(), co_name); } catch (System.Exception ex) { BathClass.printErrorMsg(ex.ToString()); } } }
public ContinueRoomForm(CSeat seat) { m_seat = seat; InitializeComponent(); }