diff --git a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/order/ordertemp/OrderTempService.java b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/order/ordertemp/OrderTempService.java index fb850bd..90a20dc 100644 --- a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/order/ordertemp/OrderTempService.java +++ b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/order/ordertemp/OrderTempService.java @@ -8,6 +8,8 @@ import com.cowr.common.utils.DataUtil; import com.cowr.common.utils.DateTimeUtil; import com.cowr.common.view.PageParam; import com.cowr.common.view.Result; +import com.cowr.model.InvoiceInvalidVerify; +import com.cowr.model.OrderInvalidVerify; import com.cowr.model.OrderTemp; import com.cowr.model.Sysuser; import com.jfinal.kit.StrKit; @@ -52,21 +54,49 @@ public class OrderTempService extends BaseService { * @return */ public Record get(String sn) { - return Db.findFirst("select t.*" + + Record record = Db.findFirst("select t.*" + ", p.order_sn \n" + ", 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 \n" + ", s.name supermarket_name \n" + - ", case when v.state is not null then 1 end invoice_invalid_verify_state " + // 只需要标记是 1,不需要反映 state = 2 + ", case when v.state is not null then 1 end invoice_invalid_verify_state \n" + // 只需要标记是 1,不需要反映 state = 2 ", case when ov.state is not null then 1 end order_invalid_verify_state \n" + // 只需要标记是 1,不需要反映 state = 2 " 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 invoice_invalid_verify v on v.order_sn = t.sn and ( v.state = 1 or v.state = 2 ) \n" + - " left join order_invalid_verify ov on ov.order_sn = t.sn and ( ov.state = 1 or ov.state = 2 ) \n" + - " where t.sn = ?", sn); + " left join ( \n" + + " select t.order_sn, min(t.state) state from invoice_invalid_verify t\n" + + " where t.order_sn = ? \n" + + " and ( t.state = 1 or t.state = 2 ) \n" + + " group by t.order_sn" + + " ) v on v.order_sn = t.sn \n" + + " left join ( \n" + + " select t.order_sn, min(t.state) state from order_invalid_verify t\n" + + " where t.order_sn = ? \n" + + " and ( t.state = 1 or t.state = 2 ) \n" + + " group by t.order_sn \n" + + " ) ov on ov.order_sn = t.sn\n" + + " where t.sn = ?", sn, sn, sn); + +// if (record != null) { +// InvoiceInvalidVerify verify1 = InvoiceInvalidVerify.dao.findFirst( +// "select * from invoice_invalid_verify t where t.order_sn = ? and ( t.state = 1 or t.state = 2 ) limit 1", sn); +// +// if (verify1 != null) { +// record.set("invoice_invalid_verify_state", 1); +// } +// +// OrderInvalidVerify verify2 = OrderInvalidVerify.dao.findFirst( +// "select * from invoice_invalid_verify t where t.order_sn = ? and ( t.state = 1 or t.state = 2 ) limit 1", sn); +// +// if (verify2 != null) { +// record.set("order_invalid_verify_state", 1); +// } +// } + + return record; } public Page find(PageParam pp, @@ -95,8 +125,12 @@ public class OrderTempService extends BaseService { 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 invoice_invalid_verify v on v.order_sn = t.sn and ( v.state = 1 or v.state = 2 ) \n" + - " left join order_invalid_verify ov on ov.order_sn = t.sn and ( ov.state = 1 or ov.state = 2 ) \n" + + " left join ( select t.order_sn, min(t.state) state from invoice_invalid_verify t\n" + + " where ( t.state = 1 or t.state = 2 )\n" + + " group by t.order_sn ) v on v.order_sn = t.sn and ( v.state = 1 or v.state = 2 ) \n" + + " left join ( select t.order_sn, min(t.state) state from order_invalid_verify t\n" + + " where ( t.state = 1 or t.state = 2 )\n" + + " group by t.order_sn ) ov on ov.order_sn = t.sn and ( ov.state = 1 or ov.state = 2 ) \n" + " where 1=1 "; List paraList = new ArrayList<>(); diff --git a/ssjygl-xsx-local/src/main/resources/dev/config.properties b/ssjygl-xsx-local/src/main/resources/dev/config.properties index f454aec..769618d 100644 --- a/ssjygl-xsx-local/src/main/resources/dev/config.properties +++ b/ssjygl-xsx-local/src/main/resources/dev/config.properties @@ -15,7 +15,7 @@ socketserver.port=21002 socketio.port=12002 #当前部署本地程序的砂站id -current.supermarket_id=6 +current.supermarket_id=1 #落杆后,等待上磅的时间 default_scale_wait_time=8000