解决一个壹沓科技OCR时ETD为空引发的问题;解决MsCodeOpStatusDetail查询条件为空时的报错

DS7Zhanhao
ddlucky 2 years ago
parent 2e0b8acaf3
commit 5bff1b6297

@ -519,7 +519,7 @@ namespace DSWeb.Areas.CommMng.DAL
/// <summary>
///
/// </summary>
public DateTime ETD { get; set; }
public DateTime? ETD { get; set; }
/// <summary>
/// 海运托书
/// </summary>
@ -620,15 +620,18 @@ namespace DSWeb.Areas.CommMng.DAL
{ //将识别数据与现有数据合并
//如识别数据有内容 则用其代替现有字段内容
var _result = data.commitResult;
if (!string.IsNullOrWhiteSpace(_result.))
if (data != null && data.commitResult != null)
{
//headdata.
}
//发货人 SHIPPER
PropNameList = new Dictionary<string, string>
var _result = data.commitResult;
if (!string.IsNullOrWhiteSpace(_result.))
{
//headdata.
}
//发货人 SHIPPER
PropNameList = new Dictionary<string, string>
{
@ -671,42 +674,43 @@ namespace DSWeb.Areas.CommMng.DAL
{ "HSCODE", "HSCODE" }
};
foreach (var item in PropNameList)
{
//var value = _result.GetType().GetProperty("发货人").GetValue(_result, null);
foreach (var item in PropNameList)
{
//var value = _result.GetType().GetProperty("发货人").GetValue(_result, null);
//headdata.SetPropertyValue("")
var value = _result.GetType().GetProperty(item.Key).GetValue(_result, null);
//headdata.SetPropertyValue("")
var value = _result.GetType().GetProperty(item.Key).GetValue(_result, null);
if (value != null && !string.IsNullOrWhiteSpace(value.ToString()))
{
headdata.SetPropertyValue(item.Value, value.ToString());
if (value != null && !string.IsNullOrWhiteSpace(value.ToString()))
{
headdata.SetPropertyValue(item.Value, value.ToString());
}
}
}
//不规则的数据
//不规则的数据
var cdc = new CommonDataContext();
var cdc = new CommonDataContext();
headdata.CNTRTOTAL = _result.GetCntrtotal();
headdata.CNTRTOTAL = _result.GetCntrtotal();
var _customername = headdata.CUSTOMERNAME;
var _customername = headdata.CUSTOMERNAME;
//如果CUSTOMERNAME在info_client.SHORTNAME当中不存在 则尝试用info_client.FULLNAME对应后修改之
//如果CUSTOMERNAME在info_client.SHORTNAME当中不存在 则尝试用info_client.FULLNAME对应后修改之
var _infoclient = cdc.info_client.FirstOrDefault(x => x.SHORTNAME == _customername);
if (_infoclient == null || string.IsNullOrWhiteSpace(_infoclient.SHORTNAME))
{
var _tempinfoclient = cdc.info_client.FirstOrDefault(x => x.EnFullName == _customername || x.DESCRIPTION == _customername);
var _infoclient = cdc.info_client.FirstOrDefault(x => x.SHORTNAME == _customername);
if (_tempinfoclient == null || string.IsNullOrWhiteSpace(_tempinfoclient.SHORTNAME))
if (_infoclient == null || string.IsNullOrWhiteSpace(_infoclient.SHORTNAME))
{
headdata.CUSTOMERNAME = _tempinfoclient.SHORTNAME;
var _tempinfoclient = cdc.info_client.FirstOrDefault(x => x.EnFullName == _customername || x.DESCRIPTION == _customername);
if (_tempinfoclient == null || string.IsNullOrWhiteSpace(_tempinfoclient.SHORTNAME))
{
headdata.CUSTOMERNAME = _tempinfoclient.SHORTNAME;
}
}
}
}
private Dictionary<string, string> PropNameList { get; set; } = new Dictionary<string, string>();

@ -83,7 +83,7 @@ namespace DSWeb.MvcShipping.DAL.MsCodeOpStatusDAL
strSql.Append("SELECT ");
strSql.Append("GID,SerialNo,OPTYPE,OPSTATUS,STTYPE,CORPID,REMARKS,COLOR");
strSql.Append(" from code_op_status_detail ");
if (strCondition.Trim() != String.Empty)
if (!string.IsNullOrWhiteSpace(strCondition))
{
strSql.Append(" where " + strCondition);
}

Loading…
Cancel
Save