Esempio n. 1
0
 public void SaveLocation(Sender sender, SaveLocationArgs args)
 {
     try
     {
         using (ObjectProxy op = new ObjectProxy(true))
         {
             Location obj = new Location();
             obj.LocationID = args.Location.LocationID;
             if (op.LoadLocationByLocationID(obj) == 0)
             {
                 args.Location.Created    = DateTime.Now;
                 args.Location.CreatedBy  = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 args.Location.Modified   = DateTime.Now;
                 args.Location.ModifiedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 op.InsertLocation(args.Location);
             }
             else
             {
                 args.Location.Modified   = DateTime.Now;
                 args.Location.ModifiedBy = string.Format("{0}.{1}", sender.UserCode, sender.UserName);
                 op.UpdateLocationByLocationID(args.Location);
             }
             op.CommitTransaction();
         }
     }
     catch (Exception ex)
     {
         PLogger.LogError(ex);
         throw ex;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 订单入库保存
        /// </summary>
        public void OrderCheckIn()
        {
            try
            {
                using (ProxyBE p = new ProxyBE())
                {
                    ProductWarehouseMain pw = new ProductWarehouseMain();
                    pw.InID    = Guid.NewGuid();
                    pw.BillNo  = Parm.BillNo;
                    pw.OrderID = Parm.OrderID;
                    SaveProductWarehouseArgs args = new SaveProductWarehouseArgs();
                    args.ProductWarehouseMain = pw;

                    SaveLocationArgs largs = new SaveLocationArgs();
                    //遍历详细页
                    List <ProductWarehouseDetail> listdetails = new List <ProductWarehouseDetail>();
                    string   InDetail = Request["InDetail"];
                    JsonData sj       = JsonMapper.ToObject(InDetail);
                    if (sj.Count > 0)
                    {
                        //遍历对象元素,保存
                        foreach (JsonData item in sj)
                        {
                            ProductWarehouseDetail detail = new ProductWarehouseDetail();
                            detail.InID       = pw.InID;
                            detail.DetailID   = Guid.NewGuid();
                            detail.PackageID  = Guid.Parse(item["PackageID"].ToString());
                            detail.LocationID = Guid.Parse(item["LocationID"].ToString());
                            listdetails.Add(detail);
                            args.ProductWarehouseDetails = listdetails;

                            //2.把该仓位占用、仓位放的包数、重量累计
                            Location location = p.Client.GetLocation(SenderUser, detail.LocationID);
                            location.PackageQty += 1;
                            location.Weight     += Convert.ToDecimal(item["Weight"].ToString());
                            location.Flag        = true;
                            largs.Location       = location;
                            p.Client.SaveLocation(SenderUser, largs);
                        }
                    }

                    //1.把订单状态改为待备货 O
                    Order order = p.Client.GetOrder(SenderUser, Parm.OrderID);
                    order.Status = "O";
                    SaveOrderArgs oargs = new SaveOrderArgs();
                    oargs.Order = order;
                    p.Client.SaveOrder(SenderUser, oargs);
                    p.Client.SaveProductWarehouse(SenderUser, args);
                }
                WriteSuccess();
            }
            catch (Exception ex)
            {
                WriteError(ex.Message, ex);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 保存仓位管理
 /// </summary>
 public void SaveLocation()
 {
     try
     {
         using (ProxyBE p = new ProxyBE())
         {
             if (parm.WarehouseID == Guid.Empty)
             {
                 throw new Exception("请选择对应所属仓库。");
             }
             SaveLocationArgs args     = new SaveLocationArgs();
             Location         location = p.Client.GetLocation(SenderUser, parm.LocationID);
             if (location == null)
             {
                 location            = new Location();
                 location.LocationID = parm.LocationID;
             }
             Category categoryid = p.Client.GetCategory(SenderUser, parm.WarehouseID);
             location.WarehouseID  = parm.WarehouseID;
             location.Category     = categoryid.CategoryName;
             location.LocationCode = parm.LocationCode;
             location.CabinetNum   = parm.CabinetNum;
             location.LayerNum     = parm.LayerNum;
             location.MaxWeight    = parm.MaxWeight;
             location.MaxPackage   = parm.MaxPackage;
             location.IsDisabled   = Convert.ToBoolean(parm.IsDisabled);
             args.Location         = location;
             p.Client.SaveLocation(SenderUser, args);
         }
         WriteSuccess();
     }
     catch (Exception ex)
     {
         WriteError(ex.Message, ex);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 订单出库产品保存
        /// </summary>
        public void SaveTransportMainOut()
        {
            try
            {
                using (ProxyBE p = new ProxyBE())
                {
                    TransportMain tm = new TransportMain();
                    tm.TransportID = Parm.TransportID;
                    tm.TransportNo = Parm.TransportNo;
                    tm.CarID       = Parm.CarID;
                    tm.Source      = Parm.Source;
                    tm.Target      = Parm.Target;
                    tm.Price       = Parm.Price;
                    SaveTransportArgs args = new SaveTransportArgs();
                    args.TransportMain = tm;

                    //遍历详细页
                    List <TransportDetail> listdetails = new List <TransportDetail>();
                    string   OutDetail = Request["OutDetail"];
                    JsonData sj        = JsonMapper.ToObject(OutDetail);
                    if (sj.Count > 0)
                    {
                        //遍历对象元素,保存
                        foreach (JsonData item in sj)
                        {
                            TransportDetail detail = new TransportDetail();
                            detail.TransportID = Parm.TransportID;
                            detail.OrderID     = Guid.Parse(item["OrderID"].ToString());
                            listdetails.Add(detail);

                            #region 1.改变订单状态
                            Order order = p.Client.GetOrder(SenderUser, Guid.Parse(item["OrderID"].ToString()));
                            order.Status = "F"; //已完成
                            SaveOrderArgs sargs = new SaveOrderArgs();
                            sargs.Order = order;
                            p.Client.SaveOrder(SenderUser, sargs);
                            #endregion

                            #region 2.把存放对应的订单的仓位 设置为不占用、包数设为0、重量设为0
                            SearchProductWarehouseDetailArgs pargs = new SearchProductWarehouseDetailArgs();
                            pargs.RowNumberFrom = pagingParm.RowNumberFrom;
                            pargs.RowNumberTo   = pagingParm.RowNumberTo;
                            pargs.OrderID       = Guid.Parse(item["OrderID"].ToString());
                            SearchResult sr = p.Client.SearchProductWarehouseDetail(SenderUser, pargs);
                            if (sr.Total > 0)
                            {
                                for (int i = 0; i < sr.DataSet.Tables[0].Rows.Count; i++)
                                {
                                    DataRow  dr       = sr.DataSet.Tables[0].Rows[i];
                                    Location location = p.Client.GetLocation(SenderUser, new Guid(dr["LocationID"].ToString()));
                                    location.Flag       = false;
                                    location.PackageQty = 0;
                                    location.Weight     = 0;

                                    SaveLocationArgs lags = new SaveLocationArgs();
                                    lags.Location = location;
                                    p.Client.SaveLocation(SenderUser, lags);
                                }
                            }
                            #endregion
                        }
                    }
                    args.TransportDetails = listdetails;
                    p.Client.SaveTransport(SenderUser, args);
                }
                WriteSuccess();
            }
            catch (Exception ex)
            {
                WriteError(ex.Message, ex);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 批量添加仓位
        /// </summary>
        public void SaveBattchLocation()
        {
            try
            {
                string Category = Request["Category"];
                if (Category == Guid.Empty.ToString())
                {
                    throw new Exception("请选择对应所属仓库。");
                }

                string CabinetNumCode = Request["CabinetNumCode"];
                string CabinetNumFrom = Request["CabinetNumFrom"];
                string CabinetNumTo   = Request["CabinetNumTo"];
                string LayerNumCode   = Request["LayerNumCode"];
                string LayerNumFrom   = Request["LayerNumFrom"];
                string LayerNumTo     = Request["LayerNumTo"];
                string MaxWeight      = Request["MaxWeight"];
                string MaxPackage     = Request["MaxPackage"];
                string Qty            = Request["Qty"];

                using (ProxyBE p = new ProxyBE())
                {
                    List <Location> Locations  = new List <Location>();
                    Category        categoryid = p.Client.GetCategory(SenderUser, Guid.Parse(parm.Category));

                    for (int i = int.Parse(CabinetNumFrom); i <= int.Parse(CabinetNumTo); i++)
                    {
                        for (int n = int.Parse(LayerNumFrom); n <= int.Parse(LayerNumTo); n++)
                        {
                            for (int m = 1; m <= int.Parse(Qty); m++)
                            {
                                string   CabinetNum = string.Format("{0}{1}", CabinetNumCode, i.ToString("000"));
                                string   LayerNum   = string.Format("{0}{1}", LayerNumCode, n.ToString("000"));
                                Location location   = new Location();
                                location.LocationID   = Guid.NewGuid();
                                location.Category     = categoryid.CategoryName;
                                location.WarehouseID  = Guid.Parse(Category);
                                location.LocationCode = string.Format("{0}-{1}-{2}", CabinetNum, LayerNum, m.ToString("000"));
                                location.CabinetNum   = CabinetNum;
                                location.LayerNum     = LayerNum;
                                location.MaxPackage   = int.Parse(MaxPackage);
                                location.MaxWeight    = int.Parse(MaxWeight);
                                location.IsDisabled   = false;
                                location.Flag         = false;
                                location.PackageQty   = 0;
                                location.Weight       = 0;
                                Locations.Add(location);
                                SaveLocationArgs args = new SaveLocationArgs();
                                args.Location = location;
                                p.Client.SaveLocation(SenderUser, args);
                            }
                        }
                    }
                }
                WriteSuccess();
            }
            catch (Exception ex)
            {
                PLogger.LogError(ex);
                WriteError(ex.Message, ex);
            }
        }