コード例 #1
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));
        }
コード例 #2
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"));
        }
コード例 #3
0
        /// <summary>
        /// 获取出库任务细节视图模型
        /// </summary>
        /// <param name="outboundTask"></param>
        /// <returns></returns>
        public static OutboundTaskDetailViewModel GetOutboundTaskDetailViewModel(OutboundTaskDetail outboundTask)
        {
            OutboundTaskDetailViewModel outboundTaskDetail = ConvertToViewModel <OutboundTaskDetailViewModel, OutboundTaskDetail>(outboundTask);

            //出库任务信息
            outboundTaskDetail.OutboundTask = new DbEntities <View_OutboundTask>().SimpleClient.GetSingle(ob => ob.OutboundTaskID == outboundTask.OutboundTaskID);

            //出库任务细节信息
            outboundTaskDetail.OutboundTaskDetail = new DbEntities <View_OutboundTaskDetail>().SimpleClient.GetSingle(obd => obd.OutboundTaskDetailID == outboundTask.OutboundTaskDetailID);

            return(outboundTaskDetail);
        }