YL2767 2 weeks ago
parent
commit
a0460d9e05

+ 13
- 5
src/main/java/com/th/demo/service/impl/maint/MaterialServiceImpl.java View File

31
 
31
 
32
     @Override
32
     @Override
33
     public String query(int page, int rows, String material,String standard, String userId, String belongId) {
33
     public String query(int page, int rows, String material,String standard, String userId, String belongId) {
34
-        PageHelper.startPage(page, rows);
35
         List<Material> list = new ArrayList<Material>();
34
         List<Material> list = new ArrayList<Material>();
35
+        if (page ==-1 && rows ==-1 ){
36
+            list = materialMapper.select(  material,  standard, belongId);
37
+
38
+            result = JSONTools.toString(list);
39
+            return result;
40
+        }else {
41
+            PageHelper.startPage(page, rows);
42
+            list = materialMapper.select(  material,  standard, belongId);
43
+
44
+            PageInfo<Material> pageInfo = new PageInfo<>(list);
45
+            result = JSONTools.toString(pageInfo);
46
+            return result;
47
+        }
36
 
48
 
37
-        list = materialMapper.select(  material,  standard, belongId);
38
 
49
 
39
-        PageInfo<Material> pageInfo = new PageInfo<>(list);
40
-        result = JSONTools.toString(pageInfo);
41
-        return result;
42
     }
50
     }
43
 
51
 
44
     @Override
52
     @Override

+ 15
- 6
src/main/java/com/th/demo/service/impl/ware/ChangeRecordServiceImpl.java View File

24
 
24
 
25
     @Override
25
     @Override
26
     public String query(int page, int rows, String wareName, String stackName, String model, String materialName, String standard, String customerName, String plateNo, Date fromDate, Date toDate, String userId, String belongId) {
26
     public String query(int page, int rows, String wareName, String stackName, String model, String materialName, String standard, String customerName, String plateNo, Date fromDate, Date toDate, String userId, String belongId) {
27
-        PageHelper.startPage(page, rows);
28
-        List<ChangeRecord> list=changeRecordMapper.select(  wareName,   stackName,model,materialName, standard, customerName,
29
-                plateNo, fromDate,toDate,  userId,    belongId);
30
-        PageInfo<ChangeRecord> pageInfo = new PageInfo<>(list);
31
-        result = JSONTools.toStringyyyyMMddHHmmss(pageInfo);
32
-        return result;
27
+        if (page == -1 && rows ==-1){
28
+            List<ChangeRecord> list=changeRecordMapper.select(  wareName,   stackName,model,materialName, standard, customerName,
29
+                    plateNo, fromDate,toDate,  userId,    belongId);
30
+            result = JSONTools.toStringyyyyMMddHHmmss(list);
31
+            return result;
32
+        }else {
33
+            PageHelper.startPage(page, rows);
34
+            List<ChangeRecord> list=changeRecordMapper.select(  wareName,   stackName,model,materialName, standard, customerName,
35
+                    plateNo, fromDate,toDate,  userId,    belongId);
36
+            PageInfo<ChangeRecord> pageInfo = new PageInfo<>(list);
37
+            result = JSONTools.toStringyyyyMMddHHmmss(pageInfo);
38
+            return result;
39
+        }
40
+
41
+
33
     }
42
     }
34
 
43
 
35
     @Override
44
     @Override

+ 27
- 1
src/main/java/com/th/demo/service/impl/ware/StoreServiceImpl.java View File

5
 import com.github.pagehelper.PageHelper;
5
 import com.github.pagehelper.PageHelper;
6
 import com.github.pagehelper.PageInfo;
6
 import com.github.pagehelper.PageInfo;
7
 import com.th.demo.mapping.maint.CustomerMapper;
7
 import com.th.demo.mapping.maint.CustomerMapper;
8
+import com.th.demo.mapping.maint.MaterialMapper;
8
 import com.th.demo.mapping.maint.StackMapper;
9
 import com.th.demo.mapping.maint.StackMapper;
9
 import com.th.demo.mapping.ware.*;
10
 import com.th.demo.mapping.ware.*;
10
 import com.th.demo.model.maint.Customer;
