select count(*) from tld_ask_goods where ask_goods_id = #{askGoodsId} and material_id = #{materialId}
update tld_ask_goods
set
num = (select num from tld_ask_goods where ask_goods_id = #{askGoodsId} and material_id = #{materialId})
where ask_goods_id = #{askGoodsId} and material_id = #{materialId}
insert into tld_ask_goods(ask_goods_id,entry_number,production_code,material_id,wbs,measurement_id,num,out_num)
values(#{askGoodsId},#{entryNumber},#{productionCode},#{materialId},#{wbs},#{measurementId},#{outNum})
insert into tld_ask_goods_log(ask_goods_id,entry_number,production_code,material_id,wbs,measurement_id,num,out_num,ask_goods_code,company_number,sqrq,department_id,source_type,move_type,ask_goods_type)
values(#{askGoodsId},#{entryNumber},#{productionCode},#{materialId},#{wbs},#{measurementId},#{outNum},#{askGoodsCode},#{companyNumber},#{sqrq},#{departmentId},#{sourceType},#{moveType},#{askGoodsType})
select count(*) from tld_ask_goods_f where ask_goods_id = #{askGoodsId} and ask_goods_code = #{askGoodsCode}
insert into tld_ask_goods_f(ask_goods_id,ask_goods_code,company_number,sqrq,department,source_type,move_type,ask_goods_apply_type)
values(#{askGoodsId},#{askGoodsCode},#{companyNumber},#{sqrq},#{department},#{sourceType},#{moveType},#{askGoodsApplyType})
select
a.ask_goods_id,
a.ask_goods_code,
b.name as departmentName
from tld_ask_goods_f a
left join tld_department b on a.department = b.tld_id
order by a.sqrq desc
SELECT
a.id,
a.material_id,
a.num,
b.name as materialName,
b.code as materialCode,
a.out_num
FROM
tld_ask_goods a
left join tld_material b on a.material_id = b.tld_id
WHERE
a.ask_goods_id = #{askGoodsId} and (a.num + 0) ]]> (a.out_num + 0) and b.part_type != '半成品' and b.part_type != '产成品'
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
left join tld_storage_location b on a.storage_location_code = b.storage_location_code
where a.material_id = #{materialId} and a.hold = '0' order by a.produc_date
insert into tld_ask_goods_vitrual(unique_code,supplier_id,serial,wllb_code,produc_date,ask_goods_id,type,storage_location_code,num,user_id,department,attribute)
values(#{uniqueCode},#{supplierId},#{serial},#{wllbCode},#{producDate},#{askGoodsId},#{type},#{storageLocationCode},#{num},#{userId},#{department},#{attribute})
select
id,
storage_location_code,
wllb_class,
library_type,
material_id,
amount,
total,
totime,
hold,
amount_lock,
account_sleeve,
wbs,
supplier_id,
serial,
wllb_code,
produc_date,
scrq
from tld_inventory where supplier_id = #{supplierId} and serial = #{serial} and wllb_code = #{wllbCode} and produc_date = #{producDate}
SELECT
ifnull(sum(a.num),0) as num
FROM
tld_ask_goods_vitrual a
join tld_material b on a.wllb_code = b.code and b.tld_id = #{materialId}
where a.storage_location_code = #{storageLocationCode}
select
(select ifnull(amount,0) from tld_inventory where supplier_id = #{supplierId} and serial = #{serial} and wllb_code = #{wllbCode} and produc_date = #{producDate}) as inventoryNum,
(select ifnull(sum(num),0) from tld_ask_goods_vitrual where supplier_id = #{supplierId} and serial = #{serial} and wllb_code = #{wllbCode} and produc_date = #{producDate} and type = #{type}) as virtualNum
from dual
SELECT
a.id,
a.ask_goods_id,
a.entry_number,
a.production_code,
a.material_id,
a.wbs,
a.measurement_id,
a.num,
a.out_num
FROM
tld_ask_goods a
join tld_material b on a.material_id = b.tld_id
where a.ask_goods_id = #{askGoodsId} and b.code = #{wllbCode}
select ifnull(sum(num), 0) from tld_ask_goods_vitrual where wllb_code = #{wllbCode} and ask_goods_id = #{askGoodsId} and type = #{type}
select ifnull(sum(num), 0) from tld_ask_goods_vitrual where supplier_id = #{supplierId} and serial = #{serial} and wllb_code = #{wllbCode} and produc_date = #{producDate} and type = #{type}
select
id,
unique_code,
supplier_id,
serial,
wllb_code,
produc_date,
ask_goods_id,
type,
storage_location_code,
num,
user_id,
department
from tld_ask_goods_vitrual where unique_code = #{uniqueCode} and type = #{type} and ask_goods_id = #{askGoodsId}
delete from tld_inventory where id = #{id}
UPDATE tld_inventory
SET amount = amount - #{amount}
WHERE
id = #{id}
delete from tld_ask_goods_vitrual where id = #{id}
insert into tld_removal(wllb_code,supplier_id,serial,num,type,user_id,storage_location_code,scrq,process,ask_goods_id,produc_date,department)
values(#{wllbCode},#{supplierId},#{serial},#{num},#{type},#{userId},#{storageLocationCode},now(),#{process},#{askGoodsId},#{producDate},#{department})
select tld_id from tld_material where code = #{wllbCode}
select
id,
ask_goods_id,
entry_number,
production_code,
material_id,
wbs,
measurement_id,
num,
out_num
from tld_ask_goods
where ask_goods_id = #{askGoodsId} and material_id = #{materialId}
insert into tld_return_gs_removal_z(material_id,wbs,num,entry_number,document_id,ask_id,storage_location_code)
values(#{materialId},#{wbs},#{num},#{entryNumber},#{documentId},#{documentPointsId},#{storageLocationCode})
select
id,
ask_goods_id,
ask_goods_code,
company_number,
sqrq,
department,
source_type,
move_type
from tld_ask_goods_f where ask_goods_id = #{askGoodsId}
insert into tld_return_gs_removal(ask_goods_id,removal_code,source_type,move_type,scrq,delivery_type)
values(#{documentId},#{removalCode},#{sourceType},#{moveType},now(),#{deliveryType})
select count(*) from tld_return_gs_removal where scrq BETWEEN CONCAT(CURDATE(),' 00:00:00') AND CONCAT(CURDATE(),' 23:59:59');
select
id,
document_id as askGoodsId,
removal_code as removalCode,
source_type as sourceType,
move_type as moveType
from tld_return_gs_removal where removal_code = #{removalCode}
select
material_id as materialId,
wbs,
num,
entry_number as entryNumber,
document_id as askGoodsId,
document_points_id as askId
from tld_return_gs_removal_z where ask_goods_id = #{askGoodsId}
select
a.id,
b.name as materialName,
a.wllb_code,
h.name as supplierName,
a.serial,
a.type,
c.user_name as userName,
a.department,
g.storage_location_name as storageLocationName,
a.scrq,
a.num
from tld_removal a
left join tld_material b on a.wllb_code = b.code
left join tld_user c on a.user_id = c.id
-- left join tld_department e on a.department = e.tld_id
left join tld_storage_location g on a.storage_location_code = g.storage_location_code
left join tld_customer h on a.supplier_id = h.code
and a.wllb_code = #{wllbCode}
and a.scrq =]]> #{startTime}
and a.scrq #{endTime}
and a.type like CONCAT(CONCAT('%', #{type}), '%')
order by a.id desc
select
b.name as materialName,
h.name as supplierName,
a.serial,
a.type,
c.user_name as userName,
a.department,
g.storage_location_name as storageLocationName,
a.scrq,
a.num
from tld_removal a
left join tld_material b on a.wllb_code = b.code
left join tld_user c on a.user_id = c.id
-- left join tld_department e on a.department = e.tld_id
left join tld_storage_location g on a.storage_location_code = g.storage_location_code
left join tld_customer h on a.supplier_id = h.code
and a.wllb_code = #{wllbCode}
and a.scrq =]]> #{startTime}
and a.scrq #{endTime}
and a.type like CONCAT(CONCAT('%', #{type}), '%')
order by a.id desc
select
id,
unique_code,
supplier_id,
serial,
wllb_code,
produc_date,
ask_goods_id,
type,
storage_location_code,
num,
user_id,
department
from tld_ask_goods_vitrual
where unique_code = #{uniqueCode} and type = #{type}
delete from tld_ask_goods_vitrual where id = #{id} and type = #{type}
update tld_ask_goods
set out_num = out_num + #{num} where material_id = #{materialId} and ask_goods_id = #{askGoodsId}
select if(AVG(num) is null, 0, num)
from tld_ask_goods_vitrual
where unique_code = #{uniqueCode} and ask_goods_id = #{askGoodsId}
SELECT
a.id,
a.material_id,
a.num,
a.production_code,
b.name as materialName,
b.code as materialCode,
a.out_num,
a.ask_goods_id,
e.name as department,
a.type
FROM
tld_ask_goods a
join tld_material b on a.material_id = b.tld_id
join tld_ask_goods_f c on a.ask_goods_id = c.ask_goods_id
left join tld_department e on c.department = e.tld_id
WHERE
(a.num + 0) ]]> (a.out_num + 0) and b.part_type = #{partType}
and a.production_code = #{productionCode}
and a.ask_goods_id = #{askGoodsId}
and a.id = #{id}
and a.type = #{type}
select
a.id,
a.wllb_code,
a.num,
a.user_id,
a.scrq,
a.ask_goods_id,
c.name as department,
b.name as materialName,
e.user_name as userName
from tld_removal_half_product a
left join tld_material b on a.wllb_code = b.code
left join tld_department c on a.department = c.tld_id
left join tld_user e on a.user_id = e.id
and a.wllb_code = #{wllbCode}
and a.scrq =]]> #{startTime}
and a.scrq #{endTime}
order by a.scrq desc
select
b.name as materialName,
a.num,
e.user_name as userName,
a.scrq,
a.ask_goods_id,
c.name as department
from tld_removal_half_product a
left join tld_material b on a.wllb_code = b.code
left join tld_department c on a.department = c.tld_id
left join tld_user e on a.user_id = e.id
and a.wllb_code = #{wllbCode}
and a.scrq =]]> #{startTime}
and a.scrq #{endTime}
order by a.scrq desc
select
a.id,
a.wllb_code,
a.num,
a.user_id,
a.scrq,
a.delivery_id,
a.company_number,
a.customer_code,
b.name as materialName,
c.user_name as userName,
e.name as customerName
from tld_removal_half a
left join tld_material b on a.wllb_code = b.code
left join tld_user c on a.user_id = c.id
left join tld_customer e on a.customer_code = e.code
and a.wllb_code = #{wllbCode}
and a.scrq =]]> #{startTime}
and a.scrq #{endTime}
order by a.scrq desc
select
b.name as materialName,
a.num,
c.user_name as userName
a.scrq,
a.company_number,
e.name
from tld_removal_half a
left join tld_material b on a.wllb_code = b.code
left join tld_user c on a.user_id = c.id
left join tld_customer e on a.customer_code = e.code
and a.wllb_code = #{wllbCode}
and a.scrq =]]> #{startTime}
and a.scrq #{endTime}
order by a.scrq desc