private FrameDLRObject copyPOItem(dynamic source)
        {
            var rtn = FrameDLRObject.CreateInstance();

            rtn.hw_contract_no         = source.hw_contract_no;
            rtn.cust_contract_no       = source.cust_contract_no;
            rtn.version                = source.version;
            rtn.status                 = source.status;
            rtn.hw_frame_contract_no   = source.hw_frame_contract_no;
            rtn.cust_frame_contract_no = source.cust_frame_contract_no;
            rtn.hw_sign_entity         = source.hw_sign_entity;
            rtn.cust_sign_entity       = source.cust_sign_entity;
            rtn.cust_type_lv1          = source.cust_type_lv1;
            rtn.cust_type_lv2          = source.cust_type_lv2;
            rtn.trade_terms            = source.trade_terms;
            rtn.transport_mode         = source.transport_mode;
            rtn.payment_terms          = source.payment_terms;
            rtn.is_vat_included        = source.is_vat_included;
            rtn.contract_amount_cny    = DoubleStd.IsDouble(source.contract_amount_cny) ? DoubleStd.ParseStd(source.contract_amount_cny).Value : null;
            rtn.contract_amount_usd    = DoubleStd.IsDouble(source.contract_amount_usd) ? DoubleStd.ParseStd(source.contract_amount_usd).Value : null;
            rtn.retail_sample          = source.retail_sample;
            rtn.created_by             = source.created_by;
            rtn.created_date           = DateTimeStd.IsDateTime(source.created_date) ? DateTimeStd.ParseStd(source.created_date).Value.ToString("yyyyMMddHHmmss") : null;
            rtn.accepted_date          = DateTimeStd.IsDateTime(source.accepted_date) ? DateTimeStd.ParseStd(source.accepted_date).Value.ToString("yyyyMMddHHmmss") : null;
            rtn.review_completed_date  = DateTimeStd.IsDateTime(source.review_completed_date) ? DateTimeStd.ParseStd(source.review_completed_date).Value.ToString("yyyyMMddHHmmss") : null;
            rtn.signed_date            = DateTimeStd.IsDateTime(source.signed_date) ? DateTimeStd.ParseStd(source.signed_date).Value.ToString("yyyyMMddHHmmss") : null;
            return(rtn);
        }
        private FrameDLRObject copyPOFeeItem(dynamic source, string hw_contract_no, int lineindex)
        {
            var rtn = FrameDLRObject.CreateInstance();

            rtn.hw_contract_no = hw_contract_no;
            rtn.line_no        = IntStd.IsInt(source.line_no) ? IntStd.ParseStd(source.line_no).Value : lineindex;
            rtn.line_type      = source.line_type;
            rtn.desc           = source.desc;
            rtn.prod_model     = source.prod_model;
            rtn.amount         = DoubleStd.IsDouble(source.amount) ? DoubleStd.ParseStd(source.amount).Value : 0.0;
            rtn.comments       = source.comments;

            return(rtn);
        }
            /// <summary>
            /// 判定是否为数字类型
            /// </summary>
            /// <param name="rule">key为传入参数名称,value为提示信息</param>
            /// <returns></returns>
            public virtual dynamic NumberValidation(FrameDLRObject rule)
            {
                var rtn = FrameDLRObject.CreateInstance(@"{
issuccess:true,
msg:''
}");

                foreach (var s in rule.Keys)
                {
                    var input = _logic.CallContext_Parameter[DomainKey.POST_DATA, s];
                    input = input == null ? _logic.CallContext_Parameter[DomainKey.QUERY_STRING, s] : input;
                    if (!DoubleStd.IsDouble(input))
                    {
                        rtn.issuccess = false;
                        rtn.msg       = rule.GetValue(s);
                        return(rtn);
                    }
                }
                return(rtn);
            }
        private FrameDLRObject copyPOLineItem(dynamic source, string hw_contract_no, int lineindex)
        {
            var rtn = FrameDLRObject.CreateInstance();

            rtn.hw_contract_no  = hw_contract_no;
            rtn.po_line_no      = IntStd.IsInt(source.po_line_no) ? IntStd.ParseStd(source.po_line_no).Value : lineindex;
            rtn.line_type       = source.line_type;
            rtn.prod_code_cust  = source.prod_code_cust;
            rtn.prod_desc_cust  = source.prod_desc_cust;
            rtn.prod_code_sale  = source.prod_code_sale;
            rtn.prod_desc_hw    = source.prod_desc_hw;
            rtn.prod_model      = source.prod_model;
            rtn.color           = source.color;
            rtn.quantity        = IntStd.IsInt(source.quantity) ? IntStd.ParseStd(source.quantity).Value : 0;
            rtn.currency        = source.currency;
            rtn.unit_price_cny  = DoubleStd.IsDouble(source.unit_price_cny) ? DoubleStd.ParseStd(source.unit_price_cny).Value : 0.0;
            rtn.line_amount_cny = DoubleStd.IsDouble(source.line_amount_cny) ? DoubleStd.ParseStd(source.line_amount_cny).Value : 0.0;
            rtn.line_amount_usd = DoubleStd.IsDouble(source.line_amount_usd) ? DoubleStd.ParseStd(source.line_amount_usd).Value : 0.0;

            return(rtn);
        }
        object QueryPO()
        {
            SetCacheEnable(false);
            string start_date = ComFunc.nvl(QueryStringD.start_date);
            string end_date   = ComFunc.nvl(QueryStringD.end_date);

            if (!IsValidBy("日期格式不正确", () =>
            {
                return((start_date == "" || DateTimeStd.IsDateTime(start_date)) && (end_date == "" || DateTimeStd.IsDateTime(end_date)));
            }))
            {
                return(null);
            }

            var up = DB.NewDBUnitParameter();
            var s  = from t in DB.LamdaTable("HW_PO", "a")
                     where t.notnull(start_date, t.accepted_date >= DateTimeStd.IsDateTimeThen(start_date)) &&
                     t.notnull(end_date, t.accepted_date <= DateTimeStd.IsDateTimeThen(end_date)) &&
                     t.is_processed == 0
                     select t;
            var result = DB.LamdaQueryByPage(up, s, "hw_contract_no");
            var polist = (from t in result.QueryData <FrameDLRObject>()
                          select new
            {
                t.hw_contract_no,
                t.cust_contract_no,
                t.version,
                t.status,
                t.hw_frame_contract_no,
                t.cust_frame_contract_no,
                t.hw_sign_entity,
                t.cust_sign_entity,
                t.cust_type_lv1,
                t.cust_type_lv2,
                t.trade_terms,
                t.transport_mode,
                t.payment_terms,
                t.is_vat_included,
                contract_amount_cny = DoubleStd.IsDouble(t.contract_amount_cny) ? DoubleStd.ParseStd(t.contract_amount_cny).Value : 0.0,
                contract_amount_usd = DoubleStd.IsDouble(t.contract_amount_usd) ? DoubleStd.ParseStd(t.contract_amount_usd).Value : 0.0,
                t.retail_sample,
                t.created_by,
                created_date = DateTimeStd.IsDateTimeThen(t.created_date, "yyyy-MM-dd HH:mm:ss"),
                accepted_date = DateTimeStd.IsDateTimeThen(t.accepted_date, "yyyy-MM-dd HH:mm:ss"),
                review_completed_date = DateTimeStd.IsDateTimeThen(t.review_completed_date, "yyyy-MM-dd HH:mm:ss"),
                signed_date = DateTimeStd.IsDateTimeThen(t.signed_date, "yyyy-MM-dd HH:mm:ss")
            }).ToList();

            foreach (dynamic item in polist)
            {
                var sline = from t in DB.LamdaTable("HW_PO_Line", "a")
                            where t.hw_contract_no == item.hw_contract_no
                            select new
                {
                    t.po_line_no,
                    t.line_type,
                    t.prod_code_cust,
                    t.prod_desc_cust,
                    t.prod_code_sale,
                    t.prod_desc_hw,
                    t.prod_model,
                    t.color,
                    t.quantity,
                    t.currency,
                    t.unit_price_cny,
                    t.line_amount_cny,
                    t.line_amount_usd
                };
                item.po_line = DB.ExcuteLamda(up, sline).QueryData <object>();

                var sfee = from t in DB.LamdaTable("HW_PO_Fee", "a")
                           where t.hw_contract_no == item.hw_contract_no
                           select new
                {
                    t.line_no,
                    t.line_type,
                    t.desc,
                    t.prod_model,
                    t.amount,
                    t.comments
                };
                item.other_fee = DB.ExcuteLamda(up, sfee).QueryData <object>();
            }

            return(new
            {
                data = polist,
                total_num = result.TotalRow,
                current_page = result.CurrentPage,
                total_page = result.TotalPage,
                page_size = result.Count_Of_OnePage
            });
        }
