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(data); var ReceiptbodyList = JsonConvert.Deserialize>(Receiptbody); var ReceiptdelbodyList = JsonConvert.Deserialize>(Receiptdelbody); var CargobodyList = JsonConvert.Deserialize>(CargoBody); var CargodelbodyList = JsonConvert.Deserialize>(CargoDelBody); var AppstateBodyList = JsonConvert.Deserialize>(AppstateBody); var AppstateDelBodyList = JsonConvert.Deserialize>(AppstateDelBody); var AuditStatusList = JsonConvert.Deserialize>(AuditStatus); var AuditStatusDelList = JsonConvert.Deserialize>(AuditStatusDel); var AuditStatusBodyList = JsonConvert.Deserialize>(AuditStatusBody); var AuditStatusBodyDelList = JsonConvert.Deserialize>(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.ToModelObjectList(ReceiptbodyList), ModelObjectConvert.ToModelObjectList(ReceiptdelbodyList), ModelObjectConvert.ToModelObjectList(CargobodyList), ModelObjectConvert.ToModelObjectList(CargodelbodyList), ModelObjectConvert.ToModelObjectList(AppstateBodyList), ModelObjectConvert.ToModelObjectList(AppstateDelBodyList), ModelObjectConvert.ToModelObjectList(AuditStatusList), ModelObjectConvert.ToModelObjectList(AuditStatusDelList), ModelObjectConvert.ToModelObjectList(AuditStatusBodyList), ModelObjectConvert.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 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 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 } }