lisai17@sina.com 2020-10-12 14:51:50 +08:00
parent ac3585d0c9
commit 9cfdbf85cf
4 changed files with 37 additions and 9 deletions

View File

@ -48,6 +48,12 @@ public class InvoiceReceiveService extends BaseService {
return receive;
}
/**
*
* @param supermarket_id
* @param invoice_number
* @return
*/
public InvoiceReceive foremostReceive(int supermarket_id, String invoice_number) {
String sql = "select * from invoice_receive t\n" +
" where t.supermarket_id = ? \n" +

View File

@ -259,6 +259,11 @@ public class OrderTempSyncService {
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()); // 销售的用第二次减第一次
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));
}
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());
if (up == null) {

View File

@ -1,5 +1,6 @@
package com.cowr.service.ssjygl.cache;
import com.cowr.common.utils.DateTimeUtil;
import com.cowr.common.view.Result;
import com.cowr.service.ssjygl.main.AuthInterceptor;
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.jfinal.aop.Clear;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Record;
import java.util.Date;
import java.util.Map;
@Clear(AuthInterceptor.class)
public class CacheController extends Controller {
@ -26,6 +31,10 @@ public class CacheController extends Controller {
}
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);
}
}

View File

@ -172,6 +172,8 @@ public class InvoiceLogSyncService extends BaseSyncService {
invoiceLog.setCode(code);
invoiceLog.setInvoiceNumber(invoice_number);
SyncTask synctask = new SyncTask();
InvoiceLog finalInvoiceLog = invoiceLog;
boolean ret = Db.tx(new IAtom() {
@Override
@ -183,7 +185,6 @@ public class InvoiceLogSyncService extends BaseSyncService {
return false;
}
SyncTask synctask = new SyncTask();
synctask.addSaveData(finalInvoiceLog);
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, "处理失败");
}
@ -263,6 +269,8 @@ public class InvoiceLogSyncService extends BaseSyncService {
invoiceLog.setInvalidUserName(sysuser.getName());
invoiceLog.setState(OrderStateEnum.INVALID.getStateid());
SyncTask synctask = new SyncTask();
boolean ret = Db.tx(new IAtom() {
@Override
public boolean run() {
@ -276,7 +284,6 @@ public class InvoiceLogSyncService extends BaseSyncService {
return false;
}
SyncTask synctask = new SyncTask();
synctask.addUpdateData(order);
ret = invoiceLog.update();
@ -287,7 +294,8 @@ public class InvoiceLogSyncService extends BaseSyncService {
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) {
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("作废失败");
}