From 8392ea7db9ad3d7cbddba1b880bb133e4f7aa5c0 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期二, 30 四月 2024 09:56:30 +0800
Subject: [PATCH] 托盘条码自动生成:临时组托
---
WarM/条码打印/Gy_PackBarCodeBill_automaticallyByPLC.Designer.cs | 15 +++
WarM/条码打印/Gy_PackBarCodeBill_automaticallyByPLC.cs | 189 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 202 insertions(+), 2 deletions(-)
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_PackBarCodeBill_automaticallyByPLC.Designer.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_PackBarCodeBill_automaticallyByPLC.Designer.cs"
index ea49d71..703f4cb 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_PackBarCodeBill_automaticallyByPLC.Designer.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_PackBarCodeBill_automaticallyByPLC.Designer.cs"
@@ -34,6 +34,7 @@
this.tabControl_MainInfo = new System.Windows.Forms.TabControl();
this.tabPage_BillInfo = new System.Windows.Forms.TabPage();
this.gbUp = new System.Windows.Forms.GroupBox();
+ this.button_produceTemp = new System.Windows.Forms.Button();
this.label_sBillNo = new System.Windows.Forms.Label();
this.textBox_sBillNo = new System.Windows.Forms.TextBox();
this.label_sBillID = new System.Windows.Forms.Label();
@@ -121,6 +122,7 @@
// gbUp
//
this.gbUp.BackColor = System.Drawing.Color.Transparent;
+ this.gbUp.Controls.Add(this.button_produceTemp);
this.gbUp.Controls.Add(this.label_sBillNo);
this.gbUp.Controls.Add(this.textBox_sBillNo);
this.gbUp.Controls.Add(this.label_sBillID);
@@ -149,6 +151,16 @@
this.gbUp.Size = new System.Drawing.Size(1374, 310);
this.gbUp.TabIndex = 33;
this.gbUp.TabStop = false;
+ //
+ // button_produceTemp
+ //
+ this.button_produceTemp.Location = new System.Drawing.Point(829, 215);
+ this.button_produceTemp.Name = "button_produceTemp";
+ this.button_produceTemp.Size = new System.Drawing.Size(158, 70);
+ this.button_produceTemp.TabIndex = 123;
+ this.button_produceTemp.Text = "涓存椂缁勬墭";
+ this.button_produceTemp.UseVisualStyleBackColor = true;
+ this.button_produceTemp.Click += new System.EventHandler(this.button_produceTemp_Click);
//
// label_sBillNo
//
@@ -287,11 +299,11 @@
// textBox_HPackBarCode
//
this.textBox_HPackBarCode.BackColor = System.Drawing.SystemColors.ScrollBar;
- this.textBox_HPackBarCode.Enabled = false;
this.textBox_HPackBarCode.Location = new System.Drawing.Point(122, 81);
this.textBox_HPackBarCode.Name = "textBox_HPackBarCode";
this.textBox_HPackBarCode.Size = new System.Drawing.Size(280, 28);
this.textBox_HPackBarCode.TabIndex = 43;
+ this.textBox_HPackBarCode.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox_HPackBarCode__KeyPress);
//
// dtpHDate
//
@@ -744,5 +756,6 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator10;
private System.Windows.Forms.ToolStripButton tc;
private System.Windows.Forms.ToolStripButton toolStripButton_Delete;
+ private System.Windows.Forms.Button button_produceTemp;
}
}
\ No newline at end of file
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 254645b..578ef1d 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"
@@ -1163,9 +1163,196 @@
}
}
+
#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);
+ }
+ #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;
+ 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();
+ }
+ }
+ }
+ #endregion
+ #endregion
+
+
}
}
--
Gitblit v1.9.1