2 Комити ddf1497264 ... c4052d1627

Аутор SHA1 Порука Датум
  Administrator c4052d1627 业务查询 пре 2 недеља
  Administrator bb4b99beef 业务查询 пре 3 недеља

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

@@ -22,6 +22,7 @@ import lombok.experimental.Accessors;
22 22
 public class ProductionVarietyDetail implements Serializable {
23 23
 
24 24
     private static final long serialVersionUID = 1L;
25
+    private Float id;
25 26
 
26 27
     private Float varietyId;
27 28
 

+ 4 - 1
src/main/java/com/zjt/service/IProductionheaderService.java

@@ -1,8 +1,11 @@
1 1
 package com.zjt.service;
2 2
 
3
+import com.baomidou.mybatisplus.core.injector.methods.SelectList;
3 4
 import com.zjt.entity.Productionheader;
4 5
 import com.baomidou.mybatisplus.extension.service.IService;
5 6
 
7
+import java.util.List;
8
+
6 9
 /**
7 10
  * <p>
8 11
  *  服务类
@@ -12,5 +15,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
12 15
  * @since 2025-09-25
13 16
  */
14 17
 public interface IProductionheaderService extends IService<Productionheader> {
15
-
18
+List<Productionheader> SelectList();
16 19
 }

+ 0 - 2
src/main/java/com/zjt/service/impl/MaterialTypeImp.java

@@ -37,8 +37,6 @@ public class MaterialTypeImp extends BaseService<type> implements MaterialType
37 37
             return ReturnDate;
38 38
         };
39 39
         List<type> materialType= typeMapper.selectAll();
40
-/*        ReturnDate ReturnDate=new ReturnDate();
41
-        List<ReturnDate> list= new ArrayList<ReturnDate>();*/
42 40
         List<ReturnDate> collect = materialType.parallelStream().map(dataMap).collect(Collectors.toList());
43 41
         return JSONArray.toJSON(collect).toString();
44 42
     }

+ 7 - 0
src/main/java/com/zjt/service/impl/ProductionheaderServiceImpl.java

@@ -6,6 +6,9 @@ import com.zjt.service.IProductionheaderService;
6 6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 7
 import org.springframework.stereotype.Service;
8 8
 
9
+import java.util.Collections;
10
+import java.util.List;
11
+
9 12
 /**
10 13
  * <p>
11 14
  *  服务实现类
@@ -17,4 +20,8 @@ import org.springframework.stereotype.Service;
17 20
 @Service
18 21
 public class ProductionheaderServiceImpl extends ServiceImpl<ProductionheaderMapper, Productionheader> implements IProductionheaderService {
19 22
 
23
+    @Override
24
+    public List<Productionheader> SelectList() {
25
+        return Collections.emptyList();
26
+    }
20 27
 }

+ 5 - 3
src/main/java/com/zjt/web/MyContraller.java

@@ -10,10 +10,12 @@ import com.zjt.service.MaterialType;
10 10
 import javax.annotation.Resource;
11 11
 
12 12
 @Controller
13
-@RequestMapping("/pos/user")
13
+@RequestMapping("/entity")
14 14
 public class MyContraller {
15 15
     @Resource
16 16
     private MaterialType MaterialType;
17
-
18
-
17
+    @RequestMapping("queryVarietyList")
18
+    public String selectvarietyList() {
19
+        return "mypackage/varietyList";
20
+    }
19 21
 }

+ 20 - 8
src/main/java/com/zjt/web/ProductionVarietyDetailController.java

@@ -1,6 +1,7 @@
1 1
 package com.zjt.web;
2 2
 
3 3
 
4
+import com.alibaba.fastjson.JSONArray;
4 5
 import com.zjt.entity.ProductionVarietyDetail;
5 6
 import com.zjt.service.IProductionVarietyDetailService;
6 7
 import com.zjt.service.IProductionVarietyService;
@@ -8,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
8 9
 import org.springframework.stereotype.Controller;
9 10
 import org.springframework.web.bind.annotation.RequestMapping;
10 11
 
12
+import org.springframework.web.bind.annotation.RequestParam;
11 13
 import org.springframework.web.bind.annotation.RestController;
12 14
 
13 15
 import java.util.List;
@@ -20,19 +22,29 @@ import java.util.List;
20 22
  * @author xxu
21 23
  * @since 2025-09-25
22 24
  */
