コード例 #1
0
        public JArray Create_ModelSO_Return()
        {
            JArray    orders    = new JArray();
            string    sqlHeader = string.Format("select * from [V_MM_SO_RETURN_HEADER_NORTH]");
            DataTable dt        = DAL.SELECT_SQL(sqlHeader);
            int       count     = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    try
                    {
                        SOInfor_Model       so          = new SOInfor_Model();
                        IList <Orderdetail> orderDetail = new List <Orderdetail>();

                        string po_MM    = dt.Rows[i]["Order_Number"].ToString().Trim();
                        string supplier = dt.Rows[i]["Supplier_Number"].ToString().TrimStart('0');
                        code    = po_MM;
                        so.type = "150";
                        string orderkey_infor = po_MM.TrimStart('0');
                        so.orderkey          = "RT_" + orderkey_infor;
                        so.storerkey         = "N0528";
                        so.consigneekey      = "STD"; //dt.Rows[0]["Store_Number"].ToString();
                        so.externalorderkey2 = po_MM;
                        so.externorderkey    = supplier;
                        so.notes2            = "";
                        so.pokey             = "";
                        //so.stage = dt.Rows[0]["Store_Number"].ToString();

                        so.planneddelvdate  = DateTime.Parse(dt.Rows[i]["Plan_Delivery_Date"].ToString());
                        so.promiseddelvdate = 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  = "wmwhse3";

                        so.apportion    = "0";
                        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_NORTH");
                        resultMapping.Handle_Error_Mapping(code, e.ToString(), step);
                        continue;
                    }
                }
            }
            return(orders);
        }
コード例 #2
0
        public JArray Create_ModelSO()
        {
            JArray    orders    = new JArray();
            string    sqlHeader = string.Format("select * from MM_ORDERS_HEADER where STATUS='' and Warehouse_Number='90072' ");
            DataTable dt        = DAL.SELECT_SQL(sqlHeader);
            int       count     = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    try
                    {
                        SOInfor_Model       so          = new SOInfor_Model();
                        IList <Orderdetail> orderDetail = new List <Orderdetail>();

                        string type        = dt.Rows[i]["Order_Type"].ToString().Trim();
                        string orderkey_mm = dt.Rows[i]["Order_Number"].ToString().Trim();
                        code = orderkey_mm;
                        string orderkey_infor = orderkey_mm.Trim().TrimStart('0');
                        string store          = dt.Rows[i]["Store_Number"].ToString().Trim().TrimStart('0');
                        so.type              = "14";
                        so.orderkey          = orderkey_infor;
                        so.storerkey         = "N0528";
                        so.consigneekey      = store;
                        so.externalorderkey2 = orderkey_mm;
                        so.externorderkey    = dt.Rows[i]["Warehouse_Number"].ToString().Trim();
                        so.notes2            = dt.Rows[i]["Memo_Field"].ToString().Trim();
                        so.pokey             = "";
                        so.stage             = store.Substring(3, 2);
                        so.apportion         = "1";
                        so.planneddelvdate   = DateTime.Parse(dt.Rows[i]["Plan_Delivery_Date"].ToString());
                        so.promiseddelvdate  = 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            = "wmwhse3";

                        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_NORTH");
                        resultMapping.Handle_Error_Mapping(code, e.ToString(), step);
                        continue;
                    }
                }
            }
            return(orders);
        }
コード例 #3
0
        public JArray Create_ModelSO_Xdock()
        {
            JArray    orders    = new JArray();
            string    sqlHeader = string.Format("select * from V_MM_SO_XDOCK_HEADER_NORTH");
            DataTable dt        = DAL.SELECT_SQL(sqlHeader);
            int       count     = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    try
                    {
                        SOInfor_Model       so          = new SOInfor_Model();
                        IList <Orderdetail> orderDetail = new List <Orderdetail>();

                        string orderkey_mm = dt.Rows[i]["SO"].ToString();
                        string pokey_MM    = dt.Rows[i]["PO"].ToString();
                        code = pokey_MM + "_" + orderkey_mm;
                        string store = dt.Rows[i]["Store"].ToString().Trim().TrimStart('0');
                        so.type              = "91";
                        so.orderkey          = orderkey_mm.TrimStart('0');
                        so.storerkey         = "N0528";
                        so.consigneekey      = store;
                        so.externalorderkey2 = orderkey_mm;
                        so.externorderkey    = dt.Rows[i]["Warehouse_Number"].ToString().Trim();
                        so.pokey             = pokey_MM.TrimStart('0');
                        so.stage             = store.Substring(3, 2);
                        so.apportion         = "0";
                        so.planneddelvdate   = DateTime.Parse(dt.Rows[i]["Plan_Delivery_Date"].ToString().Trim()); //DateTime.Now.ToString('yyyy-MM-dd');
                        so.promiseddelvdate  = DateTime.Parse(dt.Rows[i]["Plan_Delivery_Date"].ToString().Trim());
                        so.orderdate         = DateTime.Parse(dt.Rows[i]["Plan_Delivery_Date"].ToString().Trim());

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

                        orderDetail     = this.Create_OrderDetail_Xdock(orderkey_mm, pokey_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_NORTH");
                        resultMapping.Handle_Error_Mapping(code, e.ToString(), step);
                        continue;
                    }
                }
            }
            return(orders);
        }
