@ -93,7 +93,7 @@ namespace XGL.Dats.DBServiceFinishProd
/// <returns></returns>
public DataTable GetUserInfoFromCloudServer ( string userID )
{
string sql = $@"SELECT user_name,nick_name,sex FROM [dbo].[sys_user] where del_flag = '0' and (user_name = '{userID}' or pe_snr = '{userID}') ";
string sql = $@"SELECT user_name,nick_name,sex FROM [dbo].[sys_user] where del_flag = '0' and pe_snr = '{userID}'";
DataSet dtset = Utils . cloudDBHelper . getDataSet ( sql ) ;
if ( dtset ! = null & & dtset . Tables . Count > 0 & & dtset . Tables [ 0 ] . Rows . Count > 0 )
{
@ -137,12 +137,37 @@ WHERE user_id = '{userID}'
return ret > 0 ? true : false ;
}
public DataTable GetAttendanceRecord ( string v )
public DataTable GetAttendanceRecord ( string v ,string data )
{
string sql = $ @ " select id, user_id, user_name, attendance_status, sex, age,
id_number , start_time , start_addr , end_time , end_addr , attendance_time ,
attendance_date , work_hours , create_time , Convert ( DECIMAL ( 12 , 2 ) , DATEDIFF ( ( MINUTE ) , start_time , GetDate ( ) ) / 60.00 ) as diff
from mes_attendance_records where start_addr = ' { v } ' and attendance_date = CONVERT ( VARCHAR ( 10 ) , GetDate ( ) , 120 ) order by create_time desc ";
string sql = $ @ "SELECT
id ,
user_id ,
user_name ,
attendance_status ,
sex ,
age ,
id_number ,
start_time ,
start_addr ,
end_time ,
end_addr ,
attendance_time ,
attendance_date ,
work_hours ,
create_time ,
CONVERT ( DECIMAL ( 12 , 2 ) ,
CASE
WHEN end_time IS NOT NULL THEN DATEDIFF ( MINUTE , start_time , end_time ) / 60.00
ELSE DATEDIFF ( MINUTE , start_time , GetDate ( ) ) / 60.00
END ) AS diff
FROM
mes_attendance_records
WHERE
start_addr = ' { v } '
AND create_time BETWEEN ' { data } 00 : 00 : 00 ' AND ' { data } 23 : 59 : 59 '
ORDER BY
create_time DESC ;
";
DataSet dtset = Utils . netClientDBHelper . getDataSet ( sql ) ;
if ( dtset ! = null & & dtset . Tables . Count > 0 & & dtset . Tables [ 0 ] . Rows . Count > 0 )
{
@ -578,9 +603,11 @@ select a.TrayCode,a.ProductBarNo,a.carcode,a.createtime,a.lineno,b.HadNumber
{
string sql = $ @ "select workorder.factory_code,workorder.product_date as plan_time, workorder.workorder_id,workorder.workorder_code, product_code,product_name,
product_spc , shifts . shift_desc , prod_line_code , workorder . status , route_code , quantity_split ,
unit , workorder . shift_id , batch . batch_code , batch . batch_quantity , sort_no , workorder . parent_order , batch . qc_status , isnull ( batch . qc_result , ' ' ) qc_result , batch . status as batchStatus , workorder_code_sap , salary_flag , qty . batchQty , batch . batch_quantity - qty . batchQty as diffQty
unit , workorder . shift_id , batch . batch_code , batch . batch_quantity , sort_no , workorder . parent_order , batch . qc_status , isnull ( batch . qc_result , ' ' ) qc_result , batch . status as batchStatus , workorder_code_sap , salary_flag , qty . batchQty , batch . batch_quantity - qty . batchQty as diffQty , chack . create_time ,
chack . check_status
from pro_order_workorder workorder WITH ( NOLOCK )
left JOIN base_shifts_t shifts WITH ( NOLOCK ) on workorder . shift_id = shifts . shift_id
LEFT JOIN ( SELECT create_time , check_status , order_no FROM qc_check_task WHERE check_type = ' checkTypeCP ' ) chack ON workorder . workorder_code = chack . order_no
left JOIN pro_order_workorder_batch batch WITH ( NOLOCK ) on workorder . workorder_id = batch . workorder_id
left join ( SELECT sum ( quantity_feedback ) as batchQty , workorder_code , batch FROM [ dbo ] . [ mes_report_work ] where del_flag = 0 GROUP BY workorder_code , batch ) qty on qty . workorder_code = workorder . workorder_code and batch . batch_code = qty . batch
where 1 = 1 and batch . del_flag = 0 and workorder . del_flag = 0 and
@ -638,7 +665,7 @@ where 1=1 and
/// <returns></returns>
public DataTable GetUnitPriceData ( string deviceCode )
{
string sql = $ @ "select [workorder_code], [workorder_code_sap], [product_name], SUBSTRING([product_code], 8, LEN(product_code)) as product_code, [user_name], [nick_name], [childprocess_code], [childprocess_name] ,[create_by], [create_time], [line_code]
string sql = $ @ "select [workorder_code], [workorder_code_sap], [product_name], SUBSTRING([product_code], 8, LEN(product_code)) as product_code, [user_name], [nick_name], [childprocess_code], [childprocess_name] ,[create_by], [create_time], [line_code] ,[attr1]
from mes_unitprice_report
where line_code = ' { deviceCode } ' and CONVERT ( VARCHAR ( 10 ) , Create_time , 120 ) = CONVERT ( VARCHAR ( 10 ) , GETDATE ( ) , 120 ) ORDER BY childprocess_code , create_time ";
@ -651,6 +678,20 @@ where line_code = '{deviceCode}' and CONVERT(VARCHAR(10), Create_time , 120) = C
}
public string GetUsernumbereData ( string deviceCode )
{
string sql = $@"SELECT SUM(quantity_feedback) as total_quantity FROM mes_report_work WHERE workorder_code='{deviceCode}'" ;
DataSet dtset = Utils . netClientDBHelper . getDataSet ( sql ) ;
if ( dtset ! = null & & dtset . Tables . Count > 0 & & dtset . Tables [ 0 ] . Rows . Count > 0 )
{
DataTable dt = dtset . Tables [ 0 ] ;
return dt . Rows [ 0 ] [ "total_quantity" ] . ToString ( ) ;
}
return null ;
}
/// <summary>
/// 根据线体、产品获取工序列表
/// </summary>
@ -676,7 +717,7 @@ where line_code = '{deviceCode}' and CONVERT(VARCHAR(10), Create_time , 120) = C
/// </summary>
/// <param name="item"></param>
/// <exception cref="NotImplementedException"></exception>
public string GetCreateUnitPriceInfo ( sys_user item , string workorderCode , string sapWorkorderCode , string productCode , string productName , string childProcessCode , string childProcessName , string deviceCode )
public string GetCreateUnitPriceInfo ( sys_user item , string workorderCode , string sapWorkorderCode , string productCode , string productName , string childProcessCode , string childProcessName , string deviceCode ,string number )
{
string sql = $ @ "INSERT INTO [dbo].[mes_unitprice_report] (
[id] , [ workorder_code ] , [ workorder_code_sap ] , [ product_name ] , [ product_code ] ,
@ -687,7 +728,7 @@ where line_code = '{deviceCode}' and CONVERT(VARCHAR(10), Create_time , 120) = C
VALUES
(
' { Common . GetUUID ( ) } ' , ' { workorderCode } ',' { sapWorkorderCode } ' , ' { productName } ' , ' { productCode } ' ,
N ' { item . user_name } ' , N ' { item . nick_name } ' , N ' { childProcessCode } ' , N ' { childProcessName } ' , NULL ,
N ' { item . user_name } ' , N ' { item . nick_name } ' , N ' { childProcessCode } ' , N ' { childProcessName } ',' { number } ' ,
NULL , NULL , ' { LoginUser . UserName } ' , getdate ( ) , NULL ,
NULL , NULL , ' { deviceCode } ' ) ; ";
@ -709,7 +750,7 @@ where line_code = '{deviceCode}' and CONVERT(VARCHAR(10), Create_time , 120) = C
public List < sys_user > GetOnWorkUserList ( string deviceCode )
{
string sql = $"SELECT user_id as user_name,user_name as nick_name,sex,age FROM [dbo].[mes_attendance_records] where start_addr = '{deviceCode}' and CONVERT(VARCHAR(10), create_time , 120) = CONVERT(VARCHAR(10), GETDATE() , 120) ;";
string sql = $"SELECT user_id as user_name,user_name as nick_name,sex,age FROM [dbo].[mes_attendance_records] where start_addr = '{deviceCode}' and CONVERT(VARCHAR(10), create_time , 120) = CONVERT(VARCHAR(10), GETDATE() , 120) order by create_time desc ;";
DataTable dt = Utils . netClientDBHelper . getDataSet ( sql ) . Tables [ 0 ] ;
@ -958,6 +999,18 @@ where detail.parent_work_order = '{processid}'"; //where CONVERT(VARCHAR(10), w
}
/// <summary>
/// 删除薪酬录入
/// </summary>
/// <returns></returns>
public bool Updateremuneration ( string workOrdercode , string nickName , string attr1 , string childprocess_code )
{
string sql1 = $@"DELETE FROM mes_unitprice_report WHERE workorder_code_sap='{workOrdercode}' AND nick_name='{nickName}' AND attr1='{attr1}' and childprocess_code='{childprocess_code}' " ;
return Utils . netClientDBHelper . executeUpdate ( sql1 ) > 0 ? true : false ;
}
/// <summary>
/// 写入开始、报工状态
/// </summary>