select
o.order_id,
o.batch,
o.project,
o.order_type,
o.area as gross_area,
o.quantity as quantity,
o.creator,
o.customer_name,
o.processing_note
from sd.order_detail as od
left join `order` as o
on o.order_id=od.order_id
where o.production_order!=2 and o.order_review=2
and o.order_id regexp #{orderGlassDetail.orderId}
and o.batch regexp #{orderGlassDetail.order.batch}
and o.project regexp #{orderGlassDetail.order.project}
and o.order_type regexp #{orderGlassDetail.order.orderType}
and o.customer_name regexp #{orderGlassDetail.order.customerName}
and o.processing_note regexp #{orderGlassDetail.order.processingNote}
and DATE_FORMAT((o.create_time),'%Y-%m-%d') BETWEEN #{ selectTime1 } AND #{ selectTime2 }
group by o.order_id
order by o.id desc
;
select
o.order_id,
od.order_number,
ogd.production_id,
ogd.founder,
o.batch,
o.project,
o.order_type,
(od.gross_area) as gross_area,
(od.quantity) as quantity,
o.creator,
od.id,
o.customer_name,
o.processing_note
from sd.order_glass_detail as ogd
left join order_detail as od
on od.order_id=ogd.order_id
and ogd.order_number=od.order_number
left join `order` as o
on o.order_id=ogd.order_id
where ogd.production_id IS NOT NULL
and o.order_review>0
and o.order_id regexp #{orderGlassDetail.orderId}
and ogd.production_id regexp #{orderGlassDetail.productionId}
and o.batch regexp #{orderGlassDetail.order.batch}
and o.project regexp #{orderGlassDetail.order.project}
and o.order_type regexp #{orderGlassDetail.order.orderType}
and o.customer_name regexp #{orderGlassDetail.order.customerName}
and o.processing_note regexp #{orderGlassDetail.order.processingNote}
and DATE_FORMAT((o.create_time),'%Y-%m-%d') BETWEEN #{ selectTime1 } AND #{ selectTime2 }
group by od.id,ogd.order_id,od.order_number
order by od.id desc
select od.order_id,
od.product_id,
od.product_name,
sum( od.quantity) as quantity,
od.compute_gross_area,
od.perimeter
from sd.order_detail as od
left join sd.order as o
on od.order_id =o.order_id
where FIND_IN_SET(od.order_id,#{orderId}) and o.production_order!=2
and od.order_id regexp #{orderDetail.orderId}
and od.product_id regexp #{orderDetail.productId}
and od.product_name regexp #{orderDetail.productName}
group by od.order_id, od.product_id, od.product_name
;
select ifnull(count(ogd.production_id), 0)
from sd.order_glass_detail as ogd
where ogd.production_id = #{productIdVl}
update sd.order_detail as od left join sd.order_glass_detail as ogd
on od.order_id = ogd.order_id and od.order_number = ogd.order_number
set ogd.production_id=#{productIdVl},
ogd.production_time=NOW(),
ogd.founder=#{userName}
where od.order_id = #{orderId}
and od.product_id = #{productId}
and od.product_name = #{productName}
update sd.order_detail as od left join sd.order_glass_detail as ogd
on od.order_id = ogd.order_id and od.order_number = ogd.order_number
set ogd.production_id=null,
ogd.production_time=null,
ogd.founder=null
where od.order_id = #{orderId}
select COUNT(distinct order_number)
from order_glass_detail
where ISNULL(production_id)
and order_id = #{orderId}
select COUNT(distinct order_number)
from order_glass_detail
where order_id = #{orderId}
update sd.order as o
set o.production_order=#{state}
where o.order_id = #{orderId}
select processing_card from sd.`order` where order_id = #{orderId}