|
@ -2650,9 +2650,9 @@ namespace CK.SCP.Controller |
|
|
{ |
|
|
{ |
|
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
|
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
|
|
{ |
|
|
{ |
|
|
|
|
|
switch (p_state) |
|
|
if (p_state == AskState.Close) |
|
|
|
|
|
{ |
|
|
{ |
|
|
|
|
|
case AskState.Close: |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
if (_ls.Count > 0) |
|
|
if (_ls.Count > 0) |
|
|
{ |
|
|
{ |
|
@ -2688,14 +2688,13 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录,不能关闭!"; |
|
|
_ret.Message = "选择的记录,不能关闭!"; |
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
if (p_state == AskState.Complete) |
|
|
case AskState.Complete: |
|
|
{ |
|
|
var _ls1 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
int count1 = _ls1.Count(p => p.State == (int)AskState.Ship); |
|
|
int count = _ls.Count(p => p.State == (int)AskState.Ship); |
|
|
if (count1 == _ls1.Count && _ls1.Count > 0) |
|
|
if (count == _ls.Count && _ls.Count > 0) |
|
|
|
|
|
{ |
|
|
{ |
|
|
_ls.ForEach(p => |
|
|
_ls1.ForEach(p => |
|
|
{ |
|
|
{ |
|
|
var _asnlist = db.TB_ASN.Where(x => x.AskBillNum == p.AskBillNum && x.State == (int)AsnState.New).ToList(); |
|
|
var _asnlist = db.TB_ASN.Where(x => x.AskBillNum == p.AskBillNum && x.State == (int)AsnState.New).ToList(); |
|
|
if (_asnlist.Count > 0) |
|
|
if (_asnlist.Count > 0) |
|
@ -2711,7 +2710,7 @@ namespace CK.SCP.Controller |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls1.ToArray()); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -2719,14 +2718,13 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录非已发货状态,不能关闭!"; |
|
|
_ret.Message = "选择的记录非已发货状态,不能关闭!"; |
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
if (p_state == AskState.Confirm) |
|
|
case AskState.Confirm: |
|
|
{ |
|
|
var _ls2 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
int count2 = _ls2.Count(p => p.State == (int)AskState.Release); |
|
|
int count = _ls.Count(p => p.State == (int)AskState.Release); |
|
|
if (count2 == _ls2.Count && _ls2.Count > 0) |
|
|
if (count == _ls.Count && _ls.Count > 0) |
|
|
|
|
|
{ |
|
|
{ |
|
|
_ls.ForEach(p => |
|
|
_ls2.ForEach(p => |
|
|
{ |
|
|
{ |
|
|
p.State = (int)AskState.Confirm; |
|
|
p.State = (int)AskState.Confirm; |
|
|
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); |
|
|
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); |
|
@ -2751,7 +2749,7 @@ namespace CK.SCP.Controller |
|
|
#endregion
|
|
|
#endregion
|
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls2.ToArray()); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -2759,14 +2757,13 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录,有不是发布状态记录!"; |
|
|
_ret.Message = "选择的记录,有不是发布状态记录!"; |
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
if (p_state == AskState.New) |
|
|
case AskState.New: |
|
|
{ |
|
|
var _ls3 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
int count3 = _ls3.Count(p => p.State == (int)AskState.Release); |
|
|
int count = _ls.Count(p => p.State == (int)AskState.Release); |
|
|
if (count3 == _ls3.Count && _ls3.Count > 0) |
|
|
if (count == _ls.Count && _ls.Count > 0) |
|
|
|
|
|
{ |
|
|
{ |
|
|
_ls.ForEach(p => |
|
|
_ls3.ForEach(p => |
|
|
{ |
|
|
{ |
|
|
p.State = (int)AskState.New; |
|
|
p.State = (int)AskState.New; |
|
|
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); |
|
|
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); |
|
@ -2774,7 +2771,7 @@ namespace CK.SCP.Controller |
|
|
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); |
|
|
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls3.ToArray()); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -2782,11 +2779,10 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录,有不是发布状态记录!"; |
|
|
_ret.Message = "选择的记录,有不是发布状态记录!"; |
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
if (p_state == AskState.Release) |
|
|
case AskState.Release: |
|
|
{ |
|
|
var _ls4 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
foreach (var mail in _ls4) |
|
|
foreach (var mail in _ls) |
|
|
|
|
|
{ |
|
|
{ |
|
|
TB_SUPPLIER_MAIL mall = new TB_SUPPLIER_MAIL(); |
|
|
TB_SUPPLIER_MAIL mall = new TB_SUPPLIER_MAIL(); |
|
|
mall.State = 0; |
|
|
mall.State = 0; |
|
@ -2795,10 +2791,10 @@ namespace CK.SCP.Controller |
|
|
mall.Email = mail.PoBillNum; |
|
|
mall.Email = mail.PoBillNum; |
|
|
db.TB_SUPPLIER_MAIL.Add(mall); |
|
|
db.TB_SUPPLIER_MAIL.Add(mall); |
|
|
} |
|
|
} |
|
|
int count = _ls.Count(p => p.State == (int)AskState.New); |
|
|
int count4 = _ls4.Count(p => p.State == (int)AskState.New); |
|
|
if (count > 0) |
|
|
if (count4 > 0) |
|
|
{ |
|
|
{ |
|
|
_ls.ForEach(p => |
|
|
_ls4.ForEach(p => |
|
|
{ |
|
|
{ |
|
|
p.State = (int)AskState.Release; |
|
|
p.State = (int)AskState.Release; |
|
|
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); |
|
|
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); |
|
@ -2811,7 +2807,7 @@ namespace CK.SCP.Controller |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls4.ToArray()); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -2819,14 +2815,13 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录,有不是新建状态记录!"; |
|
|
_ret.Message = "选择的记录,有不是新建状态记录!"; |
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
if (p_state == AskState.Reject) |
|
|
case AskState.Reject: |
|
|
{ |
|
|
var _ls5 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
int count5 = _ls5.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release); |
|
|
int count = _ls.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release); |
|
|
if (count5 == _ls5.Count && _ls5.Count > 0) |
|
|
if (count == _ls.Count && _ls.Count > 0) |
|
|
|
|
|
{ |
|
|
{ |
|
|
_ls.ForEach(p => |
|
|
_ls5.ForEach(p => |
|
|
{ |
|
|
{ |
|
|
p.State = (int)AskState.Reject; |
|
|
p.State = (int)AskState.Reject; |
|
|
p.IsDeleted = true; |
|
|
p.IsDeleted = true; |
|
@ -2844,7 +2839,7 @@ namespace CK.SCP.Controller |
|
|
//#endregion
|
|
|
//#endregion
|
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls5.ToArray()); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -2852,15 +2847,13 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录,有不是新建或发布状态记录!"; |
|
|
_ret.Message = "选择的记录,有不是新建或发布状态记录!"; |
|
|
} |
|
|
} |
|
|
|
|
|
break; |
|
|
} |
|
|
case AskState.CompleteForce: |
|
|
if (p_state == AskState.CompleteForce) |
|
|
var _ls6 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList(); |
|
|
{ |
|
|
int count6 = _ls6.Count(p => p.State == (int)AskState.Confirm || p.State == (int)AskState.Ship); |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList(); |
|
|
if (count6 == _ls6.Count && _ls6.Count > 0) |
|
|
int count = _ls.Count(p => p.State == (int)AskState.Confirm || p.State == (int)AskState.Ship); |
|
|
|
|
|
if (count == _ls.Count && _ls.Count > 0) |
|
|
|
|
|
{ |
|
|
{ |
|
|
_ls.ForEach(p => |
|
|
_ls6.ForEach(p => |
|
|
{ |
|
|
{ |
|
|
if (p.State == (int)AskState.Complete) |
|
|
if (p.State == (int)AskState.Complete) |
|
|
{ |
|
|
{ |
|
@ -2906,7 +2899,7 @@ namespace CK.SCP.Controller |
|
|
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); |
|
|
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls6.ToArray()); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -2914,15 +2907,13 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录,有不是【已确认】或【已发货】状态,【发布状态】请用取消发布或看板作废!"; |
|
|
_ret.Message = "选择的记录,有不是【已确认】或【已发货】状态,【发布状态】请用取消发布或看板作废!"; |
|
|
} |
|
|
} |
|
|
|
|
|
break; |
|
|
} |
|
|
case AskState.Receive: |
|
|
if (p_state == AskState.Receive) |
|
|
var _ls7 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
{ |
|
|
int count7 = _ls7.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release); |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
if (count7 > 0) |
|
|
int count = _ls.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release); |
|
|
|
|
|
if (count > 0) |
|
|
|
|
|
{ |
|
|
{ |
|
|
_ls.ForEach(p => |
|
|
_ls7.ForEach(p => |
|
|
{ |
|
|
{ |
|
|
p.State = (int)AskState.Receive; |
|
|
p.State = (int)AskState.Receive; |
|
|
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); |
|
|
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); |
|
@ -2935,7 +2926,7 @@ namespace CK.SCP.Controller |
|
|
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); |
|
|
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls7.ToArray()); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -2943,12 +2934,10 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录,有不是新建或发布状态记录!"; |
|
|
_ret.Message = "选择的记录,有不是新建或发布状态记录!"; |
|
|
} |
|
|
} |
|
|
|
|
|
break; |
|
|
} |
|
|
case AskState.NoConfirm: |
|
|
if (p_state == AskState.NoConfirm) |
|
|
var _ls8 = db.TB_ASN.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList(); |
|
|
{ |
|
|
if (_ls8.Count == 0) |
|
|
var _ls = db.TB_ASN.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList(); |
|
|
|
|
|
if (_ls.Count == 0) |
|
|
|
|
|
{ |
|
|
{ |
|
|
var _askList = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList(); |
|
|
var _askList = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList(); |
|
|
_askList.ForEach(p => |
|
|
_askList.ForEach(p => |
|
@ -2971,6 +2960,7 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录已经有发货单据不能取消!"; |
|
|
_ret.Message = "选择的记录已经有发货单据不能取消!"; |
|
|
} |
|
|
} |
|
|
|
|
|
break; |
|
|
} |
|
|
} |
|
|
if (string.IsNullOrEmpty(_ret.Message)) |
|
|
if (string.IsNullOrEmpty(_ret.Message)) |
|
|
{ |
|
|
{ |
|
|