Exemple #1
0
        /// <summary>
        /// 保存设计Bom信息
        /// </summary>
        public bool SaveDesignBom(string salesOrderNoStr, Dictionary <int, string> codeIdList, float qty)
        {
            bool result = false;

            foreach (string codeFileName in codeIdList.Values)
            {
                string sqlStr = string.Format("select COUNT(*) from BS_BomMateriel where MaterielNo = '{0}'", codeFileName);
                int    count  = DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr));
                if (count == 0)//按照零件进行录入
                {
                    if (SaveDesignBom_PartsCode(salesOrderNoStr, codeFileName, qty))
                    {
                        result = true;
                    }
                }
                else//按照Bom进行录入
                {
                    if (SaveDesignBom_Bom(salesOrderNoStr, codeFileName, qty))
                    {
                        result = true;
                    }
                }
            }

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// 得到仓库类别默认的类别编号
        /// </summary>
        public string Get_WarehouseType_TypeNo(string tableNameStr, string primaryKeyStr)
        {
            string sqlStr    = string.Format("select {1} from {0} where IsDefault = 1", tableNameStr, primaryKeyStr);
            string typeNoStr = DataTypeConvert.GetString(BaseSQL.GetSingle(sqlStr));

            if (typeNoStr != "")
            {
                return(typeNoStr);
            }
            else
            {
                sqlStr = string.Format("select top 1 {1} from {0}", tableNameStr, primaryKeyStr);
                return(DataTypeConvert.GetString(BaseSQL.GetSingle(sqlStr)));
            }
        }
Exemple #3
0
        /// <summary>
        /// 检查功能模块是否在工位里面使用
        /// </summary>
        public bool CheckStnModule_IsStnSummary(SqlCommand cmd, string smNoStr)
        {
            int    count  = 0;
            string sqlStr = string.Format("select Count(*) from SA_StnSummaryListModule where StnModuleId = '{0}'", smNoStr);

            if (cmd == null)
            {
                count = DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr));
            }
            else
            {
                cmd.CommandText = sqlStr;
                count           = DataTypeConvert.GetInt(cmd.ExecuteScalar());
            }
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
        /// <summary>
        /// 更新某个单据模板
        /// </summary>
        public bool UpdateDocTemplet_File(string tableNameStr)
        {
            string    sqlStr          = string.Format("select * from BS_DocumentTemplet where TableName = '{0}'", tableNameStr);
            DataTable docTempletTable = BaseSQL.GetTableBySql(sqlStr);

            if (docTempletTable.Rows.Count != 1)
            {
                //MessageHandler.ShowMessageBox("未查询到当前表的模板记录,操作错误。");
                MessageHandler.ShowMessageBox(f.tsmiWcxddq.Text);
                return(false);
            }
            string docPathStr = DataTypeConvert.GetString(docTempletTable.Rows[0]["DocPath"]) + DataTypeConvert.GetString(docTempletTable.Rows[0]["DocFileName"]);

            if (!File.Exists(docPathStr))
            {
                return(false);
            }

            long streamLength = 0;

            Byte[] buffer = new FileHandler().FileToByteArray(docPathStr, ref streamLength);

            SqlParameter p1 = new SqlParameter("@size", SqlDbType.Int);

            p1.Value = streamLength;
            SqlParameter p2 = new SqlParameter("@filebyte", SqlDbType.Image);

            p2.Value = buffer;
            SqlParameter p3 = new SqlParameter("@tablename", SqlDbType.VarChar, 50);

            p3.Value = tableNameStr;
            SqlParameter[] paraList = { p1, p2, p3 };
            BaseSQL.GetSingle("Update BS_DocumentTemplet Set Size = @size, FileByte = @filebyte where TableName = @tablename", paraList);

            return(true);
        }
