insert into mes_next_machine
record_id,
rfid,
next_machine_code,
status,
remark,
attr1,
attr2,
attr3,
attr4,
create_by,
create_time,
update_by,
update_time,
factory_code,
#{recordId},
#{rfid},
#{nextMachineCode},
#{status},
#{remark},
#{attr1},
#{attr2},
#{attr3},
#{attr4},
#{createBy},
#{createTime},
#{updateBy},
#{updateTime},
#{factoryCode},
insert into pro_lg_used_log(
id,device_code,
used,used_unit,
createDate,lg_create_time,
factory_code,create_time
) values
(
#{item.id},#{item.deviceCode},
#{item.used},#{item.usedUnit},
#{item.createDate},#{item.lgCreateTime},
#{item.factoryCode},#{item.createTime}
)
delete from ${table} where #{ymdhms} > CONVERT(varchar(30),create_time, 120)
select
bucket_code loadNo
from pro_wet_material_plan_detail
where material_code = #{sku} and CONVERT(varchar(10),plan_time, 120) = CONVERT(varchar(10),#{reqTime}, 120)
and del_flag = '0'
select equipment_id equipmentId,
equipment_code equipmentCode,
equipment_name equipmentName,
equipment_type_code equipmentTypeCode,
equipment_type_name equipmentTypeName
from base_equipment
where del_flag = '0'
and status = '1'
and equipment_type_code = #{equipmentTypeCode}
and equipment_code like concat('%', #{equipmentCode}, '%')
and equipment_name like concat('%', #{equipmentName}, '%')
select count(0) totalNum,
equ.equipment_type_code equTypeCode,
equ.equipment_type_name equTypeName
from mes_material_transfer_result mt
left join base_equipment equ on mt.equipmentCode = equ.equipment_code
where CONVERT(varchar(10),mt.update_time, 120) = #{ymd} and equ.equipment_name is not null
and equ.equipment_type_code = #{equTypeCode}
and mt.shift_id = #{shiftId}
group by equ.equipment_type_code,
equ.equipment_type_name
select count(0) totalNum,
mt.equipmentCode equCode,
equ.equipment_name equName,
equ.equipment_type_code equTypeCode
from mes_material_transfer_result mt
left join base_equipment equ on mt.equipmentCode = equ.equipment_code
where CONVERT(varchar(10),mt.update_time, 120) = #{ymd} and equ.equipment_name is not null
and equ.equipment_type_code = #{equTypeCode}
and mt.shift_id = #{shiftId}
group by mt.equipmentCode,
equ.equipment_name,
equ.equipment_type_code
select dept_id parentName,
dept_name deptName
from sys_dept where parent_id = '1' and del_flag = '0'
select count(0) totalNum,
equ.equipment_type_code equTypeCode,
equ.equipment_type_name equTypeName
from mes_material_transfer_result mt
left join base_equipment equ on mt.equipmentCode = equ.equipment_code
where CONVERT(varchar(10),mt.create_time, 120) = #{ymd} and equ.equipment_name is not null
and equ.equipment_type_code = #{equTypeCode} and mt.status = 2
and mt.shift_id = #{shiftId}
group by equ.equipment_type_code,
equ.equipment_type_name
select count(0) totalNum,
mt.equipmentCode equCode,
equ.equipment_name equName,
equ.equipment_type_code equTypeCode
from mes_material_transfer_result mt
left join base_equipment equ on mt.equipmentCode = equ.equipment_code
where CONVERT(varchar(10),mt.create_time, 120) = #{ymd} and equ.equipment_name is not null
and equ.equipment_type_code = #{equTypeCode} and mt.status = 2
and mt.shift_id = #{shiftId}
group by mt.equipmentCode,
equ.equipment_name,
equ.equipment_type_code
SELECT TOP 0 * INTO ${tableNew} FROM mes_material_transfer_result
insert into sys_sap_log
(id,messsge,create_time,reqcode,method,remark,status)
values(
#{id},#{messsge}, #{createTime}, #{reqcode},#{method},#{remark},#{status})
insert into ${table}
select * FROM mes_material_transfer_result
where create_time >= #{startDate} and #{endDate}>create_time
SELECT * FROM [dbo].[base_equipment]
SELECT
CONVERT(INT, SUBSTRING(PivotTable.equipment_code, 2, LEN(PivotTable.equipment_code) - 1)) as i,
PivotTable.*,
DATEDIFF(MINUTE, T2.last_update_time, GETDATE()) as waitmin
FROM
(
SELECT
be.equipment_code,
be.status,
bea.isvalue,
bea.property
FROM
base_equipment be
LEFT JOIN base_equipment_attached bea ON be.equipment_code = bea.device_code
WHERE
be.equipment_type_code = 'equ_type_hf'
AND del_flag = '0'
) AS SourceTable PIVOT ( MAX ( isvalue ) FOR property IN ( [dollyNumber], [Intheoven], [temperature] ) ) AS PivotTable LEFT JOIN base_equipment_attached T2 ON PivotTable.equipment_code=T2.device_code WHERE T2.property='dollyNumber'
ORDER BY i asc
delete from mes_material_transfer_result
where create_time >= #{startDate} and #{endDate}>create_time
delete from ${table}
where create_time >= #{startDate} and #{endDate}>create_time
delete from ${table} where #{ymdhms} > CONVERT(varchar(30),creter_time, 120)
select pow.workorder_code workorderCode,
pow.workorder_code_sap workorderCodeSap,
pow.workorder_name workorderName,
pow.product_code productCode,
pow.product_name productName,
pr.route_code routeCode,
pr.route_id routeId,
equ.equipment_name equipmentName,
equ.workshop_code workshopCode,
equ.workshop_name workshopName
from pro_order_workorder pow
left join pro_route pr on pow.route_code = pr.route_code
left join base_equipment equ on pow.workorder_name = equ.equipment_code
where pow.parent_order = '0'
and pow.product_date = CONVERT(varchar(10),GETDATE(), 120)
and pow.del_flag='0'
select file_name fileName,
file_address fileAddress
from base_file
where source_id = #{routeId}
SELECT
SUM(quantity) AS sumplanquantity
FROM
pro_order
WHERE
order_type = 'LJ88'
AND parent_order=''
AND CONVERT ( DATE, plan_pro_date ) = CONVERT ( DATE, GETDATE( ) )
AND CONVERT ( DATE, plan_complete ) = CONVERT ( DATE, GETDATE( ) );
SELECT SUM
( quantity ) AS sumplanquantity
FROM
mes_report_work
WHERE
parent_order = '0'
AND CONVERT ( DATE, create_time ) = CONVERT ( DATE, GETDATE( ) )
SELECT
CONVERT(DATE, create_time) AS day,
SUM(quantity) AS sum_quantity
FROM
mes_report_work
WHERE
parent_order = '0'
AND CONVERT(DATE, create_time) BETWEEN DATEADD(DAY, -7, CONVERT(DATE, GETDATE())) AND CONVERT(DATE, GETDATE())
GROUP BY
CONVERT(DATE, create_time);
SELECT
A.workorder_code,
A.workorder_name,
C.equipment_name,
A.product_name,
SUM ( B.quantity ) AS total_quantity,
A.unit
FROM
pro_order_workorder A
LEFT JOIN mes_report_work B ON A.workorder_code = B.workorder_code
LEFT JOIN base_equipment C ON A.workorder_name= C.equipment_code
WHERE
A.status = 'w2'
AND A.parent_order = '0'
AND CONVERT ( DATE, A.product_date ) = CONVERT ( DATE, GETDATE( ) )
GROUP BY
A.workorder_code,
A.workorder_name,
A.product_name,
A.workorder_name,
A.unit,
C.equipment_name;