wtt
2024-08-01 55e565721ef588d7ae9f421b6d1fce63b51aa55f
WorkM/Á÷ת¿¨¹ÜÀí/Sc_ProcessExchangeBill.cs
@@ -105,6 +105,7 @@
        public const Int16 HMouldNoCol = 79;
        public const Int16 HProcWorkNumCol = 80;
        public const Int16 HICMOEntryIDCol = 81;
        public const Int16 HSNCtrlCol = 82;
@@ -751,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();
            //灰度源单类型
@@ -1214,6 +1216,7 @@
                    grdMain.Rows[i].Cells[HTechnologyParameterCol].Value = oSub.HTechnologyParameter.ToString();
                    grdMain.Rows[i].Cells[HOverRateCol].Value = oSub.HOverRate.ToString();
                    grdMain.Rows[i].Cells[HMaxQtyCol].Value = oSub.HMaxQty.ToString();
                    grdMain.Rows[i].Cells[HSNCtrlCol].Value = DBUtility.ClsPub.isBool(oSub.HSNCtrl);
                    //
                    grdMain.Rows[i].Cells[HICMOBillNoCol].Value = oSub.HICMOBillNo;
@@ -1565,6 +1568,7 @@
                        oSub.HProcCheckNote = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcCheckNoteCol].Value);
                        oSub.HMouldNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMouldNoCol].Value);
                        oSub.HProcWorkNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcWorkNumCol].Value);
                        oSub.HSNCtrl = DBUtility.ClsPub.isBool(grdMain.Rows[i].Cells[HSNCtrlCol].Value);
                        BillNew.DetailColl.Add(oSub);
                    }
                }
@@ -1617,7 +1621,7 @@
        {
            //
            grdMain.ColumnCount = 82;                       //总列数
            grdMain.ColumnCount = 83;                       //总列数
            DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name);
            //
            grdMain.RowsDefaultCellStyle.WrapMode = DataGridViewTriState.True;
@@ -1736,6 +1740,7 @@
            grdMain.Columns[HEditCol].HeaderText = "不可编辑";
            grdMain.Columns[HOverRateCol].HeaderText = "超额比例";
            grdMain.Columns[HMaxQtyCol].HeaderText = " æœ€é«˜ä¸Šé™";
            grdMain.Columns[HSNCtrlCol].HeaderText = "SN码过站";
            //格式化 
@@ -1878,6 +1883,12 @@
                oCell2.Value = 0;
                oCell2.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                grdMain.Rows[i].Cells[HEditCol] = oCell2;
                //SN码过站
                DataGridViewCheckBoxCell oCell3 = new DataGridViewCheckBoxCell();
                oCell3.ThreeState = false;
                oCell3.Value = 0;
                oCell3.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                grdMain.Rows[i].Cells[HSNCtrlCol] = oCell3;
            }
            //格式化网格
            DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol, oSumGrid);
@@ -3358,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;
            //}
@@ -3544,6 +3555,7 @@
                grdMain.Rows[i].Cells[HMaxQtyCol].Value = oTable.Rows[i]["最高上限"].ToString();
                grdMain.Rows[i].Cells[HMouldNoCol].Value = oTable.Rows[i]["模具编号"].ToString();
                grdMain.Rows[i].Cells[HProcWorkNumCol].Value = oTable.Rows[i]["程序号"].ToString();
                grdMain.Rows[i].Cells[HSNCtrlCol].Value = oTable.Rows[i]["SN码过站"].ToString();
            }
            Sub_CountProcExchQty();