1
duhe
2023-08-07 9ae6aa786445d49dc3e93ead5a8ee4b92006304e
PlanM/¼Æ»®¹ÜÀí/Gy_RoutingBill.cs
@@ -96,6 +96,12 @@
        //
        public  string ModName = "3301";
        public  string ModCaption = "工艺路线";
        public const string ModRightName = "Gy_RoutingBill";
        public const string ModRightNameEdit = ModRightName + "_Edit";      //编辑
        public const string ModRightNameCheck = ModRightName + "_Check";    //审核
        public const string ModRightNameClose = ModRightName + "_Close";    //关闭
        public const string ModRightNameDelete = ModRightName + "_Delete";  //作废
        public const string ModRightNameDrop = ModRightName + "_Drop";      //删除
        public bool BillChange;   //
        
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
@@ -104,15 +110,30 @@
        public DAL.ClsGy_RoutingBill BillNew =new  DAL.ClsGy_RoutingBill();
        public DAL.ClsGy_RoutingBill BillOld = new DAL.ClsGy_RoutingBill();
        ClsGridViewSum oSumGrid = new ClsGridViewSum();
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        public string CampanyName = ""; //系统参数 å®¢æˆ·
        public Int64 HOrgID = -1;       //组织内码
        //-------------------------------------------------------------------------
        #region å›ºå®šä»£ç 
        //清空界面
        public void Sub_ClearBill()
        {
            DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp);
            //
            //获取系统参数 å®¢æˆ·
            ClsXt_SystemParameter oClsXt_SystemParameter = new ClsXt_SystemParameter();
            CampanyName = oClsXt_SystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);
            //获取组织信息
            DataSet Ds1 = oCn.RunProcReturn("select * from Xt_ORGANIZATIONS with(nolock) where HItemID=" + ClsPub.HOrgID, "Xt_ORGANIZATIONS", ref DBUtility.ClsPub.sExeReturnInfo);
            if (Ds1.Tables[0].Rows.Count != 0)
            {
                cmbHOrgID.Text = DBUtility.ClsPub.isStrNull(Ds1.Tables[0].Rows[0]["HName"]);
                cmbHOrgID.Enabled = false;
            }
            txtHMaker.Text = ClsPub.CurUserName;
            txtHMakeDate.Text = "";
            txtHChecker.Text = "";