Exemple #5
0
        /// <summary>
        /// 检查报价单是否有生成销售订单
        /// </summary>
        public bool CheckSalesOrder_IsSettleAccounts(SqlCommand cmd, string autoSalesOrderNoStr)
        {
            string sqlStr = string.Format("select Count(*) from SA_SettleAccountsList where AutoSalesOrderNo = '{0}'", autoSalesOrderNoStr);
            int    count  = 0;

            if (cmd != null)
            {
                cmd.CommandText = sqlStr;
                count           = DataTypeConvert.GetInt(cmd.ExecuteScalar());
            }
            else
            {
                count = DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr));
            }
            if (count > 0)
            {
                MessageHandler.ShowMessageBox(string.Format("销售订单[{0}]已经生成销售结账单,不可以再进行修改或者删除。", autoSalesOrderNoStr));
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #6
0
        /// <summary>
        /// 检查工位信息是否设定功能模块
        /// </summary>
        public bool CheckStnList_IsModule(SqlCommand cmd, int autoIdInt)
        {
            string sqlStr = string.Format("select Count(*) from SA_StnSummaryListModule where StnSummaryListId = {0}", autoIdInt);
            int    count  = 0;

            if (cmd != null)
            {
                cmd.CommandText = sqlStr;
                count           = DataTypeConvert.GetInt(cmd.ExecuteScalar());
            }
            else
            {
                count = DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr));
            }
            if (count > 0)
            {
                MessageHandler.ShowMessageBox("工位信息已经设定功能模块,不可以进行删除等操作。");
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #7
0
        /// <summary>
        /// 检查报价单是否有生成销售订单
        /// </summary>
        /// <returns></returns>
        public bool CheckQuotationInfo_IsSalesOrder(SqlCommand cmd, string autoQuotationNoStr)
        {
            string sqlStr = string.Format("select Count(*) from SA_SalesOrder where AutoQuotationNo = '{0}'", autoQuotationNoStr);
            int    count  = 0;

            if (cmd != null)
            {
                cmd.CommandText = sqlStr;
                count           = DataTypeConvert.GetInt(cmd.ExecuteScalar());
            }
            else
            {
                count = DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr));
            }
            if (count > 0)
            {
                MessageHandler.ShowMessageBox(string.Format("报价单[{0}]已经生成销售订单,不可以再进行修改、删除和关闭等操作。", autoQuotationNoStr));
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #8
0
        /// <summary>
        /// 查询其他工位使用模块的数量
        /// </summary>
        public int QueryOtherStnUseModuleCount(string smNoStr, int noContainId)
        {
            string sqlStr = string.Format("select COUNT(*) from SA_StnSummaryListModule where StnModuleId = '{0}' and AutoId not in ({1})", smNoStr, noContainId);

            return(DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr)));
        }
Exemple #9
0
        /// <summary>
        /// 查询报价单号是否存在
        /// </summary>
        public int QueryQuotationBaseInfoCount(string autoQuotationNoStr)
        {
            string sqlStr = string.Format("select COUNT(*) from SA_QuotationBaseInfo where AutoQuotationNo = '{0}'", autoQuotationNoStr);

            return(DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr)));
        }
Exemple #10
0
        /// <summary>
        /// 得到询价单的AutoId最大号
        /// </summary>
        public int GetInquiryListMaxAutoId()
        {
            string sqlStr = "Select IsNull(Max(AutoId), 0) from PUR_InquiryList";

            return(DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr)));
        }
Exemple #11
0
        /// <summary>
        /// 查询请购单指定某个操作员为执行人的明细数量
        /// </summary>
        public int QueryPrReqList_ArrangementCount(int arrangementIdInt)
        {
            string sqlStr = string.Format("select COUNT(*) from PUR_PrReqList where Arrangement = {0} and AutoId not in (select IsNull(PrListAutoId, 0) from PUR_OrderList)", arrangementIdInt);

            return(DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr)));
        }
        /// <summary>
        /// 根据设计Bom编号来查询生产计划单Bom信息已经登记的数量
        /// </summary>
        public decimal QueryPSBom_PurQty(string pbBomNoStr)
        {
            string sqlStr = string.Format("select IsNull(Sum(PurQty), 0) from PB_ProductionScheduleBomManage where PbBomNo = '{0}'", pbBomNoStr);

            return(DataTypeConvert.GetDecimal(BaseSQL.GetSingle(sqlStr)));
        }
Exemple #13
0
        /// <summary>
        /// 查询项目人员是否可以修改计划
        /// </summary>
        public int QueryProjectUser_SingleValue(string columnNameStr, int autoIdInt)
        {
            string sqlStr = string.Format("select {1} from BS_ProjectUser where AutoId = {0}", autoIdInt, columnNameStr);

            return(DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr)));
        }
