|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using POSV.Proxy.Peripherals;
|
|
|
|
|
using POSV.Entity;
|
|
|
|
|
using POSV.Utils;
|
|
|
|
|
|
|
|
|
|
namespace POSV.Component
|
|
|
|
|
{
|
|
|
|
|
public partial class CashBoxParameter : AbstractParameter
|
|
|
|
|
{
|
|
|
|
|
public CashBoxParameter()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CashBox cashBox = new CashBox();
|
|
|
|
|
|
|
|
|
|
private void buttonX2_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
cashBox.Open(this.textBoxX1.Text, (this.guestShowPortCom.SelectedItem as DevComponents.Editors.ComboItem).Text);
|
|
|
|
|
cashBox.OpenCashBox();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonX1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.textBoxX1.Text = "27,112,0,128,128";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Config> NewChanged()
|
|
|
|
|
{
|
|
|
|
|
List<Config> configs = new List<Config>();
|
|
|
|
|
Config config = new Config();
|
|
|
|
|
config.Id = IdWorkerUtils.Instance.NextId();
|
|
|
|
|
config.Group = ConfigConstant.DEVICE_GROUP;
|
|
|
|
|
config.TenantId = Global.Instance.Authc.TenantId;
|
|
|
|
|
config.Keys = ConfigConstant.DEVICE_CASHBOX_COMMAND;
|
|
|
|
|
config.Values =this.textBoxX1.Text;
|
|
|
|
|
configs.Add(config);
|
|
|
|
|
|
|
|
|
|
config = new Config();
|
|
|
|
|
config.Id = IdWorkerUtils.Instance.NextId();
|
|
|
|
|
config.Group = ConfigConstant.DEVICE_GROUP;
|
|
|
|
|
config.TenantId = Global.Instance.Authc.TenantId;
|
|
|
|
|
config.Keys = ConfigConstant.DEVICE_CASHBOX_PORT;
|
|
|
|
|
config.Values = (this.guestShowPortCom.SelectedItem as DevComponents.Editors.ComboItem).Text;
|
|
|
|
|
configs.Add(config);
|
|
|
|
|
return configs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Tuple<bool, string> SaveChanged(List<Config> data)
|
|
|
|
|
{
|
|
|
|
|
bool isSuccess = true;
|
|
|
|
|
string message = "参数更新成功";
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
using (var db = Global.Instance.OpenDataBase)
|
|
|
|
|
{
|
|
|
|
|
using (var trans = db.GetTransaction())
|
|
|
|
|
{
|
|
|
|
|
foreach (var config in data)
|
|
|
|
|
{
|
|
|
|
|
db.Save(config);
|
|
|
|
|
}
|
|
|
|
|
trans.Complete();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
isSuccess = false;
|
|
|
|
|
message = "参数更新异常";
|
|
|
|
|
|
|
|
|
|
LOGGER.Error(ex, message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
if (isSuccess)
|
|
|
|
|
{
|
|
|
|
|
//更新控件UI
|
|
|
|
|
Global.Instance.ReloadConfig(ConfigConstant.DEVICE_GROUP);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return new Tuple<bool, string>(isSuccess, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Initialize()
|
|
|
|
|
{
|
|
|
|
|
this.guestShowPortCom.SelectedIndex = 0;
|
|
|
|
|
|
|
|
|
|
this.textBoxX1.Text = Global.Instance.GlobalConfigStringValue(ConfigConstant.DEVICE_CASHBOX_COMMAND, "27,112,0,128,128");
|
|
|
|
|
this.guestShowPortCom.Text = Global.Instance.GlobalConfigStringValue(ConfigConstant.DEVICE_CASHBOX_PORT, "NONE");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|