@@ -148,6 +169,12 @@
        //删除单据
        private void Sub_DeleteBill()
        {
            //判断权限
            if (!ClsPub.Security_Log(ModRightNameDrop, 1, true, DBUtility.ClsPub.CurUserName))
            {
                return;
            }
            string s = "";
            if (BillOld.ShowBill(BillOld.omodel.HInterID, ref s) == false)
            {
@@ -251,6 +278,9 @@
            g.DrawLine(p, new Point(txtHChecker.Left, txtHChecker.Top + txtHChecker.Height), new Point(txtHChecker.Left + txtHChecker.Width, txtHChecker.Top + txtHChecker.Height));
            g.DrawLine(p, new Point(txtHCheckDate.Left, txtHCheckDate.Top + txtHCheckDate.Height), new Point(txtHCheckDate.Left + txtHCheckDate.Width, txtHCheckDate.Top + txtHCheckDate.Height));
            //
            g.DrawLine(p, new Point(txtHUseMan.Left, txtHUseMan.Top + txtHUseMan.Height), new Point(txtHUseMan.Left + txtHUseMan.Width, txtHUseMan.Top + txtHUseMan.Height));
            g.DrawLine(p, new Point(txtHUseDate.Left, txtHUseDate.Top + txtHUseDate.Height), new Point(txtHUseDate.Left + txtHUseDate.Width, txtHUseDate.Top + txtHUseDate.Height));
            //
            g.DrawLine(p, new Point(txtHCloseMan.Left, txtHCloseMan.Top + txtHCloseMan.Height), new Point(txtHCloseMan.Left + txtHCloseMan.Width, txtHCloseMan.Top + txtHCloseMan.Height));
            g.DrawLine(p, new Point(txtHCloseDate.Left, txtHCloseDate.Top + txtHCloseDate.Height), new Point(txtHCloseDate.Left + txtHCloseDate.Width, txtHCloseDate.Top + txtHCloseDate.Height));
            //
@@ -280,7 +310,28 @@
            oSumGrid.oGridsum = grdSum;
            this.Text = ModCaption;
            this.lblCaption.Text = ModCaption;
            //加载组织信息
            Sub_AddOrdList();
        }
        //加载组织信息
        private void Sub_AddOrdList()
        {
            DataSet ds;
            DAL.ClsGy_ORGANIZATIONS_View oClsGy_ORGANIZATIONS_View = new DAL.ClsGy_ORGANIZATIONS_View();
            ds = oClsGy_ORGANIZATIONS_View.GetList();
            if (ds == null || ds.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("获取组织失败");
                return;
            }
            cmbHOrgID.Items.Clear();
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                cmbHOrgID.Items.Add(DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HName"]));
            }
        }
        //首张
        private void Sub_First()
        {
@@ -326,6 +377,17 @@
        //审核单据
        private void Sub_CheckBill()
        {
            //判断权限
            if (!ClsPub.Security_Log(ModRightNameCheck, 1, true, DBUtility.ClsPub.CurUserName))
            {
                return;
            }
            if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
            {
                MessageBox.Show("新增状态不允许审核单据,请先保存单据!", "提示");
            }
            if (BillOld.CheckBill(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
            {
                BillChange = true;
@@ -341,6 +403,17 @@
        //反审单据
        private void Sub_AbandonCheck()
        {
            //判断权限
            if (!ClsPub.Security_Log(ModRightNameCheck, 1, true, DBUtility.ClsPub.CurUserName))
            {
                return;
            }
            if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
            {
                MessageBox.Show("新增状态不允许反审核单据,请先保存单据!", "提示");
            }
            if (BillOld.AbandonCheck(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
            {
                BillChange = true;
@@ -356,6 +429,17 @@
        //关闭单据
        private void Sub_CloseBill()
        {
            //判断权限
            if (!ClsPub.Security_Log(ModRightNameClose, 1, true, DBUtility.ClsPub.CurUserName))
            {
                return;
            }
            if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
            {
                MessageBox.Show("新增状态不允许关闭单据,请先保存单据!", "提示");
            }
            if (BillOld.CloseBill(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
            {
                BillChange = true;
@@ -371,6 +455,17 @@
        //反关闭单据
        private void Sub_Cancel()
        {
            //判断权限
            if (!ClsPub.Security_Log(ModRightNameClose, 1, true, DBUtility.ClsPub.CurUserName))
            {
                return;
            }
            if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
            {
                MessageBox.Show("新增状态不允许反关闭单据,请先保存单据!", "提示");
            }
            if (BillOld.CancelClose(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
            {
                BillChange = true;
@@ -386,6 +481,17 @@
        //作废单据
        private void Sub_Cancelltion()
        {
            //判断权限
            if (!ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName))
            {
                return;
            }
            if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
            {
                MessageBox.Show("新增状态不允许作废单据,请先保存单据!", "提示");
            }
            if (BillOld.Cancelltion(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
            {
                BillChange = true;
@@ -401,6 +507,17 @@
        //反作废
        private void Sub_AbandonCancelltion()
        {
            //判断权限
            if (!ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName))
            {
                return;
            }
            if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
            {
                MessageBox.Show("新增状态不允许反作废单据,请先保存单据!", "提示");
            }
            if (BillOld.AbandonCancelltion(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
            {
                BillChange = true;
@@ -636,6 +753,18 @@
                        pic1.Image = System.Drawing.Image.FromFile(ClsPub.AppPath + @"/Pic/Closed.jpg");
                        //
                    }
                    if (txtHCloseMan.Text.Trim() != "")
                    {
                        sh.Enabled = false;
                        qsh.Enabled = false;
                        //gb.Enabled = false;
                        //hf.Enabled = true;
                        xg.Enabled = false;
                        sc.Enabled = false;
                        //
                        pic1.Visible = true;
                        pic1.Image = System.Drawing.Image.FromFile(ClsPub.AppPath + @"/Pic/Closed.jpg");
                    }
                    if (txtHDeleteMan.Text.Trim() == "")
                    {
                        //zf.Enabled = true;
@@ -850,6 +979,13 @@
            this.textHProductNum.Text = BillOld.omodel.HProductNum.ToString();
            this.textHVerNum.Text = BillOld.omodel.HVerNum.ToString();
            //获取组织信息
            DataSet Ds1 = oCn.RunProcReturn("select * from Xt_ORGANIZATIONS with(nolock) where HItemID=" + BillOld.omodel.HORGID.ToString(), "Xt_ORGANIZATIONS", ref DBUtility.ClsPub.sExeReturnInfo);
            if (Ds1.Tables[0].Rows.Count != 0)
            {
                cmbHOrgID.Text = DBUtility.ClsPub.isStrNull(Ds1.Tables[0].Rows[0]["HName"]);
            }
            //加载表体
            int i = 0;
            foreach (Model.ClsGy_RoutingBillSub oSub in BillOld.DetailColl)
@@ -997,6 +1133,35 @@
                MessageBox.Show("单位没有选择!", "提示");
                return false;
            }
            if (CampanyName == "凯贝奈特") //系统参数 å®¢æˆ·
            {
                if (DBUtility.ClsPub.isStrNull(textHPicNumVer.Text) == "")
                {
                    MessageBox.Show("图号版本没有录入!", "提示");
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(textHPicNumAssemble.Text) == "")
                {
                    MessageBox.Show("总装图号没有录入!", "提示");
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(textHMaterTexture.Text) == "")
                {
                    MessageBox.Show("材质没有录入!", "提示");
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(textHProductNum.Text) == "")
                {
                    MessageBox.Show("成品编号没有录入!", "提示");
                    return false;
                }
                if (DBUtility.ClsPub.isStrNull(textHVerNum.Text) == "")
                {
                    MessageBox.Show("版本没有录入!", "提示");
                    return false;
                }
            }
            //单据号是否重复
            if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, txtHBillNo.Text.Trim(), BillStatus, BillOld.omodel.HInterID))
            {
@@ -1038,6 +1203,19 @@
            lblCaption.Focus();
            if (!Sub_AllowSave())//单据完整性判断
                return false;
            // èŽ·å–ç»„ç»‡å†…ç 
            DAL.ClsGy_ORGANIZATIONS_View oClsGy_ORGANIZATIONS_View = new DAL.ClsGy_ORGANIZATIONS_View();
            if (oClsGy_ORGANIZATIONS_View.GetInfoByName(cmbHOrgID.Text))
            {
                HOrgID = oClsGy_ORGANIZATIONS_View.omodel.HItemID;
            }
            if (HOrgID == -1)
            {
                MessageBox.Show("选择组织有错误!");
                return false;
            }
            //赋值ID
            if (BillStatus ==DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify)
                BillNew.omodel.HInterID = BillOld.omodel.HInterID;
@@ -1072,6 +1250,7 @@
            BillNew.omodel.HMaterTexture = ClsPub.isStrNull(this.textHMaterTexture.Text);
            BillNew.omodel.HProductNum = ClsPub.isStrNull(this.textHProductNum.Text);
            BillNew.omodel.HVerNum = ClsPub.isStrNull(this.textHVerNum.Text);
            BillNew.omodel.HORGID = HOrgID;
            //明细类赋值
            BillNew.DetailColl=new List<Model.ClsGy_RoutingBillSub>();