23
-@Controller
25
+@RestController
24 26
 @RequestMapping("/entity")
25 27
 public class ProductionVarietyDetailController {
26 28
     @Autowired
27 29
     private IProductionVarietyDetailService productionVarietyDetailService;
28
-    @RequestMapping("varietyList")
30
+    @RequestMapping("varietyLists")
29 31
     public String selectvarietyList() {
30
-        productionVarietyDetailService.selectvarietyList();
31
-        return "success";
32
+        List<ProductionVarietyDetail> productionVarietyDetails = productionVarietyDetailService.selectvarietyList();
33
+        return  JSONArray.toJSON(productionVarietyDetails).toString();
32 34
     }
33
-    @RequestMapping("varietyDetailsList")
34
-    public String selectvarietyDetails() {
35
-        List<ProductionVarietyDetail> productionVarietyDetails = productionVarietyDetailService.selectvarietyDetails(1L);
36
-        return "mypackage/varietyList";
35
+    @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);
40
+            return  JSONArray.toJSON(productionVarietyDetails).toString();
41
+        }else{
42
+            return  JSONArray.toJSON("").toString();
43
+        }
44
+    }
45
+
46
+    @RequestMapping("productionheader")
47
+    public String group(@RequestParam("id") String id){
48
+        return productionVarietyDetailService.group(brand);
37 49
     }
38 50
 }

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

@@ -9,7 +9,7 @@
9 9
     </resultMap>
10 10
 
11 11
     <sql id="Base_Column_List">
12
-        variety_id, variety, variety_details
12
+        id,variety_id, variety, variety_details
13 13
     </sql>
14 14
     <select id="selectList" resultMap="BaseResultMap">
15 15
         select
@@ -25,7 +25,7 @@
25 25
     <insert id="insert" parameterType="com.zjt.entity.ProductionVarietyDetail">
26 26
     </insert>
27 27
     <select id="selectvarietyList" resultMap="BaseResultMap">
28
-        select variety_id,variety
28
+        select distinct variety_id,variety
29 29
         from production_variety_detail
30 30
     </select>
31 31
     <select id="selectvarietyDetails" resultMap="BaseResultMap">

+ 75 - 100
src/main/resources/templates/mypackage/varietyList.ftl

@@ -12,6 +12,7 @@
12 12
     <link rel="icon" href="${basePath!}/static/logo.png">
13 13
     <link rel="stylesheet" href="${basePath!}/static/layui/css/layui.css" media="all" />
14 14
     <link rel="stylesheet" href="${basePath!}/static/css/public.css" media="all" />
15
+    <script src="${basePath!}/static/layui/layui.js" charset="utf-8"></script>
15 16
     <script src="${basePath!}/static/layui/layui.all.js" charset="utf-8"></script>
16 17
     <script src="${basePath!}/static/layui/lay/modules/jquery.js"></script>
17 18
 </head>
@@ -24,12 +25,12 @@
24 25
             <form class="layui-form" action="">
25 26
                 <div class="layui-form-item" id="materialchoose">
26 27
                     <div class="layui-form-label">物料信息</div>
27
-                    <div class="layui-input-inline" style="width: 100px;">
28
-                        <select name="Variety" id="Variety" class="province-selector" data-value="品类" lay-filter="Variety" onclick="dele()" lay-search="">
28
+                    <div class="layui-input-inline" style="width: 300px;">
29
+                        <select name="materialType" id="materialType" class="province-selector" data-value="品类" lay-filter="materialType" onclick="dele()" lay-search="">
29 30
                             <option value="">品类</option>
30 31
                         </select>
31 32
                     </div>
32
-                    <div class="layui-input-inline" style="width: 100px;">
33
+                    <div class="layui-input-inline" style="width: 300px;">
33 34
                         <select name="brand" id ="brand" class="city-selector" data-value="品牌" lay-filter="brand" onclick="selectbrand()" lay-search="">
34 35
                             <option value="">品牌</option>
35 36
                         </select>
@@ -50,11 +51,6 @@
50 51
                         </select>
51 52
                     </div>
52 53
                     <div class="layui-input-inline" style="width: 100px;">
53
-                        <select name="materialRealPrice" id ="materialRealPrice" class="county-selector" data-value="物料价格" lay-filter="materialRealPrice">
54
-                            <option value="">物料价格</option>
55
-                        </select>
56
-                    </div>
57
-                    <div class="layui-input-inline" style="width: 100px;">
58 54
                         <a class="layui-btn layui-btn add" onclick="addtable()">添加</a>
59 55
                     </div>
60 56
                 </div>
@@ -116,7 +112,7 @@
116 112
             </center>
117 113
             <div class="layui-form-item">
118 114
                 <div class="layui-input-block">
119
-                    <button class="layui-btn" lay-submit lay-filter="formDemo" onclick="adddata(event)">立即提交</button>
115
+                    <button class="layui-btn" lay-submit lay-filter="formDemo" onclick="adddata(); return false;">立即提交</button>
120 116
                     <button type="reset" class="layui-btn layui-btn-primary">重置</button>
121 117
                 </div>
122 118
             </div>
@@ -125,61 +121,46 @@
125 121
 </fieldset>
126 122
 
127 123
 <script>
124
+    layui.use('form', function(){
125
+        var form = layui.form;
126
+        form.render();
127
+    });
128 128
     layui.use(['form', 'table', "laydate", 'layer','jquery'], function () {
129 129
         var materialdetil=null;
130
-        var materialRealPrice=null;
131 130
         var material=null;
132 131
         var form = layui.form;
133 132
         var table = layui.table;
134 133
         var $ = layui.$ //重点处
135 134
             ,layer = layui.layer;
136
-
137
-        function handleError(error) {
138
-            layer.alert('请求失败: ' + error);
139
-        }
140
-
141 135
         $.ajax({
142
-            url: 'type',
136
+            url: 'varietyLists',
143 137
             type: 'get',
144 138
             success: function (data) {
145
-                $("#Variety").empty();
146
-                try {
147
-                    $.each($.parseJSON(data), function(idx, obj) {
148
-                        $("#materialType").append("<option value=\""+obj.brandCode+"\">"+obj.brandName+"</option>");
149
-                    });
150
-                } catch (e) {
151
-                    handleError(e.message);
152
-                }
139
+                $("#materialType").empty();
140
+                $.each($.parseJSON(data), function(idx, obj) {
141
+                    $("#materialType").append("<option value=\""+obj.varietyId+"\">"+obj.variety+"</option>");
142
+                });
153 143
                 layui.form.render("select");
154
-            },
155
-            error: function (xhr, status, error) {
156
-                handleError(error);
157
-            }
158
-        });
159
-
144
+            },error:function (xhr, status, error) {
145
+                layer.alert('请求失败: ' + error);
146
+            }});
160 147
         form.on('select(materialType)', function(data){
161 148
             $.ajax({
162
-                url: 'brand',
149
+                url: 'varietyDetailsLists',
163 150
                 type: 'post',
164
-                data:{'materialTypeCode':data.value},
151
+                data:{'id':data.value},
165 152
                 success: function (data) {
166 153
                     $("#brand").empty();
167 154
                     $("#brand").append('<option value="">品牌</option>');
168
-                    try {
169
-                        $.each($.parseJSON(data), function(idx, obj) {
170
-                            $("#brand").append("<option value=\""+obj.brandCode+"\">"+obj.brandName+"</option>");
171
-                        });
172
-                    } catch (e) {
173
-                        handleError(e.message);
174
-                    }
155
+                    $.each($.parseJSON(data), function(idx, obj) {
156
+                        $("#brand").append("<option value=\""+obj.id+"\">"+obj.varietyDetails+"</option>");
157
+                    });
158
+
175 159
                     layui.form.render("select");
176
-                },
177
-                error: function (xhr, status, error) {
178
-                    handleError(error);
179
-                }
180
-            });
160
+                },error:function (xhr, status, error) {
161
+                    layer.alert('请求失败: ' + error);
162
+                }});
181 163
         });
182
-
183 164
         form.on('select(brand)', function(data){
184 165
             $.ajax({
185 166
                 url: 'group',
@@ -188,21 +169,15 @@
188 169
                 success: function (data) {
189 170
                     $("#materialGroup").empty();
190 171
                     $("#materialGroup").append('<option value="">物料组</option>');
191
-                    try {
192
-                        $.each($.parseJSON(data), function(idx, obj) {
193
-                            $("#materialGroup").append("<option value=\""+obj.materialGroupCode+"\">"+obj.materialGroupName+"</option>");
194
-                        });
195
-                    } catch (e) {
196
-                        handleError(e.message);
197
-                    }
172
+                    $.each($.parseJSON(data), function(idx, obj) {
173
+                        $("#materialGroup").append("<option value=\""+obj.materialGroupCode+"\">"+obj.materialGroupName+"</option>");
174
+                    });
175
+
198 176
                     layui.form.render("select");
199
-                },
200
-                error: function (xhr, status, error) {
201
-                    handleError(error);
202
-                }
203
-            });
177
+                },error:function (xhr, status, error) {
178
+                    layer.alert('请求失败: ' + error);
179
+                }});
204 180
         });
205
-
206 181
         form.on('select(materialGroup)', function(data){
207 182
             $.ajax({
208 183
                 url: 'price',
@@ -211,19 +186,13 @@
211 186
                 success: function (data) {
212 187
                     $("#materialdetil").empty();
213 188
                     $("#materialdetil").append('<option value="">物料描述</option>');
214
-                    try {
215
-                        $.each($.parseJSON(data), function(idx, obj) {
216
-                            $("#materialdetil").append("<option value=\""+obj.materialCode+"\">"+obj.materialName+"</option>");
217
-                        });
218
-                    } catch (e) {
219
-                        handleError(e.message);
220
-                    }
189
+                    $.each($.parseJSON(data), function(idx, obj) {
190
+                        $("#materialdetil").append("<option value=\""+obj.materialCode+"\">"+obj.materialName+"</option>");
191
+                    });
221 192
                     layui.form.render("select");
222
-                },
223
-                error: function (xhr, status, error) {
224
-                    handleError(error);
225
-                }
226
-            });
193
+                },error:function (xhr, status, error) {
194
+                    layer.alert('请求失败: ' + error);
195
+                }});
227 196
         });
228 197
 
229 198
         form.on('select(materialdetil)', function(data){
@@ -234,27 +203,18 @@
234 203
                 success: function (data) {
235 204
                     $("#materialCode").empty();
236 205
                     $("#materialRealPrice").empty();
237
-                    try {
238
-                        $.each($.parseJSON(data), function(idx, obj) {
239
-                            $("#materialCode").append("<option value=\""+obj.materialCode+"\">"+obj.materialCode+"</option>");
240
-                            $("#materialRealPrice").append("<option value=\""+obj.retailPrice+"\">"+obj.retailPrice+"</option>");
241
-                        });
242
-                    } catch (e) {
243
-                        handleError(e.message);
244
-                    }
206
+                    $.each($.parseJSON(data), function(idx, obj) {
207
+                        $("#materialCode").append("<option value=\""+obj.materialCode+"\">"+obj.materialCode+"</option>");
208
+                        $("#materialRealPrice").append("<option value=\""+obj.retailPrice+"\">"+obj.retailPrice+"</option>");
209
+                    });
245 210
                     layui.form.render("select");
246
-                },
247
-                error: function (xhr, status, error) {
248
-                    handleError(error);
249
-                }
250
-            });
211
+                },error:function (xhr, status, error) {
212
+                    layer.alert('请求失败: ' + error);
213
+                }});
251 214
         });
252 215
 
