| | |
| | | using System.Threading; |
| | | using System.IO; |
| | | using Pub_Class; |
| | | using System.IO.Ports; |
| | | using System.Linq; |
| | | |
| | | namespace WarM |
| | | { |
| | |
| | | public Int64 HInterID = 0; |
| | | public string HBillNo = ""; |
| | | public string HBillType = "1202"; |
| | | public Int64 HMaterID = 0; |
| | | public string HBatchNo = ""; |
| | | public Int64 HAuxPropID = 0; |
| | | public Int64 HUnitID = 0; |
| | | public Int64 HWhID = 0; |
| | |
| | | public Int64 HSourceEntryID = 0; |
| | | public string HSourceBillNo = ""; |
| | | public string HSourceBillType = ""; |
| | | public Int64 ProcessExchangeInterID = 0; |
| | | public Int64 HProcessExchangeInterID = 0; |
| | | public Int64 HSupID = 0; |
| | | public double HSourceQty = 0; |
| | | public double HMaterWeight = 0; //ç©æå
é |
| | |
| | | public string PrintQtyCtl = ""; //æ¡ç æå°æ¬¡æ°æ§å¶ |
| | | public string UpdatePrintQtyCtl = ""; //æ¡ç æå°æ¬¡æ°æ´æ° |
| | | public string sBarCodeItemID = ""; //æ¡ç èªå¢å |
| | | public string HBarCode_Pack = ""; //ææ¡ç |
| | | public long HSNo = 0; //ç»æè®¡æ°ç¨ |
| | | public DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl(); |
| | | public DBUtility.ClsPub.Enum_BillStatus BillStatus; |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | |
| | | grdMain.DataSource = null; |
| | | grdSub.DataSource = null; |
| | | chkHDYFlag.Checked = true; |
| | | |
| | | //è¯»å æå¼ä¸²å£çé
ç½®ä¿¡æ¯ |
| | | readParams(); |
| | | } |
| | | |
| | | //çªä½å è½½ |
| | |
| | | { |
| | | HInterID = DBUtility.ClsPub.CreateBillID_Prod(HBillType, ref DBUtility.ClsPub.sExeReturnInfo); //å¾å°æ°åæ®ID |
| | | HBillNo = DBUtility.ClsPub.CreateBillCode_Prod(HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true); //å¾å°æ°åæ®å· |
| | | HSNo = 0; |
| | | this.lblSNo.Text = ""; |
| | | } |
| | | else if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | HInterID = DBUtility.ClsPub.CreateBillID_Prod(HBillType, ref DBUtility.ClsPub.sExeReturnInfo); //å¾å°æ°åæ®ID |
| | | HBillNo = DBUtility.ClsPub.CreateBillCode_Prod(HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true); //å¾å°æ°åæ®å· |
| | | HSNo = 0; |
| | | this.lblSNo.Text = ""; |
| | | } |
| | | else |
| | | { |
| | |
| | | if (grdSub.Rows.Count > 0) |
| | | { |
| | | grdSub.Rows[0].Selected = true; |
| | | SourceBill(); |
| | | SourceBill(1); |
| | | txtHQty.Focus(); |
| | | } |
| | | else |
| | |
| | | return false; |
| | | } |
| | | |
| | | if (DBUtility.ClsPub.isStrNull(txtHBarCode_Pack.Text) != "") |
| | | { |
| | | MessageBox.Show("å½åç»ææªç»æï¼è¯·ç»æç»æååç¹å»æ¢çï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | |
| | | //夿ä¼è®¡ææ¯å¦åç |
| | | string s = ""; |
| | | int sYear = 0; |
| | |
| | | + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ") "); |
| | | //æ´æ°å
³èæ°é |
| | | oCn.RunProc("exec h_p_Sc_UpDateRelation_ICMOToProductIn_Add " + HInterID.ToString()); |
| | | //åå¡«å·²çåç¶æ |
| | | oCn.RunProc("Update KF_WeighSource_Temp set HRelationInterID=1 where HInterID= " + HInterID.ToString()); |
| | | MessageBox.Show("çæç产å
¥åºåï¼" + HBillNo + " æåï¼", "æç¤º"); |
| | | oCn.Commit(); |
| | | return true; |
| | |
| | | |
| | | private void tc_Click(object sender, EventArgs e) |
| | | { |
| | | this.Close(); |
| | | //éåºæ¶å
³éä¸²å£ |
| | | if (ComDevice != null) |
| | | { |
| | | CloseCom(); |
| | | } |
| | | |
| | | this.Close(); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | Source_Display(); |
| | | grdSub.Rows[0].Selected = true; |
| | | DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp); |
| | | SourceBill(); |
| | | SourceBill(2); |
| | | txtHBarCode.Text = ""; |
| | | txtHQty.Focus(); |
| | | } |
| | |
| | | } |
| | | Source_Display(); |
| | | grdSub.Rows[0].Selected = true; |
| | | DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp); |
| | | SourceBill(); |
| | | SourceBill(2); |
| | | txtHBarCode.Text = ""; |
| | | txtHQty.Focus(); |
| | | } |
| | |
| | | |
| | | private void cmdSourceBillNo_Click(object sender, EventArgs e) |
| | | { |
| | | //åå§åå³è¾¹è¡¨å¤´ä¿¡æ¯ |
| | | cmbHBarCodeType.Items.Clear(); |
| | | cmbHBarCodeType.Items.Add("å¯ä¸æ¡ç "); |
| | | DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp); |
| | | |
| | | if (grdSub.CurrentRow == null) |
| | | { |
| | | MessageBox.Show("请å¨å·¦è¾¹åæ®å表ä¸éæ©ä¸è¡åæ®ï¼", "æç¤º"); |
| | |
| | | } |
| | | else |
| | | { |
| | | SourceBill(); |
| | | SourceBill(3); |
| | | txtHQty.Focus(); |
| | | } |
| | | } |
| | |
| | | } |
| | | SaveBarCode(); |
| | | BarCode_Display(); |
| | | if (DBUtility.ClsPub.isStrNull(txtHBarCode_Pack.Text) != "") |
| | | { |
| | | this.lblSNo.Text = "å½åå·²ç» " + HSNo + " ä»¶"; |
| | | } |
| | | grdMain.Rows[0].Selected = true; |
| | | |
| | | sBarCodeItemID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.SelectedRows[0].Index].Cells[Fun_GetCol("HItemID")].Value).ToString(); |
| | |
| | | //æ¡ç çæå夿 |
| | | private bool Sub_AllowSave() |
| | | { |
| | | //夿å½ååæ®IDæ¯å¦å·²ä¸ä¼ çæåæ® |
| | | DataSet Ds = oCn.RunProcReturn("select top 1 1 from KF_WeighSource_Temp with(nolock) where HInterID=" + HInterID.ToString() + " and HRelationInterID=1 ", "KF_WeighSource_Temp", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | } |
| | | else |
| | | { |
| | | MessageBox.Show("å½åæ¡ç è®°å½å·²æ¢çä¸ä¼ çæåæ®ï¼è¯·éåºåéæ°è¿å
¥è¯¥æ¨¡åè¿è¡æ¡ç çææä½ï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | |
| | | if (HInterID==0 || HBillNo=="") |
| | | { |
| | | MessageBox.Show("è·åæ¡ç 对åºåæ®IDæåæ®å·å¤±è´¥ï¼è¯·éæ°å·æ°çé¢ï¼", "æç¤º"); |
| | |
| | | else if (DBUtility.ClsPub.isDoule( txtHWeightQyt.Text) == 0) |
| | | { |
| | | MessageBox.Show("请è¾å
¥æ£ç¡®ééï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | else if (DBUtility.ClsPub.isDoule(txtHQty.Text)- DBUtility.ClsPub.isDoule(txtHKDQty.Text) <= 0) |
| | | { |
| | | MessageBox.Show("è¾å
¥çæ£ç¹æ°ä¸è½å¤§äºç±³æ°ï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | else if (DBUtility.ClsPub.isInt(txtHBarcodeNo.Text) == 0) |
| | |
| | | MessageBox.Show("ç©æé»è®¤ä»åºå¯ç¨äºä»ä½ï¼ä½æªè®¾ç½®ä»ä½ï¼è·åä»ä½ä¿¡æ¯å¤±è´¥ï¼è¯·å
è®¾ç½®ç©æé»è®¤ä»ä½ï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | //å®é
å
éè¶
åºç¾åä¹äºåæè
ä¸è¶³åæ¬çç¾åä¹å
«åï¼è¯·æ£æ¥è¾å
¥çæ°æ®æ¯å¦çç¡® |
| | | else if (DBUtility.ClsPub.isDoule(txtHWeightQyt.Text)> HMaterWeight*1.2 || DBUtility.ClsPub.isDoule(txtHWeightQyt.Text) < HMaterWeight * 0.8) |
| | | |
| | | //å®é
å
é=éé/ç±³æ°*1000ï¼å®é
å
éè¶
åºç©æç»´æ¤å
éçç¾åä¹äºåæä¸è¶³ç©æç»´æ¤å
éçç¾åä¹å
«åï¼é¢è¦æç¤º |
| | | double sQty = 0; //å®é
å
é |
| | | sQty = DBUtility.ClsPub.isDoule(txtHWeightQyt.Text) / DBUtility.ClsPub.isDoule(txtHQty.Text) * 1000; |
| | | |
| | | if (sQty > HMaterWeight * 1.2 || sQty < HMaterWeight * 0.8) |
| | | { |
| | | if (MessageBox.Show("ç©æç»´æ¤å
é为ï¼"+HMaterWeight.ToString()+ "ï¼å®é
è¾å
¥å
é为ï¼" + DBUtility.ClsPub.isStrNull(txtHWeightQyt.Text) + "ï¼æè¾å
¥å®é
å
éè¶
åºç©æç»´æ¤å
éçç¾åä¹äºåæä¸è¶³ç©æç»´æ¤å
éçç¾åä¹å
«åï¼è¯·æ£æ¥è¾å
¥çæ°æ®æ¯å¦æ£ç¡®ï¼", "æç¤º", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) |
| | | if (MessageBox.Show("ç©æç»´æ¤å
é为ï¼"+HMaterWeight.ToString()+ "ï¼å®é
å
é为ï¼" + sQty.ToString() + "ï¼æè¾å
¥å®é
å
éè¶
åºç©æç»´æ¤å
éçç¾åä¹äºåæä¸è¶³ç©æç»´æ¤å
éçç¾åä¹å
«åï¼è¯·æ£æ¥è¾å
¥çæ°æ®æ¯å¦æ£ç¡®ï¼", "æç¤º", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) |
| | | { |
| | | //return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //æ¡ç çæåæ§å¶å¤æ |
| | | double HNowQty = 0; //ç±³æ° |
| | | double HWeightQyt = 0; //éé |
| | | double HKDQty = 0; //æ£ç¹æ° |
| | | HNowQty = DBUtility.ClsPub.isDoule(txtHQty.Text); |
| | | HWeightQyt = DBUtility.ClsPub.isDoule(txtHWeightQyt.Text); |
| | | HKDQty = DBUtility.ClsPub.isDoule(txtHKDQty.Text); |
| | | |
| | | DataSet oDsCheck = oCn.RunProcReturn("exec h_p_Kf_WeighToBarCode_AddBarCodeCheck " + HInterID.ToString() + "," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + "," + HProcessExchangeInterID.ToString() + "," + HSourceQty.ToString() + "," + HNowQty.ToString() + "," + HWeightQyt.ToString() + "," + HKDQty.ToString(), "h_p_Kf_WeighToBarCode_AddBarCodeCheck"); |
| | | // |
| | | 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") |
| | | { |
| | | MessageBox.Show(DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0]["HRemark"]), "æç¤º"); |
| | | return false; |
| | | } |
| | | else if (DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0][0]) == "2") |
| | | { |
| | | if (MessageBox.Show(DBUtility.ClsPub.isStrNull(oDsCheck.Tables[0].Rows[0]["HRemark"]), "æç¤º", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) |
| | | { |
| | | return true; |
| | | } |
| | |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | else |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | //çææ¡ç |
| | |
| | | |
| | | string HBarCode = ""; |
| | | string HBarCodeType = ""; |
| | | double HQty = 0; //ç±³æ° |
| | | double HNowQty = 0; //ç±³æ° |
| | | double HMaterialJQty = 0; //éé |
| | | double HMaterialMQty = 0; //æ£ç¹æ° |
| | | double HQty = 0; //æ°é |
| | | Int64 HDeptID = 0; |
| | | string HRemark = ""; |
| | | string HMaterName = ""; |
| | | string HMaterModel = ""; |
| | | string ProcessExchangeBillNo = ""; |
| | | string HProcessExchangeBillNo = ""; |
| | | Int64 HBarcodeNo = 0; //å
æ° |
| | | Int64 HBadReasonID = 0; //ä¸è¯åå ID |
| | | string HCusMaterName = ""; //客æ·ç©æåç§° |
| | |
| | | |
| | | HBarCode = TM; |
| | | HBarCodeType = DBUtility.ClsPub.isStrNull(cmbHBarCodeType.Text); |
| | | HQty = DBUtility.ClsPub.isDoule(txtHQty.Text); |
| | | HNowQty = DBUtility.ClsPub.isDoule(txtHQty.Text); |
| | | HMaterialJQty = DBUtility.ClsPub.isDoule(txtHWeightQyt.Text); |
| | | HMaterialMQty = DBUtility.ClsPub.isDoule(txtHKDQty.Text); |
| | | HQty = HNowQty- HMaterialMQty; |
| | | HDeptID = DBUtility.ClsPub.isLong(txtHDeptName.Tag); |
| | | HRemark = DBUtility.ClsPub.isStrNull(txtHRemark.Text); |
| | | HMaterName = DBUtility.ClsPub.isStrNull(txtHMaterName.Text); |
| | | HMaterModel = DBUtility.ClsPub.isStrNull(txtHMaterModel.Text); |
| | | ProcessExchangeBillNo = DBUtility.ClsPub.isStrNull(txtHBillNo.Text); |
| | | HProcessExchangeBillNo = DBUtility.ClsPub.isStrNull(txtHBillNo.Text); |
| | | HBarcodeNo = DBUtility.ClsPub.isLong(txtHBarcodeNo.Text); |
| | | HBadReasonID = DBUtility.ClsPub.isLong(txtHRemark.Tag); |
| | | HCusMaterName = DBUtility.ClsPub.isStrNull(txtHCusMaterName.Text); |
| | | HCusModel = DBUtility.ClsPub.isStrNull(txtHCusModel.Text); |
| | | if (HBarCode_Pack != "") |
| | | { |
| | | HSNo = HSNo + 1; |
| | | } |
| | | |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | //åå
¥æ¡ç æ¡£æ¡ (客æ·ç©æåç§°HCusMaterNameåå
¥HMaterialModelåæ®µï¼å®¢æ·è§æ ¼åå·HCusModelåå
¥HCusModelåæ®µ |
| | | //åå
¥æ¡ç æ¡£æ¡ (客æ·ç©æåç§°HCusMaterNameåå
¥HMaterialModelåæ®µï¼å®¢æ·è§æ ¼åå·HCusModelåå
¥HCusModelåæ®µï¼ä¸è¯åå IDåå
¥HCustomQty1åæ®µï¼ |
| | | oCn.RunProc("Insert into Gy_BarCodeBill " + |
| | | "(HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" + |
| | | ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + |
| | | ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + |
| | | ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + |
| | | ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate,HMaterialJQty,HMaterialMQty " + |
| | | ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HGiveAwayFlag " + |
| | | ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate,HMaterialJQty,HMaterialMQty,HNowQty " + |
| | | ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HGiveAwayFlag,HBarCode_Pack " + |
| | | ",HOrderInterID,HOrderEntryID,HOrderBillNo,HCustomQty1,HMaterialModel,HCusModel " + |
| | | ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " + |
| | | ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HLogo,HPackflag " + |
| | | ") Values (" |
| | | + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString() |
| | | + ",'" + HBatchNo + "'," + HSupID.ToString() + ",0,'" + HMaker + "',getdate(),0," + HQty.ToString() |
| | | + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "',''" |
| | | + ", 1," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'" |
| | | + ", 0,'',getdate(),'','" + sDate + "'," + HMaterialJQty.ToString() + "," + HMaterialMQty.ToString() |
| | | + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",''," + HInterID.ToString() + ",0" |
| | | + ", " + ProcessExchangeInterID.ToString() + ",0,'" + ProcessExchangeBillNo + "'," + HBadReasonID.ToString() + ",'" + HCusMaterName + "','" + HCusModel + "'" |
| | | + ",'" + HMaterName + "','" + HMaterModel + "',''," + HAuxPropID.ToString() + ",'','')"); |
| | | + ", 0,'',getdate(),'','" + sDate + "'," + HMaterialJQty.ToString() + "," + HMaterialMQty.ToString() + "," + HNowQty.ToString() |
| | | + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",''," + HInterID.ToString() + ",0,'" + HBarCode_Pack + "'" |
| | | + ", " + HProcessExchangeInterID.ToString() + ",0,'" + HProcessExchangeBillNo + "'," + HBadReasonID.ToString() + ",'" + HCusMaterName + "','" + HCusModel + "'" |
| | | + ",'" + HMaterName + "','" + HMaterModel + "',''," + HAuxPropID.ToString() + ",'','','1',0)"); |
| | | |
| | | //åå¡«æå¤§æµæ°´å· |
| | | oCn.RunProc("exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "',1 "); |
| | | |
| | | //åå¡«æºå临æ¶è¡¨HInterID |
| | | oCn.RunProc("update a set a.HInterID=" + HInterID.ToString() + ",a.HBillNo='" + HBillNo + "' from KF_WeighSource_Temp a where a.HInterID<>" + HInterID.ToString() + " and a.HMaker='" + HMaker + "' and convert(varchar(10),a.HMakeDate,120)=convert(varchar(10),getdate(),120)"); |
| | | oCn.RunProc("update a set a.HInterID=" + HInterID.ToString() + ",a.HBillNo='" + HBillNo +"',a.HRelationInterID= 0 from KF_WeighSource_Temp a where a.HInterID<>" + HInterID.ToString() + " and a.HMaker='" + HMaker + "' and a.HSourceBillNo='" + HProcessExchangeBillNo + "'"); |
| | | |
| | | //åå
¥æ¡ç åºå
¥åºä¸´æ¶è¡¨ |
| | | oCn.RunProc("Insert into KF_PonderationBillMain_Temp " + |
| | |
| | | " Values(" |
| | | + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HMaterID.ToString() + "," + HAuxPropID.ToString() + ",0" |
| | | + "," + HWhID.ToString() + ",0," + HSPID.ToString() + ",0,0,''" |
| | | +",0," + HQty.ToString() + ",1,'" + HBatchNo + "','" + HBarCode + "',''" |
| | | +",'" + HMaker + "',getdate()," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillType + "','" + HSourceBillNo + "'" |
| | | +",0," + HQty.ToString() + ",1,'" + HBatchNo + "','" + HBarCode + "','" + HBarCode_Pack + "'" |
| | | + ",'" + HMaker + "',getdate()," + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillType + "','" + HSourceBillNo + "'" |
| | | +",0,0,'',0,'',0" |
| | | +"," + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",'','ç§°éå
¥åºçæ','2'" |
| | | +",0,0,'',0)"); |
| | |
| | | |
| | | #region //è¿åä¿¡æ¯ |
| | | |
| | | //è¿åæºååè¡¨ä¿¡æ¯ |
| | | private void SourceBill() |
| | | //è¿åæºåå表信æ¯(num=1ï¼æå¼æ¨¡åæ¶å è½½æ¾ç¤ºï¼num=2ï¼æ«æµè½¬å¡æ¾ç¤ºï¼num=3ï¼éåæé®æ¾ç¤º) |
| | | private void SourceBill(int num) |
| | | { |
| | | //æå¼æ¨¡åæ¶å è½½æ¾ç¤º |
| | | if (num == 1) |
| | | { |
| | | txtHBarCode_Pack.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HBarCode_Pack")].Value); |
| | | HBarCode_Pack = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HBarCode_Pack")].Value); |
| | | HSNo = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HSNo")].Value); |
| | | if (HBarCode_Pack == "") |
| | | { |
| | | this.lblSNo.Text = ""; |
| | | } |
| | | else |
| | | { |
| | | this.lblSNo.Text = "å½åå·²ç» " + HSNo + " ä»¶"; |
| | | cmdHBPack.Enabled = false; |
| | | } |
| | | } |
| | | //æ«æµè½¬å¡æ¾ç¤º |
| | | if (num == 2) |
| | | { |
| | | //åå§åå³è¾¹è¡¨å¤´ä¿¡æ¯ |
| | | DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp); |
| | | if (HBarCode_Pack != "") |
| | | { |
| | | txtHBarCode_Pack.Text = HBarCode_Pack; |
| | | this.lblSNo.Text = "å½åå·²ç» " + HSNo + " ä»¶"; |
| | | } |
| | | } |
| | | //éåæé®æ¾ç¤º |
| | | if (num == 3) |
| | | { |
| | | if (HBarCode_Pack != "" && (HMaterID != DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HMaterID")].Value) |
| | | || HBatchNo != DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("æ¹å·")].Value))) |
| | | { |
| | | MessageBox.Show("ææ«ææµè½¬å¡å¯¹åºç©æãæ¹å·ä¸å½åæ£å¨ç»æç©æãæ¹å·ä¸ä¸è´ï¼ä¸åç©æãæ¹å·ä¸å
è®¸ç»æå¨å䏿ä¸ï¼å¦éæ¢ç©æçææ¡ç 请å
ç»æå½åç»æï¼", "æç¤º"); |
| | | return; |
| | | } |
| | | //åå§åå³è¾¹è¡¨å¤´ä¿¡æ¯ |
| | | DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp); |
| | | if (HBarCode_Pack != "") |
| | | { |
| | | txtHBarCode_Pack.Text = HBarCode_Pack; |
| | | this.lblSNo.Text = "å½åå·²ç» " + HSNo + " ä»¶"; |
| | | } |
| | | } |
| | | txtHBillNo.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("åæ®å·")].Value); |
| | | txtHDeptName.Tag = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HDeptID")].Value); |
| | | txtHDeptName.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("车é´")].Value); |
| | |
| | | txtHBatchNo.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("æ¹å·")].Value); |
| | | txtHCusMaterName.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HCusMaterName")].Value); |
| | | txtHCusModel.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HCusModel")].Value); |
| | | HMaterID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HMaterID")].Value); |
| | | HBatchNo = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("æ¹å·")].Value); |
| | | HAuxPropID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HAuxPropID")].Value); |
| | | HUnitID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HUnitID")].Value); |
| | | HWhID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HWhID")].Value); |
| | |
| | | HSourceBillNo = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("ç产订å")].Value); |
| | | HSourceBillType = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HSourceBillType")].Value); |
| | | HSourceQty = DBUtility.ClsPub.isDoule(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("æ°é")].Value); |
| | | ProcessExchangeInterID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("ProcessExchangeInterID")].Value); |
| | | HProcessExchangeInterID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("ProcessExchangeInterID")].Value); |
| | | HSupID = DBUtility.ClsPub.isLong(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HSupID")].Value); |
| | | HMaterWeight = DBUtility.ClsPub.isDoule(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("HMaterWeight")].Value); |
| | | txtHOrderPickRemark.Text = DBUtility.ClsPub.isStrNull(grdSub.SelectedRows[0].Cells[Fun_GetSubCol("订åå
è£
夿³¨")].Value); |
| | | } |
| | | |
| | | //è¿åæºååè¡¨ä¿¡æ¯ |
| | |
| | | string HItemID = ""; |
| | | string HBarCode = ""; |
| | | string HBarCode2 = ""; |
| | | long HSNo_Temp = HSNo; |
| | | for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++) |
| | | { |
| | | HItemID = HItemID + "," + DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString()); |
| | |
| | | { |
| | | HRemark = HRemark + "ã" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value); |
| | | } |
| | | //æ´æ°å½åå·²ç»æä»¶æ° |
| | | if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) != "" |
| | | && DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) == HBarCode_Pack |
| | | && DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç±»å")].Value) != "æçæ¡ç ") |
| | | { |
| | | HSNo = HSNo - 1; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç±»å")].Value) == "æçæ¡ç ") |
| | | { |
| | | if (DBUtility.ClsPub.isBool(grdMain.SelectedRows[i].Cells[Fun_GetCol("HPackflag")].Value)) |
| | | { |
| | | MessageBox.Show("æéæ¡ç ç¼å·ï¼" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value) + " 为æçæ¡ç ï¼ä¸å·²ç»æçæå¯¹åºç»æåï¼ä¸å
许ä½åºï¼", "æç¤º"); |
| | | return; |
| | | } |
| | | else if (HSNo > 0) |
| | | { |
| | | MessageBox.Show("æéæ¡ç ç¼å·ï¼" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value) + " 为æçæ¡ç ï¼ä¸å½åæçæ¡ç ä¸å·²çæå¯¹åºæ¡ç ï¼ä¸å
许ä½åºï¼", "æç¤º"); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | HBarCode_Pack = ""; |
| | | } |
| | | } |
| | | } |
| | | if (HRemark != "") |
| | | { |
| | | HSNo = HSNo_Temp; |
| | | HBarCode_Pack = DBUtility.ClsPub.isStrNull(txtHBarCode_Pack.Text); |
| | | MessageBox.Show("æéæ¡ç ç¼å·ï¼"+ HRemark.Remove(0, 1)+" å·²ä½åºï¼ä¸å
许éå¤ä½åºï¼", "æç¤º"); |
| | | return; |
| | | } |
| | |
| | | catch (Exception e2) |
| | | { |
| | | oCn.RollBack(); |
| | | HSNo = HSNo_Temp; |
| | | HBarCode_Pack = DBUtility.ClsPub.isStrNull(txtHBarCode_Pack.Text); |
| | | MessageBox.Show("ä½åºæ¡ç 失败ï¼" + e2.Message, "æç¤º"); |
| | | return; |
| | | } |
| | | //å·æ°ç§°éè®°å½åè¡¨ä¿¡æ¯ |
| | | BarCode_Display(); |
| | | if (HBarCode_Pack != "") |
| | | { |
| | | this.lblSNo.Text = "å½åå·²ç» " + HSNo + " ä»¶"; |
| | | } |
| | | else |
| | | { |
| | | txtHBarCode_Pack.Text = ""; |
| | | this.lblSNo.Text = ""; |
| | | cmdHBPack.Enabled = true; |
| | | } |
| | | MessageBox.Show("æéæ¡ç ç¼å·ï¼" + HBarCode.Remove(0, 1) + " ä½åºæåï¼", "æç¤º"); |
| | | } |
| | | } |
| | |
| | | string HItemID = ""; |
| | | string HBarCode = ""; |
| | | string HBarCode2 = ""; |
| | | long HSNo_Temp = HSNo; |
| | | bool HFlag = false; |
| | | |
| | | //çé¢ä¸ä¸ºæªå¯ç¨ç»æç¶æ |
| | | if (HBarCode_Pack == "") |
| | | { |
| | | for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++) |
| | | { |
| | | //夿æ¡ç æ¯å¦ä¸ºæçæ¡ç ï¼æªçæç»æåï¼å·²ä½åºç¶æï¼çé¢ä¸ä¸ºæªç»æç¶æ |
| | | if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç±»å")].Value) == "æçæ¡ç " |
| | | && DBUtility.ClsPub.isBool(grdMain.SelectedRows[i].Cells[Fun_GetCol("HPackflag")].Value) == false |
| | | && DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("ä½åºæ è®°")].Value) != "" |
| | | ) |
| | | { |
| | | HFlag = true; |
| | | HBarCode_Pack = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++) |
| | | { |
| | | HItemID = HItemID + "," + DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString()); |
| | |
| | | { |
| | | HRemark = HRemark + "ã" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value); |
| | | } |
| | | |
| | | //æ¡ç ä¸ºç»ææ¡ç |
| | | if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) != "") |
| | | { |
| | | //å·²ä¸ä¼ çæç»æå |
| | | if (DBUtility.ClsPub.isBool(grdMain.SelectedRows[i].Cells[Fun_GetCol("HPackflag")].Value)) |
| | | { |
| | | |
| | | } |
| | | //æªä¸ä¼ çæç»æå |
| | | else |
| | | { |
| | | //æ¡ç å¯¹åºææ¡ç åçé¢ä¸çææ¡ç ä¸è´ |
| | | if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) == HBarCode_Pack) |
| | | { |
| | | //æ´æ°å½åå·²ç»æä»¶æ° |
| | | if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç±»å")].Value) != "æçæ¡ç ") |
| | | { |
| | | HSNo = HSNo + 1; |
| | | } |
| | | |
| | | } |
| | | //æ¡ç å¯¹åºææ¡ç åçé¢ä¸çææ¡ç ä¸ä¸è´ |
| | | else |
| | | { |
| | | MessageBox.Show("æéæ¡ç ç¼å·ï¼" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value) + " å¯¹åºææ¡ç ï¼" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) + " å·²çæç»æåï¼æå·²ä½åºï¼ä¸å
许åä½åºï¼", "æç¤º"); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (HRemark != "") |
| | | { |
| | | HSNo = HSNo_Temp; |
| | | if(HFlag) |
| | | { |
| | | HBarCode_Pack = ""; |
| | | } |
| | | MessageBox.Show("æéæ¡ç ç¼å·ï¼" + HRemark.Remove(0, 1) + " æªä½åºï¼ä¸å
许åä½åºï¼", "æç¤º"); |
| | | return; |
| | | } |
| | |
| | | ",HCusID,HDeptID,HCusBarCode,HMulSourceBill) " + |
| | | " select " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "',HMaterID,HAuxPropID,0" + |
| | | ",HWhID,0,HSPID,0,0,''" + |
| | | ",0,HQty,1,HBatchNo,HBarCode,''" + |
| | | ",0,HQty,1,HBatchNo,HBarCode,HBarCode_Pack" + |
| | | ",'" + HMaker + "',getdate(),HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" + |
| | | ",0,0,'',0,'',0" + |
| | | ",HSTOCKORGID,HSTOCKORGID,HSTOCKORGID,'','ç§°éå
¥åºçæ-åä½åº','2'" + |
| | | ",0,0,'',0" + |
| | | "from Gy_BarCodeBill with(nolock) where HItemID in (" + HItemID + ")" |
| | | "from Gy_BarCodeBill with(nolock) where HItemID in (" + HItemID + ") and HBarCodeType='å¯ä¸æ¡ç ' " |
| | | ); |
| | | |
| | | //åå
¥ç³»ç»æ¥å¿ |
| | |
| | | catch (Exception e2) |
| | | { |
| | | oCn.RollBack(); |
| | | HSNo = HSNo_Temp; |
| | | if (HFlag) |
| | | { |
| | | HBarCode_Pack = ""; |
| | | } |
| | | MessageBox.Show("åä½åºæ¡ç 失败ï¼" + e2.Message, "æç¤º"); |
| | | return; |
| | | } |
| | | //å·æ°ç§°éè®°å½åè¡¨ä¿¡æ¯ |
| | | BarCode_Display(); |
| | | if (HBarCode_Pack != "") |
| | | { |
| | | txtHBarCode_Pack.Text = HBarCode_Pack; |
| | | this.lblSNo.Text = "å½åå·²ç» " + HSNo + " ä»¶"; |
| | | cmdHBPack.Enabled = false; |
| | | } |
| | | else |
| | | { |
| | | txtHBarCode_Pack.Text = ""; |
| | | this.lblSNo.Text = ""; |
| | | cmdHBPack.Enabled = true; |
| | | } |
| | | MessageBox.Show("æéæ¡ç ç¼å·ï¼" + HBarCode.Remove(0, 1) + " åä½åºæåï¼", "æç¤º"); |
| | | } |
| | | } |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region //å¼å§ç»æ |
| | | private void cmdHBPack_Click(object sender, EventArgs e) |
| | | { |
| | | if (!PackSub_AllowSave()) |
| | | { |
| | | return; |
| | | } |
| | | HSNo = 0; |
| | | SavePackBarCode(); |
| | | BarCode_Display(); |
| | | this.lblSNo.Text = "å½åå·²ç» " + HSNo + " ä»¶"; |
| | | grdMain.Rows[0].Selected = true; |
| | | txtHBarCode_Pack.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.SelectedRows[0].Index].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value); |
| | | HBarCode_Pack = DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.SelectedRows[0].Index].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value); |
| | | cmdHBPack.Enabled = false; |
| | | |
| | | sBarCodeItemID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.SelectedRows[0].Index].Cells[Fun_GetCol("HItemID")].Value).ToString(); |
| | | //èªå¨æå° |
| | | //if (chkHDYFlag.Checked == true) |
| | | //{ |
| | | // //æå°æ¡ç |
| | | // Sub_SetReport("æçæ¡ç "); |
| | | // Report.Print(false); |
| | | // Thread.Sleep(1000); |
| | | //} |
| | | //else |
| | | { |
| | | //éæ©æå°æ¨¡æ¿ |
| | | BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp(); |
| | | oFrm.sBillName = ModName; |
| | | oFrm.sBillModel = ModCaption; |
| | | oFrm.ShowDialog(); |
| | | if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK) |
| | | { |
| | | Sub_SetReport(oFrm.sOpenTmp); |
| | | Report.Print(false); |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //æ¡ç çæå夿 |
| | | private bool PackSub_AllowSave() |
| | | { |
| | | //夿å½ååæ®IDæ¯å¦å·²ä¸ä¼ çæåæ® |
| | | DataSet Ds = oCn.RunProcReturn("select top 1 1 from KF_WeighSource_Temp with(nolock) where HInterID=" + HInterID.ToString() + " and HRelationInterID=1 ", "KF_WeighSource_Temp", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | } |
| | | else |
| | | { |
| | | MessageBox.Show("å½åæ¡ç è®°å½å·²æ¢çä¸ä¼ çæåæ®ï¼è¯·éåºåéæ°è¿å
¥è¯¥æ¨¡åè¿è¡æ¡ç çææä½ï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | |
| | | if (HInterID == 0 || HBillNo == "") |
| | | { |
| | | MessageBox.Show("è·åæ¡ç 对åºåæ®IDæåæ®å·å¤±è´¥ï¼è¯·éæ°å·æ°çé¢ï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | if (HProcessExchangeInterID == 0) |
| | | { |
| | | MessageBox.Show("请å
æ«ææµè½¬å¡å·ï¼", "æç¤º"); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | //çææçæ¡ç |
| | | private void SavePackBarCode() |
| | | { |
| | | int LSHlen = 6; //æµæ°´å·é¿åº¦ |
| | | Int64 LSH = 0; //æµæ°´å· |
| | | string LSH2 = ""; //æµæ°´å·è½¬æ¢æå符 |
| | | string sDate = ""; //æ¥æ |
| | | string sYear = ""; //å¹´ |
| | | string sPeriod = ""; //æ |
| | | string sDay = ""; //æ¥ |
| | | string sTMNumber = ""; //æ¡ç èªå®ä¹åç¼ |
| | | string TM = ""; //æ¡ç ç¼å· |
| | | DataSet Ds; |
| | | |
| | | //æ¥æè·åæ¹å¼ |
| | | sDate = dtpHDate.Value.ToShortDateString(); |
| | | sYear = DBUtility.ClsPub.isDate(sDate).Year.ToString().Substring(2, 2); |
| | | sPeriod = "0" + DBUtility.ClsPub.isDate(sDate).Month.ToString(); |
| | | sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2); |
| | | sDay = "0" + DBUtility.ClsPub.isDate(sDate).Day.ToString(); |
| | | sDay = sDay.Substring(sDay.Length - 2, 2); |
| | | //================================== |
| | | //æ¡ç åç¼ = 'TP' + ç»ç»ä»£ç + å¹´ + æ + æ¥ |
| | | sTMNumber = "TP" + DBUtility.ClsPub.HOrgNumber + sYear + sPeriod + sDay; |
| | | Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //è·åæå¤§æµæ°´å· |
| | | LSH = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]); |
| | | LSH = LSH + 1; |
| | | LSH2 = LSH.ToString(); |
| | | while (LSH2.Length < LSHlen) //å¦ææµæ°´å·å°äº6使°åé¢è¡¥0 |
| | | { |
| | | LSH2 = "0" + LSH2; |
| | | } |
| | | TM = sTMNumber + LSH2; |
| | | |
| | | string HBarCode = ""; |
| | | string HBarCodeType = ""; |
| | | string HMaterID = ""; //ç©æå
ç |
| | | string HBatchNo = ""; //æ¹æ¬¡ |
| | | string HMaterName = ""; |
| | | string HMaterModel = ""; |
| | | string HProcessExchangeBillNo = ""; |
| | | string HCusMaterName = ""; //客æ·ç©æåç§° |
| | | string HCusModel = ""; //客æ·è§æ ¼åå· |
| | | |
| | | HBarCode = TM; |
| | | HBarCodeType = "æçæ¡ç "; |
| | | HMaterID = DBUtility.ClsPub.isStrNull(txtHMaterNumber.Tag); |
| | | HBatchNo = DBUtility.ClsPub.isStrNull(txtHBatchNo.Text); |
| | | HMaterName = DBUtility.ClsPub.isStrNull(txtHMaterName.Text); |
| | | HMaterModel = DBUtility.ClsPub.isStrNull(txtHMaterModel.Text); |
| | | HProcessExchangeBillNo = DBUtility.ClsPub.isStrNull(txtHBillNo.Text); |
| | | HCusMaterName = DBUtility.ClsPub.isStrNull(txtHCusMaterName.Text); |
| | | HCusModel = DBUtility.ClsPub.isStrNull(txtHCusModel.Text); |
| | | |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | //åå
¥æ¡ç æ¡£æ¡ |
| | | oCn.RunProc("Insert into Gy_BarCodeBill " + |
| | | "(HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HBarCode_Pack" + |
| | | ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" + |
| | | ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + |
| | | ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + |
| | | ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate,HMaterialJQty,HMaterialMQty,HNowQty " + |
| | | ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HGiveAwayFlag " + |
| | | ",HOrderInterID,HOrderEntryID,HOrderBillNo,HCustomQty1,HMaterialModel,HCusModel " + |
| | | ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HLogo,HPackflag " + |
| | | ") Values (" |
| | | + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + ",1,'" + HBarCode + "'" |
| | | + ",'" + HBatchNo + "'," + HSupID.ToString() + ",0,'" + HMaker + "',getdate(),0,1" |
| | | + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "',''" |
| | | + ",1,0,0,0,0,''" |
| | | + ", 0,'',getdate(),'','" + sDate + "',0,0,0" |
| | | + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",''," + HInterID.ToString() + ",0" |
| | | + ", " + HProcessExchangeInterID.ToString() + ",0,'" + HProcessExchangeBillNo + "',0,'" + HCusMaterName + "','" + HCusModel + "'" |
| | | + ",'" + HMaterName + "','" + HMaterModel + "',''," + HAuxPropID.ToString() + ",'','','1',0)"); |
| | | |
| | | //åå¡«æå¤§æµæ°´å· |
| | | oCn.RunProc("exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "',1 "); |
| | | oCn.Commit(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCn.RollBack(); |
| | | MessageBox.Show("æçæ¡ç çæå¤±è´¥ï¼" + e.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region //ç»æç»æ |
| | | private void cmdHEPack_Click(object sender, EventArgs e) |
| | | { |
| | | //çæç»æåå夿 |
| | | if(HBarCode_Pack=="") |
| | | { |
| | | MessageBox.Show("请å
ç¹å»å¼å§ç»æï¼è¿è¡æ¡ç ç»ææä½ï¼", "æç¤º"); |
| | | return; |
| | | } |
| | | bool b = false; |
| | | for (int i = 0; i < grdMain.RowCount; i++) |
| | | { |
| | | if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[Fun_GetCol("æ¡ç ç±»å")].Value) == "å¯ä¸æ¡ç " |
| | | && DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[Fun_GetCol("HBarCode_Pack")].Value) == HBarCode_Pack |
| | | && DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[Fun_GetCol("ä½åºæ è®°")].Value) == "") |
| | | { |
| | | b = true; |
| | | break; |
| | | } |
| | | } |
| | | if (b == false) |
| | | { |
| | | MessageBox.Show("å½åæçæ¡ç ä¸è¿æ²¡çæå¯¹åºæ¡ç ï¼ä¸å
许çæç»æåï¼", "æç¤º"); |
| | | return; |
| | | } |
| | | |
| | | //夿ä¼è®¡ææ¯å¦åç |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | MessageBox.Show(s, "æç¤º"); |
| | | return; |
| | | } |
| | | |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | //çæçäº§ç»æå |
| | | Int64 HPUInterID = DBUtility.ClsPub.CreateBillID_Prod("3783", ref DBUtility.ClsPub.sExeReturnInfo); //å¾å°ææ°çäº§ç»æåID |
| | | string HPUBillNo = DBUtility.ClsPub.CreateBillCode_Prod("3783", ref DBUtility.ClsPub.sExeReturnInfo, true); //å¾å°ææ°çäº§ç»æåå· |
| | | |
| | | //åå
¥çäº§ç»æå主表 |
| | | oCn.RunProc("Insert Into Sc_PackUnionBillMain " + |
| | | "(HInterID,HBillNo,HBillType,HBillSubType,HDate,HRemark" + |
| | | ",HYear,HPeriod,HChecker,HCheckDate,HMaker,HMakeDate" + |
| | | ",HICMOInterID,HICMOBillNo,HBarCode_Pack,HMaterID,HUnitID,HProdOrgID" + |
| | | ") Values (" |
| | | + " " + HPUInterID.ToString() + ",'" + HPUBillNo + "','3783','3783',convert(varchar(10),getdate(),120),''" |
| | | + "," + sYear.ToString() + "," + sPeriod.ToString() + ",'" + HMaker + "',getdate(),'" + HMaker + "',getdate()" |
| | | + ",0,'','" + HBarCode_Pack + "',0,0," + HStockOrgID.ToString() + ") "); |
| | | |
| | | //åå
¥ç产è£
ç®±åå表 |
| | | oCn.RunProc("Insert into Sc_PackUnionBillSub " + |
| | | "(HInterID,HEntryID,HRelationQty,HRelationMoney,HRemark" + |
| | | ",HMaterID,HUnitID,HQty,HBarCode,HBarCode_Pack,HScanDate" + |
| | | ",HAuxPropID,HBatchNo,HMTONo" + |
| | | ",HSourceID,HEquipID,HGroupID,HWorkerID,HStatus" + |
| | | ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType) " + |
| | | " select " + HPUInterID.ToString() + ",HItemID,0,0,''" + |
| | | ",HMaterID,HUnitID,HQty,HBarCode,HBarCode_Pack,getdate()" + |
| | | ",HAuxPropID,HBatchNo,HMTONo" + |
| | | ",0,0,0,0,0" + |
| | | ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" + |
| | | " from Gy_BarCodeBill with(nolock) where HInterID=" + HInterID.ToString() + " and HBarCode_Pack='" + HBarCode_Pack + "' and HStopflag=0 and HBarCodeType='å¯ä¸æ¡ç ' " |
| | | ); |
| | | |
| | | //åå¡«æ¡ç æ¡£æ¡ç»ææ è®° |
| | | oCn.RunProc("update Gy_BarCodeBill set HPackflag=1 where HInterID=" + HInterID.ToString() + " and HBarCode_Pack='" + HBarCode_Pack + "' and HStopflag=0", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | MessageBox.Show("çæçäº§ç»æåï¼" + HPUBillNo + " æåï¼", "æç¤º"); |
| | | |
| | | txtHBarCode_Pack.Text = ""; |
| | | HBarCode_Pack = ""; |
| | | cmdHBPack.Enabled = true; |
| | | HSNo = 0; |
| | | this.lblSNo.Text = ""; |
| | | BarCode_Display(); |
| | | oCn.Commit(); |
| | | return; |
| | | } |
| | | catch (Exception e2) |
| | | { |
| | | oCn.RollBack(); |
| | | MessageBox.Show("çæçäº§ç»æå失败ï¼" + e2.Message); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region 读å设å¤ç§°éä¿¡æ¯ |
| | | |
| | | |
| | | |
| | | private static string repeatData = string.Empty; |
| | | private SerialPort ComDevice = null; |
| | | |
| | | private int HGetWeight = 0; |
| | | private string Message = ""; |
| | | |
| | | private int timeIndex = 0; |
| | | |
| | | private string value_COM = ""; //COM |
| | | private string value_BaudRate = "9600"; //æ¯ç¹ç |
| | | private string value_StopBits = "1"; //åæ¢ä½ |
| | | private string value_Parity = "0"; //æ ¡éªä½ |
| | | private string value_DataBits = "8"; //æ°æ®ä½ |
| | | |
| | | #region æå¼ä¸²å£æé®è§¦åäºä»¶ |
| | | private void button_OpenCom_Click(object sender, EventArgs e) |
| | | { |
| | | value_COM = textBox_COM.Text; |
| | | OpenCom(); |
| | | } |
| | | #endregion |
| | | |
| | | #region æå¼ä¸²å£ |
| | | public void OpenCom() |
| | | { |
| | | //åå§åä¸²å£ |
| | | ComDevice = new SerialPort(); |
| | | ComDevice.DataReceived += new SerialDataReceivedEventHandler(Com_DataReceived);//ç»å®äºä»¶ |
| | | string[] PortNames = SerialPort.GetPortNames(); |
| | | |
| | | if (!ComDevice.IsOpen) |
| | | { |
| | | try |
| | | { |
| | | ComDevice.PortName = value_COM; |
| | | ComDevice.BaudRate = int.Parse(value_BaudRate); |
| | | switch (value_Parity) |
| | | { |
| | | case "0": |
| | | ComDevice.Parity = Parity.None; |
| | | break; |
| | | case "1": |
| | | ComDevice.Parity = Parity.Odd; |
| | | break; |
| | | case "2": |
| | | ComDevice.Parity = Parity.Even; |
| | | break; |
| | | case "3": |
| | | ComDevice.Parity = Parity.Mark; |
| | | break; |
| | | case "4": |
| | | ComDevice.Parity = Parity.Space; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | ComDevice.DataBits = int.Parse(value_DataBits); |
| | | switch (value_StopBits) |
| | | { |
| | | case "0": |
| | | ComDevice.StopBits = StopBits.None; |
| | | break; |
| | | case "1": |
| | | ComDevice.StopBits = StopBits.One; |
| | | break; |
| | | case "2": |
| | | ComDevice.StopBits = StopBits.Two; |
| | | break; |
| | | case "1.5": |
| | | ComDevice.StopBits = StopBits.OnePointFive; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | ComDevice.Open(); |
| | | |
| | | MessageBox.Show("䏲壿弿åï¼"); |
| | | |
| | | //ä¿å串å£çé
ç½®ä¿¡æ¯ |
| | | saveParams(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show("æå¼ä¸²å£å¤±è´¥ï¼" + ex.Message, "é误", MessageBoxButtons.OK, MessageBoxIcon.Error); |
| | | return; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region å
³éä¸²å£ |
| | | public void CloseCom() |
| | | { |
| | | if (!ComDevice.IsOpen) |
| | | { |
| | | MessageBox.Show("串å£å
³é失败ï¼å½å䏲壿ªæå¼ï¼"); |
| | | } |
| | | else |
| | | { |
| | | try |
| | | { |
| | | Thread.Sleep(100); |
| | | ComDevice.Close(); |
| | | |
| | | MessageBox.Show("串å£å
³éæåï¼"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show(ex.Message, "é误", MessageBoxButtons.OK, MessageBoxIcon.Error); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¥æ¶æ°æ® |
| | | private void Com_DataReceived(object sender, SerialDataReceivedEventArgs e) |
| | | { |
| | | if (HGetWeight == 1) |
| | | { |
| | | byte[] ReDatas = new byte[ComDevice.BytesToRead]; |
| | | ComDevice.Read(ReDatas, 0, ReDatas.Length);//è¯»åæ°æ® |
| | | this.AddData(ReDatas);//è¾åºæ°æ® |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region å¤çæ¥æ¶å°çæ°æ® |
| | | public void AddData(byte[] data) |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | | sb.Append(Encoding.ASCII.GetString(data)); |
| | | |
| | | var str = sb.ToString(); |
| | | str = str.Replace("w", "").Replace("n", "").Replace("kg\r\n", ";"); |
| | | |
| | | |
| | | if (str != repeatData) |
| | | { |
| | | repeatData = str; |
| | | string[] strArray = str.Split(';'); |
| | | |
| | | for (int i = 0; i < strArray.Length; i++) |
| | | { |
| | | if (double.TryParse(strArray[i], out double ret))//夿æ¯å¦æ¯æ°å |
| | | { |
| | | //ä¿çä¸ä½å°æ° |
| | | double temp = double.Parse(strArray[i]); |
| | | temp = Math.Round(temp,1); |
| | | |
| | | Message += double.Parse(strArray[i]) + ";"; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region è·åæ°ç»ä¸åºç°é¢çæé«çæ°æ® |
| | | private string getMostStr(string message) |
| | | { |
| | | string[] strArray = message.Split(';'); |
| | | // 使ç¨LINQæ¥è¯¢åºç°æ¬¡æ°æå¤çå
ç´ |
| | | var maxElement = strArray.GroupBy(x => x) |
| | | .OrderByDescending(g => g.Count()) |
| | | .First() |
| | | .Key; |
| | | |
| | | |
| | | return maxElement; |
| | | } |
| | | #endregion |
| | | |
| | | #region 计æ¶å¨è§¦åäºä»¶ï¼ç¨äºè·åæ¶é´é´éå
æ¥æ¶å°çæ°æ® |
| | | private void timer2_Tick(object sender, EventArgs e) |
| | | { |
| | | if (timeIndex == 0) |
| | | { |
| | | timeIndex = 1; |
| | | } |
| | | else |
| | | { |
| | | timer2.Enabled = false; |
| | | |
| | | string str = getMostStr(Message); |
| | | |
| | | txtHWeightQyt.Text = str; |
| | | |
| | | |
| | | Message = ""; |
| | | timeIndex = 0; |
| | | HGetWeight = 0; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region ç§°éæé®è§¦åäºä»¶ |
| | | private void button_getHWeight_Click(object sender, EventArgs e) |
| | | { |
| | | HGetWeight = 1; |
| | | timer2.Enabled = true; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region ä¿åé
ç½®ä¿¡æ¯ |
| | | //åå
¥é
ç½®åæ° |
| | | private void saveParams() |
| | | { |
| | | //夿æä»¶æ¯å¦åå¨ |
| | | if (!File.Exists(Application.StartupPath + "//Kf_WeightToBarCodeParams.txt")) |
| | | { |
| | | FileStream fs1 = new FileStream(Application.StartupPath + "//Kf_WeightToBarCodeParams.txt", FileMode.Create, FileAccess.Write);//å建åå
¥æä»¶ |
| | | StreamWriter sw = new StreamWriter(fs1); |
| | | sw.WriteLine(value_COM);//å¼å§åå
¥å¼ |
| | | sw.WriteLine(value_BaudRate); |
| | | |
| | | sw.WriteLine(value_StopBits); |
| | | |
| | | sw.WriteLine(value_Parity); |
| | | sw.WriteLine(value_DataBits); |
| | | sw.Close(); |
| | | fs1.Close(); |
| | | } |
| | | else |
| | | { |
| | | FileStream fs1 = new FileStream(Application.StartupPath + "//Kf_WeightToBarCodeParams.txt", FileMode.Create, FileAccess.Write);//å建åå
¥æä»¶ |
| | | StreamWriter sw = new StreamWriter(fs1); |
| | | sw.WriteLine(value_COM);//å¼å§åå
¥å¼ |
| | | sw.WriteLine(value_BaudRate); |
| | | |
| | | sw.WriteLine(value_StopBits); |
| | | |
| | | sw.WriteLine(value_Parity); |
| | | sw.WriteLine(value_DataBits); |
| | | sw.Close(); |
| | | fs1.Close(); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 读åé
ç½®ä¿¡æ¯ |
| | | //读åé
ç½®æä»¶ |
| | | private void readParams() |
| | | { |
| | | //å
³éä¸²å£ |
| | | //CloseCom(); |
| | | |
| | | if (File.Exists(Application.StartupPath + "//Kf_WeightToBarCodeParams.txt")) |
| | | { |
| | | //读åæä»¶å¼å¹¶æ¾ç¤ºå°çªä½ |
| | | FileStream fs = new FileStream(Application.StartupPath + "//Kf_WeightToBarCodeParams.txt", FileMode.Open, FileAccess.ReadWrite); |
| | | StreamReader sr = new StreamReader(fs); |
| | | string line = sr.ReadLine(); |
| | | int curLine = 0; |
| | | while (line != null) |
| | | { |
| | | if (++curLine == 1) |
| | | { |
| | | value_COM = line; |
| | | textBox_COM.Text = value_COM; |
| | | } |
| | | else if (curLine == 2) |
| | | { |
| | | value_BaudRate = line; |
| | | } |
| | | else if (curLine == 3) |
| | | { |
| | | value_StopBits = line; |
| | | } |
| | | else if (curLine == 4) |
| | | { |
| | | value_Parity = line; |
| | | } |
| | | else if (curLine == 5) |
| | | { |
| | | value_DataBits = line; |
| | | } |
| | | else |
| | | { |
| | | |
| | | } |
| | | line = sr.ReadLine(); |
| | | } |
| | | sr.Close(); |
| | | fs.Close(); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |