Esempio n. 1
0
        public JArray Create_ModelSO()
        {
            JArray    orders     = new JArray();
            string    sqlHeader  = string.Format("select * from MM_ORDERS_HEADER where STATUS='' and Warehouse_Number='90071' ");
            DataTable dt         = DAL.SELECT_SQL(sqlHeader);
            int       count      = dt.Rows.Count;
            DataTable dtOrderkey = this.Get_Orderkey_South(count, "90071", "CS");

            if (count > 0 && dtOrderkey.Rows.Count == count)
            {
                for (int i = 0; i < count; i++)
                {
                    try
                    {
                        SOInfor_Model_South       so          = new SOInfor_Model_South();
                        IList <Orderdetail_South> orderDetail = new List <Orderdetail_South>();

                        string type           = dt.Rows[i]["Order_Type"].ToString().Trim();
                        string orderkey_infor = dtOrderkey.Rows[i][0].ToString();
                        string orderkey_mm    = dt.Rows[i]["Order_Number"].ToString().Trim();
                        string storer         = dt.Rows[i]["Store_Number"].ToString().Trim().TrimStart('0');
                        string externorderkey = "S" + storer.Substring(3, 2);

                        code = orderkey_mm;


                        so.type              = "9602";
                        so.orderkey          = orderkey_infor;
                        so.storerkey         = "OW9600";
                        so.consigneekey      = storer;
                        so.externalorderkey2 = orderkey_mm;
                        so.externorderkey    = externorderkey;
                        so.notes2            = dt.Rows[i]["Memo_Field"].ToString().Trim();
                        so.pokey             = "";
                        so.requestedshipdate = DateTime.Parse(dt.Rows[i]["Plan_Delivery_Date"].ToString());
                        so.deliverydate      = DateTime.Parse(dt.Rows[i]["Plan_Delivery_To_Warehouse"].ToString());
                        so.orderdate         = DateTime.Parse(dt.Rows[i]["Order_Date"].ToString());
                        so.addwho            = "wmsadmin";
                        so.editwho           = "wmsadmin";
                        so.whseid            = "wmwhse10";

                        orderDetail     = this.Create_OrderDetail(orderkey_mm, orderkey_infor);
                        so.orderdetails = orderDetail;
                        string  output   = JsonConvert.SerializeObject(so);
                        JObject objectSO = JObject.Parse(output);
                        orders.Add(objectSO);
                    }
                    catch (Exception e)
                    {
                        string step = string.Format(Constant.MODEL_SO, "CS_SOUTH");
                        resultMapping.Handle_Error_Mapping(code, e.ToString(), step);
                        continue;
                    }
                }
            }
            return(orders);
        }
Esempio n. 2
0
        public JArray Create_ModelSO_Return()
        {
            JArray    orders     = new JArray();
            string    sqlHeader  = string.Format("select * from [V_MM_SO_RETURN_HEADER_SOUTH] ");
            DataTable dt         = DAL.SELECT_SQL(sqlHeader);
            int       count      = dt.Rows.Count;
            DataTable dtOrderkey = this.Get_Orderkey_South(count, "90071", "RT");

            if (count > 0 && dtOrderkey.Rows.Count == count)
            {
                for (int i = 0; i < count; i++)
                {
                    try
                    {
                        SOInfor_Model_South       so          = new SOInfor_Model_South();
                        IList <Orderdetail_South> orderDetail = new List <Orderdetail_South>();
                        string orderkey_infor = dtOrderkey.Rows[i][0].ToString();
                        string po_MM          = dt.Rows[i]["Order_Number"].ToString().Trim();
                        string supplier       = dt.Rows[i]["Supplier_Number"].ToString().TrimStart('0');
                        string externorderkey = supplier;
                        code = po_MM;

                        so.type              = "9603";
                        so.orderkey          = orderkey_infor;
                        so.storerkey         = "OW9600";
                        so.consigneekey      = "STD";
                        so.externalorderkey2 = po_MM;
                        so.externorderkey    = externorderkey;
                        so.susr2             = "";
                        so.notes2            = "";
                        so.pokey             = "";

                        so.requestedshipdate = DateTime.Parse(dt.Rows[i]["Plan_Delivery_Date"].ToString());
                        so.deliverydate      = DateTime.Parse(dt.Rows[i]["Plan_Delivery_Date"].ToString());
                        so.orderdate         = DateTime.Parse(dt.Rows[i]["Order_Date"].ToString());

                        so.addwho  = "wmsadmin";
                        so.editwho = "wmsadmin";
                        so.whseid  = "wmwhse10";

                        orderDetail     = this.Create_OrderDetail_Return(po_MM, orderkey_infor);
                        so.orderdetails = orderDetail;
                        string  output   = JsonConvert.SerializeObject(so);
                        JObject objectSO = JObject.Parse(output);
                        orders.Add(objectSO);
                    }
                    catch (Exception e)
                    {
                        string step = string.Format(Constant.MODEL_SO, "RETURN_SOUTH");
                        resultMapping.Handle_Error_Mapping(code, e.ToString(), step);
                        continue;
                    }
                }
            }
            return(orders);
        }
Esempio n. 3
0
        public JArray Create_ModelSO_Xdock()
        {
            JArray    orders     = new JArray();
            string    sqlHeader  = string.Format("select * from V_MM_SO_XDOCK_HEADER_SOUTH ");
            DataTable dt         = DAL.SELECT_SQL(sqlHeader);
            int       count      = dt.Rows.Count;
            DataTable dtOrderkey = this.Get_Orderkey_South(count, "90071", "XD");

            if (count > 0 && dtOrderkey.Rows.Count == count)
            {
                for (int i = 0; i < count; i++)
                {
                    try
                    {
                        SOInfor_Model_South       so          = new SOInfor_Model_South();
                        IList <Orderdetail_South> orderDetail = new List <Orderdetail_South>();
                        string orderkey_infor = dtOrderkey.Rows[i][0].ToString();
                        string orderkey_mm    = dt.Rows[i]["SO"].ToString();

                        code = orderkey_mm;
                        string storer         = dt.Rows[i]["Store"].ToString();
                        string externorderkey = "S" + storer.Substring(3, 2);
                        so.type              = "0";
                        so.orderkey          = orderkey_infor;
                        so.storerkey         = "OW9600";
                        so.consigneekey      = dt.Rows[i]["Store"].ToString();
                        so.externalorderkey2 = orderkey_mm;
                        so.externorderkey    = externorderkey;
                        so.susr1             = orderkey_mm;

                        so.requestedshipdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); //DateTime.Parse(dt.Rows[i]["Plan_Delivery_Date"].ToString().Trim());
                        so.deliverydate      = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                        so.orderdate         = DateTime.Parse(dt.Rows[i]["Order_Date"].ToString().Trim());

                        so.addwho  = "wmsadmin";
                        so.editwho = "wmsadmin";
                        so.whseid  = "wmwhse10";

                        orderDetail     = this.Create_OrderDetail_Xdock(orderkey_infor, orderkey_mm);
                        so.orderdetails = orderDetail;
                        string  output   = JsonConvert.SerializeObject(so);
                        JObject objectSO = JObject.Parse(output);
                        orders.Add(objectSO);
                    }
                    catch (Exception e)
                    {
                        string step = string.Format(Constant.MODEL_SO, "XDOCK_SOUTH");
                        resultMapping.Handle_Error_Mapping(code, e.ToString(), step);
                        continue;
                    }
                }
            }
            return(orders);
        }