delete from sd.delivery_detail where delivery_id=#{deliveryId}
update sd.order_detail set delivery_num=#{deliveryDetail.quantity} where order_id=#{orderId} and order_number=#{orderNumber}
update sd.order_detail set delivery_num=delivery_num-#{quantity} where order_id=#{orderId} and order_number=#{orderNumber}
select count(*) from sd.delivery_detail where delivery_id=#{deliveryId}
select * from sd.delivery_detail where delivery_id=#{deliveryId}
insert into sd.delivery_detail (delivery_id,delivery_number,order_number,
area,order_id,quantity,money,delivery_detail_remakes,delivery_detail_state,create_time)
values (
#{number} ,#{deliveryNumber},#{orderDetail.order_number},#{orderDetail.computeGrossArea},
#{orderDetail.orderId},#{orderDetail.deliveryDetail.quantity},
#{orderDetail.price}*#{orderDetail.deliveryDetail.quantity},'',1,now()
)
select od.order_id,
o.batch,
dd.delivery_number,
fgi.quantity_available + dd.quantity as quantity_available,
od.order_number,
od.quantity-dd.quantity as t_quantity,
od.quantity as o_quantity,
dd.quantity as d_quantity,
od.building_number,
od.product_id,
od.product_name,
od.price,
fgi.storage_region,
dd.money,
od.width,
od.height,
od.shape,
fgi.actual_signal_area,
od.gross_area,
od.compute_area,
od.compute_gross_area,
od.processing_note,
od.edging_type,
od.perimeter,
dd.delivery_detail_remakes
from sd.delivery_detail dd
left join sd.delivery d on dd.delivery_id=d.delivery_id
left join sd.order_detail od on dd.order_id=od.order_id and dd.order_number=od.order_number
left join sd.`order` o on dd.order_id=o.order_id
left join mm.finished_goods_inventory fgi on dd.order_id=fgi.order_id and dd.order_number=fgi.order_number
and dd.delivery_id regexp #{orderDetail.deliveryDetail.deliveryId}
and od.order_id regexp #{orderDetail.orderId}
and o.batch regexp #{orderDetail.order.batch}
and fgi.quantity_available regexp #{orderDetail.finishedGoodsInventory.quantityAvailable}
and od.quantity regexp #{orderDetail.quantity}
and dd.quantity regexp #{orderDetail.deliveryDetail.quantity}
and od.building_number regexp #{orderDetail.buildingNumber}
and od.product_id regexp #{orderDetail.productId}
and od.product_name regexp #{orderDetail.productName}
and od.price regexp #{orderDetail.price}
and fgi.storage_region regexp #{orderDetail.finishedGoodsInventory.storageRegion}
and dd.money regexp REGEXP_REPLACE(#{orderDetail.deliveryDetail.money},'\\.0+$','')
and od.width regexp REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
and od.height regexp REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
and od.shape regexp #{orderDetail.shape}
and fgi.actual_signal_area regexp REGEXP_REPLACE(#{orderDetail.finishedGoodsInventory.actualSignalArea},'\\.0+$','')
and od.gross_area regexp REGEXP_REPLACE(#{orderDetail.grossArea},'\\.0+$','')
and od.compute_area regexp REGEXP_REPLACE(#{orderDetail.computeArea},'\\.0+$','')
and od.compute_gross_area regexp REGEXP_REPLACE(#{orderDetail.computeGrossArea},'\\.0+$','')
and od.processing_note regexp #{orderDetail.processingNote}
and od.edging_type regexp #{orderDetail.edgingType}
and od.perimeter regexp #{orderDetail.perimeter}
and dd.delivery_detail_remakes regexp #{orderDetail.deliveryDetail.deliveryDetailRemakes}
limit #{offset},#{pageSize};
select
CEILING(count(dd.id)/#{pageSize})
from sd.delivery_detail dd
left join sd.delivery d on dd.delivery_id=d.delivery_id
left join sd.order_detail od on dd.order_id=od.order_id and dd.order_number=od.order_number
left join sd.`order` o on dd.order_id=o.order_id
left join mm.finished_goods_inventory fgi on dd.order_id=fgi.order_id and dd.order_number=fgi.order_number
and dd.delivery_id regexp #{orderDetail.deliveryDetail.deliveryId}
and od.order_id regexp #{orderDetail.orderId}
and o.batch regexp #{orderDetail.order.batch}
and fgi.quantity_available regexp #{orderDetail.finishedGoodsInventory.quantityAvailable}
and od.quantity regexp #{orderDetail.quantity}
and dd.quantity regexp #{orderDetail.deliveryDetail.quantity}
and od.building_number regexp #{orderDetail.buildingNumber}
and od.product_id regexp #{orderDetail.productId}
and od.product_name regexp #{orderDetail.productName}
and od.price regexp #{orderDetail.price}
and fgi.storage_region regexp #{orderDetail.finishedGoodsInventory.storageRegion}
and dd.money regexp REGEXP_REPLACE(#{orderDetail.deliveryDetail.money},'\\.0+$','')
and od.width regexp REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
and od.height regexp REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
and od.shape regexp #{orderDetail.shape}
and fgi.actual_signal_area regexp REGEXP_REPLACE(#{orderDetail.finishedGoodsInventory.actualSignalArea},'\\.0+$','')
and od.gross_area regexp REGEXP_REPLACE(#{orderDetail.grossArea},'\\.0+$','')
and od.compute_area regexp REGEXP_REPLACE(#{orderDetail.computeArea},'\\.0+$','')
and od.compute_gross_area regexp REGEXP_REPLACE(#{orderDetail.computeGrossArea},'\\.0+$','')
and od.processing_note regexp #{orderDetail.processingNote}
and od.edging_type regexp #{orderDetail.edgingType}
and od.perimeter regexp #{orderDetail.perimeter}
and dd.delivery_detail_remakes regexp #{orderDetail.deliveryDetail.deliveryDetailRemakes}
limit #{offset},#{pageSize};
select od.order_id,
od.order_number,
o.batch,
fgi.quantity_available,
od.quantity- od.delivery_num as t_quantity,
od.quantity as o_quantity,
fgi.quantity_available as d_quantity,
od.building_number,
od.product_id,
od.product_name,
od.price,
fgi.storage_region,
od.width,
od.height,
od.shape,
fgi.actual_signal_area,
od.gross_area,
od.compute_area,
od.compute_gross_area,
od.processing_note,
od.edging_type,
od.perimeter
from sd.order_detail od
left join sd.`order` o on od.order_id = o.order_id
left join mm.finished_goods_inventory fgi
on od.order_id = fgi.order_id and od.order_number = fgi.order_number
fgi.quantity_available > 0 and od.quantity > od.delivery_num
and od.order_id regexp #{orderDetail.orderId}
and o.batch regexp #{orderDetail.order.batch}
and fgi.quantity_available regexp #{orderDetail.finishedGoodsInventory.quantityAvailable}
and od.quantity regexp #{orderDetail.quantity}
and od.delivery_num regexp #{orderDetail.deliveryNum}
and od.building_number regexp #{orderDetail.buildingNumber}
and od.product_id regexp #{orderDetail.productId}
and od.product_name regexp #{orderDetail.productName}
and od.price regexp REGEXP_REPLACE(#{orderDetail.price},'\\.0+$','')
and fgi.storage_region regexp #{orderDetail.finishedGoodsInventory.storageRegion}
and od.width regexp REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
and od.height regexp REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
and od.shape regexp #{orderDetail.shape}
and fgi.actual_signal_area regexp REGEXP_REPLACE(#{orderDetail.finishedGoodsInventory.actualSignalArea},'\\.0+$','')
and od.gross_area regexp REGEXP_REPLACE(#{orderDetail.grossArea},'\\.0+$','')
and od.compute_area regexp REGEXP_REPLACE(#{orderDetail.computeArea},'\\.0+$','')
and od.compute_gross_area regexp REGEXP_REPLACE(#{orderDetail.computeGrossArea},'\\.0+$','')
and od.processing_note regexp #{orderDetail.processingNote}
and od.edging_type regexp #{orderDetail.edgingType}
and od.perimeter regexp #{orderDetail.perimeter}
limit #{offset},#{pageSize};
select
CEILING(count(od.id)/#{pageSize})
from sd.order_detail od
left join sd.`order` o on od.order_id = o.order_id
left join mm.finished_goods_inventory fgi
on od.order_id = fgi.order_id and od.order_number = fgi.order_number
fgi.quantity_available > 0 and od.quantity > od.delivery_num
and od.order_id regexp #{orderDetail.orderId}
and o.batch regexp #{orderDetail.order.batch}
and fgi.quantity_available regexp #{orderDetail.finishedGoodsInventory.quantityAvailable}
and od.quantity regexp #{orderDetail.quantity}
and od.delivery_num regexp #{orderDetail.deliveryNum}
and od.building_number regexp #{orderDetail.buildingNumber}
and od.product_id regexp #{orderDetail.productId}
and od.product_name regexp #{orderDetail.productName}
and od.price regexp REGEXP_REPLACE(#{orderDetail.price},'\\.0+$','')
and fgi.storage_region regexp #{orderDetail.finishedGoodsInventory.storageRegion}
and od.width regexp REGEXP_REPLACE(#{orderDetail.width},'\\.0+$','')
and od.height regexp REGEXP_REPLACE(#{orderDetail.height},'\\.0+$','')
and od.shape regexp #{orderDetail.shape}
and fgi.actual_signal_area regexp REGEXP_REPLACE(#{orderDetail.finishedGoodsInventory.actualSignalArea},'\\.0+$','')
and od.gross_area regexp REGEXP_REPLACE(#{orderDetail.grossArea},'\\.0+$','')
and od.compute_area regexp REGEXP_REPLACE(#{orderDetail.computeArea},'\\.0+$','')
and od.compute_gross_area regexp REGEXP_REPLACE(#{orderDetail.computeGrossArea},'\\.0+$','')
and od.processing_note regexp #{orderDetail.processingNote}
and od.edging_type regexp #{orderDetail.edgingType}
and od.perimeter regexp #{orderDetail.perimeter}
limit #{offset},#{pageSize};