YL2767 2 days ago
parent
commit
0a4fab5731

+ 10
- 0
pom.xml View File

@@ -550,6 +550,16 @@
550 550
 
551 551
     <build>
552 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 563
         <resources>
554 564
             <resource>
555 565
                 <directory>src/main/resource</directory>

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

@@ -89,6 +89,10 @@ public class OutRecord {
89 89
     private String contractNo;
90 90
     private String packNo;
91 91
 
92
+    // 出库记录增加价格计算时间的信息
93
+    private String payWay;
94
+
95
+
92 96
     public Double getStoreFee() {
93 97
         return storeFee;
94 98
     }
@@ -447,4 +451,12 @@ public class OutRecord {
447 451
     public void setPackNo(String packNo) {
448 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,6 +25,8 @@ import org.springframework.transaction.annotation.Transactional;
25 25
 
26 26
 import java.util.*;
27 27
 
28
+import static java.lang.Math.toIntExact;
29
+
28 30
 @Service("OutService")
29 31
 public class OutServiceImpl implements OutService {
30 32
 
@@ -48,6 +50,8 @@ public class OutServiceImpl implements OutService {
48 50
     public ChangeRecordMapper changeRecordMapper;
49 51
     @Autowired
50 52
     public PriceMapper priceMapper;
53
+    @Autowired
54
+    public InRecordMapper inRecordMapper;
51 55
 
52 56
     String result = Type.FAIL;
53 57
     int num = 0;
@@ -149,8 +153,6 @@ public class OutServiceImpl implements OutService {
149 153
             List<StoreOfWareStack> listSows = storeMapper.selectWareStackByDistributionStore(map);
150 154
 
151 155
             for (int m = 0; m < listSows.size(); m++) {
152
-
153
-
154 156
                 Stack stack = stackMapper.selectByPrimaryKey(listSows.get(m).getStackId());
155 157
                 Map<String, Object> mapParam = new HashMap<String, Object>();
156 158
                 mapParam.put("storeId", listStoreId);
@@ -300,6 +302,39 @@ public class OutServiceImpl implements OutService {
300 302
         outRecord.setEdgeTy(store.getEdgeTy());
301 303
         outRecord.setProductionPlace(store.getProductionPlace());
302 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 338
         return outRecord;
304 339
     }
305 340
 

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

@@ -3,12 +3,12 @@
3 3
 #jdbc.user=root
4 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 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 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

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

@@ -37,6 +37,7 @@
37 37
     <result column="in_car_no" property="inCarNo" jdbcType="VARCHAR" />
38 38
     <result column="out_car_no" property="outCarNo" jdbcType="VARCHAR" />
39 39
     <result column="fk_compony_name" property="fkComponyName" jdbcType="VARCHAR" />
40
+    <result column="pay_way" property="payWay" jdbcType="VARCHAR" />
40 41
     <result column="invoice_price" property="invoicePrice" jdbcType="DOUBLE" />
41 42
     <result column="verify_account_id" property="verifyAccountId" jdbcType="DOUBLE" />
42 43
 
@@ -93,6 +94,7 @@
93 94
     <result column="store_fee" property="storeFee" jdbcType="DOUBLE" />
94 95
     <result column="pack_no" property="packNo" jdbcType="VARCHAR" />
95 96
     <result column="contract_no" property="contractNo" jdbcType="VARCHAR" />
97
+    <result column="pay_way" property="payWay" jdbcType="VARCHAR" />
96 98
   </resultMap>
97 99
   <resultMap id="TotalResultMap" type="com.th.demo.model.ware.TotalRecord">
98 100
     <result column="total_amount" property="totalAmount" jdbcType="DOUBLE" />
@@ -105,7 +107,7 @@
105 107
   </sql>
106 108
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
107 109
     select 
108
-    <include refid="Base_Column_List" />
110
+    *
109 111
     from t_ware_out_record
110 112
     where id = #{id,jdbcType=VARCHAR}
111 113
   </select>
@@ -125,7 +127,7 @@
125 127
       modify_id, modify_time, cancel_id, 
126 128
       cancel_time, cancel_flag, belong_id, 
127 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 131
     values (#{id,jdbcType=VARCHAR}, #{wareName,jdbcType=VARCHAR}, #{stackName,jdbcType=VARCHAR}, 
130 132
       #{layer,jdbcType=INTEGER}, #{materialName,jdbcType=VARCHAR}, #{materialNo,jdbcType=VARCHAR}, 
131 133
       #{standard,jdbcType=VARCHAR}, #{model,jdbcType=VARCHAR}, #{customerName,jdbcType=VARCHAR}, 
@@ -136,7 +138,7 @@
136 138
     #{plateNo,jdbcType=VARCHAR},  #{inId,jdbcType=VARCHAR}, #{recordType,jdbcType=VARCHAR},
137 139
     #{backFlag,jdbcType=VARCHAR}, #{receiveAddress,jdbcType=VARCHAR}, #{distributionId,jdbcType=VARCHAR}
138 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 142
   </insert>
141 143
   <insert id="insertSelective" parameterType="com.th.demo.model.ware.OutRecord" >
142 144
     insert into t_ware_out_record

Loading…
Cancel
Save