1
wangbin
2024-07-08 4548e24916ac5f63eef736cabdcd634864f8de16
WorkM/Á÷ת¿¨¹ÜÀí/Sc_ProcessExchangeBill.cs
@@ -752,7 +752,8 @@
            this.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
            this.Sub_OperStatus();//设置TOOLBAR
            this.Sub_ClearBill();//清空界面
            this.txtHBillNo.Text = ClsPub.CreateBillCode(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);//得到新单号
            //this.txtHBillNo.Text = ClsPub.CreateBillCode(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);//得到新单号
            this.txtHBillNo.Text = ClsPub.CreateBillCode_Prod(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);//得到新单号    20240620返回值改取存储过程
            this.txtHBillNo.Enabled = true;
            this.txtHBillNo.Focus();
            //灰度源单类型
@@ -3368,62 +3369,62 @@
            string sNo = "";
            int row = oTable.Rows.Count - 1;
            //获取系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
            Ds = oCn.RunProcReturn("select HValue from Xt_SystemParameter with(nolock) where HKey='WMS_CampanyName'", "Xt_SystemParameter", ref DBUtility.ClsPub.sExeReturnInfo);
            if (Ds == null || Ds.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("获取系统参数失败!原因:" + DBUtility.ClsPub.sExeReturnInfo, "提示");
                return;
            }
            else
            {
                CampanyName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HValue"]);
            }
            if (CampanyName == "凯贝奈特") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
            {
            ////获取系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
            //Ds = oCn.RunProcReturn("select HValue from Xt_SystemParameter with(nolock) where HKey='WMS_CampanyName'", "Xt_SystemParameter", ref DBUtility.ClsPub.sExeReturnInfo);
            //if (Ds == null || Ds.Tables[0].Rows.Count == 0)
            //{
            //    MessageBox.Show("获取系统参数失败!原因:" + DBUtility.ClsPub.sExeReturnInfo, "提示");
            //    return;
            //}
            //else
            //{
            //    CampanyName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HValue"]);
            //}
            //if (CampanyName == "凯贝奈特") //系统参数  å®¢æˆ·å®šåˆ¶åŒ–名称
            //{
            }
            else
            {
                //获取当前改生产订单 æœ€å¤§æµè½¬å¡å·ï¼Œå¹¶ç´¯è®¡å¢žåŠ 1。
                //智见单号- å¹´æœˆæ—¥20200701+001
                string sOldNo = "";
                //Ds = oCn.RunProcReturn("select top 1 HBillNo  from Sc_ProcessExchangeBillmain where hicmointerid=" + oTable.Rows[row]["hmainid"].ToString() + "  order by LEN(HBillno) desc, HbillNo desc ", "Sc_ProcessExchangeBillmain");
            //}
            //else
            //{
            //    //获取当前改生产订单 æœ€å¤§æµè½¬å¡å·ï¼Œå¹¶ç´¯è®¡å¢žåŠ 1。
            //    //智见单号- å¹´æœˆæ—¥20200701+001
            //    string sOldNo = "";
            //    //Ds = oCn.RunProcReturn("select top 1 HBillNo  from Sc_ProcessExchangeBillmain where hicmointerid=" + oTable.Rows[row]["hmainid"].ToString() + "  order by LEN(HBillno) desc, HbillNo desc ", "Sc_ProcessExchangeBillmain");
                Ds = oCn.RunProcReturn("select top 1 HBillNo  from Sc_ProcessExchangeBillmain where HDate='" + dtpHDate.Value.ToShortDateString() + "' and HBillSubType<>'Split' order by  HbillNo desc ", "Sc_ProcessExchangeBillmain");
                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                {
                    sNo = "001";
                }
                else
                {
                    sOldNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]);
                    sOldNo = sOldNo.Substring(sOldNo.Length - 3, 3);
                    //if (sOldNo.Substring(0, 1) == "0" || sOldNo.Substring(0, 1) == "-")
                    //{
                    //    sOldNo = sOldNo.Substring(sOldNo.Length - 2, 2);
                    //    if (sOldNo.Substring(0, 1) == "0")
                    //    {
                    //        sOldNo = sOldNo.Substring(sOldNo.Length - 1, 1);
                    //    }
                    //}
                    sNo = "0000" + DBUtility.ClsPub.isStrNull(DBUtility.ClsPub.isLong(sOldNo) + 1);
                }
            //    Ds = oCn.RunProcReturn("select top 1 HBillNo  from Sc_ProcessExchangeBillmain where HDate='" + dtpHDate.Value.ToShortDateString() + "' and HBillSubType<>'Split' order by  HbillNo desc ", "Sc_ProcessExchangeBillmain");
            //    if (Ds == null || Ds.Tables[0].Rows.Count == 0)
            //    {
            //        sNo = "001";
            //    }
            //    else
            //    {
            //        sOldNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]);
            //        sOldNo = sOldNo.Substring(sOldNo.Length - 3, 3);
            //        //if (sOldNo.Substring(0, 1) == "0" || sOldNo.Substring(0, 1) == "-")
            //        //{
            //        //    sOldNo = sOldNo.Substring(sOldNo.Length - 2, 2);
            //        //    if (sOldNo.Substring(0, 1) == "0")
            //        //    {
            //        //        sOldNo = sOldNo.Substring(sOldNo.Length - 1, 1);
            //        //    }
            //        //}
            //        sNo = "0000" + DBUtility.ClsPub.isStrNull(DBUtility.ClsPub.isLong(sOldNo) + 1);
            //    }
                sNo = sNo.Substring(sNo.Length - 3, 3);
                //initGrid();
                //initGrid_Sub();
                //string sBillNo = oTable.Rows[row]["生产订单号"].ToString();
                string sYear = dtpHDate.Value.Year.ToString();
                string sMonth = "00" + dtpHDate.Value.Month.ToString();
                string sDay = "00" + dtpHDate.Value.Day.ToString();
                string sBillNo = sYear + sMonth.Substring(sMonth.Length - 2, 2) + sDay.Substring(sDay.Length - 2, 2);
                //sBillNo = sBillNo.Replace("WORKX", "");
                //sBillNo = sBillNo.Replace("WORK", "");
                //sBillNo = sBillNo.Replace("_", "-");
                sBillNo = sBillNo + "-" + sNo;
                txtHBillNo.Text = sBillNo;
            }
            //    sNo = sNo.Substring(sNo.Length - 3, 3);
            //    //initGrid();
            //    //initGrid_Sub();
            //    //string sBillNo = oTable.Rows[row]["生产订单号"].ToString();
            //    string sYear = dtpHDate.Value.Year.ToString();
            //    string sMonth = "00" + dtpHDate.Value.Month.ToString();
            //    string sDay = "00" + dtpHDate.Value.Day.ToString();
            //    string sBillNo = sYear + sMonth.Substring(sMonth.Length - 2, 2) + sDay.Substring(sDay.Length - 2, 2);
            //    //sBillNo = sBillNo.Replace("WORKX", "");
            //    //sBillNo = sBillNo.Replace("WORK", "");
            //    //sBillNo = sBillNo.Replace("_", "-");
            //    sBillNo = sBillNo + "-" + sNo;
            //    txtHBillNo.Text = sBillNo;
            //}