Exemplo n.º 1
0
        public ActionResult SetDate(int id, DateTime?value)
        {
            var entity = DeliveryOrder.Find(id);

            if (entity.IsCompleted || entity.IsCancelled)
            {
                Response.StatusCode = 400;
                return(Content(Resources.ItemAlreadyCompletedOrCancelled));
            }

            entity.Updater          = CurrentUser.Employee;
            entity.ModificationTime = DateTime.Now;

            if (value != null)
            {
                entity.Date = value.Value;
            }
            else
            {
                entity.Date = null;
            }
            using (var scope = new TransactionScope()) {
                entity.UpdateAndFlush();
            }


            return(Json(new {
                id = id,
                value = entity.FormattedValueFor(x => x.Date)
            }));
        }
Exemplo n.º 2
0
        public ActionResult Edit(int id)
        {
            var item = DeliveryOrder.Find(id);

            if (item.IsCompleted || item.IsCancelled)
            {
                return(RedirectToAction("View", new { id = item.Id }));
            }

            if (!CashHelpers.ValidateExchangeRate())
            {
                return(View("InvalidExchangeRate"));
            }

            foreach (var detail in item.Details)
            {
                if (detail.Quantity > GetRemainQuantityBySalesOrderDetail(detail.OrderDetail))
                {
                    detail.Quantity = GetRemainQuantityBySalesOrderDetail(detail.OrderDetail);
                }
            }

            using (var scope = new TransactionScope()) {
                item.UpdateAndFlush();
            }

            return(View(item));
        }
Exemplo n.º 3
0
        public ActionResult Print(int id)
        {
            var item = DeliveryOrder.Find(id);

            if (WebConfig.DeliveryOrdersUseMiniPrinter)
            {
                return(PdfTicketView(WebConfig.DeliveryOrderTicket, item));
            }
            else
            {
                return(PdfView(WebConfig.DeliveryOrderTemplate, item));
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (RequestActionString == "batchdelete")
            {
                DoBatchDelete();
            }
            else if (RequestActionString == "markDelivery")
            {
                DeliveryOrder pc = DeliveryOrder.Find(this.RequestData.Get <string>("Id"));
                pc.State = "已出库";
                pc.Save();

                ////添加交易记录
                //TransactionHi his = new TransactionHi
                //{
                //    Child = pc.Child,
                //    CId = pc.CId,
                //    CName = pc.CName,
                //    CreateId = UserInfo.UserID,
                //    CreateName = UserInfo.Name,
                //    CreateTime = DateTime.Now,
                //    RtnOrOut = "购买",
                //    Number = pc.Number,
                //    TransactionTime = DateTime.Now
                //};
                //his.DoCreate();

                //自动计算客户余额
                //Customer custom = Customer.Find(pc.CId);
                //custom.PreDeposit = custom.PreDeposit - pc.TotalMoneyHis <= 0 ? 0 : custom.PreDeposit - pc.TotalMoneyHis;
                //custom.Save();

                //计算仓库数量
            }
            else if (RequestActionString == "print")
            {
                //Print();
            }
            else
            {
                DoSelect();
            }
        }
Exemplo n.º 5
0
        public ActionResult Delivered(int id)
        {
            DeliveryOrder order = DeliveryOrder.Find(id);

            if (!(order.IsCancelled || order.IsDelivered || order.Details.Any(x => x.OrderDetail.SalesOrder.IsCancelled)))
            {
                using (var scope = new TransactionScope()) {
                    order.IsDelivered      = true;
                    order.Updater          = CurrentUser.Employee;
                    order.ModificationTime = DateTime.Now;

                    foreach (var item in order.Details)
                    {
                        Helpers.InventoryHelpers.ChangeNotification(TransactionType.SalesOrder, order.Id,
                                                                    order.ModificationTime, WebConfig.PointOfSale.Warehouse, null, item.Product, -item.Quantity);
                    }

                    order.UpdateAndFlush();
                }
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 6
0
        public ActionResult SetComment(int id, string value)
        {
            var    entity = DeliveryOrder.Find(id);
            string val    = (value ?? string.Empty).Trim();

            if (entity.IsCompleted || entity.IsCancelled)
            {
                Response.StatusCode = 400;
                return(Content(Resources.ItemAlreadyCompletedOrCancelled));
            }

            entity.Comment          = (value.Length == 0) ? null : val;
            entity.Updater          = CurrentUser.Employee;
            entity.ModificationTime = DateTime.Now;

            using (var scope = new TransactionScope()) {
                entity.UpdateAndFlush();
            }

            return(Json(new {
                id = id,
                value = entity.Comment
            }));
        }
Exemplo n.º 7
0
        public ActionResult SetShipTo(int id, int value)
        {
            var entity = DeliveryOrder.Find(id);
            var item   = Address.TryFind(value);

            if (entity.IsCompleted || entity.IsCancelled)
            {
                Response.StatusCode = 400;
                return(Content(Resources.ItemAlreadyCompletedOrCancelled));
            }

            if (item != null)
            {
                entity.ShipTo           = item;
                entity.Updater          = CurrentUser.Employee;
                entity.ModificationTime = DateTime.Now;

                using (var scope = new TransactionScope()) {
                    entity.UpdateAndFlush();
                }
            }

            return(Json(new { id = id, value = entity.ShipTo.ToString() }));
        }
Exemplo n.º 8
0
        public ActionResult SetCustomer(int id, int value)
        {
            var entity   = DeliveryOrder.Find(id);
            var customer = Customer.TryFind(value);

            if (entity.IsCompleted || entity.IsCancelled)
            {
                Response.StatusCode = 400;
                return(Content(Resources.ItemAlreadyCompletedOrCancelled));
            }

            if (customer == null)
            {
                Response.StatusCode = 400;
                return(Content(Resources.CustomerNotFound));
            }

            entity.ShipTo           = null;
            entity.Customer         = customer;
            entity.Updater          = CurrentUser.Employee;
            entity.ModificationTime = DateTime.Now;

            foreach (var detail in entity.Details)
            {
                detail.Delete();
            }

            using (var scope = new TransactionScope()) {
                entity.UpdateAndFlush();
            }

            return(Json(new {
                id = id,
                value = entity.FormattedValueFor(x => x.Customer)
            }));
        }
Exemplo n.º 9
0
        string type  = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            string db = ConfigurationManager.AppSettings["ExamineDB"];

            op    = RequestData.Get <string>("op");
            id    = RequestData.Get <string>("id");
            paids = RequestData.Get <string>("paids");
            type  = RequestData.Get <string>("type");

            DeliveryOrder  ent     = null;
            IList <string> strList = RequestData.GetList <string>("data");

            PageState.Add("Id", "");

            switch (this.RequestAction)
            {
            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent     = this.GetPostedData <DeliveryOrder>();
                ent.PId = paids;

                //自动生成流水号
                ent.Number = DataHelper.QueryValue("select " + db + ".dbo.fun_getDeliveryNumber()") + "";

                ent.DoCreate();

                //更新销售单状态(放到保存的地方)
                if (!string.IsNullOrEmpty(paids))
                {
                    GetDeliveryState(strList, paids);
                }

                //添加出库商品信息
                InsertPart(strList, ent.Id);

                PageState["Id"] = ent.Id;
                this.SetMessage("新建成功!");
                break;

            default:
                break;
            }

            if (RequestActionString == "getSalesman")
            {
                string   cid      = RequestData.Get <string>("CId");
                Customer customer = Customer.Find(cid);
                if (customer != null)
                {
                    PageState.Add("result", customer.MagUser);
                    PageState.Add("MagId", customer.MagId);
                    PageState.Add("Address", customer.Address);
                    // PageState.Add("Tel", customer.Tel);
                    PageState.Add("Code", customer.Code);
                }
            }
            else if (RequestActionString == "checkdata")
            {
                string productIds  = RequestData.Get <string>("productIds");
                string WarehouseId = RequestData.Get <string>("WarehouseId");
                if (!string.IsNullOrEmpty(productIds))
                {
                    int count = DataHelper.QueryValue <int>("select count(1) from " + db + "..StockInfo where WarehouseId='" + WarehouseId + "' and ProductId in ('" + productIds.Replace(",", "','") + "')");
                    if (count != productIds.Split(',').Length)
                    {
                        PageState.Add("error", "所选商品在指定仓库里没有找到,请重新选择");
                    }
                }
            }
            //销售订单生成销售出库单
            else if (op == "c" && !string.IsNullOrEmpty(paids))
            {
                string[]    oids = paids.Split(',');
                SaleOrder[] ents = SaleOrder.FindAllByPrimaryKeys(oids);

                if (ents.Length > 0)
                {
                    ents[0].Id     = "";
                    ents[0].Number = "自动生成";
                    //ents[0].Remark = "";
                    ents[0].State = "";
                    ents[0].Child = "[]";
                    this.SetFormData(ents[0]);
                }
            }
            else if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = DeliveryOrder.Find(id);
                }

                this.SetFormData(ent);
                this.PageState.Add("State", ent.State);
            }
            PageState.Add("DeliveryMode", SysEnumeration.GetEnumDict("DeliveryMode"));
        }
