XiaoRuby
2023-08-30 55e5fcc8df938fefc94103149dfe3acd328abfd6
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
<?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.yuanchu.mom.mapper.ManufactureOrderMapper">
    <!--查询生产订单的列表-->
    <select id="selectAllManord" resultType="java.util.Map">
        select id,
        order_code,
        customer_code,
        saleman,
        proname,
        name,
        specifications,
        unit,
        number,
        DATE_FORMAT(downTime, '%Y-%m-%d') '下单日期',
        DATE_FORMAT(delTime, '%Y-%m-%d') '交货日期',
        go_state,
        type
        from mom_ocean.manufacture_order
        where state=1
        <if test="downTime!=null and downTime!=''">
            and downTime=#{downTime}
        </if>
        <if test="delTime!=null and delTime!=''">
            and delTime=#{delTime}
        </if>
        <if test="customerCode!=null and customerCode!=''">
            and customer_code like concat('%',#{customerCode},'%')
        </if>
        <if test="type!=null">
            and type=#{type}
        </if>
    </select>
    <!--查看生产计划-->
    <select id="selectAllPlan" resultType="java.util.Map">
        select order_code,
               name,
               specifications,
               unit,
               number,
               proname,
               saleman,
               downman,
               techname,
               DATE_FORMAT(start_time, '%Y-%m-%d') '计划开始日期',
               DATE_FORMAT(end_time, '%Y-%m-%d') '计划结束日期'
        from mom_ocean.manual_technology mt
                 left join mom_ocean.manufacture_order mo
                           on mt.manufacture_order_id = mo.id
        where mo.state=1
        and go_state=1
        and device_id=#{deviceId}
        <if test="orderCode!=null and orderCode!=''">
            and order_code like concat('%',#{orderCode},'%')
        </if>
        <if test="startTime!=null and startTime!=''">
            and DATE_FORMAT(start_time, '%Y-%m-%d')=#{startTime}
        </if>
        <if test="endTime!=null and endTime!=''">
            and DATE_FORMAT(end_time, '%Y-%m-%d')=#{endTime}
        </if>
        order by start_time
    </select>
 
    <update id="deleteManufacture">
        UPDATE manufacture_order m
        SET m.`state` = 0
        WHERE m.id IN
        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
    </update>
 
    <resultMap id="towTreeFirstMap" type="map">
        <id property="orderCode" column="order_code"/>
        <collection property="children" javaType="list" resultMap="towTreeSecondMap"/>
    </resultMap>
 
    <resultMap id="towTreeSecondMap" type="map">
        <id property="manufactureId" column="id"/>
        <result property="manufactureName" column="name"/>
    </resultMap>
 
    <select id="towTree" resultMap="towTreeFirstMap">
        SELECT m.`order_code`, m.`name`, m.`id`
        FROM manufacture_order m
        WHERE m.`state` = 1
    </select>
 
    <update id="updateManufacture">
        UPDATE manufacture_order m
        SET m.`type` = 1, m.`go_state` = 0, m.`scheduled_production` = m.`scheduled_production` + #{schedulingNumber}
        where m.id = #{manufactureOrderId}
    </update>
</mapper>