diff --git a/D7MqClient/D7MqClient/JFtoDjyBackNo.cs b/D7MqClient/D7MqClient/JFtoDjyBackNo.cs index 79ad10ff..64964a5a 100644 --- a/D7MqClient/D7MqClient/JFtoDjyBackNo.cs +++ b/D7MqClient/D7MqClient/JFtoDjyBackNo.cs @@ -57,7 +57,7 @@ namespace D7MqClient try { //回写数据 - var feeback = JsonConvert.DeserializeAnonymousType(strBody, new { FeedbackType = string.Empty, FeedbackData = new { MBLNO = string.Empty, BSNO = string.Empty, IRCode = string.Empty, CSRCode = string.Empty, FF = string.Empty } }); + var feeback = JsonConvert.DeserializeAnonymousType(strBody, new { FeedbackType = string.Empty, FeedbackData = new { MBLNO = string.Empty, BSNO = string.Empty, IRCode = string.Empty, CSRCode = string.Empty, FF = string.Empty, FR = string.Empty } }); using (SqlConnection dbcon = new SqlConnection(connStr)) { @@ -71,12 +71,23 @@ namespace D7MqClient if (DSVER == "7") { var CUSTNO = ""; - if (!string.IsNullOrEmpty(feeback.FeedbackData.BSNO)) CUSTNO = feeback.FeedbackData.BSNO; + var BSNO = ""; + if (!string.IsNullOrEmpty(feeback.FeedbackData.BSNO)) BSNO = feeback.FeedbackData.BSNO; if (!string.IsNullOrEmpty(feeback.FeedbackData.FF)) CUSTNO = feeback.FeedbackData.FF; - var strSql = new StringBuilder(); - strSql.Append("update op_seae set IRCODE='" + IRCODE + "' where CUSTNO='" + CUSTNO + "' AND ISNULL(IRCODE,'')=''"); - SqlCommand cmd = new SqlCommand(strSql.ToString(), dbcon); - cmd.ExecuteNonQuery(); + if (!string.IsNullOrEmpty(feeback.FeedbackData.FR)) CUSTNO = feeback.FeedbackData.FR; + if (!string.IsNullOrEmpty(BSNO)) { + var strSql2 = new StringBuilder(); + strSql2.Append("update op_seae set IRCODE='" + IRCODE + "' where BSNO='" + BSNO + "' AND ISNULL(IRCODE,'')=''"); + SqlCommand cmd2 = new SqlCommand(strSql2.ToString(), dbcon); + cmd2.ExecuteNonQuery(); + } + if (!string.IsNullOrEmpty(CUSTNO)) + { + var strSql = new StringBuilder(); + strSql.Append("update op_seae set IRCODE='" + IRCODE + "' where CUSTNO='" + CUSTNO + "' AND ISNULL(IRCODE,'')=''"); + SqlCommand cmd = new SqlCommand(strSql.ToString(), dbcon); + cmd.ExecuteNonQuery(); + } } else { @@ -98,12 +109,23 @@ namespace D7MqClient if (DSVER == "7") { var CUSTNO = ""; - if (!string.IsNullOrEmpty(feeback.FeedbackData.BSNO)) CUSTNO = feeback.FeedbackData.BSNO; - if (!string.IsNullOrEmpty(feeback.FeedbackData.FF)) CUSTNO = feeback.FeedbackData.FF; - var strSql = new StringBuilder(); - strSql.Append("update op_seae set MBLNO='" + feeback.FeedbackData.MBLNO + "' where CUSTNO='" + CUSTNO + "' AND ISNULL(MBLNO,'')='' "); - SqlCommand cmd = new SqlCommand(strSql.ToString(), dbcon); - cmd.ExecuteNonQuery(); + var BSNO = ""; + if (!string.IsNullOrEmpty(feeback.FeedbackData.BSNO)) BSNO = feeback.FeedbackData.BSNO; + if (!string.IsNullOrEmpty(feeback.FeedbackData.FR)) CUSTNO = feeback.FeedbackData.FR; + if (!string.IsNullOrEmpty(BSNO)) + { + var strSql2 = new StringBuilder(); + strSql2.Append("update op_seae set MBLNO='" + feeback.FeedbackData.MBLNO + "' where BSNO='" + BSNO + "' AND ISNULL(MBLNO,'')=''"); + SqlCommand cmd2 = new SqlCommand(strSql2.ToString(), dbcon); + cmd2.ExecuteNonQuery(); + } + if (!string.IsNullOrEmpty(CUSTNO)) + { + var strSql = new StringBuilder(); + strSql.Append("update op_seae set MBLNO='" + feeback.FeedbackData.MBLNO + "' where CUSTNO='" + CUSTNO + "' AND ISNULL(MBLNO,'')='' "); + SqlCommand cmd = new SqlCommand(strSql.ToString(), dbcon); + cmd.ExecuteNonQuery(); + } } else {