/// <summary> /// 获取药品行信息和配置方法 /// </summary> /// <param name="labelNo"></param> /// <param name="drugCode"></param> private List <MsgDrugRow> GetDrugRowAndMixMethod(DataSet dsLableInfo, out string mixMethods) { List <MsgDrugRow> lstScreenInfo = new List <MsgDrugRow>(); //lstScreenInfo是所有药品行信息; mixMethods = string.Empty; //mixMethods是所有的配置方法,需分包发送; try { for (int i = 0; i < dsLableInfo.Tables[0].Rows.Count; i++) { string uniPreparationID = dsLableInfo.Tables[0].Rows[i]["UniPreparationID"].ToString(); InternalLogger.Log.Debug("uniPreparationID:" + uniPreparationID); mixMethods += GetMixMethodByDrugCode(uniPreparationID); MsgDrugRow drugRow = new MsgDrugRow(); drugRow.RowAddress = BitConverter.GetBytes(GetScreenAddressOfDrug(i)); Array.Reverse(drugRow.RowAddress); drugRow.DrugIndex = GetStandandArray(drugRow, "DrugIndex", (i + 1).ToString(), false);//从1开始 drugRow.DrugName = GetStandandArray(drugRow, "DrugName", dsLableInfo.Tables[0].Rows[i]["DrugName"].ToString()); drugRow.DrugSpec = GetStandandArray(drugRow, "DrugSpec", dsLableInfo.Tables[0].Rows[i]["Spec"].ToString()); drugRow.DrugDose = GetStandandArray(drugRow, "DrugDose", dsLableInfo.Tables[0].Rows[i]["Dosage"].ToString()); drugRow.DrugCount = GetStandandArray(drugRow, "DrugCount", dsLableInfo.Tables[0].Rows[i]["DgNo"].ToString(), false); lstScreenInfo.Add(drugRow); } } catch (Exception ex) { InternalLogger.Log.Error("获取药品行信息和配置方法出错:" + ex.Message); } return(lstScreenInfo); }
/// <summary> /// 清空药品信息行 /// </summary> /// <param name="displayController"></param> /// <param name="screenIp"></param> /// <param name="screenPort"></param> private void ClearDrugInfo(DisplayController displayController, string screenIp, int screenPort) { for (int i = 0; i < 10; i++)//药品行固定10行,循环清空 { MsgDrugRow drugRow = new MsgDrugRow(); drugRow.RowAddress = BitConverter.GetBytes(GetScreenAddressOfDrug(i)); Array.Reverse(drugRow.RowAddress); drugRow.DrugIndex = GetStandandArray(drugRow, "DrugIndex", string.Empty); drugRow.DrugName = GetStandandArray(drugRow, "DrugName", string.Empty); drugRow.DrugSpec = GetStandandArray(drugRow, "DrugSpec", string.Empty); drugRow.DrugDose = GetStandandArray(drugRow, "DrugDose", string.Empty); drugRow.DrugCount = GetStandandArray(drugRow, "DrugCount", string.Empty); PackSendData(displayController, screenIp, screenPort, drugRow); } }
static void testSizeOf() { MsgChareResRow t = new MsgChareResRow(); Console.WriteLine("MsgChareResRow(50):" + Marshal.SizeOf(t).ToString()); MsgDEmployeeRow t1 = new MsgDEmployeeRow(); Console.WriteLine("MsgDEmployeeRow(38):" + Marshal.SizeOf(t1).ToString()); MsgDrugRow t2 = new MsgDrugRow(); Console.WriteLine("MsgDrugRow(116):" + Marshal.SizeOf(t2).ToString()); MsgPatientRow t3 = new MsgPatientRow(); Console.WriteLine("MsgPatientRow(92):" + Marshal.SizeOf(t3).ToString()); MsgGeneral t4 = new MsgGeneral(); Console.WriteLine("MsgGeneral(4):" + Marshal.SizeOf(t4).ToString()); }