using System ;
using System.Linq ;
using System.Web.Mvc ;
using DSWeb.MvcContainer.Models.MsOpPrice ;
using DSWeb.MvcContainer.DAL.MsOpPrice ;
using DSWeb.MvcShipping.Helper ;
using DSWeb.MvcShipping.Comm.Cookie ;
using System.Collections.Generic ;
using HcUtility.Comm ;
using HcUtility.Core ;
using DSWeb.Areas.CommMng.DAL ;
using DSWeb.Areas.RptMng.Comm ;
using System.Text ;
using DSWeb.Areas.CommMng.Models ;
using System.Data ;
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL ;
namespace DSWeb.MvcContainer.Controllers
{
[JsonRequestBehavior]
public class MsOpPriceController : Controller
{
/ /
// GET:
public ActionResult Index ( )
{
return View ( ) ;
}
public ActionResult SeaiIndex ( )
{
return View ( ) ;
}
/ /
// GET: /
public ActionResult SeaeEdit ( )
{
return View ( ) ;
}
public ActionResult SeaiEdit ( )
{
return View ( ) ;
}
public ActionResult AgentIndex ( )
{
return View ( ) ;
}
public ActionResult AgentEdit ( )
{
return View ( ) ;
}
public ActionResult YardIndex ( )
{
return View ( ) ;
}
public ActionResult RptYardIndex ( )
{
return View ( ) ;
}
public ActionResult YardEdit ( )
{
return View ( ) ;
}
public ActionResult AuditYardIndex ( )
{
return View ( ) ;
}
public ActionResult AddIndex ( )
{
return View ( ) ;
}
public ActionResult AddPriceProjectIndex ( )
{
return View ( ) ;
}
public ActionResult PiLiangFeeEdit ( )
{
return View ( ) ;
}
public ActionResult HistryFeeIndex ( )
{
return View ( ) ;
}
public ActionResult HistryFeeYardIndex ( )
{
return View ( ) ;
}
public ActionResult HistryFeeAgentIndex ( )
{
return View ( ) ;
}
public ActionResult ProjectIndex ( )
{
return View ( ) ;
}
public ActionResult ProjectEdit ( )
{
return View ( ) ;
}
public ActionResult AuditProjectIndex ( )
{
return View ( ) ;
}
public ActionResult HistoryView ( )
{
return View ( ) ;
}
/ /
// GET:
public ContentResult GetDataList ( int start , int limit , string sort , string condition , string pricetype )
{
var dataList = MsOpPriceDAL . GetDataList ( condition , pricetype , Convert . ToString ( Session [ "COMPANYID" ] ) , Convert . ToString ( Session [ "USERID" ] ) , sort ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetDataListStr ( string sort , string condition , string pricetype )
{
var dataListStr = MsOpPriceDAL . GetDataListStr ( condition , pricetype , Convert . ToString ( Session [ "COMPANYID" ] ) , Convert . ToString ( Session [ "USERID" ] ) , sort ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , data = dataListStr } ) ;
return new ContentResult ( ) { Content = json } ;
}
[ValidateInput(false)]
public ContentResult GetProjectDataList ( int start , int limit , string sort , string condition , string pricetype )
{
var dataList = MsOpPriceDAL . GetProjectDataList ( condition , pricetype , Convert . ToString ( Session [ "COMPANYID" ] ) , Convert . ToString ( Session [ "USERID" ] ) , sort ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetProjectDataListStr ( string sort , string condition , string pricetype )
{
var dataListStr = MsOpPriceDAL . GetProjectDataListStr ( condition , pricetype , Convert . ToString ( Session [ "COMPANYID" ] ) , Convert . ToString ( Session [ "USERID" ] ) , sort ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , data = dataListStr } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetListData ( int start , int limit , string pricetype , string condition , string sort , string printstr = "false" )
{
var rangstr = MsOpPriceDAL . GetRangDAStr ( pricetype , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( ! string . IsNullOrEmpty ( rangstr ) )
{
if ( ! string . IsNullOrEmpty ( condition ) )
{
condition = condition + " and " + rangstr ;
}
else
{
condition = rangstr ;
}
}
var isopen = MsBaseInfoDAL . GetUserModuleEnable ( "modAgentdetailView" , Convert . ToString ( Session [ "USERID" ] ) ) ;
condition = condition . Replace ( "'" , "''" ) ;
var strSql = new StringBuilder ( ) ;
strSql . Append ( " declare @sql varchar(4000) declare @feename varchar(1000) " ) ;
strSql . Append ( " set @sql='select b.GID,b.PRICETYPE,b.LINE,b.COUNTRY,b.PORTLOAD,b.PORTDISCHARGE,b.TRANSPORT,b.CARRIER,b.WEEKETD,b.YARD,b.FEETYPE " ) ;
strSql . Append ( ",b.VOYAGE,b.VALIDETD,b.SERVICE,b.GOODTYPE,b.CTNSTATUS,b.AGENTNAME,b.DEBITCORPNAME,b.PRICEDATE,b.REMARKS,b.INPUTBY,b.INPUTTIME,b.COMPANYID,b.OP" ) ;
if ( isopen = = true )
strSql . Append ( ", b.AGENTATTN,b.AGENTADDR " ) ;
else
strSql . Append ( ", '''' AGENTATTN,'''' AGENTADDR " ) ;
strSql . Append ( ",(select ShowName from [user] where GID=b.INPUTBY) as INPUTBYREF " ) ;
strSql . Append ( ",(select ShowName from [user] where GID=b.OP) as OPREF' " ) ;
strSql . Append ( " select @sql=@sql+',sum(case when c.UNIT='''+g.UNIT+''' and c.CURRENCY='''+g.CURRENCY+''' and c.FEENAME=''海运费'' then c.UNITPRICE else 0 end) as HYF'+g.UNIT+g.CURRENCY from (select DISTINCT FEENAME,UNIT,CURRENCY from op_price_items WHERE FEENAME='海运费') as g " ) ;
strSql . Append ( " set @sql=@sql+',sum(case when c.CURRENCY=''RMB''AND c.FEENAME<>''海运费'' then c.UNITPRICE else 0 end) as OTRMB,sum(case when c.CURRENCY=''USD'' AND c.FEENAME<>''海运费'' then c.UNITPRICE else 0 end) as OTUSD' " ) ;
strSql . Append ( " set @sql=@sql+',sum(case when c.CURRENCY=''JPY''AND c.FEENAME<>''海运费'' then c.UNITPRICE else 0 end) as OTJPY,sum(case when c.CURRENCY=''EUR'' AND c.FEENAME<>''海运费'' then c.UNITPRICE else 0 end) as OTEUR' " ) ;
strSql . Append ( " set @sql=@sql+',sum(case when c.CURRENCY=''RMB'' then c.UNITPRICE else 0 end) as TOTALRMB,sum(case when c.CURRENCY=''USD'' then c.UNITPRICE else 0 end) as TOTALUSD' " ) ;
strSql . Append ( " set @sql=@sql+',sum(case when c.CURRENCY=''JPY'' then c.UNITPRICE else 0 end) as TOTALJPY,sum(case when c.CURRENCY=''EUR'' then c.UNITPRICE else 0 end) as TOTALEUR' " ) ;
strSql . Append ( " set @sql=@sql+' from op_price_items c left join op_price b on (b.GID=c.LINKGID) " ) ;
if ( ! string . IsNullOrEmpty ( condition ) )
{
strSql . Append ( " Where " + condition ) ;
}
var sortstring = DatasetSort . Getsortstring ( sort ) ;
if ( ! string . IsNullOrEmpty ( sortstring ) )
{
strSql . Append ( " group by b.GID,b.PRICETYPE,b.LINE,b.COUNTRY,b.PORTLOAD,b.PORTDISCHARGE,b.TRANSPORT,b.CARRIER,b.WEEKETD,b.YARD,b.FEETYPE," ) ;
strSql . Append ( "b.VOYAGE,b.VALIDETD,b.SERVICE,b.GOODTYPE,b.CTNSTATUS,b.AGENTNAME,b.AGENTATTN,b.AGENTADDR,b.DEBITCORPNAME," ) ;
strSql . Append ( "b.PRICEDATE,b.REMARKS,b.INPUTBY,b.INPUTTIME,b.COMPANYID,b.OP " ) ;
strSql . Append ( " order by " + sortstring + " '" ) ;
}
else
{
strSql . Append ( " group by b.GID,b.PRICETYPE,b.LINE,b.COUNTRY,b.PORTLOAD,b.PORTDISCHARGE,b.TRANSPORT,b.CARRIER,b.WEEKETD,b.YARD,b.FEETYPE," ) ;
strSql . Append ( "b.VOYAGE,b.VALIDETD,b.SERVICE,b.GOODTYPE,b.CTNSTATUS,b.AGENTNAME,b.AGENTATTN,b.AGENTADDR,b.DEBITCORPNAME," ) ;
strSql . Append ( "b.PRICEDATE,b.REMARKS,b.INPUTBY,b.INPUTTIME,b.COMPANYID,b.OP' " ) ;
}
strSql . Append ( " exec(@sql) " ) ;
if ( ( ! string . IsNullOrEmpty ( printstr ) ) & & ( printstr = = "true" ) )
{
var jsonRespose = new JsonResponse
{
Success = true ,
Message = "完成" ,
Data = strSql . ToString ( )
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
else
{
var dbparams = new List < CustomDbParamter > ( ) ;
var paramps_sSQL = new CustomDbParamter ( ) ;
paramps_sSQL . ParameterName = "@sSQL" ;
paramps_sSQL . DbType = DbType . String ;
paramps_sSQL . Direction = ParameterDirection . Input ;
paramps_sSQL . Value = strSql . ToString ( ) ;
dbparams . Add ( paramps_sSQL ) ;
var dbRptResult = PubSysDAL . GetMsSqlPrcDataSet ( "sMsExesqlQry" , dbparams , "Result_Set" ) ;
var json = RptHelper . GetRptJsonResult ( start , limit , dbRptResult , "Result_Set" , true ) ;
return new ContentResult ( ) { Content = json } ;
}
}
public ContentResult GetFeeListData ( int start , int limit , string pricetype , string condition , string sort , string printstr = "false" )
{
var rangstr = MsOpPriceDAL . GetRangDAStr ( pricetype , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( ! string . IsNullOrEmpty ( rangstr ) )
{
if ( ! string . IsNullOrEmpty ( condition ) )
{
condition = condition + " and " + rangstr ;
}
else
{
condition = rangstr ;
}
}
var strSql = new StringBuilder ( ) ;
strSql . Append ( " SELECT f.GID,f.LINKGID,f.ITEMSNO,f.FEENAME,f.UNIT,f.UNITPRICE,f.CURRENCY,f.CHANGERATE " ) ;
strSql . Append ( " ,f.GOODSNAME,f.REMARKS,f.INPUTBY,f.INPUTTIME,f.FEESTATUS,f.CTNSTATUS ,f.FREEDAY " ) ;
strSql . Append ( ",f.VALIDETD,f.AUDITOPERATOR,f.AUDITDATE,f.CUSTOMERNAME,b.COUNTRY,b.PORTDISCHARGE,b.YARD,b.FEETYPE" ) ;
strSql . Append ( ",b.COMPANYID,b.PRICETYPE" ) ;
strSql . Append ( ",(select ShowName from [user] where GID=f.AUDITOPERATOR) as AUDITNAME" ) ;
strSql . Append ( ",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99024 and EnumValueID=f.FeeStatus) as FEESTATUS_REF" ) ;
strSql . Append ( " FROM op_price_items f left join op_price b on (b.GID=f.LINKGID) " ) ;
if ( ! string . IsNullOrEmpty ( condition ) )
{
strSql . Append ( " Where " + condition ) ;
}
var sortstring = DatasetSort . Getsortstring ( sort ) ;
if ( ! string . IsNullOrEmpty ( sortstring ) )
{
strSql . Append ( " order by " + sortstring + " '" ) ;
}
else
{
strSql . Append ( " order by b.INPUTTIME,b.GID " ) ;
}
if ( ( ! string . IsNullOrEmpty ( printstr ) ) & & ( printstr = = "true" ) )
{
var jsonRespose = new JsonResponse
{
Success = true ,
Message = "完成" ,
Data = strSql . ToString ( )
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
else
{
var dbparams = new List < CustomDbParamter > ( ) ;
var paramps_sSQL = new CustomDbParamter ( ) ;
paramps_sSQL . ParameterName = "@sSQL" ;
paramps_sSQL . DbType = DbType . String ;
paramps_sSQL . Direction = ParameterDirection . Input ;
paramps_sSQL . Value = strSql . ToString ( ) ;
dbparams . Add ( paramps_sSQL ) ;
var dbRptResult = PubSysDAL . GetMsSqlPrcDataSet ( "sMsExesqlQry" , dbparams , "Result_Set" ) ;
var json = RptHelper . GetRptJsonResult ( start , limit , dbRptResult , "Result_Set" , true ) ;
return new ContentResult ( ) { Content = json } ;
}
}
public ContentResult GetUNITLIST ( string condition )
{
//var strDa = GetRangDAStr("index", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
//if (!string.IsNullOrEmpty(strDa))
//{
// if (!string.IsNullOrEmpty(condition))
// {
// condition = condition + " and " + strDa;
// }
// else
// {
// condition = strDa;
// }
//}
var strSql = new StringBuilder ( ) ;
strSql . Append ( " SELECT DISTINCT c.UNIT,c.CURRENCY " ) ;
strSql . Append ( " from op_price_items c left join op_price b on (b.GID=c.LINKGID) " ) ;
if ( ! string . IsNullOrEmpty ( condition ) )
{
strSql . Append ( " Where c.FEENAME='海运费' and " + condition ) ;
}
else {
strSql . Append ( " Where c.FEENAME='海运费' " ) ;
}
strSql . Append ( " ORDER BY c.UNIT " ) ;
var dbparams = new List < CustomDbParamter > ( ) ;
var paramps_sSQL = new CustomDbParamter ( ) ;
paramps_sSQL . ParameterName = "@sSQL" ;
paramps_sSQL . DbType = DbType . String ;
paramps_sSQL . Direction = ParameterDirection . Input ;
paramps_sSQL . Value = strSql . ToString ( ) ;
dbparams . Add ( paramps_sSQL ) ;
var dbRptResult = PubSysDAL . GetMsSqlPrcDataSet ( "sMsExesqlQry" , dbparams , "Result_Set" ) ;
var json = RptHelper . GetRptJsonResult ( 0 , 100 , dbRptResult , "Result_Set" , true ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetWXFEELIST ( string condition )
{
var strSql = new StringBuilder ( ) ;
strSql . Append ( " SELECT DISTINCT c.FEENAME " ) ;
strSql . Append ( " from op_price_items c left join op_price b on (b.GID=c.LINKGID) " ) ;
strSql . Append ( " Where b.FEETYPE='维修' " ) ;
strSql . Append ( " ORDER BY c.FEENAME " ) ;
var dbparams = new List < CustomDbParamter > ( ) ;
var paramps_sSQL = new CustomDbParamter ( ) ;
paramps_sSQL . ParameterName = "@sSQL" ;
paramps_sSQL . DbType = DbType . String ;
paramps_sSQL . Direction = ParameterDirection . Input ;
paramps_sSQL . Value = strSql . ToString ( ) ;
dbparams . Add ( paramps_sSQL ) ;
var dbRptResult = PubSysDAL . GetMsSqlPrcDataSet ( "sMsExesqlQry" , dbparams , "Result_Set" ) ;
var json = RptHelper . GetRptJsonResult ( 0 , 1000 , dbRptResult , "Result_Set" , true ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult PiliangFee ( string bill , string fee )
{
/ /
var billList = JsonConvert . Deserialize < List < OpPrice > > ( bill ) ;
var feeList = JsonConvert . Deserialize < List < OpPriceItems > > ( fee ) ;
DBResult result = MsOpPriceDAL . SavePiliangUpdateFee ( billList , feeList ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
/ /
// GET: /TruckMng/MsWlTyreAcc/GetData/
public ContentResult GetData ( string handle , string condition )
{
OpPrice head = null ;
if ( handle = = "edit" )
{
head = MsOpPriceDAL . GetData ( condition , Convert . ToString ( Session [ "USERID" ] ) ) ;
}
if ( head = = null )
{
head = new OpPrice ( ) ;
head . COMPANYID = Convert . ToString ( Session [ "COMPANYID" ] ) ;
head . OP = Convert . ToString ( Session [ "USERID" ] ) ;
head . OPREF = Convert . ToString ( Session [ "SHOWNAME" ] ) ;
}
var json = JsonConvert . Serialize (
new { Success = true , Message = "查询成功" , data = head } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetProjectData ( string handle , string condition )
{
OpPrice head = null ;
if ( handle = = "edit" )
{
head = MsOpPriceDAL . GetProjectData ( condition , Convert . ToString ( Session [ "USERID" ] ) ) ;
}
if ( head = = null )
{
head = new OpPrice ( ) ;
head . COMPANYID = Convert . ToString ( Session [ "COMPANYID" ] ) ;
head . OP = Convert . ToString ( Session [ "USERID" ] ) ;
head . OPREF = Convert . ToString ( Session [ "SHOWNAME" ] ) ;
}
var json = JsonConvert . Serialize (
new { Success = true , Message = "查询成功" , data = head } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult Save ( string opstatus , string data , string body , bool issub = false , string audit = "" )
{
var headData = JsonConvert . Deserialize < OpPrice > ( data ) ;
var bodyList = JsonConvert . Deserialize < List < OpPriceItems > > ( body ) ;
if ( opstatus = = "add" )
{
headData . DbOperationType = DbOperationType . DbotIns ;
headData . COMPANYID = Convert . ToString ( Session [ "COMPANYID" ] ) ;
headData . INPUTBY = Convert . ToString ( Session [ "USERID" ] ) ;
headData . INPUTTIME = DateTime . Now . ToString ( "yyyy-MM-dd HH:mm:ss" ) ;
headData . BSSTATUS = "未提交" ;
}
else if ( opstatus = = "edit" )
{
headData . DbOperationType = DbOperationType . DbotUpd ;
headData . ModelUIStatus = "E" ;
}
else
{
headData . DbOperationType = DbOperationType . DbotDel ;
}
var GID = headData . GID ;
if ( headData . PRICEDATE = = "" ) headData . PRICEDATE = null ;
if ( headData . VALIDETD = = "" ) headData . VALIDETD = null ;
if ( headData . BEGINDATE = = "" ) headData . BEGINDATE = null ;
if ( headData . ENDDATE = = "" ) headData . ENDDATE = null ;
if ( string . IsNullOrEmpty ( headData . RENTOFDAY ) ) headData . RENTOFDAY = "0" ;
if ( string . IsNullOrEmpty ( headData . RENTAMOUNT ) ) headData . RENTAMOUNT = "0" ;
if ( string . IsNullOrEmpty ( headData . CHANGERATE ) ) headData . CHANGERATE = "0" ;
var modb = new ModelObjectDB ( ) ;
var result = modb . Save ( headData ) ;
if ( result . Success = = true ) {
MsOpPriceDAL . SavePriceItems ( bodyList , GID , Convert . ToString ( Session [ "USERID" ] ) ) ;
}
if ( issub ) {
MsOpPriceDAL . SubmitAuditBillNew ( GID , Convert . ToString ( Session [ "USERID" ] ) , audit , Convert . ToString ( Session [ "SHOWNAME" ] ) ) ;
}
var jsonRespose = new JsonResponse
{
Success = result . Success ,
Message = result . Message ,
Data = MsOpPriceDAL . GetProjectData ( "GID='" + GID + "'" , Convert . ToString ( Session [ "USERID" ] ) )
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult SubmitAuditBackForm ( string data )
{
var headData = JsonConvert . Deserialize < OpPrice > ( data ) ;
DBResult result = MsOpPriceDAL . CancelAuditBill ( headData . GID , Convert . ToString ( Session [ "USERID" ] ) ) ;
var jsonRespose = new JsonResponse
{
Success = result . Success ,
Message = result . Message ,
Data = ""
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult AuditBillList ( string bill , string audit , string auditremark , string isfinish )
{
var billData = JsonConvert . Deserialize < List < OpPrice > > ( bill ) ;
DBResult result = MsOpPriceDAL . AuditBillList ( billData , audit , auditremark , isfinish , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult AuditBillBack ( String bill , string reasean )
{
var billData = JsonConvert . Deserialize < List < OpPrice > > ( bill ) ;
DBResult result = MsOpPriceDAL . AuditBillBack ( billData , Convert . ToString ( Session [ "USERID" ] ) , reasean , Convert . ToString ( Session [ "COMPANYID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SetStop ( String bill , string isstop )
{
var billData = JsonConvert . Deserialize < List < OpPrice > > ( bill ) ;
DBResult result = MsOpPriceDAL . SetStop ( billData , Convert . ToString ( Session [ "USERID" ] ) , isstop ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult Delete ( string data )
{
var headData = JsonConvert . Deserialize < List < OpPrice > > ( data ) ;
DBResult result = MsOpPriceDAL . DeleteOpPrice ( headData ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult DeletePrice ( string data )
{
var headData = JsonConvert . Deserialize < List < OpPrice > > ( data ) ;
if ( headData ! = null & & headData . Count ! = 0 ) {
foreach ( var head in headData ) {
var isfee = MsOpPriceDAL . GetFeeCount ( head . GID ) ;
if ( isfee )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "存在运价明细,不允许删除!"
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
}
}
DBResult result = MsOpPriceDAL . DeleteOpPrice ( headData ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult SubmitAudit ( string feebody )
{
var billData = JsonConvert . Deserialize < List < OpPriceItems > > ( feebody ) ;
DBResult result = MsOpPriceDAL . SubmitAudit ( billData ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult AuditFee ( string data )
{
var billData = JsonConvert . Deserialize < List < OpPriceItems > > ( data ) ;
DBResult result = MsOpPriceDAL . AuditFee ( billData , Convert . ToString ( Session [ "USERID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult AuditBackFee ( string data )
{
var billData = JsonConvert . Deserialize < List < OpPriceItems > > ( data ) ;
DBResult result = MsOpPriceDAL . AuditBack ( billData ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetPriceItemsList ( string condition , string sort )
{
var dataList = MsOpPriceDAL . GetPriceItemsList ( condition , sort ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetPriceItemsListStr ( string condition , string sort )
{
var dataListStr = MsOpPriceDAL . GetPriceItemsListStr ( condition , sort ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , data = dataListStr } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SavePriceItems ( string body , string PID )
{
/ /
var bodyList = JsonConvert . Deserialize < List < OpPriceItems > > ( body ) ;
DBResult result = MsOpPriceDAL . SavePriceItems ( bodyList , PID , Convert . ToString ( Session [ "USERID" ] ) ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult DeletePriceItems ( string data )
{
var headData = JsonConvert . Deserialize < List < OpPriceItems > > ( data ) ;
DBResult result = MsOpPriceDAL . DeletePriceItems ( headData ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult GetModifyData ( string FeeID , string ApplyType )
{
var dataList = MsOpPriceDAL . GetModifyData ( FeeID , ApplyType ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = dataList . Count , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult ShenModify ( string data , string olddata )
{
var NewFee = JsonConvert . Deserialize < OpPriceItems > ( data ) ;
var OldFee = JsonConvert . Deserialize < OpPriceItems > ( olddata ) ;
DBResult result = MsOpPriceDAL . ShenModify ( NewFee , OldFee , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult CancelShenList ( string feedata )
{
var FeeList = JsonConvert . Deserialize < List < OpPriceItems > > ( feedata ) ;
DBResult result = MsOpPriceDAL . CancelShenList ( FeeList , Convert . ToString ( Session [ "USERID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult AuditShenNew ( String bill )
{
var billData = JsonConvert . Deserialize < List < OpPriceItems > > ( bill ) ;
DBResult result = MsOpPriceDAL . AuditShenNew ( billData , Convert . ToString ( Session [ "USERID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult AuditBackShen ( string bill , string reasean )
{
var billData = JsonConvert . Deserialize < List < OpPriceItems > > ( bill ) ;
DBResult result = MsOpPriceDAL . AuditBackShen ( billData , Convert . ToString ( Session [ "USERID" ] ) , reasean ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult SubmitAuditNew ( string feebody )
{
var billData = JsonConvert . Deserialize < List < OpPriceItems > > ( feebody ) ;
DBResult result = MsOpPriceDAL . SubmitAuditNew ( billData , Convert . ToString ( Session [ "USERID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult CancelAudit ( string GidStr , string optype )
{
DBResult result = MsOpPriceDAL . CancelAudit ( GidStr , Convert . ToString ( Session [ "USERID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult AuditList ( string bill )
{
var billData = JsonConvert . Deserialize < List < OpPriceItems > > ( bill ) ;
DBResult result = MsOpPriceDAL . AuditList ( billData , Convert . ToString ( Session [ "USERID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult AuditBack ( String bill , string reasean )
{
var billData = JsonConvert . Deserialize < List < OpPriceItems > > ( bill ) ;
DBResult result = MsOpPriceDAL . AuditBack ( billData , Convert . ToString ( Session [ "USERID" ] ) , reasean , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( result ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult StopPriceItems ( string data )
{
var headData = JsonConvert . Deserialize < List < OpPriceItems > > ( data ) ;
DBResult result = MsOpPriceDAL . StopPriceItems ( headData , Convert . ToString ( Session [ "USERID" ] ) ) ;
var jsonRespose = new JsonResponse { Success = result . Success , Message = result . Message } ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
public ContentResult GetCustList ( string condition )
{
var dataList = MsOpPriceDAL . GetCustList ( condition , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize (
new { Success = true , Message = "查询成功" , data = dataList . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
public ContentResult GetYardPrice ( int start , int limit , string condition , string sort , string printstr )
{
var rangstr = MsOpPriceDAL . GetRangDAStr ( "4" , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
if ( ! string . IsNullOrEmpty ( rangstr ) )
{
if ( ! string . IsNullOrEmpty ( condition ) )
{
condition = condition + " and " + rangstr ;
}
else
{
condition = rangstr ;
}
}
var strSql = new StringBuilder ( ) ;
strSql . Append ( "SELECT b.GID,b.LINKGID,b.FEENAME,b.UNIT,b.CURRENCY,b.GOODSNAME,b.REMARKS,b.PORTDISCHARGE,b.YARD" ) ;
strSql . Append ( ",b.UNITPRICE,b.CHANGERATE,b.CUSTOMERNAME,b.COUNTRY,b.VALIDETD,b.BEGINDATE,B.ISSTOP,B.FREEDAY,b.DATETYPE,b.CTNSTATUS,b.INPUTBYREF,b.INPUTTIME" ) ;
strSql . Append ( " FROM v_yard_price b " ) ;
strSql . Append ( " WHERE 1=1 " ) ;
if ( ! string . IsNullOrEmpty ( condition ) )
{
strSql . Append ( " AND " + condition ) ;
}
var sortstring = DatasetSort . Getsortstring ( sort ) ;
if ( ! string . IsNullOrEmpty ( sortstring ) )
{
strSql . Append ( " order by " + sortstring ) ;
}
else
{
strSql . Append ( " order by FEENAME,UNIT,CURRENCY,GOODSNAME,REMARKS,PORTDISCHARGE,YARD " ) ;
}
if ( ( ! string . IsNullOrEmpty ( printstr ) ) & & ( printstr = = "true" ) )
{
var jsonRespose = new JsonResponse
{
Success = true ,
Message = "完成" ,
Data = strSql . ToString ( )
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
}
else
{
var dbparams = new List < CustomDbParamter > ( ) ;
var paramps_sSQL = new CustomDbParamter ( ) ;
paramps_sSQL . ParameterName = "@sSQL" ;
paramps_sSQL . DbType = DbType . String ;
paramps_sSQL . Direction = ParameterDirection . Input ;
paramps_sSQL . Value = strSql . ToString ( ) ;
dbparams . Add ( paramps_sSQL ) ;
var dbRptResult = PubSysDAL . GetMsSqlPrcDataSet ( "sMsExesqlQry" , dbparams , "Result_Set" ) ;
var json = RptHelper . GetRptJsonResult ( start , limit , dbRptResult , "Result_Set" , true ) ;
return new ContentResult ( ) { Content = json } ;
}
}
//public ContentResult GetYardPrice(string condition)
//{
// var rangstr = MsOpPriceDAL.GetRangDAStr("4", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
// if (!string.IsNullOrEmpty(rangstr))
// {
// if (!string.IsNullOrEmpty(condition))
// {
// condition = condition + " and " + rangstr;
// }
// else
// {
// condition = rangstr;
// }
// }
// var strSql = new StringBuilder();
// var objlist =MsOpPriceDAL.GetCustList(condition,Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
// strSql.Append("SELECT b.FEENAME,b.UNIT,b.CURRENCY,b.GOODSNAME,b.REMARKS,b.PORTDISCHARGE,b.YARD");
// foreach (var enumValue in objlist)
// {
// strSql.Append(",SUM(ISNULL(case when CUSTOMERNAME='" + enumValue.CUSTNAME + "' then UNITPRICE else 0 end,0)) AS " + enumValue.FIELDNAME);
// }
// strSql.Append(" FROM v_yard_price b ");
// strSql.Append(" WHERE 1=1 ");
// if (!string.IsNullOrEmpty(condition))
// {
// strSql.Append(" AND " + condition);
// }
// strSql.Append(" Group by b.FEENAME,b.UNIT,b.CURRENCY,b.GOODSNAME,b.REMARKS,b.PORTDISCHARGE,b.YARD ");
// strSql.Append(" order by b.FEENAME,b.UNIT,b.CURRENCY,b.GOODSNAME,b.REMARKS,b.PORTDISCHARGE,b.YARD ");
// var dbparams = new List<CustomDbParamter>();
// var paramps_sSQL = new CustomDbParamter();
// paramps_sSQL.ParameterName = "@sSQL";
// paramps_sSQL.DbType = DbType.String;
// paramps_sSQL.Direction = ParameterDirection.Input;
// paramps_sSQL.Value = strSql.ToString();
// dbparams.Add(paramps_sSQL);
// var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsExesqlQry", dbparams, "Result_Set");
// var json = RptHelper.GetRptJsonResult(0, 2000, dbRptResult, "Result_Set", true);
// return new ContentResult() { Content = json };
//}
#region 参照部分
# endregion
}
}