public void GetPreviewSendThingDataBaseRight() { string message = string.Empty; sendInfoPreview.Rows.Clear(); _scanCount.Clear(); _manaulCount.Clear(); Dictionary <string, DataGridViewRow> instrumentInfo = new Dictionary <string, DataGridViewRow>(); foreach (DataGridViewRow row in dgv_BcuData.Rows) { string setFullName = Convert.ToString(Convert.ToString(row.Cells["b_ca_name"].Value)).Trim(); string setName = ParseThingName(setFullName, "<"); if (_scanCount.ContainsKey(setName)) { _scanCount[setName]++; if (instrumentInfo.ContainsKey(setName)) { instrumentInfo[setName].Cells["thingNumCol"].Value = _scanCount[setName]; } } else { _scanCount.Add(setName, 1); int rowIndex = sendInfoPreview.Rows.Add(); sendInfoPreview.Rows[rowIndex].Cells["thingIdCol"].Value = sendInfoPreview.RowCount + 1; sendInfoPreview.Rows[rowIndex].Cells["thingNameCol"].Value = setName; sendInfoPreview.Rows[rowIndex].Cells["thingNumCol"].Value = _scanCount[setName]; if (!instrumentInfo.ContainsKey(setName)) { instrumentInfo.Add(setName, sendInfoPreview.Rows[rowIndex]); } } } foreach (DataGridViewRow row in dgv_Instrument.Rows) { string instrumentName = Convert.ToString(row.Cells["ca_name"].Value); int sendNum = 0; int.TryParse(Convert.ToString(row.Cells["send_count_now"].Value), out sendNum); string subSendType = Convert.ToString(row.Cells["c_codeType"].Value); if (_manaulCount.ContainsKey(instrumentName)) { _manaulCount[instrumentName] += sendNum; } else { _manaulCount.Add(instrumentName, sendNum); if (!_scanCount.ContainsKey(instrumentName) && sendNum > 0 && (!BarCodeHelper.IsOrderOutSet(txtOrderNum.Text) || _dicNoLabel.Contains(subSendType))) { int rowIndex = sendInfoPreview.Rows.Add(); sendInfoPreview.Rows[rowIndex].Cells["thingIdCol"].Value = sendInfoPreview.RowCount + 1; sendInfoPreview.Rows[rowIndex].Cells["thingNameCol"].Value = instrumentName; sendInfoPreview.Rows[rowIndex].Cells["thingNumCol"].Value = _manaulCount[instrumentName]; } } } }
/// <summary> /// 打印标签响应事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrintBcu_Click(object sender, EventArgs e) { string index5 = _orderNum.Length > 5 ? _orderNum.Substring(0, 5) : _orderNum; string tempName = txtOrderName.Text.Trim(); int packageType = index5 == "BCC4O" ? 2: 0; if (dgv_Instrument.Rows.Count > 0 && dgv_Instrument.SelectedRows.Count > 0 && packageType != 2) { tempName = Convert.ToString(dgv_Instrument.SelectedRows[0].Cells["ca_name"].Value); if (Convert.ToString(dgv_Instrument.SelectedRows[0].Cells["codeType"].Value) == "2") { packageType = 1; } } HCSSM_order_specialset_pack packOrderSet = new HCSSM_order_specialset_pack(_workflowServer, _pdData, _pdParameters, _orderNum, _batch, tempName, packageType); packOrderSet.AppId = this.App_id; packOrderSet.ShowDialog(); if (BarCodeHelper.IsOrderOutSet(txtOrderNum.Text)) { LoadData(); foreach (DataGridViewRow row in dgv_Instrument.Rows) { row.Cells["now_deal_count"].Value = row.Cells["num"].Value; } } }
/// <summary> /// 打印签收单 /// </summary> private void PrintData() { string pringxml = string.Empty; DataRow[] arrayDR02 = CnasBaseData.SystemBaseData.Select("type_code='HCS-print-type' and key_code='OrderForBack'"); if (arrayDR02.Length > 0) { pringxml = Convert.ToString(arrayDR02[0]["other_code"]).Trim(); } if (!string.IsNullOrEmpty(pringxml)) { DataGridView dgv_orderDetail = OrderHelper.StructureForBackOrder(); if (dgv_Instrument.Rows.Count > 0) { for (int i = 0; i < dgv_Instrument.Rows.Count; i++) { int index = dgv_orderDetail.Rows.Add(); dgv_orderDetail.Rows[index].Cells["o_id"].Value = dgv_orderDetail.RowCount; //dgv_orderDetail.Rows[index].Cells["o_cu_name"].Value = _CustomerName; //dgv_orderDetail.Rows[index].Cells["o_u_uname"].Value = _LocationStr; dgv_orderDetail.Rows[index].Cells["o_ca_name"].Value = dgv_Instrument.Rows[i].Cells["ca_name"].Value; //base_ca_name dgv_orderDetail.Rows[index].Cells["o_codeType"].Value = dgv_Instrument.Rows[i].Cells["codeTypeName"].Value; ///GetEnumInstrumentTypeName(dic, Convert.ToString(dgv_Instrument.Rows[i].Cells["codeType"].Value)); dgv_orderDetail.Rows[index].Cells["o_num"].Value = dgv_Instrument.Rows[i].Cells["send_count"].Value; dgv_orderDetail.Rows[index].Cells["o_remark"].Value = dgv_Instrument.Rows[i].Cells["remark"].Value; } } string patientInfo = string.Empty; if (BarCodeHelper.IsOrderOutSet(txtOrderNum.Text)) { SortedList condition = new SortedList(); condition.Clear(); condition.Add(1, txtOrderNum.Text); condition.Add(2, _batch); CnasRemotCall remoteCall = new CnasRemotCall(); string personSQL = remoteCall.RemotInterface.CheckSelectData("HCS_person_info_sec001", condition); DataTable personData = remoteCall.RemotInterface.SelectData("HCS_person_info_sec001", condition); if (personData != null && personData.Rows.Count > 0) { patientInfo = string.Format("病人姓名:{0} 住 院 号:{1}", Convert.ToString(personData.Rows[0]["p_name"]), Convert.ToString(personData.Rows[0]["p_Number"])); } } PrintHelper.Instance.Print_DataGridView(dgv_orderDetail, pringxml, _OrderNum, new string[] { txtCustmoer.Text, txtLocation.Text, patientInfo }); } else { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("notfindPrintTemplage", EnumPromptMessage.warning), "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 生成发货单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnbtnSave_Click(object sender, EventArgs e) { try { if (BarCodeHelper.IsOrderOutSet(txtOrderNum.Text)) { if (_outOrderBCUs.Count <= 0) { MessageBox.Show(string.Format("{0}", OrderHelper.GetDescribeString(5))); return; } else { KeyValuePair <string, int> notScanItem = _outOrderBCUs.FirstOrDefault(p => p.Value == 0); if (notScanItem.Key != null) { MessageBox.Show(string.Format("{0}", OrderHelper.GetDescribeString(4))); return; } } } GetPreviewSendThingData(); string message = GetDifferentInfo(); if (!string.IsNullOrEmpty(message) && MessageBox.Show(message, "信息提示", MessageBoxButtons.YesNo) == DialogResult.No) { return; } else { message = string.Empty; } SortedList sqlParameters = GenerateSQLParameter(ref message); if (!string.IsNullOrEmpty(message)) { MessageBox.Show(message, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } CnasRemotCall remoteCall = new CnasRemotCall(); string testSQL = remoteCall.RemotInterface.CheckUPDataList("HCS-workset-add014", sqlParameters); int result = remoteCall.RemotInterface.UPDataList("HCS-workset-add014", sqlParameters); if (result > 0) { DataRow[] isPrintCreateSendData = CnasBaseData.SystemBaseData.Select("type_code='HCS-system-settings' and key_code='IsPrintCreateSend'"); if (isPrintCreateSendData != null && isPrintCreateSendData.Length == 1) { string isPrintCreateSend = Convert.ToString(isPrintCreateSendData[0]["value_code"]); if (isPrintCreateSend == "1") { OnPrintBtnClick(null, null); } } this.DialogResult = DialogResult.OK; Close(); } else { MessageBox.Show("提交失败", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { } }
/// <summary> /// 处理条码 /// </summary> /// <param name="matchBarCode"></param> /// <returns></returns> private string HandleBarCode(string matchBarCode) { string result = string.Empty; if (!string.IsNullOrEmpty(matchBarCode)) { if (_dataDic.Count > 1) { List <string> bcuList = OrderHelper.GetBcuPackForOrder(); string index4 = string.Empty; if (BarCodeHelper.IsTempBCU(matchBarCode)) { index4 = matchBarCode.Substring(0, 5); } else { index4 = matchBarCode.Substring(0, 3); } KeyValuePair <string, int> bcuItem = new KeyValuePair <string, int>(); if (bcuList.Contains(index4)) { if (BarCodeHelper.IsOrderOutSet(txtOrderNum.Text)) { if (BarCodeHelper.IsTempBCU(matchBarCode)) { if (_outOrderBCUs.Count == 0) { result = OrderHelper.GetDescribeString(5); return(result); } else { bcuItem = _outOrderBCUs.FirstOrDefault(p => p.Key == matchBarCode); if (bcuItem.Key == null) { result = OrderHelper.GetDescribeString(3); return(result); } } } } else { if (BarCodeHelper.IsOutOrderBCU(matchBarCode)) { result = "此订单不能发送外来器械包。"; return(result); } } SortedList tempResult = _cnasHCSWorkflowInterface01.CheckBusinessLogic(matchBarCode, _dataDic); int bResult = -1; int.TryParse(Convert.ToString(tempResult["result_Code"]), out bResult); string bcct_barCode = Convert.ToString(tempResult["barCode"]); string bcct_barCodeObjectName = Convert.ToString(tempResult["barCodeObjectName"]); result = Convert.ToString(tempResult["result_Message"]); string messageForBox = Convert.ToString(tempResult["MessageBox_Message"]); int messageOperation = 1; if (bResult == 0) { if (!string.IsNullOrEmpty(messageForBox) && int.TryParse(Convert.ToString(tempResult["Message_Operation"]), out messageOperation)) { if (MessageBox.Show(messageForBox, "信息提示", (messageOperation == 1 ? MessageBoxButtons.OK : MessageBoxButtons.OKCancel), MessageBoxIcon.Information) != System.Windows.Forms.DialogResult.OK) { result = string.Format("{0} --用户取消", messageForBox); return(result); } else { result = string.Empty; } } if (BarCodeHelper.IsOrderOutSet(OrderNum) && string.IsNullOrEmpty(result) && BarCodeHelper.IsOutOrderBCU(matchBarCode)) { foreach (DataGridViewRow row in dgv_Instrument.Rows) { row.Cells["send_count_now"].Value = row.Cells["num"].Value; } } if (!_dataDic.ContainsKey(bcct_barCode)) { _dataDic.Add(bcct_barCode, bcct_barCode.Length > 3 ? bcct_barCode.Substring(0, 3) : bcct_barCode); } if (!string.IsNullOrEmpty(bcct_barCode) && bcct_barCode.Contains("BCC")) { bcct_barCode = bcct_barCode.Substring(bcct_barCode.IndexOf("BCC")); } AddDgv_BcuData(matchBarCode, bcct_barCode, bcct_barCodeObjectName); //grid数据添加 if (BarCodeHelper.IsOrderOutSet(OrderNum) && BarCodeHelper.IsOutOrderBCU(matchBarCode) && bcuItem.Key == matchBarCode) { _outOrderBCUs[matchBarCode] = 1; } } } else { result = OrderHelper.GetDescribeString(1); } } } else { result = "内部码错误"; } return(result); }
/// <summary> /// 加载数据 /// </summary> /// <param name="orderNum"></param> /// <param name="batch"></param> private void LoadData(string orderNum, string batch) { if (!string.IsNullOrEmpty(orderNum) && !string.IsNullOrEmpty(batch)) { string tempOrderType = orderNum.Length > 5 ? orderNum.Substring(0, 5) : orderNum; _orderTypedic = OrderHelper.GetOrderTypeItem(false); CnasRemotCall reCnasRemotCall = new CnasRemotCall(); if (BarCodeHelper.IsOrderOutSet(orderNum)) { SortedList bcuOrCondition = new SortedList(); bcuOrCondition.Add(1, batch); bcuOrCondition.Add(2, CnasBaseData.SystemID); string testBcuSql = reCnasRemotCall.RemotInterface.CheckSelectData("HCS-bcct-data-sec001", bcuOrCondition); DataTable outOrderBcu = reCnasRemotCall.RemotInterface.SelectData("HCS-bcct-data-sec001", bcuOrCondition); if (outOrderBcu != null) { foreach (DataRow item in outOrderBcu.Rows) { string bcuCode = Convert.ToString(item["BCU_code"]); string bccCode = Convert.ToString(item["bar_code"]); if (!_outOrderBCUs.ContainsKey(bcuCode)) { _outOrderBCUs.Add(bcuCode, 0); } } } } SortedList condition = new SortedList(); condition.Add(1, orderNum); condition.Add(2, batch); condition.Add(3, orderNum); condition.Add(4, batch); string testDataSql = reCnasRemotCall.RemotInterface.CheckSelectData("hcs_work_specialset_info-sec002", condition); DataTable data = reCnasRemotCall.RemotInterface.SelectData("hcs_work_specialset_info-sec002", condition); if (data != null && data.Rows.Count > 0) { DataRow tempRow = data.Rows[0]; _orderId = Convert.ToString(tempRow["orderId"]); UserName = Convert.ToString(tempRow["user_name"]); string tempCreTime = Convert.ToString(tempRow["cre_date"]); CustomerName = Convert.ToString(tempRow["cu_name"]); LocationStr = Convert.ToString(tempRow["u_uname"]); OrderName = Convert.ToString(tempRow["ca_name"]); _locationBarCode = Convert.ToString(tempRow["u_barcode"]); OrderType = OrderHelper.InitDgvDataOrderType(_orderTypedic, tempOrderType); bool isFlag = false; if (!DateTime.TryParse(tempCreTime, out DataForCre)) { DataForCre = DateTime.Now; } for (int i = 0; i < data.Rows.Count; i++) { int index = dgv_Instrument.Rows.Add(); string c_codeType = Convert.ToString(data.Rows[i]["base_ca_type"]); if (_dicNoLabel.Contains(c_codeType)) { dgv_Instrument.Rows[index].DefaultCellStyle.BackColor = Color.Green; dgv_Instrument.Rows[index].Cells["for_label"].Value = "无标签"; } else { dgv_Instrument.Rows[index].Cells["for_label"].Value = "有标签"; } dgv_Instrument.Rows[index].Cells["id"].Value = data.Rows[i]["id"]; dgv_Instrument.Rows[index].Cells["ca_name"].Value = data.Rows[i]["base_ca_name"]; dgv_Instrument.Rows[index].Cells["num_send_count"].Value = string.Format("{0}/{1}", data.Rows[i]["send_count"], data.Rows[i]["instrument_count"]); dgv_Instrument.Rows[index].Cells["send_count_now"].Value = 0; string instrument_count = Convert.ToString(data.Rows[i]["instrument_count"]); string send_count = Convert.ToString(data.Rows[i]["send_count"]); dgv_Instrument.Rows[index].Cells["num"].Value = instrument_count; dgv_Instrument.Rows[index].Cells["send_count"].Value = send_count; dgv_Instrument.Rows[index].Cells["remark"].Value = data.Rows[i]["remark"]; dgv_Instrument.Rows[index].Cells["codeType"].Value = data.Rows[i]["codeType"]; //instrument_typeName dgv_Instrument.Rows[index].Cells["c_codeType"].Value = c_codeType; dgv_Instrument.Rows[index].Cells["codeTypeName"].Value = OrderHelper.GetEnumInstrumentTypeName(Convert.ToString(data.Rows[i]["codeType"]), c_codeType, _dicInstrumentType, _dicChildInstrumentType); dgv_Instrument.Rows[index].Cells["instrument_code"].Value = data.Rows[i]["instrument_code"]; // add - 周盛祥 16-11-17 // 此处判断用户是否设置了自动还物,如果设置了,则显示相应字段 //order_restitution_type if (!instrument_count.Equals(send_count)) { isFlag = true; } } if (isFlag) { txtOrderState.Text = "未完成"; } else { txtOrderState.Text = "已处理"; } } } }
/// <summary> /// 保存(只修改器械数量以及备注) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnbtnSave_Click(object sender, EventArgs e) { SortedList condition = new SortedList(); SortedList par1_condition = new SortedList(); //更新hcs_work_specialset_info SortedList par2_condition = new SortedList(); //更新hcs_work_specialset_dealinfo OrderNumChangeList = new SortedList(); int j = 0; for (int i = 0; i < dgv_Instrument.Rows.Count; i++) { DataGridViewRow row = dgv_Instrument.Rows[i]; string now_deal_count = Convert.ToString(row.Cells["now_deal_count"].Value).Trim(); string id = Convert.ToString(row.Cells["instrument_code"].Value); string instrument_count = Convert.ToString(row.Cells["num"].Value); string deal_count = Convert.ToString(row.Cells["deal_count"].Value); string remark = Convert.ToString(row.Cells["remark"].Value); string codeType = Convert.ToString(row.Cells["codeType"].Value); string c_codeType = Convert.ToString(row.Cells["c_codeType"].Value); string tempName = Convert.ToString(row.Cells["ca_name"].Value); SortedList par_par1_condition = new SortedList(); SortedList par_par2_condition = new SortedList(); int int_now_deal_count, int_deal_count; int int_num; bool isInt = int.TryParse(now_deal_count, out int_now_deal_count); int.TryParse(deal_count, out int_deal_count); int.TryParse(instrument_count, out int_num); if (!isInt) { MessageBox.Show(string.Format("此次{1}处理的数量:必须为数值,不能为{0}", now_deal_count, tempName)); return; } if (isInt && int_num < int_deal_count + int_now_deal_count) { MessageBox.Show(string.Format("此次{1}处理的数量不能超过{0}", instrument_count, tempName)); return; } if (isInt && int_now_deal_count > 0) { par_par1_condition.Add(1, int_now_deal_count + int_deal_count); par_par1_condition.Add(2, remark); par_par1_condition.Add(3, _orderNum); par_par1_condition.Add(4, _batch); par_par1_condition.Add(5, codeType); par_par1_condition.Add(6, id); par1_condition.Add(j + 1, par_par1_condition); par_par2_condition.Add(1, _orderNum); par_par2_condition.Add(2, _batch); par_par2_condition.Add(3, codeType); par_par2_condition.Add(4, id); par_par2_condition.Add(5, now_deal_count); par_par2_condition.Add(6, App_id); par_par2_condition.Add(7, remark); par_par2_condition.Add(8, CnasBaseData.SystemID); par_par2_condition.Add(9, CnasBaseData.UserID); par2_condition.Add(j + 1, par_par2_condition); //OrderNumChangeList SortedList par_orderNumChangeList = new SortedList(); par_orderNumChangeList.Add(1, _orderNum); par_orderNumChangeList.Add(2, _batch); par_orderNumChangeList.Add(3, c_codeType); par_orderNumChangeList.Add(4, id); par_orderNumChangeList.Add(5, instrument_count); par_orderNumChangeList.Add(6, int_now_deal_count + int_deal_count); par_orderNumChangeList.Add(7, codeType); par_orderNumChangeList.Add(8, int_now_deal_count); OrderNumChangeList.Add(j + 1, par_orderNumChangeList); j++; } } if ((par1_condition.Count == 0 || par2_condition.Count == 0) && !BarCodeHelper.IsOrderOutSet(_orderNum)) { MessageBox.Show(string.Format("还没有填写数量!")); return; } condition.Add(1, par1_condition); condition.Add(2, par2_condition); CnasRemotCall reCnasRemotCall = new CnasRemotCall(); string testSql = reCnasRemotCall.RemotInterface.CheckUPDataList("hcs_work_specialset_info-up005", condition); int result = reCnasRemotCall.RemotInterface.UPDataList("hcs_work_specialset_info-up005", condition); if (result > 0) { Close(); } else { OrderNumChangeList = new SortedList(); } }