Browse Source

2024-10-11

master
qiezi 1 year ago
parent
commit
087054e3bd
  1. 3
      src/main/java/com/spring/modules/base/dao/PropertiesMapper.java
  2. 9
      src/main/java/com/spring/modules/proofing/service/impl/ProofingInformationServiceImpl.java
  3. 562
      src/main/resources/mapper/base/PropertiesMapper.xml

3
src/main/java/com/spring/modules/base/dao/PropertiesMapper.java

@ -411,6 +411,9 @@ public interface PropertiesMapper extends BaseMapper<PlmPropertiesItemData> {
void saveSubPropertiesValue(PartSubPropertiesValueData inData);
void saveSubPropertiesValueHeader(PartSubPropertiesValueData inData);
void removeSubPropertiesValue(PartSubPropertiesValueData inData);
void removeSubPropertiesValueHeader(PartSubPropertiesValueData inData);
List<PlmPropertiesItemData> getItemListsForPartAndCode(PlmPropertiesModelHeaderData inData);
List<PlmPropertiesItemData> searchPropertiesUnChoose(@Param("site")String site,

9
src/main/java/com/spring/modules/proofing/service/impl/ProofingInformationServiceImpl.java

@ -212,6 +212,15 @@ public class ProofingInformationServiceImpl extends ServiceImpl<ProofingInformat
.remove();
// 删除打样相关文件
sysOssDao.deleteByMap(map2);
PartSubPropertiesValueData propertiesData=new PartSubPropertiesValueData();
propertiesData.setSite(data.getSite());
propertiesData.setPartNo(data.getProofingNo());
propertiesData.setCodeNo("Proofing");
propertiesData.setRecordType("order");
propertiesMapper.removeSubPropertiesValueHeader(propertiesData);
propertiesMapper.removeSubPropertiesValue(propertiesData);
}
}

562
src/main/resources/mapper/base/PropertiesMapper.xml

