From cd47f11ebfaadb81d6efcf778542d3b44acee5a2 Mon Sep 17 00:00:00 2001
From: lu <123456>
Date: 星期三, 03 九月 2025 17:27:46 +0800
Subject: [PATCH] Merge branch 'master' of http://git.gs-mes.com:8080/r/~tjx/GsMesClient
---
DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs | 78 +++++++++++++++++++++++++++++----------
1 files changed, 58 insertions(+), 20 deletions(-)
diff --git a/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs b/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs
index 2c5fe7f..5679160 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 = "鈭�";
@@ -44,6 +46,16 @@
public Frm_Work01(string _fGx, string _fBc, string _strinOther)
{
InitializeComponent();
+ try
+ {
+ string _vanishingSeconds = ConfigurationManager.AppSettings["IsWater"];
+ if (!string.IsNullOrEmpty(_vanishingSeconds))
+ isWater = _vanishingSeconds;
+ }
+ catch (Exception)
+ {
+
+ }
gvMx1.IndicatorWidth = 60;
gvMx1.CustomDrawRowIndicator += (s, e) =>
{
@@ -62,7 +74,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 +107,25 @@
};
btnBad.Click += (s, e) =>
{
- string _barCode = txt_barCode.Text.Trim();
- if (string.IsNullOrEmpty(_barCode))
+ string _collectGuid ="";
+ string _collCode = "";
+ var dr = gvMx1.GetFocusedDataRow();
+ if (dr == null || string.IsNullOrEmpty(dr["guid"].ToString()))
{
- Toast vm = new Toast(-1, "~璇峰厛鎵拷婧爜~");
+ }
+ 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 + "銆戝彉鏇翠负涓嶈壇";
+ UcDictionarySelect frm = new UcDictionarySelect("宸ュ簭涓嶈壇鎻忚堪", " a.s_type='宸ュ簭涓嶈壇鎻忚堪' and pid<>'00000000-0000-0000-0000-000000000000'", _msg);
frm.UpdateParent += (ss, ee) =>
{
System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
@@ -110,7 +133,7 @@
foreach (dynamic dym in lst)
{
if (stringBuilder.Length > 0)
- stringBuilder.Append("|");
+ stringBuilder.Append("&");
stringBuilder.Append(dym.dicTxt);
}
string _txt = stringBuilder.ToString();
@@ -120,9 +143,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 +160,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 +169,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 +230,10 @@
//姘存
if (txt_gx.Text.Trim() == fGxShouJian)
{
+ if (isWater == "0")
+ {
+ return _obj;
+ }
string strCsl1 = "";//妯″紡1鍑烘按閲�
string strSw1 = "";//妯″紡1姘存俯
string strCsl2 = "";
@@ -241,18 +275,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 +349,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 +382,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;
--
Gitblit v1.9.3