TG.WXCRM.V4/WX.CRM.DataSynFactory/Cmd/Client_RefundInfo_IMP.cs

110 lines
4.9 KiB
C#

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_RefundInfo_IMP : Interfaces.IDataImportSvr<Client_RefundInfo>
{
private WX_SZZYORDER_BL _order = new WX_SZZYORDER_BL();
//private WX_SZZYORDERREFUND_BL _refundOrder = new WX_SZZYORDERREFUND_BL();
private WX_SZZYORDERREFUND_BL _refbll = new WX_SZZYORDERREFUND_BL();
public WX_SZZYORDERDEPOSIT_BL _orderDepoist = new WX_SZZYORDERDEPOSIT_BL();
public bool GenerateBusinessOne(Client_RefundInfo t)
{
try
{
var orderId = t.orderid;
var order = _order.Get(p => p.ORDERID == orderId);
if (order != null)
{
var orderRefundContract = _refbll.Get(p => p.SID == t.id);//根据中心点退款id查找数据
if (orderRefundContract == null)
{
var deptcode = string.Empty;
if (order != null)
{
deptcode = order.DEPTCODE;
}
else
{
var depo = _orderDepoist.Get(p => p.ID == orderId);
if (depo != null)
{
deptcode = depo.DEPTCODE;
}
}
var orderRefund = new WX_SZZYORDERREFUND()
{
ID = new SEQUENCES_BL().Seq_base_get(),
SID = t.id,
ORDERID = orderId,
REFUNDPRICE = t.refundprice,
ACCOUNT = t.account,
USERNAME = t.username,
REFUNDTYPE = t.refundtype,
REFUNDTYPENAME = string.Empty,
REFUNDDATE = t.refunddate,
REMARK = t.remark,
ATT = t.att,
CTIME = DateTime.Now,
ISDELETE = t.isdelete,
CREATOR = t.creator,
CREATORNAME = t.username,
ISACTURALREFUND = t.isacturalrefund,
DEPTCODE = deptcode,
ATT2 = t.att2,
AUDITOR = t.auditor,
AUDITORNAME = t.auditorname,
AUDITSTATUS = t.auditstatus,
AUDITTIME = t.audittime,
COMPANYCODE = t.companycode,
APPLYTYPE = t.applytype,
DEPTID = t.deptid,
DEPTNAME = t.deptName,
GROUPID = t.groupid
};
_refbll.Add(orderRefund);
}
else
{
orderRefundContract.ORDERID = orderId;
orderRefundContract.REFUNDPRICE = t.refundprice;
orderRefundContract.ACCOUNT = t.account;
orderRefundContract.USERNAME = t.username;
orderRefundContract.REFUNDTYPE = t.refundtype;
orderRefundContract.REFUNDTYPENAME = string.Empty;
orderRefundContract.REFUNDDATE = t.refunddate;
orderRefundContract.REMARK = t.remark;
orderRefundContract.ATT = t.att;
orderRefundContract.ISDELETE = t.isdelete;
//orderRefundContract.CREATOR = t.creator;
//orderRefundContract.CREATORNAME = t.username;
orderRefundContract.ISACTURALREFUND = t.isacturalrefund;
orderRefundContract.ATT2 = t.att2;
orderRefundContract.AUDITOR = t.auditor;
orderRefundContract.AUDITORNAME = t.auditorname;
orderRefundContract.AUDITSTATUS = t.auditstatus;
orderRefundContract.AUDITTIME = t.audittime;
orderRefundContract.APPLYTYPE = t.applytype;
orderRefundContract.DEPTID = t.deptid;
orderRefundContract.DEPTNAME = t.deptName;
orderRefundContract.GROUPID = t.groupid;
_refbll.Update(orderRefundContract);
}
}
return true;
}
catch (Exception ex)
{
LogHelper.Error(ex.ToString());
return false;
}
}
}
}