Browse Source

业务查询

temp01 6 days ago
parent
commit
4208cf3490

+ 5 - 1
src/main/java/com/zjt/entity/ProductionVarietyDetail.java

@@ -7,6 +7,8 @@ import lombok.Data;
7 7
 import lombok.EqualsAndHashCode;
8 8
 import lombok.experimental.Accessors;
9 9
 
10
+import javax.persistence.Column;
11
+
10 12
 /**
11 13
  * <p>
12 14
  * 
@@ -23,11 +25,13 @@ public class ProductionVarietyDetail implements Serializable {
23 25
 
24 26
     private static final long serialVersionUID = 1L;
25 27
     private Float id;
26
-
28
+    @Column(name = "variety_id")
27 29
     private Float varietyId;
28 30
 
31
+    @Column(name = "variety")
29 32
     private String variety;
30 33
 
34
+    @Column(name = "variety_details")
31 35
     private String varietyDetails;
32 36
 
33 37
 

+ 4 - 2
src/main/java/com/zjt/entity/ProductionVarietyDetailColour.java

@@ -7,6 +7,8 @@ import lombok.Data;
7 7
 import lombok.EqualsAndHashCode;
8 8
 import lombok.experimental.Accessors;
9 9
 
10
+import javax.persistence.Column;
11
+
10 12
 /**
11 13
  * <p>
12 14
  * 
@@ -22,9 +24,9 @@ import lombok.experimental.Accessors;
22 24
 public class ProductionVarietyDetailColour implements Serializable {
23 25
 
24 26
     private static final long serialVersionUID = 1L;
25
-
27
+    @Column(name = "variety_details_id")
26 28
     private Float varietyDetailsId;
27
-
29
+    @Column(name = "colour")
28 30
     private String colour;
29 31
 
30 32
 

+ 37 - 4
src/main/java/com/zjt/entity/Productionheader.java

@@ -10,6 +10,8 @@ import lombok.Data;
10 10
 import lombok.EqualsAndHashCode;
11 11
 import lombok.experimental.Accessors;
12 12
 
13
+import javax.persistence.Column;
14
+
13 15
 /**
14 16
  * <p>
15 17
  * 
@@ -26,6 +28,12 @@ public class Productionheader implements Serializable {
26 28
 
27 29
     private static final long serialVersionUID = 1L;
28 30
 
31
+    @Column(name = "variety_detail_id")
32
+    private Float varietyDetailId;
33
+
34
+    @Column(name = "variety_id")
35
+    private Float varietyId;
36
+
29 37
     @ApiModelProperty(value = "关联订单ID")
30 38
     private Long orderId;
31 39
 
@@ -33,92 +41,117 @@ public class Productionheader implements Serializable {
33 41
     private Long customerId;
34 42
 
35 43
     @ApiModelProperty(value = "系列")
44
+    @Column(name = "series")
36 45
     private String series;
37 46
 
38 47
     @ApiModelProperty(value = "商品1")
48
+    @Column(name = "product1")
39 49
     private String product1;
40 50
 
41 51
     @ApiModelProperty(value = "产品")
52
+    @Column(name = "product")
42 53
     private String product;
43 54
 
44 55
     @ApiModelProperty(value = "设计")
56
+    @Column(name = "design")
45 57
     private String design;
46 58
 
47 59
     @ApiModelProperty(value = "折射率")
60
+    @Column(name = "refractive_index")
48 61
     private String refractiveIndex;
49 62
 
50 63
     @ApiModelProperty(value = "膜层")
64
+    @Column(name = "coating")
51 65
     private String coating;
52 66
 
53 67
     @ApiModelProperty(value = "颜色")
68
+    @Column(name = "color")
54 69
     private String color;
55 70
 
56 71
     @ApiModelProperty(value = "属性")
72
+    @Column(name = "attribute")
57 73
     private String attribute;
58 74
 
59 75
     @ApiModelProperty(value = "光度范围")
76
+    @Column(name = "diopter_range")
60 77
     private String diopterRange;
61 78
 
62 79
     @ApiModelProperty(value = "范围说明")
80
+    @Column(name = "range_description")
63 81
     private String rangeDescription;
64 82
 
65 83
     @ApiModelProperty(value = "售价")
84
+    @Column(name = "retail_price")
66 85
     private BigDecimal retailPrice;
67 86
 
68 87
     @ApiModelProperty(value = "单眼瞳高")
88
+    @Column(name = "pupillary_height")
69 89
     private String pupillaryHeight;
70 90
 
71 91
     @ApiModelProperty(value = "单眼瞳距(右)")
72
-    private String singleEyePupillaryDistanceRight;
73
-
74
-    @ApiModelProperty(value = "单眼瞳距(左)")
75
-    private String singleEyePupillaryDistanceLeft;
92
+    @Column(name = "single_eye_pupillary_distance")
93
+    private String singleEyePupillaryDistance;
76 94
 
77 95
     @ApiModelProperty(value = "镜眼距")
96
+    @Column(name = "lens_edge_distance")
78 97
     private String lensEdgeDistance;
79 98
 
80 99
     @ApiModelProperty(value = "前倾角")
100
+    @Column(name = "front_angle")
81 101
     private String frontAngle;
82 102
 
83 103
     @ApiModelProperty(value = "镜架面")
104
+    @Column(name = "frame_surface")
84 105
     private String frameSurface;
85 106
 
86 107
     @ApiModelProperty(value = "习惯阅读距离")
108
+    @Column(name = "habit_reading_distance")
87 109
     private String habitReadingDistance;
88 110
 
89 111
     @ApiModelProperty(value = "近用瞳距")
112
+    @Column(name = "near_use_pupillary_distance")
90 113
     private String nearUsePupillaryDistance;
91 114
 
92 115
     @ApiModelProperty(value = "NVB")
116
+    @Column(name = "nvb")
93 117
     private String nvb;
94 118
 
95 119
     @ApiModelProperty(value = "主视眼")
120
+    @Column(name = "main_vision")
96 121
     private String mainVision;
97 122
 
98 123
     @ApiModelProperty(value = "ERCD")
124
+    @Column(name = "ercd")
99 125
     private String ercd;
100 126
 
101 127
     @ApiModelProperty(value = "年龄")
128
+    @Column(name = "age")
102 129
     private String age;
103 130
 
104 131
     @ApiModelProperty(value = "商品编码")
132
+    @Column(name = "product_code")
105 133
     private String productCode;
106 134
 
107 135
     @ApiModelProperty(value = "商品名称")
136
+    @Column(name = "product_name")
108 137
     private String productName;
109 138
 
110 139
     @ApiModelProperty(value = "状态:0-禁用,1-启用")
111 140
     @TableField("STATUS")
112 141
     private Integer status;
113 142
 
143
+    @Column(name = "create_Time")
114 144
     private LocalDateTime createTime;
115 145
 
146
+    @Column(name = "update_Time")
116 147
     private LocalDateTime updateTime;
117 148
 
118 149
     @ApiModelProperty(value = "创建人")
150
+    @Column(name = "create_By")
119 151
     private String createBy;
120 152
 
121 153
     @ApiModelProperty(value = "更新人")
154
+    @Column(name = "update_By")
122 155
     private String updateBy;
123 156
 
124 157
 

+ 2 - 0
src/main/java/com/zjt/mapper/ProductionVarietyDetailColourMapper.java

@@ -15,4 +15,6 @@ import java.util.List;
15 15
  */
