You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
302 lines
12 KiB
C#
302 lines
12 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using DSWeb.MvcShipping.Helper;
|
|
using DSWeb.Areas.MvcShipping.DAL;
|
|
using HcUtility.Comm;
|
|
using DSWeb.EntityDA;
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
using DSWeb.MvcShipping.DAL.DsSendmail;
|
|
using DSWeb.MvcShipping.DAL.MsInfoClientMailProject;
|
|
using System.Data;
|
|
using DSWeb.MvcShipping.Models.MsOpMailLog;
|
|
using HcUtility.Core;
|
|
using System.IO;
|
|
using CommonTool.MailKit;
|
|
using DSWeb.MvcShipping.Models.MsOpTaskNew;
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
{
|
|
|
|
[JsonRequestBehavior]
|
|
public class MsOpTaskNewController : Controller
|
|
{
|
|
|
|
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult Edit()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult PiLiang()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition)
|
|
{
|
|
var dataList = MsOpTaskNewDAL.GetDataList(start, limit,condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
int count = MsOpTaskNewDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", totalCount = count, data = dataList });//list.ToList()
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetTaskTreeRefList(string PARENTID, string condition)
|
|
{
|
|
|
|
var dataList = MsOpTaskNewDAL.GetTaskTreeRefList(PARENTID, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetData(string handle, string condition)
|
|
{
|
|
OpTaskNew head = null;
|
|
if (handle == "edit")
|
|
{
|
|
head = MsOpTaskNewDAL.GetData(condition);
|
|
}
|
|
|
|
if (head == null)
|
|
{
|
|
head = new OpTaskNew();
|
|
head.TASKSTATUS = "新建";
|
|
head.TASKCLASS = 0;
|
|
head.DEPT = Convert.ToString(Session["DEPTNAME"]);
|
|
head.CREATEUSER = Convert.ToString(Session["USERID"]);
|
|
head.CREATEUSERREF = Convert.ToString(Session["SHOWNAME"]);
|
|
head.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
head.CORPID = Convert.ToString(Session["COMPANYID"]);
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
public ContentResult GetCountList(string sort, string condition)
|
|
{
|
|
var dataList = MsOpTaskNewDAL.GetTaskCountList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", totalCount = 3, data = dataList });//list.ToList()
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetTaskDetailList(string sort, string condition)
|
|
{
|
|
var dataList = MsOpTaskNewDAL.GetTaskDetailList(condition);
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList });//list.ToList()
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
public ContentResult GetTaskLogList(string condition)
|
|
{
|
|
var dataList = MsOpTaskNewDAL.GetTaskLogList(condition);
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList });//list.ToList()
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
public ContentResult Save(string opstatus, string data,string body)
|
|
{
|
|
var headData = JsonConvert.Deserialize<OpTaskNew>(data);
|
|
var bodylist= JsonConvert.Deserialize<List<OpTaskDetail>>(body);
|
|
|
|
if (opstatus == "add")
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
headData.CREATEUSER = Convert.ToString(Session["USERID"]);
|
|
headData.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
}
|
|
else if (opstatus == "edit")
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
}
|
|
else
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
}
|
|
|
|
headData.MODIFYUSER = Convert.ToString(Session["USERID"]);
|
|
headData.MODIFYTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
var GID = headData.GID;
|
|
if (headData.COMPLETETIME== "") headData.COMPLETETIME = null;
|
|
|
|
var modb = new ModelObjectDB();
|
|
var result = modb.Save(headData);
|
|
if (result.Success) {
|
|
MsOpTaskNewDAL.SaveFitingsBody(bodylist,headData.GID, Convert.ToString(Session["USERID"]));
|
|
|
|
var optasklog = new OpTaskLog();
|
|
optasklog.GID = Guid.NewGuid().ToString();
|
|
optasklog.PGID = headData.GID;
|
|
if (opstatus == "add")
|
|
optasklog.DESCRIP = "新增";
|
|
else
|
|
optasklog.DESCRIP = "修改";
|
|
optasklog.CREATEUSER= Convert.ToString(Session["USERID"]);
|
|
optasklog.CREATETIME= DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
optasklog.DbOperationType = DbOperationType.DbotIns;
|
|
modb.Save(optasklog);
|
|
}
|
|
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsOpTaskNewDAL.GetData("GID='" + GID + "'")
|
|
};
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
|
|
public ContentResult Delete(string data)
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
//
|
|
var bodyList = JsonConvert.Deserialize<List<OpTaskNew>>(data);
|
|
var result = new DBResult();
|
|
|
|
if (bodyList != null)
|
|
{
|
|
result = MsOpTaskNewDAL.DeleteTask(bodyList);
|
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
};
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
public ContentResult DeleteDetail(string data)
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
//
|
|
var bodyList = JsonConvert.Deserialize<List<OpTaskDetail>>(data);
|
|
var result = new DBResult();
|
|
|
|
if (bodyList != null)
|
|
{
|
|
result = MsOpTaskNewDAL.DeleteTaskDetail(bodyList, Convert.ToString(Session["USERID"]).ToString());
|
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
};
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
|
|
public ContentResult UpTransStatus(string GID, string transstatus)
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
var bodyList = new List<OpTaskNew>();
|
|
var OpTaskNew = MsOpTaskNewDAL.GetData("GID='" + GID + "'");
|
|
bodyList.Add(OpTaskNew);
|
|
|
|
var result = MsOpTaskNewDAL.UpTransStatus(bodyList, transstatus, Convert.ToString(Session["USERID"]).ToString().Trim());
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsOpTaskNewDAL.GetData("GID='" + GID + "'")
|
|
};
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
public ContentResult UpTransStatusList(string data, string transstatus, string statusdate = "")
|
|
{
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
}
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<OpTaskNew>>(data);
|
|
|
|
var result = MsOpTaskNewDAL.UpTransStatus(bodyList, transstatus, Convert.ToString(Session["USERID"]).ToString().Trim());
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
public ContentResult UpdateTaskOpList(string bill, string taskop)
|
|
{
|
|
|
|
var billData = JsonConvert.Deserialize<List<OpTaskNew>>(bill);
|
|
DBResult result = MsOpTaskNewDAL.UpdateTaskOpList(billData, taskop, Convert.ToString(Session["USERID"]));
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
public ContentResult GetBsListRm(string CODENAME)
|
|
{
|
|
var condition = "";
|
|
|
|
if (CODENAME == "")
|
|
{
|
|
}
|
|
else condition = " (CUSTNO like '%" + CODENAME + "%') ";
|
|
|
|
|
|
var evList = MsOpTaskNewDAL.GetBSList(condition);
|
|
|
|
if (evList.Count == 0)
|
|
{
|
|
var json = JsonConvert.Serialize(new { success = false });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
else
|
|
{
|
|
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|