コード例 #4
0
ファイル: SOController.cs プロジェクト: tducthang7192/MM-EDI
        public JArray Create_ModelSO_South()
        {
            JArray    orders    = new JArray();
            string    sqlHeader = string.Format("select * from MM_ORDERS_HEADER where STATUS='' and Warehouse_Number='090071'");
            DataTable dt        = DAL.SELECT_SQL(sqlHeader);
            int       count     = dt.Rows.Count;

            DataTable dtOrderkey = this.Get_Orderkey(count);

            if (count > 0 && dtOrderkey.Rows.Count == count)
            {
                for (int i = 0; i < count; i++)
                {
                    string              type        = dt.Rows[i]["Order_Type"].ToString().Trim();
                    SOInfor_Model       so          = new SOInfor_Model();
                    IList <Orderdetail> orderDetail = new List <Orderdetail>();
                    string              orderkey_MM = dt.Rows[i]["Order_Number"].ToString();
                    switch (type)
                    {
                    case "19":
                        so.type = "91";
                        string    po        = string.Format("select Order_Number from MM_PO_DEATIL_XD WHERE Sale_Order='{0}'", orderkey_MM);
                        DataTable xdocTable = DAL.SELECT_SQL(po);
                        if (xdocTable.Rows.Count > 0)
                        {
                            //so.purchase=poTable.Rows[0][0];
                        }
                        else
                        {
                            continue;
                        }
                        break;

                    case "20":
                        so.type = "0";
                        break;

                    case "21":
                        so.type = "100";
                        break;
                    }
                    string orderkey_Infor = dtOrderkey.Rows[i][0].ToString();
                    so.orderkey          = orderkey_Infor;
                    so.externorderkey    = orderkey_MM;
                    so.storerkey         = "ow9305";
                    so.consigneekey      = "STD";//dt.Rows[0]["Store_Number"].ToString();
                    so.externorderkey    = dt.Rows[i]["Order_Number"].ToString();
                    so.externalorderkey2 = "";
                    so.whseid            = "wmwhse3";
                    so.pokey             = "test";

                    // so.deliverydate = Convert.ToDateTime(dt.Rows[0]["Order_Number"]);
                    so.addwho       = "wmsadmin";
                    so.editwho      = "wmsadmin";
                    orderDetail     = this.Create_OrderDetail_South(so.externorderkey, orderkey_Infor);
                    so.orderdetails = orderDetail;
                    string  output   = JsonConvert.SerializeObject(so);
                    JObject objectSO = JObject.Parse(output);
                    orders.Add(objectSO);
                }
            }
            return(orders);
        }
コード例 #5
0
ファイル: SOController.cs プロジェクト: tducthang7192/MM-EDI
        public JArray Create_ModelSO()
        {
            JArray    orders    = new JArray();
            string    sqlHeader = string.Format("select * from MM_ORDERS_HEADER where STATUS='' ");
            DataTable dt        = DAL.SELECT_SQL(sqlHeader);
            int       count     = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    string              type        = dt.Rows[i]["Order_Type"].ToString().Trim();
                    SOInfor_Model       so          = new SOInfor_Model();
                    IList <Orderdetail> orderDetail = new List <Orderdetail>();
                    string              orderkey_MM = dt.Rows[i]["Order_Number"].ToString();
                    string              po          = "";

                    switch (type)
                    {
                    case "20":
                        so.type = "91";
                        po      = string.Format("select Order_Number from MM_PO_DEATIL_XD WHERE Sale_Order='{0}'", orderkey_MM);
                        DataTable xdocTable = DAL.SELECT_SQL(po);
                        if (xdocTable.Rows.Count > 0)
                        {
                            so.pokey = xdocTable.Rows[0][0].ToString();
                        }
                        else
                        {
                            continue;
                        }
                        break;

                    case " ":

                        so.type = "91";
                        po      = string.Format("select Order_Number from MM_PO_DEATIL_XD WHERE Sale_Order='{0}'", orderkey_MM);
                        DataTable xdocTable2 = DAL.SELECT_SQL(po);
                        if (xdocTable2.Rows.Count > 0)
                        {
                            so.pokey = xdocTable2.Rows[0][0].ToString();
                        }
                        else
                        {
                            continue;
                        }
                        break;

                    case "19":
                        so.type = "0";
                        break;
                    }
                    string orderkey_Infor = orderkey_MM;
                    so.orderkey          = orderkey_Infor;
                    so.storerkey         = "OW0094";
                    so.consigneekey      = "STD"; //dt.Rows[0]["Store_Number"].ToString();
                    so.externalorderkey2 = "";
                    so.externorderkey    = dt.Rows[i]["Warehouse_Number"].ToString().Trim();
                    so.notes2            = dt.Rows[i]["Memo_Field"].ToString().Trim();
                    so.pokey             = "";
                    so.stage             = ""; //dt.Rows[0]["Store_Number"].ToString();

                    so.planneddelvdate  = DateTime.Parse(dt.Rows[i]["Plan_Delivery_Date"].ToString());
                    so.promiseddelvdate = 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  = "wmwhse3";

                    so.apportion    = "1";
                    orderDetail     = this.Create_OrderDetail(orderkey_MM, orderkey_Infor);
                    so.orderdetails = orderDetail;
                    string  output   = JsonConvert.SerializeObject(so);
                    JObject objectSO = JObject.Parse(output);
                    orders.Add(objectSO);
                }
            }
            return(orders);
        }