You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
798 lines
31 KiB
798 lines
31 KiB
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.spring.modules.part.mapper.PartInformationMapper">
|
|
|
|
<!-- 材料信息列表 -->
|
|
<select id="partInformationSearch" parameterType="com.spring.modules.part.vo.PartInformationVo" resultType="com.spring.modules.part.vo.PartInformationVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
part_desc,
|
|
spec,
|
|
part_type_db,
|
|
part_type,
|
|
family_id,
|
|
dbo.get_family_name(site, family_id) as familyName,
|
|
group_id,
|
|
dbo.get_group_name(site, group_id) as groupName,
|
|
um_id,
|
|
dbo.get_um_name(um_id) as umName,
|
|
weight_net,
|
|
uom_for_weight_net,
|
|
volume_net,
|
|
uom_for_volume_net,
|
|
lot_tracking_code,
|
|
active,
|
|
product_group_id1,
|
|
dbo.get_product_group_name(site, product_group_id1, '1') as productGroupName1,
|
|
product_group_id2,
|
|
dbo.get_product_group_name(site, product_group_id2, '2') as productGroupName2,
|
|
product_group_id3,
|
|
dbo.get_product_group_name(site, product_group_id3, '3') as productGroupName3,
|
|
product_group_id4,
|
|
dbo.get_product_group_name(site, product_group_id4, '4') as productGroupName4,
|
|
erp_part_no,
|
|
code_no,
|
|
dbo.get_code_desc(site, code_no, 'IP') as codeDesc,
|
|
manufacturer_id,
|
|
dbo.get_manufacturer_name(site, manufacturer_id) as manufacturerName,
|
|
agent_id,
|
|
dbo.split_agent_id(site, agent_id) as agentName,
|
|
type_designation,
|
|
hazard_code,
|
|
dbo.get_hazard_name(site, hazard_code) as hazardDesc,
|
|
asset_class,
|
|
dbo.get_assetClass_name(site, asset_class) as assetClassDesc,
|
|
dim_quality,
|
|
abc_class,
|
|
dbo.get_abcClass_name(site, abc_class) as abcClassDesc,
|
|
frequency_class,
|
|
lifecycle_stage,
|
|
country_of_origin,
|
|
dbo.get_country_of_origin_name(site, country_of_origin) as countryOfOriginDesc,
|
|
manufacturing_lead_time,
|
|
expected_lead_time,
|
|
region_of_origin,
|
|
dbo.get_region_of_origin_name(site, region_of_origin) as regionOfOriginDesc,
|
|
customs_star_no,
|
|
dbo.get_customs_star_name(site, customs_star_no) as customsStarDesc,
|
|
durability_day,
|
|
intrastat_conv_factor,
|
|
part_status,
|
|
dbo.get_part_status_name(site, part_status) as partStatusDesc,
|
|
configuration_id,
|
|
estimated_material_cost,
|
|
inventory_valuation_method,
|
|
part_cost_group_id,
|
|
dbo.get_part_cost_group_name(site, part_cost_group_id) as partCostGroupDesc,
|
|
inventory_part_cost_level,
|
|
invoice_consideration,
|
|
zero_cost_flag,
|
|
planning_method,
|
|
dbo.get_planning_method_name(site, planning_method) as planningMethodDesc,
|
|
safety_stock,
|
|
min_order_qty,
|
|
max_order_qty,
|
|
mul_order_qty,
|
|
safety_lead_time,
|
|
shrinkage_fac,
|
|
std_order_qty,
|
|
cum_lead_time,
|
|
back_flush_part,
|
|
by_prod_as_supply_in_mrp_db,
|
|
unprotected_lead_time,
|
|
issue_type,
|
|
mrp_control_flag_db,
|
|
fixed_lead_time_day,
|
|
over_reporting,
|
|
use_theoretical_density_db,
|
|
variable_lead_time_day,
|
|
over_report_tolerance,
|
|
fixed_lead_time_hour,
|
|
density,
|
|
variable_lead_time_hour,
|
|
remark,
|
|
status,
|
|
create_date,
|
|
create_by,
|
|
update_date,
|
|
update_by
|
|
FROM part
|
|
<where>
|
|
site = #{query.site}
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND part_no like #{query.partNo}
|
|
</if>
|
|
<if test = "query.erpPartNo != null and query.erpPartNo != ''">
|
|
AND erp_part_no like #{query.erpPartNo}
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND part_desc like #{query.partDesc}
|
|
</if>
|
|
<if test = "query.spec != null and query.spec != ''">
|
|
AND spec like #{query.spec}
|
|
</if>
|
|
<if test="query.startDate != null ">
|
|
AND required_completion_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null ">
|
|
AND #{query.endDate} >= required_completion_date
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 检查材料属性 -->
|
|
<select id="checkValueHeaderData" resultType="PartSubPropertiesValueHeaderData">
|
|
SELECT
|
|
PartNo,
|
|
Site,
|
|
CodeNo,
|
|
SubCodeSeqNo,
|
|
SubCodeDesc,
|
|
RecordType
|
|
from PartSubPropertiesValueHeader
|
|
where PartNo = #{partNo} and site = #{site} and CodeNo = #{codeNo} and RecordType = #{recordType}
|
|
</select>
|
|
|
|
<!-- 删除材料属性 -->
|
|
<delete id="deletePartSubPropertiesValueHeader">
|
|
delete from PartSubPropertiesValueHeader
|
|
where PartNo = #{partNo} and site = #{site} and RecordType = #{recordType}
|
|
</delete>
|
|
|
|
<!-- 删除材料属性值 -->
|
|
<delete id="deletePartSubPropertiesValue">
|
|
delete from PartSubPropertiesValue
|
|
where PartNo = #{partNo} and site = #{site} and RecordType = #{recordType}
|
|
</delete>
|
|
|
|
<!-- 新增材料属性 -->
|
|
<insert id="savePartSubPropertiesValueHeader">
|
|
insert into PartSubPropertiesValueHeader (PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc, RecordType)
|
|
select #{partNo}, #{site}, #{codeNo}, 1, Code_Desc, #{recordType} from plm_properties_model_header
|
|
where Code_No = #{codeNo} and site = #{site} and function_type = #{recordType}
|
|
</insert>
|
|
|
|
<!-- 新增材料属性值 -->
|
|
<insert id="savePartSubPropertiesValue">
|
|
insert into PartSubPropertiesValue (PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc, ItemNo, PropertiesItemNo, TextValue, NumValue, RecordType)
|
|
select
|
|
#{partNo},
|
|
#{site},
|
|
#{codeNo},
|
|
1,
|
|
a.Code_Desc,
|
|
b.seq_No,
|
|
b.properties_item_no,
|
|
case when c.ValueType_DB = 'T' then c.DefaultValue else null end,
|
|
case when c.ValueType_DB = 'N' and c.DefaultValue != '' then c.DefaultValue else null end,
|
|
#{recordType}
|
|
from plm_properties_model_header a
|
|
left join plm_properties_model_detail b on a.Code_No = b.Code_No and a.site = b.site and a.function_type = b.function_type
|
|
left join plm_properties_item c on b.properties_item_no = c.ItemNo and b.site = c.site and a.function_type = c.itemType
|
|
where a.Code_No = #{codeNo} and a.site = #{site} AND B.SITE IS NOT NULL AND A.function_type = #{recordType}
|
|
</insert>
|
|
|
|
<select id="getItemModal" resultType="PartSubPropertiesValueData">
|
|
SELECT
|
|
a.PartNo,
|
|
a.Site,
|
|
a.CodeNo,
|
|
a.SubCodeSeqNo,
|
|
a.SubCodeDesc,
|
|
a.ItemNo,
|
|
a.PropertiesItemNo,
|
|
a.TextValue,
|
|
a.NumValue,
|
|
a.RecordType,
|
|
b.ItemDesc as ItemDesc,
|
|
b.ValueType,
|
|
b.ValueType_DB,
|
|
b.ValueChooseFlag
|
|
FROM PartSubPropertiesValue as a
|
|
left join plm_properties_item as b on a.PropertiesItemNo = b.ItemNo and a.site = b.site and a.RecordType = b.ItemType
|
|
where a.site = #{site} and RecordType = #{recordType} and a.PartNo = #{partNo,jdbcType=VARCHAR}
|
|
</select>
|
|
|
|
<!-- 获取属性可选值 -->
|
|
<select id="getAvailableValueList" resultType="PlmPropertiesItemAvailableData">
|
|
select
|
|
ItemNo,
|
|
ValueNo,
|
|
AvailableValue
|
|
from plm_properties_item_available
|
|
where itemNo = #{propertiesItemNo} and site = #{site} and ItemType = #{recordType}
|
|
</select>
|
|
|
|
<!-- 编辑属性值 -->
|
|
<update id="savePartItemValue" >
|
|
update PartSubPropertiesValue
|
|
set TextValue = #{textValue},
|
|
NumValue = #{numValue, jdbcType=DOUBLE}
|
|
where PropertiesItemNo = #{propertiesItemNo} and site = #{site} and PartNo = #{partNo} and RecordType = #{recordType}
|
|
</update>
|
|
|
|
<!-- 查询代理商列表 -->
|
|
<select id="getAgentList" resultType="AgentInformationEntity" parameterType="AgentInformationEntity">
|
|
SELECT
|
|
site,
|
|
agent_id,
|
|
agent_name
|
|
FROM agent
|
|
<where>
|
|
site = #{site}
|
|
<if test = "agentId != null and agentId != ''">
|
|
AND agent_id LIKE #{agentId}
|
|
</if>
|
|
<if test = "agentName != null and agentName != ''">
|
|
AND agent_name LIKE #{deptName}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查询代理商列表 -->
|
|
<select id="getPartAgent" resultType="com.spring.modules.part.vo.AgentInformationVo" parameterType="com.spring.modules.part.vo.AgentInformationVo">
|
|
SELECT
|
|
a.site,
|
|
a.part_no,
|
|
a.agent_id,
|
|
b.agent_name,
|
|
b.active,
|
|
b.create_date,
|
|
b.create_by,
|
|
b.update_date,
|
|
b.update_by
|
|
FROM part_agent as a
|
|
left join agent as b on a.site = b.site and a.agent_id = b.agent_id
|
|
where a.site = #{site} and a.part_no = #{partNo}
|
|
</select>
|
|
|
|
<!-- 获取当前物料不包含的代理商 -->
|
|
<select id="getAgentList1" resultType="AgentInformationEntity" parameterType="PartInformationEntity">
|
|
SELECT
|
|
a.site,
|
|
a.agent_id,
|
|
a.agent_name,
|
|
a.active,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by
|
|
FROM agent as a
|
|
left join part_agent as b on a.site = b.site and a.agent_id = b.agent_id and b.part_no = #{partNo}
|
|
where a.site = #{site} and b.part_no is null
|
|
</select>
|
|
|
|
<!-- 获取当前物料所包含的代理商 -->
|
|
<select id="getAgentList2" resultType="AgentInformationEntity" parameterType="PartInformationEntity">
|
|
SELECT
|
|
a.site,
|
|
a.agent_id,
|
|
b.agent_name,
|
|
b.active,
|
|
b.create_date,
|
|
b.create_by,
|
|
b.update_date,
|
|
b.update_by
|
|
FROM part_agent a
|
|
LEFT JOIN agent b ON a.agent_id = b.agent_id and a.site = b.site
|
|
WHERE a.part_no = #{partNo} and a.site = #{site}
|
|
</select>
|
|
|
|
<!-- 获取当前物料所包含的代理商 -->
|
|
<select id="selectAgentByPartNo" resultType="com.spring.modules.part.vo.AgentInformationVo" parameterType="com.spring.modules.part.vo.AgentInformationVo">
|
|
SELECT
|
|
site,
|
|
agent_id
|
|
FROM part_agent
|
|
WHERE part_no = #{partNo} and site = #{site} and agent_id = #{agentId}
|
|
</select>
|
|
|
|
<!-- 新增物料代理商 -->
|
|
<insert id="addPartAgent" parameterType="com.spring.modules.part.vo.AgentInformationVo">
|
|
insert into part_agent (site, part_no, agent_id)
|
|
values (#{site}, #{partNo}, #{agentId})
|
|
</insert>
|
|
|
|
<!-- 删除物料代理商 -->
|
|
<delete id="deletePartAgent" parameterType="com.spring.modules.part.vo.AgentInformationVo">
|
|
delete from part_agent
|
|
where part_no = #{partNo} and site = #{site} and agent_id = #{agentId}
|
|
</delete>
|
|
|
|
<!-- 获取当前物料不包含的代理商 -->
|
|
<select id="getAgentListBy" resultType="AgentInformationEntity" parameterType="com.spring.modules.part.vo.AgentInformationVo">
|
|
SELECT
|
|
a.site,
|
|
a.agent_id,
|
|
a.agent_name,
|
|
a.active,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by
|
|
FROM agent as a
|
|
left join part_agent as b on a.site = b.site and a.agent_id = b.agent_id and b.part_no = #{partNo}
|
|
<where>
|
|
a.site = #{site} and b.part_no is null
|
|
<if test = "agentId != null and agentId != ''">
|
|
AND a.agent_id LIKE #{agentId}
|
|
</if>
|
|
<if test = "agentName != null and agentName != ''">
|
|
AND a.agent_name LIKE #{agentName}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 删除物料代理商 -->
|
|
<delete id="deleteAgent" parameterType="com.spring.modules.part.vo.AgentInformationVo">
|
|
delete from part_agent
|
|
where part_no = #{partNo} and site = #{site} and agent_id = #{agentId}
|
|
</delete>
|
|
|
|
<!-- 查询制造商列表 -->
|
|
<select id="getManufacturerList" resultType="ManufacturerInformationEntity" parameterType="ManufacturerInformationEntity">
|
|
SELECT
|
|
site,
|
|
manufacturer_id,
|
|
manufacturer_name
|
|
FROM manufacturer
|
|
<where>
|
|
site = #{site}
|
|
<if test = "manufacturerId != null and manufacturerId != ''">
|
|
AND manufacturer_id LIKE #{manufacturerId}
|
|
</if>
|
|
<if test = "manufacturerName != null and manufacturerName != ''">
|
|
AND manufacturer_name LIKE #{manufacturerName}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查询制造商列表 -->
|
|
<select id="getPartManufacturer" resultType="com.spring.modules.part.vo.ManufacturerInformationVo" parameterType="com.spring.modules.part.vo.ManufacturerInformationVo">
|
|
SELECT
|
|
a.site,
|
|
a.part_no,
|
|
a.manufacturer_id,
|
|
b.manufacturer_name,
|
|
b.active,
|
|
b.create_date,
|
|
b.create_by,
|
|
b.update_date,
|
|
b.update_by
|
|
FROM part_manufacturer as a
|
|
left join manufacturer as b on a.site = b.site and a.manufacturer_id = b.manufacturer_id
|
|
where a.site = #{site} and a.part_no = #{partNo}
|
|
</select>
|
|
|
|
<!-- 获取当前物料不包含的制造商 -->
|
|
<select id="getManufacturerList1" resultType="ManufacturerInformationEntity" parameterType="PartInformationEntity">
|
|
SELECT
|
|
a.site,
|
|
a.manufacturer_id,
|
|
a.manufacturer_name,
|
|
a.active,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by
|
|
FROM manufacturer as a
|
|
left join part_manufacturer as b on a.site = b.site and a.manufacturer_id = b.manufacturer_id and b.part_no = #{partNo}
|
|
where a.site = #{site} and b.part_no is null
|
|
</select>
|
|
|
|
<!-- 获取当前物料所包含的制造商 -->
|
|
<select id="getManufacturerList2" resultType="ManufacturerInformationEntity" parameterType="PartInformationEntity">
|
|
SELECT
|
|
a.site,
|
|
a.manufacturer_id,
|
|
b.manufacturer_name,
|
|
b.active,
|
|
b.create_date,
|
|
b.create_by,
|
|
b.update_date,
|
|
b.update_by
|
|
FROM part_manufacturer a
|
|
LEFT JOIN manufacturer b ON a.manufacturer_id = b.manufacturer_id and a.site = b.site
|
|
WHERE a.part_no = #{partNo} and a.site = #{site}
|
|
</select>
|
|
|
|
<!-- 获取当前物料所包含的制造商 -->
|
|
<select id="selectManufacturerByPartNo" resultType="com.spring.modules.part.vo.ManufacturerInformationVo" parameterType="com.spring.modules.part.vo.ManufacturerInformationVo">
|
|
SELECT
|
|
site,
|
|
manufacturer_id
|
|
FROM part_manufacturer
|
|
WHERE part_no = #{partNo} and site = #{site} and manufacturer_id = #{manufacturerId}
|
|
</select>
|
|
|
|
<!-- 新增物料制造商 -->
|
|
<insert id="addPartManufacturer" parameterType="com.spring.modules.part.vo.ManufacturerInformationVo">
|
|
insert into part_manufacturer (site, part_no, manufacturer_id)
|
|
values (#{site}, #{partNo}, #{manufacturerId})
|
|
</insert>
|
|
|
|
<!-- 删除物料制造商 -->
|
|
<delete id="deletePartManufacturer" parameterType="com.spring.modules.part.vo.ManufacturerInformationVo">
|
|
delete from part_manufacturer
|
|
where part_no = #{partNo} and site = #{site} and manufacturer_id = #{manufacturerId}
|
|
</delete>
|
|
|
|
<!-- 删除物料制造商 -->
|
|
<delete id="deleteManufacturer">
|
|
delete from part_manufacturer
|
|
where part_no = #{partNo} and site = #{site} and manufacturer_id = #{manufacturerId}
|
|
</delete>
|
|
|
|
<!-- 获取当前物料不包含的制造商 -->
|
|
<select id="getManufacturerListBy" resultType="ManufacturerInformationEntity" parameterType="com.spring.modules.part.vo.ManufacturerInformationVo">
|
|
SELECT
|
|
a.site,
|
|
a.manufacturer_id,
|
|
a.manufacturer_name,
|
|
a.active,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by
|
|
FROM manufacturer as a
|
|
left join part_manufacturer as b on a.site = b.site and a.manufacturer_id = b.manufacturer_id and b.part_no = #{partNo}
|
|
<where>
|
|
a.site = #{site} and b.part_no is null
|
|
<if test = "manufacturerId != null and manufacturerId != ''">
|
|
AND a.manufacturer_id LIKE #{manufacturerId}
|
|
</if>
|
|
<if test = "manufacturerName != null and manufacturerName != ''">
|
|
AND a.manufacturer_name LIKE #{manufacturerName}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 修改IQC明细记录信息 -->
|
|
<update id="commitItemValue" parameterType="PartSubPropertiesValueData">
|
|
UPDATE PartSubPropertiesValue
|
|
SET TextValue = #{textValue},
|
|
NumValue = #{numValue,jdbcType=DECIMAL}
|
|
WHERE PartNo = #{partNo} and Site = #{site} and CodeNo = #{codeNo} and SubCodeSeqNo = #{subCodeSeqNo} and ItemNo = #{itemNo} and RecordType = #{recordType}
|
|
</update>
|
|
|
|
<!-- 删除属性值 -->
|
|
<delete id="deleteItem" parameterType="PartSubPropertiesValueData">
|
|
delete from PartSubPropertiesValue
|
|
where PartNo = #{partNo} and site = #{site} and RecordType = #{recordType} and CodeNo = #{codeNo} and SubCodeSeqNo = #{subCodeSeqNo} and ItemNo = #{itemNo}
|
|
</delete>
|
|
|
|
<select id="getItemLists" resultType="PlmPropertiesItemData" parameterType="PartSubPropertiesValueData">
|
|
SELECT
|
|
a.itemNo as itNo,
|
|
a.ItemDesc
|
|
FROM plm_properties_item a
|
|
LEFT JOIN PartSubPropertiesValue b on b.recordType = #{recordType} and b.codeNo = #{codeNo} and b.PartNo = #{partNo} and b.PropertiesItemNo = a.ItemNo and a.site = b.site
|
|
<where>
|
|
a.ItemType = #{recordType}
|
|
and a.site = #{site}
|
|
AND b.codeNo is null
|
|
<if test = "propertiesItemNo != null and propertiesItemNo != ''">
|
|
AND a.ItemNo LIKE #{propertiesItemNo}
|
|
</if>
|
|
<if test = "itemDesc != null and itemDesc != ''">
|
|
AND a.ItemDesc LIKE #{itemDesc}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getModelItemLists" resultType="PlmPropertiesItemData" parameterType="PartSubPropertiesValueData">
|
|
select
|
|
a.PropertiesItemNo as itNo,
|
|
b.ItemDesc,
|
|
a.ItemNo,
|
|
a.PartNo,
|
|
a.Site,
|
|
a.CodeNo,
|
|
a.SubCodeSeqNo,
|
|
a.recordType
|
|
from PartSubPropertiesValue a
|
|
left join plm_properties_item b on a.PropertiesItemNo = b.ItemNo and a.recordType = b.ItemType and a.site = b.site
|
|
where a.codeNo = #{codeNo} and a.recordType = #{recordType} and a.site = #{site} and a.PartNo = #{partNo}
|
|
</select>
|
|
|
|
<select id="checkPartItem" resultType="PartSubPropertiesValueData" parameterType="PartSubPropertiesValueData">
|
|
select
|
|
site,
|
|
PartNo,
|
|
CodeNo,
|
|
SubCodeSeqNo,
|
|
itemNo,
|
|
PropertiesItemNo,
|
|
RecordType
|
|
from PartSubPropertiesValue
|
|
where codeNo = #{codeNo} and recordType = #{recordType} and site = #{site} and PartNo = #{partNo} and PropertiesItemNo = #{itNo}
|
|
</select>
|
|
|
|
<select id="checkItem" resultType="PartSubPropertiesValueData" parameterType="PartSubPropertiesValueData">
|
|
SELECT
|
|
ItemDesc
|
|
FROM plm_properties_item
|
|
where itemType = #{recordType} and itemNo = #{itNo} and site = #{site}
|
|
</select>
|
|
|
|
<select id="getModalDetailSeqNo" resultType="double" parameterType="PartSubPropertiesValueData">
|
|
SELECT
|
|
isnull(max(itemNo),0) + 1
|
|
from PartSubPropertiesValue
|
|
where RecordType = #{recordType} and CodeNo = #{codeNo} and site = #{site} and PartNo = #{partNo} and SubCodeSeqNo = #{subCodeSeqNo}
|
|
</select>
|
|
|
|
<insert id="addPartItem" parameterType="PartSubPropertiesValueData">
|
|
insert into PartSubPropertiesValue
|
|
(PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc, ItemNo, PropertiesItemNo, TextValue, NumValue, RecordType)
|
|
values (#{partNo}, #{site}, #{codeNo}, #{subCodeSeqNo,jdbcType=FLOAT}, #{codeDesc}, #{itemNo, jdbcType=FLOAT}, #{itNo}, #{textValue}, #{numValue, jdbcType=FLOAT}, #{recordType})
|
|
</insert>
|
|
|
|
<delete id="deletePartItem" parameterType="PartSubPropertiesValueData">
|
|
delete from PartSubPropertiesValue
|
|
where PartNo = #{partNo} and site = #{site} and RecordType = #{recordType} and CodeNo = #{codeNo} and SubCodeSeqNo = #{subCodeSeqNo} and ItemNo = #{itemNo}
|
|
</delete>
|
|
|
|
<select id="queryCodeNo" parameterType="com.spring.modules.part.vo.MasterPartInformationVo" resultType="PartSubPropertiesValueData">
|
|
SELECT
|
|
PartNo,
|
|
Site,
|
|
CodeNo,
|
|
SubCodeSeqNo,
|
|
SubCodeDesc,
|
|
RecordType
|
|
FROM PartSubPropertiesValueHeader
|
|
where PartNo = #{partNo} and Site = #{site} and SubCodeSeqNo = 1 and RecordType = 'IP'
|
|
</select>
|
|
|
|
<!-- 获取当前物料不包含的库位 -->
|
|
<select id="getLocationList1" resultType="LocationInformationEntity" parameterType="PartInformationEntity">
|
|
SELECT
|
|
a.site,
|
|
a.location_id,
|
|
a.location_name,
|
|
a.warehouse_id,
|
|
a.active,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by
|
|
FROM plm_location as a
|
|
left join plm_part_location as b on a.site = b.site and a.location_id = b.location_id and b.part_no = #{partNo}
|
|
where a.site = #{site} and b.part_no is null
|
|
</select>
|
|
|
|
<!-- 获取当前物料所包含的库位 -->
|
|
<select id="getLocationList2" resultType="LocationInformationEntity" parameterType="PartInformationEntity">
|
|
SELECT
|
|
a.site,
|
|
a.location_id,
|
|
b.location_name,
|
|
b.warehouse_id,
|
|
b.active,
|
|
b.create_date,
|
|
b.create_by,
|
|
b.update_date,
|
|
b.update_by
|
|
FROM plm_part_location a
|
|
LEFT JOIN plm_location b ON a.location_id = b.location_id and a.site = b.site
|
|
WHERE a.part_no = #{partNo} and a.site = #{site}
|
|
</select>
|
|
|
|
<!-- 获取当前物料不包含的库位 -->
|
|
<select id="getLocationListBy" resultType="LocationInformationEntity" parameterType="com.spring.modules.part.vo.LocationInformationVo">
|
|
SELECT
|
|
a.site,
|
|
a.location_id,
|
|
a.location_name,
|
|
a.warehouse_id,
|
|
a.active,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by
|
|
FROM plm_location as a
|
|
left join plm_part_location as b on a.site = b.site and a.location_id = b.location_id and b.part_no = #{partNo}
|
|
<where>
|
|
a.site = #{site} and b.part_no is null
|
|
<if test = "locationId != null and locationId != ''">
|
|
AND a.location_id LIKE #{locationId}
|
|
</if>
|
|
<if test = "locationName != null and locationName != ''">
|
|
AND a.location_name LIKE #{locationName}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查询库位列表 -->
|
|
<select id="getDefaultLocation" resultType="com.spring.modules.part.vo.LocationInformationVo" parameterType="com.spring.modules.part.vo.LocationInformationVo">
|
|
SELECT
|
|
a.site,
|
|
a.part_no,
|
|
a.location_id,
|
|
b.location_name,
|
|
b.warehouse_id,
|
|
b.active,
|
|
b.create_date,
|
|
b.create_by,
|
|
b.update_date,
|
|
b.update_by
|
|
FROM plm_part_location as a
|
|
left join plm_location as b on a.site = b.site and a.location_id = b.location_id
|
|
where a.site = #{site} and a.part_no = #{partNo}
|
|
</select>
|
|
|
|
<!-- 获取当前物料所包含的库位 -->
|
|
<select id="selectLocationByPartNo" resultType="com.spring.modules.part.vo.LocationInformationVo" parameterType="com.spring.modules.part.vo.LocationInformationVo">
|
|
SELECT
|
|
site,
|
|
location_id
|
|
FROM plm_part_location
|
|
WHERE part_no = #{partNo} and site = #{site} and location_id = #{locationId}
|
|
</select>
|
|
|
|
<!-- 新增物料库位 -->
|
|
<insert id="addDefaultLocation" parameterType="com.spring.modules.part.vo.LocationInformationVo">
|
|
insert into plm_part_location (site, part_no, location_id)
|
|
values (#{site}, #{partNo}, #{locationId})
|
|
</insert>
|
|
|
|
<!-- 删除物料库位 -->
|
|
<delete id="deleteDefaultLocation" parameterType="com.spring.modules.part.vo.LocationInformationVo">
|
|
delete from plm_part_location
|
|
where part_no = #{partNo} and site = #{site} and location_id = #{locationId}
|
|
</delete>
|
|
|
|
<!-- 删除代理商 -->
|
|
<delete id="deleteAgentByPartNo" parameterType="PartInformationEntity">
|
|
delete from part_agent
|
|
where part_no = #{partNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 删除制造商商 -->
|
|
<delete id="deleteManufacturerByPartNo" parameterType="PartInformationEntity">
|
|
delete from part_manufacturer
|
|
where part_no = #{partNo} and site = #{site}
|
|
</delete>
|
|
|
|
<!-- 删除代理商 -->
|
|
<delete id="deleteLocationByPartNo" parameterType="PartInformationEntity">
|
|
delete from plm_part_location
|
|
where part_no = #{partNo} and site = #{site}
|
|
</delete>
|
|
|
|
|
|
<select id="partAllInfoSearch" parameterType="com.spring.modules.part.vo.PartInformationVo" resultType="com.spring.modules.part.vo.PartInformationVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
part_desc,
|
|
spec,
|
|
part_type_db,
|
|
part_type,
|
|
family_id,
|
|
dbo.get_family_name(site, family_id) as familyName,
|
|
group_id,
|
|
dbo.get_group_name(site, group_id) as groupName,
|
|
um_id,
|
|
dbo.get_um_name(site, um_id) as umName,
|
|
weight_net,
|
|
uom_for_weight_net,
|
|
volume_net,
|
|
uom_for_volume_net,
|
|
lot_tracking_code,
|
|
active,
|
|
product_group_id1,
|
|
dbo.get_product_group_name(site, product_group_id1, '1') as productGroupName1,
|
|
product_group_id2,
|
|
dbo.get_product_group_name(site, product_group_id2, '2') as productGroupName2,
|
|
product_group_id3,
|
|
dbo.get_product_group_name(site, product_group_id3, '3') as productGroupName3,
|
|
product_group_id4,
|
|
dbo.get_product_group_name(site, product_group_id4, '4') as productGroupName4,
|
|
erp_part_no,
|
|
code_no,
|
|
dbo.get_code_desc(site, code_no, 'IP') as codeDesc,
|
|
manufacturer_id,
|
|
dbo.get_manufacturer_name(site, manufacturer_id) as manufacturerName,
|
|
agent_id,
|
|
dbo.split_agent_id(site, agent_id) as agentName,
|
|
type_designation,
|
|
hazard_code,
|
|
dbo.get_hazard_name(site, hazard_code) as hazardDesc,
|
|
asset_class,
|
|
dbo.get_assetClass_name(site, asset_class) as assetClassDesc,
|
|
dim_quality,
|
|
abc_class,
|
|
dbo.get_abcClass_name(site, abc_class) as abcClassDesc,
|
|
frequency_class,
|
|
lifecycle_stage,
|
|
country_of_origin,
|
|
dbo.get_country_of_origin_name(site, country_of_origin) as countryOfOriginDesc,
|
|
manufacturing_lead_time,
|
|
expected_lead_time,
|
|
region_of_origin,
|
|
dbo.get_region_of_origin_name(site, region_of_origin) as regionOfOriginDesc,
|
|
customs_star_no,
|
|
dbo.get_customs_star_name(site, customs_star_no) as customsStarDesc,
|
|
durability_day,
|
|
intrastat_conv_factor,
|
|
part_status,
|
|
dbo.get_part_status_name(site, part_status) as partStatusDesc,
|
|
configuration_id,
|
|
estimated_material_cost,
|
|
inventory_valuation_method,
|
|
part_cost_group_id,
|
|
dbo.get_part_cost_group_name(site, part_cost_group_id) as partCostGroupDesc,
|
|
inventory_part_cost_level,
|
|
invoice_consideration,
|
|
zero_cost_flag,
|
|
planning_method,
|
|
dbo.get_planning_method_name(site, planning_method) as planningMethodDesc,
|
|
safety_stock,
|
|
min_order_qty,
|
|
max_order_qty,
|
|
mul_order_qty,
|
|
safety_lead_time,
|
|
shrinkage_fac,
|
|
std_order_qty,
|
|
cum_lead_time,
|
|
back_flush_part,
|
|
by_prod_as_supply_in_mrp_db,
|
|
unprotected_lead_time,
|
|
issue_type,
|
|
mrp_control_flag_db,
|
|
fixed_lead_time_day,
|
|
over_reporting,
|
|
use_theoretical_density_db,
|
|
variable_lead_time_day,
|
|
over_report_tolerance,
|
|
fixed_lead_time_hour,
|
|
density,
|
|
variable_lead_time_hour,
|
|
create_date,
|
|
create_by,
|
|
update_date,
|
|
update_by
|
|
FROM part
|
|
<where>
|
|
site = #{query.site}
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND part_no like #{query.partNo}
|
|
</if>
|
|
<if test = "query.erpPartNo != null and query.erpPartNo != ''">
|
|
AND erp_part_no like #{query.erpPartNo}
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND part_desc like #{query.partDesc}
|
|
</if>
|
|
<if test = "query.spec != null and query.spec != ''">
|
|
AND spec like #{query.spec}
|
|
</if>
|
|
<if test="query.startDate != null ">
|
|
AND required_completion_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null ">
|
|
AND #{query.endDate} >= required_completion_date
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
|
|
<!-- 根据物料编码查 masterPart 属性 -->
|
|
<select id="queryMasterField" resultType="com.spring.modules.part.vo.MasterPartInformationVo" parameterType="PartInformationEntity">
|
|
SELECT
|
|
part_no,
|
|
part_desc,
|
|
weight_net,
|
|
uom_for_weight_net,
|
|
volume_net,
|
|
uom_for_volume_net,
|
|
um_id,
|
|
dbo.get_um_name(um_id) as umName
|
|
FROM part_catalog
|
|
WHERE part_no = #{partNo}
|
|
</select>
|
|
</mapper>
|