|
|
@@ -94,6 +94,24 @@ namespace RailLocalMeter
|
|
|
|
|
|
private void frmMain_Load(object sender, EventArgs e)
|
|
|
{
|
|
|
+ BindTable<MeterWorkRailwayActFirst>(ultraGridFirst, dataTableFirst, "firstx");
|
|
|
+ BindTable<PreRailwayScale>(ultraGridPre, dataTablePre, "prex");
|
|
|
+
|
|
|
+ CacleCls.Clear(); //清理一次数据
|
|
|
+ btnSave.Enabled = false;
|
|
|
+ txtCarNo.Text = "";
|
|
|
+ txtMATTER_NAME.Text = "";
|
|
|
+ txtFORWARDING_UNIT_NAME.Text = "";
|
|
|
+ txtRECEIVING_UINT_NAME.Text = "";
|
|
|
+ txtMETER_TYPE.Text = "";
|
|
|
+ txtMsgInfo.Text = "";
|
|
|
+ txtGroess.Text = "";
|
|
|
+ txtTare.Text = "";
|
|
|
+ txtNet.Text = "";
|
|
|
+ txtMsgInfo.Focus();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
txtMsgInfo.Focus();
|
|
|
if (AppConfigCache.openCom == "0")
|
|
|
{
|
|
|
@@ -248,6 +266,8 @@ namespace RailLocalMeter
|
|
|
{
|
|
|
if (!blThreadFlag) return;
|
|
|
int iError = 0;
|
|
|
+
|
|
|
+ bool bClear = false;
|
|
|
while (blThreadFlag)
|
|
|
{
|
|
|
try
|
|
|
@@ -257,47 +277,65 @@ namespace RailLocalMeter
|
|
|
ucWeightT1.setStable(CacleCls.isWd != 1 ? true : false);
|
|
|
ucWeightT1.setExceed(CacleCls.weight > AppConfigCache.maxRange * 1000 ? false : true);
|
|
|
|
|
|
- if (isMeasureSuccess && Math.Abs(CacleCls.lockWgt - CacleCls.weight) > AppConfigCache.changeWgt)
|
|
|
- {
|
|
|
- isMeasureSuccess = false;
|
|
|
- txtCarNo.Text = "";
|
|
|
- CacleCls.rfidCarNo = "";
|
|
|
- CacleCls.lockCarNo = "";
|
|
|
- CacleCls.carType = "";
|
|
|
- txtMsgInfo.Focus();
|
|
|
-
|
|
|
- BindTable<MeterWorkRailwayActFirst>(ultraGridFirst, dataTableFirst, "firstx");
|
|
|
-
|
|
|
- //查询预报数据
|
|
|
- BindTable<PreRailwayScale>(ultraGridPre, dataTablePre, "prex");
|
|
|
- }
|
|
|
- /*
|
|
|
- if (isMeasureSuccess && CacleCls.lockCarNo != CacleCls.rfidCarNo && !string.IsNullOrEmpty(CacleCls.rfidCarNo))
|
|
|
+ if (CacleCls.isWd == 0)
|
|
|
{
|
|
|
- txtCarNo.Text = "";
|
|
|
+ bClear = false;
|
|
|
+ //bCl = false;
|
|
|
+ if (!string.IsNullOrEmpty(CacleCls.rfidCarNo))
|
|
|
+ {
|
|
|
+ if (CacleCls.rfidCarNo.Length > 14)
|
|
|
+ {
|
|
|
+ string strRailNo = CacleCls.rfidCarNo.Substring(7, 7);
|
|
|
+ if (strRailNo.Trim().Length == 7)
|
|
|
+ {
|
|
|
+ if (strFinishCarNo != strRailNo || CacleCls.isJg && !isEditRailwayNo)
|
|
|
+ {
|
|
|
+ CacleCls.lockCarNo = strRailNo;
|
|
|
+ CacleCls.carType = CacleCls.rfidCarNo.Substring(1, 5).Trim().ToUpper();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- //*/
|
|
|
- if (txtCarNo.Text.Trim() != "" && !txtCarNo.Focused)
|
|
|
+ else if (CacleCls.lockWgt > 1000) //有计量过的重量
|
|
|
{
|
|
|
- CacleCls.lockCarNo = txtCarNo.Text.Trim();
|
|
|
+ if (Math.Abs(CacleCls.lockWgt - CacleCls.weight) > AppConfigCache.changeWgt)
|
|
|
+ {
|
|
|
+ isEditRailwayNo = false;
|
|
|
+ isMeasureSuccess = false;
|
|
|
+ CacleCls.lockCarNo = ""; //清理下数据
|
|
|
+ CacleCls.carType = "";
|
|
|
+ txtCarNo.Text = "";
|
|
|
+ txtMsgInfo.Focus();
|
|
|
+
|
|
|
+ BindTable<MeterWorkRailwayActFirst>(ultraGridFirst, dataTableFirst, "firstx");
|
|
|
+
|
|
|
+ //查询预报数据
|
|
|
+ BindTable<PreRailwayScale>(ultraGridPre, dataTablePre, "prex");
|
|
|
+ }
|
|
|
}
|
|
|
- else if (!string.IsNullOrEmpty(CacleCls.rfidCarNo))
|
|
|
+ else //从未计量过,假如有车号不需要管
|
|
|
{
|
|
|
- if (CacleCls.rfidCarNo.Length > 14)
|
|
|
+ if (!CacleCls.isJg&& !bClear)
|
|
|
{
|
|
|
- string strRailNo = CacleCls.rfidCarNo.Substring(7, 7);
|
|
|
- if (strRailNo.Trim().Length == 7)
|
|
|
- {
|
|
|
- CacleCls.lockCarNo = strRailNo;
|
|
|
- CacleCls.carType = CacleCls.rfidCarNo.Substring(1, 5).Trim().ToUpper();
|
|
|
- }
|
|
|
+ bClear = true;
|
|
|
+ txtCarNo.Text = "";
|
|
|
+
|
|
|
+ BindTable<MeterWorkRailwayActFirst>(ultraGridFirst, dataTableFirst, "firstx");
|
|
|
+
|
|
|
+ //查询预报数据
|
|
|
+ BindTable<PreRailwayScale>(ultraGridPre, dataTablePre, "prex");
|
|
|
+ txtMsgInfo.Focus();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (!string.IsNullOrEmpty(CacleCls.lockCarNo) && txtCarNo.Text.Trim() == "")
|
|
|
+ if (!string.IsNullOrEmpty(CacleCls.lockCarNo))
|
|
|
{
|
|
|
txtCarNo.Text = CacleCls.lockCarNo;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if (strOldCarNo != CacleCls.lockCarNo)
|
|
|
{
|
|
|
txtMsgInfo.Text = "";//车号不同的情况下清理下保存按钮
|
|
|
@@ -335,21 +373,24 @@ namespace RailLocalMeter
|
|
|
if (!CacleCls.isLock && !CacleCls.isJg && CacleCls.btnState == "1" && CacleCls.isWd == 0)
|
|
|
{
|
|
|
/*
|
|
|
- if (string.IsNullOrEmpty(CacleCls.lockCarNo))
|
|
|
+ if (CacleCls.serverFlag)
|
|
|
{
|
|
|
- txtMsgInfo.Text = "车号未识别";
|
|
|
- vicPlayClass.GetVoicePlay(VoiceEnum.车号未识别, "");
|
|
|
- led_controler?.setStaticLineMsg(AppConfigCache.ledIp, "车号未识别");
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (string.IsNullOrEmpty(CacleCls.lockCarNo))
|
|
|
+ {
|
|
|
+ txtMsgInfo.Text = "车号未识别";
|
|
|
+ vicPlayClass.GetVoicePlay(VoiceEnum.车号未识别, "");
|
|
|
+ led_controler?.setStaticLineMsg(AppConfigCache.ledIp, "车号未识别");
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- if (CacleCls.lockCarNo.Length != 7)
|
|
|
- {
|
|
|
- txtMsgInfo.Text = "车号不为7位";
|
|
|
- vicPlayClass.GetVoicePlay(VoiceEnum.车号未识别, "");
|
|
|
- led_controler?.setStaticLineMsg(AppConfigCache.ledIp, "车号不为7位");
|
|
|
- return;
|
|
|
+
|
|
|
+ if (CacleCls.lockCarNo.Length != 7)
|
|
|
+ {
|
|
|
+ txtMsgInfo.Text = "车号不为7位";
|
|
|
+ vicPlayClass.GetVoicePlay(VoiceEnum.车号未识别, "");
|
|
|
+ led_controler?.setStaticLineMsg(AppConfigCache.ledIp, "车号不为7位");
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
//*/
|
|
|
|
|
|
@@ -416,6 +457,9 @@ namespace RailLocalMeter
|
|
|
|
|
|
if (!CacleCls.isClear)
|
|
|
{
|
|
|
+ BindTable<MeterWorkRailwayActFirst>(ultraGridFirst, dataTableFirst, "firstx");
|
|
|
+ BindTable<PreRailwayScale>(ultraGridPre, dataTablePre, "prex");
|
|
|
+
|
|
|
iError = 32;
|
|
|
CacleCls.Clear(); //清理一次数据
|
|
|
btnSave.Enabled = false;
|
|
|
@@ -653,6 +697,10 @@ namespace RailLocalMeter
|
|
|
firstDb.weightType = "0";
|
|
|
firstDb.railwayFactoryWeight = Convert.ToDouble(txtTare.Value * 1000);
|
|
|
firstDb.valueFlag = "2";
|
|
|
+ if (string.IsNullOrEmpty(firstDb.railwayNo))
|
|
|
+ {
|
|
|
+ firstDb.railwayNo = "车号未识别";
|
|
|
+ }
|
|
|
|
|
|
RESTfulResult<ResponseData> rt = firstService.doIdentifyWeight(firstDb, out msgInfo);
|
|
|
if (rt.Succeed)
|
|
|
@@ -734,6 +782,11 @@ namespace RailLocalMeter
|
|
|
CacleCls.preTrackScale.format(firstDb);
|
|
|
}
|
|
|
|
|
|
+ if (string.IsNullOrEmpty(firstDb.railwayNo))
|
|
|
+ {
|
|
|
+ firstDb.railwayNo = "车号未识别";
|
|
|
+ }
|
|
|
+
|
|
|
RESTfulResult<ResponseData> rt = firstService.add(firstDb, out msgInfo);
|
|
|
if (rt.Succeed)
|
|
|
{
|
|
|
@@ -761,6 +814,11 @@ namespace RailLocalMeter
|
|
|
MeterWorkRailwayActFirst mwraf = new MeterWorkRailwayActFirst();
|
|
|
CreateFirst(ref mwraf);
|
|
|
|
|
|
+ if (string.IsNullOrEmpty(mwraf.railwayNo))
|
|
|
+ {
|
|
|
+ mwraf.railwayNo = "车号未识别";
|
|
|
+ }
|
|
|
+
|
|
|
if (CacleCls.preTrackScale != null)
|
|
|
{
|
|
|
CacleCls.preTrackScale.format(mwraf);
|
|
|
@@ -885,7 +943,7 @@ namespace RailLocalMeter
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
-
|
|
|
+ txtMsgInfo.Focus();
|
|
|
|
|
|
|
|
|
BindTable<PreRailwayScale>(ultraGridWaitFirst, dataTableWaitFirst, "firstWait");
|
|
|
@@ -1241,9 +1299,18 @@ namespace RailLocalMeter
|
|
|
|
|
|
}
|
|
|
|
|
|
+ bool isEditRailwayNo = false;
|
|
|
private void txtCarNo_KeyDown(object sender, KeyEventArgs e)
|
|
|
{
|
|
|
- if (e.KeyCode == Keys.Enter) label3.Focus();
|
|
|
+ if (e.KeyCode == Keys.Enter)
|
|
|
+ {
|
|
|
+ if (txtCarNo.Text.Trim().Length > 0)
|
|
|
+ {
|
|
|
+ CacleCls.lockCarNo = txtCarNo.Text.Trim();
|
|
|
+ isEditRailwayNo = true;
|
|
|
+ txtMsgInfo.Focus();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
@@ -1295,8 +1362,12 @@ namespace RailLocalMeter
|
|
|
SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1);
|
|
|
}
|
|
|
}
|
|
|
- #endregion
|
|
|
|
|
|
+ private void txtCarNo_TextChanged(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
|
|
|
#region
|
|
|
private void CreateFirst(ref MeterWorkRailwayActFirst mwraf)
|