16 16
 public interface ProductionVarietyDetailColourMapper extends BaseMapper<ProductionVarietyDetailColour> {
17 17
     public List<ProductionVarietyDetailColour> selectvarietyDetailsColour(long varietyId);
18
+
19
+    List<ProductionVarietyDetailColour> selectColour(long varietyDetailId);
18 20
 }

+ 1 - 1
src/main/java/com/zjt/mapper/ProductionVarietyDetailMapper.java

@@ -14,7 +14,7 @@ import java.util.List;
14 14
  * @since 2025-09-25
15 15
  */
16 16
 public interface ProductionVarietyDetailMapper extends BaseMapper<ProductionVarietyDetail> {
17
-    public List<ProductionVarietyDetail> selectvarietyDetails(long varietyId);
17
+    public List<ProductionVarietyDetail> selectvarietyDetails(String variety);
18 18
     public List<ProductionVarietyDetail> selectvarietyList();
19 19
 
20 20
 }

+ 4 - 0
src/main/java/com/zjt/mapper/ProductionheaderMapper.java

@@ -1,8 +1,11 @@
1 1
 package com.zjt.mapper;
2 2
 
3
+import com.zjt.entity.ProductionVarietyDetail;
3 4
 import com.zjt.entity.Productionheader;
4 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 6
 
7
+import java.util.List;
8
+
6 9
 /**
7 10
  * <p>
8 11
  *  Mapper 接口
@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
13 16
  */
14 17
 public interface ProductionheaderMapper extends BaseMapper<Productionheader> {
15 18
 
19
+    List<Productionheader> selectProductionheader(long varietyDetailId);
16 20
 }

+ 7 - 1
src/main/java/com/zjt/service/IProductionVarietyDetailService.java

@@ -2,6 +2,8 @@ package com.zjt.service;
2 2
 
3 3
 import com.zjt.entity.ProductionVarietyDetail;
4 4
 import com.baomidou.mybatisplus.extension.service.IService;
5
+import com.zjt.entity.ProductionVarietyDetailColour;
6
+import com.zjt.entity.Productionheader;
5 7
 
6 8
 import java.util.List;
7 9
 
@@ -15,5 +17,9 @@ import java.util.List;
15 17
  */
16 18
 public interface IProductionVarietyDetailService extends IService<ProductionVarietyDetail> {
17 19
     List<ProductionVarietyDetail> selectvarietyList();
18
-    List<ProductionVarietyDetail> selectvarietyDetails(long varietyId);
20
+    List<ProductionVarietyDetail> selectvarietyDetails(String variety);
21
+
22
+    List<Productionheader> selectProductionheader(long varietyDetailId);
23
+
24
+    List<ProductionVarietyDetailColour> selectColour(long varietyDetailId);
19 25
 }

