2 Commits

Author SHA1 Message Date
  张庆宇 dd5694b232 1111 2 months ago
  张庆宇 0a4fab5731 1111 2 months ago

+ 10
- 0
pom.xml View File

550
 
550
 
551
     <build>
551
     <build>
552
         <finalName>thware_zg</finalName>
552
         <finalName>thware_zg</finalName>
553
+        <plugins>
554
+            <plugin>
555
+                <groupId>org.apache.maven.plugins</groupId>
556
+                <artifactId>maven-compiler-plugin</artifactId>
557
+                <configuration>
558
+                    <source>8</source>
559
+                    <target>8</target>
560
+                </configuration>
561
+            </plugin>
562
+        </plugins>
553
         <resources>
563
         <resources>
554
             <resource>
564
             <resource>
555
                 <directory>src/main/resource</directory>
565
                 <directory>src/main/resource</directory>

+ 12
- 0
src/main/java/com/th/demo/model/ware/OutRecord.java View File

89
     private String contractNo;
89
     private String contractNo;
90
     private String packNo;
90
     private String packNo;
91
 
91
 
92
+    // 出库记录增加价格计算时间的信息
93
+    private String payWay;
94
+
95
+
92
     public Double getStoreFee() {
96
     public Double getStoreFee() {
93
         return storeFee;
97
         return storeFee;
94
     }
98
     }
447
     public void setPackNo(String packNo) {
451
     public void setPackNo(String packNo) {
448
         this.packNo = packNo;
452
         this.packNo = packNo;
449
     }
453
     }
454
+
455
+    public String getPayWay() {
456
+        return payWay;
457
+    }
458
+
459
+    public void setPayWay(String payWay) {
460
+        this.payWay = payWay;
461
+    }
450
 }
462
 }

+ 37
- 2
src/main/java/com/th/demo/service/impl/ware/OutServiceImpl.java View File

25
 
25
 
26
 import java.util.*;
26
 import java.util.*;
27
 
27
 
28
+import static java.lang.Math.toIntExact;
29
+
28
 @Service("OutService")
30
 @Service("OutService")
