Browse Source

修改价格信息,增加物料品名下

拉框
YL2767 1 month ago
parent
commit
3855b6e6b6

+ 15
- 0
src/main/java/com/th/demo/controller/maint/MaterialController.java View File

@@ -69,6 +69,21 @@ public class MaterialController {
69 69
             return result;
70 70
         }
71 71
     }
72
+
73
+    @RequestMapping(value = "/queryMaterialName.do")//查询方法 前两个参数是分页参数
74
+    public String queryMaterialName( HttpServletRequest request) {
75
+
76
+        try {
77
+            String userId = (String) request.getAttribute("userId");
78
+            String belongId = (String) request.getAttribute("belongId");
79
+            result = materialService.queryMaterialName(userId,belongId);
80
+        } catch (Exception ex) {
81
+            ex.printStackTrace();
82
+            result = JSONTools.toString(ResponseCodeMsg.CODE_EX, ex.getMessage());
83
+        } finally {
84
+            return result;
85
+        }
86
+    }
72 87
 //
73 88
 
74 89
 }

+ 1
- 0
src/main/java/com/th/demo/mapping/maint/MaterialMapper.java View File

@@ -22,4 +22,5 @@ public interface MaterialMapper {
22 22
     Material selectByNameStandard(String materialName, String standard, String belongId);
23 23
 
24 24
     List<Material> selectListByNameStandard(String materialName, String standard, String belongId);
25
+    List<Material> selectMaterialName(String belongId);
25 26
 }

+ 2
- 2
src/main/java/com/th/demo/mapping/maint/PriceMapper.java View File

