From c1657da3ded8b423ca4ba3fec8d6d3fce8e0c4ef Mon Sep 17 00:00:00 2001 From: jingh <jingh@LAPTOP-I53VDLOO> Date: 星期三, 29 十二月 2021 23:33:24 +0800 Subject: [PATCH] 博日和夏宝条码规则增加 --- WarM/条码打印/Gy_BarCodeBill.cs | 524 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 509 insertions(+), 15 deletions(-) diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs" index 5bfb837..833372c 100644 --- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs" +++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs" @@ -27,8 +27,8 @@ public const Int16 HMaterIDCol = 6; public const Int16 HMaterNumberCol = 7; public const Int16 HMaterNameCol = 8; - public const Int16 HPinfanCol = 9; - public const Int16 HMaterModelCol = 10; + public const Int16 HPinfanCol = 9;// + public const Int16 HMaterModelCol = 10;// public const Int16 HModelCol = 11; public const Int16 HAuxPropIDCol = 12; public const Int16 HAuxPropNumberCol = 13; @@ -173,10 +173,31 @@ cmbHBarCodeType.Items.Clear(); cmbSourceBillType.Items.Clear(); - cmbHBarCodeType.Items.Add("鍞竴鏉$爜"); - cmbHBarCodeType.Items.Add("鍝佺鏉$爜"); - cmbHBarCodeType.Items.Add("鎵规鏉$爜"); - //cmbHBarCodeType.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 + { + // + cmbHBarCodeType.Items.Add("鍞竴鏉$爜"); + cmbHBarCodeType.Items.Add("鍝佺鏉$爜"); + cmbHBarCodeType.Items.Add("鎵规鏉$爜"); + //cmbHBarCodeType.Items.Add("鎵樼洏鏉$爜"); + } + // cmbSourceBillType.Items.Add("鐢熶骇璁㈠崟"); cmbSourceBillType.Items.Add("鐢熶骇姹囨姤鍗�"); @@ -631,7 +652,14 @@ return false; } bc.Enabled = false; - SaveBarCode(); + if (cmbHBarCodeType.Text == "浠櫒鎴愬搧鏉$爜瑙勫垯") + { + SaveBarCode_bori(); //鐗╂枡缂栫爜+搴忓垪鍙�+鐢熶骇鏃ユ湡 + } + else + { + SaveBarCode(); + } return true; } @@ -642,7 +670,8 @@ int LSHlen = 6; //娴佹按鍙烽暱搴� int SumLen = 10; //鎬婚暱搴� string TM = ""; //鏉$爜 - string HNumber = ""; //鐗╂枡浠g爜 + string HNumber = ""; //鐗╂枡鍐呯爜 + string HMaterNumber = ""; //鐗╂枡浠g爜 double HSumQty = 0; //浜у搧鏁伴噺 double HMinQty = 0; //鏈�灏忓寘瑁呮暟 int HBQty = 0; //绠辨暟 @@ -655,6 +684,10 @@ string sPeriod = ""; //鏈� string sDay = ""; //鏃� string HBatchNo = ""; //鎵规 + string HYasuoji = ""; //鍘嬬缉鏈� + string HModelName = ""; //鏈哄瀷 + string HICMOBillNo = ""; //婧愬崟鍙� + string HBarCodeBatchNo = ""; //鏉$爜鎵规鍙� int k = 0; int n = 0; //鍚屼竴鎵圭敓鎴愭潯鐮佷腑鐨勭鍑犳潯 string sTMNumber = ""; //鏉$爜鑷畾涔夊墠缂� @@ -666,8 +699,28 @@ 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[HDateCol].Value); + } + else if (cmbHBarCodeType.Text == "璇曞墏鎴愬搧鏉$爜瑙勫垯")// 澶辨晥鏃ユ湡锛堢敓浜ц鍗曪級 + { + sDate = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HEndDateCol].Value); + } + else if (CompanyName=="澶忓疂鐢靛櫒")// 鏃ユ湡锛氱敓浜ц鍗� 鏉$爜鏃ユ湡 + { + 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[HMaterModelCol].Value); //鏈哄瀷锛堝瀹濈數鍣級 + HICMOBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HSourceBillNoCol].Value); //鐢熶骇璁㈠崟鍙凤紙澶忓疂鐢靛櫒锛� + HBarCodeBatchNo= DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HPinfanBarCodeCol].Value); //鏉$爜鎵规鍙凤紙澶忓疂鐢靛櫒锛� + // sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2); sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString(); sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2); @@ -722,6 +775,60 @@ else if (cmbHBarCodeType.Text == "鎵规鏉$爜") { TM = HOrgNumber + HNumber + HBatchNo; + }//鍗氭棩鐗规畩澶勭悊 + else if(cmbHBarCodeType.Text == "浠櫒澶栬喘浠舵潯鐮佹櫘閫氳鍒�") + { + //鐗╂枡缂栫爜+鍗曟嵁鏃ユ湡锛圷YMMDD锛�+娴佹按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.isInt(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.isInt(Ds.Tables[0].Rows[0][0]); + } + else if (cmbHBarCodeType.Text == "璇曞墏鎴愬搧鏉$爜瑙勫垯") + { + //鐗╂枡缂栫爜+鐢熶骇鎵瑰彿+澶辨晥鏃ユ湡锛圷YMMDD锛�+娴佹按鍙�6浣�- + sTMNumber = HMaterNumber + HBatchNo + 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]); + LSHlen = 6; + } + else if (cmbHBarCodeType.Text == "鍐呴攢鏈烘潯鐮�") + { + //鍒堕�犳湰閮�1浣嶏紙榛樿1锛�+鏈哄瀷浠g爜5浣嶏紙锛�+骞�2浣�+鏈�1浣嶏紙A銆丅銆丆浠f浛10鏈堜唤锛� + //+鏃�2浣�+鏉$爜鎵规鐮�2浣�+鍘嬬缉鏈轰唬鐮�1浣�+00+娴佹按鍙�4浣�+鏍¢獙鐮侊紙榛樿0锛� + sTMNumber = "1" + HModelName + sYear + Sub_PeriodChange(sPeriod) + sDay + HBarCodeBatchNo + HYasuoji; + 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]); + LSHlen = 4; + } + else if (cmbHBarCodeType.Text == "澶栭攢鏈烘潯鐮�") + { + //鐗╂枡浠g爜11浣�+骞�2浣�+鏈�1浣嶏紙A銆丅銆丆浠f浛10鏈堜唤锛�+鏃�2浣�+鎵规2浣�+娴佹按鍙�4浣� + sTMNumber = HMaterNumber + sYear + Sub_PeriodChange(sPeriod) + sDay + HBarCodeBatchNo ; + 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]); + LSHlen = 4; + } + 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.isInt(Ds.Tables[0].Rows[0][0]); + LSHlen = 4; } //else if (cmbHBarCodeType.Text == "鎵樼洏鏉$爜") //{ @@ -886,7 +993,348 @@ { 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 == "鍗撳姏") //绯荤粺鍙傛暟 瀹㈡埛瀹氬埗鍖栧悕绉� + // { + // //鏉$爜鍓嶇紑 = 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃� + // sTMNumber = HNumber + sYear + sPeriod + sDay; + // } + // else if (CampanyName == "椋為緳") + // { + // string HWorksNumber = ""; + // HWorksNumber = cmbHWorksNumber.Text; + // if (HWorksNumber == "") + // { + // MessageBox.Show("宸ュ巶浠g爜涓嶈兘涓虹┖锛�"); + // return; + // } + // //鏉$爜鍓嶇紑 = 宸ュ巶浠g爜 + 鐗╂枡鍐呯爜 + 鏃ユ湡 + // sTMNumber = HWorksNumber + HNumber + sYear + sPeriod + sDay; + // } + // else //閫氱敤鏂规硶 + // { + // //鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃� + // sTMNumber = HOrgNumber + HNumber + sYear + sPeriod + sDay; + // } + //} + //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); + } + } + //澧炲姞 鏉$爜瓒呰繃鏈敓鎴愬姛鑳芥帶鍒� + + // + oCn.Commit(); + MessageBox.Show("鏉$爜鐢熸垚瀹屾瘯锛�"); + //grdSub.RowCount = 0; + tabControl1.SelectedIndex = 1; + } + catch (Exception e) + { + oCn.RollBack(); + MessageBox.Show("鏉$爜鐢熸垚澶辫触锛�" + e.Message); + grdSub.RowCount = 0; + } + } + + //鏈堜唤杞寲 + private string Sub_PeriodChange(string sPeriod) + { + if(sPeriod=="10") + { + return "A"; + } + else if (sPeriod == "11") + { + return "B"; + } + else if (sPeriod == "12") + { + return "C"; + } + else + { + return sPeriod.Substring(2, 1); + } + } + + + //鐢熸垚鏉$爜 鍗氭棩 //鐗╂枡缂栫爜+搴忓垪鍙�+鐢熶骇鏃ユ湡 + private void SaveBarCode_bori() + { + grdSub.Rows.Clear(); + int LSHlen = 6; //娴佹按鍙烽暱搴� + int SumLen = 10; //鎬婚暱搴� + string TM = ""; //鏉$爜 + string HNumber = ""; //鐗╂枡鍐呯爜 + string HMaterNumber = ""; //鐗╂枡浠g爜 + double HSumQty = 0; //浜у搧鏁伴噺 + double HMinQty = 0; //鏈�灏忓寘瑁呮暟 + int 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 == "鍞竴鏉$爜") + { + //鏉$爜鍓嶇紑 = 缁勭粐浠g爜 + 鐗╂枡浠g爜 + 骞� + 鏈� + 鏃� + 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.isInt(Ds.Tables[0].Rows[0][0]); + } + else + { + MessageBox.Show("閿欒鐨勬潯鐮佺被鍨嬶紝涓嶈兘鐢熸垚鏉$爜锛�"); + return; + } + + HBQty = HBQty + ClsPub.isInt(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; + 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[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); @@ -1842,7 +2290,7 @@ 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[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(); @@ -1868,10 +2316,14 @@ //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 == "鎵规鏉$爜" && CampanyName == "鍗氭棩绉戞妧") + grdMain.Rows[i].Cells[HEndDateCol].Value = oTable.Rows[0]["璁″垝瀹屽伐鏃ユ湡"].ToString();//鍗氭棩 鐢熶骇璁㈠崟 澶辨晥鏃ユ湡 + if (cmbHBarCodeType.Text == "浠櫒澶栬喘浠舵潯鐮佸鍣ㄨ鍒�" && CampanyName == "鍗氭棩绉戞妧") { grdMain.Rows[i].Cells[HMinQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["鏈敓鎴愭潯鐮佹暟閲�"]); + } + else if (cmbHBarCodeType.Text == "浠櫒澶栬喘浠舵潯鐮佹櫘閫氳鍒�" && CampanyName == "鍗氭棩绉戞妧") + { + grdMain.Rows[i].Cells[HMinQtyCol].Value = "1"; } else { @@ -1910,7 +2362,7 @@ 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[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]["閮ㄩ棬浠g爜"].ToString(); @@ -2257,6 +2709,26 @@ 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 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(); @@ -2664,10 +3136,32 @@ } } + private void sdy_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_SetReportView(oFrm.sOpenTmp); + Report.PrintPreview(false); + Thread.Sleep(1000); + } + } } } \ No newline at end of file -- Gitblit v1.9.1