11
 import com.th.demo.model.maint.Customer;
12
+import com.th.demo.model.maint.Material;
11
 import com.th.demo.model.maint.Stack;
13
 import com.th.demo.model.maint.Stack;
12
 import com.th.demo.model.system.SysUser;
14
 import com.th.demo.model.system.SysUser;
13
 import com.th.demo.model.system.Type;
15
 import com.th.demo.model.system.Type;
43
     public StackMapper stackMapper;
45
     public StackMapper stackMapper;
44
     @Autowired//自动注入Mapper
46
     @Autowired//自动注入Mapper
45
     public DistributionDetailMapper distributionDetailMapper;
47
     public DistributionDetailMapper distributionDetailMapper;
48
+    @Autowired//自动注入Mapper
49
+    public MaterialMapper materialMapper;
46
     String result = Type.FAIL;
50
     String result = Type.FAIL;
47
     int num = 0;
51
     int num = 0;
48
 
52
 
77
     @Override
81
     @Override
78
     public String modify(String json, String userId, String belongId) {
82
     public String modify(String json, String userId, String belongId) {
79
         Store store = JSON.parseObject(json,Store.class);
83
         Store store = JSON.parseObject(json,Store.class);
80
-        int num =storeMapper.updateByPrimaryKey(store);
84
+        Store new_store = storeMapper.selectByPrimaryKey(store.getId());
85
+        Material material = materialMapper.selectByPrimaryKey(store.getMaterial().getId());
86
+        Customer customer = customerMapper.selectByName(store.getCustomer().getName(),store.getBelongId());
87
+        Customer fk_customer = customerMapper.selectByName(store.getFkCustomerName(),store.getBelongId());
88
+
89
+        new_store.setMaterial(material);
90
+        new_store.setModel(store.getModel());
91
+        new_store.setCount(store.getCount());
92
+        new_store.setWeight(store.getWeight());
93
+        new_store.setPlateNo(store.getPlateNo());
94
+        new_store.setOrdNo(store.getOrdNo());
95
+        new_store.setContractNo(store.getContractNo());
96
+        new_store.setPackNo(store.getPackNo());
97
+        new_store.setProductionPlace(store.getProductionPlace());
98
+        new_store.setReceiveAddress(store.getReceiveAddress());
99
+        new_store.setRemark(store.getRemark());
100
+
101
+        new_store.setCustomer(customer);
102
+        new_store.setFkComponyId(fk_customer.getId());
103
+
104
+
105
+        int num =storeMapper.updateByPrimaryKey(new_store);
106
+        num =storeMapper.updateFKByPKey(new_store);
81
         result=Tools.moreThanZeroResultJSON(num);
107
         result=Tools.moreThanZeroResultJSON(num);
82
         return result;
108
         return result;
83
     }
109
     }

+ 7
- 7
src/main/resource/localhost/db.properties View File

3
 #jdbc.user=root
3
 #jdbc.user=root
4
 #jdbc.password=root
4
 #jdbc.password=root
5
 
5
 
6
-#jdbc.driverClass=com.mysql.jdbc.Driver
7
-#jdbc.jdbcUrl=jdbc:mysql://localhost:3306/ware_zg?characterEncoding=utf8
8
-#jdbc.user=root
9
-#jdbc.password=root
10
-
11
 jdbc.driverClass=com.mysql.jdbc.Driver
6
 jdbc.driverClass=com.mysql.jdbc.Driver
12
-jdbc.jdbcUrl=jdbc:mysql://60.205.9.174:3309/ware_zg?useUnicode=true&characterEncoding=utf8
7
+jdbc.jdbcUrl=jdbc:mysql://localhost:3306/ware_zg?characterEncoding=utf8
13
 jdbc.user=root
8
 jdbc.user=root
14
-jdbc.password=122403
9
+jdbc.password=root
10
+
11
+#jdbc.driverClass=com.mysql.jdbc.Driver
12
+#jdbc.jdbcUrl=jdbc:mysql://60.205.9.174:3309/ware_zg?useUnicode=true&characterEncoding=utf8
13
+#jdbc.user=root
14
+#jdbc.password=122403

Loading…
Cancel
Save