Exemplo n.º 1
0
        public ActionResult WavePickingDetail(string id)
        {
            if (int.TryParse(id, out int wpdid))
            {
                //当前的波次单
                var curWP = new DbEntities <WavePicking>().SimpleClient.GetById(wpdid);
                if (curWP != null)
                {
                    WavePickingDetailViewModel model = new WavePickingDetailViewModel
                    {
                        WavePickingID = curWP.WavePickingID,
                        WavePickingNo = curWP.WavePickingNo
                    };

                    //下拉框
                    SetSelectListItems.OutboundTaskDetail(this);
                    SetSelectListItems.Material(this);
                    SetSelectListItems.TrayDetail(this);
                    SetSelectListItems.InventoryList(this);

                    return(View(model));
                }
            }

            TempData["Msg"] = "没有找到对象";
            return(RedirectToAction("WavePicking", "Warehouse"));
        }
Exemplo n.º 2
0
 public ActionResult MaterialType()
 {
     //设置下拉框
     SetSelectListItems.Supplier(this);
     SetSelectListItems.MaterialType(this);
     return(View());
 }
Exemplo n.º 3
0
        public ActionResult OutboundTaskDetail(string obtid = null)
        {
            //关联的出库单ID
            if (int.TryParse(obtid, out int curobtID))
            {
                var db = new DbEntities <OutboundTask>().SimpleClient;

                //当前出库任务单信息
                var OutboundTaskInfo = db.GetById(curobtID);

                if (OutboundTaskInfo != null)
                {
                    OutboundTaskDetailViewModel model = new OutboundTaskDetailViewModel
                    {
                        OutboundTaskID = curobtID,
                        OutboundTaskInfo_OutboundTaskNo = OutboundTaskInfo.OutboundTaskNo
                    };

                    //设置物资规格
                    SetSelectListItems.Material(this);
                    return(View(model));
                }
            }

            TempData["Msg"] = "没有找到对象";
            return(RedirectToAction("OutboundTask", "Warehouse"));
        }
Exemplo n.º 4
0
        public ActionResult Tray()
        {
            SetSelectListItems.Container(this);
            SetSelectListItems.TrayType(this);

            return(View());
        }
Exemplo n.º 5
0
        public ActionResult OutboundTaskDetail(OutboundTaskDetailViewModel model)
        {
            if (ModelState.IsValid)
            {
                var db = new DbEntities <OutboundTaskDetail>().SimpleClient;

                if (new IdentityAuth().GetCurUserID(HttpContext, out int curUserID))
                {
                    OutboundTaskDetail entity = model.InitAddOutboundTaskDetail(curUserID);

                    if (db.Insert(entity))
                    {
                        TempData["Msg"] = $"出库任务细节单 [{model.OutboundTaskInfo_OutboundTaskNo}] 添加成功";
                        return(RedirectToAction("OutboundTask", "Warehouse"));
                    }
                    TempData["Msg"] = "添加失败";
                }
                else
                {
                    TempData["Msg"] = "登录身份过期,请重新登录";
                }
            }

            SetSelectListItems.Material(this, model.MaterialSizeID);
            return(View(model));
        }
Exemplo n.º 6
0
        public ActionResult InventoryLocation(InventoryLocationViewModel model)
        {
            if (ModelState.IsValid)
            {
                //名称编号不重复
                var db = new DbEntities <InventoryLocation>().SimpleClient;

                if (db.IsAny(il => il.InventoryLocationName == model.InventoryLocationName || il.InventoryLocationNo == model.InventoryLocationNo))
                {
                    ModelState.AddModelError("InventoryLocationNo", "库位名称或编号已存在");
                }
                else
                {
                    //检验登录人身份,并获取对应ID
                    if (new IdentityAuth().GetCurUserID(HttpContext, out int curUserID))
                    {
                        InventoryLocation entity = model.InitAddInventoryLocation(curUserID);

                        if (db.Insert(entity))
                        {
                            TempData["Msg"] = $"库区 {entity.InventoryLocationName} 添加成功";
                            return(RedirectToAction("InventoryLocation", "Warehouse"));
                        }
                        TempData["Msg"] = "添加失败";
                    }
                    else
                    {
                        TempData["Msg"] = "登录身份过期,请重新登录";
                    }
                }
            }

            SetSelectListItems.InventoryArea(this);
            return(View(model));
        }
