@ -29,6 +29,8 @@ using DSWeb.MvcShipping.DAL.MsSysParamSet;
using DSWeb.MvcShipping.DAL.ChMonthCloseDAL ;
using DSWeb.MvcShipping.DAL.MsCodeOpTemplate ;
using DSWeb.MvcShipping.DAL.MsChFeeDAL ;
using DSWeb.Areas.MvcShipping.Models.Message.VGM ;
using DSWeb.Common.DB ;
namespace DSWeb.MvcShipping.Controllers
{
@ -534,6 +536,95 @@ namespace DSWeb.MvcShipping.Controllers
}
}
/// <summary>
/// 由解析软件触发 建立新报关业务 或返回现有报关业务的BSNO
/// </summary>
/// <param name="MBLNO"></param>
/// <param name="USERID"></param>
/// <param name="SHOWNAME"></param>
/// <param name="COMPANYID"></param>
/// <returns></returns>
public ContentResult NewApply ( string MBLNO , string USERID ) {
MsOpApply headData = null ;
var cdc = new CommonDataContext ( ) ;
var userinfo = cdc . VW_user . FirstOrDefault ( x = > x . USERID = = USERID ) ;
//var COMPANYID = userinfo
headData = MsOpApplyDAL . GetData ( $" MBLNO='{MBLNO}' " ) ;
if ( headData = = null | | headData . MBLNO = = "" )
{
//建立一个新报关业务
headData = new MsOpApply ( ) ;
headData . BSNO = "topapply" + Guid . NewGuid ( ) . ToString ( ) ;
headData . MASTERNO = headData . BSNO ;
headData . MBLNO = MBLNO ;
headData . INPUTBY = Convert . ToString ( Session [ "SHOWNAME" ] ) ;
headData . BSDATE = DateTime . Now ;
headData . DbOperationType = DbOperationType . DbotIns ;
headData . CUSTOMDATE = null ;
headData . CLEARCUSTOMDATE = null ;
headData . CORPID = userinfo . COMPANYID ;
headData . INPUTBY = userinfo . SHOWNAME ;
var _r = MsOpApplyDAL . getCUSTNO ( headData , USERID , userinfo . SHOWNAME , userinfo . COMPANYID ) ;
if ( _r . Success )
{
headData . CUSTNO = _r . Data . ToString ( ) ;
var modb = new ModelObjectDB ( ) ;
DBResult result = modb . Save ( headData ) ;
if ( result . Success )
{
DBResult dr = new DBResult ( true , "" , headData . BSNO ) ;
return BasicDataRefDAL . GetContentResult ( dr ) ;
}
else
{
return BasicDataRefDAL . GetContentResult ( result ) ;
}
//iscreatecustno = true;
//DBResult dr = new DBResult(true,"", headData.BSNO);
//return BasicDataRefDAL.GetContentResult(dr);
}
else
{
return BasicDataRefDAL . GetContentResult ( _r ) ;
}
}
else {
DBResult dr = new DBResult ( true , "" , headData . BSNO ) ;
return BasicDataRefDAL . GetContentResult ( dr ) ;
}
}
/// <summary>
/// 由解析软件触发 令数据从dechead declist container解析至op_apply
/// </summary>
/// <param name="BSNO"></param>
/// <returns></returns>
public ContentResult SaveNewApply ( string BSNO ) {
var result = new DBResult ( true , "" , "" ) ;
return BasicDataRefDAL . GetContentResult ( result ) ;
}
public ContentResult Delete ( string data )
{
var head = JsonConvert . Deserialize < MsOpApply > ( data ) ;