|
|
using System.Collections;
|
|
|
using Estsh.Core.Util;
|
|
|
using Estsh.Core.Repository.IRepositories;
|
|
|
using Estsh.Core.Services.IServices;
|
|
|
using Estsh.Core.Models;
|
|
|
using Estsh.Core.Model.Result;
|
|
|
using Estsh.Core.IRepositories;
|
|
|
using Estsh.Core.Dapper;
|
|
|
|
|
|
namespace Estsh.Core.Services
|
|
|
{
|
|
|
public class CarManagerService : BaseService<WmsCarArrive>, ICarManagerService
|
|
|
{
|
|
|
private readonly ICarManagerRepository repository;
|
|
|
public CarManagerService(ICarManagerRepository _repository) : base(_repository)
|
|
|
{
|
|
|
repository = _repository;
|
|
|
}
|
|
|
|
|
|
public Hashtable getCarManagerListByPage(string supplierName, string txtStartTime, string txtEndTime, string enabled, int factoryId, Pager pager, String direction, String sort)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
|
|
|
String strWhere = " 1=1 ";
|
|
|
if (supplierName != null && !supplierName.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += "and supplier_name like '%" + supplierName.Trim() + "%'";
|
|
|
}
|
|
|
//if (warehouseDesc != null && !warehouseDesc.Trim().Equals(""))
|
|
|
//{
|
|
|
// strWhere += "and warehouse_desc like '%" + warehouseDesc.Trim() + "%'";
|
|
|
//}
|
|
|
if (!String.IsNullOrEmpty(txtStartTime) && !String.IsNullOrEmpty(txtEndTime))
|
|
|
{
|
|
|
strWhere += " and create_time BETWEEN '" + txtStartTime.Trim() + "' AND '" + txtEndTime.Trim() + "'";
|
|
|
}
|
|
|
if (!String.IsNullOrEmpty(txtStartTime) && String.IsNullOrEmpty(txtEndTime))
|
|
|
{
|
|
|
strWhere += " and create_time > '" + txtStartTime.Trim() + "'";
|
|
|
}
|
|
|
if (String.IsNullOrEmpty(txtStartTime) && !String.IsNullOrEmpty(txtEndTime))
|
|
|
{
|
|
|
strWhere += " and create_time < '" + txtEndTime.Trim() + "'";
|
|
|
}
|
|
|
if (enabled != null && !enabled.Trim().Equals(""))
|
|
|
{
|
|
|
strWhere += " and a.enabled like '%" + enabled.Trim() + "%'";
|
|
|
}
|
|
|
//strWhere += " and a.factory_id = " + factoryId + " ";
|
|
|
strWhere += " and a.se_date='"+ DateTime.Now.ToString("yyyyMMdd") +"'";
|
|
|
String orderBy = "";
|
|
|
if (sort != null && !"".Equals(sort.Trim()))
|
|
|
{
|
|
|
orderBy += typeof(WmsCarArrive).GetEntityColumnName(sort.Trim()) + " " + direction;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
orderBy += typeof(WmsCarArrive).GetEntityColumnName("real_arrive_time") + " " + direction;
|
|
|
}
|
|
|
|
|
|
result = repository.getListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 启用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public int EnableCarArrive(String ids, int loginId)
|
|
|
{
|
|
|
String[] idArray = ids.Split(',');
|
|
|
int count = 0;
|
|
|
foreach (String id in idArray)
|
|
|
{
|
|
|
if (!"".Equals(id))
|
|
|
{
|
|
|
count += this.repository.EnableCarArrive(id, loginId);
|
|
|
}
|
|
|
}
|
|
|
return count;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 禁用
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public int DisableCarArrive(String ids, int loginId)
|
|
|
{
|
|
|
String[] idArray = ids.Split(',');
|
|
|
int count = 0;
|
|
|
foreach (String id in idArray)
|
|
|
{
|
|
|
if (!"".Equals(id))
|
|
|
{
|
|
|
count += this.repository.DisableCarArrive(id, loginId);
|
|
|
}
|
|
|
}
|
|
|
return count;
|
|
|
}
|
|
|
|
|
|
public Hashtable getCarManagerDetail(String orderNo)
|
|
|
{
|
|
|
orderNo = " a.order_no = '" + orderNo + "'";
|
|
|
List<WmsCarArrive> dt = repository.getList(orderNo, "");
|
|
|
Hashtable result = new Hashtable();
|
|
|
|
|
|
if (dt.Count > 0)
|
|
|
{
|
|
|
result.Add("isCheck", "OK");
|
|
|
result.Add("orderNo", dt[0].OrderNo);
|
|
|
result.Add("carNo", dt[0].CarNo);
|
|
|
result.Add("carDesc", dt[0].CarDesc);
|
|
|
result.Add("supplierCode", dt[0].SupplierCode);
|
|
|
result.Add("supplierName", dt[0].SupplierName);
|
|
|
result.Add("planArriveTime", dt[0].PlanArriveTime);
|
|
|
result.Add("carDriver", dt[0].CarDriver);
|
|
|
result.Add("passageway", dt[0].Passageway);
|
|
|
result.Add("enabled", dt[0].Enabled);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Add("isCheck", "不存在此收货单!");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public Hashtable getCarArriveInfo(String orderNo)
|
|
|
{
|
|
|
orderNo = " a.order_no like '%" + orderNo + "%'";
|
|
|
List<WmsCarArrive> dt = repository.getArriveInfoList(orderNo, "");
|
|
|
Hashtable result = new Hashtable();
|
|
|
|
|
|
if (dt.Count > 0)
|
|
|
{
|
|
|
result.Add("isCheck", "OK");
|
|
|
result.Add("orderNo", dt[0].OrderNo);
|
|
|
result.Add("Operator", dt[0].Operator);
|
|
|
result.Add("outDep", dt[0].outDep);
|
|
|
result.Add("remarks", dt[0].remarks);
|
|
|
result.Add("CarNo2", dt[0].carNo2);
|
|
|
result.Add("CarNo", dt[0].CarNo);
|
|
|
result.Add("ascription", dt[0].ascription);
|
|
|
result.Add("material", dt[0].material);
|
|
|
result.Add("reason", dt[0].reason);
|
|
|
result.Add("outDateTime", dt[0].outDateTime);
|
|
|
result.Add("desc1", dt[0].desc1);
|
|
|
result.Add("desc2", dt[0].desc2);
|
|
|
result.Add("desc3", dt[0].desc3);
|
|
|
result.Add("desc4", dt[0].desc4);
|
|
|
result.Add("desc5", dt[0].desc5);
|
|
|
result.Add("desc6", dt[0].desc6);
|
|
|
result.Add("desc7", dt[0].desc7);
|
|
|
result.Add("desc8", dt[0].desc8);
|
|
|
result.Add("desc9", dt[0].desc9);
|
|
|
result.Add("outOperator", dt[0].outOperator);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 保存菜单数据
|
|
|
/// </summary>
|
|
|
/// <param name="htParams"></param>
|
|
|
/// <returns></returns>
|
|
|
public string saveCarArrive(WmsCarArrive htParams)
|
|
|
{
|
|
|
return repository.saveCarArrive(htParams);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 更新菜单数据
|
|
|
/// </summary>
|
|
|
/// <param name="htParams"></param>
|
|
|
/// <returns></returns>
|
|
|
public int updateCarArrive(WmsCarArrive htParams)
|
|
|
{
|
|
|
return repository.updateCarArrive(htParams);
|
|
|
}
|
|
|
|
|
|
|
|
|
public int updateCarArriveInfo(WmsCarArrive htParams)
|
|
|
{
|
|
|
return repository.updateCarArriveInfo(htParams);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取供应商
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
//public List<KeyValueResult> getSelectSupplier()
|
|
|
//{
|
|
|
// return repository.getSelectSupplier();
|
|
|
//}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 打印放行单
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <param name="loginId"></param>
|
|
|
/// <returns></returns>
|
|
|
public int PrintOutPlant(String ids, int loginId)
|
|
|
{
|
|
|
String[] idArray = ids.Split(',');
|
|
|
int count = 0;
|
|
|
foreach (String id in idArray)
|
|
|
{
|
|
|
if (!"".Equals(id))
|
|
|
{
|
|
|
count += this.repository.PrintOutPlant(id, loginId);
|
|
|
}
|
|
|
}
|
|
|
return count;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 准入状态 , 时间添加
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <param name="loginId"></param>
|
|
|
/// <returns></returns>
|
|
|
public int ChangeInPlantStatus(String ids, int loginId)
|
|
|
{
|
|
|
String[] idArray = ids.Split(',');
|
|
|
int count = 0;
|
|
|
foreach (String id in idArray)
|
|
|
{
|
|
|
if (!"".Equals(id))
|
|
|
{
|
|
|
count += this.repository.ChangeInPlantStatus(id, loginId);
|
|
|
}
|
|
|
}
|
|
|
return count;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 离厂状态,时间添加
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <param name="loginId"></param>
|
|
|
/// <returns></returns>
|
|
|
public int ChangeOutPlantStatus(String ids, int loginId)
|
|
|
{
|
|
|
String[] idArray = ids.Split(',');
|
|
|
int count = 0;
|
|
|
foreach (String id in idArray)
|
|
|
{
|
|
|
if (!"".Equals(id))
|
|
|
{
|
|
|
count += this.repository.ChangeOutPlantStatus(id, loginId);
|
|
|
}
|
|
|
}
|
|
|
return count;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 装卸工作中
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <param name="loginId"></param>
|
|
|
/// <returns></returns>
|
|
|
public int ChangeWorkingStatus(String ids, int loginId)
|
|
|
{
|
|
|
String[] idArray = ids.Split(',');
|
|
|
int count = 0;
|
|
|
foreach (String id in idArray)
|
|
|
{
|
|
|
if (!"".Equals(id))
|
|
|
{
|
|
|
count += this.repository.ChangeWorkingStatus(id, loginId);
|
|
|
}
|
|
|
}
|
|
|
return count;
|
|
|
}
|
|
|
|
|
|
public List<SysVendor> GetSupplier(string vendorId)
|
|
|
{
|
|
|
return repository.getSelectSupplier(vendorId);
|
|
|
}
|
|
|
}
|
|
|
}
|