@ -254,11 +254,11 @@ namespace VOL.WMS.Services
/// <summary>
//车辆信息
/// </summary>
public List < OP_WMS_ TRUCK> Table3List { get ; set ; }
public List < VW_ OP_TRUCK_FILE > Table3List { get ; set ; }
public List < INFO_FILES > Table4List { get ; set ; }
public List < VW_OP_TRUCK_FILE > Table5List { get ; set ; }
//public List<VW_OP_TRUCK_FILE> Table5List { get; set; }
/// <summary>
/// 出库条件
/// </summary>
@ -381,8 +381,10 @@ namespace VOL.WMS.Services
{
//在此操作tableExtra从表信息
List < OP_WMS_OUT_PLAN_DETAIL > PLANDetailList = tableExtra . Table1List ; //.Select(s).ToList();
List < OP_WMS _TRUCK> TRUCK List = tableExtra . Table3List ;
List < VW_ OP_TRUCK_FILE > TRUCK Info List = tableExtra . Table3List ;
List < OP_WMS_TRUCK > TRUCKList = new List < OP_WMS_TRUCK > ( ) ;
TRUCKList = AutoMapperHelper . MapToList < VW_OP_TRUCK_FILE , OP_WMS_TRUCK > ( TRUCKInfoList ) ;
if ( ! PLANDetailList . isNullorEmpty ( ) )
@ -445,18 +447,19 @@ namespace VOL.WMS.Services
}
List < INFO_FILES > FileList = tableExtra . Table4List ;
if ( ! FileList . isNullorEmpty ( ) )
{
var vw = VW_OP_WMS_OUT_PLANRepository . Instance . FindFirst ( x = > x . WMSPLANID = = head . WMSPLANID ) ;
INFO_FILESService . DealSaveDetail ( FileList , head . WMSPLANID . ToString ( ) , head . WMSNO , "出库通知" , vw . MBLNO , vw . CNTRNO ) ;
}
if ( ! TRUCKList . isNullorEmpty ( ) )
{
var _r = AddTruckFile ( saveDataModel , dealedbodylist2[ 0 ] , dealedbodylist2 [ 1 ] , FileList , head ) ;
var _r = AddTruckFile ( saveDataModel , TRUCKInfoList , dealedbodylist2 [ 0 ] , dealedbodylist2 [ 1 ] , ref FileList , head ) ;
if ( ! _r . Status ) return _r ;
}
if ( ! FileList . isNullorEmpty ( ) )
{
var vw = VW_OP_WMS_OUT_PLANRepository . Instance . FindFirst ( x = > x . WMSPLANID = = head . WMSPLANID ) ;
INFO_FILESService . DealSaveDetail ( FileList , head . WMSPLANID . ToString ( ) , head . WMSNO , "出库通知" , vw . MBLNO , vw . CNTRNO ) ;
}
List < Op_Wms_Logic > ConditionList = tableExtra . Table6List ;
if ( ! ConditionList . isNullorEmpty ( ) )
@ -646,7 +649,10 @@ namespace VOL.WMS.Services
{
//在此操作tableExtra从表信息
List < OP_WMS_OUT_PLAN_DETAIL > PLANDetailList = tableExtra = = null ? null : tableExtra . Table1List ; //.Select(s).ToList();
List < OP_WMS_TRUCK > TRUCKList = tableExtra = = null ? null : tableExtra . Table3List ;
List < VW_OP_TRUCK_FILE > TRUCKInfoList = tableExtra . Table3List ;
List < OP_WMS_TRUCK > TRUCKList = new List < OP_WMS_TRUCK > ( ) ;
TRUCKList = AutoMapperHelper . MapToList < VW_OP_TRUCK_FILE , OP_WMS_TRUCK > ( TRUCKInfoList ) ;
if ( ! PLANDetailList . isNullorEmpty ( ) )
{
@ -695,19 +701,23 @@ namespace VOL.WMS.Services
List < INFO_FILES > FileList = tableExtra . Table4List ;
if ( ! TRUCKList . isNullorEmpty ( ) )
{
var _r = AddTruckFile ( saveModel , TRUCKInfoList , dealedbodylist2 [ 0 ] , dealedbodylist2 [ 1 ] , ref FileList , head ) ;
if ( ! _r . Status ) return _r ;
}
if ( ! FileList . isNullorEmpty ( ) )
{
var vw = VW_OP_WMS_OUT_PLANRepository . Instance . FindFirst ( x = > x . WMSPLANID = = head . WMSPLANID ) ;
INFO_FILESService . DealSaveDetail ( FileList , head . WMSPLANID . ToString ( ) , head . WMSNO , "出库通知" , vw . MBLNO ) ;
}
if ( ! TRUCKList . isNullorEmpty ( ) )
else
{
var _r = AddTruckFile ( saveModel , dealedbodylist2 [ 0 ] , dealedbodylist2 [ 1 ] , FileList , head ) ;
if ( ! _r . Status ) return _r ;
}
List < Op_Wms_Logic > ConditionList = tableExtra . Table6List ;
@ -785,42 +795,73 @@ namespace VOL.WMS.Services
/// <param name="FileList"></param>
/// <param name="head"></param>
/// <returns></returns>
public WebResponseContent AddTruckFile ( SaveModel saveModel , List < OP_WMS_TRUCK> addTruck , List < OP_WMS_TRUCK > updTruck , List < INFO_FILES > FileList , OP_WMS_OUT_PLAN head )
public WebResponseContent AddTruckFile ( SaveModel saveModel , List < VW_OP_TRUCK_FILE> TruckList , List < OP_WMS_TRUCK > addtrucklist , List < OP_WMS_TRUCK > updtrucklist , ref List < INFO_FILES > FileList , OP_WMS_OUT_PLAN head )
{
TableExtra2 tableExtra2 = saveModel . Extra . ToString ( ) . DeserializeObject < TableExtra2 > ( ) ;
if ( addTruck. Count > 0 | | updTruck . Count > 0 )
if ( TruckList! = null & & TruckList . Count > 0 )
{
UserInfo userInfo = UserContext . Current . UserInfo ;
var TruckList = new List < OP_WMS_TRUCK > ( ) ;
TruckList . AddRange ( addTruck ) ;
TruckList . AddRange ( updTruck ) ;
var currFileList = INFO_FILESRepository . Instance . FindAsIQueryable ( x = > x . PID = = head . WMSPLANID ) . ToList ( ) ;
var addFilelist = new List < INFO_FILES > ( ) ;
var updFilelist = new List < INFO_FILES > ( ) ;
Guid Getgid ( string truckno ) {
if ( addtrucklist . Exists ( x = > x . TRUCKNO = = truckno ) )
{
return addtrucklist . First ( x = > x . TRUCKNO = = truckno ) . GID ;
}
if ( updtrucklist . Exists ( x = > x . TRUCKNO = = truckno ) )
{
return addtrucklist . First ( x = > x . TRUCKNO = = truckno ) . GID ;
}
return new Guid ( ) ;
}
foreach ( var item in TruckList )
{
{
if ( string . IsNullOrWhiteSpace ( item . IMGPATH ) ) continue ;
if ( currFileList ! = null & & currFileList . Count ( ) > 0 & & currFileList . Exists ( x = > x . GID = = item . GID ) )
{
//更新imgpath
var updrec = currFileList . First ( x = > x . GID = = item . GID ) ;
updrec . IMGPATH = item . IMGPATH ;
updFilelist . Add ( updrec ) ;
if ( FileList . Exists ( x = > x . GID = = item . GID ) ) {
FileList . First ( x = > x . GID = = item . GID ) . IMGPATH = item . IMGPATH ;
FileList . First ( x = > x . GID = = item . GID ) . FILENAME = item . TRUCKNO ;
}
}
else if ( addFilelist . Exists ( x = > x . FILENAME = = item . TRUCKNO ) )
{
//什么也不做
} else
{
var newfile = AutoMapperHelper . MapTo < OP_WMS_TRUCK , INFO_FILES > ( item ) ;
var updrec = currFileList . First ( x = > x . GID = = item . GID ) ;
if ( ! string . IsNullOrWhiteSpace ( updrec . IMGPATH ) ) updrec . IMGPATH + = "," ;
updrec . IMGPATH + = item . IMGPATH ;
updFilelist . Add ( updrec ) ;
if ( FileList . Exists ( x = > x . GID = = item . GID ) )
{
FileList . First ( x = > x . GID = = item . GID ) . IMGPATH = item . IMGPATH ;
}
}
else
{
var newfile = AutoMapperHelper . MapTo < VW_OP_TRUCK_FILE , INFO_FILES > ( item ) ;
newfile . GID = item . GID ;
newfile . GID = Getgid ( item . TRUCKNO ) ;
newfile . PID = head . WMSPLANID ;
newfile . FILETYPE = "出库通知" ;
newfile . UPLOADEMPLY = userInfo . UserTrueName ;
@ -828,17 +869,21 @@ namespace VOL.WMS.Services
newfile . MBLNO = saveModel . getValue ( "MBLNO" ) ;
newfile . CNTRNO = saveModel . getValue ( "CNTRNO" ) ;
newfile . FILENAME = item . TRUCKNO ;
addFilel ist. Add ( newfile ) ;
FileL ist. Add ( newfile ) ;
}
}
if ( addFilelist . Count > 0 )
{
INFO_FILESService . DealSaveDetail ( addFilelist , head . WMSPLANID . ToString ( ) , head . WMSNO , "出库通知" ) ;
INFO_FILESRepository . Instance . AddRange ( addFilelist , true ) ;
}
//if (addFilelist.Count > 0)
//{
// INFO_FILESService.DealSaveDetail(addFilelist, head.WMSPLANID.ToString(), head.WMSNO, "出库通知");
// INFO_FILESRepository.Instance.AddRange(addFilelist, true);
//}
//if (updFilelist.Count > 0)
//{
// INFO_FILESRepository.Instance.UpdateRange(updFilelist, true);
//}
}
return _webResponse . OK ( "保存成功" ) ;
@ -1163,86 +1208,86 @@ namespace VOL.WMS.Services
/// </summary>
/// <param name="workKeysModel"></param>
/// <returns></returns>
public WebResponseContent UndoShenHe ( WorkKeysModel workKeysModel )
{
var headid = workKeysModel . workKeys . ToString ( ) ;
var head = repository . FindFirst ( x = > x . WMSPLANID = = new Guid ( headid ) ) ;
/ * if ( CanChange ( headid ) )
{
//如果能撤回的话 撤回审核不起作用 不做任何操作
return null ;
} * /
//判断 bxgid=wmsno的费用能否删除 如不能则返回错误
var fee_makebyplanList = Ch_feeRepository . Instance . FindAsIQueryable ( x = > x . BXGID = = head . WMSNO ) . ToList ( ) ;
foreach ( var fee in fee_makebyplanList ) {
if ( ! fee . CanChange ( ) ) {
return _webResponse . Error ( "自动产生的费用已进入其他环节(如发票申请、付费申请等),不能取消。" ) ;
}
}
int js = 0 ;
List < OP_WMS_OUT_PLAN_DETAIL > outplangoods_list = OP_WMS_OUT_PLAN_DETAILRepository . Instance . FindAsIQueryable ( x = > x . WMSPLANID = = new Guid ( workKeysModel . workKeys ) ) . ToList ( ) ;
string [ ] keys = new string [ outplangoods_list . Count ] ;
for ( int i = 0 ; i < outplangoods_list . Count ; i + + )
{
keys [ i ] = outplangoods_list [ i ] . WMSOUTDETAILID . ToString ( ) ;
}
List < VW_OP_WMS_OUT_DO_GOODS > outdogoods_list = VW_OP_WMS_OUT_DO_GOODSRepository . Instance . FindAsIQueryable ( x = > x . WMSPLANDETAILID = = new Guid ( keys [ 0 ] ) ) . ToList ( ) ;
List < OP_WMS_OUT_DO > outdo_list = OP_WMS_OUT_DORepository . Instance . FindAsIQueryable ( x = > x . WMSPLANID = = new Guid ( workKeysModel . workKeys ) ) . ToList ( ) ;
if ( ( outdogoods_list = = null | | outdogoods_list . Count < = 0 ) & & ( outdo_list = = null | | outdo_list . Count < = 0 ) )
{
try
{
//实现委托
string sql1 = $"update OP_WMS_OUT_PLAN set BSSTATUS=0 where WMSPLANID='" + workKeysModel . workKeys + "';" ;
//删除入库执行时动作 删除入库执行时后台动作
js = repository . ExecuteSqlCommand ( sql1 ) ;
//return _webResponse.OK("撤回成功。");
}
catch ( Exception e )
{
return _webResponse . Error ( e . Message ) ;
}
}
else {
var msg = "" ;
if ( outdo_list ! = null & & outdo_list . Count > 0 ) {
msg = "[" + outdo_list [ 0 ] . WMSNO + "]" ;
}
return _webResponse . Error ( $"已产生下游业务{msg},不可取消,请删除后重试。" ) ;
}
string sql = "" ;
try {
//实现委托
sql = $"update OP_WMS_OUT_PLAN set BSSTATUS=0 where WMSPLANID='{headid}';" +
//$"DELETE FROM OP_WMS_TRUCK where WMSPLANID in ({joinKeys});;" +
//$"DELETE FROM OP_WMS_OUT_PLAN_DETAIL where WMSPLANID = '{headid}';" +
$"DELETE FROM CH_FEE where BXGID ='{head.WMSNO}';" ;
//删除入库执行时动作 删除入库执行时后台动作
js = repository . ExecuteSqlCommand ( sql ) ;
Logger . PushStatus_PUB ( "出库通知" , "取消审核:" + headid ) ;
return _webResponse . OK ( "取消成功。" ) ;
}
catch ( Exception e )
{
return _webResponse . Error ( e . Message ) ;
}
}
//public WebResponseContent UndoShenHe(WorkKeysModel workKeysModel )
// {
// var headid = workKeysModel.workKeys.ToString();
// var head = repository.FindFirst(x => x.WMSPLANID == new Guid(headid));
// /*if (CanChange(headid))
// {
// //如果能撤回的话 撤回审核不起作用 不做任何操作
// return null;
// }*/
// //判断 bxgid=wmsno的费用能否删除 如不能则返回错误
// var fee_makebyplanList = Ch_feeRepository.Instance.FindAsIQueryable(x => x.BXGID == head.WMSNO).ToList();
// foreach (var fee in fee_makebyplanList) {
// if (!fee.CanChange()) {
// return _webResponse.Error("自动产生的费用已进入其他环节(如发票申请、付费申请等),不能取消。");
// }
// }
// int js = 0;
// List<OP_WMS_OUT_PLAN_DETAIL> outplangoods_list = OP_WMS_OUT_PLAN_DETAILRepository.Instance.FindAsIQueryable(x => x.WMSPLANID == new Guid(workKeysModel.workKeys)).ToList();
// string[] keys = new string[outplangoods_list.Count];
// for (int i = 0; i < outplangoods_list.Count; i++)
// {
// keys[i] = outplangoods_list[i].WMSOUTDETAILID.ToString();
// }
// List<VW_OP_WMS_OUT_DO_GOODS> outdogoods_list = VW_OP_WMS_OUT_DO_GOODSRepository.Instance.FindAsIQueryable(x => x.WMSPLANDETAILID == new Guid(keys[0])).ToList();
// List<OP_WMS_OUT_DO> outdo_list = OP_WMS_OUT_DORepository.Instance.FindAsIQueryable(x => x.WMSPLANID == new Guid(workKeysModel.workKeys)).ToList();
// if ((outdogoods_list == null || outdogoods_list.Count <= 0) && (outdo_list == null || outdo_list.Count <= 0))
// {
// try
// {
// //实现委托
// string sql1 = $"update OP_WMS_OUT_PLAN set BSSTATUS=0 where WMSPLANID='" + workKeysModel.workKeys + "';";
// //删除入库执行时动作 删除入库执行时后台动作
// js = repository.ExecuteSqlCommand(sql1);
// //return _webResponse.OK("撤回成功。");
// }
// catch (Exception e)
// {
// return _webResponse.Error(e.Message);
// }
// }
// else {
// var msg = "";
// if (outdo_list != null && outdo_list.Count > 0) {
// msg = "[" + outdo_list[0].WMSNO + "]";
// }
// return _webResponse.Error($"已产生下游业务{msg},不可取消,请删除后重试。");
// }
// string sql = "";
// try {
// //实现委托
// sql = $"update OP_WMS_OUT_PLAN set BSSTATUS=0 where WMSPLANID='{headid}';" +
// //$"DELETE FROM OP_WMS_TRUCK where WMSPLANID in ({joinKeys});;" +
// //$"DELETE FROM OP_WMS_OUT_PLAN_DETAIL where WMSPLANID = '{headid}';" +
// $"DELETE FROM CH_FEE where BXGID ='{head.WMSNO}';";
// //删除入库执行时动作 删除入库执行时后台动作
// js = repository.ExecuteSqlCommand(sql);
// Logger.PushStatus_PUB("出库通知", "取消审核:" + headid);
// return _webResponse.OK("取消成功。");
// }
// catch (Exception e)
// {
// return _webResponse.Error(e.Message);
// }
// }
public override WebResponseContent PushStatus ( object [ ] keys , int execution , string reason )
{
@ -1378,8 +1423,9 @@ namespace VOL.WMS.Services
else
{
var msg = "" ;
if ( outdo_list ! = null & & outdo_list . Count > 0 )
if ( outdo_list ! = null & & outdo_list . Where( x = > x . BILLSTATUS ! = "1010" ) . ToList ( ) . Count > 0 )
{
msg = "[" + outdo_list [ 0 ] . WMSNO + "]" ;
}
@ -1391,7 +1437,7 @@ namespace VOL.WMS.Services
return _webResponse . OK ( ) ;
}
private WebResponseContent PushStatus_Single ( Guid WMSPLANID , string execution , string reason )
@ -1438,7 +1484,11 @@ namespace VOL.WMS.Services
出 库 计 划 . BSSTATUS = true ;
_webResponse = MakeFee ( 出 库 计 划 ) ;
if ( AppSetting . CompanySetting . COMPANYNAME = = "FEST" )
var 出 库 计 划 审 核 通 过 后 产 生 出 库 执 行 的 公 司 = new List < string > ( ) {
"FEST" , "JGWL"
} ;
if ( 出 库 计 划 审 核 通 过 后 产 生 出 库 执 行 的 公 司 . Contains ( AppSetting . CompanySetting . COMPANYNAME ) )
{
var _r2 = MakeOutDo ( 出 库 计 划 ) ;
if ( ! _r2 . Status ) return _r2 ;
@ -1494,6 +1544,14 @@ namespace VOL.WMS.Services
//删除入库执行时动作 删除入库执行时后台动作
js = repository . ExecuteSqlCommand ( sql ) ;
var outdolist = OP_WMS_OUT_DORepository . Instance . FindAsIQueryable ( x = > x . WMSPLANID = = head . WMSPLANID & & x . BILLSTATUS = = "1010" ) . ToList ( ) ;
if ( outdolist ! = null & & outdolist . Count > 0 )
{
var outdogidlist = outdolist . Select ( s = > s . WMSDOID . ToString ( ) ) . ToArray ( ) ;
OP_WMS_OUT_DOService . Instance . Del ( outdogidlist ) ;
}
Logger . PushStatus_PUB ( "出库通知" , "取消审核:" + head . WMSPLANID ) ;
return _webResponse . OK ( "取消成功。" ) ;