dev
commit
5831345404
|
|
@ -0,0 +1,14 @@
|
|||
package com.cowr.model;
|
||||
|
||||
import com.cowr.model.base.BaseOrderInvalidVerify;
|
||||
|
||||
/**
|
||||
* Generated by COWR Fri Oct 23 17:41:42 CST 2020
|
||||
* TableName: order_invalid_verify
|
||||
* Remarks: 订单相关 - 订单作废申请
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class OrderInvalidVerify extends BaseOrderInvalidVerify<OrderInvalidVerify> {
|
||||
public static final OrderInvalidVerify dao = new OrderInvalidVerify().dao();
|
||||
}
|
||||
|
|
@ -70,6 +70,7 @@ public class _MappingKit {
|
|||
arp.addMapping("order_trash", "sn", OrderTrash.class);
|
||||
arp.addMapping("stock_modify_log", "id", StockModifyLog.class);
|
||||
arp.addMapping("ordercluster_truck", "id", OrderclusterTruck.class);
|
||||
arp.addMapping("order_invalid_verify", "id", OrderInvalidVerify.class);
|
||||
arp.addMapping("ordercluster", "id", Ordercluster.class);
|
||||
arp.addMapping("order_transfer", "sn", OrderTransfer.class);
|
||||
arp.addMapping("order_sale", "sn", OrderSale.class);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,316 @@
|
|||
package com.cowr.model.base;
|
||||
|
||||
import com.cowr.common.base.BaseModel;
|
||||
import com.jfinal.plugin.activerecord.IBean;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Generated by COWR Fri Oct 23 17:41:42 CST 2020
|
||||
* TableName: order_invalid_verify
|
||||
* Remarks: 订单相关 - 订单作废申请
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public abstract class BaseOrderInvalidVerify<M extends BaseOrderInvalidVerify<M>> extends BaseModel<M> implements IBean {
|
||||
|
||||
public static final String tablename = "order_invalid_verify";
|
||||
|
||||
@JSONField(serialize=false)
|
||||
public String getTablename(){
|
||||
return tablename;
|
||||
}
|
||||
|
||||
/**
|
||||
* name: id
|
||||
* type: CHAR(32)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: YES
|
||||
* defaultValue:
|
||||
* @param id uuid
|
||||
*/
|
||||
@JSONField(name="id")
|
||||
public void setId(String id) {
|
||||
set("id", id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return id uuid
|
||||
*/
|
||||
@JSONField(name="id")
|
||||
public String getId() {
|
||||
return getStr("id");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: create_time
|
||||
* type: DATETIME(19)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param createTime 创建时间
|
||||
*/
|
||||
@JSONField(name="create_time")
|
||||
public void setCreateTime(java.util.Date createTime) {
|
||||
set("create_time", createTime);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return create_time 创建时间
|
||||
*/
|
||||
@JSONField(name="create_time")
|
||||
public java.util.Date getCreateTime() {
|
||||
return get("create_time");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: change_time
|
||||
* type: TIMESTAMP(19)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue: CURRENT_TIMESTAMP
|
||||
* @param changeTime 最后修改时间
|
||||
*/
|
||||
@JSONField(name="change_time")
|
||||
public void setChangeTime(java.util.Date changeTime) {
|
||||
set("change_time", changeTime);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return change_time 最后修改时间
|
||||
*/
|
||||
@JSONField(name="change_time")
|
||||
public java.util.Date getChangeTime() {
|
||||
return get("change_time");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: state
|
||||
* type: INT(10)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue: 1
|
||||
* @param state 付费状态。
|
||||
1.提交、待审核
|
||||
2.审核通过,计入余额
|
||||
9.作废
|
||||
*/
|
||||
@JSONField(name="state")
|
||||
public void setState(Integer state) {
|
||||
set("state", state);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return state 付费状态。
|
||||
1.提交、待审核
|
||||
2.审核通过,计入余额
|
||||
9.作废
|
||||
*/
|
||||
@JSONField(name="state")
|
||||
public Integer getState() {
|
||||
return getInt("state");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: create_user_id
|
||||
* type: INT(10)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param createUserId 创建用户id
|
||||
*/
|
||||
@JSONField(name="create_user_id")
|
||||
public void setCreateUserId(Integer createUserId) {
|
||||
set("create_user_id", createUserId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return create_user_id 创建用户id
|
||||
*/
|
||||
@JSONField(name="create_user_id")
|
||||
public Integer getCreateUserId() {
|
||||
return getInt("create_user_id");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: create_user_name
|
||||
* type: VARCHAR(255)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param createUserName 创建用户姓名
|
||||
*/
|
||||
@JSONField(name="create_user_name")
|
||||
public void setCreateUserName(String createUserName) {
|
||||
set("create_user_name", createUserName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return create_user_name 创建用户姓名
|
||||
*/
|
||||
@JSONField(name="create_user_name")
|
||||
public String getCreateUserName() {
|
||||
return getStr("create_user_name");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: verify_user_id
|
||||
* type: INT(10)
|
||||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param verifyUserId 审核用户id
|
||||
*/
|
||||
@JSONField(name="verify_user_id")
|
||||
public void setVerifyUserId(Integer verifyUserId) {
|
||||
set("verify_user_id", verifyUserId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return verify_user_id 审核用户id
|
||||
*/
|
||||
@JSONField(name="verify_user_id")
|
||||
public Integer getVerifyUserId() {
|
||||
return getInt("verify_user_id");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: verify_user_name
|
||||
* type: VARCHAR(255)
|
||||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param verifyUserName 审核用户姓名
|
||||
*/
|
||||
@JSONField(name="verify_user_name")
|
||||
public void setVerifyUserName(String verifyUserName) {
|
||||
set("verify_user_name", verifyUserName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return verify_user_name 审核用户姓名
|
||||
*/
|
||||
@JSONField(name="verify_user_name")
|
||||
public String getVerifyUserName() {
|
||||
return getStr("verify_user_name");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: order_sn
|
||||
* type: CHAR(16)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param orderSn 关联订单号
|
||||
*/
|
||||
@JSONField(name="order_sn")
|
||||
public void setOrderSn(String orderSn) {
|
||||
set("order_sn", orderSn);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return order_sn 关联订单号
|
||||
*/
|
||||
@JSONField(name="order_sn")
|
||||
public String getOrderSn() {
|
||||
return getStr("order_sn");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: type
|
||||
* type: SMALLINT(5)
|
||||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param type 1、2、3、4、5
|
||||
*/
|
||||
@JSONField(name="type")
|
||||
public void setType(Integer type) {
|
||||
set("type", type);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return type 1、2、3、4、5
|
||||
*/
|
||||
@JSONField(name="type")
|
||||
public Integer getType() {
|
||||
return getInt("type");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: supermarket_id
|
||||
* type: INT(10)
|
||||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param supermarketId 超市id
|
||||
*/
|
||||
@JSONField(name="supermarket_id")
|
||||
public void setSupermarketId(Integer supermarketId) {
|
||||
set("supermarket_id", supermarketId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return supermarket_id 超市id
|
||||
*/
|
||||
@JSONField(name="supermarket_id")
|
||||
public Integer getSupermarketId() {
|
||||
return getInt("supermarket_id");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: invalid_memo
|
||||
* type: VARCHAR(255)
|
||||
* isNullable: NO
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param invalidMemo 作废申请说明
|
||||
*/
|
||||
@JSONField(name="invalid_memo")
|
||||
public void setInvalidMemo(String invalidMemo) {
|
||||
set("invalid_memo", invalidMemo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return invalid_memo 作废申请说明
|
||||
*/
|
||||
@JSONField(name="invalid_memo")
|
||||
public String getInvalidMemo() {
|
||||
return getStr("invalid_memo");
|
||||
}
|
||||
|
||||
/**
|
||||
* name: memo
|
||||
* type: VARCHAR(255)
|
||||
* isNullable: YES
|
||||
* isPrimaryKey: NO
|
||||
* defaultValue:
|
||||
* @param memo 审核说明
|
||||
*/
|
||||
@JSONField(name="memo")
|
||||
public void setMemo(String memo) {
|
||||
set("memo", memo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return memo 审核说明
|
||||
*/
|
||||
@JSONField(name="memo")
|
||||
public String getMemo() {
|
||||
return getStr("memo");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -95,6 +95,7 @@ public class ActionCmdLogService {
|
|||
String which = obj.getString("which");
|
||||
record.set("content", "抬" + Enums.WhichEnum.getLabel(which) + (obj.getInteger("num") == 1 ? "前" : "后") + "闸");
|
||||
record.set("status", obj.getBoolean("rod") ? "成功" : "失败");
|
||||
record.set("memo", obj.get("memo"));
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,8 +85,7 @@ public class CustomerSupermarketProductService extends BaseService {
|
|||
|
||||
String selectsql = " select a.customer_id, c.name customer_name ";
|
||||
String fromsql = " from (\n" +
|
||||
" select t.t.customer_id \n" +
|
||||
" from customer_supermarket_product t\n" +
|
||||
" select t.customer_id from customer_supermarket_product t\n" +
|
||||
" group by t.customer_id\n" +
|
||||
" ) a\n" +
|
||||
" left join customer c on c.id = a.customer_id \n" +
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class InvoiceReceiveService extends BaseService {
|
|||
* @param invoice_code
|
||||
* @return
|
||||
*/
|
||||
public InvoiceReceive checkReceive(int supermarket_id, String invoice_number, String invoice_code) {
|
||||
public InvoiceReceive checkSurplusReceive(int supermarket_id, String invoice_number, String invoice_code) {
|
||||
if (!StrKit.notBlank(invoice_number, invoice_code)) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -54,6 +54,30 @@ public class InvoiceReceiveService extends BaseService {
|
|||
return receive;
|
||||
}
|
||||
|
||||
/**
|
||||
* 有领用记录,可以是已经被使用完的
|
||||
* @param supermarket_id
|
||||
* @param invoice_number
|
||||
* @param invoice_code
|
||||
* @return
|
||||
*/
|
||||
public InvoiceReceive checkReceive(int supermarket_id, String invoice_number, String invoice_code) {
|
||||
if (!StrKit.notBlank(invoice_number, invoice_code)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Integer code = Integer.parseInt(invoice_code);
|
||||
String sql = "select * from invoice_receive t\n" +
|
||||
" where t.supermarket_id = ? \n" +
|
||||
" and t.invoice_number = ? \n" +
|
||||
" and cast(t.start_code as unsigned integer) <= ? \n" +
|
||||
" and cast(t.end_code as unsigned integer) >= ? \n" +
|
||||
" limit 1";
|
||||
|
||||
InvoiceReceive receive = InvoiceReceive.dao.findFirst(sql, supermarket_id, invoice_number, code, code);
|
||||
|
||||
return receive;
|
||||
}
|
||||
|
||||
public String nextInvoiceCode(InvoiceReceive receive) {
|
||||
if (receive == null) { // 前面判断过了,应该不会再这里出现 null
|
||||
|
|
|
|||
|
|
@ -207,6 +207,8 @@ public class ModifyLogService {
|
|||
sqlparams.add("?");
|
||||
params.add(obj.get("id"));
|
||||
}
|
||||
|
||||
record.set("memo", obj.get("memo"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.cowr.ssjygl.order.invalidverify;
|
||||
|
||||
|
||||
import com.cowr.common.validator.CrudParamValidator;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.OrderInvalidVerify;
|
||||
import com.jfinal.core.Controller;
|
||||
|
||||
/**
|
||||
* Generated by COWR Fri Oct 23 17:41:51 CST 2020
|
||||
* TableName: order_invalid_verify
|
||||
* Remarks: 订单相关 - 订单作废申请
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class OrderInvalidVerifyPKValidator extends CrudParamValidator {
|
||||
@Override
|
||||
protected void validate(Controller c) {
|
||||
validateRequired("id", "id", "id 必填");
|
||||
validateString("id", 1, 32, "id", "id 长度 1~32");
|
||||
}
|
||||
|
||||
protected void handleError(Controller c) {
|
||||
c.renderJson(Result.failed(getErrmsg()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
package com.cowr.ssjygl.order.invalidverify;
|
||||
|
||||
import com.cowr.common.Const;
|
||||
import com.cowr.common.base.BaseService;
|
||||
import com.cowr.common.view.PageParam;
|
||||
import com.cowr.model.OrderInvalidVerify;
|
||||
import com.jfinal.kit.StrKit;
|
||||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.activerecord.Page;
|
||||
import com.jfinal.plugin.activerecord.Record;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Generated by COWR Fri Oct 23 17:41:51 CST 2020
|
||||
* TableName: order_invalid_verify
|
||||
* Remarks: 订单相关 - 订单作废申请
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class OrderInvalidVerifyService extends BaseService {
|
||||
public static final OrderInvalidVerifyService me = new OrderInvalidVerifyService();
|
||||
|
||||
public Page<Record> find(
|
||||
PageParam pp,
|
||||
String stm,
|
||||
String etm,
|
||||
Integer state,
|
||||
String create_user_name,
|
||||
Integer supermarket_id,
|
||||
String order_sn
|
||||
) {
|
||||
String selectsql = "select t.*, s.name supermarket_name ";
|
||||
String fromsql = "from order_invalid_verify t \n" +
|
||||
" left join supermarket s on s.id = t.supermarket_id \n" +
|
||||
" where 1=1 ";
|
||||
List<Object> paraList = new ArrayList<>();
|
||||
|
||||
if (StrKit.notBlank(stm)) {
|
||||
fromsql += " and t.create_time >= ? \n";
|
||||
paraList.add(stm);
|
||||
}
|
||||
|
||||
if (StrKit.notBlank(etm)) {
|
||||
fromsql += " and t.create_time <= ? \n";
|
||||
paraList.add(etm);
|
||||
}
|
||||
|
||||
if (StrKit.notBlank(order_sn)) {
|
||||
fromsql += " and t.order_sn like ? \n";
|
||||
paraList.add("%" + order_sn.trim() + "%");
|
||||
}
|
||||
|
||||
if (StrKit.notBlank(create_user_name)) {
|
||||
fromsql += " and t.create_user_name like ? \n";
|
||||
paraList.add("%" + create_user_name.trim() + "%");
|
||||
}
|
||||
|
||||
if (supermarket_id != null) {
|
||||
fromsql += " and t.supermarket_id = ? \n";
|
||||
paraList.add(supermarket_id);
|
||||
}
|
||||
|
||||
if (state != null) {
|
||||
fromsql += " and t.state = ? \n";
|
||||
paraList.add(state);
|
||||
}
|
||||
|
||||
String totalRowSql = "select count(*) " + fromsql;
|
||||
String findSql = selectsql + fromsql;
|
||||
|
||||
// 前端传了排序字段,并且排序字段存在相关表中
|
||||
if (StrKit.notBlank(pp.getSort_field()) && OrderInvalidVerify.dao.hasColunm(pp.getSort_field())) {
|
||||
findSql += " order by t." + pp.getSort_field() + " is null, t." + pp.getSort_field();
|
||||
|
||||
if (Const.ORDER_BY_ASC.equals(pp.getSort_order())) {
|
||||
findSql += " " + Const.ORDER_BY_ASC;
|
||||
} else {
|
||||
findSql += " " + Const.ORDER_BY_DESC;
|
||||
}
|
||||
} else {
|
||||
findSql += " order by t.create_time desc ";
|
||||
}
|
||||
|
||||
return Db.paginateByFullSql(pp.getPage(), pp.getSize(), totalRowSql, findSql, paraList.toArray());
|
||||
}
|
||||
|
||||
public List<OrderInvalidVerify> list() {
|
||||
return OrderInvalidVerify.dao.find("select * from order_invalid_verify");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.cowr.ssjygl.order.invalidverify;
|
||||
|
||||
import com.jfinal.core.Controller;
|
||||
import com.jfinal.kit.StrKit;
|
||||
import com.cowr.common.validator.CrudParamValidator;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.OrderInvalidVerify;
|
||||
|
||||
/**
|
||||
* Generated by COWR Fri Oct 23 17:41:51 CST 2020
|
||||
* TableName: order_invalid_verify
|
||||
* Remarks: 订单相关 - 订单作废申请
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class OrderInvalidVerifyValidator extends CrudParamValidator {
|
||||
@Override
|
||||
protected void validate(Controller c) {
|
||||
validateString("order_sn", 1, 16, "order_sn", "order_sn 长度 1~16");
|
||||
validateString("invalid_memo", 1, 255, "invalid_memo", "invalid_memo 长度 1~255");
|
||||
}
|
||||
|
||||
protected void handleError(Controller c) {
|
||||
c.renderJson(Result.failed(getErrmsg()));
|
||||
}
|
||||
}
|
||||
|
|
@ -4,21 +4,22 @@ import com.cowr.common.Const;
|
|||
import com.cowr.common.base.BaseService;
|
||||
import com.cowr.common.enums.OrderStateEnum;
|
||||
import com.cowr.common.enums.UserTypeEnum;
|
||||
import com.cowr.common.utils.DateTimeUtil;
|
||||
import com.cowr.common.view.PageParam;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.Ordercluster;
|
||||
import com.cowr.model.OrderclusterTruck;
|
||||
import com.cowr.model.Sysuser;
|
||||
import com.cowr.model.Transport;
|
||||
import com.cowr.ssjygl.order.ordercluster.truck.OrderclusterTruckService;
|
||||
import com.cowr.ssjygl.transprice.TransPriceService;
|
||||
import com.jfinal.kit.StrKit;
|
||||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.activerecord.Page;
|
||||
import com.jfinal.plugin.activerecord.Record;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Generated by COWR Fri Apr 17 16:59:39 CST 2020
|
||||
|
|
@ -300,6 +301,17 @@ public class OrderclusterService extends BaseService {
|
|||
return Ordercluster.dao.find(sql, OrderStateEnum.RECEIVED.getStateid(), supermarket_id, customer_id, date + "%");
|
||||
}
|
||||
|
||||
public List<Record> undonlist(Integer customer_id) {
|
||||
String sql = "select * from ordercluster t \n" +
|
||||
" where t.state < ? \n" +
|
||||
" and t.customer_id = ? \n";
|
||||
List<Object> paraList = new ArrayList<>();
|
||||
paraList.add(OrderStateEnum.RECEIVED.getStateid());
|
||||
paraList.add(customer_id);
|
||||
|
||||
return Db.find(sql, paraList.toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定砂站未执行完成的集团订单
|
||||
*
|
||||
|
|
@ -569,6 +581,60 @@ public class OrderclusterService extends BaseService {
|
|||
return Db.paginate(pp.getPage(), pp.getSize(), "select * ", fromsql, salePara.toArray());
|
||||
}
|
||||
|
||||
public BigDecimal getTotalPriceByLicense(int supermarket_id, String truck_license, double weight) {
|
||||
Transport transport = Transport.dao.findFirst("select * from transport t \n" +
|
||||
" where t.state < ? \n" +
|
||||
" and t.supermarket_id = ? \n" +
|
||||
" and t.truck_license = ? \n" +
|
||||
" and t.out_time like ? ",
|
||||
OrderStateEnum.RECEIVED.getStateid(),
|
||||
supermarket_id,
|
||||
truck_license,
|
||||
DateTimeUtil.sdf.get().format(new Date()) + "%"
|
||||
);
|
||||
|
||||
if (transport == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (transport.getFirstWeight() == null || transport.getSecondWeight() == 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;
|
||||
}
|
||||
|
||||
BigDecimal up = ordercluster.getUnitPrice(); // 集团订单是每天创建的,可以使用集团订单中确定的单价
|
||||
|
||||
if (up == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BigDecimal net_weight = transport.getSecondWeight().subtract(transport.getFirstWeight()).abs();
|
||||
|
||||
BigDecimal total_price = TransPriceService.me.caleTotalPrice(up, net_weight);
|
||||
|
||||
if(total_price == null){
|
||||
return null;
|
||||
}
|
||||
|
||||
// 零散购砂总价四舍五入
|
||||
if(ordercluster.getCustomerId() == null){
|
||||
total_price = total_price.setScale(0, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
|
||||
return total_price;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取集团订单剩余成量
|
||||
*
|
||||
|
|
@ -593,4 +659,38 @@ public class OrderclusterService extends BaseService {
|
|||
|
||||
return out == null ? new BigDecimal(0) : out;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按客户查询未完成的配额量
|
||||
*
|
||||
* @param customer_id
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getOverWeightByCustomer(int customer_id) {
|
||||
String sql = "select sum(a.weight) weight from ( \n" +
|
||||
" select t.ordercluster_id, sum(t.weight) weight from order_sale t \n" +
|
||||
" left join ordercluster o on o.id = t.ordercluster_id\n" +
|
||||
" where t.state = ? \n" +
|
||||
" and o.state < ? \n" +
|
||||
" and o.customer_id = ? \n" +
|
||||
" group by t.ordercluster_id \n" +
|
||||
" \n" +
|
||||
" union \n" +
|
||||
" select t.ordercluster_id, sum(t.weight) weight from order_temp t \n" +
|
||||
" left join ordercluster o on o.id = t.ordercluster_id\n" +
|
||||
" where t.state = ? \n" +
|
||||
" and o.state < ? \n" +
|
||||
" and o.customer_id = ? \n" +
|
||||
" group by t.ordercluster_id \n" +
|
||||
") a \n" +
|
||||
"group by a.ordercluster_id ";
|
||||
|
||||
BigDecimal out = Db.queryBigDecimal(
|
||||
sql,
|
||||
OrderStateEnum.RECEIVED.getStateid(), OrderStateEnum.RECEIVED.getStateid(), customer_id,
|
||||
OrderStateEnum.RECEIVED.getStateid(), OrderStateEnum.RECEIVED.getStateid(), customer_id
|
||||
);
|
||||
|
||||
return out == null ? new BigDecimal(0) : out;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,12 @@ public class OrderclusterTruckService extends BaseService {
|
|||
return OrderclusterTruck.dao.find("select * from ordercluster_truck");
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证车牌号是不是再当天有运输任务
|
||||
* @param supermarket_id
|
||||
* @param truck_license
|
||||
* @return
|
||||
*/
|
||||
public OrderclusterTruck checkValidLicense(int supermarket_id, String truck_license) {
|
||||
if (StrKit.isBlank(truck_license)) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -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,16 +54,33 @@ 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 from order_temp t \n" +
|
||||
", s.name supermarket_name \n" +
|
||||
", 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" +
|
||||
" 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 \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);
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
public Page<Record> find(PageParam pp,
|
||||
|
|
@ -89,6 +108,7 @@ public class OrderTempService extends BaseService {
|
|||
" left join transport p on p.order_sn = t.sn \n" +
|
||||
" left join supermarket s on s.id = t.supermarket_id \n" +
|
||||
" where 1=1 ";
|
||||
|
||||
List<Object> paraList = new ArrayList<>();
|
||||
|
||||
if (StrKit.notBlank(sn)) {
|
||||
|
|
@ -171,7 +191,46 @@ public class OrderTempService extends BaseService {
|
|||
findSql += " order by t.create_time desc";
|
||||
}
|
||||
|
||||
return Db.paginateByFullSql(pp.getPage(), pp.getSize(), totalRowSql, findSql, paraList.toArray());
|
||||
Page<Record> page = Db.paginateByFullSql(pp.getPage(), pp.getSize(), totalRowSql, findSql, paraList.toArray());
|
||||
List<Record> list = page.getList();
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
List<String> sqlparams = new ArrayList<>();
|
||||
List<String> params = new ArrayList<>();
|
||||
|
||||
for (Record record : list) {
|
||||
sqlparams.add("?");
|
||||
params.add(record.getStr("sn"));
|
||||
}
|
||||
|
||||
if (!sqlparams.isEmpty()) {
|
||||
// 一个订单的发票可以作废多次,但是每个订单只能有一个是正在作废中的
|
||||
List<InvoiceInvalidVerify> verifies1 = InvoiceInvalidVerify.dao.find(
|
||||
"select * from invoice_invalid_verify t where t.order_sn in(" +StrKit.join(sqlparams, ",") + ") and t.state = 1 ", params.toArray());
|
||||
|
||||
List<OrderInvalidVerify> verifies2 = OrderInvalidVerify.dao.find(
|
||||
"select * from order_invalid_verify t where t.order_sn in(" +StrKit.join(sqlparams, ",") + ") and ( t.state = 1 or t.state = 2 )", params.toArray());
|
||||
|
||||
|
||||
for (Record record : list) {
|
||||
String rdsn = record.getStr("sn");
|
||||
|
||||
for(InvoiceInvalidVerify v : verifies1){
|
||||
if(rdsn.equals(v.getOrderSn())){
|
||||
record.set("invoice_invalid_verify_state", 1);
|
||||
}
|
||||
}
|
||||
|
||||
for(OrderInvalidVerify v : verifies2){
|
||||
if(rdsn.equals(v.getOrderSn())){
|
||||
record.set("order_invalid_verify_state", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -577,7 +577,7 @@ public class OrderStatService {
|
|||
total.set("weight", total.getDouble("weight") + record.getDouble("weight"));
|
||||
}
|
||||
|
||||
total.set("weight", String.format("%.2f", total.getDouble("weight")));
|
||||
total.set("weight", Double.parseDouble(String.format("%.2f", total.getDouble("weight"))));
|
||||
|
||||
dblist.add(total);
|
||||
|
||||
|
|
@ -620,7 +620,7 @@ public class OrderStatService {
|
|||
total.set("weight", total.getDouble("weight") + record.getDouble("weight"));
|
||||
}
|
||||
|
||||
total.set("weight", String.format("%.2f", total.getDouble("weight")));
|
||||
total.set("weight", Double.parseDouble(String.format("%.2f", total.getDouble("weight"))));
|
||||
|
||||
dblist.add(total);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,22 +3,14 @@ package com.cowr.ssjygl.transport;
|
|||
import com.cowr.common.Const;
|
||||
import com.cowr.common.base.BaseService;
|
||||
import com.cowr.common.enums.OrderStateEnum;
|
||||
import com.cowr.common.enums.OrderTypeEnum;
|
||||
import com.cowr.common.view.PageParam;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.Supermarket;
|
||||
import com.cowr.model.Transport;
|
||||
import com.cowr.model.TransportCompany;
|
||||
import com.cowr.model.Truck;
|
||||
import com.cowr.ssjygl.prepay.PrepayService;
|
||||
import com.cowr.model.*;
|
||||
import com.jfinal.kit.StrKit;
|
||||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.activerecord.Page;
|
||||
import com.jfinal.plugin.activerecord.Record;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Generated by COWR Sun Apr 12 21:56:13 CST 2020
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public class TransPriceService {
|
|||
|
||||
// return MathUtil.round4(up.multiply(net_weight).doubleValue()); // 三舍四入 保留 0 位小数
|
||||
// 2020-07-01 保留两位小数
|
||||
return up.multiply(net_weight).setScale(2, BigDecimal.ROUND_UP).doubleValue();
|
||||
return up.multiply(net_weight).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ public class Main {
|
|||
"customer_pact",
|
||||
"customer_supermarket_product",
|
||||
"invoice_invalid_verify",
|
||||
"order_invalid_verify",
|
||||
};
|
||||
|
||||
PropKit.use("db.properties");
|
||||
|
|
|
|||
|
|
@ -237,12 +237,22 @@ public class DeviceThread extends Thread {
|
|||
});
|
||||
}
|
||||
|
||||
public double scale(String scaleId) throws IOException {
|
||||
public Double scale(String scaleId) throws IOException {
|
||||
if (!this.scaleMap.containsKey(scaleId)) {
|
||||
throw new IllegalArgumentException(scaleId + " does not exist");
|
||||
}
|
||||
|
||||
return this.scaleMap.get(scaleId).weigh15();
|
||||
AbsScale scale = this.scaleMap.get(scaleId);
|
||||
|
||||
if(scale == null){
|
||||
return null;
|
||||
}
|
||||
|
||||
if(!scale.isConnected()){
|
||||
scale.connect();
|
||||
}
|
||||
|
||||
return scale.weigh15();
|
||||
}
|
||||
|
||||
public void print(String printerId, File file) throws IOException {
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@ import com.cowr.local.ssjygl.devicectrl.device.*;
|
|||
import com.cowr.local.ssjygl.devicectrl.utils.LicenseJPGPair;
|
||||
import com.cowr.local.ssjygl.main.CliCacheData;
|
||||
import com.cowr.model.PostLicenseResult;
|
||||
import com.cowr.ssjygl.order.ordercluster.OrderclusterService;
|
||||
import com.jfinal.log.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class OutController extends Controller implements Runnable {
|
||||
private static Log log = Log.getLog(InController.class);
|
||||
|
|
@ -209,6 +211,10 @@ public class OutController extends Controller implements Runnable {
|
|||
|
||||
log.debug("%s 【%s】上磅后,控制LED显示称重结果【%s】", getWhich(), pair.license, weight);
|
||||
try {
|
||||
BigDecimal total_price = OrderclusterService.me.getTotalPriceByLicense(CliCacheData.SUP.getId(), pair.license, weight);
|
||||
|
||||
log.debug("%s 【%s】总价 %s 元", getWhich(), pair.license, total_price);
|
||||
|
||||
String weightStr;
|
||||
if (weight >= 100) {
|
||||
weightStr = String.format("%.1f", weight);
|
||||
|
|
@ -216,7 +222,12 @@ public class OutController extends Controller implements Runnable {
|
|||
weightStr = String.format("%.2f", weight);
|
||||
}
|
||||
|
||||
if (total_price == null) {
|
||||
getLed().setWeightInfo(pair.license, weightStr);
|
||||
} else {
|
||||
// 显示总价
|
||||
getLed().setPriceInfo(pair.license, weightStr, String.format("%.2f", total_price));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
log.debug("%s 【%s】控制LED显示称重结果失败【%s】", getWhich(), pair.license, weight);
|
||||
|
|
|
|||
|
|
@ -15,12 +15,14 @@ import java.util.Date;
|
|||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
public class LEDThread extends Device implements Runnable {
|
||||
private static Log log = Log.getLog(LED.class);
|
||||
private static Log log = Log.getLog(LEDThread.class);
|
||||
private static final String LEDPriceFormat = "%s\\n%s吨\\n%s元";
|
||||
private static final String LEDWeightFormat = "%s\\n %s \\n重: %s吨";
|
||||
private static final String LEDInfoFormat = "%s\\n %s \\n%s";
|
||||
|
||||
private String license = "";
|
||||
private String text = "系统启动";
|
||||
private String price = "";
|
||||
private String format = LEDInfoFormat;
|
||||
private Thread thread;
|
||||
private boolean running = true;
|
||||
|
|
@ -37,14 +39,23 @@ public class LEDThread extends Device implements Runnable {
|
|||
screen(); // 更新属性后,马上刷新显示内容
|
||||
}
|
||||
|
||||
public void setWeightInfo(String license, String text) {
|
||||
public void setWeightInfo(String license, String weight) {
|
||||
this.license = license;
|
||||
this.text = text;
|
||||
this.text = weight;
|
||||
this.format = LEDWeightFormat;
|
||||
|
||||
screen(); // 更新属性后,马上刷新显示内容
|
||||
}
|
||||
|
||||
public void setPriceInfo(String license, String weight, String price) {
|
||||
this.license = license;
|
||||
this.text = weight;
|
||||
this.price = price;
|
||||
this.format = LEDPriceFormat;
|
||||
|
||||
screen(); // 更新属性后,马上刷新显示内容
|
||||
}
|
||||
|
||||
private static final ThreadLocal<SimpleDateFormat> sdf = new ThreadLocal<SimpleDateFormat>() {
|
||||
protected SimpleDateFormat initialValue() {
|
||||
return new SimpleDateFormat("MM-dd HH:mm");
|
||||
|
|
@ -109,8 +120,14 @@ public class LEDThread extends Device implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
String date = sdf.get().format(new Date());
|
||||
String dataStr = String.format(this.format, date, this.license, this.text);
|
||||
String dataStr = null;
|
||||
|
||||
if (this.format.equals(LEDPriceFormat)) {
|
||||
dataStr = String.format(this.format, this.license, this.text, this.price);
|
||||
} else {
|
||||
dataStr = String.format(this.format, sdf.get().format(new Date()), this.license, this.text);
|
||||
}
|
||||
|
||||
byte[] data = dataStr.getBytes(Charset.forName("gb2312"));
|
||||
int dataLen = data.length;
|
||||
byte[] msg = new byte[frameHead.length + packetHead.length + b.length + dataLen];
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public class XiShuiScale extends AbsScale {
|
|||
int errCount = 0;
|
||||
|
||||
while (run.get() && list.size() < 15) {
|
||||
long st = System.currentTimeMillis();
|
||||
// long st = System.currentTimeMillis();
|
||||
|
||||
byte[] buf = new byte[18];
|
||||
int read = inputStream.read(buf);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import com.jfinal.log.Log;
|
|||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.activerecord.IAtom;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
|
||||
public class InvoiceInvalidVerifySyncService {
|
||||
|
|
@ -36,7 +35,7 @@ public class InvoiceInvalidVerifySyncService {
|
|||
}
|
||||
|
||||
InvoiceInvalidVerify old = InvoiceInvalidVerify.dao.findFirst(
|
||||
"select * from invoice_invalid_verify t where t.state = ? and t.order_sn = ?", 1, order_sn);
|
||||
"select * from invoice_invalid_verify t where t.order_sn = ? and t.state = 1 limit 1", order_sn);
|
||||
|
||||
if (old != null) {
|
||||
return Result.failedstr("订单 %s 已提交申请", order_sn);
|
||||
|
|
@ -86,6 +85,17 @@ public class InvoiceInvalidVerifySyncService {
|
|||
}
|
||||
|
||||
public Result save(InvoiceInvalidVerify model, Sysuser sysuser) {
|
||||
InvoiceInvalidVerify old = InvoiceInvalidVerify.dao.findFirst(
|
||||
"select * from invoice_invalid_verify t \n" +
|
||||
" wheret.invoice_number = ? \n" +
|
||||
" and t.invoice_code = ? \n" +
|
||||
" and t.state = 1 " +
|
||||
" limit 1", model.getInvoiceNumber(), model.getInvoiceCode());
|
||||
|
||||
if (old != null) {
|
||||
return Result.failedstr("发票 %s|%s 已提交申请", model.getInvoiceNumber(), model.getInvoiceCode());
|
||||
}
|
||||
|
||||
// 先判断这张发票有没有被领用
|
||||
InvoiceReceive receive = InvoiceReceiveService.me.checkReceive(CliCacheData.SUP.getId(), model.getInvoiceNumber(), model.getInvoiceCode());
|
||||
if (receive == null) {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.cowr.common.oss.OSSKit;
|
|||
import com.cowr.local.ssjygl.customer.pact.CustomerPactController;
|
||||
import com.cowr.local.ssjygl.customer.supermarketproduct.CustomerSupermarketProductController;
|
||||
import com.cowr.local.ssjygl.invoice.invalidverify.InvoiceInvalidVerifyController;
|
||||
import com.cowr.local.ssjygl.order.invalidverify.OrderInvalidVerifyController;
|
||||
import com.cowr.ssjygl.actioncmdlog.ActionCmdLogController;
|
||||
import com.cowr.local.ssjygl.authlicense.AuthLicenseController;
|
||||
import com.cowr.local.ssjygl.authlicense.AuthLicenseSyncService;
|
||||
|
|
@ -93,7 +94,7 @@ public class Config extends JFinalConfig {
|
|||
public static DeviceThread deviceThread = new DeviceThread();
|
||||
public static SocketIOService socketio = null;
|
||||
private static boolean client_run = true;
|
||||
public static final String CLINET_VERSION = "20201023";
|
||||
public static final String CLINET_VERSION = "20201026";
|
||||
|
||||
public static String getRootPath() {
|
||||
return PathKit.getWebRootPath()
|
||||
|
|
@ -218,6 +219,7 @@ public class Config extends JFinalConfig {
|
|||
me.add("/order/trash", OrderTrashController.class);
|
||||
me.add("/order/purchase", OrderPurchaseController.class);
|
||||
me.add("/orderclustertruck", OrderclusterTruckController.class);
|
||||
me.add("/order/invalidverify", OrderInvalidVerifyController.class);
|
||||
|
||||
// -- 统计
|
||||
me.add("/stat/sale", OrderStatController.class);
|
||||
|
|
@ -345,6 +347,8 @@ public class Config extends JFinalConfig {
|
|||
log.info("====================================================");
|
||||
log.info("============= 启动 %s %s 服务 ================", CliCacheData.SUP.getId(), CliCacheData.SUP.getName());
|
||||
log.info("====================================================");
|
||||
log.info("============= 最大限重 %s 吨 =================", configprop.getInt("weigh.max"));
|
||||
log.info("====================================================");
|
||||
}
|
||||
|
||||
StockSyncService.me.initSupermarketStock();
|
||||
|
|
|
|||
|
|
@ -562,12 +562,12 @@ public class LocalOrderService {
|
|||
|
||||
try {
|
||||
Config.deviceThread.print(printerId, getPrintFile(printdata));
|
||||
cmd.set("print", true);
|
||||
cmd.set("status", true);
|
||||
|
||||
ActionCmdLogSyncService.me.save(cmd.toJson(), sysuser);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
cmd.set("print", false);
|
||||
cmd.set("status", false);
|
||||
|
||||
ActionCmdLogSyncService.me.save(cmd.toJson(), sysuser);
|
||||
return Result.failed("打印指令失败");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
package com.cowr.local.ssjygl.order.invalidverify;
|
||||
|
||||
import com.cowr.common.view.PageParam;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.local.ssjygl.system.sysuser.SysuserSyncService;
|
||||
import com.cowr.model.OrderInvalidVerify;
|
||||
import com.cowr.model.Sysuser;
|
||||
import com.cowr.ssjygl.order.invalidverify.OrderInvalidVerifyService;
|
||||
import com.cowr.ssjygl.order.invalidverify.OrderInvalidVerifyValidator;
|
||||
import com.jfinal.aop.Before;
|
||||
import com.jfinal.core.Controller;
|
||||
|
||||
/**
|
||||
* Generated by COWR Fri Oct 23 17:41:51 CST 2020
|
||||
* TableName: order_invalid_verify
|
||||
* Remarks: 订单相关 - 订单作废申请
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class OrderInvalidVerifyController extends Controller {
|
||||
|
||||
/**
|
||||
* 新增 order_invalid_verify 订单相关 - 订单作废申请
|
||||
*/
|
||||
@Before(OrderInvalidVerifyValidator.class)
|
||||
public void save() {
|
||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||
|
||||
if (tokenuser == null) {
|
||||
renderJson(Result.noauth());
|
||||
return;
|
||||
}
|
||||
|
||||
String order_sn = get("order_sn");
|
||||
String invalid_memo = get("invalid_memo");
|
||||
|
||||
renderJson(OrderInvalidVerifySyncService.me.save(order_sn, invalid_memo, tokenuser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查找 order_invalid_verify 订单相关 - 订单作废申请
|
||||
*/
|
||||
public void find() {
|
||||
PageParam pp = getBean(PageParam.class, "", true);
|
||||
|
||||
String stm = get("stm");
|
||||
String etm = get("etm");
|
||||
String order_sn = get("order_sn");
|
||||
String create_user_name = get("create_user_name");
|
||||
Integer supermarket_id = getInt("supermarket_id");
|
||||
Integer state = getInt("state");
|
||||
|
||||
renderJson(Result.object(OrderInvalidVerifyService.me.find(pp, stm, etm, state, create_user_name, supermarket_id, order_sn)));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package com.cowr.local.ssjygl.order.invalidverify;
|
||||
|
||||
import com.cowr.common.enums.OrderStateEnum;
|
||||
import com.cowr.common.enums.OrderTypeEnum;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.local.ssjygl.main.CliCacheData;
|
||||
import com.cowr.local.ssjygl.synctask.SyncTaskService;
|
||||
import com.cowr.model.OrderInvalidVerify;
|
||||
import com.cowr.model.OrderTemp;
|
||||
import com.cowr.model.SyncTask;
|
||||
import com.cowr.model.Sysuser;
|
||||
import com.jfinal.kit.StrKit;
|
||||
import com.jfinal.log.Log;
|
||||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.activerecord.IAtom;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class OrderInvalidVerifySyncService {
|
||||
private static Log log = Log.getLog(OrderInvalidVerifySyncService.class);
|
||||
public static OrderInvalidVerifySyncService me = new OrderInvalidVerifySyncService();
|
||||
|
||||
public Result save(String order_sn, String invalid_memo, Sysuser sysuser) {
|
||||
OrderTemp order = OrderTemp.dao.findById(order_sn);
|
||||
|
||||
if (order == null) {
|
||||
return Result.failedstr("按 %s 没有找到订单信息", order_sn);
|
||||
}
|
||||
|
||||
if(order.getState() != OrderStateEnum.RECEIVED.getStateid()){
|
||||
return Result.failed("只能对已收货的订单提出作废申请");
|
||||
}
|
||||
|
||||
OrderInvalidVerify old = OrderInvalidVerify.dao.findFirst("select * from order_invalid_verify t \n" +
|
||||
" where t.order_sn = ? \n" +
|
||||
" and ( t.state= 1 or t.state = 2 )\n" +
|
||||
" limit 1", order_sn);
|
||||
|
||||
if (old != null) {
|
||||
return Result.failedstr("订单 %s 已提交申请", order_sn);
|
||||
}
|
||||
|
||||
OrderInvalidVerify model = new OrderInvalidVerify();
|
||||
model.setId(StrKit.getRandomUUID());
|
||||
model.setSupermarketId(CliCacheData.SUP.getId());
|
||||
model.setCreateTime(new Date());
|
||||
model.setCreateUserId(sysuser.getId());
|
||||
model.setCreateUserName(sysuser.getName());
|
||||
model.setOrderSn(order.getSn());
|
||||
model.setType(OrderTypeEnum.TEMP.getTypeid());
|
||||
model.setInvalidMemo(invalid_memo);
|
||||
|
||||
SyncTask synctask = new SyncTask();
|
||||
boolean ret = Db.tx(new IAtom() {
|
||||
@Override
|
||||
public boolean run() {
|
||||
try {
|
||||
boolean ret = model.save();
|
||||
|
||||
if (!ret) {
|
||||
return false;
|
||||
}
|
||||
|
||||
synctask.addSaveData(model);
|
||||
|
||||
return SyncTaskService.me.save(synctask);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (ret) {
|
||||
SyncTaskService.me.send(synctask);
|
||||
}
|
||||
|
||||
return ret ? Result.success(model) : Result.failed("保存失败");
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,6 @@ import com.cowr.local.ssjygl.main.CliCacheData;
|
|||
import com.cowr.local.ssjygl.main.Config;
|
||||
import com.cowr.local.ssjygl.order.LocalOrderService;
|
||||
import com.cowr.local.ssjygl.order.orderseq.OrderSeqService;
|
||||
import com.cowr.ssjygl.customer.supermarketproduct.CustomerSupermarketProductService;
|
||||
import com.cowr.ssjygl.invoice.log.InvoiceLogService;
|
||||
import com.cowr.ssjygl.invoice.receive.InvoiceReceiveService;
|
||||
import com.cowr.ssjygl.order.ordercluster.OrderclusterService;
|
||||
|
|
@ -56,7 +55,7 @@ public class OrderTempSyncService {
|
|||
return Result.failed("进出场记录已完结或者已作废,不能使用");
|
||||
}
|
||||
|
||||
InvoiceReceive receive = InvoiceReceiveService.me.checkReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
||||
InvoiceReceive receive = InvoiceReceiveService.me.checkSurplusReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
||||
if (receive == null) {
|
||||
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
||||
}
|
||||
|
|
@ -316,7 +315,7 @@ public class OrderTempSyncService {
|
|||
|
||||
// 零散客户需要开具发票的,需要检查是否有有效的领用记录
|
||||
if (ordercluster.getReqReceipt() == 1) {
|
||||
receive = InvoiceReceiveService.me.checkReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
||||
receive = InvoiceReceiveService.me.checkSurplusReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
||||
|
||||
if (receive == null) {
|
||||
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
||||
|
|
@ -378,10 +377,19 @@ public class OrderTempSyncService {
|
|||
order.setCustomerTexpayerNum(ordercluster.getCustomerTexpayerNum());
|
||||
}
|
||||
|
||||
// 2020-10-26 应王乐要求,零散购砂客户总价四舍五入
|
||||
BigDecimal total_price = TransPriceService.me.caleTotalPrice(up, net_weight);
|
||||
|
||||
if(total_price == null){
|
||||
return Result.failed("总价计算错误");
|
||||
}
|
||||
|
||||
total_price = total_price.setScale(0, BigDecimal.ROUND_HALF_UP);
|
||||
|
||||
// 支付信息
|
||||
order.setUnitPrice(up);
|
||||
order.setWeight(net_weight); // 使用净重更新重量
|
||||
order.setTotalPrice(TransPriceService.me.caleTotalPrice(up, net_weight)); // 获取根据净重和单价计算的总价,作为应付金额
|
||||
order.setTotalPrice(total_price); // 获取根据净重和单价计算的总价,作为应付金额
|
||||
order.setPaid(order.getTotalPrice()); // 如果有预付费,该字段根据预付费情况设置。实付金额
|
||||
order.setPayType(ordercluster.getPayType());
|
||||
order.setOrderclusterId(ordercluster_id);
|
||||
|
|
@ -629,7 +637,7 @@ public class OrderTempSyncService {
|
|||
order.setInvoiceType(2);
|
||||
// 需要专票的,在结算开了专票之后,再修改 invoice_site 字段
|
||||
} else {
|
||||
receive = InvoiceReceiveService.me.checkReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
||||
receive = InvoiceReceiveService.me.checkSurplusReceive(transport.getSupermarketId(), invoice_number, invoice_code);
|
||||
if (receive == null) {
|
||||
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
||||
}
|
||||
|
|
@ -878,7 +886,7 @@ public class OrderTempSyncService {
|
|||
return Result.failedstr("请先将已开具的发票[%s]取消", order.getInvoiceCode());
|
||||
}
|
||||
|
||||
InvoiceReceive receive = InvoiceReceiveService.me.checkReceive(order.getSupermarketId(), invoice_number, invoice_code);
|
||||
InvoiceReceive receive = InvoiceReceiveService.me.checkSurplusReceive(order.getSupermarketId(), invoice_number, invoice_code);
|
||||
if (receive == null) {
|
||||
return Result.failed("没有有效的发票领用记录,或者发票已经被使用");
|
||||
}
|
||||
|
|
@ -969,15 +977,15 @@ public class OrderTempSyncService {
|
|||
|
||||
try {
|
||||
Config.deviceThread.print(printerId, LocalOrderService.me.getPrintFile(printdata));
|
||||
cmd.set("print", true);
|
||||
cmd.set("status", true);
|
||||
|
||||
ActionCmdLogSyncService.me.save(cmd.toJson(), sysuser);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
cmd.set("print", false);
|
||||
cmd.set("status", false);
|
||||
|
||||
ActionCmdLogSyncService.me.save(cmd.toJson(), sysuser);
|
||||
return Result.failed("打印指令失败");
|
||||
return Result.success("开票成功,打印指令失败");
|
||||
}
|
||||
|
||||
return Result.success("开票成功,打印指令已发送");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
package com.cowr.local.ssjygl.transport;
|
||||
|
||||
|
||||
import com.cowr.common.validator.CrudParamValidator;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.jfinal.core.Controller;
|
||||
|
||||
public class MemoValidator extends CrudParamValidator {
|
||||
@Override
|
||||
protected void validate(Controller c) {
|
||||
validateString("memo", 1, 500, "memo", "memo 长度 1~500,必填");
|
||||
}
|
||||
|
||||
protected void handleError(Controller c) {
|
||||
c.renderJson(Result.failed(getErrmsg()));
|
||||
}
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@ public class TransportController extends BaseController {
|
|||
/**
|
||||
* 手动输入重量
|
||||
*/
|
||||
@Before(ManualWeightValidator.class)
|
||||
@Before({ManualWeightValidator.class, MemoValidator.class})
|
||||
public void manualWeight() {
|
||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||
|
||||
|
|
@ -146,6 +146,7 @@ public class TransportController extends BaseController {
|
|||
return;
|
||||
}
|
||||
|
||||
String memo = get("memo");
|
||||
String transport_id = get("transport_id");
|
||||
String which = getUpperCaseVal("which", Enums.WhichEnum.R01.name());
|
||||
double weight = getParaToDouble("weight");
|
||||
|
|
@ -156,10 +157,10 @@ public class TransportController extends BaseController {
|
|||
return;
|
||||
}
|
||||
|
||||
renderJson(TransportSyncService.me.manualWeight(transport_id, which, weight, tokenuser, password));
|
||||
renderJson(TransportSyncService.me.manualWeight(transport_id, which, weight, memo, tokenuser, password));
|
||||
}
|
||||
|
||||
@Before({ManualCreateValidator.class})
|
||||
@Before({ManualCreateValidator.class, MemoValidator.class})
|
||||
public void manualCreate() {
|
||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||
|
||||
|
|
@ -168,6 +169,7 @@ public class TransportController extends BaseController {
|
|||
return;
|
||||
}
|
||||
|
||||
String memo = get("memo");
|
||||
int supermarket_id = getInt("supermarket_id", CliCacheData.SUP.getId());
|
||||
String truck_license = getUpperCaseVal("truck_license");
|
||||
double first_weight = getParaToDouble("first_weight");
|
||||
|
|
@ -180,7 +182,7 @@ public class TransportController extends BaseController {
|
|||
return;
|
||||
}
|
||||
|
||||
renderJson(TransportSyncService.me.manualCreate(supermarket_id, truck_license, first_weight, second_weight, out_which, tokenuser, password));
|
||||
renderJson(TransportSyncService.me.manualCreate(supermarket_id, truck_license, first_weight, second_weight, out_which, memo, tokenuser, password));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -266,6 +268,7 @@ public class TransportController extends BaseController {
|
|||
renderJson(result ? Result.success(true) : Result.failed("重置流程失败"));
|
||||
}
|
||||
|
||||
@Before({MemoValidator.class})
|
||||
public void cmdRodUp() {
|
||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||
|
||||
|
|
@ -274,6 +277,7 @@ public class TransportController extends BaseController {
|
|||
return;
|
||||
}
|
||||
|
||||
String memo = get("memo");
|
||||
int num = getInt("num", 1); // 抬前闸 1,还是后闸 2 // 2020-09-28 可以确定,一个磅上只有两个闸,num 值只能为 1 或者 2
|
||||
String which = getUpperCaseVal("which");// Enums.WhichEnum R01 入场流程 C01 出场流程
|
||||
|
||||
|
|
@ -282,10 +286,11 @@ public class TransportController extends BaseController {
|
|||
return;
|
||||
}
|
||||
|
||||
boolean result = TransportDeviceService.me.cmdRodUp(num == 1 ? 1 : 2, which, tokenuser);
|
||||
boolean result = TransportDeviceService.me.cmdRodUp(num == 1 ? 1 : 2, which, memo, tokenuser);
|
||||
renderJson(result ? Result.success(true) : Result.failed("抬闸失败"));
|
||||
}
|
||||
|
||||
@Before(TransportIdValidator.class)
|
||||
public void cmdScale() {
|
||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||
|
||||
|
|
@ -294,6 +299,7 @@ public class TransportController extends BaseController {
|
|||
return;
|
||||
}
|
||||
|
||||
String transport_id = get("transport_id");
|
||||
String which = getUpperCaseVal("which");// Enums.WhichEnum R01 入场流程 C01 出场流程
|
||||
|
||||
if (!Enums.CtrlFlowEnum.isValid(which)) {
|
||||
|
|
@ -301,8 +307,7 @@ public class TransportController extends BaseController {
|
|||
return;
|
||||
}
|
||||
|
||||
double result = TransportDeviceService.me.cmdScale(which, tokenuser);
|
||||
renderJson(Result.success(result));
|
||||
renderJson(TransportDeviceService.me.cmdScale(transport_id, which, tokenuser));
|
||||
}
|
||||
|
||||
@Before(TransportIdValidator.class)
|
||||
|
|
|
|||
|
|
@ -1,14 +1,19 @@
|
|||
package com.cowr.local.ssjygl.transport;
|
||||
|
||||
import com.cowr.common.enums.Enums;
|
||||
import com.cowr.common.enums.OrderStateEnum;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.local.ssjygl.actioncmdlog.ActionCmdLogSyncService;
|
||||
import com.cowr.local.ssjygl.devicectrl.controllers.Controller;
|
||||
import com.cowr.local.ssjygl.main.CliCacheData;
|
||||
import com.cowr.local.ssjygl.main.Config;
|
||||
import com.cowr.model.SyncTask;
|
||||
import com.cowr.model.Sysuser;
|
||||
import com.cowr.model.Transport;
|
||||
import com.jfinal.kit.HttpKit;
|
||||
import com.jfinal.kit.StrKit;
|
||||
import com.jfinal.log.Log;
|
||||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.activerecord.Record;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
|
@ -233,11 +238,12 @@ public class TransportDeviceService {
|
|||
return Config.deviceThread.cmdResetFlow(which) && ActionCmdLogSyncService.me.save(cmdlog.toJson(), sysuser);
|
||||
}
|
||||
|
||||
public boolean cmdRodUp(int num, String which, Sysuser sysuser) {
|
||||
public boolean cmdRodUp(int num, String which, String memo, Sysuser sysuser) {
|
||||
Record cmdlog = new Record();
|
||||
cmdlog.set("cmd", "rodUp");
|
||||
cmdlog.set("which", which);
|
||||
cmdlog.set("num", num);
|
||||
cmdlog.set("memo", memo);
|
||||
|
||||
boolean ret;
|
||||
|
||||
|
|
@ -258,18 +264,47 @@ public class TransportDeviceService {
|
|||
return ret;
|
||||
}
|
||||
|
||||
public double cmdScale(String which, Sysuser sysuser) {
|
||||
public Result cmdScale(String transport_id, String which, Sysuser sysuser) {
|
||||
try {
|
||||
Record cmdlog = new Record();
|
||||
cmdlog.set("cmd", "scale");
|
||||
cmdlog.set("which", which);
|
||||
cmdlog.set("transport_id", transport_id);
|
||||
cmdlog.set("status", false);
|
||||
|
||||
try {
|
||||
Transport transport = Transport.dao.findById(transport_id);
|
||||
|
||||
if (transport == null) {
|
||||
ActionCmdLogSyncService.me.save(cmdlog.toJson(), sysuser);
|
||||
return Result.failed("未找到出入场记录");
|
||||
}
|
||||
|
||||
if (transport.getState() >= OrderStateEnum.RECEIVED.getStateid()) {
|
||||
ActionCmdLogSyncService.me.save(cmdlog.toJson(), sysuser);
|
||||
return Result.failed("记录已完成或者已取消");
|
||||
}
|
||||
|
||||
Double weight = Config.deviceThread.scale(which);
|
||||
|
||||
// 称重失败,在称一次
|
||||
if (weight == null || weight == 0) {
|
||||
weight = Config.deviceThread.scale(which);
|
||||
}
|
||||
|
||||
if (weight == null || weight == 0) {
|
||||
ActionCmdLogSyncService.me.save(cmdlog.toJson(), sysuser);
|
||||
return Result.failed("称重失败");
|
||||
}
|
||||
|
||||
boolean ret = TransportSyncService.me.postWeigh(transport, weight, which);
|
||||
|
||||
cmdlog.set("status", ret);
|
||||
ActionCmdLogSyncService.me.save(cmdlog.toJson(), sysuser);
|
||||
|
||||
return Config.deviceThread.scale(which);
|
||||
return ret ? Result.success() : Result.failed("称重失败");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return 0.0;
|
||||
return Result.failed("称重失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.cowr.local.ssjygl.main.Config;
|
|||
import com.cowr.ssjygl.customer.supermarketproduct.CustomerSupermarketProductService;
|
||||
import com.cowr.ssjygl.invoice.receive.InvoiceReceiveService;
|
||||
import com.cowr.ssjygl.order.OrderService;
|
||||
import com.cowr.ssjygl.order.ordercluster.OrderclusterService;
|
||||
import com.cowr.ssjygl.order.ordercluster.truck.OrderclusterTruckService;
|
||||
import com.cowr.ssjygl.supermarket.product.SupermarketProductService;
|
||||
import com.cowr.model.*;
|
||||
|
|
@ -40,7 +41,7 @@ public class TransportQueryService {
|
|||
return Result.failed("未找到有效的出入场记录");
|
||||
}
|
||||
|
||||
if (transport.getFirstWeight() == null && transport.getSecondWeight() == null) {
|
||||
if (transport.getFirstWeight() == null || transport.getSecondWeight() == null) {
|
||||
return Result.failed("重量数据不完整");
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +67,12 @@ public class TransportQueryService {
|
|||
transobj.set("prepay_truck", false);
|
||||
}
|
||||
|
||||
BigDecimal overweight = OrderclusterService.me.getOverWeight(ordercluster.getId()); // 集团订单已完成量
|
||||
|
||||
transobj.set("ordercluster", ordercluster);
|
||||
transobj.set("ordercluster_over_weight", overweight);
|
||||
transobj.set("ordercluster_surplus_weight", ordercluster.getTotalWeight().subtract(overweight));
|
||||
transobj.set("ordercluster_surplus_threshold", Config.configprop.getInt("surplus.threshold", 30));
|
||||
transobj.set("weight", net_weight);
|
||||
transobj.set("net_weight", net_weight);
|
||||
|
||||
|
|
|
|||
|
|
@ -160,11 +160,6 @@ public class TransportSyncService {
|
|||
* @return
|
||||
*/
|
||||
public boolean postWeigh(int supermarket_id, String truck_license, Double weight, String which) {
|
||||
try {
|
||||
if (!Enums.CtrlFlowEnum.isValid(which)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Transport transport = TransportService.me.undoneTransport(supermarket_id, truck_license);
|
||||
|
||||
if (transport == null) {
|
||||
|
|
@ -177,6 +172,15 @@ public class TransportSyncService {
|
|||
return false;
|
||||
}
|
||||
|
||||
return postWeigh(transport, weight, which);
|
||||
}
|
||||
|
||||
public boolean postWeigh(Transport transport, Double weight, String which) {
|
||||
try {
|
||||
if (!Enums.CtrlFlowEnum.isValid(which)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean ret = false;
|
||||
|
||||
if (which.startsWith(Enums.CtrlFlowEnum.R.name())) {
|
||||
|
|
@ -684,7 +688,7 @@ public class TransportSyncService {
|
|||
* 2020-06-24,黄州这个参数固定为 C01
|
||||
* @return
|
||||
*/
|
||||
public Result manualCreate(int supermarket_id, String truck_license, double first_weight, double second_weight, String out_which, Sysuser sysuser, String password) {
|
||||
public Result manualCreate(int supermarket_id, String truck_license, double first_weight, double second_weight, String out_which, String memo, Sysuser sysuser, String password) {
|
||||
try {
|
||||
// 重新验证密码
|
||||
Sysuser chkuser = SysuserSyncService.me.getUserByWhere(null, sysuser.getPhone(), password);
|
||||
|
|
@ -729,6 +733,7 @@ public class TransportSyncService {
|
|||
SyncTask synctask = new SyncTask();
|
||||
Record logrecord = new Record();
|
||||
logrecord.set("id", transport.getId());
|
||||
logrecord.set("memo", memo);
|
||||
logrecord.set("modify_content", "manualWeight"); // 创建入场记录,用 Enums.DataOpType.UPDATE 记录
|
||||
logrecord.set("modify_type", "manualCreate");
|
||||
logrecord.set("first_weight", transport.getFirstWeight());
|
||||
|
|
@ -859,7 +864,7 @@ public class TransportSyncService {
|
|||
* @param password
|
||||
* @return
|
||||
*/
|
||||
public Result manualWeight(String transport_id, String which, double weight, Sysuser sysuser, String password) {
|
||||
public Result manualWeight(String transport_id, String which, double weight, String memo, Sysuser sysuser, String password) {
|
||||
// 重新验证密码
|
||||
Sysuser chkuser = SysuserSyncService.me.getUserByWhere(null, sysuser.getPhone(), password);
|
||||
|
||||
|
|
@ -876,6 +881,7 @@ public class TransportSyncService {
|
|||
|
||||
Record logrecord = new Record();
|
||||
logrecord.set("id", transport_id);
|
||||
logrecord.set("memo", memo);
|
||||
logrecord.set("modify_content", "manualWeight");
|
||||
logrecord.set("modify_type", "manualWeight_" + which);
|
||||
|
||||
|
|
@ -911,7 +917,16 @@ public class TransportSyncService {
|
|||
if (!ret) {
|
||||
return false;
|
||||
}
|
||||
synctask.addSaveData(ModifyLogSyncService.me.generator(Transport.tablename, "id", logrecord.toJson(), Enums.DataOpType.UPDATE.getId(), sysuser));
|
||||
|
||||
ModifyLog modify = ModifyLogSyncService.me.generator(Transport.tablename, "id", logrecord.toJson(), Enums.DataOpType.UPDATE.getId(), sysuser);
|
||||
|
||||
ret = modify.save();
|
||||
|
||||
if (!ret) {
|
||||
return false;
|
||||
}
|
||||
|
||||
synctask.addSaveData(modify);
|
||||
synctask.addUpdateData(transport);
|
||||
|
||||
return SyncTaskService.me.save(synctask);
|
||||
|
|
|
|||
|
|
@ -17,11 +17,14 @@ socketio.port=12002
|
|||
#当前部署本地程序的砂站id
|
||||
current.supermarket_id=1
|
||||
#落杆后,等待上磅的时间
|
||||
default_scale_wait_time=5000
|
||||
default_scale_wait_time=8000
|
||||
|
||||
#最大毛重不超过 49 吨,超过 49 吨不能上高速
|
||||
#2020-10-16 盐港都是小磅,最大只能40
|
||||
weigh.max=40
|
||||
weigh.max=49
|
||||
|
||||
#集团订单剩余量在结算时的剩余量预警值
|
||||
surplus.threshold=30
|
||||
|
||||
#打印用到的配置信息
|
||||
print.vendor=浠水县长投环保有限公司
|
||||
|
|
|
|||
|
|
@ -17,11 +17,15 @@ socketio.port=12002
|
|||
#当前部署本地程序的砂站id
|
||||
current.supermarket_id=6
|
||||
#落杆后,等待上磅的时间
|
||||
default_scale_wait_time=5000
|
||||
default_scale_wait_time=8000
|
||||
|
||||
#最大毛重不超过 49 吨,超过 49 吨不能上高速
|
||||
#2020-10-16 盐港都是小磅,最大只能40
|
||||
weigh.max=49
|
||||
|
||||
#集团订单剩余量在结算时的剩余量预警值
|
||||
surplus.threshold=30
|
||||
|
||||
#打印用到的配置信息
|
||||
print.vendor=浠水县长投环保有限公司
|
||||
print.vendorTaxId=91421125MA49GYYK2B
|
||||
|
|
|
|||
|
|
@ -27,6 +27,10 @@ public class InvoiceInvalidVerifySyncService {
|
|||
return Result.failed("没有找到申请记录");
|
||||
}
|
||||
|
||||
if (model.getState() == 9) {
|
||||
return Result.failed("申请已作废");
|
||||
}
|
||||
|
||||
if (model.getState() == state) {
|
||||
return Result.failed("状态值没有变化");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,7 +145,10 @@ public class InvoiceLogController extends Controller {
|
|||
if (tokenuser == null) {
|
||||
renderJson(Result.noauth());
|
||||
return;
|
||||
} else if (!SysuserSyncService.me.isTreasurer(tokenuser.getRole())) { // 财务才能录入专票
|
||||
} else if (
|
||||
!SysuserSyncService.me.isTreasurer(tokenuser.getRole())
|
||||
&& !SysuserSyncService.me.isPresident(tokenuser.getRole())
|
||||
) { // 和经理录入专票
|
||||
renderJson(Result.permissionDenied());
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import com.jfinal.plugin.activerecord.Db;
|
|||
import com.jfinal.plugin.activerecord.IAtom;
|
||||
import com.jfinal.plugin.activerecord.Record;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
|
||||
public class InvoiceLogSyncService extends BaseSyncService {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.cowr.service.ssjygl.jobs;
|
||||
|
||||
import com.cowr.model.Supermarket;
|
||||
import com.cowr.service.ssjygl.main.SvrCacheData;
|
||||
import com.cowr.service.ssjygl.smslog.SmsService;
|
||||
import com.cowr.service.ssjygl.synctask.SyncTaskService;
|
||||
import com.jfinal.log.Log;
|
||||
|
|
@ -7,13 +9,17 @@ import org.quartz.Job;
|
|||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class SyncJob implements Job {
|
||||
private static Log log = Log.getLog(SyncJob.class);
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
try {
|
||||
SyncTaskService.me.task();
|
||||
for(Map.Entry<Integer, Supermarket> entry : SvrCacheData.SUP_CACHE.entrySet()){
|
||||
SyncTaskService.me.task(entry.getKey());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import com.cowr.service.ssjygl.invoice.invalidverify.InvoiceInvalidVerifyControl
|
|||
import com.cowr.service.ssjygl.invoice.log.InvoiceLogController;
|
||||
import com.cowr.service.ssjygl.invoice.receive.InvoiceReceiveController;
|
||||
import com.cowr.service.ssjygl.netty.NettyServer;
|
||||
import com.cowr.service.ssjygl.order.invalidverify.OrderInvalidVerifyController;
|
||||
import com.cowr.service.ssjygl.order.ordercluster.OrderclusterController;
|
||||
import com.cowr.service.ssjygl.order.ordercluster.truck.OrderclusterTruckController;
|
||||
import com.cowr.service.ssjygl.order.orderpurchase.OrderPurchaseController;
|
||||
|
|
@ -185,6 +186,7 @@ public class Config extends JFinalConfig {
|
|||
me.add("/order/trash", OrderTrashController.class);
|
||||
me.add("/order/purchase", OrderPurchaseController.class);
|
||||
me.add("/orderclustertruck", OrderclusterTruckController.class);
|
||||
me.add("/order/invalidverify", OrderInvalidVerifyController.class);
|
||||
|
||||
// -- 统计
|
||||
me.add("/stat/sale", OrderStatController.class);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
package com.cowr.service.ssjygl.order.invalidverify;
|
||||
|
||||
import com.cowr.common.view.PageParam;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.Sysuser;
|
||||
import com.cowr.service.ssjygl.invoice.invalidverify.InvoiceInvalidVerifyValidator;
|
||||
import com.cowr.service.ssjygl.system.sysuser.SysuserSyncService;
|
||||
import com.cowr.ssjygl.order.invalidverify.OrderInvalidVerifyService;
|
||||
import com.jfinal.aop.Before;
|
||||
import com.jfinal.core.Controller;
|
||||
|
||||
/**
|
||||
* Generated by COWR Fri Oct 23 17:41:51 CST 2020
|
||||
* TableName: order_invalid_verify
|
||||
* Remarks: 订单相关 - 订单作废申请
|
||||
* PrimaryKey: id
|
||||
*/
|
||||
public class OrderInvalidVerifyController extends Controller {
|
||||
|
||||
@Before(InvoiceInvalidVerifyValidator.class)
|
||||
public void verify() {
|
||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||
|
||||
if (tokenuser == null) {
|
||||
renderJson(Result.noauth());
|
||||
return;
|
||||
} else if (!SysuserSyncService.me.isTreasurer(tokenuser.getRole())) { // 财务才能审核
|
||||
renderJson(Result.permissionDenied());
|
||||
return;
|
||||
}
|
||||
|
||||
String id = get("id");
|
||||
int state = getInt("state", 0);
|
||||
String memo = get("memo");
|
||||
String password = get("password");
|
||||
|
||||
renderJson(OrderInvalidVerifySyncService.me.verify(id, state, memo, tokenuser, password));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查找 order_invalid_verify 订单相关 - 订单作废申请
|
||||
*/
|
||||
public void find() {
|
||||
PageParam pp = getBean(PageParam.class, "", true);
|
||||
|
||||
String stm = get("stm");
|
||||
String etm = get("etm");
|
||||
String order_sn = get("order_sn");
|
||||
String create_user_name = get("create_user_name");
|
||||
Integer supermarket_id = getInt("supermarket_id");
|
||||
Integer state = getInt("state");
|
||||
|
||||
renderJson(Result.object(OrderInvalidVerifyService.me.find(pp, stm, etm, state, create_user_name, supermarket_id, order_sn)));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.cowr.service.ssjygl.order.invalidverify;
|
||||
|
||||
import com.cowr.common.enums.OrderStateEnum;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.cowr.model.OrderInvalidVerify;
|
||||
import com.cowr.model.SyncTask;
|
||||
import com.cowr.model.Sysuser;
|
||||
import com.cowr.service.ssjygl.order.ordertemp.OrderTempSyncService;
|
||||
import com.cowr.service.ssjygl.synctask.SyncTaskService;
|
||||
import com.jfinal.log.Log;
|
||||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.activerecord.IAtom;
|
||||
|
||||
public class OrderInvalidVerifySyncService {
|
||||
private static Log log = Log.getLog(OrderInvalidVerifySyncService.class);
|
||||
public static OrderInvalidVerifySyncService me = new OrderInvalidVerifySyncService();
|
||||
|
||||
public Result verify(String id, int state, String memo, Sysuser user, String password) {
|
||||
if (state != 2 && state != 9) {
|
||||
return Result.failed("state 值错误");
|
||||
}
|
||||
|
||||
OrderInvalidVerify model = OrderInvalidVerify.dao.findById(id);
|
||||
|
||||
if (model == null) {
|
||||
return Result.failed("没有找到申请记录");
|
||||
}
|
||||
|
||||
if (model.getState() == 9) {
|
||||
return Result.failed("申请已作废");
|
||||
}
|
||||
|
||||
if (model.getState() == state) {
|
||||
return Result.failed("状态值没有变化");
|
||||
}
|
||||
|
||||
model.setVerifyUserId(user.getId());
|
||||
model.setVerifyUserName(user.getName());
|
||||
model.setMemo(memo);
|
||||
model.setState(state);
|
||||
|
||||
if (state == OrderStateEnum.INVALID.getStateid()) {
|
||||
return notPass(model);
|
||||
} else if (state == 2) {
|
||||
return OrderTempSyncService.me.cancel(model.getOrderSn(), model.getInvalidMemo(), user, password, model);
|
||||
}
|
||||
|
||||
return Result.failed("修改失败");
|
||||
}
|
||||
|
||||
|
||||
private Result notPass(OrderInvalidVerify model) {
|
||||
SyncTask synctask = new SyncTask();
|
||||
|
||||
boolean ret = Db.tx(new IAtom() {
|
||||
@Override
|
||||
public boolean run() {
|
||||
try {
|
||||
boolean ret = model.update();
|
||||
|
||||
if (!ret) {
|
||||
return false;
|
||||
}
|
||||
|
||||
synctask.addUpdateData(model);
|
||||
|
||||
return SyncTaskService.me.save(synctask, model.getSupermarketId());
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (ret) {
|
||||
SyncTaskService.me.send(synctask);
|
||||
}
|
||||
|
||||
return ret ? Result.success() : Result.failed("修改失败");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.cowr.service.ssjygl.order.ordercluster;
|
||||
|
||||
import com.cowr.common.validator.CrudParamValidator;
|
||||
import com.cowr.common.view.Result;
|
||||
import com.jfinal.core.Controller;
|
||||
import com.jfinal.kit.StrKit;
|
||||
|
||||
public class EditClusterValidator extends CrudParamValidator {
|
||||
@Override
|
||||
protected void validate(Controller c) {
|
||||
validateRequired("id", "id", "id 必填");
|
||||
validateInteger("id", 1, 2147483647, "id", "id 范围 1~2147483647");
|
||||
validateBigDecimal("total_weight", new java.math.BigDecimal("0.01"), new java.math.BigDecimal(9.9999999999E10), "total_weight", "total_weight 范围 0.01~9.9999999999E10");
|
||||
|
||||
if (StrKit.notBlank(c.get("time_interval"))) {
|
||||
validateInteger("time_interval", 1, 3, "time_interval", "time_interval 范围 1~3");
|
||||
}
|
||||
|
||||
if (StrKit.notBlank(c.get("mini_truck"))) {
|
||||
validateInteger("mini_truck", 1, 2147483647, "mini_truck", "mini_truck 范围 1~2147483647");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleError(Controller c) {
|
||||
c.renderJson(Result.failed(getErrmsg()));
|
||||
}
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ public class OrderclusterController extends BaseController {
|
|||
/**
|
||||
* 修改 ordercluster 订单簇 - 集团客户订单
|
||||
*/
|
||||
@Before(OrderclusterEditValidator.class)
|
||||
@Before(EditClusterValidator.class)
|
||||
public void edit() {
|
||||
Sysuser tokenuser = SysuserSyncService.me.getSysuserByToken(get("token"));
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import com.jfinal.log.Log;
|
|||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.activerecord.IAtom;
|
||||
import com.jfinal.plugin.activerecord.Record;
|
||||
import org.apache.poi.ss.usermodel.DateUtil;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.SQLException;
|
||||
|
|
@ -115,19 +116,39 @@ public class OrderclusterSyncService extends BaseSyncService {
|
|||
continue;
|
||||
}
|
||||
|
||||
List<Record> undonlist = OrderclusterService.me.undonlist(supermarket_id, customer_id);
|
||||
|
||||
if (undonlist != null && !undonlist.isEmpty()) {
|
||||
return Result.failedstr("客户[%s]在砂站[%s]还有未完成的配额", customerObj.getName(), SvrCacheData.SUP_CACHE.get(supermarket_id).getName());
|
||||
}
|
||||
|
||||
BigDecimal unitprice = CustomerSupermarketProductService.me.getUnitPrice(customer_id, supermarket_id, product.getId());
|
||||
if (unitprice == null) {
|
||||
return Result.failed("未配置商品单价");
|
||||
}
|
||||
|
||||
// 按客户查询未完成的订单量
|
||||
List<Record> undonlist = OrderclusterService.me.undonlist(customer_id);
|
||||
|
||||
if (undonlist != null && !undonlist.isEmpty()) {
|
||||
BigDecimal plan_total_weight = new BigDecimal(total_weight); // 本次配额重量
|
||||
|
||||
for (Record record : undonlist) {
|
||||
Date record_cutoff_time = record.getDate("cutoff_time");
|
||||
|
||||
// 判断日期不是已经存在
|
||||
if (record_cutoff_time.getTime() == cutoff_time.getTime()) {
|
||||
return Result.failedstr("客户[%s][%s]在砂站[%s]还有未完成的配额", customerObj.getName(), DateTimeUtil.sdfymd.get().format(cutoff_time), SvrCacheData.SUP_CACHE.get(supermarket_id).getName());
|
||||
} else {
|
||||
// 累加总量
|
||||
plan_total_weight = plan_total_weight.add(record.getBigDecimal("total_weight"));
|
||||
}
|
||||
}
|
||||
|
||||
// 按客户统计已完成量
|
||||
BigDecimal overweight = OrderclusterService.me.getOverWeightByCustomer(customer_id); // 按客户找集团订单已完成量
|
||||
|
||||
if (plan_total_weight.subtract(overweight).multiply(unitprice).compareTo(prepayCustomer.getSurplus()) > 0) {
|
||||
return Result.failedstr("剩余总配额 %.2f,客户余额(%.2f)不足", plan_total_weight.subtract(overweight), prepayCustomer.getSurplus());
|
||||
}
|
||||
}
|
||||
|
||||
if (unitprice.multiply(new BigDecimal(total_weight)).compareTo(prepayCustomer.getSurplus()) > 0) {
|
||||
return Result.failedstr("余额 %.2f 不足以购买 %.2f 吨 %s", prepayCustomer.getSurplus(), total_weight, product.getName());
|
||||
return Result.failedstr("余额 %.2f 不足以购买 %.2f 吨", prepayCustomer.getSurplus(), total_weight);
|
||||
}
|
||||
|
||||
Ordercluster model = new Ordercluster();
|
||||
|
|
@ -500,39 +521,43 @@ public class OrderclusterSyncService extends BaseSyncService {
|
|||
return Result.failed(false, "订单已完成,不能修改");
|
||||
}
|
||||
|
||||
if (oldobj.getState() > OrderStateEnum.INITIAL.getStateid() && !oldobj.getCutoffTime().equals(model.getCutoffTime())) {
|
||||
return Result.failed(false, "已经开始执行的订单不能修改完成时间");
|
||||
} else if (model.getCutoffTime() != null) {
|
||||
oldobj.setCutoffTime(model.getCutoffTime());
|
||||
if (oldobj.getCustomerId() != null) {
|
||||
PrepayCustomer prepayCustomer = PrepayCustomerService.me.getPrepayCustomer(oldobj.getCustomerId());
|
||||
if (prepayCustomer == null) {
|
||||
return Result.failed("不是预付费用户");
|
||||
}
|
||||
|
||||
if (model.getAvgWeight() != null) {
|
||||
oldobj.setAvgWeight(model.getAvgWeight());
|
||||
// 按客户查询未完成的订单量
|
||||
List<Record> undonlist = OrderclusterService.me.undonlist(oldobj.getCustomerId());
|
||||
|
||||
if (undonlist != null && !undonlist.isEmpty()) {
|
||||
BigDecimal plan_total_weight = model.getTotalWeight();
|
||||
|
||||
for (Record record : undonlist) {
|
||||
if (model.getId().equals(record.getInt("id"))) {
|
||||
continue; // 当前修改的记录已经做为初始值了,不再累计
|
||||
}
|
||||
|
||||
if (model.getTotalWeight() != null) {
|
||||
String sql = "select t.ordercluster_id, sum(t.weight) weight from order_sale t \n" +
|
||||
" where t.state = ? \n" +
|
||||
" and t.ordercluster_id = ? \n" +
|
||||
" group by t.ordercluster_id \n" +
|
||||
" union \n" +
|
||||
" select t.ordercluster_id, sum(t.weight) weight from order_temp t \n" +
|
||||
" where t.state = ? \n" +
|
||||
" and t.ordercluster_id = ? \n" +
|
||||
" group by t.ordercluster_id ";
|
||||
// 累加总量
|
||||
plan_total_weight = plan_total_weight.add(record.getBigDecimal("total_weight"));
|
||||
}
|
||||
|
||||
Record record = Db.findFirst(sql, OrderStateEnum.RECEIVED.getStateid(), model.getId(), OrderStateEnum.RECEIVED.getStateid(), model.getId());
|
||||
// 按客户统计已完成量
|
||||
BigDecimal overweight = OrderclusterService.me.getOverWeightByCustomer(oldobj.getCustomerId()); // 按客户找集团订单已完成量
|
||||
|
||||
if (record != null) {
|
||||
if (model.getTotalWeight().compareTo(record.getBigDecimal("weight")) < 0) {
|
||||
return Result.failedstr("总量不能低于已运输量(%.2f)", record.getBigDecimal("weight"));
|
||||
if (plan_total_weight.subtract(overweight).multiply(oldobj.getUnitPrice()).compareTo(prepayCustomer.getSurplus()) > 0) {
|
||||
return Result.failedstr("剩余总配额 %.2f,客户余额(%.2f)不足", plan_total_weight.subtract(overweight), prepayCustomer.getSurplus());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BigDecimal overweight = OrderclusterService.me.getOverWeight(model.getId()); // 集团订单已完成量
|
||||
|
||||
if (model.getTotalWeight().compareTo(overweight) < 0) {
|
||||
return Result.failedstr("总量不能低于已运输量(%.2f)", overweight);
|
||||
} else {
|
||||
oldobj.setTotalWeight(model.getTotalWeight());
|
||||
}
|
||||
} else {
|
||||
oldobj.setTotalWeight(model.getTotalWeight());
|
||||
}
|
||||
}
|
||||
|
||||
if (model.getTimeInterval() != null) {
|
||||
oldobj.setTimeInterval(model.getTimeInterval());
|
||||
|
|
@ -542,47 +567,22 @@ public class OrderclusterSyncService extends BaseSyncService {
|
|||
oldobj.setMiniTruck(model.getMiniTruck());
|
||||
}
|
||||
|
||||
if (model.getTransDistance() != null) {
|
||||
oldobj.setTransDistance(model.getTransDistance());
|
||||
}
|
||||
|
||||
if (model.getReqReceipt() != null) {
|
||||
oldobj.setReqReceipt(model.getReqReceipt());
|
||||
}
|
||||
|
||||
if (model.getCustomerTexpayerName() != null) {
|
||||
oldobj.setCustomerTexpayerName(model.getCustomerTexpayerName());
|
||||
}
|
||||
|
||||
if (model.getCustomerTexpayerNum() != null) {
|
||||
oldobj.setCustomerTexpayerNum(model.getCustomerTexpayerNum());
|
||||
}
|
||||
|
||||
// 设定了物流公司,并且和以前的不一样
|
||||
if (model.getTransCoId() != null && !model.getTransCoId().equals(oldobj.getTransCoId())) {
|
||||
TransportCompany transCoObj = TransportCompany.dao.findById(model.getTransCoId());
|
||||
|
||||
if (transCoObj == null) {
|
||||
return Result.failed("新增失败, 物流公司信息获取失败");
|
||||
}
|
||||
|
||||
oldobj.setTransCoId(transCoObj.getId());
|
||||
oldobj.setTransCoName(transCoObj.getName());
|
||||
oldobj.setTransCoAddress(transCoObj.getAddress());
|
||||
oldobj.setTransCoBankName(transCoObj.getBankName());
|
||||
oldobj.setTransCoBankAccount(transCoObj.getBankAccount());
|
||||
oldobj.setTransCoPhone(transCoObj.getPhone());
|
||||
oldobj.setTransCoTexpayerName(transCoObj.getTexpayerName());
|
||||
oldobj.setTransCoTexpayerNum(transCoObj.getTexpayerNum());
|
||||
}
|
||||
SyncTask synctask = new SyncTask();
|
||||
|
||||
try {
|
||||
boolean ret = Db.tx(new IAtom() {
|
||||
@Override
|
||||
public boolean run() throws SQLException {
|
||||
try {
|
||||
return oldobj.update()
|
||||
&& SyncTaskService.me.save(new SyncTask().addUpdateData(oldobj), oldobj.getSupermarketId())
|
||||
boolean ret = oldobj.update();
|
||||
|
||||
if (!ret) {
|
||||
return false;
|
||||
}
|
||||
|
||||
synctask.addUpdateData(oldobj);
|
||||
|
||||
return SyncTaskService.me.save(synctask, oldobj.getSupermarketId())
|
||||
&& ModifyLogService.me.save(model, null, Enums.DataOpType.UPDATE.getId(), sysuser);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
|
|
@ -592,7 +592,7 @@ public class OrderclusterSyncService extends BaseSyncService {
|
|||
}
|
||||
});
|
||||
|
||||
return ret ? Result.success(model) : Result.failed("修改失败");
|
||||
return ret ? Result.success(oldobj) : Result.failed("修改失败");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.failed("修改失败");
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ public class OrderTempSyncService {
|
|||
private static Log log = Log.getLog(OrderTempSyncService.class);
|
||||
|
||||
public Result cancel(String sn, String invalid_memo, Sysuser sysuser, String password) {
|
||||
return cancel(sn, invalid_memo, sysuser, password, null);
|
||||
}
|
||||
|
||||
public Result cancel(String sn, String invalid_memo, Sysuser sysuser, String password, OrderInvalidVerify orderInvalidVerify) {
|
||||
// TODO: 判断权限
|
||||
|
||||
OrderTemp order = OrderTemp.dao.findById(sn);
|
||||
|
|
@ -67,6 +71,16 @@ public class OrderTempSyncService {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (orderInvalidVerify != null) {
|
||||
ret = orderInvalidVerify.update();
|
||||
|
||||
if (!ret) {
|
||||
return false;
|
||||
}
|
||||
|
||||
synctask.addUpdateData(orderInvalidVerify);
|
||||
}
|
||||
|
||||
// if(oldstate == OrderStateEnum.LEAVE.getStateid() ){
|
||||
// Bocomm bocomm = Bocomm.dao.findFirst(
|
||||
// "select * from bocomm t where t.order_sn = ? and t.state <= ? limit 0,1",
|
||||
|
|
@ -116,7 +130,7 @@ public class OrderTempSyncService {
|
|||
}
|
||||
|
||||
// 是预付费订单
|
||||
if (order.getIsprepaid() == 1) {
|
||||
if (order.getIsprepaid() == 1 && order.getCustomerId() != null) {
|
||||
Customer customer = Customer.dao.findById(order.getCustomerId());
|
||||
|
||||
if (customer == null) {
|
||||
|
|
@ -172,6 +186,10 @@ public class OrderTempSyncService {
|
|||
}
|
||||
});
|
||||
|
||||
if (ret) {
|
||||
SyncTaskService.me.send(synctask);
|
||||
}
|
||||
|
||||
return ret ? Result.success(order) : Result.failed("取消失败");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,14 +89,6 @@ public class SyncTaskService {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 2020-10-10 创建的任务不能立马就发出,要事务完成后发出,避免事务回滚
|
||||
// if (ret) {
|
||||
// for (SyncTask obj : list) {
|
||||
// send(obj);
|
||||
// }
|
||||
// }
|
||||
|
||||
return ret; // 有插入的,还是需要返回插入状态
|
||||
}
|
||||
}
|
||||
|
|
@ -167,15 +159,19 @@ public class SyncTaskService {
|
|||
}
|
||||
}
|
||||
|
||||
public void task() {
|
||||
/**
|
||||
* 按砂站ID去找未完成的,避免一个砂站有过多的未完成堆积,导致其他的不能下发
|
||||
* @param supermarket_id
|
||||
*/
|
||||
public void task(int supermarket_id) {
|
||||
if (!isEnable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<SyncTask> list = unsynclist();
|
||||
List<SyncTask> list = unsynclist(supermarket_id);
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
log.debug("开始下发未同步完成的数据 " + list.size());
|
||||
log.debug("开始下发未同步完成的数据 supermarket_id: %s, len: %s", supermarket_id, list.size());
|
||||
}
|
||||
|
||||
for (SyncTask obj : list) {
|
||||
|
|
@ -183,8 +179,8 @@ public class SyncTaskService {
|
|||
}
|
||||
}
|
||||
|
||||
public List<SyncTask> unsynclist() {
|
||||
return SyncTask.dao.find("select * from sync_task t where t.state = 0 order by t.create_time limit 0, 500");
|
||||
public List<SyncTask> unsynclist(int supermarket_id) {
|
||||
return SyncTask.dao.find("select * from sync_task t where t.state = 0 and t.supermarket_id = ? order by t.create_time limit 0, 500", supermarket_id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ public class SysuserSyncService extends BaseSyncService {
|
|||
|
||||
/**
|
||||
* 2020-03-7 财务和总经理,必须选砂站管理员?
|
||||
* 是否是财务人员
|
||||
* 是否是公司经理人员
|
||||
*
|
||||
* @param roleid
|
||||
* @return
|
||||
|
|
|
|||
Loading…
Reference in New Issue