|
@@ -11368,7 +11368,7 @@ namespace SiteCore.Handler
|
|
|
{
|
|
{
|
|
|
int userid = CurrentUser.UserID;
|
|
int userid = CurrentUser.UserID;
|
|
|
StringBuilder sql = new StringBuilder();
|
|
StringBuilder sql = new StringBuilder();
|
|
|
- sql.AppendFormat("select top 1 * from CE_ErpMessageTip c where (c.userId = '{0}' ) and c.isVisit = 0 and c.type = 3;", userid);
|
|
|
|
|
|
|
+ sql.AppendFormat("select top 1 * from CE_ErpMessageTip c where (c.userId = '{0}' ) and c.isVisit = 0 and c.type in (3,4);", userid);
|
|
|
DataTable dth = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
|
|
DataTable dth = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
|
|
|
List<string> ids = new List<string>();
|
|
List<string> ids = new List<string>();
|
|
|
|
|
|
|
@@ -14718,6 +14718,7 @@ namespace SiteCore.Handler
|
|
|
public void applyOrderBack()
|
|
public void applyOrderBack()
|
|
|
{
|
|
{
|
|
|
string ctid = GetPostString("ctid");
|
|
string ctid = GetPostString("ctid");
|
|
|
|
|
+ string reason = GetPostString("reason");
|
|
|
if (!string.IsNullOrEmpty(ctid))
|
|
if (!string.IsNullOrEmpty(ctid))
|
|
|
{
|
|
{
|
|
|
CeErpTradeCell ceErpTradeCell = CeErpTradeCell.GetByCtid(ctid);
|
|
CeErpTradeCell ceErpTradeCell = CeErpTradeCell.GetByCtid(ctid);
|
|
@@ -14741,9 +14742,47 @@ namespace SiteCore.Handler
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ string sql = string.Format("select Con,UserId from CE_ErpTradeLog where tid = '{0}'", ceErpTradeCell.ctid);
|
|
|
|
|
+ DataTable dataTable = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
|
|
|
|
|
+ if (dataTable != null && dataTable.Rows.Count > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ foreach (DataRow row in dataTable.Rows)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (row["Con"].ToString().Contains("拒绝打回"))
|
|
|
|
|
+ {
|
|
|
|
|
+ returnErrorMsg("被拒绝过无法继续申请");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
ceErpTradeCell.IsReturn = 4;
|
|
ceErpTradeCell.IsReturn = 4;
|
|
|
ceErpTradeCell.Update();
|
|
ceErpTradeCell.Update();
|
|
|
- LogHelper.addLog(ceErpTradeCell.ctid, CurrentUser.UserID, "申请打回", ceErpTradeCell.OrderState);
|
|
|
|
|
|
|
+ LogHelper.addLog(ceErpTradeCell.ctid, CurrentUser.UserID, "申请打回:" + reason, ceErpTradeCell.OrderState);
|
|
|
|
|
+ returnSuccessMsg("保存成功");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ returnErrorMsg("缺少必要的参数");
|
|
|
|
|
+ }
|
|
|
|
|
+ public void cancelApplyOrderBack()
|
|
|
|
|
+ {
|
|
|
|
|
+ string ctid = GetPostString("ctid");
|
|
|
|
|
+ if (!string.IsNullOrEmpty(ctid))
|
|
|
|
|
+ {
|
|
|
|
|
+ CeErpTradeCell ceErpTradeCell = CeErpTradeCell.GetByCtid(ctid);
|
|
|
|
|
+ if (ceErpTradeCell == null)
|
|
|
|
|
+ {
|
|
|
|
|
+ returnErrorMsg("找不到订单");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ceErpTradeCell.IsReturn != 4)
|
|
|
|
|
+ {
|
|
|
|
|
+ returnErrorMsg("订单未在申请阶段");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ ceErpTradeCell.IsReturn = 0;
|
|
|
|
|
+ ceErpTradeCell.Update();
|
|
|
|
|
+ LogHelper.addLog(ceErpTradeCell.ctid, CurrentUser.UserID, "取消申请打回", ceErpTradeCell.OrderState);
|
|
|
returnSuccessMsg("保存成功");
|
|
returnSuccessMsg("保存成功");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -14793,6 +14832,10 @@ namespace SiteCore.Handler
|
|
|
lw.Add(string.Format("SupplierId in ({0})", CurrentUser.User.pemVend));
|
|
lw.Add(string.Format("SupplierId in ({0})", CurrentUser.User.pemVend));
|
|
|
lw.Add(string.Format("OrderState = 6"));
|
|
lw.Add(string.Format("OrderState = 6"));
|
|
|
}
|
|
}
|
|
|
|
|
+ else if (CurrentUser.UserPost.Post.Code == "Place" || CurrentUser.UserPost.Post.Code == "PlaceMr")
|
|
|
|
|
+ {
|
|
|
|
|
+ lw.Add("OrderState = 5");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
lw.Add(string.Format("IsReturn = 4"));
|
|
lw.Add(string.Format("IsReturn = 4"));
|
|
|
|
|
|
|
@@ -14820,7 +14863,30 @@ namespace SiteCore.Handler
|
|
|
returnErrorMsg("找不到订单");
|
|
returnErrorMsg("找不到订单");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ string sql = string.Format("select Con,UserId from CE_ErpTradeLog where tid = '{0}' order by ID desc", ceErpTradeCell.ctid);
|
|
|
|
|
+ DataTable dataTable = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
|
|
|
|
|
+ int userId = 0;
|
|
|
|
|
+ if (dataTable != null && dataTable.Rows.Count > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ foreach (DataRow row in dataTable.Rows)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (row["Con"].ToString().Contains("申请打回:"))
|
|
|
|
|
+ {
|
|
|
|
|
+ userId = Convert.ToInt32(row["UserId"]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (userId > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ CeErpMessageTip ct = new CeErpMessageTip();
|
|
|
|
|
+ ct.tid = ceErpTradeCell.ctid;
|
|
|
|
|
+ ct.sectionId = 0;
|
|
|
|
|
+ ct.userId = userId;
|
|
|
|
|
+ ct.type = 4;
|
|
|
|
|
+ ct.isVisit = false;
|
|
|
|
|
+ ct.content = ceErpTradeCell.ctid + ",申请打回被拒绝:" + reason;
|
|
|
|
|
+ ct.Create();
|
|
|
|
|
+ }
|
|
|
ceErpTradeCell.IsReturn = 0;
|
|
ceErpTradeCell.IsReturn = 0;
|
|
|
ceErpTradeCell.Update();
|
|
ceErpTradeCell.Update();
|
|
|
LogHelper.addLog(ceErpTradeCell.ctid, CurrentUser.UserID, "拒绝打回:" + reason, ceErpTradeCell.OrderState);
|
|
LogHelper.addLog(ceErpTradeCell.ctid, CurrentUser.UserID, "拒绝打回:" + reason, ceErpTradeCell.OrderState);
|
|
@@ -14829,6 +14895,40 @@ namespace SiteCore.Handler
|
|
|
}
|
|
}
|
|
|
returnErrorMsg("缺少必要的参数");
|
|
returnErrorMsg("缺少必要的参数");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public void getApplyBackCount()
|
|
|
|
|
+ {
|
|
|
|
|
+ string sql = string.Format("SELECT top 1 ctid FROM [dbo].[CE_ErpTradeCell]");
|
|
|
|
|
+
|
|
|
|
|
+ List<string> lw = new List<string>();
|
|
|
|
|
+ lw.Add("IsReturn = 4");
|
|
|
|
|
+ if (CurrentUser.UserPost.Post.Code == "Supplier")
|
|
|
|
|
+ {
|
|
|
|
|
+ lw.Add("OrderState = 6");
|
|
|
|
|
+ lw.Add(string.Format("SupplierId in ({0})", CurrentUser.User.pemVend));
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (CurrentUser.UserPost.Post.Code == "Place" || CurrentUser.UserPost.Post.Code == "PlaceMr")
|
|
|
|
|
+ {
|
|
|
|
|
+ lw.Add("OrderState = 5");
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ ReturnSuccess("{" + string.Format("\"data\":{0}", "0") + "}");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ sql += " where " + string.Join(" and ", lw.ToArray());
|
|
|
|
|
+ DataTable dataTable = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
|
|
|
|
|
+ List<string> list = new List<string>();
|
|
|
|
|
+ if (dataTable != null && dataTable.Rows.Count > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ foreach (DataRow row in dataTable.Rows)
|
|
|
|
|
+ {
|
|
|
|
|
+ list.Add(row["ctid"].ToString());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ReturnSuccess("{" + string.Format("\"data\":{0}", "\"" + string.Join(",", list) + "\"") + "}");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|