コード例 #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public List <Model.Fieldcmps> GetModelList(string where)
        {
            List <Model.Fieldcmps> fieldList = new List <Model.Fieldcmps>();
            StringBuilder          strSql    = new StringBuilder();

            strSql.Append("select autoid, isnull, cremark, guid, id, ccode, ctype, cvalue, cfunid, cardsection, fieldname, carditemname  ");
            strSql.Append("  from " + _tablename + " ");
            strSql.Append(" where  ");
            strSql.Append(where);
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), null);

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    Model.Fieldcmps model = new Model.Fieldcmps();
                    model.Autoid = dr["autoid"].ToString();
                    if (dr["isnull"].ToString() != "")
                    {
                        if ((dr["isnull"].ToString() == "1") || (dr["isnull"].ToString().ToLower() == "true"))
                        {
                            model.Isnull = true;
                        }
                        else
                        {
                            model.Isnull = false;
                        }
                    }
                    model.Cremark = dr["cremark"].ToString();
                    model.Guid    = dr["guid"].ToString();
                    model.Id      = dr["id"].ToString();
                    model.Ccode   = dr["ccode"].ToString();
                    if (dr["ctype"].ToString() != "")
                    {
                        model.Ctype = int.Parse(dr["ctype"].ToString());
                    }
                    model.Cvalue       = dr["cvalue"].ToString();
                    model.Cfunid       = dr["cfunid"].ToString();
                    model.Cardsection  = dr["cardsection"].ToString();
                    model.Fieldname    = dr["fieldname"].ToString();
                    model.Carditemname = dr["carditemname"].ToString();
                    fieldList.Add(model);
                }

                return(fieldList);
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
        /// <summary>
        /// 表体固定值检查
        /// </summary>
        /// <param name="fd">固定值信息</param>
        /// <param name="type">单据类型</param>
        public static void FieldcmpsBodyConstCheck(Model.Fieldcmps fd, string type)
        {
            string field = fd.Fieldname.ToLower();

            switch (type)
            {
            case "17":          //销售订单
                switch (field)
                {
                case "cinvcode":
                case "iquantity":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                case "dpredate":
                case "dpremodate":
                    if (string.IsNullOrEmpty(fd.Cvalue))
                    {
                        fd.Cvalue = DateTime.Now.ToString("yyyy-MM-dd");
                    }
                    break;

                default:
                    break;
                }
                break;

            case "01":          //发货单
                switch (field)
                {
                case "cinvcode":
                case "iquantity":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                //case "bcosting":
                //case "bsettleall":
                //case "bqaneedcheck":
                //case "bqaurgency":
                //case "bqachecking":
                //case "bqachecked":
                //    ErrorMsg(fd.Cvalue, "固定值不能为空");
                //    break;
                default:
                    break;
                }
                break;

            case "03":          //退货单
                switch (field)
                {
                case "cinvcode":
                case "iquantity":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                default:
                    break;
                }
                break;

            case "0303":        //销售出库单
                switch (field)
                {
                case "cinvcode":
                case "iflag":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                default:
                    break;
                }
                break;

            case "27":          //采购请购单
                switch (field)
                {
                case "cinvcode":
                case "fquantity":
                case "drequirdate":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                default:
                    break;
                }
                break;

            case "88":          //采购订单
                switch (field)
                {
                case "cinvcode":
                case "iquantity":
                case "ipertaxrate":
                case "darrivedate":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                default:
                    break;
                }
                break;

            case "26":          //采购到货单
                switch (field)
                {
                case "cinvcode":
                case "iquantity":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                case "itaxrate":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                default:
                    break;
                }
                break;

            case "24":          //采购入库单
                switch (field)
                {
                case "cinvcode":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                case "ibillsettlecount":
                case "imatsettlestate":
                case "iflag":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                default:
                    break;
                }
                break;

            case "0411":
                break;

            default:
                break;
            }
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fd"></param>
        /// <param name="i"></param>
        /// <param name="rowno"></param>
        /// <param name="apidata"></param>
        /// <param name="dt"></param>
        /// <param name="lmu8nv">一行数据</param>
        /// <param name="rdds"></param>
        /// <param name="rdsds"></param>
        private List <List <Model.U8NameValue> > SetSfcBodyChildRows(List <Model.Fieldcmps> listfd, Model.Fieldcmps bodyfd, ref int bodyrowi, ref int rowno, Model.APIData apidata,
                                                                     Model.Synergismlogdt dt,
                                                                     DataSet rdds, DataSet rdsds, DataSet rdchild)
        {
            List <List <Model.U8NameValue> > rows = new List <List <Model.U8NameValue> >();

            for (int i = 0; i < rdchild.Tables[0].Rows.Count; i++)
            {
                //Model.BodyRow lmu8nv = new Model.BodyRow();
                List <Model.U8NameValue> cols = new List <U8.Interface.Bus.ApiService.Model.U8NameValue>();

                foreach (Model.Fieldcmps fd in listfd)
                {
                    try
                    {
                        if (fd.Cardsection == DAL.Constant.Fixvalue_Cardsection_Child)
                        {
                            Model.U8NameValue u8nv = new Model.U8NameValue();

                            if (dt.Cvouchertype == "FC31" || dt.Cvouchertype == "FC32" || dt.Cvouchertype == "MO21")
                            {
                                u8nv.U8FieldName = fd.Fieldname; //生产制作区分大小写
                            }
                            else
                            {
                                u8nv.U8FieldName = fd.Fieldname.ToLower();
                            }

                            switch (fd.Ctype)
                            {
                            case DAL.Constant.Fieldcmps_Ctype_Const:        //固定值
                                Common.FieldcmpsBodyConstCheck(fd, dt.Cvouchertype);
                                u8nv.U8FieldValue = fd.Cvalue;
                                break;

                            case DAL.Constant.Fieldcmps_Ctype_Source:       // 完全参照
                                BLL.Common.ErrorMsg(fd.Cvalue.Split(','), 2, "完全参照格式不正确");
                                BLL.Common.ErrorMsg(fd.Cvalue.Split(',')[1].Split('|'), 2, "完全参照格式不正确");
                                string[] u8value = fd.Cvalue.Split(',')[1].Split('|');

                                if (u8value[0] == DAL.Constant.Fixvalue_Cardsection_Title)
                                {
                                    u8nv.U8FieldValue = rdds.Tables[0].Rows[0][u8value[1]].ToDataString();
                                }
                                if (u8value[0] == DAL.Constant.Fixvalue_Cardsection_Body)
                                {
                                    u8nv.U8FieldValue = rdsds.Tables[0].Rows[bodyrowi][u8value[1]].ToDataString();
                                }
                                if (u8value[0] == DAL.Constant.Fixvalue_Cardsection_Child)
                                {
                                    u8nv.U8FieldValue = rdchild.Tables[0].Rows[i][u8value[1]].ToDataString();
                                }

                                break;

                            case DAL.Constant.Fieldcmps_Ctype_MutiValue:        // 分账套
                                u8nv.U8FieldValue = DAL.Common.GetVauleByAccid(fd.Autoid, dt.Accid);
                                break;

                            case DAL.Constant.Fieldcmps_Ctype_Funtion:      // 函数
                                u8nv.U8FieldValue = DAL.Common.GetFunValue(apidata, apidata.HeadData, cols, rdds.Tables[0].Rows[0], rdsds.Tables[0].Rows[bodyrowi], fd, dt, rowno);
                                #region 默认值   刘忻洲添加  2014.11.20

                                if (dt.TaskType == 1)
                                {
                                    if (string.IsNullOrEmpty(u8nv.U8FieldValue))
                                    {
                                        u8nv.U8FieldValue = DAL.Common.GetDefaultValueByTaskIdFunctionId(dt.Id.ToString(), fd.Id, fd.Autoid, fd.Cfunid);
                                    }
                                    if (u8nv.U8FieldValue == "[null]")
                                    {
                                        u8nv.U8FieldValue = "";
                                    }
                                }
                                #endregion
                                break;

                            default:
                                u8nv.U8FieldValue = null;
                                break;
                            }
                            cols.Add(u8nv);
                        }
                    }
                    catch (Exception ex)
                    {
                        #region 默认值   刘忻洲修改  2014.11.20
                        if (dt.TaskType == 1)
                        {
                            string msg = string.Format("表体第{3}行,字段-{0}({2})取值发生错误,错误信息:{1}", fd.Carditemname, ex.Message.ToString(), fd.Fieldname, i + 1);

                            if (fd.Ctype == DAL.Constant.Fieldcmps_Ctype_Funtion)  // 函数
                            {
                                Model.U8NameValue u8nv = new Model.U8NameValue();
                                if (dt.Cvouchertype == "FC31" || dt.Cvouchertype == "FC32" || dt.Cvouchertype == "MO21")
                                {
                                    u8nv.U8FieldName = fd.Fieldname;//生产制作区分大小写
                                }
                                else
                                {
                                    u8nv.U8FieldName = fd.Fieldname.ToLower();
                                }


                                u8nv.U8FieldValue = DAL.Common.GetDefaultValueByTaskIdFunctionId(dt.Id.ToString(), fd.Id, fd.Autoid, fd.Cfunid);
                                if (string.IsNullOrEmpty(u8nv.U8FieldValue))
                                {
                                    throw new Exception(msg);
                                }
                                if (u8nv.U8FieldValue == "[null]")
                                {
                                    u8nv.U8FieldValue = "";
                                }
                                cols.Add(u8nv);
                            }
                            else
                            {
                                throw new Exception(msg);
                            }
                        }
                        #endregion
                    }
                }

                rows.Add(cols);
            }

            return(rows);
        }
コード例 #4
0
        /// <summary>
        /// 表头固定值检查
        /// </summary>
        /// <param name="fd">固定值信息</param>
        /// <param name="type">单据类型</param>
        public static void FieldcmpsHeadConstCheck(Model.Fieldcmps fd, string type)
        {
            string field = fd.Fieldname.ToLower();

            switch (type)
            {
            case "17":          //销售订单
                switch (field)
                {
                case "ddate":
                    if (string.IsNullOrEmpty(fd.Cvalue))
                    {
                        fd.Cvalue = DateTime.Now.ToString("yyyy-MM-dd");
                    }
                    break;

                case "cbustype":
                case "cstcode":
                case "ccuscode":
                case "cdepcode":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                case "breturnflag":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                default:
                    break;
                }
                break;

            case "01":          //发货单
                switch (field)
                {
                case "ddate":
                    if (string.IsNullOrEmpty(fd.Cvalue))
                    {
                        fd.Cvalue = DateTime.Now.ToString("yyyy-MM-dd");
                    }
                    break;

                case "cbustype":
                case "cstcode":
                case "ccuscode":
                case "cdepcode":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                //case "bfirst":
                //case "breturnflag":
                //case "bsettleall":
                case "iexchrate":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                default:
                    break;
                }
                break;

            case "03":          //退货单    added by liuxzha  2014.11.27
                switch (field)
                {
                case "ddate":
                    if (string.IsNullOrEmpty(fd.Cvalue))
                    {
                        fd.Cvalue = DateTime.Now.ToString("yyyy-MM-dd");
                    }
                    break;

                case "cbustype":
                case "cstcode":
                case "ccuscode":
                case "cdepcode":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                case "iexchrate":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                default:
                    break;
                }
                break;

            case "0303":        //销售出库单
                switch (field)
                {
                case "ddate":
                    if (string.IsNullOrEmpty(fd.Cvalue))
                    {
                        fd.Cvalue = DateTime.Now.ToString("yyyy-MM-dd");
                    }
                    break;

                case "cwhcode":
                case "ccuscode":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                //case "bssstqc":
                //case "brdflag":
                //case "btransflag":
                case "iexchrate":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                default:
                    break;
                }
                break;

            case "27":          //采购请购单
                switch (field)
                {
                case "ddate":
                    if (string.IsNullOrEmpty(fd.Cvalue))
                    {
                        fd.Cvalue = DateTime.Now.ToString("yyyy-MM-dd");
                    }
                    break;

                case "":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                default:
                    break;
                }
                break;

            case "88":          //采购订单
                switch (field)
                {
                case "dpodate":
                    if (string.IsNullOrEmpty(fd.Cvalue))
                    {
                        fd.Cvalue = DateTime.Now.ToString("yyyy-MM-dd");
                    }
                    break;

                case "cvencode":
                case "cexch_name":
                case "nflat":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                default:
                    break;
                }
                break;

            case "26":          //采购到货单
                switch (field)
                {
                case "ddate":
                    if (string.IsNullOrEmpty(fd.Cvalue))
                    {
                        fd.Cvalue = DateTime.Now.ToString("yyyy-MM-dd");
                    }
                    break;

                case "cbustype":
                case "cvencode":
                case "cdepcode":
                case "cexch_name":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                case "iexchrate":
                case "ibilltype":
                case "bnegative":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                default:
                    break;
                }
                break;

            case "24":          //采购入库单
                switch (field)
                {
                case "ddate":
                    if (string.IsNullOrEmpty(fd.Cvalue))
                    {
                        fd.Cvalue = DateTime.Now.ToString("yyyy-MM-dd");
                    }
                    break;

                case "cwhcode":
                case "cvencode":
                case "cdepcode":
                case "cexch_name":
                    ErrorMsg(fd.Cvalue, "固定值不能为空");
                    break;

                default:
                    break;
                }
                break;

            case "0411":       //产成品入库单
                break;

            default:
                break;
            }
        }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fd"></param>
        /// <param name="i"></param>
        /// <param name="rowno"></param>
        /// <param name="apidata"></param>
        /// <param name="dt"></param>
        /// <param name="lmu8nv"></param>
        /// <param name="rdds"></param>
        /// <param name="rdsds"></param>
        private void SetSfcBodyCols(List <Model.Fieldcmps> listfd, Model.Fieldcmps fd, ref int i, ref int rowno,
                                    Model.APIData apidata, Model.Synergismlogdt dt, Model.BodyRow lmu8nv, DataSet rdds, DataSet rdsds)
        {
            try
            {
                if (fd.Cardsection == DAL.Constant.Fixvalue_Cardsection_Body)
                {
                    Model.U8NameValue u8nv = new Model.U8NameValue();

                    if (dt.Cvouchertype == "FC31" || dt.Cvouchertype == "FC32" || dt.Cvouchertype == "MO21")
                    {
                        u8nv.U8FieldName = fd.Fieldname; //生产制作区分大小写
                    }
                    else
                    {
                        u8nv.U8FieldName = fd.Fieldname.ToLower();
                    }


                    switch (fd.Ctype)
                    {
                    case DAL.Constant.Fieldcmps_Ctype_Const:        //固定值
                        Common.FieldcmpsBodyConstCheck(fd, dt.Cvouchertype);
                        u8nv.U8FieldValue = fd.Cvalue;
                        break;

                    case DAL.Constant.Fieldcmps_Ctype_Source:       // 完全参照
                        BLL.Common.ErrorMsg(fd.Cvalue.Split(','), 2, "完全参照格式不正确");
                        BLL.Common.ErrorMsg(fd.Cvalue.Split(',')[1].Split('|'), 2, "完全参照格式不正确");
                        string[] u8value = fd.Cvalue.Split(',')[1].Split('|');

                        if (u8value[0] == DAL.Constant.Fixvalue_Cardsection_Title)
                        {
                            u8nv.U8FieldValue = rdds.Tables[0].Rows[0][u8value[1]].ToDataString();
                        }
                        if (u8value[0] == DAL.Constant.Fixvalue_Cardsection_Body)
                        {
                            u8nv.U8FieldValue = rdsds.Tables[0].Rows[i][u8value[1]].ToDataString();
                        }
                        break;

                    case DAL.Constant.Fieldcmps_Ctype_MutiValue:        // 分账套
                        u8nv.U8FieldValue = DAL.Common.GetVauleByAccid(fd.Autoid, dt.Accid);
                        break;

                    case DAL.Constant.Fieldcmps_Ctype_Funtion:      // 函数
                        u8nv.U8FieldValue = DAL.Common.GetFunValue(apidata, apidata.HeadData, lmu8nv.BodyCols, rdds.Tables[0].Rows[0], rdsds.Tables[0].Rows[i], fd, dt, rowno);
                        #region 默认值   刘忻洲添加  2014.11.20

                        if (dt.TaskType == 1)
                        {
                            if (string.IsNullOrEmpty(u8nv.U8FieldValue))
                            {
                                u8nv.U8FieldValue = DAL.Common.GetDefaultValueByTaskIdFunctionId(dt.Id.ToString(), fd.Id, fd.Autoid, fd.Cfunid);
                            }
                            if (u8nv.U8FieldValue == "[null]")
                            {
                                u8nv.U8FieldValue = "";
                            }
                        }
                        #endregion
                        break;

                    default:
                        u8nv.U8FieldValue = null;
                        break;
                    }
                    lmu8nv.BodyCols.Add(u8nv);

                    #region 添加表体子表
                    DataSet dschild = new DataSet();
                    dschild = ((SfcOp)dt.OP).SetFromTabetsChild(dt, apidata.Fristsynergismlogdt, apidata);
                    List <List <Model.U8NameValue> > childData = SetSfcBodyChildRows(listfd, fd, ref i, ref rowno, apidata, dt, rdds, rdsds, dschild);
                    lmu8nv.ChildData = childData;
                    #endregion
                }
            }
            catch (Exception ex)
            {
                #region 默认值   刘忻洲修改  2014.11.20
                if (dt.TaskType == 1)
                {
                    string msg = string.Format("表体第{3}行,字段-{0}({2})取值发生错误,错误信息:{1}", fd.Carditemname, ex.Message.ToString(), fd.Fieldname, i + 1);

                    if (fd.Ctype == DAL.Constant.Fieldcmps_Ctype_Funtion)  // 函数
                    {
                        Model.U8NameValue u8nv = new Model.U8NameValue();
                        if (dt.Cvouchertype == "FC31" || dt.Cvouchertype == "FC32" || dt.Cvouchertype == "MO21")
                        {
                            u8nv.U8FieldName = fd.Fieldname;//生产制作区分大小写
                        }
                        else
                        {
                            u8nv.U8FieldName = fd.Fieldname.ToLower();
                        }


                        u8nv.U8FieldValue = DAL.Common.GetDefaultValueByTaskIdFunctionId(dt.Id.ToString(), fd.Id, fd.Autoid, fd.Cfunid);
                        if (string.IsNullOrEmpty(u8nv.U8FieldValue))
                        {
                            throw new Exception(msg);
                        }
                        if (u8nv.U8FieldValue == "[null]")
                        {
                            u8nv.U8FieldValue = "";
                        }
                        lmu8nv.BodyCols.Add(u8nv);

                        #region 添加表体子表
                        List <List <Model.U8NameValue> > childData = SetSfcBodyChildRows(listfd, fd, ref i, ref rowno, apidata, dt, rdds, rdsds, rdsds);
                        lmu8nv.ChildData = childData;
                        #endregion
                    }
                    else
                    {
                        throw new Exception(msg);
                    }
                }
                #endregion
            }
        }