@ -48,6 +48,7 @@ using DSWeb.Areas.Dispatch.Models;
using DSWeb.MvcShipping.Models.MsChFee ;
using static DSWeb . Areas . CommMng . DAL . PublicAPIDAL . 泛 微 OAHelper ;
using Microsoft.AspNet.SignalR.Hosting ;
using DSWeb.MvcShipping.Helper.Repository ;
//using System.Web.Http;
namespace DSWeb.Areas.Dispatch.Controllers
@ -224,6 +225,12 @@ namespace DSWeb.Areas.Dispatch.Controllers
[HttpPost]
public ActionResult GetEnumList ( EnumQueryInfo QueryInfo )
{
Stream postData = Request . InputStream ;
StreamReader sRead = new StreamReader ( postData ) ;
string postContent = sRead . ReadToEnd ( ) ;
sRead . Close ( ) ;
var cdc = new Common . DB . CommonDataContext ( ) ;
#region 正式逻辑
var openidok = BasicDataRefDAL . GetWxappUserInfo ( QueryInfo . AuthCode ) ;
@ -248,7 +255,18 @@ namespace DSWeb.Areas.Dispatch.Controllers
if ( QueryInfo . formname = = "CUSTOMERNAME" ) {
var _condition = $"CODENAME like '%{QueryInfo.condition}%' or SHORTNAME like '%{QueryInfo.condition}%'" ;
var _condition = " 1=1 " ;
if ( ! string . IsNullOrWhiteSpace ( QueryInfo . condition ) ) {
_condition + = $" and CODENAME like '%{QueryInfo.condition}%' or SHORTNAME like '%{QueryInfo.condition}%'" ;
}
var searchParams = JsonConvert . DeserializeObject < List < SearchParam > > ( postContent ) ;
var _condition2 = SearchParam . getcondition ( searchParams ) ;
_condition + = " and " + _condition2 ;
var customerList = BasicDataRefDAL . GetCustomRefList ( _condition , "0" , userinfo . USERID , "0" , "" ) ;
@ -428,6 +446,19 @@ namespace DSWeb.Areas.Dispatch.Controllers
} ) ;
}
if ( QueryInfo . formname = = "BSSOURCE" )
{
var evList = BasicDataRefDAL . GetSourceList ( "1=1" , "" ) ;
_result = Json ( new
{
ErrorCode = 0 ,
Message = "获取成功" ,
BaseInfo = evList
} ) ;
}
return _result ;
}
catch ( Exception e )
@ -474,17 +505,7 @@ namespace DSWeb.Areas.Dispatch.Controllers
try
{
var bsno = QueryInfo . bsno ;
var 应 收 费 用 List = DSWeb . MvcShipping . DAL . MsChFeeDAL . MsChFeeDAL . GetDataList ( $" bsno='{bsno}' " , 1 , "" , userinfo . USERID , userinfo . SHOWNAME , userinfo . COMPANYID ) ;
var 应 付 费 用 List = DSWeb . MvcShipping . DAL . MsChFeeDAL . MsChFeeDAL . GetDataList ( $" bsno='{bsno}' " , 2 , "" , userinfo . USERID , userinfo . SHOWNAME , userinfo . COMPANYID ) ;
var evList = new List < DSWeb . MvcShipping . Models . MsChFee . MsChFee > ( ) ;
if ( 应 收 费 用 List ! = null & & 应 收 费 用 List . Count > 0 ) {
evList . AddRange ( 应 收 费 用 List ) ;
}
if ( 应 付 费 用 List ! = null & & 应 付 费 用 List . Count > 0 )
{
evList . AddRange ( 应 付 费 用 List ) ;
}
var evList = DSWeb . MvcShipping . DAL . MsChFeeDAL . MsChFeeDAL . GetDataList ( $" bsno='{bsno}' " , 1 , "" , userinfo . USERID , userinfo . SHOWNAME , userinfo . COMPANYID ) ;
_result = Json ( new
{
@ -3244,7 +3265,6 @@ namespace DSWeb.Areas.Dispatch.Controllers
# endregion
#region 销售订舱审核 环亚捷运
/// <summary>
@ -3279,7 +3299,11 @@ namespace DSWeb.Areas.Dispatch.Controllers
var condition = SearchParam . getcondition ( searchParams ) ;
var datalist = MsSeaeOrderDAL . GetDataList ( QueryInfo . start , QueryInfo . limit , condition , userinfo . USERID , userinfo . CODENAME , userinfo . COMPANYID ) ;
//DatasetSort _sort = new DatasetSort();
var sortstr = @"[{""property"":""BSDATE"",""direction"":""desc""}]" ;
var datalist = MsSeaeOrderDAL . GetDataList ( QueryInfo . start , QueryInfo . limit , condition , userinfo . USERID , userinfo . CODENAME , userinfo . COMPANYID , sortstr ) ;
var totalcount = MsSeaeOrderDAL . getTotalCount ( condition , userinfo . USERID , userinfo . CODENAME , userinfo . COMPANYID ) ;
@ -3379,9 +3403,11 @@ namespace DSWeb.Areas.Dispatch.Controllers
var condition = SearchParam . getcondition ( searchParams ) ;
var datalist = MsSeaeOrderDAL . GetAuditDataList ( condition , userinfo . USERID , userinfo . CODENAME , userinfo . COMPANYID , QueryInfo . start , QueryInfo . limit ) ;
var sortstr = @"[{""property"":""BSDATE"",""direction"":""desc""}]" ;
var totalcount = MsSeaeOrderDAL . getAuditCount ( condition , userinfo . USERID , userinfo . CODENAME , userinfo . COMPANYID ) ;
var datalist = MsSeaeOrderDAL . GetAuditDataList ( condition , userinfo . USERID , userinfo . SHOWNAME , userinfo . COMPANYID , QueryInfo . start , QueryInfo . limit , sortstr ) ;
var totalcount = MsSeaeOrderDAL . getAuditCount ( condition , userinfo . USERID , userinfo . SHOWNAME , userinfo . COMPANYID ) ;
return Json ( new { ErrorCode = 0 , start = QueryInfo . start , limit = QueryInfo . limit , totalcount = totalcount , Data = datalist } ) ;
}
@ -3433,6 +3459,50 @@ namespace DSWeb.Areas.Dispatch.Controllers
}
}
/// <summary>
/// 销售订舱审核页 查询数量
/// </summary>
/// <param name="logininfo"></param>
/// <returns></returns>
[System.Web.Http.HttpPost]
public ActionResult GetAuditOrderCount ( EnumQueryInfo QueryInfo )
{
try
{
Stream postData = Request . InputStream ;
StreamReader sRead = new StreamReader ( postData ) ;
string postContent = sRead . ReadToEnd ( ) ;
sRead . Close ( ) ;
var searchParams = JsonConvert . DeserializeObject < List < SearchParam > > ( postContent ) ;
var cdc = new Common . DB . CommonDataContext ( ) ;
#region 正式逻辑
var openidok = BasicDataRefDAL . GetWxappUserInfo ( QueryInfo . AuthCode ) ;
if ( ! openidok . Success )
{
return Json ( new { ErrorCode = 500 , Message = $"发生错误:{openidok.Message}" } , JsonRequestBehavior . AllowGet ) ;
}
var userinfo = ( VW_user_md ) openidok . Data ;
# endregion
var condition = SearchParam . getcondition ( searchParams ) ;
var data = MsSeaeOrderDAL . getAuditCount ( condition , userinfo . USERID , userinfo . SHOWNAME , userinfo . COMPANYID ) ;
return Json ( new { ErrorCode = 0 , start = QueryInfo . start , limit = QueryInfo . limit , totalcount = data , Data = data } ) ;
}
catch ( Exception e )
{
return Json ( new { ErrorCode = 500 , Message = "发生错误:" + e . Message } ) ;
}
}
/// <summary>
/// 获取ctn列表
/// </summary>
@ -3713,6 +3783,9 @@ namespace DSWeb.Areas.Dispatch.Controllers
if ( result . Success )
{
//提交审核成功后添加费用
MsSeaeOrderDAL . CreateFeeOrder ( headData ) ;
return Json ( new { ErrorCode = 0 , Message = result . Message , Data = result . Data } ) ;
}
else
@ -3774,6 +3847,9 @@ namespace DSWeb.Areas.Dispatch.Controllers
if ( result . Success )
{
//撤回提交成功 删除 ch_fee_order
MsSeaeOrderDAL . DeleteFeeOrder ( headData ) ;
return Json ( new { ErrorCode = 0 , Message = result . Message , Data = result . Data } ) ;
}
else
@ -3835,6 +3911,8 @@ namespace DSWeb.Areas.Dispatch.Controllers
if ( result . Success )
{
//生成ch_fee_order
return Json ( new { ErrorCode = 0 , Message = result . Message , Data = result . Data } ) ;
}
else
@ -3896,6 +3974,9 @@ namespace DSWeb.Areas.Dispatch.Controllers
if ( result . Success )
{
//驳回提交成功 删除 ch_fee_order
MsSeaeOrderDAL . DeleteFeeOrder ( headData ) ;
return Json ( new { ErrorCode = 0 , Message = result . Message , Data = result . Data } ) ;
}
else
@ -3911,7 +3992,7 @@ namespace DSWeb.Areas.Dispatch.Controllers
}
/// <summary>
/// 驳回提交
/// 确认订舱
/// </summary>
/// <param name="QueryInfo"></param>
/// <returns></returns>
@ -3973,7 +4054,215 @@ namespace DSWeb.Areas.Dispatch.Controllers
}
}
/// <summary>
/// 获取销售订舱费用列表
/// </summary>
/// <param name="CUSTOMERNAME"></param>
/// <returns></returns>
[HttpPost]
public ActionResult GetOrderFeeList ( EnumQueryInfo QueryInfo )
{
var cdc = new Common . DB . CommonDataContext ( ) ;
#region 正式逻辑
var openidok = BasicDataRefDAL . GetWxappUserInfo ( QueryInfo . AuthCode ) ;
if ( ! openidok . Success )
{
return Json ( new { ErrorCode = 500 , Message = $"发生错误:{openidok.Message}" } , JsonRequestBehavior . AllowGet ) ;
}
var userinfo = ( VW_user_md ) openidok . Data ;
# endregion
#region 测试逻辑
//var userinfo = cdc.VW_user .Where(x => x.CODENAME.ToUpper() == "ADMIN").FirstOrDefault();
# endregion
var _result = Json ( new { } ) ;
try
{
var bsno = QueryInfo . bsno ;
var evList = DSWeb . MvcShipping . DAL . MsChFeeDAL . MsChFeeDAL . GetOrderDataList ( $" bsno='{bsno}' " ) ;
_result = Json ( new
{
ErrorCode = 0 ,
Message = "获取成功" ,
BaseInfo = evList
} ) ;
return _result ;
}
catch ( Exception e )
{
BasicDataRefDAL . SaveLog ( JsonConvert . SerializeObject ( e ) , e . Message , "wxapp" , "查询错误" ) ;
_result = Json ( new
{
ErrorCode = 500 ,
Message = e . Message ,
Data = e
} ) ;
}
return Json ( new { ErrorCode = 500 , Message = "发生错误" } , JsonRequestBehavior . AllowGet ) ;
}
/// <summary>
/// 保存销售订舱费用列表
/// </summary>
/// <param name="CUSTOMERNAME"></param>
/// <returns></returns>
[HttpPost]
public ActionResult SaveOrderFeeList ( EnumQueryInfo QueryInfo )
{
try
{
Stream postData = Request . InputStream ;
StreamReader sRead = new StreamReader ( postData ) ;
string postContent = sRead . ReadToEnd ( ) ;
sRead . Close ( ) ;
var cdc = new Common . DB . CommonDataContext ( ) ;
#region 正式逻辑
var openidok = BasicDataRefDAL . GetWxappUserInfo ( QueryInfo . AuthCode ) ;
if ( ! openidok . Success )
{
return Json ( new { ErrorCode = 500 , Message = $"发生错误:{openidok.Message}" } , JsonRequestBehavior . AllowGet ) ;
}
var userinfo = ( VW_user_md ) openidok . Data ;
# endregion
string LANGUAGES = "" ;
string userid = userinfo . USERID ;
var aaa = "" ;
var saveinfo = JsonConvert . DeserializeObject < SaveOrderFeeListParam > ( postContent ) ;
var bodyList = saveinfo . Body ;
var chfeeBodyList = bodyList ;
var chfeeDelBodyList = JsonConvert . DeserializeObject < List < MsOrderFee > > ( "" ) ;
var modb = new DSWeb . TruckMng . Helper . Repository . ModelObjectRepository ( ) ;
DBResult result = modb . SaveComm ( "BsNo" , QueryInfo . bsno ,
DSWeb . MvcShipping . Helper . ModelObjectConvert < MsOrderFee > . ToModelObjectList ( chfeeBodyList ) ,
DSWeb . MvcShipping . Helper . ModelObjectConvert < MsOrderFee > . ToModelObjectList ( chfeeDelBodyList )
) ;
if ( result . Success )
{
return Json ( new { ErrorCode = 0 , Message = result . Message , Data = result . Data } ) ;
}
else
{
return Json ( new { ErrorCode = 500 , Message = "保存错误:" + result . Message } ) ;
}
}
catch ( Exception e )
{
return Json ( new { ErrorCode = 500 , Message = "发生错误:" + e . Message } ) ;
}
}
/// <summary>
/// 删除销售订舱费用列表
/// </summary>
/// <param name="CUSTOMERNAME"></param>
/// <returns></returns>
[HttpPost]
public ActionResult DelOrderFeeList ( EnumQueryInfo QueryInfo )
{
try
{
Stream postData = Request . InputStream ;
StreamReader sRead = new StreamReader ( postData ) ;
string postContent = sRead . ReadToEnd ( ) ;
sRead . Close ( ) ;
var searchParams = JsonConvert . DeserializeObject < DelFeeListParam > ( postContent ) ;
var cdc = new Common . DB . CommonDataContext ( ) ;
#region 正式逻辑
var openidok = BasicDataRefDAL . GetWxappUserInfo ( QueryInfo . AuthCode ) ;
if ( ! openidok . Success )
{
return Json ( new { ErrorCode = 500 , Message = $"发生错误:{openidok.Message}" } , JsonRequestBehavior . AllowGet ) ;
}
var userinfo = ( VW_user_md ) openidok . Data ;
# endregion
string LAN = Convert . ToString ( Session [ "LANGUAGES" ] ) ;
var shanchuchenggong = "删除成功!" ;
if ( LAN = = "en-us" )
{
shanchuchenggong = "Successfully deleted! " ;
}
int iResult = 0 ;
//前端传递的feeids是一个id
//如果将来需要删除多个 id, 则传递多个id, 以','分隔
var bodyList = searchParams . feeids ;
var result = new DBResult ( ) ;
if ( bodyList ! = "" | | bodyList ! = null )
{
//iResult = DSWeb.MvcShipping.DAL.MsChFeeDAL.MsChFeeDAL.DeleteFee(bodyList);
//DSWeb.MvcShipping.DAL.MsChFeeDAL.MsChFeeDAL.p_op_gain(searchParams.bsno, userinfo.USERID);
iResult = DSWeb . MvcShipping . DAL . MsChFeeDAL . MsChFeeDAL . DeleteOrderFee ( "'" + bodyList + "'" ) ;
//DSWeb.MvcShipping.DAL.MsChFeeDAL.MsChFeeDAL.p_op_gain(searchParams.bsno, userinfo.USERID);
}
if ( iResult = = 1 )
{
result . Success = true ;
result . Message = shanchuchenggong ;
}
else if ( iResult = = 0 )
{
result . Success = false ;
result . Message = "出现错误,未删除!" ;
}
else if ( iResult = = - 1 )
{
result . Success = false ;
result . Message = "有异常,删除失败!" ;
}
else if ( iResult = = - 2 )
{
result . Success = false ;
result . Message = "删除异常,事务已回滚成功!" ;
}
return Json ( new { ErrorCode = 0 , result . Message } ) ;
}
catch ( Exception e )
{
return Json ( new { ErrorCode = 500 , Message = "发生错误:" + e . Message } ) ;
}
}
# endregion
}
@ -4024,6 +4313,11 @@ namespace DSWeb.Areas.Dispatch.Controllers
result + = $" < '{SearchValue}'" ;
}
if ( SearchType = = "sql" )
{
result = $"({SearchValue})" ;
}
return result ;
}
@ -4060,6 +4354,12 @@ namespace DSWeb.Areas.Dispatch.Controllers
public List < MsChFee > Body { get ; set ; }
}
public class SaveOrderFeeListParam : SaveParam
{
public string bsno { get ; set ; }
public List < MsOrderFee > Body { get ; set ; }
}
public class DelFeeListParam : SaveParam
{
public string bsno { get ; set ; }