Exemplo n.º 1
0
        public async Task <ActionResult> Query(MaterialReceiptQueryViewModel model)
        {
            using (ERPClient client = new ERPClient())
            {
                MethodReturnResult           ReturnResult = new MethodReturnResult();
                MethodReturnResult <DataSet> result       = client.GetERPMaterialReceipt(model.ReceiptNo);

                if (result.Code == 0)
                {
                    if (result.Data.Tables[0].Rows.Count > 0)
                    {
                        WorkOrderServiceClient         workClient = new WorkOrderServiceClient();
                        MethodReturnResult <WorkOrder> rst        = await workClient.GetAsync(result.Data.Tables[0].Rows[0]["VPRODUCTBATCH"].ToString());

                        if (rst.Data == null)
                        {
                            ReturnResult.Code    = 1001;
                            ReturnResult.Message = string.Format(StringResource.ERPWorkOrder_Error_Query, model.ReceiptNo, result.Data.Tables[0].Rows[0]["VPRODUCTBATCH"].ToString());
                        }
                    }
                    else
                    {
                        ReturnResult.Code    = 1001;
                        ReturnResult.Message = string.Format(StringResource.ERPMaterialReceipt_Error_Query, model.ReceiptNo);
                    }
                }
                else
                {
                    ReturnResult.Code    = result.Code;
                    ReturnResult.Message = result.Message;
                }
                return(Json(ReturnResult));
            }
        }
Exemplo n.º 2
0
        public async Task <ActionResult> SaveModify(WorkOrderViewModel model)
        {
            MethodReturnResult rst = new MethodReturnResult();

            try
            {
                using (WorkOrderServiceClient client = new WorkOrderServiceClient())
                {
                    MethodReturnResult <WorkOrder> result = await client.GetAsync(model.OrderNumber);

                    if (result.Code == 0 && result.Data != null)
                    {
                        result.Data.CloseType     = model.CloseType;
                        result.Data.Description   = model.Description;
                        result.Data.FinishTime    = model.FinishTime;
                        result.Data.LocationName  = model.LocationName.ToUpper();
                        result.Data.MaterialCode  = model.MaterialCode.ToUpper();
                        result.Data.LeftQuantity  = result.Data.LeftQuantity + (model.OrderQuantity - result.Data.OrderQuantity);
                        result.Data.OrderQuantity = model.OrderQuantity;
                        result.Data.OrderState    = model.OrderState;
                        result.Data.OrderType     = model.OrderType;
                        result.Data.Priority      = model.Priority;
                        result.Data.RevenueType   = model.RevenueType;
                        result.Data.StartTime     = model.StartTime;
                        result.Data.Description   = model.Description;
                        result.Data.Editor        = User.Identity.Name;
                        result.Data.EditTime      = DateTime.Now;

                        rst = await client.ModifyAsync(result.Data);

                        if (rst.Code == 0)
                        {
                            rst.Message = string.Format(PPMResources.StringResource.WorkOrder_Save_Success
                                                        , model.OrderNumber);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                rst.Code    = 1000;
                rst.Message = ex.Message;
                rst.Detail  = ex.ToString();
            }
            return(Json(rst));
        }
Exemplo n.º 3
0
        /// <summary> 修改信息查询 </summary>
        /// <param name="key">工单号</param>
        /// <returns></returns>
        public async Task <ActionResult> Modify(string key)
        {
            WorkOrderViewModel viewModel = new WorkOrderViewModel();

            using (WorkOrderServiceClient client = new WorkOrderServiceClient())
            {
                MethodReturnResult <WorkOrder> result = await client.GetAsync(key);

                if (result.Code == 0)
                {
                    viewModel = new WorkOrderViewModel()
                    {
                        CloseType      = result.Data.CloseType,
                        FinishQuantity = result.Data.FinishQuantity,
                        FinishTime     = result.Data.FinishTime,
                        PlanStartTime  = result.Data.PlanStartTime,
                        PlanFinishTime = result.Data.PlanFinishTime,
                        LeftQuantity   = result.Data.LeftQuantity,
                        MaterialCode   = result.Data.MaterialCode,
                        OrderNumber    = result.Data.Key,
                        OrderQuantity  = result.Data.OrderQuantity,
                        OrderState     = result.Data.OrderState,
                        OrderType      = result.Data.OrderType,
                        Priority       = result.Data.Priority,
                        RepairQuantity = result.Data.RepairQuantity,
                        RevenueType    = result.Data.RevenueType,
                        ReworkQuantity = result.Data.ReworkQuantity,
                        ScrapQuantity  = result.Data.ScrapQuantity,
                        StartTime      = result.Data.StartTime,
                        WIPQuantity    = result.Data.WIPQuantity,
                        LocationName   = result.Data.LocationName,
                        CreateTime     = result.Data.CreateTime,
                        Creator        = result.Data.Creator,
                        Description    = result.Data.Description,
                        Editor         = result.Data.Editor,
                        EditTime       = result.Data.EditTime
                    };
                    return(PartialView("_ModifyPartial", viewModel));
                }
                else
                {
                    ModelState.AddModelError("", result.Message);
                }
            }
            return(PartialView("_ModifyPartial"));
        }
Exemplo n.º 4
0
        //
        // GET: /PPM/WorkOrderBOM/
        public async Task <ActionResult> Index(string orderNumber)
        {
            using (WorkOrderServiceClient client = new WorkOrderServiceClient())
            {
                MethodReturnResult <WorkOrder> result = await client.GetAsync(orderNumber ?? string.Empty);

                if (result.Code > 0 || result.Data == null)
                {
                    return(RedirectToAction("Index", "WorkOrder"));
                }
                ViewBag.WorkOrder = result.Data;
            }

            using (WorkOrderBOMServiceClient client = new WorkOrderBOMServiceClient())
            {
                await Task.Run(() =>
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        Where = string.Format(" Key.OrderNumber = '{0}'"
                                              , orderNumber),
                        OrderBy = "Key.ItemNo"
                    };
                    MethodReturnResult <IList <WorkOrderBOM> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.PagingConfig = cfg;
                        ViewBag.List         = result.Data;
                    }
                });
            }

            //return View(new WorkOrderBOMViewModel() { OrderNumber = orderNumber });
            return(View(new WorkOrderBOMQueryViewModel()
            {
                OrderNumber = orderNumber
            }));
        }
