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.
DS7/DSWeb/Areas/Import/Controllers/UseApprovalController.cs

152 lines
5.7 KiB
C#

2 years ago
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;
8 months ago
using DSWeb.SoftMng.Filter;
2 years ago
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<UseAppmb>(data);
var ReceiptbodyList = JsonConvert.Deserialize<List<Receiptmb>>(Receiptbody);
var ReceiptdelbodyList = JsonConvert.Deserialize<List<Receiptmb>>(Receiptdelbody);
var AppstateBodyList = JsonConvert.Deserialize<List<Appstatemb>>(AppstateBody);
var AppstateDelBodyList = JsonConvert.Deserialize<List<Appstatemb>>(AppstateDelBody);
var CargoBodyList = JsonConvert.Deserialize<List<Cargomb>>(CargoBody);
var CargoDelBodyList = JsonConvert.Deserialize<List<Cargomb>>(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<Receiptmb>.ToModelObjectList(ReceiptbodyList),
ModelObjectConvert<Receiptmb>.ToModelObjectList(ReceiptdelbodyList),
ModelObjectConvert<Appstatemb>.ToModelObjectList(AppstateBodyList),
ModelObjectConvert<Appstatemb>.ToModelObjectList(AppstateDelBodyList),
ModelObjectConvert<Cargomb>.ToModelObjectList(CargoBodyList),
ModelObjectConvert<Cargomb>.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
}
}