ComplianceServer/oldcode/WX.CRM.DataSynFactory/Cmd/Client_RefundOrder_IMP.cs

69 lines
2.8 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using WX.CRM.BLL.Base;
using WX.CRM.BLL.Wx;
using WX.CRM.Common;
using WX.CRM.DataSynFactory.Templates;
using WX.CRM.Model.Entity;
namespace WX.CRM.DataSynFactory.Cmd
{
public class Client_RefundOrder_IMP : Interfaces.IDataImportSvr<Client_RefundOrder>
{
private WX_SZZYORDER_BL _order = new WX_SZZYORDER_BL();
private WX_SZZYORDERREFUND_BL _orderRefund = new WX_SZZYORDERREFUND_BL();
private WX_SZZYORDER_REFUND_BL _orderRefund2 = new WX_SZZYORDER_REFUND_BL();
public bool GenerateBusinessOne(Client_RefundOrder t)
{
try
{
var order = _order.Get(p => p.ORDERID == t.OrderId);
order.ORDERSTATUS = t.OrderStatus;
order.ORDERSTATUSNAME = t.OrderStatusName;
//order.ISOPEN = t.IsOpen;
var orderRefund = _orderRefund.Get(p => p.SID == t.Id);
orderRefund.AUDITSTATUS = t.AuditStatus;
orderRefund.AUDITOR = t.Auditor;
orderRefund.AUDITORNAME = t.AuditorName;
orderRefund.AUDITTIME = t.AuditTime;
orderRefund.COMPANYCODE = t.DeptCode;
orderRefund.REFUNDDATE = DateTime.Parse(t.AuditTime.ToString("yyyy-MM-dd"));
var curMonth = new DateTime(orderRefund.REFUNDDATE.Value.Year, orderRefund.REFUNDDATE.Value.Month, 1);
var nextMonth = curMonth.AddMonths(1);
//90正常退款写入220是部分退款的时候写入
if (t.OrderStatus == "90" || t.OrderStatus == "220")
{
var refund = new WX_SZZYORDER_REFUND()
{
PKID = new SEQUENCES_BL().Seq_base_get(),
SZZYORDERID = order.SZZYORDERID.Value,
REFUND = orderRefund.REFUNDPRICE,
REFUNDTIME = new DateTime(t.AuditTime.Year, t.AuditTime.Month, 1),
CTIME = DateTime.Now,
REMARK = string.Empty,
//FLAG = order.ISOPEN.Value
FLAG = order.ISFINANCEPAY.Value
};
_orderRefund2.Add(refund);
}
if (order.ARRIVALTIME >= curMonth && order.ARRIVALTIME < nextMonth && t.OrderStatus != "220")
{
//到账时间大于等于本月第一天说明是当月的订单不需要算提成所以isopen状态改成0
order.ISOPEN = 0;
}
return (_order.Update(order) && _orderRefund.Update(orderRefund));
}
catch (Exception ex)
{
LogHelper.Error(ex.ToString());
return false;
}
}
}
}