public void ProcessRequest(HttpContext context)
        {
            var orderId = int.Parse(context.Request["orderId"]);
            var time    = Convert.ToDateTime(context.Request["time"]);

            using (JDJS_WMS_DB_USEREntities wms = new JDJS_WMS_DB_USEREntities())
            {
                using (System.Data.Entity.DbContextTransaction mytran = wms.Database.BeginTransaction())
                {
                    try
                    {
                        {
                            int OrderID   = orderId;
                            var delayInfo = wms.JDJS_WMS_Order_Blank_Table.Where(r => r.OrderID == OrderID);

                            {
                                foreach (var item in delayInfo)
                                {
                                    item.Expected_Completion_Time = time;
                                }
                                wms.SaveChanges();
                            }
                        }
                        wms.SaveChanges();
                        mytran.Commit();
                        context.Response.Write("ok");
                    }
                    catch (Exception ex)
                    {
                        mytran.Rollback();
                        context.Response.Write(ex.Message);
                    }
                }
            }
        }
Esempio n. 2
0
        public void ProcessRequest(HttpContext context)
        {
            {
                int OrderID = int.Parse(context.Request["orderId"]);
                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                List <string> str = new List <string>();

                using (JDJS_WMS_DB_USEREntities wms = new JDJS_WMS_DB_USEREntities())
                {
                    using (System.Data.Entity.DbContextTransaction date = wms.Database.BeginTransaction())
                    {
                        try
                        {
                            List <int> processid = new List <int>();
                            var        process   = wms.JDJS_WMS_Order_Process_Info_Table.Where(r => r.OrderID == OrderID && r.sign != 0);
                            foreach (var item in process)
                            {
                                if (!processid.Contains(Convert.ToInt32(item.ProcessID)))
                                {
                                    processid.Add(Convert.ToInt32(item.ProcessID));
                                }
                            }
                            processid.Sort();
                            List <int> ProcessId = new List <int>();
                            foreach (var item in processid)
                            {
                                var processed = wms.JDJS_WMS_Order_Process_Info_Table.Where(r => r.OrderID == OrderID && r.sign != 0 && r.ProcessID == item);
                                ProcessId.Add(Convert.ToInt32(processed.FirstOrDefault().ID));
                            }
                            foreach (var item in ProcessId)
                            {
                                List <int> CncID = new List <int>();

                                var mach = wms.JDJS_WMS_Order_Process_Scheduling_Table.Where(r => r.ProcessID == item && r.isFlag != 0);
                                foreach (var real in mach)
                                {
                                    if (!CncID.Contains(Convert.ToInt32(real.CncID)))
                                    {
                                        CncID.Add(Convert.ToInt32(real.CncID));
                                    }
                                }
                                var fix = wms.JDJS_WMS_Order_Fixture_Manager_Table.Where(r => r.ProcessID == item);
                                fix.FirstOrDefault().FixtureNumber = CncID.Count();
                                wms.SaveChanges();
                                str.Add(CncID.Count().ToString());
                            }
                            wms.SaveChanges();
                            date.Commit();
                        }
                        catch (Exception ex)
                        {
                            date.Rollback();
                            context.Response.Write(ex.Message);
                        }
                    }
                }
                var json = serializer.Serialize(str);
                context.Response.Write("ok");
            }
        }
Esempio n. 3
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                var processId  = int.Parse(context.Request["processId"]);
                var process    = int.Parse(context.Request["process"]);
                var time       = context.Request["time"];
                var deviceType = context.Request["deviceType"];
                var cncNumber  = context.Request["cncNumber"];
                using (JDJS_WMS_DB_USEREntities entities = new JDJS_WMS_DB_USEREntities())
                {
                    var row = entities.JDJS_WMS_Order_Process_Info_Table.Where(r => r.ProcessID == process & r.sign == 0);
                    if (row.Count() > 0)
                    {
                        //if (row.First().ID != processId)
                        //{
                        //    context.Response.Write("该工序已存在");
                        //    return;
                        //}
                    }
                    var rowEdit = entities.JDJS_WMS_Order_Process_Info_Table.Where(r => r.ID == processId);

                    rowEdit.First().ProcessID   = process;
                    rowEdit.First().ProcessTime = double.Parse(time);
                    rowEdit.First().DeviceType  = int.Parse(deviceType);
                    rowEdit.First().MachNumber  = int.Parse(cncNumber);
                    entities.SaveChanges();
                    context.Response.Write("ok");
                }
            }
            catch (Exception ex)
            {
                context.Response.Write(ex.Message);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            var data = context.Request["data"];

            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            var obj = serializer.Deserialize <SizeEditSub>(data);

            using (JDJS_WMS_DB_USEREntities entities = new JDJS_WMS_DB_USEREntities())
            {
                var id = int.Parse(obj.ID);

                var row = entities.JDJS_WMS_Quality_ManualInput_Measurement_Table.Where(r => r.ID == id);
                if (row.Count() > 0)
                {
                    row.First().Measurements      = Convert.ToDouble(obj.Measurements);
                    row.First().SizeName          = obj.SizeName;
                    row.First().SizeNumber        = int.Parse(obj.SizeNumber);
                    row.First().StandardValue     = Convert.ToDouble(obj.StandardValue);
                    row.First().ToleranceRangeMax = Convert.ToDouble(obj.ToleranceRangeMax);
                    row.First().ToleranceRangeMin = Convert.ToDouble(obj.ToleranceRangeMin);
                }
                entities.SaveChanges();
                context.Response.Write("ok");
            }
        }
