dev
parent
57c96db052
commit
fad8dbe4a8
|
|
@ -12,8 +12,10 @@ import com.cowr.model.OrderclusterTruck;
|
|||
import com.cowr.model.Sysuser;
|
||||
import com.cowr.model.Transport;
|
||||
import com.cowr.ssjygl.order.ordercluster.truck.OrderclusterTruckService;
|
||||
import com.cowr.ssjygl.transport.TransportService;
|
||||
import com.cowr.ssjygl.transprice.TransPriceService;
|
||||
import com.jfinal.kit.StrKit;
|
||||
import com.jfinal.log.Log;
|
||||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.activerecord.Page;
|
||||
import com.jfinal.plugin.activerecord.Record;
|
||||
|
|
@ -29,7 +31,8 @@ import java.util.*;
|
|||
* <p>
|
||||
*/
|
||||
public class OrderclusterService extends BaseService {
|
||||
public static final OrderclusterService me = new OrderclusterService();
|
||||
private static Log log = Log.getLog(OrderclusterService.class);
|
||||
public static final OrderclusterService me = new OrderclusterService();
|
||||
|
||||
public Result get(Integer id, Sysuser sysuser) {
|
||||
Ordercluster ordercluster = Ordercluster.dao.findById(id);
|
||||
|
|
@ -582,53 +585,50 @@ public class OrderclusterService extends BaseService {
|
|||
}
|
||||
|
||||
public BigDecimal getTotalPriceByLicense(int supermarket_id, String truck_license, double weight) {
|
||||
Transport transport = Transport.dao.findFirst("select * from transport t \n" +
|
||||
" where t.state < ? \n" +
|
||||
" and t.supermarket_id = ? \n" +
|
||||
" and t.truck_license = ? \n" +
|
||||
" and t.out_time like ? ",
|
||||
OrderStateEnum.RECEIVED.getStateid(),
|
||||
supermarket_id,
|
||||
truck_license,
|
||||
DateTimeUtil.sdf.get().format(new Date()) + "%"
|
||||
);
|
||||
Transport transport = TransportService.me.undoneTransport(supermarket_id, truck_license);
|
||||
|
||||
if (transport == null) {
|
||||
log.debug("没有找到运输记录");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (transport.getFirstWeight() == null || transport.getSecondWeight() == null) {
|
||||
if (transport.getFirstWeight() == null) {
|
||||
log.debug("没有入场重量");
|
||||
return null;
|
||||
}
|
||||
|
||||
OrderclusterTruck ot = OrderclusterTruckService.me.checkValidLicense(transport.getSupermarketId(), transport.getTruckLicense());
|
||||
|
||||
if (ot == null) {
|
||||
log.debug("没有配车记录");
|
||||
return null;
|
||||
}
|
||||
|
||||
Ordercluster ordercluster = Ordercluster.dao.findById(ot.getOrderclusterId());
|
||||
|
||||
if (ordercluster == null) {
|
||||
log.debug("没有找到关联的集团订单信息");
|
||||
return null;
|
||||
}
|
||||
|
||||
BigDecimal up = ordercluster.getUnitPrice(); // 集团订单是每天创建的,可以使用集团订单中确定的单价
|
||||
|
||||
if (up == null) {
|
||||
log.debug("集团订单单价信息错误");
|
||||
return null;
|
||||
}
|
||||
|
||||
BigDecimal net_weight = transport.getSecondWeight().subtract(transport.getFirstWeight()).abs();
|
||||
BigDecimal net_weight = new BigDecimal(weight).subtract(transport.getFirstWeight()).abs();
|
||||
|
||||
BigDecimal total_price = TransPriceService.me.caleTotalPrice(up, net_weight);
|
||||
|
||||
if(total_price == null){
|
||||
if (total_price == null) {
|
||||
log.debug("总价计算错误");
|
||||
return null;
|
||||
}
|
||||
|
||||
// 零散购砂总价四舍五入
|
||||
if(ordercluster.getCustomerId() == null){
|
||||
if (ordercluster.getCustomerId() == null) {
|
||||
total_price = total_price.setScale(0, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public class Config extends JFinalConfig {
|
|||
public static DeviceThread deviceThread = new DeviceThread();
|
||||
public static SocketIOService socketio = null;
|
||||
private static boolean client_run = true;
|
||||
public static final String CLINET_VERSION = "20201029";
|
||||
public static final String CLINET_VERSION = "20201029.2";
|
||||
|
||||
public static String getRootPath() {
|
||||
return PathKit.getWebRootPath()
|
||||
|
|
|
|||
|
|
@ -286,11 +286,26 @@ public class TransportDeviceService {
|
|||
return Result.failed("记录已完成或者已取消");
|
||||
}
|
||||
|
||||
Double weight = Config.deviceThread.scale(which);
|
||||
Double weight = null;
|
||||
int tryCount = 0;
|
||||
|
||||
// 称重失败,在称一次
|
||||
if (weight == null || weight == 0) {
|
||||
weight = Config.deviceThread.scale(which);
|
||||
while (tryCount < 4) {
|
||||
try {
|
||||
weight = Config.deviceThread.scale(which);
|
||||
|
||||
if (weight != null && weight > 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
Thread.sleep(500);
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(), e);
|
||||
}finally {
|
||||
tryCount++;
|
||||
|
||||
log.debug("%s 第 %s 次,重 %s", transport.getTruckLicense(), tryCount, weight);
|
||||
}
|
||||
}
|
||||
|
||||
if (weight == null || weight == 0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue