コード例 #1
0
ファイル: PurchaseHistory.cs プロジェクト: NH4CL/UniProject
 /// <summary>
 /// 复制采购单成老版本
 /// </summary>
 public PurchaseHistory(PurchaseInformation oPurchase)
 {
     // TODO
 }
コード例 #2
0
 public StockInBill(WarehouseStockIn oStockIn, PurchaseInformation oPurchase, List<StockInSkuAndPurchase> oInSkuAndPurchase)
 {
     this.oStockIn = oStockIn;
     this.oPurchase = oPurchase;
     this.oInSkuAndPurchase = oInSkuAndPurchase;
 }
コード例 #3
0
 public StockInBill(WarehouseStockIn oStockIn, OrderInformation oOrder, List<StockInSku> oStockInSkus,PurchaseInformation oPurchase, List<StockInSkuAndPurchase> oInSkuAndPurchase)
 {
     this.oStockIn = oStockIn;
     this.oOrder = oOrder;
     this.oStockInSkus = oStockInSkus;
     this.oPurchase = oPurchase;
     this.oInSkuAndPurchase = oInSkuAndPurchase;
 }
コード例 #4
0
        public ActionResult PurchaseDetail(PurchaseInformation purinfo)
        {
            PurchaseInformation newpurinfo;
            if (gPurId.ToString().Equals("00000000-0000-0000-0000-000000000000"))
            {
                CultureInfo culture = new CultureInfo(CurrentSession.Culture);
                ViewBag.datePattern = culture.DateTimeFormat.ShortDatePattern;
                //culture.DateTimeFormat.ShortDatePattern
                newpurinfo = new PurchaseInformation();
                newpurinfo.OrgID = OrgIdSelect;
                newpurinfo.WhID = purinfo.WhID;
                newpurinfo.Pstatus = purinfo.Pstatus;
                //newpurinfo.Ptype = purinfo.Ptype;    //采购类型暂时缺少
                newpurinfo.aSupplier = purinfo.aSupplier;
                newpurinfo.Discount = purinfo.Discount;
                newpurinfo.aCurrency = purinfo.aCurrency;
                newpurinfo.CalcMode = purinfo.CalcMode;
                //newpurinfo.Quantity = purinfo.Quantity;
                //newpurinfo.Amount = purinfo.Amount;
                newpurinfo.Brief = purinfo.Brief;
                newpurinfo.DocVersion = 0;
                nCalmode = purinfo.CalcMode;
                newpurinfo.etd = purinfo.etd;
                newpurinfo.atd = purinfo.atd;
                newpurinfo.eta = purinfo.eta;
                newpurinfo.ata = purinfo.ata;
                newpurinfo.PortDate = purinfo.PortDate;
                newpurinfo.Discount = purinfo.Discount;
                //newpurinfo.etd = DateTimeOffset.Parse(purinfo.etd.Value.ToString(ViewBag.datePattern));
                //newpurinfo.atd = DateTimeOffset.Parse(purinfo.atd.Value.ToString(ViewBag.datePattern));
                //newpurinfo.eta = DateTimeOffset.Parse(purinfo.eta.Value.ToString(ViewBag.datePattern));
                //newpurinfo.ata = DateTimeOffset.Parse(purinfo.ata.Value.ToString(ViewBag.datePattern));
                //newpurinfo.PortDate = DateTimeOffset.Parse(purinfo.PortDate.Value.ToString(ViewBag.datePattern));
                dbEntity.PurchaseInformations.Add(newpurinfo);
                dbEntity.SaveChanges();
                gPurId = newpurinfo.Gid;
                return RedirectToAction("EditPurchaseDetail");
            }
            else
            {
                newpurinfo = dbEntity.PurchaseInformations.Include("Currency").Include("PurchaseType").Include("Supplier").Include("Warehouse").Include("Organization").
                            Where(o => o.Gid == gPurId && o.Deleted == false).Single();
                CultureInfo culture = new CultureInfo(CurrentSession.Culture);
                ViewBag.datePattern = culture.DateTimeFormat.ShortDatePattern;
                //culture.DateTimeFormat.ShortDatePattern

                newpurinfo.aCurrency = purinfo.aCurrency;
                newpurinfo.Pstatus = purinfo.Pstatus;
                newpurinfo.Discount = purinfo.Discount;
                newpurinfo.CalcMode = purinfo.CalcMode;
                newpurinfo.Quantity = purinfo.Quantity;
                newpurinfo.Amount = purinfo.Amount;
                newpurinfo.Brief = purinfo.Brief;
                newpurinfo.DocVersion =  newpurinfo.DocVersion + 1;
                newpurinfo.Hanged = purinfo.Hanged;
                nCalmode = purinfo.CalcMode;
                //string stretd = purinfo.etd.Value.ToString("yyyy/M/d");
                //DateTimeOffset dateetd = DateTimeOffset.Parse(stretd);
                newpurinfo.etd = purinfo.etd;
                newpurinfo.atd = purinfo.atd;
                newpurinfo.eta = purinfo.eta;
                newpurinfo.ata = purinfo.ata;
                newpurinfo.PortDate = purinfo.PortDate;
                newpurinfo.Discount = purinfo.Discount;
                //newpurinfo.etd = purinfo.etd.Value.ToString(ViewBag.datePattern);
                //newpurinfo.atd = DateTimeOffset.Parse( purinfo.atd.Value.ToString(ViewBag.datePattern) );
                //newpurinfo.eta = DateTimeOffset.Parse( purinfo.eta.Value.ToString(ViewBag.datePattern) );
                //newpurinfo.ata = DateTimeOffset.Parse( purinfo.ata.Value.ToString(ViewBag.datePattern) );
                //newpurinfo.PortDate = DateTimeOffset.Parse( purinfo.PortDate.Value.ToString(ViewBag.datePattern) );
                dbEntity.SaveChanges();

                return RedirectToAction("EditPurchaseDetail");
            }
        }
