| | |
| | | Int64 HBadReasonID = 0; //ä¸è¯åå ID |
| | | string HCusMaterName = ""; //客æ·ç©æåç§° |
| | | string HCusModel = ""; //客æ·è§æ ¼åå· |
| | | string HBarCode_Pack = ""; //æçæ¡ç |
| | | |
| | | HBarCode = TM; |
| | | HBarCodeType = DBUtility.ClsPub.isStrNull(cmbHBarCodeType.Text); |
| | |
| | | HBadReasonID = DBUtility.ClsPub.isLong(txtHRemark.Tag); |
| | | HCusMaterName = DBUtility.ClsPub.isStrNull(txtHCusMaterName.Text); |
| | | HCusModel = DBUtility.ClsPub.isStrNull(txtHCusModel.Text); |
| | | HBarCode_Pack = DBUtility.ClsPub.isStrNull(txtHBarCode_Pack.Text); |
| | | |
| | | try |
| | | { |
| | |
| | | ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " + |
| | | ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " + |
| | | ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate,HMaterialJQty,HMaterialMQty,HNowQty " + |
| | | ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HGiveAwayFlag " + |
| | | ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HGiveAwayFlag,HBarCode_Pack " + |
| | | ",HOrderInterID,HOrderEntryID,HOrderBillNo,HCustomQty1,HMaterialModel,HCusModel " + |
| | | ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HLogo " + |
| | | ") Values (" |
| | |
| | | + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "',''" |
| | | + ", 1," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'" |
| | | + ", 0,'',getdate(),'','" + sDate + "'," + HMaterialJQty.ToString() + "," + HMaterialMQty.ToString() + "," + HNowQty.ToString() |
| | | + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",''," + HInterID.ToString() + ",0" |
| | | + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",''," + HInterID.ToString() + ",0,'" + HBarCode_Pack + "'" |
| | | + ", " + HProcessExchangeInterID.ToString() + ",0,'" + HProcessExchangeBillNo + "'," + HBadReasonID.ToString() + ",'" + HCusMaterName + "','" + HCusModel + "'" |
| | | + ",'" + HMaterName + "','" + HMaterModel + "',''," + HAuxPropID.ToString() + ",'','','1')"); |
| | | |
| | |
| | | " 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)"); |
| | |
| | | { |
| | | HRemark = HRemark + "ã" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value); |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç±»å")].Value) == "æçæ¡ç ") |
| | | { |
| | | MessageBox.Show("æéæ¡ç ç¼å·ï¼" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value) + " 为æçæ¡ç ï¼ä¸å
许ä½åºï¼", "æç¤º"); |
| | | return; |
| | | } |
| | | } |
| | | if (HRemark != "") |
| | | { |
| | |
| | | string HItemID = ""; |
| | | string HBarCode = ""; |
| | | string HBarCode2 = ""; |
| | | string HBarCode_Pack = DBUtility.ClsPub.isStrNull(txtHBarCode_Pack.Text); |
| | | for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++) |
| | | { |
| | | HItemID = HItemID + "," + DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString()); |
| | |
| | | if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("ä½åºæ è®°")].Value) == "") |
| | | { |
| | | HRemark = HRemark + "ã" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value); |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç±»å")].Value) == "æçæ¡ç ") |
| | | { |
| | | MessageBox.Show("æéæ¡ç ç¼å·ï¼" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value) + " 为æçæ¡ç ï¼ä¸å
许åä½åºï¼", "æç¤º"); |
| | | return; |
| | | } |
| | | 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) |
| | | { |
| | | MessageBox.Show("æéæ¡ç ç¼å·ï¼" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("æ¡ç ç¼å·")].Value) + " å·²çæå¯¹åºç»æåï¼ä¸å
许åä½åºï¼", "æç¤º"); |
| | | return; |
| | | } |
| | | } |
| | | if (HRemark != "") |
| | |
| | | ",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'" + |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region //å¼å§ç»æ |
| | | private void cmdHBPack_Click(object sender, EventArgs e) |
| | | { |
| | | if (!PackSub_AllowSave()) |
| | | { |
| | | return; |
| | | } |
| | | SavePackBarCode(); |
| | | BarCode_Display(); |
| | | grdMain.Rows[0].Selected = true; |
| | | |
| | | txtHBarCode_Pack.Text = 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; |
| | | } |
| | | 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 = "æçæ¡ç "; |
| | | |
| | | HBarCode = TM; |
| | | HBarCodeType = ""; |
| | | |
| | | 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 " + |
| | | ") Values (" |
| | | + "'" + HBarCode + "','" + HBarCodeType + "',0,0,1,'" + HBarCode + "'" |
| | | + ",'',0,0,'" + HMaker + "',getdate(),0,1" |
| | | + ",0,0,'','',''" |
| | | + ",1,0,0,0,0,''" |
| | | + ", 0,'',getdate(),'','" + sDate + "',0,0,0" |
| | | + ", " + HStockOrgID.ToString() + "," + HStockOrgID.ToString() + ",''," + HInterID.ToString() + ",0" |
| | | + ", " + HProcessExchangeInterID.ToString() + ",0,'',0,'',''" |
| | | + ",'','','',0,'','','1')"); |
| | | |
| | | //åå¡«æå¤§æµæ°´å· |
| | | 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) |
| | | { |
| | | string HBarCode_Pack = DBUtility.ClsPub.isStrNull(txtHBarCode_Pack.Text); |
| | | |
| | | //çæç»æåå夿 |
| | | 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) |
| | | { |
| | | 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" |
| | | ); |
| | | |
| | | MessageBox.Show("çæçäº§ç»æåï¼" + HPUBillNo + " æåï¼", "æç¤º"); |
| | | |
| | | txtHBarCode_Pack.Text = ""; |
| | | cmdHBPack.Enabled = true; |
| | | oCn.Commit(); |
| | | return; |
| | | } |
| | | catch (Exception e2) |
| | | { |
| | | oCn.RollBack(); |
| | | MessageBox.Show("çæçäº§ç»æå失败ï¼" + e2.Message); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | |
| | | fs.Close(); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | } |
| | | } |