select
a.id,
a.delivery_id,
a.entry_number,
a.material_id,
a.wbs,
a.measurement_id,
a.gs_delivery_num,
a.gs_cancel_num,
a.out_num,
b.company_number,
b.bills_time,
b.delivery_type,
b.source_type,
b.move_type,
c.name as materialName,
c.code as materialCode
from tld_delivery a
join tld_delivery_f b on a.delivery_id = b.delivery_id
left join tld_material c on a.material_id = c.tld_id
where (a.gs_delivery_num - a.gs_cancel_num) != a.out_num
and a.delivery_id = #{deliveryId}
and a.material_id = #{materialId}
select
CONCAT(CONCAT(GROUP_CONCAT(storage_location_code SEPARATOR ","),','), '111111,')
from tld_storage_location where is_product = '1'
SELECT
a.id,
a.storage_location_code,
a.wllb_class,
a.library_type,
a.material_id,
(a.amount - ifnull(a.amount_lock, 0)) as amount,
a.wbs,
a.serial,
a.wllb_code,
a.produc_date,
a.scrq,
a.produc_batch,
a.attribute,
b.storage_location_name as storageLocationName
FROM tld_inventory a
LEFT JOIN tld_storage_location b on a.storage_location_code = b.storage_location_code
WHERE #{storageLocationCode} LIKE CONCAT( '%', CONCAT( a.storage_location_code, ',' ), '%' )
AND a.material_id = #{delivery.materialId} AND a.hold = '0'
and a.attribute = #{delivery.attribute}
ORDER BY
a.produc_batch
SELECT
a.id,
a.storage_location_code,
a.wllb_class,
a.library_type,
a.material_id,
a.amount,
a.amount_lock,
a.wbs,
a.serial,
a.wllb_code,
a.produc_date,
a.scrq,
a.produc_batch,
a.attribute,
b.storage_location_name as storageLocationName
FROM tld_inventory a
JOIN tld_material b on a.material_id = b.tld_id
WHERE a.attribute = #{attribute} and a.produc_batch = #{producDate} and a.serial = #{serial} and b.code = #{wllbCode}
select
ifnull(sum(a.num), 0)
from tld_ask_goods_vitrual a
join tld_material b on a.wllb_code = b.code
where a.storage_location_code = #{storageLocationCode} and b.code = #{wllbCode} and a.attribute = #{attribute} and a.produc_date = #{producBatch}
update tld_delivery set ifnull(out_num, 0) = #{num} where delivery_id = #{deliveryId} and material_id = #{materialId}
insert into tld_removal_half(wllb_code,num,user_id,scrq,delivery_id,company_number,customer_code,storage_code,wbs)
value(#{materialCode},#{outNum},#{userId},now(),#{deliveryId},#{companyNumber},#{customerCode},#{storageCode},#{wbs})
select
id,
delivery_id,
delivery_code,
company_number,
customer_code,
bills_time,
delivery_type,
source_type,
move_type
from tld_delivery_f where delivery_id = #{deliveryId}
SELECT
DISTINCT attribute,
storage_location_code,
wllb_code,
produc_batch
FROM tld_inventory
WHERE CONCAT(#{storageLocationCode},'111111,') LIKE CONCAT( '%', CONCAT( storage_location_code, ',' ), '%' )
AND material_id = #{delivery.materialId} AND hold = '0'
select sum(amount) from tld_inventory where storage_location_code = #{storageLocationCode}
select
id,
name,
code,
tld_id,
specification_and_model,
unit_of_measurement,
size,
wllb_class,
is_not_disable,
is_recommend,
part_type
from tld_material where tld_id = #{materialId}