Exemplo n.º 7
0
        public ActionResult InventoryAllocation(InventoryAllocationViewModel model)
        {
            if (ModelState.IsValid)
            {
                if (new IdentityAuth().GetCurUserID(HttpContext, out int curUserID))
                {
                    InventoryAllocation entity = model.InitAddInventoryAllocation(curUserID);

                    if (new DbEntities <InventoryAllocation>().SimpleClient.Insert(entity))
                    {
                        TempData["Msg"] = "库位分配成功";
                        return(RedirectToAction("InventoryAllocation", "Warehouse"));
                    }
                    TempData["Msg"] = "失败";
                }
                else
                {
                    TempData["Msg"] = "登录身份过期,请重新登录";
                }
            }

            SetSelectListItems.MaterialType(this, model.MaterialTypeID);
            SetSelectListItems.InventoryLocation(this, model.InventoryLocationID);
            return(View(model));
        }
Exemplo n.º 8
0
        public ActionResult InboundTaskDetail(string ibtid = null)
        {
            //关联的入库单ID
            if (int.TryParse(ibtid, out int curibtID))
            {
                var db = new DbEntities <InboundTask>().SimpleClient;

                var InboundTaskInfo = db.GetById(curibtID);

                if (InboundTaskInfo != null)
                {
                    InboundTaskDetailViewModel model = new InboundTaskDetailViewModel
                    {
                        InboundTaskID = curibtID,
                        InboundTaskInfo_InboundTaskNo = InboundTaskInfo.InboundTaskNo
                    };

                    //设置物资规格
                    SetSelectListItems.Material(this);
                    return(View(model));
                }
            }

            TempData["Msg"] = "没有找到对象";
            return(RedirectToAction("InboundTask", "Warehouse"));
        }
Exemplo n.º 9
0
        public ActionResult OutboundTask()
        {
            //下拉框
            SetSelectListItems.OutboundType(this);
            SetSelectListItems.SaleType(this);

            return(View());
        }
Exemplo n.º 10
0
        public ActionResult WavePicking()
        {
            //设置下拉框
            SetSelectListItems.PickingType(this);
            SetSelectListItems.WavePickingType(this);

            return(View());
        }
Exemplo n.º 11
0
        public ActionResult Material()
        {
            //设置下拉框
            SetSelectListItems.MaterialType(this);
            SetSelectListItems.UnitList(this);
            SetSelectListItems.Container(this);

            return(View());
        }
Exemplo n.º 12
0
        public ActionResult InventoryList()
        {
            //下拉框设置
            SetSelectListItems.InboundTaskDetail(this);
            SetSelectListItems.OutboundTaskDetail(this);
            SetSelectListItems.Tray(this);
            SetSelectListItems.InventoryLocation(this);

            return(View());
        }
Exemplo n.º 13
0
        public ActionResult InventoryAllocation(string Id = null)
        {
            SetSelectListItems.MaterialType(this);

            if (int.TryParse(Id, out int curInventoryLocationID))
            {
                SetSelectListItems.InventoryLocation(this, curInventoryLocationID);
            }
            else
            {
                SetSelectListItems.InventoryLocation(this);
            }
            return(View());
        }
Exemplo n.º 14
0
        public ActionResult Material(MaterialViewModel model)
        {
            if (model.UnitInput == null && model.Unit == "-1")
            {
                ModelState.AddModelError("UnitInput", "请输入或选择一项单位");
            }
            if (ModelState.IsValid)
            {
                //物资型号模型不能相同
                var db = new DbEntities <Material>().SimpleClient;

                if (db.IsAny(m => m.SizeCode == model.SizeCode || m.MaterialModel == model.MaterialModel))
                {
                    ModelState.AddModelError("SizeCode", "编号或者型号不能相同");
                }
                else
                {
                    //获得对应实体
                    if (new IdentityAuth().GetCurUserID(HttpContext, out int creater))
                    {
                        Material entity = model.InitAddMaterial(creater);

                        //插入数据
                        if (new DbEntities <Material>().SimpleClient.Insert(entity))
                        {
                            TempData["Msg"] = "添加成功";
                            return(RedirectToAction("MaterialList", "Materials"));
                        }
                    }
                }
            }

            //设置下拉框
            SetSelectListItems.MaterialType(this, model.MaterialTypeID);
            SetSelectListItems.UnitList(this);
            SetSelectListItems.Container(this, model.MaterialContainer);
            TempData["Msg"] = "添加失败,请检查信息";
            return(View());
        }