Esempio n. 5
0
 public void ProcessRequest(HttpContext context)
 {
     try {
         var orderId = int.Parse(context.Request.QueryString["orderId"]);
         using (JDJS_WMS_DB_USEREntities entities = new JDJS_WMS_DB_USEREntities())
         {
             var rows = entities.JDJS_WMS_Order_Process_Info_Table.Where(r => r.OrderID == orderId & r.sign == -1);
             if (rows.Count() < 1)
             {
                 context.Response.Write("暂无需提交审核工序");
                 return;
             }
             foreach (var item in entities.JDJS_WMS_Order_Process_Info_Table.Where(r => r.OrderID == orderId && r.sign != 0))
             {
                 item.sign = -2;
             }
             entities.SaveChanges();
             context.Response.Write("ok");
         }
     }
     catch (Exception ex)
     {
         context.Response.Write(ex.Message);
     }
 }
        public void ProcessRequest(HttpContext context)
        {
            int PlanId = int.Parse(context.Request["MaintenacneID"]);
            int enable = int.Parse(context.Request["MaintenanceEnable"]);

            using (JDJS_WMS_DB_USEREntities wms = new JDJS_WMS_DB_USEREntities())
            {
                using (System.Data.Entity.DbContextTransaction mytran = wms.Database.BeginTransaction())
                {
                    try
                    {
                        var plan = wms.JDJS_WMS_Device_Accuracy_Verification_Plan.Where(r => r.ID == PlanId);
                        foreach (var item in plan)
                        {
                            item.isFlag = enable;
                        }
                        wms.SaveChanges();
                        mytran.Commit();
                    }
                    catch
                    {
                        mytran.Rollback();
                    }
                }
            }
            context.Response.Write("ok");
        }
Esempio n. 7
0
 /// <summary>
 /// 治具异常报备
 /// </summary>
 /// <param name="id">工序id</param>
 /// <returns></returns>
 public bool AbnormalSubmit(int id, ref string errMsg)
 {
     try
     {
         using (JDJS_WMS_DB_USEREntities wms = new JDJS_WMS_DB_USEREntities())
         {
             var processes = wms.JDJS_WMS_Order_Fixture_Manager_Table.Where(r => r.ProcessID == id);
             using (System.Data.Entity.DbContextTransaction mytran = wms.Database.BeginTransaction())
             {
                 try
                 {
                     foreach (var item in processes)
                     {
                         item.FixtureFinishPerpareNumber = 0;
                     }
                     wms.SaveChanges();
                     errMsg = "ok";
                     mytran.Commit();
                     return(true);
                 }
                 catch (Exception ex)
                 {
                     mytran.Rollback();
                     errMsg = ex.Message;
                     return(false);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         return(false);
     }
 }
 public void ProcessRequest(HttpContext context)
 {
     using (JDJS_WMS_DB_USEREntities entities = new JDJS_WMS_DB_USEREntities())
     {
         using (System.Data.Entity.DbContextTransaction db = entities.Database.BeginTransaction())
         {
             try
             {
                 var form = context.Request.Form;
                 for (int i = 0; i < form.Count; i++)
                 {
                     var id  = int.Parse(form[i]);
                     var row = entities.JDJS_WMS_Quality_ManualInput_Measurement_Table.Where(r => r.ID == id);
                     if (row.Count() > 0)
                     {
                         entities.JDJS_WMS_Quality_ManualInput_Measurement_Table.Remove(row.FirstOrDefault());
                     }
                 }
                 entities.SaveChanges();
                 db.Commit();
                 context.Response.Write("ok");
             }
             catch (Exception ex)
             {
                 db.Rollback();
                 context.Response.Write(ex.Message);
             }
         }
     }
 }
Esempio n. 9
0
        public void ProcessRequest(HttpContext context)
        {
            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

            var form            = context.Request["form"];
            var orderId         = int.Parse(context.Request["orderId"]);
            var workpieceNumber = int.Parse(context.Request["workpieceNumber"]);

            var obj = serializer.Deserialize <AddSize>(form);

            using (JDJS_WMS_DB_USEREntities entities = new JDJS_WMS_DB_USEREntities())
            {
                var row = new JDJS_WMS_Quality_ManualInput_Measurement_Table
                {
                    OrderID           = orderId,
                    WorkpieceNumber   = workpieceNumber,
                    SizeNumber        = int.Parse(obj.SizeNumber),
                    SizeName          = obj.SizeName,
                    StandardValue     = double.Parse(obj.StandardValue),
                    ToleranceRangeMin = double.Parse(obj.ToleranceRangeMin),
                    ToleranceRangeMax = double.Parse(obj.ToleranceRangeMax),
                    Measurements      = double.Parse(obj.Measurements),
                };
                entities.JDJS_WMS_Quality_ManualInput_Measurement_Table.Add(row);
                entities.SaveChanges();
                context.Response.Write("ok");
            }
        }
Esempio n. 10
0
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         var orderId = int.Parse(context.Request.Form["orderId"]);
         var time    = Convert.ToDateTime(context.Request.Form["time"]);
         var loginID = Convert.ToInt32(context.Session["id"]);
         using (JDJS_WMS_DB_USEREntities wms = new JDJS_WMS_DB_USEREntities())
         {
             var order = wms.JDJS_WMS_Order_Machine_Scheduing_Time_Table.Where(r => r.OrderID == orderId).FirstOrDefault();
             if (order == null)
             {
                 JDJS_WMS_Order_Machine_Scheduing_Time_Table jd = new JDJS_WMS_Order_Machine_Scheduing_Time_Table()
                 {
                     OrderID      = orderId,
                     PlanPersonID = loginID,
                     PlanEndTime  = time
                 };
                 wms.JDJS_WMS_Order_Machine_Scheduing_Time_Table.Add(jd);
             }
             else
             {
                 order.PlanEndTime  = time;
                 order.PlanPersonID = loginID;
             }
             wms.SaveChanges();
         }
         context.Response.Write("ok");
     }
     catch (Exception ex)
     {
         context.Response.Write(ex.Message);
     }
 }
Esempio n. 11
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            var brand = context.Request["brand"];

            using (JDJS_WMS_DB_USEREntities data = new JDJS_WMS_DB_USEREntities())
            {
                var data2 =
                    from brands in data.JDJS_WMS_Device_Brand_Info
                    where brands.Brand == brand
                    select new
                {
                    brands.Brand
                };
                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                var data3 = serializer.Serialize(data2);
                if (data3 == "[]")
                {
                    var data4 = new JDJS_WMS_Device_Brand_Info()
                    {
                        Brand = brand
                    };
                    data.JDJS_WMS_Device_Brand_Info.Add(data4);
                    data.SaveChanges();

                    context.Response.Write("ok");
                }
                else
                {
                    context.Response.Write("false");
                }
            }
        }
