You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
673 lines
21 KiB
673 lines
21 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using Dapper;
|
|
|
|
namespace Warehouse.DAL.OBAdetain
|
|
{
|
|
public class OBAspotCheckDal
|
|
{
|
|
static DbUtility dbhelp = new DbUtility(System.Configuration.ConfigurationManager.ConnectionStrings["mesConn"].ToString(), DbProviderType.SqlServer);
|
|
|
|
|
|
#region Wait托盘号查询
|
|
public DataTable WaitPalletDT()
|
|
{
|
|
return dbhelp.ExecuteDataTable(WaitPalletSql(), null);
|
|
}
|
|
|
|
public string WaitPalletSql()
|
|
{
|
|
|
|
string sql = @"
|
|
SELECT isnull(b.containerno,'') containerno
|
|
,a.[pallet_nbr] palletNbr
|
|
,a.[power_grade] powerGrade
|
|
,a.[current_grade] currentGrade
|
|
,a.[final_grade] FinalGrade
|
|
,d.source_desc color
|
|
,c.cell_qty cellQty
|
|
,e.source_desc crys
|
|
,pro.mod_spec_desc modSpecDesc
|
|
,a.pallet_qty palletQty
|
|
,case
|
|
WHEN f.status is null THEN '未入库'
|
|
WHEN f.status = '-1' THEN '退库'
|
|
WHEN f.status = '2' THEN '入库'
|
|
WHEN f.status = '3' THEN '出货'
|
|
WHEN f.status = '4' THEN '监装'
|
|
end status
|
|
,case
|
|
when a.oba_spot_check is null then '正常托盘'
|
|
when a.oba_spot_check = 'G' then '释放'
|
|
when a.oba_spot_check = 'H' then '扣留'
|
|
end obaSpotCheck
|
|
,case
|
|
when a.oba_spot_check is null then ''
|
|
when a.oba_spot_check = 'G' then ''
|
|
when a.oba_spot_check = 'H' then g.detain_reason
|
|
end detainReason
|
|
FROM [mes_main].[dbo].[pack_pallets] a
|
|
left join [wh].[dbo].[tcontainerpallet] b
|
|
on a.pallet_nbr = b.palletno
|
|
left join [mes_main].[dbo].[wo_mfg] c
|
|
on a.workorder = c.workorder
|
|
left join [mes_main].[dbo].[df_source] d
|
|
on c.mod_color = d.source_value and d.source_group_name = 'MOD_COLOR'
|
|
left join [mes_main].[dbo].[df_source] e
|
|
on c.crys_type = e.source_value and e.source_group_name = 'CRYS_TYPE'
|
|
left join (select t.*
|
|
from (select u.*,row_number() over(partition by u.palletno order by u.createtime desc) rw
|
|
from [wh].[dbo].[tstockinlog] u) t
|
|
where t.rw = '1') f
|
|
on f.palletno = a.pallet_nbr
|
|
left join mes_main.dbo.config_products pro
|
|
on a.product_code =pro.product_code
|
|
left join (select s.*
|
|
from (select v.*,row_number() over(partition by v.palletno order by v.detaintime desc) rw
|
|
from [wh].[dbo].[oba_detainpaller] v) s
|
|
where s.rw = '1') g
|
|
on a.pallet_nbr = g.palletno
|
|
where a.oba_spot_check is null
|
|
group by
|
|
b.containerno
|
|
,a.[pallet_nbr]
|
|
,a.[power_grade]
|
|
,a.[current_grade]
|
|
,a.[final_grade]
|
|
,d.source_desc
|
|
,c.cell_qty
|
|
,e.source_desc
|
|
,a.pallet_qty
|
|
,f.createtime
|
|
,f.status
|
|
,a.oba_spot_check
|
|
,pro.mod_spec_desc
|
|
,g.detain_reason
|
|
ORDER BY f.createtime
|
|
";
|
|
return sql;
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region Wait托盘号查询
|
|
public DataTable HoldPalletDT()
|
|
{
|
|
return dbhelp.ExecuteDataTable(HoldPalletSql(), null);
|
|
}
|
|
|
|
public string HoldPalletSql()
|
|
{
|
|
|
|
string sql = @"
|
|
SELECT isnull(b.containerno,'') containerno
|
|
,a.[pallet_nbr] palletNbr
|
|
,a.[power_grade] powerGrade
|
|
,a.[current_grade] currentGrade
|
|
,a.[final_grade] FinalGrade
|
|
,d.source_desc color
|
|
,c.cell_qty cellQty
|
|
,e.source_desc crys
|
|
,pro.mod_spec_desc modSpecDesc
|
|
,a.pallet_qty palletQty
|
|
,case
|
|
WHEN f.status is null THEN '未入库'
|
|
WHEN f.status = '-1' THEN '退库'
|
|
WHEN f.status = '2' THEN '入库'
|
|
WHEN f.status = '3' THEN '出货'
|
|
WHEN f.status = '4' THEN '监装'
|
|
end status
|
|
,case
|
|
when a.oba_spot_check is null then '正常托盘'
|
|
when a.oba_spot_check = 'G' then '释放'
|
|
when a.oba_spot_check = 'H' then '扣留'
|
|
end obaSpotCheck
|
|
,case
|
|
when a.oba_spot_check is null then ''
|
|
when a.oba_spot_check = 'G' then ''
|
|
when a.oba_spot_check = 'H' then g.detain_reason
|
|
end detainReason
|
|
FROM [mes_main].[dbo].[pack_pallets] a
|
|
left join [wh].[dbo].[tcontainerpallet] b
|
|
on a.pallet_nbr = b.palletno
|
|
left join [mes_main].[dbo].[wo_mfg] c
|
|
on a.workorder = c.workorder
|
|
left join [mes_main].[dbo].[df_source] d
|
|
on c.mod_color = d.source_value and d.source_group_name = 'MOD_COLOR'
|
|
left join [mes_main].[dbo].[df_source] e
|
|
on c.crys_type = e.source_value and e.source_group_name = 'CRYS_TYPE'
|
|
left join (select t.*
|
|
from (select u.*,row_number() over(partition by u.palletno order by u.createtime desc) rw
|
|
from [wh].[dbo].[tstockinlog] u) t
|
|
where t.rw = '1') f
|
|
on f.palletno = a.pallet_nbr
|
|
left join mes_main.dbo.config_products pro
|
|
on a.product_code =pro.product_code
|
|
left join (select s.*
|
|
from (select v.*,row_number() over(partition by v.palletno order by v.detaintime desc) rw
|
|
from [wh].[dbo].[oba_detainpaller] v) s
|
|
where s.rw = '1') g
|
|
on a.pallet_nbr = g.palletno
|
|
where a.oba_spot_check = 'H'
|
|
group by
|
|
b.containerno
|
|
,a.[pallet_nbr]
|
|
,a.[power_grade]
|
|
,a.[current_grade]
|
|
,a.[final_grade]
|
|
,d.source_desc
|
|
,c.cell_qty
|
|
,e.source_desc
|
|
,a.pallet_qty
|
|
,f.createtime
|
|
,f.status
|
|
,a.oba_spot_check
|
|
,pro.mod_spec_desc
|
|
,g.detain_reason
|
|
ORDER BY f.createtime
|
|
";
|
|
return sql;
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region 托盘、柜号扣留查询
|
|
public DataTable PalletDetainDT(string PalletLot, string ContainerLot,string Status)
|
|
{
|
|
return dbhelp.ExecuteDataTable(PalletDetainSql(PalletLot,ContainerLot, Status), null);
|
|
}
|
|
|
|
public string PalletDetainSql(string PalletLot, string ContainerLot, string Status)
|
|
{
|
|
//and c.sale_order = '' and b.workorder = '' and c.area_code = '' and a.create_date >= '' and a.create_date < ''
|
|
string strWhere = string.Empty;
|
|
if (!string.IsNullOrEmpty(PalletLot)&& PalletLot!="''")
|
|
{
|
|
strWhere += "and a.pallet_nbr in (" + PalletLot + ") ";
|
|
}
|
|
if (!string.IsNullOrEmpty(ContainerLot)&& Status == "G")
|
|
{
|
|
strWhere += "and b.containerno = '" + ContainerLot + "' and f.status != '3' and (a.oba_spot_check is null or a.oba_spot_check = 'G') ";
|
|
}
|
|
if (!string.IsNullOrEmpty(ContainerLot) && Status == "H")
|
|
{
|
|
strWhere += "and b.containerno = '" + ContainerLot + "' and f.status != '3' and a.oba_spot_check = 'H' ";
|
|
}
|
|
string sql = @"
|
|
SELECT isnull(b.containerno,'') containerno
|
|
,a.[pallet_nbr] palletNbr
|
|
,a.[power_grade] powerGrade
|
|
,a.[current_grade] currentGrade
|
|
,a.[final_grade] FinalGrade
|
|
,d.source_desc color
|
|
,c.cell_qty cellQty
|
|
,e.source_desc crys
|
|
,pro.mod_spec_desc modSpecDesc
|
|
,a.pallet_qty palletQty
|
|
,case
|
|
WHEN f.status is null THEN '未入库'
|
|
WHEN f.status = '-1' THEN '退库'
|
|
WHEN f.status = '2' THEN '入库'
|
|
WHEN f.status = '3' THEN '出货'
|
|
WHEN f.status = '4' THEN '监装'
|
|
end status
|
|
,case
|
|
when a.oba_spot_check is null then '正常托盘'
|
|
when a.oba_spot_check = 'G' then '释放'
|
|
when a.oba_spot_check = 'H' then '扣留'
|
|
end obaSpotCheck
|
|
,case
|
|
when a.oba_spot_check is null then ''
|
|
when a.oba_spot_check = 'G' then ''
|
|
when a.oba_spot_check = 'H' then g.detain_reason
|
|
end detainReason
|
|
FROM [mes_main].[dbo].[pack_pallets] a
|
|
left join [wh].[dbo].[tcontainerpallet] b
|
|
on a.pallet_nbr = b.palletno
|
|
left join [mes_main].[dbo].[wo_mfg] c
|
|
on a.workorder = c.workorder
|
|
left join [mes_main].[dbo].[df_source] d
|
|
on c.mod_color = d.source_value and d.source_group_name = 'MOD_COLOR'
|
|
left join [mes_main].[dbo].[df_source] e
|
|
on c.crys_type = e.source_value and e.source_group_name = 'CRYS_TYPE'
|
|
left join (select t.*
|
|
from (select u.*,row_number() over(partition by u.palletno order by u.createtime desc) rw
|
|
from [wh].[dbo].[tstockinlog] u) t
|
|
where t.rw = '1') f
|
|
on f.palletno = a.pallet_nbr
|
|
left join mes_main.dbo.config_products pro
|
|
on a.product_code =pro.product_code
|
|
left join (select s.*
|
|
from (select v.*,row_number() over(partition by v.palletno order by v.detaintime desc) rw
|
|
from [wh].[dbo].[oba_detainpaller] v) s
|
|
where s.rw = '1') g
|
|
on a.pallet_nbr = g.palletno
|
|
where 1=1 " + strWhere + @"
|
|
group by
|
|
b.containerno
|
|
,a.[pallet_nbr]
|
|
,a.[power_grade]
|
|
,a.[current_grade]
|
|
,a.[final_grade]
|
|
,d.source_desc
|
|
,c.cell_qty
|
|
,e.source_desc
|
|
,a.pallet_qty
|
|
,f.createtime
|
|
,f.status
|
|
,a.oba_spot_check
|
|
,pro.mod_spec_desc
|
|
,g.detain_reason
|
|
ORDER BY f.createtime
|
|
";
|
|
return sql;
|
|
}
|
|
#endregion
|
|
|
|
#region 判断柜号是否存在
|
|
public DataTable IfContainerDT(string PalletLot, string ContainerLot)
|
|
{
|
|
return dbhelp.ExecuteDataTable(IfContainerSql(PalletLot, ContainerLot), null);
|
|
}
|
|
|
|
public string IfContainerSql(string PalletLot, string ContainerLot)
|
|
{
|
|
//and c.sale_order = '' and b.workorder = '' and c.area_code = '' and a.create_date >= '' and a.create_date < ''
|
|
string strWhere = string.Empty;
|
|
string sql = @"select *
|
|
from [wh].[dbo].[tcontainer]
|
|
where containerno = '"+ ContainerLot+"'";
|
|
return sql;
|
|
}
|
|
#endregion
|
|
|
|
#region 判断柜号是否出货
|
|
public DataTable IfShipmentDT(string PalletLot, string ContainerLot)
|
|
{
|
|
return dbhelp.ExecuteDataTable(IfShipmentSql(PalletLot, ContainerLot), null);
|
|
}
|
|
|
|
public string IfShipmentSql(string PalletLot, string ContainerLot)
|
|
{
|
|
//and c.sale_order = '' and b.workorder = '' and c.area_code = '' and a.create_date >= '' and a.create_date < ''
|
|
string strWhere = string.Empty;
|
|
string sql = @"SELECT isnull(b.containerno,'') containerno
|
|
,a.[pallet_nbr] palletNbr
|
|
,a.[power_grade] powerGrade
|
|
,a.[current_grade] currentGrade
|
|
,a.[final_grade] FinalGrade
|
|
,d.source_desc color
|
|
,c.cell_qty cellQty
|
|
,e.source_desc crys
|
|
,pro.mod_spec_desc modSpecDesc
|
|
,a.pallet_qty palletQty
|
|
,case
|
|
WHEN f.status is null THEN '未入库'
|
|
WHEN f.status = '-1' THEN '退库'
|
|
WHEN f.status = '2' THEN '入库'
|
|
WHEN f.status = '3' THEN '出货'
|
|
WHEN f.status = '4' THEN '监装'
|
|
end status
|
|
,case
|
|
when a.oba_spot_check is null then '正常托盘'
|
|
when a.oba_spot_check = 'G' then '释放'
|
|
when a.oba_spot_check = 'H' then '扣留'
|
|
end obaSpotCheck
|
|
FROM [mes_main].[dbo].[pack_pallets] a
|
|
left join [wh].[dbo].[tcontainerpallet] b
|
|
on a.pallet_nbr = b.palletno
|
|
left join [mes_main].[dbo].[wo_mfg] c
|
|
on a.workorder = c.workorder
|
|
left join [mes_main].[dbo].[df_source] d
|
|
on c.mod_color = d.source_value and d.source_group_name = 'MOD_COLOR'
|
|
left join [mes_main].[dbo].[df_source] e
|
|
on c.crys_type = e.source_value and e.source_group_name = 'CRYS_TYPE'
|
|
left join (select t.*
|
|
from (select u.*,row_number() over(partition by u.palletno order by u.createtime desc) rw
|
|
from [wh].[dbo].[tstockinlog] u) t
|
|
where t.rw = '1') f
|
|
on f.palletno = a.pallet_nbr
|
|
left join mes_main.dbo.config_products pro
|
|
on a.product_code =pro.product_code
|
|
where b.containerno = '" + ContainerLot + @"' and f.status = '3'
|
|
group by
|
|
b.containerno
|
|
,a.[pallet_nbr]
|
|
,a.[power_grade]
|
|
,a.[current_grade]
|
|
,a.[final_grade]
|
|
,d.source_desc
|
|
,c.cell_qty
|
|
,e.source_desc
|
|
,a.pallet_qty
|
|
,f.createtime
|
|
,f.status
|
|
,a.oba_spot_check
|
|
,pro.mod_spec_desc
|
|
ORDER BY f.createtime";
|
|
return sql;
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
#region 托盘释放查询
|
|
public DataTable PalletReleaseDT(string PalletLot, string ContainerLot,string BeginTime,string EndTime)
|
|
{
|
|
return dbhelp.ExecuteDataTable(PalletReleaseSql(PalletLot, ContainerLot, BeginTime,EndTime), null);
|
|
}
|
|
|
|
public string PalletReleaseSql(string PalletLot, string ContainerLot, string BeginTime, string EndTime)
|
|
{
|
|
|
|
string strWhere = string.Empty;
|
|
if (!string.IsNullOrEmpty(PalletLot))
|
|
{
|
|
strWhere += "and a.pallet_nbr in(" + PalletLot + ") ";
|
|
}
|
|
if (!string.IsNullOrEmpty(BeginTime))
|
|
{
|
|
strWhere += "and oba.detaintime >= '" + BeginTime + "' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(EndTime))
|
|
{
|
|
strWhere += "and oba.detaintime <= '" + EndTime + "' ";
|
|
}
|
|
string sql = @"SELECT isnull(b.containerno,'') containerno
|
|
,a.[pallet_nbr] palletNbr
|
|
,a.[power_grade] powerGrade
|
|
,a.[current_grade] currentGrade
|
|
,a.[final_grade] FinalGrade
|
|
,d.source_desc color
|
|
,c.cell_qty cellQty
|
|
,e.source_desc crys
|
|
,pro.mod_spec_desc modSpecDesc
|
|
,a.pallet_qty palletQty
|
|
,case
|
|
WHEN f.status is null THEN '未入库'
|
|
WHEN f.status = '-1' THEN '退库'
|
|
WHEN f.status = '2' THEN '入库'
|
|
WHEN f.status = '3' THEN '出货'
|
|
WHEN f.status = '4' THEN '监装'
|
|
end status
|
|
,case
|
|
when a.oba_spot_check is null then '正常托盘'
|
|
when a.oba_spot_check = 'G' then '释放'
|
|
when a.oba_spot_check = 'H' then '扣留'
|
|
end obaSpotCheck
|
|
,case
|
|
when a.oba_spot_check is null then ''
|
|
when a.oba_spot_check = 'G' then ''
|
|
when a.oba_spot_check = 'H' then g.detain_reason
|
|
end detainReason
|
|
FROM [mes_main].[dbo].[pack_pallets] a
|
|
left join [wh].[dbo].[tcontainerpallet] b
|
|
on a.pallet_nbr = b.palletno
|
|
left join [mes_main].[dbo].[wo_mfg] c
|
|
on a.workorder = c.workorder
|
|
left join [mes_main].[dbo].[df_source] d
|
|
on c.mod_color = d.source_value and d.source_group_name = 'MOD_COLOR'
|
|
left join [mes_main].[dbo].[df_source] e
|
|
on c.crys_type = e.source_value and e.source_group_name = 'CRYS_TYPE'
|
|
left join (select t.*
|
|
from (select u.*,row_number() over(partition by u.palletno order by u.createtime desc) rw
|
|
from [wh].[dbo].[tstockinlog] u) t
|
|
where t.rw = '1') f
|
|
on f.palletno = a.pallet_nbr
|
|
left join mes_main.dbo.config_products pro
|
|
on a.product_code =pro.product_code
|
|
left join wh.dbo.oba_detainpaller oba
|
|
on oba.palletno = a.pallet_nbr
|
|
left join (select s.*
|
|
from (select v.*,row_number() over(partition by v.palletno order by v.detaintime desc) rw
|
|
from [wh].[dbo].[oba_detainpaller] v) s
|
|
where s.rw = '1') g
|
|
on a.pallet_nbr = g.palletno
|
|
where 1=1 " + strWhere + @"
|
|
group by
|
|
b.containerno
|
|
,a.[pallet_nbr]
|
|
,a.[power_grade]
|
|
,a.[current_grade]
|
|
,a.[final_grade]
|
|
,d.source_desc
|
|
,c.cell_qty
|
|
,e.source_desc
|
|
,a.pallet_qty
|
|
,f.createtime
|
|
,f.status
|
|
,a.oba_spot_check
|
|
,pro.mod_spec_desc
|
|
,g.detain_reason
|
|
ORDER BY f.createtime";
|
|
return sql;
|
|
}
|
|
#endregion
|
|
|
|
#region 通过时间进行托盘释放查询
|
|
public DataTable SearchTimeDT(string BeginTime, string EndTime)
|
|
{
|
|
return dbhelp.ExecuteDataTable(SearchTimeSql(BeginTime, EndTime), null);
|
|
}
|
|
|
|
public string SearchTimeSql(string BeginTime, string EndTime)
|
|
{
|
|
|
|
string strWhere = string.Empty;
|
|
if (!string.IsNullOrEmpty(BeginTime))
|
|
{
|
|
strWhere += "and a.detaintime >= '" + BeginTime + "' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(EndTime))
|
|
{
|
|
strWhere += "and a.detaintime <= '" + EndTime + "' ";
|
|
}
|
|
string sql = @"select a.palletno,isnull(b.oba_spot_check,'wait') oba_spot_check
|
|
from wh.dbo.oba_detainpaller a
|
|
left join mes_main.dbo.pack_pallets b
|
|
on a.palletno = b.pallet_nbr
|
|
where 1 = 1 " + strWhere+@"
|
|
group by a.palletno,b.oba_spot_check ";
|
|
return sql;
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
#region 扣留按钮扣留托盘
|
|
public DataTable DetainPalletDT(string item)
|
|
{
|
|
return dbhelp.ExecuteDataTable(DetainPalletSql(item), null);
|
|
}
|
|
|
|
public string DetainPalletSql(string item)
|
|
{
|
|
|
|
string strWhere = string.Empty;
|
|
if (!string.IsNullOrEmpty(item))
|
|
{
|
|
strWhere += "and pallet_nbr = '" + item + "' ";
|
|
}
|
|
string sql = @"update [mes_main].[dbo].[pack_pallets] set oba_spot_check = 'H'
|
|
where 1 = 1 "+strWhere;
|
|
return sql;
|
|
}
|
|
#endregion
|
|
|
|
#region 释放按钮释放托盘
|
|
public DataTable ReleasePalletDT(string pallet)
|
|
{
|
|
return dbhelp.ExecuteDataTable(ReleasePalletSql(pallet), null);
|
|
}
|
|
|
|
public string ReleasePalletSql(string pallet)
|
|
{
|
|
|
|
string strWhere = string.Empty;
|
|
if (!string.IsNullOrEmpty(pallet))
|
|
{
|
|
strWhere += "and pallet_nbr = '" + pallet + "' ";
|
|
}
|
|
string sql = @"update [mes_main].[dbo].[pack_pallets] set oba_spot_check = 'G'
|
|
where 1 = 1 " + strWhere;
|
|
return sql;
|
|
}
|
|
#endregion
|
|
|
|
#region 通过托盘查询相关信息
|
|
public DataTable SearchInfoDT(string item)
|
|
{
|
|
return dbhelp.ExecuteDataTable(searchInfoSql(item), null);
|
|
}
|
|
|
|
public string searchInfoSql(string item)
|
|
{
|
|
|
|
string strWhere = string.Empty;
|
|
if (!string.IsNullOrEmpty(item))
|
|
{
|
|
strWhere += "and a.pallet_nbr = '" + item + "' ";
|
|
}
|
|
string sql = @"select b.containerno,a.pallet_nbr,a.power_grade,a.current_grade
|
|
,a.final_grade,d.source_desc,c.cell_qty,c.crys_type,e.mod_spec_value
|
|
,a.pallet_qty,a.oba_spot_check
|
|
from [mes_main].[dbo].[pack_pallets] a
|
|
left join [wh].[dbo].[tcontainerpallet] b
|
|
on a.pallet_nbr = b.palletno
|
|
left join [mes_main].[dbo].[wo_mfg] c
|
|
on a.workorder = c.workorder
|
|
left join [mes_main].[dbo].[df_source] d
|
|
on c.mod_color = d.source_value and d.source_group_desc = '组件颜色'
|
|
left join [mes_main].[dbo].[config_products] e
|
|
on c.product_code = e.product_code
|
|
where 1 = 1 " + strWhere;
|
|
return sql;
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region 通过托盘查询扣留表中该托盘扣留数量
|
|
public DataTable SearchAmountDT(string item)
|
|
{
|
|
return dbhelp.ExecuteDataTable(searchAmountSql(item), null);
|
|
}
|
|
|
|
public string searchAmountSql(string item)
|
|
{
|
|
|
|
string strWhere = string.Empty;
|
|
if (!string.IsNullOrEmpty(item))
|
|
{
|
|
strWhere += "and palletno = '" + item + "' ";
|
|
}
|
|
string sql = @"select count(palletno) counts
|
|
from [wh].[dbo].[oba_detainpaller]
|
|
where 1 = 1 " + strWhere;
|
|
return sql;
|
|
}
|
|
#endregion
|
|
|
|
#region 通过托盘查询释放表中该托盘释放数量
|
|
public DataTable SearchAmountRelDT(string item)
|
|
{
|
|
return dbhelp.ExecuteDataTable(searchAmountRelSql(item), null);
|
|
}
|
|
|
|
public string searchAmountRelSql(string item)
|
|
{
|
|
|
|
string strWhere = string.Empty;
|
|
if (!string.IsNullOrEmpty(item))
|
|
{
|
|
strWhere += "and palletno = '" + item + "' ";
|
|
}
|
|
string sql = @"select count(palletno) counts
|
|
from [wh].[dbo].[oba_releasepallet]
|
|
where 1 = 1 " + strWhere;
|
|
return sql;
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region 扣留表插入数据
|
|
public DataTable InsertIntoPalletDT(List<dynamic> info)
|
|
{
|
|
return dbhelp.ExecuteDataTable(InsertIntoPalletSql(info), null);
|
|
}
|
|
|
|
public string InsertIntoPalletSql(List<dynamic> info)
|
|
{
|
|
|
|
string strWhere = string.Empty;
|
|
string sql = @"insert into [wh].[dbo].[oba_detainpaller] values ('" + info[0].containerno+"','"+ info[0].pallet_nbr + "','" + info[0].power_grade + "','"
|
|
+ info[0].current_grade + "','" + info[0].final_grade + "','" + info[0].source_desc + "','" + info[0].cell_qty + "','" + info[0].crys_type + "','"
|
|
+ info[0].mod_spec_value + "','" + info[0].pallet_qty + "','" + info[0].oba_spot_check + "','" + info[0].detainer + "','" + info[0].detaintime + "','"
|
|
+ info[0].detain_order + "','" + info[0].detain_reason + "')";
|
|
return sql;
|
|
}
|
|
#endregion
|
|
|
|
#region 释放表插入数据
|
|
public DataTable InsertIntoPalletRelDT(List<dynamic> info)
|
|
{
|
|
return dbhelp.ExecuteDataTable(InsertIntoPalletRelSql(info), null);
|
|
}
|
|
|
|
public string InsertIntoPalletRelSql(List<dynamic> info)
|
|
{
|
|
|
|
string strWhere = string.Empty;
|
|
string sql = @"insert into [wh].[dbo].[oba_releasepallet] values ('" + info[0].containerno + "','" + info[0].pallet_nbr + "','" + info[0].power_grade + "','"
|
|
+ info[0].current_grade + "','" + info[0].final_grade + "','" + info[0].source_desc + "','" + info[0].cell_qty + "','" + info[0].crys_type + "','"
|
|
+ info[0].mod_spec_value + "','" + info[0].pallet_qty + "','" + info[0].oba_spot_check + "','" + info[0].releaser + "','" + info[0].releasetime + "','"
|
|
+ info[0].release_order + "')";
|
|
return sql;
|
|
}
|
|
#endregion
|
|
|
|
#region 释放表插入数据
|
|
public DataTable ContainerRelDT(string ContainerLot)
|
|
{
|
|
return dbhelp.ExecuteDataTable(ContainerRelSql(ContainerLot), null);
|
|
}
|
|
|
|
public string ContainerRelSql(string ContainerLot)
|
|
{
|
|
|
|
string strWhere = string.Empty;
|
|
if (!string.IsNullOrEmpty(ContainerLot))
|
|
{
|
|
strWhere += "and containerno = '" + ContainerLot + "' ";
|
|
}
|
|
string sql = @"update [wh].[dbo].[tcontainer] set oba_status = 'G'
|
|
where 1 = 1 " + strWhere;
|
|
return sql;
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
#region 扣留按钮扣留托盘所在的柜号
|
|
public DataTable DetainContainernoDT(string Containerno)
|
|
{
|
|
return dbhelp.ExecuteDataTable(DetainContainernoSql(Containerno), null);
|
|
}
|
|
|
|
public string DetainContainernoSql(string Containerno)
|
|
{
|
|
|
|
string strWhere = string.Empty;
|
|
if (!string.IsNullOrEmpty(Containerno))
|
|
{
|
|
strWhere += "and containerno = '" + Containerno + "' ";
|
|
}
|
|
string sql = @"update [wh].[dbo].[tcontainer] set oba_status = 'H'
|
|
where 1 = 1 " + strWhere;
|
|
return sql;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|
|
|