dev
parent
ac3585d0c9
commit
9cfdbf85cf
|
|
@ -48,6 +48,12 @@ public class InvoiceReceiveService extends BaseService {
|
||||||
return receive;
|
return receive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最早的领用记录
|
||||||
|
* @param supermarket_id
|
||||||
|
* @param invoice_number
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public InvoiceReceive foremostReceive(int supermarket_id, String invoice_number) {
|
public InvoiceReceive foremostReceive(int supermarket_id, String invoice_number) {
|
||||||
String sql = "select * from invoice_receive t\n" +
|
String sql = "select * from invoice_receive t\n" +
|
||||||
" where t.supermarket_id = ? \n" +
|
" where t.supermarket_id = ? \n" +
|
||||||
|
|
|
||||||
|
|
@ -259,6 +259,11 @@ public class OrderTempSyncService {
|
||||||
return Result.failedstr("毛重 %.2f 吨,不能超过 %s 吨", transport.getSecondWeight(), Config.configprop.getInt("weigh.max"));
|
return Result.failedstr("毛重 %.2f 吨,不能超过 %s 吨", transport.getSecondWeight(), Config.configprop.getInt("weigh.max"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InvoiceReceive receive = InvoiceReceiveService.me.checkReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
||||||
|
if (receive == null) {
|
||||||
|
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
||||||
|
}
|
||||||
|
|
||||||
BigDecimal net_weight = transport.getSecondWeight().subtract(transport.getFirstWeight()); // 销售的用第二次减第一次
|
BigDecimal net_weight = transport.getSecondWeight().subtract(transport.getFirstWeight()); // 销售的用第二次减第一次
|
||||||
|
|
||||||
OrderclusterTruck ot = OrderclusterTruck.dao.findFirst("select * from ordercluster_truck t \n" +
|
OrderclusterTruck ot = OrderclusterTruck.dao.findFirst("select * from ordercluster_truck t \n" +
|
||||||
|
|
@ -291,11 +296,6 @@ public class OrderTempSyncService {
|
||||||
return Result.failedstr("净重 %.2f 吨,超过了剩余的 %.2f 余量", net_weight, ordercluster.getTotalWeight().subtract(overweight));
|
return Result.failedstr("净重 %.2f 吨,超过了剩余的 %.2f 余量", net_weight, ordercluster.getTotalWeight().subtract(overweight));
|
||||||
}
|
}
|
||||||
|
|
||||||
InvoiceReceive receive = InvoiceReceiveService.me.checkReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
|
||||||
if (receive == null) {
|
|
||||||
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
|
||||||
}
|
|
||||||
|
|
||||||
BigDecimal up = SupermarketProductService.me.getUnitPrice(transport.getSupermarketId(), ordercluster.getProductId());
|
BigDecimal up = SupermarketProductService.me.getUnitPrice(transport.getSupermarketId(), ordercluster.getProductId());
|
||||||
|
|
||||||
if (up == null) {
|
if (up == null) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.cowr.service.ssjygl.cache;
|
package com.cowr.service.ssjygl.cache;
|
||||||
|
|
||||||
|
import com.cowr.common.utils.DateTimeUtil;
|
||||||
import com.cowr.common.view.Result;
|
import com.cowr.common.view.Result;
|
||||||
import com.cowr.service.ssjygl.main.AuthInterceptor;
|
import com.cowr.service.ssjygl.main.AuthInterceptor;
|
||||||
import com.cowr.service.ssjygl.main.SvrCacheData;
|
import com.cowr.service.ssjygl.main.SvrCacheData;
|
||||||
|
|
@ -8,6 +9,10 @@ import com.cowr.ssjygl.transportcompany.TransportCompanyService;
|
||||||
import com.cowr.ssjygl.transprice.TransPriceService;
|
import com.cowr.ssjygl.transprice.TransPriceService;
|
||||||
import com.jfinal.aop.Clear;
|
import com.jfinal.aop.Clear;
|
||||||
import com.jfinal.core.Controller;
|
import com.jfinal.core.Controller;
|
||||||
|
import com.jfinal.plugin.activerecord.Record;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Clear(AuthInterceptor.class)
|
@Clear(AuthInterceptor.class)
|
||||||
public class CacheController extends Controller {
|
public class CacheController extends Controller {
|
||||||
|
|
@ -26,6 +31,10 @@ public class CacheController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void last(){
|
public void last(){
|
||||||
renderJson(SvrCacheData.SUP_HEARTBEAT);
|
Record out = new Record();
|
||||||
|
for(Map.Entry<Integer, Long> entry : SvrCacheData.SUP_HEARTBEAT.entrySet()){
|
||||||
|
out.set(String.valueOf(entry.getKey()), DateTimeUtil.sdfhms.get().format(new Date(entry.getValue())));
|
||||||
|
}
|
||||||
|
renderJson(out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,8 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
invoiceLog.setCode(code);
|
invoiceLog.setCode(code);
|
||||||
invoiceLog.setInvoiceNumber(invoice_number);
|
invoiceLog.setInvoiceNumber(invoice_number);
|
||||||
|
|
||||||
|
SyncTask synctask = new SyncTask();
|
||||||
|
|
||||||
InvoiceLog finalInvoiceLog = invoiceLog;
|
InvoiceLog finalInvoiceLog = invoiceLog;
|
||||||
boolean ret = Db.tx(new IAtom() {
|
boolean ret = Db.tx(new IAtom() {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -183,7 +185,6 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SyncTask synctask = new SyncTask();
|
|
||||||
synctask.addSaveData(finalInvoiceLog);
|
synctask.addSaveData(finalInvoiceLog);
|
||||||
|
|
||||||
receive.setSurplus(receive.getSurplus() - 1);
|
receive.setSurplus(receive.getSurplus() - 1);
|
||||||
|
|
@ -207,6 +208,11 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 普票作废理解同步到砂站
|
||||||
|
if(ret){
|
||||||
|
SyncTaskService.me.send(synctask);
|
||||||
|
}
|
||||||
|
|
||||||
return ret ? Result.success(invoiceLog) : Result.failed(false, "处理失败");
|
return ret ? Result.success(invoiceLog) : Result.failed(false, "处理失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -263,6 +269,8 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
invoiceLog.setInvalidUserName(sysuser.getName());
|
invoiceLog.setInvalidUserName(sysuser.getName());
|
||||||
invoiceLog.setState(OrderStateEnum.INVALID.getStateid());
|
invoiceLog.setState(OrderStateEnum.INVALID.getStateid());
|
||||||
|
|
||||||
|
SyncTask synctask = new SyncTask();
|
||||||
|
|
||||||
boolean ret = Db.tx(new IAtom() {
|
boolean ret = Db.tx(new IAtom() {
|
||||||
@Override
|
@Override
|
||||||
public boolean run() {
|
public boolean run() {
|
||||||
|
|
@ -276,7 +284,6 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SyncTask synctask = new SyncTask();
|
|
||||||
synctask.addUpdateData(order);
|
synctask.addUpdateData(order);
|
||||||
|
|
||||||
ret = invoiceLog.update();
|
ret = invoiceLog.update();
|
||||||
|
|
@ -287,7 +294,8 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
|
|
||||||
synctask.addUpdateData(invoiceLog);
|
synctask.addUpdateData(invoiceLog);
|
||||||
|
|
||||||
return SyncTaskService.me.save(synctask, order.getInt("supermarket_id")) && ModifyLogService.me.save(invoiceLog, old, Enums.DataOpType.UPDATE.getId(), sysuser);
|
return SyncTaskService.me.save(synctask, order.getInt("supermarket_id"))
|
||||||
|
&& ModifyLogService.me.save(invoiceLog, old, Enums.DataOpType.UPDATE.getId(), sysuser);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
@ -295,6 +303,11 @@ public class InvoiceLogSyncService extends BaseSyncService {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 普票作废理解同步到砂站
|
||||||
|
if(ret){
|
||||||
|
SyncTaskService.me.send(synctask);
|
||||||
|
}
|
||||||
|
|
||||||
return ret ? Result.success() : Result.failed("作废失败");
|
return ret ? Result.success() : Result.failed("作废失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue