175 lines
5.8 KiB
C#
175 lines
5.8 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Data;
|
|||
|
|
using WMS.IData;
|
|||
|
|
using WMS.Model.Base;
|
|||
|
|
using WMS.Common;
|
|||
|
|
|
|||
|
|
namespace WMS.Business.Base
|
|||
|
|
{
|
|||
|
|
public class BussCustomer : IBussFactory
|
|||
|
|
{
|
|||
|
|
#region 根据编号获得用户信息如果为空则获得全部
|
|||
|
|
/// <summary>
|
|||
|
|
/// 根据编号获得用户信息如果为空则获得全部
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="customer"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public List<CustomerModel> GetCustomer(CustomerModel customer)
|
|||
|
|
{
|
|||
|
|
DataTable dt = DataProvider.Instance.Customer.GetCustomer(customer);
|
|||
|
|
List<CustomerModel> list = ConvertHelper<CustomerModel>.ConvertToList(dt);
|
|||
|
|
|
|||
|
|
return list;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public DataSet GetCustomer()
|
|||
|
|
{
|
|||
|
|
DataSet dt = DataProvider.Instance.Customer.GetCustomer();
|
|||
|
|
|
|||
|
|
|
|||
|
|
return dt;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 客户信息的修改或增加
|
|||
|
|
/// <summary>
|
|||
|
|
/// 客户信息的修改或增加
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="model">客户信息Model</param>
|
|||
|
|
/// <param name="flg">0 新增、 1 修改</param>
|
|||
|
|
public string AddCustomer(CustomerModel model)
|
|||
|
|
{
|
|||
|
|
DataProvider.Instance.Customer.AddCustomer(model);
|
|||
|
|
Transaction = DataProvider.Instance.TranOracle;
|
|||
|
|
logList.Add(DataProvider.Instance.logData);
|
|||
|
|
TaCmtOrRak();
|
|||
|
|
return ErrText;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 客户信息的修改或增加
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="model">客户信息Model</param>
|
|||
|
|
/// <param name="flg">0 新增、 1 修改</param>
|
|||
|
|
public string UpdateCustomer(CustomerModel model)
|
|||
|
|
{
|
|||
|
|
DataProvider.Instance.Customer.UpdateCustomer(model);
|
|||
|
|
Transaction = DataProvider.Instance.TranOracle;
|
|||
|
|
logList.Add(DataProvider.Instance.logData);
|
|||
|
|
TaCmtOrRak();
|
|||
|
|
return ErrText;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 客户信息的删除
|
|||
|
|
/// <summary>
|
|||
|
|
/// 客户信息的删除
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="customer_id"></param>
|
|||
|
|
public int execCustomerDel(string customer_id)
|
|||
|
|
{
|
|||
|
|
return DataProvider.Instance.Customer.execCustomerDel(customer_id);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 导入
|
|||
|
|
/// <summary>
|
|||
|
|
/// 导入
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="list">导入集合</param>
|
|||
|
|
/// <param name="_list">失败的集合</param>
|
|||
|
|
/// <returns>错误的编号集合</returns>
|
|||
|
|
public List<string> Import(List<CustomerModel> list, ref List<CustomerModel> _list)
|
|||
|
|
{
|
|||
|
|
_list = new List<CustomerModel>();
|
|||
|
|
List<string> list_errIDs = new List<string>();
|
|||
|
|
string str_id = "";
|
|||
|
|
int count = 0;
|
|||
|
|
|
|||
|
|
//默认是线上客户
|
|||
|
|
string typeID = "";
|
|||
|
|
string _typeID = "";
|
|||
|
|
// string _typeID = DataProvider.Instance.CustomerType.GetCustomerType(" and CUS_TYPE_NAME = '系统默认级别'");
|
|||
|
|
DataSet table = DataProvider.Instance.CustomerType.GetCustomerType(" and CUS_TYPE_NAME = '系统默认级别'");
|
|||
|
|
if (table != null)
|
|||
|
|
{
|
|||
|
|
if (table.Tables.Count > 0)
|
|||
|
|
{
|
|||
|
|
if (table.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
_typeID = table.Tables[0].Rows[0]["CUS_TYPE_ID"].ToString();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
foreach (CustomerModel model in list)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (model.Cus_type_name.Trim().Length> 0)
|
|||
|
|
{
|
|||
|
|
DataSet tableTYpe = DataProvider.Instance.CustomerType.GetCustomerType(" and CUS_TYPE_NAME = '" + model.Cus_type_name + "'");
|
|||
|
|
if (table != null)
|
|||
|
|
{
|
|||
|
|
if (table.Tables.Count > 0)
|
|||
|
|
{
|
|||
|
|
if (table.Tables[0].Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
_typeID = table.Tables[0].Rows[0]["CUS_TYPE_ID"].ToString();
|
|||
|
|
model.Cus_type_id = typeID;
|
|||
|
|
if (string.IsNullOrEmpty(model.Cus_type_id))
|
|||
|
|
{
|
|||
|
|
model.Cus_type_id = _typeID;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (string.IsNullOrEmpty(model.Customer_id))
|
|||
|
|
{
|
|||
|
|
str_id += model.Customer_name;
|
|||
|
|
str_id += ":编号为空";
|
|||
|
|
list_errIDs.Add(str_id);
|
|||
|
|
_list.Add(model);
|
|||
|
|
str_id = "";
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
DataProvider.Instance.Customer.AddCustomer(model);
|
|||
|
|
Transaction = DataProvider.Instance.TranOracle;
|
|||
|
|
logList.Add(DataProvider.Instance.logData);
|
|||
|
|
if (!DataLogErrWrite("导入客户资料:"))
|
|||
|
|
{
|
|||
|
|
str_id += model.Customer_name;
|
|||
|
|
str_id += ":";
|
|||
|
|
str_id += ErrText;
|
|||
|
|
list_errIDs.Add(str_id);
|
|||
|
|
_list.Add(model);
|
|||
|
|
str_id = "";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
TaCmtOrRak();
|
|||
|
|
|
|||
|
|
return list_errIDs;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 获取流水号
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取流水号
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public string GetSerialNum()
|
|||
|
|
{
|
|||
|
|
return DataProvider.Instance.Customer.GetSerialNum();
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|