@@ -21,9 +21,9 @@ public interface PriceMapper {
21 21
 
22 22
     Price selectByMaterialChangeTime(String materialId, int changeTime,String belongId);
23 23
 
24
-    List<Price> select(String materialName, String belongId);
24
+    List<Price> select(String customerName, String belongId,String materialName);
25 25
 
26
-    List<Price> selectListByCustomer(String materialName, String belongId);
26
+    List<Price> selectListByCustomer(String customerName, String belongId,String materialName);
27 27
 
28 28
     int selectCntByMaterialChangeTime(String id, int i, String belongId);
29 29
 

+ 18
- 0
src/main/java/com/th/demo/model/maint/Price.java View File

@@ -34,6 +34,8 @@ public class Price {
34 34
     private String storageType;
35 35
 
36 36
     private Customer customer;
37
+    private String materialName;
38
+    private String payWay;
37 39
     private double keepDay;
38 40
     private double ordPrice;
39 41
     private double outOrdPrice;
@@ -181,4 +183,20 @@ public class Price {
181 183
     public void setOutOrdPrice(double outOrdPrice) {
182 184
         this.outOrdPrice = outOrdPrice;
183 185
     }
186
+
187
+    public String getMaterialName() {
188
+        return materialName;
189
+    }
190
+
191
+    public void setMaterialName(String materialName) {
192
+        this.materialName = materialName;
193
+    }
194
+
195
+    public String getPayWay() {
196
+        return payWay;
197
+    }
198
+
199
+    public void setPayWay(String payWay) {
200
+        this.payWay = payWay;
201
+    }
184 202
 }

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

@@ -87,4 +87,13 @@ public class MaterialServiceImpl implements MaterialService {
87 87
         return result;
88 88
 
89 89
     }
90
+
91
+    @Override
92
+    public String queryMaterialName(String userId, String belongId) {
93
+
94
+        List<Material> list = new ArrayList<Material>();
95
+        list = materialMapper.selectMaterialName( belongId);
96
+        result = JSONTools.toString(list);
97
+        return result;
98
+    }
90 99
 }

+ 3
- 3
src/main/java/com/th/demo/service/impl/maint/PriceServiceImpl.java View File

@@ -34,7 +34,7 @@ public class PriceServiceImpl implements PriceService {
34 34
     @Override
35 35
     public String query(int page, int rows, String customerName, String userId, String belongId) {
36 36
         PageHelper.startPage(page, rows);
37
-        List<Price> list = priceMapper.select(customerName, belongId);
37
+        List<Price> list = priceMapper.select(customerName, belongId,"");
38 38
         PageInfo<Price> pageInfo = new PageInfo<>(list);
39 39
         result = JSONTools.toStringyyyyMMddHHmmss(pageInfo);
40 40
         return result;
@@ -44,7 +44,7 @@ public class PriceServiceImpl implements PriceService {
44 44
     public String save(String json, String userId, String belongId) {
45 45
         Price price = JSON.parseObject(json,new TypeReference<Price>(){});
46 46
         if(price.getId()==null||price.getId().equals("")){
47
-            List<Price> priceList = priceMapper.selectListByCustomer(price.getCustomer().getId(),belongId);
47
+            List<Price> priceList = priceMapper.selectListByCustomer(price.getCustomer().getId(),belongId,"");
48 48
             if (priceList.size() >= 1){
49 49
                 return JSONTools.toString(1,"该客户的价格已维护,请勿重复维护");
50 50
             }
@@ -56,7 +56,7 @@ public class PriceServiceImpl implements PriceService {
56 56
             price.setBelongId(belongId);
57 57
             num += priceMapper.insert(price);
58 58
         }else {
59
-            List<Price> priceList = priceMapper.selectListByCustomer(price.getCustomer().getName(),belongId);
59
+            List<Price> priceList = priceMapper.selectListByCustomer(price.getCustomer().getName(),belongId,price.getMaterialName());
60 60
             if (priceList.size() == 1 && !price.getId().equals(priceList.get(0).getId())){
61 61
                 return JSONTools.toString(1,"该客户的价格已维护,请勿重复维护");
62 62
             } else if (priceList.size() > 1) {

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

@@ -244,7 +244,7 @@ public class InServiceImpl implements InService {
244 244
 //                throw new Exception(listSameStack.get(m).getMaterial().getName()+"价格未维护");
245 245
 //            }
246 246
             // listSameStack.get(m).setInvoicePrice(prodPrice.getInvoicePrice());
247
-            List<Price> priceList = priceMapper.selectListByCustomer(listSameStack.get(m).getFkComponyId(),belongId);
247
+            List<Price> priceList = priceMapper.selectListByCustomer(listSameStack.get(m).getFkComponyId(),belongId,listSameStack.get(m).getMaterial().getName());
248 248
             if (priceList.size() >= 1){
249 249
                 listSameStack.get(m).setKeepDay(priceList.get(0).getKeepDay());
250 250
                 listSameStack.get(m).setOrdPrice(priceList.get(0).getOrdPrice());

+ 2
- 0
src/main/java/com/th/demo/service/maint/MaterialService.java View File

@@ -6,4 +6,6 @@ public interface MaterialService {
6 6
     String save(String json, String userId, String belongId);
7 7
 
8 8
     String remove(String id, String userId);
9
+
10
+    String queryMaterialName(String userId, String belongId);
9 11
 }

+ 8
- 0
src/main/resource/mapper/maint/MaterialMapper.xml View File

@@ -220,6 +220,14 @@
220 220
       and ifnull(cancel_flag,'0') = '0'
221 221
   </select>
222 222
 
223
+  <select id="selectMaterialName" resultMap="BaseResultMap" >
224
+    select distinct name
225
+    from t_maint_material
226
+    where 1=1
227
+      and   belong_id = #{param3,jdbcType=VARCHAR}
228
+      and ifnull(cancel_flag,'0') = '0'
229
+  </select>
230
+
223 231
 
224 232
 
225 233
 

+ 10
- 4
src/main/resource/mapper/maint/PriceMapper.xml View File

@@ -18,6 +18,8 @@
18 18
     <result column="keep_day" property="keepDay" jdbcType="DOUBLE" />
19 19
     <result column="ord_price" property="ordPrice" jdbcType="DOUBLE" />
20 20
     <result column="out_ord_price" property="outOrdPrice" jdbcType="DOUBLE" />
21
+    <result column="material_name" property="materialName" jdbcType="VARCHAR" />
22
+    <result column="pay_way" property="payWay" jdbcType="VARCHAR" />
21 23
 
22 24
       <association  column="material_id" property="material" select="com.th.demo.mapping.maint.MaterialMapper.selectByPrimaryKey" />
23 25
       <association  column="add_id" property="addUser" select="com.th.demo.mapping.system.SysUserMapper.selectByPrimaryKey" />
@@ -28,7 +30,7 @@
28 30
   <sql id="Base_Column_List" >
29 31
     id, material_id, storage_price,transfer_price, weight_price, add_id, add_time,
30 32
     modify_id, modify_time, cancel_id, cancel_time, cancel_flag, belong_id,storage_type,
31
-      keep_day,ord_price,out_ord_price,customer_id
33
+      keep_day,ord_price,out_ord_price,customer_id,material_name,pay_way
32 34
   </sql>
33 35
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
34 36
     select 
@@ -51,13 +53,13 @@
51 53
       add_time, modify_id, modify_time, 
52 54
       cancel_id, cancel_time, cancel_flag, 
53 55
       belong_id,storage_type,
54
-    keep_day,ord_price,out_ord_price,customer_id)
56
+    keep_day,ord_price,out_ord_price,customer_id,material_name,pay_way)
55 57
     values (#{id,jdbcType=VARCHAR}, #{material.id,jdbcType=VARCHAR}, #{storagePrice,jdbcType=DOUBLE},
56 58
       #{transferPrice,jdbcType=DOUBLE}, #{weightPrice,jdbcType=DOUBLE}, #{addUser.id,jdbcType=VARCHAR},
57 59
       #{addTime,jdbcType=TIMESTAMP}, #{modifyUser.id,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP},
58 60
       #{cancelId,jdbcType=VARCHAR}, #{cancelTime,jdbcType=TIMESTAMP}, #{cancelFlag,jdbcType=VARCHAR}, 
59 61
       #{belongId,jdbcType=VARCHAR},#{storageType,jdbcType=VARCHAR}, #{keepDay,jdbcType=DOUBLE},
60
-      #{ordPrice,jdbcType=DOUBLE},#{outOrdPrice,jdbcType=DOUBLE},#{customer.id,jdbcType=VARCHAR})
62
+      #{ordPrice,jdbcType=DOUBLE},#{outOrdPrice,jdbcType=DOUBLE},#{customer.id,jdbcType=VARCHAR},#{materialName,jdbcType=VARCHAR},#{payWay,jdbcType=VARCHAR})
61 63
   </insert>
62 64
   <insert id="insertSelective" parameterType="com.th.demo.model.maint.Price" >
63 65
     insert into t_maint_price
@@ -204,7 +206,9 @@ transfer_price,
204 206
         keep_day = #{keepDay,jdbcType=DOUBLE},
205 207
       ord_price = #{ordPrice,jdbcType=DOUBLE},
206 208
       out_ord_price = #{outOrdPrice,jdbcType=DOUBLE},
207
-      customer_id = #{customer.id,jdbcType=VARCHAR}
209
+      customer_id = #{customer.id,jdbcType=VARCHAR},
210
+        material_name = #{materialName,jdbcType=VARCHAR},
211
+        pay_way = #{payWay,jdbcType=VARCHAR}
208 212
     where id = #{id,jdbcType=VARCHAR}
209 213
   </update>
210 214
 
@@ -221,6 +225,7 @@ transfer_price,
221 225
     select  t.*   from t_maint_price t ,t_maint_customer d
222 226
     where t.customer_id = d.id
223 227
     and d.name like concat('%',#{param1,jdbcType=VARCHAR},'%')
228
+    and t.material_name like concat('%',#{param3,jdbcType=VARCHAR},'%')
224 229
      and t.belong_id=#{param2,jdbcType=VARCHAR}
225 230
       and t.cancel_flag = '0'
226 231
   </select>
@@ -239,6 +244,7 @@ transfer_price,
239 244
     where 1=1
240 245
       and t.customer_id = #{param1,jdbcType=VARCHAR}
241 246
       and t.belong_id = #{param2,jdbcType=VARCHAR}
247
+      and t.material_name = #{param3,jdbcType=VARCHAR}
242 248
       and t.cancel_flag = '0'
243 249
   </select>
244 250
 </mapper>

Loading…
Cancel
Save