dev
parent
c0dda76e57
commit
5af914837d
|
|
@ -5,11 +5,13 @@ import com.cowr.common.base.BaseService;
|
||||||
import com.cowr.common.enums.OrderStateEnum;
|
import com.cowr.common.enums.OrderStateEnum;
|
||||||
import com.cowr.common.utils.DateTimeUtil;
|
import com.cowr.common.utils.DateTimeUtil;
|
||||||
import com.cowr.common.view.PageParam;
|
import com.cowr.common.view.PageParam;
|
||||||
|
import com.cowr.model.Ordercluster;
|
||||||
import com.cowr.model.OrderclusterTruck;
|
import com.cowr.model.OrderclusterTruck;
|
||||||
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.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
@ -50,7 +52,6 @@ public class OrderclusterTruckService extends BaseService {
|
||||||
return OrderclusterTruck.dao.find("select * from ordercluster_truck");
|
return OrderclusterTruck.dao.find("select * from ordercluster_truck");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public OrderclusterTruck checkValidLicense(int supermarket_id, String truck_license) {
|
public OrderclusterTruck checkValidLicense(int supermarket_id, String truck_license) {
|
||||||
if (StrKit.isBlank(truck_license)) {
|
if (StrKit.isBlank(truck_license)) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -79,4 +80,45 @@ public class OrderclusterTruckService extends BaseService {
|
||||||
end,
|
end,
|
||||||
truck_license);
|
truck_license);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用超市id、车牌号查询当天关联的集团订单信息
|
||||||
|
* @param supermarket_id
|
||||||
|
* @param truck_license
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Ordercluster getOrdercluster(int supermarket_id, String truck_license) {
|
||||||
|
if (StrKit.isBlank(truck_license)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
c.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
c.set(Calendar.MINUTE, 0);
|
||||||
|
c.set(Calendar.SECOND, 0);
|
||||||
|
c.set(Calendar.MILLISECOND, 0);
|
||||||
|
Date start = c.getTime();
|
||||||
|
c.add(Calendar.HOUR_OF_DAY, 24);
|
||||||
|
Date end = c.getTime();
|
||||||
|
|
||||||
|
OrderclusterTruck ot = OrderclusterTruck.dao.findFirst("select * from ordercluster_truck t\n" +
|
||||||
|
" left join ordercluster c on c.id = t.ordercluster_id \n" +
|
||||||
|
" where c.supermarket_id = ? \n" +
|
||||||
|
" and c.state < ?" +
|
||||||
|
" and c.cutoff_time >= ? \n" +
|
||||||
|
" and c.cutoff_time < ? \n" +
|
||||||
|
" and t.truck_license = ? \n" +
|
||||||
|
" limit 0,1",
|
||||||
|
supermarket_id,
|
||||||
|
OrderStateEnum.RECEIVED.getStateid(), // 只有未完成的订单才有效
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
truck_license);
|
||||||
|
|
||||||
|
if (ot == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ordercluster.dao.findById(ot.getOrderclusterId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,20 +105,8 @@ public class PrepayService {
|
||||||
return Db.paginateByFullSql(pp.getPage(), pp.getSize(), totalRowSql, findSql, paraList.toArray());
|
return Db.paginateByFullSql(pp.getPage(), pp.getSize(), totalRowSql, findSql, paraList.toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Record prepayInfo(Transport transport) {
|
public Record prepayInfo(Ordercluster ordercluster, Transport transport) {
|
||||||
if (transport == null) {
|
if(ordercluster == null || transport == null) {
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
OrderclusterTruck ot = OrderclusterTruckService.me.checkValidLicense(transport.getSupermarketId(), transport.getTruckLicense());
|
|
||||||
|
|
||||||
if (ot == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ordercluster ordercluster = Ordercluster.dao.findById(ot.getOrderclusterId());
|
|
||||||
|
|
||||||
if (ordercluster == null) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -160,11 +148,6 @@ public class PrepayService {
|
||||||
out.set("prepay_surplus", prepayCustomer.getSurplus());
|
out.set("prepay_surplus", prepayCustomer.getSurplus());
|
||||||
out.set("prepay_customer", customer);
|
out.set("prepay_customer", customer);
|
||||||
out.set("prepay_customer_info", prepayCustomer);
|
out.set("prepay_customer_info", prepayCustomer);
|
||||||
out.set("prepay_ordercluster", ordercluster); // 预付费关联集团客户订单
|
|
||||||
|
|
||||||
List<Record> list = CustomerReceiverService.me.list(customer.getId(), null, null, transport.getSupermarketId());
|
|
||||||
|
|
||||||
out.set("prepay_customer_receiver", list);
|
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ public class DeviceThread extends Thread {
|
||||||
// 一个摄像头只能连一次
|
// 一个摄像头只能连一次
|
||||||
Camera camera = new Camera(which + "_camera", cameraconf.getString("ip"));
|
Camera camera = new Camera(which + "_camera", cameraconf.getString("ip"));
|
||||||
HuangZhouScale scale = new HuangZhouScale(which + "_scale", scaleconf.getString("ip"), scaleconf.getIntValue("port"));
|
HuangZhouScale scale = new HuangZhouScale(which + "_scale", scaleconf.getString("ip"), scaleconf.getIntValue("port"));
|
||||||
LED led = new LED(which + "_led", ledconf.getString("ip"), ledconf.getIntValue("port"));
|
LEDThread led = new LEDThread(which + "_led", ledconf.getString("ip"), ledconf.getIntValue("port"));
|
||||||
|
|
||||||
PLC plc = null;
|
PLC plc = null;
|
||||||
for (Map.Entry<String, PLC> entry : plcMap.entrySet()) {
|
for (Map.Entry<String, PLC> entry : plcMap.entrySet()) {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
package com.cowr.local.ssjygl.devicectrl.controllers;
|
package com.cowr.local.ssjygl.devicectrl.controllers;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.cowr.local.ssjygl.devicectrl.device.AbsScale;
|
import com.cowr.local.ssjygl.devicectrl.device.*;
|
||||||
import com.cowr.local.ssjygl.devicectrl.device.Camera;
|
|
||||||
import com.cowr.local.ssjygl.devicectrl.device.LED;
|
|
||||||
import com.cowr.local.ssjygl.devicectrl.device.PLC;
|
|
||||||
import com.cowr.local.ssjygl.devicectrl.utils.LicenseJPGPair;
|
import com.cowr.local.ssjygl.devicectrl.utils.LicenseJPGPair;
|
||||||
import com.cowr.local.ssjygl.main.CliCacheData;
|
import com.cowr.local.ssjygl.main.CliCacheData;
|
||||||
import com.cowr.local.ssjygl.transport.TransportDeviceService;
|
import com.cowr.local.ssjygl.transport.TransportDeviceService;
|
||||||
|
|
@ -33,7 +30,7 @@ public abstract class Controller implements Runnable {
|
||||||
private String which; // 入场、出场 WhichEnum,规则:R01、R02、C01、C02 以此类推, TODO: 前端、后端、设备控制 几个部分可以共用一个枚举,保障一致性
|
private String which; // 入场、出场 WhichEnum,规则:R01、R02、C01、C02 以此类推, TODO: 前端、后端、设备控制 几个部分可以共用一个枚举,保障一致性
|
||||||
private Camera camera; // 车牌识别
|
private Camera camera; // 车牌识别
|
||||||
private AbsScale scale; // 入场称重
|
private AbsScale scale; // 入场称重
|
||||||
private LED led; // 称重结果显示
|
private LEDThread led; // 称重结果显示
|
||||||
private PLC plc; // 道闸控制
|
private PLC plc; // 道闸控制
|
||||||
|
|
||||||
private String currentLicense; // 当前流程车牌
|
private String currentLicense; // 当前流程车牌
|
||||||
|
|
@ -43,7 +40,7 @@ public abstract class Controller implements Runnable {
|
||||||
|
|
||||||
private boolean running = true;
|
private boolean running = true;
|
||||||
|
|
||||||
public Controller(String which, Camera camera, AbsScale scale, LED led, PLC plc) {
|
public Controller(String which, Camera camera, AbsScale scale, LEDThread led, PLC plc) {
|
||||||
this.which = which;
|
this.which = which;
|
||||||
this.camera = camera;
|
this.camera = camera;
|
||||||
this.scale = scale;
|
this.scale = scale;
|
||||||
|
|
@ -213,11 +210,11 @@ public abstract class Controller implements Runnable {
|
||||||
this.scale = scale;
|
this.scale = scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LED getLed() {
|
public LEDThread getLed() {
|
||||||
return led;
|
return led;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLed(LED led) {
|
public void setLed(LEDThread led) {
|
||||||
this.led = led;
|
this.led = led;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -284,8 +281,8 @@ public abstract class Controller implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getLed().connect();
|
getLed().start();
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
log.error("%s %s LED连接失败", getWhich(), getLed().getId());
|
log.error("%s %s LED连接失败", getWhich(), getLed().getId());
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
package com.cowr.local.ssjygl.devicectrl.controllers;
|
package com.cowr.local.ssjygl.devicectrl.controllers;
|
||||||
|
|
||||||
import com.cowr.local.ssjygl.devicectrl.device.AbsScale;
|
import com.cowr.local.ssjygl.devicectrl.device.*;
|
||||||
import com.cowr.local.ssjygl.devicectrl.device.Camera;
|
|
||||||
import com.cowr.local.ssjygl.devicectrl.device.LED;
|
|
||||||
import com.cowr.local.ssjygl.devicectrl.device.PLC;
|
|
||||||
import com.cowr.local.ssjygl.devicectrl.utils.LicenseJPGPair;
|
import com.cowr.local.ssjygl.devicectrl.utils.LicenseJPGPair;
|
||||||
import com.cowr.local.ssjygl.main.CliCacheData;
|
import com.cowr.local.ssjygl.main.CliCacheData;
|
||||||
import com.cowr.model.PostLicenseResult;
|
import com.cowr.model.PostLicenseResult;
|
||||||
|
|
@ -14,7 +11,7 @@ import java.io.IOException;
|
||||||
public class InController extends Controller implements Runnable {
|
public class InController extends Controller implements Runnable {
|
||||||
private static Log log = Log.getLog(InController.class);
|
private static Log log = Log.getLog(InController.class);
|
||||||
|
|
||||||
public InController(String which, Camera camera, AbsScale scale, LED led, PLC plc) {
|
public InController(String which, Camera camera, AbsScale scale, LEDThread led, PLC plc) {
|
||||||
super(which, camera, scale, led, plc);
|
super(which, camera, scale, led, plc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,7 +52,7 @@ public class InController extends Controller implements Runnable {
|
||||||
// 初始化 LED 显示内容
|
// 初始化 LED 显示内容
|
||||||
log.debug("等待入场车牌识别");
|
log.debug("等待入场车牌识别");
|
||||||
try {
|
try {
|
||||||
getLed().screen(" ", "等待车辆", LEDInfoFormat);
|
getLed().setInfo(" ", "等待车辆");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
@ -103,7 +100,7 @@ public class InController extends Controller implements Runnable {
|
||||||
|
|
||||||
log.debug("%s 【%s】上磅前,控制LED显示", getWhich(), pair.license);
|
log.debug("%s 【%s】上磅前,控制LED显示", getWhich(), pair.license);
|
||||||
try {
|
try {
|
||||||
getLed().screen(pair.license, "等待上磅", LEDInfoFormat);
|
getLed().setInfo(pair.license, "等待上磅");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
@ -152,7 +149,7 @@ public class InController extends Controller implements Runnable {
|
||||||
|
|
||||||
log.debug("%s 【%s】上磅后,控制LED显示", getWhich(), pair.license);
|
log.debug("%s 【%s】上磅后,控制LED显示", getWhich(), pair.license);
|
||||||
try {
|
try {
|
||||||
getLed().screen(pair.license, "开始称重", LEDInfoFormat);
|
getLed().setInfo(pair.license, "开始称重");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
@ -210,8 +207,8 @@ public class InController extends Controller implements Runnable {
|
||||||
weightStr = String.format("%.2f", weight);
|
weightStr = String.format("%.2f", weight);
|
||||||
}
|
}
|
||||||
|
|
||||||
getLed().screen(pair.license, weightStr, LEDWeightFormat);
|
getLed().setWeightInfo(pair.license, weightStr);
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
log.debug("%s 【%s】控制LED显示称重结果失败【%s】", getWhich(), pair.license, weight);
|
log.debug("%s 【%s】控制LED显示称重结果失败【%s】", getWhich(), pair.license, weight);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
package com.cowr.local.ssjygl.devicectrl.controllers;
|
package com.cowr.local.ssjygl.devicectrl.controllers;
|
||||||
|
|
||||||
import com.cowr.local.ssjygl.devicectrl.device.AbsScale;
|
import com.cowr.local.ssjygl.devicectrl.device.*;
|
||||||
import com.cowr.local.ssjygl.devicectrl.device.Camera;
|
|
||||||
import com.cowr.local.ssjygl.devicectrl.device.LED;
|
|
||||||
import com.cowr.local.ssjygl.devicectrl.device.PLC;
|
|
||||||
import com.cowr.local.ssjygl.devicectrl.utils.LicenseJPGPair;
|
import com.cowr.local.ssjygl.devicectrl.utils.LicenseJPGPair;
|
||||||
import com.cowr.local.ssjygl.main.CliCacheData;
|
import com.cowr.local.ssjygl.main.CliCacheData;
|
||||||
import com.cowr.model.PostLicenseResult;
|
import com.cowr.model.PostLicenseResult;
|
||||||
|
|
@ -14,7 +11,7 @@ import java.io.IOException;
|
||||||
public class OutController extends Controller implements Runnable {
|
public class OutController extends Controller implements Runnable {
|
||||||
private static Log log = Log.getLog(InController.class);
|
private static Log log = Log.getLog(InController.class);
|
||||||
|
|
||||||
public OutController(String which, Camera camera, AbsScale scale, LED led, PLC plc) {
|
public OutController(String which, Camera camera, AbsScale scale, LEDThread led, PLC plc) {
|
||||||
super(which, camera, scale, led, plc);
|
super(which, camera, scale, led, plc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,7 +52,7 @@ public class OutController extends Controller implements Runnable {
|
||||||
// 初始化 LED 显示内容
|
// 初始化 LED 显示内容
|
||||||
log.debug("等待出场车牌识别");
|
log.debug("等待出场车牌识别");
|
||||||
try {
|
try {
|
||||||
getLed().screen(" ", "等待车辆", LEDInfoFormat);
|
getLed().setInfo(" ", "等待车辆");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
@ -104,7 +101,7 @@ public class OutController extends Controller implements Runnable {
|
||||||
|
|
||||||
log.debug("%s 【%s】上磅前,控制LED显示", getWhich(), pair.license);
|
log.debug("%s 【%s】上磅前,控制LED显示", getWhich(), pair.license);
|
||||||
try {
|
try {
|
||||||
getLed().screen(pair.license, "等待上磅", LEDInfoFormat);
|
getLed().setInfo(pair.license, "等待上磅");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
@ -152,7 +149,7 @@ public class OutController extends Controller implements Runnable {
|
||||||
|
|
||||||
log.debug("%s 【%s】上磅后,控制LED显示", getWhich(), pair.license);
|
log.debug("%s 【%s】上磅后,控制LED显示", getWhich(), pair.license);
|
||||||
try {
|
try {
|
||||||
getLed().screen(pair.license, "开始称重", LEDInfoFormat);
|
getLed().setInfo(pair.license, "开始称重");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
@ -210,8 +207,8 @@ public class OutController extends Controller implements Runnable {
|
||||||
weightStr = String.format("%.2f", weight);
|
weightStr = String.format("%.2f", weight);
|
||||||
}
|
}
|
||||||
|
|
||||||
getLed().screen(pair.license, weightStr, LEDWeightFormat);
|
getLed().setWeightInfo(pair.license, weightStr);
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
log.debug("%s 【%s】控制LED显示称重结果失败【%s】", getWhich(), pair.license, weight);
|
log.debug("%s 【%s】控制LED显示称重结果失败【%s】", getWhich(), pair.license, weight);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,8 @@ public class LED extends Device {
|
||||||
msgCrc[msgCrc.length - 1] = frameTail;
|
msgCrc[msgCrc.length - 1] = frameTail;
|
||||||
// System.out.println(HexDump.toHex(msgCrc));
|
// System.out.println(HexDump.toHex(msgCrc));
|
||||||
|
|
||||||
|
log.debug("LED 发送数据: %s", HexDump.toHex(msgCrc));
|
||||||
|
|
||||||
socket.getOutputStream().write(msgCrc);
|
socket.getOutputStream().write(msgCrc);
|
||||||
socket.getOutputStream().flush();
|
socket.getOutputStream().flush();
|
||||||
|
|
||||||
|
|
@ -90,8 +92,8 @@ public class LED extends Device {
|
||||||
}
|
}
|
||||||
byte[] z = new byte[read];
|
byte[] z = new byte[read];
|
||||||
System.arraycopy(y, 0, z, 0, read);
|
System.arraycopy(y, 0, z, 0, read);
|
||||||
System.out.println(HexDump.toHex(z));
|
log.debug("LED 返回数据: %s", HexDump.toHex(z));
|
||||||
socket.close();
|
// socket.close();
|
||||||
} finally {
|
} finally {
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public class LEDThread extends Device implements Runnable {
|
||||||
private String license = "";
|
private String license = "";
|
||||||
private String text = "系统启动";
|
private String text = "系统启动";
|
||||||
private String format = LEDInfoFormat;
|
private String format = LEDInfoFormat;
|
||||||
|
private Thread thread;
|
||||||
private boolean running = true;
|
private boolean running = true;
|
||||||
|
|
||||||
public void setRunning(boolean running) {
|
public void setRunning(boolean running) {
|
||||||
|
|
@ -56,12 +56,18 @@ public class LEDThread extends Device implements Runnable {
|
||||||
|
|
||||||
public LEDThread(String id, String ip, int port) {
|
public LEDThread(String id, String ip, int port) {
|
||||||
super(id, ip, port);
|
super(id, ip, port);
|
||||||
|
|
||||||
|
this.thread = new Thread(this);
|
||||||
|
this.thread.setDaemon(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start(){
|
||||||
|
this.thread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
DateFormat df = new SimpleDateFormat("mm:ss");
|
DateFormat df = new SimpleDateFormat("mm.ss");
|
||||||
|
|
||||||
|
|
||||||
while (this.running){
|
while (this.running){
|
||||||
try {
|
try {
|
||||||
|
|
@ -116,11 +122,11 @@ public class LEDThread extends Device implements Runnable {
|
||||||
|
|
||||||
byte[] msgCrc = new byte[msg.length + 3];
|
byte[] msgCrc = new byte[msg.length + 3];
|
||||||
System.arraycopy(msg, 0, msgCrc, 0, msg.length);
|
System.arraycopy(msg, 0, msgCrc, 0, msg.length);
|
||||||
// System.out.println(HexDump.toHex(msgCrc));
|
|
||||||
msgCrc[msgCrc.length - 2] = (byte) (crc >> 8);
|
msgCrc[msgCrc.length - 2] = (byte) (crc >> 8);
|
||||||
msgCrc[msgCrc.length - 3] = (byte) crc;
|
msgCrc[msgCrc.length - 3] = (byte) crc;
|
||||||
msgCrc[msgCrc.length - 1] = frameTail;
|
msgCrc[msgCrc.length - 1] = frameTail;
|
||||||
// System.out.println(HexDump.toHex(msgCrc));
|
|
||||||
|
System.out.println("LED 发送数据:" + HexDump.toHex(msgCrc));
|
||||||
|
|
||||||
socket.getOutputStream().write(msgCrc);
|
socket.getOutputStream().write(msgCrc);
|
||||||
socket.getOutputStream().flush();
|
socket.getOutputStream().flush();
|
||||||
|
|
@ -129,16 +135,15 @@ public class LEDThread extends Device implements Runnable {
|
||||||
byte[] buf = new byte[in.available()];
|
byte[] buf = new byte[in.available()];
|
||||||
in.read(buf);
|
in.read(buf);
|
||||||
// LED 返回
|
// LED 返回
|
||||||
// BufferedInputStream bis = new BufferedInputStream(socket.getInputStream());
|
BufferedInputStream bis = new BufferedInputStream(socket.getInputStream());
|
||||||
// byte[] y = new byte[128];
|
byte[] y = new byte[128];
|
||||||
// int read = bis.read(y);
|
int read = bis.read(y);
|
||||||
// while (!(read > 0)) {
|
while (!(read > 0)) {
|
||||||
// read = bis.read(y);
|
read = bis.read(y);
|
||||||
// }
|
}
|
||||||
// byte[] z = new byte[read];
|
byte[] z = new byte[read];
|
||||||
// System.arraycopy(y, 0, z, 0, read);
|
System.arraycopy(y, 0, z, 0, read);
|
||||||
// System.out.println("LED 返回:");
|
System.out.println("LED 返回数据:" + HexDump.toHex(z));
|
||||||
// System.out.println(HexDump.toHex(z));
|
|
||||||
// socket.close();
|
// socket.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
|
@ -247,6 +252,8 @@ public class LEDThread extends Device implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
running = false;
|
running = false;
|
||||||
|
|
||||||
|
this.thread.interrupt();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
@ -280,7 +287,7 @@ public class LEDThread extends Device implements Runnable {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
LEDThread led = new LEDThread("", "192.168.30.201", 5005);
|
LEDThread led = new LEDThread("", "192.168.30.205", 5005);
|
||||||
Thread thread = new Thread(led);
|
Thread thread = new Thread(led);
|
||||||
thread.setDaemon(true);
|
thread.setDaemon(true);
|
||||||
thread.start();
|
thread.start();
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
|
||||||
import com.jfinal.plugin.activerecord.SqlReporter;
|
import com.jfinal.plugin.activerecord.SqlReporter;
|
||||||
import com.jfinal.plugin.activerecord.dialect.MysqlDialect;
|
import com.jfinal.plugin.activerecord.dialect.MysqlDialect;
|
||||||
import com.jfinal.plugin.druid.DruidPlugin;
|
import com.jfinal.plugin.druid.DruidPlugin;
|
||||||
|
import com.jfinal.plugin.druid.DruidStatViewHandler;
|
||||||
import com.jfinal.plugin.redis.RedisPlugin;
|
import com.jfinal.plugin.redis.RedisPlugin;
|
||||||
import com.jfinal.template.Engine;
|
import com.jfinal.template.Engine;
|
||||||
import com.cowr.common.Interceptor.ReporterInterceptor;
|
import com.cowr.common.Interceptor.ReporterInterceptor;
|
||||||
|
|
@ -270,6 +271,9 @@ public class Config extends JFinalConfig {
|
||||||
// 让 druid 允许在 sql 中使用 union
|
// 让 druid 允许在 sql 中使用 union
|
||||||
// https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE-wallfilter
|
// https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE-wallfilter
|
||||||
wallFilter.getConfig().setSelectUnionCheck(false);
|
wallFilter.getConfig().setSelectUnionCheck(false);
|
||||||
|
if("dev".equals(ENV)){
|
||||||
|
me.add(new DruidStatViewHandler("/druid"));
|
||||||
|
}
|
||||||
me.add(new GlobalHandler());
|
me.add(new GlobalHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.cowr.common.utils.ImageUtil;
|
||||||
import com.cowr.common.view.Result;
|
import com.cowr.common.view.Result;
|
||||||
import com.cowr.local.ssjygl.main.Config;
|
import com.cowr.local.ssjygl.main.Config;
|
||||||
import com.cowr.local.ssjygl.order.OrderService;
|
import com.cowr.local.ssjygl.order.OrderService;
|
||||||
|
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.*;
|
||||||
import com.cowr.ssjygl.order.ordersale.OrderSaleService;
|
import com.cowr.ssjygl.order.ordersale.OrderSaleService;
|
||||||
|
|
@ -41,9 +42,21 @@ public class TransportQueryService {
|
||||||
return Result.failed("重量数据不完整");
|
return Result.failed("重量数据不完整");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OrderclusterTruck ot = OrderclusterTruckService.me.checkValidLicense(transport.getSupermarketId(), transport.getTruckLicense());
|
||||||
|
|
||||||
|
if (ot == null) {
|
||||||
|
return Result.failed("未找到车辆分配信息");
|
||||||
|
}
|
||||||
|
|
||||||
|
Ordercluster ordercluster = Ordercluster.dao.findById(ot.getOrderclusterId());
|
||||||
|
|
||||||
|
if (ordercluster == null) {
|
||||||
|
return Result.failed("未找到配额分配信息");
|
||||||
|
}
|
||||||
|
|
||||||
BigDecimal net_weight = transport.getSecondWeight().subtract(transport.getFirstWeight()).abs();
|
BigDecimal net_weight = transport.getSecondWeight().subtract(transport.getFirstWeight()).abs();
|
||||||
Record transobj = transport.toRecord();
|
Record transobj = transport.toRecord();
|
||||||
Record prepayinfo = PrepayService.me.prepayInfo(transport);
|
Record prepayinfo = PrepayService.me.prepayInfo(ordercluster, transport);
|
||||||
|
|
||||||
if (prepayinfo != null) {
|
if (prepayinfo != null) {
|
||||||
transobj.setColumns(prepayinfo);
|
transobj.setColumns(prepayinfo);
|
||||||
|
|
@ -51,6 +64,7 @@ public class TransportQueryService {
|
||||||
transobj.set("prepay_truck", false);
|
transobj.set("prepay_truck", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
transobj.set("ordercluster", ordercluster);
|
||||||
transobj.set("weight", net_weight);
|
transobj.set("weight", net_weight);
|
||||||
transobj.set("net_weight", net_weight);
|
transobj.set("net_weight", net_weight);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
|
||||||
import com.jfinal.plugin.activerecord.SqlReporter;
|
import com.jfinal.plugin.activerecord.SqlReporter;
|
||||||
import com.jfinal.plugin.activerecord.dialect.MysqlDialect;
|
import com.jfinal.plugin.activerecord.dialect.MysqlDialect;
|
||||||
import com.jfinal.plugin.druid.DruidPlugin;
|
import com.jfinal.plugin.druid.DruidPlugin;
|
||||||
|
import com.jfinal.plugin.druid.DruidStatViewHandler;
|
||||||
import com.jfinal.plugin.redis.RedisPlugin;
|
import com.jfinal.plugin.redis.RedisPlugin;
|
||||||
import com.jfinal.template.Engine;
|
import com.jfinal.template.Engine;
|
||||||
import com.cowr.common.Interceptor.ReporterInterceptor;
|
import com.cowr.common.Interceptor.ReporterInterceptor;
|
||||||
|
|
@ -237,6 +238,9 @@ public class Config extends JFinalConfig {
|
||||||
// 让 druid 允许在 sql 中使用 union
|
// 让 druid 允许在 sql 中使用 union
|
||||||
// https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE-wallfilter
|
// https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE-wallfilter
|
||||||
wallFilter.getConfig().setSelectUnionCheck(false);
|
wallFilter.getConfig().setSelectUnionCheck(false);
|
||||||
|
if("dev".equals(ENV)){
|
||||||
|
me.add(new DruidStatViewHandler("/druid"));
|
||||||
|
}
|
||||||
me.add(new GlobalHandler());
|
me.add(new GlobalHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue