1
yangle
2023-09-22 2eb3c33f7c70cfba49230a37874e58e54aa792d7
PlanM/¼Æ»®¹ÜÀí/Gy_RoutingBill.cs
@@ -91,10 +91,17 @@
        public const Int16 HTechnologyParameterCol = 59;
        public const Int16 HPicNumCol = 60;
        public const Int16 HProcCheckNoteCol = 61;
        public const Int16 HProcWorkNumCol = 62;
        //
        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;
@@ -103,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 = "";
@@ -147,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)
            {
@@ -250,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));
            //
@@ -279,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()
        {
@@ -325,8 +377,22 @@
        //审核单据
        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;
                txtHChecker.Text = ClsPub.CurUserName;
                txtHCheckDate.Text = BillOld.omodel.HCheckDate;
@@ -340,6 +406,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;
@@ -355,6 +432,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;
@@ -370,6 +458,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;
@@ -385,6 +484,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;
@@ -400,6 +510,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;
@@ -635,6 +756,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;
@@ -843,6 +976,19 @@
            this.txtHAddSourceRate.Text = BillOld.omodel.HAddSourceRate.ToString();
            this.txtHDelSourceRate.Text = BillOld.omodel.HDelSourceRate.ToString();
            this.textHPicNumVer.Text = BillOld.omodel.HPicNumVer.ToString();
            this.textHPicNumAssemble.Text = BillOld.omodel.HPicNumAssemble.ToString();
            this.textHMaterTexture.Text = BillOld.omodel.HMaterTexture.ToString();
            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)
@@ -953,6 +1099,7 @@
                grdMain.Rows[i].Cells[HWorkQty_SCol].Value = oSub.HWorkQty_S.ToString();
                grdMain.Rows[i].Cells[HSubStdEmpQty_SCol].Value = oSub.HSubStdEmpQty_S.ToString();
                grdMain.Rows[i].Cells[HMouldNoCol].Value = oSub.HMouldNo;
                grdMain.Rows[i].Cells[HProcWorkNumCol].Value = oSub.HProcWorkNum;
                grdMain.Rows[i].Cells[HChangeMouldCol].Value = oSub.HChangeMould.ToString();
                grdMain.Rows[i].Cells[HPackStdCol].Value = oSub.HPackStd;
                grdMain.Rows[i].Cells[HPackCol].Value = oSub.HPack;
@@ -989,6 +1136,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))
            {
@@ -1030,10 +1206,24 @@
            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;
            //主类赋值
            BillNew.omodel.HPRDORGID = DBUtility.ClsPub.HOrgID;  //组织
            BillNew.omodel.HYear = 2011;
            BillNew.omodel.HPeriod = 1;
            BillNew.omodel.HBillNo = this.txtHBillNo.Text.Trim();  //在赋值类前就处理好字符串和数字
@@ -1057,7 +1247,14 @@
            BillNew.omodel.HStdSourceQty = ClsPub.isSingle(this.txtHStdSourceQty.Text);
            BillNew.omodel.HAddSourceRate = ClsPub.isSingle(this.txtHAddSourceRate.Text);
            BillNew.omodel.HDelSourceRate = ClsPub.isSingle(this.txtHDelSourceRate.Text);
            BillNew.omodel.HPicNumVer = ClsPub.isStrNull(this.textHPicNumVer.Text);
            BillNew.omodel.HPicNumAssemble = ClsPub.isStrNull(this.textHPicNumAssemble.Text);
            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>();
            for (i = 0; i <= grdMain.RowCount - 1; i++)
@@ -1111,6 +1308,7 @@
                    oSub.HProcID_S = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HProcID_SCol].Value);
                    oSub.HCenterID_S = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HCenterID_SCol].Value);
                    oSub.HMouldNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMouldNoCol].Value);
                    oSub.HProcWorkNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcWorkNumCol].Value);
                    oSub.HPackStd = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HPackStdCol].Value);
                    oSub.HPack = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HPackCol].Value);
                    oSub.HPutArea = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HPutAreaCol].Value);
@@ -1153,6 +1351,8 @@
                    oSub.HStdFlag = DBUtility.ClsPub.isBool(grdMain.Rows[i].Cells[HStdFlagCol].Value);
                    oSub.HAutoTrunFlag = DBUtility.ClsPub.isBool(grdMain.Rows[i].Cells[HAutoTrunFlagCol].Value);
                    oSub.HProcType = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcTypeCol].Value);
                    oSub.HProcWorkNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcWorkNumCol].Value);
                    if (DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HPassRateCol].Value) > 0)
                    {
                        oSub.HPassRate = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HPassRateCol].Value);
@@ -1225,7 +1425,7 @@
        private void initGrid()
        {
            //
            grdMain.ColumnCount = 62;                       //总列数
            grdMain.ColumnCount = 63;                       //总列数
            DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name);
            //
            grdMain.RowsDefaultCellStyle.WrapMode = DataGridViewTriState.True;
@@ -1301,6 +1501,7 @@
            grdMain.Columns[HTechnologyParameterCol].HeaderText = "工艺参数";
            grdMain.Columns[HPicNumCol].HeaderText = "图纸编号";
            grdMain.Columns[HProcCheckNoteCol].HeaderText = "本工序确认记录";
            grdMain.Columns[HProcWorkNumCol].HeaderText = "程序号";
            //格式化 
            grdMain.Columns[HTagCol].Visible = false;                           
            //隐藏列
@@ -1344,6 +1545,7 @@
                            "," + HWorkQty_SCol.ToString() +
                            "," + HSubStdEmpQty_SCol.ToString() +
                            "," + HMouldNoCol.ToString() +
                            "," + HProcWorkNumCol.ToString() +
                            "," + HChangeMouldCol.ToString() +
                            "," + HPackStdCol.ToString() +
                            "," + HPackCol.ToString() +
@@ -1558,6 +1760,8 @@
                                    grdMain.Rows[sRow].Cells[HProcNameCol].Value = oProc.oModel.HName;
                                    grdMain.Rows[sRow].Cells[HTimeUnitCol].Value = "小时";
                                    grdMain.Rows[sRow].Cells[HUnitTimeCol].Value = "1";
                                    grdMain.Rows[sRow].Cells[HPassRateCol].Value = "100";
                                    grdMain.Rows[sRow].Cells[HWorkQtyCol].Value = "1";
                                    if (oProc.GetInfoByID(oProc.oModel.HItemID))
                                    {
                                        grdMain.Rows[sRow].Cells[HProcCheckNoteCol].Value = oProc.omodel.HProcCheckNote.ToString();
@@ -1989,6 +2193,12 @@
                MessageBox.Show("使用失败!当前工艺路线不是浏览状态!");
                return;
            }
            //判断权限
            if (!ClsPub.Security_Log(ModRightNameCheck, 1, true, DBUtility.ClsPub.CurUserName))
            {
                return;
            }
            if (BillOld.Sub_RoutingCheckAndUsed(BillOld.omodel.HInterID))
            {
                MessageBox.Show("使用成功!");