sfd
2025-05-26 2a64b537e8e3bce9ce030585a3da17d48379c0ad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<?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.aps.core.mapper.ApsGasPipingPlanMapper">
    
    <resultMap type="com.aps.core.domain.ApsGasPipingPlan" id="ApsGasPipingPlanResult">
        <result property="id"    column="id"    />
        <result property="masterPlanner"    column="master_planner"    />
        <result property="weekDay"    column="week_day"    />
        <result property="weekCycle"    column="week_cycle"    />
        <result property="mainPartNumber"    column="main_part_number"    />
        <result property="mainPartDrawingNumber"    column="main_part_drawing_number"    />
        <result property="customer"    column="customer"    />
        <result property="businessType"    column="business_type"    />
        <result property="documentNumber"    column="document_number"    />
        <result property="requirementType"    column="requirement_type"    />
        <result property="documentStatus"    column="document_status"    />
        <result property="itemNumber"    column="item_number"    />
        <result property="drawingNo"    column="drawing_no"    />
        <result property="versionNumber"    column="version_number"    />
        <result property="productionQuantity"    column="production_quantity"    />
        <result property="goodProductsQuantity"    column="good_products_quantity"    />
        <result property="processNumber"    column="process_number"    />
        <result property="workCenter"    column="work_center"    />
        <result property="department"    column="department"    />
        <result property="planStartDay"    column="plan_start_day"    />
        <result property="planEndDay"    column="plan_end_day"    />
        <result property="standbyNumber"    column="standby_number"    />
        <result property="standbyName"    column="standby_name"    />
        <result property="standbyStock"    column="standby_stock"    />
        <result property="nextProcessDeparment"    column="next_process_deparment"    />
        <result property="isSuspended"    column="is_suspended"    />
        <result property="isOutsourcing"    column="is_outsourcing"    />
        <result property="account"    column="account"    />
        <result property="advancedMaterials"    column="advanced_materials"    />
        <result property="advancedDocumentNumber"    column="advanced_document_number"    />
        <result property="advancedRequirementDay"    column="advanced_requirement_day"    />
        <result property="isPlanComplete"    column="is_plan_complete"    />
        <result property="isStockComplete"    column="is_stock_complete"    />
        <result property="hasTurnback"    column="has_turnback"    />
        <result property="hasRisk"    column="has_risk"    />
        <result property="planType"    column="plan_type"    />
        <result property="opStatus"    column="op_status"    />
        <result property="nextOpName"    column="next_op_name"    />
        <result property="orderCreateTime"    column="order_create_time"    />
        <result property="approveOn"    column="approve_on"    />
        <result property="startWorkDate"    column="start_work_date"    />
        <result property="lowOrderCode"    column="low_order_code"    />