コード例 #5
0
        private static Guid WarehouseSelected = Guid.Empty; //选中的仓库

        #endregion Fields

        #region Methods

        //添加订单页面Get方法
        public ActionResult AddPurchaseDetail()
        {
            CultureInfo culture = new CultureInfo(CurrentSession.Culture);
            ViewBag.datePattern = culture.DateTimeFormat.ShortDatePattern;

            //货币下拉框
            List<SelectListItem> listorgunit = new List<SelectListItem>();
            var orgunit = dbEntity.MemberOrgCultures.Where(p => p.Deleted == false && p.Ctype == 1 && p.OrgID == OrgIdSelect).ToList();
            foreach (var i in orgunit)
            {
                SelectListItem item1 = new SelectListItem
                {
                    Text = i.Currency.Name.Matter,
                    Value = i.aCurrency.ToString()
                };
                listorgunit.Add(item1);
            }
            ViewBag.listorgunit = listorgunit;

            //供应商下拉框
            List<SelectListItem> osupplierlist = new List<SelectListItem>();
            var orgsupplier = dbEntity.PurchaseSuppliers.Where(p => p.Deleted == false && p.Otype == 3 && p.aParent == OrgIdSelect).ToList();
            foreach (var itemsupplier in orgsupplier)
            {
                SelectListItem item1 = new SelectListItem
                {
                    Text = itemsupplier.ShortName.Matter,
                    Value = itemsupplier.Gid.ToString()
                };
                osupplierlist.Add(item1);
            }
            ViewBag.osupplierlist = osupplierlist;

            //仓库下拉框
            List<SelectListItem> owarehouselist = new List<SelectListItem>();
            var orgwarehouse = dbEntity.WarehouseInformations.Where(p => p.Deleted == false && p.Otype == 2 && p.aParent == OrgIdSelect).ToList();
            foreach (var itemwarehouse in orgwarehouse)
            {
                SelectListItem item1 = new SelectListItem
                {
                    Text = itemwarehouse.ShortName.Matter,
                    Value = itemwarehouse.Gid.ToString()
                };
                owarehouselist.Add(item1);
            }
            ViewBag.owarehouselist = owarehouselist;

            //订单状态下拉框
            PurchaseInformation opur = new PurchaseInformation();
            List<SelectListItem> ostatuslist = GetSelectList(opur.PurchaseStatusList);
            ViewBag.ostatuslist = ostatuslist;

            //挂起状态下拉框
            List<SelectListItem> ohangstatuslist = GetSelectList(opur.HangStatusList);
            ViewBag.ohangstatuslist = ohangstatuslist;

            //金额结算方式下拉框
            List<SelectListItem> ocalmodelist = GetSelectList(opur.CalcModeList);
            ViewBag.ocalmodelist = ocalmodelist;

            //采购类型下拉框
            List<GeneralPrivateCategory> oPurchases = dbEntity.GeneralPrivateCategorys.Where(p => p.Deleted == false && p.OrgID == OrgIdSelect && p.Ctype == (byte)ModelEnum.PrivateCategoryType.PURCHASE).ToList();
            List<SelectListItem> PurchaseTypeList = new List<SelectListItem>();
            foreach (GeneralPrivateCategory item in oPurchases)
            {
                PurchaseTypeList.Add(new SelectListItem { Text = item.Code, Value = item.Gid.ToString() });
            }
            ViewBag.purchaseTypeList = PurchaseTypeList;
            return View();
        }
コード例 #6
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="OrgId">级联组织</param>
        /// <returns></returns>
        public ActionResult Index(Guid? OrgId = null)
        {
            // 权限验证
            string strProgramCode = Request.RequestContext.RouteData.Values["Controller"].ToString() +
                Request.RequestContext.RouteData.Values["Action"].ToString();
            if (!base.Permission(strProgramCode))
                return RedirectToAction("ErrorPage", "Home", new { message = LiveAzure.Resource.Common.NoPermission });

            gPurId = new Guid("00000000-0000-0000-0000-000000000000");
            nLocking = -1;//锁定状态
            gPstatus = -1;//确定状态
            gHstatus = -1;//挂起状态
            gSearchStr  = "";
            nAll = 1;
            Guid? userID = CurrentSession.UserID;
            //生成组织下拉列表
            if (userID != null)
            {
                //获取用户所属组织---一个用户可能属于多个组织
                var userOrgId = dbEntity.MemberUsers.Where(p => p.Deleted == false && p.Gid == userID).Select(p => p.OrgID).FirstOrDefault();
                gOrgPurId = userOrgId;
                OrgIdSelect = OrgId == null ? userOrgId : (Guid)OrgId;//赋值所选中的组织
                List<SelectListItem> memOrgs = new List<SelectListItem>();

                var memOrg = dbEntity.MemberOrganizations.Where(s => s.Deleted == false && s.Gid == userOrgId).FirstOrDefault();
                SelectListItem item = new SelectListItem();
                item.Value = userOrgId.ToString();
                item.Text = memOrg.FullName.GetResource(CurrentSession.Culture);
                item.Selected = OrgId == null ? true : false;//默认用户所属组织为已选中值
                memOrgs.Add(item);

                //获取当前登录用户所授权的组织,如果是admin,则所有组织都被授权
                var nowuser = dbEntity.MemberUsers.Where(p => p.Deleted == false && p.Gid == userID).Single();
                if (nowuser.Role.Code == "Supervisor")
                {
                    var allmem = dbEntity.MemberOrganizations.Where(s => s.Deleted == false).ToList();
                    foreach (var item1 in allmem)
                    {
                        if (item1.Gid == userOrgId)
                        {
                            continue;
                        }
                        item = new SelectListItem();
                        if (item1.Gid == OrgId)
                        {
                            item.Selected = true;
                        }
                        item.Value = item1.Gid.ToString();
                        item.Text = item1.FullName.GetResource(CurrentSession.Culture);
                        memOrgs.Add(item);
                    }
                }
                else
                {
                    var memPrivOrg = dbEntity.MemberPrivileges.Where(p => p.Deleted == false && p.UserID == userID && p.Ptype == 2 && p.Pstatus == 1).FirstOrDefault();
                    if (memPrivOrg != null)
                    {
                        var privOrgs = dbEntity.MemberPrivItems.Where(p => p.Deleted == false && p.PrivID == memPrivOrg.Gid).Select(p => p.RefID).ToList();
                        foreach (Guid gid in privOrgs)
                        {
                            if (gid == userOrgId)
                            {
                                continue;
                            }
                            memOrg = dbEntity.MemberOrganizations.Where(s => s.Deleted == false && s.Gid == gid).Single();
                            item = new SelectListItem();
                            if (gid == OrgId)
                                item.Selected = true;
                            item.Value = gid.ToString();
                            item.Text = memOrg.FullName.GetResource(CurrentSession.Culture);
                            memOrgs.Add(item);
                        }
                    }
                }
                ViewData["orgCode"] = memOrgs;
            }
            //生成仓库列表
            List<WarehouseInformation> warehouses = dbEntity.WarehouseInformations.Where(p => p.Deleted == false && p.Otype == (byte)ModelEnum.OrganizationType.WAREHOUSE && p.aParent == (OrgId==null? gOrgPurId:OrgId)).ToList();
            if (WarehouseSelected == null || WarehouseSelected == Guid.Empty)
            {
                    WarehouseSelected = warehouses.Select(p => p.Gid).FirstOrDefault();
            }
            List<SelectListItem> warehouseList = new List<SelectListItem>();
            foreach (WarehouseInformation item in warehouses)
            {
                if (item.Gid == WarehouseSelected)
                    warehouseList.Add(new SelectListItem { Text = item.FullName.GetResource(CurrentSession.Culture), Value = item.Gid.ToString(), Selected = true });
                else
                    warehouseList.Add(new SelectListItem { Text = item.FullName.GetResource(CurrentSession.Culture), Value = item.Gid.ToString(), Selected = false });
            }
            ViewBag.WarehouseList = warehouseList;
            //生成Locking状态下拉表
            PurchaseInformation purchaseInfo = new PurchaseInformation();
            List<SelectListItem> plockinglist = GetSelectList(purchaseInfo.LockStatusList);
            ViewBag.plockinglist = plockinglist;

            //生成PStatus状态下拉列表
            //PurchaseInformation purchaseInfo = (dbEntity.PurchaseInformations.Where(o => o.Deleted == false)).FirstOrDefault();
            List<SelectListItem> pstatuslist = GetSelectList(purchaseInfo.PurchaseStatusList);
            ViewBag.pstatuslist = pstatuslist;

            //生成Hanged状态下拉列表
            List<SelectListItem> hstatuslist = GetSelectList(purchaseInfo.HangStatusList);
            ViewBag.hstatuslist = hstatuslist;
            //允许制表
            ViewBag.EnablePrepare =(base.GetProgramNode("EnablePrepare") == "1") ? true : false;
            return View();
        }