|
|
@ -904,7 +904,7 @@ namespace CK.SCP.Controller |
|
|
|
scpRcvDetail.Qty = detail.ReceiveQuantity; |
|
|
|
} |
|
|
|
// var _str=JsonHelper.GetJson<List<TB_RECEIVE_DETAIL>>(scpRcveDetailList);
|
|
|
|
scpdb.TB_RECEIVE_DETAIL.AddOrUpdate(scpRcveDetailList.ToArray()); |
|
|
|
scpdb.TB_RECEIVE_DETAIL_QAD.AddOrUpdate(scpRcveDetailList.ToArray()); |
|
|
|
_ret.State = ReturnStatus.Succeed; |
|
|
|
_ret.MessageList.Add(string.Format("QAD收货单更新{0}任务编号{1}", _reciveDetailList.Count().ToString(), p_entity.TaskID)); |
|
|
|
_ret.Result = true; |
|
|
@ -929,11 +929,12 @@ namespace CK.SCP.Controller |
|
|
|
try |
|
|
|
{ |
|
|
|
var _reciveList = db.TED_RECEIPT_MSTR.Where(p => p.TaskID == p_entity.TaskID && !string.IsNullOrEmpty(p.ReceiveNbr)).ToList(); |
|
|
|
var _scpPoDetailList = new List<TB_ARRIVE>(); |
|
|
|
var _scpPoDetailList = new List<TB_RECEIVE>(); |
|
|
|
foreach (var detail in _reciveList) |
|
|
|
{ |
|
|
|
var scpRcv = scpdb.TB_ARRIVE.SingleOrDefault(p => p.ArrvBillNum != null && p.ArrvBillNum == detail.ReceiveNbr && p.Site == detail.Domain && p.SubSite == detail.Site); |
|
|
|
var scpRcvList = new List<TB_ARRIVE>(); |
|
|
|
|
|
|
|
var scpRcv = scpdb.TB_RECEIVE.SingleOrDefault(p => p.RecvBillNum != null && p.RecvBillNum == detail.ReceiveNbr && p.Site == detail.Domain && p.SubSite == detail.Site); |
|
|
|
var scpRcvList = new List<TB_RECEIVE>(); |
|
|
|
bool isRerviceOk = false; |
|
|
|
if (!string.IsNullOrEmpty(detail.Site) && !string.IsNullOrEmpty(detail.Domain)) |
|
|
|
{ |
|
|
@ -963,9 +964,9 @@ namespace CK.SCP.Controller |
|
|
|
{ |
|
|
|
istate = (int)FormState.开放; |
|
|
|
} |
|
|
|
scpRcv = new TB_ARRIVE |
|
|
|
scpRcv = new TB_RECEIVE |
|
|
|
{ |
|
|
|
ArrvBillNum = detail.ReceiveNbr,//收货单号
|
|
|
|
RecvBillNum = detail.ReceiveNbr,//收货单号
|
|
|
|
State = istate, |
|
|
|
Remark = "", |
|
|
|
CreateTime = detail.CreateTime == null ? DateTime.Now : (DateTime)detail.CreateTime,//创建日期
|
|
|
@ -991,17 +992,17 @@ namespace CK.SCP.Controller |
|
|
|
scpRcv.VendId = detail.Supplier;//供货商名称
|
|
|
|
scpRcv.ShipTime = detail.ReceiptDate;//收货日期
|
|
|
|
scpRcv.SubSite = detail.Site; |
|
|
|
scpdb.TB_ARRIVE.AddOrUpdate(scpRcvList.ToArray()); |
|
|
|
scpdb.TB_RECEIVE.AddOrUpdate(scpRcvList.ToArray()); |
|
|
|
} |
|
|
|
|
|
|
|
var scpRcveDetailList = new List<TB_ARRIVE_DETAIL>(); |
|
|
|
var scpRcveDetailList = new List<TB_RECEIVE_DETAIL>(); |
|
|
|
var _reciveDetailList = db.TED_RECEIPT_DET.Where(p => p.TaskID == p_entity.TaskID && !string.IsNullOrEmpty(p.ReceiveNbr)).ToList(); |
|
|
|
foreach (var detail in _reciveDetailList) |
|
|
|
{ |
|
|
|
var poLineNum = Convert.ToInt32(detail.Line); |
|
|
|
var scpRcvDetail = |
|
|
|
scpdb.TB_ARRIVE_DETAIL.SingleOrDefault( |
|
|
|
p => p.ArrvBillNum == detail.ReceiveNbr && |
|
|
|
scpdb.TB_RECEIVE_DETAIL.SingleOrDefault( |
|
|
|
p => p.RecvBillNum == detail.ReceiveNbr && |
|
|
|
p.PoBillNum == detail.PurchaseOrder && |
|
|
|
p.PoLine == detail.Line && |
|
|
|
p.PartCode == detail.PartCode && |
|
|
@ -1020,8 +1021,8 @@ namespace CK.SCP.Controller |
|
|
|
//{
|
|
|
|
// istate = (int)FormState.开放;
|
|
|
|
//}
|
|
|
|
scpRcvDetail = new TB_ARRIVE_DETAIL(); |
|
|
|
scpRcvDetail.ArrvBillNum = detail.ReceiveNbr;//收货单号
|
|
|
|
scpRcvDetail = new TB_RECEIVE_DETAIL(); |
|
|
|
scpRcvDetail.RecvBillNum = detail.ReceiveNbr;//收货单号
|
|
|
|
scpRcvDetail.PoBillNum = detail.PurchaseOrder;//采购单
|
|
|
|
scpRcvDetail.PoLine = detail.Line;//订单行
|
|
|
|
scpRcvDetail.PartCode = detail.PartCode;//零件号
|
|
|
@ -1042,8 +1043,8 @@ namespace CK.SCP.Controller |
|
|
|
scpRcveDetailList.Add(scpRcvDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
var _str = JsonHelper.GetJson<List<TB_ARRIVE_DETAIL>>(scpRcveDetailList); |
|
|
|
scpdb.TB_ARRIVE_DETAIL.AddOrUpdate(scpRcveDetailList.ToArray()); |
|
|
|
var _str = JsonHelper.GetJson<List<TB_RECEIVE_DETAIL>>(scpRcveDetailList); |
|
|
|
scpdb.TB_RECEIVE_DETAIL.AddOrUpdate(scpRcveDetailList.ToArray()); |
|
|
|
_ret.State = ReturnStatus.Succeed; |
|
|
|
_ret.MessageList.Add(string.Format("到货单更新{0}任务编号{1}", _reciveDetailList.Count().ToString(), p_entity.TaskID)); |
|
|
|
_ret.Result = true; |
|
|
@ -1089,7 +1090,7 @@ namespace CK.SCP.Controller |
|
|
|
ResultObject<LogModel> _ret = new ResultObject<LogModel>(); |
|
|
|
List<TED_INVOICE_MSTR> _mstList = new List<TED_INVOICE_MSTR>(); |
|
|
|
List<TED_INVOICE_DET> _detList = new List<TED_INVOICE_DET>(); |
|
|
|
// List<TED_INVOICE_ADD> _addList = new List<TED_INVOICE_ADD>();
|
|
|
|
//List<TED_INVOICE_ADD> _addList = new List<TED_INVOICE_ADD>();
|
|
|
|
try |
|
|
|
{ |
|
|
|
if (p_invoiceList.FirstOrDefault() != null) |
|
|
@ -1111,7 +1112,7 @@ namespace CK.SCP.Controller |
|
|
|
_invMast.InvoiceHoldAmountTC = _vinvoice.Amount.Value; |
|
|
|
_invMast.InvoiceVoucher = 0; |
|
|
|
_invMast.InvoiceRegistrationNbr = 1000; |
|
|
|
_invMast.PostingDate = _vinvoice.PostingDate==null?DateTime.Now:_vinvoice.PostingDate.Value; |
|
|
|
_invMast.PostingDate = DateTime.Now; |
|
|
|
_invMast.Currency = "CNY"; |
|
|
|
|
|
|
|
_invMast.InvoiceDate = _vinvoice.UpdateTime == null ? DateTime.Now : _vinvoice.UpdateTime.Value; |
|
|
@ -1121,7 +1122,7 @@ namespace CK.SCP.Controller |
|
|
|
_invMast.PaymentCondCode = "90"; |
|
|
|
_invMast.InvoiceDueDate = _invMast.InvoiceDate.AddDays(int.Parse(_invMast.PaymentCondCode)); |
|
|
|
_invMast.InvoiceIsStatusFinal = true; |
|
|
|
_invMast.InvoicePostingYear = _vinvoice.PostingDate==null?DateTime.Now.Year: _vinvoice.PostingDate.Value.Year; |
|
|
|
_invMast.InvoicePostingYear = DateTime.Now.Year; |
|
|
|
_invMast.APMatchingIsStatusFinal = true; |
|
|
|
_invMast.InvoiceRemark = _vinvoice.InvcBillNum;//发票编号
|
|
|
|
_invMast.CreateWithAmountIsTax = true; |
|
|
@ -1135,11 +1136,11 @@ namespace CK.SCP.Controller |
|
|
|
_invMast.DataID = Guid.NewGuid(); |
|
|
|
_invMast.Domain = _vinvoice.Site; |
|
|
|
_invMast.Site = _vinvoice.SubSite; |
|
|
|
_invMast.CInvoiceCostCenterCode = _vinvoice.CInvoiceCostCenterCode; |
|
|
|
// _invMast.CInvoiceCostCenterCode = _vinvoice.CInvoiceCostCenterCode;
|
|
|
|
_invMast.CInvoiceReference = _vinvoice.InvoiceNum; |
|
|
|
_invMast.CInvoiceDescription = _vinvoice.CInvoiceDescription; |
|
|
|
_invMast.CInvoiceType = _vinvoice.CInvoiceType; |
|
|
|
_invMast.CInvoiceDivisionCode = _vinvoice.CInvoiceDivisionCode; |
|
|
|
// _invMast.CInvoiceDescription = _vinvoice.CInvoiceDescription;
|
|
|
|
// _invMast.CInvoiceType = _vinvoice.CInvoiceType;
|
|
|
|
// _invMast.CInvoiceDivisionCode = _vinvoice.CInvoiceDivisionCode;
|
|
|
|
|
|
|
|
_mstList.Add(_invMast); |
|
|
|
#endregion
|
|
|
@ -1234,11 +1235,11 @@ namespace CK.SCP.Controller |
|
|
|
try |
|
|
|
{ |
|
|
|
var _reciveList = db.TED_RETURN_MSTR.Where(p => p.TaskID == p_entity.TaskID && !string.IsNullOrEmpty(p.ReturnNbr)).ToList(); |
|
|
|
var _scpPoDetailList = new List<TB_ARRIVE>(); |
|
|
|
var _scpPoDetailList = new List<TB_RECEIVE>(); |
|
|
|
foreach (var detail in _reciveList) |
|
|
|
{ |
|
|
|
var scpRcv = scpdb.TB_ARRIVE.SingleOrDefault(p => p.ArrvBillNum != null && p.ArrvBillNum == detail.ReturnNbr && p.Site == detail.Domain && p.SubSite == detail.Site); |
|
|
|
var scpRcvList = new List<TB_ARRIVE>(); |
|
|
|
var scpRcv = scpdb.TB_RECEIVE.SingleOrDefault(p => p.RecvBillNum != null && p.RecvBillNum == detail.ReturnNbr && p.Site == detail.Domain && p.SubSite == detail.Site); |
|
|
|
var scpRcvList = new List<TB_RECEIVE>(); |
|
|
|
bool isRerviceOk = false; |
|
|
|
if (!string.IsNullOrEmpty(detail.Site) && !string.IsNullOrEmpty(detail.Domain)) |
|
|
|
{ |
|
|
@ -1268,9 +1269,9 @@ namespace CK.SCP.Controller |
|
|
|
{ |
|
|
|
istate = (int)FormState.开放; |
|
|
|
} |
|
|
|
scpRcv = new TB_ARRIVE |
|
|
|
scpRcv = new TB_RECEIVE |
|
|
|
{ |
|
|
|
ArrvBillNum = detail.ReturnNbr,//收货单号
|
|
|
|
RecvBillNum = detail.ReturnNbr,//收货单号
|
|
|
|
State = istate, |
|
|
|
Remark = "", |
|
|
|
CreateTime = detail.CreateTime == null ? DateTime.Now : (DateTime)detail.CreateTime,//创建日期
|
|
|
@ -1296,10 +1297,10 @@ namespace CK.SCP.Controller |
|
|
|
scpRcv.VendId = detail.Supplier;//供货商名称
|
|
|
|
scpRcv.ShipTime = detail.ReturnDate;//收货日期
|
|
|
|
scpRcv.SubSite = detail.Site; |
|
|
|
scpdb.TB_ARRIVE.AddOrUpdate(scpRcvList.ToArray()); |
|
|
|
scpdb.TB_RECEIVE.AddOrUpdate(scpRcvList.ToArray()); |
|
|
|
} |
|
|
|
|
|
|
|
var scpRcveDetailList = new List<TB_ARRIVE_DETAIL>(); |
|
|
|
var scpRcveDetailList = new List<TB_RECEIVE_DETAIL>(); |
|
|
|
var _reciveDetailList = db.TED_RETURN_DET.Where(p => p.TaskID == p_entity.TaskID ).ToList(); |
|
|
|
var _recive = db.TED_RETURN_MSTR.Where(p => p.TaskID == p_entity.TaskID && !string.IsNullOrEmpty(p.ReturnNbr)).FirstOrDefault(); |
|
|
|
if (_recive != null) |
|
|
@ -1309,8 +1310,8 @@ namespace CK.SCP.Controller |
|
|
|
detail.ReturnNbr = _recive.ReturnNbr; |
|
|
|
var poLineNum = Convert.ToInt32(detail.Line); |
|
|
|
var scpRcvDetail = |
|
|
|
scpdb.TB_ARRIVE_DETAIL.SingleOrDefault( |
|
|
|
p => p.ArrvBillNum == detail.ReturnNbr && |
|
|
|
scpdb.TB_RECEIVE_DETAIL.SingleOrDefault( |
|
|
|
p => p.RecvBillNum == detail.ReturnNbr && |
|
|
|
p.PoBillNum == detail.PurchaseOrder && |
|
|
|
p.PoLine == detail.Line && |
|
|
|
p.PartCode == detail.PartCode && |
|
|
@ -1329,8 +1330,8 @@ namespace CK.SCP.Controller |
|
|
|
//{
|
|
|
|
// istate = (int)FormState.开放;
|
|
|
|
//}
|
|
|
|
scpRcvDetail = new TB_ARRIVE_DETAIL(); |
|
|
|
scpRcvDetail.ArrvBillNum = detail.ReturnNbr;//收货单号
|
|
|
|
scpRcvDetail = new TB_RECEIVE_DETAIL(); |
|
|
|
scpRcvDetail.RecvBillNum = detail.ReturnNbr;//收货单号
|
|
|
|
scpRcvDetail.PoBillNum = detail.PurchaseOrder;//采购单
|
|
|
|
scpRcvDetail.PoLine = detail.Line;//订单行
|
|
|
|
scpRcvDetail.PartCode = detail.PartCode;//零件号
|
|
|
@ -1352,8 +1353,8 @@ namespace CK.SCP.Controller |
|
|
|
scpRcveDetailList.Add(scpRcvDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
var _str = JsonHelper.GetJson<List<TB_ARRIVE_DETAIL>>(scpRcveDetailList); |
|
|
|
scpdb.TB_ARRIVE_DETAIL.AddOrUpdate(scpRcveDetailList.ToArray()); |
|
|
|
var _str = JsonHelper.GetJson<List<TB_RECEIVE_DETAIL>>(scpRcveDetailList); |
|
|
|
scpdb.TB_RECEIVE_DETAIL.AddOrUpdate(scpRcveDetailList.ToArray()); |
|
|
|
} |
|
|
|
_ret.State = ReturnStatus.Succeed; |
|
|
|
_ret.MessageList.Add(string.Format("退货单更新{0}任务编号{1}", _reciveDetailList.Count().ToString(), p_entity.TaskID)); |
|
|
|