コード例 #1
0
        //
        // GET: /BillOfMaterial/

        public ActionResult Add(string ID)
        {
            ViewBag.FinishedProductList    = ProductLogic.GetFinishedProducts();
            ViewBag.RawMaterialProductList = ProductLogic.GetRawMaterialProducts();
            ViewBag.BOMProcessList         = BOMProcessLogic.BOMProcessByID(0);
            ViewBag.UnitList      = ProductUnitLogic.GetProductUnitByID(0);
            ViewBag.LabParameters = LabParameterLogic.GetLabParameterByID(0);
            ViewBag.UserType      = currUser.Type;
            if (Convert.ToInt32(ID) > 0)
            {
                var bom = BillOfMaterialLogic.GetBillOfMaterialByID(Convert.ToInt32(ID)).FirstOrDefault();
                ViewBag.ShadeList = ShadeLogic.GetShadeByProductID(Convert.ToInt32(bom.ProductID)).Select(x => new { x.ShadeID, x.ShadeName }).Distinct();
                //var productShades = ShadeLogic.GetShadeByProductID(bom.ProductID);
                //if (productShades != null && productShades.Count() > 0)
                //{
                //    foreach (var productShade in productShades.Select(x => x.ShadeID).Distinct())
                //    {
                //        ViewBag.ShadeList = ShadeLogic.GetShadeByID(Convert.ToInt32(productShade));
                //    }
                //}
                //else
                //{
                //    ViewBag.ShadeList = null;
                //}
                return(View(bom));
            }
            else
            {
                ViewBag.ShadeList = null;
                return(View(new BillOfMaterial()));
            }
        }
コード例 #2
0
        public ActionResult Add(BillOfMaterial billOfMaterial)
        {
            ResponseMsg response = new ResponseMsg();

            billOfMaterial.CreatedBy = billOfMaterial.UpdatedBy = currUser.ID;
            BillOfMaterialLogic.SaveBillOfMaterial(billOfMaterial);
            response.IsSuccess = true;
            return(Json(response));
        }
コード例 #3
0
        public JsonResult Delete(string ID)
        {
            ResponseMsg response = new ResponseMsg();

            if (Convert.ToInt32(ID) > 0)
            {
                BillOfMaterialLogic.DeleteBillOfMaterialByID(ID);
                response.IsSuccess     = true;
                response.ResponseValue = "";
            }
            return(Json(response, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
        public ActionResult GetLastRevision(int ProductID, int ShadeID)
        {
            ViewBag.RawMaterialProductList = ProductLogic.GetRawMaterialProducts();
            ViewBag.BOMProcessList         = BOMProcessLogic.BOMProcessByID(0);
            var lastReivision = BillOfMaterialLogic.GetLastRevision(ProductID, ShadeID);

            if (lastReivision != null)
            {
                return(PartialView("_BOMRawMaterials", lastReivision));
            }
            else
            {
                return(null);
            }
        }
コード例 #5
0
        public JsonResult GetRevisionNo(int ProductID, int ShadeID)
        {
            ResponseMsg response   = new ResponseMsg();
            var         revisionNo = BillOfMaterialLogic.GetRevisionNo(ProductID, ShadeID);

            if (revisionNo > 0)
            {
                response.IsSuccess     = true;
                response.ResponseValue = revisionNo;
            }
            else
            {
                response.IsSuccess     = false;
                response.ResponseValue = "";
            }
            return(Json(response, JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
        public ActionResult GrindingDone(Batch batch)
        {
            ResponseMsg response = new ResponseMsg();
            var         bom      = BillOfMaterialLogic.GetLastRevision(batch.ProductID, batch.ShadeID);

            if (bom == null)
            {
                response.IsSuccess     = false;
                response.ResponseValue = "Bill of material for selected product and shade is not found, Please enter Bill of material detail for selected Product and Batch";
                return(Json(response));
            }
            if (GrindingLogic.Done(batch))
            {
                response.IsSuccess = true;
            }
            return(Json(response));
        }
コード例 #7
0
        public ActionResult GetRawMaterialDetails(int ProductID, int ShadeID, string RevisionNo)
        {
            ResponseMsg response = new ResponseMsg();

            ViewBag.RawMaterialProductList = ProductLogic.GetRawMaterialProducts();
            ViewBag.BOMProcessList         = BOMProcessLogic.BOMProcessByID(0);
            var lastReivision = BillOfMaterialDetailLogic.GetRawMaterialDetails(ProductID, ShadeID, RevisionNo);

            if (lastReivision != null)
            {
                var rmHtml  = "";
                var labHtml = "";
                using (var sw = new StringWriter())
                {
                    PartialViewResult result = PartialView("_BOMRawMaterials", lastReivision);
                    result.View = ViewEngines.Engines.FindPartialView(ControllerContext, "_BOMRawMaterials").View;
                    ViewContext vc = new ViewContext(ControllerContext, result.View, result.ViewData, result.TempData, sw);
                    result.View.Render(vc, sw);
                    rmHtml = sw.GetStringBuilder().ToString();
                }
                using (var sw = new StringWriter())
                {
                    var bom = BillOfMaterialLogic.GetBillOfMaterialByPSR(ProductID, ShadeID, RevisionNo);
                    ViewBag.LabParameters = LabParameterLogic.GetLabParameterByID(0);
                    PartialViewResult result = PartialView("_BOMLabParameters", bom);
                    result.View = ViewEngines.Engines.FindPartialView(ControllerContext, "_BOMLabParameters").View;
                    ViewContext vc = new ViewContext(ControllerContext, result.View, result.ViewData, result.TempData, sw);
                    result.View.Render(vc, sw);
                    labHtml = sw.GetStringBuilder().ToString();
                }
                response.IsSuccess     = true;
                response.ResponseValue = new { RMData = rmHtml, LABData = labHtml };
                return(Json(response, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(null);
            }
        }
コード例 #8
0
        public JsonResult StartGrinding(int ID, int ProductID, int ShadeID, int EmployeeID)
        {
            ResponseMsg response = new ResponseMsg();
            var         bom      = BillOfMaterialLogic.GetLastRevision(ProductID, ShadeID);

            if (bom == null)
            {
                response.IsSuccess     = false;
                response.ResponseValue = "Bill of material for selected product and shade is not found, Please enter Bill of material detail for selected Product and Batch";
                return(Json(response, JsonRequestBehavior.AllowGet));
            }
            var materials = GrindingLogic.Start(ID, EmployeeID);

            if (materials != null && materials.Count() > 0)
            {
                var fileName = GrindingLogic.PrintRawMaterial(materials, Server.MapPath(ConfigurationManager.AppSettings["ReportFolderPath"]), ID, currUser.Name, EmployeeID);
                if (!string.IsNullOrEmpty(fileName))
                {
                    response.IsSuccess     = true;
                    response.ResponseValue = ConfigurationManager.AppSettings["ReportFolderPath"].Replace("~", "").Trim() + fileName;
                }
            }
            return(Json(response, JsonRequestBehavior.AllowGet));
        }
コード例 #9
0
        public ActionResult GetAll()
        {
            var BOMs = BillOfMaterialLogic.GetBillOfMaterialByID(0);

            return(PartialView("GetAll", BOMs));
        }