From 99a2c28e1eef5e0da651b8e964d135d96ca2fa1f Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期一, 03 七月 2023 15:16:31 +0800
Subject: [PATCH] 称重入库模块优化
---
BaseSet/公用资料/其他基础资料/Gy_StdWorkTimes.cs | 164 ++++++++++++++++++++++--------------------------------
1 files changed, 67 insertions(+), 97 deletions(-)
diff --git "a/BaseSet/\345\205\254\347\224\250\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StdWorkTimes.cs" "b/BaseSet/\345\205\254\347\224\250\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StdWorkTimes.cs"
index 1df1c1a..757f566 100644
--- "a/BaseSet/\345\205\254\347\224\250\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StdWorkTimes.cs"
+++ "b/BaseSet/\345\205\254\347\224\250\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StdWorkTimes.cs"
@@ -8,7 +8,7 @@
using System.Text;
using System.Windows.Forms;
-namespace BaseSet.鍏敤璧勬枡.鍏朵粬鍩虹璧勬枡
+namespace BaseSet
{
public partial class Gy_StdWorkTimes : Form
{
@@ -32,6 +32,8 @@
public const Int16 HLowerlimit = 11;
public const Int16 HUSEORGID = 12;
public const Int16 HRemarkCol = 13;
+ public const Int16 HStdPiece = 14;
+ public const Int16 HStdPric = 15;
public bool BillChange; //
public DBUtility.ClsPub.Enum_OKTag OkTag;
public DBUtility.ClsPub.Enum_BillStatus BillStatus;
@@ -242,29 +244,44 @@
{
try
{
- if (int.Parse(txtHStdWorkTimes.Text)<=0)
+ if (Convert.ToDecimal(txtHStdWorkTimes.Text.ToString())<=0)
{
MessageBox.Show("鏍囧噯宸ユ椂蹇呴』澶т簬0", "鎻愮ず");
+ return;
}
- if (int.Parse(txtHUpperlimit.Text) <= 0)
+ if (Convert.ToDecimal(txtHUpperlimit.Text) <= 0)
{
MessageBox.Show("涓婇檺姣斾緥蹇呴』澶т簬0", "鎻愮ず");
+ return;
}
- if (int.Parse(txtHLowerlimit.Text) <= 0)
+ if (Convert.ToDecimal(txtHLowerlimit.Text) <= 0)
{
MessageBox.Show("涓嬬嚎姣斾緥蹇呴』澶т簬0", "鎻愮ず");
+ return;
}
- oCn.BeginTran();
+ if (Convert.ToDecimal(txtHStdPiece.Text) <= 0)
+ {
+ MessageBox.Show("鏍囧噯璁′欢蹇呴』澶т簬0", "鎻愮ず");
+ return;
+ }
+ if (Convert.ToDecimal(txtHStdPric.Text) <= 0)
+ {
+ MessageBox.Show("鏍囧噯璁′环蹇呴』澶т簬0", "鎻愮ず");
+ return;
+ }
string sql = string.Format(@"Update Gy_StdWorkTimes set" +
" HMaterID=" + textBox1.Text +
",HProcID=" + textBox2.Text +
",HStdWorkTimes=" + txtHStdWorkTimes.Text +
",HUpperlimit=" + txtHUpperlimit.Text +
",HLowerlimit=" + txtHLowerlimit.Text +
+ ",HStdPiece=" + txtHStdPiece.Text +
+ ",HStdPric=" + txtHStdPric.Text +
",HMaker='" + DBUtility.ClsPub.CurUserName + "'" +
",HMakeDate='" + DateTime.Now + "'" +
",HUSEORGID=" + DBUtility.ClsPub.HOrgID +
" where HItemID=" + BillOld.HItemID);
+ oCn.BeginTran();
oCn.RunProc(sql);
oCn.Commit();
MessageBox.Show("淇敼鎴愬姛,璇烽��鍑哄苟鍒锋柊", "鎻愮ず");
@@ -334,7 +351,7 @@
{
timer1.Enabled = false;
Sub_ControlLocation();
- if (BillOld.HItemID.ToString()!=null)//|| BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_Viewonly
+ if (BillOld.HItemID.ToString()!=null&& BillOld.HItemID.ToString() !="0")//|| BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_Viewonly
{
this.Sub_ShowBill();
}
@@ -365,37 +382,27 @@
{
switch (BillStatus)
{
- case DBUtility.ClsPub.Enum_BillStatus.BillStatus_View:
- //case DBUtility.ClsPub.Enum_BillStatus.BillStatus_Viewonly:
- //娴忚鐘舵��
- yl.Enabled = true;
- xz.Enabled = true;
+ case 0:
xg.Enabled = true;
- sc.Enabled = true;
AddRow.Enabled = false;
DelRow.Enabled = false;
bc.Enabled = false;
tc.Enabled = true;
- //鏈鏍�
- if (txtHChecker.Text.Trim() == "")
- {
- xg.Enabled = true;
- sc.Enabled = true;
- }
- else
- {
- xg.Enabled = false;
- sc.Enabled = false;
- }
+ Sub_LrtextStatus(true);
+ grdStatus = true;
+ break;
+ case DBUtility.ClsPub.Enum_BillStatus.BillStatus_View:
+ xg.Enabled = true;
+ AddRow.Enabled = false;
+ DelRow.Enabled = false;
+ bc.Enabled = false;
+ tc.Enabled = true;
Sub_LrtextStatus(false);
grdStatus = false;
break;
case DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew:
//鏂板鐘舵��
- yl.Enabled = false;
- xz.Enabled = false;
xg.Enabled = false;
- sc.Enabled = false;
AddRow.Enabled = true;
DelRow.Enabled = true;
bc.Enabled = true;
@@ -405,10 +412,7 @@
break;
case DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify:
//淇敼鐘舵��
- yl.Enabled = false;
- xz.Enabled = false;
xg.Enabled = false;
- sc.Enabled = false;
AddRow.Enabled = true;
DelRow.Enabled = true;
bc.Enabled = true;
@@ -416,6 +420,7 @@
Sub_LrtextStatus(true);
grdStatus = true;
break;
+
}
}
@@ -445,48 +450,10 @@
this.txtHStdWorkTimes.Text = dr["鏍囧噯宸ユ椂"].ToString();
this.txtHUpperlimit.Text = dr["涓婄嚎姣斾緥"].ToString();
this.txtHLowerlimit.Text = dr["涓嬬嚎姣斾緥"].ToString();
+ this.txtHStdPiece.Text = dr["鏍囧噯璁′欢"].ToString();
+ this.txtHStdPric.Text = dr["鏍囧噯璁′环"].ToString();
- //鍔犺浇琛ㄤ綋
- //initGrid();
- //int i = 0;
- //foreach (Model.ClsGy_StdWorkTimes_Model oSub in BillNew.DetailColl)
- //{
- // //
- // if (i >= grdMain1.RowCount - 1)
- // grdMain1.Rows.Add();
- // grdMain1.Rows[i].Cells[HTagCol].Value = "*";
- // grdMain1.Rows[i].Cells[HMaterIDCol].Value = oSub.HMaterID.ToString();
- // if (oMater.GetInfoByID(oSub.HMaterID))
- // {
- // grdMain1.Rows[i].Cells[HMaterNumberCol].Value = oMater.omodel.HNumber;
- // grdMain1.Rows[i].Cells[HMaterNameCol].Value = oMater.omodel.HName;
- // grdMain1.Rows[i].Cells[HMaterModelCol].Value = oMater.omodel.HModel;
- // }
- // else
- // {
- // grdMain1.Rows[i].Cells[HMaterNumberCol].Value = "";
- // grdMain1.Rows[i].Cells[HMaterNameCol].Value = "";
- // grdMain1.Rows[i].Cells[HMaterModelCol].Value = "";
- // }
- // grdMain1.Rows[i].Cells[HProcIDCol].Value = oSub.HProcID.ToString();
- // if (oProc.GetInfoByID(oSub.HProcID))
- // {
- // grdMain1.Rows[i].Cells[HProcNumberCol].Value = oProc.omodel.HNumber;
- // grdMain1.Rows[i].Cells[HProcNameCol].Value = oProc.omodel.HName;
- // }
- // else
- // {
- // grdMain1.Rows[i].Cells[HProcNumberCol].Value = "";
- // grdMain1.Rows[i].Cells[HProcNameCol].Value = "";
- // }
-
- // grdMain1.Rows[i].Cells[HStdWorkTimes].Value = oSub.HStdWorkTimes.ToString();
- // grdMain1.Rows[i].Cells[HUpperlimit].Value = oSub.HUpperlimit.ToString();
- // grdMain1.Rows[i].Cells[HLowerlimit].Value = oSub.HLowerlimit.ToString();
- // grdMain1.Rows[i].Cells[HUSEORGID].Value = oSub.HUSEORGID.ToString();
- // grdMain1.Rows[i].Cells[HRemarkCol].Value = oSub.HRemark;
- // i = i + 1;
- //}
+
//GRID鍏佽鍒锋柊
DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
//鍚堣
@@ -499,16 +466,6 @@
//鍗曟嵁瀹屾暣鎬у垽鏂� 鏈畬鎴�
private bool Sub_AllowSave()
{
- //蹇呰緭椤圭洰鏄惁涓虹┖
- //ClsK3_DepartmentHlp oDept = new ClsK3_DepartmentHlp();
- //if(!oDept.GetInfoByID(ClsPub.isLong(txtHDeptID.Tag)))
- //{
- // MessageBox.Show("閮ㄩ棬涓嶅瓨鍦紒");
- // return false;
- //}
-
- //鏄庣粏琛ㄦ槸鍚︿负闆惰
-
if (!IsNullRow(0))
{
MessageBox.Show("琛ㄤ綋鏄庣粏琛屼笉瀛樺湪锛佽褰曞叆锛�", "鎻愮ず");
@@ -516,8 +473,18 @@
}
else
{
+
return true;
}
+ }
+ //鏄惁鏄┖琛�
+ private bool IsNullRow(int Row)
+ {
+ if (ClsPub.isInt(grdMain1.Rows[Row].Cells[HMaterIDCol].Value) == 0&& ClsPub.isInt(grdMain1.Rows[Row].Cells[HProcIDCol].Value) == 0&& ClsPub.isDoule( grdMain1.Rows[Row].Cells[HStdWorkTimes].Value )== 0&& ClsPub.isDoule(grdMain1.Rows[Row].Cells[HUpperlimit].Value) == 0&& ClsPub.isDoule(grdMain1.Rows[Row].Cells[HLowerlimit].Value) == 0&& ClsPub.isStrNull(grdMain1.Rows[Row].Cells[HRemarkCol].Value) == ""&& ClsPub.isDoule(grdMain1.Rows[Row].Cells[HStdPiece].Value) == 0&& ClsPub.isDoule(grdMain1.Rows[Row].Cells[HStdPiece].Value) == 0)
+ {
+ return true;
+ }
+ return false;
}
//淇濆瓨鍗曟嵁
private bool Sub_SaveBill()
@@ -526,11 +493,7 @@
Int32 i;
bool bResult;
BillNew = new DAL.ClsGy_StdWorkTimes_Ctl();
- //缂栬緫鏉冮檺
- //if (!ClsPub.Security_Log(ModRightNameEdit, 1, true, DBUtility.ClsPub.CurUserName))
- //{
- // return false;
- //}
+
//澶卞幓鐒︾偣
lblCaption.Focus();
//
@@ -542,9 +505,13 @@
BillNew.DetailColl = new List<Model.ClsGy_StdWorkTimes_Model>();
for (i = 0; i <= grdMain1.RowCount - 1; i++)
{
- if (DBUtility.ClsPub.isLong(grdMain1.Rows[i].Cells[HMaterIDCol].Value) != 0 && DBUtility.ClsPub.isLong(grdMain1.Rows[i].Cells[HProcIDCol].Value) != 0)
+ if (IsNullRow(i))
{
- if (DBUtility.ClsPub.isLong(grdMain1.Rows[i].Cells[HStdWorkTimes].Value)>0&& DBUtility.ClsPub.isLong(grdMain1.Rows[i].Cells[HUpperlimit].Value) > 0&& DBUtility.ClsPub.isLong(grdMain1.Rows[i].Cells[HLowerlimit].Value) > 0)
+ break;
+ }
+ if (DBUtility.ClsPub.isStrNull(grdMain1.Rows[i].Cells[HMaterIDCol].Value) != "" && DBUtility.ClsPub.isStrNull(grdMain1.Rows[i].Cells[HProcIDCol].Value) != "" && DBUtility.ClsPub.isStrNull(grdMain1.Rows[i].Cells[HStdWorkTimes].Value) != "")
+ {
+ if (DBUtility.ClsPub.isDoule(grdMain1.Rows[i].Cells[HStdWorkTimes].Value) > 0 && DBUtility.ClsPub.isDoule(grdMain1.Rows[i].Cells[HUpperlimit].Value) > 0 && DBUtility.ClsPub.isDoule(grdMain1.Rows[i].Cells[HLowerlimit].Value) > 0 && DBUtility.ClsPub.isDoule(grdMain1.Rows[i].Cells[HStdPiece].Value) > 0 && DBUtility.ClsPub.isDoule(grdMain1.Rows[i].Cells[HStdPric].Value) > 0)
{
Model.ClsGy_StdWorkTimes_Model oSub = new Model.ClsGy_StdWorkTimes_Model();
oSub.HMaterID = ClsPub.isLong(grdMain1.Rows[i].Cells[HMaterIDCol].Value);
@@ -552,6 +519,8 @@
oSub.HStdWorkTimes = ClsPub.isDoule(grdMain1.Rows[i].Cells[HStdWorkTimes].Value);
oSub.HUpperlimit = ClsPub.isDoule(grdMain1.Rows[i].Cells[HUpperlimit].Value);
oSub.HLowerlimit = ClsPub.isDoule(grdMain1.Rows[i].Cells[HLowerlimit].Value);
+ oSub.HStdPiece = ClsPub.isDoule(grdMain1.Rows[i].Cells[HStdPiece].Value);
+ oSub.HStdPric = ClsPub.isDoule(grdMain1.Rows[i].Cells[HStdPric].Value);
oSub.HUSEORGID = ClsPub.HOrgID;
oSub.HStopflag = false;
oSub.HMaker = ClsPub.CurUserName;
@@ -561,9 +530,14 @@
}
else
{
- MessageBox.Show("绗�" + (i+1) + "琛�,鏍囧噯宸ユ椂,涓婇檺姣斾緥鍜屼笅闄愭瘮渚嬮兘搴斿ぇ浜�0", "鎻愮ず");
+ MessageBox.Show("绗�" + (i + 1) + "琛�,鏍囧噯宸ユ椂,涓婇檺姣斾緥,涓嬮檺姣斾緥锛屾爣鍑嗚浠跺拰鏍囧噯璁′环閮藉簲澶т簬0", "鎻愮ず");
return false;
}
+ }
+ else
+ {
+ MessageBox.Show("绗�" + (i + 1) + "琛�,鐗╂枡銆佸伐搴忓拰鏍囧噯宸ユ椂涓嶈兘涓虹┖", "鎻愮ず");
+ return false;
}
}
//淇濆瓨瀹屾瘯鍚庡鐞�
@@ -632,6 +606,9 @@
grdMain1.Columns[HStdWorkTimes].HeaderText = "鏍囧噯宸ユ椂";
grdMain1.Columns[HUpperlimit].HeaderText = "涓婇檺姣斾緥";
grdMain1.Columns[HLowerlimit].HeaderText = "涓嬮檺姣斾緥";
+ grdMain1.Columns[HStdPiece].HeaderText = "鏍囧噯璁′欢";
+ grdMain1.Columns[HStdPric].HeaderText = "鏍囧噯璁′环";
+
grdMain1.Columns[HUSEORGID].HeaderText = "缁勭粐ID";
grdMain1.Columns[HRemarkCol].HeaderText = "澶囨敞";
//
@@ -646,6 +623,8 @@
"," + HStdWorkTimes.ToString() +
"," + HUpperlimit.ToString() +
"," + HLowerlimit.ToString() +
+ "," + HStdPiece.ToString() +
+ "," + HStdPric.ToString() +
"," + HRemarkCol.ToString();
//鍚堣鍒�
string sTotalCol = "";
@@ -710,15 +689,6 @@
//
oSumGrid.EditStatus = false;
return true;
- }
- //鏄惁鏄┖琛�
- private bool IsNullRow(int Row)
- {
- if (ClsPub.isInt(grdMain1.Rows[Row].Cells[HMaterIDCol].Value) == 0)
- {
- return true;
- }
- return false;
}
//'鍒ゆ柇缃戞牸琛岀殑褰曞叆鏄惁姝g‘
private bool CheckGridRow(int Row)
--
Gitblit v1.9.1