@ -1,7 +1,6 @@
<?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.base.dao.PropertiesMapper">
<!-- 查询点检项目 -->
<select id="plmPropertiesItemSearch" parameterType="PlmPropertiesItemData" resultType="PlmPropertiesItemData">
SELECT ppi.site,
@ -37,30 +36,49 @@
</select>
<select id="checkPlmPropertiesItem" resultType="PlmPropertiesItemData">
SELECT ItemNo,ItemDesc FROM plm_properties_item WHERE ItemNo = #{itemNo} and ItemType = #{itemType} and site = #{site}
SELECT ItemNo, ItemDesc
FROM plm_properties_item
WHERE ItemNo = #{itemNo}
and ItemType = #{itemType}
and site = #{site}
</select>
<insert id="saveNewPlmPropertiesItem">
Insert into plm_properties_item (site,ItemNo,ItemDesc,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,CreatedDate
,CreatedBy,MaxValue,MinValue,ItemType) values
(#{site},#{itemNo},#{itemDesc},#{defaultValue},#{valueType},#{valueTypeDb},#{valueChooseFlag},GetDate(),
Insert into plm_properties_item ( site, ItemNo, ItemDesc, DefaultValue, ValueType, ValueType_DB, ValueChooseFlag
, CreatedDate
, CreatedBy, MaxValue, MinValue, ItemType)
values (#{site}, #{itemNo}, #{itemDesc}, #{defaultValue}, #{valueType}, #{valueTypeDb}, #{valueChooseFlag},
GetDate(),
#{createdBy}, #{maxValue,jdbcType=DOUBLE}, #{minValue,jdbcType=DOUBLE}, #{itemType})
</insert>
<update id="plmPropertiesItemEdit">
update plm_properties_item
set ItemDesc=#{itemDesc},DefaultValue=#{defaultValue},ValueType=#{valueType},ValueType_DB=#{valueTypeDb},
ValueChooseFlag=#{valueChooseFlag},update_date=GetDate()
,update_by=#{updateBy},MaxValue=#{maxValue,jdbcType=DOUBLE},MinValue=#{minValue,jdbcType=DOUBLE},ItemType=#{itemType}
WHERE ItemNo = #{itemNo} and ItemType = #{itemType} and site = #{site}
set ItemDesc=#{itemDesc},
DefaultValue=#{defaultValue},
ValueType=#{valueType},
ValueType_DB=#{valueTypeDb},
ValueChooseFlag=#{valueChooseFlag},
update_date=GetDate()
,
update_by=#{updateBy},
MaxValue=#{maxValue,jdbcType=DOUBLE},
MinValue=#{minValue,jdbcType=DOUBLE},
ItemType=#{itemType}
WHERE ItemNo = #{itemNo}
and ItemType = #{itemType}
and site = #{site}
</update>
<delete id="propertiesItemDelete">
Delete FROM plm_properties_item WHERE ItemNo = #{itemNo} and ItemType = #{itemType} and site = #{site}
Delete
FROM plm_properties_item
WHERE ItemNo = #{itemNo}
and ItemType = #{itemType}
and site = #{site}
</delete>
<select id="searchItemAvailable" resultType="PlmPropertiesItemAvailableData">
SELECT
site,
SELECT site,
ItemNo,
ValueNo,
AvailableValue,
@ -68,28 +86,46 @@
CreatedBy,
ItemType
from plm_properties_item_available
where itemNo = #{itemNo} and ItemType = #{itemType} and site = #{site}
where itemNo = #{itemNo}
and ItemType = #{itemType}
and site = #{site}
</select>
<select id="getItemValueNo" resultType="Double">
SELECT isnull( max(valueNo),0)+1 from plm_properties_item_available where itemNo = #{itemNo} and ItemType = #{itemType} and site = #{site}
SELECT isnull(max(valueNo), 0) + 1
from plm_properties_item_available
where itemNo = #{itemNo}
and ItemType = #{itemType}
and site = #{site}
</select>
<insert id="saveItemAvailable">
insert into plm_properties_item_available (ItemNo,ValueNo,AvailableValue,CreatedDate,CreatedBy,ItemType,site)
insert into plm_properties_item_available (ItemNo, ValueNo, AvailableValue, CreatedDate, CreatedBy, ItemType,
site)
values (#{itemNo}, #{valueNo}, #{availableValue}, GetDate(), #{createdBy}, #{itemType}, #{site})
</insert>
<update id="updateItemAvailable">
update plm_properties_item_available set AvailableValue = #{availableValue} where itemNo = #{itemNo} and ItemType = #{itemType} and ValueNo = #{valueNo} and site = #{site}
update plm_properties_item_available
set AvailableValue = #{availableValue}
where itemNo = #{itemNo}
and ItemType = #{itemType}
and ValueNo = #{valueNo}
and site = #{site}
</update>
<delete id="deleteItemAvailable">
delete from plm_properties_item_available where itemNo = #{itemNo} and ItemType = #{itemType} and ValueNo = #{valueNo} and site = #{site}
delete
from plm_properties_item_available
where itemNo = #{itemNo}
and ItemType = #{itemType}
and ValueNo = #{valueNo}
and site = #{site}
</delete>
<select id="plmPropertiesModelSearch" parameterType="PlmPropertiesModelHeaderData" resultType="PlmPropertiesModelHeaderData">
<select id="plmPropertiesModelSearch" parameterType="PlmPropertiesModelHeaderData"
resultType="PlmPropertiesModelHeaderData">
SELECT pmh.site,
pmh.function_type,
pmh.code_no,
@ -112,7 +148,8 @@
left join properties_bu bu
on bu.site = pmh.site and bu.function_type = pmh.function_type and bu.code_no = pmh.code_no
left join properties_type pt on pt.function_type = pmh.function_type
left join properties_relationship pr on pr.function_group = pmh.function_group and pr.function_type = pmh.function_type
left join properties_relationship pr
on pr.function_group = pmh.function_group and pr.function_type = pmh.function_type
<where>
pmh.site = #{query.site}
<if test="query.codeNo != null and query.codeNo != ''">
@ -144,8 +181,10 @@
<insert id="plmPropertiesModelSave">
insert into plm_properties_model_header
(function_type, code_no, code_desc, active, created_date, created_by, delflag, version, update_date, update_by,site,function_group)
values(#{functionType}, #{codeNo}, #{codeDesc}, #{active}, GetDate(), #{userId}, 'N', 0, getDate(), #{updateBy},#{site},#{functionGroup})
(function_type, code_no, code_desc, active, created_date, created_by, delflag, version, update_date, update_by,
site, function_group)
values (#{functionType}, #{codeNo}, #{codeDesc}, #{active}, GetDate(), #{userId}, 'N', 0, getDate(),
#{updateBy}, #{site}, #{functionGroup})
</insert>
<update id="plmPropertiesModelEdit">
@ -162,8 +201,7 @@
</update>
<select id="checkPropertiesModel" resultType="PlmPropertiesModelHeaderData">
SELECT
function_type,
SELECT function_type,
code_no,
code_desc,
active,
@ -174,16 +212,21 @@
delflag,
version
FROM plm_properties_model_header
where function_type = #{functionType} and code_no = #{codeNo} and site = #{site}
where function_type = #{functionType}
and code_no = #{codeNo}
and site = #{site}
</select>
<delete id="plmPropertiesModelDelete">
delete from plm_properties_model_header where function_type = #{functionType} and code_no = #{codeNo} and site = #{site}
delete
from plm_properties_model_header
where function_type = #{functionType}
and code_no = #{codeNo}
and site = #{site}
</delete>
<select id="searchModalDetails" resultType="PlmPropertiesModelDetailData">
SELECT
a.site,
SELECT a.site,
a.function_type,
a.code_no,
a.properties_item_no itemNo,
@ -195,16 +238,19 @@
b.ValueChooseFlag,
b.MaxValue,
b.MinValue,
b.ItemType,order_id
b.ItemType,
order_id
FROM plm_properties_model_detail a
left join plm_properties_item b on a.function_type = b.itemType and a.properties_item_no = b.itemNo and a.site = b.site
where a.function_type = #{functionType} and a.code_no = #{codeNo} and a.site = #{site}
left join plm_properties_item b
on a.function_type = b.itemType and a.properties_item_no = b.itemNo and a.site = b.site
where a.function_type = #{functionType}
and a.code_no = #{codeNo}
and a.site = #{site}
order by order_id
</select>
<select id="checkItem" resultType="PlmPropertiesModelDetailData">
SELECT
ItemDesc
SELECT ItemDesc
FROM plm_properties_item
where itemType = #{functionType}
and itemNo = #{itemNo}
@ -212,8 +258,7 @@
</select>
<select id="checkModalDetails" resultType="PlmPropertiesModelDetailData">
SELECT
function_type,
SELECT function_type,
code_no,
properties_item_no itemNo,
seq_no
@ -225,10 +270,11 @@
</select>
<select id="getModalDetailSeqNo" resultType="Integer">
SELECT
isnull(max(seq_no),0) + 1
SELECT isnull(max(seq_no), 0) + 1
from plm_properties_model_detail
where function_type = #{functionType} and code_no = #{codeNo} and site = #{site}
where function_type = #{functionType}
and code_no = #{codeNo}
and site = #{site}
</select>
<insert id="saveModalDetails">
@ -239,7 +285,8 @@
<delete id="deleteModalDetails">
delete from plm_properties_model_detail
delete
from plm_properties_model_detail
where function_type = #{functionType}
and code_no = #{codeNo}
and properties_item_no = #{itemNo}
@ -247,11 +294,12 @@
</delete>
<select id="getItemLists" resultType="PlmPropertiesItemData">
SELECT
a.itemNo,
SELECT a.itemNo,
a.ItemDesc
FROM plm_properties_item a
LEFT JOIN plm_properties_model_detail b on b.function_type = #{functionType} and b.code_no = #{codeNo} and b.properties_item_no = a.ItemNo and a.site = b.site
LEFT JOIN plm_properties_model_detail b
on b.function_type = #{functionType} and b.code_no = #{codeNo} and
b.properties_item_no = a.ItemNo and a.site = b.site
<where>
a.ItemType = #{functionType}
and a.site = #{site}
@ -266,11 +314,11 @@
</select>
<select id="getModelItemLists" resultType="PlmPropertiesItemData">
select
a.properties_item_no itemNo,
select a.properties_item_no itemNo,
b.ItemDesc
from plm_properties_model_detail a
left join plm_properties_item b on a.properties_item_no = b.ItemNo and a.function_type = b.ItemType and a.site=b.site
left join plm_properties_item b
on a.properties_item_no = b.ItemNo and a.function_type = b.ItemType and a.site = b.site
where a.code_no = #{codeNo}
and a.function_type = #{functionType}
and a.site = #{site}
@ -278,11 +326,11 @@
<select id="getItemListsForPartAndCode" resultType="PlmPropertiesItemData">
select
a.PropertiesItemNo itemNo,
select a.PropertiesItemNo itemNo,
b.ItemDesc
from PartSubPropertiesValue a
left join plm_properties_item b on a.PropertiesItemNo = b.ItemNo and a.RecordType = b.ItemType and a.site=b.site
left join plm_properties_item b
on a.PropertiesItemNo = b.ItemNo and a.RecordType = b.ItemType and a.site = b.site
where a.code_no = #{codeNo}
and a.RecordType = #{functionType}
and a.site = #{site}
@ -290,8 +338,7 @@
</select>
<select id="searchPropertiesUnChoose" resultType="PlmPropertiesItemData">
SELECT
b.site,
SELECT b.site,
b.ItemType as functionType,
b.ItemNo,
b.ItemDesc,
@ -302,7 +349,8 @@
b.MaxValue,
b.MinValue
FROM plm_properties_item b
where b.ItemType = #{codeType} and b.site = #{site}
where b.ItemType = #{codeType}
and b.site = #{site}
<if test="list != null and list.size() != 0">
and b.ItemNo not in (
<foreach collection="list" item="item" separator=",">
@ -313,36 +361,82 @@
</select>
<select id="checkValueHeaderData" resultType="PartSubPropertiesValueHeaderData">
SELECT PartNo,Site,CodeNo,SubCodeSeqNo,SubCodeDesc,RecordType from PartSubPropertiesValueHeader
where PartNo=#{testPartNo} and site=#{site} and CodeNo=#{codeNo} and RecordType ='IP'
SELECT PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc, RecordType
from PartSubPropertiesValueHeader
where PartNo = #{testPartNo}
and site = #{site}
and CodeNo = #{codeNo}
and RecordType = 'IP'
</select>
<delete id="deletePartSubPropertiesValueHeader">
delete from PartSubPropertiesValueHeader where PartNo=#{testPartNo} and site=#{site} and RecordType ='IP'
delete
from PartSubPropertiesValueHeader
where PartNo = #{testPartNo}
and site = #{site}
and RecordType = 'IP'
</delete>
<delete id="deletePartSubPropertiesValue">
delete from PartSubPropertiesValue where PartNo=#{testPartNo} and site=#{site} and RecordType ='IP'
delete
from PartSubPropertiesValue
where PartNo = #{testPartNo}
and site = #{site}
and RecordType = 'IP'
</delete>
<insert id="savePartSubPropertiesValueHeader">
insert into PartSubPropertiesValueHeader (PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc, RecordType)
select #{testPartNo},#{site},#{codeNo},1,Code_Desc,'IP' from plm_properties_model_header where Code_No=#{codeNo} and site=#{site} and function_type='IP'
select #{testPartNo}, #{site}, #{codeNo}, 1, Code_Desc, 'IP'
from plm_properties_model_header
where Code_No = #{codeNo}
and site = #{site}
and function_type = 'IP'
</insert>
<insert id="savePartSubPropertiesValue">
insert into PartSubPropertiesValue ( PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc
, ItemNo, PropertiesItemNo, TextValue, NumValue, RecordType)
select #{testPartNo},#{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 ,'IP'
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='IP'
select #{testPartNo},
#{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,
'IP'
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 = 'IP'
</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 ItemDesc,b.ValueType,b.ValueType_DB,b.ValueChooseFlag
FROM PartSubPropertiesValue a left join plm_properties_item b on a.PropertiesItemNo=b.ItemNo and a.site=b.site and a.RecordType=b.ItemType
SELECT a.PartNo
, a.Site
, a.CodeNo
, a.SubCodeSeqNo
, a.SubCodeDesc
, a.ItemNo
, a.PropertiesItemNo
, a.TextValue
, a.NumValue
, a.RecordType
, b.ItemDesc ItemDesc
, b.ValueType
, b.ValueType_DB
, b.ValueChooseFlag
FROM PartSubPropertiesValue a
left join plm_properties_item b
on a.PropertiesItemNo = b.ItemNo and a.site = b.site and a.RecordType = b.ItemType
<where>
AND a.site = #{site}
and RecordType = 'IP'
@ -351,32 +445,62 @@
</select>
<select id="checkItemNo" resultType="PartSubPropertiesValueData">
select ValueType_DB from plm_properties_item where itemNo=#{propertiesItemNo} and site=#{site} and ItemType='IP'
select ValueType_DB
from plm_properties_item
where itemNo = #{propertiesItemNo}
and site = #{site}
and ItemType = 'IP'
</select>
<select id="getAvailableValueList" resultType="PlmPropertiesItemAvailableData">
select ItemNo,ValueNo,AvailableValue from plm_properties_item_available where itemNo=#{propertiesItemNo} and site=#{site} and ItemType='IP'
select ItemNo, ValueNo, AvailableValue
from plm_properties_item_available
where itemNo = #{propertiesItemNo}
and site = #{site}
and ItemType = 'IP'
</select>
<update id="updateToolItem">
update PartSubPropertiesValue set TextValue=#{textValue} , NumValue=#{numValue,jdbcType=DOUBLE} where PropertiesItemNo=#{propertiesItemNo} and site=#{site} and PartNo=#{partNo} and RecordType='IP'
update PartSubPropertiesValue
set TextValue=#{textValue},
NumValue=#{numValue,jdbcType=DOUBLE}
where PropertiesItemNo = #{propertiesItemNo}
and site = #{site}
and PartNo = #{partNo}
and RecordType = 'IP'
</update>
<insert id="refreshItemModal">
insert into PartSubPropertiesValue(PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc,
ItemNo, PropertiesItemNo, TextValue, NumValue, RecordType)
select #{partNo},#{site},a.CodeNo,1,a.SubCodeDesc,b.seq_No,b.properties_item_no,case when e.ValueType_DB='T' then e.DefaultValue
else null end ,case when e.ValueType_DB='N' and e.DefaultValue!='' then e.DefaultValue else null end ,'IP'
from PartSubPropertiesValueHeader a left join plm_properties_model_detail b on a.CodeNo=b.Code_No and a.site=b.site and a.RecordType=b.function_type
left join PartSubPropertiesValue c on c.Site=#{site} and c.PartNo=#{partNo} and c.RecordType='IP' and b.seq_no=c.ItemNo and a.RecordType=b.function_type
left join plm_properties_item e on b.properties_item_no=e.ItemNo and a.site=e.site and a.RecordType=e.ItemType
where c.ItemNo is null and a.RecordType='IP' and a.PartNo=#{partNo} and a.site= #{site}
select #{partNo},
#{site},
a.CodeNo,
1,
a.SubCodeDesc,
b.seq_No,
b.properties_item_no,
case
when e.ValueType_DB = 'T' then e.DefaultValue
else null end,
case when e.ValueType_DB = 'N' and e.DefaultValue != '' then e.DefaultValue else null end,
'IP'
from PartSubPropertiesValueHeader a
left join plm_properties_model_detail b
on a.CodeNo = b.Code_No and a.site = b.site and a.RecordType = b.function_type
left join PartSubPropertiesValue c
on c.Site = #{site} and c.PartNo = #{partNo} and c.RecordType = 'IP' and
b.seq_no = c.ItemNo and a.RecordType = b.function_type
left join plm_properties_item e
on b.properties_item_no = e.ItemNo and a.site = e.site and a.RecordType = e.ItemType
where c.ItemNo is null
and a.RecordType = 'IP'
and a.PartNo = #{partNo}
and a.site = #{site}
</insert>
<select id="propertiesModelSearchForBM" parameterType="PlmBmModelHeaderData" resultType="PlmBmModelHeaderData">
SELECT
site,
SELECT site,
bu_no,
dbo.plm_get_bu_desc(site, bu_no) buDesc,
function_type,
@ -388,7 +512,10 @@
update_date,
update_by,
delflag,
version,edit_flag,properties_code_no,dbo.get_properties_codeDesc(site,function_type,properties_code_no) properties_code_desc
version,
edit_flag,
properties_code_no,
dbo.get_properties_codeDesc(site, function_type, properties_code_no) properties_code_desc
FROM plm_bm_model_header
<where>
site = #{query.site}
@ -418,8 +545,7 @@
</select>
<select id="searchModalDetailsForBM" resultType="PlmBmModelDetailData">
SELECT
a.site,
SELECT a.site,
a.function_type,
a.code_no,
pd.properties_item_no itemNo,
@ -435,18 +561,25 @@
b.ItemType,
pd.order_id
FROM plm_bm_model_header a
left join plm_properties_model_detail pd on a.site=pd.site and pd.function_type='BM' and a.properties_code_no=pd.code_no
left join plm_properties_item b on pd.function_type = b.itemType and pd.properties_item_no = b.itemNo and pd.site = b.site
where a.function_type = #{functionType} and a.code_no = #{codeNo} and a.site = #{site} and a.bu_No = #{buNo} and pd.properties_item_no is not null
left join plm_properties_model_detail pd
on a.site = pd.site and pd.function_type = 'BM' and a.properties_code_no = pd.code_no
left join plm_properties_item b
on pd.function_type = b.itemType and pd.properties_item_no = b.itemNo and pd.site = b.site
where a.function_type = #{functionType}
and a.code_no = #{codeNo}
and a.site = #{site}
and a.bu_No = #{buNo}
and pd.properties_item_no is not null
order by order_id
</select>
<select id="getItemListsForBM" resultType="PlmPropertiesItemData">
SELECT
a.itemNo,
SELECT a.itemNo,
a.ItemDesc
FROM plm_properties_item a
LEFT JOIN plm_bm_model_detail b on b.function_type = #{functionType} and b.code_no = #{codeNo} and b.properties_item_no = a.ItemNo and a.site = b.site and b.bu_no=#{buNo}
LEFT JOIN plm_bm_model_detail b on b.function_type = #{functionType} and b.code_no = #{codeNo} and
b.properties_item_no = a.ItemNo and a.site = b.site and
b.bu_no = #{buNo}
<where>
a.ItemType = #{functionType}
and a.site = #{site}
@ -461,19 +594,19 @@
</select>
<select id="getModelItemListsForBM" resultType="PlmPropertiesItemData">
select
a.properties_item_no itemNo,
select a.properties_item_no itemNo,
b.ItemDesc
from plm_bm_model_detail a
left join plm_properties_item b on a.properties_item_no = b.ItemNo and a.function_type = b.ItemType and a.site=b.site
left join plm_properties_item b
on a.properties_item_no = b.ItemNo and a.function_type = b.ItemType and a.site = b.site
where a.code_no = #{codeNo}
and a.function_type = #{functionType}
and a.site=#{site} and a.bu_no=#{buNo}
and a.site = #{site}
and a.bu_no = #{buNo}
</select>
<select id="checkModalDetailsForBM" resultType="PlmBmModelDetailData">
SELECT
function_type,
SELECT function_type,
code_no,
properties_item_no itemNo,
seq_no
@ -486,28 +619,47 @@
</select>
<select id="getModalDetailSeqNoForBM" resultType="Integer">
SELECT
isnull(max(seq_no),0) + 1
SELECT isnull(max(seq_no), 0) + 1
from plm_bm_model_detail
where function_type = #{functionType} and code_no = #{codeNo} and site = #{site} and bu_no=#{buNo}
where function_type = #{functionType}
and code_no = #{codeNo}
and site = #{site}
and bu_no = #{buNo}
</select>
<select id="getModalDetailOrderId" resultType="Integer">
SELECT
isnull(max(order_id),0) + 1
SELECT isnull(max(order_id), 0) + 1
from plm_properties_model_detail
where function_type = #{functionType} and code_no = #{codeNo} and site = #{site}
where function_type = #{functionType}
and code_no = #{codeNo}
and site = #{site}
</select>
<insert id="saveModalDetailsForBM">
insert into plm_bm_model_detail
(function_type, code_no, properties_item_no, seq_no, created_date, created_by, delflag, version, site,bu_no,order_id)
values (#{functionType}, #{codeNo}, #{itemNo}, #{seqNo}, GetDate(), #{userId}, 'N', 0, #{site},#{buNo}, #{orderId})
(function_type, code_no, properties_item_no, seq_no, created_date, created_by, delflag, version, site, bu_no,
order_id)
values (#{functionType}, #{codeNo}, #{itemNo}, #{seqNo}, GetDate(), #{userId}, 'N', 0, #{site}, #{buNo},
#{orderId})
</insert>
<select id="getPropertiesListByPartAndCodeNo" 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 ItemDesc,b.ValueType,b.ValueType_DB,b.ValueChooseFlag
FROM PartSubPropertiesValue a left join plm_properties_item b on a.PropertiesItemNo=b.ItemNo and a.site=b.site and a.RecordType=b.ItemType
SELECT a.PartNo
, a.Site
, a.CodeNo
, a.SubCodeSeqNo
, a.SubCodeDesc
, a.ItemNo
, a.PropertiesItemNo
, a.TextValue
, a.NumValue
, a.RecordType
, b.ItemDesc ItemDesc
, b.ValueType
, b.ValueType_DB
, b.ValueChooseFlag
FROM PartSubPropertiesValue a
left join plm_properties_item b
on a.PropertiesItemNo = b.ItemNo and a.site = b.site and a.RecordType = b.ItemType
<where>
AND a.site = #{site}
and a.RecordType = #{recordType}
@ -518,35 +670,79 @@ FROM PartSubPropertiesValue a left join plm_properties_item b on a.PropertiesIte
</select>
<update id="updatePropertiesList">
update PartSubPropertiesValue set TextValue=#{textValue} ,NumValue=#{numValue,jdbcType=DOUBLE} where
Site=#{site} and CodeNo=#{codeNo} and PartNo=#{partNo} and SubCodeSeqNo=#{subCodeSeqNo} and itemNo=#{itemNo}
update PartSubPropertiesValue
set TextValue=#{textValue},
NumValue=#{numValue,jdbcType=DOUBLE}
where Site = #{site}
and CodeNo = #{codeNo}
and PartNo = #{partNo}
and SubCodeSeqNo = #{subCodeSeqNo}
and itemNo = #{itemNo}
</update>
<delete id="deleteModalDetailsForBM">
delete from plm_bm_model_detail
delete
from plm_bm_model_detail
where function_type = #{functionType}
and code_no = #{codeNo}
and properties_item_no = #{itemNo}
and site = #{site} and bu_no=#{buNo}
and site = #{site}
and bu_no = #{buNo}
</delete>
<select id="getUpItemdata" resultType="com.spring.modules.base.entity.PlmPropertiesModelDetail">
select top 1 site,function_type,code_no,properties_item_no,seq_no,created_date,created_by,update_date,update_by,delflag,version,
order_id from plm_properties_model_detail where #{orderId} > order_id and site = #{site} and code_no = #{codeNo} and function_type = #{functionType} order by order_id desc
select top 1 site,
function_type,
code_no,
properties_item_no,
seq_no,
created_date,
created_by,
update_date,
update_by,
delflag,
version,
order_id
from plm_properties_model_detail
where #{orderId} > order_id
and site = #{site}
and code_no = #{codeNo}
and function_type = #{functionType}
order by order_id desc
</select>
<select id="getDownItemdata" resultType="com.spring.modules.base.entity.PlmPropertiesModelDetail">
select top 1 site,function_type,code_no,properties_item_no,seq_no,created_date,created_by,update_date,update_by,delflag,version,
order_id from plm_properties_model_detail where order_id > #{orderId} and site = #{site} and code_no = #{codeNo} and function_type = #{functionType} order by order_id
select top 1 site,
function_type,
code_no,
properties_item_no,
seq_no,
created_date,
created_by,
update_date,
update_by,
delflag,
version,
order_id
from plm_properties_model_detail
where order_id > #{orderId}
and site = #{site}
and code_no = #{codeNo}
and function_type = #{functionType}
order by order_id
</select>
<update id="updatePlmPropertiesModelDetailOrder">
update plm_properties_model_detail set order_id=#{orderId} where site = #{site} and code_no = #{codeNo} and function_type = #{functionType} and seq_no=#{seqNo}
update plm_properties_model_detail
set order_id=#{orderId}
where site = #{site}
and code_no = #{codeNo}
and function_type = #{functionType}
and seq_no = #{seqNo}
</update>
<select id="propertiesListSearch" resultType="com.spring.modules.base.entity.PlmPropertiesModelHeader">
SELECT
site,
SELECT site,
function_type,
code_no,
code_desc,
@ -559,7 +755,8 @@ order_id from plm_properties_model_detail where order_id > #{orderId} and site =
version
FROM plm_properties_model_header
<where>
site = #{site} and active = 'Y'
site = #{site}
and active = 'Y'
<if test="codeNo != null and codeNo != ''">
AND code_no like '%' + #{codeNo} + '%'
</if>
@ -573,36 +770,53 @@ order_id from plm_properties_model_detail where order_id > #{orderId} and site =
</select>
<select id="searchWorkCenterBMType" resultType="WorkCenterBMTypeData">
select a.site, a.work_center_no, a.work_center_desc, b.itemType, c.type_desc
from work_center a left join WorkCenter_BMType b on a.site=b.site and a.work_center_no=b.workCenterNo
from work_center a
left join WorkCenter_BMType b on a.site = b.site and a.work_center_no = b.workCenterNo
left join plm_route_itemType c on b.itemType = c.item_type
where a.site = #{site}
</select>
<delete id="deleteWorkCenterBMType">
delete from WorkCenter_BMType where site=#{site} and workCenterNo=#{workCenterNo}
delete
from WorkCenter_BMType
where site = #{site}
and workCenterNo = #{workCenterNo}
</delete>
<update id="updateWorkCenterBMType">
update WorkCenter_BMType set itemType=#{itemType} ,update_by=#{updateBy} ,update_date=GetDate()
where site=#{site} and workCenterNo=#{workCenterNo}
update WorkCenter_BMType
set itemType=#{itemType},
update_by=#{updateBy},
update_date=GetDate()
where site = #{site}
and workCenterNo = #{workCenterNo}
</update>
<insert id="insertWorkCenterBMType">
insert into WorkCenter_BMType (site,workCenterNo,itemType,update_by,update_date) values
(#{site},#{workCenterNo},#{itemType},#{updateBy},GetDate())
insert into WorkCenter_BMType (site, workCenterNo, itemType, update_by, update_date)
values (#{site}, #{workCenterNo}, #{itemType}, #{updateBy}, GetDate())
</insert>
<select id="getPlmRouteItemType" resultType="PlmRouteItemType">
select item_type,type_desc from plm_route_itemType
select item_type, type_desc
from plm_route_itemType
</select>
<select id="searchMenuAllListId" resultType="com.spring.modules.sys.entity.SysMenuEntity">
select menu_id,name from sys_menu where parent_id = 0 and menu_id not in (999) and menu_type = 'pc'
select menu_id, name
from sys_menu
where parent_id = 0
and menu_id not in (999)
and menu_type = 'pc'
</select>
<select id="searchBUList" resultType="com.spring.modules.base.entity.Bu">
select bu_no,bu_desc from BU where site = #{site} and active='Y'
select bu_no, bu_desc
from BU
where site = #{site}
and active = 'Y'
</select>
<select id="searchBUPropertiesList" resultType="com.spring.modules.base.entity.Bu">
select a.bu_no, b.bu_desc
from properties_bu a left join BU b on a.site = b.site and a.bu_no = b.bu_no
from properties_bu a
left join BU b on a.site = b.site and a.bu_no = b.bu_no
<where>
<if test="functionType != null and functionType != ''">
and a.function_type = #{functionType}
@ -620,50 +834,116 @@ order_id from plm_properties_model_detail where order_id > #{orderId} and site =
select dict_label, dict_value
from sys_dict_data
where site = #{site}
and dict_type in (select menu_id from sys_menu where parent_id = 0 and menu_id not in (999) and menu_type = 'pc')
and dict_type in
(select menu_id from sys_menu where parent_id = 0 and menu_id not in (999) and menu_type = 'pc')
</select>
<select id="searchAllTypeList" resultType="java.util.Map">
select function_type as functionType,function_type_desc as functionTypeDesc from properties_type
select function_type as functionType, function_type_desc as functionTypeDesc
from properties_type
</select>
<select id="searchAllTypeRelationshipList" resultType="java.util.Map">
select function_group as functionGroup,function_group_desc as functionGroupDesc from properties_relationship where function_type = #{type}
select function_group as functionGroup, function_group_desc as functionGroupDesc
from properties_relationship
where function_type = #{type}
</select>
<insert id="saveSubPropertiesValue">
insert into PartSubPropertiesValue ( PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc
, ItemNo, PropertiesItemNo, TextValue, NumValue, RecordType, order_id)
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} ,isnull(b.order_id,999)
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}
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},
isnull(b.order_id, 999)
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>
<insert id="saveSubPropertiesValueHeader">
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}
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="saveSubPropertiesValueForAlone">
insert into PartSubPropertiesValue ( PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc
, ItemNo, PropertiesItemNo, TextValue, NumValue, RecordType, order_id)
select #{partNo},#{site},#{codeNo},1,d.SubCodeDesc,#{itemNo,jdbcType=DOUBLE},#{propertiesItemNo},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} ,#{itemNo,jdbcType=DOUBLE}
select #{partNo},
#{site},
#{codeNo},
1,
d.SubCodeDesc,
#{itemNo,jdbcType=DOUBLE},
#{propertiesItemNo},
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},
#{itemNo,jdbcType=DOUBLE}
from plm_properties_item c
left join PartSubPropertiesValueHeader d on d.PartNo=#{partNo} and d.site=#{site} and CodeNo=#{codeNo} and RecordType=#{recordType}
where c.ItemNo=#{propertiesItemNo} and c.site=#{site} and c.itemType=#{recordType}
left join PartSubPropertiesValueHeader d
on d.PartNo = #{partNo} and d.site = #{site} and CodeNo = #{codeNo} and
RecordType = #{recordType}
where c.ItemNo = #{propertiesItemNo}
and c.site = #{site}
and c.itemType = #{recordType}
</insert>
<delete id="deleteSubPropertiesValueForAlone">
delete from PartSubPropertiesValue where Site=#{site} and PartNo=#{partNo} and CodeNo=#{codeNo} and PropertiesItemNo=#{propertiesItemNo} and RecordType=#{recordType}
delete
from PartSubPropertiesValue
where Site = #{site}
and PartNo = #{partNo}
and CodeNo = #{codeNo}
and PropertiesItemNo = #{propertiesItemNo}
and RecordType = #{recordType}
</delete>
<select id="getNewSeqNoForAlone" resultType="Double">
select isnull(Max(itemNo)+1,1) from PartSubPropertiesValue
where Site=#{site} and PartNo=#{partNo} and CodeNo=#{codeNo} and RecordType=#{recordType}
</select>
select isnull(Max(itemNo) + 1, 1)
from PartSubPropertiesValue
where Site = #{site}
and PartNo = #{partNo}
and CodeNo = #{codeNo}
and RecordType = #{recordType}
</select>
<delete id="removeSubPropertiesValue">
delete
from PartSubPropertiesValue
where Site = #{site}
and PartNo = #{partNo}
and CodeNo = #{codeNo}
and RecordType = #{recordType}
</delete>
<delete id="removeSubPropertiesValueHeader">
delete from PartSubPropertiesValueHeader
where Site = #{site}
and PartNo = #{partNo}
and CodeNo = #{codeNo}
and RecordType = #{recordType}
</delete>
</mapper>
Loading…
Cancel
Save