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.

275 lines
10 KiB
C#

12 months ago
using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcContainer.Models.MsOpCtnBsCardReAudit;
using DSWeb.MvcContainer.DAL.MsOpCtnBsCardReAudit;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Comm.Cookie;
using System.Collections.Generic;
using HcUtility.Comm;
using HcUtility.Core;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.Areas.RptMng.Comm;
using System.Text;
using DSWeb.Areas.CommMng.Models;
using System.Data;
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
using DSWeb.MvcContainer.Models.MsOpCtnBsCard;
namespace DSWeb.MvcContainer.Controllers
{
[JsonRequestBehavior]
public class MsOpCtnBsCardReAuditController : Controller
{
//
// GET:
public ActionResult Index()
{
return View();
}
//
// GET: /
public ActionResult Edit()
{
return View();
}
public ActionResult AuditIndex()
{
return View();
}
public ActionResult AddIndex()
{
return View();
}
//
// GET
public ContentResult GetDataList(int start, int limit, string sort, string condition, string pricetype)
{
var dataList = MsOpCtnBsCardReAuditDAL.GetDataList(condition,sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetDataListStr(string sort, string condition, string pricetype)
{
var dataListStr = MsOpCtnBsCardReAuditDAL.GetDataListStr(condition, pricetype, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]),sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
return new ContentResult() { Content = json };
}
//
// GET/TruckMng/MsWlTyreAcc/GetData/
public ContentResult GetData(string handle, string condition)
{
OpCtnBsCardReAudit head = null;
if (handle == "edit")
{
head = MsOpCtnBsCardReAuditDAL.GetData(condition, Convert.ToString(Session["USERID"]));
}
if (head == null)
{
head = new OpCtnBsCardReAudit();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult CreateReAudit(string data,string bsno)
{
var dataList = MsOpCtnBsCardReAuditDAL.GetDataList("b.BSNO='"+bsno+"'");
if (dataList != null && dataList.Count != 0) {
var jsonRespose2 = new JsonResponse { Success =true, Message ="" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
var CtnList = JsonConvert.Deserialize<List<OpCtnBsCard>>(data);
var headData = new OpCtnBsCardReAudit();
headData.GID = Guid.NewGuid().ToString();
headData.BSNO = bsno;
headData.DbOperationType = DbOperationType.DbotIns;
headData.APPLICANT = Convert.ToString(Session["USERID"]);
headData.APPLYTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
headData.BILLSTATUS = 1;
headData.CTNNUM = CtnList.Count.ToString();
var modb = new ModelObjectDB();
var result = modb.Save(headData);
if (result.Success == true)
{
var bodylist = new List<OpCtnBsCardReAuditDetail>();
foreach (var ctn in CtnList) {
var body = new OpCtnBsCardReAuditDetail();
body.GID = Guid.NewGuid().ToString();
body.LINKGID = "*";
body.BSCARDGID = ctn.GID;
bodylist.Add(body);
}
MsOpCtnBsCardReAuditDAL.SaveReAuditDetail(bodylist, headData.GID, Convert.ToString(Session["USERID"]));
}
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult Save(string opstatus, string data,string body,string audit="",bool issub=false)
{
var headData = JsonConvert.Deserialize<OpCtnBsCardReAudit>(data);
var bodyList = JsonConvert.Deserialize<List<OpCtnBsCardReAuditPrice>>(body);
if (opstatus == "add")
{
headData.DbOperationType = DbOperationType.DbotIns;
headData.APPLICANT= Convert.ToString(Session["USERID"]);
headData.APPLYTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
headData.BILLSTATUS = 1;
}
else if (opstatus == "edit")
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
else
{
headData.DbOperationType = DbOperationType.DbotDel;
}
var GID = headData.GID;
var modb = new ModelObjectDB();
var result=modb.Save(headData);
if (result.Success) {
10 months ago
MsOpCtnBsCardReAuditDAL.SavePriceItems(headData,bodyList, headData.GID, Convert.ToString(Session["USERID"]));
12 months ago
}
if (issub) {
MsOpCtnBsCardReAuditDAL.SubmitAuditBillNew(GID, audit,Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]));
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpCtnBsCardReAuditDAL.GetData("GID='" + GID + "'", Convert.ToString(Session["USERID"]))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SubmitAuditBackForm(string data)
{
var headData = JsonConvert.Deserialize<OpCtnBsCardReAudit>(data);
DBResult result = MsOpCtnBsCardReAuditDAL.CancelAuditBill(headData.GID, Convert.ToString(Session["USERID"]));
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult AuditBillList(string bill, string audit, string auditremark, string isfinish)
{
var billData = JsonConvert.Deserialize<List<OpCtnBsCardReAudit>>(bill);
DBResult result = MsOpCtnBsCardReAuditDAL.AuditBillList(billData, audit, auditremark, isfinish,Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult AuditBillBack(String bill, string reasean)
{
var billData = JsonConvert.Deserialize<List<OpCtnBsCardReAudit>>(bill);
DBResult result = MsOpCtnBsCardReAuditDAL.AuditBillBack(billData, Convert.ToString(Session["USERID"]), reasean, Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult CloseAuditBill(String bill,bool islast)
{
var billData = JsonConvert.Deserialize<List<OpCtnBsCardReAudit>>(bill);
DBResult result = MsOpCtnBsCardReAuditDAL.CloseAuditBill(billData, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), islast);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult Delete(string data)
{
var headData = JsonConvert.Deserialize<OpCtnBsCardReAudit>(data);
DBResult result = MsOpCtnBsCardReAuditDAL.DeleteOpReAudit(headData);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult GetPriceItemsList(string condition, string sort)
{
var dataList = MsOpCtnBsCardReAuditDAL.GetPriceItemsList(condition, sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult SavePriceItems(string body, string PID)
{
//
var bodyList = JsonConvert.Deserialize<List<OpCtnBsCardReAuditPrice>>(body);
10 months ago
var head = MsOpCtnBsCardReAuditDAL.GetData("GID='"+ PID + "'", Convert.ToString(Session["USERID"]));
DBResult result = MsOpCtnBsCardReAuditDAL.SavePriceItems(head,bodyList, PID, Convert.ToString(Session["USERID"]));
12 months ago
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult DeletePriceItems(string data)
{
var headData = JsonConvert.Deserialize<List<OpCtnBsCardReAuditPrice>>(data);
DBResult result = MsOpCtnBsCardReAuditDAL.DeletePriceItems(headData);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#region 参照部分
#endregion
}
}