Esempio n. 12
0
        public void ProcessRequest(HttpContext context)
        {
            var    Id  = int.Parse(context.Request.Form["Id"]);
            string str = "";

            try

            {
                using (JDJS_WMS_DB_USEREntities entities = new JDJS_WMS_DB_USEREntities())
                {
                    var rows = entities.JDJS_WMS_Tool_Machine_Replaace_History_Table.Where(r => r.ID == Id);
                    if (rows.Count() > 0)
                    {
                        var userId                    = int.Parse(context.Session["id"].ToString());
                        rows.First().Flag             = 1;
                        rows.First().AcceptPersonID   = userId;
                        rows.First().AcceptPersonTime = DateTime.Now;
                        entities.SaveChanges();
                        str = "ok";
                    }
                    else
                    {
                        str = "该记录不存在";
                    }
                }
            }
            catch (Exception ex)
            {
                str = ex.Message;
            }
            finally
            {
                context.Response.Write(str);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            var processId = int.Parse(context.Request["processId"]);
            var time      = Convert.ToDateTime(context.Request["time"]);

            using (JDJS_WMS_DB_USEREntities wms = new JDJS_WMS_DB_USEREntities())
            {
                using (System.Data.Entity.DbContextTransaction mytran = wms.Database.BeginTransaction())
                {
                    try
                    {
                        var processInfo = wms.JDJS_WMS_Order_Process_Info_Table.Where(r => r.ID == processId).FirstOrDefault();
                        processInfo.Jig_Expected_Completion_Time = time;
                        wms.SaveChanges();
                        mytran.Commit();
                        context.Response.Write("ok");
                    }
                    catch (Exception ex)
                    {
                        mytran.Rollback();
                        context.Response.Write(ex.Message);
                    }
                }
            }
        }
Esempio n. 14
0
        public void ProcessRequest(HttpContext context)
        {
            var orderId      = int.Parse(context.Request["orderId"]);
            var outputNumber = int.Parse(context.Request["outputNumber"]);

            using (JDJS_WMS_DB_USEREntities entities = new JDJS_WMS_DB_USEREntities())
            {
                var row = entities.JDJS_WMS_Finished_Product_Manager.Where(r => r.OrderID == orderId);

                if (row.Count() > 0)
                {
                    if (row.First().stock >= outputNumber)
                    {
                        var order                          = entities.JDJS_WMS_Order_Entry_Table.Where(r => r.Order_ID == orderId);
                        int produstOUT                     = order.First().Product_Output;
                        int outnum                         = Convert.ToInt32(row.FirstOrDefault().outputNumber);
                        row.FirstOrDefault().stock        -= outputNumber;
                        row.FirstOrDefault().outputNumber += outputNumber;
                        row.FirstOrDefault().outputTime    = DateTime.Now;

                        JDJS_WMS_Finished_Product_OutPut_History_Manager jdjsout = new JDJS_WMS_Finished_Product_OutPut_History_Manager()
                        {
                            OrderID   = orderId,
                            OutPutNum = outputNumber,
                            Time      = DateTime.Now
                        };
                        entities.JDJS_WMS_Finished_Product_OutPut_History_Manager.Add(jdjsout);
                        entities.SaveChanges();
                        if (outnum + outputNumber >= produstOUT)
                        {
                            foreach (var item in order)
                            {
                                item.Intention = 4;
                            }
                        }
                        entities.SaveChanges();
                    }
                    else
                    {
                        context.Response.Write("库存不足");
                        return;
                    }
                }
                entities.SaveChanges();
                context.Response.Write("ok");
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            var processId = int.Parse(context.Request["processId"]);
            var time      = Convert.ToDateTime(context.Request["time"]);

            using (JDJS_WMS_DB_USEREntities wms = new JDJS_WMS_DB_USEREntities())
            {
                using (System.Data.Entity.DbContextTransaction mytran = wms.Database.BeginTransaction())
                {
                    try
                    {
                        var processInfo = wms.JDJS_WMS_Order_Process_Info_Table.Where(r => r.ID == processId).FirstOrDefault();
                        if (processInfo != null)
                        {
                            int OrderID   = Convert.ToInt32(processInfo.OrderID);
                            var delayInfo = wms.JDJS_WMS_Order_DelayTime_Table.Where(r => r.OrderID == OrderID);
                            if (delayInfo.Count() < 1)
                            {
                                JDJS_WMS_Order_DelayTime_Table delay = new JDJS_WMS_Order_DelayTime_Table()
                                {
                                    OrderID  = OrderID,
                                    ToolTime = time,
                                };
                                wms.JDJS_WMS_Order_DelayTime_Table.Add(delay);
                                wms.SaveChanges();
                            }
                            else
                            {
                                foreach (var item in delayInfo)
                                {
                                    item.ToolTime = time;
                                }
                                wms.SaveChanges();
                            }
                        }
                        wms.SaveChanges();
                        mytran.Commit();
                        context.Response.Write("ok");
                    }
                    catch (Exception ex)
                    {
                        mytran.Rollback();
                        context.Response.Write(ex.Message);
                    }
                }
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                context.Response.ContentType = "text/plain";
                var form      = context.Request.Form;
                var type      = form["type"];
                var numberId  = int.Parse(form["id"]);
                var progId    = int.Parse(form["prog"]);
                var progIdOld = int.Parse(form["progOld"]);
                var techIdOld = int.Parse(form["techOld"]);

                using (JDJS_WMS_DB_USEREntities entities = new JDJS_WMS_DB_USEREntities())
                {
                    if (type == "生产订单")
                    {
                        entities.JDJS_WMS_Order_Guide_Schedu_Table.Where(r => r.OrderID == numberId).FirstOrDefault().FileDownTime = DateTime.Now;
                        entities.JDJS_WMS_Order_Entry_Table.Where(r => r.Order_ID == numberId).First().Engine_Program_Manager      =
                            entities.JDJS_WMS_Staff_Info.Where(r => r.id == progId).First().staff;

                        entities.JDJS_WMS_Order_Entry_Table.Where(r => r.Order_ID == numberId).First().craftPerson =
                            entities.JDJS_WMS_Staff_Info.Where(r => r.id == progId).First().staff;

                        entities.JDJS_WMS_Order_Entry_Table.Where(r => r.Order_ID == numberId).First().Engine_Program_ManagerId = progId;

                        entities.JDJS_WMS_Order_Entry_Table.Where(r => r.Order_ID == numberId).First().virtualProgPersId = progId;
                        entities.JDJS_WMS_Order_Entry_Table.Where(r => r.Order_ID == numberId).First().craftPersonId     = progId;

                        entities.SaveChanges();
                        context.Response.Write("ok");
                    }
                    else
                    {
                        entities.JDJS_WMS_Order_Entry_Table.Where(r => r.Order_ID == numberId).First().virtualProgPersId = progId;
                        entities.SaveChanges();
                        context.Response.Write("ok");
                    }
                }
            }
            catch (Exception ex)
            {
                context.Response.Write(ex.Message);
            }
        }
Esempio n. 17
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                int id = int.Parse(context.Request["id"]);//id
                using (FixtureModel model = new FixtureModel())
                {
                    var fx = model.JDJS_WMS_Fixture_System_Table.Where(r => r.Id == id).FirstOrDefault();
                    if (fx == null)
                    {
                        context.Response.Write("该治具不存在!");
                        return;
                    }


                    using (System.Data.Entity.DbContextTransaction mytran = model.Database.BeginTransaction())
                    {
                        try
                        {
                            model.JDJS_WMS_Fixture_System_Table.Remove(fx);
                            model.SaveChanges();
                            mytran.Commit();
                            PathInfo info = new PathInfo();
                            if (System.IO.File.Exists(System.IO.Path.Combine(info.GetFixtrue_SurfMillFilePath(), fx.FileName)))
                            {
                                System.IO.File.Delete(System.IO.Path.Combine(info.GetFixtrue_SurfMillFilePath(), fx.FileName));
                            }
                            using (JDJS_WMS_DB_USEREntities wms = new JDJS_WMS_DB_USEREntities())
                            {
                                var status = wms.JDJS_WMS_Device_Status_Table.Where(r => r.SystemId == id).FirstOrDefault();
                                if (status != null)
                                {
                                    wms.JDJS_WMS_Device_Status_Table.Remove(status);
                                }
                                wms.SaveChanges();
                            }
                            string str = "";
                            Fixture_SurfMill.DeleteChildJIG(fx.Name, fx.Desc, fx.StockAllNum.ToString(), fx.StockCurrNum.ToString(), ref str);
                            context.Response.Write(str);
                            return;
                        }
                        catch (Exception ex)
                        {
                            mytran.Rollback();
                            context.Response.Write(ex.Message);
                            return;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                context.Response.Write(ex.Message);
                return;
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            var  fileType = context.Request["fileType"];//"更新";"覆盖"
            bool isUpdate = true;

            if (fileType == "覆盖")
            {
                isUpdate = false;
            }
            int    personId   = int.Parse(context.Session["id"].ToString());
            string personName = context.Session["UserName"].ToString();
            var    number     = context.Request.Form[0];
            var    processId  = int.Parse(context.Request.Form[1]);
            var    file       = context.Request.Files;

            using (JDJS_WMS_DB_USEREntities entities = new JDJS_WMS_DB_USEREntities())
            {
                var row = entities.JDJS_WMS_Order_Process_Info_Table.Where(r => r.ID == processId).FirstOrDefault();

                var programName = row.programName;

                PathInfo pathInfo = new PathInfo();
                var      root     = pathInfo.upLoadPath();

                var fileName = Path.GetFileNameWithoutExtension(programName) + Path.GetExtension(file[0].FileName);
                var path     = Path.Combine(root, number, "加工文件", fileName);
                var Folder   = Path.Combine(root, number, "加工文件");

                if (System.IO.File.Exists(path))
                {
                    if (!isUpdate)
                    {
                        System.IO.File.Delete(path);
                    }
                    else
                    {
                        int    i       = 1;
                        string oldPath = Path.Combine(root, number, "加工文件", Path.GetFileNameWithoutExtension(programName) + "-" + i.ToString() + Path.GetExtension(file[0].FileName));
                        while (System.IO.File.Exists(oldPath))
                        {
                            i++;
                            oldPath = Path.Combine(root, number, "加工文件", Path.GetFileNameWithoutExtension(programName) + "-" + i.ToString() + Path.GetExtension(file[0].FileName));
                        }
                        System.IO.File.Move(path, oldPath);
                    }
                }
                string str = "";
                FileManage.UpdateFileToDB(Convert.ToInt32(row.OrderID), row.ID, personId, personName, FileType.加工文件, isUpdate, ref str);
                file[0].SaveAs(path);
                row.programName = fileName;
                entities.SaveChanges();

                context.Response.Write(str);
            }
        }
Esempio n. 19
0
 /// <summary>
 /// 更新文件
 /// </summary>
 /// <param name="orderId">订单Id</param>
 /// <param name="processId">工序Id</param>
 /// <param name="personId">员工id</param>
 /// <param name="personName">员工姓名</param>
 /// <param name="fileType">文件类型</param>
 /// <param name="isUpdate">是否更新</param>
 /// <param name="errMsg">错误信息</param>
 /// <returns></returns>
 public static bool UpdateFileToDB(int orderId, int processId, int personId, string personName, FileType fileType, bool isUpdate, ref string errMsg)
 {
     try
     {
         string fileTypeStr = fileType.ToString();
         using (JDJS_WMS_DB_USEREntities model = new JDJS_WMS_DB_USEREntities())
         {
             int max = 0;
             if (model.JDJS_WMS_Order_Files_Manage_Table.Where(r => r.OrderId == orderId && r.ProcessId == processId && r.FileType == fileTypeStr).Count() > 0)
             {
                 max = int.Parse(model.JDJS_WMS_Order_Files_Manage_Table.Where(r => r.OrderId == orderId && r.ProcessId == processId && r.FileType == fileTypeStr).Max <JDJS_WMS_Order_Files_Manage_Table>(r => r.VersonNum).ToString());
             }
             int    verson = max;
             string str    = "覆盖";
             if (isUpdate)
             {
                 verson++;
                 str = "更新";
             }
             JDJS_WMS_Order_Files_Manage_Table jdf = new JDJS_WMS_Order_Files_Manage_Table()
             {
                 OrderId       = orderId,
                 CreateTime    = DateTime.Now,
                 FileType      = fileTypeStr,
                 PersonId      = personId,
                 PersonName    = personName,
                 ProcessId     = processId,
                 VersonNum     = verson,
                 UpdateOrCover = str
             };
             using (System.Data.Entity.DbContextTransaction mytran = model.Database.BeginTransaction())
             {
                 try
                 {
                     model.JDJS_WMS_Order_Files_Manage_Table.Add(jdf);
                     model.SaveChanges();
                     mytran.Commit();
                     errMsg = "ok";
                     return(true);
                 }
                 catch (Exception ex)
                 {
                     mytran.Rollback();
                     errMsg = ex.Message;
                     return(false);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         errMsg = ex.Message;
         return(false);
     }
 }
Esempio n. 20
0
        public void ProcessRequest(HttpContext context)
        {
            var form = context.Request.Form;

            var orderNumberId      = int.Parse(form[0]);
            var workNumber         = 1;
            var blankType          = int.Parse(form[1]);
            var blankSpecification = form[2];

            using (JDJS_WMS_DB_USEREntities entities = new JDJS_WMS_DB_USEREntities())
            {
                using (System.Data.Entity.DbContextTransaction mytran = entities.Database.BeginTransaction())
                {
                    try
                    {
                        {
                            var orderNumber = entities.JDJS_WMS_Order_Entry_Table.Where(r => r.Order_ID == orderNumberId).First().Order_Number;
                            var BlankNumber = entities.JDJS_WMS_Order_Entry_Table.Where(r => r.Order_ID == orderNumberId).First().Product_Output;
                            var judge       = entities.JDJS_WMS_Order_Blank_Table.Where(r => r.OrderID == orderNumberId);
                            if (judge.Count() == 0)
                            {
                                var newRow = new JDJS_WMS_Order_Blank_Table
                                {
                                    OrderID                  = orderNumberId,
                                    BlankSpecification       = blankSpecification + "#1#",
                                    BlankType                = blankType,
                                    BlankState               = "待备料",
                                    BlanktotalPreparedNumber = 0,
                                    BlackNumber              = BlankNumber,
                                    BlankAddition            = 0
                                };
                                entities.JDJS_WMS_Order_Blank_Table.Add(newRow);
                            }
                            else
                            {
                                foreach (var item in judge)
                                {
                                    item.BlankSpecification = blankSpecification + "#1#";
                                    item.BlankType          = blankType;
                                }
                            }
                        }
                        entities.SaveChanges();
                        mytran.Commit();
                    }
                    catch (Exception ex)
                    {
                        mytran.Rollback();
                        context.Response.Write(ex.Message);
                        return;
                    }
                }
            }
            context.Response.Write("ok");
        }
        public void ProcessRequest(HttpContext context)
        {
            int PlanID  = int.Parse(context.Request["MaintenacneID"]); //计划表中的主键ID
            int staffID = int.Parse(context.Request["staffId"]);       //员工中的主键ID
            var data    = Convert.ToDouble(context.Request["data"]);

            using (JDJS_WMS_DB_USEREntities wms = new JDJS_WMS_DB_USEREntities())
            {
                using (System.Data.Entity.DbContextTransaction mytran = wms.Database.BeginTransaction())
                {
                    try
                    {
                        var plan = wms.JDJS_WMS_Device_Accuracy_Verification_Plan.Where(r => r.ID == PlanID && r.isFlag == 1);
                        if (plan.Count() > 0)
                        {
                            foreach (var item in plan)
                            {
                                item.AccuracyVerificationTime = DateTime.Now;
                            }

                            wms.SaveChanges();
                            JDJS_WMS_Device_Accuracy_Verification_Data confirm = new JDJS_WMS_Device_Accuracy_Verification_Data()
                            {
                                RecordTime = DateTime.Now,
                                PlanID     = PlanID,
                                StaffID    = staffID,
                                Data       = data
                            };
                            wms.JDJS_WMS_Device_Accuracy_Verification_Data.Add(confirm);
                            wms.SaveChanges();
                        }
                        mytran.Commit();
                    }
                    catch
                    {
                        mytran.Rollback();
                    }
                }
            }
            context.Response.Write("ok");
        }
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         int fxDemandId = int.Parse(context.Request["fxDemandId"]);
         int personId   = int.Parse(context.Session["id"].ToString());
         using (JDJS_WMS_DB_USEREntities model = new JDJS_WMS_DB_USEREntities())
         {
             var demand = model.JDJS_WMS_Fixture_Manage_Demand_Table.Where(r => r.ID == fxDemandId).FirstOrDefault();
             if (demand == null)
             {
                 context.Response.Write("该治具需求不存在");
                 return;
             }
             if (demand.DesignPersonId != personId)
             {
                 context.Response.Write("当前用户无此权限!");
                 return;
             }
             if (demand.State != "设计中")
             {
                 context.Response.Write("该治具设计需求暂不支持提交审核");
                 return;
             }
             if (demand.Material == null)
             {
                 context.Response.Write("请填写治具材料等相关信息!");
                 return;
             }
             using (System.Data.Entity.DbContextTransaction mytran = model.Database.BeginTransaction())
             {
                 try
                 {
                     demand.State = "待审核";
                     model.SaveChanges();
                     mytran.Commit();
                     context.Response.Write("ok");
                     return;
                 }
                 catch (Exception ex)
                 {
                     mytran.Rollback();
                     context.Response.Write(ex.Message);
                     return;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         context.Response.Write(ex.Message);
     }
 }
        public void ProcessRequest(HttpContext context)
        {
            var brand = context.Request["brand"];
            var type  = context.Request["type"];
            var tool_Location_Number = int.Parse(context.Request["tool_Location_Number"]);

            context.Response.ContentType = "text/plain";
            int id = int.Parse(context.Request["id"]);

            using (JDJS_WMS_DB_USEREntities data = new JDJS_WMS_DB_USEREntities())
            {
                var data1 = from brands in data.JDJS_WMS_Device_Brand_Info
                            where brands.Brand == brand
                            select new
                {
                    brands.ID
                };

                foreach (var item in data1)
                {
                    n = item.ID;
                }
                var data2 = data.JDJS_WMS_Device_Type_Info.Where(p => p.ID != id);
                //var data3 = data2.where(r => r.Type == type && r.BrandID == n);
                var data3 = from r in data2
                            where r.Type == type && r.BrandID == n
                            select new
                {
                    r.Type
                };


                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                var data4 = serializer.Serialize(data3);
                if (data4 == "[]")
                {
                    var data5 = data.JDJS_WMS_Device_Type_Info.Where(r => r.ID == id);
                    foreach (var item in data5)
                    {
                        item.Type = type; item.BrandID = n; item.tool_Location_Number = tool_Location_Number;
                    }

                    data.SaveChanges();

                    context.Response.Write("ok");
                }
                else
                {
                    context.Response.Write("false");
                }
            }
        }
Esempio n. 24
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            var limit = context.Request.Form[0];
            var form  = context.Request.Form[1];
            var id    = int.Parse(context.Request.Form[2]);
            var obj   = Serializer.Deserialize <Form>(form);

            using (JDJS_WMS_DB_USEREntities entities1 = new JDJS_WMS_DB_USEREntities())
            {
                if (obj.user == "")
                {
                    var row = new JDJS_WMS_Staff_Info
                    {
                        staff    = obj.staffName,
                        position = obj.position,
                        tel      = obj.tel,
                        parentId = id,
                        remark   = obj.remark
                    };
                    entities1.JDJS_WMS_Staff_Info.Add(row);
                }
                else
                {
                    var rows = entities1.JDJS_WMS_Staff_Info.Where(r => r.users == obj.user);
                    if (rows.Count() > 0)
                    {
                        context.Response.Write("登录账户已存在");
                        return;
                    }
                    else
                    {
                        var row = new JDJS_WMS_Staff_Info
                        {
                            staff    = obj.staffName,
                            position = obj.position,
                            tel      = obj.tel,
                            parentId = id,
                            users    = obj.user,
                            password = "******",
                            limit    = limit,
                            remark   = obj.remark
                        };
                        entities1.JDJS_WMS_Staff_Info.Add(row);
                    }
                }
                entities1.SaveChanges();
            }


            context.Response.Write("ok");
        }
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         int    id   = int.Parse(context.Request["id"]);//处理的申请主键ID
         string path = "";
         using (JDJS_WMS_DB_USEREntities model = new JDJS_WMS_DB_USEREntities())
         {
             var inspect = model.JDJS_WMS_Quality_Apply_Measure_Table.Where(r => r.ID == id).FirstOrDefault();
             if (inspect == null)
             {
                 context.Response.Write("该送检申请不存在,请确认后再试!");
                 return;
             }
             path = inspect.SavePath;
             //if (inspect.State != Enum.GetName(typeof(InspectStateType), 1))
             //{
             //    context.Response.Write("该测量记录状态不符,请确认后再试!");
             //    return;
             //}
             using (System.Data.Entity.DbContextTransaction mytran = model.Database.BeginTransaction())
             {
                 try
                 {
                     model.JDJS_WMS_Quality_Apply_Measure_Table.Remove(inspect);
                     model.SaveChanges();
                     mytran.Commit();
                     if (!string.IsNullOrWhiteSpace(path))
                     {
                         if (System.IO.Directory.Exists(path))
                         {
                             System.IO.Directory.Delete(path, true);
                         }
                     }
                     context.Response.Write("ok");
                     return;
                 }
                 catch (Exception ex)
                 {
                     mytran.Rollback();
                     context.Response.Write(ex.Message);
                     return;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         context.Response.Write(ex.Message);
         return;
     }
 }
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         int id = int.Parse(context.Request["id"]);//处理的申请主键ID
         using (JDJS_WMS_DB_USEREntities model = new JDJS_WMS_DB_USEREntities())
         {
             var inspect = model.JDJS_WMS_Quality_Apply_Measure_Table.Where(r => r.ID == id).FirstOrDefault();
             if (inspect == null)
             {
                 context.Response.Write("该送检申请不存在,请确认后再试!");
                 return;
             }
             if (inspect.State != Enum.GetName(typeof(InspectStateType), 1))
             {
                 context.Response.Write("该测量记录状态不符,请确认后再试!");
                 return;
             }
             if (inspect.MeasureResult == null)
             {
                 context.Response.Write("该工件暂未填写测量结果,请确认后再试!");
                 return;
             }
             using (System.Data.Entity.DbContextTransaction mytran = model.Database.BeginTransaction())
             {
                 try
                 {
                     inspect.State = Enum.GetName(typeof(InspectStateType), 2);
                     model.SaveChanges();
                     mytran.Commit();
                     PathInfo         pathInfo         = new PathInfo();
                     bool             z                = true;
                     SendTextToWechat sendTextToWechat = new CompanyWeChatRobotRemind();
                     sendTextToWechat.SendText(inspect.ApplyPersonName + "提交的工件:" + inspect.WorkPieceName + "的测量已完成。结果为" + inspect.MeasureResult + "。点击http://3x196w2589.qicp.vip/M/appointList.html", pathInfo.GetQualituInspectAuditRobot(), new List <string>(), out z);
                     context.Response.Write("ok");
                     return;
                 }
                 catch (Exception ex)
                 {
                     mytran.Rollback();
                     context.Response.Write(ex.Message);
                     return;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         context.Response.Write(ex.Message);
         return;
     }
 }
Esempio n. 27
0
        public void ProcessRequest(HttpContext context)
        {
            int PlanID  = int.Parse(context.Request["MaintenacneID"]); //计划表中的主键ID
            int staffID = int.Parse(context.Request["staffId"]);       //员工中的主键ID

            using (JDJS_WMS_DB_USEREntities wms = new JDJS_WMS_DB_USEREntities())
            {
                using (System.Data.Entity.DbContextTransaction mytran = wms.Database.BeginTransaction())
                {
                    try
                    {
                        var plan = wms.JDJS_WMS_Maintenance_Plan_Table.Where(r => r.ID == PlanID && r.isFlag == 1);
                        if (plan.Count() > 0)
                        {
                            foreach (var item in plan)
                            {
                                item.MaintenanceTime = DateTime.Now;
                            }

                            wms.SaveChanges();
                            JDJS_WMS_Maintenance_Confirm_Table confirm = new JDJS_WMS_Maintenance_Confirm_Table()
                            {
                                ConfirmTime = DateTime.Now,
                                PlanID      = PlanID,
                                StaffID     = staffID,
                            };
                            wms.JDJS_WMS_Maintenance_Confirm_Table.Add(confirm);
                            wms.SaveChanges();
                        }
                        mytran.Commit();
                    }
                    catch
                    {
                        mytran.Rollback();
                    }
                }
            }
            context.Response.Write("ok");
        }
        public void ProcessRequest(HttpContext context)
        {
            try {
                var form    = context.Request.Form;
                var orderId = int.Parse(form["orderId"]);


                using (JDJS_WMS_DB_USEREntities entities = new JDJS_WMS_DB_USEREntities())
                {
                    var process = int.Parse(form["process"]);
                    var allTime = form["allTime"];
                    //var cncType = form["cncType"];
                    //var cncNumber = form["cncNumber"];

                    var cncType   = "1";
                    var cncNumber = "1";
                    if (entities.JDJS_WMS_Order_Process_Info_Table.Where(r => r.OrderID == orderId & r.sign == 0 & r.ProcessID == process).Count() > 0)
                    {
                        context.Response.Write("该工序已存在");
                        return;
                    }
                    var row = new JDJS_WMS_Order_Process_Info_Table
                    {
                        OrderID     = orderId,
                        ProcessID   = process,
                        ProcessTime = int.Parse(allTime),
                        DeviceType  = int.Parse(cncType),
                        MachNumber  = int.Parse(cncNumber),
                        sign        = 0
                    };
                    entities.JDJS_WMS_Order_Process_Info_Table.Add(row);


                    //var orderNumberRow = entities.JDJS_WMS_Order_Entry_Table.Where(r => r.Order_ID == orderId);
                    //var orderNumber = "";
                    //if (orderNumberRow.Count() > 0)
                    //{
                    //    orderNumber = orderNumberRow.First().Order_Number;
                    //}

                    entities.SaveChanges();
                    context.Response.Write("ok");
                }
            }
            catch (Exception ex)
            {
                context.Response.Write(ex.Message);
            }
        }
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         var           ids       = context.Request["ids"];//需要删除的尺寸主键ID列表,以逗号,分隔
         List <string> idStrList = ids.Split(',').ToList();
         List <int>    idList    = new List <int>();
         foreach (var item in idStrList)
         {
             int value = 0;
             value = int.TryParse(item, out value) ? value : 0;
             idList.Add(value);
         }
         using (JDJS_WMS_DB_USEREntities model = new JDJS_WMS_DB_USEREntities())
         {
             using (System.Data.Entity.DbContextTransaction mytran = model.Database.BeginTransaction())
             {
                 try
                 {
                     foreach (var item in idList)
                     {
                         var quality = model.JDJS_WMS_Quality_Detection_Measurement_Table.Where(r => r.ID == item);
                         foreach (var real in quality)
                         {
                             model.JDJS_WMS_Quality_Detection_Measurement_Table.Remove(real);
                         }
                     }
                     model.SaveChanges();
                     mytran.Commit();
                     context.Response.Write("ok");
                     return;
                 }
                 catch (Exception ex)
                 {
                     mytran.Rollback();
                     context.Response.Write(ex.Message);
                     return;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         context.Response.Write(ex.Message);
         return;
     }
     context.Response.ContentType = "text/plain";
     context.Response.Write("Hello World");
 }
        /// <summary>
        /// 删除任务
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool DeleteTask(int id, ref string errMsg)
        {
            try
            {
                using (JDJS_WMS_DB_USEREntities wms = new JDJS_WMS_DB_USEREntities())
                {
                    using (System.Data.Entity.DbContextTransaction mytran = wms.Database.BeginTransaction())
                    {
                        try
                        {
                            var work = wms.JDJS_WMS_Order_Process_Scheduling_Table.Where(r => r.ID == id).FirstOrDefault();
                            if (work == null)
                            {
                                mytran.Rollback();
                                errMsg = "该任务不存在";
                                return(false);
                            }
                            DateTime time     = Convert.ToDateTime(work.StartTime);
                            TimeSpan timespan = Convert.ToDateTime(work.EndTime) - Convert.ToDateTime(work.StartTime);
                            var      works    = wms.JDJS_WMS_Order_Process_Scheduling_Table.Where(r => r.CncID == work.CncID && r.isFlag == 1 && r.StartTime > time);
                            foreach (var item in works)
                            {
                                DateTime startTime = Convert.ToDateTime(item.StartTime);
                                item.StartTime = startTime - timespan;
                                DateTime endTime = Convert.ToDateTime(item.EndTime);
                                item.EndTime = endTime - timespan;
                            }

                            wms.JDJS_WMS_Order_Process_Scheduling_Table.Remove(work);
                            wms.SaveChanges();
                            mytran.Commit();
                            errMsg = "ok";
                            return(true);
                        }
                        catch (Exception ex)
                        {
                            errMsg = ex.Message;
                            mytran.Rollback();
                            return(false);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                errMsg = ex.Message;
                return(false);
            }
        }