<!--        <collection property="apsProcessRoutes" javaType="java.util.ArrayList" ofType="com.aps.core.domain.ApsProcessRoute">-->
<!--            <result property="id"    column="id"    />-->
<!--            <result property="itemNo"    column="item_no"    />-->
<!--            <result property="workOrderNo"    column="work_order_no"    />-->
<!--            <result property="processNumber"    column="process_number_sub"    />-->
<!--            <result property="processName"    column="process_name"    />-->
<!--            <result property="processPlanStartDay"    column="process_plan_start_day"    />-->
<!--            <result property="processPlanEndDay"    column="process_plan_end_day"    />-->
<!--            <result property="notStartWorkCount"    column="not_start_work_count"    />-->
<!--            <result property="completedCount"    column="completed_count"    />-->
<!--            <result property="discardCount"    column="discard_count"    />-->
<!--            <result property="integrationDay"    column="integration_day"    />-->
<!--            <result property="plant"    column="plant"    />-->
<!--            <result property="delFlag"    column="del_flag"    />-->
<!--            <result property="createBy"    column="create_by"    />-->
<!--            <result property="createTime"    column="create_time"    />-->
<!--            <result property="updateBy"    column="update_by"    />-->
<!--            <result property="updateTime"    column="update_time"    />-->
<!--            <result property="standardTime"    column="standard_time"    />-->
<!--            <result property="processOrder"    column="process_order"    />-->
<!--            <result property="workCenter"    column="work_center"    />-->
<!--            <result property="processQty"    column="process_qty"    />-->
<!--            <result property="opStatus"    column="op_status"    />-->
<!--            <result property="opStatus"    column="op_status"    />-->
<!--            <result property="orgCode"    column="org_code"    />-->
<!--        </collection>-->
    </resultMap>
 
    <resultMap type="com.aps.core.domain.ApsGasPipingPlan" id="ApsGasPipingPlanResultWithProcess">
        <result property="documentNumber"    column="document_number"    />
        <result property="itemNumber"    column="item_number"    />
        <result property="productionQuantity"    column="production_quantity"    />
        <result property="processNumber"    column="process_number"    />
        <result property="planType"    column="plan_type"    />
        <result property="planEndDay"    column="plan_end_day"    />
        <result property="stdOp"    column="std_op"    />
        <collection property="apsProcessRoutes" javaType="java.util.ArrayList" ofType="com.aps.core.domain.ApsProcessRoute">
            <result property="processNumber"    column="process_number_sub"    />
            <result property="processName"    column="process_name"    />
            <result property="processPlanStartDay"    column="process_plan_start_day"    />
            <result property="processPlanEndDay"    column="process_plan_end_day"    />
            <result property="standardTime"    column="standard_time"    />
        </collection>
    </resultMap>
 
    <sql id="selectApsGasPipingPlanVo">
        select id, master_planner, week_day, week_cycle, main_part_number, main_part_drawing_number, customer,
               business_type, document_number, requirement_type, document_status, item_number, drawing_no,
               version_number, production_quantity, good_products_quantity, process_number, work_center,
               department, plan_start_day, plan_end_day, standby_number, standby_name, standby_stock,
               next_process_deparment, is_suspended, is_outsourcing, account, advanced_materials,
               advanced_document_number, advanced_requirement_day, is_plan_complete, is_stock_complete,
               has_turnback, has_risk ,plan_type, op_status, next_op_name, order_create_time, approve_on, start_work_date, low_order_code
        from aps_gas_piping_plan
    </sql>
 
    <select id="selectApsGasPipingPlanList" parameterType="com.aps.core.domain.ApsGasPipingPlan" resultMap="ApsGasPipingPlanResult">
        <include refid="selectApsGasPipingPlanVo"/>
        <where>  
            <if test="masterPlanner != null  and masterPlanner != ''"> and master_planner like concat('%', #{masterPlanner}, '%')</if>
            <if test="customer != null  and customer != ''">  and customer like  '%' || #{customer} || '%'  </if>
            <if test="businessType != null  and businessType != ''"> and business_type = #{businessType}</if>
            <if test="documentNumber != null  and documentNumber != ''"> and document_number  like  '%' || #{documentNumber} || '%'</if>
            <if test="requirementType != null  and requirementType != ''"> and requirement_type = #{requirementType}</if>
            <if test="documentStatus != null  and documentStatus != ''"> and document_status = #{documentStatus}</if>
            <if test="itemNumber != null  and itemNumber != ''"> and item_number = #{itemNumber}</if>
            <if test="drawingNo != null  and drawingNo != ''"> and drawing_no = #{drawingNo}</if>
            <if test="versionNumber != null  and versionNumber != ''"> and version_number = #{versionNumber}</if>
            <if test="productionQuantity != null "> and production_quantity = #{productionQuantity}</if>
            <if test="goodProductsQuantity != null "> and good_products_quantity = #{goodProductsQuantity}</if>
            <if test="processNumber != null  and processNumber != ''"> and process_number = #{processNumber}</if>
            <if test="workCenter != null  and workCenter != ''"> and work_center = #{workCenter}</if>
            <if test="department != null  and department != ''"> and department = #{department}</if>
            <if test="params.beginPlanStartDay != null and params.beginPlanStartDay != '' and params.endPlanStartDay != null and params.endPlanStartDay != ''"> and plan_start_day between #{params.beginPlanStartDay} and #{params.endPlanStartDay}</if>
            <if test="params.beginPlanEndDay != null and params.beginPlanEndDay != '' and params.endPlanEndDay != null and params.endPlanEndDay != ''"> and plan_end_day between #{params.beginPlanEndDay} and #{params.endPlanEndDay}</if>
            <if test="standbyNumber != null  and standbyNumber != ''"> and standby_number = #{standbyNumber}</if>
            <if test="standbyName != null  and standbyName != ''"> and standby_name like concat('%', #{standbyName}, '%')</if>
            <if test="standbyStock != null "> and standby_stock = #{standbyStock}</if>
            <if test="nextProcessDeparment != null  and nextProcessDeparment != ''"> and next_process_deparment = #{nextProcessDeparment}</if>
            <if test="isSuspended != null "> and is_suspended = #{isSuspended}</if>
            <if test="isOutsourcing != null  and isOutsourcing != ''"> and is_outsourcing = #{isOutsourcing}</if>
            <if test="account != null  and account != ''"> and account = #{account}</if>
            <if test="advancedMaterials != null  and advancedMaterials != ''"> and advanced_materials = #{advancedMaterials}</if>
            <if test="advancedDocumentNumber != null  and advancedDocumentNumber != ''"> and advanced_document_number = #{advancedDocumentNumber}</if>
            <if test="advancedRequirementDay != null "> and advanced_requirement_day = #{advancedRequirementDay}</if>
            <if test="isPlanComplete != null "> and is_plan_complete = #{isPlanComplete}</if>
            <if test="isStockComplete != null "> and is_stock_complete = #{isStockComplete}</if>
            <if test="hasTurnback != null "> and has_turnback = #{hasTurnback}</if>
            <if test="hasRisk != null "> and has_risk = #{hasRisk}</if>
            <if test="planType != null "> and plan_type = #{planType}</if>
            <if test="opStatus != null "> and op_status = #{opStatus}</if>
            <if test="nextOpName != null "> and next_op_name = #{nextOpName}</if>
           and del_flag ='0'
        </where>
    </select>
    
    <select id="selectApsGasPipingPlanById" parameterType="String" resultMap="ApsGasPipingPlanResult">
        <include refid="selectApsGasPipingPlanVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertApsGasPipingPlan" parameterType="com.aps.core.domain.ApsGasPipingPlan">
        insert into aps_gas_piping_plan
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null and id != ''">id,</if>
            <if test="masterPlanner != null">master_planner,</if>
            <if test="weekDay != null">week_day,</if>
            <if test="weekCycle != null">week_cycle,</if>
            <if test="mainPartNumber != null">main_part_number,</if>
            <if test="mainPartDrawingNumber != null">main_part_drawing_number,</if>
            <if test="customer != null">customer,</if>
            <if test="businessType != null">business_type,</if>
            <if test="documentNumber != null">document_number,</if>
            <if test="requirementType != null">requirement_type,</if>
            <if test="documentStatus != null">document_status,</if>
            <if test="itemNumber != null">item_number,</if>
            <if test="drawingNo != null">drawing_no,</if>
            <if test="versionNumber != null">version_number,</if>
            <if test="productionQuantity != null">production_quantity,</if>
            <if test="goodProductsQuantity != null">good_products_quantity,</if>
            <if test="processNumber != null">process_number,</if>
            <if test="workCenter != null">work_center,</if>
            <if test="department != null">department,</if>
            <if test="planStartDay != null">plan_start_day,</if>
            <if test="planEndDay != null">plan_end_day,</if>
            <if test="standbyNumber != null">standby_number,</if>
            <if test="standbyName != null">standby_name,</if>
            <if test="standbyStock != null">standby_stock,</if>
            <if test="nextProcessDeparment != null">next_process_deparment,</if>
            <if test="isSuspended != null">is_suspended,</if>
            <if test="isOutsourcing != null">is_outsourcing,</if>
            <if test="account != null">account,</if>
            <if test="advancedMaterials != null">advanced_materials,</if>
            <if test="advancedDocumentNumber != null">advanced_document_number,</if>
            <if test="advancedRequirementDay != null">advanced_requirement_day,</if>
            <if test="isPlanComplete != null">is_plan_complete,</if>
            <if test="isStockComplete != null">is_stock_complete,</if>
            <if test="hasTurnback != null">has_turnback,</if>
            <if test="hasRisk != null">has_risk,</if>
            <if test="planType != null">plan_type,</if>
            <if test="opStatus != null">op_status,</if>
            <if test="nextOpName != null">next_op_name,</if>
            <if test="orderCreateTime != null">order_create_time,</if>
            <if test="approveOn != null">approve_on,</if>
            <if test="startWorkDate != null">start_work_date,</if>
            <if test="lowOrderCode != null">low_order_code,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null and id != ''">#{id},</if>
            <if test="masterPlanner != null">#{masterPlanner},</if>
            <if test="weekDay != null">#{weekDay},</if>
            <if test="weekCycle != null">#{weekCycle},</if>
            <if test="mainPartNumber != null">#{mainPartNumber},</if>
            <if test="mainPartDrawingNumber != null">#{mainPartDrawingNumber},</if>
            <if test="customer != null">#{customer},</if>
            <if test="businessType != null">#{businessType},</if>
            <if test="documentNumber != null">#{documentNumber},</if>
            <if test="requirementType != null">#{requirementType},</if>
            <if test="documentStatus != null">#{documentStatus},</if>
            <if test="itemNumber != null">#{itemNumber},</if>
            <if test="drawingNo != null">#{drawingNo},</if>
            <if test="versionNumber != null">#{versionNumber},</if>
            <if test="productionQuantity != null">#{productionQuantity},</if>
            <if test="goodProductsQuantity != null">#{goodProductsQuantity},</if>
            <if test="processNumber != null">#{processNumber},</if>
            <if test="workCenter != null">#{workCenter},</if>
            <if test="department != null">#{department},</if>
            <if test="planStartDay != null">#{planStartDay},</if>
            <if test="planEndDay != null">#{planEndDay},</if>
            <if test="standbyNumber != null">#{standbyNumber},</if>
            <if test="standbyName != null">#{standbyName},</if>
            <if test="standbyStock != null">#{standbyStock},</if>
            <if test="nextProcessDeparment != null">#{nextProcessDeparment},</if>
            <if test="isSuspended != null">#{isSuspended},</if>
            <if test="isOutsourcing != null">#{isOutsourcing},</if>
            <if test="account != null">#{account},</if>
            <if test="advancedMaterials != null">#{advancedMaterials},</if>
            <if test="advancedDocumentNumber != null">#{advancedDocumentNumber},</if>
            <if test="advancedRequirementDay != null">#{advancedRequirementDay},</if>
            <if test="isPlanComplete != null">#{isPlanComplete},</if>
            <if test="isStockComplete != null">#{isStockComplete},</if>
            <if test="hasTurnback != null">#{hasTurnback},</if>
            <if test="hasRisk != null">#{hasRisk},</if>
            <if test="planType != null">#{planType},</if>
            <if test="opStatus != null">#{opStatus},</if>
            <if test="nextOpName != null">#{nextOpName},</if>
            <if test="orderCreateTime != null">#{orderCreateTime},</if>
            <if test="approveOn != null">#{approveOn},</if>
            <if test="startWorkDate != null">#{startWorkDate},</if>
            <if test="lowOrderCode != null">#{lowOrderCode},</if>
         </trim>
    </insert>
 
    <update id="updateApsGasPipingPlan" parameterType="com.aps.core.domain.ApsGasPipingPlan">
        update aps_gas_piping_plan
        <trim prefix="SET" suffixOverrides=",">
            <if test="masterPlanner != null">master_planner = #{masterPlanner},</if>
            <if test="weekDay != null">week_day = #{weekDay},</if>
            <if test="weekCycle != null">week_cycle = #{weekCycle},</if>
            <if test="mainPartNumber != null">main_part_number = #{mainPartNumber},</if>
            <if test="mainPartDrawingNumber != null">main_part_drawing_number = #{mainPartDrawingNumber},</if>
            <if test="customer != null">customer = #{customer},</if>
            <if test="businessType != null">business_type = #{businessType},</if>
            <if test="documentNumber != null">document_number = #{documentNumber},</if>
            <if test="requirementType != null">requirement_type = #{requirementType},</if>
            <if test="documentStatus != null">document_status = #{documentStatus},</if>
            <if test="itemNumber != null">item_number = #{itemNumber},</if>
            <if test="drawingNo != null">drawing_no = #{drawingNo},</if>
            <if test="versionNumber != null">version_number = #{versionNumber},</if>
            <if test="productionQuantity != null">production_quantity = #{productionQuantity},</if>
            <if test="goodProductsQuantity != null">good_products_quantity = #{goodProductsQuantity},</if>
            <if test="processNumber != null">process_number = #{processNumber},</if>
            <if test="workCenter != null">work_center = #{workCenter},</if>
            <if test="department != null">department = #{department},</if>
            <if test="planStartDay != null">plan_start_day = #{planStartDay},</if>
            <if test="planEndDay != null">plan_end_day = #{planEndDay},</if>
            <if test="standbyNumber != null">standby_number = #{standbyNumber},</if>
            <if test="standbyName != null">standby_name = #{standbyName},</if>
            <if test="standbyStock != null">standby_stock = #{standbyStock},</if>
            <if test="nextProcessDeparment != null">next_process_deparment = #{nextProcessDeparment},</if>
            <if test="isSuspended != null">is_suspended = #{isSuspended},</if>
            <if test="isOutsourcing != null">is_outsourcing = #{isOutsourcing},</if>
            <if test="account != null">account = #{account},</if>
            <if test="advancedMaterials != null">advanced_materials = #{advancedMaterials},</if>
            <if test="advancedDocumentNumber != null">advanced_document_number = #{advancedDocumentNumber},</if>
            <if test="advancedRequirementDay != null">advanced_requirement_day = #{advancedRequirementDay},</if>
            <if test="isPlanComplete != null">is_plan_complete = #{isPlanComplete},</if>
            <if test="isStockComplete != null">is_stock_complete = #{isStockComplete},</if>
            <if test="hasTurnback != null">has_turnback = #{hasTurnback},</if>
            <if test="hasRisk != null">has_risk = #{hasRisk},</if>
            <if test="planType != null">plan_type = #{planType},</if>
            <if test="opStatus != null">op_status = #{opStatus},</if>
            <if test="nextOpName != null">next_op_name = #{nextOpName},</if>
            <if test="orderCreateTime != null">order_create_time = #{orderCreateTime},</if>
            <if test="approveOn != null">approve_on = #{approveOn},</if>
            <if test="startWorkDate != null">start_work_date = #{startWorkDate},</if>
            <if test="lowOrderCode != null">low_order_code = #{lowOrderCode},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteApsGasPipingPlanById" parameterType="String">
        delete from aps_gas_piping_plan where id = #{id}
    </delete>
 
    <delete id="deleteApsGasPipingPlanByIds" parameterType="String">
        delete from aps_gas_piping_plan where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <update id="removeAllPlans" >
        update  aps_gas_piping_plan  set del_flag='1' where del_flag ='0'
    </update>
 
    <select id="selectApsGasPipingPlanWithProcess" parameterType="com.aps.core.domain.ApsGasPipingPlan" resultMap="ApsGasPipingPlanResultWithProcess">
        select c.* from (select a.document_number,a.item_number,a.process_number,a.production_quantity,a.plan_type,a.plan_end_day,a.std_op,b.process_name,b.process_number as process_number_sub,b.standard_time,b.process_plan_start_day,b.process_plan_end_day from aps_gas_piping_plan a
           left join aps_process_route b on a.document_number = b.work_order_no
        where a.document_status in ('0','1','2','4') and a.op_status!='完工' and b.process_plan_start_day is not null and b.process_name in(select process_name from aps_standard_process where major='气柜' or major='管路') ORDER BY a.document_number,b.process_number) c GROUP BY c.document_number,c.item_number,c.process_number,c.production_quantity,c.process_name,c.process_number_sub,c.standard_time,c.process_plan_start_day,c.plan_type,c.process_plan_end_day,c.plan_end_day,c.std_op
    </select>
 
</mapper>