Exemplo n.º 10
0
        private void CreateLog()
        {
            IList <InWarehouseDetailDetail> iwddEnts = InWarehouseDetailDetail.FindAll();//入库

            foreach (InWarehouseDetailDetail iwddEnt in iwddEnts)
            {
                StockLog    slEnt = new StockLog();
                InWarehouse iwEnt = null;
                if (!string.IsNullOrEmpty(iwddEnt.InWarehouseDetailId))
                {
                    slEnt.InOrOutDetailId = iwddEnt.InWarehouseDetailId;
                    InWarehouseDetail iwdEnt = InWarehouseDetail.Find(iwddEnt.InWarehouseDetailId);
                    iwEnt = InWarehouse.Find(iwdEnt.InWarehouseId);
                }
                else
                {
                    slEnt.InOrOutDetailId = iwddEnt.OtherInWarehouseDetailId;
                    OtherInWarehouseDetail oiwdEnt = OtherInWarehouseDetail.Find(iwddEnt.OtherInWarehouseDetailId);
                    iwEnt = InWarehouse.Find(oiwdEnt.InWarehouseId);
                }
                slEnt.InOrOutBillNo = iwEnt.InWarehouseNo;
                slEnt.OperateType   = "产品入库";
                slEnt.WarehouseId   = iwEnt.WarehouseId;
                slEnt.WarehouseName = iwEnt.WarehouseName;
                //IList<StockInfo> siEnts = StockInfo.FindAllByProperties(StockInfo.Prop_ProductId, iwddEnt.ProductId, StockInfo.Prop_WarehouseId, iwEnt.WarehouseId);
                //if (siEnts.Count > 0)
                //{
                //    slEnt.StockQuantity = siEnts[0].StockQuantity;
                //}
                slEnt.Quantity  = iwddEnt.Quantity;
                slEnt.ProductId = iwddEnt.ProductId;
                Product pEnt = Product.TryFind(iwddEnt.ProductId);
                if (pEnt != null)
                {
                    slEnt.ProductName = pEnt.Name;
                    slEnt.ProductCode = pEnt.Code;
                    slEnt.ProductIsbn = pEnt.Isbn;
                    slEnt.ProductPcn  = pEnt.Pcn;
                    slEnt.CreateId    = iwddEnt.CreateId;
                    slEnt.CreateName  = iwddEnt.CreateName;
                    slEnt.CreateTime  = iwddEnt.CreateTime;
                    slEnt.DoCreate();
                }
            }
            //生成出库日志
            IList <DelieryOrderPart> dopEnts = DelieryOrderPart.FindAllByProperty(DelieryOrderPart.Prop_State, "已出库");

            foreach (DelieryOrderPart dopEnt in dopEnts)
            {
                StockLog slEnt = new StockLog();
                slEnt.InOrOutDetailId = dopEnt.Id;
                DeliveryOrder doEnt = DeliveryOrder.Find(dopEnt.DId);
                slEnt.InOrOutBillNo = doEnt.Number;
                slEnt.OperateType   = "产品出库";
                slEnt.WarehouseId   = doEnt.WarehouseId;
                slEnt.WarehouseName = doEnt.WarehouseName;
                //IList<StockInfo> siEnts = StockInfo.FindAllByProperties(StockInfo.Prop_ProductId, iwddEnt.ProductId, StockInfo.Prop_WarehouseId, iwEnt.WarehouseId);
                //if (siEnts.Count > 0)
                //{
                //    slEnt.StockQuantity = siEnts[0].StockQuantity;
                //}
                slEnt.Quantity = dopEnt.OutCount;
                if (!string.IsNullOrEmpty(dopEnt.ProductId))
                {
                    slEnt.ProductId = dopEnt.ProductId;
                    Product pEnt = Product.TryFind(dopEnt.ProductId);
                    if (pEnt != null)
                    {
                        slEnt.ProductName = pEnt.Name;
                        slEnt.ProductCode = pEnt.Code;
                        slEnt.ProductIsbn = pEnt.Isbn;
                        slEnt.ProductPcn  = pEnt.Pcn;
                        slEnt.CreateId    = dopEnt.CreateId;
                        slEnt.CreateName  = dopEnt.CreateName;
                        slEnt.CreateTime  = dopEnt.CreateTime;
                        slEnt.DoCreate();
                    }
                }
            }
            //盘点操作库存日志
            string sql = "select * from SHHG_AimExamine..StockCheckDetail where StockCheckResult!='正常' and StockCheckState='盘点结束'";
            IList <EasyDictionary> scdDics = DataHelper.QueryDictList(sql);

            foreach (EasyDictionary scdDic in scdDics)
            {
                StockLog slEnt = new StockLog();
                slEnt.InOrOutDetailId = scdDic.Get <string>("Id");
                StockCheck scEnt = StockCheck.Find(scdDic.Get <string>("StockCheckId"));
                slEnt.InOrOutBillNo = scEnt.StockCheckNo;
                slEnt.OperateType   = "库存盘点";
                slEnt.WarehouseId   = scEnt.WarehouseId;
                slEnt.WarehouseName = scEnt.WarehouseName;
                slEnt.StockQuantity = scdDic.Get <Int32>("StockQuantity");
                slEnt.Quantity      = scdDic.Get <Int32>("StockCheckQuantity") - scdDic.Get <Int32>("StockQuantity");
                slEnt.ProductId     = scdDic.Get <string>("ProductId");
                Product pEnt = Product.TryFind(slEnt.ProductId);
                if (pEnt != null)
                {
                    slEnt.ProductName = pEnt.Name;
                    slEnt.ProductCode = pEnt.Code;
                    slEnt.ProductIsbn = pEnt.Isbn;
                    slEnt.ProductPcn  = pEnt.Pcn;
                    slEnt.CreateId    = scEnt.CreateId;
                    slEnt.CreateName  = scEnt.CreateName;
                    slEnt.CreateTime  = scEnt.CreateTime;
                    slEnt.DoCreate();
                }
            }
        }