Exemplo n.º 15
0
        public ActionResult TrayDetail(TrayDetailViewModel model)
        {
            if (ModelState.IsValid)
            {
                var db = new DbEntities <TrayDetail>().SimpleClient;

                ////入库明细、物资规格、托盘不能都相同
                //if (db.IsAny(t => t.InboundTaskDetailID == model.InboundTaskDetailID && t.MaterialSizeID == model.MaterialSizeID && t.TrayDetailID == model.TrayDetailID))

                //当前的托盘盘是否已经添加
                if (db.IsAny(t => t.TrayID == model.TrayID))
                {
                    TempData["Msg"] = "该托盘单细节已存在";
                }
                else
                {
                    //登录人信息
                    if (new IdentityAuth().GetCurUserID(HttpContext, out int curUserID))
                    {
                        TrayDetail entity = model.InitAddTrayDetail(curUserID);

                        if (db.Insert(entity))
                        {
                            TempData["Msg"] = "添加成功";
                            return(RedirectToAction("TrayDetail", "Warehouse"));
                        }
                        TempData["Msg"] = "添加失败";
                    }
                    else
                    {
                        TempData["Msg"] = "登录身份过期,请重新登录";
                    }
                }
            }

            SetSelectListItems.InboundTaskDetail(this);
            SetSelectListItems.Material(this);
            return(View(model));
        }
Exemplo n.º 16
0
        public ActionResult InventoryList(InventoryListViewModel model)
        {
            if (ModelState.IsValid)
            {
                var db = new DbEntities <InventoryList>().SimpleClient;

                //信息记录不重复
                if (db.IsAny(il => il.InboundTaskDetailID == model.InboundTaskDetailID && il.OutboundTaskDetailID == model.OutboundTaskDetailID && il.TrayID == model.TrayID && il.InventoryLocationID == model.InventoryLocationID && il.InventoryType == model.InventoryType))
                {
                    TempData["Msg"] = "该条记录已存在";
                }
                else
                {
                    //登录人信息
                    if (new IdentityAuth().GetCurUserID(HttpContext, out int curUserID))
                    {
                        InventoryList entity = model.InitAddInventoryList(curUserID);

                        if (db.Insert(entity))
                        {
                            TempData["Msg"] = $"添加成功";
                            return(RedirectToAction("InventoryList", "Warehouse"));
                        }
                        TempData["Msg"] = "添加失败";
                    }
                    else
                    {
                        TempData["Msg"] = "登录身份过期,请重新登录";
                    }
                }
            }

            //下拉框设置
            SetSelectListItems.InboundTaskDetail(this);
            SetSelectListItems.OutboundTaskDetail(this);
            SetSelectListItems.Tray(this);
            SetSelectListItems.InventoryLocation(this);
            return(View());
        }
Exemplo n.º 17
0
        public ActionResult WavePicking(WavePickingViewModel model)
        {
            if (ModelState.IsValid)
            {
                //编号不重复
                var db = new DbEntities <WavePicking>().SimpleClient;

                if (db.IsAny(wp => wp.WavePickingNo == model.WavePickingNo))
                {
                    ModelState.AddModelError("WavePickingNo", "波次编号已存在");
                }
                else
                {
                    //检验登录人身份
                    if (new IdentityAuth().GetCurUserID(HttpContext, out int curUserID))
                    {
                        WavePicking entity = model.InitAddWavePicking(curUserID);

                        if (db.Insert(entity))
                        {
                            TempData["Msg"] = $"波次单 [{entity.WavePickingNo}] 添加成功";
                            return(RedirectToAction("WavePicking", "Warehouse"));
                        }
                        TempData["Msg"] = "添加失败";
                    }
                    else
                    {
                        TempData["Msg"] = "登录身份过期,请重新登录";
                    }
                }
            }

            //设置下拉框
            SetSelectListItems.PickingType(this);
            SetSelectListItems.WavePickingType(this);

            return(View(model));
        }
