Ejemplo n.º 1
0
        public HttpResponseMessage postAddTag(PrintTagSearchView model)
        {
            try
            {
                var result = tagSvc.AddTag(model);

                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message.ToString()));
            }
        }
Ejemplo n.º 2
0
        public PrintTagView searchPrintData(PrintTagSearchView model)
        {
            using (var ctx = new ConXContext())
            {
                var ventity         = model.entity;
                var vreq_date       = model.req_date;
                var vwc_code        = model.wc_code;
                var vmc_code        = model.mc_code;
                var vspring_grp     = model.spring_grp;
                var vsize_desc      = model.size_desc;
                var vqty            = model.qty;
                var vuser_id        = model.user_id;
                var vprinter        = model.printer;
                int vprocess_tag_no = 0;

                PrintTagView view = new ModelViews.PrintTagView()
                {
                    datas = new List <ModelViews.RawMatitemView>()
                };

                string sqlp          = "select  a.prnt_point_name  from whmobileprnt_ctl a , whmobileprnt_default b where a.series_no = b.series_no and b.mc_code= :p_mc_code";
                string vprinter_name = ctx.Database.SqlQuery <string>(sqlp, new OracleParameter("p_mc_code", vmc_code)).FirstOrDefault();


                string sqls       = "select pdsize_tname from pdsize_mast where pdsize_code=:p_size_code";
                string vsize_name = ctx.Database.SqlQuery <string>(sqls, new OracleParameter("p_size_code", vsize_desc)).FirstOrDefault();


                //string sql = "select max(process_tag_no) process_tag_no , max(to_char(req_date,'dd/mm/yyyy')) req_date , max(mc_code) , max(to_char(fin_date,'dd/mm/yyyy')) fin_date";
                string sql = "select process_tag_no , to_char(req_date,'dd/mm/yyyy') req_date , mc_code , to_char(fin_date,'dd/mm/yyyy') fin_date";
                sql += " from mps_det_in_process_tag";
                sql += " where entity = :p_entity";
                sql += " and req_date = to_date(:p_req_date,'dd/mm/yyyy')";
                sql += " and mc_code = :p_mc_code";
                sql += " and rownum = 1";
                sql += " order by process_tag_no desc";


                PrintTagView tag = ctx.Database.SqlQuery <PrintTagView>(sql, new OracleParameter("p_entity", ventity), new OracleParameter("p_req_date", vreq_date), new OracleParameter("p_mc_code", vmc_code)).SingleOrDefault();


                if (tag == null)
                {
                    vprocess_tag_no = 1;

                    view.entity         = ventity;
                    view.process_tag_no = vprocess_tag_no;
                    view.req_date       = vreq_date;
                    view.wc_code        = vwc_code;
                    view.mc_code        = vmc_code;
                    view.spring_grp     = vspring_grp;
                    view.size_desc      = vsize_name;
                    view.qty            = vqty;
                    view.fin_date       = DateTime.Now.ToShortDateString();
                    view.printer        = vprinter_name;
                }
                else
                {
                    //vprocess_tag_no = tag.process_tag_no;

                    string sqlt = "select max(process_tag_no)";
                    sqlt += " from mps_det_in_process_tag";
                    sqlt += " where entity = :p_entity";
                    sqlt += " and req_date = to_date(:p_req_date,'dd/mm/yyyy')";
                    sqlt += " and mc_code = :p_mc_code";
                    sqlt += " order by process_tag_no desc";


                    vprocess_tag_no = ctx.Database.SqlQuery <int>(sqlt, new OracleParameter("p_entity", ventity), new OracleParameter("p_req_date", vreq_date), new OracleParameter("p_mc_code", vmc_code)).SingleOrDefault();


                    view.entity         = ventity;
                    view.process_tag_no = vprocess_tag_no;
                    view.req_date       = tag.req_date;
                    view.wc_code        = tag.wc_code;
                    view.mc_code        = vmc_code;
                    view.spring_grp     = vspring_grp;
                    view.size_desc      = vsize_name;
                    view.qty            = vqty;
                    view.fin_date       = tag.fin_date;
                    view.printer        = vprinter_name;
                }



                string sqlr = "select process_tag_no , ref_doc_no doc_no , prod_code , prod_tname prod_name";
                sqlr += " from mps_det_in_process_tag";
                sqlr += " where entity = :p_entity";
                sqlr += " and req_date = to_date(:p_req_date,'dd/mm/yyyy')";
                sqlr += " and mc_code = :p_mc_code";
                //sqlr += " and process_tag_no = :p_process_tag_no";
                sqlr += " order by seq_no";

                List <RawMatitemView> scan = ctx.Database.SqlQuery <RawMatitemView>(sqlr, new OracleParameter("p_entity", ventity), new OracleParameter("p_req_date", vreq_date), new OracleParameter("p_mc_code", vmc_code)).ToList();

                foreach (var i in scan)
                {
                    view.datas.Add(new ModelViews.RawMatitemView()
                    {
                        process_tag_no = i.process_tag_no,
                        doc_no         = i.doc_no,
                        prod_code      = i.prod_code,
                        prod_name      = i.prod_name
                    });
                }


                //return data to contoller
                return(view);
            }
        }
