Ejemplo n.º 1
0
        /// <summary>
        /// 设置
        /// </summary>
        public override void EntitySet()
        {
            FormNoControl entity = new FormNoControl();

            entity.ID = HTDataID;
            bool findFlag = entity.SelectByID();

            txtID.Text              = entity.ID.ToString();
            txtCode.Text            = entity.Code.ToString();
            txtNoType.Text          = entity.NoType.ToString();
            txtFormNM.Text          = entity.FormNM.ToString();
            txtFormRuleSpecial.Text = entity.FormRuleSpecial.ToString();
            txtFormRulePre.Text     = entity.FormRulePre.ToString();
            txtFormRuleSort.Text    = entity.FormRuleSort.ToString();
            txtCurSort.Text         = entity.CurSort.ToString();
            txtCurYear.Text         = entity.CurYear.ToString();
            txtCurMonth.Text        = entity.CurMonth.ToString();
            txtCurDay.Text          = entity.CurDay.ToString();
            txtDTableName.Text      = entity.DTableName.ToString();
            txtDFieldName.Text      = entity.DFieldName.ToString();
            txtCondition.Text       = entity.Condition.ToString();
            txtRemark.Text          = entity.Remark.ToString();
            drpSourceFlag.EditValue = entity.SourceFlag;

            if (!findFlag)
            {
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private FormNoControl EntityGet()
        {
            FormNoControl entity = new FormNoControl();

            entity.ID = HTDataID;
            entity.SelectByID();
            entity.ID              = SysConvert.ToInt32(txtID.Text.Trim());
            entity.Code            = txtCode.Text.Trim();
            entity.NoType          = SysConvert.ToInt32(txtNoType.Text.Trim());
            entity.FormNM          = txtFormNM.Text.Trim();
            entity.FormRuleSpecial = txtFormRuleSpecial.Text.Trim();
            entity.FormRulePre     = txtFormRulePre.Text.Trim();
            entity.FormRuleSort    = txtFormRuleSort.Text.Trim();
            entity.CurSort         = SysConvert.ToInt32(txtCurSort.Text.Trim());
            entity.CurYear         = SysConvert.ToInt32(txtCurYear.Text.Trim());
            entity.CurMonth        = SysConvert.ToInt32(txtCurMonth.Text.Trim());
            entity.CurDay          = SysConvert.ToInt32(txtCurDay.Text.Trim());
            entity.DTableName      = txtDTableName.Text.Trim();
            entity.DFieldName      = txtDFieldName.Text.Trim();
            entity.Condition       = txtCondition.Text.Trim();
            entity.Remark          = txtRemark.Text.Trim();
            entity.SourceFlag      = SysConvert.ToInt32(drpSourceFlag.EditValue);

            return(entity);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获得单据号码
        /// </summary>
        /// <param name="p_FormNoID">单据ID</param>
        /// <param name="p_Num">第几个单据号码0,1,2,</param>
        /// <param name="sqlTrans">事务</param>
        public string RGetFormNoVendor(int p_FormNoID, int p_FNCVID, string p_VendorID, IDBTransAccess sqlTrans)
        {
            try
            {
                string        outstr = "";
                FormNoControl entity = new FormNoControl(sqlTrans);
                entity.ID = p_FormNoID;
                entity.SelectByID();
                if (entity.NoType == 2)//使用具体业务表进行处理
                {
                    FormNCVendorRule nvRule = new FormNCVendorRule();

                    outstr = nvRule.RGetFormNo(entity, p_FNCVID, p_VendorID, sqlTrans);
                    //Data_FormNCVendor
                }
                else
                {
                    outstr = "单号异常,设置类型错误";
                }
                return(outstr);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 单据序号加N(有些批号可能一次产生多个)
 /// </summary>
 /// <param name="p_FormNoID">单据ID</param>
 /// <param name="p_Num">第几个单据号码0,1,2,</param>
 /// <param name="sqlTrans">事务</param>
 public void RAddSort(int p_FormNoID, int p_Num, IDBTransAccess sqlTrans)
 {
     try
     {
         FormNoControl entity = new FormNoControl(sqlTrans);
         entity.ID = p_FormNoID;
         entity.SelectByID();
         string sql = "UPDATE Enum_FormNoControl SET CurSort=" + (entity.CurSort + p_Num) + " WHERE ID=" + p_FormNoID;
         sqlTrans.ExecuteNonQuery(sql);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 获得单据号码
        /// </summary>
        /// <param name="p_FormNoID">单据ID</param>
        /// <param name="p_Num">第几个单据号码0,1,2,</param>
        /// <param name="sqlTrans">事务</param>
        public string RGetFormNo(int p_FormNoID, int p_Num, string p_WHID, IDBTransAccess sqlTrans)
        {
            try
            {
                string        outstr = "";
                FormNoControl entity = new FormNoControl(sqlTrans);
                entity.ID = p_FormNoID;
                entity.SelectByID();
                string   sql      = "SELECT getdate() AS ServerTime";
                DateTime dtserver = SysConvert.ToDateTime(sqlTrans.Fill(sql).Rows[0][0].ToString());

                bool UpdFlag = false;
                if (entity.CurYear != 0 && entity.CurYear != dtserver.Year)//判断年
                {
                    entity.CurYear = dtserver.Year;
                    UpdFlag        = true;
                }
                if (entity.CurMonth != 0 && entity.CurMonth != dtserver.Month)//判断月
                {
                    entity.CurMonth = dtserver.Month;
                    UpdFlag         = true;
                }
                if (entity.CurDay != 0 && entity.CurDay != dtserver.Day)//判断日
                {
                    entity.CurDay = dtserver.Day;
                    UpdFlag       = true;
                }
                if (UpdFlag)//需要更新
                {
                    entity.CurSort = 0;
                    this.RUpdate(entity, sqlTrans);
                }
                outstr = entity.FormRulePre;

                if (entity.CurYear != 0)//替换年
                {
                    outstr = outstr.Replace("YY", entity.CurYear.ToString().Substring(2));
                }
                if (entity.CurMonth != 0)//替换月
                {
                    outstr = outstr.Replace("MM", SysString.IntToStr(entity.CurMonth, 2));
                }
                if (entity.CurDay != 0)//替换日
                {
                    outstr = outstr.Replace("DD", SysString.IntToStr(entity.CurDay, 2));
                }

                if (entity.FormRuleSpecial != "")//替换特殊符号
                {
                    outstr = outstr.Replace("X", entity.FormRuleSpecial);
                }
                outstr += SysString.IntToStr(entity.CurSort + 1 + p_Num, entity.FormRuleSort.Length);//获得序号


                if (!THAddOneFlag) //没有调号过,防止死循环
                {
                    try            //跳号验证是否存在处理,存在则加1
                    {
                        sql = "SELECT DTableName,DFieldName FROM Enum_FormNoControl WHERE ID=" + p_FormNoID;
                        DataTable dtL = sqlTrans.Fill(sql);
                        if (dtL.Rows.Count != 0)
                        {
                            if (dtL.Rows[0]["DTableName"].ToString() != string.Empty && dtL.Rows[0]["DFieldName"].ToString() != string.Empty)
                            {
                                sql = "SELECT " + dtL.Rows[0]["DFieldName"].ToString() + " FROM " + dtL.Rows[0]["DTableName"].ToString() + " WHERE " + dtL.Rows[0]["DFieldName"].ToString() + "=" + SysString.ToDBString(outstr);
                                if (sqlTrans.Fill(sql).Rows.Count != 0)//产生的号码系统中已存在,则序号跳号
                                {
                                    THAddOneFlag = true;
                                    //this.RAddSort(p_FormNoID, sqlTrans);
                                    outstr = RGetFormNo(p_FormNoID, p_Num, p_WHID, sqlTrans);//循环调用一次
                                }
                            }
                        }
                    }
                    catch (Exception EL)//异常情况下填写临时信息
                    {
                        SysFile.WriteFrameworkLog(EL.Message);
                    }
                }
                return(outstr);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }