/// <summary> /// 从服务器获取所有经营范围 /// </summary> /// <param name="showMessage"></param> /// <returns></returns> public bool LoadBusinessTypes(bool showMessage = false) { try { string message; BusinessTypes = PharmacyDatabaseService.AllBusinessTypes(out message) .ToList(); if (BusinessScopes != null && string.IsNullOrWhiteSpace(message)) { return(true); } else { throw new Exception(message); return(false); } } catch (Exception ex) { Log.Error(ex); if (showMessage) { //MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop); MessageBox.Show(this.Text + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop); } return(false); } }
private void FormDeliverySearch_Load(object sender, EventArgs e) { string message = string.Empty; try { IEnumerable <User> users = PharmacyDatabaseService.GetAllUsers(out message); var list = users.Select(p => new ListItem { ID = p.Id.ToString(), Name = p.Account }).ToList(); list.Insert(0, new ListItem { ID = Guid.Empty.ToString(), Name = "-请选择-" }); this.cmbOperator.DataSource = list; this.cmbOperator.ValueMember = "ID"; this.cmbOperator.DisplayMember = "Name"; } catch (Exception) { MessageBox.Show("画面初始化失败"); } this.dgvDelivery.DataSource = null; this.pagerControl.RecordCount = 0; }
private void btnDel_Click(object sender, EventArgs e) { try { if (MessageBox.Show("确定要删除吗?", "信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { dosage.Id = Guid.Parse(selectId); string msg = string.Empty; PharmacyDatabaseService.DeleteDictionaryDosage(out msg, dosage.Id); if (string.IsNullOrEmpty(msg)) { //删除成功 this.FormState = FormOperation.Empty; //refresh datview RefreshDataView(); } } } catch (Exception ex) { MessageBox.Show("删除数据失败!", "错误"); Log.Error(ex); } }
private void BindGrid() { string message = string.Empty; SalesCodeSearchInput input = new SalesCodeSearchInput(); input.Code = this.txtCode.Text; if (this.dtFrom.Checked) { input.FromDate = this.dtFrom.Value; } if (this.dtTo.Checked) { input.ToDate = this.dtTo.Value; } input.isImport = this.checkBox1.Checked ? 1 : 0; OutInventory[] list = new OutInventory[0]; if (this.Status == OutInventoryStatus.Outing) { list = PharmacyDatabaseService.GetSubmitedOutInventoryByCondition(out pager, out message, input, this.pagerControl.PageIndex, this.pagerControl.PageSize); } else if (this.Status == OutInventoryStatus.Outed) { list = PharmacyDatabaseService.GetAcceptedOutInventoryByCondition(out pager, out message, input, this.pagerControl.PageIndex, this.pagerControl.PageSize); } dgvOutInventory.DataSource = list; FormatRows(); }
private void GetListHealthDoc(int pageIndex, int pageSize) { try { if (this.tabControlHealthDocManage.SelectedIndex == 1) { _searchKeyword = txtSearchKeyword2.Text.Trim(); string msg = string.Empty; HealthCheckDetails = null; HealthCheckDetails = PharmacyDatabaseService.SearchPagedHealthCheckDetailByAllStrings(out pageInfo, out msg, _searchKeyword, pageIndex, pageSize).ToList(); initDataGridView2(); //this.dataGridView1.DataSource = _listDrugInfo; this.pagerControl1.RecordCount = pageInfo.RecordCount; this.pagerControl1.PageIndex = 1; } if (this.tabControlHealthDocManage.SelectedIndex == 0) { _searchKeyword = txtSearchKeyword.Text.Trim(); string msg = string.Empty; HealthCheckDocuments = null; HealthCheckDocuments = PharmacyDatabaseService.SearchPagedHealthCheckDocumentByAllStrings(out pageInfo, out msg, _searchKeyword, pageIndex, pageSize).ToList(); initDataGridView(); //this.dataGridView1.DataSource = _listDrugInfo; this.pagerControl1.RecordCount = pageInfo.RecordCount; this.pagerControl1.PageIndex = 1; } } catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK); Log.Error(ex); } }
private void LoadData() { string msg; int? CompleteState = null, DrugMaintainTypeValue = null; //完成状态 if (cmbCompleteState.SelectedIndex == 1) { CompleteState = 1; } else if (cmbCompleteState.SelectedIndex == 2) { CompleteState = 0; } //类型 if (cmdDrugMaintainType.SelectedIndex == 1) { DrugMaintainTypeValue = (int)DrugMaintainType.Normal; } else if (cmdDrugMaintainType.SelectedIndex == 2) { DrugMaintainTypeValue = (int)DrugMaintainType.Special; } else if (cmdDrugMaintainType.SelectedIndex == 3) { DrugMaintainTypeValue = (int)DrugMaintainType.Inst; } else if (cmdDrugMaintainType.SelectedIndex == 4) { DrugMaintainTypeValue = (int)DrugMaintainType.Zyyp; } else if (cmdDrugMaintainType.SelectedIndex == 5) { DrugMaintainTypeValue = (int)DrugMaintainType.Zyc; } else if (cmdDrugMaintainType.SelectedIndex == 6) { DrugMaintainTypeValue = (int)DrugMaintainType.BJSP; } List <BugsBox.Pharmacy.Models.DrugMaintainRecord> item = PharmacyDatabaseService.GetDrugMaintainRecordByCondition(out msg, StartDate.Value, EndDate.Value, CompleteState, DrugMaintainTypeValue).ToList(); if (item == null) { return; } var all = item.OrderBy(r => r.CreateTime).ToList(); var c = from i in all select new MaintainInfo { BillDocumentNo = i.BillDocumentNo, CompleteState = Convert.ToBoolean(i.CompleteState) ? "已完成" : "未完成", ExpirationDate = i.ExpirationDate.ToLongDateString(), CreateTime = i.CreateTime, DrugMaintainType = i.DrugMaintainTypeValue == 0 ? "普通药品" : i.DrugMaintainTypeValue == 1 ? "重点养护药品":i.DrugMaintainTypeValue == 2?"医疗器械":i.DrugMaintainTypeValue == 3 ? "中药饮片":i.DrugMaintainTypeValue == 4?"中药材":"保健食品", DrugMaintainTypeValue = i.DrugMaintainTypeValue }; dataGridView1.DataSource = c.ToList(); }
private void SaveData() { try { unit.Name = txtName.Text.Trim(); string msg = string.Empty; if (string.IsNullOrEmpty(selectId)) { unit.Id = Guid.NewGuid(); PharmacyDatabaseService.AddDictionarySpecification(out msg, unit); } else { unit.Id = Guid.Parse(selectId); PharmacyDatabaseService.SaveDictionarySpecification(out msg, unit); } if (string.IsNullOrEmpty(msg)) { this.FormState = FormOperation.Empty; RefreshDataView(); } } catch (Exception ex) { MessageBox.Show("保存数据失败!", "错误"); Log.Error(ex); } }
private void SalesOrderLog() { try { PagerInfo pi = new PagerInfo(); Business.Models.SalesCodeSearchInput scsi = new Business.Models.SalesCodeSearchInput(); DateTime dtF = this.dateTimePicker1.Value; DateTime dtT = this.dateTimePicker2.Value; var salesOrderList = PharmacyDatabaseService.AllSalesOrders(out msg).Where(r => r.BalanceTime > dtF && r.BalanceTime < dtT); var c = from i in salesOrderList select new LogContext { dt = i.CreateTime, name = i.SalerName, context = "开销售单" + i.OrderCode, type = "销售操作日志" }; this.dataGridView1.DataSource = c.ToList(); } catch (Exception ex) { MessageBox.Show("日志查询失败!请联系统管理员!"); } }
private void LoadDataFromServer() { string message = string.Empty; try { MmedicalInstitutionPermit = PharmacyDatabaseService.GetMmedicalInstitutionPermit(entity.Id, out message).FirstOrDefault(); if (MmedicalInstitutionPermit == null) { MmedicalInstitutionPermit = new MmedicalInstitutionPermit(); MmedicalInstitutionPermit.Id = Guid.Empty; MmedicalInstitutionPermit.IssuanceDate = DateTime.Now; MmedicalInstitutionPermit.OutDate = DateTime.Now.AddYears(1); MmedicalInstitutionPermit.StartDate = DateTime.Now; this.dateTimePickerOutDate.Value = DateTime.Now.AddYears(1); MmedicalInstitutionPermit.UnitName = unitName; MmedicalInstitutionPermit.RegAddress = Address; MmedicalInstitutionPermit.LegalPerson = Legalperson; MmedicalInstitutionPermit.WarehouseAddress = WareHouseAddress; } } catch (Exception ex) { MessageBox.Show("证书信息不存在或已被删除!", "警告!"); } }
/// <summary> /// 处理按钮按下 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvOrderReturn_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } var entity = dgvOrderReturn.Rows[e.RowIndex].DataBoundItem as SalesOrderReturn; if (dgvOrderReturn.Columns[e.ColumnIndex].Name == "处理") { string message = string.Empty; try { var orderReturn = PharmacyDatabaseService.GetSalesOrderReturn(out message, entity.Id); FormSalesOrderReturn form = new FormSalesOrderReturn(orderReturn); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { btnRefresh_Click(sender, e); } } catch (Exception) { MessageBox.Show("打开销退处理画面失败" + message); } } }
private void InitData() { try { string message; PurchaseUnits = PharmacyDatabaseService.AllPurchaseUnits(out message) .ToList(); PurchaseUnits.Insert(0, new PurchaseUnit { Id = Guid.Empty, Name = "请您选择..." }); queryModel = new QueryPurchaseUnitBuyerModel(); queryModel.OutDateFrom = TypesDefaultValues.MaxDateTime; queryModel.OutDateTo = TypesDefaultValues.MinDateTime; queryModel.BirthdayFrom = TypesDefaultValues.MaxDateTime; queryModel.BirthdayTo = TypesDefaultValues.MinDateTime; queryModel.CreateTimeFrom = TypesDefaultValues.MaxDateTime; queryModel.CreateTimeTo = TypesDefaultValues.MinDateTime; queryModel.UpdateTimeFrom = TypesDefaultValues.MaxDateTime; queryModel.UpdateTimeTo = TypesDefaultValues.MinDateTime; } catch (Exception ex) { ex = new Exception("初始化数据失败", ex); Log.Error(ex); MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Search() { try { string msg = string.Empty; Guid[] warehouseZonesIds = new Guid[] { }; if (this.cmbWareHouse.SelectedIndex != -1) { warehouseZonesIds = new Guid[] { Guid.Parse(cmbWareHouse.SelectedValue.ToString()) }; } if (this.txtGeneralName.Text != "") { _listLackDrugRecords = _listLackDrugRecords.Where(p => p.pinyin != null && p.pinyin.ToUpper().Contains(this.txtGeneralName.Text.Trim().ToUpper())).ToList(); } else { _listLackDrugRecords = PharmacyDatabaseService.GetDrugInfoForOutofStock( out msg).OrderBy(r => r.ProductGeneralName).ToList(); } if (this.cmbWareHouse.SelectedIndex != -1) { _listLackDrugRecords = _listLackDrugRecords.Where(w => w.wareHouse.Equals(cmbWareHouse.Text)).ToList(); } dataGridView1.DataSource = new BindingCollection <LackDrugModel>(_listLackDrugRecords); this.label1.Text = "当前缺货品种共计:" + _listLackDrugRecords.Count.ToString(); } catch (Exception ex) { MessageBox.Show("缺货查询失败,请联系管理员!"); } }
private void Search() { try { if (cmbOrderStatus.SelectedIndex != -1) { orderStatus = Int32.Parse(((ListItem)(cmbOrderStatus.SelectedItem)).ID.ToString()); } else { orderStatus = -1; } Guid[] supplyIds = new Guid[] { }; if (cmbSupply.SelectedIndex != -1) { supplyIds = new Guid[] { new Guid(cmbSupply.SelectedValue.ToString()) }; } string msg = String.Empty; _listPurchaseOrder = PharmacyDatabaseService.GetPurchaseOrders(out msg, this.txtOrderNo.Text.Trim(), this.dtpFrom.Value, this.dtpTo.Value, new int[] { orderStatus }, supplyIds, this.pagerControl1.PageIndex, this.pagerControl1.PageSize).ToList(); if (_listPurchaseOrder.Count > 0) { this.pagerControl1.RecordCount = _listPurchaseOrder[0].RecordCount; } else { this.pagerControl1.RecordCount = 0; } this.dataGridView1.DataSource = _listPurchaseOrder; } catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK); Log.Error(ex); } }
private void tsbtnCancel_Click(object sender, EventArgs e) { string msg = string.Empty; dqc = new drugsUnqualificationCondition(); dqc.batchNo = cmbBatch.Text.Trim() == "全部" || cmbBatch.Text.Trim() == string.Empty ? string.Empty : cmbBatch.Text.Trim(); dqc.drugName = textBox1.Text.Trim() == "全部" || textBox1.Text.Trim() == string.Empty?string.Empty:textBox1.Text.Trim(); dqc.unqualificationType = cmbUnqualificationType.SelectedIndex; dqc.dtFrom = checkBox1.Checked? this.dateTimePicker1.Value:DateTime.MinValue; dqc.dtTo = checkBox1.Checked ? this.dateTimePicker2.Value : DateTime.MaxValue; list = PharmacyDatabaseService.GetDrugsUnqualificationByCondition(out msg, dqc).ToList(); var l = list.ToArray(); var v = from i in l select new drugsUnqualificationQuery { id = i.Id, flowID = i.flowID, drugName = i.drugName, batchNo = i.batchNo, createTime = i.createTime, unqualificationType = (drugsUnqualificationType)i.unqualificationType, quantity = i.quantity, Description = "双击查看", updateTime = i.updateTime, IsApproval = i.ApprovalStatusValue == 2 ? "已审" : i.ApprovalStatusValue == 4 ? "审批未通过" : i.ApprovalStatusValue == 1 ? "待审" : "其他" }; recordCount = v.Count(); dqs = v.ToList(); loadData(); }
/// <summary> /// 出库 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbtnOuted_Click(object sender, EventArgs e) { try { string msg = string.Empty; Delivery newDelivery = PharmacyDatabaseService.GetDelivery(out msg, Delivery.Id); newDelivery.DeliveryStatusValue = (int)DeliveryStatus.Outed; newDelivery.outedTime = DateTime.Now; newDelivery.outedOperatorId = AppClientContext.CurrentUser.Id; var billcode = this.PharmacyDatabaseService.GenerateBillDocumentCodeByTypeValue(out msg, (int)BillDocumentType.Test); newDelivery.outedNo = billcode.Code; if (string.IsNullOrEmpty(PharmacyDatabaseService.UpdateDelivery(newDelivery))) { this.PharmacyDatabaseService.AddBillDocumentCode(out msg, billcode); MessageBox.Show("成功出库!"); this.PharmacyDatabaseService.WriteLog(AppClientContext.CurrentUser.Id, "提交配送记录出库操作成功"); this.DialogResult = System.Windows.Forms.DialogResult.OK; } else { MessageBox.Show("出库失败!请联系管理员!"); this.PharmacyDatabaseService.WriteLog(AppClientContext.CurrentUser.Id, "提交配送记录出库操作失败"); } this.UpdateBtnEnabled(DeliveryStatus.Outed); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 查供应商 /// </summary> public FormSupplyUnitsSelector() { InitializeComponent(); supplyUnitSalesman = PharmacyDatabaseService.AllSupplyUnitSalesmans(out msg).ToList(); BindBuessess(); BindDataForAllSupply(); }
private DataTable getStorageTable() { dt = new DataTable(); dt.Columns.Add("drugName"); dt.Columns.Add("batchNo"); drugsUnqualificationCondition duc = new drugsUnqualificationCondition(); duc.dtFrom = this.checkBox1.Checked ? this.dateTimePicker1.Value:DateTime.MinValue; duc.dtTo = this.checkBox1.Checked ? dateTimePicker1.Value : DateTime.MaxValue; duc.IsApproval = true; duc.unqualificationType = 0; list = PharmacyDatabaseService.GetDrugsUnqualificationByCondition(out msg, duc).ToList(); this.bList.Clear(); DataRow dr = null; foreach (drugsUnqualication ar in list) { dr = dt.NewRow(); dr["drugName"] = ar.drugName; dr["batchNo"] = ar.batchNo; dt.Rows.Add(dr); } return(dt); }
void dgvDrugDetailList_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex < 0) { return; } string msg = string.Empty; int rIdx = e.RowIndex; Guid itemId = new Guid(this.dgvDrugDetailList.Rows[rIdx].Cells["id"].Value.ToString()); Guid approvalFlowId = new Guid(this.dgvDrugDetailList.Rows[rIdx].Cells["FlowId"].Value.ToString()); item = PharmacyDatabaseService.GetDrugsUnqualificationByID(out msg, itemId); if (PharmacyDatabaseService.GetFinishApproveFlowsRecord(out msg, approvalFlowId, 0).Count() > 1) { FormUnqualificationApprovalDetail f = new FormUnqualificationApprovalDetail(); Business.Models.drugsUnqualificationQuery dq = PharmacyDatabaseService.getDrugsUnqualificationQueryByFlowID(approvalFlowId, out msg); UserControls.ucDrugsUnqualification ucf = new UserControls.ucDrugsUnqualification(dq); f.Height += ucf.Height; f.Controls.Add(ucf); ucf.Dock = DockStyle.Fill; f.ShowDialog(); f = null; dq = null; ucf = null; } if (item != null) { textBox1.Text = item.drugName; this.textBox2.Text = item.quantity.ToString(); this.txtRemark.Text = item.Description; } flag = true; }
private void btnDel_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(selectId)) { MessageBox.Show("未选择要删除的数据!"); return; } if (MessageBox.Show("确定要删除吗?", "信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { //删除数据 unit.Id = Guid.Parse(selectId); string msg = string.Empty; //PharmacyDatabaseService.SaveDictionarySpecification(out msg, unit); PharmacyDatabaseService.DeleteDictionarySpecification(out msg, unit.Id); if (string.IsNullOrEmpty(msg)) { //删除成功 this.FormState = FormOperation.Empty; //refresh datview RefreshDataView(); } } } catch (Exception ex) { MessageBox.Show("删除数据失败!", "错误"); Log.Error(ex); } }
private void dgvDrugDetailList_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (bList == null) { return; } if (e.RowIndex < 0) { return; } if (this.dgvDrugDetailList.Columns[e.ColumnIndex].Name == this.submit.Name) { if (MessageBox.Show("确定要提交至不合格审批流程吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK) { drugsUnqualication du = bList[e.RowIndex]; du.ApprovalStatusValue = 0; du.updateTime = DateTime.Now; if (PharmacyDatabaseService.addDrugsUnqualityApproval(du, Guid.Parse(this.cmbApprovalSelector.ComboBox.SelectedValue.ToString()), du.createUID, "新增不合格审批:" + du.drugName, out msg)) { MessageBox.Show("已提交至不合格审批流程!"); this.PharmacyDatabaseService.WriteLog(AppClientContext.CurrentUser.Id, "成功提交不合格药品信息至审批流程:" + du.drugName); this.GetUnqualificationData(); } } } }
private void BindData() { string msg; _detail = PharmacyDatabaseService.GetDrugMaintainRecordDetailByCondition(out msg, _documentNumber, null).ToList(); this._detail.ForEach(r => { r.CheckResult = string.IsNullOrEmpty(r.CheckResult) ? "外观检验" : r.CheckResult; r.MaintainResult = string.IsNullOrEmpty(r.MaintainResult) ? "正常" : r.MaintainResult; User usr = allUser.Where(u => u.Id == r.UserId).FirstOrDefault(); if (usr != null) { r.UserName = usr.Employee.Name; } }); dataGridView1.DataSource = new BindingCollection <DrugMaintainRecordDetail>(_detail); foreach (DataGridViewRow dr in this.dataGridView1.Rows) { if (dr.Cells[this.Column7.Name].Value != null) { dr.Cells[Column18.Name].Value = true; dr.Cells[Column19.Name].Value = Convert.ToDecimal(dr.Cells[this.Column9.Name].Value) - Convert.ToDecimal(dr.Cells[this.Column10.Name].Value); dr.ReadOnly = true; } } }
public formDrugsUnqualification() { InitializeComponent(); this.dgvDrugDetailList.AutoGenerateColumns = false; List <int> flowTypeList = new List <int>(); flowTypeList.Add((int)ApprovalType.drugsUnqualityApproval); string msg = string.Empty; List <ApprovalFlowType> list = PharmacyDatabaseService.GetApprovalFlowTypeByTypeList(out msg, flowTypeList.ToArray()).Where(r => r.Deleted == false).ToList(); this.cmbApprovalSelector.ComboBox.DataSource = list; this.cmbApprovalSelector.ComboBox.DisplayMember = "Name"; this.cmbApprovalSelector.ComboBox.ValueMember = "Id"; #region 事件声明 this.textBox1.KeyDown += textBox1_KeyDown; this.dgvDrugDetailList.RowPostPaint += delegate(object o, DataGridViewRowPostPaintEventArgs ex) { DataGridViewOperator.SetRowNumber((DataGridView)o, ex); }; this.dgvDrugDetailList.CellDoubleClick += dgvDrugDetailList_CellDoubleClick; this.checkBox1.Click += checkBox1_Click; #endregion this.dgvDrugDetailList.DataSource = bList; this.GetUnqualificationData(); }
/// <summary> /// 初始化画面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormOutInventoryIndex_Load(object sender, EventArgs e) { string message = string.Empty; try { IEnumerable <User> users = PharmacyDatabaseService.GetAllUsers(out message); var list = users.Select(p => new ListItem { ID = p.Id.ToString(), Name = p.Account }).ToList(); list.Insert(0, new ListItem { ID = Guid.Empty.ToString(), Name = "-请选择-" }); } catch (Exception) { MessageBox.Show("画面初始化失败"); } System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); string xmlFile = AppDomain.CurrentDomain.BaseDirectory + "BugsBox.Pharmacy.AppClient.SalePriceType.xml"; doc.Load(xmlFile); System.Xml.XmlNodeList NodeList = doc.SelectNodes("/SalePriceType/SaleOutInventoryChecker"); FirstChecker = NodeList[0].Attributes[0].Value.ToString(); SecondChecker = NodeList[0].Attributes[1].Value.ToString(); InventoryKeeper = NodeList[0].Attributes[2].Value.ToString(); dgvOutInventory.DataSource = null; this.pagerControl.RecordCount = 0; }
/// <summary> /// 取消订单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCancel_Click(object sender, EventArgs e) { //如果订单为未付款状态的话,就可以取消 FormCancelOrderConfirm form = new FormCancelOrderConfirm(); form.ShowDialog(); ////确定取消 if (form.DialogResult == DialogResult.OK) { string cancelReason = form.Reason; //执行取消操作 try { string msg = String.Empty; PurchaseOrder purchaseOrder = PharmacyDatabaseService.GetPurchaseOrder(out msg, _purchaseOrder.Id); purchaseOrder.OrderStatusValue = OrderStatus.Canceled.GetHashCode(); purchaseOrder.ApprovaledTime = DateTime.Now; purchaseOrder.ApprovalUserId = AppClientContext.CurrentUser.Id; purchaseOrder.ApprovalDecription = cancelReason; PharmacyDatabaseService.SavePurchaseOrder(out msg, purchaseOrder); _orderStatus = OrderStatus.Canceled; FormSalesOrderEdit_Load(sender, e); MessageBox.Show("订单取消成功!"); this.PharmacyDatabaseService.WriteLog(AppClientContext.CurrentUser.Id, "执行采购单取消操作成功,单号:" + purchaseOrder.DocumentNumber); } catch { MessageBox.Show("订单取消失败,请联系管理员!"); } } }
private void btnDelete_Click(object sender, EventArgs e) { try { _TYPE = OperateType.Delete; if (MessageBox.Show("确定要删除吗?", "信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (dataGridView1.CurrentRow != null) { //执行删除操作 int currRowIndex = dataGridView1.CurrentRow.Cells[0].RowIndex; entity = _listDrugInfo[currRowIndex]; string msg = string.Empty; PharmacyDatabaseService.DeleteDrugInfo(out msg, entity.Id); SetEditMode(false); btnRefresh_Click(this, null); } else { MessageBox.Show("没有选择要删除的记录!"); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); Log.Error(ex); } }
private void RefreshDataGridView() { string msg = string.Empty; _listPurchaseOrderDetail = PharmacyDatabaseService.GetPurchaseOrderDetails(out msg, _purchaseOrder.Id).ToList(); this.dataGridView1.DataSource = _listPurchaseOrderDetail; }
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.ColumnIndex == 10) { e.Value = Convert.ToDateTime(e.Value).ToString("yyyy-MM-dd"); } if (e.ColumnIndex == 11) { e.Value = Convert.ToDateTime(e.Value).ToString("yyyy-MM-dd"); } if (e.ColumnIndex == 16) { if (e.Value != null) { e.Value = Convert.ToDateTime(e.Value).ToString("yyyy-MM-dd"); } } if (e.ColumnIndex == 15) { string msg; if (e.Value != null) { User user = PharmacyDatabaseService.GetUser(out msg, Guid.Parse(e.Value.ToString())); if (user != null) { e.Value = user.Account; } } } }
/// <summary> /// 取消配送 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbtnCancel_Click(object sender, EventArgs e) { if (MessageBox.Show("确定要取消该配送单据吗?", "提示", MessageBoxButtons.OKCancel) != System.Windows.Forms.DialogResult.OK) { return; } try { string msg = string.Empty; Delivery newDelivery = PharmacyDatabaseService.GetDelivery(out msg, Delivery.Id); newDelivery.DeliveryStatusValue = (int)DeliveryStatus.Reservation; newDelivery.CanceledTime = DateTime.Now; newDelivery.CanceledOperatorId = AppClientContext.CurrentUser.Id; var billcode = this.PharmacyDatabaseService.GenerateBillDocumentCodeByTypeValue(out msg, (int)BillDocumentType.Test); newDelivery.CanceledNo = billcode.Code; this.PharmacyDatabaseService.AddBillDocumentCode(out msg, billcode); PharmacyDatabaseService.UpdateDelivery(newDelivery); this.PharmacyDatabaseService.WriteLog(AppClientContext.CurrentUser.Id, "执行取消配送记录成功"); this.UpdateBtnEnabled(DeliveryStatus.Canceled); this.DialogResult = System.Windows.Forms.DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 刷新画面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnRefresh_Click(object sender, EventArgs e) { string message = string.Empty; try { List <SalesOrder> list = null; if (_Status == (int)OrderStatus.Banlaced) { list = PharmacyDatabaseService.GetOrderStatusList(out message, new int[] { _Status }).ToList(); } else { list = PharmacyDatabaseService.GetOrderStatusList(out message, new int[] { _Status }).ToList(); } listp.Clear(); bList.Clear(); listp = list.OrderBy(r => r.CreateTime).ToList(); foreach (var c in listp) { bList.Add(c); } dgvSalesOrderList.DataSource = bList; } catch (Exception) { MessageBox.Show("订单检索失败!" + message); } }
/// <summary> /// 初始化画面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormOutInventoryIndex_Load(object sender, EventArgs e) { string message = string.Empty; try { IEnumerable <User> users = PharmacyDatabaseService.GetAllUsers(out message); var list = users.Select(p => new ListItem { ID = p.Id.ToString(), Name = p.Account }).ToList(); list.Insert(0, new ListItem { ID = Guid.Empty.ToString(), Name = "-请选择-" }); } catch (Exception) { MessageBox.Show("画面初始化失败"); } FirstChecker = BugsBoxApplication.Instance.FirstChecker; SecondChecker = BugsBoxApplication.Instance.SecondChecker; InventoryKeeper = BugsBoxApplication.Instance.InventoryKeeper; dgvOutInventory.DataSource = null; this.pagerControl.RecordCount = 0; }