Ejemplo n.º 3
0
        public PrintTagView AddTag(PrintTagSearchView model)
        {
            using (var ctx = new ConXContext())
            {
                var ventity     = model.entity;
                var vreq_date   = model.req_date;
                var vwc_code    = model.wc_code;
                var vmc_code    = model.mc_code;
                var vspring_grp = model.spring_grp;
                var vsize_desc  = model.size_desc;
                var vqty        = model.qty;
                var vuser_id    = model.user_id;
                var vprinter    = model.printer;
                //int vprocess_tag_no = 0;

                PrintTagView view = new ModelViews.PrintTagView()
                {
                    datas = new List <ModelViews.RawMatitemView>()
                };

                //string sqlp = "select a.prnt_point_name from whmobileprnt_ctl where grp_type='SPRING' and series_no=:p_printer";\
                string sqlp         = "select  a.prnt_point_name printer_name from whmobileprnt_ctl a , whmobileprnt_default b where a.series_no = b.series_no and b.mc_code= :p_mc_code";
                string printer_name = ctx.Database.SqlQuery <string>(sqlp, new OracleParameter("p_mc_code", vmc_code)).FirstOrDefault();


                string sqls       = "select pdsize_tname from pdsize_mast where pdsize_code=:p_size_code";
                string vsize_name = ctx.Database.SqlQuery <string>(sqls, new OracleParameter("p_size_code", vsize_desc)).FirstOrDefault();


                string sql = "select nvl(max(process_tag_no),0) process_tag_no , max(to_char(req_date,'dd/mm/yyyy')) req_date , max(mc_code) , max(to_char(fin_date,'dd/mm/yyyy')) fin_date";
                sql += " from mps_det_in_process_tag";
                sql += " where entity = :p_entity";
                sql += " and req_date = to_date(:p_req_date,'dd/mm/yyyy')";
                sql += " and mc_code = :p_mc_code";
                // sql += " and rownum = 1";
                sql += " order by process_tag_no";


                PrintTagView tag = ctx.Database.SqlQuery <PrintTagView>(sql, new OracleParameter("p_entity", ventity), new OracleParameter("p_req_date", vreq_date), new OracleParameter("p_mc_code", vmc_code)).SingleOrDefault();



                if (tag.process_tag_no == 0)
                {
                    view.entity         = ventity;
                    view.process_tag_no = 1;
                    view.req_date       = vreq_date;
                    view.wc_code        = vwc_code;
                    view.mc_code        = vmc_code;
                    view.spring_grp     = vspring_grp;
                    view.size_desc      = vsize_name;
                    view.qty            = vqty;
                    view.fin_date       = DateTime.Now.ToShortDateString();
                    view.printer        = printer_name;
                }
                else
                {
                    view.entity         = ventity;
                    view.process_tag_no = tag.process_tag_no + 1;
                    view.req_date       = tag.req_date;
                    view.wc_code        = tag.wc_code;
                    view.mc_code        = vmc_code;
                    view.spring_grp     = vspring_grp;
                    view.size_desc      = vsize_name;
                    view.qty            = vqty;
                    view.fin_date       = tag.fin_date;
                    view.printer        = printer_name;
                }



                //return data to contoller
                return(view);
            }
        }