代码提交
parent
e86cf024c6
commit
e35adc1da2
|
|
@ -106,10 +106,12 @@ public class OrderTempService extends BaseService {
|
|||
", p.in_time, p.out_time, p.in_which, p.out_which, p.in_mode, p.out_mode \n" +
|
||||
", p.first_weight, p.second_weight, p.first_weigh_mode, p.second_weight_mode \n" +
|
||||
", p.first_pic, p.first_weight_which, p.second_weight_which, p.second_pic \n" +
|
||||
", p.arrive_time, p.type, p.memo transport_memo, s.name supermarket_name \n";
|
||||
", p.arrive_time, p.type, p.memo transport_memo, s.name supermarket_name \n" +
|
||||
", ot.sn in_sn, ot.trans_price in_trans_price, ot.weight in_weight \n";
|
||||
String fromsql = "from order_temp t \n" +
|
||||
" left join transport p on p.order_sn = t.sn \n" +
|
||||
" left join supermarket s on s.id = t.supermarket_id \n" +
|
||||
" left join order_transfer ot on ot.old_sn = t.sn \n" +
|
||||
" where 1=1 ";
|
||||
|
||||
List<Object> paraList = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -561,7 +561,8 @@ public class OrderStatService {
|
|||
" group by t.id, t.product_id\n" +
|
||||
" ) a on a.id = t.supermarket_id and a.product_id = t.product_id\n" +
|
||||
" left join supermarket s on s.id = t.supermarket_id\n" +
|
||||
" left join product p on p.id = t.product_id AND p.del = 0";
|
||||
" left join product p on p.id = t.product_id AND p.del = 0" +
|
||||
" where s.type = 0";
|
||||
|
||||
List<Record> dblist = Db.find(sql, params.toArray());
|
||||
|
||||
|
|
@ -603,40 +604,56 @@ public class OrderStatService {
|
|||
|
||||
|
||||
// 查询取土场站订单信息
|
||||
List<Record> sale_list = Db.find("SELECT \n" +
|
||||
" g.sandfarm_id," +
|
||||
" s.name sandfarm_name,\n" +
|
||||
" ifnull( sum( CASE WHEN g.supermarket_id = 1 THEN g.count END ), 0 ) xsl_1,\n" +
|
||||
" ifnull( sum( CASE WHEN g.supermarket_id = 1 THEN g.weight END ), 0 ) xse_1,\n" +
|
||||
" ifnull( sum( CASE WHEN g.supermarket_id = 1 THEN g.source_weight END ), 0 ) xss_1,\n" +
|
||||
" ifnull( sum( g.weight), 0 ) weight\n" +
|
||||
" FROM supermarket s " +
|
||||
" LEFT JOIN (\n" +
|
||||
"SELECT\n" +
|
||||
" t.supermarket_id,\n" +
|
||||
" so.NAME out_name,\n" +
|
||||
" t.sandfarm_id,\n" +
|
||||
" si.NAME in_name,\n" +
|
||||
" count( t.sn ) count,\n" +
|
||||
" sum( t.weight ) weight,\n" +
|
||||
" sum( t.source_weight ) source_weight \n" +
|
||||
List<Record> sale_list = Db.find("SELECT\n" +
|
||||
" s.id AS sandfarm_id,\n" +
|
||||
" s.NAME AS sandfarm_name,\n" +
|
||||
" IFNULL( SUM( CASE WHEN t.supermarket_id = 1 THEN t.count END ), 0 ) AS xsl_1,\n" +
|
||||
" IFNULL( SUM( CASE WHEN t.supermarket_id = 1 THEN t.source_weight END ), 0 ) AS xse_1,\n" +
|
||||
" IFNULL( SUM( CASE WHEN t.supermarket_id = 1 THEN t.weight END ), 0 ) AS xss_1,\n" +
|
||||
" IFNULL( SUM( t.weight ), 0 ) AS weight \n" +
|
||||
"FROM\n" +
|
||||
" order_transfer t\n" +
|
||||
" LEFT JOIN supermarket so ON t.sandfarm_id = so.id \n" +
|
||||
" AND so.del = 0\n" +
|
||||
" LEFT JOIN supermarket si ON t.supermarket_id = si.id \n" +
|
||||
" AND si.del = 0 \n" +
|
||||
" supermarket s\n" +
|
||||
" LEFT JOIN (\n" +
|
||||
" SELECT\n" +
|
||||
" t.supermarket_id sandfarm_id,\n" +
|
||||
" t.customer_id supermarket_id,\n" +
|
||||
" COUNT( t.sn ) AS count,\n" +
|
||||
" SUM( t.weight ) AS source_weight,\n" +
|
||||
" 0 weight \n" +
|
||||
" FROM\n" +
|
||||
" supermarket s\n" +
|
||||
" LEFT JOIN order_temp t ON t.supermarket_id = s.id \n" +
|
||||
" WHERE\n" +
|
||||
" s.del = 0 \n" +
|
||||
" AND t.state = 5 \n" +
|
||||
" AND s.type = 1 \n" +
|
||||
" AND t.create_time >= ? \n" +
|
||||
" AND t.create_time <= ? \n" +
|
||||
" GROUP BY\n" +
|
||||
" t.supermarket_id,\n" +
|
||||
" t.customer_id UNION\n" +
|
||||
" SELECT\n" +
|
||||
" t.sandfarm_id,\n" +
|
||||
" t.supermarket_id,\n" +
|
||||
" COUNT( t.sn ) AS count,\n" +
|
||||
" 0 source_weight,\n" +
|
||||
" SUM( t.weight ) AS weight \n" +
|
||||
" FROM\n" +
|
||||
" order_transfer t \n" +
|
||||
" WHERE\n" +
|
||||
" t.state = 5 \n" +
|
||||
" AND t.create_time >= ? \n" +
|
||||
" AND t.create_time <= ? \n" +
|
||||
" GROUP BY\n" +
|
||||
" t.sandfarm_id,\n" +
|
||||
" t.supermarket_id \n" +
|
||||
" ) t ON s.id = t.sandfarm_id \n" +
|
||||
"WHERE\n" +
|
||||
" t.state = 5 " +
|
||||
" AND t.create_time >= ? \n" +
|
||||
" AND t.create_time <= ? \n" +
|
||||
" s.type = 1 \n" +
|
||||
"GROUP BY\n" +
|
||||
" sandfarm_id,\n" +
|
||||
" supermarket_id\n" +
|
||||
") g ON s.id = g.sandfarm_id " +
|
||||
" where s.type = 1" +
|
||||
" GROUP BY g.sandfarm_id" +
|
||||
" ORDER BY g.sandfarm_id", stm,etm);
|
||||
" s.id \n" +
|
||||
"ORDER BY\n" +
|
||||
" s.id;", stm,etm, stm,etm);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.cowr.common.oss.OSSKit;
|
|||
import com.cowr.common.utils.DateTimeUtil;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.ProductPriceModify;
|
||||
import com.cowr.model.SupermarketProduct;
|
||||
import com.cowr.model.SupermarketProductLog;
|
||||
import com.cowr.model.Sysuser;
|
||||
import com.cowr.service.ssjygl.base.BaseSyncService;
|
||||
|
|
@ -17,6 +18,7 @@ import com.jfinal.plugin.activerecord.Record;
|
|||
import com.jfinal.upload.UploadFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -50,16 +52,26 @@ public class SupermarketProductLogSyncService extends BaseSyncService {
|
|||
// 判断是否审核通过
|
||||
if (1 == model.getState()) {
|
||||
ProductPriceModify mod = new ProductPriceModify();
|
||||
mod.setProductId(byPk.getProductId());
|
||||
mod.setSupermarketId(byPk.getSupermarketId());
|
||||
Integer product_id = byPk.getProductId();
|
||||
mod.setProductId(product_id);
|
||||
Integer supermarket_id = byPk.getSupermarketId();
|
||||
mod.setSupermarketId(supermarket_id);
|
||||
mod.setType(1);
|
||||
mod.setUnitPrice(byPk.getUnitPrice());
|
||||
|
||||
SupermarketSyncService.me.addProduct(mod.getSupermarketId(), mod.getProductId(), mod.getUnitPrice().doubleValue(), sysuser);
|
||||
BigDecimal unit_price = byPk.getUnitPrice();
|
||||
mod.setUnitPrice(unit_price);
|
||||
|
||||
// 修改价格
|
||||
Result save = ProductPriceModifySyncService.me.save(mod, sysuser);
|
||||
String id = ((ProductPriceModify) save.getData()).getId();
|
||||
|
||||
// 砂站单价修改
|
||||
if (mod.getType() == 1) {
|
||||
SupermarketProduct sp = SupermarketProduct.dao.findByIds(supermarket_id, product_id);
|
||||
if (sp == null) {
|
||||
SupermarketSyncService.me.addProduct(supermarket_id, product_id, unit_price.doubleValue(), sysuser);
|
||||
}
|
||||
SupermarketSyncService.me.editUnitPrice(supermarket_id, product_id, unit_price.doubleValue(), sysuser);
|
||||
}
|
||||
ProductPriceModifySyncService.me.verify(id, 2, "通过", sysuser);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue