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.

155 lines
6.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using DSWeb.Areas.TruckMng.Models.Comm;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.Areas.Import.DAL.XXH;
using DSWeb.Areas.Import.DAL.audit;
using DSWeb.Areas.Import.Models.XXH;
using DSWeb.Areas.Import.Models.audit;
using DSWeb.TruckMng.Comm.Cookie;
using DSWeb.TruckMng.Helper;
using DSWeb.TruckMng.Helper.Repository;
using HcUtility.Comm;
using HcUtility.Core;
namespace DSWeb.Areas.Import.Controllers
{
[JsonRequestBehavior]
public class auditController : Controller
{
//
// GET: /Import/create
public ActionResult Index()
{
return View();
}
//
// GET: /Import/create/Edit
public ActionResult Edit()
{
return View();
}
public ContentResult Save(string opstatus, string data,
string CargoBody, string CargoDelBody,
string Receiptbody, string Receiptdelbody,
string AppstateBody, string AppstateDelBody,
string AuditStatus, string AuditStatusDel,
string AuditStatusBody ,string AuditStatusDelBody)
{
var head = JsonConvert.Deserialize<auditmb>(data);
var ReceiptbodyList = JsonConvert.Deserialize<List<Receiptmb>>(Receiptbody);
var ReceiptdelbodyList = JsonConvert.Deserialize<List<Receiptmb>>(Receiptdelbody);
var CargobodyList = JsonConvert.Deserialize<List<Cargomb>>(CargoBody);
var CargodelbodyList = JsonConvert.Deserialize<List<Cargomb>>(CargoDelBody);
var AppstateBodyList = JsonConvert.Deserialize<List<Appstatemb>>(AppstateBody);
var AppstateDelBodyList = JsonConvert.Deserialize<List<Appstatemb>>(AppstateDelBody);
var AuditStatusList = JsonConvert.Deserialize<List<AuditStatusmb>>(AuditStatus);
var AuditStatusDelList = JsonConvert.Deserialize<List<AuditStatusmb>>(AuditStatusDel);
var AuditStatusBodyList = JsonConvert.Deserialize<List<AuditStatus_Bodymb>>(AuditStatusBody);
var AuditStatusBodyDelList = JsonConvert.Deserialize<List<AuditStatus_Bodymb>>(AuditStatusDelBody);
if (AuditStatus != "") {
foreach (var _as in AuditStatusList) {
if (!string.IsNullOrEmpty(_as.MODIFIEDTIME))
_as.MODIFIEDTIME = System.DateTime.Now.ToString("G");
if (!string.IsNullOrEmpty(_as.MODIFIEDUSER))
_as.MODIFIEDUSER = CookieConfig.GetCookie_UserName(Request);
}
}
if (AuditStatusBody != "")
{
foreach (var _as in AuditStatusBodyList)
{
if (!string.IsNullOrEmpty(_as.MODIFIEDTIME))
_as.MODIFIEDTIME = System.DateTime.Now.ToString("G");
if (!string.IsNullOrEmpty(_as.MODIFIEDUSER))
_as.MODIFIEDUSER = CookieConfig.GetCookie_UserName(Request);
}
}
if (opstatus == "add")
{
head.DbOperationType = DbOperationType.DbotIns;
head.ModelUIStatus = "I";
head.ContractNo = PubSysDAL.GetBillNo("0201"); //获取合同号
//20131011 应客户要求,将合同号改为接单人手动填写的必填项目。不再自动生成合同号
/*自动填写接单审单人id
headData.UserCode = CookieConfig.GetCookie_UserCode(Request);
headData.UserName = CookieConfig.GetCookie_UserName(Request);
headData.OrgCode = CookieConfig.GetCookie_OrgCode(Request);
headData.OrgName = CookieConfig.GetCookie_OrgName(Request);*/
//headData.LrDate = DateTime.Now;
}
else if (opstatus == "edit")
{
head.DbOperationType = DbOperationType.DbotUpd;
head.ModelUIStatus = "E";
}
else
{
head.DbOperationType = DbOperationType.DbotDel;
}
var modb = new ModelObjectRepository();
head.MODIFIEDUSER = Session["SHOWNAME"].ToString();
head.MODIFIEDTIME = System.DateTime.Now.ToString();
DBResult result = modb.Save(head,
ModelObjectConvert<Receiptmb>.ToModelObjectList(ReceiptbodyList),
ModelObjectConvert<Receiptmb>.ToModelObjectList(ReceiptdelbodyList),
ModelObjectConvert<Cargomb>.ToModelObjectList(CargobodyList),
ModelObjectConvert<Cargomb>.ToModelObjectList(CargodelbodyList),
ModelObjectConvert<Appstatemb>.ToModelObjectList(AppstateBodyList),
ModelObjectConvert<Appstatemb>.ToModelObjectList(AppstateDelBodyList),
ModelObjectConvert<AuditStatusmb>.ToModelObjectList(AuditStatusList),
ModelObjectConvert<AuditStatusmb>.ToModelObjectList(AuditStatusDelList),
ModelObjectConvert<AuditStatus_Bodymb>.ToModelObjectList(AuditStatusBodyList),
ModelObjectConvert<AuditStatus_Bodymb>.ToModelObjectList(AuditStatusBodyDelList)
);
BasicDataRefDAL.SaveLog(head, Session["USERID"].ToString(), "进口贸易_审单", "保存");
//刷新父窗口上的父节点
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'", CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_UserName(Request), CookieConfig.GetCookie_CompanyId(Request))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult GetAuditStatusList ( string condition )
{
var _condition = condition;
List<AuditStatusmb> list = auditDAL.GetAuditStatusList(_condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetAuditStatusBodyList ( string condition )
{
var _condition = condition;
List<AuditStatus_Bodymb> list = auditDAL.GetAuditStatusBodyList(_condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
#region 参照部分
#endregion
}
}