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.approval; using DSWeb.Areas.Import.Models.XXH; using DSWeb.Areas.Import.Models.UseApp; 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 UseApprovalController : Controller { // // GET: /Import/create public ActionResult Index() { return View(); } // // GET: /Import/create/Edit public ActionResult Edit() { return View(); } // // GET:/Import/UseApproval/Save public ContentResult Save(string opstatus, string data, string Receiptbody, string Receiptdelbody, string AppstateBody, string AppstateDelBody, string CargoBody, string CargoDelBody) { var head = JsonConvert.Deserialize(data); var ReceiptbodyList = JsonConvert.Deserialize>(Receiptbody); var ReceiptdelbodyList = JsonConvert.Deserialize>(Receiptdelbody); var AppstateBodyList = JsonConvert.Deserialize>(AppstateBody); var AppstateDelBodyList = JsonConvert.Deserialize>(AppstateDelBody); var CargoBodyList = JsonConvert.Deserialize>(CargoBody); var CargoDelBodyList = JsonConvert.Deserialize>(CargoDelBody); 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(AppstateBodyList), ModelObjectConvert.ToModelObjectList(AppstateDelBodyList), ModelObjectConvert.ToModelObjectList(CargoBodyList), ModelObjectConvert.ToModelObjectList(CargoDelBodyList) ); //刷新父窗口上的父节点 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)) }; BasicDataRefDAL.SaveLog(head, Session["USERID"].ToString(), "进口贸易_配证", "保存"); return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } //查询参数中指定的许可证号和货物编号,如HS代码和CIQ代码吻合返回true,不吻合返回false public ContentResult GetAppCargo(string app_id, string cargo_id) { AppCargomb head = null; var list = XXHDAL.GetAppCargo(app_id, cargo_id); if (list.Count > 0) head = list[0]; if (head == null) { head = new AppCargomb(); } var json = JsonConvert.Serialize( new { Success = true, Message = "查询成功", data = head }); return new ContentResult() { Content = json }; } public ContentResult GetHTState(string contractno) { var dataList = XXHDAL.GetHTState(contractno); var list = dataList.Skip(0).Take(500); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); return new ContentResult() { Content = json }; } public ContentResult Getused(string cargo_id) { HTmb head = null; var list = approvalDAL.Getused(cargo_id); if (list.Count > 0) head = list[0]; if (head == null) { head = new HTmb(); } var json = JsonConvert.Serialize( new { Success = true, Message = "查询成功", data = head }); return new ContentResult() { Content = json }; } #region 参照部分 #endregion } }