29
 public class OutServiceImpl implements OutService {
31
 public class OutServiceImpl implements OutService {
30
 
32
 
48
     public ChangeRecordMapper changeRecordMapper;
50
     public ChangeRecordMapper changeRecordMapper;
49
     @Autowired
51
     @Autowired
50
     public PriceMapper priceMapper;
52
     public PriceMapper priceMapper;
53
+    @Autowired
54
+    public InRecordMapper inRecordMapper;
51
 
55
 
52
     String result = Type.FAIL;
56
     String result = Type.FAIL;
53
     int num = 0;
57
     int num = 0;
149
             List<StoreOfWareStack> listSows = storeMapper.selectWareStackByDistributionStore(map);
153
             List<StoreOfWareStack> listSows = storeMapper.selectWareStackByDistributionStore(map);
150
 
154
 
151
             for (int m = 0; m < listSows.size(); m++) {
155
             for (int m = 0; m < listSows.size(); m++) {
152
-
153
-
154
                 Stack stack = stackMapper.selectByPrimaryKey(listSows.get(m).getStackId());
156
                 Stack stack = stackMapper.selectByPrimaryKey(listSows.get(m).getStackId());
155
                 Map<String, Object> mapParam = new HashMap<String, Object>();
157
                 Map<String, Object> mapParam = new HashMap<String, Object>();
156
                 mapParam.put("storeId", listStoreId);
158
                 mapParam.put("storeId", listStoreId);
300
         outRecord.setEdgeTy(store.getEdgeTy());
302
         outRecord.setEdgeTy(store.getEdgeTy());
301
         outRecord.setProductionPlace(store.getProductionPlace());
303
         outRecord.setProductionPlace(store.getProductionPlace());
302
         outRecord.setInvoicePrice(store.getInvoicePrice());
304
         outRecord.setInvoicePrice(store.getInvoicePrice());
305
+
306
+        // 增加天数计算,以及计算价格
307
+        if (!recordType.equals("0")) {
308
+            InRecord inRecord = inRecordMapper.selectByPrimaryKey(store.getInId());
309
+            Date InDate = inRecord.getAddTime();
310
+            Date OutDate = new Date();
311
+            long diffMillis = OutDate.getTime() - InDate.getTime();
312
+            long millisPerDay = 24 * 60 * 60 * 1000;
313
+
314
+            // 计算天数并向上取整
315
+            Long days_L = diffMillis / millisPerDay;
316
+            if (diffMillis % millisPerDay > 0) {
317
+                days_L++;
318
+            }
319
+            int days = toIntExact(days_L);
320
+            outRecord.setInWareDays(days);
321
+
322
+            List<Price> priceList = priceMapper.selectListByCustomer(store.getFkComponyId(), store.getBelongId(),store.getMaterial().getCode());
323
+            if (priceList.size() ==1){
324
+                Price price = priceList.get(0);
325
+                if (price.getKeepDay() >= days){
326
+                    outRecord.setInvoicePrice(price.getOrdPrice()* store.getWeight());
327
+
328
+                }else {
329
+                    Double invoicePrice = price.getOrdPrice()* store.getWeight();
330
+                    invoicePrice = invoicePrice + ((days-price.getKeepDay())*price.getOutOrdPrice()* store.getWeight());
331
+                    outRecord.setInvoicePrice(invoicePrice);
332
+                }
333
+                outRecord.setPayWay(price.getPayWay());
334
+            }
335
+
336
+
337
+        }
303
         return outRecord;
338
         return outRecord;
304
     }
339
     }
305
 
340
 

+ 7
- 2
src/main/resource/mapper/ware/InRecordMapper.xml View File

354
             and  a.user_id = #{param10,jdbcType=VARCHAR}  )
354
             and  a.user_id = #{param10,jdbcType=VARCHAR}  )
355
             )  or t.customer_name like CONCAT((select attr3 from sys_user temp where temp.id=#{param10,jdbcType=VARCHAR}),'%') )
355
             )  or t.customer_name like CONCAT((select attr3 from sys_user temp where temp.id=#{param10,jdbcType=VARCHAR}),'%') )
356
     and ifnull(t.tally_people,'*') like concat('%',#{param14,jdbcType=VARCHAR},'%')
356
     and ifnull(t.tally_people,'*') like concat('%',#{param14,jdbcType=VARCHAR},'%')
357
-    and ifnull(a.name,'*') like concat('%',#{param15,jdbcType=VARCHAR},'%')
357
+    <if test="param15 != null and param15 != ''">
358
+      and ifnull(a.name,'*') = #{param15,jdbcType=VARCHAR}
359
+    </if>
360
+
358
 
361
 
359
     and  (t.plate_no like concat('%',#{param7,jdbcType=VARCHAR},'%')
362
     and  (t.plate_no like concat('%',#{param7,jdbcType=VARCHAR},'%')
360
     <if test="param18 != null and param18.size() !=0" >
363
     <if test="param18 != null and param18.size() !=0" >
405
             and  a.user_id = #{param10,jdbcType=VARCHAR}  )
408
             and  a.user_id = #{param10,jdbcType=VARCHAR}  )
406
             )  or t.customer_name like CONCAT((select attr3 from sys_user temp where temp.id=#{param10,jdbcType=VARCHAR}),'%') )
409
             )  or t.customer_name like CONCAT((select attr3 from sys_user temp where temp.id=#{param10,jdbcType=VARCHAR}),'%') )
407
     and ifnull(t.tally_people,'*') like concat('%',#{param14,jdbcType=VARCHAR},'%')
410
     and ifnull(t.tally_people,'*') like concat('%',#{param14,jdbcType=VARCHAR},'%')
408
-    and ifnull(a.name,'*') like concat('%',#{param15,jdbcType=VARCHAR},'%')
411
+    <if test="param15 != null and param15 != ''">
412
+      and ifnull(a.name,'*') = #{param15,jdbcType=VARCHAR}
413
+    </if>
409
     and  (t.plate_no like concat('%',#{param7,jdbcType=VARCHAR},'%')
414
     and  (t.plate_no like concat('%',#{param7,jdbcType=VARCHAR},'%')
410
     <if test="param18 != null and param18.size() !=0" >
415
     <if test="param18 != null and param18.size() !=0" >
411
       or t.plate_no IN <foreach  item="item" collection="param18" index="index"  open="(" separator="," close=")">
416
       or t.plate_no IN <foreach  item="item" collection="param18" index="index"  open="(" separator="," close=")">

+ 11
- 5
src/main/resource/mapper/ware/OutRecordMapper.xml View File

37
     <result column="in_car_no" property="inCarNo" jdbcType="VARCHAR" />
37
     <result column="in_car_no" property="inCarNo" jdbcType="VARCHAR" />
38
     <result column="out_car_no" property="outCarNo" jdbcType="VARCHAR" />
38
     <result column="out_car_no" property="outCarNo" jdbcType="VARCHAR" />
39
     <result column="fk_compony_name" property="fkComponyName" jdbcType="VARCHAR" />
39
     <result column="fk_compony_name" property="fkComponyName" jdbcType="VARCHAR" />
40
+    <result column="pay_way" property="payWay" jdbcType="VARCHAR" />
40
     <result column="invoice_price" property="invoicePrice" jdbcType="DOUBLE" />
41
     <result column="invoice_price" property="invoicePrice" jdbcType="DOUBLE" />
41
     <result column="verify_account_id" property="verifyAccountId" jdbcType="DOUBLE" />
42
     <result column="verify_account_id" property="verifyAccountId" jdbcType="DOUBLE" />
42
 
43
 
93
     <result column="store_fee" property="storeFee" jdbcType="DOUBLE" />
94
     <result column="store_fee" property="storeFee" jdbcType="DOUBLE" />
94
     <result column="pack_no" property="packNo" jdbcType="VARCHAR" />
95
     <result column="pack_no" property="packNo" jdbcType="VARCHAR" />
95
     <result column="contract_no" property="contractNo" jdbcType="VARCHAR" />
96
     <result column="contract_no" property="contractNo" jdbcType="VARCHAR" />
97
+    <result column="pay_way" property="payWay" jdbcType="VARCHAR" />
96
   </resultMap>
98
   </resultMap>
97
   <resultMap id="TotalResultMap" type="com.th.demo.model.ware.TotalRecord">
99
   <resultMap id="TotalResultMap" type="com.th.demo.model.ware.TotalRecord">
98
     <result column="total_amount" property="totalAmount" jdbcType="DOUBLE" />
100
     <result column="total_amount" property="totalAmount" jdbcType="DOUBLE" />
105
   </sql>
107
   </sql>
106
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
108
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
107
     select 
109
     select 
108
-    <include refid="Base_Column_List" />
110
+    *
109
     from t_ware_out_record
111
     from t_ware_out_record
110
     where id = #{id,jdbcType=VARCHAR}
112
     where id = #{id,jdbcType=VARCHAR}
111
   </select>
113
   </select>
125
       modify_id, modify_time, cancel_id, 
127
       modify_id, modify_time, cancel_id, 
126
       cancel_time, cancel_flag, belong_id, 
128
       cancel_time, cancel_flag, belong_id, 
127
       plate_no,in_id, record_type,back_flag,receive_address,distribution_id
129
       plate_no,in_id, record_type,back_flag,receive_address,distribution_id
128
-    ,wgt_dcn_mtc_cd,edge_ty,production_place,tally_people,invoice_price,pack_no,contract_no,ord_no,fk_compony_name)
130
+    ,wgt_dcn_mtc_cd,edge_ty,production_place,tally_people,invoice_price,pack_no,contract_no,ord_no,fk_compony_name,in_ware_days,pay_way)
129
     values (#{id,jdbcType=VARCHAR}, #{wareName,jdbcType=VARCHAR}, #{stackName,jdbcType=VARCHAR}, 
131
     values (#{id,jdbcType=VARCHAR}, #{wareName,jdbcType=VARCHAR}, #{stackName,jdbcType=VARCHAR}, 
130
       #{layer,jdbcType=INTEGER}, #{materialName,jdbcType=VARCHAR}, #{materialNo,jdbcType=VARCHAR}, 
132
       #{layer,jdbcType=INTEGER}, #{materialName,jdbcType=VARCHAR}, #{materialNo,jdbcType=VARCHAR}, 
131
       #{standard,jdbcType=VARCHAR}, #{model,jdbcType=VARCHAR}, #{customerName,jdbcType=VARCHAR}, 
133
       #{standard,jdbcType=VARCHAR}, #{model,jdbcType=VARCHAR}, #{customerName,jdbcType=VARCHAR}, 
136
     #{plateNo,jdbcType=VARCHAR},  #{inId,jdbcType=VARCHAR}, #{recordType,jdbcType=VARCHAR},
138
     #{plateNo,jdbcType=VARCHAR},  #{inId,jdbcType=VARCHAR}, #{recordType,jdbcType=VARCHAR},
137
     #{backFlag,jdbcType=VARCHAR}, #{receiveAddress,jdbcType=VARCHAR}, #{distributionId,jdbcType=VARCHAR}
139
     #{backFlag,jdbcType=VARCHAR}, #{receiveAddress,jdbcType=VARCHAR}, #{distributionId,jdbcType=VARCHAR}
138
     ,#{wgtDcnMtcCd,jdbcType=VARCHAR},#{edgeTy,jdbcType=VARCHAR},#{productionPlace,jdbcType=VARCHAR},#{tallyPeople,jdbcType=VARCHAR},#{invoicePrice,jdbcType=DOUBLE},
140
     ,#{wgtDcnMtcCd,jdbcType=VARCHAR},#{edgeTy,jdbcType=VARCHAR},#{productionPlace,jdbcType=VARCHAR},#{tallyPeople,jdbcType=VARCHAR},#{invoicePrice,jdbcType=DOUBLE},
139
-    #{packNo,jdbcType=VARCHAR},#{contractNo,jdbcType=VARCHAR},#{ordNo,jdbcType=VARCHAR},#{fkComponyName,jdbcType=VARCHAR})
141
+    #{packNo,jdbcType=VARCHAR},#{contractNo,jdbcType=VARCHAR},#{ordNo,jdbcType=VARCHAR},#{fkComponyName,jdbcType=VARCHAR},#{inWareDays,jdbcType=DOUBLE},#{payWay,jdbcType=VARCHAR})
140
   </insert>
142
   </insert>
141
   <insert id="insertSelective" parameterType="com.th.demo.model.ware.OutRecord" >
143
   <insert id="insertSelective" parameterType="com.th.demo.model.ware.OutRecord" >
142
     insert into t_ware_out_record
144
     insert into t_ware_out_record
423
             )  or t.customer_name like CONCAT((select attr3 from sys_user temp where temp.id=#{param10,jdbcType=VARCHAR}),'%') )
425
             )  or t.customer_name like CONCAT((select attr3 from sys_user temp where temp.id=#{param10,jdbcType=VARCHAR}),'%') )
424
    and ifnull(p.tally_people,'*') like concat('%',#{param13,jdbcType=VARCHAR},'%')
426
    and ifnull(p.tally_people,'*') like concat('%',#{param13,jdbcType=VARCHAR},'%')
425
    and ifnull(c.ord_no,'*') like concat('%',#{param14,jdbcType=VARCHAR},'%')
427
    and ifnull(c.ord_no,'*') like concat('%',#{param14,jdbcType=VARCHAR},'%')
426
-   and ifnull(e.name,'*') like concat('%',#{param15,jdbcType=VARCHAR},'%')
428
+    <if test="param15 != null and param15 != ''">
429
+      and ifnull(e.name,'*') = #{param15,jdbcType=VARCHAR}
430
+    </if>
427
     and ifnull(t.back_flag,0) &lt;> '1'
431
     and ifnull(t.back_flag,0) &lt;> '1'
428
     order by t.add_time desc
432
     order by t.add_time desc
429
   </select>
433
   </select>
450
             and  a.user_id = #{param10,jdbcType=VARCHAR}  )
454
             and  a.user_id = #{param10,jdbcType=VARCHAR}  )
451
             )  or t.customer_name like CONCAT((select attr3 from sys_user temp where temp.id=#{param10,jdbcType=VARCHAR}),'%') )
455
             )  or t.customer_name like CONCAT((select attr3 from sys_user temp where temp.id=#{param10,jdbcType=VARCHAR}),'%') )
452
     and ifnull(p.tally_people,'*') like concat('%',#{param13,jdbcType=VARCHAR},'%')
456
     and ifnull(p.tally_people,'*') like concat('%',#{param13,jdbcType=VARCHAR},'%')
453
-    and ifnull(e.name,'*') like concat('%',#{param15,jdbcType=VARCHAR},'%')
457
+    <if test="param15 != null and param15 != ''">
458
+      and ifnull(e.name,'*') = #{param15,jdbcType=VARCHAR}
459
+    </if>
454
     and ifnull(t.back_flag,0) &lt;> '1'
460
     and ifnull(t.back_flag,0) &lt;> '1'
455
     and  (t.plate_no like concat('%',#{param7,jdbcType=VARCHAR},'%')
461
     and  (t.plate_no like concat('%',#{param7,jdbcType=VARCHAR},'%')
456
     <if test="param18 != null and param18.size() !=0" >
462
     <if test="param18 != null and param18.size() !=0" >

+ 18
- 5
src/main/resource/mapper/ware/StoreMapper.xml View File

495
     and  t.model like concat('%',#{param3,jdbcType=VARCHAR},'%')
495
     and  t.model like concat('%',#{param3,jdbcType=VARCHAR},'%')
496
     and  c.name like concat('%',#{param4,jdbcType=VARCHAR},'%')
496
     and  c.name like concat('%',#{param4,jdbcType=VARCHAR},'%')
497
     and  c.standard like concat('%',#{param5,jdbcType=VARCHAR},'%')
497
     and  c.standard like concat('%',#{param5,jdbcType=VARCHAR},'%')
498
-    and  d.name like concat('%',#{param6,jdbcType=VARCHAR},'%')
499
-    and  e.name like concat('%',#{param9,jdbcType=VARCHAR},'%')
498
+    <if test="param6 != null and param6 != ''">
499
+      and ifnull(d.name,'*') = #{param6,jdbcType=VARCHAR}
500
+    </if>
501
+    <if test="param9 != null and param9 != ''">
502
+      and ifnull(e.name,'*') = #{param9,jdbcType=VARCHAR}
503
+    </if>
500
 
504
 
501
       and  (t.plate_no like concat('%',#{param10,jdbcType=VARCHAR},'%')
505
       and  (t.plate_no like concat('%',#{param10,jdbcType=VARCHAR},'%')
502
     <if test="param13 != null and param13.size() !=0" >
506
     <if test="param13 != null and param13.size() !=0" >
556
     and  t.model like concat('%',#{param3,jdbcType=VARCHAR},'%')
560
     and  t.model like concat('%',#{param3,jdbcType=VARCHAR},'%')
557
     and  c.name like concat('%',#{param4,jdbcType=VARCHAR},'%')
561
     and  c.name like concat('%',#{param4,jdbcType=VARCHAR},'%')
558
     and  c.standard like concat('%',#{param5,jdbcType=VARCHAR},'%')
562
     and  c.standard like concat('%',#{param5,jdbcType=VARCHAR},'%')
559
-    and  d.name like concat('%',#{param6,jdbcType=VARCHAR},'%')
560
-    and  e.name like concat('%',#{param9,jdbcType=VARCHAR},'%')
563
+    <if test="param6 != null and param6 != ''">
564
+      and ifnull(d.name,'*') = #{param6,jdbcType=VARCHAR}
565
+    </if>
566
+    <if test="param9 != null and param9 != ''">
567
+      and ifnull(e.name,'*') = #{param9,jdbcType=VARCHAR}
568
+    </if>
561
 
569
 
562
     and  (t.plate_no like concat('%',#{param10,jdbcType=VARCHAR},'%')
570
     and  (t.plate_no like concat('%',#{param10,jdbcType=VARCHAR},'%')
563
     <if test="param13 != null and param13.size() !=0" >
571
     <if test="param13 != null and param13.size() !=0" >
673
     and  t.model like concat('%',#{param3,jdbcType=VARCHAR},'%')
681
     and  t.model like concat('%',#{param3,jdbcType=VARCHAR},'%')
674
     and  c.name like concat('%',#{param4,jdbcType=VARCHAR},'%')
682
     and  c.name like concat('%',#{param4,jdbcType=VARCHAR},'%')
675
     and  c.standard like concat('%',#{param5,jdbcType=VARCHAR},'%')
683
     and  c.standard like concat('%',#{param5,jdbcType=VARCHAR},'%')
676
-    and  d.name like concat('%',#{param6,jdbcType=VARCHAR},'%')
684
+    <if test="param6 != null and param6 != ''">
685
+      and ifnull(d.name,'*') = #{param6,jdbcType=VARCHAR}
686
+    </if>
687
+    <if test="param9 != null and param9 != ''">
688
+      and ifnull(e.name,'*') = #{param9,jdbcType=VARCHAR}
689
+    </if>
677
     and  t.plate_no like concat('%',#{param7,jdbcType=VARCHAR},'%')
690
     and  t.plate_no like concat('%',#{param7,jdbcType=VARCHAR},'%')
678
     and t.cancel_flag = '0'
691
     and t.cancel_flag = '0'
679
     and t.out_flag = '0'
692
     and t.out_flag = '0'

Loading…
Cancel
Save