From 92d1a0d613fa5d063c9bd496563d06632382aa98 Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期二, 16 十二月 2025 09:17:44 +0800
Subject: [PATCH] 新增凯贝立讯客户条码生成规则
---
WarM/条码打印/Gy_CusBarCodeBill_KaiBei_LangChao.cs | 171 ++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 115 insertions(+), 56 deletions(-)
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_CusBarCodeBill_KaiBei_LangChao.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_CusBarCodeBill_KaiBei_LangChao.cs"
index 592e0a5..34197bd 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_CusBarCodeBill_KaiBei_LangChao.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_CusBarCodeBill_KaiBei_LangChao.cs"
@@ -68,7 +68,7 @@
public const Int16 HCusModelCol = 46;
//
public string ModName = "85";
- public string ModCaption = "娴疆銆佸厓鑴戙�侀『杈惧鎴锋爣绛剧敓鎴�";
+ public string ModCaption = "娴疆銆佸厓鑴戙�侀『杈俱�佺珛璁鎴锋爣绛剧敓鎴�";
public const string ModRightName = "Gy_CusBarCodeBill_KaiBei_LangChao";
public DBUtility.ClsPub.Enum_BillStatus BillStatus;
@@ -82,7 +82,8 @@
public Int64 HOrgID = ClsPub.HOrgID;
public string HCS = "Z"; //鍘傚晢浠g爜
public string sDate = ""; //鏃ユ湡
- public string sYear = ""; //骞达紙2浣嶏級
+ public string sYear = ""; //骞�
+ public string sYear2 = ""; //骞达紙2浣嶏級
public string sYear4 = ""; //骞达紙4浣嶏級
public string sPeriod = ""; //鏈�
public string sPeriod2 = ""; //鏈堬紙姝e父锛�
@@ -458,6 +459,7 @@
//鏃ユ湡鑾峰彇鏂瑰紡
sDate = dtpHDate.Value.ToShortDateString();
sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2);
+ sYear2 = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2);
sYear4 = ClsPub.isDate(sDate).Year.ToString();
sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString();
sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2);
@@ -578,6 +580,10 @@
double HWMinQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[HWMinQtyCol].Value); // 澶栫鏈�灏忓寘瑁呮暟
string HCusModelName = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelNameCol].Value); // 瀹㈡埛鏂欏彿
string HCode1 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode1Col].Value); // 鐗╂枡绫诲埆
+ if (cmbHCusName.Text.Contains("杈惧垱绮惧瘑鏅洪��"))
+ {
+ HCode1 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBatchNoCol].Value); // 鎵瑰彿
+ }
string HCode2 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode2Col].Value); // 鎵规浣�
HCode2 = HCode2.ToUpper();
string HCode3 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode3Col].Value); // 鐗堟湰鍙�
@@ -730,43 +736,56 @@
long sHMaterID = DBUtility.ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value); // 鐗╂枡鍐呯爜
string sHMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterNumberCol].Value); // 鐗╂枡浠g爜
string sHCusModelName = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelNameCol].Value); // 瀹㈡埛鏂欏彿
- string sHCode1 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode1Col].Value); // 鐗╂枡绫诲埆
- string sHCode2 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode2Col].Value); // 鎵规浣�
- sHCode2 = sHCode2.ToUpper();
- string HBatchNoNumber = sHCode1 + sYear + sPeriod + sDay + HCS; // 鎵规鐢熸垚鍓嶇紑
- HBatchNoNumber = HBatchNoNumber.ToUpper();
- DataSet oDsBatchNo = oCn.RunProcReturn("exec h_p_Gy_CusBarCodeBill_KaiBeiLC_GetBatchNo '" + sHSourceBillNo + "'," + sHMaterID.ToString() + ",'" + sHMaterNumber + "','" + sHCusModelName + "','" + sHCode2 + "','" + HBatchNoNumber + "'", "h_p_Gy_CusBarCodeBill_KaiBeiLC_GetBatchNo");
- //
- if (oDsBatchNo == null && oDsBatchNo.Tables[0].Rows.Count == 0)
+ if (cmbHCusName.Text.Contains("杈惧垱绮惧瘑鏅洪��"))
{
- MessageBox.Show("鑾峰彇鎵规澶辫触锛�");
- bc.Enabled = true;
- oCn.RollBack();
- return;
+ //鑾峰彇鏈�澶ф祦姘村彿
+ //鏉$爜鍓嶇紑 = 瀹㈡埛鐗╂枡瀵瑰簲琛ㄤ腑瀹㈡埛浜у搧缂栫爜+渚涘簲鍟嗕唬鐮侊紙鍥哄畾'0001010121'锛�+骞存湀鏃ワ紙YYMMDD锛�
+ sTMNumber = sHCusModelName + "0001010121" + sYear2 + sPeriod2 + 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 (DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0][0]) == "1")
- {
- MessageBox.Show(DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0]["HRemark"]));
- bc.Enabled = true;
- oCn.RollBack();
- return;
- }
+ //娴疆銆佸厓鑴戙�侀『杈�
else
{
- grdMain.Rows[j].Cells[HBaNoCol].Value = sHCode2;
- grdMain.Rows[j].Cells[HBatchNoCol].Value = DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0]["HBatchNo"]);
- grdMain.Rows[j].Cells[HCode2Col].Value = DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0]["HCode2"]);
- }
+ string sHCode1 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode1Col].Value); // 鐗╂枡绫诲埆
+ string sHCode2 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode2Col].Value); // 鎵规浣�
+ sHCode2 = sHCode2.ToUpper();
+ string HBatchNoNumber = sHCode1 + sYear + sPeriod + sDay + HCS; // 鎵规鐢熸垚鍓嶇紑
+ HBatchNoNumber = HBatchNoNumber.ToUpper();
- HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBatchNoCol].Value);
- HCode3 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode3Col].Value);
- //鑾峰彇鏈�澶ф祦姘村彿
- LSH = 0;
- Ds = oCn.RunProcReturn("select top 1 HSno from Gy_BarCodeBill_Cus where HBatchNo='" + HBatchNo + "' order by HSno desc", "Gy_BarCodeBill_Cus");
- if (Ds != null && Ds.Tables[0].Rows.Count != 0)
- {
- LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
+ DataSet oDsBatchNo = oCn.RunProcReturn("exec h_p_Gy_CusBarCodeBill_KaiBeiLC_GetBatchNo '" + sHSourceBillNo + "'," + sHMaterID.ToString() + ",'" + sHMaterNumber + "','" + sHCusModelName + "','" + sHCode2 + "','" + HBatchNoNumber + "'", "h_p_Gy_CusBarCodeBill_KaiBeiLC_GetBatchNo");
+ //
+ if (oDsBatchNo == null && oDsBatchNo.Tables[0].Rows.Count == 0)
+ {
+ MessageBox.Show("鑾峰彇鎵规澶辫触锛�");
+ bc.Enabled = true;
+ oCn.RollBack();
+ return;
+ }
+ else if (DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0][0]) == "1")
+ {
+ MessageBox.Show(DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0]["HRemark"]));
+ bc.Enabled = true;
+ oCn.RollBack();
+ return;
+ }
+ else
+ {
+ grdMain.Rows[j].Cells[HBaNoCol].Value = sHCode2;
+ grdMain.Rows[j].Cells[HBatchNoCol].Value = DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0]["HBatchNo"]);
+ grdMain.Rows[j].Cells[HCode2Col].Value = DBUtility.ClsPub.isStrNull(oDsBatchNo.Tables[0].Rows[0]["HCode2"]);
+ }
+
+ HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBatchNoCol].Value);
+ HCode3 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode3Col].Value);
+ //鑾峰彇鏈�澶ф祦姘村彿
+ LSH = 0;
+ Ds = oCn.RunProcReturn("select top 1 HSno from Gy_BarCodeBill_Cus where HBatchNo='" + HBatchNo + "' order by HSno desc", "Gy_BarCodeBill_Cus");
+ if (Ds != null && Ds.Tables[0].Rows.Count != 0)
+ {
+ LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
+ }
}
HBQty = ClsPub.isInt(grdMain.Rows[j].Cells[HBQtyCol].Value);
@@ -791,23 +810,37 @@
{
LSH2 = "0" + LSH2;
}
- //鏉$爜缂栧彿 = 鎵规 + 娴佹按鍙� + 鐗堟湰鍙�
- TM = HBatchNo + LSH2 + HCode3;
- HEntryID = j + 1;
- HBarCode = TM.ToUpper();
- if(cmbHCusName.Text.Contains("鍏冭剳"))
+ if (cmbHCusName.Text.Contains("杈惧垱绮惧瘑鏅洪��"))
{
+ TM = sTMNumber + LSH2;
+ HBarCodeType = "绔嬭鍐呯鐮�";
+ HSno = 0;
+ }
+ else if (cmbHCusName.Text.Contains("鍏冭剳"))
+ {
+ //鏉$爜缂栧彿 = 鎵规 + 娴佹按鍙� + 鐗堟湰鍙�
+ TM = HBatchNo + LSH2 + HCode3;
HBarCodeType = "鍏冭剳鍐呯鐮�";
+ HSno = LSH;
}
else if (cmbHCusName.Text.Contains("椤鸿揪"))
{
+ //鏉$爜缂栧彿 = 鎵规 + 娴佹按鍙� + 鐗堟湰鍙�
+ TM = HBatchNo + LSH2 + HCode3;
HBarCodeType = "椤鸿揪鍐呯鐮�";
+ HSno = LSH;
}
else
{
+ //鏉$爜缂栧彿 = 鎵规 + 娴佹按鍙� + 鐗堟湰鍙�
+ TM = HBatchNo + LSH2 + HCode3;
HBarCodeType = "鍐呯鐮�";
+ HSno = LSH;
}
+
+ HEntryID = j + 1;
+ HBarCode = TM.ToUpper();
HMaterID = ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value);
HUnitID = ClsPub.isLong(grdMain.Rows[j].Cells[HUnitIDCol].Value);
HAuxPropID = ClsPub.isLong(grdMain.Rows[j].Cells[HAuxPropIDCol].Value);
@@ -831,7 +864,6 @@
HCode1 = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode1Col].Value).ToUpper();
HCode2 = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode2Col].Value).ToUpper();
HCode3 = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode3Col].Value).ToUpper();
- HSno = LSH;
HBoxNo = HCode1 + sYear + sPeriod + sDay + HCS;
HBoxNo = HBoxNo.ToUpper();
sHBaNo = ClsPub.isStrNull(grdMain.Rows[j].Cells[HBaNoCol].Value); // 鐣岄潰涓婅緭鍏ョ殑鎵规浣�
@@ -876,6 +908,7 @@
{
HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBatchNoCol].Value);
HCode3 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode3Col].Value);
+ HCusModelName = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelNameCol].Value);
if (cmbHCusName.Text.Contains("鍏冭剳"))
{
LWSHlen = 5;
@@ -896,6 +929,17 @@
Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
LWSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
}
+ else if (cmbHCusName.Text.Contains("杈惧垱绮惧瘑鏅洪��"))
+ {
+ LWSHlen = 6;
+ HBarCodeType = "绔嬭澶栫鐮�";
+ //鑾峰彇鏈�澶ф祦姘村彿
+ //鏉$爜鍓嶇紑 = 瀹㈡埛鐗╂枡瀵瑰簲琛ㄤ腑瀹㈡埛浜у搧缂栫爜+骞存湀鏃ワ紙YYMMDD锛�
+ sTMNumber = HCusModelName + sYear2 + sPeriod2 + sDay;
+ Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
+ LWSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
+ }
+ //娴疆
else
{
LWSHlen = 5;
@@ -938,7 +982,6 @@
HAuxPropID = ClsPub.isLong(grdMain.Rows[j].Cells[HAuxPropIDCol].Value);
HQty = HWMinQty;
HCusID = ClsPub.isLong(cmbHCusName.SelectedValue);
- HCusModelName = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelNameCol].Value);
HCusModel = ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelCol].Value);
HGiveAwayFlag = ClsPub.isBool(grdMain.Rows[j].Cells[HGiveAwayFlagCol].Value);
HISKFPERIOD = ClsPub.isBool(grdMain.Rows[j].Cells[HISKFPERIODCol].Value);
@@ -1014,7 +1057,7 @@
private void Display()
{
//鍒锋柊鍐呯鐮佸垪琛�
- DataSet DSet = oCn.RunProcReturn("select * from h_v_Gy_BarCodeBill_CusList where HInterID=" + HInterID.ToString() + " and (鏉$爜绫诲瀷='鍐呯鐮�' or 鏉$爜绫诲瀷='鍏冭剳鍐呯鐮�' or 鏉$爜绫诲瀷='椤鸿揪鍐呯鐮�') order by HItemID", "h_v_Gy_BarCodeBill_CusList", ref DBUtility.ClsPub.sExeReturnInfo);
+ DataSet DSet = oCn.RunProcReturn("select * from h_v_Gy_BarCodeBill_CusList where HInterID=" + HInterID.ToString() + " and 鏉$爜绫诲瀷 in ('鍐呯鐮�','鍏冭剳鍐呯鐮�','椤鸿揪鍐呯鐮�','绔嬭鍐呯鐮�') order by HItemID", "h_v_Gy_BarCodeBill_CusList", ref DBUtility.ClsPub.sExeReturnInfo);
//鐢熸垚棣栬鏍囬
if (DSet == null)
{
@@ -1025,7 +1068,7 @@
grdSub.DataSource = DSet.Tables[0].DefaultView;
//鍒锋柊澶栫鐮佸垪琛�
- DataSet DWSet = oCn.RunProcReturn("select * from h_v_Gy_BarCodeBill_CusList where HInterID=" + HInterID.ToString() + " and (鏉$爜绫诲瀷='澶栫鐮�' or 鏉$爜绫诲瀷='鍏冭剳澶栫鐮�' or 鏉$爜绫诲瀷='椤鸿揪澶栫鐮�') order by HItemID", "h_v_Gy_BarCodeBill_CusList", ref DBUtility.ClsPub.sExeReturnInfo);
+ DataSet DWSet = oCn.RunProcReturn("select * from h_v_Gy_BarCodeBill_CusList where HInterID=" + HInterID.ToString() + " and 鏉$爜绫诲瀷 in ('澶栫鐮�','鍏冭剳澶栫鐮�','椤鸿揪澶栫鐮�','绔嬭澶栫鐮�') order by HItemID", "h_v_Gy_BarCodeBill_CusList", ref DBUtility.ClsPub.sExeReturnInfo);
//鐢熸垚棣栬鏍囬
if (DWSet == null)
{
@@ -1591,18 +1634,34 @@
grdMain.Rows[i].Cells[HEXPPERIODCol].Value = oTable.Rows[0]["HEXPPERIOD"].ToString();
grdMain.Rows[i].Cells[HInnerBillNoCol].Value = oTable.Rows[0]["閿�鍞鍗曠紪鍙�"].ToString();
//--
- //璁剧疆鍙紪杈戝垪
- string sAllowCol = HQtyCol.ToString() +
- "," + HMinQtyCol.ToString() +
- "," + HWMinQtyCol.ToString() +
- "," + HAuxPropNumberCol.ToString() +
- "," + HCusModelNameCol.ToString() +
- "," + HCusModelCol.ToString() +
- //"," + HCode1Col.ToString() +
- //"," + HCode2Col.ToString() +
- //"," + HCode3Col.ToString() +
- "," + HInnerBillNoCol.ToString() +
- "," + HRemarkCol.ToString();
+ string sAllowCol = HRemarkCol.ToString();
+ if (cmbHCusName.Text.Contains("杈惧垱绮惧瘑鏅洪��"))
+ {
+ sAllowCol = HQtyCol.ToString() +
+ "," + HMinQtyCol.ToString() +
+ "," + HWMinQtyCol.ToString() +
+ "," + HAuxPropNumberCol.ToString() +
+ "," + HCusModelNameCol.ToString() +
+ "," + HCusModelCol.ToString() +
+ "," + HBatchNoCol.ToString() +
+ "," + HInnerBillNoCol.ToString() +
+ "," + HRemarkCol.ToString();
+ }
+ else
+ {
+ //璁剧疆鍙紪杈戝垪
+ sAllowCol = HQtyCol.ToString() +
+ "," + HMinQtyCol.ToString() +
+ "," + HWMinQtyCol.ToString() +
+ "," + HAuxPropNumberCol.ToString() +
+ "," + HCusModelNameCol.ToString() +
+ "," + HCusModelCol.ToString() +
+ //"," + HCode1Col.ToString() +
+ //"," + HCode2Col.ToString() +
+ //"," + HCode3Col.ToString() +
+ "," + HInnerBillNoCol.ToString() +
+ "," + HRemarkCol.ToString();
+ }
grdMain.Columns[HBillNoCol].ReadOnly = true;
//璁剧疆鍚堣鍒�
string sTotalCol = HQtyCol.ToString();
@@ -1772,7 +1831,7 @@
{
try
{
- oCn.RunProc("update Gy_BarCodeBill_Cus set HPrintQty=isnull(HPrintQty,0)+1 where HBarCodeType in ('鍐呯鐮�','鍏冭剳鍐呯鐮�','椤鸿揪鍐呯鐮�') and HInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+ oCn.RunProc("update Gy_BarCodeBill_Cus set HPrintQty=isnull(HPrintQty,0)+1 where HBarCodeType in ('鍐呯鐮�','鍏冭剳鍐呯鐮�','椤鸿揪鍐呯鐮�','绔嬭鍐呯鐮�') and HInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
}
catch (Exception e)
{
@@ -1887,7 +1946,7 @@
{
try
{
- oCn.RunProc("update Gy_BarCodeBill_Cus set HPrintQty=isnull(HPrintQty,0)+1 where HBarCodeType in ('澶栫鐮�','鍏冭剳澶栫鐮�','椤鸿揪澶栫鐮�') and HInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+ oCn.RunProc("update Gy_BarCodeBill_Cus set HPrintQty=isnull(HPrintQty,0)+1 where HBarCodeType in ('澶栫鐮�','鍏冭剳澶栫鐮�','椤鸿揪澶栫鐮�','绔嬭澶栫鐮�') and HInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
}
catch (Exception e)
{
--
Gitblit v1.9.1