Exemple #14
0
        /// <summary>
        /// 单击保存按钮事件
        /// </summary>
        public bool btnSave_Click()
        {
            try
            {
                masterBindingSource.EndEdit();
                DataRow dr = ((DataRowView)masterBindingSource.Current).Row;

                if (dr.RowState == DataRowState.Added && DataTypeConvert.GetString(dr[PrimaryKeyColumn]) != "")
                {
                    string sqlStr = string.Format("select count(*) from {0} where {1}='{2}'", TableName, PrimaryKeyColumn, DataTypeConvert.GetString(dr[PrimaryKeyColumn]));
                    if (DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr)) > 0)
                    {
                        //MessageHandler.ShowMessageBox(string.Format("主键列[{0}]不可以输入重复的信息,请重新输入。", masterDataSet.Tables[0].Columns[PrimaryKeyColumn].Caption));
                        MessageHandler.ShowMessageBox(string.Format(f.tsmiZjl.Text + "[{0}]" + f.tsmiBkysrcfdxxqcxsr.Text, masterDataSet.Tables[0].Columns[PrimaryKeyColumn].Caption));
                        if (masterEditPanel != null)
                        {
                            masterEditPanel.SelectNextControl(null, true, true, true, true);
                        }
                        return(false);
                    }
                }
                else if (dr.RowState == DataRowState.Modified && DataTypeConvert.GetString(dr[PrimaryKeyColumn]) != "")
                {
                    string sqlStr = string.Format("select count(*) from {0} where {1}='{2}' and {1}!='{3}'", TableName, PrimaryKeyColumn, DataTypeConvert.GetString(dr[PrimaryKeyColumn, DataRowVersion.Current]), DataTypeConvert.GetString(dr[PrimaryKeyColumn, DataRowVersion.Original]));
                    if (DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr)) > 0)
                    {
                        //MessageHandler.ShowMessageBox(string.Format("主键列[{0}]不可以输入重复的信息,请重新输入。", masterDataSet.Tables[0].Columns[PrimaryKeyColumn].Caption));
                        MessageHandler.ShowMessageBox(string.Format(f.tsmiZjl.Text + "[{0}]" + f.tsmiBkysrcfdxxqcxsr.Text, masterDataSet.Tables[0].Columns[PrimaryKeyColumn].Caption));
                        if (masterEditPanel != null)
                        {
                            masterEditPanel.SelectNextControl(null, true, true, true, true);
                        }
                        return(false);
                    }
                }

                if (dr.RowState != DataRowState.Unchanged || RowStateUnchangedIsSave)
                {
                    bool isAdded = dr.RowState == DataRowState.Added;
                    if (DoSave(dr))
                    {
                        newState = false;
                        Set_Button_State(true);
                        Set_EditZone_ControlReadOnly(true);

                        int posInt = masterBindingSource.Position;
                        btnRefresh_Click(null, null);

                        if (RefreshToSetPosition)
                        {
                            if (!isAdded)
                            {
                                masterBindingSource.Position = posInt;
                            }
                        }
                        else
                        {
                            masterBindingSource.Position = posInt;
                        }
                        return(true);
                    }
                    return(false);
                }
                else
                {
                    newState = false;
                    Set_Button_State(true);
                    Set_EditZone_ControlReadOnly(true);

                    int posInt = masterBindingSource.Position;
                    btnRefresh_Click(null, null);
                    masterBindingSource.Position = posInt;
                    return(true);
                }
            }
            catch (Exception ex)
            {
                //ExceptionHandler.HandleException(this.Text + "--保存按钮事件错误。", ex);
                ExceptionHandler.HandleException(this.Text + "--" + f.tsmiBcansj.Text, ex);
                if (masterEditPanel != null)
                {
                    masterEditPanel.SelectNextControl(null, true, true, true, true);
                }
                return(false);
            }
        }
Exemple #15
0
        /// <summary>
        /// 查询用户登记被拒绝的单据的条数
        /// </summary>
        public int QueryRejectOrder_Count()
        {
            string sqlStr = Get_QueryRejectOrder_Sql("Count(*)");

            return(DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr)));
        }
Exemple #16
0
        /// <summary>
        /// 查询用户流程信息的条数
        /// </summary>
        public int QueryUserWorkFlow_Count()
        {
            string sqlStr = Get_QueryUserWorkFlow_Sql("Count(*)");

            return(DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr)));
        }
Exemple #17
0
        /// <summary>
        /// 查询用户流程信息数量
        /// </summary>
        public int QueryUserWorkFlow()
        {
            string sqlStr = string.Format("select Count(*) from F_QueryUserWorkFlow('{0}')", SystemInfo.user.LoginID);

            return(DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr)));
        }
Exemple #18
0
        /// <summary>
        /// 查询项目计划任务表的状态
        /// </summary>
        public int QueryProjectPlanTask_PlanTaskStatus(int autoIdInt)
        {
            string sqlStr = string.Format("Select PlanTaskStatus from PM_ProjectPlanTask where AutoId = {0}", autoIdInt);

            return(DataTypeConvert.GetInt(BaseSQL.GetSingle(sqlStr)));
        }