private void btnDispense_Click(object sender, EventArgs e) { try { Decimal newDispFee = 0; this.Cursor = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor(); if (ConfigManager.IsChecking(_currentDeptId) == true) { MessageBox.Show("药品正在盘点中......"); return; } if (this._recipeOrder == null) { MessageBox.Show("没有药品可发"); return; } if (this._recipeOrder.Rows.Count < 1) { MessageBox.Show("没有药品可发"); return; } for (int index = 0; index < selectPat.Count; index++) { newDispFee += IN_InterFace.QueryPatDispFee(selectPat[index], (int)_currentDeptId); } if (CompareFee(newDispFee) == false) { MessageBox.Show("有病人因费用冲账发药信息需要刷新,请重新刷新"); return; } List <BillMaster> dispList = new List <BillMaster>(); for (int index = 0; index < selectPat.Count; index++) { DataTable dt = (DataTable)_allDispPats[selectPat[index].CureNo]; YP_DRMaster dispMaster = _billProcessor.BuildNewDispenseMaster(selectPat[index], (int)_currentDeptId, (int)_currentUserId, Convert.ToInt32(dt.Rows[0]["presamount"].ToString()), Convert.ToInt32(dt.Rows[0]["group_id"].ToString())); dispList.Add(dispMaster); for (int j = 1; j < dt.Rows.Count; j++) { if (dt.Rows[j]["group_id"].ToString().Trim() != dt.Rows[j - 1]["group_id"].ToString().Trim()) { dispMaster = _billProcessor.BuildNewDispenseMaster(selectPat[index], (int)_currentDeptId, (int)_currentUserId, Convert.ToInt32(dt.Rows[j]["presamount"].ToString()), Convert.ToInt32(dt.Rows[j]["group_id"].ToString())); dispList.Add(dispMaster); } } } YP_DispDeptHis newDispDept = (YP_DispDeptHis)(_billProcessor.SaveBills(dispList, _searchDeptId, _allDispPats)); MessageBox.Show("发药成功,开始打印摆药单...", "发药成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); PrintBy(); // PrintDispTL(dispList, newDispDept); dgrdRecipeInfo.DataSource = null; LoadMsgMaster(); } catch (Exception error) { MessageBox.Show(error.Message); } finally { this.Cursor = DefaultCursor; } }
private void btnDispense_Click(object sender, EventArgs e) { try { Decimal newDispFee = 0; this.Cursor = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor(); if (ConfigManager.IsChecking(_currentDeptId) == true) { MessageBox.Show("药品正在盘点中......"); return; } if (this._recipeOrder == null) { MessageBox.Show("没有药品可发"); return; } if (this._recipeOrder.Rows.Count < 1) { MessageBox.Show("没有药品可发"); return; } if (_dispenseModel == 1) { if (_currentZYPat == null) { MessageBox.Show("没有病人需要发药"); return; } YP_DRMaster dispMaster = _billProcessor.BuildNewDispenseMaster(_currentZYPat, (int)_currentDeptId, (int)_currentUserId); newDispFee = IN_InterFace.QueryPatDispFee(_currentZYPat, (int)_currentDeptId); if (this.CompareFee(newDispFee) == false) { MessageBox.Show("该病人因费用冲账发药信息需要刷新,请重新刷新"); return; } if (_recipeOrder != null) { List <BillOrder> dispList = _billProcessor.BuildNewDispOrder(_recipeOrder, dispMaster, _dispenseModel); _billProcessor.SaveBill(dispMaster, dispList, _currentDeptId); MessageBox.Show("发药成功...", "发药成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); _recipeOrder = IN_InterFace.QueryRecipeOrder(_currentZYPat, (int)_currentDeptId); dgrdRecipeInfo.DataSource = _recipeOrder; } } //如果是住院统领 else { ZY_PatList dispPat; for (int index = 0; index < lstPatInfo.CheckedItems.Count; index++) { dispPat = (ZY_PatList)lstPatInfo.CheckedItems[index].Tag; newDispFee += IN_InterFace.QueryPatDispFee(dispPat, (int)_currentDeptId); } if (CompareFee(newDispFee) == false) { MessageBox.Show("有病人因费用冲账发药信息需要刷新,请重新刷新"); return; } List <BillMaster> dispList = new List <BillMaster>(); for (int index = 0; index < lstPatInfo.CheckedItems.Count; index++) { dispPat = (ZY_PatList)lstPatInfo.CheckedItems[index].Tag; YP_DRMaster dispMaster = _billProcessor.BuildNewDispenseMaster(dispPat, (int)_currentDeptId, (int)_currentUserId); dispList.Add(dispMaster); } YP_DispDeptHis newDispDept = (YP_DispDeptHis)(_billProcessor.SaveBills(dispList, _searchDeptId, _allDispPats)); MessageBox.Show("发药成功,开始打印统领发药单据...", "发药成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); PrintDispTL(dispList, newDispDept); LoadTLMessage(); } this.txtQueryNum.Focus(); } catch (Exception error) { MessageBox.Show(error.Message); } finally { this.Cursor = DefaultCursor; } }
//发药按钮 private void btnDispense_Click(object sender, EventArgs e) { try { this.Cursor = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor(); if (ConfigManager.IsChecking(_currentDeptId) == true) { MessageBox.Show("药品正在盘点中......"); return; } if (this._recipeOrder == null) { MessageBox.Show("没有药品可发"); return; } if (this._recipeOrder.Rows.Count < 1) { MessageBox.Show("没有药品可发"); return; } //重新获取住院发药数量和金额 update by heyan 修改药房多次发药的问题 _zyInterFace.GetSendNumAndFee(_recipeOrder); bool isDurg = true; for (int i = 0; i < _recipeOrder.Rows.Count; i++) { if (Convert.ToInt32(_recipeOrder.Rows[i]["DRUGNUM"]) != 0) { isDurg = false; break; } } if (isDurg == true) { MessageBox.Show("该单据已经发药,请刷新列表!", "发药提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } List <BillMaster> dispList = PutDrugByOrder(_allDispPats); YP_DispDeptHis newDispDept = (YP_DispDeptHis)(_billProcessor.SaveBills(dispList, _selectDeptId, _allDispPats)); if (newDispDept != null) { MessageBox.Show("发药成功,开始打印统领发药单据...", "发药成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); PrintDispTL(newDispDept); //btnPutDrug_Click(null, null); LoadMsgMaster(); } else { if (MessageBox.Show("当前存在药品库存不足,需要系统帮您自动取消这些库存不足的药品么?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { foreach (YP_StoreNum noStoreInfo in ((ZY_DispProcessor)(_billProcessor)).noStoreList) { for (int index = 0; index < _recipeOrder.Rows.Count; index++) { DataRow currentRow = _recipeOrder.Rows[index]; if (currentRow["ORDERRECIPEID"].ToString() == noStoreInfo.queryKey && Convert.ToInt32(currentRow["MAKERDICID"]) == noStoreInfo.makerDicId) { currentRow["ISDISPENSE"] = 0; } } } } } } catch (Exception error) { MessageBox.Show(error.Message); } finally { this.Cursor = DefaultCursor; this.txtQueryNum.Focus(); } }