Переглянути джерело

5月5日系统修改完成 1.0

Zhangqy 1 місяць тому
джерело
коміт
9c8274a121

+ 2
- 0
src/main/java/com/th/demo/mapping/ware/StoreMapper.java Переглянути файл

@@ -51,4 +51,6 @@ public interface StoreMapper {
51 51
     int selEffStore(String plateNo);
52 52
 
53 53
     void updateByOutId(String id, String noUserParam, String userId, String belongId);
54
+
55
+    int updateFKByPKey(Store store);
54 56
 }

+ 19
- 0
src/main/java/com/th/demo/model/ware/ChangeRecord.java Переглянути файл

@@ -67,6 +67,9 @@ public class ChangeRecord {
67 67
 
68 68
     private String productionPlace;
69 69
 
70
+    private String fkCustomerNameOld;
71
+    private String fkCustomerNameNew;
72
+
70 73
     public String getId() {
71 74
         return id;
72 75
     }
@@ -314,4 +317,20 @@ public class ChangeRecord {
314 317
     public void setProductionPlace(String productionPlace) {
315 318
         this.productionPlace = productionPlace;
316 319
     }
320
+
321
+    public String getFkCustomerNameOld() {
322
+        return fkCustomerNameOld;
323
+    }
324
+
325
+    public void setFkCustomerNameOld(String fkCustomerNameOld) {
326
+        this.fkCustomerNameOld = fkCustomerNameOld;
327
+    }
328
+
329
+    public String getFkCustomerNameNew() {
330
+        return fkCustomerNameNew;
331
+    }
332
+
333
+    public void setFkCustomerNameNew(String fkCustomerNameNew) {
334
+        this.fkCustomerNameNew = fkCustomerNameNew;
335
+    }
317 336
 }

+ 28
- 0
src/main/java/com/th/demo/model/ware/InRecord.java Переглянути файл

@@ -62,6 +62,10 @@ public class InRecord {
62 62
 
63 63
     private String fkComponyName;
64 64
 
65
+    private String contractNo;
66
+    private String packNo;
67
+    private String outFlag;
68
+
65 69
     public String getFkComponyName() {
66 70
         return fkComponyName;
67 71
     }
@@ -322,4 +326,28 @@ public class InRecord {
322 326
     public void setReceiveAddress(String receiveAddress) {
323 327
         this.receiveAddress = receiveAddress == null ? null : receiveAddress.trim();
324 328
     }
329
+
330
+    public String getContractNo() {
331
+        return contractNo;
332
+    }
333
+
334
+    public void setContractNo(String contractNo) {
335
+        this.contractNo = contractNo;
336
+    }
337
+
338
+    public String getPackNo() {
339
+        return packNo;
340
+    }
341
+
342
+    public void setPackNo(String packNo) {
343
+        this.packNo = packNo;
344
+    }
345
+
346
+    public String getOutFlag() {
347
+        return outFlag;
348
+    }
349
+
350
+    public void setOutFlag(String outFlag) {
351
+        this.outFlag = outFlag;
352
+    }
325 353
 }

+ 9
- 0
src/main/java/com/th/demo/model/ware/Store.java Переглянути файл

@@ -90,6 +90,7 @@ public class Store  implements Comparable<Store>{
90 90
     private String attrib08;
91 91
     private String attrib09;
92 92
     private String attrib10;
93
+    private double changeCount; // 合约号
93 94
 
94 95
     private String fkCustomerName;
95 96
 
@@ -567,6 +568,14 @@ public class Store  implements Comparable<Store>{
567 568
         this.payWay = payWay;
568 569
     }
569 570
 
571
+    public double getChangeCount() {
572
+        return changeCount;
573
+    }
574
+
575
+    public void setChangeCount(double changeCount) {
576
+        this.changeCount = changeCount;
577
+    }
578
+
570 579
     @Override
571 580
     public int compareTo(Store o) {
572 581
         if (this.layer > o.getLayer()) {

+ 15
- 12
src/main/java/com/th/demo/service/impl/ware/ChangeServiceImpl.java Переглянути файл

@@ -3,6 +3,7 @@ package com.th.demo.service.impl.ware;
3 3
 import com.alibaba.fastjson.JSON;
4 4
 import com.alibaba.fastjson.TypeReference;
5 5
 import com.th.demo.mapping.finance.AccountDetailMapper;
6
+import com.th.demo.mapping.maint.CustomerMapper;
6 7
 import com.th.demo.mapping.maint.PriceMapper;
7 8
 import com.th.demo.mapping.maint.StackMapper;
8 9
 import com.th.demo.mapping.ware.ChangeRecordMapper;
@@ -38,6 +39,8 @@ public class ChangeServiceImpl implements ChangeService {
38 39
     public PriceMapper priceMapper;
39 40
     @Autowired
40 41
     public StoreMapper storeMapper;
42
+    @Autowired
43
+    public CustomerMapper customerMapper;
41 44
 
42 45
     int num = 0;
43 46
     String result = Type.FAIL;
@@ -48,8 +51,9 @@ public class ChangeServiceImpl implements ChangeService {
48 51
     public String changeCustomer(String json, String customer,String address,String userId, String belongId) throws Exception{
49 52
         List<Store> list = JSON.parseObject(json, new TypeReference<List<Store>>() {
50 53
         });
51
-        Customer c = JSON.parseObject(customer, new TypeReference<Customer>() {
54
+        Customer c1 = JSON.parseObject(customer, new TypeReference<Customer>() {
52 55
         });
56
+        Customer c = customerMapper.selectByPrimaryKey(c1.getId());
53 57
         String recordType = "";
54 58
         for (int i = 0; i < list.size(); i++) {
55 59
             if(list.get(i).getCustomer().getName().equals(c.getName())){
@@ -59,18 +63,21 @@ public class ChangeServiceImpl implements ChangeService {
59 63
                 AccountDetail accountDetail = getAccountDetail(list.get(i),  userId, belongId);
60 64
                 num += accountDetailMapper.insert(accountDetail);
61 65
             }
62
-            ChangeRecord changeRecord = getChangeRecord(recordType, list.get(i), c, address, userId, belongId);
66
+            Customer customer1 = customerMapper.selectByPrimaryKey(list.get(i).getFkComponyId());
67
+            ChangeRecord changeRecord = getChangeRecord(recordType, list.get(i), c, customer1, address, userId, belongId);
63 68
             num += changeRecordMapper.insert(changeRecord);
64 69
 
65 70
 
71
+            list.get(i).setFkComponyId(list.get(i).getCustomer().getId());
66 72
             list.get(i).setCustomer(c);
67 73
             list.get(i).setReceiveAddress(address);
68
-            num += storeMapper.updateByPrimaryKey(list.get(i));
74
+            list.get(i).setChangeCount(list.get(i).getChangeCount()+1);
75
+            num += storeMapper.updateFKByPKey(list.get(i));
69 76
         }
70 77
         return Tools.moreThanZeroResultJSON(num);
71 78
     }
72 79
 
73
-    private ChangeRecord getChangeRecord(String recordType, Store store, Customer customer, String receiveAddress, String userId, String belongId) {
80
+    private ChangeRecord getChangeRecord(String recordType, Store store, Customer customer, Customer customer1, String receiveAddress, String userId, String belongId) {
74 81
 
75 82
         ChangeRecord record = new ChangeRecord();
76 83
         record.setRecordType(recordType);
@@ -86,6 +93,10 @@ public class ChangeServiceImpl implements ChangeService {
86 93
             record.setCustomerNameNew(customer.getName());
87 94
         }
88 95
         record.setCustomerNameOld(store.getCustomer().getName());
96
+
97
+        record.setFkCustomerNameNew(store.getCustomer().getName());
98
+        record.setFkCustomerNameOld(customer1.getName());
99
+
89 100
         record.setCount(store.getCount());
90 101
         record.setWeight(store.getWeight());
91 102
         record.setRemark(store.getRemark());
@@ -115,10 +126,6 @@ public class ChangeServiceImpl implements ChangeService {
115 126
             changeTime = list.size();
116 127
             changeTimeForPrice = 1;
117 128
         }
118
-       /* Price price = priceMapper.selectByMaterialChangeTime(store.getMaterial().getId(), changeTimeForPrice, belongId);
119
-        if (price == null) {
120
-            throw new Exception(store.getMaterial().getName() + "," + store.getMaterial().getStandard() + "没有对应价格信息");
121
-        }*/
122 129
         AccountDetail accountDetail = new AccountDetail();
123 130
         accountDetail.setChangeTime(changeTime);
124 131
         accountDetail.setRecordType("货权转移");
@@ -138,10 +145,6 @@ public class ChangeServiceImpl implements ChangeService {
138 145
         accountDetail.setAddTime(new Date());
139 146
         accountDetail.setCancelFlag("0");
140 147
         accountDetail.setBelongId(belongId);
141
-
142
-        //storagePrice = price.getStoragePrice() * store.getWeight();
143
-
144
-        //accountDetail.setStorageUnitPrice(price.getStoragePrice());
145 148
         accountDetail.setStoragePrice(storagePrice);
146 149
 
147 150
         //accountDetail.setWeightUnitPrice(price.getWeightPrice());

+ 11
- 1
src/main/java/com/th/demo/service/impl/ware/InServiceImpl.java Переглянути файл

@@ -168,6 +168,8 @@ public class InServiceImpl implements InService {
168 168
                     //listStore.get(i).setOutId(outRecord.getId());
169 169
                     listStore.get(i).setCancelFlag("1");
170 170
                     num += storeMapper.updateByPrimaryKey(listStore.get(i));
171
+                    num += inRecordMapper.deleteByPrimaryKey(listStore.get(i).getInId());
172
+
171 173
                 }
172 174
                 result = Tools.moreThanZeroResultJSON(num);
173 175
             }
@@ -476,7 +478,15 @@ public class InServiceImpl implements InService {
476 478
         inRecord.setAddUser(new SysUser(userId));
477 479
         inRecord.setAddTime(new Date());
478 480
         inRecord.setRecordType(recordType);
479
-        inRecord.setCancelFlag("0");
481
+        if (recordType.equals("0")){
482
+            inRecord.setCancelFlag("9");
483
+        }else {
484
+            inRecord.setCancelFlag("0");
485
+        }
486
+        inRecord.setOutFlag("0");
487
+        inRecord.setPackNo(store.getPackNo());
488
+        inRecord.setContractNo(store.getContractNo());
489
+
480 490
         inRecord.setReceiveAddress(store.getReceiveAddress());
481 491
 
482 492
         inRecord.setWgtDcnMtcCd(store.getWgtDcnMtcCd());

+ 9
- 3
src/main/resource/mapper/ware/ChangeRecordMapper.xml Переглянути файл

@@ -12,6 +12,10 @@
12 12
     <result column="model" property="model" jdbcType="VARCHAR" />
13 13
     <result column="customer_name_old" property="customerNameOld" jdbcType="VARCHAR" />
14 14
     <result column="customer_name_new" property="customerNameNew" jdbcType="VARCHAR" />
15
+
16
+    <result column="fk_customer_name_old" property="fkCustomerNameOld" jdbcType="VARCHAR" />
17
+    <result column="fk_customer_name_new" property="fkCustomerNameNew" jdbcType="VARCHAR" />
18
+
15 19
     <result column="record_type" property="recordType" jdbcType="VARCHAR" />
16 20
     <result column="count" property="count" jdbcType="DOUBLE" />
17 21
     <result column="weight" property="weight" jdbcType="DOUBLE" />
@@ -47,7 +51,7 @@
47 51
     id, ware_name, stack_name, layer, material_name, material_no, standard, model, customer_name_old, 
48 52
     customer_name_new, record_type, count, weight, remark, add_id, add_time, modify_id, 
49 53
     modify_time, cancel_id, cancel_time, cancel_flag, belong_id, plate_no, in_id, out_id, 
50
-    receive_address_old, receive_address_new,wgt_dcn_mtc_cd,edge_ty,production_place
54
+    receive_address_old, receive_address_new,wgt_dcn_mtc_cd,edge_ty,production_place,fk_customer_name_new,fk_customer_name_old
51 55
   </sql>
52 56
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
53 57
     select 
@@ -74,7 +78,8 @@
74 78
       cancel_id, cancel_time, cancel_flag, 
75 79
       belong_id, plate_no, in_id, 
76 80
       out_id, receive_address_old, receive_address_new
77
-    ,wgt_dcn_mtc_cd,edge_ty,production_place
81
+    ,wgt_dcn_mtc_cd,edge_ty,production_place,
82
+    fk_customer_name_old,fk_customer_name_new
78 83
       )
79 84
     values (#{id,jdbcType=VARCHAR}, #{wareName,jdbcType=VARCHAR}, #{stackName,jdbcType=VARCHAR}, 
80 85
       #{layer,jdbcType=INTEGER}, #{materialName,jdbcType=VARCHAR}, #{materialNo,jdbcType=VARCHAR}, 
@@ -85,7 +90,8 @@
85 90
       #{cancelId,jdbcType=VARCHAR}, #{cancelTime,jdbcType=TIMESTAMP}, #{cancelFlag,jdbcType=VARCHAR}, 
86 91
       #{belongId,jdbcType=VARCHAR}, #{plateNo,jdbcType=VARCHAR}, #{inId,jdbcType=VARCHAR}, 
87 92
       #{outId,jdbcType=VARCHAR}, #{receiveAddressOld,jdbcType=VARCHAR}, #{receiveAddressNew,jdbcType=VARCHAR}
88
-    ,#{wgtDcnMtcCd,jdbcType=VARCHAR},#{edgeTy,jdbcType=VARCHAR},#{productionPlace,jdbcType=VARCHAR}
93
+    ,#{wgtDcnMtcCd,jdbcType=VARCHAR},#{edgeTy,jdbcType=VARCHAR},#{productionPlace,jdbcType=VARCHAR},
94
+        #{fkCustomerNameOld,jdbcType=VARCHAR},#{fkCustomerNameNew,jdbcType=VARCHAR}
89 95
       )
90 96
   </insert>
91 97
   <insert id="insertSelective" parameterType="com.th.demo.model.ware.ChangeRecord" >

+ 17
- 7
src/main/resource/mapper/ware/InRecordMapper.xml Переглянути файл

@@ -33,6 +33,11 @@
33 33
     <result column="ord_no" property="ordNo" jdbcType="VARCHAR" />
34 34
     <result column="tally_people" property="tallyPeople" jdbcType="VARCHAR" />
35 35
     <result column="fk_compony_name" property="fkComponyName" jdbcType="VARCHAR" />
36
+
37
+    <result column="contract_no" property="contractNo" jdbcType="VARCHAR" />
38
+    <result column="pack_no" property="packNo" jdbcType="VARCHAR" />
39
+    <result column="out_flag" property="outFlag" jdbcType="VARCHAR" />
40
+
36 41
     <association  column="add_id" property="addUser" select="com.th.demo.mapping.system.SysUserMapper.selectByPrimaryKey" />
37 42
 
38 43
   </resultMap>
@@ -43,7 +48,7 @@
43 48
   <sql id="Base_Column_List" >
44 49
     id, ware_name, stack_name, layer, material_name, material_no, standard, model, customer_name, 
45 50
     customer_no, count, weight, remark, add_id, add_time, modify_id, modify_time, cancel_id, 
46
-    cancel_time, cancel_flag, belong_id, plate_no,record_type,receive_address ,wgt_dcn_mtc_cd,edge_ty,production_place
51
+    cancel_time, cancel_flag, belong_id, plate_no,record_type,receive_address ,wgt_dcn_mtc_cd,edge_ty,production_place,contract_no,pack_no,out_flag
47 52
   </sql>
48 53
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
49 54
     select 
@@ -51,10 +56,10 @@
51 56
     from t_ware_in_record
52 57
     where id = #{id,jdbcType=VARCHAR}
53 58
   </select>
54
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
55
-    delete from t_ware_in_record
59
+  <update id="deleteByPrimaryKey" parameterType="java.lang.String" >
60
+    update t_ware_in_record set cancel_flag = '9'
56 61
     where id = #{id,jdbcType=VARCHAR}
57
-  </delete>
62
+  </update>
58 63
   <insert id="insert" parameterType="com.th.demo.model.ware.InRecord" >
59 64
 
60 65
     <selectKey keyProperty="id" order="BEFORE" resultType="java.lang.String">
@@ -69,7 +74,8 @@
69 74
       modify_id, modify_time, cancel_id, 
70 75
       cancel_time, cancel_flag, belong_id, 
71 76
       plate_no,record_type,receive_address
72
-    ,wgt_dcn_mtc_cd,edge_ty,production_place,car_no,ord_no,tally_people,fk_compony_name)
77
+    ,wgt_dcn_mtc_cd,edge_ty,production_place,car_no,ord_no,tally_people,fk_compony_name
78
+    ,contract_no,pack_no,out_flag)
73 79
     values (#{id,jdbcType=VARCHAR}, #{wareName,jdbcType=VARCHAR}, #{stackName,jdbcType=VARCHAR}, 
74 80
       #{layer,jdbcType=INTEGER}, #{materialName,jdbcType=VARCHAR}, #{materialNo,jdbcType=VARCHAR}, 
75 81
       #{standard,jdbcType=VARCHAR}, #{model,jdbcType=VARCHAR}, #{customerName,jdbcType=VARCHAR}, 
@@ -79,7 +85,8 @@
79 85
       #{cancelTime,jdbcType=TIMESTAMP}, #{cancelFlag,jdbcType=VARCHAR}, #{belongId,jdbcType=VARCHAR},
80 86
     #{plateNo,jdbcType=VARCHAR},#{recordType,jdbcType=VARCHAR}, #{receiveAddress,jdbcType=VARCHAR}
81 87
     ,#{wgtDcnMtcCd,jdbcType=VARCHAR},#{edgeTy,jdbcType=VARCHAR},#{productionPlace,jdbcType=VARCHAR},#{carNo,jdbcType=VARCHAR}
82
-    ,#{ordNo,jdbcType=VARCHAR},#{tallyPeople,jdbcType=VARCHAR},#{fkComponyName,jdbcType=VARCHAR})
88
+    ,#{ordNo,jdbcType=VARCHAR},#{tallyPeople,jdbcType=VARCHAR},#{fkComponyName,jdbcType=VARCHAR}
89
+    ,#{contractNo,jdbcType=VARCHAR},#{packNo,jdbcType=VARCHAR},#{outFlag,jdbcType=VARCHAR})
83 90
   </insert>
84 91
   <insert id="insertSelective" parameterType="com.th.demo.model.ware.InRecord" >
85 92
     insert into t_ware_in_record
@@ -313,7 +320,10 @@
313 320
       belong_id = #{belongId,jdbcType=VARCHAR},
314 321
       plate_no = #{plateNo,jdbcType=VARCHAR},
315 322
          record_type = #{recordType,jdbcType=VARCHAR},
316
-    receive_address = #{receiveAddress,jdbcType=VARCHAR}
323
+    receive_address = #{receiveAddress,jdbcType=VARCHAR},
324
+        contract_no= #{contractNo,jdbcType=VARCHAR},
325
+        pack_no= #{packNo,jdbcType=VARCHAR},
326
+        out_flag= #{outFlag,jdbcType=VARCHAR}
317 327
     where id = #{id,jdbcType=VARCHAR}
318 328
   </update>
319 329
 

+ 11
- 0
src/main/resource/mapper/ware/StoreMapper.xml Переглянути файл

@@ -53,6 +53,8 @@
53 53
     <result column="inware_day" property="inwareDay" jdbcType="DOUBLE" />
54 54
     <result column="pay_way" property="payWay" jdbcType="VARCHAR" />
55 55
 
56
+    <result column="change_count" property="changeCount" jdbcType="DOUBLE" />
57
+
56 58
 
57 59
     <association  column="ware_id" property="ware" select="com.th.demo.mapping.maint.WareMapper.selectByPrimaryKey" />
58 60
     <association  column="stack_id" property="stack" select="com.th.demo.mapping.maint.StackMapper.selectByPrimaryKey" />
@@ -373,6 +375,14 @@
373 375
     where id = #{id,jdbcType=VARCHAR}
374 376
   </update>
375 377
 
378
+  <update id="updateFKByPKey" parameterType="com.th.demo.model.ware.Store" >
379
+    update t_ware_store
380
+    set customer_id = #{customer.id,jdbcType=VARCHAR},
381
+        fk_compony_id = #{fkComponyId,jdbcType=VARCHAR},
382
+        change_count = #{changeCount,jdbcType=DOUBLE}
383
+    where id = #{id,jdbcType=VARCHAR}
384
+  </update>
385
+
376 386
 
377 387
 
378 388
   <select id="selectLayerByStackId" resultType="java.lang.String" >
@@ -575,6 +585,7 @@ update t_ware_store t set t.layer =   #{param7,jdbcType=INTEGER}
575 585
       select count(*)
576 586
       from t_ware_store t
577 587
       where t.cancel_flag = '0'
588
+      and t.out_flag = '0'
578 589
       and t.plate_no = #{param1,jdbcType=VARCHAR};
579 590
 
580 591
   </select>

Завантаження…
Відмінити
Зберегти