Beispiel #1
0
        /// <summary>
        /// 移库右键菜单
        /// </summary>
        /// <param name="sender">sender内含tag属性为warehousezone对象</param>
        /// <param name="e"></param>
        private void DrugInventoryMoveClick(object sender, EventArgs e)
        {
            WarehouseZone wz = ((ToolStripDropDownItem)sender).Tag as WarehouseZone;

            if (wz.Name == this.comboBox1.SelectedText)
            {
                return;
            }

            ApprovalFlowType aft = this.PharmacyDatabaseService.GetApprovalFlowTypeByBusiness(out msg, ApprovalType.drugsInventoryMove).FirstOrDefault();

            if (aft == null)
            {
                MessageBox.Show("请先通知管理员设定移库审批,并设定其审批节点!"); return;
            }

            if (MessageBox.Show("确定需要申请该药品移库至:" + wz.Name + "吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
            {
                return;
            }
            Guid InventoryID        = storage[this.dataGridView1.SelectedCells[0].RowIndex].InventoryID;
            DrugInventoryRecord dir = this.PharmacyDatabaseService.GetDrugInventoryRecord(out msg, InventoryID);

            if (dir == null)
            {
                MessageBox.Show("读取库存表失败!");
                return;
            }

            DrugsInventoryMove dim = new DrugsInventoryMove();

            dim.Id = Guid.NewGuid();
            dim.ApprovalStatusValue = 1;
            dim.batchNo             = dir.BatchNumber;
            dim.createTime          = DateTime.Now;
            dim.createUID           = BugsBox.Pharmacy.AppClient.Common.AppClientContext.currentUser.Id;
            dim.Deleted             = false;
            dim.Description         = "移库至" + wz.Name;
            dim.drugName            = dir.DrugInfo.ProductGeneralName;
            dim.flowID            = Guid.NewGuid();
            dim.inventoryRecordID = dir.Id;
            dim.OriginWareHouseID = dir.WarehouseZoneId;
            dim.quantity          = dir.CanSaleNum;
            dim.updateTime        = DateTime.Now;
            dim.WareHouseID       = wz.Id;
            bool b = this.PharmacyDatabaseService.AddDrugsInventoryMoveByFlowID(dim, aft.Id, "新增移库审批", out msg);

            if (b)
            {
                this.PharmacyDatabaseService.WriteLog(dim.createUID, "成功提交移库申请信息:" + dim.drugName + "被成功申请移至" + dim.OriginWareHouseID);
                if (MessageBox.Show("成功申请移库信息" + wz.Name + ",请至右键菜单->移库记录查询界面查询!需要打开移库记录查询窗口吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
                {
                    return;
                }
                Form_DrugInventoryMove frm = new Form_DrugInventoryMove();
                frm.ShowDialog();
            }
        }
Beispiel #2
0
        /// <summary>
        /// 根据销售订单获取获取出库详细
        /// </summary>
        /// <param name="SalesOrderId"></param>
        /// <returns></returns>
        public List <OutInventoryDetail> GetOutInventoryDetailFromOrderDetail(Guid orderID)
        {
            try
            {
                List <SalesOrderDetail> salesOrderDetails = BusinessHandlerFactory.SalesOrderDetailBusinessHandler
                                                            .Fetch(p => p.SalesOrderID == orderID &&
                                                                   p.OutAmount < (p.Amount - p.ReturnAmount))        //还有未发的货
                                                            .ToList();

                List <OutInventoryDetail> detailList = new List <OutInventoryDetail>();
                foreach (var sDetail in salesOrderDetails)
                {
                    var detail = new OutInventoryDetail();
                    detail.ActualUnitPrice      = sDetail.ActualUnitPrice;
                    detail.Index                = sDetail.Index;
                    detail.productCode          = sDetail.productCode;
                    detail.productName          = sDetail.productName;
                    detail.BatchNumber          = sDetail.BatchNumber;
                    detail.UnitPrice            = sDetail.UnitPrice;
                    detail.Amount               = sDetail.Amount - sDetail.OutAmount - sDetail.ReturnAmount;
                    detail.Price                = sDetail.Price;
                    detail.DictionaryDosageCode = sDetail.DictionaryDosageCode;
                    detail.SpecificationCode    = sDetail.SpecificationCode;
                    detail.PruductDate          = sDetail.PruductDate;
                    detail.OutValidDate         = sDetail.OutValidDate;
                    detail.FactoryName          = sDetail.FactoryName;
                    detail.MeasurementUnit      = sDetail.MeasurementUnit;
                    detail.Origin               = sDetail.Origin;
                    detail.Description          = "数量正确";
                    DrugInventoryRecord drugInventoryRecord = BusinessHandlerFactory.DrugInventoryRecordBusinessHandler.Get(sDetail.DrugInventoryRecordID);
                    if (drugInventoryRecord == null)
                    {
                        BusinessHandlerFactory.SalesOrderDetailBusinessHandler.Delete(sDetail.Id);
                        continue;
                    }
                    WarehouseZone warehouseZone = BusinessHandlerFactory.WarehouseZoneBusinessHandler.Get(drugInventoryRecord.WarehouseZoneId);
                    warehouseZone.Warehouse  = BusinessHandlerFactory.WarehouseBusinessHandler.Get(warehouseZone.WarehouseId);
                    detail.WarehouseName     = warehouseZone.Warehouse.Name;
                    detail.WarehouseCode     = warehouseZone.Warehouse.Code;
                    detail.WarehouseZoneCode = warehouseZone.Code;
                    detail.WarehouseZoneName = warehouseZone.Name;
                    detail.CanSaleNum        = drugInventoryRecord.CanSaleNum;

                    detail.SalesOrderId       = sDetail.SalesOrderID;
                    detail.SalesOrderDetailId = sDetail.Id;

                    detailList.Add(detail);
                }
                return(detailList);
            }
            catch (Exception ex)
            {
                return(this.HandleException <List <OutInventoryDetail> >("根据销售订单好获取输出订单模型失败", ex));
            }
        }
        public static WarehouseZone CreateWarehouseZone(string dataAreaId, string zoneId, global::Microsoft.Dynamics.DataEntities.WarehouseZoneGroup warehouseZoneGroup)
        {
            WarehouseZone warehouseZone = new WarehouseZone();

            warehouseZone.dataAreaId = dataAreaId;
            warehouseZone.ZoneId     = zoneId;
            if ((warehouseZoneGroup == null))
            {
                throw new global::System.ArgumentNullException("warehouseZoneGroup");
            }
            warehouseZone.WarehouseZoneGroup = warehouseZoneGroup;
            return(warehouseZone);
        }
        /// <summary>
        /// 选中库区
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvUserList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var grid = sender as DataGridView;

            if (e.RowIndex < 0 || grid == null)
            {
                return;
            }

            //点击选择按钮
            if ("选择".Equals(grid.Columns[e.ColumnIndex].Name))
            {
                this.DialogResult = DialogResult.OK;
                this.Result       = warehouseZones[e.RowIndex];//返回的数据
                this.Close();
            }
        }
 public void UpdateZone(WarehouseZone zone)
 {
     this._warehouseRepository.Update(zone);
     this._warehouseRepository.SaveChanges();
 }
 public void AddZone(WarehouseZone zone)
 {
     this._warehouseRepository.Add(zone);
     this._warehouseRepository.SaveChanges();
 }
Beispiel #7
0
 public void AddZone(WarehouseZone zone)
 {
     zonesService.AddZone(zone);
 }