| | |
| | | // |
| | | //Socketé讯 |
| | | Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); |
| | | long produceQty = 0; //æ¥æ¶é讯ï¼éè¦çæå 个æ¡ç |
| | | |
| | | GridppReport Report; |
| | | |
| | | |
| | | #region ä¸»è¦æ¹æ³ |
| | | #region éæ©æºå |
| | | //éæ©æºåæ§ä»¶ç¹å»æ¹æ³ |
| | | private void cmdSourceBillNo_Click_1(object sender, EventArgs e) |
| | | { |
| | | cmdSourceBillNo_Click(sender, e); |
| | | } |
| | | |
| | | //éåå |
| | | private void cmdSourceBillNo_Click(object sender, EventArgs e) |
| | | { |
| | | DAL.ClsGy_ORGANIZATIONS_View oClsGy_ORGANIZATIONS_View = new DAL.ClsGy_ORGANIZATIONS_View(); |
| | | if (oClsGy_ORGANIZATIONS_View.GetInfoByName(cmbHOrgID.Text)) |
| | | { |
| | | HOrgID = oClsGy_ORGANIZATIONS_View.omodel.HItemID; |
| | | } |
| | | if (HOrgID == -1) |
| | | { |
| | | MessageBox.Show("éæ©ç»ç»æé误ï¼"); |
| | | return; |
| | | } |
| | | |
| | | if (cmbSourceBillType.Text.Trim() == "ç产订å") |
| | | { |
| | | string sWhere = ""; |
| | | //ç³»ç»åæ°ï¼çææ¡ç æ°éå¯å¦è¶
æºåæ°éæ§å¶ï¼N为ä¸å¯è¶
æºåæ°éï¼ |
| | | if (SourceQtyCtl == "N") |
| | | { |
| | | sWhere = " and HOrgID =" + HOrgID.ToString() + " and 任塿°é>0 and ç产线='" + comboBox_SourceNameParams.Text + "' "; |
| | | } |
| | | else |
| | | { |
| | | sWhere = " and HOrgID =" + HOrgID.ToString(); |
| | | } |
| | | |
| | | DAL.Cls_S_IFCLD_ICMOList oIFCLD_ICMOList = new DAL.Cls_S_IFCLD_ICMOList(); |
| | | if (oIFCLD_ICMOList.Refresh(sWhere)) //éæ©åå |
| | | { |
| | | FillSelectData(oIFCLD_ICMOList.oBillSelectColl); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | |
| | | } |
| | | |
| | | //éæ©æºååï¼å 载该æºåè®°å½ç©æå¨å½åæ¥æçæ¡ç å表 |
| | | Display4(); |
| | | } |
| | | |
| | | // |
| | | private void FillSelectData(List<DBUtility.BillSelect> oList) |
| | | { |
| | | if (oList.Count != 1) |
| | | { |
| | | MessageBox.Show("è¯·éæ©ä¸æ¡æ°æ®!"); |
| | | return; |
| | | } |
| | | |
| | | |
| | | DataSet Ds; |
| | | oSumGrid.Changelock = true; |
| | | initGrid(); |
| | | int i = -1; |
| | | foreach (DBUtility.BillSelect oSelectRow in oList) |
| | | { |
| | | i = i + 1; |
| | | //ç产订å |
| | | if (oSelectRow.BillType == "3710") |
| | | { |
| | | grdMain.Rows.Add(); |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | //å¾å°ä¿¡æ¯ |
| | | Ds = oCn.RunProcReturn("exec h_p_Gy_BarCodeBill_ICMOBillList " + oSelectRow.BillMainID.ToString() + "," + oSelectRow.BillSubID.ToString() + ",'" + SourceQtyCtl + "'", "h_p_Gy_BarCodeBill_ICMOBillList"); |
| | | //Ds = oCn.RunProcReturn("select * from h_v_IFCLD_ICMOList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IFCLD_ICMOList"); |
| | | //åå
¥ä¿¡æ¯ |
| | | Sub_WriteInForm(Ds.Tables[0], i); |
| | | } |
| | | } |
| | | // |
| | | oSumGrid.Changelock = false; |
| | | DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid); |
| | | |
| | | if (grdMain.Rows.Count > 0) |
| | | { |
| | | //æ ¹æ®æºå设置表头 |
| | | textBox_HMaterNumber.Text = grdMain.Rows[0].Cells[HMaterNumberCol].Value.ToString(); |
| | | textBox_HMaterName.Text = grdMain.Rows[0].Cells[HMaterNameCol].Value.ToString(); |
| | | textBox_HMaterModel.Text = grdMain.Rows[0].Cells[HMaterModelCol].Value.ToString(); |
| | | long HMaterID = ClsPub.isLong(grdMain.Rows[i].Cells[HMaterIDCol].Value.ToString()); |
| | | Ds = oCn.RunProcReturn("select * from Gy_Material where HItemID = " + HMaterID + " and HUSEORGID =" + HOrgID, "Gy_Material"); |
| | | if (Ds != null && Ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | string HBatchManager = Ds.Tables[0].Rows[0]["HBatchManager"].ToString(); |
| | | if (HBatchManager == "False") |
| | | { |
| | | radioButton_HIsUsingBatchNo.Checked = false; |
| | | } |
| | | else |
| | | { |
| | | radioButton_HIsUsingBatchNo.Checked = true; |
| | | } |
| | | } |
| | | //设置æ¹å· |
| | | if (radioButton_HIsUsingBatchNo.Checked) |
| | | { |
| | | grdMain.Rows[0].Cells[HBatchNoCol].Value = getBatchNo(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //æ ¹æ®TABLEåå
¥çé¢(ç产任å¡å) |
| | | private void Sub_WriteInForm(DataTable oTable, int i) |
| | | { |
| | | ////å 载表头 |
| | | //this.txtHDeptID.Tag = oTable.Rows[0]["HDeptID"].ToString(); |
| | | //this.txtHDeptID.Text = oTable.Rows[0]["é¨é¨åç§°"].ToString(); |
| | | ////å è½½è¡¨ä½ |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | grdMain.Rows[i].Cells[HQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["æªçææ¡ç æ°é"]); |
| | | grdMain.Rows[i].Cells[HinitQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["æªçææ¡ç æ°é"]); |
| | | // |
| | | grdMain.Rows[i].Cells[HMainIDCol].Value = oTable.Rows[0]["hmainid"].ToString(); |
| | | grdMain.Rows[i].Cells[HSubIDCol].Value = oTable.Rows[0]["hsubid"].ToString(); |
| | | grdMain.Rows[i].Cells[HBillNoCol].Value = oTable.Rows[0]["åæ®å·"].ToString(); |
| | | grdMain.Rows[i].Cells[HSourceBillNoCol].Value = oTable.Rows[0]["åæ®å·"].ToString(); |
| | | grdMain.Rows[i].Cells[HBillTypeCol].Value = oTable.Rows[0]["HBillType"].ToString(); |
| | | grdMain.Rows[i].Cells[HDateCol].Value = oTable.Rows[0]["æ¥æ"].ToString(); //忥 æ¶æåæ®æ¥æ |
| | | grdMain.Rows[i].Cells[HShowDateCol].Value = dtpHDate.Value.ToShortDateString(); |
| | | grdMain.Rows[i].Cells[HSupIDCol].Value = oTable.Rows[0]["hsupid"].ToString(); |
| | | grdMain.Rows[i].Cells[HSupNumberCol].Value = oTable.Rows[0]["ä¾åºå代ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HSupNameCol].Value = oTable.Rows[0]["ä¾åºå"].ToString(); |
| | | grdMain.Rows[i].Cells[HDeptIDCol].Value = oTable.Rows[0]["HDeptID"].ToString(); |
| | | grdMain.Rows[i].Cells[HDeptNumberCol].Value = oTable.Rows[0]["é¨é¨ä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HDeptNameCol].Value = oTable.Rows[0]["é¨é¨"].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterIDCol].Value = oTable.Rows[0]["HMaterID"].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterNumberCol].Value = oTable.Rows[0]["ç©æä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterNameCol].Value = oTable.Rows[0]["ç©æåç§°"].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterModelCol].Value = oTable.Rows[0]["è§æ ¼åå·"].ToString(); |
| | | //grdMain.Rows[i].Cells[HBatchManagerCol].Value = oTable.Rows[0]["æ¯å¦å¯ç¨æ¹æ¬¡"].ToString(); |
| | | grdMain.Rows[i].Cells[HBatchNoCol].Value = oTable.Rows[0]["æ¹æ¬¡"].ToString(); |
| | | grdMain.Rows[i].Cells[HUnitIDCol].Value = oTable.Rows[0]["HUnitID"].ToString(); |
| | | grdMain.Rows[i].Cells[HUnitNumberCol].Value = oTable.Rows[0]["计éåä½ä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HUnitNameCol].Value = oTable.Rows[0]["计éåä½"].ToString(); |
| | | grdMain.Rows[i].Cells[HRemarkCol].Value = oTable.Rows[0]["夿³¨"].ToString(); |
| | | grdMain.Rows[i].Cells[HMTONoCol].Value = oTable.Rows[0]["计åè·è¸ªå·"].ToString(); |
| | | grdMain.Rows[i].Cells[HCusIDCol].Value = oTable.Rows[0]["HCusID"].ToString(); |
| | | grdMain.Rows[i].Cells[HCusNumberCol].Value = oTable.Rows[0]["客æ·ä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HCusNameCol].Value = oTable.Rows[0]["客æ·"].ToString(); |
| | | grdMain.Rows[i].Cells[HCusTypeCol].Value = oTable.Rows[0]["客æ·åå·"].ToString(); |
| | | grdMain.Rows[i].Cells[HPinfanBarCodeCol].Value = oTable.Rows[0]["HPinfanBarCode"].ToString(); |
| | | grdMain.Rows[i].Cells[HPinfanCol].Value = oTable.Rows[0]["HPinfan"].ToString(); |
| | | //grdMain.Rows[i].Cells[HSourceIDCol].Value = oTable.Rows[0]["HSourceID"].ToString(); |
| | | //grdMain.Rows[i].Cells[HSourceNumberCol].Value = oTable.Rows[0]["ç产线代ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HSourceNameCol].Value = oTable.Rows[0]["ç产线"].ToString(); |
| | | grdMain.Rows[i].Cells[HEndDateCol].Value = oTable.Rows[0]["计åå®å·¥æ¥æ"].ToString();//忥 ç产订å å¤±ææ¥æ |
| | | |
| | | grdMain.Rows[i].Cells[HAuxPropIDCol].Value = oTable.Rows[0]["HAuxPropID"].ToString(); |
| | | |
| | | if (cmbHBarCodeType.Text == "仪å¨å¤è´ä»¶æ¡ç 容å¨è§å") |
| | | { |
| | | grdMain.Rows[i].Cells[HMinQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["æªçææ¡ç æ°é"]); |
| | | } |
| | | else if (cmbHBarCodeType.Text == "仪å¨å¤è´ä»¶æ¡ç æ®éè§å" |
| | | || cmbHBarCodeType.Text == "ä»ªå¨æåæ¡ç è§å" |
| | | || cmbHBarCodeType.Text == "è¯åæåæ¡ç è§å") |
| | | { |
| | | grdMain.Rows[i].Cells[HMinQtyCol].Value = "1"; |
| | | } |
| | | else |
| | | { |
| | | grdMain.Rows[i].Cells[HMinQtyCol].Value = oTable.Rows[0]["æå°å
è£
æ°"].ToString(); |
| | | } |
| | | grdMain.Rows[i].Cells[HProduceDateCol].Value = oTable.Rows[0]["HProduceDate"].ToString(); |
| | | grdMain.Rows[i].Cells[HExpiryDateCol].Value = oTable.Rows[0]["HExpiryDate"].ToString(); |
| | | grdMain.Rows[i].Cells[HISKFPERIODCol].Value = oTable.Rows[0]["HISKFPERIOD"].ToString(); |
| | | grdMain.Rows[i].Cells[HEXPUNITCol].Value = oTable.Rows[0]["HEXPUNIT"].ToString(); |
| | | grdMain.Rows[i].Cells[HEXPPERIODCol].Value = oTable.Rows[0]["HEXPPERIOD"].ToString(); |
| | | |
| | | |
| | | //èªå¨çæ-设置æ°éãæå°å
è£
æ°ãç®±æ°ä¸º1 |
| | | grdMain.Rows[i].Cells[HQtyCol].Value = 1; |
| | | grdMain.Rows[i].Cells[HMinQtyCol].Value = 1; |
| | | grdMain.Rows[i].Cells[HBQtyCol].Value = 1; |
| | | |
| | | |
| | | |
| | | |
| | | //-- |
| | | //设置å¯ç¼è¾å |
| | | string sAllowCol = HQtyCol.ToString() + |
| | | "," + HMinQtyCol.ToString() + |
| | | "," + HAuxPropNumberCol.ToString() + |
| | | "," + HBatchNoCol.ToString() + |
| | | "," + HPackQtyCol.ToString() + |
| | | "," + HRemarkCol.ToString(); |
| | | grdMain.Columns[HBillNoCol].ReadOnly = true; |
| | | //设置å计å |
| | | string sTotalCol = HQtyCol.ToString(); |
| | | // |
| | | DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol, oSumGrid); |
| | | tabControl1.SelectedIndex = 3; |
| | | bc.Enabled = true; |
| | | // |
| | | RowCount(i, 0); |
| | | } |
| | | #endregion |
| | | |
| | | #region çææé® |
| | | private void bc_Click(object sender, EventArgs e) |
| | | { |
| | | this.Sub_SaveBill(); |
| | | Display(); |
| | | |
| | | Display4(); |
| | | } |
| | | //ä¿ååæ® |
| | | private bool Sub_SaveBill() |
| | | { |
| | | //è·åå
ç |
| | | HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | ////è¥MAINDIéå¤åéæ°è·å |
| | | //if (BaseBill.IsExistMainID(ref DBUtility.ClsPub.sExeReturnInfo, HInterID, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew)) |
| | | //{ |
| | | // HInterID = DBUtility.ClsPub.CreateBillID(ModName, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //} |
| | | // |
| | | |
| | | |
| | | DAL.ClsGy_ORGANIZATIONS_View oClsGy_ORGANIZATIONS_View = new DAL.ClsGy_ORGANIZATIONS_View(); |
| | | HOrgNumber = ""; |
| | | if (oClsGy_ORGANIZATIONS_View.GetInfoByName(cmbHOrgID.Text)) |
| | | { |
| | | HOrgID = oClsGy_ORGANIZATIONS_View.omodel.HItemID; |
| | | HOrgNumber = DBUtility.ClsPub.isStrNull(oClsGy_ORGANIZATIONS_View.omodel.HNumber); |
| | | } |
| | | if (HOrgID == -1) |
| | | { |
| | | MessageBox.Show("éæ©ç»ç»æé误ï¼"); |
| | | return false; |
| | | } |
| | | |
| | | |
| | | lblCaption.Focus(); |
| | | if (!Sub_AllowSave())//忮宿´æ§å¤æ |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | SaveBarCode(); |
| | | return true; |
| | | } |
| | | |
| | | //忮宿´æ§å¤æ æªå®æ |
| | | private bool Sub_AllowSave() |
| | | { |
| | | //æç»è¡¨æ¯å¦ä¸ºé¶è¡ |
| | | bool b = false; |
| | | for (int i = 0; i < grdMain.RowCount; i++) |
| | | { |
| | | if (!IsNullRow(i)) |
| | | { |
| | | b = true; |
| | | break; |
| | | } |
| | | } |
| | | if (b == false) |
| | | { |
| | | MessageBox.Show("æç»è¡ä¸åå¨ï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | |
| | | string sHRemark = ""; |
| | | for (int j = 0; j < grdMain.Rows.Count; j++) |
| | | { |
| | | long HSno = DBUtility.ClsPub.isLong(grdMain.Rows[j].Cells[HSnoCol].Value); // åºå· |
| | | string HBarCodeType = cmbHBarCodeType.Text; // æ¡ç ç±»å |
| | | string HSourceBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBillNoCol].Value); // æºååå· |
| | | long HMaterID = DBUtility.ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value); // ç©æå
ç |
| | | string HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBatchNoCol].Value); // æ¹å· |
| | | long HAuxPropID = DBUtility.ClsPub.isLong(grdMain.Rows[j].Cells[HAuxPropIDCol].Value); // è¾
å©å±æ§ID |
| | | double HSourceQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[HinitQtyCol].Value); // æºåæ°é |
| | | double HQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[HQtyCol].Value); // æ°é |
| | | double HMinQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[HMinQtyCol].Value); // æå°å
è£
æ° |
| | | |
| | | if (HMaterID != 0) |
| | | { |
| | | DataSet oDsCheck = oCn.RunProcReturn("exec h_p_Gy_BarCodeBill_AddCheck " + HSno.ToString() + ",'" + HBarCodeType + "','" + HSourceBillNo + "'," + HMaterID.ToString() + ",'" + HBatchNo + "'," + HAuxPropID.ToString() + "," + HSourceQty.ToString() + "," + HQty.ToString() + "," + HMinQty.ToString() + "," + HOrgID.ToString() + ",'" + SourceQtyCtl + "'", "h_p_Gy_BarCodeBill_AddCheck"); |
| | | // |
| | | if (oDsCheck == null && oDsCheck.Tables[0].Rows.Count == 0) |
| | | { |
| | | MessageBox.Show("æ¡ç çæå®æ´æ§å¤æé误ï¼"); |
| | | return false; |
| | | } |
| | | else if (DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0][0]) == "1") |
| | | { |
| | | sHRemark = sHRemark + DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0]["HRemark"]); |
| | | } |
| | | else if (DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HExpiryDateCol].Value) == "") |
| | | { |
| | | if (DBUtility.ClsPub.isBool(oDsCheck.Tables[0].Rows[0]["HISKFPERIOD"])) |
| | | { |
| | | DateTime HProduceDate; //çäº§æ¥æ |
| | | string HEXPUNIT; //ä¿è´¨æåä½ |
| | | int HEXPPERIOD; //ä¿è´¨æ |
| | | |
| | | HProduceDate = dtpHDate.Value; |
| | | HEXPUNIT = DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0]["HEXPUNIT"]); |
| | | HEXPPERIOD = DBUtility.ClsPub.isInt(oDsCheck.Tables[0].Rows[0]["HEXPPERIOD"]); |
| | | |
| | | grdMain.Rows[j].Cells[HISKFPERIODCol].Value = 1; |
| | | grdMain.Rows[j].Cells[HEXPUNITCol].Value = HEXPUNIT; |
| | | grdMain.Rows[j].Cells[HEXPPERIODCol].Value = HEXPPERIOD.ToString(); |
| | | grdMain.Rows[j].Cells[HProduceDateCol].Value = HProduceDate.ToShortDateString(); |
| | | |
| | | if (HEXPUNIT == "Y") |
| | | { |
| | | grdMain.Rows[j].Cells[HExpiryDateCol].Value = HProduceDate.AddYears(HEXPPERIOD).ToShortDateString(); |
| | | } |
| | | else if (HEXPUNIT == "M") |
| | | { |
| | | grdMain.Rows[j].Cells[HExpiryDateCol].Value = HProduceDate.AddMonths(HEXPPERIOD).ToShortDateString(); |
| | | } |
| | | else |
| | | { |
| | | grdMain.Rows[j].Cells[HExpiryDateCol].Value = HProduceDate.AddDays(HEXPPERIOD).ToShortDateString(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | grdMain.Rows[j].Cells[HISKFPERIODCol].Value = 0; |
| | | grdMain.Rows[j].Cells[HEXPUNITCol].Value = ""; |
| | | grdMain.Rows[j].Cells[HEXPPERIODCol].Value = 0; |
| | | grdMain.Rows[j].Cells[HProduceDateCol].Value = ""; |
| | | grdMain.Rows[j].Cells[HExpiryDateCol].Value = ""; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (sHRemark != "") |
| | | { |
| | | MessageBox.Show(sHRemark); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | //çææ¡ç |
| | | private void SaveBarCode() |
| | | { |
| | | grdSub.Rows.Clear(); |
| | | int LSHlen = 6; //æµæ°´å·é¿åº¦ |
| | | int SumLen = 10; //æ»é¿åº¦ |
| | | string TM = ""; //æ¡ç |
| | | string HNumber = ""; //ç©æå
ç |
| | | string HMaterNumber = ""; //ç©æä»£ç |
| | | double HSumQty = 0; //äº§åæ°é |
| | | double HMinQty = 0; //æå°å
è£
æ° |
| | | Int64 HBQty = 0; //ç®±æ° |
| | | double HQty = 0; //æ°é |
| | | string WeiShu = ""; //å°¾æ° |
| | | Int64 LSH = 0; //æµæ°´å· |
| | | string LSH2 = ""; //æµæ°´å·è½¬æ¢æå符 |
| | | string sDate = ""; //æ¥æ |
| | | string sYear = ""; //å¹´ |
| | | string sPeriod = ""; //æ |
| | | string sDay = ""; //æ¥ |
| | | string HBatchNo = ""; //æ¹æ¬¡ |
| | | string HYasuoji = ""; //åç¼©æº |
| | | string HModelName = ""; //æºå |
| | | string HICMOBillNo = ""; //æºåå· |
| | | string HBarCodeBatchNo = ""; //æ¡ç æ¹æ¬¡å· |
| | | string HBarCodeDate = ""; //æ¡ç æ¥æ |
| | | int k = 0; |
| | | Int64 n = 0; //å䏿¹çææ¡ç ä¸çç¬¬å æ¡ |
| | | string sTMNumber = ""; //æ¡ç èªå®ä¹åç¼ |
| | | string sSourceBillNo = ""; //æºåå· |
| | | string sSourceEntryID = ""; //è¡å·ï¼æºååIDï¼ |
| | | DataSet Ds; |
| | | //Ds = oCn.RunProcReturn("exec GetLSH '" + ClsPub.GetServerDate(0) + "'", "GetLSH"); |
| | | //LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]); |
| | | for (int j = 0; j < grdMain.Rows.Count; j++) |
| | | { |
| | | if (ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value) != 0) |
| | | { |
| | | HNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterIDCol].Value); |
| | | HMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterNumberCol].Value); |
| | | HBatchNo = ClsPub.isStrNull(grdMain.Rows[j].Cells[HBatchNoCol].Value); |
| | | //æ¥æè·åæ¹å¼ |
| | | sDate = dtpHDate.Value.ToShortDateString(); |
| | | |
| | | HYasuoji = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HPinfanCol].Value); //å缩æºä»£ç ï¼å¤å®çµå¨ï¼ |
| | | HModelName = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusTypeCol].Value); //æºåï¼å¤å®çµå¨ï¼ |
| | | HICMOBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HSourceBillNoCol].Value); //ç产订åå·ï¼å¤å®çµå¨ï¼ |
| | | HBarCodeBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HPinfanBarCodeCol].Value); //æ¡ç æ¹æ¬¡å·ï¼å¤å®çµå¨ï¼ |
| | | HBarCodeDate = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HSupNumberCol].Value); //æ¡ç æ¥æï¼å¤å®çµå¨ï¼ |
| | | // |
| | | sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2); |
| | | sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString(); |
| | | sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2); |
| | | sDay = "0" + ClsPub.isDate(sDate).Day.ToString(); |
| | | sDay = sDay.Substring(sDay.Length - 2, 2); |
| | | //================================== |
| | | if (cmbHBarCodeType.Text == "å¯ä¸æ¡ç ") |
| | | { |
| | | |
| | | //æ¡ç åç¼ = ç»ç»ä»£ç + ç©æä»£ç + å¹´ + æ + æ¥ |
| | | sTMNumber = HOrgNumber + HNumber + sYear + sPeriod + sDay; |
| | | Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //è·åæå¤§æµæ°´å· |
| | | //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]); |
| | | } |
| | | else |
| | | { |
| | | MessageBox.Show("éè¯¯çæ¡ç ç±»åï¼ä¸è½çææ¡ç ï¼"); |
| | | return; |
| | | } |
| | | |
| | | Int64 HBQty2 = 0; //ç®±æ° |
| | | HBQty2 = ClsPub.isLong(grdMain.Rows[j].Cells[HBQtyCol].Value); |
| | | HBQty = HBQty + ClsPub.isLong(grdMain.Rows[j].Cells[HBQtyCol].Value); |
| | | HMinQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HMinQtyCol].Value); |
| | | HSumQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HQtyCol].Value); |
| | | n = 0; |
| | | int nn = 0; |
| | | for (int i = k; i < HBQty; i++) |
| | | { |
| | | if (HSumQty - HMinQty > 0) |
| | | { |
| | | WeiShu = ""; |
| | | HSumQty = HSumQty - HMinQty; |
| | | } |
| | | else |
| | | { |
| | | if (HSumQty == HMinQty) |
| | | { |
| | | WeiShu = ""; |
| | | } |
| | | else |
| | | { |
| | | WeiShu = "å°¾æ°"; |
| | | } |
| | | HMinQty = HSumQty; |
| | | } |
| | | // |
| | | LSH = LSH + 1; |
| | | LSH2 = LSH.ToString(); |
| | | while (LSH2.Length < LSHlen) //å¦ææµæ°´å·å°äº6使°åé¢è¡¥0 |
| | | { |
| | | LSH2 = "0" + LSH2; |
| | | } |
| | | if (cmbHBarCodeType.Text == "å¯ä¸æ¡ç ") |
| | | { |
| | | //æ¡ç ç¼å· = æ¡ç åç¼ + æµæ°´å· |
| | | TM = sTMNumber + LSH2; |
| | | } |
| | | |
| | | // |
| | | if (i + 1 > grdSub.Rows.Count) |
| | | { |
| | | grdSub.RowCount = grdSub.RowCount + 1; |
| | | } |
| | | grdSub.Rows[i].Cells[HSno2Col].Value = ClsPub.isStrNull(i + 1); |
| | | if (TM.Trim() == "") |
| | | { |
| | | MessageBox.Show("æ¡å½¢ç ä¸è½ä¸ºç©ºï¼ä¸è½çææ¡ç ï¼"); |
| | | return; |
| | | } |
| | | grdSub.Rows[i].Cells[HTMCol].Value = TM; |
| | | grdSub.Rows[i].Cells[HEntryID2Col].Value = j + 1; |
| | | grdSub.Rows[i].Cells[HMaterID2Col].Value = grdMain.Rows[j].Cells[HMaterIDCol].Value; |
| | | grdSub.Rows[i].Cells[HMaterNumber2Col].Value = grdMain.Rows[j].Cells[HMaterNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HMaterName2Col].Value = grdMain.Rows[j].Cells[HMaterNameCol].Value; |
| | | grdSub.Rows[i].Cells[HMaterModel2Col].Value = grdMain.Rows[j].Cells[HMaterModelCol].Value; |
| | | grdSub.Rows[i].Cells[HPinfan2Col].Value = grdMain.Rows[j].Cells[HPinfanCol].Value; |
| | | grdSub.Rows[i].Cells[HPinfanBarCode2Col].Value = grdMain.Rows[j].Cells[HPinfanBarCodeCol].Value; |
| | | |
| | | grdSub.Rows[i].Cells[HAuxPropID2Col].Value = grdMain.Rows[j].Cells[HAuxPropIDCol].Value; |
| | | grdSub.Rows[i].Cells[HAuxPropNumber2Col].Value = grdMain.Rows[j].Cells[HAuxPropNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HAuxPropName2Col].Value = grdMain.Rows[j].Cells[HAuxPropNameCol].Value; |
| | | |
| | | grdSub.Rows[i].Cells[HUnitID2Col].Value = grdMain.Rows[j].Cells[HUnitIDCol].Value; |
| | | grdSub.Rows[i].Cells[HUnitNumber2Col].Value = grdMain.Rows[j].Cells[HUnitNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HUnitName2Col].Value = grdMain.Rows[j].Cells[HUnitNameCol].Value; |
| | | |
| | | grdSub.Rows[i].Cells[HQty2Col].Value = HMinQty; |
| | | grdSub.Rows[i].Cells[HBatchNo2Col].Value = grdMain.Rows[j].Cells[HBatchNoCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceInterID2Col].Value = grdMain.Rows[j].Cells[HMainIDCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceEntryID2Col].Value = grdMain.Rows[j].Cells[HSubIDCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceBillNo2Col].Value = grdMain.Rows[j].Cells[HBillNoCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceBillType2Col].Value = grdMain.Rows[j].Cells[HBillTypeCol].Value; |
| | | grdSub.Rows[i].Cells[HPrintCol].Value = "0"; |
| | | grdSub.Rows[i].Cells[HWeiCol].Value = WeiShu; |
| | | grdSub.Rows[i].Cells[HBarcodeNoCol].Value = n + 1; |
| | | grdSub.Rows[i].Cells[HBarcodeQtysCol].Value = grdMain.Rows[j].Cells[HBQtyCol].Value; |
| | | grdSub.Rows[i].Cells[HSupID2Col].Value = grdMain.Rows[j].Cells[HSupIDCol].Value; |
| | | grdSub.Rows[i].Cells[HSupNumber2Col].Value = grdMain.Rows[j].Cells[HSupNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HSupName2Col].Value = grdMain.Rows[j].Cells[HSupNameCol].Value; |
| | | grdSub.Rows[i].Cells[HDeptID2Col].Value = grdMain.Rows[j].Cells[HDeptIDCol].Value; |
| | | grdSub.Rows[i].Cells[HDeptNumber2Col].Value = grdMain.Rows[j].Cells[HDeptNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HDeptName2Col].Value = grdMain.Rows[j].Cells[HDeptNameCol].Value; |
| | | grdSub.Rows[i].Cells[HRemark2Col].Value = grdMain.Rows[j].Cells[HRemarkCol].Value; |
| | | grdSub.Rows[i].Cells[HDate2Col].Value = grdMain.Rows[j].Cells[HDateCol].Value; |
| | | grdSub.Rows[i].Cells[HShowDate2Col].Value = grdMain.Rows[j].Cells[HShowDateCol].Value; |
| | | grdSub.Rows[i].Cells[HWhID2Col].Value = grdMain.Rows[j].Cells[HWhIDCol].Value; |
| | | grdSub.Rows[i].Cells[HWhNumber2Col].Value = grdMain.Rows[j].Cells[HWhNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HWhName2Col].Value = grdMain.Rows[j].Cells[HWhNameCol].Value; |
| | | grdSub.Rows[i].Cells[HSPID2Col].Value = grdMain.Rows[j].Cells[HSPIDCol].Value; |
| | | grdSub.Rows[i].Cells[HSPNumber2Col].Value = grdMain.Rows[j].Cells[HSPNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HSPName2Col].Value = grdMain.Rows[j].Cells[HSPNameCol].Value; |
| | | grdSub.Rows[i].Cells[HMTONo2Col].Value = grdMain.Rows[j].Cells[HMTONoCol].Value; |
| | | grdSub.Rows[i].Cells[HCusID2Col].Value = grdMain.Rows[j].Cells[HCusIDCol].Value; |
| | | grdSub.Rows[i].Cells[HCusNumber2Col].Value = grdMain.Rows[j].Cells[HCusNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HCusName2Col].Value = grdMain.Rows[j].Cells[HCusNameCol].Value; |
| | | grdSub.Rows[i].Cells[HCusType2Col].Value = grdMain.Rows[j].Cells[HCusTypeCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceID2Col].Value = grdMain.Rows[j].Cells[HSourceIDCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceNumber2Col].Value = grdMain.Rows[j].Cells[HSourceNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceName2Col].Value = grdMain.Rows[j].Cells[HSourceNameCol].Value; |
| | | grdSub.Rows[i].Cells[HEndDate2Col].Value = grdMain.Rows[j].Cells[HEndDateCol].Value; |
| | | grdSub.Rows[i].Cells[HSeOrderBillNo2Col].Value = grdMain.Rows[j].Cells[HSeOrderBillNoCol].Value; |
| | | grdSub.Rows[i].Cells[HSeOrderSEQ2Col].Value = grdMain.Rows[j].Cells[HSeOrderSEQCol].Value; |
| | | grdSub.Rows[i].Cells[HInnerBillNo2Col].Value = grdMain.Rows[j].Cells[HInnerBillNoCol].Value; |
| | | grdSub.Rows[i].Cells[HMaker2Col].Value = grdMain.Rows[j].Cells[HMakerCol].Value; |
| | | grdSub.Rows[i].Cells[HGiveAwayFlag2Col].Value = grdMain.Rows[j].Cells[HGiveAwayFlagCol].Value; |
| | | grdSub.Rows[i].Cells[HProduceDate2Col].Value = grdMain.Rows[j].Cells[HProduceDateCol].Value; |
| | | grdSub.Rows[i].Cells[HExpiryDate2Col].Value = grdMain.Rows[j].Cells[HExpiryDateCol].Value; |
| | | grdSub.Rows[i].Cells[HISKFPERIOD2Col].Value = grdMain.Rows[j].Cells[HISKFPERIODCol].Value; |
| | | grdSub.Rows[i].Cells[HEXPUNIT2Col].Value = grdMain.Rows[j].Cells[HEXPUNITCol].Value; |
| | | grdSub.Rows[i].Cells[HEXPPERIOD2Col].Value = grdMain.Rows[j].Cells[HEXPPERIODCol].Value; |
| | | //ç½æ ¼æå¾ |
| | | //æ¯å¦èµ å |
| | | DataGridViewCheckBoxCell oCell = new DataGridViewCheckBoxCell(); |
| | | oCell.ThreeState = false; |
| | | oCell.Value = grdSub.Rows[i].Cells[HGiveAwayFlag2Col].Value; |
| | | oCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; |
| | | grdSub.Rows[i].Cells[HGiveAwayFlag2Col] = oCell; |
| | | //æ¯å¦å¯ç¨ä¿è´¨æ |
| | | DataGridViewCheckBoxCell oCell2 = new DataGridViewCheckBoxCell(); |
| | | oCell2.ThreeState = false; |
| | | oCell2.Value = grdSub.Rows[i].Cells[HISKFPERIOD2Col].Value; |
| | | oCell2.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; |
| | | grdSub.Rows[i].Cells[HISKFPERIOD2Col] = oCell2; |
| | | k = k + 1; |
| | | n = n + 1; |
| | | //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | nn = nn + 1; |
| | | } |
| | | //åå°æ¹éæ§è¡è¯å¥ |
| | | oCn.RunProc("exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "'," + nn.ToString() + " "); |
| | | } |
| | | } |
| | | string HWei = ""; //å°¾æ° |
| | | string HBarCode = ""; |
| | | string HBarCodeType = ""; |
| | | Int64 HMaterID = 0; |
| | | Int64 HAuxPropID = 0; |
| | | Int64 HUnitID = 0; |
| | | double HQty2 = 0; |
| | | string HBatchNo2 = ""; |
| | | Int64 HSupID = 0; |
| | | Int64 HGroupID = 0; |
| | | int HPrintQty = 0; |
| | | Int64 HSourceInterID = 0; |
| | | Int64 HSourceEntryID = 0; |
| | | string HSourceBillNo = ""; |
| | | string HSourceBillType = ""; |
| | | Int64 HBarcodeNo = 0; //æå· |
| | | Int64 HBarcodeQtys = 0; //æ»ææ° |
| | | Int64 HDeptID = 0; |
| | | Int64 HWhID = 0; |
| | | Int64 HSPID = 0; |
| | | string HRemark = ""; |
| | | string HMaterName = ""; |
| | | string HMaterModel = ""; |
| | | string HPinfan = ""; |
| | | string HMTONo = ""; |
| | | Int64 HCusID = 0; |
| | | string HCusType = ""; |
| | | DateTime HEndDate; |
| | | string HWorkLineName = ""; |
| | | string HSeOrderBillNo = ""; |
| | | Int64 HSeOrderSEQ = 0; |
| | | string HInnerBillNo = ""; |
| | | bool HGiveAwayFlag = false; |
| | | Int64 HEntryID = 0; |
| | | string HProduceDate; |
| | | string HExpiryDate; |
| | | bool HISKFPERIOD = false; |
| | | string HEXPUNIT = ""; |
| | | double HEXPPERIOD = 0; |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | for (int i = 0; i < grdSub.Rows.Count; i++) |
| | | { |
| | | if (ClsPub.isLong(grdSub.Rows[i].Cells[HMaterID2Col].Value) != 0) |
| | | { |
| | | HWei = ClsPub.isStrNull(grdSub.Rows[i].Cells[HWeiCol].Value); |
| | | HBarCode = ClsPub.isStrNull(grdSub.Rows[i].Cells[HTMCol].Value); |
| | | // |
| | | HBarCodeType = ClsPub.isStrNull(cmbHBarCodeType.Text); |
| | | HMaterID = ClsPub.isLong(grdSub.Rows[i].Cells[HMaterID2Col].Value); |
| | | HEntryID = ClsPub.isLong(grdSub.Rows[i].Cells[HEntryID2Col].Value); |
| | | HAuxPropID = ClsPub.isLong(grdSub.Rows[i].Cells[HAuxPropID2Col].Value); |
| | | HUnitID = ClsPub.isLong(grdSub.Rows[i].Cells[HUnitID2Col].Value); |
| | | HQty2 = ClsPub.isDoule(grdSub.Rows[i].Cells[HQty2Col].Value); |
| | | HBatchNo2 = ClsPub.isStrNull(grdSub.Rows[i].Cells[HBatchNo2Col].Value); |
| | | HSourceInterID = ClsPub.isLong(grdSub.Rows[i].Cells[HSourceInterID2Col].Value); |
| | | HSourceEntryID = ClsPub.isLong(grdSub.Rows[i].Cells[HSourceEntryID2Col].Value); |
| | | HSourceBillNo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSourceBillNo2Col].Value); |
| | | HSourceBillType = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSourceBillType2Col].Value); |
| | | HBarcodeQtys = ClsPub.isLong(grdSub.Rows[i].Cells[HBarcodeQtysCol].Value); |
| | | HBarcodeNo = ClsPub.isLong(grdSub.Rows[i].Cells[HBarcodeNoCol].Value); |
| | | HSupID = ClsPub.isLong(grdSub.Rows[i].Cells[HSupID2Col].Value); |
| | | HDeptID = ClsPub.isLong(grdSub.Rows[i].Cells[HDeptID2Col].Value); |
| | | HWhID = ClsPub.isLong(grdSub.Rows[i].Cells[HWhID2Col].Value); |
| | | HSPID = ClsPub.isLong(grdSub.Rows[i].Cells[HSPID2Col].Value); |
| | | HRemark = ClsPub.isStrNull(grdSub.Rows[i].Cells[HRemark2Col].Value); |
| | | HMaterName = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMaterName2Col].Value); |
| | | HMaterModel = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMaterModel2Col].Value); |
| | | HPinfan = ClsPub.isStrNull(grdSub.Rows[i].Cells[HPinfan2Col].Value); |
| | | HMTONo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMTONo2Col].Value); |
| | | HCusID = ClsPub.isLong(grdSub.Rows[i].Cells[HCusID2Col].Value); |
| | | HCusType = ClsPub.isStrNull(grdSub.Rows[i].Cells[HCusType2Col].Value); |
| | | HEndDate = ClsPub.isDate(grdSub.Rows[i].Cells[HEndDate2Col].Value); |
| | | HWorkLineName = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSourceName2Col].Value); |
| | | HSeOrderBillNo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSeOrderBillNo2Col].Value); |
| | | HSeOrderSEQ = ClsPub.isLong(grdSub.Rows[i].Cells[HSeOrderSEQ2Col].Value); |
| | | HInnerBillNo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HInnerBillNo2Col].Value); |
| | | HGiveAwayFlag = ClsPub.isBool(grdSub.Rows[i].Cells[HGiveAwayFlag2Col].Value); |
| | | if (ClsPub.isDate(grdSub.Rows[i].Cells[HProduceDate2Col].Value) < Convert.ToDateTime("1950-01-01")) |
| | | { |
| | | HProduceDate = ""; |
| | | } |
| | | else |
| | | { |
| | | HProduceDate = ClsPub.isStrNull(grdSub.Rows[i].Cells[HProduceDate2Col].Value); |
| | | } |
| | | if (ClsPub.isDate(grdSub.Rows[i].Cells[HExpiryDate2Col].Value) < Convert.ToDateTime("1950-01-01")) |
| | | { |
| | | HExpiryDate = ""; |
| | | } |
| | | else |
| | | { |
| | | HExpiryDate = ClsPub.isStrNull(grdSub.Rows[i].Cells[HExpiryDate2Col].Value); |
| | | } |
| | | HISKFPERIOD = ClsPub.isBool(grdSub.Rows[i].Cells[HISKFPERIOD2Col].Value); |
| | | HEXPUNIT = ClsPub.isStrNull(grdSub.Rows[i].Cells[HEXPUNIT2Col].Value); |
| | | HEXPPERIOD = ClsPub.isDoule(grdSub.Rows[i].Cells[HEXPPERIOD2Col].Value); |
| | | |
| | | if (radioButton_HIsUsingBatchNo.Checked) |
| | | { |
| | | HBatchNo2 = getBatchNo(); |
| | | } |
| | | |
| | | 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()); |
| | | } |
| | | |
| | | 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 " + |
| | | ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " + |
| | | ",HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID " + |
| | | ",HProduceDate,HExpiryDate " + |
| | | ",HISKFPERIOD,HEXPUNIT,HEXPPERIOD " + |
| | | ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HSourceID " + |
| | | ") values (" |
| | | + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString() |
| | | + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'" + ClsPub.CurUserName + "',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString() |
| | | + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'" |
| | | + ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'" |
| | | + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + sDate + "'" |
| | | + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterID.ToString() + "," + HEntryID.ToString() |
| | | + ", " + DBUtility.ClsPub.BoolToString(HGiveAwayFlag) + "," + HSeOrderSEQ.ToString() + "," + HSourceEntryID.ToString() |
| | | + ", " + (HProduceDate == "" ? "NULL" : "'" + HProduceDate + "'") + "," + (HExpiryDate == "" ? "NULL" : "'" + HExpiryDate + "'") |
| | | + ", " + DBUtility.ClsPub.BoolToString(HISKFPERIOD) + ",'" + HEXPUNIT + "'," + HEXPPERIOD.ToString() |
| | | + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "'," + HSourceID + |
| | | ")"); |
| | | } |
| | | } |
| | | //å¢å æ¡ç è¶
è¿æªçæåè½æ§å¶ |
| | | |
| | | // |
| | | oCn.Commit(); |
| | | tabControl1.SelectedIndex = 3; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCn.RollBack(); |
| | | MessageBox.Show("æ¡ç çæå¤±è´¥ï¼" + e.Message); |
| | | grdSub.RowCount = 0; |
| | | } |
| | | } |
| | | |
| | | //çæå½å¤©ç©æçæ¹å· |
| | | private string getBatchNo() |
| | | { |
| | | string HBatchNo = ""; |
| | | |
| | | if (radioButton_HIsUsingBatchNo.Checked) |
| | | { |
| | | //æ¥æè·åæ¹å¼ |
| | | string sDate = dtpHDate.Value.ToShortDateString(); // |
| | | string sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2); |
| | | string sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString(); |
| | | sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2); |
| | | string sDay = "0" + ClsPub.isDate(sDate).Day.ToString(); |
| | | sDay = sDay.Substring(sDay.Length - 2, 2); |
| | | |
| | | string HDate = "20" + sYear + "-" + sPeriod + "-" + sDay; |
| | | |
| | | //è·åæµæ°´å·ï¼åä½ï¼è¯¥ç©æå½å¤©çæçæ¡ç æ° |
| | | string LIU = ""; |
| | | int LEN = 4; |
| | | DataSet ds; |
| | | string sql = "select * from h_v_IF_BarCodeBillList Where æºååå· ='" + grdMain.Rows[0].Cells[HSourceBillNoCol].Value + "' and HMaterID = " + grdMain.Rows[0].Cells[HMaterIDCol].Value + " and HSTOCKORGID = " + HOrgID + " and CONVERT(varchar(100),æ¡ç æ¥æ, 23) = '" + HDate + "' order by æ¹å· desc"; |
| | | ds = oCn.RunProcReturn(sql, "h_v_IF_BarCodeBillList"); |
| | | if (ds != null) |
| | | { |
| | | long count = 0; |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | count = ClsPub.isLong(ds.Tables[0].Rows[0]["æ¹å·"].ToString().Replace(sYear + sPeriod + sDay, "")); |
| | | } |
| | | LIU += count + 1; |
| | | while (LIU.Length < LEN) //å¦ææµæ°´å·å°äº6使°åé¢è¡¥0 |
| | | { |
| | | LIU = "0" + LIU; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return ""; |
| | | } |
| | | |
| | | //æ¼æ¥æ¹å· |
| | | HBatchNo = sYear + sPeriod + sDay + LIU; |
| | | } |
| | | |
| | | |
| | | return HBatchNo; |
| | | } |
| | | #endregion |
| | | |
| | | #region çå¬é讯 |
| | | //å¼å§çå¬æé® ç¹å»äºä»¶ |
| | | private void button_startListen_Click(object sender, EventArgs e) |
| | | { |
| | | try |
| | | { |
| | | if (grdMain.Rows.Count == 0 || grdMain.Rows[0].Cells[HMaterIDCol].Value == null || grdMain.Rows[0].Cells[HMaterIDCol].Value.ToString() == "" || grdMain.Rows[0].Cells[HMaterIDCol].Value.ToString() == "0") |
| | | { |
| | | MessageBox.Show("è¯·éæ©æºåï¼"); |
| | | return; |
| | | } |
| | | |
| | | if (textBox_IPParams.Text == "") |
| | | { |
| | | MessageBox.Show("请设置IPå°åï¼"); |
| | | return; |
| | | } |
| | | if (textBox_PortParams.Text == "") |
| | | { |
| | | MessageBox.Show("请设置端å£å·ï¼"); |
| | | return; |
| | | } |
| | | |
| | | if (comboBox_PrinterParams.Text == "") |
| | | { |
| | | MessageBox.Show("è¯·éæ©æå°æºï¼"); |
| | | return; |
| | | } |
| | | |
| | | if (textBox_PrintModelParams.Text == "") |
| | | { |
| | | MessageBox.Show("请设置æå°æ¨¡æ¿ï¼"); |
| | | return; |
| | | } |
| | | |
| | | if (!judgePrinterIsConnected()) |
| | | { |
| | | MessageBox.Show("æå°æºå¤äºç¦»çº¿ç¶æï¼è¯·æ£æ¥ï¼"); |
| | | return; |
| | | } |
| | | |
| | | socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); |
| | | IPAddress iPAddress = IPAddress.Parse(textBox_IPParams.Text); |
| | | IPEndPoint point = new IPEndPoint(iPAddress, Convert.ToInt32(textBox_PortParams.Text)); |
| | | socket.Connect(point); |
| | | |
| | | Thread thread = new Thread(ReceiveMess); |
| | | thread.Start(); |
| | | MessageBox.Show("è¿æ¥æåï¼"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show(ex.Message); |
| | | } |
| | | } |
| | | |
| | | //socketé讯ï¼å®¢æ·ç«¯æ¥æ¶ä¿¡æ¯ |
| | | private void ReceiveMess() |
| | | { |
| | | try |
| | | { |
| | | while (true) |
| | | { |
| | | byte[] buffer = new byte[1024 * 1024 * 5]; |
| | | int length = socket.Receive(buffer); |
| | | if (length == 0) |
| | | { |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | string RMess = Encoding.UTF8.GetString(buffer, 0, length); |
| | | produceQty = ClsPub.isLong(RMess); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show("æ¥å£å¼å¸¸ï¼å·²å
³éè¿æ¥ï¼" + ex.Message); |
| | | socket.Close(); |
| | | } |
| | | } |
| | | |
| | | //夿æå°æºæ¯å¦å¯ç¨ |
| | | private bool judgePrinterIsConnected() |
| | | { |
| | | //è·åçµèè¿æ¥çæå°æºå表 |
| | | ManagementObjectSearcher searcher = new |
| | | ManagementObjectSearcher("SELECT * FROM Win32_Printer"); |
| | | |
| | | //å¹é
设置çæå°æºï¼å¹¶å¤ææ¯å¦å¯ç¨ |
| | | string printerName = ""; |
| | | foreach (ManagementObject printer in searcher.Get()) |
| | | { |
| | | printerName = printer["Name"].ToString().ToLower(); |
| | | if (printerName.Equals(comboBox_PrinterParams.Text.Replace("(é»è®¤)", "").ToLower())) |
| | | { |
| | | string HPrinterName = printer.Properties["Name"].Value.ToString(); //è·åæå°æºåç§° |
| | | string HPrinterPort = printer.Properties["PortName"].Value.ToString(); //è·åæå°æºç«¯å£å· |
| | | string HPrinterDefault = printer.Properties["Default"].Value.ToString(); //è·åæå°æºæ¯å¦æ¯é»è®¤æå°æº |
| | | string HPrinterWorkStatus = printer.Properties["PrinterStatus"].Value.ToString(); //è·åæå°æºå·¥ä½ç¶æ(1:å
¶ä»ï¼2:æªç¥ï¼3:空é²ï¼4:æå°ï¼5:é¢çï¼6:忢æå°ï¼7:è±æº) |
| | | string HIsOffOnline = printer.Properties["WorkOffline"].Value.ToString(); //è·åæå°æºæ¯å¦ç¦»çº¿ |
| | | |
| | | |
| | | string isConnected = printer["WorkOffline"].ToString().ToLower(); |
| | | |
| | | if (isConnected.Equals("true")) |
| | | { |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | //æ ¹æ®é讯信æ¯çææ¡ç å¹¶æå° |
| | | private void timer2_Tick(object sender, EventArgs e) |
| | | { |
| | | for (int i = 0; i < produceQty; i++) |
| | | { |
| | | //çææ¡ç |
| | | this.Sub_SaveBill(); |
| | | |
| | | //è·åéè¦æå°çæ°æ® |
| | | Display(); |
| | | |
| | | //设置æå°æ¨¡æ¿ï¼æå° |
| | | grdList.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); |
| | | |
| | | if (i == produceQty - 1) |
| | | { |
| | | //éæ°å è½½è¯¥ç©æå½å¤©çæçæ¡ç |
| | | Display4(); |
| | | } |
| | | } |
| | | |
| | | produceQty = 0; |
| | | } |
| | | |
| | | //è·åéè¦æå°çæ°æ®å¹¶åæ¾å¨å表grdList |
| | | private void Display() |
| | | { |
| | | //设置档æ¡å表é项å¡è¡¨æ ¼æ°æ® |
| | | DataSet DSet = oCn.RunProcReturn("select * from h_v_IF_BarCodeBillList Where HinterID=" + HInterID.ToString() + " order by HItemID", "h_v_IF_BarCodeBillList", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //çæé¦è¡æ é¢ |
| | | if (DSet == null) |
| | | { |
| | | MessageBox.Show("没æè¿åä»»ä½ç»æ,æ¡ç ä¸åå¨ï¼" + DBUtility.ClsPub.sExeReturnInfo); |
| | | return; |
| | | } |
| | | // |
| | | grdList.DataSource = DSet.Tables[0].DefaultView; |
| | | //å»ç» |
| | | int FrCol = 0; |
| | | string s = "æ¯"; |
| | | DBUtility.Xt_BaseBillFun.DisplayGrid(grdList, this.Name + "grdList", s, FrCol); |
| | | //ç»çº¿ |
| | | //GraphLine(); |
| | | } |
| | | |
| | | //è·åå·¥åå½å¤©ç©æçæçæ¡ç è®°å½ |
| | | private void Display4() |
| | | { |
| | | if (grdMain.Rows.Count > 0) |
| | | { |
| | | //æ¥æè·åæ¹å¼ |
| | | string sDate = dtpHDate.Value.ToShortDateString(); // |
| | | string sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2); |
| | | string sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString(); |
| | | sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2); |
| | | string sDay = "0" + ClsPub.isDate(sDate).Day.ToString(); |
| | | sDay = sDay.Substring(sDay.Length - 2, 2); |
| | | |
| | | sDate = "20" + sYear + "-" + sPeriod + "-" + sDay; |
| | | |
| | | //è®¾ç½®å·¥åæ¡ç é项å¡è¡¨æ ¼æ°æ® |
| | | //string sql = "select * from h_v_IF_BarCodeBillList Where æºååå· = '" + grdMain.Rows[0].Cells[HBillNoCol].Value + "' and HMaterID = " + grdMain.Rows[0].Cells[HMaterIDCol].Value + " and HSTOCKORGID = " + HOrgID + " and CONVERT(varchar(100),æ¡ç æ¥æ, 23) = '" + sDate + "' order by æ¡ç ç¼å·"; |
| | | string sql = "select * from h_v_IF_BarCodeBillList Where æºååå· = '" + grdMain.Rows[0].Cells[HBillNoCol].Value + "' and HMaterID = " + grdMain.Rows[0].Cells[HMaterIDCol].Value + " and CONVERT(varchar(100),æ¡ç æ¥æ, 23) = '" + sDate + "' order by æ¡ç ç¼å·"; |
| | | DataSet DSet1 = oCn.RunProcReturn(sql, "h_v_IF_BarCodeBillList", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //çæé¦è¡æ é¢ |
| | | if (DSet1 == null) |
| | | { |
| | | return; |
| | | } |
| | | // |
| | | grdBillBarCodeList.DataSource = DSet1.Tables[0].DefaultView; |
| | | //å»ç» |
| | | int FrCol = 0; |
| | | string s = "æ¯"; |
| | | DBUtility.Xt_BaseBillFun.DisplayGrid(grdBillBarCodeList, this.Name + "grdBillBarCodeList", s, FrCol); |
| | | //ç»çº¿ |
| | | //GraphLine(); |
| | | // |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 忢çå¬ |
| | | //忢çå¬æé® ç¹å»äºä»¶ |
| | | private void button_stopListen_Click(object sender, EventArgs e) |
| | | { |
| | | try |
| | | { |
| | | if (socket.Connected) |
| | | { |
| | | socket.Close(); |
| | | } |
| | | else |
| | | { |
| | | MessageBox.Show("å½åå°æªè¿æ¥"); |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show(ex.Message); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region ä¿åé
ç½®ä¿¡æ¯æé® |
| | | //é
置信æ¯ä¿åæé® ç¹å»äºä»¶ |
| | | private void button_saveParams_Click(object sender, EventArgs e) |
| | | { |
| | | saveParams(); |
| | | } |
| | | |
| | | //åå
¥é
ç½®åæ° |
| | | private void saveParams() |
| | | { |
| | | //夿æä»¶æ¯å¦åå¨ |
| | | if (!File.Exists(Application.StartupPath + "//Gy_BarCodeBill_automaticallyByPLC.txt")) |
| | | { |
| | | FileStream fs1 = new FileStream(Application.StartupPath + "//Gy_BarCodeBill_automaticallyByPLC.txt", FileMode.Create, FileAccess.Write);//å建åå
¥æä»¶ |
| | | StreamWriter sw = new StreamWriter(fs1); |
| | | sw.WriteLine(textBox_IPParams.Text);//å¼å§åå
¥å¼ |
| | | sw.WriteLine(textBox_PortParams.Text); |
| | | |
| | | sw.WriteLine(comboBox_SourceNameParams.Text); |
| | | |
| | | sw.WriteLine(comboBox_PrinterParams.Text.Replace("(é»è®¤)", "")); |
| | | sw.WriteLine(textBox_PrintModelParams.Text); |
| | | sw.Close(); |
| | | fs1.Close(); |
| | | } |
| | | else |
| | | { |
| | | FileStream fs1 = new FileStream(Application.StartupPath + "//Gy_BarCodeBill_automaticallyByPLC.txt", FileMode.Create, FileAccess.Write);//å建åå
¥æä»¶ |
| | | StreamWriter sw = new StreamWriter(fs1); |
| | | sw.WriteLine(textBox_IPParams.Text);//å¼å§åå
¥å¼ |
| | | sw.WriteLine(textBox_PortParams.Text); |
| | | |
| | | sw.WriteLine(comboBox_SourceNameParams.Text); |
| | | |
| | | sw.WriteLine(comboBox_PrinterParams.Text); |
| | | sw.WriteLine(textBox_PrintModelParams.Text); |
| | | sw.Close(); |
| | | fs1.Close(); |
| | | } |
| | | |
| | | MessageBox.Show("ä¿åæåï¼"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region é
置信æ¯éç½® |
| | | //é
置信æ¯éç½®æé®ç¹å» äºä»¶ |
| | | private void button_resetParams_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region åºå®ä»£ç |
| | | |
| | | //æ¸
空çé¢ |
| | | public void Sub_ClearBill() |
| | | { |
| | | ////è¡¨ä½æ¸
空 |
| | | //grdMain.Rows.Clear(); |
| | | //grdSub.Rows.Clear(); |
| | | |
| | | //设置æ¡ç ç±»å 䏿å表 |
| | | cmbHBarCodeType.Items.Clear(); |
| | | cmbHBarCodeType.Items.Add("å¯ä¸æ¡ç "); |
| | | |
| | | //设置æºåç±»å 䏿å表 |
| | | cmbSourceBillType.Items.Clear(); |
| | | cmbSourceBillType.Items.Add("ç产订å"); |
| | | |
| | | //æ ¹æ®ç³»ç»åæ°è·å对åºçæ¡ç ç±»åï¼å¤å®çµå¨ã忥 以åä½¿ç¨æ¡ç è§åè¡¨ï¼ |
| | | ClsXt_SystemParameter oClsXt_SystemParameter = new ClsXt_SystemParameter(); |
| | | string sCapName = oClsXt_SystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (sCapName == "å¤å®çµå¨") |
| | | { |
| | | cmbHBarCodeType.Items.Add("å
éæºæ¡ç "); |
| | | cmbHBarCodeType.Items.Add("å¤éæºæ¡ç "); |
| | | cmbHBarCodeType.Items.Add("åæåæ¡ç "); |
| | | } |
| | | else if (sCapName == "åæ¥ç§æ") |
| | | { |
| | | cmbHBarCodeType.Items.Add("仪å¨å¤è´ä»¶æ¡ç æ®éè§å"); |
| | | cmbHBarCodeType.Items.Add("仪å¨å¤è´ä»¶æ¡ç 容å¨è§å"); |
| | | cmbHBarCodeType.Items.Add("ä»ªå¨æåæ¡ç è§å"); |
| | | cmbHBarCodeType.Items.Add("è¯åæåæ¡ç è§å"); |
| | | } |
| | | else if (sCapName == "䏿§") |
| | | { |
| | | cmbHBarCodeType.Items.Add("å¯ä¸æ¡ç "); |
| | | } |
| | | else |
| | | { |
| | | // |
| | | cmbHBarCodeType.Items.Add("å¯ä¸æ¡ç "); |
| | | cmbHBarCodeType.Items.Add("åç§æ¡ç "); |
| | | cmbHBarCodeType.Items.Add("æ¹æ¬¡æ¡ç "); |
| | | //cmbHBarCodeType.Items.Add("æçæ¡ç "); |
| | | } |
| | | |
| | | //æºåç±»å |
| | | if (sCapName == "䏿§") |
| | | { |
| | | cmbSourceBillType.Items.Add("çäº§æ±æ¥å"); |
| | | cmbSourceBillType.Items.Add("æ¶æéç¥å"); |
| | | } |
| | | else |
| | | { |
| | | cmbSourceBillType.Items.Add("ç产订å"); |
| | | cmbSourceBillType.Items.Add("çäº§æ±æ¥å"); |
| | | cmbSourceBillType.Items.Add("éè´è®¢å"); |
| | | cmbSourceBillType.Items.Add("æ¶æéç¥å"); |
| | | cmbSourceBillType.Items.Add("å§å¤è®¢å"); |
| | | cmbSourceBillType.Items.Add("å·¥åºæ±æ¥å"); |
| | | cmbSourceBillType.Items.Add("å·¥åºæµè½¬å¡"); |
| | | cmbSourceBillType.Items.Add("éè´§éç¥å"); |
| | | cmbSourceBillType.Items.Add("å
¶ä»å
¥åºå"); |
| | | cmbSourceBillType.Items.Add("ç´æ¥è°æ¨å"); |
| | | cmbSourceBillType.Items.Add("éè´éæå"); |
| | | cmbSourceBillType.Items.Add("ç产éæå"); |
| | | cmbSourceBillType.Items.Add("ç»è£
æå¸å"); |
| | | } |
| | | // |
| | | //åå§åæ§ä»¶ |
| | | DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp); |
| | | //ç»ç»ä¸æå表 |
| | | |
| | | //设置ç»ç» 䏿å表 å¹¶è®¾ç½®å¼ |
| | | DataSet Ds1 = oCn.RunProcReturn("select * from Xt_ORGANIZATIONS with(nolock) where HItemID=" + ClsPub.HOrgID, "Xt_ORGANIZATIONS", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (Ds1.Tables[0].Rows.Count != 0) |
| | | { |
| | | cmbHOrgID.Text = DBUtility.ClsPub.isStrNull(Ds1.Tables[0].Rows[0]["HName"]); |
| | | } |
| | | |
| | | //æå°æºä¸æå表 |
| | | //设置æå°æº 䏿å表 |
| | | PrintDocument fPrintDocument = new PrintDocument(); |
| | | string defaultPrinter = fPrintDocument.PrinterSettings.PrinterName; |
| | | comboBox_PrinterParams.Items.Clear(); |
| | |
| | | string tmp = PrinterSettings.InstalledPrinters[i]; |
| | | if (tmp == defaultPrinter) |
| | | { |
| | | tmp = tmp + "(é»è®¤)"; |
| | | //tmp = tmp + "(é»è®¤)"; |
| | | } |
| | | comboBox_PrinterParams.Items.Add(tmp); |
| | | } |
| | | |
| | | |
| | | //äº§çº¿ä¸æå表 |
| | | DataSet DsSource = oCn.RunProcReturn("select * from Gy_Source where HUSEORGID =" + ClsPub.HOrgID, "Gy_Source"); |
| | | //设置产线 䏿å表 |
| | | DataSet DsSource = oCn.RunProcReturn("select * from Gy_Source", "Gy_Source"); |
| | | comboBox_SourceNameParams.Items.Add(""); |
| | | if (DsSource != null) |
| | | { |
| | | comboBox_SourceNameParams.Items.Clear(); |
| | | comboBox_SourceNameParams.Items.Add(""); |
| | | for (int i = 0; i < DsSource.Tables[0].Rows.Count; i++) |
| | | { |
| | | comboBox_SourceNameParams.Items.Add(DsSource.Tables[0].Rows[i]["HName"]); |
| | |
| | | readParams(); |
| | | //设置工åä¿¡æ¯ |
| | | textBox_SourceName.Text = comboBox_SourceNameParams.Text; |
| | | |
| | | //设置å¶åä¿¡æ¯ |
| | | txtHMaker.Text = ClsPub.CurUserName; |
| | | txtHMakeDate.Text = ""; |
| | | txtHChecker.Text = ""; |
| | |
| | | txtHDeleteDate.Text = ""; |
| | | txtHUpDater.Text = ""; |
| | | txtHUpDateDate.Text = ""; |
| | | |
| | | //设置å表 |
| | | initGrid(); |
| | | grdList.DataSource = null; |
| | | grdBillBarCodeList.DataSource = null; |
| | | |
| | | tabControl1.SelectedIndex = 3; |
| | | } |
| | | |
| | | //读åé
ç½®æä»¶ |
| | | private void readParams() |
| | | { |
| | | if (File.Exists(Application.StartupPath + "//Gy_BarCodeBill_automaticallyByPLC.txt")) |
| | | { |
| | | //读åæä»¶å¼å¹¶æ¾ç¤ºå°çªä½ |
| | | FileStream fs = new FileStream(Application.StartupPath + "//Gy_BarCodeBill_automaticallyByPLC.txt", FileMode.Open, FileAccess.ReadWrite); |
| | | StreamReader sr = new StreamReader(fs); |
| | | string line = sr.ReadLine(); |
| | | int curLine = 0; |
| | | while (line != null) |
| | | { |
| | | if (++curLine == 1) |
| | | { |
| | | textBox_IPParams.Text = line; |
| | | } |
| | | else if (curLine == 2) |
| | | { |
| | | textBox_PortParams.Text = line; |
| | | } |
| | | else if (curLine == 3) |
| | | { |
| | | for (int i = 0; i < comboBox_SourceNameParams.Items.Count; i++) |
| | | { |
| | | if (comboBox_SourceNameParams.Items[i].ToString() == line) |
| | | { |
| | | comboBox_SourceNameParams.Text = line; |
| | | } |
| | | } |
| | | |
| | | if (comboBox_SourceNameParams.Text == "") |
| | | { |
| | | comboBox_SourceNameParams.Items.Add(line); |
| | | comboBox_SourceNameParams.Text = line; |
| | | } |
| | | } |
| | | else if (curLine == 4) |
| | | { |
| | | for (int i = 0; i < comboBox_PrinterParams.Items.Count; i++) |
| | | { |
| | | if (comboBox_PrinterParams.Items[i].ToString() == line) |
| | | { |
| | | comboBox_PrinterParams.Text = line; |
| | | } |
| | | } |
| | | } |
| | | else if (curLine == 5) |
| | | { |
| | | textBox_PrintModelParams.Text = line; |
| | | } |
| | | else |
| | | { |
| | | |
| | | } |
| | | line = sr.ReadLine(); |
| | | } |
| | | sr.Close(); |
| | | fs.Close(); |
| | | } |
| | | } |
| | | |
| | | //åå§åGRID |
| | | private void initGrid() |
| | | { |
| | | // |
| | | grdMain.RowCount = 0; |
| | | grdSub.RowCount = 0; |
| | | grdMain.ColumnCount = 68; //æ»åæ° |
| | | DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name); |
| | | grdMain.Columns[HSnoCol].HeaderText = "åºå·"; |
| | | grdMain.Columns[HMainIDCol].HeaderText = "æºå主ID"; |
| | | grdMain.Columns[HSubIDCol].HeaderText = "æºååID"; |
| | | grdMain.Columns[HBillNoCol].HeaderText = "æºååå·"; |
| | | grdMain.Columns[HBillTypeCol].HeaderText = "åæ®ç±»å"; |
| | | grdMain.Columns[HMaterIDCol].HeaderText = "ç©æID"; |
| | | grdMain.Columns[HMaterNumberCol].HeaderText = "ç©æä»£ç "; |
| | | grdMain.Columns[HMaterNameCol].HeaderText = "ç©æåç§°"; |
| | | grdMain.Columns[HMaterModelCol].HeaderText = "è§æ ¼åå·"; |
| | | grdMain.Columns[HModelCol].HeaderText = "èªå®ä¹è§æ ¼"; |
| | | grdMain.Columns[HPinfanCol].HeaderText = "åçª"; |
| | | grdMain.Columns[HPinfanBarCodeCol].HeaderText = "HPinfanBarCode"; |
| | | grdMain.Columns[HAuxPropIDCol].HeaderText = "è¾
å©å±æ§ID"; |
| | | grdMain.Columns[HAuxPropNumberCol].HeaderText = "è¾
å©å±æ§ä»£ç "; |
| | | grdMain.Columns[HAuxPropNameCol].HeaderText = "è¾
å©å±æ§åç§°"; |
| | | grdMain.Columns[HUnitIDCol].HeaderText = "计éåä½ID"; |
| | | grdMain.Columns[HUnitNumberCol].HeaderText = "计éåä½ä»£ç "; |
| | | grdMain.Columns[HUnitNameCol].HeaderText = "计éåä½åç§°"; |
| | | grdMain.Columns[HBarCodeTypeCol].HeaderText = "æ¡ç ç±»å"; |
| | | grdMain.Columns[HBatchManagerCol].HeaderText = "æ¯å¦å¯ç¨æ¹æ¬¡"; |
| | | grdMain.Columns[HBatchNoCol].HeaderText = "æ¹å·"; |
| | | grdMain.Columns[HGiveAwayFlagCol].HeaderText = "æ¯å¦èµ å"; |
| | | grdMain.Columns[HQtyCol].HeaderText = "æ°é"; |
| | | grdMain.Columns[HMinQtyCol].HeaderText = "æå°å
è£
æ°"; |
| | | grdMain.Columns[HPackQtyCol].HeaderText = "å¤ç®±æ°"; |
| | | grdMain.Columns[HBQtyCol].HeaderText = "ç®±æ°"; |
| | | grdMain.Columns[HSupIDCol].HeaderText = "ä¾åºåID"; |
| | | grdMain.Columns[HSupNumberCol].HeaderText = "ä¾åºå代ç "; |
| | | grdMain.Columns[HSupNameCol].HeaderText = "ä¾åºå"; |
| | | grdMain.Columns[HDeptIDCol].HeaderText = "车é´ID"; |
| | | grdMain.Columns[HDeptNumberCol].HeaderText = "车é´ä»£ç "; |
| | | grdMain.Columns[HDeptNameCol].HeaderText = "车é´"; |
| | | grdMain.Columns[HWhIDCol].HeaderText = "ä»åºID"; |
| | | grdMain.Columns[HWhNumberCol].HeaderText = "ä»åºä»£ç "; |
| | | grdMain.Columns[HWhNameCol].HeaderText = "ä»åº"; |
| | | grdMain.Columns[HSPIDCol].HeaderText = "ä»ä½ID"; |
| | | grdMain.Columns[HSPNumberCol].HeaderText = "ä»ä½ä»£ç "; |
| | | grdMain.Columns[HSPNameCol].HeaderText = "ä»ä½"; |
| | | grdMain.Columns[HInstructNoCol].HeaderText = "æä»¤åå·"; |
| | | grdMain.Columns[HSeOrderBillNoCol].HeaderText = "éå®è®¢åå·"; |
| | | grdMain.Columns[HSeOrderSEQCol].HeaderText = "éå®è®¢åè¡å·"; |
| | | grdMain.Columns[HDateCol].HeaderText = "è¿ææ¥æ"; |
| | | grdMain.Columns[HRemarkCol].HeaderText = "夿³¨"; |
| | | grdMain.Columns[HMTONoCol].HeaderText = "计åè·è¸ªå·"; |
| | | grdMain.Columns[HCusIDCol].HeaderText = "客æ·ID"; |
| | | grdMain.Columns[HCusNumberCol].HeaderText = "客æ·ä»£ç "; |
| | | grdMain.Columns[HCusNameCol].HeaderText = "客æ·"; |
| | | grdMain.Columns[HCusTypeCol].HeaderText = "客æ·åå·"; |
| | | grdMain.Columns[HEndDateCol].HeaderText = "计åå®å·¥æ¥æ"; |
| | | grdMain.Columns[HSourceIDCol].HeaderText = "ç产线ID"; |
| | | grdMain.Columns[HSourceNumberCol].HeaderText = "ç产线代ç "; |
| | | grdMain.Columns[HSourceNameCol].HeaderText = "ç产线"; |
| | | grdMain.Columns[HShowDateCol].HeaderText = "æ¥æ"; |
| | | grdMain.Columns[HInnerBillNoCol].HeaderText = "å
é¨éè´è®¢åå·"; |
| | | grdMain.Columns[HMakerCol].HeaderText = "å¶å人"; |
| | | grdMain.Columns[HProduceDateCol].HeaderText = "çäº§æ¥æ"; |
| | | grdMain.Columns[HExpiryDateCol].HeaderText = "æææè³"; |
| | | grdMain.Columns[HISKFPERIODCol].HeaderText = "æ¯å¦å¯ç¨ä¿è´¨æ"; |
| | | grdMain.Columns[HEXPUNITCol].HeaderText = "ä¿è´¨æåä½"; |
| | | grdMain.Columns[HEXPPERIODCol].HeaderText = "ä¿è´¨æ"; |
| | | //// |
| | | //æ ¼å¼å |
| | | grdMain.Columns[HTagCol].Visible = false; //éèå |
| | | grdMain.Columns[HMainIDCol].Visible = false; |
| | | grdMain.Columns[HSubIDCol].Visible = false; |
| | | grdMain.Columns[HBillTypeCol].Visible = false; |
| | | grdMain.Columns[HMaterIDCol].Visible = false; |
| | | grdMain.Columns[HModelCol].Visible = false; |
| | | //grdMain.Columns[HBatchNoCol].Visible = false; |
| | | grdMain.Columns[HAuxPropIDCol].Visible = false; |
| | | //grdMain.Columns[HAuxPropNumberCol].Visible = false; |
| | | //grdMain.Columns[HAuxPropNameCol].Visible = false; |
| | | grdMain.Columns[HUnitIDCol].Visible = false; |
| | | grdMain.Columns[HinitQtyCol].Visible = false; |
| | | grdMain.Columns[HSupIDCol].Visible = false; |
| | | grdMain.Columns[HSupNumberCol].Visible = false; |
| | | grdMain.Columns[HSupNameCol].Visible = false; |
| | | grdMain.Columns[HDeptIDCol].Visible = false; |
| | | grdMain.Columns[HDeptNumberCol].Visible = false; |
| | | grdMain.Columns[HDeptNameCol].Visible = false; |
| | | grdMain.Columns[HWhIDCol].Visible = false; |
| | | grdMain.Columns[HWhNumberCol].Visible = false; |
| | | grdMain.Columns[HWhNameCol].Visible = false; |
| | | grdMain.Columns[HSPIDCol].Visible = false; |
| | | grdMain.Columns[HSPNumberCol].Visible = false; |
| | | grdMain.Columns[HSPNameCol].Visible = false; |
| | | grdMain.Columns[HSourceInterIDCol].Visible = false; |
| | | grdMain.Columns[HSourceEntryIDCol].Visible = false; |
| | | grdMain.Columns[HSourceBillNoCol].Visible = false; |
| | | grdMain.Columns[HSourceBillTypeCol].Visible = false; |
| | | grdMain.Columns[HInstructIDCol].Visible = false; |
| | | grdMain.Columns[HInstructNoCol].Visible = false; |
| | | grdMain.Columns[HSeOrderBillIDCol].Visible = false; |
| | | //grdMain.Columns[HSeOrderBillNoCol].Visible = false; |
| | | grdMain.Columns[HBarCodeTypeCol].Visible = false; |
| | | grdMain.Columns[HBatchManagerCol].Visible = false; |
| | | //grdMain.Columns[HDateCol].Visible = false; |
| | | grdMain.Columns[HPinfanCol].Visible = false; |
| | | grdMain.Columns[HPinfanBarCodeCol].Visible = false; |
| | | grdMain.Columns[HCusIDCol].Visible = false; |
| | | //grdMain.Columns[HCusNumberCol].Visible = false; |
| | | //grdMain.Columns[HCusNameCol].Visible = false; |
| | | grdMain.Columns[HCusTypeCol].Visible = false; |
| | | grdMain.Columns[HEndDateCol].Visible = false; |
| | | grdMain.Columns[HSourceIDCol].Visible = false; |
| | | grdMain.Columns[HSourceNumberCol].Visible = false; |
| | | grdMain.Columns[HSourceNameCol].Visible = false; |
| | | //grdMain.Columns[HProduceDateCol].Visible = false; |
| | | //grdMain.Columns[HExpiryDateCol].Visible = false; |
| | | grdMain.Columns[HISKFPERIODCol].Visible = false; |
| | | grdMain.Columns[HEXPUNITCol].Visible = false; |
| | | grdMain.Columns[HEXPPERIODCol].Visible = false; |
| | | |
| | | //设置å¯ç¼è¾å |
| | | string sAllowCol = HQtyCol.ToString() + |
| | | "," + HMinQtyCol.ToString() + |
| | | "," + HMaterNumberCol.ToString() + |
| | | "," + HAuxPropNumberCol.ToString() + |
| | | "," + HUnitNumberCol.ToString() + |
| | | "," + HSeOrderBillNoCol.ToString() + |
| | | "," + HBatchNoCol.ToString() + |
| | | "," + HCusNumberCol.ToString() + |
| | | "," + HPackQtyCol.ToString() + |
| | | "," + HRemarkCol.ToString(); |
| | | //设置å计å |
| | | string sTotalCol = HQtyCol.ToString(); |
| | | |
| | | //è®¾ç½®ç¹æ®å |
| | | for (int i = 0; i < grdMain.Rows.Count; i++) |
| | | { |
| | | //ç½æ ¼æå¾ |
| | | DataGridViewCheckBoxCell oCell = new DataGridViewCheckBoxCell(); |
| | | oCell.ThreeState = false; |
| | | oCell.Value = 0; |
| | | oCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; |
| | | grdMain.Rows[i].Cells[HGiveAwayFlagCol] = oCell; |
| | | } |
| | | // |
| | | |
| | | DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol, oSumGrid); |
| | | //---------------------------- |
| | | |
| | | grdSub.ColumnCount = 65; //æ»åæ° |
| | | DBUtility.Xt_BaseBillFun.initGridFst(grdSub, this.Name); |
| | | grdSub.Columns[HSelectCol].HeaderText = "éæ©"; |
| | | grdSub.Columns[HTMCol].HeaderText = "æ¡ç ç¼å·"; |
| | | grdSub.Columns[HBarCodeType2Col].HeaderText = "æ¡ç ç±»å"; |
| | | grdSub.Columns[HSno2Col].HeaderText = "åºå·"; |
| | | grdSub.Columns[HMaterID2Col].HeaderText = "ç©æID"; |
| | | grdSub.Columns[HMaterNumber2Col].HeaderText = "ç©æä»£ç "; |
| | | grdSub.Columns[HMaterName2Col].HeaderText = "ç©æåç§°"; |
| | | grdSub.Columns[HMaterModel2Col].HeaderText = "è§æ ¼åå·"; |
| | | grdSub.Columns[HModel2Col].HeaderText = "èªå®ä¹è§æ ¼"; |
| | | grdSub.Columns[HAuxPropID2Col].HeaderText = "è¾
å©å±æ§ID"; |
| | | grdSub.Columns[HAuxPropNumber2Col].HeaderText = "è¾
å©å±æ§ä»£ç "; |
| | | grdSub.Columns[HAuxPropName2Col].HeaderText = "è¾
å©å±æ§"; |
| | | grdSub.Columns[HPinfan2Col].HeaderText = "åçª"; |
| | | grdSub.Columns[HPinfanBarCode2Col].HeaderText = "HPinfanBarCode"; |
| | | grdSub.Columns[HBatchNo2Col].HeaderText = "æ¹å·"; |
| | | grdSub.Columns[HGiveAwayFlag2Col].HeaderText = "æ¯å¦èµ å"; |
| | | grdSub.Columns[HUnitID2Col].HeaderText = "计éåä½ID"; |
| | | grdSub.Columns[HUnitNumber2Col].HeaderText = "计éåä½ä»£ç "; |
| | | grdSub.Columns[HUnitName2Col].HeaderText = "计éåä½"; |
| | | grdSub.Columns[HQty2Col].HeaderText = "æ°é"; |
| | | grdSub.Columns[HWeiCol].HeaderText = "å°¾æ°"; |
| | | grdSub.Columns[HPrintCol].HeaderText = "æå°æ¬¡æ°"; |
| | | grdSub.Columns[HSourceInterID2Col].HeaderText = "æºå主ID"; |
| | | grdSub.Columns[HSourceEntryID2Col].HeaderText = "æºååID"; |
| | | grdSub.Columns[HSourceBillNo2Col].HeaderText = "æºååå·"; |
| | | grdSub.Columns[HSourceBillType2Col].HeaderText = "æºåç±»å"; |
| | | grdSub.Columns[HSeOrderBillNo2Col].HeaderText = "éå®è®¢åå·"; |
| | | grdSub.Columns[HSeOrderSEQ2Col].HeaderText = "éå®è®¢åè¡å·"; |
| | | grdSub.Columns[HBarcodeNoCol].HeaderText = "æå·"; |
| | | grdSub.Columns[HBarcodeQtysCol].HeaderText = "æ»ææ°"; |
| | | grdSub.Columns[HSupID2Col].HeaderText = "ä¾åºåID"; |
| | | grdSub.Columns[HSupNumber2Col].HeaderText = "ä¾åºå代ç "; |
| | | grdSub.Columns[HSupName2Col].HeaderText = "ä¾åºå"; |
| | | grdSub.Columns[HDeptID2Col].HeaderText = "车é´ID"; |
| | | grdSub.Columns[HDeptNumber2Col].HeaderText = "车é´ä»£ç "; |
| | | grdSub.Columns[HDeptName2Col].HeaderText = "车é´"; |
| | | grdSub.Columns[HWhID2Col].HeaderText = "ä»åºID"; |
| | | grdSub.Columns[HWhNumber2Col].HeaderText = "ä»åºä»£ç "; |
| | | grdSub.Columns[HWhName2Col].HeaderText = "ä»åº"; |
| | | grdSub.Columns[HSPID2Col].HeaderText = "ä»ä½ID"; |
| | | grdSub.Columns[HSPNumber2Col].HeaderText = "ä»ä½ä»£ç "; |
| | | grdSub.Columns[HSPName2Col].HeaderText = "ä»ä½"; |
| | | grdSub.Columns[HInstructNo2Col].HeaderText = "æä»¤åå·"; |
| | | grdSub.Columns[HDate2Col].HeaderText = "è¿ææ¥æ"; |
| | | grdSub.Columns[HRemark2Col].HeaderText = "夿³¨"; |
| | | grdSub.Columns[HMTONo2Col].HeaderText = "计åè·è¸ªå·"; |
| | | grdSub.Columns[HCusID2Col].HeaderText = "客æ·ID"; |
| | | grdSub.Columns[HCusNumber2Col].HeaderText = "客æ·ä»£ç "; |
| | | grdSub.Columns[HCusName2Col].HeaderText = "客æ·"; |
| | | grdSub.Columns[HCusType2Col].HeaderText = "客æ·åå·"; |
| | | grdSub.Columns[HEndDate2Col].HeaderText = "计åå®å·¥æ¥æ"; |
| | | grdSub.Columns[HSourceID2Col].HeaderText = "ç产线ID"; |
| | | grdSub.Columns[HSourceNumber2Col].HeaderText = "ç产线代ç "; |
| | | grdSub.Columns[HSourceName2Col].HeaderText = "ç产线"; |
| | | grdSub.Columns[HShowDate2Col].HeaderText = "æ¥æ"; |
| | | grdSub.Columns[HInnerBillNo2Col].HeaderText = "å
é¨éè´è®¢åå·"; |
| | | grdSub.Columns[HMaker2Col].HeaderText = "å¶å人"; |
| | | grdSub.Columns[HEntryID2Col].HeaderText = "è¡å·"; |
| | | grdSub.Columns[HProduceDate2Col].HeaderText = "çäº§æ¥æ"; |
| | | grdSub.Columns[HExpiryDate2Col].HeaderText = "æææè³"; |
| | | grdSub.Columns[HISKFPERIOD2Col].HeaderText = "æ¯å¦å¯ç¨ä¿è´¨æ"; |
| | | grdSub.Columns[HEXPUNIT2Col].HeaderText = "ä¿è´¨æåä½"; |
| | | grdSub.Columns[HEXPPERIOD2Col].HeaderText = "ä¿è´¨æ"; |
| | | //æ ¼å¼å |
| | | grdSub.Columns[HMaterID2Col].Visible = false; |
| | | grdSub.Columns[HModel2Col].Visible = false; |
| | | grdSub.Columns[HAuxPropID2Col].Visible = false; |
| | | //grdSub.Columns[HAuxPropNumber2Col].Visible = false; |
| | | //grdSub.Columns[HAuxPropName2Col].Visible = false; |
| | | grdSub.Columns[HUnitID2Col].Visible = false; |
| | | grdSub.Columns[HPrintCol].Visible = false; |
| | | grdSub.Columns[HSourceInterID2Col].Visible = false; |
| | | grdSub.Columns[HSourceEntryID2Col].Visible = false; |
| | | grdSub.Columns[HSourceBillType2Col].Visible = false; |
| | | grdSub.Columns[HDeptID2Col].Visible = false; |
| | | grdSub.Columns[HDeptNumber2Col].Visible = false; |
| | | grdSub.Columns[HDeptName2Col].Visible = false; |
| | | //grdSub.Columns[HDate2Col].Visible = false; |
| | | grdSub.Columns[HBarCodeType2Col].Visible = false; |
| | | //grdSub.Columns[HBatchNo2Col].Visible = false; |
| | | grdSub.Columns[HWeiCol].Visible = false; |
| | | grdSub.Columns[HBarcodeNoCol].Visible = false; |
| | | grdSub.Columns[HBarcodeQtysCol].Visible = false; |
| | | grdSub.Columns[HSupID2Col].Visible = false; |
| | | grdSub.Columns[HSupNumber2Col].Visible = false; |
| | | grdSub.Columns[HSupName2Col].Visible = false; |
| | | grdSub.Columns[HWhID2Col].Visible = false; |
| | | grdSub.Columns[HWhNumber2Col].Visible = false; |
| | | grdSub.Columns[HWhName2Col].Visible = false; |
| | | grdSub.Columns[HSPID2Col].Visible = false; |
| | | grdSub.Columns[HSPNumber2Col].Visible = false; |
| | | grdSub.Columns[HSPName2Col].Visible = false; |
| | | grdSub.Columns[HInstructID2Col].Visible = false; |
| | | grdSub.Columns[HInstructNo2Col].Visible = false; |
| | | grdSub.Columns[HSeOrderBillID2Col].Visible = false; |
| | | //grdSub.Columns[HSeOrderBillNo2Col].Visible = false; |
| | | grdSub.Columns[HPinfan2Col].Visible = false; |
| | | grdSub.Columns[HPinfanBarCode2Col].Visible = false; |
| | | grdSub.Columns[HCusID2Col].Visible = false; |
| | | //grdSub.Columns[HCusNumber2Col].Visible = false; |
| | | //grdSub.Columns[HCusName2Col].Visible = false; |
| | | grdSub.Columns[HCusType2Col].Visible = false; |
| | | grdSub.Columns[HEndDate2Col].Visible = false; |
| | | grdSub.Columns[HSourceID2Col].Visible = false; |
| | | grdSub.Columns[HSourceNumber2Col].Visible = false; |
| | | grdSub.Columns[HSourceName2Col].Visible = false; |
| | | |
| | | //è®¾ç½®ç¹æ®å |
| | | for (int i = 0; i < grdSub.Rows.Count; i++) |
| | | { |
| | | //ç½æ ¼æå¾ |
| | | //æ¯å¦èµ å |
| | | DataGridViewCheckBoxCell oCell = new DataGridViewCheckBoxCell(); |
| | | oCell.ThreeState = false; |
| | | oCell.Value = 0; |
| | | oCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; |
| | | grdSub.Rows[i].Cells[HGiveAwayFlag2Col] = oCell; |
| | | //æ¯å¦å¯ç¨ä¿è´¨æ |
| | | DataGridViewCheckBoxCell oCell2 = new DataGridViewCheckBoxCell(); |
| | | oCell2.ThreeState = false; |
| | | oCell2.Value = 0; |
| | | oCell2.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; |
| | | grdSub.Rows[i].Cells[HISKFPERIOD2Col] = oCell2; |
| | | } |
| | | |
| | | DBUtility.Xt_BaseBillFun.GetGrid(grdMain, this.Name); |
| | | DBUtility.Xt_BaseBillFun.GetGrid(grdSub, this.Name + "grdSub"); |
| | | grdSub.SelectionMode = DataGridViewSelectionMode.FullRowSelect; //éè¡æ¨¡å¼ |
| | | |
| | | //// |
| | | DBUtility.Xt_BaseBillFun.initGridList(grdList, this.Name + "grdList"); |
| | | DBUtility.Xt_BaseBillFun.initGridList(grdBillBarCodeList, this.Name + "grdBillBarCodeList"); |
| | | //// |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region æå°ç¸å
³ |
| | | //æå°ç»æååå¡«æ¡ç æå°æ¬¡æ° |
| | | private void ReportPrintEnd() |
| | | { |
| | | if (UpdatePrintQtyCtl == "Y") |
| | | { |
| | | oBar.Set_UpdatePrintQty_SD(HInterID); |
| | | } |
| | | } |
| | | |
| | | //å¡«å
¥åæ®è¡¨å¤´ä¿¡æ¯ |
| | | private void ReportBeforePostRecord()// |
| | | { |
| | | try |
| | | { |
| | | //Report.FieldByName("ç©æä»£ç ").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HMaterNumber2Col].Value); |
| | | //Report.FieldByName("ç©æåç§°").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HMaterName2Col].Value); |
| | | //Report.FieldByName("è§æ ¼åå·").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HMaterModel2Col].Value); |
| | | ////Report.FieldByName("èªå®ä¹è§æ ¼").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HModel2Col].Value); |
| | | //Report.FieldByName("æ¡ç ç¼å·").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HTMCol].Value); |
| | | //Report.FieldByName("æ°é").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HQty2Col].Value); |
| | | //Report.FieldByName("æºååå·").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HSourceBillNoCol].Value); |
| | | //Report.FieldByName("éå®è®¢åå·").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HSeOrderBillNo2Col].Value); |
| | | //Report.FieldByName("ç产车é´").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HDeptName2Col].Value); |
| | | //Report.FieldByName("夿³¨").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HRemark2Col].Value); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | MessageBox.Show("æå°å¤±è´¥!表头ï¼" + e.Message); |
| | | } |
| | | } |
| | | |
| | | //å¡«å
¥åæ®è¡¨ä½ä¿¡æ¯ |
| | | private void ReportFetchRecordByDataTable() |
| | | { |
| | | try |
| | | { |
| | | DataTable ds = new DataTable(); |
| | | BLL.Utility.FillRecordToReport_Sel(Report, grdList, ds, Fun_GetCol("éæ©")); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | MessageBox.Show("æå°å¤±è´¥!表ä½ï¼" + e.Message); |
| | | } |
| | | } |
| | | |
| | | private Int32 Fun_GetCol(string sCol) |
| | | { |
| | | return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdList); |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region åºå®ä»£ç |
| | | |
| | | |
| | | |
| | | //ä¿åå宽 |
| | | private void bclk_Click(object sender, EventArgs e) |
| | |
| | | DBUtility.Xt_BaseBillFun.DelRow(oSumGrid); |
| | | } |
| | | |
| | | //ä¿åæé® |
| | | private void bc_Click(object sender, EventArgs e) |
| | | { |
| | | this.Sub_SaveBill(); |
| | | Display(); |
| | | |
| | | Display4(); |
| | | } |
| | | |
| | | |
| | | //éç½®æçº½ |
| | | private void cz_Click(object sender, EventArgs e) |
| | |
| | | |
| | | #region 读åç±» |
| | | |
| | | //忮宿´æ§å¤æ æªå®æ |
| | | private bool Sub_AllowSave() |
| | | { |
| | | //æç»è¡¨æ¯å¦ä¸ºé¶è¡ |
| | | bool b = false; |
| | | for (int i = 0; i < grdMain.RowCount; i++) |
| | | { |
| | | if (!IsNullRow(i)) |
| | | { |
| | | b = true; |
| | | break; |
| | | } |
| | | } |
| | | if (b == false) |
| | | { |
| | | MessageBox.Show("æç»è¡ä¸åå¨ï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | |
| | | string sHRemark = ""; |
| | | for (int j = 0; j < grdMain.Rows.Count; j++) |
| | | { |
| | | long HSno = DBUtility.ClsPub.isLong(grdMain.Rows[j].Cells[HSnoCol].Value); // åºå· |
| | | string HBarCodeType = cmbHBarCodeType.Text; // æ¡ç ç±»å |
| | | string HSourceBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBillNoCol].Value); // æºååå· |
| | | long HMaterID = DBUtility.ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value); // ç©æå
ç |
| | | string HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBatchNoCol].Value); // æ¹å· |
| | | long HAuxPropID = DBUtility.ClsPub.isLong(grdMain.Rows[j].Cells[HAuxPropIDCol].Value); // è¾
å©å±æ§ID |
| | | double HSourceQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[HinitQtyCol].Value); // æºåæ°é |
| | | double HQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[HQtyCol].Value); // æ°é |
| | | double HMinQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[HMinQtyCol].Value); // æå°å
è£
æ° |
| | | |
| | | if (HMaterID != 0) |
| | | { |
| | | DataSet oDsCheck = oCn.RunProcReturn("exec h_p_Gy_BarCodeBill_AddCheck " + HSno.ToString() + ",'" + HBarCodeType + "','" + HSourceBillNo + "'," + HMaterID.ToString() + ",'" + HBatchNo + "'," + HAuxPropID.ToString() + "," + HSourceQty.ToString() + "," + HQty.ToString() + "," + HMinQty.ToString() + "," + HOrgID.ToString() + ",'" + SourceQtyCtl + "'", "h_p_Gy_BarCodeBill_AddCheck"); |
| | | // |
| | | if (oDsCheck == null && oDsCheck.Tables[0].Rows.Count == 0) |
| | | { |
| | | MessageBox.Show("æ¡ç çæå®æ´æ§å¤æé误ï¼"); |
| | | return false; |
| | | } |
| | | else if (DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0][0]) == "1") |
| | | { |
| | | sHRemark = sHRemark + DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0]["HRemark"]); |
| | | } |
| | | else if (DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HExpiryDateCol].Value) == "") |
| | | { |
| | | if (DBUtility.ClsPub.isBool(oDsCheck.Tables[0].Rows[0]["HISKFPERIOD"])) |
| | | { |
| | | DateTime HProduceDate; //çäº§æ¥æ |
| | | string HEXPUNIT; //ä¿è´¨æåä½ |
| | | int HEXPPERIOD; //ä¿è´¨æ |
| | | |
| | | HProduceDate = dtpHDate.Value; |
| | | HEXPUNIT = DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0]["HEXPUNIT"]); |
| | | HEXPPERIOD = DBUtility.ClsPub.isInt(oDsCheck.Tables[0].Rows[0]["HEXPPERIOD"]); |
| | | |
| | | grdMain.Rows[j].Cells[HISKFPERIODCol].Value = 1; |
| | | grdMain.Rows[j].Cells[HEXPUNITCol].Value = HEXPUNIT; |
| | | grdMain.Rows[j].Cells[HEXPPERIODCol].Value = HEXPPERIOD.ToString(); |
| | | grdMain.Rows[j].Cells[HProduceDateCol].Value = HProduceDate.ToShortDateString(); |
| | | |
| | | if (HEXPUNIT == "Y") |
| | | { |
| | | grdMain.Rows[j].Cells[HExpiryDateCol].Value = HProduceDate.AddYears(HEXPPERIOD).ToShortDateString(); |
| | | } |
| | | else if (HEXPUNIT == "M") |
| | | { |
| | | grdMain.Rows[j].Cells[HExpiryDateCol].Value = HProduceDate.AddMonths(HEXPPERIOD).ToShortDateString(); |
| | | } |
| | | else |
| | | { |
| | | grdMain.Rows[j].Cells[HExpiryDateCol].Value = HProduceDate.AddDays(HEXPPERIOD).ToShortDateString(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | grdMain.Rows[j].Cells[HISKFPERIODCol].Value = 0; |
| | | grdMain.Rows[j].Cells[HEXPUNITCol].Value = ""; |
| | | grdMain.Rows[j].Cells[HEXPPERIODCol].Value = 0; |
| | | grdMain.Rows[j].Cells[HProduceDateCol].Value = ""; |
| | | grdMain.Rows[j].Cells[HExpiryDateCol].Value = ""; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (sHRemark != "") |
| | | { |
| | | MessageBox.Show(sHRemark); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | //ä¿ååæ® |
| | | private bool Sub_SaveBill() |
| | | { |
| | | //è·åå
ç |
| | | HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | ////è¥MAINDIéå¤åéæ°è·å |
| | | //if (BaseBill.IsExistMainID(ref DBUtility.ClsPub.sExeReturnInfo, HInterID, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew)) |
| | | //{ |
| | | // HInterID = DBUtility.ClsPub.CreateBillID(ModName, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //} |
| | | // |
| | | DAL.ClsGy_ORGANIZATIONS_View oClsGy_ORGANIZATIONS_View = new DAL.ClsGy_ORGANIZATIONS_View(); |
| | | HOrgNumber = ""; |
| | | if (oClsGy_ORGANIZATIONS_View.GetInfoByName(cmbHOrgID.Text)) |
| | | { |
| | | HOrgID = oClsGy_ORGANIZATIONS_View.omodel.HItemID; |
| | | HOrgNumber = DBUtility.ClsPub.isStrNull(oClsGy_ORGANIZATIONS_View.omodel.HNumber); |
| | | } |
| | | if (HOrgID == -1) |
| | | { |
| | | MessageBox.Show("éæ©ç»ç»æé误ï¼"); |
| | | return false; |
| | | } |
| | | lblCaption.Focus(); |
| | | if (!Sub_AllowSave())//忮宿´æ§å¤æ |
| | | { |
| | | return false; |
| | | } |
| | | //bc.Enabled = false; |
| | | if (cmbHBarCodeType.Text == "ä»ªå¨æåæ¡ç è§å") |
| | | { |
| | | SaveBarCode_bori(); //ç©æç¼ç +åºåå·+çäº§æ¥æ |
| | | } |
| | | else |
| | | { |
| | | SaveBarCode(); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | //çææ¡ç |
| | | private void SaveBarCode() |
| | | { |
| | | grdSub.Rows.Clear(); |
| | | int LSHlen = 6; //æµæ°´å·é¿åº¦ |
| | | int SumLen = 10; //æ»é¿åº¦ |
| | | string TM = ""; //æ¡ç |
| | | string HNumber = ""; //ç©æå
ç |
| | | string HMaterNumber = ""; //ç©æä»£ç |
| | | double HSumQty = 0; //äº§åæ°é |
| | | double HMinQty = 0; //æå°å
è£
æ° |
| | | Int64 HBQty = 0; //ç®±æ° |
| | | double HQty = 0; //æ°é |
| | | string WeiShu = ""; //å°¾æ° |
| | | Int64 LSH = 0; //æµæ°´å· |
| | | string LSH2 = ""; //æµæ°´å·è½¬æ¢æå符 |
| | | string sDate = ""; //æ¥æ |
| | | string sYear = ""; //å¹´ |
| | | string sPeriod = ""; //æ |
| | | string sDay = ""; //æ¥ |
| | | string HBatchNo = ""; //æ¹æ¬¡ |
| | | string HYasuoji = ""; //åç¼©æº |
| | | string HModelName = ""; //æºå |
| | | string HICMOBillNo = ""; //æºåå· |
| | | string HBarCodeBatchNo = ""; //æ¡ç æ¹æ¬¡å· |
| | | string HBarCodeDate = ""; //æ¡ç æ¥æ |
| | | int k = 0; |
| | | Int64 n = 0; //å䏿¹çææ¡ç ä¸çç¬¬å æ¡ |
| | | string sTMNumber = ""; //æ¡ç èªå®ä¹åç¼ |
| | | string sSourceBillNo = ""; //æºåå· |
| | | string sSourceEntryID = ""; //è¡å·ï¼æºååIDï¼ |
| | | DataSet Ds; |
| | | //Ds = oCn.RunProcReturn("exec GetLSH '" + ClsPub.GetServerDate(0) + "'", "GetLSH"); |
| | | //LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]); |
| | | for (int j = 0; j < grdMain.Rows.Count; j++) |
| | | { |
| | | if (ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value) != 0) |
| | | { |
| | | HNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterIDCol].Value); |
| | | HMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterNumberCol].Value); |
| | | HBatchNo = ClsPub.isStrNull(grdMain.Rows[j].Cells[HBatchNoCol].Value); |
| | | //æ¥æè·åæ¹å¼ |
| | | sDate = dtpHDate.Value.ToShortDateString(); |
| | | // |
| | | if (cmbHBarCodeType.Text == "仪å¨å¤è´ä»¶æ¡ç æ®éè§å" || cmbHBarCodeType.Text == "仪å¨å¤è´ä»¶æ¡ç 容å¨è§å") //åæ®æ¥æ(æ¶æéç¥å) |
| | | { |
| | | sDate = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HDateCol].Value); |
| | | } |
| | | else if (cmbHBarCodeType.Text == "è¯åæåæ¡ç è§å")// å¤±ææ¥æï¼ç产订åï¼ |
| | | { |
| | | sDate = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HEndDateCol].Value); |
| | | } |
| | | else if (CampanyName == "å¤å®çµå¨")// æ¥æï¼çäº§è®¢å æ¡ç æ¥æ |
| | | { |
| | | sDate = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HDateCol].Value); |
| | | } |
| | | HYasuoji = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HPinfanCol].Value); //å缩æºä»£ç ï¼å¤å®çµå¨ï¼ |
| | | HModelName = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusTypeCol].Value); //æºåï¼å¤å®çµå¨ï¼ |
| | | HICMOBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HSourceBillNoCol].Value); //ç产订åå·ï¼å¤å®çµå¨ï¼ |
| | | HBarCodeBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HPinfanBarCodeCol].Value); //æ¡ç æ¹æ¬¡å·ï¼å¤å®çµå¨ï¼ |
| | | HBarCodeDate = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HSupNumberCol].Value); //æ¡ç æ¥æï¼å¤å®çµå¨ï¼ |
| | | // |
| | | sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2); |
| | | sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString(); |
| | | sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2); |
| | | sDay = "0" + ClsPub.isDate(sDate).Day.ToString(); |
| | | sDay = sDay.Substring(sDay.Length - 2, 2); |
| | | //================================== |
| | | if (cmbHBarCodeType.Text == "å¯ä¸æ¡ç ") |
| | | { |
| | | if (CampanyName == "åå") //ç³»ç»åæ° å®¢æ·å®å¶ååç§° |
| | | { |
| | | //æ¡ç åç¼ = ç©æä»£ç + å¹´ + æ + æ¥ |
| | | sTMNumber = HNumber + sYear + sPeriod + sDay; |
| | | Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //è·åæå¤§æµæ°´å· |
| | | //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]); |
| | | } |
| | | else if (CampanyName == "é£é¾") |
| | | { |
| | | string HWorksNumber = ""; |
| | | HWorksNumber = cmbHWorksNumber.Text; |
| | | if (HWorksNumber == "") |
| | | { |
| | | MessageBox.Show("å·¥å代ç ä¸è½ä¸ºç©ºï¼"); |
| | | return; |
| | | } |
| | | //æ¡ç åç¼ = å·¥å代ç + ç©æå
ç + æ¥æ |
| | | sTMNumber = HWorksNumber + HNumber + sYear + sPeriod + sDay; |
| | | Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //è·åæå¤§æµæ°´å· |
| | | //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]); |
| | | } |
| | | else if (CampanyName == "䏿§") |
| | | { |
| | | sSourceBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBillNoCol].Value); |
| | | sSourceEntryID = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HSubIDCol].Value); |
| | | if (sSourceBillNo == "") |
| | | { |
| | | //æ¡ç åç¼ = ç»ç»ä»£ç + ç©æä»£ç + å¹´ + æ + æ¥ |
| | | sTMNumber = HOrgNumber + HNumber + sYear + sPeriod + sDay; |
| | | Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //è·åæå¤§æµæ°´å· |
| | | LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]); |
| | | } |
| | | else |
| | | { |
| | | //æ¡ç = æºååå· + ç©æID + è¡å· |
| | | sTMNumber = sSourceBillNo + HNumber + sSourceEntryID; |
| | | } |
| | | } |
| | | else //éç¨æ¹æ³ |
| | | { |
| | | //æ¡ç åç¼ = ç»ç»ä»£ç + ç©æä»£ç + å¹´ + æ + æ¥ |
| | | sTMNumber = HOrgNumber + HNumber + sYear + sPeriod + sDay; |
| | | Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //è·åæå¤§æµæ°´å· |
| | | //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]); |
| | | } |
| | | } |
| | | else if (cmbHBarCodeType.Text == "åç§æ¡ç ") |
| | | { |
| | | if (CampanyName == "äºäº") //ç³»ç»åæ° å®¢æ·å®å¶ååç§° |
| | | { |
| | | TM = HNumber + ";" + DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMTONoCol].Value); |
| | | } |
| | | else |
| | | { |
| | | TM = HOrgNumber + HNumber; |
| | | } |
| | | } |
| | | else if (cmbHBarCodeType.Text == "æ¹æ¬¡æ¡ç ") |
| | | { |
| | | TM = HOrgNumber + HNumber + HBatchNo; |
| | | }//åæ¥ç¹æ®å¤ç |
| | | else if (cmbHBarCodeType.Text == "åºåç ") |
| | | { |
| | | //æ¡ç è§åï¼ GX+ç©æå
ç +å¹´å¹´æææ¥æ¥+5使µæ°´å· |
| | | LSHlen = 5; |
| | | //æ¡ç åç¼ = GX+ç©æå
ç +å¹´å¹´æææ¥æ¥ |
| | | sTMNumber = "GX" + HNumber + sYear + sPeriod + sDay; |
| | | Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //è·åæå¤§æµæ°´å· |
| | | LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]); |
| | | } |
| | | else if (cmbHBarCodeType.Text == "仪å¨å¤è´ä»¶æ¡ç æ®éè§å" || cmbHBarCodeType.Text == "仪å¨å¤è´ä»¶æ¡ç 容å¨è§å") |
| | | { |
| | | //ç©æç¼ç +åæ®æ¥æï¼YYMMDDï¼+æµæ°´4ä½ |
| | | sTMNumber = HMaterNumber + sYear + sPeriod + sDay; |
| | | Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //è·åæå¤§æµæ°´å· |
| | | //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]); |
| | | LSHlen = 4; |
| | | } |
| | | else if (cmbHBarCodeType.Text == "ä»ªå¨æåæ¡ç è§å") //å¦å¤å¤çäº |
| | | { |
| | | //ç©æç¼ç +åºåå·+çäº§æ¥æ |
| | | //sTMNumber = HMaterNumber + sYear + sPeriod + sDay; |
| | | //Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //è·åæå¤§æµæ°´å· |
| | | // //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | //LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]); |
| | | } |
| | | else if (cmbHBarCodeType.Text == "è¯åæåæ¡ç è§å") |
| | | { |
| | | //ç©æç¼ç +ç产æ¹å·+æµæ°´å·6ä½- |
| | | sTMNumber = HMaterNumber + HBatchNo; |
| | | Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //è·åæå¤§æµæ°´å· |
| | | //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]); |
| | | LSHlen = 6; |
| | | } |
| | | else if (cmbHBarCodeType.Text == "å
éæºæ¡ç ") |
| | | { |
| | | //å¶é æ¬é¨1ä½ï¼é»è®¤1ï¼+æºå代ç 5ä½ï¼ï¼+å¹´2ä½+æ1ä½ï¼AãBãC代æ¿10æä»½ï¼ |
| | | //+æ¥2ä½+æ¡ç æ¹æ¬¡ç 2ä½+å缩æºä»£ç 1ä½+00+æµæ°´å·4ä½+æ ¡éªç ï¼é»è®¤0ï¼ |
| | | sTMNumber = "1" + HModelName + HBarCodeDate + HBarCodeBatchNo + HYasuoji + "00"; |
| | | Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //è·åæå¤§æµæ°´å· |
| | | //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]); |
| | | LSHlen = 4; |
| | | if (sTMNumber.Length != 16 && sTMNumber.Length != 15) |
| | | { |
| | | MessageBox.Show("æ¡ç é¿åº¦ä¸å¤15æ16ä½ï¼æ¯å¦æ°æ®ä¸å
¨ï¼å¶é æ¬é¨1ä½:[0] + æºå代ç 5ä½:[" + HModelName + "] + å¹´ææ¥4æ5ä½:[" + HBarCodeDate + "] + æ¹æ¬¡å·2ä½:[" + HBarCodeBatchNo + "]+ å缩æº1ä½:[" + HYasuoji + "]+00 ; "); |
| | | return; |
| | | } |
| | | } |
| | | else if (cmbHBarCodeType.Text == "å¤éæºæ¡ç ") |
| | | { |
| | | //ç©æä»£ç 11ä½+å¹´2ä½+æ1ä½ï¼AãBãC代æ¿10æä»½ï¼+æ¥2ä½+æ¹æ¬¡2ä½+æµæ°´å·4ä½ |
| | | //sTMNumber = HMaterNumber.Replace(Convert.ToChar("."),Convert.ToChar("")) + HBarCodeDate + HBarCodeBatchNo; |
| | | sTMNumber = HMaterNumber.Replace(".", "") + HBarCodeDate + HBarCodeBatchNo; |
| | | Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //è·åæå¤§æµæ°´å· |
| | | //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]); |
| | | LSHlen = 4; |
| | | if (sTMNumber.Length != 18 && sTMNumber.Length != 17) |
| | | { |
| | | MessageBox.Show("æ¡ç é¿åº¦ä¸å¤17æ18ä½ï¼æ¯å¦æ°æ®ä¸å
¨ï¼ç©æä»£ç 11ä½:[" + HMaterNumber.Replace(".", "") + "]+å¹´ææ¥4æ5ä½:[" + HBarCodeDate + "]+æ¹æ¬¡å·2ä½:[" + HBarCodeBatchNo + "];"); |
| | | return; |
| | | } |
| | | } |
| | | else if (cmbHBarCodeType.Text == "åæåæ¡ç ") |
| | | { |
| | | //ç产订åå·+4使µæ°´å· |
| | | sTMNumber = HICMOBillNo; |
| | | Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //è·åæå¤§æµæ°´å· |
| | | //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]); |
| | | LSHlen = 5; |
| | | } |
| | | //else if (cmbHBarCodeType.Text == "æçæ¡ç ") |
| | | //{ |
| | | // TM = HOrgNumber + HNumber + LSH2; |
| | | //} |
| | | else |
| | | { |
| | | MessageBox.Show("éè¯¯çæ¡ç ç±»åï¼ä¸è½çææ¡ç ï¼"); |
| | | return; |
| | | } |
| | | |
| | | Int64 HBQty2 = 0; //ç®±æ° |
| | | HBQty2 = ClsPub.isLong(grdMain.Rows[j].Cells[HBQtyCol].Value); |
| | | HBQty = HBQty + ClsPub.isLong(grdMain.Rows[j].Cells[HBQtyCol].Value); |
| | | HMinQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HMinQtyCol].Value); |
| | | HSumQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HQtyCol].Value); |
| | | n = 0; |
| | | int nn = 0; |
| | | for (int i = k; i < HBQty; i++) |
| | | { |
| | | if (HSumQty - HMinQty > 0) |
| | | { |
| | | WeiShu = ""; |
| | | HSumQty = HSumQty - HMinQty; |
| | | } |
| | | else |
| | | { |
| | | if (HSumQty == HMinQty) |
| | | { |
| | | WeiShu = ""; |
| | | } |
| | | else |
| | | { |
| | | WeiShu = "å°¾æ°"; |
| | | } |
| | | HMinQty = HSumQty; |
| | | } |
| | | // |
| | | LSH = LSH + 1; |
| | | LSH2 = LSH.ToString(); |
| | | while (LSH2.Length < LSHlen) //å¦ææµæ°´å·å°äº6使°åé¢è¡¥0 |
| | | { |
| | | LSH2 = "0" + LSH2; |
| | | } |
| | | if (cmbHBarCodeType.Text == "å¯ä¸æ¡ç ") |
| | | { |
| | | if (CampanyName == "䏿§") |
| | | { |
| | | if (sSourceBillNo == "") |
| | | { |
| | | //æ¡ç ç¼å· = æ¡ç åç¼ + æµæ°´å· |
| | | TM = sTMNumber + LSH2; |
| | | } |
| | | else |
| | | { |
| | | if (HBQty2 > 1) |
| | | { |
| | | MessageBox.Show("çäº§æ±æ¥åãæ¶æéç¥åçææ¡ç æ¶ï¼ç®±æ°ä¸è½å¤§äº1ï¼"); |
| | | bc.Enabled = true; |
| | | return; |
| | | } |
| | | //æ¡ç ç¼å· = æ¡ç åç¼ |
| | | TM = sTMNumber; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //æ¡ç ç¼å· = æ¡ç åç¼ + æµæ°´å· |
| | | TM = sTMNumber + LSH2; |
| | | } |
| | | } |
| | | else if (cmbHBarCodeType.Text == "åºåç ") |
| | | { |
| | | //æ¡ç ç¼å· = æ¡ç åç¼ + æµæ°´å· |
| | | TM = sTMNumber + LSH2; |
| | | } |
| | | else if (cmbHBarCodeType.Text == "仪å¨å¤è´ä»¶æ¡ç æ®éè§å" || cmbHBarCodeType.Text == "仪å¨å¤è´ä»¶æ¡ç 容å¨è§å" || cmbHBarCodeType.Text == "è¯åæåæ¡ç è§å" |
| | | || cmbHBarCodeType.Text == "åæåæ¡ç " || cmbHBarCodeType.Text == "å¤éæºæ¡ç ") |
| | | { |
| | | TM = sTMNumber + LSH2; |
| | | |
| | | } |
| | | else if (cmbHBarCodeType.Text == "å
éæºæ¡ç ") |
| | | { |
| | | TM = sTMNumber + LSH2 + "0"; |
| | | } |
| | | // |
| | | if (i + 1 > grdSub.Rows.Count) |
| | | { |
| | | grdSub.RowCount = grdSub.RowCount + 1; |
| | | } |
| | | grdSub.Rows[i].Cells[HSno2Col].Value = ClsPub.isStrNull(i + 1); |
| | | if (TM.Trim() == "") |
| | | { |
| | | MessageBox.Show("æ¡å½¢ç ä¸è½ä¸ºç©ºï¼ä¸è½çææ¡ç ï¼"); |
| | | return; |
| | | } |
| | | grdSub.Rows[i].Cells[HTMCol].Value = TM; |
| | | grdSub.Rows[i].Cells[HEntryID2Col].Value = j + 1; |
| | | grdSub.Rows[i].Cells[HMaterID2Col].Value = grdMain.Rows[j].Cells[HMaterIDCol].Value; |
| | | grdSub.Rows[i].Cells[HMaterNumber2Col].Value = grdMain.Rows[j].Cells[HMaterNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HMaterName2Col].Value = grdMain.Rows[j].Cells[HMaterNameCol].Value; |
| | | grdSub.Rows[i].Cells[HMaterModel2Col].Value = grdMain.Rows[j].Cells[HMaterModelCol].Value; |
| | | grdSub.Rows[i].Cells[HPinfan2Col].Value = grdMain.Rows[j].Cells[HPinfanCol].Value; |
| | | grdSub.Rows[i].Cells[HPinfanBarCode2Col].Value = grdMain.Rows[j].Cells[HPinfanBarCodeCol].Value; |
| | | |
| | | grdSub.Rows[i].Cells[HAuxPropID2Col].Value = grdMain.Rows[j].Cells[HAuxPropIDCol].Value; |
| | | grdSub.Rows[i].Cells[HAuxPropNumber2Col].Value = grdMain.Rows[j].Cells[HAuxPropNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HAuxPropName2Col].Value = grdMain.Rows[j].Cells[HAuxPropNameCol].Value; |
| | | |
| | | grdSub.Rows[i].Cells[HUnitID2Col].Value = grdMain.Rows[j].Cells[HUnitIDCol].Value; |
| | | grdSub.Rows[i].Cells[HUnitNumber2Col].Value = grdMain.Rows[j].Cells[HUnitNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HUnitName2Col].Value = grdMain.Rows[j].Cells[HUnitNameCol].Value; |
| | | |
| | | grdSub.Rows[i].Cells[HQty2Col].Value = HMinQty; |
| | | grdSub.Rows[i].Cells[HBatchNo2Col].Value = grdMain.Rows[j].Cells[HBatchNoCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceInterID2Col].Value = grdMain.Rows[j].Cells[HMainIDCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceEntryID2Col].Value = grdMain.Rows[j].Cells[HSubIDCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceBillNo2Col].Value = grdMain.Rows[j].Cells[HBillNoCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceBillType2Col].Value = grdMain.Rows[j].Cells[HBillTypeCol].Value; |
| | | grdSub.Rows[i].Cells[HPrintCol].Value = "0"; |
| | | grdSub.Rows[i].Cells[HWeiCol].Value = WeiShu; |
| | | grdSub.Rows[i].Cells[HBarcodeNoCol].Value = n + 1; |
| | | grdSub.Rows[i].Cells[HBarcodeQtysCol].Value = grdMain.Rows[j].Cells[HBQtyCol].Value; |
| | | grdSub.Rows[i].Cells[HSupID2Col].Value = grdMain.Rows[j].Cells[HSupIDCol].Value; |
| | | grdSub.Rows[i].Cells[HSupNumber2Col].Value = grdMain.Rows[j].Cells[HSupNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HSupName2Col].Value = grdMain.Rows[j].Cells[HSupNameCol].Value; |
| | | grdSub.Rows[i].Cells[HDeptID2Col].Value = grdMain.Rows[j].Cells[HDeptIDCol].Value; |
| | | grdSub.Rows[i].Cells[HDeptNumber2Col].Value = grdMain.Rows[j].Cells[HDeptNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HDeptName2Col].Value = grdMain.Rows[j].Cells[HDeptNameCol].Value; |
| | | grdSub.Rows[i].Cells[HRemark2Col].Value = grdMain.Rows[j].Cells[HRemarkCol].Value; |
| | | grdSub.Rows[i].Cells[HDate2Col].Value = grdMain.Rows[j].Cells[HDateCol].Value; |
| | | grdSub.Rows[i].Cells[HShowDate2Col].Value = grdMain.Rows[j].Cells[HShowDateCol].Value; |
| | | grdSub.Rows[i].Cells[HWhID2Col].Value = grdMain.Rows[j].Cells[HWhIDCol].Value; |
| | | grdSub.Rows[i].Cells[HWhNumber2Col].Value = grdMain.Rows[j].Cells[HWhNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HWhName2Col].Value = grdMain.Rows[j].Cells[HWhNameCol].Value; |
| | | grdSub.Rows[i].Cells[HSPID2Col].Value = grdMain.Rows[j].Cells[HSPIDCol].Value; |
| | | grdSub.Rows[i].Cells[HSPNumber2Col].Value = grdMain.Rows[j].Cells[HSPNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HSPName2Col].Value = grdMain.Rows[j].Cells[HSPNameCol].Value; |
| | | grdSub.Rows[i].Cells[HMTONo2Col].Value = grdMain.Rows[j].Cells[HMTONoCol].Value; |
| | | grdSub.Rows[i].Cells[HCusID2Col].Value = grdMain.Rows[j].Cells[HCusIDCol].Value; |
| | | grdSub.Rows[i].Cells[HCusNumber2Col].Value = grdMain.Rows[j].Cells[HCusNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HCusName2Col].Value = grdMain.Rows[j].Cells[HCusNameCol].Value; |
| | | grdSub.Rows[i].Cells[HCusType2Col].Value = grdMain.Rows[j].Cells[HCusTypeCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceID2Col].Value = grdMain.Rows[j].Cells[HSourceIDCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceNumber2Col].Value = grdMain.Rows[j].Cells[HSourceNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceName2Col].Value = grdMain.Rows[j].Cells[HSourceNameCol].Value; |
| | | grdSub.Rows[i].Cells[HEndDate2Col].Value = grdMain.Rows[j].Cells[HEndDateCol].Value; |
| | | grdSub.Rows[i].Cells[HSeOrderBillNo2Col].Value = grdMain.Rows[j].Cells[HSeOrderBillNoCol].Value; |
| | | grdSub.Rows[i].Cells[HSeOrderSEQ2Col].Value = grdMain.Rows[j].Cells[HSeOrderSEQCol].Value; |
| | | grdSub.Rows[i].Cells[HInnerBillNo2Col].Value = grdMain.Rows[j].Cells[HInnerBillNoCol].Value; |
| | | grdSub.Rows[i].Cells[HMaker2Col].Value = grdMain.Rows[j].Cells[HMakerCol].Value; |
| | | grdSub.Rows[i].Cells[HGiveAwayFlag2Col].Value = grdMain.Rows[j].Cells[HGiveAwayFlagCol].Value; |
| | | grdSub.Rows[i].Cells[HProduceDate2Col].Value = grdMain.Rows[j].Cells[HProduceDateCol].Value; |
| | | grdSub.Rows[i].Cells[HExpiryDate2Col].Value = grdMain.Rows[j].Cells[HExpiryDateCol].Value; |
| | | grdSub.Rows[i].Cells[HISKFPERIOD2Col].Value = grdMain.Rows[j].Cells[HISKFPERIODCol].Value; |
| | | grdSub.Rows[i].Cells[HEXPUNIT2Col].Value = grdMain.Rows[j].Cells[HEXPUNITCol].Value; |
| | | grdSub.Rows[i].Cells[HEXPPERIOD2Col].Value = grdMain.Rows[j].Cells[HEXPPERIODCol].Value; |
| | | //ç½æ ¼æå¾ |
| | | //æ¯å¦èµ å |
| | | DataGridViewCheckBoxCell oCell = new DataGridViewCheckBoxCell(); |
| | | oCell.ThreeState = false; |
| | | oCell.Value = grdSub.Rows[i].Cells[HGiveAwayFlag2Col].Value; |
| | | oCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; |
| | | grdSub.Rows[i].Cells[HGiveAwayFlag2Col] = oCell; |
| | | //æ¯å¦å¯ç¨ä¿è´¨æ |
| | | DataGridViewCheckBoxCell oCell2 = new DataGridViewCheckBoxCell(); |
| | | oCell2.ThreeState = false; |
| | | oCell2.Value = grdSub.Rows[i].Cells[HISKFPERIOD2Col].Value; |
| | | oCell2.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; |
| | | grdSub.Rows[i].Cells[HISKFPERIOD2Col] = oCell2; |
| | | k = k + 1; |
| | | n = n + 1; |
| | | //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | nn = nn + 1; |
| | | } |
| | | //åå°æ¹éæ§è¡è¯å¥ |
| | | oCn.RunProc("exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "'," + nn.ToString() + " "); |
| | | } |
| | | } |
| | | string HWei = ""; //å°¾æ° |
| | | string HBarCode = ""; |
| | | string HBarCodeType = ""; |
| | | Int64 HMaterID = 0; |
| | | Int64 HAuxPropID = 0; |
| | | Int64 HUnitID = 0; |
| | | double HQty2 = 0; |
| | | string HBatchNo2 = ""; |
| | | Int64 HSupID = 0; |
| | | Int64 HGroupID = 0; |
| | | int HPrintQty = 0; |
| | | Int64 HSourceInterID = 0; |
| | | Int64 HSourceEntryID = 0; |
| | | string HSourceBillNo = ""; |
| | | string HSourceBillType = ""; |
| | | Int64 HBarcodeNo = 0; //æå· |
| | | Int64 HBarcodeQtys = 0; //æ»ææ° |
| | | Int64 HDeptID = 0; |
| | | Int64 HWhID = 0; |
| | | Int64 HSPID = 0; |
| | | string HRemark = ""; |
| | | string HMaterName = ""; |
| | | string HMaterModel = ""; |
| | | string HPinfan = ""; |
| | | string HMTONo = ""; |
| | | Int64 HCusID = 0; |
| | | string HCusType = ""; |
| | | DateTime HEndDate; |
| | | string HWorkLineName = ""; |
| | | string HSeOrderBillNo = ""; |
| | | Int64 HSeOrderSEQ = 0; |
| | | string HInnerBillNo = ""; |
| | | bool HGiveAwayFlag = false; |
| | | Int64 HEntryID = 0; |
| | | string HProduceDate; |
| | | string HExpiryDate; |
| | | bool HISKFPERIOD = false; |
| | | string HEXPUNIT = ""; |
| | | double HEXPPERIOD = 0; |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | for (int i = 0; i < grdSub.Rows.Count; i++) |
| | | { |
| | | if (ClsPub.isLong(grdSub.Rows[i].Cells[HMaterID2Col].Value) != 0) |
| | | { |
| | | HWei = ClsPub.isStrNull(grdSub.Rows[i].Cells[HWeiCol].Value); |
| | | HBarCode = ClsPub.isStrNull(grdSub.Rows[i].Cells[HTMCol].Value); |
| | | // |
| | | HBarCodeType = ClsPub.isStrNull(cmbHBarCodeType.Text); |
| | | if (CampanyName == "åæ¥ç§æ" || CampanyName == "å¤å®çµå¨") |
| | | { |
| | | HBarCodeType = "å¯ä¸æ¡ç "; |
| | | } |
| | | // |
| | | HMaterID = ClsPub.isLong(grdSub.Rows[i].Cells[HMaterID2Col].Value); |
| | | HEntryID = ClsPub.isLong(grdSub.Rows[i].Cells[HEntryID2Col].Value); |
| | | HAuxPropID = ClsPub.isLong(grdSub.Rows[i].Cells[HAuxPropID2Col].Value); |
| | | HUnitID = ClsPub.isLong(grdSub.Rows[i].Cells[HUnitID2Col].Value); |
| | | HQty2 = ClsPub.isDoule(grdSub.Rows[i].Cells[HQty2Col].Value); |
| | | HBatchNo2 = ClsPub.isStrNull(grdSub.Rows[i].Cells[HBatchNo2Col].Value); |
| | | HSourceInterID = ClsPub.isLong(grdSub.Rows[i].Cells[HSourceInterID2Col].Value); |
| | | HSourceEntryID = ClsPub.isLong(grdSub.Rows[i].Cells[HSourceEntryID2Col].Value); |
| | | HSourceBillNo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSourceBillNo2Col].Value); |
| | | HSourceBillType = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSourceBillType2Col].Value); |
| | | HBarcodeQtys = ClsPub.isLong(grdSub.Rows[i].Cells[HBarcodeQtysCol].Value); |
| | | HBarcodeNo = ClsPub.isLong(grdSub.Rows[i].Cells[HBarcodeNoCol].Value); |
| | | HSupID = ClsPub.isLong(grdSub.Rows[i].Cells[HSupID2Col].Value); |
| | | HDeptID = ClsPub.isLong(grdSub.Rows[i].Cells[HDeptID2Col].Value); |
| | | HWhID = ClsPub.isLong(grdSub.Rows[i].Cells[HWhID2Col].Value); |
| | | HSPID = ClsPub.isLong(grdSub.Rows[i].Cells[HSPID2Col].Value); |
| | | HRemark = ClsPub.isStrNull(grdSub.Rows[i].Cells[HRemark2Col].Value); |
| | | HMaterName = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMaterName2Col].Value); |
| | | HMaterModel = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMaterModel2Col].Value); |
| | | HPinfan = ClsPub.isStrNull(grdSub.Rows[i].Cells[HPinfan2Col].Value); |
| | | HMTONo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMTONo2Col].Value); |
| | | HCusID = ClsPub.isLong(grdSub.Rows[i].Cells[HCusID2Col].Value); |
| | | HCusType = ClsPub.isStrNull(grdSub.Rows[i].Cells[HCusType2Col].Value); |
| | | HEndDate = ClsPub.isDate(grdSub.Rows[i].Cells[HEndDate2Col].Value); |
| | | HWorkLineName = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSourceName2Col].Value); |
| | | HSeOrderBillNo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSeOrderBillNo2Col].Value); |
| | | HSeOrderSEQ = ClsPub.isLong(grdSub.Rows[i].Cells[HSeOrderSEQ2Col].Value); |
| | | HInnerBillNo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HInnerBillNo2Col].Value); |
| | | HGiveAwayFlag = ClsPub.isBool(grdSub.Rows[i].Cells[HGiveAwayFlag2Col].Value); |
| | | if (ClsPub.isDate(grdSub.Rows[i].Cells[HProduceDate2Col].Value) < Convert.ToDateTime("1950-01-01")) |
| | | { |
| | | HProduceDate = ""; |
| | | } |
| | | else |
| | | { |
| | | HProduceDate = ClsPub.isStrNull(grdSub.Rows[i].Cells[HProduceDate2Col].Value); |
| | | } |
| | | if (ClsPub.isDate(grdSub.Rows[i].Cells[HExpiryDate2Col].Value) < Convert.ToDateTime("1950-01-01")) |
| | | { |
| | | HExpiryDate = ""; |
| | | } |
| | | else |
| | | { |
| | | HExpiryDate = ClsPub.isStrNull(grdSub.Rows[i].Cells[HExpiryDate2Col].Value); |
| | | } |
| | | HISKFPERIOD = ClsPub.isBool(grdSub.Rows[i].Cells[HISKFPERIOD2Col].Value); |
| | | HEXPUNIT = ClsPub.isStrNull(grdSub.Rows[i].Cells[HEXPUNIT2Col].Value); |
| | | HEXPPERIOD = ClsPub.isDoule(grdSub.Rows[i].Cells[HEXPPERIOD2Col].Value); |
| | | |
| | | if (radioButton_HIsUsingBatchNo.Checked) |
| | | { |
| | | HBatchNo2 = getBatchNo(); |
| | | } |
| | | |
| | | |
| | | 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 " + |
| | | ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " + |
| | | ",HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID " + |
| | | ",HProduceDate,HExpiryDate " + |
| | | ",HISKFPERIOD,HEXPUNIT,HEXPPERIOD " + |
| | | ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " + |
| | | ") values (" |
| | | + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString() |
| | | + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'" + ClsPub.CurUserName + "',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString() |
| | | + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'" |
| | | + ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'" |
| | | + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + sDate + "'" |
| | | + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterID.ToString() + "," + HEntryID.ToString() |
| | | + ", " + DBUtility.ClsPub.BoolToString(HGiveAwayFlag) + "," + HSeOrderSEQ.ToString() + "," + HSourceEntryID.ToString() |
| | | + ", " + (HProduceDate == "" ? "NULL" : "'" + HProduceDate + "'") + "," + (HExpiryDate == "" ? "NULL" : "'" + HExpiryDate + "'") |
| | | + ", " + DBUtility.ClsPub.BoolToString(HISKFPERIOD) + ",'" + HEXPUNIT + "'," + HEXPPERIOD.ToString() |
| | | + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "')"); |
| | | |
| | | |
| | | //HNumber = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMaterID2Col].Value); |
| | | //if (cmbHBarCodeType.Text == "å¯ä¸æ¡ç ") |
| | | //{ |
| | | // if (CampanyName == "åå") //ç³»ç»åæ° å®¢æ·å®å¶ååç§° |
| | | // { |
| | | // //æ¡ç åç¼ = ç©æä»£ç + å¹´ + æ + æ¥ |
| | | // sTMNumber = HNumber + sYear + sPeriod + sDay; |
| | | // } |
| | | // else if (CampanyName == "é£é¾") |
| | | // { |
| | | // string HWorksNumber = ""; |
| | | // HWorksNumber = cmbHWorksNumber.Text; |
| | | // if (HWorksNumber == "") |
| | | // { |
| | | // MessageBox.Show("å·¥å代ç ä¸è½ä¸ºç©ºï¼"); |
| | | // return; |
| | | // } |
| | | // //æ¡ç åç¼ = å·¥å代ç + ç©æå
ç + æ¥æ |
| | | // sTMNumber = HWorksNumber + HNumber + sYear + sPeriod + sDay; |
| | | // } |
| | | // else //éç¨æ¹æ³ |
| | | // { |
| | | // //æ¡ç åç¼ = ç»ç»ä»£ç + ç©æä»£ç + å¹´ + æ + æ¥ |
| | | // sTMNumber = HOrgNumber + HNumber + sYear + sPeriod + sDay; |
| | | // } |
| | | //} |
| | | //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | } |
| | | } |
| | | //å¢å æ¡ç è¶
è¿æªçæåè½æ§å¶ |
| | | |
| | | // |
| | | oCn.Commit(); |
| | | //MessageBox.Show("æ¡ç çæå®æ¯ï¼"); |
| | | //grdSub.RowCount = 0; |
| | | tabControl1.SelectedIndex = 3; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCn.RollBack(); |
| | | MessageBox.Show("æ¡ç çæå¤±è´¥ï¼" + e.Message); |
| | | grdSub.RowCount = 0; |
| | | } |
| | | } |
| | | |
| | | private string getBatchNo() |
| | | { |
| | | string HBatchNo = ""; |
| | | |
| | | if (radioButton_HIsUsingBatchNo.Checked) |
| | | { |
| | | //æ¥æè·åæ¹å¼ |
| | | string sDate = dtpHDate.Value.ToShortDateString(); // |
| | | string sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2); |
| | | string sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString(); |
| | | sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2); |
| | | string sDay = "0" + ClsPub.isDate(sDate).Day.ToString(); |
| | | sDay = sDay.Substring(sDay.Length - 2, 2); |
| | | |
| | | string HDate = "20" + sYear + "-" + sPeriod + "-" + sDay; |
| | | |
| | | //è·åæµæ°´å·ï¼åä½ï¼è¯¥ç©æå½å¤©çæçæ¡ç æ° |
| | | string LIU = ""; |
| | | int LEN = 4; |
| | | DataSet ds; |
| | | string sql = "select * from h_v_IF_BarCodeBillList Where HMaterID = " + grdMain.Rows[0].Cells[HMaterIDCol].Value + " and HSTOCKORGID = " + HOrgID + " and CONVERT(varchar(100),æ¡ç æ¥æ, 23) = '" + HDate + "' order by æ¹å· desc"; |
| | | ds = oCn.RunProcReturn(sql, "h_v_IF_BarCodeBillList"); |
| | | if (ds != null) |
| | | { |
| | | long count = ClsPub.isLong(ds.Tables[0].Rows[0]["æ¹å·"].ToString().Replace(sYear + sPeriod + sDay, "")); |
| | | |
| | | LIU += count + 1; |
| | | while (LIU.Length < LEN) //å¦ææµæ°´å·å°äº6使°åé¢è¡¥0 |
| | | { |
| | | LIU = "0" + LIU; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return ""; |
| | | } |
| | | |
| | | //æ¼æ¥æ¹å· |
| | | HBatchNo = sYear + sPeriod + sDay + LIU; |
| | | } |
| | | |
| | | |
| | | return HBatchNo; |
| | | } |
| | | |
| | | //çææ¡ç 忥 |
| | | //ç©æç¼ç +åºåå·+çäº§æ¥æ |
| | | private void SaveBarCode_bori() |
| | | { |
| | | grdSub.Rows.Clear(); |
| | | int LSHlen = 6; //æµæ°´å·é¿åº¦ |
| | | int SumLen = 10; //æ»é¿åº¦ |
| | | string TM = ""; //æ¡ç |
| | | string HNumber = ""; //ç©æå
ç |
| | | string HMaterNumber = ""; //ç©æä»£ç |
| | | double HSumQty = 0; //äº§åæ°é |
| | | double HMinQty = 0; //æå°å
è£
æ° |
| | | Int64 HBQty = 0; //ç®±æ° |
| | | double HQty = 0; //æ°é |
| | | string WeiShu = ""; //å°¾æ° |
| | | //int LSH = 0; //æµæ°´å· |
| | | string LSH2 = ""; //æµæ°´å·è½¬æ¢æå符 |
| | | string sDate = ""; //æ¥æ |
| | | string sYear = ""; //å¹´ |
| | | string sPeriod = ""; //æ |
| | | string sDay = ""; //æ¥ |
| | | string HBatchNo = ""; //æ¹æ¬¡ |
| | | int k = 0; |
| | | int n = 0; //å䏿¹çææ¡ç ä¸çç¬¬å æ¡ |
| | | string sTMNumber = ""; //æ¡ç èªå®ä¹åç¼ |
| | | DataSet Ds; |
| | | //Ds = oCn.RunProcReturn("exec GetLSH '" + ClsPub.GetServerDate(0) + "'", "GetLSH"); |
| | | //LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]); |
| | | for (int j = 0; j < grdMain.Rows.Count; j++) |
| | | { |
| | | if (ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value) != 0) |
| | | { |
| | | HNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterIDCol].Value); |
| | | HMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterNumberCol].Value); |
| | | HBatchNo = ClsPub.isStrNull(grdMain.Rows[j].Cells[HBatchNoCol].Value); |
| | | //æ¥æè·åæ¹å¼ |
| | | sDate = dtpHDate.Value.ToShortDateString(); |
| | | // |
| | | if (cmbHBarCodeType.Text == "è¯åæåæ¡ç è§å")// å¤±ææ¥æï¼ç产订åï¼ |
| | | { |
| | | sDate = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HEndDateCol].Value); |
| | | } |
| | | // |
| | | sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2); |
| | | sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString(); |
| | | sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2); |
| | | sDay = "0" + ClsPub.isDate(sDate).Day.ToString(); |
| | | sDay = sDay.Substring(sDay.Length - 2, 2); |
| | | //================================== |
| | | //if (cmbHBarCodeType.Text == "è¯åæåæ¡ç è§å") |
| | | //{ |
| | | // //æ¡ç åç¼ = ç»ç»ä»£ç + ç©æä»£ç + å¹´ + æ + æ¥ |
| | | //sTMNumber = HMaterNumber + HNumber + sYear + sPeriod + sDay; |
| | | // Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //è·åæå¤§æµæ°´å· |
| | | // //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | // LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]); |
| | | //} |
| | | //else |
| | | //{ |
| | | // MessageBox.Show("éè¯¯çæ¡ç ç±»åï¼ä¸è½çææ¡ç ï¼"); |
| | | // return; |
| | | //} |
| | | |
| | | HBQty = HBQty + ClsPub.isLong(grdMain.Rows[j].Cells[HBQtyCol].Value); |
| | | HMinQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HMinQtyCol].Value); |
| | | HSumQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HQtyCol].Value); |
| | | n = 0; |
| | | //ä»éè¶åºåå·è¡¨è·ååºåå· |
| | | DataSet DSet = oCn.RunProcReturn("exec h_p_CLD_GetBarCodeSno " + ClsPub.isStrNull(grdMain.Rows[j].Cells[HMainIDCol].Value) + "," + ClsPub.isStrNull(grdMain.Rows[j].Cells[HSubIDCol].Value) + " ", "h_p_CLD_GetBarCodeSno", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //çæé¦è¡æ é¢ |
| | | if (DSet == null) |
| | | { |
| | | MessageBox.Show("没æè¿åä»»ä½ç»æ,éè¶äºåºåå·ä¸åå¨ï¼" + DBUtility.ClsPub.sExeReturnInfo); |
| | | continue; |
| | | } |
| | | // |
| | | |
| | | for (int i = k; i < DSet.Tables[0].Rows.Count; i++) |
| | | //for (int i = k; i < HBQty; i++) |
| | | { |
| | | if (HSumQty - HMinQty > 0) |
| | | { |
| | | WeiShu = ""; |
| | | HSumQty = HSumQty - HMinQty; |
| | | } |
| | | else |
| | | { |
| | | if (HSumQty == HMinQty) |
| | | { |
| | | WeiShu = ""; |
| | | } |
| | | else |
| | | { |
| | | WeiShu = "å°¾æ°"; |
| | | } |
| | | HMinQty = HSumQty; |
| | | } |
| | | // |
| | | //LSH = LSH + 1; |
| | | LSH2 = DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[n]["SHNO"]); |
| | | //while (LSH2.Length < LSHlen) //å¦ææµæ°´å·å°äº6使°åé¢è¡¥0 |
| | | //{ |
| | | // LSH2 = "0" + LSH2; |
| | | //} |
| | | //if (cmbHBarCodeType.Text == "å¯ä¸æ¡ç ") |
| | | //{ |
| | | //æ¡ç ç¼å· = æ¡ç åç¼ + æµæ°´å· |
| | | //T/*M*/ = HMaterNumber + LSH2 + sYear + sPeriod + sDay; |
| | | TM = LSH2 + sYear + sPeriod + sDay; |
| | | //} |
| | | |
| | | if (i + 1 > grdSub.Rows.Count) |
| | | { |
| | | grdSub.RowCount = grdSub.RowCount + 1; |
| | | } |
| | | grdSub.Rows[i].Cells[HSno2Col].Value = ClsPub.isStrNull(i + 1); |
| | | if (TM.Trim() == "") |
| | | { |
| | | MessageBox.Show("æ¡å½¢ç ä¸è½ä¸ºç©ºï¼ä¸è½çææ¡ç ï¼"); |
| | | return; |
| | | } |
| | | grdSub.Rows[i].Cells[HTMCol].Value = TM; |
| | | grdSub.Rows[i].Cells[HMaterID2Col].Value = grdMain.Rows[j].Cells[HMaterIDCol].Value; |
| | | grdSub.Rows[i].Cells[HMaterNumber2Col].Value = grdMain.Rows[j].Cells[HMaterNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HMaterName2Col].Value = grdMain.Rows[j].Cells[HMaterNameCol].Value; |
| | | grdSub.Rows[i].Cells[HMaterModel2Col].Value = grdMain.Rows[j].Cells[HMaterModelCol].Value; |
| | | grdSub.Rows[i].Cells[HPinfan2Col].Value = grdMain.Rows[j].Cells[HPinfanCol].Value; |
| | | grdSub.Rows[i].Cells[HPinfanBarCode2Col].Value = grdMain.Rows[j].Cells[HPinfanBarCodeCol].Value; |
| | | |
| | | grdSub.Rows[i].Cells[HAuxPropID2Col].Value = grdMain.Rows[j].Cells[HAuxPropIDCol].Value; |
| | | grdSub.Rows[i].Cells[HAuxPropNumber2Col].Value = grdMain.Rows[j].Cells[HAuxPropNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HAuxPropName2Col].Value = grdMain.Rows[j].Cells[HAuxPropNameCol].Value; |
| | | |
| | | grdSub.Rows[i].Cells[HUnitID2Col].Value = grdMain.Rows[j].Cells[HUnitIDCol].Value; |
| | | grdSub.Rows[i].Cells[HUnitNumber2Col].Value = grdMain.Rows[j].Cells[HUnitNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HUnitName2Col].Value = grdMain.Rows[j].Cells[HUnitNameCol].Value; |
| | | |
| | | grdSub.Rows[i].Cells[HQty2Col].Value = HMinQty; |
| | | grdSub.Rows[i].Cells[HBatchNo2Col].Value = grdMain.Rows[j].Cells[HBatchNoCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceInterID2Col].Value = grdMain.Rows[j].Cells[HMainIDCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceEntryID2Col].Value = grdMain.Rows[j].Cells[HSubIDCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceBillNo2Col].Value = grdMain.Rows[j].Cells[HBillNoCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceBillType2Col].Value = grdMain.Rows[j].Cells[HBillTypeCol].Value; |
| | | grdSub.Rows[i].Cells[HPrintCol].Value = "0"; |
| | | grdSub.Rows[i].Cells[HWeiCol].Value = WeiShu; |
| | | grdSub.Rows[i].Cells[HBarcodeNoCol].Value = n + 1; |
| | | grdSub.Rows[i].Cells[HBarcodeQtysCol].Value = grdMain.Rows[j].Cells[HBQtyCol].Value; |
| | | grdSub.Rows[i].Cells[HSupID2Col].Value = grdMain.Rows[j].Cells[HSupIDCol].Value; |
| | | grdSub.Rows[i].Cells[HSupNumber2Col].Value = grdMain.Rows[j].Cells[HSupNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HSupName2Col].Value = grdMain.Rows[j].Cells[HSupNameCol].Value; |
| | | grdSub.Rows[i].Cells[HDeptID2Col].Value = grdMain.Rows[j].Cells[HDeptIDCol].Value; |
| | | grdSub.Rows[i].Cells[HDeptNumber2Col].Value = grdMain.Rows[j].Cells[HDeptNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HDeptName2Col].Value = grdMain.Rows[j].Cells[HDeptNameCol].Value; |
| | | grdSub.Rows[i].Cells[HRemark2Col].Value = grdMain.Rows[j].Cells[HRemarkCol].Value; |
| | | grdSub.Rows[i].Cells[HDate2Col].Value = grdMain.Rows[j].Cells[HDateCol].Value; |
| | | grdSub.Rows[i].Cells[HShowDate2Col].Value = grdMain.Rows[j].Cells[HShowDateCol].Value; |
| | | grdSub.Rows[i].Cells[HWhID2Col].Value = grdMain.Rows[j].Cells[HWhIDCol].Value; |
| | | grdSub.Rows[i].Cells[HWhNumber2Col].Value = grdMain.Rows[j].Cells[HWhNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HWhName2Col].Value = grdMain.Rows[j].Cells[HWhNameCol].Value; |
| | | grdSub.Rows[i].Cells[HSPID2Col].Value = grdMain.Rows[j].Cells[HSPIDCol].Value; |
| | | grdSub.Rows[i].Cells[HSPNumber2Col].Value = grdMain.Rows[j].Cells[HSPNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HSPName2Col].Value = grdMain.Rows[j].Cells[HSPNameCol].Value; |
| | | grdSub.Rows[i].Cells[HMTONo2Col].Value = grdMain.Rows[j].Cells[HMTONoCol].Value; |
| | | grdSub.Rows[i].Cells[HCusID2Col].Value = grdMain.Rows[j].Cells[HCusIDCol].Value; |
| | | grdSub.Rows[i].Cells[HCusNumber2Col].Value = grdMain.Rows[j].Cells[HCusNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HCusName2Col].Value = grdMain.Rows[j].Cells[HCusNameCol].Value; |
| | | grdSub.Rows[i].Cells[HCusType2Col].Value = grdMain.Rows[j].Cells[HCusTypeCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceID2Col].Value = grdMain.Rows[j].Cells[HSourceIDCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceNumber2Col].Value = grdMain.Rows[j].Cells[HSourceNumberCol].Value; |
| | | grdSub.Rows[i].Cells[HSourceName2Col].Value = grdMain.Rows[j].Cells[HSourceNameCol].Value; |
| | | grdSub.Rows[i].Cells[HEndDate2Col].Value = grdMain.Rows[j].Cells[HEndDateCol].Value; |
| | | grdSub.Rows[i].Cells[HSeOrderBillNo2Col].Value = grdMain.Rows[j].Cells[HSeOrderBillNoCol].Value; |
| | | grdSub.Rows[i].Cells[HInnerBillNo2Col].Value = grdMain.Rows[j].Cells[HInnerBillNoCol].Value; |
| | | grdSub.Rows[i].Cells[HMaker2Col].Value = grdMain.Rows[j].Cells[HMakerCol].Value; |
| | | grdSub.Rows[i].Cells[HGiveAwayFlag2Col].Value = grdMain.Rows[j].Cells[HGiveAwayFlagCol].Value; |
| | | //ç½æ ¼æå¾ |
| | | DataGridViewCheckBoxCell oCell = new DataGridViewCheckBoxCell(); |
| | | oCell.ThreeState = false; |
| | | oCell.Value = grdSub.Rows[i].Cells[HGiveAwayFlag2Col].Value; |
| | | oCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; |
| | | grdSub.Rows[i].Cells[HGiveAwayFlag2Col] = oCell; |
| | | k = k + 1; |
| | | n = n + 1; |
| | | //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | } |
| | | } |
| | | } |
| | | string HWei = ""; //å°¾æ° |
| | | string HBarCode = ""; |
| | | string HBarCodeType = ""; |
| | | Int64 HMaterID = 0; |
| | | Int64 HAuxPropID = 0; |
| | | Int64 HUnitID = 0; |
| | | double HQty2 = 0; |
| | | string HBatchNo2 = ""; |
| | | Int64 HSupID = 0; |
| | | Int64 HGroupID = 0; |
| | | int HPrintQty = 0; |
| | | Int64 HSourceInterID = 0; |
| | | Int64 HSourceEntryID = 0; |
| | | string HSourceBillNo = ""; |
| | | string HSourceBillType = ""; |
| | | Int64 HBarcodeNo = 0; //æå· |
| | | Int64 HBarcodeQtys = 0; //æ»ææ° |
| | | Int64 HDeptID = 0; |
| | | Int64 HWhID = 0; |
| | | Int64 HSPID = 0; |
| | | string HRemark = ""; |
| | | string HMaterName = ""; |
| | | string HMaterModel = ""; |
| | | string HPinfan = ""; |
| | | string HMTONo = ""; |
| | | Int64 HCusID = 0; |
| | | string HCusType = ""; |
| | | DateTime HEndDate; |
| | | string HWorkLineName = ""; |
| | | string HSeOrderBillNo = ""; |
| | | string HInnerBillNo = ""; |
| | | bool HGiveAwayFlag = false; |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | for (int i = 0; i < grdSub.Rows.Count; i++) |
| | | { |
| | | if (ClsPub.isLong(grdSub.Rows[i].Cells[HMaterID2Col].Value) != 0) |
| | | { |
| | | HWei = ClsPub.isStrNull(grdSub.Rows[i].Cells[HWeiCol].Value); |
| | | HBarCode = ClsPub.isStrNull(grdSub.Rows[i].Cells[HTMCol].Value); |
| | | // |
| | | HBarCodeType = ClsPub.isStrNull(cmbHBarCodeType.Text); |
| | | if (CampanyName == "åæ¥ç§æ" || CampanyName == "å¤å®çµå¨") |
| | | { |
| | | HBarCodeType = "å¯ä¸æ¡ç "; |
| | | } |
| | | // |
| | | HMaterID = ClsPub.isLong(grdSub.Rows[i].Cells[HMaterID2Col].Value); |
| | | HAuxPropID = ClsPub.isLong(grdSub.Rows[i].Cells[HAuxPropID2Col].Value); |
| | | HUnitID = ClsPub.isLong(grdSub.Rows[i].Cells[HUnitID2Col].Value); |
| | | HQty2 = ClsPub.isDoule(grdSub.Rows[i].Cells[HQty2Col].Value); |
| | | HBatchNo2 = ClsPub.isStrNull(grdSub.Rows[i].Cells[HBatchNo2Col].Value); |
| | | HSourceInterID = ClsPub.isLong(grdSub.Rows[i].Cells[HSourceInterID2Col].Value); |
| | | HSourceEntryID = ClsPub.isLong(grdSub.Rows[i].Cells[HSourceEntryID2Col].Value); |
| | | HSourceBillNo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSourceBillNo2Col].Value); |
| | | HSourceBillType = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSourceBillType2Col].Value); |
| | | HBarcodeQtys = ClsPub.isLong(grdSub.Rows[i].Cells[HBarcodeQtysCol].Value); |
| | | HBarcodeNo = ClsPub.isLong(grdSub.Rows[i].Cells[HBarcodeNoCol].Value); |
| | | HSupID = ClsPub.isLong(grdSub.Rows[i].Cells[HSupID2Col].Value); |
| | | HDeptID = ClsPub.isLong(grdSub.Rows[i].Cells[HDeptID2Col].Value); |
| | | HWhID = ClsPub.isLong(grdSub.Rows[i].Cells[HWhID2Col].Value); |
| | | HSPID = ClsPub.isLong(grdSub.Rows[i].Cells[HSPID2Col].Value); |
| | | HRemark = ClsPub.isStrNull(grdSub.Rows[i].Cells[HRemark2Col].Value); |
| | | HMaterName = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMaterName2Col].Value); |
| | | HMaterModel = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMaterModel2Col].Value); |
| | | HPinfan = ClsPub.isStrNull(grdSub.Rows[i].Cells[HPinfan2Col].Value); |
| | | HMTONo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMTONo2Col].Value); |
| | | HCusID = ClsPub.isLong(grdSub.Rows[i].Cells[HCusID2Col].Value); |
| | | HCusType = ClsPub.isStrNull(grdSub.Rows[i].Cells[HCusType2Col].Value); |
| | | HEndDate = ClsPub.isDate(grdSub.Rows[i].Cells[HEndDate2Col].Value); |
| | | HWorkLineName = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSourceName2Col].Value); |
| | | HSeOrderBillNo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSeOrderBillNo2Col].Value); |
| | | HInnerBillNo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HInnerBillNo2Col].Value); |
| | | HGiveAwayFlag = ClsPub.isBool(grdSub.Rows[i].Cells[HGiveAwayFlag2Col].Value); |
| | | |
| | | 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 " + |
| | | ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " + |
| | | ",HGiveAwayFlag " + |
| | | ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " + |
| | | ") values (" |
| | | + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString() |
| | | + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'" + ClsPub.CurUserName + "',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString() |
| | | + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'" |
| | | + ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'" |
| | | + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + sDate + "'" |
| | | + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterID.ToString() |
| | | + ", " + DBUtility.ClsPub.BoolToString(HGiveAwayFlag) |
| | | + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "')"); |
| | | |
| | | |
| | | //HNumber = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMaterID2Col].Value); |
| | | //if (cmbHBarCodeType.Text == "å¯ä¸æ¡ç ") |
| | | //{ |
| | | // if (CampanyName == "åå") //ç³»ç»åæ° å®¢æ·å®å¶ååç§° |
| | | // { |
| | | // //æ¡ç åç¼ = ç©æä»£ç + å¹´ + æ + æ¥ |
| | | // sTMNumber = HNumber + sYear + sPeriod + sDay; |
| | | // } |
| | | // else if (CampanyName == "é£é¾") |
| | | // { |
| | | // string HWorksNumber = ""; |
| | | // HWorksNumber = cmbHWorksNumber.Text; |
| | | // if (HWorksNumber == "") |
| | | // { |
| | | // MessageBox.Show("å·¥å代ç ä¸è½ä¸ºç©ºï¼"); |
| | | // return; |
| | | // } |
| | | // //æ¡ç åç¼ = å·¥å代ç + ç©æå
ç + æ¥æ |
| | | // sTMNumber = HWorksNumber + HNumber + sYear + sPeriod + sDay; |
| | | // } |
| | | // else //éç¨æ¹æ³ |
| | | // { |
| | | // //æ¡ç åç¼ = ç»ç»ä»£ç + ç©æä»£ç + å¹´ + æ + æ¥ |
| | | // sTMNumber = HOrgNumber + HNumber + sYear + sPeriod + sDay; |
| | | // } |
| | | //} |
| | | //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | } |
| | | } |
| | | //å¢å æ¡ç è¶
è¿æªçæåè½æ§å¶ |
| | | |
| | | // |
| | | oCn.Commit(); |
| | | MessageBox.Show("æ¡ç çæå®æ¯ï¼"); |
| | | //grdSub.RowCount = 0; |
| | | tabControl1.SelectedIndex = 3; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCn.RollBack(); |
| | | MessageBox.Show("æ¡ç çæå¤±è´¥ï¼" + e.Message); |
| | | grdSub.RowCount = 0; |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region çªä½å¤çæ¹æ³ |
| | | //åå§åGRID |
| | | private void initGrid() |
| | | { |
| | | // |
| | | grdMain.RowCount = 0; |
| | | grdSub.RowCount = 0; |
| | | grdMain.ColumnCount = 68; //æ»åæ° |
| | | DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name); |
| | | grdMain.Columns[HSnoCol].HeaderText = "åºå·"; |
| | | grdMain.Columns[HMainIDCol].HeaderText = "æºå主ID"; |
| | | grdMain.Columns[HSubIDCol].HeaderText = "æºååID"; |
| | | grdMain.Columns[HBillNoCol].HeaderText = "æºååå·"; |
| | | grdMain.Columns[HBillTypeCol].HeaderText = "åæ®ç±»å"; |
| | | grdMain.Columns[HMaterIDCol].HeaderText = "ç©æID"; |
| | | grdMain.Columns[HMaterNumberCol].HeaderText = "ç©æä»£ç "; |
| | | grdMain.Columns[HMaterNameCol].HeaderText = "ç©æåç§°"; |
| | | grdMain.Columns[HMaterModelCol].HeaderText = "è§æ ¼åå·"; |
| | | grdMain.Columns[HModelCol].HeaderText = "èªå®ä¹è§æ ¼"; |
| | | grdMain.Columns[HPinfanCol].HeaderText = "åçª"; |
| | | grdMain.Columns[HPinfanBarCodeCol].HeaderText = "HPinfanBarCode"; |
| | | grdMain.Columns[HAuxPropIDCol].HeaderText = "è¾
å©å±æ§ID"; |
| | | grdMain.Columns[HAuxPropNumberCol].HeaderText = "è¾
å©å±æ§ä»£ç "; |
| | | grdMain.Columns[HAuxPropNameCol].HeaderText = "è¾
å©å±æ§åç§°"; |
| | | grdMain.Columns[HUnitIDCol].HeaderText = "计éåä½ID"; |
| | | grdMain.Columns[HUnitNumberCol].HeaderText = "计éåä½ä»£ç "; |
| | | grdMain.Columns[HUnitNameCol].HeaderText = "计éåä½åç§°"; |
| | | grdMain.Columns[HBarCodeTypeCol].HeaderText = "æ¡ç ç±»å"; |
| | | grdMain.Columns[HBatchManagerCol].HeaderText = "æ¯å¦å¯ç¨æ¹æ¬¡"; |
| | | grdMain.Columns[HBatchNoCol].HeaderText = "æ¹å·"; |
| | | grdMain.Columns[HGiveAwayFlagCol].HeaderText = "æ¯å¦èµ å"; |
| | | grdMain.Columns[HQtyCol].HeaderText = "æ°é"; |
| | | grdMain.Columns[HMinQtyCol].HeaderText = "æå°å
è£
æ°"; |
| | | grdMain.Columns[HPackQtyCol].HeaderText = "å¤ç®±æ°"; |
| | | grdMain.Columns[HBQtyCol].HeaderText = "ç®±æ°"; |
| | | grdMain.Columns[HSupIDCol].HeaderText = "ä¾åºåID"; |
| | | grdMain.Columns[HSupNumberCol].HeaderText = "ä¾åºå代ç "; |
| | | grdMain.Columns[HSupNameCol].HeaderText = "ä¾åºå"; |
| | | grdMain.Columns[HDeptIDCol].HeaderText = "车é´ID"; |
| | | grdMain.Columns[HDeptNumberCol].HeaderText = "车é´ä»£ç "; |
| | | grdMain.Columns[HDeptNameCol].HeaderText = "车é´"; |
| | | grdMain.Columns[HWhIDCol].HeaderText = "ä»åºID"; |
| | | grdMain.Columns[HWhNumberCol].HeaderText = "ä»åºä»£ç "; |
| | | grdMain.Columns[HWhNameCol].HeaderText = "ä»åº"; |
| | | grdMain.Columns[HSPIDCol].HeaderText = "ä»ä½ID"; |
| | | grdMain.Columns[HSPNumberCol].HeaderText = "ä»ä½ä»£ç "; |
| | | grdMain.Columns[HSPNameCol].HeaderText = "ä»ä½"; |
| | | grdMain.Columns[HInstructNoCol].HeaderText = "æä»¤åå·"; |
| | | grdMain.Columns[HSeOrderBillNoCol].HeaderText = "éå®è®¢åå·"; |
| | | grdMain.Columns[HSeOrderSEQCol].HeaderText = "éå®è®¢åè¡å·"; |
| | | grdMain.Columns[HDateCol].HeaderText = "è¿ææ¥æ"; |
| | | grdMain.Columns[HRemarkCol].HeaderText = "夿³¨"; |
| | | grdMain.Columns[HMTONoCol].HeaderText = "计åè·è¸ªå·"; |
| | | grdMain.Columns[HCusIDCol].HeaderText = "客æ·ID"; |
| | | grdMain.Columns[HCusNumberCol].HeaderText = "客æ·ä»£ç "; |
| | | grdMain.Columns[HCusNameCol].HeaderText = "客æ·"; |
| | | grdMain.Columns[HCusTypeCol].HeaderText = "客æ·åå·"; |
| | | grdMain.Columns[HEndDateCol].HeaderText = "计åå®å·¥æ¥æ"; |
| | | grdMain.Columns[HSourceIDCol].HeaderText = "ç产线ID"; |
| | | grdMain.Columns[HSourceNumberCol].HeaderText = "ç产线代ç "; |
| | | grdMain.Columns[HSourceNameCol].HeaderText = "ç产线"; |
| | | grdMain.Columns[HShowDateCol].HeaderText = "æ¥æ"; |
| | | grdMain.Columns[HInnerBillNoCol].HeaderText = "å
é¨éè´è®¢åå·"; |
| | | grdMain.Columns[HMakerCol].HeaderText = "å¶å人"; |
| | | grdMain.Columns[HProduceDateCol].HeaderText = "çäº§æ¥æ"; |
| | | grdMain.Columns[HExpiryDateCol].HeaderText = "æææè³"; |
| | | grdMain.Columns[HISKFPERIODCol].HeaderText = "æ¯å¦å¯ç¨ä¿è´¨æ"; |
| | | grdMain.Columns[HEXPUNITCol].HeaderText = "ä¿è´¨æåä½"; |
| | | grdMain.Columns[HEXPPERIODCol].HeaderText = "ä¿è´¨æ"; |
| | | //// |
| | | //æ ¼å¼å |
| | | grdMain.Columns[HTagCol].Visible = false; //éèå |
| | | grdMain.Columns[HMainIDCol].Visible = false; |
| | | grdMain.Columns[HSubIDCol].Visible = false; |
| | | grdMain.Columns[HBillTypeCol].Visible = false; |
| | | grdMain.Columns[HMaterIDCol].Visible = false; |
| | | grdMain.Columns[HModelCol].Visible = false; |
| | | //grdMain.Columns[HBatchNoCol].Visible = false; |
| | | grdMain.Columns[HAuxPropIDCol].Visible = false; |
| | | //grdMain.Columns[HAuxPropNumberCol].Visible = false; |
| | | //grdMain.Columns[HAuxPropNameCol].Visible = false; |
| | | grdMain.Columns[HUnitIDCol].Visible = false; |
| | | grdMain.Columns[HinitQtyCol].Visible = false; |
| | | grdMain.Columns[HSupIDCol].Visible = false; |
| | | grdMain.Columns[HSupNumberCol].Visible = false; |
| | | grdMain.Columns[HSupNameCol].Visible = false; |
| | | grdMain.Columns[HDeptIDCol].Visible = false; |
| | | grdMain.Columns[HDeptNumberCol].Visible = false; |
| | | grdMain.Columns[HDeptNameCol].Visible = false; |
| | | grdMain.Columns[HWhIDCol].Visible = false; |
| | | grdMain.Columns[HWhNumberCol].Visible = false; |
| | | grdMain.Columns[HWhNameCol].Visible = false; |
| | | grdMain.Columns[HSPIDCol].Visible = false; |
| | | grdMain.Columns[HSPNumberCol].Visible = false; |
| | | grdMain.Columns[HSPNameCol].Visible = false; |
| | | grdMain.Columns[HSourceInterIDCol].Visible = false; |
| | | grdMain.Columns[HSourceEntryIDCol].Visible = false; |
| | | grdMain.Columns[HSourceBillNoCol].Visible = false; |
| | | grdMain.Columns[HSourceBillTypeCol].Visible = false; |
| | | grdMain.Columns[HInstructIDCol].Visible = false; |
| | | grdMain.Columns[HInstructNoCol].Visible = false; |
| | | grdMain.Columns[HSeOrderBillIDCol].Visible = false; |
| | | //grdMain.Columns[HSeOrderBillNoCol].Visible = false; |
| | | grdMain.Columns[HBarCodeTypeCol].Visible = false; |
| | | grdMain.Columns[HBatchManagerCol].Visible = false; |
| | | //grdMain.Columns[HDateCol].Visible = false; |
| | | grdMain.Columns[HPinfanCol].Visible = false; |
| | | grdMain.Columns[HPinfanBarCodeCol].Visible = false; |
| | | grdMain.Columns[HCusIDCol].Visible = false; |
| | | //grdMain.Columns[HCusNumberCol].Visible = false; |
| | | //grdMain.Columns[HCusNameCol].Visible = false; |
| | | grdMain.Columns[HCusTypeCol].Visible = false; |
| | | grdMain.Columns[HEndDateCol].Visible = false; |
| | | grdMain.Columns[HSourceIDCol].Visible = false; |
| | | grdMain.Columns[HSourceNumberCol].Visible = false; |
| | | grdMain.Columns[HSourceNameCol].Visible = false; |
| | | //grdMain.Columns[HProduceDateCol].Visible = false; |
| | | //grdMain.Columns[HExpiryDateCol].Visible = false; |
| | | grdMain.Columns[HISKFPERIODCol].Visible = false; |
| | | grdMain.Columns[HEXPUNITCol].Visible = false; |
| | | grdMain.Columns[HEXPPERIODCol].Visible = false; |
| | | |
| | | //设置å¯ç¼è¾å |
| | | string sAllowCol = HQtyCol.ToString() + |
| | | "," + HMinQtyCol.ToString() + |
| | | "," + HMaterNumberCol.ToString() + |
| | | "," + HAuxPropNumberCol.ToString() + |
| | | "," + HUnitNumberCol.ToString() + |
| | | "," + HSeOrderBillNoCol.ToString() + |
| | | "," + HBatchNoCol.ToString() + |
| | | "," + HCusNumberCol.ToString() + |
| | | "," + HPackQtyCol.ToString() + |
| | | "," + HRemarkCol.ToString(); |
| | | //设置å计å |
| | | string sTotalCol = HQtyCol.ToString(); |
| | | |
| | | //è®¾ç½®ç¹æ®å |
| | | for (int i = 0; i < grdMain.Rows.Count; i++) |
| | | { |
| | | //ç½æ ¼æå¾ |
| | | DataGridViewCheckBoxCell oCell = new DataGridViewCheckBoxCell(); |
| | | oCell.ThreeState = false; |
| | | oCell.Value = 0; |
| | | oCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; |
| | | grdMain.Rows[i].Cells[HGiveAwayFlagCol] = oCell; |
| | | } |
| | | // |
| | | |
| | | DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol, oSumGrid); |
| | | //---------------------------- |
| | | |
| | | grdSub.ColumnCount = 65; //æ»åæ° |
| | | DBUtility.Xt_BaseBillFun.initGridFst(grdSub, this.Name); |
| | | grdSub.Columns[HSelectCol].HeaderText = "éæ©"; |
| | | grdSub.Columns[HTMCol].HeaderText = "æ¡ç ç¼å·"; |
| | | grdSub.Columns[HBarCodeType2Col].HeaderText = "æ¡ç ç±»å"; |
| | | grdSub.Columns[HSno2Col].HeaderText = "åºå·"; |
| | | grdSub.Columns[HMaterID2Col].HeaderText = "ç©æID"; |
| | | grdSub.Columns[HMaterNumber2Col].HeaderText = "ç©æä»£ç "; |
| | | grdSub.Columns[HMaterName2Col].HeaderText = "ç©æåç§°"; |
| | | grdSub.Columns[HMaterModel2Col].HeaderText = "è§æ ¼åå·"; |
| | | grdSub.Columns[HModel2Col].HeaderText = "èªå®ä¹è§æ ¼"; |
| | | grdSub.Columns[HAuxPropID2Col].HeaderText = "è¾
å©å±æ§ID"; |
| | | grdSub.Columns[HAuxPropNumber2Col].HeaderText = "è¾
å©å±æ§ä»£ç "; |
| | | grdSub.Columns[HAuxPropName2Col].HeaderText = "è¾
å©å±æ§"; |
| | | grdSub.Columns[HPinfan2Col].HeaderText = "åçª"; |
| | | grdSub.Columns[HPinfanBarCode2Col].HeaderText = "HPinfanBarCode"; |
| | | grdSub.Columns[HBatchNo2Col].HeaderText = "æ¹å·"; |
| | | grdSub.Columns[HGiveAwayFlag2Col].HeaderText = "æ¯å¦èµ å"; |
| | | grdSub.Columns[HUnitID2Col].HeaderText = "计éåä½ID"; |
| | | grdSub.Columns[HUnitNumber2Col].HeaderText = "计éåä½ä»£ç "; |
| | | grdSub.Columns[HUnitName2Col].HeaderText = "计éåä½"; |
| | | grdSub.Columns[HQty2Col].HeaderText = "æ°é"; |
| | | grdSub.Columns[HWeiCol].HeaderText = "å°¾æ°"; |
| | | grdSub.Columns[HPrintCol].HeaderText = "æå°æ¬¡æ°"; |
| | | grdSub.Columns[HSourceInterID2Col].HeaderText = "æºå主ID"; |
| | | grdSub.Columns[HSourceEntryID2Col].HeaderText = "æºååID"; |
| | | grdSub.Columns[HSourceBillNo2Col].HeaderText = "æºååå·"; |
| | | grdSub.Columns[HSourceBillType2Col].HeaderText = "æºåç±»å"; |
| | | grdSub.Columns[HSeOrderBillNo2Col].HeaderText = "éå®è®¢åå·"; |
| | | grdSub.Columns[HSeOrderSEQ2Col].HeaderText = "éå®è®¢åè¡å·"; |
| | | grdSub.Columns[HBarcodeNoCol].HeaderText = "æå·"; |
| | | grdSub.Columns[HBarcodeQtysCol].HeaderText = "æ»ææ°"; |
| | | grdSub.Columns[HSupID2Col].HeaderText = "ä¾åºåID"; |
| | | grdSub.Columns[HSupNumber2Col].HeaderText = "ä¾åºå代ç "; |
| | | grdSub.Columns[HSupName2Col].HeaderText = "ä¾åºå"; |
| | | grdSub.Columns[HDeptID2Col].HeaderText = "车é´ID"; |
| | | grdSub.Columns[HDeptNumber2Col].HeaderText = "车é´ä»£ç "; |
| | | grdSub.Columns[HDeptName2Col].HeaderText = "车é´"; |
| | | grdSub.Columns[HWhID2Col].HeaderText = "ä»åºID"; |
| | | grdSub.Columns[HWhNumber2Col].HeaderText = "ä»åºä»£ç "; |
| | | grdSub.Columns[HWhName2Col].HeaderText = "ä»åº"; |
| | | grdSub.Columns[HSPID2Col].HeaderText = "ä»ä½ID"; |
| | | grdSub.Columns[HSPNumber2Col].HeaderText = "ä»ä½ä»£ç "; |
| | | grdSub.Columns[HSPName2Col].HeaderText = "ä»ä½"; |
| | | grdSub.Columns[HInstructNo2Col].HeaderText = "æä»¤åå·"; |
| | | grdSub.Columns[HDate2Col].HeaderText = "è¿ææ¥æ"; |
| | | grdSub.Columns[HRemark2Col].HeaderText = "夿³¨"; |
| | | grdSub.Columns[HMTONo2Col].HeaderText = "计åè·è¸ªå·"; |
| | | grdSub.Columns[HCusID2Col].HeaderText = "客æ·ID"; |
| | | grdSub.Columns[HCusNumber2Col].HeaderText = "客æ·ä»£ç "; |
| | | grdSub.Columns[HCusName2Col].HeaderText = "客æ·"; |
| | | grdSub.Columns[HCusType2Col].HeaderText = "客æ·åå·"; |
| | | grdSub.Columns[HEndDate2Col].HeaderText = "计åå®å·¥æ¥æ"; |
| | | grdSub.Columns[HSourceID2Col].HeaderText = "ç产线ID"; |
| | | grdSub.Columns[HSourceNumber2Col].HeaderText = "ç产线代ç "; |
| | | grdSub.Columns[HSourceName2Col].HeaderText = "ç产线"; |
| | | grdSub.Columns[HShowDate2Col].HeaderText = "æ¥æ"; |
| | | grdSub.Columns[HInnerBillNo2Col].HeaderText = "å
é¨éè´è®¢åå·"; |
| | | grdSub.Columns[HMaker2Col].HeaderText = "å¶å人"; |
| | | grdSub.Columns[HEntryID2Col].HeaderText = "è¡å·"; |
| | | grdSub.Columns[HProduceDate2Col].HeaderText = "çäº§æ¥æ"; |
| | | grdSub.Columns[HExpiryDate2Col].HeaderText = "æææè³"; |
| | | grdSub.Columns[HISKFPERIOD2Col].HeaderText = "æ¯å¦å¯ç¨ä¿è´¨æ"; |
| | | grdSub.Columns[HEXPUNIT2Col].HeaderText = "ä¿è´¨æåä½"; |
| | | grdSub.Columns[HEXPPERIOD2Col].HeaderText = "ä¿è´¨æ"; |
| | | //æ ¼å¼å |
| | | grdSub.Columns[HMaterID2Col].Visible = false; |
| | | grdSub.Columns[HModel2Col].Visible = false; |
| | | grdSub.Columns[HAuxPropID2Col].Visible = false; |
| | | //grdSub.Columns[HAuxPropNumber2Col].Visible = false; |
| | | //grdSub.Columns[HAuxPropName2Col].Visible = false; |
| | | grdSub.Columns[HUnitID2Col].Visible = false; |
| | | grdSub.Columns[HPrintCol].Visible = false; |
| | | grdSub.Columns[HSourceInterID2Col].Visible = false; |
| | | grdSub.Columns[HSourceEntryID2Col].Visible = false; |
| | | grdSub.Columns[HSourceBillType2Col].Visible = false; |
| | | grdSub.Columns[HDeptID2Col].Visible = false; |
| | | grdSub.Columns[HDeptNumber2Col].Visible = false; |
| | | grdSub.Columns[HDeptName2Col].Visible = false; |
| | | //grdSub.Columns[HDate2Col].Visible = false; |
| | | grdSub.Columns[HBarCodeType2Col].Visible = false; |
| | | //grdSub.Columns[HBatchNo2Col].Visible = false; |
| | | grdSub.Columns[HWeiCol].Visible = false; |
| | | grdSub.Columns[HBarcodeNoCol].Visible = false; |
| | | grdSub.Columns[HBarcodeQtysCol].Visible = false; |
| | | grdSub.Columns[HSupID2Col].Visible = false; |
| | | grdSub.Columns[HSupNumber2Col].Visible = false; |
| | | grdSub.Columns[HSupName2Col].Visible = false; |
| | | grdSub.Columns[HWhID2Col].Visible = false; |
| | | grdSub.Columns[HWhNumber2Col].Visible = false; |
| | | grdSub.Columns[HWhName2Col].Visible = false; |
| | | grdSub.Columns[HSPID2Col].Visible = false; |
| | | grdSub.Columns[HSPNumber2Col].Visible = false; |
| | | grdSub.Columns[HSPName2Col].Visible = false; |
| | | grdSub.Columns[HInstructID2Col].Visible = false; |
| | | grdSub.Columns[HInstructNo2Col].Visible = false; |
| | | grdSub.Columns[HSeOrderBillID2Col].Visible = false; |
| | | //grdSub.Columns[HSeOrderBillNo2Col].Visible = false; |
| | | grdSub.Columns[HPinfan2Col].Visible = false; |
| | | grdSub.Columns[HPinfanBarCode2Col].Visible = false; |
| | | grdSub.Columns[HCusID2Col].Visible = false; |
| | | //grdSub.Columns[HCusNumber2Col].Visible = false; |
| | | //grdSub.Columns[HCusName2Col].Visible = false; |
| | | grdSub.Columns[HCusType2Col].Visible = false; |
| | | grdSub.Columns[HEndDate2Col].Visible = false; |
| | | grdSub.Columns[HSourceID2Col].Visible = false; |
| | | grdSub.Columns[HSourceNumber2Col].Visible = false; |
| | | grdSub.Columns[HSourceName2Col].Visible = false; |
| | | |
| | | //è®¾ç½®ç¹æ®å |
| | | for (int i = 0; i < grdSub.Rows.Count; i++) |
| | | { |
| | | //ç½æ ¼æå¾ |
| | | //æ¯å¦èµ å |
| | | DataGridViewCheckBoxCell oCell = new DataGridViewCheckBoxCell(); |
| | | oCell.ThreeState = false; |
| | | oCell.Value = 0; |
| | | oCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; |
| | | grdSub.Rows[i].Cells[HGiveAwayFlag2Col] = oCell; |
| | | //æ¯å¦å¯ç¨ä¿è´¨æ |
| | | DataGridViewCheckBoxCell oCell2 = new DataGridViewCheckBoxCell(); |
| | | oCell2.ThreeState = false; |
| | | oCell2.Value = 0; |
| | | oCell2.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; |
| | | grdSub.Rows[i].Cells[HISKFPERIOD2Col] = oCell2; |
| | | } |
| | | |
| | | DBUtility.Xt_BaseBillFun.GetGrid(grdMain, this.Name); |
| | | DBUtility.Xt_BaseBillFun.GetGrid(grdSub, this.Name + "grdSub"); |
| | | grdSub.SelectionMode = DataGridViewSelectionMode.FullRowSelect; //éè¡æ¨¡å¼ |
| | | |
| | | //// |
| | | DBUtility.Xt_BaseBillFun.initGridList(grdList, this.Name + "grdList"); |
| | | DBUtility.Xt_BaseBillFun.initGridList(grdBillBarCodeList, this.Name + "grdBillBarCodeList"); |
| | | //// |
| | | } |
| | | |
| | | |
| | | //å
¬å¼éç® |
| | | private void RowCount(int sRow, int sTag) |
| | |
| | | } |
| | | return true; |
| | | } |
| | | //帮å©å½æ° |
| | | private void Sub_GridKey(int sKeyCode, int sRow, int sCol, DataGridViewTextBoxEditingControl oEdit) |
| | | { |
| | | DataSet oDs = new DataSet(); |
| | | DataSet oDs2 = new DataSet(); |
| | | long sHMaterID = 0; |
| | | long sHAuxPropID = 0; |
| | | long sHOrgID = -1; |
| | | string sWhere = ""; |
| | | |
| | | DAL.ClsGy_ORGANIZATIONS_View oClsGy_ORGANIZATIONS_View = new DAL.ClsGy_ORGANIZATIONS_View(); |
| | | if (oClsGy_ORGANIZATIONS_View.GetInfoByName(cmbHOrgID.Text)) |
| | | { |
| | | sHOrgID = oClsGy_ORGANIZATIONS_View.omodel.HItemID; |
| | | } |
| | | if (sHOrgID == -1) |
| | | { |
| | | MessageBox.Show("éæ©ç»ç»æé误ï¼"); |
| | | return; |
| | | } |
| | | DAL.ClsIF_Material_View oMater = new DAL.ClsIF_Material_View();//ç©æ |
| | | DAL.ClsIF_Unit_View oUnit = new DAL.ClsIF_Unit_View();//计éåä½ |
| | | DAL.ClsIF_Property_View oProperty = new DAL.ClsIF_Property_View();//è¾
å©å±æ§ |
| | | if (!grdStatus) |
| | | { |
| | | return; |
| | | } |
| | | //if (oSumGrid.FindAllowEditCol(sCol)) |
| | | //{ |
| | | oSumGrid.EditStatus = true; |
| | | //} |
| | | //else |
| | | //{ |
| | | // return; |
| | | //} |
| | | switch (sKeyCode) |
| | | { |
| | | case 118: //F7 |
| | | { |
| | | switch (sCol) |
| | | { |
| | | case HMaterNumberCol: |
| | | oMater.WherePart = ""; |
| | | sWhere = " and HUSEORGID = " + sHOrgID; |
| | | if (oMater.RefreshViewForBig(sWhere)) |
| | | { |
| | | if (oMater.GetInfoByID(oMater.oModel.HItemID)) |
| | | { |
| | | grdMain.Rows[sRow].Cells[HMaterIDCol].Value = oMater.omodel.HItemID.ToString(); |
| | | grdMain.Rows[sRow].Cells[HMaterNumberCol].Value = oMater.omodel.HNumber; |
| | | grdMain.Rows[sRow].Cells[HMaterNameCol].Value = oMater.omodel.HName; |
| | | grdMain.Rows[sRow].Cells[HMaterModelCol].Value = oMater.omodel.HModel; |
| | | grdMain.Rows[sRow].Cells[HMinQtyCol].Value = oMater.omodel.HQtyMin; |
| | | grdMain.Rows[sRow].Cells[HDateCol].Value = dtpHDate.Value.ToShortDateString(); |
| | | grdMain.Rows[sRow].Cells[HShowDateCol].Value = dtpHDate.Value.ToShortDateString(); |
| | | grdMain.Rows[sRow].Cells[HAuxPropIDCol].Value = 0; |
| | | grdMain.Rows[sRow].Cells[HAuxPropNumberCol].Value = ""; |
| | | grdMain.Rows[sRow].Cells[HAuxPropNameCol].Value = ""; |
| | | if (oUnit.GetInfoByID(oMater.omodel.HUnitID)) |
| | | { |
| | | grdMain.Rows[sRow].Cells[HUnitIDCol].Value = oUnit.omodel.HItemID.ToString(); |
| | | grdMain.Rows[sRow].Cells[HUnitNumberCol].Value = oUnit.omodel.HNumber; |
| | | grdMain.Rows[sRow].Cells[HUnitNameCol].Value = oUnit.omodel.HName; |
| | | } |
| | | else |
| | | { |
| | | grdMain.Rows[sRow].Cells[HUnitIDCol].Value = 0; |
| | | grdMain.Rows[sRow].Cells[HUnitNumberCol].Value = ""; |
| | | grdMain.Rows[sRow].Cells[HUnitNameCol].Value = ""; |
| | | } |
| | | if (CampanyName == "䏿§") |
| | | { |
| | | grdMain.Rows[sRow].Cells[HQtyCol].Value = oMater.omodel.HQtyMin; |
| | | grdMain.Rows[sRow].Cells[HBQtyCol].Value = 1; |
| | | } |
| | | oEdit.Text = oMater.omodel.HNumber; |
| | | } |
| | | else |
| | | { |
| | | grdMain.Rows[sRow].Cells[HMaterIDCol].Value = 0; |
| | | grdMain.Rows[sRow].Cells[HMaterNumberCol].Value = ""; |
| | | grdMain.Rows[sRow].Cells[HMaterNameCol].Value = ""; |
| | | grdMain.Rows[sRow].Cells[HMaterModelCol].Value = ""; |
| | | grdMain.Rows[sRow].Cells[HMinQtyCol].Value = 0; |
| | | grdMain.Rows[sRow].Cells[HUnitIDCol].Value = 0; |
| | | grdMain.Rows[sRow].Cells[HUnitNumberCol].Value = ""; |
| | | grdMain.Rows[sRow].Cells[HUnitNameCol].Value = ""; |
| | | grdMain.Rows[sRow].Cells[HAuxPropIDCol].Value = 0; |
| | | grdMain.Rows[sRow].Cells[HAuxPropNumberCol].Value = ""; |
| | | grdMain.Rows[sRow].Cells[HAuxPropNameCol].Value = ""; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | grdMain.Rows[sRow].Cells[HMaterIDCol].Value = 0; |
| | | grdMain.Rows[sRow].Cells[HMaterNumberCol].Value = ""; |
| | | grdMain.Rows[sRow].Cells[HMaterNameCol].Value = ""; |
| | | grdMain.Rows[sRow].Cells[HMaterModelCol].Value = ""; |
| | | grdMain.Rows[sRow].Cells[HMinQtyCol].Value = 0; |
| | | grdMain.Rows[sRow].Cells[HUnitIDCol].Value = 0; |
| | | grdMain.Rows[sRow].Cells[HUnitNumberCol].Value = ""; |
| | | grdMain.Rows[sRow].Cells[HUnitNameCol].Value = ""; |
| | | grdMain.Rows[sRow].Cells[HAuxPropIDCol].Value = 0; |
| | | grdMain.Rows[sRow].Cells[HAuxPropNumberCol].Value = ""; |
| | | grdMain.Rows[sRow].Cells[HAuxPropNameCol].Value = ""; |
| | | } |
| | | break; |
| | | |
| | | case HUnitNumberCol: |
| | | oUnit.WherePart = ""; |
| | | if (oUnit.RefreshView()) |
| | | { |
| | | grdMain.Rows[sRow].Cells[HUnitIDCol].Value = oUnit.oModel.HItemID.ToString(); |
| | | grdMain.Rows[sRow].Cells[HUnitNumberCol].Value = oUnit.oModel.HNumber; |
| | | grdMain.Rows[sRow].Cells[HUnitNameCol].Value = oUnit.oModel.HName; |
| | | EditingControl.Text = oUnit.oModel.HNumber; |
| | | } |
| | | else |
| | | { |
| | | grdMain.Rows[sRow].Cells[HUnitIDCol].Value = 0; |
| | | grdMain.Rows[sRow].Cells[HUnitNumberCol].Value = ""; |
| | | grdMain.Rows[sRow].Cells[HUnitNameCol].Value = ""; |
| | | } |
| | | break; |
| | | |
| | | case HDeptNumberCol: |
| | | BLL.ClsBaseSelect_InterFace.SetGridByDept(grdMain, sRow, HDeptIDCol, HDeptNumberCol, HDeptNameCol); |
| | | oEdit.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[sRow].Cells[HDeptNumberCol].Value); |
| | | break; |
| | | |
| | | case HCusNumberCol: |
| | | BLL.ClsBaseSelect_InterFace.SetGridByCus(grdMain, sRow, HCusIDCol, HCusNumberCol, HCusNameCol); |
| | | oEdit.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[sRow].Cells[HCusNumberCol].Value); |
| | | break; |
| | | |
| | | case HDateCol: |
| | | BLL.ClsPub_BLL.Sub_SelectDate(grdMain, sRow, HDateCol); |
| | | oEdit.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[sRow].Cells[HDateCol].Value); |
| | | break; |
| | | |
| | | case HAuxPropNumberCol: |
| | | oProperty.WherePart = ""; |
| | | if (ERPMode == "CLOUD") |
| | | { |
| | | sWhere = " and HMaterNumber = '" + DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.CurrentCell.RowIndex].Cells[HMaterNumberCol].Value) + "'"; |
| | | } |
| | | else |
| | | { |
| | | sWhere = ""; |
| | | } |
| | | if (oProperty.RefreshView(sWhere)) |
| | | { |
| | | grdMain.Rows[sRow].Cells[HAuxPropIDCol].Value = oProperty.oModel.HItemID.ToString(); |
| | | grdMain.Rows[sRow].Cells[HAuxPropNumberCol].Value = oProperty.oModel.HNumber; |
| | | grdMain.Rows[sRow].Cells[HAuxPropNameCol].Value = oProperty.oModel.HName; |
| | | oEdit.Text = oProperty.oModel.HNumber; |
| | | } |
| | | else |
| | | { |
| | | grdMain.Rows[sRow].Cells[HAuxPropIDCol].Value = 0; |
| | | grdMain.Rows[sRow].Cells[HAuxPropNumberCol].Value = ""; |
| | | grdMain.Rows[sRow].Cells[HAuxPropNameCol].Value = ""; |
| | | } |
| | | break; |
| | | |
| | | |
| | | default: |
| | | break; |
| | | } |
| | | bc.Enabled = true; |
| | | break; |
| | | } |
| | | case 117: //F6 |
| | | { |
| | | switch (sCol) |
| | | { |
| | | |
| | | |
| | | default: |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | //éåå |
| | | private void cmdSourceBillNo_Click(object sender, EventArgs e) |
| | | { |
| | | DAL.ClsGy_ORGANIZATIONS_View oClsGy_ORGANIZATIONS_View = new DAL.ClsGy_ORGANIZATIONS_View(); |
| | | if (oClsGy_ORGANIZATIONS_View.GetInfoByName(cmbHOrgID.Text)) |
| | | { |
| | | HOrgID = oClsGy_ORGANIZATIONS_View.omodel.HItemID; |
| | | } |
| | | if (HOrgID == -1) |
| | | { |
| | | MessageBox.Show("éæ©ç»ç»æé误ï¼"); |
| | | return; |
| | | } |
| | | |
| | | if (cmbSourceBillType.Text.Trim() == "ç产订å") |
| | | { |
| | | string sWhere = ""; |
| | | //ç³»ç»åæ°ï¼çææ¡ç æ°éå¯å¦è¶
æºåæ°éæ§å¶ï¼N为ä¸å¯è¶
æºåæ°éï¼ |
| | | if (SourceQtyCtl == "N") |
| | | { |
| | | sWhere = " and HOrgID =" + HOrgID.ToString() + " and 任塿°é>0"; |
| | | } |
| | | else |
| | | { |
| | | sWhere = " and HOrgID =" + HOrgID.ToString(); |
| | | } |
| | | |
| | | DAL.Cls_S_IFCLD_ICMOList oIFCLD_ICMOList = new DAL.Cls_S_IFCLD_ICMOList(); |
| | | if (oIFCLD_ICMOList.Refresh(sWhere)) //éæ©åå |
| | | { |
| | | FillSelectData(oIFCLD_ICMOList.oBillSelectColl); |
| | | } |
| | | } |
| | | else if (cmbSourceBillType.Text.Trim() == "çäº§æ±æ¥å") |
| | | { |
| | | string sWhere = " and HOrgID =" + HOrgID.ToString(); |
| | | DAL.Cls_S_IF_ICMOReportBillList oIF_ICMOReportBillList = new DAL.Cls_S_IF_ICMOReportBillList(); |
| | | if (oIF_ICMOReportBillList.Refresh(sWhere)) //éæ©åå |
| | | { |
| | | FillSelectData(oIF_ICMOReportBillList.oBillSelectColl); |
| | | } |
| | | } |
| | | else if (cmbSourceBillType.Text.Trim() == "æ¶æéç¥å") |
| | | { |
| | | string sWhere = " and HOrgID =" + HOrgID.ToString(); |
| | | DAL.Cls_S_IF_POInStockBillList oIF_POInStockBillList = new DAL.Cls_S_IF_POInStockBillList(); |
| | | if (oIF_POInStockBillList.Refresh(sWhere)) //éæ©åå |
| | | { |
| | | FillSelectData(oIF_POInStockBillList.oBillSelectColl); |
| | | } |
| | | } |
| | | else if (cmbSourceBillType.Text.Trim() == "éè´è®¢å") |
| | | { |
| | | string sWhere = " and HOrgID =" + HOrgID.ToString(); |
| | | DAL.Cls_S_IF_POOrderBillList oIF_POOrderBillList = new DAL.Cls_S_IF_POOrderBillList(); |
| | | if (oIF_POOrderBillList.Refresh(sWhere)) //éæ©åå |
| | | { |
| | | FillSelectData(oIF_POOrderBillList.oBillSelectColl); |
| | | } |
| | | } |
| | | else if (cmbSourceBillType.Text.Trim() == "å§å¤è®¢å") |
| | | { |
| | | string sWhere = " and HOrgID =" + HOrgID.ToString(); |
| | | DAL.Cls_S_IF_EntrustOrderBillList oIF_EntrustOrderBillList = new DAL.Cls_S_IF_EntrustOrderBillList(); |
| | | if (oIF_EntrustOrderBillList.Refresh(sWhere)) //éæ©åå |
| | | { |
| | | FillSelectData(oIF_EntrustOrderBillList.oBillSelectColl); |
| | | } |
| | | } |
| | | else if (cmbSourceBillType.Text.Trim() == "éè´å
¥åºå") |
| | | { |
| | | string sWhere = ""; |
| | | DAL.Cls_S_IF_POStockInBillList oIF_POStockInBillList = new DAL.Cls_S_IF_POStockInBillList(); |
| | | if (oIF_POStockInBillList.Refresh(sWhere)) //éæ©åå |
| | | { |
| | | FillSelectData(oIF_POStockInBillList.oBillSelectColl); |
| | | } |
| | | } |
| | | else if (cmbSourceBillType.Text.Trim() == "åç®±å") |
| | | { |
| | | string sWhere = ""; |
| | | DAL.Cls_S_IF_ChangeBoxBillList oIF_ChangeBoxBillList = new DAL.Cls_S_IF_ChangeBoxBillList(); |
| | | if (oIF_ChangeBoxBillList.Refresh(sWhere)) //éæ©åå |
| | | { |
| | | FillSelectData(oIF_ChangeBoxBillList.oBillSelectColl); |
| | | } |
| | | } |
| | | else if (cmbSourceBillType.Text.Trim() == "éè´§éç¥å") |
| | | { |
| | | string sWhere = ""; |
| | | DAL.Cls_S_IF_SeOutStockBackBillList oIF_SeOutStockBackBillList = new DAL.Cls_S_IF_SeOutStockBackBillList(); |
| | | if (oIF_SeOutStockBackBillList.Refresh(sWhere)) //éæ©åå |
| | | { |
| | | FillSelectData(oIF_SeOutStockBackBillList.oBillSelectColl); |
| | | } |
| | | } |
| | | else if (cmbSourceBillType.Text.Trim() == "å
¶ä»å
¥åºå") |
| | | { |
| | | string sWhere = " and HOrgID =" + HOrgID.ToString(); |
| | | DAL.Cls_S_IF_OtherInBillList oIF_OtherInBillList = new DAL.Cls_S_IF_OtherInBillList(); |
| | | if (oIF_OtherInBillList.Refresh(sWhere)) //éæ©åå |
| | | { |
| | | FillSelectData(oIF_OtherInBillList.oBillSelectColl); |
| | | } |
| | | } |
| | | else if (cmbSourceBillType.Text.Trim() == "ç´æ¥è°æ¨å") |
| | | { |
| | | string sWhere = " and HOrgID =" + HOrgID.ToString(); |
| | | DAL.Cls_S_IF_MoveStockBillList oIF_MoveStockBillList = new DAL.Cls_S_IF_MoveStockBillList(); |
| | | if (oIF_MoveStockBillList.Refresh(sWhere)) //éæ©åå |
| | | { |
| | | FillSelectData(oIF_MoveStockBillList.oBillSelectColl); |
| | | } |
| | | } |
| | | else if (cmbSourceBillType.Text.Trim() == "éè´éæå") |
| | | { |
| | | string sWhere = " and HOrgID =" + HOrgID.ToString(); |
| | | DAL.Cls_S_IF_POStockInBackBillList oIF_POStockInBackBillList = new DAL.Cls_S_IF_POStockInBackBillList(); |
| | | if (oIF_POStockInBackBillList.Refresh(sWhere)) //éæ©åå |
| | | { |
| | | FillSelectData(oIF_POStockInBackBillList.oBillSelectColl); |
| | | } |
| | | } |
| | | else if (cmbSourceBillType.Text.Trim() == "ç产éæå") |
| | | { |
| | | string sWhere = " and HOrgID =" + HOrgID.ToString(); |
| | | DAL.Cls_S_IF_MateOutBackBillList oIF_MateOutBackBillList = new DAL.Cls_S_IF_MateOutBackBillList(); |
| | | if (oIF_MateOutBackBillList.Refresh(sWhere)) //éæ©åå |
| | | { |
| | | FillSelectData(oIF_MateOutBackBillList.oBillSelectColl); |
| | | } |
| | | } |
| | | else if (cmbSourceBillType.Text.Trim() == "ç»è£
æå¸å") |
| | | { |
| | | string sWhere = " and HOrgID =" + HOrgID.ToString(); |
| | | DAL.Cls_S_IF_PackageDismantleBillList oIF_PackageDismantleBillList = new DAL.Cls_S_IF_PackageDismantleBillList(); |
| | | if (oIF_PackageDismantleBillList.Refresh(sWhere)) //éæ©åå |
| | | { |
| | | FillSelectData(oIF_PackageDismantleBillList.oBillSelectColl); |
| | | } |
| | | } |
| | | else if (cmbSourceBillType.Text.Trim() == "å·¥åºæµè½¬å¡") |
| | | { |
| | | string sWhere = " and HOrgID =" + HOrgID.ToString(); |
| | | DAL.Cls_S_IF_ProcessExchangeBillList oIF_ProcessExchangeBillList = new DAL.Cls_S_IF_ProcessExchangeBillList(); |
| | | if (oIF_ProcessExchangeBillList.Refresh(sWhere)) //éæ©åå |
| | | { |
| | | FillSelectData(oIF_ProcessExchangeBillList.oBillSelectColl); |
| | | } |
| | | } |
| | | else if (cmbSourceBillType.Text.Trim() == "å·¥åºæ±æ¥å") |
| | | { |
| | | string sWhere = " and HOrgID =" + HOrgID.ToString(); |
| | | DAL.Cls_S_IF_ProcessReportBillList oIF_ProcessReportBillList = new DAL.Cls_S_IF_ProcessReportBillList(); |
| | | if (oIF_ProcessReportBillList.Refresh(sWhere)) //éæ©åå |
| | | { |
| | | FillSelectData(oIF_ProcessReportBillList.oBillSelectColl); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | |
| | | } |
| | | |
| | | //éæ©æºååï¼å 载该æºåè®°å½ç©æå¨å½åæ¥æçæ¡ç å表 |
| | | Display4(); |
| | | } |
| | | // |
| | | private void FillSelectData(List<DBUtility.BillSelect> oList) |
| | | { |
| | | if (oList.Count != 1) |
| | | { |
| | | MessageBox.Show("è¯·éæ©ä¸æ¡æ°æ®!"); |
| | | return; |
| | | } |
| | | |
| | | |
| | | DataSet Ds; |
| | | oSumGrid.Changelock = true; |
| | | initGrid(); |
| | | int i = -1; |
| | | foreach (DBUtility.BillSelect oSelectRow in oList) |
| | | { |
| | | i = i + 1; |
| | | //ç产订å |
| | | if (oSelectRow.BillType == "3710") |
| | | { |
| | | grdMain.Rows.Add(); |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | //å¾å°ä¿¡æ¯ |
| | | Ds = oCn.RunProcReturn("exec h_p_Gy_BarCodeBill_ICMOBillList " + oSelectRow.BillMainID.ToString() + "," + oSelectRow.BillSubID.ToString() + ",'" + SourceQtyCtl + "'", "h_p_Gy_BarCodeBill_ICMOBillList"); |
| | | //Ds = oCn.RunProcReturn("select * from h_v_IFCLD_ICMOList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IFCLD_ICMOList"); |
| | | //åå
¥ä¿¡æ¯ |
| | | Sub_WriteInForm(Ds.Tables[0], i); |
| | | } |
| | | //çäº§æ±æ¥å |
| | | if (oSelectRow.BillType == "3711") |
| | | { |
| | | grdMain.Rows.Add(); |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | //å¾å°ä¿¡æ¯ |
| | | Ds = oCn.RunProcReturn("select * from h_v_IF_ICMOReportList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_ICMOReportList"); |
| | | //åå
¥ä¿¡æ¯ |
| | | Sub_WriteInForm1(Ds.Tables[0], i); |
| | | } |
| | | //æ¶æéç¥å |
| | | if (oSelectRow.BillType == "1103") |
| | | { |
| | | grdMain.Rows.Add(); |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | //å¾å°ä¿¡æ¯ |
| | | Ds = oCn.RunProcReturn("select * from h_v_IF_POInStockList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_POInStockList"); |
| | | //åå
¥ä¿¡æ¯ |
| | | Sub_WriteInForm1(Ds.Tables[0], i); |
| | | } |
| | | //éè´è®¢å |
| | | if (oSelectRow.BillType == "1102") |
| | | { |
| | | grdMain.Rows.Add(); |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | //å¾å°ä¿¡æ¯ |
| | | Ds = oCn.RunProcReturn("select * from h_v_IF_POOrderList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_POOrderList"); |
| | | //åå
¥ä¿¡æ¯ |
| | | Sub_WriteInForm1(Ds.Tables[0], i); |
| | | } |
| | | //å§å¤è®¢å |
| | | if (oSelectRow.BillType == "1601") |
| | | { |
| | | grdMain.Rows.Add(); |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | //å¾å°ä¿¡æ¯ |
| | | Ds = oCn.RunProcReturn("select * from h_v_IF_EntrustOrderList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_EntrustOrderList"); |
| | | //åå
¥ä¿¡æ¯ |
| | | Sub_WriteInForm1(Ds.Tables[0], i); |
| | | } |
| | | //éè´å
¥åºå |
| | | if (oSelectRow.BillType == "1201") |
| | | { |
| | | grdMain.Rows.Add(); |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | //å¾å°ä¿¡æ¯ |
| | | Ds = oCn.RunProcReturn("select * from h_v_IF_POStockInBillList_Source where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_POStockInBillList_Source"); |
| | | //åå
¥ä¿¡æ¯ |
| | | Sub_WriteInForm1(Ds.Tables[0], i); |
| | | } |
| | | //åç®±å |
| | | if (oSelectRow.BillType == "1240") |
| | | { |
| | | grdMain.Rows.Add(); |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | //å¾å°ä¿¡æ¯ |
| | | Ds = oCn.RunProcReturn("select * from h_v_IF_ChangeBoxList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_ChangeBoxList"); |
| | | //åå
¥ä¿¡æ¯ |
| | | Sub_WriteInForm3(Ds.Tables[0], i); |
| | | } |
| | | //éè´§éç¥å |
| | | if (oSelectRow.BillType == "1403") |
| | | { |
| | | grdMain.Rows.Add(); |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | //å¾å°ä¿¡æ¯ |
| | | Ds = oCn.RunProcReturn("select * from h_v_IF_SeOutStockBackList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_SeOutStockBackList"); |
| | | //åå
¥ä¿¡æ¯ |
| | | Sub_WriteInForm1(Ds.Tables[0], i); |
| | | } |
| | | //å
¶ä»å
¥åºå |
| | | if (oSelectRow.BillType == "1203") |
| | | { |
| | | grdMain.Rows.Add(); |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | //å¾å°ä¿¡æ¯ |
| | | Ds = oCn.RunProcReturn("select * from h_v_IF_OtherInList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_OtherInList"); |
| | | //åå
¥ä¿¡æ¯ |
| | | Sub_WriteInForm1(Ds.Tables[0], i); |
| | | } |
| | | //ç´æ¥è°æ¨å |
| | | if (oSelectRow.BillType == "1207") |
| | | { |
| | | grdMain.Rows.Add(); |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | //å¾å°ä¿¡æ¯ |
| | | Ds = oCn.RunProcReturn("select * from h_v_IF_MoveStockList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_MoveStockList"); |
| | | //åå
¥ä¿¡æ¯ |
| | | Sub_WriteInForm1(Ds.Tables[0], i); |
| | | } |
| | | //éè´éæå |
| | | if (oSelectRow.BillType == "1239") |
| | | { |
| | | grdMain.Rows.Add(); |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | //å¾å°ä¿¡æ¯ |
| | | Ds = oCn.RunProcReturn("select * from h_v_IF_POStockInBackList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_POStockInBackList"); |
| | | //åå
¥ä¿¡æ¯ |
| | | Sub_WriteInForm1(Ds.Tables[0], i); |
| | | } |
| | | //ç产éæå |
| | | if (oSelectRow.BillType == "1244") |
| | | { |
| | | grdMain.Rows.Add(); |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | //å¾å°ä¿¡æ¯ |
| | | Ds = oCn.RunProcReturn("select * from h_v_IF_MateOutBackList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_MateOutBackList"); |
| | | //åå
¥ä¿¡æ¯ |
| | | Sub_WriteInForm1(Ds.Tables[0], i); |
| | | } |
| | | //ç»è£
æå¸å |
| | | if (oSelectRow.BillType == "1255") |
| | | { |
| | | grdMain.Rows.Add(); |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | //å¾å°ä¿¡æ¯ |
| | | Ds = oCn.RunProcReturn("select * from h_v_IF_PackageDismantleList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_PackageDismantleList"); |
| | | //åå
¥ä¿¡æ¯ |
| | | Sub_WriteInForm1(Ds.Tables[0], i); |
| | | } |
| | | //å·¥åºæµè½¬å¡ |
| | | if (oSelectRow.BillType == "3772") |
| | | { |
| | | grdMain.Rows.Add(); |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | //å¾å°ä¿¡æ¯ |
| | | Ds = oCn.RunProcReturn("select * from h_v_IF_ProcessExchangeList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_ProcessExchangeList"); |
| | | //åå
¥ä¿¡æ¯ |
| | | Sub_WriteInForm1(Ds.Tables[0], i); |
| | | } |
| | | //å·¥åºæ±æ¥å |
| | | if (oSelectRow.BillType == "3714") |
| | | { |
| | | grdMain.Rows.Add(); |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | //å¾å°ä¿¡æ¯ |
| | | Ds = oCn.RunProcReturn("select * from h_v_IF_ProcessReportList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_ProcessReportList"); |
| | | //åå
¥ä¿¡æ¯ |
| | | Sub_WriteInForm1(Ds.Tables[0], i); |
| | | } |
| | | //峿¶åºå |
| | | if (oSelectRow.BillType == "JSKC") |
| | | { |
| | | grdMain.Rows.Add(); |
| | | Application.DoEvents(); |
| | | //å¾å°ä¿¡æ¯ |
| | | Ds = oCn.RunProcReturn("select * from h_v_KF_ICInventoryList_IF where hmaterid=" + oSelectRow.BillMainID + " and hwhid=" + oSelectRow.BillSubID + " and hspid=" + oSelectRow.SPID + " and HAuxPropID=" + oSelectRow.HAuxPropID + " and æ¹æ¬¡='" + oSelectRow.BatchNo + "' and 计åè·è¸ªå·='" + oSelectRow.BillNo + "' and çäº§æ¥æ='" + oSelectRow.HProduceDate + "' and æææè³='" + oSelectRow.HExpiryDate + "'", "h_v_KF_ICInventoryList_IF"); |
| | | //åå
¥ä¿¡æ¯ |
| | | Sub_WriteInForm2(Ds.Tables[0], i); |
| | | } |
| | | } |
| | | // |
| | | oSumGrid.Changelock = false; |
| | | DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid); |
| | | |
| | | if (grdMain.Rows.Count > 0) |
| | | { |
| | | //æ ¹æ®æºå设置表头 |
| | | textBox_HMaterNumber.Text = grdMain.Rows[0].Cells[HMaterNumberCol].Value.ToString(); |
| | | textBox_HMaterName.Text = grdMain.Rows[0].Cells[HMaterNameCol].Value.ToString(); |
| | | textBox_HMaterModel.Text = grdMain.Rows[0].Cells[HMaterModelCol].Value.ToString(); |
| | | long HMaterID = ClsPub.isLong(grdMain.Rows[i].Cells[HMaterIDCol].Value.ToString()); |
| | | Ds = oCn.RunProcReturn("select * from Gy_Material where HItemID = " + HMaterID + " and HUSEORGID =" + HOrgID, "Gy_Material"); |
| | | if (Ds != null && Ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | string HBatchManager = Ds.Tables[0].Rows[0]["HBatchManager"].ToString(); |
| | | if (HBatchManager == "False") |
| | | { |
| | | radioButton_HIsUsingBatchNo.Checked = false; |
| | | } |
| | | else |
| | | { |
| | | radioButton_HIsUsingBatchNo.Checked = true; |
| | | } |
| | | } |
| | | //设置æ¹å· |
| | | if (radioButton_HIsUsingBatchNo.Checked) |
| | | { |
| | | grdMain.Rows[0].Cells[HBatchNoCol].Value = getBatchNo(); |
| | | } |
| | | } |
| | | } |
| | | //æ ¹æ®TABLEåå
¥çé¢(ç产任å¡å) |
| | | private void Sub_WriteInForm(DataTable oTable, int i) |
| | | { |
| | | ////å 载表头 |
| | | //this.txtHDeptID.Tag = oTable.Rows[0]["HDeptID"].ToString(); |
| | | //this.txtHDeptID.Text = oTable.Rows[0]["é¨é¨åç§°"].ToString(); |
| | | ////å è½½è¡¨ä½ |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | grdMain.Rows[i].Cells[HQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["æªçææ¡ç æ°é"]); |
| | | grdMain.Rows[i].Cells[HinitQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["æªçææ¡ç æ°é"]); |
| | | // |
| | | grdMain.Rows[i].Cells[HMainIDCol].Value = oTable.Rows[0]["hmainid"].ToString(); |
| | | grdMain.Rows[i].Cells[HSubIDCol].Value = oTable.Rows[0]["hsubid"].ToString(); |
| | | grdMain.Rows[i].Cells[HBillNoCol].Value = oTable.Rows[0]["åæ®å·"].ToString(); |
| | | grdMain.Rows[i].Cells[HSourceBillNoCol].Value = oTable.Rows[0]["åæ®å·"].ToString(); |
| | | grdMain.Rows[i].Cells[HBillTypeCol].Value = oTable.Rows[0]["HBillType"].ToString(); |
| | | grdMain.Rows[i].Cells[HDateCol].Value = oTable.Rows[0]["æ¥æ"].ToString(); //忥 æ¶æåæ®æ¥æ |
| | | grdMain.Rows[i].Cells[HShowDateCol].Value = dtpHDate.Value.ToShortDateString(); |
| | | grdMain.Rows[i].Cells[HSupIDCol].Value = oTable.Rows[0]["hsupid"].ToString(); |
| | | grdMain.Rows[i].Cells[HSupNumberCol].Value = oTable.Rows[0]["ä¾åºå代ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HSupNameCol].Value = oTable.Rows[0]["ä¾åºå"].ToString(); |
| | | grdMain.Rows[i].Cells[HDeptIDCol].Value = oTable.Rows[0]["HDeptID"].ToString(); |
| | | grdMain.Rows[i].Cells[HDeptNumberCol].Value = oTable.Rows[0]["é¨é¨ä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HDeptNameCol].Value = oTable.Rows[0]["é¨é¨"].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterIDCol].Value = oTable.Rows[0]["HMaterID"].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterNumberCol].Value = oTable.Rows[0]["ç©æä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterNameCol].Value = oTable.Rows[0]["ç©æåç§°"].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterModelCol].Value = oTable.Rows[0]["è§æ ¼åå·"].ToString(); |
| | | //grdMain.Rows[i].Cells[HBatchManagerCol].Value = oTable.Rows[0]["æ¯å¦å¯ç¨æ¹æ¬¡"].ToString(); |
| | | grdMain.Rows[i].Cells[HBatchNoCol].Value = oTable.Rows[0]["æ¹æ¬¡"].ToString(); |
| | | grdMain.Rows[i].Cells[HUnitIDCol].Value = oTable.Rows[0]["HUnitID"].ToString(); |
| | | grdMain.Rows[i].Cells[HUnitNumberCol].Value = oTable.Rows[0]["计éåä½ä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HUnitNameCol].Value = oTable.Rows[0]["计éåä½"].ToString(); |
| | | grdMain.Rows[i].Cells[HRemarkCol].Value = oTable.Rows[0]["夿³¨"].ToString(); |
| | | grdMain.Rows[i].Cells[HMTONoCol].Value = oTable.Rows[0]["计åè·è¸ªå·"].ToString(); |
| | | grdMain.Rows[i].Cells[HCusIDCol].Value = oTable.Rows[0]["HCusID"].ToString(); |
| | | grdMain.Rows[i].Cells[HCusNumberCol].Value = oTable.Rows[0]["客æ·ä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HCusNameCol].Value = oTable.Rows[0]["客æ·"].ToString(); |
| | | grdMain.Rows[i].Cells[HCusTypeCol].Value = oTable.Rows[0]["客æ·åå·"].ToString(); |
| | | grdMain.Rows[i].Cells[HPinfanBarCodeCol].Value = oTable.Rows[0]["HPinfanBarCode"].ToString(); |
| | | grdMain.Rows[i].Cells[HPinfanCol].Value = oTable.Rows[0]["HPinfan"].ToString(); |
| | | //grdMain.Rows[i].Cells[HSourceIDCol].Value = oTable.Rows[0]["HSourceID"].ToString(); |
| | | //grdMain.Rows[i].Cells[HSourceNumberCol].Value = oTable.Rows[0]["ç产线代ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HSourceNameCol].Value = oTable.Rows[0]["ç产线"].ToString(); |
| | | grdMain.Rows[i].Cells[HEndDateCol].Value = oTable.Rows[0]["计åå®å·¥æ¥æ"].ToString();//忥 ç产订å å¤±ææ¥æ |
| | | if (cmbHBarCodeType.Text == "仪å¨å¤è´ä»¶æ¡ç 容å¨è§å") |
| | | { |
| | | grdMain.Rows[i].Cells[HMinQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["æªçææ¡ç æ°é"]); |
| | | } |
| | | else if (cmbHBarCodeType.Text == "仪å¨å¤è´ä»¶æ¡ç æ®éè§å" |
| | | || cmbHBarCodeType.Text == "ä»ªå¨æåæ¡ç è§å" |
| | | || cmbHBarCodeType.Text == "è¯åæåæ¡ç è§å") |
| | | { |
| | | grdMain.Rows[i].Cells[HMinQtyCol].Value = "1"; |
| | | } |
| | | else |
| | | { |
| | | grdMain.Rows[i].Cells[HMinQtyCol].Value = oTable.Rows[0]["æå°å
è£
æ°"].ToString(); |
| | | } |
| | | grdMain.Rows[i].Cells[HProduceDateCol].Value = oTable.Rows[0]["HProduceDate"].ToString(); |
| | | grdMain.Rows[i].Cells[HExpiryDateCol].Value = oTable.Rows[0]["HExpiryDate"].ToString(); |
| | | grdMain.Rows[i].Cells[HISKFPERIODCol].Value = oTable.Rows[0]["HISKFPERIOD"].ToString(); |
| | | grdMain.Rows[i].Cells[HEXPUNITCol].Value = oTable.Rows[0]["HEXPUNIT"].ToString(); |
| | | grdMain.Rows[i].Cells[HEXPPERIODCol].Value = oTable.Rows[0]["HEXPPERIOD"].ToString(); |
| | | |
| | | |
| | | //èªå¨çæ-设置æ°éãæå°å
è£
æ°ãç®±æ°ä¸º1 |
| | | grdMain.Rows[i].Cells[HQtyCol].Value = 1; |
| | | grdMain.Rows[i].Cells[HMinQtyCol].Value = 1; |
| | | grdMain.Rows[i].Cells[HBQtyCol].Value = 1; |
| | | |
| | | |
| | | |
| | | |
| | | //-- |
| | | //设置å¯ç¼è¾å |
| | | string sAllowCol = HQtyCol.ToString() + |
| | | "," + HMinQtyCol.ToString() + |
| | | "," + HAuxPropNumberCol.ToString() + |
| | | "," + HBatchNoCol.ToString() + |
| | | "," + HPackQtyCol.ToString() + |
| | | "," + HRemarkCol.ToString(); |
| | | grdMain.Columns[HBillNoCol].ReadOnly = true; |
| | | //设置å计å |
| | | string sTotalCol = HQtyCol.ToString(); |
| | | // |
| | | DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol, oSumGrid); |
| | | tabControl1.SelectedIndex = 3; |
| | | bc.Enabled = true; |
| | | // |
| | | RowCount(i, 0); |
| | | } |
| | | |
| | | //æ ¹æ®TABLEåå
¥çé¢ |
| | | private void Sub_WriteInForm1(DataTable oTable, int i) |
| | | { |
| | | ////å 载表头 |
| | | //this.txtHDeptID.Tag = oTable.Rows[0]["HDeptID"].ToString(); |
| | | //this.txtHDeptID.Text = oTable.Rows[0]["é¨é¨åç§°"].ToString(); |
| | | ////å è½½è¡¨ä½ |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | grdMain.Rows[i].Cells[HQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["æªçææ¡ç æ°é"]); |
| | | grdMain.Rows[i].Cells[HinitQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["æªçææ¡ç æ°é"]); |
| | | // |
| | | grdMain.Rows[i].Cells[HMainIDCol].Value = oTable.Rows[0]["hmainid"].ToString(); |
| | | grdMain.Rows[i].Cells[HSubIDCol].Value = oTable.Rows[0]["hsubid"].ToString(); |
| | | grdMain.Rows[i].Cells[HBillNoCol].Value = oTable.Rows[0]["åæ®å·"].ToString(); |
| | | grdMain.Rows[i].Cells[HBillTypeCol].Value = oTable.Rows[0]["HBillType"].ToString(); |
| | | grdMain.Rows[i].Cells[HDateCol].Value = oTable.Rows[0]["æ¥æ"].ToString(); //忥 åæ®æ¥æ |
| | | grdMain.Rows[i].Cells[HShowDateCol].Value = dtpHDate.Value.ToShortDateString(); |
| | | grdMain.Rows[i].Cells[HDeptIDCol].Value = oTable.Rows[0]["HDeptID"].ToString(); |
| | | grdMain.Rows[i].Cells[HDeptNumberCol].Value = oTable.Rows[0]["é¨é¨ä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HDeptNameCol].Value = oTable.Rows[0]["é¨é¨"].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterIDCol].Value = oTable.Rows[0]["HMaterID"].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterNumberCol].Value = oTable.Rows[0]["ç©æä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterNameCol].Value = oTable.Rows[0]["ç©æåç§°"].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterModelCol].Value = oTable.Rows[0]["è§æ ¼åå·"].ToString(); |
| | | //grdMain.Rows[i].Cells[HBatchManagerCol].Value = oTable.Rows[0]["æ¯å¦å¯ç¨æ¹æ¬¡"].ToString(); |
| | | grdMain.Rows[i].Cells[HBatchNoCol].Value = oTable.Rows[0]["æ¹æ¬¡"].ToString(); |
| | | grdMain.Rows[i].Cells[HUnitIDCol].Value = oTable.Rows[0]["HUnitID"].ToString(); |
| | | grdMain.Rows[i].Cells[HUnitNumberCol].Value = oTable.Rows[0]["计éåä½ä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HUnitNameCol].Value = oTable.Rows[0]["计éåä½"].ToString(); |
| | | grdMain.Rows[i].Cells[HRemarkCol].Value = oTable.Rows[0]["夿³¨"].ToString(); |
| | | grdMain.Rows[i].Cells[HMTONoCol].Value = oTable.Rows[0]["计åè·è¸ªå·"].ToString(); |
| | | grdMain.Rows[i].Cells[HProduceDateCol].Value = oTable.Rows[0]["çäº§æ¥æ"].ToString(); |
| | | grdMain.Rows[i].Cells[HExpiryDateCol].Value = oTable.Rows[0]["æææè³"].ToString(); |
| | | grdMain.Rows[i].Cells[HISKFPERIODCol].Value = oTable.Rows[0]["HISKFPERIOD"].ToString(); |
| | | grdMain.Rows[i].Cells[HEXPUNITCol].Value = oTable.Rows[0]["HEXPUNIT"].ToString(); |
| | | grdMain.Rows[i].Cells[HEXPPERIODCol].Value = oTable.Rows[0]["HEXPPERIOD"].ToString(); |
| | | if (cmbHBarCodeType.Text == "仪å¨å¤è´ä»¶æ¡ç 容å¨è§å") |
| | | { |
| | | grdMain.Rows[i].Cells[HMinQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["æªçææ¡ç æ°é"]); |
| | | } |
| | | else if (cmbHBarCodeType.Text == "仪å¨å¤è´ä»¶æ¡ç æ®éè§å") |
| | | { |
| | | grdMain.Rows[i].Cells[HMinQtyCol].Value = "1"; |
| | | } |
| | | else |
| | | { |
| | | if (CampanyName == "䏿§") |
| | | { |
| | | grdMain.Rows[i].Cells[HMinQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["æªçææ¡ç æ°é"]); |
| | | } |
| | | else |
| | | { |
| | | grdMain.Rows[i].Cells[HMinQtyCol].Value = oTable.Rows[0]["æå°å
è£
æ°"].ToString(); |
| | | } |
| | | } |
| | | grdMain.Rows[i].Cells[HMakerCol].Value = ClsPub.CurUserName; |
| | | if (cmbSourceBillType.Text.Trim() == "æ¶æéç¥å" || cmbSourceBillType.Text.Trim() == "éè´è®¢å" |
| | | || cmbSourceBillType.Text.Trim() == "å§å¤è®¢å" || cmbSourceBillType.Text.Trim() == "éè´å
¥åºå") |
| | | { |
| | | grdMain.Rows[i].Cells[HInnerBillNoCol].Value = oTable.Rows[0]["å
é¨éè´è®¢åå·"].ToString(); |
| | | grdMain.Rows[i].Cells[HSupIDCol].Value = oTable.Rows[0]["hsupid"].ToString(); |
| | | grdMain.Rows[i].Cells[HSupNumberCol].Value = oTable.Rows[0]["ä¾åºå代ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HSupNameCol].Value = oTable.Rows[0]["ä¾åºå"].ToString(); |
| | | if (cmbSourceBillType.Text.Trim() == "æ¶æéç¥å") |
| | | { |
| | | if (oTable.Rows[0]["æ¯å¦èµ å"].ToString() == "æ¯") |
| | | { |
| | | grdMain.Rows[i].Cells[HGiveAwayFlagCol].Value = 1; |
| | | } |
| | | else |
| | | { |
| | | grdMain.Rows[i].Cells[HGiveAwayFlagCol].Value = 0; |
| | | } |
| | | grdMain.Rows[i].Cells[HSeOrderBillNoCol].Value = oTable.Rows[0]["éå®è®¢åå·"].ToString(); |
| | | grdMain.Rows[i].Cells[HSeOrderSEQCol].Value = oTable.Rows[0]["éå®è®¢åè¡å·"].ToString(); |
| | | } |
| | | |
| | | } |
| | | if (cmbSourceBillType.Text.Trim() == "éè´§éç¥å") |
| | | { |
| | | grdMain.Rows[i].Cells[HCusIDCol].Value = oTable.Rows[0]["HCusID"].ToString(); |
| | | grdMain.Rows[i].Cells[HCusNumberCol].Value = oTable.Rows[0]["客æ·ä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HCusNameCol].Value = oTable.Rows[0]["客æ·"].ToString(); |
| | | } |
| | | if (cmbSourceBillType.Text.Trim() == "å
¶ä»å
¥åºå") |
| | | { |
| | | grdMain.Rows[i].Cells[HWhIDCol].Value = oTable.Rows[0]["HWhID"].ToString(); |
| | | grdMain.Rows[i].Cells[HWhNumberCol].Value = oTable.Rows[0]["ä»åºä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HWhNameCol].Value = oTable.Rows[0]["ä»åº"].ToString(); |
| | | grdMain.Rows[i].Cells[HSPIDCol].Value = oTable.Rows[0]["HSPID"].ToString(); |
| | | grdMain.Rows[i].Cells[HSPNumberCol].Value = oTable.Rows[0]["ä»ä½ä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HSPNameCol].Value = oTable.Rows[0]["ä»ä½"].ToString(); |
| | | } |
| | | |
| | | //èªå¨çæ-设置æ°éãæå°å
è£
æ°ãç®±æ°ä¸º1 |
| | | grdMain.Rows[i].Cells[HQtyCol].Value = 1; |
| | | grdMain.Rows[i].Cells[HMinQtyCol].Value = 1; |
| | | grdMain.Rows[i].Cells[HBQtyCol].Value = 1; |
| | | |
| | | |
| | | //-- |
| | | //设置å¯ç¼è¾å |
| | | string sAllowCol = HQtyCol.ToString() + |
| | | "," + HMinQtyCol.ToString() + |
| | | "," + HAuxPropNumberCol.ToString() + |
| | | "," + HBatchNoCol.ToString() + |
| | | "," + HRemarkCol.ToString(); |
| | | grdMain.Columns[HBillNoCol].ReadOnly = true; |
| | | //设置å计å |
| | | string sTotalCol = HQtyCol.ToString(); |
| | | // |
| | | DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol, oSumGrid); |
| | | tabControl1.SelectedIndex = 3; |
| | | bc.Enabled = true; |
| | | // |
| | | RowCount(i, 0); |
| | | } |
| | | |
| | | //æ ¹æ®TABLEåå
¥çé¢ï¼K3峿¶åºåï¼ |
| | | private void Sub_WriteInForm2(DataTable oTable, int i) |
| | | { |
| | | ////å 载表头 |
| | | //this.txtHDeptID.Tag = oTable.Rows[0]["HDeptID"].ToString(); |
| | | //this.txtHDeptID.Text = oTable.Rows[0]["é¨é¨åç§°"].ToString(); |
| | | ////å è½½è¡¨ä½ |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | grdMain.Rows[i].Cells[HQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["æ°é"]); |
| | | grdMain.Rows[i].Cells[HinitQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["æ°é"]); |
| | | // |
| | | //grdMain.Rows[i].Cells[HMainIDCol].Value = oTable.Rows[0]["hmainid"].ToString(); |
| | | //grdMain.Rows[i].Cells[HBillNoCol].Value = oTable.Rows[0]["ä»»å¡åå·"].ToString(); |
| | | //grdMain.Rows[i].Cells[HBillTypeCol].Value = oTable.Rows[0]["HBillType"].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterIDCol].Value = oTable.Rows[0]["HMaterID"].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterNumberCol].Value = oTable.Rows[0]["ç©æä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterNameCol].Value = oTable.Rows[0]["ç©æåç§°"].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterModelCol].Value = oTable.Rows[0]["è§æ ¼åå·"].ToString(); |
| | | grdMain.Rows[i].Cells[HAuxPropIDCol].Value = oTable.Rows[0]["HAuxPropID"].ToString(); |
| | | grdMain.Rows[i].Cells[HAuxPropNumberCol].Value = oTable.Rows[0]["è¾
å©å±æ§ä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HAuxPropNameCol].Value = oTable.Rows[0]["è¾
å©å±æ§åç§°"].ToString(); |
| | | grdMain.Rows[i].Cells[HBatchNoCol].Value = oTable.Rows[0]["æ¹æ¬¡"].ToString(); |
| | | grdMain.Rows[i].Cells[HUnitIDCol].Value = oTable.Rows[0]["HUnitID"].ToString(); |
| | | grdMain.Rows[i].Cells[HUnitNumberCol].Value = oTable.Rows[0]["计éåä½ä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HUnitNameCol].Value = oTable.Rows[0]["计éåä½"].ToString(); |
| | | grdMain.Rows[i].Cells[HSupIDCol].Value = oTable.Rows[0]["HSupplyID"].ToString(); |
| | | grdMain.Rows[i].Cells[HSupNumberCol].Value = oTable.Rows[0]["ä¾åºå代ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HSupNameCol].Value = oTable.Rows[0]["ä¾åºå"].ToString(); |
| | | grdMain.Rows[i].Cells[HWhIDCol].Value = oTable.Rows[0]["HWhID"].ToString(); |
| | | grdMain.Rows[i].Cells[HWhNumberCol].Value = oTable.Rows[0]["ä»åºä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HWhNameCol].Value = oTable.Rows[0]["ä»åº"].ToString(); |
| | | grdMain.Rows[i].Cells[HSPIDCol].Value = oTable.Rows[0]["HSPID"].ToString(); |
| | | grdMain.Rows[i].Cells[HSPNumberCol].Value = oTable.Rows[0]["ä»ä½ä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HSPNameCol].Value = oTable.Rows[0]["ä»ä½"].ToString(); |
| | | grdMain.Rows[i].Cells[HDateCol].Value = ClsPub.GetServerDate(0); |
| | | grdMain.Rows[i].Cells[HShowDateCol].Value = dtpHDate.Value.ToShortDateString(); |
| | | grdMain.Rows[i].Cells[HRemarkCol].Value = "æåºåçæ"; |
| | | grdMain.Rows[i].Cells[HMTONoCol].Value = oTable.Rows[0]["计åè·è¸ªå·"].ToString(); |
| | | grdMain.Rows[i].Cells[HProduceDateCol].Value = oTable.Rows[0]["çäº§æ¥æ"].ToString(); |
| | | grdMain.Rows[i].Cells[HExpiryDateCol].Value = oTable.Rows[0]["æææè³"].ToString(); |
| | | grdMain.Rows[i].Cells[HISKFPERIODCol].Value = oTable.Rows[0]["HISKFPERIOD"].ToString(); |
| | | grdMain.Rows[i].Cells[HEXPUNITCol].Value = oTable.Rows[0]["HEXPUNIT"].ToString(); |
| | | grdMain.Rows[i].Cells[HEXPPERIODCol].Value = oTable.Rows[0]["HEXPPERIOD"].ToString(); |
| | | if (CampanyName == "䏿§") |
| | | { |
| | | grdMain.Rows[i].Cells[HMinQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["æ°é"]); |
| | | } |
| | | |
| | | //èªå¨çæ-设置æ°éãæå°å
è£
æ°ãç®±æ°ä¸º1 |
| | | grdMain.Rows[i].Cells[HQtyCol].Value = 1; |
| | | grdMain.Rows[i].Cells[HMinQtyCol].Value = 1; |
| | | grdMain.Rows[i].Cells[HBQtyCol].Value = 1; |
| | | |
| | | |
| | | //-- |
| | | //设置å¯ç¼è¾å |
| | | string sAllowCol = HQtyCol.ToString() + |
| | | "," + HRemarkCol.ToString() + |
| | | "," + HMinQtyCol.ToString(); |
| | | grdMain.Columns[HBillNoCol].ReadOnly = true; |
| | | //设置å计å |
| | | string sTotalCol = HQtyCol.ToString(); |
| | | // |
| | | DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol, oSumGrid); |
| | | tabControl1.SelectedIndex = 3; |
| | | bc.Enabled = true; |
| | | // |
| | | RowCount(i, 0); |
| | | } |
| | | |
| | | //æ ¹æ®TABLEåå
¥çé¢ï¼åç®±åï¼ |
| | | private void Sub_WriteInForm3(DataTable oTable, int i) |
| | | { |
| | | ////å 载表头 |
| | | //this.txtHDeptID.Tag = oTable.Rows[0]["HDeptID"].ToString(); |
| | | //this.txtHDeptID.Text = oTable.Rows[0]["é¨é¨åç§°"].ToString(); |
| | | ////å è½½è¡¨ä½ |
| | | grdMain.Rows[i].Cells[HTagCol].Value = "*"; |
| | | grdMain.Rows[i].Cells[HQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["å¯çææ¡ç æ°é"]); |
| | | grdMain.Rows[i].Cells[HinitQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["å¯çææ¡ç æ°é"]); |
| | | // |
| | | grdMain.Rows[i].Cells[HMainIDCol].Value = oTable.Rows[0]["hmainid"].ToString(); |
| | | grdMain.Rows[i].Cells[HSubIDCol].Value = oTable.Rows[0]["hsubid"].ToString(); |
| | | grdMain.Rows[i].Cells[HBillNoCol].Value = oTable.Rows[0]["åæ®å·"].ToString(); |
| | | grdMain.Rows[i].Cells[HBillTypeCol].Value = oTable.Rows[0]["HBillType"].ToString(); |
| | | grdMain.Rows[i].Cells[HDateCol].Value = oTable.Rows[0]["æ¥æ"].ToString(); |
| | | grdMain.Rows[i].Cells[HShowDateCol].Value = dtpHDate.Value.ToShortDateString(); |
| | | grdMain.Rows[i].Cells[HDeptIDCol].Value = oTable.Rows[0]["HDeptID"].ToString(); |
| | | grdMain.Rows[i].Cells[HDeptNumberCol].Value = oTable.Rows[0]["é¨é¨ä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HDeptNameCol].Value = oTable.Rows[0]["é¨é¨"].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterIDCol].Value = oTable.Rows[0]["HMaterID"].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterNumberCol].Value = oTable.Rows[0]["ç©æä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterNameCol].Value = oTable.Rows[0]["ç©æåç§°"].ToString(); |
| | | grdMain.Rows[i].Cells[HMaterModelCol].Value = oTable.Rows[0]["è§æ ¼åå·"].ToString(); |
| | | grdMain.Rows[i].Cells[HPinfanCol].Value = oTable.Rows[0]["åçª"].ToString(); |
| | | grdMain.Rows[i].Cells[HPinfanBarCodeCol].Value = oTable.Rows[0]["HPinfanBarCode"].ToString(); |
| | | grdMain.Rows[i].Cells[HAuxPropIDCol].Value = oTable.Rows[0]["HAuxPropID"].ToString(); |
| | | grdMain.Rows[i].Cells[HAuxPropNumberCol].Value = oTable.Rows[0]["è¾
å©å±æ§ä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HAuxPropNameCol].Value = oTable.Rows[0]["è¾
å©å±æ§åç§°"].ToString(); |
| | | grdMain.Rows[i].Cells[HBatchNoCol].Value = oTable.Rows[0]["æ¹å·"].ToString(); |
| | | grdMain.Rows[i].Cells[HUnitIDCol].Value = oTable.Rows[0]["HUnitID"].ToString(); |
| | | grdMain.Rows[i].Cells[HUnitNumberCol].Value = oTable.Rows[0]["计éåä½ä»£ç "].ToString(); |
| | | grdMain.Rows[i].Cells[HUnitNameCol].Value = oTable.Rows[0]["计éåä½"].ToString(); |
| | | grdMain.Rows[i].Cells[HRemarkCol].Value = oTable.Rows[0]["夿³¨"].ToString(); |
| | | //è·åææ°æå°å
è£
æ° |
| | | DataSet oDs = new DataSet(); |
| | | oDs = oCn.RunProcReturn("exec h_p_Gy_StdPack " + oTable.Rows[0]["HMaterID"].ToString() + "," + oTable.Rows[0]["HAuxPropID"].ToString(), "h_p_Gy_StdPack"); |
| | | // |
| | | if (oDs != null && oDs.Tables[0].Rows.Count > 0) |
| | | { |
| | | grdMain.Rows[i].Cells[HMinQtyCol].Value = DBUtility.ClsPub.isSingle(oDs.Tables[0].Rows[0]["HMinPack"]); |
| | | } |
| | | |
| | | //èªå¨çæ-设置æ°éãæå°å
è£
æ°ãç®±æ°ä¸º1 |
| | | grdMain.Rows[i].Cells[HQtyCol].Value = 1; |
| | | grdMain.Rows[i].Cells[HMinQtyCol].Value = 1; |
| | | grdMain.Rows[i].Cells[HBQtyCol].Value = 1; |
| | | |
| | | |
| | | //-- |
| | | //设置å¯ç¼è¾å |
| | | string sAllowCol = HQtyCol.ToString() + |
| | | "," + HRemarkCol.ToString() + |
| | | "," + HMaterNameCol.ToString() + |
| | | "," + HMaterModelCol.ToString() + |
| | | "," + HPinfanCol.ToString() + |
| | | "," + HMinQtyCol.ToString(); |
| | | grdMain.Columns[HBillNoCol].ReadOnly = true; |
| | | //设置å计å |
| | | string sTotalCol = HQtyCol.ToString(); |
| | | // |
| | | DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol, oSumGrid); |
| | | tabControl1.SelectedIndex = 3; |
| | | bc.Enabled = true; |
| | | // |
| | | RowCount(i, 0); |
| | | } |
| | | |
| | | //ç½æ ¼ç¼è¾å夿 |
| | | private void grdMain_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) |
| | | { |
| | | int i = grdMain.CurrentCell.ColumnIndex; |
| | | if (DBUtility.Xt_BaseBillFun.AllowEdit(grdStatus, oSumGrid, i)) |
| | | { |
| | | e.Cancel = true; |
| | | } |
| | | } |
| | | |
| | | //ç½æ ¼ç¼è¾åå¤ç |
| | | private void grdMain_CellEndEdit(object sender, DataGridViewCellEventArgs e) |
| | | { |
| | | DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid); |
| | | if (e.ColumnIndex == HMinQtyCol) |
| | | { |
| | | RowCount(e.RowIndex, 0); // |
| | | } |
| | | else if (e.ColumnIndex == HQtyCol) |
| | | { |
| | | RowCount(e.RowIndex, 0); // |
| | | } |
| | | // |
| | | if (this.EditingControl != null) //éæ¾äºä»¶ |
| | | { |
| | | EditingControl.KeyDown -= new KeyEventHandler(this.EditingControl_KeyDown); |
| | | this.EditingControl = null; |
| | | } |
| | | } |
| | | DataGridViewTextBoxEditingControl EditingControl; |
| | | |
| | | private void grdMain_CellLeave(object sender, DataGridViewCellEventArgs e) |
| | | { |
| | | // |
| | | if (!grdStatus) |
| | | { |
| | | return; |
| | | } |
| | | DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid); |
| | | // |
| | | //if (oSumGrid.Changelock) |
| | | // return; |
| | | //if(oSumGrid.EditStatus) |
| | | //{ |
| | | if (!CheckGridRow(oSumGrid.OldCell.Row)) |
| | | return; |
| | | //} |
| | | } |
| | | |
| | | private void grdMain_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) |
| | | { |
| | | DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid); |
| | | } |
| | | |
| | | private void grdMain_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) |
| | | { |
| | | if (grdMain.CurrentCell != null) |
| | | { |
| | | if (e.Control is DataGridViewTextBoxEditingControl) |
| | | { |
| | | this.EditingControl = (DataGridViewTextBoxEditingControl)e.Control; |
| | | //å¢å å§æå¤ç |
| | | this.EditingControl.KeyDown += new KeyEventHandler(this.EditingControl_KeyDown); |
| | | } |
| | | } |
| | | } |
| | | private void EditingControl_KeyDown(object sender, KeyEventArgs e) |
| | | { |
| | | //ä¸å¡å¤ç |
| | | Sub_GridKey(e.KeyValue, grdMain.CurrentRow.Index, grdMain.CurrentCell.ColumnIndex, EditingControl); |
| | | } |
| | | private void grdMain_RowHeadersWidthChanged(object sender, EventArgs e) |
| | | { |
| | | DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid); |
| | | } |
| | | |
| | | private void grdMain_Scroll(object sender, ScrollEventArgs e) |
| | | { |
| | | DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid); |
| | | oSumGrid.DisplayCurRow(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region //æå°è®¾ç½® |
| | | |
| | | GridppReport Report; |
| | | int CurRows = 0; |
| | | string sBarCodeItemID = ""; //æ¡ç èªå¢å |
| | | |
| | | //é¢è§ |
| | | private void yl_Click(object sender, EventArgs e) |
| | | { |
| | | //夿æ¯å¦å·²ç»çææ¡ç |
| | | if (DBUtility.ClsPub.isStrNull(grdSub.Rows[0].Cells[HTMCol].Value) == "") |
| | | { |
| | | MessageBox.Show("æ¡ç æªçæï¼è¯·å
çææ¡ç ååé¢è§ï¼"); |
| | | return; |
| | | } |
| | | |
| | | //æå°å夿æ¡ç æ¯å¦å·²æå°è¿ |
| | | 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.PrintPreview(false); |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | |
| | | //æå° |
| | | private void dy_Click(object sender, EventArgs e) |
| | | { |
| | | //夿æ¯å¦å·²ç»çææ¡ç |
| | | if (DBUtility.ClsPub.isStrNull(grdSub.Rows[0].Cells[HTMCol].Value) == "") |
| | | { |
| | | MessageBox.Show("æ¡ç æªçæï¼è¯·å
çææ¡ç ååæå°ï¼"); |
| | | return; |
| | | } |
| | | |
| | | //æå°å夿æ¡ç æ¯å¦å·²æå°è¿ |
| | | 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(true); |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | |
| | | ////æå°å夿æ¡ç æ¯å¦å·²æå°è¿ |
| | | //private bool ReportPrintBegin() |
| | | //{ |
| | | // string sRelQty = ""; |
| | | |
| | | // if (oBar.Set_BPrintQty(DBUtility.ClsPub.isStrNull(grdSub.Rows[0].Cells[HTMCol].Value), ref sRelQty)) |
| | | // { |
| | | // MessageBox.Show("æ¡ç å·²ç»æå°è¿ï¼ä¸å¯é夿å°ï¼"); |
| | | // return true; |
| | | // } |
| | | // else |
| | | // { |
| | | // return false; |
| | | // } |
| | | //} |
| | | |
| | | //æå°å夿æ¡ç æ¯å¦è¶
è¿å
è®¸å¯æå°æ¬¡æ° |
| | | private bool ReportPrintBegin() |
| | | { |
| | | string sHRemark = ""; |
| | | if (PrintQtyCtl == "Y") |
| | | { |
| | | if (oBar.Set_CheckPrintQty_SD(HInterID, PrintQty, ref sHRemark)) |
| | | { |
| | | MessageBox.Show(sHRemark); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | private void Sub_SetReport(string sOpenTmp) |
| | | { |
| | | //å¤æè¡æ° |
| | | for (int i = 0; i < grdList.Rows.Count; i++) |
| | | { |
| | | grdList.Rows[i].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()// |
| | | { |
| | | try |
| | | { |
| | | //Report.FieldByName("ç©æä»£ç ").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HMaterNumber2Col].Value); |
| | | //Report.FieldByName("ç©æåç§°").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HMaterName2Col].Value); |
| | | //Report.FieldByName("è§æ ¼åå·").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HMaterModel2Col].Value); |
| | | ////Report.FieldByName("èªå®ä¹è§æ ¼").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HModel2Col].Value); |
| | | //Report.FieldByName("æ¡ç ç¼å·").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HTMCol].Value); |
| | | //Report.FieldByName("æ°é").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HQty2Col].Value); |
| | | //Report.FieldByName("æºååå·").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HSourceBillNoCol].Value); |
| | | //Report.FieldByName("éå®è®¢åå·").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HSeOrderBillNo2Col].Value); |
| | | //Report.FieldByName("ç产车é´").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HDeptName2Col].Value); |
| | | //Report.FieldByName("夿³¨").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HRemark2Col].Value); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | MessageBox.Show("æå°å¤±è´¥!表头ï¼" + e.Message); |
| | | } |
| | | } |
| | | |
| | | //å¡«å
¥åæ®è¡¨ä½ä¿¡æ¯ |
| | | private void ReportFetchRecordByDataTable() |
| | | { |
| | | try |
| | | { |
| | | DataTable ds = new DataTable(); |
| | | BLL.Utility.FillRecordToReport_Sel(Report, grdList, ds, Fun_GetCol("éæ©")); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | MessageBox.Show("æå°å¤±è´¥!表ä½ï¼" + e.Message); |
| | | } |
| | | } |
| | | |
| | | ////æå°ç»æååå¡«æ¡ç æå°æ¬¡æ° |
| | | //private void ReportPrintEnd() |
| | | //{ |
| | | // try |
| | | // { |
| | | // oCn.RunProc("update Gy_BarCodeBill set HPrintQty=isnull(HPrintQty,0)+1 where HInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | // } |
| | | // catch (Exception e) |
| | | // { |
| | | // MessageBox.Show("æå°å¤±è´¥!æå°ç»æ ï¼" + e.Message); |
| | | // } |
| | | //} |
| | | |
| | | //æå°ç»æååå¡«æ¡ç æå°æ¬¡æ° |
| | | private void ReportPrintEnd() |
| | | { |
| | | if (UpdatePrintQtyCtl == "Y") |
| | | { |
| | | oBar.Set_UpdatePrintQty_SD(HInterID); |
| | | } |
| | | } |
| | | |
| | | //è¯æå° |
| | | private void sdy_Click(object sender, EventArgs e) |
| | | { |
| | | //夿æ¯å¦å·²ç»çææ¡ç |
| | | if (DBUtility.ClsPub.isStrNull(grdSub.Rows[0].Cells[HTMCol].Value) == "") |
| | | { |
| | | MessageBox.Show("æ¡ç æªçæï¼è¯·å
çææ¡ç ååé¢è§ï¼"); |
| | | return; |
| | | } |
| | | |
| | | //æå°å夿æ¡ç æ¯å¦å·²æå°è¿ |
| | | if (ReportPrintBegin_SDY()) |
| | | { |
| | | 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_SetReportView(oFrm.sOpenTmp); |
| | | Report.PrintPreview(false); |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | |
| | | //æå°å夿æ¡ç æ¯å¦è¶
è¿å
è®¸å¯æå°æ¬¡æ° |
| | | private bool ReportPrintBegin_SDY() |
| | | { |
| | | string sHRemark = ""; |
| | | sBarCodeItemID = ""; |
| | | for (int i = 0; i < grdList.SelectedRows.Count; i++) |
| | | { |
| | | sBarCodeItemID = sBarCodeItemID + "," + DBUtility.ClsPub.isLong(grdList.Rows[grdList.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_SetReportView(string sOpenTmp) |
| | | { |
| | | //å¤æè¡æ° |
| | | for (int i = 0; i < grdList.Rows.Count; i++) |
| | | { |
| | | grdList.Rows[i].Cells[0].Value = ""; |
| | | } |
| | | for (int i = 0; i < grdList.SelectedRows.Count; i++) |
| | | { |
| | | grdList.Rows[grdList.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_SDY); |
| | | } |
| | | |
| | | //æå°ç»æååå¡«æ¡ç æå°æ¬¡æ° |
| | | private void ReportPrintEnd_SDY() |
| | | { |
| | | if (UpdatePrintQtyCtl == "Y") |
| | | { |
| | | oBar.Set_UpdatePrintQty(sBarCodeItemID); |
| | | } |
| | | } |
| | | |
| | | private Int32 Fun_GetCol(string sCol) |
| | | { |
| | | return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdList); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | private void grdSub_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) |
| | | { |
| | | int i = grdSub.CurrentCell.ColumnIndex; |
| | | if (DBUtility.Xt_BaseBillFun.AllowEdit(grdStatus, oSumGrid, i)) |
| | | { |
| | | e.Cancel = true; |
| | | } |
| | | } |
| | | |
| | | private void grdSub_CellEndEdit(object sender, DataGridViewCellEventArgs e) |
| | | { |
| | | DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid); |
| | | RowCount(e.RowIndex, 0); //è®¡ç® éé¢ åä»· |
| | | // |
| | | if (this.EditingControl != null) //éæ¾äºä»¶ |
| | | { |
| | | EditingControl.KeyDown -= new KeyEventHandler(this.EditingControl_KeyDown); |
| | | this.EditingControl = null; |
| | | } |
| | | } |
| | | |
| | | //æåºåçææ¡ç |
| | | private void kc_Click(object sender, EventArgs e) |
| | | { |
| | | long sHOrgID = -1; |
| | | string sWhere = ""; |
| | | |
| | | DAL.ClsGy_ORGANIZATIONS_View oClsGy_ORGANIZATIONS_View = new DAL.ClsGy_ORGANIZATIONS_View(); |
| | | if (oClsGy_ORGANIZATIONS_View.GetInfoByName(cmbHOrgID.Text)) |
| | | { |
| | | sHOrgID = oClsGy_ORGANIZATIONS_View.omodel.HItemID; |
| | | } |
| | | if (sHOrgID == -1) |
| | | { |
| | | MessageBox.Show("éæ©ç»ç»æé误ï¼"); |
| | | return; |
| | | } |
| | | sWhere = " and HOrgID =" + sHOrgID.ToString(); |
| | | BLL.Cls_S_KF_ICInventoryList_IF oadd = new BLL.Cls_S_KF_ICInventoryList_IF(); |
| | | if (oadd.Refresh(sWhere)) //éæ©åå |
| | | //if (oadd.Refresh(" and HErpClsID in (1,2,3) ")) //éæ©åå |
| | | { |
| | | FillSelectData(oadd.oBillSelectColl); |
| | | } |
| | | } |
| | | |
| | | |
| | | //è·åæ¬æç第å å¨ |
| | | private static int getWeekNumInMonth(DateTime daytime) |
| | | { |
| | | int dayInMonth = daytime.Day; |
| | | //æ¬æç¬¬ä¸å¤© |
| | | DateTime firstDay = daytime.AddDays(1 - daytime.Day); |
| | | //æ¬æç¬¬ä¸å¤©æ¯å¨å |
| | | int weekday = (int)firstDay.DayOfWeek == 0 ? 7 : (int)firstDay.DayOfWeek; |
| | | //æ¬æç¬¬ä¸å¨æå 天 |
| | | int firstWeekEndDay = 7 - (weekday - 1); |
| | | //å½åæ¥æå第ä¸å¨ä¹å·® |
| | | int diffday = dayInMonth - firstWeekEndDay; |
| | | diffday = diffday > 0 ? diffday : 1; |
| | | //å½åæ¯ç¬¬å å¨,妿æ´é¤7å°±åä¸å¤© |
| | | int WeekNumInMonth = ((diffday % 7) == 0 |
| | | ? (diffday / 7 - 1) |
| | | : (diffday / 7)) + 1 + (dayInMonth > firstWeekEndDay ? 1 : 0); |
| | | return WeekNumInMonth; |
| | | } |
| | | |
| | | //忥åºç¡èµæä¿¡æ¯ |
| | | private void tb_Click(object sender, EventArgs e) |
| | | { |
| | | try |
| | | { |
| | | oCn.RunProc("exec h_p_IF_ERPDataToLocal", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | MessageBox.Show("忥åºç¡èµææåï¼"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show("忥åºç¡èµæå¤±è´¥ï¼" + ex); |
| | | } |
| | | } |
| | | public Frm_Split oDlg = new Frm_Split(); |
| | | private void spRow_Click(object sender, EventArgs e) |
| | | { |
| | | //DBUtility.Xt_BaseBillFun.AddRow(oSumGrid); |
| | | oDlg.ShowDialog(); |
| | | if (oDlg.IsOk == 1) |
| | | { |
| | | grdMainData_CF(DBUtility.ClsPub.isInt(oDlg.txtHQ.Text)); |
| | | } |
| | | } |
| | | |
| | | |
| | | private void grdMainData_CF(int HQty) |
| | | { |
| | | double hq = 0; |
| | | int Qty = HQty - 1; |
| | | int row = grdMain.CurrentCell.RowIndex; |
| | | grdMain.Rows.Insert(row + 1, Qty); |
| | | hq = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[HQtyCol].Value) / HQty; |
| | | grdMain.Rows[row].Cells[HQtyCol].Value = hq; |
| | | for (int i = 0; i < Qty; i++) |
| | | { |
| | | int r = i + 1; |
| | | grdMain.Rows[row + r].Cells[HMaterIDCol].Value = grdMain.Rows[row].Cells[HMaterIDCol].Value; |
| | | grdMain.Rows[row + r].Cells[HMaterNumberCol].Value = grdMain.Rows[row].Cells[HMaterNumberCol].Value; |
| | | grdMain.Rows[row + r].Cells[HMaterNameCol].Value = grdMain.Rows[row].Cells[HMaterNameCol].Value; |
| | | grdMain.Rows[row + r].Cells[HMaterModelCol].Value = grdMain.Rows[row].Cells[HMaterModelCol].Value; |
| | | grdMain.Rows[row + r].Cells[HUnitIDCol].Value = grdMain.Rows[row].Cells[HUnitIDCol].Value; |
| | | grdMain.Rows[row + r].Cells[HUnitNameCol].Value = grdMain.Rows[row].Cells[HUnitNameCol].Value; |
| | | grdMain.Rows[row + r].Cells[HSourceIDCol].Value = grdMain.Rows[row].Cells[HSourceIDCol].Value; |
| | | grdMain.Rows[row + r].Cells[HSourceNumberCol].Value = grdMain.Rows[row].Cells[HSourceNumberCol].Value; |
| | | grdMain.Rows[row + r].Cells[HSourceNameCol].Value = grdMain.Rows[row].Cells[HSourceNameCol].Value; |
| | | grdMain.Rows[row + r].Cells[HQtyCol].Value = DBUtility.ClsPub.isDoule(hq, 4); |
| | | grdMain.Rows[row + r].Cells[HinitQtyCol].Value = DBUtility.ClsPub.isDoule(hq, 4); |
| | | grdMain.Rows[row + r].Cells[HMinQtyCol].Value = 0; |
| | | |
| | | grdMain.Rows[row + r].Cells[HTagCol].Value = grdMain.Rows[row].Cells[HTagCol].Value; |
| | | grdMain.Rows[row + r].Cells[HMainIDCol].Value = grdMain.Rows[row].Cells[HMainIDCol].Value; |
| | | grdMain.Rows[row + r].Cells[HSubIDCol].Value = grdMain.Rows[row].Cells[HSubIDCol].Value; |
| | | grdMain.Rows[row + r].Cells[HBillNoCol].Value = grdMain.Rows[row].Cells[HBillNoCol].Value; |
| | | grdMain.Rows[row + r].Cells[HBillTypeCol].Value = grdMain.Rows[row].Cells[HBillTypeCol].Value; |
| | | grdMain.Rows[row + r].Cells[HDateCol].Value = grdMain.Rows[row].Cells[HDateCol].Value; |
| | | grdMain.Rows[row + r].Cells[HShowDateCol].Value = grdMain.Rows[row].Cells[HShowDateCol].Value; |
| | | grdMain.Rows[row + r].Cells[HEndDateCol].Value = grdMain.Rows[row].Cells[HEndDateCol].Value; |
| | | grdMain.Rows[row + r].Cells[HSupIDCol].Value = grdMain.Rows[row].Cells[HSupIDCol].Value; |
| | | grdMain.Rows[row + r].Cells[HSupNumberCol].Value = grdMain.Rows[row].Cells[HSupNumberCol].Value; |
| | | grdMain.Rows[row + r].Cells[HSupNameCol].Value = grdMain.Rows[row].Cells[HSupNameCol].Value; |
| | | grdMain.Rows[row + r].Cells[HDeptIDCol].Value = grdMain.Rows[row].Cells[HDeptIDCol].Value; |
| | | grdMain.Rows[row + r].Cells[HDeptNumberCol].Value = grdMain.Rows[row].Cells[HDeptNumberCol].Value; |
| | | grdMain.Rows[row + r].Cells[HDeptNameCol].Value = grdMain.Rows[row].Cells[HDeptNameCol].Value; |
| | | grdMain.Rows[row + r].Cells[HBatchNoCol].Value = grdMain.Rows[row].Cells[HBatchNoCol].Value; |
| | | grdMain.Rows[row + r].Cells[HAuxPropIDCol].Value = grdMain.Rows[row].Cells[HAuxPropIDCol].Value; |
| | | grdMain.Rows[row + r].Cells[HAuxPropNumberCol].Value = grdMain.Rows[row].Cells[HAuxPropNumberCol].Value; |
| | | grdMain.Rows[row + r].Cells[HAuxPropNameCol].Value = grdMain.Rows[row].Cells[HAuxPropNameCol].Value; |
| | | grdMain.Rows[row + r].Cells[HRemarkCol].Value = grdMain.Rows[row].Cells[HRemarkCol].Value; |
| | | grdMain.Rows[row + r].Cells[HMTONoCol].Value = grdMain.Rows[row].Cells[HMTONoCol].Value; |
| | | grdMain.Rows[row + r].Cells[HInnerBillNoCol].Value = grdMain.Rows[row].Cells[HInnerBillNoCol].Value; |
| | | grdMain.Rows[row + r].Cells[HMakerCol].Value = grdMain.Rows[row].Cells[HMakerCol].Value; |
| | | //ç½æ ¼æå¾ |
| | | DataGridViewCheckBoxCell oCell = new DataGridViewCheckBoxCell(); |
| | | oCell.ThreeState = false; |
| | | oCell.Value = grdMain.Rows[row].Cells[HGiveAwayFlagCol].Value; |
| | | oCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; |
| | | grdMain.Rows[row + r].Cells[HGiveAwayFlagCol] = oCell; |
| | | |
| | | } |
| | | DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid); |
| | | } |
| | | |
| | | private void grdSub_CellContentClick(object sender, DataGridViewCellEventArgs e) |
| | | { |
| | | |
| | | } |
| | | |
| | | private void Display() |
| | | { |
| | | //设置档æ¡å表é项å¡è¡¨æ ¼æ°æ® |
| | | DataSet DSet = oCn.RunProcReturn("select * from h_v_IF_BarCodeBillList Where HinterID=" + HInterID.ToString() + " order by HItemID", "h_v_IF_BarCodeBillList", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //çæé¦è¡æ é¢ |
| | | if (DSet == null) |
| | | { |
| | | MessageBox.Show("没æè¿åä»»ä½ç»æ,æ¡ç ä¸åå¨ï¼" + DBUtility.ClsPub.sExeReturnInfo); |
| | | return; |
| | | } |
| | | // |
| | | grdList.DataSource = DSet.Tables[0].DefaultView; |
| | | //å»ç» |
| | | int FrCol = 0; |
| | | string s = "æ¯"; |
| | | DBUtility.Xt_BaseBillFun.DisplayGrid(grdList, this.Name + "grdList", s, FrCol); |
| | | //ç»çº¿ |
| | | //GraphLine(); |
| | | } |
| | | |
| | | // //è®¾ç½®å·¥åæ¡ç é项å¡è¡¨æ ¼æ°æ® |
| | | private void Display4() |
| | | { |
| | | if (grdMain.Rows.Count > 0) |
| | | { |
| | | //æ¥æè·åæ¹å¼ |
| | | string sDate = dtpHDate.Value.ToShortDateString(); // |
| | | string sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2); |
| | | string sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString(); |
| | | sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2); |
| | | string sDay = "0" + ClsPub.isDate(sDate).Day.ToString(); |
| | | sDay = sDay.Substring(sDay.Length - 2, 2); |
| | | |
| | | sDate = "20" + sYear + "-" + sPeriod + "-" + sDay; |
| | | |
| | | //è®¾ç½®å·¥åæ¡ç é项å¡è¡¨æ ¼æ°æ® |
| | | string sql = "select * from h_v_IF_BarCodeBillList Where æºååå· = '" + grdMain.Rows[0].Cells[HBillNoCol].Value + "' and HMaterID = " + grdMain.Rows[0].Cells[HMaterIDCol].Value + " and HSTOCKORGID = " + HOrgID + " and CONVERT(varchar(100),æ¡ç æ¥æ, 23) = '" + sDate + "' order by æ¡ç ç¼å·"; |
| | | DataSet DSet1 = oCn.RunProcReturn(sql, "h_v_IF_BarCodeBillList", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //çæé¦è¡æ é¢ |
| | | if (DSet1 == null) |
| | | { |
| | | return; |
| | | } |
| | | // |
| | | grdBillBarCodeList.DataSource = DSet1.Tables[0].DefaultView; |
| | | //å»ç» |
| | | int FrCol = 0; |
| | | string s = "æ¯"; |
| | | DBUtility.Xt_BaseBillFun.DisplayGrid(grdBillBarCodeList, this.Name + "grdBillBarCodeList", s, FrCol); |
| | | //ç»çº¿ |
| | | //GraphLine(); |
| | | // |
| | | } |
| | | } |
| | | |
| | | //å
³èæé® |
| | | private void gl_Click(object sender, EventArgs e) |
| | | { |
| | | try |
| | | { |
| | | long HInterID = DBUtility.ClsPub.isLong(grdList.Rows[0].Cells[Fun_GetCol("HInterID")].Value); |
| | | string HBarCode = DBUtility.ClsPub.isStrNull(grdList.Rows[0].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value); |
| | | string HBarCodeType = DBUtility.ClsPub.isStrNull(grdList.Rows[0].Cells[Fun_GetCol("æ¡ç ç±»å")].Value); |
| | | string HSourceBillType = DBUtility.ClsPub.isStrNull(grdList.Rows[0].Cells[Fun_GetCol("HSourceBillType")].Value); |
| | | |
| | | DataSet oDs = oCn.RunProcReturn("exec h_p_WMS_BarCodeToICStockBillSub_Insert " + HInterID.ToString() + ",'" + HBarCode + "','" + HBarCodeType + "','" + HSourceBillType + "'", "h_p_WMS_BarCodeToICStockBillSub_Insert"); |
| | | // |
| | | if (oDs == null && oDs.Tables[0].Rows.Count == 0) |
| | | { |
| | | MessageBox.Show("å
³èèªå¨çææ¡ç åºå
¥åºè®°å½å¤±è´¥ï¼"); |
| | | } |
| | | else |
| | | { |
| | | MessageBox.Show(DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HRemark"])); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show("å
³èèªå¨çææ¡ç åºå
¥åºè®°å½å¤±è´¥22ï¼" + ex); |
| | | } |
| | | } |
| | | |
| | | //æ¹æ¬¡æé® |
| | | private void BatchNo_Click(object sender, EventArgs e) |
| | | { |
| | | lblCaption.Focus(); |
| | | bool b = false; |
| | | for (int i = 0; i < grdMain.RowCount; i++) |
| | | { |
| | | long HMaterID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMaterIDCol].Value); // ç©æå
ç |
| | | string HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HBatchNoCol].Value); // æ¹å· |
| | | |
| | | if (HMaterID != 0) |
| | | { |
| | | DataSet oDs = oCn.RunProcReturn("exec h_p_Gy_BarCodeBill_GetBatchNo " + HMaterID.ToString() + ",'" + HBatchNo + "','" + dtpHDate.Value.ToShortDateString() + "','" + CampanyName + "'", "h_p_Gy_BarCodeBill_GetBatchNo"); |
| | | // |
| | | if (oDs == null && oDs.Tables[0].Rows.Count == 0) |
| | | { |
| | | MessageBox.Show("çææ¹æ¬¡å¤±è´¥ï¼"); |
| | | return; |
| | | } |
| | | else if (DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0][0]) == "1") |
| | | { |
| | | grdMain.Rows[i].Cells[HBatchNoCol].Value = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["HBatchNo"]); |
| | | b = true; |
| | | } |
| | | } |
| | | } |
| | | //æç»è¡¨æ¯å¦ä¸ºé¶è¡ |
| | | if (b == false) |
| | | { |
| | | MessageBox.Show("没æéè¦çææ¹æ¬¡çæç»è¡ï¼", "æç¤º"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | private void txtHSourceBillNo_KeyPress(object sender, KeyPressEventArgs e) |
| | | { |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | //çæå¤ç®±ç |
| | | private void wxm_Click(object sender, EventArgs e) |
| | | { |
| | | try |
| | | { |
| | | Int64 iInterID = 0; |
| | | Int64 dPackQty = 0; //å¤ç®±æ°é |
| | | Int64 dPackLeftQty = 0; //å¤ç®±å©ä½æ°é |
| | | Int64 dLabelQty = 0; //å°ç®±æ°é |
| | | Int64 dQty = 0; //æ»æ°é |
| | | Int64 dEntryID = 0; //è¡å· |
| | | string sPackBarCode = ""; //å¤ç®±ç |
| | | string sBarCode = ""; //å¯ä¸ç |
| | | Int64 LSH = 0; |
| | | DataSet Ds; |
| | | string sYear = DateTime.Today.Year.ToString().Substring(2, 2); |
| | | string sPeriod = "0" + DateTime.Today.Month.ToString(); |
| | | sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2); |
| | | string sDay = "0" + DateTime.Today.Day.ToString(); |
| | | sDay = sDay.Substring(sDay.Length - 2, 2); |
| | | // |
| | | string sPackStr = "ZXM" + sYear + sPeriod + sDay; //å¤ç®±ç åç¼ |
| | | |
| | | //å¿
é¡»æ¡ç çææé®æ¯ç°åº¦æå¯ä»¥çæç®±æ¡ç |
| | | if (bc.Enabled != false) |
| | | { |
| | | MessageBox.Show("请å
çææ¡å½¢ç ï¼åçæç®±æ¡ç "); |
| | | return; |
| | | } |
| | | //-------------------æ ¹æ®HINTERIDçæç®±æ¡ç |
| | | //çæå夿ï¼å¾ªç¯ç©æç½æ ¼ï¼å¤æ æ¯å¦è®¾ç½®äºåçç å¤ç®±æ°éã å¤ç®±æ°é å¿
é¡»æ¯ æå°å
è£
æ°ç åæ° å¹¶å¿
须大äº0å大äºçäºæå°å
è£
æ°éã |
| | | for (int i = 0; i < grdMain.Rows.Count; i++) |
| | | { |
| | | if (DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMaterIDCol].Value) != 0) |
| | | { |
| | | if (DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value) <= 0) |
| | | { |
| | | MessageBox.Show("请å½å
¥åççå¤ç®±æ°éï¼ç¬¬" + Convert.ToString(i + 1) + "è¡"); |
| | | return; |
| | | } |
| | | if (DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value) |
| | | % DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMinQtyCol].Value) != 0 |
| | | || DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value) |
| | | < DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMinQtyCol].Value)) |
| | | { |
| | | MessageBox.Show("å¤ç®±æ°éå¿
é¡»æ¯æå°å
è£
æ°çåæ°ï¼ä¸å¤§äºçäºæå°å
è£
æ°ï¼ç¬¬" + Convert.ToString(i + 1) + "è¡"); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | //oCn.BeginTran(); |
| | | //ä»0è¡è¿è¡å¾ªç¯ ç©æç½æ ¼ï¼è·åå¤ç®±æ°é |
| | | for (int i = 0; i < grdMain.Rows.Count; i++) |
| | | { |
| | | if (DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMaterIDCol].Value) != 0) |
| | | { |
| | | //è·åæ»æ°éãå¤ç®±æ°é |
| | | dPackQty = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value); |
| | | dQty = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HQtyCol].Value); |
| | | dEntryID = i + 1; |
| | | dPackLeftQty = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value); |
| | | //çæä¸ä¸ªå¤ç®±ç |
| | | Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sPackStr + "'", "h_p_WMS_GetMaxNo"); //è·åæå¤§æµæ°´å· //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]) + 1; |
| | | sPackBarCode = sPackStr + LSH.ToString(); |
| | | oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'"); |
| | | //åå¾ªç¯ æ¡ç ç½æ ¼ |
| | | for (int j = 0; j < grdSub.Rows.Count; j++) |
| | | { |
| | | if (dEntryID == DBUtility.ClsPub.isLong(grdSub.Rows[j].Cells[HEntryID2Col].Value)) |
| | | { |
| | | if (dQty <= 0) |
| | | { |
| | | continue; |
| | | } |
| | | if (dPackLeftQty > 0) //å½å©ä½å¤ç®±æ°éå°äºçäº0æ¶ï¼éæ°çæå¤ç®±ç |
| | | { |
| | | } |
| | | else |
| | | { |
| | | //çæä¸ä¸ªå¤ç®±ç |
| | | Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sPackStr + "'", "h_p_WMS_GetMaxNo"); //è·åæå¤§æµæ°´å· //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]) + 1; |
| | | sPackBarCode = sPackStr + LSH.ToString(); |
| | | oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'"); |
| | | dPackLeftQty = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value); |
| | | } |
| | | sBarCode = DBUtility.ClsPub.isStrNull(grdSub.Rows[j].Cells[HTMCol].Value); // æ¡ç |
| | | dLabelQty = DBUtility.ClsPub.isLong(grdSub.Rows[j].Cells[HQty2Col].Value); // å°ç®±æ°é |
| | | oCn.RunProc("update Gy_BarCodebill set HInnerBillNo= '" + sPackBarCode + "' Where HbarCode='" + sBarCode + "'"); |
| | | dPackLeftQty = dPackLeftQty - dLabelQty; |
| | | dQty = dQty - dLabelQty; |
| | | if (dPackLeftQty <= 0)//å½ç®±å©ä½æ°éå°äºçäº0æ¶ æ§è¡ ç»æå |
| | | { |
| | | //è·åç»æåå
ç |
| | | iInterID = DBUtility.ClsPub.CreateBillID("3783", ref DBUtility.ClsPub.sExeReturnInfo); ;//å¾å°æ°åå·; |
| | | //æ ¹æ®å¤ç®±ç åå
¥ ç»æå主表ï¼ç»æåå表ï¼SUMï¼å¤ç®±ç æ¡£æ¡ï¼SUMæ¡£æ¡ |
| | | oCn.RunProc("exec h_p_WMS_PackUnionBill_AddNew '" + sPackBarCode + "'," + iInterID.ToString() + ",'" + DBUtility.ClsPub.CurUserName + "'," + HInterID.ToString()); //æ ¹æ®ç®±æ¡ç ï¼åå
¥ 主表ï¼å表 ï¼ç®±æ¡ç æ¡£æ¡ |
| | | oCn.RunProc("exec h_p_WMS_PackUnionBill_SumSubBill " + iInterID.ToString() + ",'" + sPackBarCode + "','3783','" + DBUtility.ClsPub.CurUserName + "'," + HInterID.ToString()); //æ ¹æ®ç®±æ¡ç ï¼åå
¥ SUM表ï¼SUMæ¡ç æ¡£æ¡ |
| | | } |
| | | } |
| | | else |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | wxm.Enabled = false; |
| | | //oCn.Commit(); |
| | | MessageBox.Show("çæç®±ç 宿¯ï¼"); |
| | | //å·æ°æ°æ® |
| | | Display(); |
| | | } |
| | | catch (Exception e1) |
| | | { |
| | | //oCn.RollBack(); |
| | | MessageBox.Show("çæç®±ç 失败ï¼" + e1.Message); |
| | | } |
| | | } |
| | | |
| | | private void cmbSourceBillType_TextChanged(object sender, EventArgs e) |
| | | { |
| | | if (cmbSourceBillType.Text == "å·¥åºæµè½¬å¡") |
| | | { |
| | | cmbHBarCodeType.Items.Clear(); |
| | | cmbHBarCodeType.Items.Add("åºåç "); |
| | | this.cmbHBarCodeType.SelectedIndex = 0; |
| | | } |
| | | else |
| | | { |
| | | if (CampanyName == "å¤å®çµå¨") |
| | | { |
| | | cmbHBarCodeType.Items.Clear(); |
| | | cmbHBarCodeType.Items.Add("å
éæºæ¡ç "); |
| | | cmbHBarCodeType.Items.Add("å¤éæºæ¡ç "); |
| | | cmbHBarCodeType.Items.Add("åæåæ¡ç "); |
| | | this.cmbHBarCodeType.SelectedIndex = 0; |
| | | } |
| | | else if (CampanyName == "åæ¥ç§æ") |
| | | { |
| | | cmbHBarCodeType.Items.Clear(); |
| | | cmbHBarCodeType.Items.Add("仪å¨å¤è´ä»¶æ¡ç æ®éè§å"); |
| | | cmbHBarCodeType.Items.Add("仪å¨å¤è´ä»¶æ¡ç 容å¨è§å"); |
| | | cmbHBarCodeType.Items.Add("ä»ªå¨æåæ¡ç è§å"); |
| | | cmbHBarCodeType.Items.Add("è¯åæåæ¡ç è§å"); |
| | | this.cmbHBarCodeType.SelectedIndex = 0; |
| | | } |
| | | else if (CampanyName == "䏿§") |
| | | { |
| | | cmbHBarCodeType.Items.Clear(); |
| | | cmbHBarCodeType.Items.Add("å¯ä¸æ¡ç "); |
| | | this.cmbHBarCodeType.SelectedIndex = 0; |
| | | } |
| | | else |
| | | { |
| | | cmbHBarCodeType.Items.Clear(); |
| | | cmbHBarCodeType.Items.Add("å¯ä¸æ¡ç "); |
| | | cmbHBarCodeType.Items.Add("åç§æ¡ç "); |
| | | cmbHBarCodeType.Items.Add("æ¹æ¬¡æ¡ç "); |
| | | this.cmbHBarCodeType.SelectedIndex = 0; |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void cmdSourceBillNo_Click_1(object sender, EventArgs e) |
| | | { |
| | | cmdSourceBillNo_Click(sender, e); |
| | | } |
| | | |
| | | private void button_startListen_Click(object sender, EventArgs e) |
| | | { |
| | | try |
| | | { |
| | | if (grdMain.Rows.Count == 0 || grdMain.Rows[0].Cells[HMaterIDCol].Value == null || grdMain.Rows[0].Cells[HMaterIDCol].Value.ToString() == "" || grdMain.Rows[0].Cells[HMaterIDCol].Value.ToString() == "0") |
| | | { |
| | | MessageBox.Show("è¯·éæ©æºåï¼"); |
| | | return; |
| | | } |
| | | |
| | | if (textBox_IPParams.Text == "") |
| | | { |
| | | MessageBox.Show("请设置IPå°åï¼"); |
| | | return; |
| | | } |
| | | if (textBox_PortParams.Text == "") |
| | | { |
| | | MessageBox.Show("请设置端å£å·ï¼"); |
| | | return; |
| | | } |
| | | |
| | | if (comboBox_PrinterParams.Text == "") |
| | | { |
| | | MessageBox.Show("è¯·éæ©æå°æºï¼"); |
| | | return; |
| | | } |
| | | |
| | | if (textBox_PrintModelParams.Text == "") |
| | | { |
| | | MessageBox.Show("请设置æå°æ¨¡æ¿ï¼"); |
| | | return; |
| | | } |
| | | |
| | | if (!judgePrinterIsConnected()) |
| | | { |
| | | MessageBox.Show("æå°æºå¤äºç¦»çº¿ç¶æï¼è¯·æ£æ¥ï¼"); |
| | | return; |
| | | } |
| | | |
| | | socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); |
| | | IPAddress iPAddress = IPAddress.Parse(textBox_IPParams.Text); |
| | | IPEndPoint point = new IPEndPoint(iPAddress, Convert.ToInt32(textBox_PortParams.Text)); |
| | | socket.Connect(point); |
| | | |
| | | Thread thread = new Thread(ReceiveMess); |
| | | thread.Start(); |
| | | MessageBox.Show("è¿æ¥æåï¼"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show(ex.Message); |
| | | } |
| | | } |
| | | |
| | | //socketé讯ï¼å®¢æ·ç«¯æ¥æ¶ä¿¡æ¯ |
| | | private void ReceiveMess() |
| | | { |
| | | try |
| | | { |
| | | while (true) |
| | | { |
| | | byte[] buffer = new byte[1024 * 1024 * 5]; |
| | | int length = socket.Receive(buffer); |
| | | if (length == 0) |
| | | { |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | string RMess = Encoding.UTF8.GetString(buffer, 0, length); |
| | | long produceQty = ClsPub.isLong(RMess); |
| | | |
| | | for (int i = 0; i < produceQty; i++) |
| | | { |
| | | //çææ¡ç |
| | | this.Sub_SaveBill(); |
| | | |
| | | //è·åéè¦æå°çæ°æ® |
| | | Display(); |
| | | |
| | | //设置æå°æ¨¡æ¿ï¼æå° |
| | | grdList.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; |
| | | } |
| | | Report.Print(false); |
| | | } |
| | | |
| | | //éæ°å è½½è¯¥ç©æå½å¤©çæçæ¡ç |
| | | Display4(); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show("æ¥å£å¼å¸¸ï¼å·²å
³éè¿æ¥ï¼" + ex.Message); |
| | | socket.Close(); |
| | | } |
| | | } |
| | | |
| | | private void button_stopListen_Click(object sender, EventArgs e) |
| | | { |
| | | try |
| | | { |
| | | if (socket.Connected) |
| | | { |
| | | socket.Close(); |
| | | } |
| | | else |
| | | { |
| | | MessageBox.Show("å½åå°æªè¿æ¥"); |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show(ex.Message); |
| | | } |
| | | } |
| | | |
| | | private void button_resetParams_Click(object sender, EventArgs e) |
| | | { |
| | | //comboBox_SourceNameParams.Items.Clear(); |
| | | //comboBox_PrinterParams.Items.Clear(); |
| | | |
| | | //DBUtility.Xt_BaseBillFun.Sub_ClearBill(groupBox_ParamsInfo); |
| | | } |
| | | |
| | | //åå
¥é
ç½®åæ° |
| | | private void saveParams() |
| | | { |
| | | //夿æä»¶æ¯å¦åå¨ |
| | | if (!File.Exists(Application.StartupPath + "//Gy_BarCodeBill_automaticallyByPLC.txt")) |
| | | { |
| | | FileStream fs1 = new FileStream(Application.StartupPath + "//Gy_BarCodeBill_automaticallyByPLC.txt", FileMode.Create, FileAccess.Write);//å建åå
¥æä»¶ |
| | | StreamWriter sw = new StreamWriter(fs1); |
| | | sw.WriteLine(textBox_IPParams.Text);//å¼å§åå
¥å¼ |
| | | sw.WriteLine(textBox_PortParams.Text); |
| | | |
| | | sw.WriteLine(comboBox_SourceNameParams.Text); |
| | | |
| | | sw.WriteLine(comboBox_PrinterParams.Text); |
| | | sw.WriteLine(textBox_PrintModelParams.Text); |
| | | sw.Close(); |
| | | fs1.Close(); |
| | | } |
| | | else |
| | | { |
| | | FileStream fs1 = new FileStream(Application.StartupPath + "//Gy_BarCodeBill_automaticallyByPLC.txt", FileMode.Create, FileAccess.Write);//å建åå
¥æä»¶ |
| | | StreamWriter sw = new StreamWriter(fs1); |
| | | sw.WriteLine(textBox_IPParams.Text);//å¼å§åå
¥å¼ |
| | | sw.WriteLine(textBox_PortParams.Text); |
| | | |
| | | sw.WriteLine(comboBox_SourceNameParams.Text); |
| | | |
| | | sw.WriteLine(comboBox_PrinterParams.Text); |
| | | sw.WriteLine(textBox_PrintModelParams.Text); |
| | | sw.Close(); |
| | | fs1.Close(); |
| | | } |
| | | |
| | | MessageBox.Show("ä¿åæåï¼"); |
| | | } |
| | | |
| | | private void readParams() |
| | | { |
| | | if (File.Exists(Application.StartupPath + "//Gy_BarCodeBill_automaticallyByPLC.txt")) |
| | | { |
| | | //读åæä»¶å¼å¹¶æ¾ç¤ºå°çªä½ |
| | | FileStream fs = new FileStream(Application.StartupPath + "//Gy_BarCodeBill_automaticallyByPLC.txt", FileMode.Open, FileAccess.ReadWrite); |
| | | StreamReader sr = new StreamReader(fs); |
| | | string line = sr.ReadLine(); |
| | | int curLine = 0; |
| | | while (line != null) |
| | | { |
| | | if (++curLine == 1) |
| | | { |
| | | textBox_IPParams.Text = line; |
| | | } |
| | | else if (curLine == 2) |
| | | { |
| | | textBox_PortParams.Text = line; |
| | | } |
| | | else if (curLine == 3) |
| | | { |
| | | for (int i = 0; i < comboBox_SourceNameParams.Items.Count; i++) |
| | | { |
| | | if (comboBox_SourceNameParams.Items[i].ToString() == line) |
| | | { |
| | | comboBox_SourceNameParams.Text = line; |
| | | } |
| | | } |
| | | |
| | | if (comboBox_SourceNameParams.Text == "") |
| | | { |
| | | comboBox_SourceNameParams.Items.Add(line); |
| | | comboBox_SourceNameParams.Text = line; |
| | | } |
| | | } |
| | | else if (curLine == 4) |
| | | { |
| | | for (int i = 0; i < comboBox_PrinterParams.Items.Count; i++) |
| | | { |
| | | if (comboBox_PrinterParams.Items[i].ToString() == line) |
| | | { |
| | | comboBox_PrinterParams.Text = line; |
| | | } |
| | | } |
| | | } |
| | | else if (curLine == 5) |
| | | { |
| | | textBox_PrintModelParams.Text = line; |
| | | } |
| | | else |
| | | { |
| | | |
| | | } |
| | | line = sr.ReadLine(); |
| | | } |
| | | sr.Close(); |
| | | fs.Close(); |
| | | } |
| | | } |
| | | |
| | | private void button_saveParams_Click(object sender, EventArgs e) |
| | | { |
| | | saveParams(); |
| | | } |
| | | |
| | | //夿æå°æºæ¯å¦å¯ç¨ |
| | | private bool judgePrinterIsConnected() |
| | | { |
| | | //è·åçµèè¿æ¥çæå°æºå表 |
| | | ManagementObjectSearcher searcher = new |
| | | ManagementObjectSearcher("SELECT * FROM Win32_Printer"); |
| | | |
| | | //å¹é
设置çæå°æºï¼å¹¶å¤ææ¯å¦å¯ç¨ |
| | | string printerName = ""; |
| | | foreach (ManagementObject printer in searcher.Get()) |
| | | { |
| | | printerName = printer["Name"].ToString().ToLower(); |
| | | if (printerName.Equals(comboBox_PrinterParams.Text.ToLower())) |
| | | { |
| | | string HPrinterName = printer.Properties["Name"].Value.ToString(); //è·åæå°æºåç§° |
| | | string HPrinterPort = printer.Properties["PortName"].Value.ToString(); //è·åæå°æºç«¯å£å· |
| | | string HPrinterDefault = printer.Properties["Default"].Value.ToString(); //è·åæå°æºæ¯å¦æ¯é»è®¤æå°æº |
| | | string HPrinterWorkStatus = printer.Properties["PrinterStatus"].Value.ToString(); //è·åæå°æºå·¥ä½ç¶æ(1:å
¶ä»ï¼2:æªç¥ï¼3:空é²ï¼4:æå°ï¼5:é¢çï¼6:忢æå°ï¼7:è±æº) |
| | | string HIsOffOnline = printer.Properties["WorkOffline"].Value.ToString(); //è·åæå°æºæ¯å¦ç¦»çº¿ |
| | | |
| | | |
| | | string isConnected = printer["WorkOffline"].ToString().ToLower(); |
| | | |
| | | if (isConnected.Equals("true")) |
| | | { |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | } |