temp01 3 gün önce
ebeveyn
işleme
22ed14647d

+ 5 - 3
src/main/java/com/zjt/entity/ProductionVarietyTd.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,11 +24,11 @@ import lombok.experimental.Accessors;
22 24
 public class ProductionVarietyTd implements Serializable {
23 25
 
24 26
     private static final long serialVersionUID = 1L;
25
-
27
+    @Column(name = "variety")
26 28
     private String variety;
27
-
29
+    @Column(name = "variety_id")
28 30
     private Float varietyId;
29
-
31
+    @Column(name = "td")
30 32
     private Integer td;
31 33
 
32 34
 

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

@@ -72,11 +72,11 @@ public class Productionheader implements Serializable {
72 72
     @Column(name = "attribute")
73 73
     private String attribute;
74 74
 
75
-    @ApiModelProperty(value = "光度范围")
75
+    @ApiModelProperty(value = "光度说明")
76 76
     @Column(name = "diopter_range")
77 77
     private String diopterRange;
78 78
 
79
-    @ApiModelProperty(value = "范围说明")
79
+    @ApiModelProperty(value = "光度范围")
80 80
     @Column(name = "range_description")
81 81
     private String rangeDescription;
82 82
 
@@ -89,8 +89,12 @@ public class Productionheader implements Serializable {
89 89
     private String pupillaryHeight;
90 90
 
91 91
     @ApiModelProperty(value = "单眼瞳距(右)")
92
-    @Column(name = "single_eye_pupillary_distance")
93
-    private String singleEyePupillaryDistance;
92
+    @Column(name = "single_eye_pupillary_distance_right")
93
+    private String singleEyePupillaryDistanceRight;
94
+
95
+    @ApiModelProperty(value = "单眼瞳距(左)")
96
+    @Column(name = "single_eye_pupillary_distance_left")
97
+    private String singleEyePupillaryDistanceLeft;
94 98
 
95 99
     @ApiModelProperty(value = "镜眼距")
96 100
     @Column(name = "lens_edge_distance")

+ 105 - 34
src/main/java/com/zjt/entity/SaleorderHeader.java

@@ -1,21 +1,34 @@
1 1
 package com.zjt.entity;
2 2
 
3 3
 
4
-public class SaleorderHeader {
4
+import io.swagger.annotations.ApiModel;
5
+import lombok.EqualsAndHashCode;
6
+import lombok.experimental.Accessors;
7
+
8
+import javax.persistence.Column;
9
+import java.io.Serializable;
10
+import java.time.LocalDateTime;
11
+import java.util.Date;
12
+
13
+@EqualsAndHashCode
14
+@Accessors(chain = true)
15
+@ApiModel(value = "销售订单表")
16
+public class SaleorderHeader implements Serializable {
17
+    private static final long serialVersionUID = 1L;
5 18
     private String orderNumber;        // 订单编号
6 19
     private String variety;            // 品种
7 20
     private String details;            // 明细
8
-    private String color;              // 颜色
21
+    private String colour;              // 颜色
9 22
     private String position;           // 位置
10 23
     private String sphericalLens;      // 球镜
11 24
     private String cylindricalLens;    // 柱镜
12 25
     private String axis;               // 轴位
13 26
     private String channel;            // 通道
14
-    private String add;                // ADD
27
+    private String addNum;                // ADD
15 28
     private String remarks;            // 备注
16 29
     private String retailPrice;        // 零售价
17
-    private String diopterRange;       // 光度范围
18
-    private String diopterDescription; // 光度说明
30
+    private String diopterRange; // 光度说明
31
+    private String rangeDescription;       // 光度范围
19 32
     private String singleEyePupillaryDistance; // 单眼瞳距
20 33
     private String singleEyePupillaryDistanceRight; // 单眼右瞳距
21 34
     private String singleEyePupillaryDistanceLeft; // 单眼左瞳距
@@ -23,18 +36,24 @@ public class SaleorderHeader {
23 36
     private String frontAngle;         // 前倾角
24 37
     private String frameSurface;       // 镜架面
25 38
     private String habitReadingDistance; // 习惯阅读距离
26
-    private String nearUse;            // 近用
39
+    private String nearUsePupillaryDistance;            // 近用
27 40
     private String nvb;                // NVB
28 41
     private String mainVision;         // 主视
29 42
     private String ercd;               // ERCO
30
-    private String productCode;        // 商品编码
31
-    private String productName;        // 商品名称
32
-
43
+    private String materialCode;        // 商品编码
44
+    private String materialDetile;        // 商品名称
45
+    @Column(name = "create_time")
46
+    private Date createTime;
47
+    @Column(name = "update_time")
48
+    private Date updateTime;
33 49
     // 构造函数
34 50
     public SaleorderHeader() {
35 51
     }
36 52
 
37
-    // getter和setter方法
53
+    public static long getSerialVersionUID() {
54
+        return serialVersionUID;
55
+    }
56
+
38 57
     public String getOrderNumber() {
39 58
         return orderNumber;
40 59
     }
@@ -59,12 +78,12 @@ public class SaleorderHeader {
59 78
         this.details = details;
60 79
     }
61 80
 
62
-    public String getColor() {
63
-        return color;
81
+    public String getColour() {
82
+        return colour;
64 83
     }
65 84
 
66
-    public void setColor(String color) {
67
-        this.color = color;
85
+    public void setColour(String colour) {
86
+        this.colour = colour;
68 87
     }
69 88
 
70 89
     public String getPosition() {
@@ -107,12 +126,12 @@ public class SaleorderHeader {
107 126
         this.channel = channel;
108 127
     }
109 128
 
110
-    public String getAdd() {
111
-        return add;
129
+    public String getAddNum() {
130
+        return addNum;
112 131
     }
113 132
 
114
-    public void setAdd(String add) {
115
-        this.add = add;
133
+    public void setAddNum(String addNum) {
134
+        this.addNum = addNum;
116 135
     }
117 136
 
118 137
     public String getRemarks() {
@@ -139,12 +158,12 @@ public class SaleorderHeader {
139 158
         this.diopterRange = diopterRange;
140 159
     }
141 160
 
142
-    public String getDiopterDescription() {
143
-        return diopterDescription;
161
+    public String getRangeDescription() {
162
+        return rangeDescription;
144 163
     }
145 164
 
146
-    public void setDiopterDescription(String diopterDescription) {
147
-        this.diopterDescription = diopterDescription;
165
+    public void setRangeDescription(String rangeDescription) {
166
+        this.rangeDescription = rangeDescription;
148 167
     }
149 168
 
150 169
     public String getSingleEyePupillaryDistance() {
@@ -203,12 +222,13 @@ public class SaleorderHeader {
203 222
         this.habitReadingDistance = habitReadingDistance;
204 223
     }
205 224
 
206
-    public String getNearUse() {
207
-        return nearUse;
225
+
226
+    public String getNearUsePupillaryDistance() {
227
+        return nearUsePupillaryDistance;
208 228
     }
209 229
 
210
-    public void setNearUse(String nearUse) {
211
-        this.nearUse = nearUse;
230
+    public void setNearUsePupillaryDistance(String nearUsePupillaryDistance) {
231
+        this.nearUsePupillaryDistance = nearUsePupillaryDistance;
212 232
     }
213 233
 
214 234
     public String getNvb() {
@@ -235,20 +255,71 @@ public class SaleorderHeader {
235 255
         this.ercd = ercd;
236 256
     }
237 257
 
238
-    public String getProductCode() {
239
-        return productCode;
258
+    public String getMaterialCode() {
259
+        return materialCode;
260
+    }
261
+
262
+    public void setMaterialCode(String materialCode) {
263
+        this.materialCode = materialCode;
264
+    }
265
+
266
+    public String getMaterialDetile() {
267
+        return materialDetile;
268
+    }
269
+
270
+    public void setMaterialDetile(String materialDetile) {
271
+        this.materialDetile = materialDetile;
272
+    }
273
+
274
+    public Date getCreateTime() {
275
+        return createTime;
276
+    }
277
+
278
+    public void setCreateTime(Date createTime) {
279
+        this.createTime = createTime;
240 280
     }
241 281
 
242
-    public void setProductCode(String productCode) {
243
-        this.productCode = productCode;
282
+    public Date getUpdateTime() {
283
+        return updateTime;
244 284
     }
245 285
 
246
-    public String getProductName() {
247
-        return productName;
286
+    public void setUpdateTime(Date updateTime) {
287
+        this.updateTime = updateTime;
248 288
     }
249 289
 
250
-    public void setProductName(String productName) {
251
-        this.productName = productName;
290
+    @Override
291
+    public String toString() {
292
+        return "SaleorderHeader{" +
293
+                "orderNumber='" + orderNumber + '\'' +
294
+                ", variety='" + variety + '\'' +
295
+                ", details='" + details + '\'' +
296
+                ", colour='" + colour + '\'' +
297
+                ", position='" + position + '\'' +
298
+                ", sphericalLens='" + sphericalLens + '\'' +
299
+                ", cylindricalLens='" + cylindricalLens + '\'' +
300
+                ", axis='" + axis + '\'' +
301
+                ", channel='" + channel + '\'' +
302
+                ", addNum='" + addNum + '\'' +
303
+                ", remarks='" + remarks + '\'' +
304
+                ", retailPrice='" + retailPrice + '\'' +
305
+                ", diopterRange='" + diopterRange + '\'' +
306
+                ", rangeDescription='" + rangeDescription + '\'' +
307
+                ", singleEyePupillaryDistance='" + singleEyePupillaryDistance + '\'' +
308
+                ", singleEyePupillaryDistanceRight='" + singleEyePupillaryDistanceRight + '\'' +
309
+                ", singleEyePupillaryDistanceLeft='" + singleEyePupillaryDistanceLeft + '\'' +
310
+                ", lensEdgeDistance='" + lensEdgeDistance + '\'' +
311
+                ", frontAngle='" + frontAngle + '\'' +
312
+                ", frameSurface='" + frameSurface + '\'' +
313
+                ", habitReadingDistance='" + habitReadingDistance + '\'' +
314
+                ", nearUsePupillaryDistance='" + nearUsePupillaryDistance + '\'' +
315
+                ", nvb='" + nvb + '\'' +
316
+                ", mainVision='" + mainVision + '\'' +
317
+                ", ercd='" + ercd + '\'' +
318
+                ", materialCode='" + materialCode + '\'' +
319
+                ", materialDetile='" + materialDetile + '\'' +
320
+                ", createTime=" + createTime +
321
+                ", updateTime=" + updateTime +
322
+                '}';
252 323
     }
253 324
 }
254 325
 

+ 3 - 0
src/main/java/com/zjt/mapper/ProductionVarietyTdMapper.java

@@ -3,6 +3,8 @@ package com.zjt.mapper;
3 3
 import com.zjt.entity.ProductionVarietyTd;
4 4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 5
 
6
+import java.util.List;
7
+
6 8
 /**
7 9
  * <p>
8 10
  *  Mapper 接口
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
13 15
  */
14 16
 public interface ProductionVarietyTdMapper extends BaseMapper<ProductionVarietyTd> {
15 17
 
18
+    List<ProductionVarietyTd> selectChannel(long varietyId);
16 19
 }

+ 9 - 0
src/main/java/com/zjt/mapper/SaleorderHeaderMapper.java

@@ -0,0 +1,9 @@
1
+package com.zjt.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.zjt.entity.SaleorderHeader;
5
+
6
+public interface SaleorderHeaderMapper extends BaseMapper<SaleorderHeader> {
7
+
8
+    void insertSh(SaleorderHeader saleorderHeader);
9
+}

+ 5 - 3
src/main/java/com/zjt/service/IProductionVarietyDetailService.java

@@ -1,9 +1,7 @@
1 1
 package com.zjt.service;
2 2
 
3
-import com.zjt.entity.ProductionVarietyDetail;
3
+import com.zjt.entity.*;
4 4
 import com.baomidou.mybatisplus.extension.service.IService;
5
-import com.zjt.entity.ProductionVarietyDetailColour;
6
-import com.zjt.entity.Productionheader;
7 5
 
8 6
 import java.util.List;
9 7
 
@@ -22,4 +20,8 @@ public interface IProductionVarietyDetailService extends IService<ProductionVari
22 20
     List<Productionheader> selectProductionheader(long varietyDetailId);
23 21
 
24 22
     List<ProductionVarietyDetailColour> selectColour(long varietyDetailId);
23
+
24
+    List<ProductionVarietyTd> selectChannel(long varietyId);
25
+
26
+    void insertSh(SaleorderHeader saleorderHeader);
25 27
 }

+ 18 - 7
src/main/java/com/zjt/service/impl/ProductionVarietyDetailServiceImpl.java

@@ -1,12 +1,8 @@
1 1
 package com.zjt.service.impl;
2 2
 
3
-import com.zjt.entity.ProductionVarietyDetail;
4
-import com.zjt.entity.ProductionVarietyDetailColour;
5
-import com.zjt.entity.Productionheader;
3
+import com.zjt.entity.*;
4
+import com.zjt.mapper.*;
6 5
 import com.zjt.mapper.ProductionVarietyDetailColourMapper;
7
-import com.zjt.mapper.ProductionVarietyDetailMapper;
8
-import com.zjt.mapper.ProductionVarietyMapper;
9
-import com.zjt.mapper.ProductionheaderMapper;
10 6
 import com.zjt.service.IProductionVarietyDetailService;
11 7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
12 8
 import org.springframework.stereotype.Service;
@@ -30,7 +26,11 @@ public class ProductionVarietyDetailServiceImpl extends ServiceImpl<ProductionVa
30 26
     @Resource
31 27
     ProductionheaderMapper ProductionheaderMapper;
32 28
     @Resource
33
-    com.zjt.mapper.ProductionVarietyDetailColourMapper ProductionVarietyDetailColourMapper;
29
+    ProductionVarietyDetailColourMapper ProductionVarietyDetailColourMapper;
30
+    @Resource
31
+    ProductionVarietyTdMapper ProductionVarietyTdMapper;
32
+    @Resource
33
+    SaleorderHeaderMapper SaleorderHeaderMapper;
34 34
     @Override
35 35
     public List<ProductionVarietyDetail> selectvarietyList() {
36 36
         List<ProductionVarietyDetail> productionVarietyDetails = ProductionVarietyDetailMapper.selectvarietyList();
@@ -55,5 +55,16 @@ public class ProductionVarietyDetailServiceImpl extends ServiceImpl<ProductionVa
55 55
         return ProductionVarietyDetailColour;
56 56
     }
57 57
 
58
+    @Override
59
+    public List<ProductionVarietyTd> selectChannel(long varietyId) {
60
+        List<ProductionVarietyTd> ProductionVarietyTd=ProductionVarietyTdMapper.selectChannel(varietyId);
61
+        return ProductionVarietyTd;
62
+    }
63
+
64
+    @Override
65
+    public void insertSh(SaleorderHeader saleorderHeader) {
66
+        SaleorderHeaderMapper.insertSh(saleorderHeader);
67
+    }
68
+
58 69
 
59 70
 }

+ 38 - 3
src/main/java/com/zjt/web/ProductionVarietyDetailController.java

@@ -3,9 +3,7 @@ package com.zjt.web;
3 3
 
4 4
 import com.alibaba.fastjson.JSON;
5 5
 import com.alibaba.fastjson.JSONArray;
6
-import com.zjt.entity.ProductionVarietyDetail;
7
-import com.zjt.entity.ProductionVarietyDetailColour;
8
-import com.zjt.entity.Productionheader;
6
+import com.zjt.entity.*;
9 7
 import com.zjt.service.IProductionVarietyDetailService;
10 8
 import com.zjt.service.IProductionVarietyService;
11 9
 import org.springframework.beans.factory.annotation.Autowired;
@@ -15,7 +13,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
15 13
 import org.springframework.web.bind.annotation.RequestParam;
16 14
 import org.springframework.web.bind.annotation.RestController;
17 15
 
16
+import javax.servlet.http.HttpSession;
17
+import java.text.SimpleDateFormat;
18
+import java.util.Date;
18 19
 import java.util.List;
20
+import java.util.function.Consumer;
19 21
 
20 22
 /**
21 23
  * <p>
@@ -50,6 +52,7 @@ public class ProductionVarietyDetailController {
50 52
         if(id!=null||id!=""){
51 53
             long l = Long.parseLong(id);
52 54
             List<Productionheader> productionVarietyDetails = productionVarietyDetailService.selectProductionheader(l);
55
+            System.out.println("输出的值为:"+productionVarietyDetails);
53 56
             return  JSONArray.toJSON(productionVarietyDetails).toString();
54 57
         }else{
55 58
             return  JSONArray.toJSON("").toString();
@@ -65,4 +68,36 @@ public class ProductionVarietyDetailController {
65 68
             return  JSONArray.toJSON("").toString();
66 69
         }
67 70
     }
71
+    @RequestMapping("selectChannel")
72
+    public String selectChannel(@RequestParam("id") String id){
73
+        if(id!=null||id!=""){
74
+            long l = Long.parseLong(id);
75
+            List<ProductionVarietyTd>  ProductionVarietyTdDetails= productionVarietyDetailService.selectChannel(l);
76
+            return  JSONArray.toJSON(ProductionVarietyTdDetails).toString();
77
+        }else{
78
+            return  JSONArray.toJSON("").toString();
79
+        }
80
+    }
81
+    @RequestMapping("insert")
82
+    public String insert(@RequestParam("list") String userList, HttpSession session) {
83
+        List<SaleorderHeader> SaleorderHeaders = JSON.parseArray(userList, SaleorderHeader.class);
84
+        Tuser user = (Tuser) session.getAttribute("currentUser");
85
+        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
86
+        String s = user.getId() + "" + df.format(new Date());
87
+
88
+        Consumer<SaleorderHeader> consumer = productionVarietyDetailService::insertSh;
89
+
90
+        SaleorderHeaders.stream()
91
+                .filter(a -> a.getMaterialCode() != null && a.getPosition() != null)
92
+                .map(a -> {
93
+                    a.setOrderNumber(s);
94
+//                    a.setUsername(user.getTrueName());
95
+                    a.setCreateTime(new Date());
96
+//                    a.setStore(user.getUserName());
97
+                    return a;
98
+                })
99
+                .forEach(consumer);
100
+
101
+        return "mypackage/varietyList";
102
+    }
68 103
 }

+ 10 - 1
src/main/resources/mapper/ProductionVarietyTdMapper.xml

@@ -1,5 +1,14 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.zjt.mapper.ProductionVarietyTdMapper">
4
-
4
+    <resultMap id="BaseResultMap" type="com.zjt.entity.ProductionVarietyTd">
5
+        <id column="variety_detail_id" jdbcType="FLOAT" property="varietyDetailId" />
6
+        <result column="variety_id" jdbcType="VARCHAR" property="varietyId" />
7
+        <result column="variety" jdbcType="VARCHAR" property="variety" />
8
+        <result column="td" jdbcType="VARCHAR" property="td" />
9
+    </resultMap>
10
+    <select id="selectChannel" resultMap="BaseResultMap">
11
+        select * from production_variety_td
12
+        where variety_id=#{varietyId}
13
+    </select>
5 14
 </mapper>

+ 24 - 0
src/main/resources/mapper/ProductionheaderMapper.xml

@@ -7,6 +7,30 @@
7 7
         <result column="variety_id" jdbcType="VARCHAR" property="varietyId" />
8 8
         <result column="product_code" jdbcType="VARCHAR" property="productCode" />
9 9
         <result column="product_name" jdbcType="VARCHAR" property="productName" />
10
+        <result column="series" jdbcType="VARCHAR" property="series" />
11
+        <result column="product1" jdbcType="VARCHAR" property="product1" />
12
+        <result column="product" jdbcType="VARCHAR" property="product" />
13
+        <result column="design" jdbcType="VARCHAR" property="design" />
14
+        <result column="refractive_index" jdbcType="VARCHAR" property="refractiveIndex" />
15
+        <result column="coating" jdbcType="VARCHAR" property="coating" />
16
+        <result column="color" jdbcType="VARCHAR" property="color" />
17
+        <result column="attribute" jdbcType="VARCHAR" property="attribute" />
18
+        <result column="diopter_range" jdbcType="VARCHAR" property="diopterRange" />
19
+        <result column="range_description" jdbcType="VARCHAR" property="rangeDescription" />
20
+        <result column="retail_price" jdbcType="VARCHAR" property="retailPrice" />
21
+        <result column="pupillary_height" jdbcType="VARCHAR" property="pupillaryHeight" />
22
+        <result column="single_eye_pupillary_distance_right" jdbcType="VARCHAR" property="singleEyePupillaryDistanceRight" />
23
+        <result column="lens_edge_distance" jdbcType="VARCHAR" property="lensEdgeDistance" />
24
+        <result column="front_angle" jdbcType="VARCHAR" property="frontAngle" />
25
+        <result column="frame_surface" jdbcType="VARCHAR" property="frameSurface" />
26
+        <result column="habit_reading_distance" jdbcType="VARCHAR" property="habitReadingDistance" />
27
+        <result column="near_use_pupillary_distance" jdbcType="VARCHAR" property="nearUsePupillaryDistance" />
28
+        <result column="nvb" jdbcType="VARCHAR" property="nvb" />
29
+        <result column="main_vision" jdbcType="VARCHAR" property="mainVision" />
30
+        <result column="ercd" jdbcType="VARCHAR" property="ercd" />
31
+        <result column="STATUS" jdbcType="VARCHAR" property="status" />
32
+        <result column="create_Time" jdbcType="VARCHAR" property="createTime" />
33
+        <result column="update_Time" jdbcType="VARCHAR" property="updateTime" />
10 34
     </resultMap>
11 35
     <sql id="Base_Column_List">
12 36
         variety_detail_id, variety_id, product_code, product_name

+ 99 - 0
src/main/resources/mapper/SaleorderHeaderMapper.xml

@@ -0,0 +1,99 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="com.zjt.mapper.SaleorderHeaderMapper">
4
+    <resultMap id="BaseResultMap" type="com.zjt.entity.SaleorderHeader">
5
+        <result column="order_number" property="orderNumber" jdbcType="VARCHAR"></result>
6
+        <result column="variety" property="variety" jdbcType="VARCHAR"></result>
7
+        <result column="details" property="details" jdbcType="VARCHAR"></result>
8
+        <result column="colour" property="colour" jdbcType="VARCHAR"></result>
9
+        <result column="position" property="position" jdbcType="VARCHAR"></result>
10
+        <result column="spherical_lens" property="sphericalLens" jdbcType="VARCHAR"></result>
11
+        <result column="cylindrical_lens" property="cylindricalLens" jdbcType="VARCHAR"></result>
12
+        <result column="axis" property="axis" jdbcType="VARCHAR"></result>
13
+        <result column="channel" property="channel" jdbcType="VARCHAR"></result>
14
+        <result column="add_num" property="addNum" jdbcType="VARCHAR"></result>
15
+        <result column="remarks" property="remarks" jdbcType="VARCHAR"></result>
16
+        <result column="retail_price" property="retailPrice" jdbcType="VARCHAR"></result>
17
+        <result column="diopter_range" property="diopterRange" jdbcType="VARCHAR"></result>
18
+        <result column="range_description" property="rangeDescription" jdbcType="VARCHAR"></result>
19
+        <result column="single_eye_pupillary_distance" property="singleEyePupillaryDistance" jdbcType="VARCHAR"></result>
20
+        <result column="single_eye_pupillary_distance_right" property="singleEyePupillaryDistanceRight" jdbcType="VARCHAR"></result>
21
+        <result column="single_eye_pupillary_distance_left" property="singleEyePupillaryDistanceLeft" jdbcType="VARCHAR"></result>
22
+        <result column="lens_edge_distance" property="lensEdgeDistance" jdbcType="VARCHAR"></result>
23
+        <result column="front_angle" property="frontAngle" jdbcType="VARCHAR"></result>
24
+        <result column="frame_surface" property="frameSurface" jdbcType="VARCHAR"></result>
25
+        <result column="habit_reading_distance" property="habitReadingDistance" jdbcType="VARCHAR"></result>
26
+        <result column="near_use_pupillary_distance" property="nearUsePupillaryDistance" jdbcType="VARCHAR"></result>
27
+        <result column="nvb" property="nvb" jdbcType="VARCHAR"></result>
28
+        <result column="main_vision" property="mainVision" jdbcType="VARCHAR"></result>
29
+        <result column="ercd" property="ercd" jdbcType="VARCHAR"></result>
30
+        <result column="material_code" property="materialCode" jdbcType="VARCHAR"></result>
31
+        <result column="materia_detile" property="materialDetile" jdbcType="VARCHAR"></result>
32
+        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"></result>
33
+        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"></result>
34
+    </resultMap>
35
+
36
+    <insert id="insertSh" parameterType="com.zjt.entity.SaleorderHeader">
37
+        INSERT INTO saleorderheader (
38
+            order_number,
39
+            variety,
40
+            details,
41
+            colour,
42
+            position,
43
+            spherical_lens,
44
+            cylindrical_lens,
45
+            axis,
46
+            channel,
47
+            add_num,
48
+            remarks,
49
+            retail_price,
50
+            diopter_range,
51
+            range_description,
52
+            single_eye_pupillary_distance,
53
+            single_eye_pupillary_distance_right,
54
+            single_eye_pupillary_distance_left,
55
+            lens_edge_distance,
56
+            front_angle,
57
+            frame_surface,
58
+            habit_reading_distance,
59
+            near_use_pupillary_distance,
60
+            nvb,
61
+            main_vision,
62
+            ercd,
63
+            material_code,
64
+            materia_detile,
65
+            create_time,
66
+            update_time
67
+        ) VALUES (
68
+                     #{orderNumber,jdbcType=VARCHAR},
69
+                     #{variety,jdbcType=VARCHAR},
70
+                     #{details,jdbcType=VARCHAR},
71
+                     #{colour,jdbcType=VARCHAR},
72
+                     #{position,jdbcType=VARCHAR},
73
+                     #{sphericalLens,jdbcType=VARCHAR},
74
+                     #{cylindricalLens,jdbcType=VARCHAR},
75
+                     #{axis,jdbcType=VARCHAR},
76
+                     #{channel,jdbcType=VARCHAR},
77
+                     #{addNum,jdbcType=VARCHAR},
78
+                     #{remarks,jdbcType=VARCHAR},
79
+                     #{retailPrice,jdbcType=VARCHAR},
80
+                     #{diopterRange,jdbcType=VARCHAR},
81
+                     #{rangeDescription,jdbcType=VARCHAR},
82
+                     #{singleEyePupillaryDistance,jdbcType=VARCHAR},
83
+                     #{singleEyePupillaryDistanceRight,jdbcType=VARCHAR},
84
+                     #{singleEyePupillaryDistanceLeft,jdbcType=VARCHAR},
85
+                     #{lensEdgeDistance,jdbcType=VARCHAR},
86
+                     #{frontAngle,jdbcType=VARCHAR},
87
+                     #{frameSurface,jdbcType=VARCHAR},
88
+                     #{habitReadingDistance,jdbcType=VARCHAR},
89
+                     #{nearUsePupillaryDistance,jdbcType=VARCHAR},
90
+                     #{nvb,jdbcType=VARCHAR},
91
+                     #{mainVision,jdbcType=VARCHAR},
92
+                     #{ercd,jdbcType=VARCHAR},
93
+                     #{materialCode,jdbcType=VARCHAR},
94
+                     #{materialDetile,jdbcType=VARCHAR},
95
+                     #{createTime,jdbcType=TIMESTAMP},
96
+                     #{updateTime,jdbcType=TIMESTAMP}
97
+                 )
98
+    </insert>
99
+</mapper>

+ 110 - 53
src/main/resources/templates/mypackage/varietyList.ftl

@@ -142,8 +142,7 @@
142 142
                     $("#brand").empty();
143 143
                     $("#brand").append('<option value="">品牌</option>');
144 144
                     $.each($.parseJSON(data), function(idx, obj) {
145
-                        $("#brand").append("<option value=\""+obj.id+"\">"+obj.varietyDetails+"</option>");
146
-                    });
145
+                        $("#brand").append("<option value=\""+obj.id+"\" data-variety-id=\""+obj.varietyId+"\">"+obj.varietyDetails+"</option>");                    });
147 146
 
148 147
                     layui.form.render("select");
149 148
                 },error:function (xhr, status, error) {
@@ -173,7 +172,6 @@
173 172
                 type: 'post',
174 173
                 data:{'id':data.value},
175 174
                 success: function (data) {
176
-                    layer.alert('请求失败: ' + data);
177 175
                     $("#productName").empty();$("#productCode").empty();$("#varietyDetailId").empty();
178 176
 
179 177
                 // $("#productName").append('<option value="">物料描述</option>');
@@ -207,21 +205,97 @@
207 205
                     layer.alert('请求失败: ' + error);
208 206
                 }});
209 207
         });
208
+        function fillRowData(rowElement, data) {
209
+            var fieldMapping = {
210
+                'productCode': 'productCode',
211
+                'productName': 'productName',
212
+                'color': 'color',
213
+                'position': 'position',//镜片位置
214
+                'sphericalLens': 'sphericalLens',
215
+                'cylindricalLens': 'cylindricalLens',
216
+                'axis': 'axis',
217
+                'channel': 'channel',
218
+                'add': 'add',
219
+                'remarks': 'remarks',
220
+                'retailPrice': 'retailPrice',
221
+                'rangeDescription': 'rangeDescription',
222
+                'singleEyePupillaryDistanceRight': 'singleEyePupillaryDistanceRight',
223
+                'pupillaryHeight': 'pupillaryHeight',
224
+                'lensEdgeDistance': 'lensEdgeDistance',
225
+                'frontAngle': 'frontAngle',
226
+                'frameSurface': 'frameSurface',
227
+                'diopterRange': 'diopterRange',
228
+                'habitReadingDistance': 'habitReadingDistance',
229
+                'nearUsePupillaryDistance': 'nearUsePupillaryDistance',
230
+                'nvb': 'nvb',
231
+                'mainVision': 'mainVision',
232
+                'ercd': 'ercd',
233
+            };
210 234
 
235
+            $.each(fieldMapping, function(inputName, dataField) {
236
+                if (data[dataField]) {
237
+                    rowElement.find('input[name="' + inputName + '"]').val(data[dataField]);
238
+                }
239
+            });
240
+        }
211 241
         //因为动态添加的元素class属性是无效的,所以不能用$('.add').click(function(){});
212 242
         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);
243
+            var html = '<tr>'+
244
+                '<td style = "width: 100px"><input type="button" class="layui-btn layui-btn-radius" onclick="dele(this)" value="删除" /></td>'+
245
+                '<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>'+
246
+                '<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>'+
247
+                '<td style = "width: 100px">' +
248
+                '<select name="colour" class="county-selector"  placeholder="颜色" lay-filter="productName">'+
249
+                '</select></td>'+
250
+                '<td style="width:200px">'+
251
+                '<select name="position" placeholder="位置" lay-verify="required">'+
252
+                '<option value="">--请选择--</option>'+
253
+                '<option value="L">L</option>'+
254
+                '<option value="R">R</option>'+
255
+                '</select></td>'+
256
+                '<td style = "width: 150px"> <input type="text" name="sphericalLens"    placeholder="球镜" autocomplete="off" class="layui-input"></td>'+
257
+                '<td style = "width: 150px"> <input type="text" name="cylindricalLens"    placeholder="柱镜" autocomplete="off" class="layui-input"></td>'+
258
+                '<td style = "width: 150px"> <input type="text" name="axis"    placeholder="轴位" autocomplete="off" class="layui-input"></td>'+
259
+                '<td style = "width: 100px">' +
260
+                '<select name="channel" class="county-selector"  placeholder="通道" lay-filter="productName">'+
261
+                '</select></td>'+
262
+                '<td style = "width: 150px"> <input type="text" name="addNum"    placeholder="下加光" autocomplete="off" class="layui-input"></td>'+
263
+                '<td style = "width: 300px"> <input type="text" name="remarks"    placeholder="备注" autocomplete="off" class="layui-input"></td>'+
264
+                '<td style = "width: 150px"> <input type="text" name="retailPrice" required lay-verify="required"   placeholder="零售价" autocomplete="off" class="layui-input" /></td>'+
265
+                '<td style = "width: 300px"> <input type="text" name="rangeDescription"    placeholder="光度范围" autocomplete="off" class="layui-input"></td>'+
266
+                '<td style = "width: 150px"> <input type="text" name="diopterRange"    placeholder="光度说明" autocomplete="off" class="layui-input"></td>'+
267
+                '<td style = "width: 150px"> <input type="text" name="singleEyePupillaryDistance"    placeholder="单眼瞳距" autocomplete="off" class="layui-input"></td>'+
268
+                '<td style = "width: 150px"> <input type="text" name="pupillaryHeight"    placeholder="单眼瞳高" autocomplete="off" class="layui-input"></td>'+
269
+                '<td style = "width: 150px"> <input type="text" name="lensEdgeDistance"    placeholder="镜眼距离" autocomplete="off" class="layui-input"></td>'+
270
+                '<td style = "width: 150px"> <input type="text" name="frontAngle"    placeholder="前倾角" autocomplete="off" class="layui-input"></td>'+
271
+                '<td style = "width: 150px"> <input type="text" name="frameSurface"    placeholder="镜架面弯" autocomplete="off" class="layui-input"></td>'+
272
+                '<td style = "width: 150px"> <input type="text" name="habitReadingDistance"    placeholder="习惯阅读距离" autocomplete="off" class="layui-input"></td>'+
273
+                '<td style = "width: 150px"> <input type="text" name="nearUsePupillaryDistance"    placeholder="近用瞳距" autocomplete="off" class="layui-input"></td>'+
274
+                '<td style = "width: 150px"> <input type="text" name="nvb"    placeholder="NVB" autocomplete="off" class="layui-input"></td>'+
275
+                '<td style = "width: 75px"> <input type="text" name="mainVision"    placeholder="主视眼" autocomplete="off" class="layui-input"></td>'+
276
+                '<td style = "width: 150px"> <input type="text" name="ercd"    placeholder="ERCD" autocomplete="off" class="layui-input"></td>'+
277
+
278
+                '</tr>';
279
+            //添加到表格最后
280
+            $(html).appendTo($('#table tbody:last'));
281
+
282
+            var newRow = $('#table tbody tr:last');
283
+            var varietyId = $('#brand option:selected').data('variety-id');
284
+            var selectedVarietyDetailId = $('#productName option:selected').data('variety-id');
285
+            var selectedVarietyDetailId = $('#productName option:selected').data('variety-detail-id');
286
+            var currentRowColourId = 'colour_' + Date.now();
287
+            var currentRowChannelId = 'channel_' + Date.now();
288
+            newRow.find('select[name="colour"]').attr('id', currentRowColourId);
289
+            newRow.find('select[name="channel"]').attr('id', currentRowChannelId);
216 290
             $.ajax({
217 291
                 url: 'selectColour',
218 292
                 type: 'post',
219 293
                 data:{'id':selectedVarietyDetailId},
220 294
                 success: function (data) {
221
-                    $("#colour").empty();
222
-                    $("#colour").append('<option value="">颜色</option>');
295
+                    $("#" + currentRowColourId).empty();
296
+                    $("#" + currentRowColourId).append('<option value="">颜色</option>');
223 297
                     $.each($.parseJSON(data), function(idx, obj) {
224
-                        $("#colour").append("<option value=\""+obj.id+"\">"+obj.colour+"</option>");
298
+                        $("#" + currentRowColourId).append("<option value=\""+obj.colour+"\">"+obj.colour+"</option>");
225 299
                     });
226 300
 
227 301
                     layui.form.render("select");
@@ -229,58 +303,36 @@
229 303
                     layer.alert('请求失败: ' + error);
230 304
                 }});
231 305
             $.ajax({
232
-                url: 'productionheader',
306
+                url:'selectChannel',
233 307
                 type: 'post',
234
-                data:{'id':selectedVarietyDetailId},
308
+                data:{'id':varietyId},
235 309
                 success: function (data) {
236
-                    layer.alert('请求失败: ' + data);
237
-                    $("#productName").empty();$("#productCode").empty();$("#varietyDetailId").empty();
238
-
310
+                    $("#" + currentRowChannelId).empty();  // 使用当前行的唯一ID
311
+                    $("#" + currentRowChannelId).append('<option value="">通道</option>');  // 添加默认选项
239 312
                     $.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
-
313
+                        $("#" + currentRowChannelId).append("<option value=\""+obj.td+"\">"+obj.td+"</option>");  // 使用当前行的唯一ID
243 314
                     });
244
-                    layui.form.render("select");
315
+                    layui.form.render("select");  // 重新渲染表单
316
+                },
317
+                error:function (xhr, status, error) {
318
+                    layer.alert('请求失败: ' + error);
319
+                }
320
+            })
321
+            $.ajax({
322
+                url: 'productionheader',
323
+                type: 'post',
324
+                data:{'id':selectedVarietyDetailId},
325
+                success: function (data) {
326
+                    var parsedData = $.parseJSON(data);
327
+                    if (parsedData && parsedData.length > 0) {
328
+                        // 使用第一个对象的数据填充行
329
+                        var rowData = parsedData[0];
330
+                        fillRowData(newRow, rowData);
331
+                    }
245 332
                 },error:function (xhr, status, error) {
246 333
                     layer.alert('请求失败: ' + error);
247 334
                 }});
248
-            var html = '<tr>'+
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>'+
255
-                '<td style="width:200px">'+
256
-                '<select name="WZ" lay-verify="required">'+
257
-                '<option value="">--请选择--</option>'+
258
-                '<option value="L">L</option>'+
259
-                '<option value="R">R</option>'+
260
-                '</select></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>'+
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 335
 
281
-                '</tr>';
282
-            //添加到表格最后
283
-            $(html).appendTo($('#table tbody:last'));
284 336
             form.render();
285 337
         }
286 338
         window.dele= function (obj){
@@ -304,6 +356,11 @@
304 356
         window.adddata= function() {
305 357
             table=document.getElementById("table");
306 358
             let tr=table.getElementsByTagName("tr");
359
+
360
+/*            let productCode=table.getElementsByName("materialCode");
361
+            let productName=table.getElementsByName("materialDetile");
362
+            let colour=table.getElementsByName("colour");*/
363
+
307 364
             var arrayObj = new Array();
308 365
             for (var i=0; i<tr.length; i++){
309 366
                 let target=tr[i].querySelectorAll("[name]"),obj={};