| New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.Text; |
| | | using System.Windows.Forms; |
| | | using gregn6Lib; |
| | | using SQLHelper; |
| | | using DBUtility; |
| | | using System.Threading; |
| | | using System.IO; |
| | | using Pub_Class; |
| | | |
| | | namespace WarM |
| | | { |
| | | public partial class Kf_WeighToBarCode_StationOutBill : Form |
| | | { |
| | | public Kf_WeighToBarCode_StationOutBill() |
| | | { |
| | | InitializeComponent(); |
| | | } |
| | | public frmBillQueryCondition_New frmCondition; |
| | | public string ModCaption = "涤纶åæåçææ¡ç "; |
| | | public const string ModName = "85"; |
| | | public Int64 HInterID = 0; |
| | | public string HBillNo = ""; |
| | | public string HBillType = "1202"; |
| | | public Int64 HUnitID = 0; |
| | | public Int64 HSourceInterID = 0; |
| | | public Int64 HSourceEntryID = 0; |
| | | public string HSourceBillNo = ""; |
| | | public string HSourceBillType = ""; |
| | | public Int64 HProcessExchangeInterID = 0; |
| | | public Int64 HProcessExchangeEntryID = 0; |
| | | public Int64 HSupID = 0; |
| | | public double HSourceQty = 0; |
| | | public string HCusMaterName = ""; //客æ·ç©æåç§° |
| | | public string HCusModel = ""; //客æ·è§æ ¼åå· |
| | | public string HMaker = DBUtility.ClsPub.CurUserName; |
| | | public Int64 HStockOrgID = DBUtility.ClsPub.HOrgID; |
| | | public DateTime HDate = DateTime.Today; |
| | | public long PrintQty = 0; //å
许æ¡ç æå°æ¬¡æ° |
| | | public string PrintQtyCtl = ""; //æ¡ç æå°æ¬¡æ°æ§å¶ |
| | | public string UpdatePrintQtyCtl = ""; //æ¡ç æå°æ¬¡æ°æ´æ° |
| | | public string sBarCodeItemID = ""; //æ¡ç èªå¢å |
| | | public DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl(); |
| | | public DBUtility.ClsPub.Enum_BillStatus BillStatus; |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | |
| | | #region //åºå®ä»£ç |
| | | |
| | | //æ¸
空çé¢ |
| | | public void Sub_ClearBill() |
| | | { |
| | | cmbHBarCodeType.Items.Clear(); |
| | | cmbHBarCodeType.Items.Add("å¯ä¸æ¡ç "); |
| | | DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp); |
| | | txtHBarCode.Text = ""; |
| | | grdMain.DataSource = null; |
| | | grdSub.DataSource = null; |
| | | chkHDYFlag.Checked = true; |
| | | } |
| | | |
| | | //çªä½å è½½ |
| | | private void Kf_WeighToBarCode_StationOutBill_Load(object sender, EventArgs e) |
| | | { |
| | | frmCondition = new frmBillQueryCondition_New(); |
| | | this.Text = ModCaption; |
| | | Sub_GetSystemParameter(); |
| | | } |
| | | |
| | | private void initGrid() |
| | | { |
| | | DBUtility.Xt_BaseBillFun.initGridList(grdMain, this.Name); |
| | | DBUtility.Xt_BaseBillFun.initGridList(grdSub, this.Name + "grdSub"); |
| | | } |
| | | |
| | | //è·åç³»ç»åæ°ä¿¡æ¯ |
| | | private void Sub_GetSystemParameter() |
| | | { |
| | | //è·åç³»ç»åæ° |
| | | ClsXt_SystemParameter oSystemParameter = new ClsXt_SystemParameter(); |
| | | if (oSystemParameter.ShowBill(ref DBUtility.ClsPub.sExeReturnInfo) == false) |
| | | { |
| | | MessageBox.Show("è·åç³»ç»åæ°å¤±è´¥ï¼åå :" + DBUtility.ClsPub.sExeReturnInfo, "æç¤º"); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | PrintQty = oSystemParameter.omodel.BarCode_PrintQty; |
| | | PrintQtyCtl = oSystemParameter.omodel.BarCode_PrintQtyCtl; |
| | | UpdatePrintQtyCtl = oSystemParameter.omodel.BarCode_UpdatePrintQtyCtl; |
| | | } |
| | | } |
| | | |
| | | private void timer1_Tick(object sender, EventArgs e) |
| | | { |
| | | timer1.Enabled = false; |
| | | initGrid(); |
| | | this.Sub_ClearBill();//æ¸
空çé¢ |
| | | |
| | | //è·åæ¡ç ID |
| | | DataSet Ds = oCn.RunProcReturn("exec h_p_KF_GetBCPWeighSource_TempList '" + HMaker + "'," + HStockOrgID.ToString(), "h_p_KF_GetBCPWeighSource_TempList"); |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | HInterID = DBUtility.ClsPub.CreateBillID_Prod(HBillType, ref DBUtility.ClsPub.sExeReturnInfo); //å¾å°æ°åæ®ID |
| | | } |
| | | else if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | HInterID = DBUtility.ClsPub.CreateBillID_Prod(HBillType, ref DBUtility.ClsPub.sExeReturnInfo); //å¾å°æ°åæ®ID |
| | | } |
| | | else |
| | | { |
| | | HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); |
| | | } |
| | | Source_Display(); |
| | | BarCode_Display(); |
| | | if (grdSub.Rows.Count > 0) |
| | | { |
| | | grdSub.Rows[0].Selected = true; |
| | | SourceBill(); |
| | | txtHQty.Focus(); |
| | | } |
| | | else |
| | | { |
| | | txtHBarCode.Focus(); |
| | | } |
| | | } |
| | | |
| | | private void grdMain_Paint(object sender, PaintEventArgs e) |
| | | { |
| | | GraphicsGrid(); |
| | | } |
| | | |
| | | private void GraphicsGrid() |
| | | { |
| | | DBUtility.Xt_BaseBillFun.GraphicsGrid(grdMain); |
| | | } |
| | | |
| | | private void grdSub_Paint(object sender, PaintEventArgs e) |
| | | { |
| | | GraphicsGridSub(); |
| | | } |
| | | |
| | | private void GraphicsGridSub() |
| | | { |
| | | DBUtility.Xt_BaseBillFun.GraphicsGrid(grdSub); |
| | | } |
| | | |
| | | private Int32 Fun_GetCol(string sCol) |
| | | { |
| | | return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdMain); |
| | | } |
| | | |
| | | private Int32 Fun_GetSubCol(string sCol) |
| | | { |
| | | return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdSub); |
| | | } |
| | | |
| | | //ä¿åå宽 |
| | | private void bclk_Click(object sender, EventArgs e) |
| | | { |
| | | DBUtility.Xt_BaseBillFun.SaveGrid(grdMain, this.Name); |
| | | DBUtility.Xt_BaseBillFun.SaveGrid(grdSub, this.Name + "grdSub"); |
| | | } |
| | | |
| | | //é»è®¤å宽 |
| | | private void mrlk_Click(object sender, EventArgs e) |
| | | { |
| | | DBUtility.Xt_BaseBillFun.DefaultGridView(grdMain, this.Name); |
| | | DBUtility.Xt_BaseBillFun.DefaultGridView(grdSub, this.Name + "grdSub"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region //å·æ° |
| | | |
| | | private void sx_Click_1(object sender, EventArgs e) |
| | | { |
| | | timer1.Enabled = true; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region //æå° |
| | | |
| | | GridppReport Report; |
| | | |
| | | private void dy_Click_1(object sender, EventArgs e) |
| | | { |
| | | //æå°å夿æ¡ç æ¯å¦è¶
è¿å
è®¸å¯æå°æ¬¡æ° |
| | | if (ReportPrintBegin()) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | //éæ©æå°æ¨¡æ¿ |
| | | BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp(); |
| | | oFrm.sBillName = ModName; |
| | | oFrm.sBillModel = ModCaption; |
| | | oFrm.ShowDialog(); |
| | | if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK) |
| | | { |
| | | Sub_SetReport(oFrm.sOpenTmp); |
| | | Report.Print(false); |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | |
| | | //æå°å夿æ¡ç æ¯å¦è¶
è¿å
è®¸å¯æå°æ¬¡æ° |
| | | private bool ReportPrintBegin() |
| | | { |
| | | DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl(); |
| | | string sHRemark = ""; |
| | | sBarCodeItemID = ""; |
| | | for (int i = 0; i < grdMain.SelectedRows.Count; i++) |
| | | { |
| | | sBarCodeItemID = sBarCodeItemID + "," + DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[Fun_GetCol("HItemID")].Value).ToString(); |
| | | } |
| | | sBarCodeItemID = sBarCodeItemID.Remove(0, 1); |
| | | |
| | | if (PrintQtyCtl == "Y") |
| | | { |
| | | if (oBar.Set_CheckPrintQty(sBarCodeItemID, PrintQty, ref sHRemark)) |
| | | { |
| | | MessageBox.Show(sHRemark); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | private void Sub_SetReport(string sOpenTmp) |
| | | { |
| | | //å¤æè¡æ° |
| | | for (int i = 0; i < grdMain.Rows.Count; i++) |
| | | { |
| | | grdMain.Rows[i].Cells[0].Value = ""; |
| | | } |
| | | for (int i = 0; i < grdMain.SelectedRows.Count; i++) |
| | | { |
| | | grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[0].Value = "*"; |
| | | } |
| | | // |
| | | Report = new GridppReport(); |
| | | Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + sOpenTmp + ".grf"); //here . |
| | | Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord); |
| | | Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable); |
| | | Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd); |
| | | } |
| | | |
| | | //å¡«å
¥åæ®è¡¨å¤´ä¿¡æ¯ |
| | | private void ReportBeforePostRecord()//your report?kao |
| | | { |
| | | try |
| | | { |
| | | //Report.FieldByName("ç©æä»£ç ").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("ç©æä»£ç ")].Value.ToString(); |
| | | //Report.FieldByName("ç©æåç§°").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("ç©æåç§°")].Value.ToString(); |
| | | //Report.FieldByName("è§æ ¼åå·").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("è§æ ¼åå·")].Value.ToString(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | MessageBox.Show("æå°å¤±è´¥!表头ï¼" + e.Message); |
| | | } |
| | | } |
| | | |
| | | //å¡«å
¥åæ®è¡¨ä½ä¿¡æ¯ |
| | | private void ReportFetchRecordByDataTable() |
| | | { |
| | | try |
| | | { |
| | | DataTable ds = new DataTable(); |
| | | BLL.Utility.FillRecordToReport_Sel(Report, grdMain, ds, Fun_GetCol("éæ©")); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | MessageBox.Show("æå°å¤±è´¥!表ä½ï¼" + e.Message); |
| | | } |
| | | } |
| | | |
| | | //æå°ç»æååå¡«æ¡ç æå°æ¬¡æ° |
| | | private void ReportPrintEnd() |
| | | { |
| | | DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl(); |
| | | if (UpdatePrintQtyCtl == "Y") |
| | | { |
| | | oBar.Set_UpdatePrintQty(sBarCodeItemID); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region //çå |
| | | |
| | | private void hb_Click(object sender, EventArgs e) |
| | | { |
| | | this.Sub_SaveBill(); |
| | | timer1.Enabled = true; |
| | | } |
| | | |
| | | private bool Sub_SaveBill() |
| | | { |
| | | //æ¡ç è®°å½å表æ¯å¦æè®°å½å¤æ |
| | | bool b = false; |
| | | for (int i = 0; i < grdMain.RowCount; i++) |
| | | { |
| | | b = true; |
| | | break; |
| | | } |
| | | if (b == false) |
| | | { |
| | | MessageBox.Show("å½åæ¡ç è®°å½åè¡¨æ æ°æ®ï¼ä¸å
许çæåæ®ï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | |
| | | //夿ä¼è®¡ææ¯å¦åç |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | MessageBox.Show(s, "æç¤º"); |
| | | return false; |
| | | } |
| | | |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | DataSet Ds = oCn.RunProcReturn("exec h_p_KF_GetBCPWeighSource_StationOutBill " + HInterID.ToString(), "h_p_KF_GetBCPWeighSource_StationOutBill"); |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | oCn.RollBack(); |
| | | MessageBox.Show("çæå·¥åºåºç«æ±æ¥å失败ï¼å½åæ¡ç è®°å½åè¡¨æ æ°æ®ï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | for (int y = 0; y < Ds.Tables[0].Rows.Count; y++) |
| | | { |
| | | Int64 sInterID = 0; |
| | | string sBillNo = ""; |
| | | string sBillType = "3791"; |
| | | sInterID = DBUtility.ClsPub.CreateBillID(sBillType, ref DBUtility.ClsPub.sExeReturnInfo); //å¾å°æ°åæ®ID |
| | | sBillNo = DBUtility.ClsPub.CreateBillCode(sBillType, ref DBUtility.ClsPub.sExeReturnInfo, true); //å¾å°æ°åæ®å· |
| | | |
| | | Int64 sHBarCodeInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[y]["HInterID"]); |
| | | Int64 sHMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[y]["HMaterID"]); |
| | | Int64 sHUnitID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[y]["HUnitID"]); |
| | | string sHBatchNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[y]["HBatchNo"]); |
| | | Int64 sHSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[y]["HSupID"]); |
| | | Int64 sHGroupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[y]["HGroupID"]); |
| | | Int64 sHDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[y]["HDeptID"]); |
| | | Int64 sHProcID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[y]["HProcID"]); |
| | | Int64 sHCenterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[y]["HCenterID"]); |
| | | Int64 sHSourceID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[y]["HSourceID"]); |
| | | Int64 sHProcNo = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[y]["HLayerNumber"]); |
| | | Double sHQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[y]["HQty"]); |
| | | Double sHICMOQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[y]["HReadyQty"]); |
| | | Int64 sHICMOInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[y]["HSourceInterID"]); |
| | | Int64 sHICMOEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[y]["HSourceEntryID"]); |
| | | string sHICMOBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[y]["HSourceBillNo"]); |
| | | Int64 sHProcExchInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[y]["HOrderInterID"]); |
| | | Int64 sHProcExchEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[y]["HOrderEntryID"]); |
| | | string sHProcExchBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[y]["HOrderBillNo"]); |
| | | |
| | | //çæå·¥åºåºç«æ±æ¥å (æ¡ç IDåå
¥HMainInterIDåæ®µï¼ |
| | | oCn.RunProc("Insert Into Sc_StationOutBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate,HMouldNum" + |
| | | ",HYear,HPeriod,HRemark,HSourceName,HPieceQty,HWasterQty,HPlanPieceQty,HBadPNL" + |
| | | ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" + |
| | | ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HStationOutTime,HSourceID,HPayProcID" + |
| | | ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate,HSourceID2,HSourceID3,HSourceID4,HSourceID5" + |
| | | ",HSupID,HQty,HPrice,HMoney,HBadCount,HCenterID,HProcNo,HOrderProcNO,HSourceNameList" + |
| | | ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HLastSubProc" + |
| | | ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID" + |
| | | ",HPersonNums,HMachineNums,HEmpNum,HMainInterID,HPRDORGID" + |
| | | ") " + |
| | | " values('" + sBillType + "','" + sBillType + "'," + sInterID.ToString() + ",'" + sBillNo + "',0,getdate(),'" + DBUtility.ClsPub.CurUserName + "',getdate(),''" + |
| | | "," + sYear.ToString() + "," + sPeriod.ToString() + ",'涤纶åæåçææ¡ç 模åçåçæ','',0,0,0,0" + |
| | | "," + sHICMOInterID.ToString() + "," + sHICMOEntryID.ToString() + ",'" + sHICMOBillNo + "',0,0,''," + sHProcExchInterID.ToString() + "," + sHProcExchEntryID.ToString() + |
| | | ",'" + sHProcExchBillNo + "'," + sHMaterID.ToString() + "," + sHProcID.ToString() + "," + sHICMOQty.ToString() + "," + sHICMOQty.ToString() + ",getdate()," + sHSourceID.ToString() + ",0" + |
| | | "," + sHGroupID.ToString() + "," + sHDeptID.ToString() + ",0,'','','',getdate(),0,0,0,0" + |
| | | "," + sHSupID.ToString() + "," + sHQty.ToString() + ",0,0,0," + sHCenterID.ToString() + "," + sHProcNo.ToString() + ",'',''" + |
| | | ",0,'','',0" + |
| | | ",0,0,0,0,0,0,0,0,0" + |
| | | ",0,0,''," + sHBarCodeInterID.ToString() + "," + HStockOrgID.ToString() + |
| | | ") "); |
| | | } |
| | | |
| | | //åå¡«å·²çåç¶æ |
| | | oCn.RunProc("Update KF_BCPWeighSource_Temp set HRelationInterID=1 where HInterID= " + HInterID.ToString()); |
| | | MessageBox.Show("çæå·¥åºåºç«æ±æ¥åæåï¼", "æç¤º"); |
| | | oCn.Commit(); |
| | | return true; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCn.RollBack(); |
| | | MessageBox.Show("çæå·¥åºåºç«æ±æ¥å失败ï¼" + e.Message); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region //éåº |
| | | |
| | | private void tc_Click(object sender, EventArgs e) |
| | | { |
| | | this.Close(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region //æ«ææ¡ç |
| | | |
| | | private void txtHBarCode_KeyPress(object sender, KeyPressEventArgs e) |
| | | { |
| | | if (e.KeyChar == (char)Keys.Return) |
| | | { |
| | | if (!AddSource()) |
| | | { |
| | | txtHBarCode.Focus(); |
| | | txtHBarCode.SelectAll(); |
| | | return; |
| | | } |
| | | Source_Display(); |
| | | grdSub.Rows[0].Selected = true; |
| | | DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp); |
| | | SourceBill(); |
| | | txtHBarCode.Text = ""; |
| | | txtHQty.Focus(); |
| | | } |
| | | } |
| | | |
| | | private void cmdOK_Click(object sender, EventArgs e) |
| | | { |
| | | if (!AddSource()) |
| | | { |
| | | txtHBarCode.Focus(); |
| | | txtHBarCode.SelectAll(); |
| | | return; |
| | | } |
| | | Source_Display(); |
| | | grdSub.Rows[0].Selected = true; |
| | | DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp); |
| | | SourceBill(); |
| | | txtHBarCode.Text = ""; |
| | | txtHQty.Focus(); |
| | | } |
| | | |
| | | private bool AddSource() |
| | | { |
| | | //å°æ«æåæ®å·åå
¥ä¸´æ¶è¡¨ |
| | | DataSet ds = oCn.RunProcReturn("exec h_p_Kf_AddSource_BCPWeighToBarCode " + HInterID.ToString() + ",'" + HBillNo + "','" + txtHBarCode.Text.Trim() + "','" + HMaker + "'," + HStockOrgID.ToString(), "h_p_Kf_AddSource_BCPWeighToBarCode"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | MessageBox.Show("æ«ææ¡ç åå
¥ä¸´æ¶è¡¨åçé误ï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0][0]) == 1) |
| | | { |
| | | MessageBox.Show(DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]), "æç¤º"); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region //éå |
| | | |
| | | private void cmdSourceBillNo_Click(object sender, EventArgs e) |
| | | { |
| | | //åå§åå³è¾¹è¡¨å¤´ä¿¡æ¯ |
| | | cmbHBarCodeType.Items.Clear(); |
| | | cmbHBarCodeType.Items.Add("å¯ä¸æ¡ç "); |
| | | DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp); |
| | | |
| | | if (grdSub.CurrentRow == null) |
| | | { |
| | | MessageBox.Show("请å¨å·¦è¾¹åæ®å表ä¸éæ©ä¸è¡åæ®ï¼", "æç¤º"); |
| | | return; |
| | | } |
| | | else if (grdSub.SelectedRows.Count != 1) |
| | | { |
| | | MessageBox.Show("ä¸å
è®¸åæ¶éæ©å¤è¡åæ®ï¼è¯·éæ°éæ©åæ®ï¼"); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | SourceBill(); |
| | | txtHQty.Focus(); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region //ä¿å |
| | | |
| | | private void cmdSave_Click(object sender, EventArgs e) |
| | | { |
| | | if (!Sub_AllowSave()) |
| | | { |
| | | return; |
| | | } |
| | | SaveBarCode(); |
| | | BarCode_Display(); |
| | | grdMain.Rows[0].Selected = true; |
| | | |
| | | sBarCodeItemID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.SelectedRows[0].Index].Cells[Fun_GetCol("HItemID")].Value).ToString(); |
| | | //èªå¨æå° |
| | | if (chkHDYFlag.Checked == true) |
| | | { |
| | | //æå°æ¡ç |
| | | Sub_SetReport("ç©ææ¡ç "); |
| | | Report.Print(false); |
| | | Thread.Sleep(1000); |
| | | } |
| | | else |
| | | { |
| | | //éæ©æå°æ¨¡æ¿ |
| | | BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp(); |
| | | oFrm.sBillName = ModName; |
| | | oFrm.sBillModel = ModCaption; |
| | | oFrm.ShowDialog(); |
| | | if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK) |
| | | { |
| | | Sub_SetReport(oFrm.sOpenTmp); |
| | | Report.Print(false); |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | |
| | | txtHQty.Text = ""; |
| | | txtHQty.Focus(); |
| | | } |
| | | |
| | | //æ¡ç çæå夿 |
| | | private bool Sub_AllowSave() |
| | | { |
| | | //夿å½ååæ®IDæ¯å¦å·²ä¸ä¼ çæåæ® |
| | | DataSet Ds = oCn.RunProcReturn("select top 1 1 from KF_BCPWeighSource_Temp with(nolock) where HInterID=" + HInterID.ToString() + " and HRelationInterID=1 ", "KF_BCPWeighSource_Temp", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | } |
| | | else |
| | | { |
| | | MessageBox.Show("å½åæ¡ç è®°å½å·²è¢«ä¸ä¼ çæåæ®ï¼è¯·éåºåéæ°è¿å
¥è¯¥æ¨¡åè¿è¡æ¡ç çææä½ï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | |
| | | if (HInterID==0) |
| | | { |
| | | MessageBox.Show("è·åæ¡ç 对åºåæ®ID失败ï¼è¯·éæ°å·æ°çé¢ï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | else if (DBUtility.ClsPub.isLong(txtHMaterNumber.Tag) == 0) |
| | | { |
| | | MessageBox.Show("请å
æ«æå·¥åºæµè½¬å¡å·ï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | else if (DBUtility.ClsPub.isDoule(txtHQty.Text) == 0) |
| | | { |
| | | MessageBox.Show("请è¾å
¥æ£ç¡®ç±³æ°ï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | else if (DBUtility.ClsPub.isDoule(txtHProcID.Tag) == 0) |
| | | { |
| | | MessageBox.Show("请å
鿩工åºï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | //çææ¡ç |
| | | private void SaveBarCode() |
| | | { |
| | | int LSHlen = 6; //æµæ°´å·é¿åº¦ |
| | | Int64 LSH = 0; //æµæ°´å· |
| | | string LSH2 = ""; //æµæ°´å·è½¬æ¢æå符 |
| | | string HMaterID = ""; //ç©æå
ç |
| | | string HBatchNo = ""; //æ¹æ¬¡ |
| | | string sDate = ""; //æ¥æ |
| | | string sYear = ""; //å¹´ |
| | | string sPeriod = ""; //æ |
| | | string sDay = ""; //æ¥ |
| | | string sTMNumber = ""; //æ¡ç èªå®ä¹åç¼ |
| | | string TM = ""; //æ¡ç ç¼å· |
| | | DataSet Ds; |
| | | |
| | | HMaterID = DBUtility.ClsPub.isStrNull(txtHMaterNumber.Tag); |
| | | HBatchNo = DBUtility.ClsPub.isStrNull(txtHBatchNo.Text); |
| | | //æ¥æè·åæ¹å¼ |
| | | sDate = dtpHDate.Value.ToShortDateString(); |
| | | sYear = DBUtility.ClsPub.isDate(sDate).Year.ToString().Substring(2, 2); |
| | | sPeriod = "0" + DBUtility.ClsPub.isDate(sDate).Month.ToString(); |
| | | sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2); |
| | | sDay = "0" + DBUtility.ClsPub.isDate(sDate).Day.ToString(); |
| | | sDay = sDay.Substring(sDay.Length - 2, 2); |
| | | //================================== |
| | | if (cmbHBarCodeType.Text == "å¯ä¸æ¡ç ") |
| | | { |
| | | //æ¡ç åç¼ = ç»ç»ä»£ç + ç©æå
ç + å¹´ + æ + æ¥ |
| | | sTMNumber = DBUtility.ClsPub.HOrgNumber + HMaterID + sYear + sPeriod + sDay; |
| | | Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //è·åæå¤§æµæ°´å· |
| | | LSH = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]); |
| | | LSH = LSH + 1; |
| | | LSH2 = LSH.ToString(); |
| | | while (LSH2.Length < LSHlen) //å¦ææµæ°´å·å°äº6使°åé¢è¡¥0 |
| | | { |
| | | LSH2 = "0" + LSH2; |
| | | } |
| | | TM = sTMNumber + LSH2; |
| | | } |
| | | else if (cmbHBarCodeType.Text == "åç§æ¡ç ") |
| | | { |
| | | TM = DBUtility.ClsPub.HOrgNumber + HMaterID; |
| | | } |
| | | else if (cmbHBarCodeType.Text == "æ¹æ¬¡æ¡ç ") |
| | | { |
| | | TM = DBUtility.ClsPub.HOrgNumber + HMaterID + HBatchNo; |
| | | } |
| | | else |
| | | { |
| | | MessageBox.Show("éè¯¯çæ¡ç ç±»åï¼ä¸è½çææ¡ç ï¼"); |
| | | return; |
| | | } |
| | | |
| | | string HBarCode = ""; |
| | | string HBarCodeType = ""; |
| | | Int64 HMaterID2 = 0; |
| | | double HQty = 0; //ç±³æ° |
| | | Int64 HGroupID = 0; |
| | | Int64 HDeptID = 0; |
| | | string HProcessExchangeBillNo = ""; |
| | | string HMaterName = ""; |
| | | string HMaterModel = ""; |
| | | Int64 HProcID = 0; |
| | | Int64 HCenterID = 0; |
| | | Int64 HSourceID = 0; |
| | | Int64 HProcNo = 0; |
| | | |
| | | HBarCode = TM; |
| | | HBarCodeType = DBUtility.ClsPub.isStrNull(cmbHBarCodeType.Text); |
| | | HMaterID2 = DBUtility.ClsPub.isLong(txtHMaterNumber.Tag); |
| | | HQty = DBUtility.ClsPub.isDoule(txtHQty.Text); |
| | | HGroupID = DBUtility.ClsPub.isLong(txtHGroupID.Tag); |
| | | HDeptID = DBUtility.ClsPub.isLong(txtHDeptName.Tag); |
| | | HProcessExchangeBillNo = DBUtility.ClsPub.isStrNull(txtHBillNo.Text); |
| | | HMaterName = DBUtility.ClsPub.isStrNull(txtHMaterName.Text); |
| | | HMaterModel = DBUtility.ClsPub.isStrNull(txtHMaterModel.Text); |
| | | HProcID = DBUtility.ClsPub.isLong(txtHProcID.Tag); |
| | | HCenterID = DBUtility.ClsPub.isLong(txtHCenterID.Tag); |
| | | HSourceID = DBUtility.ClsPub.isLong(txtHSourceID.Tag); |
| | | HProcNo = DBUtility.ClsPub.isLong(txtHProcNo.Text); |
| | | |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | //åå
¥æ¡ç æ¡£æ¡ (客æ·ç©æåç§°HCusMaterNameåå
¥HMaterialModelåæ®µï¼å®¢æ·è§æ ¼åå·HCusModelåå
¥HCusModelåæ®µï¼æµæ°´å·åå
¥HLayerNumberåæ®µï¼æºåæ°éåå
¥HReadyQtyåæ®µï¼ |
| | | oCn.RunProc("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,HBarCodeDate,HMaterialJQty,HMaterialMQty " + |
| | | ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HGiveAwayFlag " + |
| | | ",HOrderInterID,HOrderEntryID,HOrderBillNo,HCustomQty1,HMaterialModel,HCusModel " + |
| | | ",HProcID,HCenterID,HSourceID,HLayerNumber,HReadyQty " + |
| | | ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HLogo " + |
| | | ") Values (" |
| | | + " '" + HBarCode + "','" + HBarCodeType + "'," + HMaterID2.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString() |
| | | + ",'" + HBatchNo + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'" + HMaker + "',getdate(),0," + HQty.ToString() |
| | | + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "',''" |
| | | + ", 1,1," + HDeptID.ToString() + ",0,0,''" |
| | | + ", 0,'',getdate(),'','" + sDate + "',0,0" |
| | | + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",''," + HInterID.ToString() + ",0" |
| | | + ", " + HProcessExchangeInterID.ToString() + "," + HProcessExchangeEntryID.ToString() + ",'" + HProcessExchangeBillNo + "',0,'" + HCusMaterName + "','" + HCusModel + "'" |
| | | + ", " + HProcID.ToString() + "," + HCenterID.ToString() + "," + HSourceID.ToString() + "," + HProcNo.ToString() + "," + HSourceQty.ToString() |
| | | + ",'" + HMaterName + "','" + HMaterModel + "','',0,'','','1')"); |
| | | |
| | | //åå¡«æå¤§æµæ°´å· |
| | | oCn.RunProc("exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "',1 "); |
| | | //åå¡«æºå临æ¶è¡¨HInterID |
| | | oCn.RunProc("update a set a.HInterID=" + HInterID.ToString() + ",a.HRelationInterID= 0 from KF_BCPWeighSource_Temp a where a.HInterID<>" + HInterID.ToString() + " and a.HMaker='" + HMaker + "' and a.HSourceBillNo='" + HProcessExchangeBillNo + "'"); |
| | | oCn.Commit(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCn.RollBack(); |
| | | MessageBox.Show("æ¡ç çæå¤±è´¥ï¼" + e.Message); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region //è¿åä¿¡æ¯ |
| | | |
| | | //è¿åæºååè¡¨ä¿¡æ¯ |
| | | private void SourceBill() |
| | | { |
| | | txtHBillNo.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("åæ®å·")].Value); |
| | | txtHDeptName.Tag = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HDeptID")].Value); |
| | | txtHDeptName.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("车é´")].Value); |
| | | txtHMaterNumber.Tag = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HMaterID")].Value); |
| | | txtHMaterNumber.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("ç©æä»£ç ")].Value); |
| | | txtHMaterName.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("ç©æåç§°")].Value); |
| | | txtHMaterModel.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("è§æ ¼åå·")].Value); |
| | | txtHBatchNo.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("æ¹å·")].Value); |
| | | txtHICMOBillNo.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("ç产订å")].Value); |
| | | HUnitID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HUnitID")].Value); |
| | | HSourceInterID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HSourceInterID")].Value); |
| | | HSourceEntryID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HSourceEntryID")].Value); |
| | | HSourceBillNo = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("ç产订å")].Value); |
| | | HSourceBillType = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HSourceBillType")].Value); |
| | | HSourceQty = DBUtility.ClsPub.isDoule(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("æ°é")].Value); |
| | | HProcessExchangeInterID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HProcessExchangeInterID")].Value); |
| | | HSupID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HSupID")].Value); |
| | | HCusMaterName = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HCusMaterName")].Value); |
| | | HCusModel = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HCusModel")].Value); |
| | | } |
| | | |
| | | //è¿åæºååè¡¨ä¿¡æ¯ |
| | | private void Source_Display() |
| | | { |
| | | DataSet DSet = oCn.RunProcReturn("exec h_p_KF_GetBCPWeighSource_TempList '" + HMaker + "'," + HStockOrgID.ToString(), "h_p_KF_GetBCPWeighSource_TempList"); |
| | | grdSub.DataSource = DSet.Tables[0].DefaultView; |
| | | //å»ç» |
| | | int FrCol = DBUtility.ClsPub.isInt(frmCondition.txtFrozenCol.Text); |
| | | string s = frmCondition.cmbHComplete.Text; |
| | | DBUtility.Xt_BaseBillFun.DisplayGrid(grdSub, this.Name + "grdSub", s, FrCol); |
| | | //ç»çº¿ |
| | | GraphLine(); |
| | | } |
| | | |
| | | //è¿åæ¡ç è®°å½åè¡¨ä¿¡æ¯ |
| | | private void BarCode_Display() |
| | | { |
| | | DataSet DSet = oCn.RunProcReturn("select * from h_v_IF_BarCodeBillList Where HinterID=" + HInterID.ToString() + " order by HItemID desc", "h_v_IF_BarCodeBillList", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | grdMain.DataSource = DSet.Tables[0].DefaultView; |
| | | //å»ç» |
| | | int FrCol = DBUtility.ClsPub.isInt(frmCondition.txtFrozenCol.Text); |
| | | string s = frmCondition.cmbHComplete.Text; |
| | | DBUtility.Xt_BaseBillFun.DisplayGrid(grdMain, this.Name, s, FrCol); |
| | | //ç»çº¿ |
| | | GraphLine(); |
| | | } |
| | | |
| | | private void GraphLine() |
| | | { |
| | | int MainIDCol = Fun_GetCol("hmainid"); |
| | | int SubIDCol = Fun_GetCol("hsubid"); |
| | | string s = frmCondition.cmbHComplete.Text; |
| | | long n = 0; |
| | | DBUtility.Xt_BaseBillFun.GraphLine(grdMain, MainIDCol, SubIDCol, s, ref n); |
| | | |
| | | int MainIDCol2 = Fun_GetSubCol("hmainid"); |
| | | int SubIDCol2 = Fun_GetSubCol("hsubid"); |
| | | string s2 = frmCondition.cmbHComplete.Text; |
| | | long n2 = 0; |
| | | DBUtility.Xt_BaseBillFun.GraphLine(grdSub, MainIDCol2, SubIDCol2, s2, ref n2); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region //ä½åº |
| | | private void cmdZF_Click(object sender, EventArgs e) |
| | | { |
| | | if (grdMain.CurrentRow == null) |
| | | { |
| | | MessageBox.Show("请å
éæ©éè¦ä½åºçæ¡ç ï¼", "æç¤º"); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | if (MessageBox.Show("ç¡®å®è¦ä½åºæéæ¡ç ï¼", "æç¤º", MessageBoxButtons.OKCancel) == DialogResult.Cancel) |
| | | { |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | string HRemark = ""; |
| | | string HItemID = ""; |
| | | string HBarCode = ""; |
| | | string HBarCode2 = ""; |
| | | for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++) |
| | | { |
| | | HItemID = HItemID + "," + DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString()); |
| | | HBarCode = HBarCode + ",'" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value) + "'"; |
| | | if (i != 0 && i % 100 == 0) |
| | | { |
| | | HBarCode2 = HBarCode2 + "#" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value); |
| | | } |
| | | else |
| | | { |
| | | HBarCode2 = HBarCode2 + "," + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value); |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("ä½åºæ è®°")].Value) != "") |
| | | { |
| | | HRemark = HRemark + "ã" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value); |
| | | } |
| | | } |
| | | if (HRemark != "") |
| | | { |
| | | MessageBox.Show("æéæ¡ç ç¼å·ï¼"+ HRemark.Remove(0, 1)+" å·²ä½åºï¼ä¸å
许éå¤ä½åºï¼", "æç¤º"); |
| | | return; |
| | | } |
| | | HItemID = HItemID.Remove(0, 1); //廿å符串第ä¸ä¸ªå符 |
| | | HBarCode = HBarCode.Remove(0, 1); |
| | | HBarCode2 = HBarCode2.Remove(0, 1); |
| | | |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | string[] NewBarCode; |
| | | NewBarCode = HBarCode2.Split(Convert.ToChar("#")); |
| | | |
| | | //ä½åºæ¡ç |
| | | oCn.RunProc("update Gy_BarCodeBill set HStopflag=1,HDeleteMan='" + DBUtility.ClsPub.CurUserName + "',HDeleteDate=getdate() where HItemID in (" + HItemID + ")", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //åå
¥ç³»ç»æ¥å¿ |
| | | for (int i = 0; i <= NewBarCode.Length - 1; i++) |
| | | { |
| | | oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + DBUtility.ClsPub.CurUserName + "','" + DBUtility.ClsPub.ComputerName + "','ä½åºæ¡ç ï¼" + NewBarCode[i] + "','涤纶åæåçææ¡ç 模å','" + DBUtility.ClsPub.IPAddress + "','ä½åº'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | oCn.Commit(); |
| | | } |
| | | catch (Exception e2) |
| | | { |
| | | oCn.RollBack(); |
| | | MessageBox.Show("ä½åºæ¡ç 失败ï¼" + e2.Message, "æç¤º"); |
| | | return; |
| | | } |
| | | //å·æ°æ¡ç è®°å½åè¡¨ä¿¡æ¯ |
| | | BarCode_Display(); |
| | | MessageBox.Show("æéæ¡ç ç¼å·ï¼" + HBarCode.Remove(0, 1) + " ä½åºæåï¼", "æç¤º"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region //åä½åº |
| | | private void cmdFZF_Click(object sender, EventArgs e) |
| | | { |
| | | if (grdMain.CurrentRow == null) |
| | | { |
| | | MessageBox.Show("请å
éæ©éè¦åä½åºçæ¡ç ï¼", "æç¤º"); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | if (MessageBox.Show("ç¡®å®è¦åä½åºæéæ¡ç ï¼", "æç¤º", MessageBoxButtons.OKCancel) == DialogResult.Cancel) |
| | | { |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | string HRemark = ""; |
| | | string HItemID = ""; |
| | | string HBarCode = ""; |
| | | string HBarCode2 = ""; |
| | | for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++) |
| | | { |
| | | HItemID = HItemID + "," + DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString()); |
| | | HBarCode = HBarCode + ",'" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value) + "'"; |
| | | if (i != 0 && i % 100 == 0) |
| | | { |
| | | HBarCode2 = HBarCode2 + "#" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value); |
| | | } |
| | | else |
| | | { |
| | | HBarCode2 = HBarCode2 + "," + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value); |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("ä½åºæ è®°")].Value) == "") |
| | | { |
| | | HRemark = HRemark + "ã" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value); |
| | | } |
| | | } |
| | | if (HRemark != "") |
| | | { |
| | | MessageBox.Show("æéæ¡ç ç¼å·ï¼" + HRemark.Remove(0, 1) + " æªä½åºï¼ä¸å
许åä½åºï¼", "æç¤º"); |
| | | return; |
| | | } |
| | | HItemID = HItemID.Remove(0, 1); //廿å符串第ä¸ä¸ªå符 |
| | | HBarCode = HBarCode.Remove(0, 1); |
| | | HBarCode2 = HBarCode2.Remove(0, 1); |
| | | |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | string[] NewBarCode; |
| | | NewBarCode = HBarCode2.Split(Convert.ToChar("#")); |
| | | |
| | | //åä½åºæ¡ç |
| | | oCn.RunProc("update Gy_BarCodeBill set HStopflag=0,HDeleteMan='',HDeleteDate=null where HItemID in (" + HItemID + ")", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | //åå
¥ç³»ç»æ¥å¿ |
| | | for (int i = 0; i <= NewBarCode.Length - 1; i++) |
| | | { |
| | | oCn.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + DBUtility.ClsPub.CurUserName + "','" + DBUtility.ClsPub.ComputerName + "','åä½åºæ¡ç ï¼" + NewBarCode[i] + "','涤纶åæåçææ¡ç 模å','" + DBUtility.ClsPub.IPAddress + "','åä½åº'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | oCn.Commit(); |
| | | } |
| | | catch (Exception e2) |
| | | { |
| | | oCn.RollBack(); |
| | | MessageBox.Show("åä½åºæ¡ç 失败ï¼" + e2.Message, "æç¤º"); |
| | | return; |
| | | } |
| | | //å·æ°æ¡ç è®°å½åè¡¨ä¿¡æ¯ |
| | | BarCode_Display(); |
| | | MessageBox.Show("æéæ¡ç ç¼å·ï¼" + HBarCode.Remove(0, 1) + " åä½åºæåï¼", "æç¤º"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region //å·¥åºéæ© |
| | | |
| | | private void cmdHProcID_Click(object sender, EventArgs e) |
| | | { |
| | | DAL.ClsGy_Process_View oProcess = new DAL.ClsGy_Process_View(); |
| | | if (oProcess.RefreshView()) |
| | | { |
| | | this.txtHProcID.Text = oProcess.oModel.HName; |
| | | this.txtHProcID.Tag = oProcess.oModel.HItemID.ToString(); |
| | | } |
| | | |
| | | if(oProcess.oModel.HItemID!=0 && HProcessExchangeInterID != 0) |
| | | { |
| | | //æ ¹æ®è½¬å¡ä¸»IDãå·¥åºå¸¦åºæµè½¬å¡ä¸ç¸åºæµæ°´å·ãçç»ãå·¥ä½ä¸å¿ãçäº§èµæº |
| | | DataSet Ds = oCn.RunProcReturn("exec h_p_KF_GetBCPWeighSource_ProcID " + HProcessExchangeInterID.ToString() + "," + oProcess.oModel.HItemID.ToString(), "h_p_KF_GetBCPWeighSource_ProcID"); |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | this.txtHProcID.Text = ""; |
| | | this.txtHProcID.Tag = 0; |
| | | MessageBox.Show("æéå·¥åºä¸å¨å½åå·¥åºæµè½¬å¡ä¸ï¼è¯·éæ°éæ©æ£ç¡®å·¥åºï¼"); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | HProcessExchangeEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceEntryID"]); |
| | | txtHProcNo.Text = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProcNo"]); |
| | | txtHCenterID.Tag = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCenterID"]); |
| | | txtHCenterID.Text = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCenterName"]); |
| | | txtHGroupID.Tag = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HGroupID"]); |
| | | txtHGroupID.Text = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HGroupName"]); |
| | | txtHSourceID.Tag = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceID"]); |
| | | txtHSourceID.Text = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceName"]); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void txtHProcID_TextChanged(object sender, EventArgs e) |
| | | { |
| | | BLL.ClsPub_BLL.Sub_ClearText(txtHProcID); |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |