yangle
2024-03-07 61591faf499fca6a7e774e9dd7cbb20b0b67e67f
BaseSet/¹«ÓÃ×ÊÁÏ/ÆäËû»ù´¡×ÊÁÏ/Gy_ProcPrice.cs
@@ -38,7 +38,19 @@
        public const Int16 HCostFlagCol = 18;
        public const Int16 HFlowFlagCol = 19;
        public const Int16 HPayFlagCol = 20;
        public const Int16 HRemarkCol = 21;
        public const Int16 HWorkCenterIDCol = 21;
        public const Int16 HWorkCenterNumberCol = 22;
        public const Int16 HWorkCenterNameCol = 23;
        public const Int16 HWorkQtyCol = 24;
        public const Int16 HStdEmpCol = 25;
        public const Int16 HChangeTimesCol = 26;
        public const Int16 HChangeMoneyCol = 27;
        public const Int16 HProcNoCol = 28;
        public const Int16 HPieceTimesCol = 29;
        public const Int16 HMouldQtyCol = 30;
        public const Int16 HChangeMouldMoneyCol = 31;
        public const Int16 HRushQtyCol = 32;
        public const Int16 HRemarkCol = 33;
        public bool BillChange;   //
        public DBUtility.ClsPub.Enum_OKTag OkTag;
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
@@ -53,6 +65,8 @@
        public DAL.ClsGy_ProcPrice_Ctl BillNew = new DAL.ClsGy_ProcPrice_Ctl();
        public Model.ClsGy_ProcPrice_Model BillOld = new Model.ClsGy_ProcPrice_Model();
        ClsGridViewSum oSumGrid = new ClsGridViewSum();
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
        public Int64 sHOrgID = -1;
        //-------------------------------------------------------------------------
        #region å›ºå®šä»£ç 
@@ -100,6 +114,13 @@
                    default:
                        break;
                }
            }
            //显示当前登入组织
            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"]);
                sHOrgID = ClsPub.HOrgID;
            }
            //
            initGrid();
@@ -210,8 +231,28 @@
            oSumGrid.oGridsum = grdSum;
            lblCaption.Text = ModName;
            this.Text = ModName;
            //加载组织信息
            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_CheckBill()
        {
@@ -408,8 +449,9 @@
            DAL.ClsIF_Process_View oProc = new DAL.ClsIF_Process_View();
            DAL.ClsIF_Department_View oDept = new DAL.ClsIF_Department_View();
            DAL.ClsIF_Source_View oSource = new DAL.ClsIF_Source_View();
            DAL.ClsIF_WorkCenter_View oWorkCenter = new DAL.ClsIF_WorkCenter_View();
            //判断是否存在单据
            if(BillNew.ShowBill(BillOld.HItemID,ref  ClsPub.sExeReturnInfo)==false )
            if (BillNew.ShowBill(BillOld.HItemID,ref  ClsPub.sExeReturnInfo)==false )
            {
                MessageBox.Show(ClsPub.sExeReturnInfo, "提示");
                return;
@@ -485,12 +527,31 @@
                    grdMain.Rows[i].Cells[HSourceNumberCol].Value = "";
                    grdMain.Rows[i].Cells[HSourceNameCol].Value = "";
                }
                if (oWorkCenter.GetInfoByID(oSub.HWorkCenterID))
                {
                    grdMain.Rows[i].Cells[HWorkCenterNumberCol].Value = oWorkCenter.omodel.HNumber;
                    grdMain.Rows[i].Cells[HWorkCenterNameCol].Value = oWorkCenter.omodel.HName;
                }
                else
                {
                    grdMain.Rows[i].Cells[HWorkCenterNumberCol].Value = "";
                    grdMain.Rows[i].Cells[HWorkCenterNameCol].Value = "";
                }
                grdMain.Rows[i].Cells[HBeginDateCol].Value = oSub.HBeginDate.ToShortDateString();
                grdMain.Rows[i].Cells[HEndDateCol].Value = oSub.HEndDate.ToShortDateString();
                grdMain.Rows[i].Cells[HCostFlagCol].Value = oSub.HCostFlag.ToString();
                grdMain.Rows[i].Cells[HFlowFlagCol].Value = oSub.HFlowFlag.ToString();
                grdMain.Rows[i].Cells[HPayFlagCol].Value = oSub.HPayFlag.ToString();
                grdMain.Rows[i].Cells[HPriceCol].Value = oSub.HPrice.ToString();
                grdMain.Rows[i].Cells[HWorkQtyCol].Value = oSub.HWorkQty.ToString();
                grdMain.Rows[i].Cells[HStdEmpCol].Value = oSub.HStdEmp.ToString();
                grdMain.Rows[i].Cells[HChangeTimesCol].Value = oSub.HChangeTimes.ToString();
                grdMain.Rows[i].Cells[HChangeMoneyCol].Value = oSub.HChangeMoney.ToString();
                grdMain.Rows[i].Cells[HProcNoCol].Value = oSub.HProcNo.ToString();
                grdMain.Rows[i].Cells[HPieceTimesCol].Value = oSub.HPieceTimes.ToString();
                grdMain.Rows[i].Cells[HMouldQtyCol].Value = oSub.HMouldQty.ToString();
                grdMain.Rows[i].Cells[HChangeMouldMoneyCol].Value = oSub.HChangeMouldMoney.ToString();
                grdMain.Rows[i].Cells[HRushQtyCol].Value = oSub.HRushQty.ToString();
                grdMain.Rows[i].Cells[HRemarkCol].Value = oSub.HRemark;
                
                i = i + 1;
@@ -567,10 +628,20 @@
                    oSub.HFlowFlag = ClsPub.GridToBool(grdMain.Rows[i].Cells[HFlowFlagCol].Value);
                    oSub.HPayFlag = ClsPub.GridToBool(grdMain.Rows[i].Cells[HPayFlagCol].Value);
                    oSub.HDeptID = ClsPub.isLong(txtHDeptID.Tag);
                    oSub.HStopflag = true;
                    oSub.HStopflag = false;
                    oSub.HMaker = ClsPub.CurUserName;
                    oSub.HMakeDate = DateTime.Today.ToString();
                    oSub.HRemark = ClsPub.isStrNull(grdMain.Rows[i].Cells[HRemarkCol].Value);
                    oSub.HWorkCenterID = ClsPub.isLong(grdMain.Rows[i].Cells[HWorkCenterIDCol].Value);
                    oSub.HWorkQty = ClsPub.isSingle(grdMain.Rows[i].Cells[HWorkQtyCol].Value);
                    oSub.HStdEmp = ClsPub.isSingle(grdMain.Rows[i].Cells[HStdEmpCol].Value);
                    oSub.HChangeTimes = ClsPub.isSingle(grdMain.Rows[i].Cells[HChangeTimesCol].Value);
                    oSub.HChangeMoney = ClsPub.isSingle(grdMain.Rows[i].Cells[HChangeMoneyCol].Value);
                    oSub.HProcNo = ClsPub.isLong(grdMain.Rows[i].Cells[HProcNoCol].Value);
                    oSub.HPieceTimes = ClsPub.isSingle(grdMain.Rows[i].Cells[HPieceTimesCol].Value);
                    oSub.HMouldQty = ClsPub.isSingle(grdMain.Rows[i].Cells[HMouldQtyCol].Value);
                    oSub.HChangeMouldMoney = ClsPub.isSingle(grdMain.Rows[i].Cells[HChangeMouldMoneyCol].Value);
                    oSub.HRushQty = ClsPub.isSingle(grdMain.Rows[i].Cells[HRushQtyCol].Value);
                    BillNew.DetailColl.Add(oSub);
                }
            }
@@ -587,13 +658,14 @@
            if (bResult == true)
            {
                BillChange = true;
                MessageBox.Show("单据存盘完毕!", "提示");
                if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
                {
                    MessageBox.Show("保存成功,最新数据请返回列表查看!", "提示");
                    this.Sub_AddBill();
                }
                else if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify)
                {
                    MessageBox.Show("修改成功!", "提示");
                    BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
                }
                this.Sub_OperStatus();
@@ -634,7 +706,8 @@
        //初始化GRID
        private void initGrid()
        {
            grdMain.ColumnCount = 22;                       //总列数
            grdMain.RowCount = 0;
            grdMain.ColumnCount = 34;                       //总列数
            DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name);
            //
            grdMain.Columns[HMaterIDCol].HeaderText = "物料ID";
@@ -656,6 +729,18 @@
            grdMain.Columns[HEndDateCol].HeaderText = "结束日期";
            grdMain.Columns[HPriceCol].HeaderText = "单价";
            grdMain.Columns[HRemarkCol].HeaderText = "备注";
            grdMain.Columns[HWorkCenterIDCol].HeaderText = "工作中心ID";
            grdMain.Columns[HWorkCenterNumberCol].HeaderText = "工作中心代码";
            grdMain.Columns[HWorkCenterNameCol].HeaderText = "工作中心名称";
            grdMain.Columns[HWorkQtyCol].HeaderText = "小时产能";
            grdMain.Columns[HStdEmpCol].HeaderText = "标准人力";
            grdMain.Columns[HChangeTimesCol].HeaderText = "换线时间";
            grdMain.Columns[HChangeMoneyCol].HeaderText = "换线补贴";
            grdMain.Columns[HProcNoCol].HeaderText = "工艺路线流水号";
            grdMain.Columns[HPieceTimesCol].HeaderText = "单件加工时间";
            grdMain.Columns[HMouldQtyCol].HeaderText = "模具数量";
            grdMain.Columns[HChangeMouldMoneyCol].HeaderText = "换模补贴";
            grdMain.Columns[HRushQtyCol].HeaderText = "单件冲次次数";
            //
            //设置特殊列
            //HOldMaterBackFlagCol
@@ -690,6 +775,7 @@
            grdMain.Columns[HDeptIDCol].Visible = false;
            grdMain.Columns[HDeptNumberCol].Visible = false;
            grdMain.Columns[HDeptNameCol].Visible = false;
            grdMain.Columns[HWorkCenterIDCol].Visible = false;
            //
            string sAllowCol = HMaterNumberCol.ToString() +
                            "," + HProcNumberCol.ToString() +
@@ -700,6 +786,16 @@
                            "," + HCostFlagCol.ToString() +
                            "," + HFlowFlagCol.ToString() +
                            "," + HPayFlagCol.ToString() +
                            "," + HWorkCenterNumberCol.ToString() +
                            "," + HWorkQtyCol.ToString() +
                            "," + HStdEmpCol.ToString() +
                            "," + HChangeTimesCol.ToString() +
                            "," + HChangeMoneyCol.ToString() +
                            "," + HProcNoCol.ToString() +
                            "," + HPieceTimesCol.ToString() +
                            "," + HMouldQtyCol.ToString() +
                            "," + HChangeMouldMoneyCol.ToString() +
                            "," + HRushQtyCol.ToString() +
                            "," + HRemarkCol.ToString();
            string sTotalCol = HPriceCol.ToString();
            //格式化网格
@@ -744,7 +840,9 @@
        //选择班组
        private void cmdHMaterID_Click(object sender, EventArgs e)
        {
            BLL.ClsBaseSelect_InterFace.SetTextByMater(txtHMaterID,txtHMaterName,txtHMaterModel);
            string sWhere = "";
            sWhere = " and HUSEORGID = " + sHOrgID;
            BLL.ClsBaseSelect_InterFace.SetTextByMater(sWhere,txtHMaterID, txtHMaterName,txtHMaterModel);
        }
@@ -771,7 +869,7 @@
        //是否是空行
        private bool IsNullRow(int Row)
        {
            if (ClsPub.isInt(grdMain.Rows[Row].Cells[HMaterIDCol].Value) == 0)
            if (ClsPub.isLong(grdMain.Rows[Row].Cells[HMaterIDCol].Value) == 0)
            {
                return true;
            }
@@ -795,6 +893,7 @@
        //帮助函数
        private void Sub_GridKey(int sKeyCode, int sRow, int sCol, DataGridViewTextBoxEditingControl oEdit)
        {
            string sWhere = "";
            if (!grdStatus)
            {
                return;
@@ -814,8 +913,8 @@
                    switch (sCol)
                    {
                        case HMaterNumberCol:
                            //BLL.ClsBaseSelect_K3.SetGridByMater_K3(grdMain, sRow, HMaterIDCol, HMaterNumberCol, HMaterNameCol, HMaterModelCol, 0, 0, 0);
                            BLL.ClsBaseSelect_InterFace.SetGridByMater(grdMain, sRow, HMaterIDCol, HMaterNumberCol, HMaterNameCol, HMaterModelCol, 0, 0, 0);
                            sWhere = " and HUSEORGID = " + sHOrgID;
                            BLL.ClsBaseSelect_InterFace.SetGridByMater(grdMain, sWhere, sRow, HMaterIDCol, HMaterNumberCol, HMaterNameCol, HMaterModelCol, 0, 0, 0);
                            if (rbHSelectCus.Checked)
                            {
                                grdMain.Rows[sRow].Cells[HProcIDCol].Value = txtHProcID.Tag.ToString();
@@ -848,7 +947,11 @@
                            BLL.ClsBaseSelect_InterFace.SetGridBySource(grdMain, sRow, HSourceIDCol, HSourceNumberCol, HSourceNameCol);
                            oEdit.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[sRow].Cells[HSourceNumberCol].Value);
                            break;
                        default:
                            case HWorkCenterNumberCol:
                                BLL.ClsBaseSelect_InterFace.SetGridByWorkCenter(grdMain, sRow, HWorkCenterIDCol, HWorkCenterNumberCol, HWorkCenterNameCol);
                                oEdit.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[sRow].Cells[HWorkCenterNumberCol].Value);
                                break;
                            default:
                            break;
                    }
                    break;
@@ -932,12 +1035,19 @@
        #endregion
        //选择组织时触发
        private void cmbHOrgID_TextChanged(object sender, EventArgs e)
        {
            DAL.ClsGy_ORGANIZATIONS_View oClsGy_ORGANIZATIONS_View = new DAL.ClsGy_ORGANIZATIONS_View();
            if (oClsGy_ORGANIZATIONS_View.GetInfoByName(cmbHOrgID.Text))
            {
                sHOrgID = oClsGy_ORGANIZATIONS_View.omodel.HItemID;
            }
            if (sHOrgID == -1)
            {
                MessageBox.Show("选择组织有错误!");
                return;
            }
        }
    }
}