Exemplo n.º 11
0
        public ViewResult View(int id)
        {
            var item = DeliveryOrder.Find(id);

            return(View(item));
        }
Exemplo n.º 12
0
        public ActionResult Items(int id)
        {
            var item = DeliveryOrder.Find(id);

            return(PartialView("_Items", item.Details));
        }
Exemplo n.º 13
0
        public ActionResult AddItems(int id, string value)
        {
            var        entity         = DeliveryOrder.Find(id);
            SalesOrder sales_order    = null;
            int        sales_order_id = 0;
            int        count          = 0;

            if (entity.IsCompleted || entity.IsCancelled)
            {
                Response.StatusCode = 400;
                return(Content(Resources.ItemAlreadyCompletedOrCancelled));
            }

            if (int.TryParse(value, out sales_order_id))
            {
                sales_order = SalesOrder.TryFind(sales_order_id);
            }

            if (sales_order == null)
            {
                Response.StatusCode = 400;
                return(Content(Resources.SalesOrderNotFound));
            }

            if (sales_order.IsCancelled)
            {
                Response.StatusCode = 400;
                return(Content(Resources.ItemAlreadyCompletedOrCancelled));
            }

            if (sales_order.IsDelivered)
            {
                Response.StatusCode = 400;
                return(Content(Resources.Delivered));
            }

            if (sales_order.Customer != entity.Customer)
            {
                Response.StatusCode = 400;
                return(Content(string.Format(Resources.MismatchCustomers, Resources.SalesOrder, Resources.DeliveryOrder)));
            }

            var Details = sales_order.Details.Where(x => !entity.Details.Any(y => y.OrderDetail == x)).ToList();

            if (!(Details.Count() > 0))
            {
                Response.StatusCode = 400;
                return(Content(Resources.ItemAlreadyCompletedOrCancelled));
            }


            using (var scope = new TransactionScope()) {
                foreach (var x in Details.Where(y => GetRemainQuantityBySalesOrderDetail(y) > 0.0m))
                {
                    var item = new DeliveryOrderDetail {
                        DeliveryOrder = entity,
                        Product       = x.Product,
                        OrderDetail   = x,
                        ProductCode   = x.ProductCode,
                        ProductName   = x.ProductName,
                        Quantity      = GetRemainQuantityBySalesOrderDetail(x)
                    };

                    item.Create();
                    count++;
                }
            }


            return(Json(new { id = id, value = string.Empty, itemsChanged = count }));
        }
