select
a.id,
a.delivery_id,
b.delivery_code,
a.entry_number,
a.material_id,
d.code as wbsCode,
d.name as wbsName,
a.wbs,
a.measurement_id,
a.gs_delivery_num,
a.gs_cancel_num,
a.out_num,
b.company_number,
b.bills_time,
b.customer_code,
b.delivery_type,
b.source_type,
b.move_type,
b.project_name,
c.name as materialName,
c.code as materialCode,
c.part_type as partType
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
left join tld_wbs d on a.wbs = d.tld_id
where (a.gs_delivery_num - a.gs_cancel_num) != a.out_num
and a.status != '1' and c.code in (select material_id from tld_user_material where user_id = #{userId})
and a.delivery_id = #{deliveryId}
and a.material_id = #{materialId}
and a.entry_number = #{entryNumber}
and a.wbs = #{wbs}
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,
0 + (a.amount - a.amount_lock) 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,
a.account_sleeve
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.wbs = #{delivery.wbs} and a.account_sleeve = #{delivery.companyNumber}
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
FROM tld_inventory a
JOIN tld_material b on a.material_id = b.tld_id
WHERE b.code = #{wllbCode} and a.account_sleeve = #{companyNumber} and a.wbs = #{wbs} and a.hold = '0'
and a.attribute = #{attribute}
and a.serial = #{serial}
and a.storage_location_code = #{storageLocationCode}
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
FROM tld_inventory a
JOIN tld_material b on a.material_id = b.tld_id
WHERE b.code = #{wllbCode} and a.account_sleeve = #{companyNumber} and a.wbs = #{wbs} and a.hold = '0'
and a.attribute = #{attribute}
and a.storage_location_code = #{storageLocationCode}
and a.supplier_id = #{supplierId}
and (a.amount + 0) =]]> (#{num} + 0) limit 1
select
count(*)
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} and serial = #{serial}
update tld_delivery set out_num = (out_num + 0) + #{num} where delivery_id = #{deliveryId} and material_id = #{materialId} and entry_number = #{entryNumber}
insert into tld_removal_half(wllb_code,num,user_id,scrq,delivery_id,company_number,customer_code,storage_code,wbs,transmission_type,serial)
value(#{materialCode},#{outNum},#{userId},now(),#{deliveryId},#{companyNumber},#{customerCode},#{storageCode},#{wbs},0,#{serial})
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}) 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}
select
sum(num) as num
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.wbs = #{wbs}
select
(select ifnull(amount,0) from tld_inventory where id = #{id}) as amount,
(select ifnull(sum(num),0) from tld_ask_goods_vitrual where wbs = #{wbs} and wllb_code = #{wllbCode} and storage_location_code = #{storageLocationCode} and produc_date = #{producDate} and account_sleeve = #{companyNumber}
and serial = #{serial}
and attribute = #{attribute}
) as vitrualNum
from dual
select * from tld_delivery where id = #{id}
delete from tld_delivery where id = #{id}
select a.storage_location_code,
a.wllb_class,
a.library_type,
a.material_id,
(a.amount - ifnull(a.amount_lock, 0)) as amount,
a.total,
a.totime,
a.hold,
a.amount_lock,
a.account_sleeve,
a.wbs,
a.supplier_id,
a.serial,
a.wllb_code,
a.produc_date,
a.scrq,
b.storage_location_name as storageLocationName
from tld_inventory a
join tld_storage_location b on a.storage_location_code = b.storage_location_code
join tld_warehouse c on b.warehouse_where = c.tld_id
where a.material_id = #{materialId}
and a.account_sleeve = #{companyNumber}
and a.hold = '0'
and (c.warehouse_type = '0' or c.warehouse_type = '1' or c.warehouse_type = '2')
and a.wbs = #{wbs}
order by a.produc_date
select count(*) from tld_ask_goods_vitrual
and serial = #{serial}
and supplier_id = #{supplierId}
and wllb_code = #{wllbCode}
and produc_date = #{producDate}
SELECT
ifnull(sum( a.num ), 0)
FROM
tld_ask_goods_vitrual a
join tld_material b on a.wllb_code = b.code
WHERE
a.ask_goods_id = #{deliveryId} and b.tld_id = #{materialId}
insert into tld_removal_half_product(wllb_code,num,user_id,scrq,ask_goods_id,storage_code,wbs,company_number,transmission_type)
value(#{materialCode},#{outNum},#{userId},now(),#{deliveryId},#{storageCode},#{wbs},#{companyNumber},0)
select out_num,gs_delivery_num from tld_delivery where delivery_id = #{askGoodsId} and entry_number = #{entryNumber}
select amount from tld_inventory where id = #{id}
select ifnull(sum(num), 0) as num from tld_ask_goods_vitrual where ask_goods_id = #{askGoodsId} and entry_number = #{entryNumber}
select ifnull(sum(num), 0) as num from tld_ask_goods_vitrual where wllb_code = #{wllbCode} and account_sleeve = #{accountSleeve} and wbs = #{wbs}
and produc_date = #{producDate}
and serial = #{serial}
select
a.equipment_code as equipmentCode
a.software_code as softwareCode,
b.tld_id as materialId
from tld_equipment_binding_software a
join tld_material b on a.equipment_code = b.code
where a.equipment_code = #{code}