216
+        //因为动态添加的元素class属性是无效的,所以不能用$('.add').click(function(){});
253 217
         window.addtable= function(){
254
-            var selectedCode = $('#materialCode option:selected').text();
255
-            var selectedDetail = $('#materialdetil option:selected').text();
256
-            var selectedPrice = $('#materialRealPrice option:selected').text();
257
-
258 218
             var html = '<tr>'+
259 219
                 '<td style = "width: 100px"><input type="button" class="layui-btn layui-btn-radius" onclick="dele(this)" value="删除" /></td>'+
260 220
                 '<td style="width:200px">'+
@@ -269,10 +229,10 @@
269 229
                 '<option value="C">采购</option>'+
270 230
                 '<option value="T">退货</option>'+
271 231
                 '</select></td>'+
272
-                '<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>'+
273
-                '<td style = "width: 200px"> <input type="text" name="materialCode" required lay-verify="required"   placeholder="物料编码" autocomplete="off" class="layui-input"  readonly="true" value="'+ selectedCode +'"/></td>'+
274
-                '<td style = "width: 800px"> <input type="text" name="materialDetile"  required lay-verify="required"  placeholder="物料描述" autocomplete="off" class="layui-input"  readonly="true" value="'+ selectedDetail +'"/></td>'+
275
-                '<td style = "width: 200px"> <input type="text" name="price" required lay-verify="required"   placeholder="价格" autocomplete="off" class="layui-input"  readonly="true" value="'+ selectedPrice +'"/></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>'+
276 236
                 '<td style = "width: 100px"> <input type="text" name="NUM" required lay-verify="required"   placeholder="数量" autocomplete="off" class="layui-input" value ="1"/></td>'+
277 237
                 '<td style = "width: 300px"> <input type="text" name="SPH"    placeholder="球镜" autocomplete="off" class="layui-input"></td>'+
278 238
                 '<td style = "width: 300px"> <input type="text" name="CYL"    placeholder="柱镜" autocomplete="off" class="layui-input"></td>'+
@@ -302,18 +262,29 @@
302 262
                 '<td style = "width: 300px"> <input type="text" name="PS"    placeholder="片色" autocomplete="off" class="layui-input"></td>'+
303 263
                 '<td style = "width: 300px"> <input type="text" name="MARK"    placeholder="备注" autocomplete="off" class="layui-input"></td>'+
304 264
                 '</tr>';
265
+            //添加到表格最后
305 266
             $(html).appendTo($('#table tbody:last'));
306
-            form.render('select');
307
-        };
308
-
267
+            form.render();
268
+        }
309 269
         window.dele= function (obj){
270
+            debugger;
310 271
             var otr = obj.parentNode.parentNode;
311
-            var tab =  otr.parentNode;
272
+//			var tab = document.getElementById("tab");
273
+//			tab.deleteRow(otr.rowIndex)
274
+            var tab =  otr.parentNode; //自己的父节点 就是table
312 275
             tab.removeChild(otr);
276
+        }
277
+        window.deltable= function() {
278
+            if ($('#table tbody tr').length === 1) {
279
+                layer.msg('只有一条不允许删除。', {
280
+                    time : 2000
281
+                });
282
+            } else {
283
+                //删除当前按钮所在的tr
284
+                $(this).closest('tr').remove();
285
+            }
313 286
         };
314
-
315
-        window.adddata= function(event) {
316
-            event.preventDefault();
287
+        window.adddata= function() {
317 288
             table=document.getElementById("table");
318 289
             let tr=table.getElementsByTagName("tr");
319 290
             var arrayObj = new Array();
@@ -341,11 +312,15 @@
341 312
                         time : 5000
342 313
                     });
343 314
                 }, error: function (xhr, status, error) {
344
-                    handleError(error);
315
+                    layer.alert('请求失败: ' + error);
345 316
                 }
346 317
             });
347
-        };
318
+        }
319
+        form.on('submit(login)', function (data) {
320
+            //alert(data.value);
321
+        });
348 322
     });
323
+
349 324
 </script>
350 325
 
351 326
 </body>