Exemplo n.º 14
0
        public ActionResult PrintFormat(int id)
        {
            var item = DeliveryOrder.Find(id);

            return(PdfView(WebConfig.DeliveryOrderTemplate, item));
        }
Exemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string db = ConfigurationManager.AppSettings["ExamineDB"];

            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");
            DeliveryOrder  ent     = null;
            IList <string> strList = RequestData.GetList <string>("data");

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <DeliveryOrder>();
                if (type == "xg")
                {
                    ent.DoUpdate();
                }
                else if (type == "ck")
                {
                    UpdateStockInfo(strList, ent);      //更新库存及唯一编号
                    if (ent.DeliveryType == "换货出库")
                    {
                        ChangeProduct dorder = ChangeProduct.TryFind(ent.PId);
                        if (dorder != null)
                        {
                            if ((dorder.State + "").Contains("已入库"))
                            {
                                dorder.State = "已完成";
                            }
                            else
                            {
                                dorder.State += ",仓库已出库:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                            }
                            dorder.DoSave();
                        }
                    }
                    //更新子商品信息(先删除,再添加)
                    DelieryOrderPart.DeleteAll("DId='" + ent.Id + "'");     //删除DeliveryOrderPart
                    //添加出库商品信息并更新出库单状态
                    ent.State = InsertPart(strList, ent.Id);
                    ent.DoUpdate();
                    if (ent.DeliveryType == "调拨出库")    //add by phg 20120519 跟出库单的状态保持一致
                    {
                        WarehouseExchange weEnt = WarehouseExchange.Find(ent.PId);
                        weEnt.OutWarehouseState = ent.State;
                        weEnt.DoUpdate();
                    }
                    //更新SaleOrder表出库状态
                    DataHelper.ExecSql("update " + db + "..SaleOrders set DeState=" + db + ".dbo.fun_getDeliveryState(Id) where id='" + ent.PId + "'");
                }
                break;

            default:
                break;
            }
            if (RequestActionString == "getSalesman")
            {
                string   cid      = RequestData.Get <string>("CId");
                Customer customer = Customer.Find(cid);
                if (customer != null)
                {
                    PageState.Add("MagUser", customer.MagUser);
                    PageState.Add("MagId", customer.MagId);
                    PageState.Add("Address", customer.Address);
                    // PageState.Add("Tel", customer.Tel);
                    PageState.Add("Code", customer.Code);
                }
            }
            //根据压缩机唯一Id获取压缩机条码
            else if (RequestActionString == "getprobyguid")
            {
                //string isbn = DataHelper.QueryValue("select ModelNo from " + db + "..Compressor where SeriesNo='" + RequestData.Get<string>("isbn") + "'") + "";

                string isbn = DataHelper.QueryValue("select ModelNo from " + db + "..v_Compressor where SeriesNo='" + RequestData.Get <string>("Guid") + "' and ([State] is null or [State]<>'已出库')") + "";
                PageState.Add("isbn", isbn);
            }
            //获取压缩机整版的数量及GUIDS
            else if (RequestActionString == "getprobyboxnum")
            {
                string boxnum = RequestData.Get <string>("boxnum");
                string isbn   = DataHelper.QueryValue("select ModelNo from " + db + "..v_Compressor where SkinNo='" + boxnum + "' and ([State] is null or [State]<>'已出库')") + "";
                string count  = DataHelper.QueryValue("select count(1) from " + db + "..v_Compressor where SkinNo='" + boxnum + "' and ([State] is null or [State]<>'已出库')") + "";
                string guids  = DataHelper.QueryValue("select " + db + ".dbo.fun_getGuids('" + boxnum + "')") + "";

                PageState.Add("isbn", isbn);
                PageState.Add("count", count);
                PageState.Add("guids", guids);
            }
            //获取配件箱子所包含的配件数量
            else if (RequestActionString == "getPJbyboxnum")
            {
                string boxnum = RequestData.Get <string>("boxnum");
                sql = "select * from SHHG_AimExamine..Products where FirstSkinIsbn='" + boxnum + "' and FirstSkinCapacity is not null";
                IList <EasyDictionary> dics = DataHelper.QueryDictList(sql);
                if (dics.Count > 0)
                {
                    PageState.Add("isbn", dics[0].Get <string>("Isbn"));
                    PageState.Add("count", dics[0].Get <int>("FirstSkinCapacity"));
                }
                sql  = "select * from SHHG_AimExamine..Products where SecondSkinIsbn='" + boxnum + "' and SecondSkinCapacity is not null";
                dics = DataHelper.QueryDictList(sql);
                if (dics.Count > 0)
                {
                    PageState.Add("isbn", dics[0].Get <string>("Isbn"));
                    PageState.Add("count", dics[0].Get <int>("SecondSkinCapacity"));
                }
            }
            else if (RequestActionString == "getguids")
            {
                string guids = DataHelper.QueryValue("select " + db + ".dbo.fun_getGuids('" + RequestData.Get <string>("SkinNo") + "'," + RequestData.Get <string>("Count") + ")") + "";
                PageState.Add("guids", guids);
            }
            else if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = DeliveryOrder.Find(id);
                }
                SetFormData(ent);
                PageState.Add("State", ent.State);
                //查询子商品
                sql = "select p.Id, PId, PCode as Code, ProductId, PName as Name, c.ProductType, p.Isbn, Guids, Count,Count-(isnull(OutCount,0)) as dck, isnull(OutCount,0) as OutCount, p.Unit, p.Remark, FirstSkinIsbn,Count*(c.Weight) as TotalWeight," + db + ".dbo.fun_getProQuantity(ProductId) as StockQuan," + db + ".dbo.fun_getProQuantityByWarehouseId(ProductId,'" + ent.WarehouseId + "') as BenStockQuan from " + db + "..DelieryOrderPart p "
                      + " left join " + db + "..Products c on c.Id=p.ProductId  where DId='" + id + "'";
                PageState.Add("DetailList", DataHelper.QueryDictList(sql));
            }
            PageState.Add("DeliveryMode", SysEnumeration.GetEnumDict("DeliveryMode"));
        }
