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.
213 lines
8.2 KiB
C#
213 lines
8.2 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Web.Mvc;
|
|
using DSWeb.MvcShipping.DAL.MsOpExpressDAL;
|
|
using DSWeb.MvcShipping.Models.MsOpExpress;
|
|
using DSWeb.MvcShipping.DAL.MsCompanysDAL;
|
|
using DSWeb.MvcShipping.Helper;
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
using HcUtility.Comm;
|
|
using HcUtility.Core;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Data;
|
|
using System.Data.OleDb;
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
using DSWeb.Areas.RptMng.Comm;
|
|
using DSWeb.Areas.CommMng.Models;
|
|
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
{
|
|
[JsonRequestBehavior]
|
|
public class MsOpExpressController : Controller
|
|
{
|
|
//
|
|
// GET:
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult Edit()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
|
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition,string load)
|
|
{
|
|
var dataList = MsOpExpressDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort,load);
|
|
var list = dataList.Skip(start).Take(limit);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
|
|
|
|
public ContentResult GetData(string handle, string condition)
|
|
{
|
|
MsOpExpress head = null;
|
|
if (handle == "edit")
|
|
{
|
|
head = MsOpExpressDAL.GetData(condition);
|
|
}
|
|
if (head == null)
|
|
{
|
|
head = new MsOpExpress();
|
|
var company = MsCompanysDAL.GetNoPicData(" GID='" + Convert.ToString(Session["COMPANYID"]) + "'");
|
|
var userlist = MsBaseInfoDAL.GetUserBaseList("USERID='" + Convert.ToString(Session["USERID"]) + "'");
|
|
head.SENDERATTN = Convert.ToString(Session["SHOWNAME"]);
|
|
head.SENDER = company.FULLNAME;
|
|
head.SENDERADDR = company.ADDRESS;
|
|
head.SENDERPOST = company.POSTCODE;
|
|
if (userlist.Count > 0) {
|
|
head.SENDERTEL = userlist[0].OFFICEPHONE;
|
|
} else
|
|
head.SENDERTEL = company.OFFICEPHONE;
|
|
|
|
}
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
|
|
|
|
public ContentResult Save(string opstatus, string data, string body)
|
|
{
|
|
var aaa = "";
|
|
var headData = JsonConvert.Deserialize<MsOpExpress>(data);
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpReceiptEntity>>(body);
|
|
|
|
|
|
var isPost = true;
|
|
var errorstr = "";
|
|
var isuse = false;
|
|
|
|
if (opstatus == "add")
|
|
{
|
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
|
|
headData.CREATEUSER = Convert.ToString(Session["USERID"]);
|
|
headData.CREATETIME = DateTime.Now.ToString();
|
|
headData.GID = Guid.NewGuid().ToString();
|
|
}
|
|
else if (opstatus == "edit")
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
headData.ModelUIStatus = "E";
|
|
}
|
|
else
|
|
{
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
}
|
|
|
|
|
|
var BSNO = headData.GID;
|
|
|
|
if (isPost)
|
|
{
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Save(headData);
|
|
if (result.Success == true)
|
|
{
|
|
result = MsOpExpressDAL.SaveDetail(headData, bodyList, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["USERID"]));
|
|
}
|
|
|
|
var jsonRespose = new JsonResponse
|
|
{
|
|
Success = result.Success,
|
|
Message = result.Message,
|
|
Data = MsOpExpressDAL.GetData("GID='" + BSNO + "'")
|
|
};
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
else {
|
|
var jsonRespose = new JsonResponse { Success = false, Message =errorstr+"重复,不允许保存!" };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
}
|
|
|
|
|
|
public ContentResult Delete(string data)
|
|
{
|
|
var head = JsonConvert.Deserialize<MsOpExpress>(data);
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = modb.Delete(head);
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
public ContentResult RefreshExpressSTATUSList(string data,string status)
|
|
{
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpExpress>>(data);
|
|
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = MsOpExpressDAL.RefreshExpressSTATUSList(bodyList,status);
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
public ContentResult GetExpressStatusList(string expno, string expcorpid,string expid)
|
|
{
|
|
|
|
DBResult result = MsOpExpressDAL.GetExpressStatusList(expno, expcorpid,expid);
|
|
return new ContentResult() { Content = result.Message };
|
|
}
|
|
|
|
public ContentResult GetExpressDocList(int start, int limit, string sort, string condition)
|
|
{
|
|
var dataList = MsOpExpressDAL.GetExpressDocList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]),sort);
|
|
var list = dataList.Skip(start).Take(limit);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
public ContentResult GetDocList(int start, int limit, string sort, string condition, string doctype)
|
|
{
|
|
var dataList = MsOpExpressDAL.GetDocList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), doctype, sort);
|
|
var list = dataList.Skip(start).Take(limit);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
public ContentResult GetDoc(string condition)
|
|
{
|
|
|
|
var head = MsOpExpressDAL.GetData(condition);
|
|
|
|
var json = JsonConvert.Serialize(
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
|
|
public ContentResult AddBill(string billno, string data)
|
|
{
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpReceiptEntity>>(data);
|
|
|
|
var modb = new ModelObjectDB();
|
|
DBResult result = MsOpExpressDAL.AddBill(billno, bodyList);
|
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
|
|
public ContentResult DelBill(string data, string billno)
|
|
{
|
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpReceiptEntity>>(data);
|
|
|
|
DBResult result = MsOpExpressDAL.DelBill(bodyList);
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
}
|
|
|
|
//
|
|
}
|
|
}
|
|
|