dev
parent
6c069bf564
commit
032c96757c
|
|
@ -35,7 +35,7 @@ public class InvoiceReceiveService extends BaseService {
|
||||||
* @param invoice_code
|
* @param invoice_code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public InvoiceReceive checkReceive(int supermarket_id, String invoice_number, String invoice_code) {
|
public InvoiceReceive checkSurplusReceive(int supermarket_id, String invoice_number, String invoice_code) {
|
||||||
if (!StrKit.notBlank(invoice_number, invoice_code)) {
|
if (!StrKit.notBlank(invoice_number, invoice_code)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -54,6 +54,30 @@ public class InvoiceReceiveService extends BaseService {
|
||||||
return receive;
|
return receive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有领用记录,可以是已经被使用完的
|
||||||
|
* @param supermarket_id
|
||||||
|
* @param invoice_number
|
||||||
|
* @param invoice_code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public InvoiceReceive checkReceive(int supermarket_id, String invoice_number, String invoice_code) {
|
||||||
|
if (!StrKit.notBlank(invoice_number, invoice_code)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer code = Integer.parseInt(invoice_code);
|
||||||
|
String sql = "select * from invoice_receive t\n" +
|
||||||
|
" where t.supermarket_id = ? \n" +
|
||||||
|
" and t.invoice_number = ? \n" +
|
||||||
|
" and cast(t.start_code as unsigned integer) <= ? \n" +
|
||||||
|
" and cast(t.end_code as unsigned integer) >= ? \n" +
|
||||||
|
" limit 1";
|
||||||
|
|
||||||
|
InvoiceReceive receive = InvoiceReceive.dao.findFirst(sql, supermarket_id, invoice_number, code, code);
|
||||||
|
|
||||||
|
return receive;
|
||||||
|
}
|
||||||
|
|
||||||
public String nextInvoiceCode(InvoiceReceive receive) {
|
public String nextInvoiceCode(InvoiceReceive receive) {
|
||||||
if (receive == null) { // 前面判断过了,应该不会再这里出现 null
|
if (receive == null) { // 前面判断过了,应该不会再这里出现 null
|
||||||
|
|
|
||||||
|
|
@ -577,7 +577,7 @@ public class OrderStatService {
|
||||||
total.set("weight", total.getDouble("weight") + record.getDouble("weight"));
|
total.set("weight", total.getDouble("weight") + record.getDouble("weight"));
|
||||||
}
|
}
|
||||||
|
|
||||||
total.set("weight", String.format("%.2f", total.getDouble("weight")));
|
total.set("weight", Double.parseDouble(String.format("%.2f", total.getDouble("weight"))));
|
||||||
|
|
||||||
dblist.add(total);
|
dblist.add(total);
|
||||||
|
|
||||||
|
|
@ -620,7 +620,7 @@ public class OrderStatService {
|
||||||
total.set("weight", total.getDouble("weight") + record.getDouble("weight"));
|
total.set("weight", total.getDouble("weight") + record.getDouble("weight"));
|
||||||
}
|
}
|
||||||
|
|
||||||
total.set("weight", String.format("%.2f", total.getDouble("weight")));
|
total.set("weight", Double.parseDouble(String.format("%.2f", total.getDouble("weight"))));
|
||||||
|
|
||||||
dblist.add(total);
|
dblist.add(total);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,22 +3,14 @@ package com.cowr.ssjygl.transport;
|
||||||
import com.cowr.common.Const;
|
import com.cowr.common.Const;
|
||||||
import com.cowr.common.base.BaseService;
|
import com.cowr.common.base.BaseService;
|
||||||
import com.cowr.common.enums.OrderStateEnum;
|
import com.cowr.common.enums.OrderStateEnum;
|
||||||
import com.cowr.common.enums.OrderTypeEnum;
|
|
||||||
import com.cowr.common.view.PageParam;
|
import com.cowr.common.view.PageParam;
|
||||||
import com.cowr.common.view.Result;
|
import com.cowr.model.*;
|
||||||
import com.cowr.model.Supermarket;
|
|
||||||
import com.cowr.model.Transport;
|
|
||||||
import com.cowr.model.TransportCompany;
|
|
||||||
import com.cowr.model.Truck;
|
|
||||||
import com.cowr.ssjygl.prepay.PrepayService;
|
|
||||||
import com.jfinal.kit.StrKit;
|
import com.jfinal.kit.StrKit;
|
||||||
import com.jfinal.plugin.activerecord.Db;
|
import com.jfinal.plugin.activerecord.Db;
|
||||||
import com.jfinal.plugin.activerecord.Page;
|
import com.jfinal.plugin.activerecord.Page;
|
||||||
import com.jfinal.plugin.activerecord.Record;
|
import com.jfinal.plugin.activerecord.Record;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.util.*;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated by COWR Sun Apr 12 21:56:13 CST 2020
|
* Generated by COWR Sun Apr 12 21:56:13 CST 2020
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
public class LEDThread extends Device implements Runnable {
|
public class LEDThread extends Device implements Runnable {
|
||||||
private static Log log = Log.getLog(LEDThread.class);
|
private static Log log = Log.getLog(LEDThread.class);
|
||||||
private static final String LEDPriceFormat = " %s \\n重: %s吨\\n %s元";
|
private static final String LEDPriceFormat = "%s\\n%s吨\\n%s元";
|
||||||
private static final String LEDWeightFormat = "%s\\n %s \\n重: %s吨";
|
private static final String LEDWeightFormat = "%s\\n %s \\n重: %s吨";
|
||||||
private static final String LEDInfoFormat = "%s\\n %s \\n%s";
|
private static final String LEDInfoFormat = "%s\\n %s \\n%s";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import com.jfinal.log.Log;
|
||||||
import com.jfinal.plugin.activerecord.Db;
|
import com.jfinal.plugin.activerecord.Db;
|
||||||
import com.jfinal.plugin.activerecord.IAtom;
|
import com.jfinal.plugin.activerecord.IAtom;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class InvoiceInvalidVerifySyncService {
|
public class InvoiceInvalidVerifySyncService {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import com.cowr.local.ssjygl.main.CliCacheData;
|
||||||
import com.cowr.local.ssjygl.main.Config;
|
import com.cowr.local.ssjygl.main.Config;
|
||||||
import com.cowr.local.ssjygl.order.LocalOrderService;
|
import com.cowr.local.ssjygl.order.LocalOrderService;
|
||||||
import com.cowr.local.ssjygl.order.orderseq.OrderSeqService;
|
import com.cowr.local.ssjygl.order.orderseq.OrderSeqService;
|
||||||
import com.cowr.ssjygl.customer.supermarketproduct.CustomerSupermarketProductService;
|
|
||||||
import com.cowr.ssjygl.invoice.log.InvoiceLogService;
|
import com.cowr.ssjygl.invoice.log.InvoiceLogService;
|
||||||
import com.cowr.ssjygl.invoice.receive.InvoiceReceiveService;
|
import com.cowr.ssjygl.invoice.receive.InvoiceReceiveService;
|
||||||
import com.cowr.ssjygl.order.ordercluster.OrderclusterService;
|
import com.cowr.ssjygl.order.ordercluster.OrderclusterService;
|
||||||
|
|
@ -56,7 +55,7 @@ public class OrderTempSyncService {
|
||||||
return Result.failed("进出场记录已完结或者已作废,不能使用");
|
return Result.failed("进出场记录已完结或者已作废,不能使用");
|
||||||
}
|
}
|
||||||
|
|
||||||
InvoiceReceive receive = InvoiceReceiveService.me.checkReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
InvoiceReceive receive = InvoiceReceiveService.me.checkSurplusReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
||||||
if (receive == null) {
|
if (receive == null) {
|
||||||
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
||||||
}
|
}
|
||||||
|
|
@ -316,7 +315,7 @@ public class OrderTempSyncService {
|
||||||
|
|
||||||
// 零散客户需要开具发票的,需要检查是否有有效的领用记录
|
// 零散客户需要开具发票的,需要检查是否有有效的领用记录
|
||||||
if (ordercluster.getReqReceipt() == 1) {
|
if (ordercluster.getReqReceipt() == 1) {
|
||||||
receive = InvoiceReceiveService.me.checkReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
receive = InvoiceReceiveService.me.checkSurplusReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
||||||
|
|
||||||
if (receive == null) {
|
if (receive == null) {
|
||||||
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
||||||
|
|
@ -638,7 +637,7 @@ public class OrderTempSyncService {
|
||||||
order.setInvoiceType(2);
|
order.setInvoiceType(2);
|
||||||
// 需要专票的,在结算开了专票之后,再修改 invoice_site 字段
|
// 需要专票的,在结算开了专票之后,再修改 invoice_site 字段
|
||||||
} else {
|
} else {
|
||||||
receive = InvoiceReceiveService.me.checkReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
receive = InvoiceReceiveService.me.checkSurplusReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
||||||
if (receive == null) {
|
if (receive == null) {
|
||||||
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
||||||
}
|
}
|
||||||
|
|
@ -887,7 +886,7 @@ public class OrderTempSyncService {
|
||||||
return Result.failedstr("请先将已开具的发票[%s]取消", order.getInvoiceCode());
|
return Result.failedstr("请先将已开具的发票[%s]取消", order.getInvoiceCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
InvoiceReceive receive = InvoiceReceiveService.me.checkReceive(order.getSupermarketId(), invoice_number, invoice_code);
|
InvoiceReceive receive = InvoiceReceiveService.me.checkSurplusReceive(order.getSupermarketId(), invoice_number, invoice_code);
|
||||||
if (receive == null) {
|
if (receive == null) {
|
||||||
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
||||||
}
|
}
|
||||||
|
|
@ -986,7 +985,7 @@ public class OrderTempSyncService {
|
||||||
cmd.set("status", false);
|
cmd.set("status", false);
|
||||||
|
|
||||||
ActionCmdLogSyncService.me.save(cmd.toJson(), sysuser);
|
ActionCmdLogSyncService.me.save(cmd.toJson(), sysuser);
|
||||||
return Result.failed("打印指令失败");
|
return Result.success("开票成功,打印指令失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.success("开票成功,打印指令已发送");
|
return Result.success("开票成功,打印指令已发送");
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import com.cowr.local.ssjygl.main.Config;
|
||||||
import com.cowr.ssjygl.customer.supermarketproduct.CustomerSupermarketProductService;
|
import com.cowr.ssjygl.customer.supermarketproduct.CustomerSupermarketProductService;
|
||||||
import com.cowr.ssjygl.invoice.receive.InvoiceReceiveService;
|
import com.cowr.ssjygl.invoice.receive.InvoiceReceiveService;
|
||||||
import com.cowr.ssjygl.order.OrderService;
|
import com.cowr.ssjygl.order.OrderService;
|
||||||
|
import com.cowr.ssjygl.order.ordercluster.OrderclusterService;
|
||||||
import com.cowr.ssjygl.order.ordercluster.truck.OrderclusterTruckService;
|
import com.cowr.ssjygl.order.ordercluster.truck.OrderclusterTruckService;
|
||||||
import com.cowr.ssjygl.supermarket.product.SupermarketProductService;
|
import com.cowr.ssjygl.supermarket.product.SupermarketProductService;
|
||||||
import com.cowr.model.*;
|
import com.cowr.model.*;
|
||||||
|
|
@ -66,7 +67,12 @@ public class TransportQueryService {
|
||||||
transobj.set("prepay_truck", false);
|
transobj.set("prepay_truck", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BigDecimal overweight = OrderclusterService.me.getOverWeight(ordercluster.getId()); // 集团订单已完成量
|
||||||
|
|
||||||
transobj.set("ordercluster", ordercluster);
|
transobj.set("ordercluster", ordercluster);
|
||||||
|
transobj.set("ordercluster_over_weight", overweight);
|
||||||
|
transobj.set("ordercluster_surplus_weight", ordercluster.getTotalWeight().subtract(overweight));
|
||||||
|
transobj.set("ordercluster_surplus_threshold", Config.configprop.getInt("surplus.threshold", 30));
|
||||||
transobj.set("weight", net_weight);
|
transobj.set("weight", net_weight);
|
||||||
transobj.set("net_weight", net_weight);
|
transobj.set("net_weight", net_weight);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,10 @@ default_scale_wait_time=8000
|
||||||
|
|
||||||
#最大毛重不超过 49 吨,超过 49 吨不能上高速
|
#最大毛重不超过 49 吨,超过 49 吨不能上高速
|
||||||
#2020-10-16 盐港都是小磅,最大只能40
|
#2020-10-16 盐港都是小磅,最大只能40
|
||||||
weigh.max=40
|
weigh.max=49
|
||||||
|
|
||||||
|
#集团订单剩余量在结算时的剩余量预警值
|
||||||
|
surplus.threshold=30
|
||||||
|
|
||||||
#打印用到的配置信息
|
#打印用到的配置信息
|
||||||
print.vendor=浠水县长投环保有限公司
|
print.vendor=浠水县长投环保有限公司
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@ default_scale_wait_time=8000
|
||||||
#2020-10-16 盐港都是小磅,最大只能40
|
#2020-10-16 盐港都是小磅,最大只能40
|
||||||
weigh.max=49
|
weigh.max=49
|
||||||
|
|
||||||
|
#集团订单剩余量在结算时的剩余量预警值
|
||||||
|
surplus.threshold=30
|
||||||
|
|
||||||
#打印用到的配置信息
|
#打印用到的配置信息
|
||||||
print.vendor=浠水县长投环保有限公司
|
print.vendor=浠水县长投环保有限公司
|
||||||
print.vendorTaxId=91421125MA49GYYK2B
|
print.vendorTaxId=91421125MA49GYYK2B
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ import com.jfinal.plugin.activerecord.Db;
|
||||||
import com.jfinal.plugin.activerecord.IAtom;
|
import com.jfinal.plugin.activerecord.IAtom;
|
||||||
import com.jfinal.plugin.activerecord.Record;
|
import com.jfinal.plugin.activerecord.Record;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class InvoiceLogSyncService extends BaseSyncService {
|
public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.cowr.service.ssjygl.jobs;
|
package com.cowr.service.ssjygl.jobs;
|
||||||
|
|
||||||
|
import com.cowr.model.Supermarket;
|
||||||
|
import com.cowr.service.ssjygl.main.SvrCacheData;
|
||||||
import com.cowr.service.ssjygl.smslog.SmsService;
|
import com.cowr.service.ssjygl.smslog.SmsService;
|
||||||
import com.cowr.service.ssjygl.synctask.SyncTaskService;
|
import com.cowr.service.ssjygl.synctask.SyncTaskService;
|
||||||
import com.jfinal.log.Log;
|
import com.jfinal.log.Log;
|
||||||
|
|
@ -7,13 +9,17 @@ import org.quartz.Job;
|
||||||
import org.quartz.JobExecutionContext;
|
import org.quartz.JobExecutionContext;
|
||||||
import org.quartz.JobExecutionException;
|
import org.quartz.JobExecutionException;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class SyncJob implements Job {
|
public class SyncJob implements Job {
|
||||||
private static Log log = Log.getLog(SyncJob.class);
|
private static Log log = Log.getLog(SyncJob.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||||
try {
|
try {
|
||||||
SyncTaskService.me.task();
|
for(Map.Entry<Integer, Supermarket> entry : SvrCacheData.SUP_CACHE.entrySet()){
|
||||||
|
SyncTaskService.me.task(entry.getKey());
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -127,13 +127,13 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
if (undonlist != null && !undonlist.isEmpty()) {
|
if (undonlist != null && !undonlist.isEmpty()) {
|
||||||
BigDecimal plan_total_weight = new BigDecimal(total_weight); // 本次配额重量
|
BigDecimal plan_total_weight = new BigDecimal(total_weight); // 本次配额重量
|
||||||
|
|
||||||
for(Record record : undonlist){
|
for (Record record : undonlist) {
|
||||||
Date record_cutoff_time = record.getDate("cutoff_time");
|
Date record_cutoff_time = record.getDate("cutoff_time");
|
||||||
|
|
||||||
// 判断日期不是已经存在
|
// 判断日期不是已经存在
|
||||||
if(record_cutoff_time.getTime() == cutoff_time.getTime()){
|
if (record_cutoff_time.getTime() == cutoff_time.getTime()) {
|
||||||
return Result.failedstr("客户[%s][%s]在砂站[%s]还有未完成的配额", customerObj.getName(), DateTimeUtil.sdfymd.get().format(cutoff_time), SvrCacheData.SUP_CACHE.get(supermarket_id).getName());
|
return Result.failedstr("客户[%s][%s]在砂站[%s]还有未完成的配额", customerObj.getName(), DateTimeUtil.sdfymd.get().format(cutoff_time), SvrCacheData.SUP_CACHE.get(supermarket_id).getName());
|
||||||
}else{
|
} else {
|
||||||
// 累加总量
|
// 累加总量
|
||||||
plan_total_weight = plan_total_weight.add(record.getBigDecimal("total_weight"));
|
plan_total_weight = plan_total_weight.add(record.getBigDecimal("total_weight"));
|
||||||
}
|
}
|
||||||
|
|
@ -142,7 +142,7 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
// 按客户统计已完成量
|
// 按客户统计已完成量
|
||||||
BigDecimal overweight = OrderclusterService.me.getOverWeightByCustomer(customer_id); // 按客户找集团订单已完成量
|
BigDecimal overweight = OrderclusterService.me.getOverWeightByCustomer(customer_id); // 按客户找集团订单已完成量
|
||||||
|
|
||||||
if(plan_total_weight.subtract(overweight).multiply(unitprice).compareTo(prepayCustomer.getSurplus()) > 0 ){
|
if (plan_total_weight.subtract(overweight).multiply(unitprice).compareTo(prepayCustomer.getSurplus()) > 0) {
|
||||||
return Result.failedstr("剩余总配额 %.2f,客户余额(%.2f)不足", plan_total_weight.subtract(overweight), prepayCustomer.getSurplus());
|
return Result.failedstr("剩余总配额 %.2f,客户余额(%.2f)不足", plan_total_weight.subtract(overweight), prepayCustomer.getSurplus());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -521,33 +521,49 @@ public class OrderclusterSyncService extends BaseSyncService {
|
||||||
return Result.failed(false, "订单已完成,不能修改");
|
return Result.failed(false, "订单已完成,不能修改");
|
||||||
}
|
}
|
||||||
|
|
||||||
String sql = "select t.ordercluster_id, sum(t.weight) weight from order_sale t \n" +
|
if (oldobj.getCustomerId() != null) {
|
||||||
" where t.state = ? \n" +
|
PrepayCustomer prepayCustomer = PrepayCustomerService.me.getPrepayCustomer(oldobj.getCustomerId());
|
||||||
" and t.ordercluster_id = ? \n" +
|
if (prepayCustomer == null) {
|
||||||
" group by t.ordercluster_id \n" +
|
return Result.failed("不是预付费用户");
|
||||||
" union \n" +
|
|
||||||
" select t.ordercluster_id, sum(t.weight) weight from order_temp t \n" +
|
|
||||||
" where t.state = ? \n" +
|
|
||||||
" and t.ordercluster_id = ? \n" +
|
|
||||||
" group by t.ordercluster_id ";
|
|
||||||
|
|
||||||
Record record = Db.findFirst(sql, OrderStateEnum.RECEIVED.getStateid(), model.getId(), OrderStateEnum.RECEIVED.getStateid(), model.getId());
|
|
||||||
|
|
||||||
if (record != null) {
|
|
||||||
if (model.getTotalWeight().compareTo(record.getBigDecimal("weight")) < 0) {
|
|
||||||
return Result.failedstr("总量不能低于已运输量(%.2f)", record.getBigDecimal("weight"));
|
|
||||||
} else {
|
|
||||||
oldobj.setTotalWeight(model.getTotalWeight());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 按客户查询未完成的订单量
|
||||||
|
List<Record> undonlist = OrderclusterService.me.undonlist(oldobj.getCustomerId());
|
||||||
|
|
||||||
|
if (undonlist != null && !undonlist.isEmpty()) {
|
||||||
|
BigDecimal plan_total_weight = model.getTotalWeight();
|
||||||
|
|
||||||
|
for (Record record : undonlist) {
|
||||||
|
if (model.getId().equals(record.getInt("id"))) {
|
||||||
|
continue; // 当前修改的记录已经做为初始值了,不再累计
|
||||||
|
}
|
||||||
|
|
||||||
|
// 累加总量
|
||||||
|
plan_total_weight = plan_total_weight.add(record.getBigDecimal("total_weight"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按客户统计已完成量
|
||||||
|
BigDecimal overweight = OrderclusterService.me.getOverWeightByCustomer(oldobj.getCustomerId()); // 按客户找集团订单已完成量
|
||||||
|
|
||||||
|
if (plan_total_weight.subtract(overweight).multiply(oldobj.getUnitPrice()).compareTo(prepayCustomer.getSurplus()) > 0) {
|
||||||
|
return Result.failedstr("剩余总配额 %.2f,客户余额(%.2f)不足", plan_total_weight.subtract(overweight), prepayCustomer.getSurplus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal overweight = OrderclusterService.me.getOverWeight(model.getId()); // 集团订单已完成量
|
||||||
|
|
||||||
|
if (model.getTotalWeight().compareTo(overweight) < 0) {
|
||||||
|
return Result.failedstr("总量不能低于已运输量(%.2f)", overweight);
|
||||||
} else {
|
} else {
|
||||||
oldobj.setTotalWeight(model.getTotalWeight());
|
oldobj.setTotalWeight(model.getTotalWeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(model.getTimeInterval() != null){
|
if (model.getTimeInterval() != null) {
|
||||||
oldobj.setTimeInterval(model.getTimeInterval());
|
oldobj.setTimeInterval(model.getTimeInterval());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(model.getMiniTruck() != null){
|
if (model.getMiniTruck() != null) {
|
||||||
oldobj.setMiniTruck(model.getMiniTruck());
|
oldobj.setMiniTruck(model.getMiniTruck());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ public class OrderTempSyncService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 是预付费订单
|
// 是预付费订单
|
||||||
if (order.getIsprepaid() == 1) {
|
if (order.getIsprepaid() == 1 && order.getCustomerId() != null) {
|
||||||
Customer customer = Customer.dao.findById(order.getCustomerId());
|
Customer customer = Customer.dao.findById(order.getCustomerId());
|
||||||
|
|
||||||
if (customer == null) {
|
if (customer == null) {
|
||||||
|
|
|
||||||
|
|
@ -89,14 +89,6 @@ public class SyncTaskService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 2020-10-10 创建的任务不能立马就发出,要事务完成后发出,避免事务回滚
|
|
||||||
// if (ret) {
|
|
||||||
// for (SyncTask obj : list) {
|
|
||||||
// send(obj);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
return ret; // 有插入的,还是需要返回插入状态
|
return ret; // 有插入的,还是需要返回插入状态
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -167,15 +159,19 @@ public class SyncTaskService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void task() {
|
/**
|
||||||
|
* 按砂站ID去找未完成的,避免一个砂站有过多的未完成堆积,导致其他的不能下发
|
||||||
|
* @param supermarket_id
|
||||||
|
*/
|
||||||
|
public void task(int supermarket_id) {
|
||||||
if (!isEnable()) {
|
if (!isEnable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SyncTask> list = unsynclist();
|
List<SyncTask> list = unsynclist(supermarket_id);
|
||||||
|
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
log.debug("开始下发未同步完成的数据 " + list.size());
|
log.debug("开始下发未同步完成的数据 supermarket_id: %s, len: %s", supermarket_id, list.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SyncTask obj : list) {
|
for (SyncTask obj : list) {
|
||||||
|
|
@ -183,8 +179,8 @@ public class SyncTaskService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SyncTask> unsynclist() {
|
public List<SyncTask> unsynclist(int supermarket_id) {
|
||||||
return SyncTask.dao.find("select * from sync_task t where t.state = 0 order by t.create_time limit 0, 500");
|
return SyncTask.dao.find("select * from sync_task t where t.state = 0 and t.supermarket_id = ? order by t.create_time limit 0, 500", supermarket_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue