Explorar el Código

改的太杂,懒得备注,同步一下信息

YL2767 hace 2 meses
padre
commit
088222b521

+ 19
- 0
src/main/java/com/th/demo/model/ware/CargoChangeRecord.java Ver fichero

@@ -21,6 +21,9 @@ public class CargoChangeRecord {
21 21
     private Customer uperCustomer;
22 22
     private Customer Customer;
23 23
 
24
+    private String ordNo;
25
+    private String remark;
26
+
24 27
     public String getId() {
25 28
         return id;
26 29
     }
@@ -84,4 +87,20 @@ public class CargoChangeRecord {
84 87
     public void setCustomer(Customer customer) {
85 88
         Customer = customer;
86 89
     }
90
+
91
+    public String getOrdNo() {
92
+        return ordNo;
93
+    }
94
+
95
+    public void setOrdNo(String ordNo) {
96
+        this.ordNo = ordNo;
97
+    }
98
+
99
+    public String getRemark() {
100
+        return remark;
101
+    }
102
+
103
+    public void setRemark(String remark) {
104
+        this.remark = remark;
105
+    }
87 106
 }

+ 2
- 0
src/main/java/com/th/demo/service/impl/maint/CargoServiceImpl.java Ver fichero

@@ -99,6 +99,8 @@ public class CargoServiceImpl implements CargoService {
99 99
         cargoChangeRecord.setCustomer(downCust);
100 100
         cargoChangeRecord.setChangeFrom("手动调整");
101 101
         cargoChangeRecord.setWeight(weight);
102
+        cargoChangeRecord.setOrdNo(object.get("ordNo").toString());
103
+        cargoChangeRecord.setRemark(object.get("remark").toString());
102 104
         if (subChange.equals("up")){
103 105
             cargoChangeRecord.setSubStr("增加");
104 106
         }

+ 30
- 22
src/main/java/com/th/demo/service/impl/ware/ChangeServiceImpl.java Ver fichero

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
5 5
 import com.alibaba.fastjson.TypeReference;
6 6
 import com.th.demo.mapping.finance.AccountDetailMapper;
7 7
 import com.th.demo.mapping.maint.CargoMapper;
8
+import com.th.demo.mapping.maint.CustomerMapper;
8 9
 import com.th.demo.mapping.maint.PriceMapper;
9 10
 import com.th.demo.mapping.maint.StackMapper;
10 11
 import com.th.demo.mapping.ware.ChangeRecordMapper;
@@ -46,6 +47,8 @@ public class ChangeServiceImpl implements ChangeService {
46 47
     public CargoMapper cargoMapper;
47 48
     @Autowired
48 49
     public CargoChangeRecordMapper cargoChangeRecordMapper;
50
+    @Autowired
51
+    public CustomerMapper customerMapper;
49 52
 
50 53
     int num = 0;
51 54
     String result = Type.FAIL;
@@ -55,21 +58,23 @@ public class ChangeServiceImpl implements ChangeService {
55 58
     @Override
56 59
     public String changeCustomer(String json, String customer,String address,String userId, String belongId) throws Exception{
57 60
         List<Store> list = JSON.parseObject(json, new TypeReference<List<Store>>() {});
58
-        Customer c = JSON.parseObject(customer, new TypeReference<Customer>() {});
61
+        Customer c1 = JSON.parseObject(customer, new TypeReference<Customer>() {});
62
+        Customer c = customerMapper.selectByPrimaryKey(c1.getId());//新货主
59 63
         String recordType = "";
60 64
         double sum_weight = 0;//可以进行货权转移的重量(货权转移的地方维护的)
61 65
         double use_weight = 0;//已经使用的货权转移的重量
62 66
         // 增加校验
63
-        Cargo cargo = cargoMapper.selectByByFkAndCustomer(list.get(0).getFkComponyId(),c.getId(),belongId);
67
+        Customer fk_cus = customerMapper.selectByPrimaryKey(list.get(0).getCustomer().getId());//老货主
68
+        Cargo cargo = cargoMapper.selectByByFkAndCustomer(fk_cus.getId(),c.getId(),belongId);
64 69
         if (cargo == null){
65
-            num =10;
66
-            return JSONTools.toString(1,"未维护两个单位之间货权转移重量");
70
+            sum_weight=0;
67 71
         }else{
68 72
             sum_weight = cargo.getSumWeight();
69 73
         }
70 74
 
71 75
         for (int i = 0; i < list.size(); i++) {
72
-            if((sum_weight-use_weight-list.get(i).getWeight()) < 0){
76
+            //保留可转移重量不为0的情况下,货权转移重量的计算
77
+            if(sum_weight != 0 && (sum_weight-use_weight-list.get(i).getWeight()) < 0){
73 78
                 num =10;
74 79
                 return JSONTools.toString(1,"权转移重量不足");
75 80
             }
@@ -83,27 +88,30 @@ public class ChangeServiceImpl implements ChangeService {
83 88
             ChangeRecord changeRecord = getChangeRecord(recordType, list.get(i), c, address, userId, belongId);
84 89
             num += changeRecordMapper.insert(changeRecord);
85 90
             list.get(i).setCustomer(c);
86
-            list.get(i).setFkComponyId(c.getId());
91
+            list.get(i).setFkComponyId(fk_cus.getId());
87 92
             list.get(i).setReceiveAddress(address);
88 93
             num += storeMapper.updateByPrimaryKey(list.get(i));
89 94
             use_weight = use_weight + list.get(i).getWeight();
90 95
         }
91
-        cargo.setSumWeight(cargo.getSumWeight() - use_weight);
92
-        cargo.setUseWeight(cargo.getUseWeight() + use_weight);
93
-        num = cargoMapper.updateByPrimaryKey(cargo);
94
-        result = Tools.moreThanZeroResultJSON(num);
95
-
96
-        CargoChangeRecord cargoChangeRecord = new CargoChangeRecord();
97
-        cargoChangeRecord.setUperCustomer(cargo.getUperCustomer());
98
-        cargoChangeRecord.setCustomer(cargo.getCustomer());
99
-        cargoChangeRecord.setChangeFrom("货权转移");
100
-        cargoChangeRecord.setWeight(use_weight);
101
-        cargoChangeRecord.setSubStr("减少");
102
-
103
-        cargoChangeRecord.setModifyTime(new Date());
104
-        cargoChangeRecord.setModifyUser(new SysUser(userId));
105
-        num = cargoChangeRecordMapper.insert(cargoChangeRecord);
106
-        result = Tools.moreThanZeroResultJSON(num);
96
+        if (sum_weight != 0){
97
+            cargo.setSumWeight(cargo.getSumWeight() - use_weight);
98
+            cargo.setUseWeight(cargo.getUseWeight() + use_weight);
99
+            num = cargoMapper.updateByPrimaryKey(cargo);
100
+            result = Tools.moreThanZeroResultJSON(num);
101
+
102
+            CargoChangeRecord cargoChangeRecord = new CargoChangeRecord();
103
+            cargoChangeRecord.setUperCustomer(cargo.getUperCustomer());
104
+            cargoChangeRecord.setCustomer(cargo.getCustomer());
105
+            cargoChangeRecord.setChangeFrom("货权转移");
106
+            cargoChangeRecord.setWeight(use_weight);
107
+            cargoChangeRecord.setSubStr("减少");
108
+
109
+            cargoChangeRecord.setModifyTime(new Date());
110
+            cargoChangeRecord.setModifyUser(new SysUser(userId));
111
+            num = cargoChangeRecordMapper.insert(cargoChangeRecord);
112
+            result = Tools.moreThanZeroResultJSON(num);
113
+        }
114
+
107 115
 
108 116
 
109 117
         return Tools.moreThanZeroResultJSON(num);

+ 7
- 3
src/main/resource/mapper/ware/CargoChangeRecordMapper.xml Ver fichero

@@ -7,6 +7,8 @@
7 7
     <result column="weight" property="weight" jdbcType="DOUBLE" />
8 8
     <result column="change_from" property="changeFrom" jdbcType="VARCHAR"/>
9 9
     <result column="sub_str" property="subStr" jdbcType="VARCHAR"/>
10
+    <result column="ord_no" property="ordNo" jdbcType="VARCHAR"/>
11
+    <result column="remark" property="remark" jdbcType="VARCHAR"/>
10 12
 
11 13
     <association  column="modify_id" property="modifyUser" select="com.th.demo.mapping.system.SysUserMapper.selectByPrimaryKey" />
12 14
     <association  column="uper_customer_id" property="uperCustomer" select="com.th.demo.mapping.maint.CustomerMapper.selectByPrimaryKey" />
@@ -14,7 +16,7 @@
14 16
   </resultMap>
15 17
 
16 18
   <sql id="Base_Column_List" >
17
-    id, modify_id, modify_time, weight, change_from, sub_str, uper_customer_id, customer_id
19
+    id, modify_id, modify_time, weight, change_from, sub_str, uper_customer_id, customer_id,ord_no,remark
18 20
   </sql>
19 21
 
20 22
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
@@ -37,10 +39,12 @@
37 39
 
38 40
     insert into t_ware_cargochange_record (id, modify_id, modify_time,
39 41
                                            weight, change_from, sub_str,
40
-                                           uper_customer_id, customer_id )
42
+                                           uper_customer_id, customer_id,
43
+                                           ord_no,remark)
41 44
     values (#{id,jdbcType=VARCHAR},#{modifyUser.id,jdbcType=VARCHAR},#{modifyTime,jdbcType=TIMESTAMP},
42 45
             #{weight,jdbcType=DOUBLE},#{changeFrom,jdbcType=VARCHAR},#{subStr,jdbcType=VARCHAR},
43
-            #{uperCustomer.id,jdbcType=VARCHAR}, #{Customer.id,jdbcType=VARCHAR})
46
+            #{uperCustomer.id,jdbcType=VARCHAR}, #{Customer.id,jdbcType=VARCHAR},
47
+            #{ordNo,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR})
44 48
   </insert>
45 49
 
46 50
   <select id="selectByCustomer" resultMap="BaseResultMap" parameterType="java.lang.String" >

+ 1
- 1
src/main/resource/mapper/ware/DistributionMapper.xml Ver fichero

@@ -234,7 +234,7 @@
234 234
       cancel_flag = #{cancelFlag,jdbcType=VARCHAR},
235 235
       belong_id = #{belongId,jdbcType=VARCHAR},
236 236
       delivery_company = #{deliveryCompany,jdbcType=VARCHAR},
237
-      distribution_no =ifnull(distribution_no,(select dis_no from (select concat('BS',DATE_FORMAT(NOW(), '%Y%m%d'),IFNULL(lpad(max(substring(t.distribution_no,11,3)+1),3,'0'),'001')) as dis_no from t_ware_distribution t
237
+      distribution_no =ifnull(distribution_no,(select dis_no from (select concat('MJ',DATE_FORMAT(NOW(), '%Y%m%d'),IFNULL(lpad(max(substring(t.distribution_no,11,3)+1),3,'0'),'001')) as dis_no from t_ware_distribution t
238 238
 where substring(t.distribution_no,3,8) = DATE_FORMAT(NOW(), '%Y%m%d')) temp))
239 239
       ,tally_people    = #{tallyPeople,jdbcType=VARCHAR}
240 240
     where id = #{id,jdbcType=VARCHAR}

+ 2
- 2
src/main/resource/mapper/ware/StoreMapper.xml Ver fichero

@@ -432,11 +432,11 @@ update t_ware_store t set t.layer =   #{param7,jdbcType=INTEGER}
432 432
 
433 433
 
434 434
   <select id="selectStore" resultMap="BaseResultMap" >
435
-    select t.* from t_ware_store t, t_maint_ware a, t_maint_stack b, t_maint_material c,t_maint_customer d
435
+    select d.name as fk_compony_id,t.* from t_ware_store t, t_maint_ware a, t_maint_stack b, t_maint_material c,t_maint_customer d
436 436
     where t.ware_id = a.id
437 437
     and t.stack_id = b.id
438 438
     and t.material_id  = c.id
439
-    and t.customer_id = d.id
439
+    and t.fk_compony_id = d.id
440 440
     and  a.name like concat('%',#{param1,jdbcType=VARCHAR},'%')
441 441
     and  b.name like concat('%',#{param2,jdbcType=VARCHAR},'%')
442 442
     and  t.model like concat('%',#{param3,jdbcType=VARCHAR},'%')

+ 1
- 1
出库单配车单导入模板/out.ureport.xml
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


Loading…
Cancelar
Guardar