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/xxhController.cs

811 lines
34 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using DSWeb.Areas.Import.Models.Comm;
using DSWeb.Areas.CommMng.Models;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.Areas.Import.DAL.XXH;
using DSWeb.Areas.Import.Models.XXH;
using DSWeb.Areas.Import.Models.ImportTrade;
using DSWeb.TruckMng.Comm.Cookie;
using DSWeb.TruckMng.Helper;
using DSWeb.TruckMng.Helper.Repository;
using DSWeb.Areas.Import.DAL.Comm;
using HcUtility.Comm;
using HcUtility.Core;
////应对新的单据管理模块
using DSWeb.MvcShipping.Controllers;
using DSWeb.MvcShipping.DAL.MsOpReceiptDAL;
using DSWeb.MvcShipping.Models.MsOpReceipt;
using DSWeb.MvcShipping.Models.MsOpAmend;
using DSWeb.Areas.Import.Models.PortOperate;
using DSWeb.SoftMng.Filter;
namespace DSWeb.Areas.Import.Controllers
{
[JsonRequestBehavior]
public class XXHController : Controller
{
//
// GET: /Import/XXH
public ActionResult Index()
{
return View();
}
//
// GET: /Import/XXH/Edit
public ActionResult Edit()
{
return View();
}
public ActionResult HistryFeeIndex()
{
return View();
}
//
// GET/Import/XXH/GetDataList
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var dataList = XXHDAL.GetDataList(condition, CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_UserName(Request), CookieConfig.GetCookie_CompanyId(Request), sort);
var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetDataList_ALL(int start, int limit, string sort, string condition)
{
var dataList = XXHDAL.GetDataList_ALL(condition, CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_UserName(Request), CookieConfig.GetCookie_CompanyId(Request), sort);
var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetDataList_ALL_HD ( int start, int limit, string sort, string condition )
{
var dataList = XXHDAL.GetDataList_ALL_HD(condition, sort);
var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetDataList_ALL_OUT ( int start, int limit, string sort, string condition, string callback )
{
var dataList = XXHDAL.GetDataList_ALL(condition, CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_UserName(Request), CookieConfig.GetCookie_CompanyId(Request), sort);
var list = dataList.Skip(start).Take(limit);
string callBack = callback;
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = callBack+"(" + json + ")" };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetEditList_ALL ( int start, int limit, string sort, string condition )
{
var dataList = XXHDAL.GetEditList_ALL(condition, CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_UserName(Request), CookieConfig.GetCookie_CompanyId(Request), sort);
var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetDataList_ALL_single(int start, int limit, string sort, string condition)
{
var dataList = XXHDAL.GetDataList_ALL_single(condition, CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_UserName(Request), CookieConfig.GetCookie_CompanyId(Request));
var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetDataList_HT(int start, int limit, string sort, string condition)
{
var dataList = XXHDAL.GetDataList_HT(condition);
var list = dataList.Skip(start).Take(limit);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
//获取指定合同号的合同数量,用于防止合同号重复
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetData_HT(string handle, string condition)
{
HTmb head = null;
var list = XXHDAL.GetDataList_HT(condition);
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 };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
//获取指定日期前最近的入库时间或者结费时间,用于计算仓储天数
//如最近一次为入库,则返回入库时间;如最近一次为结费,则最后天数需要-1
public ContentResult GetLastCZ(string handle, string condition,string id,string cargo_id)
{
CZmb head = null;
var corpid = CookieConfig.GetCookie_OrgCode(Request);
var list = XXHDAL.GetLastCZ(condition,id,corpid,cargo_id);
if (list.Count > 0)
head = list[0];
if (head == null)
{ head = new CZmb(); }
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
//获取毛利(通过存储过程)
public ContentResult GetML(string contractno)
{
MLmb head = null;
var corpid = Convert.ToString(Session["COMPANYID"]);
var USERID = Convert.ToString(Session["USERID"]);
var DEPTGID = Convert.ToString(Session["DEPTGID"]);
//var OPERATERANGE="";
var VISIBLERANGE = "";
var modName = "modImport_Fee";
var evList = BasicDataRefDAL.GetAR(modName, USERID);
AuthorityRangemb AR = null;
if (evList.Count > 0)
AR = evList[0];
if (AR == null)
{
AR = new AuthorityRangemb();
//OPERATERANGE = "3";
VISIBLERANGE = "3";
}
else
{
//OPERATERANGE = head.OPERATERANGE;
VISIBLERANGE = AR.VISIBLERANGE;
}
var condition = " (BsNo='" + contractno + "' or F_NO='" + contractno + "') ";
if (VISIBLERANGE == "1")
{
condition = condition + " and enteroperator in(select userid from user_company where companyid='" + corpid + "')";
}
if (VISIBLERANGE == "2")
{
condition = condition + " and enteroperator in(select userid from user_baseinfo where companyname=(select name from company where gid='" + corpid + "') ";
condition = condition + " and deptname=(select deptname from sys_dept where gid='" + DEPTGID + "')) ";
}
if (VISIBLERANGE == "3")
{
condition = condition + " and enteroperator ='" + USERID + "'";
}
var list = XXHDAL.GetML(condition, contractno);
if (list.Count > 0)
head = list[0];
if (head == null)
{ head = new MLmb(); }
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
//
// GET/Import/XXH/GetData/
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetData(string handle, string condition)
{
XXHmb head = null;
if (handle == "edit"||handle =="view")
{
var _t = "";
var list = XXHDAL.GetDataList(condition, CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_UserName(Request), CookieConfig.GetCookie_CompanyId(Request), _t);
if (list.Count > 0)
head = list[0];
}
if (head == null)
{
head = new XXHmb();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetData_HD ( string handle, string condition )
{
XXHmb head = null;
if (handle == "edit" || handle == "view")
{
var _t = "";
var list = XXHDAL.GetDataList_ALL_HD(condition, _t);
if (list.Count > 0)
head = list[0];
}
if (head == null)
{
head = new XXHmb();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
/*
public ContentResult Save_Lock(string opstatus, string data, string chfeebody, string chfeedelbody)
{
var head = JsonConvert.Deserialize<CWLockmb>(data);
var chfeeBodyList = JsonConvert.Deserialize<List<MsChFee>>(chfeebody);
var chfeeBodyDelList = JsonConvert.Deserialize<List<MsChFee>>(chfeedelbody);
if (opstatus == "add")
{
head.DbOperationType = DbOperationType.DbotIns;
head.ModelUIStatus = "I";
head.ContractNo = PubSysDAL.GetBillNo("0201"); //获取合同号
//20131011 应客户要求,将合同号改为接单人手动填写的必填项目。不再自动生成合同号
//headData.LrDate = DateTime.Now;
}
else if (opstatus == "edit")
{
head.DbOperationType = DbOperationType.DbotUpd;
head.ModelUIStatus = "E";
}
else
{
head.DbOperationType = DbOperationType.DbotDel;
}
var modb = new ModelObjectRepository();
DBResult result = modb.Save(head,
ModelObjectConvert<MsChFee>.ToModelObjectList(chfeeBodyList),
ModelObjectConvert<MsChFee>.ToModelObjectList(chfeeBodyDelList)
);
//刷新父窗口上的父节点
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = XXHDAL.GetData_ALL("M.ContractNo='" + head.ContractNo + "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
*/
//
// GET/Import/XXH/Save
public ContentResult Save(string opstatus, string data,
string Receiptbody, string Receiptdelbody,string CargoBody,string CargoDelBody,
string KCBody, string KCDelBody, string chfeebody, string chfeedelbody)
{
var head = JsonConvert.Deserialize<XXHmb>(data);
var ReceiptbodyList = JsonConvert.Deserialize<List<MsOpReceiptEntity>>(Receiptbody);
var ReceiptdelbodyList = JsonConvert.Deserialize<List<MsOpReceiptEntity>>(Receiptdelbody);
var CargoBodyList = JsonConvert.Deserialize<List<Cargomb>>(CargoBody);
var CargoDelBodyList = JsonConvert.Deserialize<List<Cargomb>>(CargoDelBody);
var KCBodyList = JsonConvert.Deserialize<List<KCmb>>(KCBody);
var KCDelBodyList = JsonConvert.Deserialize<List<KCmb>>(KCDelBody);
var chfeeBodyList = JsonConvert.Deserialize<List<MsChFee>>(chfeebody);
var chfeeBodyDelList = JsonConvert.Deserialize<List<MsChFee>>(chfeedelbody);
if (chfeeBodyList != null)
{
foreach (var _fee in chfeeBodyList)
{
_fee.MODIFIEDTIME = DateTime.Now.ToString();
_fee.MODIFIEDUSER = Session["USERID"].ToString();
}
}
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();
DBResult result = modb.Save(head,
ModelObjectConvert<MsOpReceiptEntity>.ToModelObjectList(ReceiptbodyList),
ModelObjectConvert<MsOpReceiptEntity>.ToModelObjectList(ReceiptdelbodyList),
ModelObjectConvert<Cargomb>.ToModelObjectList(CargoBodyList),
ModelObjectConvert<Cargomb>.ToModelObjectList(CargoDelBodyList),
ModelObjectConvert<KCmb>.ToModelObjectList(KCBodyList),
ModelObjectConvert<KCmb>.ToModelObjectList(KCDelBodyList),
ModelObjectConvert<MsChFee>.ToModelObjectList(chfeeBodyList),
ModelObjectConvert<MsChFee>.ToModelObjectList(chfeeBodyDelList)
);
BasicDataRefDAL.SaveLog(head, Session["USERID"].ToString(), "进口贸易_港口操作_0", "保存");
//刷新父窗口上的父节点
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 Save_HD ( string opstatus, string data,
string Receiptbody, string Receiptdelbody, string CargoBody, string CargoDelBody,
string KCBody, string KCDelBody, string chfeebody, string chfeedelbody )
{
var head = JsonConvert.Deserialize<PortOperate2mb>(data);
var ReceiptbodyList = JsonConvert.Deserialize<List<MsOpReceiptEntity>>(Receiptbody);
var ReceiptdelbodyList = JsonConvert.Deserialize<List<MsOpReceiptEntity>>(Receiptdelbody);
var CargoBodyList = JsonConvert.Deserialize<List<Cargomb>>(CargoBody);
var CargoDelBodyList = JsonConvert.Deserialize<List<Cargomb>>(CargoDelBody);
var KCBodyList = JsonConvert.Deserialize<List<KCmb>>(KCBody);
var KCDelBodyList = JsonConvert.Deserialize<List<KCmb>>(KCDelBody);
var chfeeBodyList = JsonConvert.Deserialize<List<MsChFee>>(chfeebody);
var chfeeBodyDelList = JsonConvert.Deserialize<List<MsChFee>>(chfeedelbody);
if (chfeeBodyList != null)
{
foreach (var _fee in chfeeBodyList)
{
_fee.MODIFIEDTIME = DateTime.Now.ToString();
_fee.MODIFIEDUSER = Session["USERID"].ToString();
}
}
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();
DBResult result = modb.Save(head,
ModelObjectConvert<MsOpReceiptEntity>.ToModelObjectList(ReceiptbodyList),
ModelObjectConvert<MsOpReceiptEntity>.ToModelObjectList(ReceiptdelbodyList),
ModelObjectConvert<Cargomb>.ToModelObjectList(CargoBodyList),
ModelObjectConvert<Cargomb>.ToModelObjectList(CargoDelBodyList),
ModelObjectConvert<KCmb>.ToModelObjectList(KCBodyList),
ModelObjectConvert<KCmb>.ToModelObjectList(KCDelBodyList),
ModelObjectConvert<MsChFee>.ToModelObjectList(chfeeBodyList),
ModelObjectConvert<MsChFee>.ToModelObjectList(chfeeBodyDelList)
);
BasicDataRefDAL.SaveLog(head, Session["USERID"].ToString(), "进口贸易_港口操作_HD", "保存");
//刷新父窗口上的父节点
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) };
}
/// <summary>
/// 编辑模式 保存
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public ContentResult SaveList ( string data )
{
var headList = JsonConvert.Deserialize<List<XXH_ALLEditmb2>>(data);
foreach (var _hd in headList)
{
_hd.MODIFIEDUSER = Session["SHOWNAME"].ToString();
_hd.MODIFIEDTIME = System.DateTime.Now.ToString();
}
var result = new DBResult();
var _L = ModelHeadConvert<XXH_ALLEditmb2>.ToModelObjectList(headList);
var modb = new ModelObjectRepository();
result = modb.SaveHeadList(_L);
foreach(var _D in _L){
BasicDataRefDAL.SaveLog(_D, Session["USERID"].ToString(), "进口贸易_港口操作_编辑模式", "保存");
}
//刷新父窗口上的父节点
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};
/*
var jsonRespose = new JsonResponse
{
Success = false,
Message = "暂时停用",
//Data = XXHDAL.GetData("M.ContractNo='" + head.ContractNo + "'")
};*/
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult Delete(string data,string USERID)
{
var head = JsonConvert.Deserialize<XXHmb>(data);
//验证是否有
var modb = new ModelObjectDB();
DBResult result = modb.Delete(head, USERID,true
, "delete from Import_appstate where contractno='"+head.ContractNo+"'"
);
var ContractNo = head.ContractNo;
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
//为了清除用证信息
var _count = 0 ;
_count = XXHDAL.DELUseApp(ContractNo);
_count = _count + XXHDAL.ClearHTH(ContractNo);
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult UnDelete ( string data, string USERID )
{
var head = JsonConvert.Deserialize<XXHmb>(data);
var HTH = head.ContractNo;
var _r = BasicDataRefDAL.ExecSql(" update import_main set ISDELETE=0,HTH='" + HTH + "' where contractno='" + HTH + "' ");
var jsonRespose = new JsonResponse { Success = true, Message = "恢复成功" };
if (_r == 0) {
jsonRespose = new JsonResponse { Success = false, Message = "恢复失败" };
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
// Get:/Import/XXH/GetReceiptList
public ContentResult GetReceiptList(string condition)
{
var _condition = " ContractNo='" + condition + "' ";
List<Receiptmb> list = XXHDAL.GetReceiptList(_condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
#region 商品信息 Get:/Import/XXH/GetCargoList
public ContentResult GetCargoList(string condition)
{
var _condition = " c.ContractNo = '" + condition + "' ";
List<Cargomb> list = XXHDAL.GetCargoList(_condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetCargoList2 ( string condition ) //增加三个字段
{
var _condition = " c.ContractNo = '" + condition + "' ";
List<Cargomb2> list = XXHDAL.GetCargoList2(_condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetCargoList_Audit(string condition)
{
var _condition = " c.ContractNo = '" + condition + "' ";
List<Cargomb> list = XXHDAL.GetCargoList_Audit(_condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
#endregion
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
// Get:/Import/XXH/GetAppstate
public ContentResult GetAppstate(string condition)
{
var _condition = " at.ContractNo = '" + condition + "' ";
List<Appstatemb> list = XXHDAL.GetAppstate(_condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
// Get:/Import/XXH/GetKC
public ContentResult GetKC(string condition)
{
//var _condition = " K.ContractNo = '" + condition + "' order by k.czdate";
var _condition = condition + " order by k.czdate";
List<KCmb> list = XXHDAL.GetKC(_condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
// Get:/Import/XXH/KCStart
public int KCStart(string cargo_id)
{
var _count = 0 ;
var corpcode = CookieConfig.GetCookie_OrgCode(Request);
var userid = CookieConfig.GetCookie_UserId(Request);
_count = XXHDAL.KCStart(cargo_id, corpcode, userid);
return _count;
}
public int CWStart(string ContractNo)
{
var _count = 0;
_count = XXHDAL.CWStart(ContractNo);
return _count;
}
// Get:/Import/XXH/SetStatus
public int SetStatus(string ContractNo, string NewMainstate)
{
var _count = 0;
_count = XXHDAL.SetStatus(ContractNo, NewMainstate);
return _count;
}
public ContentResult GetFeeList(string billno, string Feetype, string sort)
{
var corpid = Convert.ToString(Session["COMPANYID"]);
var USERID = Convert.ToString(Session["USERID"]);
var DEPTGID = Convert.ToString(Session["DEPTGID"]);
//var OPERATERANGE="";
var VISIBLERANGE="";
var modName = "modImport_Fee";
var evList = BasicDataRefDAL.GetAR(modName, USERID);
AuthorityRangemb head = null;
if (evList.Count > 0)
head = evList[0];
if (head == null)
{
head = new AuthorityRangemb();
//OPERATERANGE = "3";
VISIBLERANGE = "3";
}
else {
//OPERATERANGE = head.OPERATERANGE;
VISIBLERANGE = head.VISIBLERANGE;
}
var condition = " (BsNo='" + billno + "' OR F_NO='" + billno + "') and feetype='" + Feetype + "'";
if (VISIBLERANGE == "1") {
condition = condition + " and enteroperator in(select userid from user_company where companyid='" + corpid + "')";
}
if (VISIBLERANGE == "2")
{
condition = condition + " and enteroperator in(select userid from user_baseinfo where companyname=(select name from company where gid='" + corpid + "') ";
condition = condition + " and deptname=(select deptname from sys_dept where gid='" + DEPTGID + "')) ";
}
if (VISIBLERANGE == "3")
{
condition = condition + " and enteroperator ='" + USERID + "'";
}
var dataList = MsChFeeDAL.GetDataList(condition, sort, USERID);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetField(string tablename, string fieldid,string fieldvalue)
{
var dataList = XXHDAL.GetField(tablename, fieldid, fieldvalue);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
#region 获取指定合同号的费用数量,防止有费用的合同被删
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetChfee(string handle, string condition)
{
HTmb head = null;
var list = XXHDAL.GetChfee(condition);
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 };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetChfeeAndSaleDetail ( string sql1, string sql2 )
{
HTmb head = null;
int _C = 0;
var list = XXHDAL.GetChfee(sql1);
if (list.Count > 0)
{
head = list[0];
_C += Convert.ToInt32(head.Count);
}
list = XXHDAL.GetSales(sql2);
if (list.Count > 0)
{
head = list[0];
_C += Convert.ToInt32(head.Count);
}
if (head == null)
{ head = new HTmb(); }
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = _C });
return new ContentResult() { Content = json };
}
#endregion
#region 参照部分
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
// Get:/Import/XXH/GetApp
public ContentResult GetApp(string condition)
{
var _condition = " ap.cargoinfo_id in(select cargoinfo_id from import_cargo where contractno='" + condition + "') ";
_condition = _condition + " and ap.cargociq_id in(select cargociq_id from import_cargo where contractno='" + condition + "') ";
_condition = _condition + " and ap.countryid in(select countryid from import_main where contractno='" + condition + "')";
_condition = _condition + " and ap.sljg in(select port sljg from import_main where contractno='" + condition + "')";
_condition = _condition + " and isnull(ap.SPECIFICATIONS,'') in(select isnull(SPECIFICATIONS,'') from import_Cargo where contractno='" + condition + "')";
_condition = _condition + " and ap.isdeleted=0 and (validdate>(select creattime from import_main where contractno='" + condition + "') or validdate='')";
List<Appstatemb> list = XXHDAL.GetApp(_condition);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetCountry(string condition)
{
var list = XXHDAL.GetCountry();
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() });
return new ContentResult() { Content = json };
}
public string KCEnterDate(string contractno,string OutDate)
{
var KCEnterDate = "";
//KCEnterDate = XXHDAL.GetKCEnterDate(contractno);
return KCEnterDate;
}
#endregion
public int UploadFee(string idList)
{
var _count = 0;
_count = XXHDAL.UploadFee(idList);
return _count;
}
public int UploadInfo ( string idList )
{
var _count = 0;
_count = XXHDAL.UploadInfo(idList);
return _count;
}
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult SendXML(string condition)
{
var _r = new DBResult();
//var USERID=Convert.ToString(CookieConfig.GetCookie_UserId(Request));
var corpid = Convert.ToString(Session["COMPANYID"]);
var _c=BasicDataRefDAL.GetcompanyList(" GID='" + corpid + "'");
var CompanyName = _c[0].name;
_r = XXHDAL.GetDoc(CompanyName,condition);
_r = XXHDAL.GetFee(CompanyName,condition);
_r = XXHDAL.GetCargo(CompanyName,condition);
_r = XXHDAL.GetImport(CompanyName,condition);
var json = JsonConvert.Serialize(new { _r = true, Message = "查询成功", data = _r.Data });
return new ContentResult() { Content = json };
}
public ContentResult BatchRate(string GIDS, string Rate)
{
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
{
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
bool flag = XXHDAL.SetBatchRate(GIDS,Rate);
var jsonRespose = new JsonResponse { Success = flag };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
}