Ejemplo n.º 1
0
        //创建退货单
        public FormReturnOrder(PurchaseCommonEntity order, List <PurchaseOrderReturnDetailEntity> orderDetails)
            : this()
        {
            _order.Description           = "";
            _order.PurchaseOrderId       = order.PurchaseOrderId;
            _order.OperateUserId         = AppClientContext.CurrentUser.Id;
            _order.CheckerEmployeeName   = AppClientContext.CurrentUser.Employee.Name;
            _order.CheckerEmployeeNumber = AppClientContext.CurrentUser.Employee.Number;
            _order.SupplyUnitId          = order.SupplyUnitId;
            _order.SupplyUnitName        = order.SupplyUnitName;
            _order.OrderStatus           = (int)OrderReturnStatus.Waitting;
            foreach (PurchaseOrderReturnDetailEntity d in orderDetails)
            {
                PurchaseOrderReturnDetailEntity c = new PurchaseOrderReturnDetailEntity();
                c.DictionaryDosageCode      = d.DictionaryDosageCode;
                c.FactoryName               = d.FactoryName;
                c.IsReissue                 = true;
                c.PurchaseReturnSourceValue = 2;
                c.ReissueAmount             = 0;
                c.RelatedOrderId            = d.RelatedOrderId;
                c.ReturnAmount              = 0;
                c.ReturnHandledMethodValue  = (int)ReturnHandledMethod.ReturnDestroy;
                c.ReturnReason              = "正常退货";
                c.Origin                        = d.Decription;
                c.Decription                    = "";
                c.ProductGeneralName            = d.ProductGeneralName;
                c.DictionarySpecificationCode   = d.DictionarySpecificationCode;
                c.DictionaryMeasurementUnitCode = d.DictionaryMeasurementUnitCode;
                c.LicensePermissionNumber       = d.LicensePermissionNumber;
                c.OutValidDate                  = d.OutValidDate;
                c.PruductDate                   = d.PruductDate;
                c.DrugInfoId                    = d.DrugInfoId;
                c.BatchNumber                   = d.BatchNumber;
                c.PurchasePrice                 = d.PurchasePrice;
                c.CanReturnNum                  = d.CanReturnNum;
                c.inInventoryNum                = d.inInventoryNum;
                _orderDetails.Add(c);
            }
            #region 合并数据
            //var o = from i in _orderDetails group i by new { i.BatchNumber, i.DrugInfoId };
            //List<PurchaseOrderReturnDetailEntity> a = new List<PurchaseOrderReturnDetailEntity>();

            //foreach (var g in o)
            //{
            //    var ll = g.First();
            //    ll.ReturnAmount = g.Sum(r => r.ReturnAmount);
            //    a.Add(ll);
            //}
            #endregion
            Initial(true);
            tsbtnFinanceDepartmentApproved.Visible = false;
            tsbtnGeneralManagerApproved.Visible    = false;
            tsbtnQualityrApproved.Visible          = false;
            label13.Text  = order.SupplyUnitName;
            txt备注.Enabled = true;
        }
Ejemplo n.º 2
0
        public PurchaseOrderReturnDetailEntity[] getPurchaseInventoryDetatilEntity(Guid id)
        {
            List <PurchaseOrderReturnDetailEntity> l    = new List <PurchaseOrderReturnDetailEntity>();
            PurchaseOrderReturnDetailEntity        pord = null;
            var pid = this.Queryable;
            //List<DrugInfo> drugList = RepositoryProvider.Db.DrugInfos.ToList();

            var all  = pid.Where(r => r.PurchaseOrderId == id).Include(r => r.PurchaseInInventeryOrderDetails);
            var piio = all.ToList().FirstOrDefault();

            var c = RepositoryProvider.Db.PurchaseCheckingOrderDetails.Where(r => r.PurchaseCheckingOrderId == piio.RelatedOrderId).ToList();

            foreach (var d in c)
            {
                var f = d;
                var i = piio.PurchaseInInventeryOrderDetails.Where(r => r.DrugInfoId == f.DrugInfoId && r.BatchNumber == f.BatchNumber).ToList().First();
                var h = RepositoryProvider.Db.DrugInfos.Where(r => r.Id == i.DrugInfoId).ToList().First();

                pord                                = new PurchaseOrderReturnDetailEntity();
                pord.DrugInfoId                     = f.DrugInfoId;
                pord.BatchNumber                    = f.BatchNumber;
                pord.Decription                     = f.Decription;
                pord.DictionaryDosageCode           = h.DictionaryDosageCode;
                pord.DictionaryMeasurementUnitCode  = h.DictionaryMeasurementUnitCode;
                pord.DictionarySpecificationCode    = h.DictionarySpecificationCode;
                pord.DrugInfoId                     = f.DrugInfoId;
                pord.FactoryName                    = h.FactoryName;
                pord.Id                             = Guid.NewGuid();
                pord.IsReissue                      = false;
                pord.LicensePermissionNumber        = h.LicensePermissionNumber;
                pord.OutValidDate                   = f.OutValidDate;
                pord.ProductGeneralName             = h.ProductGeneralName;
                pord.PruductDate                    = f.PruductDate;
                pord.PurchaseOrderReturnId          = new Guid();
                pord.PurchasePrice                  = f.PurchasePrice;
                pord.PurchaseReturnSourceString     = "库存";
                pord.PurchaseReturnSourceValue      = 0;
                pord.ReissueAmount                  = 0;
                pord.RelatedOrderId                 = piio.Id;
                pord.ReturnAmount                   = 0;
                pord.ReturnHandledMethodValue       = 0;
                pord.ReturnHandledMethodValueString = "";
                pord.ReturnReason                   = "";
                l.Add(pord);
            }
            return(l.ToArray());
        }