| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- using BizCom;
- using SQLData;
- using System;
- using System.Collections.Generic;
- using System.Data;
- namespace SiteCore.Handler
- {
- public partial class sync
- {
- //通知接口---------------------------------------------
- public void get_erp_noticelist()
- {
- DataStruct dStruct = GetPostStruct();
- List<string> lw = new List<string>();
- string date1 = GetPostString("date1");
- string date2 = GetPostString("date2");
- string dw = GetDateMinuteWhere("NoticeTime", date1, date2);
- if (dw.Length > 0) lw.Add(dw);
- string title = GetPostString("title");
- if (title.Length > 0) lw.Add(string.Format("Title like '%{0}%'", title));
- lw.Add(string.Format("uid={0}", CurrentUser.UserID));
- dStruct.Order = "ID desc";
- dStruct.MainWhere = string.Join(" and ", lw.ToArray());
- DataTable dt = WebCache.GetData("view_ErpNoticeCell", dStruct);
- writeGridDataTableJson(dStruct.TotalCount, dt);
- }
- public void get_erp_edit_noticelist()
- {
- DataStruct dStruct = GetPostStruct();
- List<string> lw = new List<string>();
- string date1 = GetPostString("date1");
- string date2 = GetPostString("date2");
- string dw = GetDateMinuteWhere("NoticeTime", date1, date2);
- if (dw.Length > 0) lw.Add(dw);
- string title = GetPostString("title");
- if (title.Length > 0) lw.Add(string.Format("Title like '%{0}%'", title));
- if (CurrentUser.UserPost.Post.Code != "SysAdmin")
- {
- lw.Add(string.Format("senderId={0}", CurrentUser.UserID));
- }
- dStruct.Order = "ID desc";
- dStruct.MainWhere = string.Join(" and ", lw.ToArray());
- DataTable dt = WebCache.GetData("view_ErpNotice", dStruct);
- writeGridDataTableJson(dStruct.TotalCount, dt);
- }
- public void add_erp_notice()
- {
- string id = GetPostString("id");
- CeErpNotice Nt = null;
- if (id.Length > 0)
- {
- Nt = CeErpNotice.Get(id);
- }
- else
- {
- Nt = new CeErpNotice();
- }
- string title = GetPostString("title");
- string con = GetPostString("con");
- string noticeTime = GetPostString("noticeTime");
- string receiver = GetPostString("receiver");
- string receiverStr = GetPostString("receiverStr");
- Nt.Title = title;
- Nt.NoticeType = GetPostString("noticeType");
- Nt.Con = con;
- Nt.NoticeTime = Convert.ToDateTime(noticeTime);
- Nt.CreatedTime = DateTime.Now;
- Nt.Receiver = receiver;
- Nt.ReceiverStr = receiverStr;
- Nt.senderId = CurrentUser.UserID;
- if (id.Length > 0)
- {
- Nt.Update();
- CeErpNoticeCell.DelByNid(Nt.ID);
- }
- else
- {
- Nt.Create();
- }
- //StringBuilder sql = new StringBuilder();
- //sql.AppendFormat("select * from view_erpuser where OrgID in ({0})", receiverOrg);
- //DataTable dt = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
- //if (dt.Rows.Count > 0)
- //{
- string[] idList = receiver.Split(',');
- foreach (string iditem in idList)
- {
- if (iditem.IndexOf("o") != -1) continue;
- CeErpNoticeCell ntcell = new CeErpNoticeCell();
- ntcell.nid = Nt.ID;
- ntcell.uid = Convert.ToInt32(iditem);
- ntcell.Create();
- }
- //}
- returnSuccessMsg("添加成功");
- return;
- }
- public void get_notice_user()
- {
- string sql = "select * from view_ErpUser where isOpen=1";
- DataTable dt = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
- returnSuccess(Utils.Serialization.JsonString.DataTable2MiniAjaxJson(dt));
- }
- public void set_erp_readnotice()
- {
- if (UrlPostParmsCheck("ids"))
- {
- string ids = GetPostString("ids");
- string[] idList = ids.Split(',');
- foreach (string id in idList)
- {
- if (id == "") continue;
- CeErpNoticeCell ntcell = CeErpNoticeCell.Get(id);
- if (ntcell != null)
- {
- ntcell.IsRead = 1;
- ntcell.ReadTime = DateTime.Now;
- ntcell.Update();
- }
- }
- returnSuccessMsg("操作成功");
- return;
- }
- returnErrorMsg("缺少必要参数");
- }
- public void del_erp_notice()
- {
- if (UrlPostParmsCheck("id"))
- {
- string id = GetPostString("id");
- CeErpNotice.Del(id);
- CeErpNoticeCell.DelByNid(id);
- returnSuccessMsg("操作成功");
- return;
- }
- returnErrorMsg("缺少必要参数");
- }
- public void sel_erp_checkreadnotice()
- {
- if (UrlPostParmsCheck("id"))
- {
- DataStruct dStruct = GetPostStruct();
- List<string> lw = new List<string>();
- int id = GetPostInt("id");
- lw.Add(string.Format("nid={0}", id));
- dStruct.Order = "ID desc";
- dStruct.MainWhere = string.Join(" and ", lw.ToArray());
- DataTable dt = WebCache.GetData("view_ErpNoticeCell", dStruct);
- writeGridDataTableJson(dStruct.TotalCount, dt);
- }
- }
- //获取流程列表接口---------------------------------------------
- public void get_erp_processlist()
- {
- string posCode = CurrentUser.UserPost.Post.Code;
- int orgId = CurrentUser.UserPost.OrgID;
- DataStruct dStruct = GetPostStruct();
- List<string> lw = new List<string>();
- string date1 = GetPostString("date1");
- string date2 = GetPostString("date2");
- string dw = GetDateMinuteWhere("CreatedTime", date1, date2);
- if (dw.Length > 0) lw.Add(dw);
- string title = GetPostString("title");
- if (title.Length > 0) lw.Add(string.Format("Title like '%{0}%'", title));
- if (posCode != "SysAdmin")
- {
- lw.Add(string.Format("OrgId={0}", orgId));
- }
- dStruct.Order = "ID desc";
- dStruct.MainWhere = string.Join(" and ", lw.ToArray());
- DataTable dt = WebCache.GetData("view_ErpProcessList", dStruct);
- writeGridDataTableJson(dStruct.TotalCount, dt);
- }
- //流程添加--------------------------------------------
- public void add_erp_process()
- {
- string id = GetPostString("id");
- /*CeErpProcessList Nt = null;
- if (id.Length > 0)
- {
- Nt = CeErpProcessList.Get(id);
- if (Nt.CreateUserId != CurrentUser.UserID)
- {
- returnErrorMsg("此流程添加者才能修改");
- return;
- }
- }
- else
- {
- Nt = new CeErpProcessList();
- }
- string title = GetPostString("title");
- string con = GetPostString("con");
- Nt.OrgId = GetPostInt("orgid");
- Nt.Title = title;
- Nt.Con = con;
- Nt.CreatedTime = DateTime.Now;
- Nt.CreateUserId = CurrentUser.UserID;
- if (id.Length > 0)
- {
- Nt.Update();
- }
- else
- {
- Nt.Create();
- }*/
- returnSuccessMsg("添加成功");
- return;
- }
- public void del_erp_process()
- {
- if (UrlPostParmsCheck("id"))
- {
- string id = GetPostString("id");
- //CeErpProcessList Nt = null;
- if (id.Length > 0)
- {
- /*Nt = CeErpProcessList.Get(id);
- if (Nt.CreateUserId != CurrentUser.UserID)
- {
- returnErrorMsg("此流程添加者才能删除");
- return;
- }
- CeErpProcessList.Del(id);*/
- returnSuccessMsg("操作成功");
- return;
- }
- }
- returnErrorMsg("缺少必要参数");
- }
- }
- }
|