Exemplo n.º 5
0
        public async Task <ActionResult> SaveModify(WorkOrderViewModel model)
        {
            MethodReturnResult rst = new MethodReturnResult();

            try
            {
                using (WorkOrderServiceClient client = new WorkOrderServiceClient())
                {
                    MethodReturnResult <WorkOrder> result = await client.GetAsync(model.OrderNumber);

                    if (result.Code == 0 && result.Data != null)
                    {
                        //判断工单数量是否满足已投批数量
                        if (result.Data.LeftQuantity + (model.OrderQuantity - result.Data.OrderQuantity) < 0)
                        {
                            rst.Code    = 1000;
                            rst.Message = string.Format("工单数量({0})小于已创批数量({1})!",
                                                        model.OrderQuantity,
                                                        result.Data.OrderQuantity - result.Data.LeftQuantity);
                            rst.Detail = rst.Message;

                            return(Json(rst));
                        }

                        result.Data.PlanStartTime  = model.PlanStartTime;                                                          //计划开工日期
                        result.Data.PlanFinishTime = model.PlanFinishTime;                                                         //计划完工日期
                        result.Data.LeftQuantity   = result.Data.LeftQuantity + (model.OrderQuantity - result.Data.OrderQuantity); //剩余数量
                        result.Data.OrderQuantity  = model.OrderQuantity;                                                          //工单数量
                        result.Data.OrderType      = model.OrderType;                                                              //工单类型

                        result.Data.StartTime   = model.PlanStartTime;                                                             //开工时间
                        result.Data.FinishTime  = model.PlanFinishTime;                                                            //完工时间
                        result.Data.Description = model.Description;                                                               //描述

                        result.Data.Editor     = User.Identity.Name;                                                               //编辑人
                        result.Data.EditTime   = DateTime.Now;                                                                     //编辑日期
                        result.Data.CloseType  = model.CloseType;                                                                  //工单关闭类型
                        result.Data.OrderState = model.OrderState;                                                                 //工单状态

                        //result.Data.Description = model.Description;
                        //result.Data.FinishTime = model.FinishTime;
                        //result.Data.LocationName = model.LocationName.ToUpper();
                        //result.Data.MaterialCode = model.MaterialCode.ToUpper();
                        //result.Data.LeftQuantity = result.Data.LeftQuantity + (model.OrderQuantity - result.Data.OrderQuantity);
                        //result.Data.OrderQuantity = model.OrderQuantity;
                        //result.Data.OrderState = model.OrderState;
                        //result.Data.OrderType = model.OrderType;
                        //result.Data.Priority = model.Priority;
                        //result.Data.RevenueType = model.RevenueType;
                        //result.Data.StartTime = model.StartTime;
                        //result.Data.Description = model.Description;
                        //result.Data.Editor = User.Identity.Name;
                        //result.Data.EditTime = DateTime.Now;

                        rst = await client.ModifyAsync(result.Data);

                        if (rst.Code == 0)
                        {
                            rst.Message = string.Format(PPMResources.StringResource.WorkOrder_Save_Success
                                                        , model.OrderNumber);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                rst.Code    = 1000;
                rst.Message = ex.Message;
                rst.Detail  = ex.ToString();
            }

            return(Json(rst));
        }