+ 24 - 3
src/main/java/com/zjt/service/impl/ProductionVarietyDetailServiceImpl.java

@@ -1,12 +1,15 @@
1 1
 package com.zjt.service.impl;
2 2
 
3 3
 import com.zjt.entity.ProductionVarietyDetail;
4
+import com.zjt.entity.ProductionVarietyDetailColour;
5
+import com.zjt.entity.Productionheader;
6
+import com.zjt.mapper.ProductionVarietyDetailColourMapper;
4 7
 import com.zjt.mapper.ProductionVarietyDetailMapper;
5 8
 import com.zjt.mapper.ProductionVarietyMapper;
9
+import com.zjt.mapper.ProductionheaderMapper;
6 10
 import com.zjt.service.IProductionVarietyDetailService;
7 11
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
8 12
 import org.springframework.stereotype.Service;
9
-
10 13
 import javax.annotation.Resource;
11 14
 import java.util.Collections;
12 15
 import java.util.List;
@@ -24,6 +27,10 @@ public class ProductionVarietyDetailServiceImpl extends ServiceImpl<ProductionVa
24 27
 
25 28
     @Resource
26 29
     ProductionVarietyDetailMapper ProductionVarietyDetailMapper;
30
+    @Resource
31
+    ProductionheaderMapper ProductionheaderMapper;
32
+    @Resource
33
+    com.zjt.mapper.ProductionVarietyDetailColourMapper ProductionVarietyDetailColourMapper;
27 34
     @Override
28 35
     public List<ProductionVarietyDetail> selectvarietyList() {
29 36
         List<ProductionVarietyDetail> productionVarietyDetails = ProductionVarietyDetailMapper.selectvarietyList();
@@ -31,8 +38,22 @@ public class ProductionVarietyDetailServiceImpl extends ServiceImpl<ProductionVa
31 38
     }
32 39
 
33 40
     @Override
34
-    public List<ProductionVarietyDetail> selectvarietyDetails(long  varietyId) {
35
-        List<ProductionVarietyDetail> productionVarietyDetails = ProductionVarietyDetailMapper.selectvarietyDetails(varietyId);
41
+    public List<ProductionVarietyDetail> selectvarietyDetails(String  variety) {
42
+        List<ProductionVarietyDetail> productionVarietyDetails = ProductionVarietyDetailMapper.selectvarietyDetails(variety);
36 43
         return productionVarietyDetails;
37 44
     }
45
+
46
+    @Override
47
+    public List<Productionheader> selectProductionheader(long varietyDetailId) {
48
+        List<Productionheader>productionheaderDetails = ProductionheaderMapper.selectProductionheader(varietyDetailId);
49
+        return productionheaderDetails;
50
+    }
51
+
52
+    @Override
53
+    public List<ProductionVarietyDetailColour> selectColour(long varietyDetailId) {
54
+        List<ProductionVarietyDetailColour>ProductionVarietyDetailColour = ProductionVarietyDetailColourMapper.selectColour(varietyDetailId);
55
+        return ProductionVarietyDetailColour;
56
+    }
57
+
58
+
38 59
 }

+ 23 - 5
src/main/java/com/zjt/web/ProductionVarietyDetailController.java

@@ -1,8 +1,11 @@
1 1
 package com.zjt.web;
2 2
 
3 3
 
4
+import com.alibaba.fastjson.JSON;
4 5
 import com.alibaba.fastjson.JSONArray;
5 6
 import com.zjt.entity.ProductionVarietyDetail;
7
+import com.zjt.entity.ProductionVarietyDetailColour;
8
+import com.zjt.entity.Productionheader;
6 9
 import com.zjt.service.IProductionVarietyDetailService;
7 10
 import com.zjt.service.IProductionVarietyService;
8 11
 import org.springframework.beans.factory.annotation.Autowired;
@@ -33,10 +36,9 @@ public class ProductionVarietyDetailController {
33 36
         return  JSONArray.toJSON(productionVarietyDetails).toString();
34 37
     }
35 38
     @RequestMapping("varietyDetailsLists")