Exemple #6
0
        protected override bool DoValid(EWRAParameter ep, EWRAData ed)
        {
            if (fields == null)
            {
                return(true);
            }
            else
            {
                foreach (var f in fields)
                {
                    var ispostdata    = ep.ContainsKey(DomainKey.POST_DATA, f);
                    var isquerystring = ep.ContainsKey(DomainKey.QUERY_STRING, f);
                    var v             = ComFunc.nvl(ep[DomainKey.POST_DATA, f]);
                    v = v == "" ? ComFunc.nvl(ep[DomainKey.QUERY_STRING, f]) : v;
                    if (is_check_empty_error)
                    {
                        if (!DoubleStd.IsDouble(v))
                        {
                            return(false);
                        }
                        else
                        {
                            if (is_convert)
                            {
                                if (ispostdata)
                                {
                                    ep[DomainKey.POST_DATA, f] = double.Parse(v);
                                }
                                if (isquerystring)
                                {
                                    ep[DomainKey.QUERY_STRING, f] = double.Parse(v);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (v != "" && !DoubleStd.IsDouble(v))
                        {
                            return(false);
                        }
                        else
                        {
                            if (v != "")
                            {
                                if (is_convert)
                                {
                                    if (ispostdata)
                                    {
                                        ep[DomainKey.POST_DATA, f] = double.Parse(v);
                                    }
                                    if (isquerystring)
                                    {
                                        ep[DomainKey.QUERY_STRING, f] = double.Parse(v);
                                    }
                                }
                            }
                        }
                    }
                }

                return(true);
            }
        }