|
@ -244,7 +244,7 @@ namespace CK.SCP.Controller |
|
|
q = q.Where(p => p.TaskState==p_entity.TaskState); |
|
|
q = q.Where(p => p.TaskState==p_entity.TaskState); |
|
|
|
|
|
|
|
|
_ret.State = ReturnStatus.Succeed; |
|
|
_ret.State = ReturnStatus.Succeed; |
|
|
_ret.Result = q.OrderBy(p => p.CreateTime).ToList(); |
|
|
_ret.Result = q.ToList(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
catch (Exception e) |
|
|
catch (Exception e) |
|
@ -405,7 +405,8 @@ namespace CK.SCP.Controller |
|
|
DataCenterContext dc = EntitiesFactory.CreateDataCenterInstance(); |
|
|
DataCenterContext dc = EntitiesFactory.CreateDataCenterInstance(); |
|
|
AppBoxContext authdb = EntitiesFactory.CreateAppBoxInstance(); |
|
|
AppBoxContext authdb = EntitiesFactory.CreateAppBoxInstance(); |
|
|
using (var scope = |
|
|
using (var scope = |
|
|
new TransactionScope(TransactionScopeOption.Required, new TransactionOptions() |
|
|
new TransactionScope(TransactionScopeOption.Suppress, new TransactionOptions() |
|
|
|
|
|
//new TransactionScope(TransactionScopeOption.Required, new TransactionOptions()
|
|
|
{ |
|
|
{ |
|
|
IsolationLevel = System.Transactions.IsolationLevel.Serializable, |
|
|
IsolationLevel = System.Transactions.IsolationLevel.Serializable, |
|
|
Timeout = new TimeSpan(0, 20, 0) |
|
|
Timeout = new TimeSpan(0, 20, 0) |
|
@ -479,6 +480,16 @@ namespace CK.SCP.Controller |
|
|
EntitiesFactory.SaveDb(dc); |
|
|
EntitiesFactory.SaveDb(dc); |
|
|
scope.Complete(); |
|
|
scope.Complete(); |
|
|
break; |
|
|
break; |
|
|
|
|
|
// 作废asn单
|
|
|
|
|
|
case "TED_SCRAPASN": |
|
|
|
|
|
result = UpApAsn(db, scpdb, _task); |
|
|
|
|
|
result.Message = _task.TaskID.ToString(); |
|
|
|
|
|
Update_TEA_TASK_SUB(db, _task); |
|
|
|
|
|
scpdb.BulkSaveChanges(); |
|
|
|
|
|
db.BulkSaveChanges(); |
|
|
|
|
|
dc.BulkSaveChanges(); |
|
|
|
|
|
scope.Complete(); |
|
|
|
|
|
break; |
|
|
//case "TES_SITE":
|
|
|
//case "TES_SITE":
|
|
|
// result = UpdateFactory(db, scpdb, appscpdb, _task);
|
|
|
// result = UpdateFactory(db, scpdb, appscpdb, _task);
|
|
|
// break;
|
|
|
// break;
|
|
@ -3678,6 +3689,58 @@ namespace CK.SCP.Controller |
|
|
} |
|
|
} |
|
|
return _ret; |
|
|
return _ret; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 作废发货单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="db"></param>
|
|
|
|
|
|
/// <param name="scpdb"></param>
|
|
|
|
|
|
/// <param name="p_entity"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public static ResultObject<bool> UpApAsn(ExchangeCenterContext db, ScpEntities scpdb, TEA_TASK_SUB p_entity) |
|
|
|
|
|
{ |
|
|
|
|
|
ResultObject<bool> _ret = new ResultObject<bool>(); |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
var _SCPAPASNlist = db.TED_SCRAPASN.Where(p => p.TaskID == p_entity.TaskID && string.IsNullOrEmpty(p.Remark)).ToList(); |
|
|
|
|
|
var Asnlist = new List<TB_ASN>(); |
|
|
|
|
|
var AsnDetailslist = new List<TB_ASN_DETAIL>(); |
|
|
|
|
|
foreach (var asn in _SCPAPASNlist) |
|
|
|
|
|
{ |
|
|
|
|
|
TB_ASN b_ASN = new TB_ASN(); |
|
|
|
|
|
b_ASN = scpdb.TB_ASN.FirstOrDefault(q => q.SubSite == "BJ02" && q.AsnBillNum == asn.BillNum); |
|
|
|
|
|
b_ASN.Reason = asn.Reason; |
|
|
|
|
|
b_ASN.State = (int)AskState.Reject; |
|
|
|
|
|
b_ASN.IsDeleted = true; |
|
|
|
|
|
List<TB_ASN_DETAIL> asn_details = scpdb.TB_ASN_DETAIL.Where(q => q.AsnBillNum == asn.BillNum).ToList(); |
|
|
|
|
|
if (asn_details != null) |
|
|
|
|
|
{ |
|
|
|
|
|
asn_details.ForEach(itm => { |
|
|
|
|
|
itm.IsDeleted = true; |
|
|
|
|
|
itm.State = (int)AskState.Reject; |
|
|
|
|
|
}); |
|
|
|
|
|
AsnDetailslist.AddRange(asn_details); |
|
|
|
|
|
} |
|
|
|
|
|
Asnlist.Add(b_ASN); |
|
|
|
|
|
asn.Remark = "SCPREAD"; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
scpdb.TB_ASN.BulkUpdate(Asnlist); |
|
|
|
|
|
scpdb.TB_ASN_DETAIL.BulkUpdate(AsnDetailslist); |
|
|
|
|
|
db.TED_SCRAPASN.BulkUpdate(_SCPAPASNlist); |
|
|
|
|
|
_ret.State = ReturnStatus.Succeed; |
|
|
|
|
|
_ret.MessageList.Add(string.Format("更新表{0}任务ID{1}成功!", "TED_SCPAPASN", p_entity.TaskID)); |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception e) |
|
|
|
|
|
{ |
|
|
|
|
|
_ret.State = ReturnStatus.Failed; |
|
|
|
|
|
LogHelper.Writlog(LogHelper.LogType.Error, typeof(TEA_TASK_SUB), "UpApAsn", e.Message); |
|
|
|
|
|
_ret.Result = false; |
|
|
|
|
|
_ret.ErrorList.Add(e); |
|
|
|
|
|
throw e; |
|
|
|
|
|
} |
|
|
|
|
|
return _ret; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|