コード例 #1
0
        public WorkOrderStartEndRES WorkOrderStartService(WorkOrder_Start_EndREQ WOSE)
        {
            WorkOrderStartEndRES SM = new WorkOrderStartEndRES();

            try
            {
                if (WOSE.UserId == "" || WOSE.UserId == null)
                {
                    SM.Status  = "Failure";
                    SM.Message = "Invalid UserId";
                    return(SM);
                }
                if (WOSE.WorkOrderNo == "" || WOSE.WorkOrderNo == null)
                {
                    SM.Status  = "Failure";
                    SM.Message = "Invalid WorkOrderNo";
                    return(SM);
                }

                bool AutoPicked = true;
                bool AutoRoute  = true;
                if (WOSE.AutoPick == "1")
                {
                    AutoPicked = true;
                }
                else
                {
                    AutoPicked = false;
                }
                if (WOSE.AutoRoute == "1")
                {
                    AutoRoute = true;
                }
                else
                {
                    AutoRoute = false;
                }
                query     = "Sp_AxWebserviceIntegration";
                dbcommand = new SqlCommand(query, conn);
                //  dbcommand.Connection.Open();
                dbcommand.CommandType    = CommandType.StoredProcedure;
                dbcommand.CommandTimeout = 0;
                SqlDataAdapter da = new SqlDataAdapter(dbcommand);
                DataSet        ds = new DataSet();
                da.Fill(ds);

                //  DataSet ds = CommonManger.FillDatasetWithParam("Sp_AxWebserviceIntegration");
                AXWebServiceRef1.Iace_FinishedGoodServiceClient obj = new AXWebServiceRef1.Iace_FinishedGoodServiceClient();
                obj.ClientCredentials.Windows.ClientCredential.Domain   = Convert.ToString(ds.Tables[0].Rows[0]["Domain"]);
                obj.ClientCredentials.Windows.ClientCredential.UserName = Convert.ToString(ds.Tables[0].Rows[0]["Username"]);
                obj.ClientCredentials.Windows.ClientCredential.Password = Convert.ToString(ds.Tables[0].Rows[0]["Password"]);

                AXWebServiceRef1.CallContext Cct = new AXWebServiceRef1.CallContext();
                Cct.Company  = Convert.ToString(ds.Tables[0].Rows[0]["Company"]);
                Cct.Language = Convert.ToString(ds.Tables[0].Rows[0]["Language"]);
                string value = obj.StartWorkOrder(Cct, WOSE.WorkOrderNo, AutoPicked, AutoRoute, Convert.ToDecimal(WOSE.StartQty));


                query     = "Sp_WorkOrderWebApi";
                dbcommand = new SqlCommand(query, conn);
                //dbcommand.Connection.Open();
                dbcommand.CommandType = CommandType.StoredProcedure;
                dbcommand.Parameters.AddWithValue("@QueryType", "WorkOrder_Start");
                dbcommand.Parameters.AddWithValue("@WorkOrderNo", WOSE.WorkOrderNo);
                dbcommand.Parameters.AddWithValue("@StartQty", WOSE.StartQty);
                dbcommand.Parameters.AddWithValue("@UserId", WOSE.UserId);
                dbcommand.CommandTimeout = 0;
                da = new SqlDataAdapter(dbcommand);
                DataTable dt = new DataTable();
                da.Fill(dt);
                if (dt.Rows[0]["value"].ToString() == "1")
                {
                    SM.Status  = "Success";
                    SM.Message = "WorkOrder Started";
                }
                else
                {
                    SM.Status  = "Failure";
                    SM.Message = "Invalid WorkOrder No";
                }
            }
            catch (Exception Ex)
            {
                SM.Status  = "Failure";
                SM.Message = Ex.Message;
            }
            //finally
            //{
            //    //dbcommand.Connection.Close();
            //}
            return(SM);
        }
コード例 #2
0
        public WorkOrderStartEndRES WorkOrderFinancialEnd(WorkOrder_Start_EndREQ WOSE)
        {
            WorkOrderStartEndRES SM = new WorkOrderStartEndRES();
            // string date = DateTime.Now.ToString("dd/MM/yyyy");
            Random rand        = new Random();
            string RandomNumer = rand.Next(11111, 99999).ToString();

            try
            {
                if (WOSE.UserId == "" || WOSE.UserId == null)
                {
                    SM.Status  = "Failure";
                    SM.Message = "Invalid UserId";
                    return(SM);
                }
                if (WOSE.WorkOrderNo == "" || WOSE.WorkOrderNo == null)
                {
                    SM.Status  = "Failure";
                    SM.Message = "Invalid WorkOrderNo";
                    return(SM);
                }

                query     = "Sp_AxWebserviceIntegration";
                dbcommand = new SqlCommand(query, conn);
                //  dbcommand.Connection.Open();
                dbcommand.CommandType    = CommandType.StoredProcedure;
                dbcommand.CommandTimeout = 0;
                SqlDataAdapter da = new SqlDataAdapter(dbcommand);
                DataSet        ds = new DataSet();
                da.Fill(ds);

                //  DataSet ds = CommonManger.FillDatasetWithParam("Sp_AxWebserviceIntegration");
                AXWebServiceRef1.Iace_FinishedGoodServiceClient obj = new AXWebServiceRef1.Iace_FinishedGoodServiceClient();
                obj.ClientCredentials.Windows.ClientCredential.Domain   = Convert.ToString(ds.Tables[0].Rows[0]["Domain"]);
                obj.ClientCredentials.Windows.ClientCredential.UserName = Convert.ToString(ds.Tables[0].Rows[0]["Username"]);
                obj.ClientCredentials.Windows.ClientCredential.Password = Convert.ToString(ds.Tables[0].Rows[0]["Password"]);

                AXWebServiceRef1.CallContext Cct = new AXWebServiceRef1.CallContext();
                Cct.Company  = Convert.ToString(ds.Tables[0].Rows[0]["Company"]);
                Cct.Language = Convert.ToString(ds.Tables[0].Rows[0]["Language"]);

                //string value = obj.EndWorkOrder(Cct, WOSE.WorkOrderNo);

                string value = obj.ReportAsFinished(Cct, WOSE.WorkOrderNo, false, false, "A", WOSE.WorkOrderNo, "HHD", true, true, true);



                query     = "Sp_WorkOrderWebApi";
                dbcommand = new SqlCommand(query, conn);
                dbcommand.Connection.Open();
                dbcommand.CommandType = CommandType.StoredProcedure;
                dbcommand.Parameters.AddWithValue("@QueryType", "WorkOrderFinancialEnd");
                dbcommand.Parameters.AddWithValue("@WorkOrderNo", WOSE.WorkOrderNo);
                dbcommand.Parameters.AddWithValue("@UserId", WOSE.UserId);
                dbcommand.CommandTimeout = 0;
                da = new SqlDataAdapter(dbcommand);
                DataTable dt = new DataTable();
                da.Fill(dt);
                if (dt.Rows[0]["value"].ToString() == "1")
                {
                    SM.Status  = "Success";
                    SM.Message = "Workorder end job successfully";
                }
                else
                {
                    SM.Status  = "Failure";
                    SM.Message = "Invalid WorkOrder No";
                }
            }
            catch (Exception Ex)
            {
                SM.Status  = "Failure";
                SM.Message = Ex.Message;
            }
            //finally
            //{
            //    //dbcommand.Connection.Close();
            //}
            return(SM);
        }