36
-    public String selectvarietyDetails(@RequestParam("id") String id) {
37
-        if(id!=null||id!=""){
38
-            long l = Long.parseLong(id);
39
-            List<ProductionVarietyDetail> productionVarietyDetails = productionVarietyDetailService.selectvarietyDetails(l);
39
+    public String selectvarietyDetails(String variety) {
40
+        if(variety!=null||variety!=""){
41
+            List<ProductionVarietyDetail> productionVarietyDetails = productionVarietyDetailService.selectvarietyDetails(variety);
40 42
             return  JSONArray.toJSON(productionVarietyDetails).toString();
41 43
         }else{
42 44
             return  JSONArray.toJSON("").toString();
@@ -45,6 +47,22 @@ public class ProductionVarietyDetailController {
45 47
 
46 48
     @RequestMapping("productionheader")
47 49
     public String group(@RequestParam("id") String id){
48
-        return productionVarietyDetailService.group(brand);
50
+        if(id!=null||id!=""){
51
+            long l = Long.parseLong(id);
52
+            List<Productionheader> productionVarietyDetails = productionVarietyDetailService.selectProductionheader(l);
53
+            return  JSONArray.toJSON(productionVarietyDetails).toString();
54
+        }else{
55
+            return  JSONArray.toJSON("").toString();
56
+        }
57
+    }
58
+    @RequestMapping("selectColour")
59
+    public String selectColour(@RequestParam("id") String id){
60
+        if(id!=null||id!=""){
61
+            long l = Long.parseLong(id);
62
+            List<ProductionVarietyDetailColour> productionVarietyDetails = productionVarietyDetailService.selectColour(l);
63
+            return  JSONArray.toJSON(productionVarietyDetails).toString();
64
+        }else{
65
+            return  JSONArray.toJSON("").toString();
66
+        }
49 67
     }
50 68
 }

+ 0 - 1
src/main/java/com/zjt/web/ProductionheaderController.java

@@ -32,7 +32,6 @@ public class ProductionheaderController {
32 32
     public String selectVarietyAll() {
33 33
         productionVarietyService.varietyList();
34 34
         productionVarietyDetailService.selectvarietyList();
35
-        productionVarietyDetailService.selectvarietyDetails(1l);
36 35
         return VIEW_VARIETY_LIST;
37 36
     }
38 37
 

+ 4 - 0
src/main/resources/mapper/ProductionVarietyDetailColourMapper.xml

@@ -12,4 +12,8 @@
12 12
         where variety_details_id=#{varietyId}
13 13
     </select>
14 14
 
15
+    <select id="selectColour" resultMap="BaseResultMap">
16
+        select * from production_variety_detail_colour
17
+        where variety_details_id=#{varietyDetailId}
18
+    </select>
15 19
 </mapper>

+ 1 - 1
src/main/resources/mapper/ProductionVarietyDetailMapper.xml

@@ -31,6 +31,6 @@
31 31
     <select id="selectvarietyDetails" resultMap="BaseResultMap">
32 32
         select <include refid="Base_Column_List" />
33 33
         from production_variety_detail
34
-        where variety_id = #{varietyId}
34
+        where variety = #{variety}
35 35
     </select>
36 36
 </mapper>

+ 13 - 1
src/main/resources/mapper/ProductionheaderMapper.xml

@@ -3,6 +3,18 @@
3 3
 <mapper namespace="com.zjt.mapper.ProductionheaderMapper">
4 4
     <!-- 通用查询结果映射 -->
5 5
     <resultMap id="BaseResultMap" type="com.zjt.entity.Productionheader">
6
-        <!-- 请根据实际实体类字段进行配置 -->
6
+        <id column="variety_detail_id" jdbcType="FLOAT" property="varietyDetailId" />
7
+        <result column="variety_id" jdbcType="VARCHAR" property="varietyId" />
8
+        <result column="product_code" jdbcType="VARCHAR" property="productCode" />
9
+        <result column="product_name" jdbcType="VARCHAR" property="productName" />
7 10
     </resultMap>
11
+    <sql id="Base_Column_List">
12
+        variety_detail_id, variety_id, product_code, product_name
13
+    </sql>
14
+
15
+    <select id="selectProductionheader"  resultMap="BaseResultMap">
16
+        select  *
17
+        from productionheader
18
+        where variety_detail_id = #{varietyDetailId}
19
+    </select>
8 20
 </mapper>

+ 104 - 87
src/main/resources/templates/mypackage/varietyList.ftl

@@ -35,18 +35,18 @@
35 35
                             <option value="">品牌</option>
36 36
                         </select>
37 37
                     </div>
38
-                    <div class="layui-input-inline" style="width: 200px;">
38
+<#--                    <div class="layui-input-inline" style="width: 200px;">
39 39
                         <select name="materialGroup" id ="materialGroup" class="county-selector" data-value="物料组" lay-filter="materialGroup"  lay-search="">
40 40
                             <option value="">物料组</option>
41 41
                         </select>
42
-                    </div>
42
+                    </div>-->
43 43
                     <div class="layui-input-inline" style="width: 400px;">
44
-                        <select name="materialdetil" id ="materialdetil" class="county-selector" data-value="物料描述" lay-filter="materialdetil">
45
-                            <option value="">物料描述</option>
44
+                        <select name="productName" id ="productName" class="county-selector" data-value="物料描述" lay-filter="productName">
45
+<#--                            <option value="">物料描述</option>-->
46 46
                         </select>
47 47
                     </div>
48 48
                     <div class="layui-input-inline" style="width: 200px;">
49
-                        <select name="materialCode" id ="materialCode" class="county-selector" data-value="物料编码" lay-filter="materialCode">
49
+                        <select name="productCode" id ="productCode" class="county-selector" data-value="物料编码" lay-filter="productCode">
50 50
                             <option value="">物料编码</option>
51 51
                         </select>
52 52
                     </div>
@@ -70,40 +70,29 @@
70 70
                     <thead style="align: center">
71 71
                     <tr style="align: center">
72 72
                         <th style = "width: 200px"> 操作</th>
73
-                        <th style = "width: 200px"> 镜片位置</th>
74
-                        <th style = "width: 200px"> 采购/退货</th>
75
-                        <th style = "width: 200px"> 用户名</th>
76 73
                         <th style = "width: 300px"> 物料编码</th>
77
-                        <th style = "width: 800px"> 物料描述</th>
78
-                        <th style = "width: 300px"> 物料价格</th>
79
-                        <th style = "width: 300px"> 数量</th>
80
-                        <th style = "width: 300px"> 球镜</th>
81
-                        <th style = "width: 300px"> 柱镜</th>
82
-                        <th style = "width: 300px"> 轴位</th>
83
-                        <th style = "width: 300px"> 瞳距</th>
84
-                        <th style = "width: 300px"> 瞳高</th>
85
-                        <th style = "width: 300px"> 下加光</th>
86
-                        <th style = "width: 300px"> 通道</th>
87
-                        <th style = "width: 300px"> 棱镜</th>
88
-                        <th style = "width: 300px"> 镜片度数</th>
89
-                        <th style = "width: 300px"> 镜片型号/基弧</th>
90
-                        <th style = "width: 300px"> 是否染色</th>
91
-                        <th style = "width: 300px"> 色度</th>
92
-                        <th style = "width: 300px"> 来板染色</th>
93
-                        <th style = "width: 300px"> 厂家色板</th>
94
-                        <th style = "width: 300px"> 标准色号</th>
95
-                        <th style = "width: 300px"> 美薄加工</th>
96
-                        <th style = "width: 300px"> 丽薄加工</th>
97
-                        <th style = "width: 300px"> 镜架框形</th>
98
-                        <th style = "width: 300px"> 镜架高度</th>
99
-                        <th style = "width: 300px"> 鼻梁间距</th>
100
-                        <th style = "width: 300px"> 水平宽度</th>
101
-                        <th style = "width: 300px"> 加工镜架框形</th>
102
-                        <th style = "width: 300px"> 颜色</th>
103
-                        <th style = "width: 300px"> 直径</th>
104
-                        <th style = "width: 300px"> 片型</th>
105
-                        <th style = "width: 300px"> 片色</th>
74
+                        <th style = "width: 500px"> 物料描述</th>
75
+                        <th style = "width: 100px"> 颜色</th>
76
+                        <th style = "width: 200px"> 镜片位置</th>
77
+                        <th style = "width: 150px"> 球镜</th>
78
+                        <th style = "width: 150px"> 柱镜</th>
79
+                        <th style = "width: 150px"> 轴位</th>
80
+                        <th style = "width: 150px"> 通道</th>
81
+                        <th style = "width: 150px"> 下加光</th>
106 82
                         <th style = "width: 300px">备注</th>
83
+                        <th style = "width: 150px"> 零售价格</th>
84
+                        <th style = "width: 300px"> 光度范围</th>
85
+                        <th style = "width: 150px"> 光度说明</th>
86
+                        <th style = "width: 150px"> 单眼瞳距</th>
87
+                        <th style = "width: 150px"> 单眼瞳高</th>
88
+                        <th style = "width: 150px"> 镜眼间距</th>
89
+                        <th style = "width: 150px"> 前倾角</th>
90
+                        <th style = "width: 150px"> 镜架面弯</th>
91
+                        <th style = "width: 150px"> 习惯阅读距离</th>
92
+                        <th style = "width: 150px"> 近用瞳距</th>
93
+                        <th style = "width: 150px"> NVB</th>
94
+                        <th style = "width: 75px"> 主视眼</th>
95
+                        <th style = "width: 150px"> ERCD</th>
107 96
                     </tr>
108 97
                     </thead>
109 98
                     <tbody style="text-align: center">
@@ -126,7 +115,7 @@
126 115
         form.render();
127 116
     });
128 117
     layui.use(['form', 'table', "laydate", 'layer','jquery'], function () {
129
-        var materialdetil=null;
118
+        var productName=null;
130 119
         var material=null;
131 120
         var form = layui.form;
132 121
         var table = layui.table;
@@ -138,17 +127,17 @@
138 127
             success: function (data) {
139 128
                 $("#materialType").empty();
140 129
                 $.each($.parseJSON(data), function(idx, obj) {
141
-                    $("#materialType").append("<option value=\""+obj.varietyId+"\">"+obj.variety+"</option>");
142
-                });
130
+                    $("#materialType").append("<option value=\""+obj.varietyId+"\" data-variety=\""+obj.variety+"\">"+obj.variety+"</option>");                });
143 131
                 layui.form.render("select");
144 132
             },error:function (xhr, status, error) {
145 133
                 layer.alert('请求失败: ' + error);
146 134
             }});
147 135
         form.on('select(materialType)', function(data){
136
+            var variety = $(data.elem).find("option:selected").text();
148 137
             $.ajax({
149 138
                 url: 'varietyDetailsLists',
150 139
                 type: 'post',
151
-                data:{'id':data.value},
140
+                data:{'variety':variety},
152 141
                 success: function (data) {
153 142
                     $("#brand").empty();
154 143
                     $("#brand").append('<option value="">品牌</option>');
@@ -161,7 +150,7 @@
161 150
                     layer.alert('请求失败: ' + error);
162 151
                 }});
163 152
         });
164
-        form.on('select(brand)', function(data){
153
+/*        form.on('select(brand)', function(data){
165 154
             $.ajax({
166 155
                 url: 'group',
167 156
                 type: 'post',
@@ -177,17 +166,23 @@
177 166
                 },error:function (xhr, status, error) {
178 167
                     layer.alert('请求失败: ' + error);
179 168
                 }});
180
-        });
181
-        form.on('select(materialGroup)', function(data){
169
+        });*/
170
+        form.on('select(brand)', function(data){
182 171
             $.ajax({
183
-                url: 'price',
172
+                url: 'productionheader',
184 173
                 type: 'post',
185
-                data:{'group':data.value},
174
+                data:{'id':data.value},
186 175
                 success: function (data) {
187
-                    $("#materialdetil").empty();
188
-                    $("#materialdetil").append('<option value="">物料描述</option>');
176
+                    layer.alert('请求失败: ' + data);
177
+                    $("#productName").empty();$("#productCode").empty();$("#varietyDetailId").empty();
178
+
179
+                // $("#productName").append('<option value="">物料描述</option>');
189 180
                     $.each($.parseJSON(data), function(idx, obj) {
190
-                        $("#materialdetil").append("<option value=\""+obj.materialCode+"\">"+obj.materialName+"</option>");
181
+                        $("#productName").append("<option value=\""+obj.productName+"\" data-variety-detail-id=\""+obj.varietyDetailId+"\">"+obj.productName+"</option>");
182
+                        $("#productCode").append("<option value=\""+obj.productCode+"\" data-variety-detail-id=\""+obj.varietyDetailId+"\">"+obj.productCode+"</option>");
183
+
184
+                        /*$("#productName").append("<option value=\""+obj.productName+"\">"+obj.productName+"</option>");
185
+                        $("#productCode").append("<option value=\""+obj.productCode+"\">"+obj.productCode+"</option>");*/
191 186
                     });
192 187
                     layui.form.render("select");
193 188
                 },error:function (xhr, status, error) {
@@ -201,7 +196,7 @@
201 196
                 type: 'post',
202 197
                 data:{'code':data.value},
203 198
                 success: function (data) {
204
-                    $("#materialCode").empty();
199
+                    $("#materialCode").empty();$("#materialdetil").empty();
205 200
                     $("#materialRealPrice").empty();
206 201
                     $.each($.parseJSON(data), function(idx, obj) {
207 202
                         $("#materialCode").append("<option value=\""+obj.materialCode+"\">"+obj.materialCode+"</option>");
@@ -215,52 +210,74 @@
215 210
 
216 211
         //因为动态添加的元素class属性是无效的,所以不能用$('.add').click(function(){});
217 212
         window.addtable= function(){
213
+            var selectedVarietyDetailId = $('#productName option:selected').data('variety-detail-id') ||
214
+                $('#productCode option:selected').data('variety-detail-id');
215
+            layer.alert(selectedVarietyDetailId);
216
+            $.ajax({
217
+                url: 'selectColour',
218
+                type: 'post',
219
+                data:{'id':selectedVarietyDetailId},
220
+                success: function (data) {
221
+                    $("#colour").empty();
222
+                    $("#colour").append('<option value="">颜色</option>');
223
+                    $.each($.parseJSON(data), function(idx, obj) {
224
+                        $("#colour").append("<option value=\""+obj.id+"\">"+obj.colour+"</option>");
225
+                    });
226
+
227
+                    layui.form.render("select");
228
+                },error:function (xhr, status, error) {
229
+                    layer.alert('请求失败: ' + error);
230
+                }});
231
+            $.ajax({
232
+                url: 'productionheader',
233
+                type: 'post',
234
+                data:{'id':selectedVarietyDetailId},
235
+                success: function (data) {
236
+                    layer.alert('请求失败: ' + data);
237
+                    $("#productName").empty();$("#productCode").empty();$("#varietyDetailId").empty();
238
+
239
+                    $.each($.parseJSON(data), function(idx, obj) {
240
+                        $("#productName").append("<option value=\""+obj.productName+"\" data-variety-detail-id=\""+obj.varietyDetailId+"\">"+obj.productName+"</option>");
241
+                        $("#productCode").append("<option value=\""+obj.productCode+"\" data-variety-detail-id=\""+obj.varietyDetailId+"\">"+obj.productCode+"</option>");
242
+
243
+                    });
244
+                    layui.form.render("select");
245
+                },error:function (xhr, status, error) {
246
+                    layer.alert('请求失败: ' + error);
247
+                }});
218 248
             var html = '<tr>'+
219 249
                 '<td style = "width: 100px"><input type="button" class="layui-btn layui-btn-radius" onclick="dele(this)" value="删除" /></td>'+
250
+                '<td style = "width: 200px"> <input type="text" name="materialCode" required lay-verify="required"   placeholder="物料编码" autocomplete="off" class="layui-input"  readonly="true" value="'+ $('#productCode option:selected').text()+'"/></td>'+
251
+                '<td style = "width: 500px"> <input type="text" name="materialDetile"  required lay-verify="required"  placeholder="物料描述" autocomplete="off" class="layui-input"  readonly="true" value="'+$('#productName option:selected').text()+'"/></td>'+
252
+                '<td style = "width: 100px">' +
253
+                '<select name="colour" id ="colour" class="county-selector"  placeholder="颜色" lay-filter="productName">'+
254
+                '</select></td>'+
220 255
                 '<td style="width:200px">'+
221 256
                 '<select name="WZ" lay-verify="required">'+
222 257
                 '<option value="">--请选择--</option>'+
223 258
                 '<option value="L">L</option>'+
224 259
                 '<option value="R">R</option>'+
225 260
                 '</select></td>'+
226
-                '<td style="width:300px">'+
227
-                '<select name="LY" lay-verify="required">'+
228
-                '<option value="">--请选择--</option>'+
229
-                '<option value="C">采购</option>'+
230
-                '<option value="T">退货</option>'+
231
-                '</select></td>'+
232
-                '<td style = "width: 200px"> <input type="text" name="username" required lay-verify="required"   placeholder="用户名字" autocomplete="off" class="layui-input" readonly="true" value="${currentUser.userName!}"+"/></td>'+
233
-                '<td style = "width: 200px"> <input type="text" name="materialCode" required lay-verify="required"   placeholder="物料编码" autocomplete="off" class="layui-input"  readonly="true" value="'+ $('#materialCode option:selected').text()+'"/></td>'+
234
-                '<td style = "width: 800px"> <input type="text" name="materialDetile"  required lay-verify="required"  placeholder="物料描述" autocomplete="off" class="layui-input"  readonly="true" value="'+$('#materialdetil option:selected').text()+'"/></td>'+
235
-                '<td style = "width: 200px"> <input type="text" name="price" required lay-verify="required"   placeholder="价格" autocomplete="off" class="layui-input"  readonly="true" value="'+$('#materialRealPrice option:selected').text()+'"/></td>'+
236
-                '<td style = "width: 100px"> <input type="text" name="NUM" required lay-verify="required"   placeholder="数量" autocomplete="off" class="layui-input" value ="1"/></td>'+
237
-                '<td style = "width: 300px"> <input type="text" name="SPH"    placeholder="球镜" autocomplete="off" class="layui-input"></td>'+
238
-                '<td style = "width: 300px"> <input type="text" name="CYL"    placeholder="柱镜" autocomplete="off" class="layui-input"></td>'+
239
-                '<td style = "width: 300px"> <input type="text" name="AXIS"    placeholder="轴位" autocomplete="off" class="layui-input"></td>'+
240
-                '<td style = "width: 300px"> <input type="text" name="PDFOD"    placeholder="瞳距" autocomplete="off" class="layui-input"></td>'+
241
-                '<td style = "width: 300px"> <input type="text" name="PH"    placeholder="瞳高" autocomplete="off" class="layui-input"></td>'+
242
-                '<td style = "width: 300px"> <input type="text" name="XADD"    placeholder="下加光" autocomplete="off" class="layui-input"></td>'+
243
-                '<td style = "width: 300px"> <input type="text" name="YULIU1"    placeholder="通道" autocomplete="off" class="layui-input"></td>'+
244
-                '<td style = "width: 300px"> <input type="text" name="PRISM"    placeholder="棱镜" autocomplete="off" class="layui-input"></td>'+
245
-                '<td style = "width: 300px"> <input type="text" name="CVA"    placeholder="镜片度数" autocomplete="off" class="layui-input"></td>'+
246
-                '<td style = "width: 300px"> <input type="text" name="OPTICBC"    placeholder="镜片型号/基弧" autocomplete="off" class="layui-input"></td>'+
247
-                '<td style = "width: 300px"> <input type="text" name="RS"    placeholder="是否染色" autocomplete="off" class="layui-input"></td>'+
248
-                '<td style = "width: 300px"> <input type="text" name="SD"    placeholder="色度" autocomplete="off" class="layui-input"></td>'+
249
-                '<td style = "width: 300px"> <input type="text" name="LRS"    placeholder="来板染色" autocomplete="off" class="layui-input"></td>'+
250
-                '<td style = "width: 300px"> <input type="text" name="CRS"    placeholder="厂家色板" autocomplete="off" class="layui-input"></td>'+
251
-                '<td style = "width: 300px"> <input type="text" name="BRS"    placeholder="标准色号" autocomplete="off" class="layui-input"></td>'+
252
-                '<td style = "width: 300px"> <input type="text" name="MPRO"    placeholder="美薄加工" autocomplete="off" class="layui-input"></td>'+
253
-                '<td style = "width: 300px"> <input type="text" name="LBPO"    placeholder="丽薄加工" autocomplete="off" class="layui-input"></td>'+
254
-                '<td style = "width: 300px"> <input type="text" name="FRAMESHAPE"    placeholder="镜架框形" autocomplete="off" class="layui-input"></td>'+
255
-                '<td style = "width: 300px"> <input type="text" name="FRAMEHEIGHT"    placeholder="镜架高度" autocomplete="off" class="layui-input"></td>'+
256
-                '<td style = "width: 300px"> <input type="text" name="FRAMEBRIDGEWIDTH"    placeholder="鼻梁间距" autocomplete="off" class="layui-input"></td>'+
257
-                '<td style = "width: 300px"> <input type="text" name="SPK"    placeholder="水平宽度" autocomplete="off" class="layui-input"></td>'+
258
-                '<td style = "width: 300px"> <input type="text" name="JFRAMESHAPE"    placeholder="加工镜架框形" autocomplete="off" class="layui-input"></td>'+
259
-                '<td style = "width: 300px"> <input type="text" name="COLOR"    placeholder="颜色" autocomplete="off" class="layui-input"></td>'+
260
-                '<td style = "width: 300px"> <input type="text" name="lEN_DIAMETER"    placeholder="直径" autocomplete="off" class="layui-input"></td>'+
261
-                '<td style = "width: 300px"> <input type="text" name="PX"    placeholder="片型" autocomplete="off" class="layui-input"></td>'+
262
-                '<td style = "width: 300px"> <input type="text" name="PS"    placeholder="片色" autocomplete="off" class="layui-input"></td>'+
261
+                '<td style = "width: 150px"> <input type="text" name="SPH"    placeholder="球镜" autocomplete="off" class="layui-input"></td>'+
262
+                '<td style = "width: 150px"> <input type="text" name="CYL"    placeholder="柱镜" autocomplete="off" class="layui-input"></td>'+
263
+                '<td style = "width: 150px"> <input type="text" name="AXIS"    placeholder="轴位" autocomplete="off" class="layui-input"></td>'+
264
+                '<td style = "width: 150"> <input type="text" name="YULIU1"    placeholder="通道" autocomplete="off" class="layui-input"></td>'+
265
+                '<td style = "width: 150px"> <input type="text" name="XADD"    placeholder="下加光" autocomplete="off" class="layui-input"></td>'+
263 266
                 '<td style = "width: 300px"> <input type="text" name="MARK"    placeholder="备注" autocomplete="off" class="layui-input"></td>'+
267
+                '<td style = "width: 150px"> <input type="text" name="NUM" required lay-verify="required"   placeholder="零售价" autocomplete="off" class="layui-input" /></td>'+
268
+                '<td style = "width: 300px"> <input type="text" name="CVA"    placeholder="光度范围" autocomplete="off" class="layui-input"></td>'+
269
+                '<td style = "width: 150px"> <input type="text" name="SD"    placeholder="光度说明" autocomplete="off" class="layui-input"></td>'+
270
+                '<td style = "width: 150px"> <input type="text" name="PDFOD"    placeholder="单眼瞳距" autocomplete="off" class="layui-input"></td>'+
271
+                '<td style = "width: 150px"> <input type="text" name="PH"    placeholder="单眼瞳高" autocomplete="off" class="layui-input"></td>'+
272
+                '<td style = "width: 150px"> <input type="text" name="FRAMEBRIDGEWIDTH"    placeholder="镜眼距离" autocomplete="off" class="layui-input"></td>'+
273
+                '<td style = "width: 150px"> <input type="text" name="OPTICBC"    placeholder="前倾角" autocomplete="off" class="layui-input"></td>'+
274
+                '<td style = "width: 150px"> <input type="text" name="FRAMESHAPE"    placeholder="镜架面弯" autocomplete="off" class="layui-input"></td>'+
275
+                '<td style = "width: 150px"> <input type="text" name="FRAMEHEIGHT"    placeholder="习惯阅读距离" autocomplete="off" class="layui-input"></td>'+
276
+                '<td style = "width: 150px"> <input type="text" name="PRISM"    placeholder="近用瞳距" autocomplete="off" class="layui-input"></td>'+
277
+                '<td style = "width: 150px"> <input type="text" name="RS"    placeholder="NVB" autocomplete="off" class="layui-input"></td>'+
278
+                '<td style = "width: 75px"> <input type="text" name="LRS"    placeholder="主视眼" autocomplete="off" class="layui-input"></td>'+
279
+                '<td style = "width: 150px"> <input type="text" name="CRS"    placeholder="ERCD" autocomplete="off" class="layui-input"></td>'+
280
+
264 281
                 '</tr>';
265 282
             //添加到表格最后
266 283
             $(html).appendTo($('#table tbody:last'));