From e5414022999d94626b0d55d29d0dba3ce700fea9 Mon Sep 17 00:00:00 2001
From: lu <123456>
Date: 星期一, 22 九月 2025 15:40:13 +0800
Subject: [PATCH] bug
---
DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs | 151 ++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 126 insertions(+), 25 deletions(-)
diff --git a/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs b/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs
index 2c5fe7f..7e1079c 100644
--- a/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs
@@ -4,6 +4,7 @@
using DevExpress.XtraLayout.Utils;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
+using Gs.DevApp.UserControl;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NModbus;
@@ -22,10 +23,11 @@
{
public partial class Frm_Work01 : DevExpress.XtraEditors.XtraForm
{
+ string isWater = "0";
string hostName = "192.168.60.51";
int hostNamePoint = 502;
- string strConn = "Data Source=192.168.1.146;Initial Catalog=GS_MES;User ID=mesUser;Password =qixi1qaz@WSXmes";
- bool isCleanDianJian = false;
+ string strConn = "Data Source=192.168.1.146,12468;Initial Catalog=GS_MES;User ID=mesUser;Password =qixi1qaz@WSXmes";
+ bool isCleanDianJian = true;
string _webServiceName = "WorkCollect/";
string dianJianPath = "";//鐢垫鍙栧�艰矾寰�
string goodTag = "鈭�";
@@ -41,9 +43,64 @@
/// <param name="_fGx">宸ュ簭</param>
/// <param name="_fBc">鐝</param>
/// <param name="_strinOther">鐩墠涓虹數妫�璺緞</param>
- public Frm_Work01(string _fGx, string _fBc, string _strinOther)
+ /// <param name="chkWater">鏄惁姘存</param>
+ public Frm_Work01(string _fGx, string _fBc, string _strinOther, int chkWater = 0)
{
InitializeComponent();
+ System.Drawing.Font ft1 = new System.Drawing.Font("瀹嬩綋", 35F);
+ System.Drawing.Font ft2 = new System.Drawing.Font("瀹嬩綋", 25F);
+ System.Drawing.Font ft3 = new System.Drawing.Font("瀹嬩綋", 20F);
+ System.Drawing.Font ft4 = new System.Drawing.Font("瀹嬩綋", 15F);
+ System.Drawing.Font ft5 = new System.Drawing.Font("瀹嬩綋", 12F);
+ //璁剧疆瀛椾綋澶у皬
+ this.btnGood.Appearance.Font = ft1;
+ this.btnBad.Appearance.Font = ft1;
+ this.simpleButton3.Appearance.Font =ft2;
+ this.simpleButton7.Appearance.Font =ft2;
+ this.simpleButton5.Appearance.Font =ft2;
+ this.simpleButton4.Appearance.Font =ft2;
+ this.simpleButton6.Appearance.Font =ft2;
+ this.gvMx1.Appearance.Row.Font = ft3;
+ this.gvMx2.Appearance.Row.Font = ft3;
+ this.layoutControlItem1.AppearanceItemCaption.Font = ft4;
+ this.layoutControlItem2.AppearanceItemCaption.Font = ft4;
+ this.layoutControlItem3.AppearanceItemCaption.Font = ft4;
+ this.layoutControlItem4.AppearanceItemCaption.Font = ft4;
+ this.layoutControlItem5.AppearanceItemCaption.Font = ft4;
+ this.layShuiJian.AppearanceItemCaption.Font = ft4;
+ this.layoutControlItem7.AppearanceItemCaption.Font = ft4;
+ this.layoutControlItem8.AppearanceItemCaption.Font = ft4;
+ this.layoutControlItem10.AppearanceItemCaption.Font = ft4;
+ this.layoutControlItem11.AppearanceItemCaption.Font = ft4;
+ this.layoutControlItem12.AppearanceItemCaption.Font = ft4;
+ this.layoutControlItem13.AppearanceItemCaption.Font = ft4;
+ this.layoutControlItem14.AppearanceItemCaption.Font = ft4;
+ this.layoutControlItem15.AppearanceItemCaption.Font = ft4;
+ this.txt_gdbh.Properties.Appearance.Font =ft5;
+ this.txt_itemNo.Properties.Appearance.Font =ft5;
+ this.txt_itemModel.Properties.Appearance.Font =ft5;
+ this.txt_gx.Properties.Appearance.Font =ft5;
+ this.txt_bc.Properties.Appearance.Font =ft5;
+ this.txt_itemName.Properties.Appearance.Font =ft5;
+ this.txt_yjDate.Properties.Appearance.Font =ft5;
+ this.txt_collectBy.Properties.Appearance.Font =ft5;
+ this.txt_sbNo.Properties.Appearance.Font =ft5;
+ this.txt_sjXt.Properties.Appearance.Font =ft5;
+ this.txt_sjDate.Properties.Appearance.Font =ft5;
+ this.txt_barCode.Properties.Appearance.Font =ft5;
+ this.txt_currentBarCode.Properties.Appearance.Font =ft5;
+ this.txt_gongWei.Properties.Appearance.Font =ft5;
+ this.txt_dianJianPath.Properties.Appearance.Font =ft5;
+ try
+ {
+ string _vanishingSeconds = chkWater.ToString();
+ if (!string.IsNullOrEmpty(_vanishingSeconds))
+ isWater = _vanishingSeconds;
+ }
+ catch (Exception)
+ {
+
+ }
gvMx1.IndicatorWidth = 60;
gvMx1.CustomDrawRowIndicator += (s, e) =>
{
@@ -62,7 +119,7 @@
if (e.KeyCode == Keys.Enter)
{
//濡傛灉鏄按妫�锛岃繕瑕佹壂宸ヤ綅
- if (txt_gx.Text.Trim() == fGxShouJian)
+ if (txt_gx.Text.Trim() == fGxShouJian && isWater == "1")
{
txt_gongWei.Focus();
}
@@ -95,14 +152,43 @@
};
btnBad.Click += (s, e) =>
{
- string _barCode = txt_barCode.Text.Trim();
- if (string.IsNullOrEmpty(_barCode))
+ int idx = tabMx.SelectedTabPageIndex;
+ if (idx > 0)
{
- Toast vm = new Toast(-1, "~璇峰厛鎵拷婧爜~");
+ Toast vm = new Toast(-1, "~宸插府浣犲垏鎹㈠埌銆愯壇鍝佹槑缁嗐��,璇烽噸鏂版搷浣渵");
+ vm.Show();
+ tabMx.SelectedTabPageIndex = 0;
+ return;
+ }
+ string _collectGuid = "";
+ string _collCode = "";
+ var dr = gvMx1.GetFocusedDataRow();
+ if (dr == null || string.IsNullOrEmpty(dr["guid"].ToString()))
+ {
+
+ }
+ else
+ {
+ _collectGuid = dr["guid"].ToString();
+ _collCode = dr["barCode"].ToString();
+ }
+ if (_collectGuid.Length < 30)
+ {
+ Toast vm = new Toast(-1, "~璇峰厛閫夋嫨杩芥函鐮亊");
vm.Show();
return;
}
- UcDictionarySelect frm = new UcDictionarySelect("宸ュ簭涓嶈壇鎻忚堪", " a.s_type='宸ュ簭涓嶈壇鎻忚堪' and pid<>'00000000-0000-0000-0000-000000000000'");
+ string _msg = "浣犲噯澶囧皢銆�" + _collCode + "銆戝彉鏇翠负涓嶈壇";
+ string _type = "";
+ if (txt_gx.Text.Trim() == fGxTouRu)
+ _type = "宸ュ簭G001:鎶曞叆涓嶈壇鎻忚堪";
+ if (txt_gx.Text.Trim() == fGxDianJian)
+ _type = "宸ュ簭G002:鐢垫涓嶈壇鎻忚堪";
+ if (txt_gx.Text.Trim() == fGxShouJian)
+ _type = "宸ュ簭G003:姘存涓嶈壇鎻忚堪";
+ if (txt_gx.Text.Trim() == fGxZhongJian)
+ _type = "宸ュ簭G004:缁堟涓嶈壇鎻忚堪";
+ UcDictionarySelect frm = new UcDictionarySelect(_type, " a.s_type='" + _type + "' and pid<>'00000000-0000-0000-0000-000000000000'", _msg);
frm.UpdateParent += (ss, ee) =>
{
System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
@@ -110,7 +196,7 @@
foreach (dynamic dym in lst)
{
if (stringBuilder.Length > 0)
- stringBuilder.Append("|");
+ stringBuilder.Append("&");
stringBuilder.Append(dym.dicTxt);
}
string _txt = stringBuilder.ToString();
@@ -120,9 +206,11 @@
vm.Show();
}
else
- addModel(badTag, _txt);
+ addModel(badTag, _txt, _collectGuid);
};
frm.ShowDialog();
+ this.ActiveControl = this.txt_barCode;
+ txt_barCode.Focus();
};
this.ActiveControl = this.txt_barCode;
txt_barCode.Focus();
@@ -135,7 +223,7 @@
/// <param name="_checkResult">缁撴灉</param>
/// <param name="_badDescription">涓嶈壇鎻忚堪</param>
/// <returns></returns>
- private dynamic getObj(string _barCode, string _checkResult, string _badDescription = "")
+ private dynamic getObj(string _barCode, string _checkResult, string _badDescription = "", string _collectGuid = "")
{
dynamic _obj = new ExpandoObject();
_obj.barCode = _barCode;
@@ -144,6 +232,11 @@
_obj.banCi = txt_bc.Text.Trim();//鐝
_obj.gongWei = txt_gongWei.Text.Trim();//宸ヤ綅
_obj.badDescription = _badDescription.Trim();//涓嶈壇鎻忚堪
+ _obj.collectGuid = _collectGuid;
+ if (!string.IsNullOrEmpty(_collectGuid))
+ {
+ return _obj;
+ }
if (txt_gx.Text.Trim() == fGxTouRu)
{
return _obj;
@@ -200,6 +293,10 @@
//姘存
if (txt_gx.Text.Trim() == fGxShouJian)
{
+ if (isWater == "0")
+ {
+ return _obj;
+ }
string strCsl1 = "";//妯″紡1鍑烘按閲�
string strSw1 = "";//妯″紡1姘存俯
string strCsl2 = "";
@@ -241,18 +338,21 @@
/// </summary>
/// <param name="_checkResult">缁撴灉锛氣垰</param>
/// <param name="_badDescription">涓嶈壇鎻忚堪</param>
- private void addModel(string _checkResult, string _badDescription = "")
+ private void addModel(string _checkResult, string _badDescription = "", string _collectGuid = "")
{
string _barCode = txt_barCode.Text.Trim();
- if (string.IsNullOrEmpty(_barCode))
+ if (string.IsNullOrEmpty(_collectGuid))
{
- Toast vm = new Toast(-1, "~璇峰厛鎵拷婧爜~");
- vm.Show();
- this.ActiveControl = this.txt_barCode;
- txt_barCode.Focus();
- return;
+ if (string.IsNullOrEmpty(_barCode))
+ {
+ Toast vm = new Toast(-1, "~璇峰厛鎵拷婧爜~");
+ vm.Show();
+ this.ActiveControl = this.txt_barCode;
+ txt_barCode.Focus();
+ return;
+ }
}
- dynamic _obj = getObj(_barCode, _checkResult, _badDescription);
+ dynamic _obj = getObj(_barCode, _checkResult, _badDescription, _collectGuid);
try
{
string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj));
@@ -312,7 +412,8 @@
string _msg = _rtn.rtnMsg;
if (!string.IsNullOrEmpty(_msg))
{
- Toast vm = new Toast((goodTag == "鈭�" ? 1 : -1), _msg);
+ // Toast vm = new Toast((goodTag == "鈭�" ? 1 : -1), _msg); 2025-08-20 淇敼鎻愮ず澶栬
+ Toast vm = new Toast(1, _rtn.rtnMsg);
vm.Show();
}
}
@@ -344,7 +445,7 @@
else
layDianJian.Visibility = LayoutVisibility.Never;
//鍙湁姘存鎵嶆樉绀�
- if (txt_gx.Text.Trim() == fGxShouJian)
+ if (txt_gx.Text.Trim() == fGxShouJian && isWater == "1")
layShuiJian.Visibility = LayoutVisibility.Always;
else
layShuiJian.Visibility = LayoutVisibility.Never;
@@ -383,25 +484,25 @@
{
ziduan = "t007",
wenben = "鎺ュ湴缁撴灉",
- visibleIndex = -1,
+ visibleIndex = 1,
});
_lst.Add(new
{
ziduan = "t009",
wenben = "浜よ�愮粨鏋�",
- visibleIndex = -1,
+ visibleIndex = 1,
});
_lst.Add(new
{
ziduan = "t010",
wenben = "娉勬紡缁撴灉",
- visibleIndex = -1,
+ visibleIndex = 1,
});
_lst.Add(new
{
ziduan = "t011",
wenben = "鍔熺巼缁撴灉",
- visibleIndex = -1,
+ visibleIndex = 1,
});
}
if (txt_gx.Text.Trim() == fGxShouJian)
--
Gitblit v1.9.3