|
@@ -36,6 +36,32 @@ namespace JLHHJSvr.Excutor
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
|
|
+ // 只处理主规格
|
|
|
|
+ Dictionary<int, u_mattress> mattressDic = new Dictionary<int, u_mattress>();
|
|
|
|
+
|
|
|
|
+ foreach (int itemid in request.mattressids)
|
|
|
|
+ {
|
|
|
|
+ var mattressInfo = new u_mattress() { mattressid = itemid };
|
|
|
|
+ if (DbSqlHelper.SelectOne(cmd, mattressInfo, "flag, xd_flag, mattresscode, parentid") != 1)
|
|
|
|
+ {
|
|
|
|
+ rslt.ErrMsg = "查找报价单据失败:" + itemid;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (mattressInfo.parentid > 0)
|
|
|
|
+ {
|
|
|
|
+ mattressInfo = new u_mattress() { mattressid = mattressInfo.parentid.Value };
|
|
|
|
+ if (DbSqlHelper.SelectOne(cmd, mattressInfo, "flag, xd_flag, parentid") != 1)
|
|
|
|
+ {
|
|
|
|
+ rslt.ErrMsg = "查找报价单据失败:" + itemid;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!mattressDic.ContainsKey(mattressInfo.mattressid))
|
|
|
|
+ {
|
|
|
|
+ mattressDic.Add(mattressInfo.mattressid, mattressInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
if (request.xd_flag != null)
|
|
if (request.xd_flag != null)
|
|
{
|
|
{
|
|
@@ -56,25 +82,20 @@ namespace JLHHJSvr.Excutor
|
|
|
|
|
|
var updateField = "xd_flag, xd_auditingrep, xd_auditingdate";
|
|
var updateField = "xd_flag, xd_auditingrep, xd_auditingdate";
|
|
|
|
|
|
- foreach (int itemid in request.mattressids)
|
|
|
|
|
|
+ foreach (var item in mattressDic)
|
|
{
|
|
{
|
|
- var mattressInfo = new u_mattress() { mattressid = itemid };
|
|
|
|
- if (DbSqlHelper.SelectOne(cmd, mattressInfo, "flag, xd_flag") != 1)
|
|
|
|
- {
|
|
|
|
- rslt.ErrMsg = "查找报价单据失败:" + itemid;
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ var mattressInfo = item.Value;
|
|
|
|
|
|
if (request.xd_flag == 1)
|
|
if (request.xd_flag == 1)
|
|
{
|
|
{
|
|
if (mattressInfo.flag == 1)
|
|
if (mattressInfo.flag == 1)
|
|
{
|
|
{
|
|
- rslt.ErrMsg = "床垫已审核,不能业务下单!(" + itemid + ")";
|
|
|
|
|
|
+ rslt.ErrMsg = "床垫已审核,不能业务下单!(" + mattressInfo.mattresscode + ")";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (mattressInfo.xd_flag == 1)
|
|
if (mattressInfo.xd_flag == 1)
|
|
{
|
|
{
|
|
- rslt.ErrMsg = "床垫已完成业务下单(" + itemid + ")";
|
|
|
|
|
|
+ rslt.ErrMsg = "床垫已完成业务下单(" + mattressInfo.mattresscode + ")";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -88,17 +109,18 @@ namespace JLHHJSvr.Excutor
|
|
throw new LJCommonException("因网络或其它原因,【业务下单/取消】操作失败!");
|
|
throw new LJCommonException("因网络或其它原因,【业务下单/取消】操作失败!");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ UpdateChildState(cmd, mattressInfo, "xd_flag", 1);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
if (mattressInfo.js1_flag == 1)
|
|
if (mattressInfo.js1_flag == 1)
|
|
{
|
|
{
|
|
- rslt.ErrMsg = "已产品补充审核,不能取消下单!(" + itemid + ")";
|
|
|
|
|
|
+ rslt.ErrMsg = "已产品补充审核,不能取消下单!(" + mattressInfo.mattresscode + ")";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
if (mattressInfo.xd_flag == 0)
|
|
if (mattressInfo.xd_flag == 0)
|
|
{
|
|
{
|
|
- rslt.ErrMsg = "未进行业务下单,不能取消下单!(" + itemid + ")";
|
|
|
|
|
|
+ rslt.ErrMsg = "未进行业务下单,不能取消下单!(" + mattressInfo.mattresscode + ")";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -110,6 +132,8 @@ namespace JLHHJSvr.Excutor
|
|
{
|
|
{
|
|
throw new LJCommonException("因网络或其它原因,【业务下单/取消】操作失败!");
|
|
throw new LJCommonException("因网络或其它原因,【业务下单/取消】操作失败!");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ UpdateChildState(cmd, mattressInfo, "xd_flag", 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -132,20 +156,15 @@ namespace JLHHJSvr.Excutor
|
|
|
|
|
|
var updateField = "flag, auditingrep, auditingdate";
|
|
var updateField = "flag, auditingrep, auditingdate";
|
|
|
|
|
|
- foreach (int itemid in request.mattressids)
|
|
|
|
|
|
+ foreach (var item in mattressDic)
|
|
{
|
|
{
|
|
- var mattressInfo = new u_mattress() { mattressid = itemid };
|
|
|
|
- if (DbSqlHelper.SelectOne(cmd, mattressInfo, "flag") != 1)
|
|
|
|
- {
|
|
|
|
- rslt.ErrMsg = "查找报价单据失败:" + itemid;
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ var mattressInfo = item.Value;
|
|
|
|
|
|
if (request.flag == 1)
|
|
if (request.flag == 1)
|
|
{
|
|
{
|
|
if (mattressInfo.flag == 1)
|
|
if (mattressInfo.flag == 1)
|
|
{
|
|
{
|
|
- rslt.ErrMsg = "床报价已完成审核(" + itemid + ")";
|
|
|
|
|
|
+ rslt.ErrMsg = "床报价已完成审核(" + mattressInfo.mattresscode + ")";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -158,12 +177,13 @@ namespace JLHHJSvr.Excutor
|
|
throw new LJCommonException("因网络或其它原因,【审核消】操作失败!");
|
|
throw new LJCommonException("因网络或其它原因,【审核消】操作失败!");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ UpdateChildState(cmd, mattressInfo, "flag", 1);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
if (mattressInfo.flag == 0)
|
|
if (mattressInfo.flag == 0)
|
|
{
|
|
{
|
|
- rslt.ErrMsg = "床报价已完成撤销审核!(" + itemid + ")";
|
|
|
|
|
|
+ rslt.ErrMsg = "床报价已完成撤销审核!(" + mattressInfo.mattresscode + ")";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -175,6 +195,8 @@ namespace JLHHJSvr.Excutor
|
|
{
|
|
{
|
|
throw new LJCommonException("因网络或其它原因,【撤销审核】操作失败!");
|
|
throw new LJCommonException("因网络或其它原因,【撤销审核】操作失败!");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ UpdateChildState(cmd, mattressInfo, "flag", 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -193,5 +215,65 @@ namespace JLHHJSvr.Excutor
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public void UpdateChildState(SqlCommand cmd, u_mattress mattress, string fieldStr, int value)
|
|
|
|
+ {
|
|
|
|
+ var updateStr = "";
|
|
|
|
+ var rep = "";
|
|
|
|
+ DateTime? date = null;
|
|
|
|
+ if (fieldStr == "xd_flag")
|
|
|
|
+ {
|
|
|
|
+ if (mattress.auditingdate.HasValue)
|
|
|
|
+ {
|
|
|
|
+ updateStr = @"
|
|
|
|
+ xd_auditingrep = @rep,
|
|
|
|
+ xd_auditingdate = @date
|
|
|
|
+ ";
|
|
|
|
+ rep = mattress.xd_auditingrep;
|
|
|
|
+ date = mattress.xd_auditingdate;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ updateStr = @"
|
|
|
|
+ xd_auditingrep = @rep,
|
|
|
|
+ xd_auditingdate = null
|
|
|
|
+ ";
|
|
|
|
+ rep = mattress.xd_auditingrep;
|
|
|
|
+ }
|
|
|
|
+ } else
|
|
|
|
+ {
|
|
|
|
+ if (mattress.auditingdate.HasValue)
|
|
|
|
+ {
|
|
|
|
+ updateStr = @"
|
|
|
|
+ auditingrep = @rep,
|
|
|
|
+ auditingdate = @date
|
|
|
|
+ ";
|
|
|
|
+ rep = mattress.auditingrep;
|
|
|
|
+ date = mattress.auditingdate;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ updateStr = @"
|
|
|
|
+ auditingrep = @rep,
|
|
|
|
+ auditingdate = null
|
|
|
|
+ ";
|
|
|
|
+ rep = mattress.auditingrep;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ cmd.CommandText = @"UPDATE u_mattress
|
|
|
|
+ SET " + fieldStr + @" = @value,
|
|
|
|
+ " + updateStr + @"
|
|
|
|
+ FROM u_mattress
|
|
|
|
+ WHERE u_mattress.parentid = @mattressid";
|
|
|
|
+ cmd.Parameters.Clear();
|
|
|
|
+ cmd.Parameters.AddWithValue("@mattressid", mattress.mattressid);
|
|
|
|
+ cmd.Parameters.AddWithValue("@value", value);
|
|
|
|
+ cmd.Parameters.AddWithValue("@rep", rep);
|
|
|
|
+ if (date.HasValue)
|
|
|
|
+ {
|
|
|
|
+ cmd.Parameters.AddWithValue("@date", date);
|
|
|
|
+ }
|
|
|
|
+ cmd.ExecuteNonQuery();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|