Exemplo n.º 16
0
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            string db = ConfigurationManager.AppSettings["ExamineDB"];

            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            paid = RequestData.Get <string>("paid");
            type = RequestData.Get <string>("type");

            DeliveryOrder  ent     = null;
            IList <string> strList = RequestData.GetList <string>("data");

            switch (this.RequestAction)
            {
            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent     = this.GetPostedData <DeliveryOrder>();
                ent.PId = paid;

                //自动生成流水号
                ent.Number = DataHelper.QueryValue("select " + db + ".dbo.fun_getDeliveryNumber()") + "";

                ent.DoCreate();

                //添加出库商品信息
                InsertPart(strList, ent.Id);

                break;

            default:
                break;
            }

            if (RequestActionString == "getSalesman")
            {
                string   cid      = RequestData.Get <string>("CId");
                Customer customer = Customer.Find(cid);
                if (customer != null)
                {
                    PageState.Add("result", customer.MagUser);
                    PageState.Add("MagId", customer.MagId);
                    PageState.Add("Address", customer.Address);
                    //PageState.Add("Tel", customer.Tel);
                    PageState.Add("Code", customer.Code);
                }
            }
            else if (RequestActionString == "checkdata")
            {
                string productIds  = RequestData.Get <string>("productIds");
                string WarehouseId = RequestData.Get <string>("WarehouseId");
                if (!string.IsNullOrEmpty(productIds))
                {
                    int count = DataHelper.QueryValue <int>("select count(1) from " + db + "..StockInfo where WarehouseId='" + WarehouseId + "' and ProductId in ('" + productIds.Replace(",", "','") + "')");
                    if (count != productIds.Split(',').Length)
                    {
                        PageState.Add("error", "所选商品在指定仓库里没有找到,请重新选择");
                    }
                }
            }
            else if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = DeliveryOrder.Find(id);
                }

                this.SetFormData(ent);
                this.PageState.Add("State", ent.State);

                if (!String.IsNullOrEmpty(id))
                {
                    //查询子商品
                    string sql = "select Id, PCode as Code, PName as Name, ProductId,Isbn, Guids, Count as OutCount, Unit, Remark from " + db + "..DelieryOrderPart where DId='" + id + "'";
                    PageState.Add("DetailList", DataHelper.QueryDictList(sql));
                }
            }
            PageState.Add("DeliveryMode", SysEnumeration.GetEnumDict("DeliveryMode"));
        }