Exemplo n.º 18
0
        public ActionResult OutboundTask(OutboundTaskViewModel model)
        {
            if (ModelState.IsValid)
            {
                var db = new DbEntities <OutboundTask>().SimpleClient;

                //编号不重复
                if (db.IsAny(ob => ob.OutboundTaskNo == model.OutboundTaskNo))
                {
                    ModelState.AddModelError("OutboundTaskNo", "该编号已存在");
                }
                else
                {
                    //登录人信息
                    if (new IdentityAuth().GetCurUserID(HttpContext, out int curUserID))
                    {
                        OutboundTask entity = model.InitAddOutboundTask(curUserID);

                        if (db.Insert(entity))
                        {
                            TempData["Msg"] = $"出库任务单 [{entity.OutboundTaskNo}] 添加成功";
                            return(RedirectToAction("OutboundTask", "Warehouse"));
                        }
                        TempData["Msg"] = "添加失败";
                    }
                    else
                    {
                        TempData["Msg"] = "登录身份过期,请重新登录";
                    }
                }
            }

            //下拉框
            SetSelectListItems.OutboundType(this);
            SetSelectListItems.SaleType(this);

            return(View(model));
        }
Exemplo n.º 19
0
        public ActionResult TrayDetail(string tdid = null)
        {
            //关联托盘单
            if (int.TryParse(tdid, out int id))
            {
                var db = new DbEntities <TrayDetail>().SimpleClient;

                if (db.GetById(id) == null)
                {
                    TrayDetailViewModel model = new TrayDetailViewModel
                    {
                        TrayID = id,
                    };

                    SetSelectListItems.InboundTaskDetail(this);
                    SetSelectListItems.Material(this);
                    return(View(model));
                }
            }

            TempData["Msg"] = "请先选择对应托盘";
            return(RedirectToAction("Tray", "Warehouse"));
        }
Exemplo n.º 20
0
        public ActionResult Tray(TrayViewModel model)
        {
            if (ModelState.IsValid)
            {
                //编号条码不重复
                var db = new DbEntities <Tray>().SimpleClient;

                if (db.IsAny(tr => tr.TrayNo == model.TrayNo || tr.TrayCode == model.TrayCode))
                {
                    ModelState.AddModelError("TrayCode", "托盘编号或条码");
                }
                else
                {
                    //检验登录人身份,并获取对应ID
                    if (new IdentityAuth().GetCurUserID(HttpContext, out int curUserID))
                    {
                        Tray entity = model.InitAddTray(curUserID);

                        if (db.Insert(entity))
                        {
                            TempData["Msg"] = $"托盘 [{entity.TrayNo}] 添加成功";
                            return(RedirectToAction("Tray", "Warehouse"));
                        }
                        TempData["Msg"] = "添加失败";
                    }
                    else
                    {
                        TempData["Msg"] = "登录身份过期,请重新登录";
                    }
                }
            }

            SetSelectListItems.Container(this, model.Container);
            SetSelectListItems.TrayType(this, model.TrayType);

            return(View(model));
        }
Exemplo n.º 21
0
        public ActionResult MaterialType(MaterialTypeViewModel model)
        {
            //验证
            if (ModelState.IsValid)
            {
                //名称编码是否有重复
                var db = new DbEntities <MaterialType>().SimpleClient;

                if (db.IsAny(mt => mt.MaterialTypeName == model.MaterialTypeName || mt.MaterialTypeNo == model.MaterialTypeNo))
                {
                    ModelState.AddModelError("MaterialTypeCode", "物资种类名称或编码已存在");
                }
                else
                {
                    if (new IdentityAuth().GetCurUserID(HttpContext, out int curUserID))
                    {
                        //转换为对应实体
                        MaterialType entity = model.InitAddMaterialType(curUserID);

                        if (db.Insert(entity))
                        {
                            TempData["Msg"] = $"物资种类 {entity.MaterialTypeName} 添加成功";
                            return(RedirectToAction("TypeList", "Materials"));
                        }
                        else
                        {
                            TempData["Msg"] = "添加失败";
                        }
                    }
                }
            }

            SetSelectListItems.Supplier(this);
            SetSelectListItems.MaterialType(this);
            return(View());
        }
Exemplo n.º 22
0
 public ActionResult InboundTask()
 {
     SetSelectListItems.Supplier(this);
     SetSelectListItems.InboundType(this);
     return(View());
 }
Exemplo n.º 23
0
 public ActionResult InventoryArea()
 {
     SetSelectListItems.Warehouse(this);
     return(View());
 }
Exemplo n.º 24
0
 public ActionResult InventoryLocation()
 {
     SetSelectListItems.InventoryArea(this);
     return(View());
 }