{
errorMessage = "";
try
{
HisService.HisServiceSoapClient TMISClient = new HisService.HisServiceSoapClient();
HisService.SendBloodClex SendBloodClex = new HisService.SendBloodClex();
HisService.SendBloodInfo SendBlodInfo = new HisService.SendBloodInfo();
HisService.SendBloodListInfo[] SendBloodListInfos = new HisService.SendBloodListInfo[gSendBloodListInfo.Length];
//SendBlodInfo.Name = "aaaa";
SendBlodInfo.HospitalId = Helper.NVL(gSendBloodInfo.hospitalId, "", true);
SendBlodInfo.Id = Helper.NVL(gSendBloodInfo.id,"",true);
SendBlodInfo.CaseId = Helper.NVL(gSendBloodInfo.caseId,"", true);
SendBlodInfo.Name = Helper.NVL(gSendBloodInfo.name, "", true);
SendBlodInfo.SexId = Helper.NVL(gSendBloodInfo.sexId, "", true);
SendBlodInfo.Birthday = Convert.ToDateTime(Helper.NVL(gSendBloodInfo.birthday.ToString(), "", true));
SendBlodInfo.IdCard = Helper.NVL(gSendBloodInfo.idCard, "", true);
SendBlodInfo.InHospitalId = Helper.NVL(gSendBloodInfo.inHospitalId, "", true);
SendBlodInfo.LocalHospitalId = Helper.NVL(gSendBloodInfo.localHospitalId, "", true);
SendBlodInfo.ApanageId = Helper.NVL(gSendBloodInfo.apanageId, "", true);
SendBlodInfo.BloodType = Helper.NVL(gSendBloodInfo.bloodType, "", true);
SendBlodInfo.BloodRh = Helper.NVL(gSendBloodInfo.bloodRh, "", true);
SendBlodInfo.Other = Helper.NVL(gSendBloodInfo.other, "", true);
SendBlodInfo.Age = Convert.ToInt32(Helper.NVL(gSendBloodInfo.age.ToString(), "", true));
SendBlodInfo.AgeTypeId = Helper.NVL(gSendBloodInfo.ageTypeId, "", true);
SendBlodInfo.OfficeId = Helper.NVL(gSendBloodInfo.officeId, "", true);
SendBlodInfo.BedAreaId = Helper.NVL(gSendBloodInfo.bedAreaId, "", true);
SendBlodInfo.BedAreaName = Helper.NVL(gSendBloodInfo.bedAreaName, "", true);
SendBlodInfo.BedNumber = Helper.NVL(gSendBloodInfo.bedNumber, "", true);
SendBlodInfo.Pregnant = Convert.ToInt16(Helper.NVL(gSendBloodInfo.pregnant.ToString(), "", true));
SendBlodInfo.Birth = Convert.ToInt16(Helper.NVL(gSendBloodInfo.birth.ToString(), "", true));
SendBlodInfo.HistoryId = Helper.NVL(gSendBloodInfo.historyId, "", true);
SendBlodInfo.IllnessId = Helper.NVL(gSendBloodInfo.IllnessId, "", true);
SendBlodInfo.IllnessName = Helper.NVL(gSendBloodInfo.IllnessName, "", true);
SendBlodInfo.Illness = Helper.NVL(gSendBloodInfo.Illness, "", true);
SendBlodInfo.Hgb = Convert.ToDecimal(Helper.NVL(gSendBloodInfo.hgb.ToString(), "", true));
SendBlodInfo.Hct = Convert.ToDecimal(Helper.NVL(gSendBloodInfo.hct.ToString(), "", true));
SendBlodInfo.Plt = Convert.ToDecimal(Helper.NVL(gSendBloodInfo.plt.ToString(), "", true));
SendBlodInfo.Alt = Convert.ToDecimal(Helper.NVL(gSendBloodInfo.alt.ToString(), "", true));
SendBlodInfo.HbsagId = Helper.NVL(gSendBloodInfo.hbsagId, "", true);
SendBlodInfo.HbeId = Helper.NVL(gSendBloodInfo.hbeId, "", true);
SendBlodInfo.HbcId = Helper.NVL(gSendBloodInfo.hbcId, "", true);
SendBlodInfo.AhbsId = Helper.NVL(gSendBloodInfo.ahbsId, "", true);
SendBlodInfo.HcvId = Helper.NVL(gSendBloodInfo.hcvId, "", true);
SendBlodInfo.HivId = Helper.NVL(gSendBloodInfo.hivId, "", true);
SendBlodInfo.SypId = Helper.NVL(gSendBloodInfo.sypId, "", true);
SendBlodInfo.PT = Convert.ToDecimal(Helper.NVL(gSendBloodInfo.PT.ToString(), "", true));
SendBlodInfo.APTT = Convert.ToDecimal(Helper.NVL(gSendBloodInfo.APTT.ToString(), "", true));
SendBlodInfo.FIB = Convert.ToDecimal(Helper.NVL(gSendBloodInfo.FIB.ToString(), "", true));
SendBlodInfo.TT = Convert.ToDecimal(Helper.NVL(gSendBloodInfo.TT.ToString(), "", true));
SendBlodInfo.DD = Convert.ToDecimal(Helper.NVL(gSendBloodInfo.DD.ToString(), "", true));
SendBlodInfo.FDT = Convert.ToDecimal(Helper.NVL(gSendBloodInfo.FDT.ToString(), "", true));
SendBlodInfo.Routine = Helper.NVL(gSendBloodInfo.Routine, "", true);
SendBlodInfo.Aim = Helper.NVL(gSendBloodInfo.Aim, "", true);
SendBlodInfo.UseTypeId = Helper.NVL(gSendBloodInfo.UseTypeId, "", true);
SendBlodInfo.UseTypeName = Helper.NVL(gSendBloodInfo.UseTypeName, "", true);
SendBlodInfo.SenderId = Helper.NVL(gSendBloodInfo.SenderId, "", true);
SendBlodInfo.SendDate = Convert.ToDateTime(Helper.NVL(gSendBloodInfo.SendDate.ToString(), "", true));
SendBlodInfo.TesterId = Helper.NVL(gSendBloodInfo.TesterId, "", true);
SendBlodInfo.RequistionDate = Convert.ToDateTime(Helper.NVL(gSendBloodInfo.RequistionDate.ToString(), "", true));
SendBlodInfo.TransDate = Convert.ToDateTime(Helper.NVL(gSendBloodInfo.TransDate.ToString(), "", true));
SendBlodInfo.ApplyDoctor = Helper.NVL(gSendBloodInfo.ApplyDoctorId, "", true);
for (int i = 0; i < gSendBloodListInfo.Length; i++)
{
SendBloodListInfos[i].BloodId = "1";
//SendBloodClex.SendBloodListInfos[i].BloodId = "1";
SendBloodListInfos[i].BloodId = Helper.NVL(gSendBloodListInfo[i].BloodId, "", true);
SendBloodListInfos[i].DonId = Helper.NVL(gSendBloodListInfo[i].DonId, "", true);
SendBloodListInfos[i].ProId = Helper.NVL(gSendBloodListInfo[i].ProId, "", true);
}
SendBloodClex.SendBlodInfo = SendBlodInfo;
SendBloodClex.SendBloodListInfos = SendBloodListInfos;
errorMessage = TMISClient.SyncHISBloodSendInfo(TMISHelper.TmisUserName, TMISHelper.TmisUserPsd, SendBloodClex);
}
catch (Exception e)
{
errorMessage = e.Message;
//throw;
}
}
7 个解决方案
#1
SendBloodListInfos[i].BloodId = "1";//报错 未将对象引用设置到对象的实例
#2
再顶 adsa
#3
SendBloodListInfos[i]为null
#4
偌大个CSDN都没有解决我的问题,还是我自己解决的
办法:HisService.SendBloodListInfo[] SendBloodListInfos = new HisService.SendBloodListInfo[gSendBloodListInfo.Length];声明类对象数组时候需要对数组中的每个对象进行初始化
办法:HisService.SendBloodListInfo[] SendBloodListInfos = new HisService.SendBloodListInfo[gSendBloodListInfo.Length];声明类对象数组时候需要对数组中的每个对象进行初始化
for (int i = 0; i < gSendBloodListInfo.Length; i++)
{
SendBloodListInfos[i] = new HisService.SendBloodListInfo();
}
#5
看你的代码写法,就知道你不调试。你既然无法跟人家说出具体的那一条语句抛出异常,你既然不调试、靠求人,那么只能个人也与开发。在一个正规的软件公司,这样不会vs调试的程序员是进不去的。
#6
如果你在一个正规软件公司里,你请技术经理给你看一下,人家一来就要操作你vs调试器,查看断点处的变量信息,甚至调用堆栈里深层入口的环境变量信息。
而你呢?扔给人家一个 errorMessage 字符串,这就是你提出这个帖子的方式。这个方式说明丧失了调试能力,所以没人解决你的问题啊。
而你呢?扔给人家一个 errorMessage 字符串,这就是你提出这个帖子的方式。这个方式说明丧失了调试能力,所以没人解决你的问题啊。
#7
初级程序员的硬伤,调试出来错误,不知道怎么改,这也能算错,不过找不到对象这种事经常碰到,碰到多了就知道怎么处理了
#1
SendBloodListInfos[i].BloodId = "1";//报错 未将对象引用设置到对象的实例
#2
再顶 adsa
#3
SendBloodListInfos[i]为null
#4
偌大个CSDN都没有解决我的问题,还是我自己解决的
办法:HisService.SendBloodListInfo[] SendBloodListInfos = new HisService.SendBloodListInfo[gSendBloodListInfo.Length];声明类对象数组时候需要对数组中的每个对象进行初始化
办法:HisService.SendBloodListInfo[] SendBloodListInfos = new HisService.SendBloodListInfo[gSendBloodListInfo.Length];声明类对象数组时候需要对数组中的每个对象进行初始化
for (int i = 0; i < gSendBloodListInfo.Length; i++)
{
SendBloodListInfos[i] = new HisService.SendBloodListInfo();
}
#5
看你的代码写法,就知道你不调试。你既然无法跟人家说出具体的那一条语句抛出异常,你既然不调试、靠求人,那么只能个人也与开发。在一个正规的软件公司,这样不会vs调试的程序员是进不去的。
#6
如果你在一个正规软件公司里,你请技术经理给你看一下,人家一来就要操作你vs调试器,查看断点处的变量信息,甚至调用堆栈里深层入口的环境变量信息。
而你呢?扔给人家一个 errorMessage 字符串,这就是你提出这个帖子的方式。这个方式说明丧失了调试能力,所以没人解决你的问题啊。
而你呢?扔给人家一个 errorMessage 字符串,这就是你提出这个帖子的方式。这个方式说明丧失了调试能力,所以没人解决你的问题啊。
#7
初级程序员的硬伤,调试出来错误,不知道怎么改,这也能算错,不过找不到对象这种事经常碰到,碰到多了就知道怎么处理了