From 176c90cddfb8c43674e889d89b86cd979e94e65a Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期二, 10 九月 2024 18:36:43 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
WarM/条码打印/Gy_PackBarCodeBill_automaticallyByPLC.cs | 502 +++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 427 insertions(+), 75 deletions(-)
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_PackBarCodeBill_automaticallyByPLC.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_PackBarCodeBill_automaticallyByPLC.cs"
index bec4a79..b7698c4 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_PackBarCodeBill_automaticallyByPLC.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_PackBarCodeBill_automaticallyByPLC.cs"
@@ -10,6 +10,7 @@
using System.Linq;
using System.Text;
using System.Windows.Forms;
+using Microsoft.VisualBasic;
namespace WarM.鏉$爜鎵撳嵃
{
@@ -71,6 +72,10 @@
public bool BillChange; //
public bool grdStatus;
public int selectRow = 0;
+
+ //璁板綍褰撳墠缁勬墭鐨勬潯鐮佺殑婧愬崟ID銆佸瓙ID锛岀敤浜庝繚璇佸綋鍓嶆墭涓墍鏈夊瓙鏉$爜涓哄悓涓�涓伐鍗曠敓鎴�
+ public int HSourceInterID_ICMO = 0;
+ public int HSourceEntryID_ICMO = 0;
private void Gy_PackBarCodeBill_automaticallyByPLC_Load(object sender, EventArgs e)
{
@@ -181,6 +186,11 @@
DBUtility.Xt_BaseBillFun.initGridList(grdSub, this.Name + "grdSub");
getDisplay_GrdMain();
+
+ if (grdMain.Rows.Count > 0 && grdMain.Rows[0].Cells[4].Value!=null)
+ {
+ getPackQty(grdMain.Rows[0].Cells[4].Value.ToString());
+ }
}
@@ -347,22 +357,32 @@
//鏈弧鎵樼敓鎴� 鎸夐挳 鐐瑰嚮浜嬩欢
private void button_produceByHand_Click(object sender, EventArgs e)
{
- if (HQty == 0)
+ try
{
- MessageBox.Show("璇锋壂鐮佸瓙鏉$爜!");
- return;
+ if (HQty == 0)
+ {
+ MessageBox.Show("璇锋壂鐮佸瓙鏉$爜!");
+ return;
+ }
+ this.Sub_SaveBill();
+
+ //缁勬墭鎴愬姛鍚庯紝娓呯┖缁勬墭鏁伴噺涓庢簮鍗曚俊鎭�
+ set_clearPackQtyAndSourceInfo();
}
- this.Sub_SaveBill();
+ catch(Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
}
//鑷姩缁勬墭
private void button_startListen_Click(object sender, EventArgs e)
{
- if (DBUtility.ClsPub.isLong(textBox_PackQty.Text) == 0)
- {
- MessageBox.Show("璇疯缃墭鏉$爜鐨勬渶灏忓寘瑁呮暟锛�");
- return;
- }
+ //if (DBUtility.ClsPub.isLong(textBox_PackQty.Text) == 0)
+ //{
+ // MessageBox.Show("璇疯缃墭鏉$爜鐨勬渶灏忓寘瑁呮暟锛�");
+ // return;
+ //}
isStartListen = 1;
@@ -379,6 +399,8 @@
comboBox_SourceNameParams.Enabled = false;
button_saveParams.Enabled = false;
+
+ textBox_HBarCode.Focus();
}
//鍋滄缁勬墭
@@ -406,22 +428,31 @@
{
if(isStartListen == 1)
{
- if(HQty == DBUtility.ClsPub.isDoule(textBox_PackQty.Text))
+ try
{
- this.Sub_SaveBill();
-
- //璁剧疆鎵撳嵃妯℃澘锛屾墦鍗�
- grdSub.Rows[0].Cells[0].Value = "*";
- Report = new GridppReport();
- Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + textBox_PrintModelParams.Text + ".grf"); //here .
- Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
- Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
- Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd);
- if (comboBox_PrinterParams.Text != "")
+ if (HQty == DBUtility.ClsPub.isDoule(textBox_PackQty.Text))
{
- Report.Printer.PrinterName = comboBox_PrinterParams.Text.Replace("(榛樿)", "");
+ this.Sub_SaveBill();
+
+ //璁剧疆鎵撳嵃妯℃澘锛屾墦鍗�
+ grdSub.Rows[0].Cells[0].Value = "*";
+ Report = new GridppReport();
+ Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + textBox_PrintModelParams.Text + ".grf"); //here .
+ Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
+ Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
+ Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd);
+ if (comboBox_PrinterParams.Text != "")
+ {
+ Report.Printer.PrinterName = comboBox_PrinterParams.Text.Replace("(榛樿)", "");
+ }
+ Report.Print(false);
+
+ //缁勬墭鎴愬姛鍚庯紝娓呯┖缁勬墭鏁伴噺涓庢簮鍗曚俊鎭�
+ set_clearPackQtyAndSourceInfo();
}
- Report.Print(false);
+ }catch(Exception ex)
+ {
+ MessageBox.Show(ex.Message);
}
}
}
@@ -430,25 +461,31 @@
//鐢熸垚鎵樼洏鏉$爜
private bool Sub_SaveBill()
{
- //鑾峰彇缁勭粐淇℃伅
- HOrgID = get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
- HOrgNumber = get_ORGANIZATIONSNOByName(cmbHOrgID.Text);
-
- if (HOrgID == -1)
+ try
{
- MessageBox.Show("閫夋嫨缁勭粐鏈夐敊璇紒");
- return false;
- }
+ //鑾峰彇缁勭粐淇℃伅
+ HOrgID = get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
+ HOrgNumber = get_ORGANIZATIONSNOByName(cmbHOrgID.Text);
+ if (HOrgID == -1)
+ {
+ throw new Exception("閫夋嫨缁勭粐鏈夐敊璇紒");
+ }
- if (!Sub_AllowSave())//鍗曟嵁瀹屾暣鎬у垽鏂�
+ if (!Sub_AllowSave())//鍗曟嵁瀹屾暣鎬у垽鏂�
+ {
+ throw new Exception("鍗曟嵁瀹屾暣鎬у垽鏂け璐ワ紒");
+ }
+
+ SaveBarCode();
+ return true;
+ }catch(Exception ex)
{
- return false;
+ string sql = "exec h_p_WMS_PackBarCodeBill_dealDataWhenError '" + textBox_HPackBarCode + "'";
+ oCn.RunProc(sql);
+ throw new Exception(ex.Message);
}
-
-
- SaveBarCode();
- return true;
+
}
//鍗曟嵁瀹屾暣鎬у垽鏂� 鏈畬鎴�
@@ -506,6 +543,15 @@
sSQLMul[1] = " exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "'," + HQty.ToString() + " ";
+ //鍒ゆ柇褰撳墠鎵樼洏鏉$爜鏄惁宸茬粡閫氳繃涓存椂缁勬墭鍦ㄦ潯鐮佹。妗堜腑鐢熸垚浜嗭紝鑻ュ凡缁忕敓鎴愪簡鍒欎笉闇�瑕佸湪鎻掑叆
+ ds = oCn.RunProcReturn("select * from Gy_BarCodeBill where HBarCode = '" + textBox_HPackBarCode.Text + "' and HSTOCKORGID = " + HOrgID, "Gy_BarCodeBill");
+ if (ds != null && ds.Tables[0].Rows.Count > 0)
+ {
+ sSQLMul[0] = "";
+ }
+
+ oCn.BeginTran();
+
if (getRunProcByMul_Back(sSQLMul, ref DBUtility.ClsPub.sExeReturnInfo))
{
//MessageBox.Show("鏉$爜鐢熸垚瀹屾瘯锛�");
@@ -517,15 +563,21 @@
setPackBarCodeBillData();
getDisplay_GrdMain();
+
+ oCn.Commit();
}
else
{
//MessageBox.Show("鏉$爜鐢熸垚澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo);
+ oCn.RollBack();
}
+
+ //oCn.Commit();
}
catch (Exception e)
{
- //MessageBox.Show("鏉$爜鐢熸垚澶辫触锛�" + e.Message);
+ oCn.RollBack();
+ throw new Exception(e.Message);
}
}
@@ -540,27 +592,30 @@
{
for (int i = 0; i < 1; i++)
{
- oCn.RunProc(sSQL[i]);
+ if (sSQL[i].Length > 0)
+ {
+ oCn.RunProc(sSQL[i]);
+ }
}
-
-
+ //涓婁紶缁勬墭淇℃伅鍒版湇鍔″櫒
send();
+ oCn.Commit();
}
else
{
- sErrMsg = "娌℃湁鏁版嵁锛�";
oCn.Commit();
- return false;
+ sErrMsg = "娌℃湁鏁版嵁锛�";
+ throw new Exception(sErrMsg);
}
- oCn.Commit();
+ //oCn.Commit();
return true;
}
catch (Exception e)
{
- sErrMsg = e.Message;
oCn.RollBack();
- return false;
+ sErrMsg = e.Message;
+ throw new Exception(sErrMsg);
}
}
#endregion
@@ -570,16 +625,22 @@
private void send()
{
string err = "";
- if (!CheckModRight(ModRightNamePackUnion, DBUtility.ClsPub.CurUserName, ref err))
- {
- MessageBox.Show(err);
- return;
- }
+ //if (!CheckModRight(ModRightNamePackUnion, DBUtility.ClsPub.CurUserName, ref err))
+ //{
+ // MessageBox.Show(err);
+ // return;
+ //}
//if (MessageBox.Show("纭畾瑕佷笂浼狅紵", "鎻愮ず", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
//{
// return;
//}
- LoadData();
+ try
+ {
+ LoadData();
+ }catch(Exception ex)
+ {
+ throw new Exception(ex.Message);
+ }
}
//鍒ゆ柇鐢ㄦ埛鏉冮檺
@@ -608,7 +669,7 @@
//鍒ゆ柇鏄惁鏁版嵁瀹屾暣
if (AllowLoadData() == false)
{
- return;
+ throw new Exception("鏁版嵁瀹屾暣鎬у垽鏂け璐ワ紒");
}
try
{
@@ -626,14 +687,14 @@
}
else
{
- MessageBox.Show("鐢熸垚澶辫触锛佸師鍥�:" + err);
- return;
+ string error = "鐢熸垚澶辫触锛佸師鍥�:" + err;
+ throw new Exception(error);
}
}
catch (Exception e)
{
- MessageBox.Show("鍗曟嵁鍙凤細" + textBox_sBillID.Text + "锛屽崟鎹甀D锛�" + textBox_sBillID.Text + "锛涗笂浼犲け璐ワ紒" + e.Message);
- return;
+ string error = "鍗曟嵁鍙凤細" + textBox_sBillID.Text + "锛屽崟鎹甀D锛�" + textBox_sBillID.Text + "锛涗笂浼犲け璐ワ紒" + e.Message;
+ throw new Exception(error);
}
}
@@ -657,37 +718,37 @@
public bool set_SavePackUnionBill_Add(Int64 HInterID, string HBillType, string HBillNo, string HBarCode_Pack, string HMaker, Int64 HStockOrgID, ref string sErrMsg)
{
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+ oCn.BeginTran();
try
{
- oCn.BeginTran();
DataSet ds = oCn.RunProcReturn("exec h_p_Sc_PackUnionBill_Insert_New " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + HBarCode_Pack + "','" + HMaker + "'," + HStockOrgID.ToString(), "h_p_Sc_PackUnionBill_Insert_New");
if (ds == null || ds.Tables[0].Rows.Count == 0)
{
- sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涗笂浼犲け璐ワ紒";
oCn.RollBack();
- return false;
+ sErrMsg = "鍗曟嵁鍙凤細" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛涗笂浼犲け璐ワ紒";
+ throw new Exception(sErrMsg);
}
else
{
if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 1)
{
- sErrMsg = "涓婁紶澶辫触锛屽崟鎹彿锛�" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
oCn.RollBack();
- return false;
+ sErrMsg = "涓婁紶澶辫触锛屽崟鎹彿锛�" + HBillNo + "锛屽崟鎹甀D锛�" + HInterID + "锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
+ throw new Exception(sErrMsg);
}
else
{
- //sErrMsg = "鐢熸垚鐢熶骇缁勬墭鍗曟垚鍔燂紒鍗曟嵁鍙蜂负锛�" + HBillNo;
oCn.Commit();
+ //sErrMsg = "鐢熸垚鐢熶骇缁勬墭鍗曟垚鍔燂紒鍗曟嵁鍙蜂负锛�" + HBillNo;
return true;
}
}
}
catch (Exception e)
{
- sErrMsg = "鐢熸垚鐢熶骇缁勬墭鍗曞け璐ワ紒" + e.Message;
oCn.RollBack();
- return false;
+ sErrMsg = "鐢熸垚鐢熶骇缁勬墭鍗曞け璐ワ紒" + e.Message;
+ throw new Exception(sErrMsg);
}
}
@@ -704,20 +765,30 @@
{
if (e.KeyChar == (char)Keys.Return)
{
+ //闃查敊鍒ゆ柇
+ if(!judgeIsSameSourceBill(textBox_HBarCode.Text.Trim()))
+ {
+ textBox_HBarCode.Text = "";
+ return;
+ }
+
SetBarCode_Webs();
textBox_HBarCode.Text = "";
textBox_HBarCode.Focus();
autoProducePackBarCode();
+
+ if (grdMain.Rows.Count ==1 )
+ {
+ getPackQty(grdMain.Rows[0].Cells[4].Value.ToString());
+ }
}
}
catch (Exception e2)
{
- //if (DBUtility.ClsPub.bSound)
- //{
- // DBUtility.ClsPub.MessageBeep((int)DBUtility.ClsPub.BeepType.Warning);
- //}
- MessageBox.Show("鍙戠敓缃戠粶寮傚父锛岃绋嶅悗鍐嶈瘯锛�");
+ textBox_HBarCode.Text = "";
+ textBox_HBarCode.Focus();
+ MessageBox.Show(e2.Message);
}
}
//灏嗘潯鐮佷俊鎭啓鍏ユ潯鐮佸嚭鍏ュ簱涓存椂琛�
@@ -741,13 +812,13 @@
}
else
{
- MessageBox.Show(err);
- return;
+ throw new Exception(err);
}
}
catch (Exception e)
{
- MessageBox.Show("鎵弿瀛愭潯鐮侊紝鍐欏叆涓存椂琛ㄤ俊鎭け璐ワ紒" + e.Message + err);
+ string sError = "鎵弿瀛愭潯鐮侊紝鍐欏叆涓存椂琛ㄤ俊鎭け璐ワ紒" + e.Message + err;
+ throw new Exception(sError);
}
}
@@ -1095,6 +1166,11 @@
private void toolStripButton_Delete_Click(object sender, EventArgs e)
{
deleteGrdMainNote();
+
+ if (grdMain.Rows.Count== 0)
+ {
+ set_clearPackQtyAndSourceInfo();
+ }
}
#endregion
@@ -1105,14 +1181,29 @@
{
if (grdMain.SelectedRows != null && grdMain.SelectedRows.Count==1)
{
- if (MessageBox.Show("纭畾瑕佸垹闄わ紵", "鎻愮ず", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
+ //if (MessageBox.Show("纭畾瑕佸垹闄わ紵", "鎻愮ず", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
+ //{
+ // return;
+ //}
+ //if (MessageBox.Show("鍒犻櫎鍚庡皢涓嶅彲鎭㈠锛岀‘瀹氳缁х画鎿嶄綔锛�", "鎻愮ず", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
+ //{
+ // return;
+ //}
+
+ string pwd = Interaction.InputBox("璇疯緭鍏ュ瘑鐮�", "鍒犻櫎纭锛�", "", 100, 100);
+
+ //鐐瑰嚮鍙栨秷
+ if(pwd == "")
{
return;
}
- if (MessageBox.Show("鍒犻櫎鍚庡皢涓嶅彲鎭㈠锛岀‘瀹氳缁х画鎿嶄綔锛�", "鎻愮ず", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
+
+ if(pwd != "123456")
{
+ MessageBox.Show("瀵嗙爜閿欒锛�");
return;
}
+
Delete();
}
else
@@ -1161,9 +1252,270 @@
}
}
+
#endregion
-
+
+ #region 涓存椂缁勬墭
+ #region 涓存椂缁勬墭 鎸夐挳鐐瑰嚮浜嬩欢
+ private void button_produceTemp_Click(object sender, EventArgs e)
+ {
+ if (HQty == 0)
+ {
+ MessageBox.Show("璇锋壂鐮佸瓙鏉$爜!");
+ return;
+ }
+ this.produceTemp();
+
+ //璁剧疆鎵撳嵃妯℃澘锛屾墦鍗�
+ grdSub.Rows[0].Cells[0].Value = "*";
+ Report = new GridppReport();
+ Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + textBox_PrintModelParams.Text + "_Temp" + ".grf"); //here .
+ Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
+ Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
+ Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd);
+ if (comboBox_PrinterParams.Text != "")
+ {
+ Report.Printer.PrinterName = comboBox_PrinterParams.Text.Replace("(榛樿)", "");
+ }
+ Report.Print(false);
+
+ //缁勬墭鎴愬姛鍚庯紝娓呯┖缁勬墭鏁伴噺涓庢簮鍗曚俊鎭�
+ set_clearPackQtyAndSourceInfo();
+ }
+ #endregion
+
+ #region 涓存椂缁勬墭
+ private void produceTemp()
+ {
+ //鍒ゆ柇鏉$爜妗f涓槸鍚﹀凡缁忓瓨鍦ㄨ鎵樻潯鐮侊紝鑻ュ瓨鍦紝鍒欎笉闇�瑕佸啀鍒涘缓銆傞噸鏂板姞杞界晫闈㈠嵆鍙��
+ DataSet ds_getPackBarCode;
+ string sql_getPackBarCode = "select * from Gy_BarCodeBill where HBarCode = '" + textBox_HPackBarCode.Text + "'";
+ ds_getPackBarCode = oCn.RunProcReturn(sql_getPackBarCode, "Gy_BarCodeBill");
+ if (ds_getPackBarCode != null && ds_getPackBarCode.Tables[0].Rows.Count > 0)
+ {
+ //閲嶆柊鍔犺浇鐣岄潰
+ getDisplay_grdSub();
+
+ setPackBarCodeBillData();
+
+ getDisplay_GrdMain();
+ return;
+ }
+
+
+ //鑾峰彇缁勭粐淇℃伅
+ HOrgID = get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
+ HOrgNumber = get_ORGANIZATIONSNOByName(cmbHOrgID.Text);
+
+ //楠岃瘉缁勭粐
+ if (HOrgID == -1)
+ {
+ MessageBox.Show("閫夋嫨缁勭粐鏈夐敊璇紒");
+ return;
+ }
+
+ //鍗曟嵁瀹屾暣鎬у垽鏂�
+ if (!Sub_AllowSave())
+ {
+ return;
+ }
+
+ //鑾峰彇褰撳墠浜х嚎鍙婁骇绾垮唴鐮�
+ long HSourceID = 0;
+ string sql = "select * from Gy_Source where HName = '" + comboBox_SourceNameParams.Text + "' ";
+ DataSet ds = oCn.RunProcReturn(sql, "Gy_Source");
+ if (ds != null && ds.Tables[0].Rows.Count > 0)
+ {
+ HSourceID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HItemID"].ToString());
+ }
+
+ //鎷兼帴涓存椂缁勬墭鏃讹紝鎵樻潯鐮佺殑鐢熸垚璇彞
+ sSQLMul = new string[2];
+ sSQLMul[0] = "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
+ ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
+ ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
+ ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
+ ",HCusID,HCusType,HEndDate,HWorkLineName,HJiaYe " +
+ ",HPressModel,HCusModel,HMaterialModel,HColor,HBarCodeDate " +
+ ",HLogo,HPackageSize,HMaterialJQty,HMaterialMQty,HCustomBatchNo " +
+ ",HSTOCKORGID,HOWNERID,HBeginDate,HSeOrderBillNo,HGBBarCode " +
+ ",POOrderBillNo,HInterID,HInitSourceEntryID,HBarCode_Pack " +
+ ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo " +
+ ",HCustomQty1,HLayerNumber,HCusBarCode,HBarCodeStatus,HSourceID " +
+ ") values ("
+ + "'" + textBox_HPackBarCode.Text + "','" + HBarCodeType + "',0,0,1"
+ + ",'',0,0,'" + ClsPub.CurUserName + "',getdate(),0,1"
+ + ",0,0,'','',''"
+ + "," + HQty.ToString() + ",1,0,0,0,''"
+ + ",0,'','','',''"
+ + ",'','','','','" + sDate + "'"
+ + ",'','',0,0,''"
+ + "," + HOrgID.ToString() + "," + HOrgID.ToString() + ",'','',''"
+ + ",''," + HInterID.ToString() + ",0,'" + textBox_HPackBarCode.Text + "'"
+ + ",'','','',0,''"
+ + ",0,0,'',''," + HSourceID +
+ ")";
+ //鎷兼帴 鏇存柊 鎵樻潯鐮佹祦姘村彿 鐨剆ql璇彞
+ sSQLMul[1] = " exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "'," + HQty.ToString() + " ";
+
+ if (sSQLMul.Length > 0)
+ {
+ //鎵ц鎵樻潯鐮佺殑鐢熸垚璇彞涓庢墭鏉$爜娴佹按鍙风殑鏇存柊璇彞
+ for (int i = 0; i < 1; i++)
+ {
+ oCn.RunProc(sSQLMul[i]);
+ }
+
+ //閲嶆柊鍔犺浇鐣岄潰
+ getDisplay_grdSub();
+
+ setPackBarCodeBillData();
+
+ getDisplay_GrdMain();
+ }
+ else
+ {
+ MessageBox.Show("娌℃湁鏁版嵁锛�");
+ return;
+ }
+ }
+ #endregion
+
+ #region 鎵樻潯鐮� 鎵爜
+ private void textBox_HPackBarCode__KeyPress(object sender, KeyPressEventArgs e)
+ {
+ if (e.KeyChar == (char)Keys.Return)
+ {
+ //鑾峰彇鎵弿鐨勬墭鏉$爜
+ string HPackBarCode = textBox_HPackBarCode.Text;
+ //鏉$爜绫诲瀷
+ HBarCodeType = ClsPub.isStrNull(cmbHBarCodeType.Text);
+ //鑾峰彇缁勭粐淇℃伅
+ HOrgID = get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
+ HOrgNumber = get_ORGANIZATIONSNOByName(cmbHOrgID.Text);
+
+ //澹版槑鐢ㄤ簬鏁版嵁搴撴煡璇㈢殑鍙橀噺
+ string sql = "";
+ DataSet ds;
+
+ //鍒ゆ柇 鎵樻潯鐮佹槸鍚﹀凡缁忕敓鎴愮粍鎵樺崟
+ sql = "select * from Sc_PackUnionBillMain where HBarCode_Pack = '" + HPackBarCode + "'";
+ ds = oCn.RunProcReturn(sql, "Sc_PackUnionBillMain");
+ if (ds != null && ds.Tables[0].Rows.Count > 0)
+ {
+ MessageBox.Show("鎵樻潯鐮乕" + HPackBarCode + "]宸茬粡缁勬墭锛�");
+ return;
+ }
+
+
+ //鑾峰彇褰撳墠浜х嚎
+ long HSourceID = 0;
+ sql = "select * from Gy_Source where HName = '" + comboBox_SourceNameParams.Text + "'";
+ ds = oCn.RunProcReturn(sql, "Gy_Source");
+ if (ds != null && ds.Tables[0].Rows.Count > 0)
+ {
+ HSourceID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HItemID"].ToString());
+ }
+
+
+ //鑾峰彇缂撳瓨鍒楄〃涓� 鎵樻潯鐮� 瀵瑰簲鐨� 缁勬墭璁板綍
+ sql = "select top(1) a.* from Sc_PackUnionBill_Temp as a inner join Gy_BarCodeBill as b on a.HBarCode = b.HBarCode where a.HBarCode_Pack = '" + HPackBarCode + "' and b.HSourceID = " + HSourceID + " and a.HStockorgID = " + HOrgID;
+ //sql = "select top(1) a.* from Sc_PackUnionBill_Temp as a where a.HBarCode_Pack = '" + HPackBarCode + "' and a.HStockorgID = " + HOrgID;
+ ds = oCn.RunProcReturn(sql, "Sc_PackUnionBill_Temp");
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ MessageBox.Show("缂撳瓨鍒楄〃涓湭鏌ヨ鍒拌鎵樻潯鐮佷笌瀛愭潯鐮佺殑缁勬墭璁板綍锛�");
+ return;
+ }
+ else
+ {
+ string HBarCode_Pack = ds.Tables[0].Rows[0]["HBarCode_Pack"].ToString();
+ long HBillID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HInterID"].ToString());
+ string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+
+ textBox_HPackBarCode.Text = HBarCode_Pack;
+ textBox_sBillID.Text = HBillID.ToString();
+ textBox_sBillNo.Text = HBillNo;
+
+ getDisplay_GrdMain();
+
+ if (grdMain.Rows.Count > 0 && grdMain.Rows[0].Cells[4].Value != null)
+ {
+ getPackQty(grdMain.Rows[0].Cells[4].Value.ToString());
+ }
+ }
+
+
+ }
+ }
+ #endregion
+ #endregion
+
+
+ #region 鏍规嵁鏉$爜缂栧彿锛岃幏鍙栨潯鐮佷腑鐗╂枡鎵�瀵瑰簲鐨勭粍鎵樻暟閲忥紝鍚屾椂璁板綍婧愬崟涓籌D銆佸瓙ID
+ private void getPackQty(string HBarCode)
+ {
+ string sql = "select * from h_v_IF_BarCodeBillList_getPackQty where 鏉$爜缂栧彿 = '" + HBarCode + "'";
+ DataSet ds_getPackQty = oCn.RunProcReturn(sql, "h_v_IF_BarCodeBillList_getPackQty");
+ if (ds_getPackQty == null || ds_getPackQty.Tables[0].Rows.Count <= 0)
+ {
+ HSourceInterID_ICMO = 0;
+ HSourceEntryID_ICMO = 0;
+
+ textBox_PackQty.Text = "";
+ return;
+ }
+
+ HSourceInterID_ICMO = int.Parse(ds_getPackQty.Tables[0].Rows[0]["HSourceInterID"].ToString());
+ HSourceEntryID_ICMO = int.Parse(ds_getPackQty.Tables[0].Rows[0]["HSourceEntryID"].ToString());
+ textBox_PackQty.Text = Double.Parse(ds_getPackQty.Tables[0].Rows[0]["缁勬墭鏁伴噺"].ToString()).ToString();
+ }
+ #endregion
+
+ #region 鍒ゆ柇褰撳墠鎵弿鐨勬潯鐮佹槸鍚︿笌宸茬粡鎵弿杩囩殑鏉$爜涓哄悓涓�宸ュ崟鐢熸垚鐨�
+ private bool judgeIsSameSourceBill(string HBarCode)
+ {
+ if (grdMain.Rows.Count == 0)
+ {
+ return true;
+ }
+ else
+ {
+ string sql = "select * from h_v_IF_BarCodeBillList_getPackQty where 鏉$爜缂栧彿 = '" + HBarCode + "'";
+ DataSet ds_getPackQty = oCn.RunProcReturn(sql, "h_v_IF_BarCodeBillList_getPackQty");
+ if (ds_getPackQty == null || ds_getPackQty.Tables[0].Rows.Count <= 0)
+ {
+ MessageBox.Show("褰撳墠鏉$爜涓嶅瓨鍦紒");
+ return false;
+ }
+ else
+ {
+ int HSourceInterID_ICMO_Bak = int.Parse(ds_getPackQty.Tables[0].Rows[0]["HSourceInterID"].ToString());
+ int HSourceEntryID_ICMO_Bak = int.Parse(ds_getPackQty.Tables[0].Rows[0]["HSourceEntryID"].ToString());
+ if (HSourceInterID_ICMO != HSourceInterID_ICMO_Bak || HSourceEntryID_ICMO != HSourceEntryID_ICMO_Bak)
+ {
+ MessageBox.Show("褰撳墠鎵弿鐨勬潯鐮佷笌涔嬪墠鎵�鎵弿鐨勬潯鐮佸伐鍗曚笉涓�鑷达紒");
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ }
+ }
+ #endregion
+
+ #region 娓呯┖ 缁勬墭鏁伴噺 涓庤褰曠殑婧愬崟涓籌D銆佸瓙ID
+ private void set_clearPackQtyAndSourceInfo()
+ {
+ textBox_PackQty.Text = "";
+ HSourceInterID_ICMO = 0;
+ HSourceEntryID_ICMO = 0;
+ }
+ #endregion
+
}
}
--
Gitblit v1.9.1