From ec02022018c44e794fa53e40daa96321daaae4fc Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期一, 02 六月 2025 15:21:30 +0800
Subject: [PATCH] 清理
---
DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs | 326 ++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 293 insertions(+), 33 deletions(-)
diff --git a/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs b/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs
index 105ff5e..99ef870 100644
--- a/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs
+++ b/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work01.cs
@@ -1,10 +1,14 @@
-锘縰sing DevExpress.Utils.MVVM.Services;
+锘縰sing DevExpress.XtraGrid.Columns;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
+using System.Collections.Generic;
using System.Data;
+using System.Dynamic;
+using System.IO;
+using System.Text;
using System.Windows.Forms;
namespace Gs.DevApp.DevFrm.Work
@@ -12,29 +16,40 @@
public partial class Frm_Work01 : DevExpress.XtraEditors.XtraForm
{
string _webServiceName = "WorkCollect/";
- string fGx = "";
- string fBc = "";
+ string dianJianPath = "";//鐢垫鍙栧�艰矾寰�
string goodTag = "鈭�";
string badTag = "脳";
- public Frm_Work01(string _fGx, string _fBc)
+ string fGxTouRu = "G001:鎶曞叆";
+ string fGxDianJian = "G002:鐢垫";
+ string fGxShouJian = "G003:姘存";
+ string fGxZhongJian = "G004:缁堟";
+
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="_fGx">宸ュ簭</param>
+ /// <param name="_fBc">鐝</param>
+ /// <param name="_strinOther">鐩墠涓虹數妫�璺緞</param>
+ public Frm_Work01(string _fGx, string _fBc, string _strinOther)
{
InitializeComponent();
- this.fGx = _fGx;
- this.fBc = _fBc;
- this.Text = "宸ュ簭閲囬泦 - " + fGx + " - " + fBc;
- txt_gx.Text = fGx;
- txt_bc.Text = fBc;
+ txt_gx.Text = _fGx;
+ txt_bc.Text = _fBc;
+ txt_dianJianPath.Text = _strinOther;
+ dianJianPath= _strinOther;
+ this.Text = "宸ュ簭閲囬泦銆�" + _fGx + " - " + _fBc + "銆�";
+ addColumn();
txt_barCode.KeyDown += (s, e) =>
{
- if (e.KeyCode == Keys.Enter) { getModel("", goodTag); };
+ if (e.KeyCode == Keys.Enter) { addModel(goodTag); };
};
btnGood.Click += (s, e) =>
{
- getModel("", goodTag);
+ addModel(goodTag);
};
btnBad.Click += (s, e) =>
{
- UcDictionarySelect frm = new UcDictionarySelect("缂洪櫡鎻忚堪", " s_type='宸ュ簭閲囬泦涓嶈壇椤圭洰'");
+ UcDictionarySelect frm = new UcDictionarySelect("宸ュ簭涓嶈壇鎻忚堪", " a.s_type='宸ュ簭涓嶈壇鎻忚堪' and pid<>'00000000-0000-0000-0000-000000000000'");
frm.UpdateParent += (ss, ee) =>
{
System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
@@ -52,22 +67,121 @@
vm.Show();
}
else
- getModel("", badTag, _txt);
+ addModel(badTag, _txt);
};
frm.ShowDialog();
};
}
+ /// <summary>
+ /// 鏍规嵁宸ュ簭锛屾瀯閫犱笉鍚岀被鍨嬬殑瀹炰綋
+ /// </summary>
+ /// <param name="_barCode">鏉$爜</param>
+ /// <param name="_checkResult">缁撴灉</param>
+ /// <param name="_badReson">鍘熷洜</param>
+ /// <returns></returns>
+ private dynamic getObj(string _barCode, string _checkResult, string _badReson = "")
+ {
+ dynamic _obj = new ExpandoObject();
+ _obj.barCode = _barCode;
+ _obj.checkResult = _checkResult;//妫�娴嬬粨鏋�
+ _obj.processNo = txt_gx.Text.Trim();//宸ュ簭
+ _obj.banCi = txt_bc.Text.Trim();//鐝
+ _obj.gongWei = txt_gw.Text.Trim();//宸ヤ綅
+ _obj.badReson = _badReson.Trim();//涓嶈壇鍘熷洜
+ if (txt_gx.Text.Trim() == fGxTouRu)
+ {
+ return _obj;
+ }
+ if (txt_gx.Text.Trim() == fGxDianJian)
+ {
+ string TM = "";
+ string JD = "";
+ string JY = "";
+ string JN = "";
+ string XL = "";
+ string GV = "";
+ string JDV = "";
+ string JYV = "";
+ string JNV = "";
+ string XLV = "";
+ string GVV = "";
+ string myStr = File.ReadAllText(dianJianPath, Encoding.Default);
+ if (myStr == "")
+ {
+ return null;
+ }
+
+ JArray dsTemp = JArray.Parse(myStr);
+ foreach (var ss in dsTemp) //鏌ユ壘鏌愪釜瀛楁涓庡��
+ {
+ TM = (((JObject)ss)["TiaoMa"] == null) ? "" : ((JObject)ss)["TiaoMa"].ToString();
+ JD = (((JObject)ss)["JieDi"] == null) ? "" : ((JObject)ss)["JieDi"]["state"].ToString();
+ JY = (((JObject)ss)["JueYuan"] == null) ? "" : ((JObject)ss)["JueYuan"]["state"].ToString();
+ JN = (((JObject)ss)["JiaoNai"] == null) ? "" : ((JObject)ss)["JiaoNai"]["state"].ToString();
+ XL = (((JObject)ss)["XieLou"] == null) ? "" : ((JObject)ss)["XieLou"]["state"].ToString();
+ GV = (((JObject)ss)["GongLv"] == null) ? "" : ((JObject)ss)["GongLv"]["state"].ToString();
+ JDV = (((JObject)ss)["JieDi"] == null) ? "" : ((JObject)ss)["JieDi"]["value"].ToString().Replace(" ", ",");
+ JYV = (((JObject)ss)["JueYuan"] == null) ? "" : ((JObject)ss)["JueYuan"]["value"].ToString().Replace(" ", ", ");
+ JNV = (((JObject)ss)["JiaoNai"] == null) ? "" : ((JObject)ss)["JiaoNai"]["value"].ToString().Replace(" ", ", ");
+ XLV = (((JObject)ss)["XieLou"] == null) ? "" : ((JObject)ss)["XieLou"]["value"].ToString().Replace(" ", ", ");
+ GVV = (((JObject)ss)["GongLv"] == null) ? "" : ((JObject)ss)["GongLv"]["value"].ToString().Replace(" ", ", ");
+ }
+ _obj.t001 = TM;
+ _obj.t002 = JD;
+ _obj.t003 = JY;
+ _obj.t004 = JN;
+ _obj.t005 = XL;
+ _obj.t006 = GV;
+ _obj.t007 = JDV;
+ _obj.t008 = JYV;
+ _obj.t009 = JNV;
+ _obj.t010 = XLV;
+ _obj.t011 = GVV;
+ // File.WriteAllText(dianJianPath, "");
+ return _obj;
+ }
+ if (txt_gx.Text.Trim() == fGxShouJian)
+ {
+ string strCsl1 = "strCsl1";
+ string strSw1 = "strSw1";
+ string strCsl2 = "strCsl2";
+ string strSw2 = "strSw2";
+ string strCsl3 = "strCsl3";
+ string strSw3 = "strSw3";
+ string strCsl4 = "strCsl4";
+ string strSw4 = "strSw4";
+ string strCsl5 = "strCsl5";
+ string strSw5 = "strSw5";
+ string SJJG = "";
+ _obj.t002 = strCsl1;
+ _obj.t003 = strSw1;
+ _obj.t004 = strCsl2;
+ _obj.t005 = strSw2;
+ _obj.t006 = strCsl3;
+ _obj.t007 = strSw3;
+ _obj.t008 = strCsl4;
+ _obj.t009 = strSw4;
+ _obj.t010 = strCsl5;
+ _obj.t011 = strSw5;
+ // _obj.t012 = SJJG;杩欎釜寰呯‘瀹�
+ return _obj;
+ }
+
+ if (txt_gx.Text.Trim() == fGxZhongJian)
+ {
+ return _obj;
+ }
+ return null;
+ }
/// <summary>
- ///
+ /// 涓婃姤瀹炰綋
/// </summary>
- /// <param name="_checkVal">妫�娴嬪��</param>
- /// <param name="_checkResult">妫�娴嬬粨鏋�</param>
- /// <param name="_badReson">涓嶈壇鍘熷洜</param>
- /// <param name="_inBz">澶囨敞</param>
- private void getModel(string _checkVal, string _checkResult, string _badReson = "", string _inBz = "")
+ /// <param name="_checkResult">鍒ゅ畾缁撴灉</param>
+ /// <param name="_badReson">涓嶈壇鍘熷洜锛屽彲绌�</param>
+ private void addModel(string _checkResult, string _badReson = "")
{
string _barCode = txt_barCode.Text.Trim();
if (string.IsNullOrEmpty(_barCode))
@@ -76,17 +190,13 @@
vm.Show();
return;
}
- var _obj = new
+ dynamic _obj = getObj(_barCode, _checkResult, _badReson);
+ if (_obj == null)
{
- barCode = _barCode,
- inBz = _inBz.Trim(),
- checkVal = _checkVal,
- checkResult = _checkResult,
- processNo = txt_gx.Text.Trim(),//宸ュ簭
- banCi = txt_bc.Text.Trim(),//鐝
- gongWei = txt_gw.Text.Trim(),//宸ヤ綅
- badReson = _badReson.Trim()
- };
+ Toast vm = new Toast(-1, "~璇诲彇鏁版嵁澶辫触锛岃妫�鏌ヨ澶噡");
+ vm.Show();
+ return;
+ }
try
{
string strJson = UtilityHelper.HttpPost("", _webServiceName + "GetModel", JsonConvert.SerializeObject(_obj));
@@ -94,14 +204,14 @@
if (_rtn.rtnCode > 0)
{
dynamic dy = _rtn.rtnData;
- //澶磋〃鍜屾眹鎬�
+ //琛ㄥご鍜屾眹鎬�
UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, false);
lbSum1.Text = dy.lbSum1;
lbSum2.Text = dy.lbSum2;
lbSum3.Text = dy.lbSum3;
lbSum4.Text = dy.lbSum4;
prog1.Position = dy.jd;
- //鑹搧
+ //鑹搧鍒楄〃
txt_barCode.ReadOnly = false;
JObject _job = JObject.Parse(strJson);
JArray array = new JArray();
@@ -122,7 +232,7 @@
{
Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
}
- //涓嶈壇鍝�
+ //涓嶈壇鍝佸垪琛�
JArray array2 = new JArray();
foreach (var a in _job["rtnData"]["list2"])
{
@@ -144,7 +254,6 @@
string _msg = _rtn.rtnMsg;
if (!string.IsNullOrEmpty(_msg))
{
-
Toast vm = new Toast((goodTag == "鈭�" ? 1 : -1), _msg);
vm.Show();
};
@@ -161,5 +270,156 @@
vm.Show();
}
}
+
+ /// <summary>
+ /// 澧炲姞鐢垫鍙栨暟鐨勫垪
+ /// </summary>
+ public void addColumn()
+ {
+ List<dynamic> _lst = new List<dynamic>();
+ if (txt_gx.Text.Trim() == fGxDianJian)
+ {
+ _lst.Add(new
+ {
+ ziduan = "t002",
+ wenben = "鎺ュ湴",
+ kejian = true,
+ visibleIndex = 1,
+ });
+ _lst.Add(new
+ {
+ ziduan = "t004",
+ wenben = "浜よ��",
+ kejian = true,
+ visibleIndex = 1,
+ });
+ _lst.Add(new
+ {
+ ziduan = "t005",
+ wenben = "娉勬紡",
+ kejian = true,
+ visibleIndex = 1,
+ });
+ _lst.Add(new
+ {
+ ziduan = "t006",
+ wenben = "鍔熺巼",
+ kejian = true,
+ visibleIndex = 1,
+ });
+ _lst.Add(new
+ {
+ ziduan = "t007",
+ wenben = "鎺ュ湴缁撴灉",
+ kejian = true,
+ visibleIndex = 1,
+ });
+ _lst.Add(new
+ {
+ ziduan = "t009",
+ wenben = "浜よ�愮粨鏋�",
+ kejian = true,
+ visibleIndex = 1,
+ });
+ _lst.Add(new
+ {
+ ziduan = "t010",
+ wenben = "娉勬紡缁撴灉",
+ kejian = true,
+ visibleIndex = 1,
+ });
+
+ _lst.Add(new
+ {
+ ziduan = "t011",
+ wenben = "鍔熺巼缁撴灉",
+ kejian = true,
+ visibleIndex = 1,
+ });
+ }
+ if (txt_gx.Text.Trim() == fGxShouJian)
+ {
+ _lst.Add(new
+ {
+ ziduan = "t002",
+ wenben = "鍑烘按閲�1",
+ kejian = true,
+ visibleIndex = 1,
+ });
+ _lst.Add(new
+ {
+ ziduan = "t003",
+ wenben = "姘存俯1",
+ kejian = true,
+ visibleIndex = 1,
+ });
+ _lst.Add(new
+ {
+ ziduan = "t004",
+ wenben = "鍑烘按閲�2",
+ kejian = true,
+ visibleIndex = 1,
+ });
+ _lst.Add(new
+ {
+ ziduan = "t005",
+ wenben = "姘存俯2",
+ kejian = true,
+ visibleIndex = 1,
+ });
+ _lst.Add(new
+ {
+ ziduan = "t006",
+ wenben = "鍑烘按閲�3",
+ kejian = true,
+ visibleIndex = 1,
+ });
+ _lst.Add(new
+ {
+ ziduan = "t007",
+ wenben = "姘存俯3",
+ kejian = true,
+ visibleIndex = 1,
+ });
+ _lst.Add(new
+ {
+ ziduan = "t008",
+ wenben = "鍑烘按閲�4",
+ kejian = true,
+ visibleIndex = 1,
+ });
+ _lst.Add(new
+ {
+ ziduan = "t009",
+ wenben = "姘存俯4",
+ kejian = true,
+ visibleIndex = 1,
+ });
+
+ _lst.Add(new
+ {
+ ziduan = "t010",
+ wenben = "鍑烘按閲�5",
+ kejian = true,
+ visibleIndex = 1,
+ });
+ _lst.Add(new
+ {
+ ziduan = "t011",
+ wenben = "姘存俯5",
+ kejian = true,
+ visibleIndex = 1,
+ });
+ }
+ foreach (var item in _lst)
+ {
+ GridColumn newColumn = new GridColumn();
+ newColumn.FieldName = item.ziduan; // 璁剧疆涓庢暟鎹簮瀵瑰簲鐨勫瓧娈靛悕
+ newColumn.Caption = item.wenben; // 璁剧疆鍒楃殑鏍囬
+ //newColumn.Visible = item.visibleIndex; // 璁剧疆鍒楁槸鍚﹀彲瑙�
+ newColumn.VisibleIndex = item.visibleIndex; // 璁剧疆鍒楃殑鏄剧ず椤哄簭
+ gvMx1.Columns.Add(newColumn);
+ }
+ }
}
}
\ No newline at end of file
--
Gitblit v1.9.3