538 lines
20 KiB
C#
538 lines
20 KiB
C#
|
|
using JJMediSys.cs;
|
|||
|
|
using JJServer;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Drawing;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Runtime.InteropServices;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
//using BLECom;
|
|||
|
|
using static JJMediSys.AlertForm;
|
|||
|
|
using static JJMediSys.SystemSet;
|
|||
|
|
using Timer = System.Windows.Forms.Timer;
|
|||
|
|
|
|||
|
|
namespace JJMediSys
|
|||
|
|
{
|
|||
|
|
public partial class Dispensing : Form
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
public static int JyxxId = 0;
|
|||
|
|
public const int HTCAPTION = 0x0002;
|
|||
|
|
public bool DispenseCancel =false;
|
|||
|
|
public bool DispenseRetry = false;
|
|||
|
|
public bool DispenseNext = false;
|
|||
|
|
public bool isStop = false;
|
|||
|
|
public bool WinClose = false;
|
|||
|
|
public int TimeDelay = 8;
|
|||
|
|
|
|||
|
|
public string ErrorInfoStr = "";
|
|||
|
|
public SystemSet fm1;
|
|||
|
|
public List<PatientDatail> mpatientDatails;
|
|||
|
|
|
|||
|
|
//public BLECom.JJBLE jJBLE ;
|
|||
|
|
Timer timer2;
|
|||
|
|
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
|
|||
|
|
private static extern IntPtr CreateRoundRectRgn
|
|||
|
|
(
|
|||
|
|
int nLeftRect, // x-coordinate of upper-left corner
|
|||
|
|
int nTopRect, // y-coordinate of upper-left corner
|
|||
|
|
int nRightRect, // x-coordinate of lower-right corner
|
|||
|
|
int nBottomRect, // y-coordinate of lower-right corner
|
|||
|
|
int nWidthEllipse, // height of ellipse
|
|||
|
|
int nHeightEllipse // width of ellipse
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
[DllImport("dwmapi.dll")]
|
|||
|
|
public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMarInset);
|
|||
|
|
|
|||
|
|
[DllImport("dwmapi.dll")]
|
|||
|
|
public static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize);
|
|||
|
|
|
|||
|
|
[DllImport("dwmapi.dll")]
|
|||
|
|
public static extern int DwmIsCompositionEnabled(ref int pfEnabled);
|
|||
|
|
|
|||
|
|
private bool m_aeroEnabled; // variables for box shadow
|
|||
|
|
private const int CS_DROPSHADOW = 0x00020000;
|
|||
|
|
private const int WM_NCPAINT = 0x0085;
|
|||
|
|
private const int WM_ACTIVATEAPP = 0x001C;
|
|||
|
|
|
|||
|
|
public struct MARGINS // struct for box shadow
|
|||
|
|
{
|
|||
|
|
public int leftWidth;
|
|||
|
|
public int rightWidth;
|
|||
|
|
public int topHeight;
|
|||
|
|
public int bottomHeight;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private const int WM_NCHITTEST = 0x84; // variables for dragging the form
|
|||
|
|
private const int HTCLIENT = 0x1;
|
|||
|
|
|
|||
|
|
protected override CreateParams CreateParams
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
m_aeroEnabled = CheckAeroEnabled();
|
|||
|
|
|
|||
|
|
CreateParams cp = base.CreateParams;
|
|||
|
|
if (!m_aeroEnabled)
|
|||
|
|
cp.ClassStyle |= CS_DROPSHADOW;
|
|||
|
|
|
|||
|
|
return cp;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private bool CheckAeroEnabled()
|
|||
|
|
{
|
|||
|
|
if (Environment.OSVersion.Version.Major >= 6)
|
|||
|
|
{
|
|||
|
|
int enabled = 0;
|
|||
|
|
DwmIsCompositionEnabled(ref enabled);
|
|||
|
|
return (enabled == 1) ? true : false;
|
|||
|
|
}
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected override void WndProc(ref Message m)
|
|||
|
|
{
|
|||
|
|
switch (m.Msg)
|
|||
|
|
{
|
|||
|
|
case WM_NCPAINT: // box shadow
|
|||
|
|
if (m_aeroEnabled)
|
|||
|
|
{
|
|||
|
|
var v = 2;
|
|||
|
|
DwmSetWindowAttribute(this.Handle, 2, ref v, 4);
|
|||
|
|
MARGINS margins = new MARGINS()
|
|||
|
|
{
|
|||
|
|
bottomHeight = 1,
|
|||
|
|
leftWidth = 1,
|
|||
|
|
rightWidth = 1,
|
|||
|
|
topHeight = 1
|
|||
|
|
};
|
|||
|
|
DwmExtendFrameIntoClientArea(this.Handle, ref margins);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
base.WndProc(ref m);
|
|||
|
|
|
|||
|
|
if (m.Msg == WM_NCHITTEST && (int)m.Result == HTCLIENT) // drag the form
|
|||
|
|
m.Result = (IntPtr)HTCAPTION;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
public Dispensing(SystemSet form1,List<PatientDatail> patientDatails)
|
|||
|
|
{
|
|||
|
|
m_aeroEnabled = false;
|
|||
|
|
InitializeComponent();
|
|||
|
|
fm1 = form1;
|
|||
|
|
mpatientDatails = patientDatails;
|
|||
|
|
ItemDetail.GetType().GetProperty
|
|||
|
|
("DoubleBuffered", System.Reflection.BindingFlags.Instance
|
|||
|
|
| System.Reflection.BindingFlags.NonPublic)
|
|||
|
|
.SetValue(ItemDetail, true, null);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
private async void Dispensing_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
IsDispensing = true;
|
|||
|
|
logger.Info("IsDispensing = true");
|
|||
|
|
|
|||
|
|
ItemDetail.AutoScroll = true;
|
|||
|
|
// 设置FlowLayoutPanel的内容自动换行
|
|||
|
|
ItemDetail.WrapContents = true;
|
|||
|
|
if (SystemSet.DispenseWindowLocation.X == 9999)
|
|||
|
|
{
|
|||
|
|
int x = (Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2;
|
|||
|
|
int y = (Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 2;
|
|||
|
|
SystemSet.DispenseWindowLocation = new Point(x, y);
|
|||
|
|
}
|
|||
|
|
SystemSet.CancelDispensing = false;
|
|||
|
|
// 设置窗口位置
|
|||
|
|
this.Location = SystemSet.DispenseWindowLocation;
|
|||
|
|
TimeDelay = SystemSet.TimeDelay;
|
|||
|
|
Timer timer1 = new Timer();
|
|||
|
|
timer1.Interval = 500; // 每隔500毫秒触发一次
|
|||
|
|
timer1.Tick += timerforflash_Tick; // 绑定事件处理程序
|
|||
|
|
timer1.Start(); // 启动定时器
|
|||
|
|
|
|||
|
|
int TotalPidCount = 0;
|
|||
|
|
int TotalNum = 0;
|
|||
|
|
foreach (PatientDatail patientDatail in mpatientDatails)
|
|||
|
|
{
|
|||
|
|
TotalPidCount++;
|
|||
|
|
TotalNum += patientDatail.ItemCount;
|
|||
|
|
}
|
|||
|
|
LabPIdTotal.Text = TotalPidCount.ToString();
|
|||
|
|
LabSGTotal.Text = TotalNum.ToString();
|
|||
|
|
LabMsg.Text = "请放入接管盒";
|
|||
|
|
|
|||
|
|
|
|||
|
|
timer2 = new Timer();
|
|||
|
|
timer2.Interval = 100; // 每隔500毫秒触发一次
|
|||
|
|
timer2.Tick += timerforTask_Tick; // 绑定事件处理程序
|
|||
|
|
timer2.Start(); // 启动定时器
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
private void timerforTask_Tick(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
timer2.Stop();
|
|||
|
|
Dispense();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
public async void Dispense()
|
|||
|
|
{
|
|||
|
|
int CurPersonID = 0;
|
|||
|
|
int CurTotalSgCount = 0;
|
|||
|
|
for (int i = 0; i < mpatientDatails.Count; i++)
|
|||
|
|
{
|
|||
|
|
DispenseCancel = false;
|
|||
|
|
DispenseRetry = false;
|
|||
|
|
DispenseNext = false;
|
|||
|
|
PatientDatail patientDatail = mpatientDatails[i];
|
|||
|
|
|
|||
|
|
|
|||
|
|
List<ItemsShow> itemsShows = new List<ItemsShow>();
|
|||
|
|
int SGcount = 0;
|
|||
|
|
int BQcount = 0;
|
|||
|
|
bool isAllRecp = true;
|
|||
|
|
foreach (JJServer.jyData jyData in patientDatail.jyDatas)
|
|||
|
|
{
|
|||
|
|
ItemsShow itemsShow = new ItemsShow(jyData);
|
|||
|
|
itemsShows.Add(itemsShow);
|
|||
|
|
|
|||
|
|
if (jyData.bqtype==2)
|
|||
|
|
{
|
|||
|
|
BQcount++;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SGcount++;
|
|||
|
|
isAllRecp = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//fm1.GetDeviceStatusNoUI();
|
|||
|
|
|
|||
|
|
StartCheckBox:
|
|||
|
|
this.Invoke((MethodInvoker)delegate
|
|||
|
|
{
|
|||
|
|
LabMsg.Text = "请放入接管盒";
|
|||
|
|
labCurName.Text = patientDatail.PatientInfo.Name;
|
|||
|
|
labCurBed.Text = patientDatail.PatientInfo.BedNo;
|
|||
|
|
LabPIdCur.Text = (++CurPersonID).ToString();
|
|||
|
|
labcurcount.Text = patientDatail.ItemCount.ToString();
|
|||
|
|
labcurSGcount.Text = SGcount.ToString();
|
|||
|
|
labcurBQcount.Text = BQcount.ToString();
|
|||
|
|
ItemDetail.Controls.Clear();
|
|||
|
|
ItemDetail.Controls.AddRange(itemsShows.ToArray());
|
|||
|
|
ItemDetail.WrapContents = false;
|
|||
|
|
this.Update();
|
|||
|
|
});
|
|||
|
|
if(!isAllRecp)
|
|||
|
|
{
|
|||
|
|
while (!mTubeLabelTool.WaitTubeTakeBox() && !DispenseCancel)
|
|||
|
|
{
|
|||
|
|
await Task.Delay(500);
|
|||
|
|
}
|
|||
|
|
if (DispenseCancel) //手动取消
|
|||
|
|
{
|
|||
|
|
logger.Info("取消发管!");
|
|||
|
|
Task.Run(() => PublicStatic.EventMgr.ExcuteCmd($"insert into EVENTINFOLIST(Msg,Details,Time) Values('{"取消发管"}','发管信息 \r\n患者姓名:{patientDatail.PatientInfo.Name} \r\n试管数量:{ SGcount.ToString()} \r\n标签数量:{ BQcount.ToString()}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}')"));
|
|||
|
|
this.Invoke((MethodInvoker)delegate
|
|||
|
|
{
|
|||
|
|
AlertForm.ShowAlert("取消发管", AlertType.Info, 3);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
this.Invoke((MethodInvoker)delegate
|
|||
|
|
{
|
|||
|
|
this.Closewin();
|
|||
|
|
});
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
this.Invoke((MethodInvoker)delegate
|
|||
|
|
{
|
|||
|
|
LabMsg.Text = "正在处理中";
|
|||
|
|
});
|
|||
|
|
//if (SystemSet.UseBle)
|
|||
|
|
//{
|
|||
|
|
// BleTask bleTask = new BleTask();
|
|||
|
|
// if (!fm1.ExtBle)
|
|||
|
|
// {
|
|||
|
|
// jJBLE = new JJBLE();
|
|||
|
|
// //扫码 获取盒子蓝牙地址
|
|||
|
|
// JJBLE.BLEConnectionResult bleResult = await jJBLE.Matching(mTubeLabelTool.BleBarcodeStr); //连接蓝牙
|
|||
|
|
// if (bleResult != JJBLE.BLEConnectionResult.Success)
|
|||
|
|
// {
|
|||
|
|
// ErrMsgShow errMsgShow = new ErrMsgShow(this);
|
|||
|
|
// ErrorInfoStr = "试管盒蓝牙连接失败,请重试";
|
|||
|
|
// DialogResult result = errMsgShow.ShowDialog();
|
|||
|
|
// if (result == DialogResult.Retry)
|
|||
|
|
// goto StartCheckBox;
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// this.Invoke((MethodInvoker)delegate
|
|||
|
|
// {
|
|||
|
|
// this.Closewin();
|
|||
|
|
// });
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// bleTask.TargDevice = jJBLE.currentDevice;
|
|||
|
|
// }
|
|||
|
|
// bleTask.MACstr = mTubeLabelTool.BleBarcodeStr.Substring(mTubeLabelTool.BleBarcodeStr.Length - 17, 17);
|
|||
|
|
|
|||
|
|
// string Bedno = "";
|
|||
|
|
// if (patientDatail.PatientInfo.BedNo.Length == 6)
|
|||
|
|
// {
|
|||
|
|
// Bedno = patientDatail.PatientInfo.BedNo.Substring(3, 2) + "-" + patientDatail.PatientInfo.BedNo.Substring(5, 1);
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// Bedno = patientDatail.PatientInfo.BedNo;
|
|||
|
|
|
|||
|
|
// bleTask.CodeStr = "D000000125040|#000000@D125000125040|#FF0000@D000045080030|#000000@TB16000010125030|C^#FFFFFF^24楼病区@T 10125002130020|C^#FFFFFF^浙江大学医学院附属@TB16125015130030|C^#FFFFFF^邵逸夫医院@TB16000050080030|R^#FFFFFF^床位号@TB16080050080040|L^#FF0000^" + Bedno + "@TB18150060110060|L^" + patientDatail.PatientInfo.Name + "@TB18120100150040|C^#FF0000^" + SGcount.ToString() + "管" + BQcount.ToString() + "签@B000085120025|J" + patientDatail.PatientInfo.CardNo + "@T 10015110120020|C^J" + patientDatail.PatientInfo.CardNo;
|
|||
|
|
// logger.Info("BLEImage:" + bleTask.CodeStr);
|
|||
|
|
// SystemSet.bleTaskQueue.Enqueue(bleTask);
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
|
|||
|
|
CurTotalSgCount = CurTotalSgCount + patientDatail.ItemCount;
|
|||
|
|
LabSgCur.Text = CurTotalSgCount.ToString();
|
|||
|
|
string Result = "";
|
|||
|
|
lock (locker)
|
|||
|
|
{
|
|||
|
|
if(patientDatail.jyDatas[0].bqtype==3)
|
|||
|
|
{
|
|||
|
|
Result = "0|";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Result = mTubeLabelTool.Dispense(patientDatail);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
string[] Arr = Result.Split('|');
|
|||
|
|
if (Arr[0] == "0")
|
|||
|
|
{
|
|||
|
|
logger.Info("发管成功!");
|
|||
|
|
Task.Run(() => PublicStatic.EventMgr.ExcuteCmd($"insert into EVENTINFOLIST(Msg,Details,Time) Values('{"发管成功"}','发管信息 \r\n患者姓名:{patientDatail.PatientInfo.Name} \r\n试管数量:{ SGcount.ToString()} \r\n标签数量:{ BQcount.ToString()}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}')"));
|
|||
|
|
this.Invoke((MethodInvoker)delegate
|
|||
|
|
{
|
|||
|
|
AlertForm.ShowAlert("发管成功", AlertType.Success, 3);
|
|||
|
|
});
|
|||
|
|
this.Invoke((MethodInvoker)delegate
|
|||
|
|
{
|
|||
|
|
LabMsg.Text = "当前患者发管完成,共【" + patientDatail.ItemCount.ToString() + "】管,请取走接管盒";
|
|||
|
|
logger.Info($"发管成功!i={i} mpatientDatails.Count={mpatientDatails.Count-1}");
|
|||
|
|
if (fm1.AutoClose && i == mpatientDatails.Count-1)
|
|||
|
|
EnableTimer();
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
if(MainForm.ifWindowOpen("门诊采血"))
|
|||
|
|
{
|
|||
|
|
MZCY.ConformTask conformTask = new MZCY.ConformTask();
|
|||
|
|
conformTask.orginDatas = patientDatail.OrginDatas;
|
|||
|
|
MZCY.ConformTaskQueue.Enqueue(conformTask);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
while (!mTubeLabelTool.WaitTubeTakeBoxTaken() && !isCancel() && !isClose())
|
|||
|
|
{
|
|||
|
|
await Task.Delay(500);
|
|||
|
|
}
|
|||
|
|
if (isCancel())
|
|||
|
|
{
|
|||
|
|
logger.Info("取消发管!");
|
|||
|
|
this.Invoke((MethodInvoker)delegate
|
|||
|
|
{
|
|||
|
|
AlertForm.ShowAlert("取消发管", AlertType.Info, 3);
|
|||
|
|
});
|
|||
|
|
this.Invoke((MethodInvoker)delegate
|
|||
|
|
{
|
|||
|
|
Closewin();
|
|||
|
|
});
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else if(isClose()|| i == mpatientDatails.Count - 1)
|
|||
|
|
{
|
|||
|
|
this.Invoke((MethodInvoker)delegate
|
|||
|
|
{
|
|||
|
|
logger.Info("CLose Window");
|
|||
|
|
Closewin();
|
|||
|
|
});
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (MainForm.ifWindowOpen("门诊采血"))
|
|||
|
|
{
|
|||
|
|
MZCY.ConformTask conformTask = new MZCY.ConformTask();
|
|||
|
|
conformTask.orginDatas = patientDatail.OrginDatas;
|
|||
|
|
MZCY.ConformTaskQueue.Enqueue(conformTask);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
logger.Info(string.Format("发管失败:{0}", Arr[1]));
|
|||
|
|
Task.Run(() => PublicStatic.EventMgr.ExcuteCmd($"insert into EVENTINFOLIST(Msg,Details,Time) Values('{"发管失败"}','发管信息 \r\n患者姓名:{patientDatail.PatientInfo.Name} \r\n试管数量:{ SGcount.ToString()} \r\n标签数量:{ BQcount.ToString()} \r\n错误信息:{ Arr[1]}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}')"));
|
|||
|
|
this.Invoke((MethodInvoker)delegate
|
|||
|
|
{
|
|||
|
|
AlertForm.ShowAlert(string.Format("发管失败:{0}", Arr[1]), AlertType.Error, 3);
|
|||
|
|
});
|
|||
|
|
this.Invoke((MethodInvoker)delegate
|
|||
|
|
{
|
|||
|
|
ErrorInfoStr = Arr[1];// "当前患者发管失败,共【" + patientDatail.ItemCount.ToString() + "】管,请核查";
|
|||
|
|
LabMsg.Text = ErrorInfoStr;
|
|||
|
|
DispenseMsg dispenseMsg = new DispenseMsg(this);
|
|||
|
|
dispenseMsg.Show();
|
|||
|
|
});
|
|||
|
|
while (!isCancel() && !isRetry() && !isNext())
|
|||
|
|
{
|
|||
|
|
await Task.Delay(500);
|
|||
|
|
}
|
|||
|
|
if (isNext())
|
|||
|
|
continue;
|
|||
|
|
if (isRetry()) //重试
|
|||
|
|
{
|
|||
|
|
logger.Info("isRetry");
|
|||
|
|
i--;
|
|||
|
|
LabPIdCur.Text = (--CurPersonID).ToString();
|
|||
|
|
CurTotalSgCount = CurTotalSgCount - patientDatail.ItemCount;
|
|||
|
|
LabSgCur.Text = CurTotalSgCount.ToString();
|
|||
|
|
}
|
|||
|
|
if (isCancel())
|
|||
|
|
{
|
|||
|
|
logger.Info("取消发管!");
|
|||
|
|
Task.Run(() => PublicStatic.EventMgr.ExcuteCmd($"insert into EVENTINFOLIST(Msg,Details,Time) Values('{"取消发管"}','发管信息 \r\n患者姓名:{patientDatail.PatientInfo.Name} \r\n试管数量:{ SGcount.ToString()} \r\n标签数量:{ BQcount.ToString()}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}')"));
|
|||
|
|
this.Invoke((MethodInvoker)delegate
|
|||
|
|
{
|
|||
|
|
AlertForm.ShowAlert("取消发管", AlertType.Info, 3);
|
|||
|
|
});
|
|||
|
|
this.Invoke((MethodInvoker)delegate
|
|||
|
|
{
|
|||
|
|
Closewin();
|
|||
|
|
});
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
this.Invoke((MethodInvoker)delegate
|
|||
|
|
{
|
|||
|
|
Closewin();
|
|||
|
|
});
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void button1_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
/*Form1.CancelDispensing = true; //手动点击终止后 ,TubeLabelTool.cs中的循环将退出 并返回手动取消状态
|
|||
|
|
if (!isStop)//处于可手动终止状态
|
|||
|
|
DispenseCancel = true; //*/
|
|||
|
|
|
|||
|
|
DispenseCancel = true;
|
|||
|
|
//Closewin();
|
|||
|
|
}
|
|||
|
|
public bool isCancel()
|
|||
|
|
{
|
|||
|
|
return DispenseCancel;
|
|||
|
|
}
|
|||
|
|
public bool isRetry()
|
|||
|
|
{
|
|||
|
|
return DispenseRetry;
|
|||
|
|
}
|
|||
|
|
public bool isNext()
|
|||
|
|
{
|
|||
|
|
return DispenseNext;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void EnableTimer()
|
|||
|
|
{
|
|||
|
|
timerForClose.Enabled = true;
|
|||
|
|
}
|
|||
|
|
public bool isClose()
|
|||
|
|
{
|
|||
|
|
return WinClose;
|
|||
|
|
}
|
|||
|
|
public void Closewin()
|
|||
|
|
{
|
|||
|
|
SystemSet.DispenseWindowLocation = new Point(this.Location.X, this.Location.Y);
|
|||
|
|
IsDispensing = false;
|
|||
|
|
logger.Info("IsDispensing = false");
|
|||
|
|
this.Close();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void timerForClose_Tick(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (TimeDelay > 0)
|
|||
|
|
{
|
|||
|
|
LabTime.Text = TimeDelay.ToString();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
WinClose = true;
|
|||
|
|
}
|
|||
|
|
TimeDelay--;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void timerforflash_Tick(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
this.Invoke((MethodInvoker)delegate
|
|||
|
|
{
|
|||
|
|
if (LabMsg.ForeColor == Color.Red)
|
|||
|
|
{
|
|||
|
|
LabMsg.ForeColor = Color.Black;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
LabMsg.ForeColor = Color.Red;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch(Exception ex)
|
|||
|
|
{
|
|||
|
|
Console.WriteLine("timerforflash:" + ex.Message);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void LabMsg_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|