This commit is contained in:
linfso 2024-04-30 22:34:56 +08:00
parent 63f29cc881
commit 8dd33fbdbb
16 changed files with 485 additions and 13 deletions

View File

@ -11,10 +11,21 @@
package com.xdadan.erp.web.emis;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.xdadan.erp.common.annotation.filter.jackson.JacksonFilter;
import com.xdadan.erp.emis.domain.EmisBrand;
import com.xdadan.erp.emis.domain.EmisWaybill;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.domain.vo.scan.ScanInfo;
import com.xdadan.erp.emis.domain.vo.scan.ScanResult;
import com.xdadan.erp.emis.service.IEmisWaybillService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@ -29,7 +40,6 @@ import com.xdadan.erp.common.core.controller.BaseController;
import com.xdadan.erp.common.core.domain.AjaxResult;
import com.xdadan.erp.common.core.page.TableDataInfo;
import com.xdadan.erp.common.enums.BusinessType;
import com.xdadan.erp.common.utils.StringUtils;
import com.xdadan.erp.common.utils.poi.ExcelUtil;
import com.xdadan.erp.emis.domain.EmisTmsScanRecord;
@ -48,6 +58,190 @@ public class EmisTmsScanRecordController extends BaseController
@Autowired
private IEmisTmsScanRecordService emisTmsScanRecordService;
@Autowired
private IEmisWaybillService emisWaybillService;
/**
* 获取可扫描的运单
* @param scanInfo
* @return
*/
@RequestMapping("/scan")
public AjaxResult scan(@RequestBody ScanInfo scanInfo)
{
if(scanInfo==null){
return AjaxResult.error("参数为空");
}
if(StringUtils.isEmpty(scanInfo.getScanType())
|| CollectionUtils.isEmpty(scanInfo.getScanData())
|| scanInfo.getOpType() == null
){
return AjaxResult.error("参数不正确");
}
try {
ScanResult scanResult=emisTmsScanRecordService.scan(scanInfo);
return AjaxResult.success("扫描成功",scanResult);
}catch (Exception ex){
ex.printStackTrace();
// 返回子定义异常
if(ex instanceof EmisBizError){
return AjaxResult.error("("+((EmisBizError)ex).getErrorCode()+")"+ex.getMessage());
}
return AjaxResult.error("扫描异常,联系客服");
}
}
/**
* 获取可扫描的运单
* @param billCodes
* @param scanType
* @return
*/
@RequestMapping("/scanBatch")
@JacksonFilter(include= {"id","code","name","nameEn","logo"},value= EmisBrand.class,type= JacksonFilter.JscksonFilterType.RESPONSE)
public AjaxResult scanBatch(String[] billCodes,String scanType)
{
List<EmisWaybill> newList = new ArrayList<>();
if(billCodes==null || StringUtils.isEmpty(scanType) ){
return AjaxResult.error("参数不正确");
}
// emisWaybillService.getWaybillDetail(billCodes)
// List<EmisWaybill> list = emisWaybillService.selectEmisWaybillByMutiBillCode(billCodes);
// for(EmisWaybill emisWaybill:list){
// // 检测是否可揽收
// if("GOT".equals(scanType.toUpperCase())){
//
// }
// }
return AjaxResult.success("批量扫描成功");
// scanType 揽收扫描 emis_tab_scan_type
/*
"emis_tab_scan_type": [
{
"label": "收件扫描",
"sort": 1,
"value": "ACCEPT"
},
{
"label": "揽件扫描",
"sort": 2,
"value": "GOT"
},
{
"label": "入中转",
"sort": 3,
"value": "ARRIVAL"
},
{
"label": "出中转",
"sort": 4,
"value": "DEPARTURE"
},
{
"label": "派件中",
"sort": 5,
"value": "SENT"
},
{
"label": "第三方代收入库",
"sort": 6,
"value": "INBOUND"
},
{
"label": "第三方代收快递员取出",
"sort": 7,
"value": "OUTBOUND"
},
{
"label": "已签收",
"sort": 8,
"value": "SIGNED"
},
{
"label": "签收失败",
"sort": 9,
"value": "SIGNFAIL"
},
{
"label": "退回件",
"sort": 10,
"value": "RETURN"
},
{
"label": "问题件",
"sort": 11,
"value": "ISSUE"
},
{
"label": "拒收",
"sort": 12,
"value": "REJECTION"
},
{
"label": "其他",
"sort": 13,
"value": "OTHER"
},
{
"label": "入库扫描",
"sort": 14,
"value": "OVERSEA_IN"
},
{
"label": "出库扫描",
"sort": 15,
"value": "OVERSEA_OUT"
},
{
"label": "清关开始",
"sort": 16,
"value": "CLEARANCE_START"
},
{
"label": "清关结束",
"sort": 17,
"value": "CLEARANCE_FINISH"
},
{
"label": "清关失败",
"sort": 18,
"value": "CLEARANCE_FAIL"
},
{
"label": "干线到达",
"sort": 19,
"value": "OVERSEA_ARRIVAL"
},
{
"label": "干线离开",
"sort": 20,
"value": "OVERSEA_DEPARTURE"
},
{
"label": "转单",
"sort": 20,
"value": "TRANSFER"
}
],
"desc": "扫描类型"
*/
// return getDataTable(newList);
}
/**
* 查询TMS扫描记录列表
*/

View File

@ -11,16 +11,20 @@
package com.xdadan.erp.web.emis;
import java.util.ArrayList;
import java.util.List;
import javax.validation.Valid;
import com.alibaba.fastjson.JSONObject;
import com.xdadan.erp.common.annotation.filter.jackson.JacksonFilter;
import com.xdadan.erp.emis.domain.EmisBrand;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.domain.vo.*;
import com.xdadan.erp.emis.service.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import com.xdadan.erp.common.annotation.Log;
@ -198,6 +202,9 @@ public class EmisWaybillController extends BaseController
return getDataTable(list);
}
// /**
// * 导出运单列表列表
// */

View File

@ -1,4 +1,4 @@
package com.xdadan.erp.emis.domain.exception;
package com.xdadan.erp.emis.domain.enumtype;
import lombok.Getter;

View File

@ -0,0 +1,33 @@
package com.xdadan.erp.emis.domain.enumtype;
public enum ScanType {
ACCEPT("收件扫描"),
GOT("揽件扫描"),
ARRIVAL("入中转"),
DEPARTURE("出中转"),
SENT("派件中"),
INBOUND("第三方代收入库"),
OUTBOUND("第三方代收快递员取出"),
SIGNED("已签收"),
SIGNFAIL("签收失败"),
RETURN("退回件"),
ISSUE("问题件"),
REJECTION("拒收"),
OTHER("其他"),
OVERSEA_IN("入库扫描"),
OVERSEA_OUT("出库扫描"),
CLEARANCE_START("清关开始"),
CLEARANCE_FINISH("清关结束"),
CLEARANCE_FAIL("清关失败"),
OVERSEA_ARRIVAL("干线到达"),
OVERSEA_DEPARTURE("干线离开"),
TRANSFER("转单"),
;
private String label;
ScanType(String label) {
this.label = label;
}
}

View File

@ -1,5 +1,7 @@
package com.xdadan.erp.emis.domain.exception;
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
public class EmisBizError extends Exception {
private String errorCode;

View File

@ -0,0 +1,30 @@
package com.xdadan.erp.emis.domain.vo.scan;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* 扫描信息
* {
* scanType:"GOT",
* opType:1,
* scanData:[{
* "billCode":"运单号,多个单号逗号隔开,T123,T1234",
* "pickEmpCode":"取件员",
* "scanWeight":"扫描重量"
* }]
* }
*/
@Data
public class ScanInfo implements Serializable {
private static final long serialVersionUID = 1L;
private String scanType;
private Integer opType;
private List<Map<String,Object>> scanData;
}

View File

@ -0,0 +1,38 @@
package com.xdadan.erp.emis.domain.vo.scan;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
扫描信息
{
"scanType": "GOT",
"opType": 1,
"scanResult": [
{
"billCode": "T123",
"result": "success",
"message": "允许扫描"
},
{
"billCode": "T123",
"result": "fail",
"message": "不允许扫描:已签收"
}
]
}
*/
@Data
public class ScanResult implements Serializable {
private static final long serialVersionUID = 1L;
private String scanType;
private Integer opType;
private List<ScanResultItem> scanResult;
}

View File

@ -0,0 +1,37 @@
package com.xdadan.erp.emis.domain.vo.scan;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
扫描信息
{
"scanType": "GOT",
"opType": 1,
"scanResult": [
{
"billCode": "T123",
"result": "success",
"message": "允许扫描"
},
{
"billCode": "T123",
"result": "fail",
"message": "不允许扫描:已签收"
}
]
}
*/
@Data
public class ScanResultItem implements Serializable {
private static final long serialVersionUID = 1L;
String billCode;
String result;
String message;
}

View File

@ -72,4 +72,7 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
* @return 结果
*/
public int deleteEmisWaybillByIds(Long[] ids);
public List<EmisWaybill> selectEmisWaybillByMutiBillCode(String[] billCodes);
}

View File

@ -17,7 +17,9 @@ package com.xdadan.erp.emis.service;
import com.xdadan.erp.common.utils.DateUtils;
import com.xdadan.erp.common.utils.SecurityUtils;
import com.xdadan.erp.emis.domain.*;
import com.xdadan.erp.emis.domain.enumtype.ScanType;
import com.xdadan.erp.emis.domain.vo.WaybillOrder;
import com.xdadan.erp.emis.domain.vo.scan.ScanResultItem;
import com.xdadan.erp.emis.mapper.*;
import com.xdadan.erp.emis.service.IEmisWaybillAttachmentService;
import com.xdadan.erp.emis.service.IEmisWaybillCargoService;
@ -83,6 +85,40 @@ public class EmisBaseService {
}
public List<ScanResultItem> checkCanScan(String scanType,Map<String,Object> scanDataItem){
List<ScanResultItem> itemList = new ArrayList<>();
String billCode = (String)scanDataItem.get("billCode");
if(StringUtils.isEmpty(billCode)){
ScanResultItem scanResultItem = new ScanResultItem();
scanResultItem.setBillCode(billCode);
scanResultItem.setResult("fail");
scanResultItem.setMessage("billCode为空");
itemList.add(scanResultItem);
return itemList;
}
// 开始检查数据
String[] billCodeArr = billCode.split(",");
for (String billCodeItem:billCodeArr) {
ScanResultItem scanResultItem = new ScanResultItem();
scanResultItem.setBillCode(billCode);
// 检查区间
scanResultItem.setResult("success");
scanResultItem.setMessage("允许操作");
// 检查操作员
if(ScanType.ACCEPT.name().equals(scanType)){
}
itemList.add(scanResultItem);
}
return itemList;
}
/**
* 产生客户编码 规则: siteCode+ 000000
@ -357,15 +393,19 @@ public class EmisBaseService {
}
public static void main(String[] args) {
Date startDate = new Date();
Date endDate = DateUtils.addDays(startDate, 10);
int weekDays = computeWeekDays(startDate,endDate,true);
// System.out.println("周末:"+new SimpleDateFormat("yyyy-MM-dd").format(cal1.getTime()));
// Date startDate = new Date();
// Date endDate = DateUtils.addDays(startDate, 10);
// int weekDays = computeWeekDays(startDate,endDate,true);
//// System.out.println("周末:"+new SimpleDateFormat("yyyy-MM-dd").format(cal1.getTime()));
//
// System.out.println(startDate);
// System.out.println(endDate);
System.out.println(startDate);
System.out.println(endDate);
Object m1=null;
String s1=(String)m1;
System.out.println(weekDays);
System.out.println(s1);
}
}

View File

@ -11,8 +11,11 @@ package com.xdadan.erp.emis.service;
import java.util.List;
import com.xdadan.erp.emis.domain.EmisTmsScanRecord;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.domain.vo.scan.ScanInfo;
import com.xdadan.erp.emis.domain.vo.scan.ScanResult;
/**
/**
* @ClassName EmisTmsScanRecordService
* @Description TMS扫描记录
* @author linfso
@ -66,4 +69,11 @@ public interface IEmisTmsScanRecordService
* @return 结果
*/
public int deleteEmisTmsScanRecordById(Long id);
/**
* 运单扫描操作
* @param scanInfo
*/
public ScanResult scan(ScanInfo scanInfo) throws EmisBizError;
}

View File

@ -112,4 +112,6 @@ public interface IEmisWaybillService
public void calcSettledWeight(EmisWaybill emisWaybill) throws EmisBizError;
public List<EmisWaybill> selectEmisWaybillByMutiBillCode(String[] billCodes);
}

View File

@ -10,7 +10,15 @@
package com.xdadan.erp.emis.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.domain.vo.scan.ScanInfo;
import com.xdadan.erp.emis.domain.vo.scan.ScanResult;
import com.xdadan.erp.emis.domain.vo.scan.ScanResultItem;
import com.xdadan.erp.emis.service.EmisBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xdadan.erp.emis.domain.EmisTmsScanRecord;
@ -24,7 +32,7 @@ import com.xdadan.erp.emis.service.IEmisTmsScanRecordService;
* @date 2024-03-01 08:54:59
*/
@Service
public class EmisTmsScanRecordServiceImpl implements IEmisTmsScanRecordService
public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEmisTmsScanRecordService
{
@Autowired
private EmisTmsScanRecordMapper emisTmsScanRecordMapper;
@ -101,4 +109,26 @@ public class EmisTmsScanRecordServiceImpl implements IEmisTmsScanRecordService
return emisTmsScanRecordMapper.deleteEmisTmsScanRecordById(id);
}
@Override
public ScanResult scan(ScanInfo scanInfo) throws EmisBizError{
ScanResult scanResult = new ScanResult();
scanResult.setScanType(scanInfo.getScanType());
scanResult.setOpType(scanInfo.getOpType());
List<ScanResultItem> resultList = new ArrayList<>();
if(scanInfo.getOpType()==1){
for (Map<String,Object> item: scanInfo.getScanData()) {
List<ScanResultItem> itemCheckList=checkCanScan(scanInfo.getScanType(),item);
resultList.addAll(itemCheckList);
}
}
scanResult.setScanResult(resultList);
return scanResult;
}
}

View File

@ -23,10 +23,9 @@ import com.alibaba.fastjson.JSONObject;
import com.googlecode.aviator.AviatorEvaluator;
import com.xdadan.erp.common.utils.DateUtils;
import com.xdadan.erp.common.utils.DictUtils;
import com.xdadan.erp.common.utils.SecurityUtils;
import com.xdadan.erp.emis.domain.*;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.domain.exception.EmisBizErrorType;
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
import com.xdadan.erp.emis.domain.vo.*;
import com.xdadan.erp.emis.mapper.EmisTransLineMapper;
import com.xdadan.erp.emis.service.*;
@ -564,6 +563,13 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
}
@Override
public List<EmisWaybill> selectEmisWaybillByMutiBillCode(String[] billCodes){
return emisWaybillMapper.selectEmisWaybillByMutiBillCode(billCodes);
}
public static void main(String[] args) {
Snowflake snowflake = IdUtil.getSnowflake(0, 0);

View File

@ -30,6 +30,7 @@ public class WaybillHelper {
return orderId.toString();
}
/**
* 小数进位计算
* @param weight

View File

@ -183,6 +183,45 @@
</where>
</select>
<select id="selectEmisWaybillByMutiBillCode" parameterType="String" resultMap="EmisWaybillResult">
select id, order_sn, cust_order_id, bill_code,
bill_code_sub, order_status, waybill_status,
order_type, order_date, user_id, customer_code,
customer_name, receive_customer_code,
receive_customer_name, third_customer_code,
third_customer_name, open_id, receive_name,
receive_company, receive_mobile, receive_tel,
receive_country, receive_province, receive_city,
receive_county, receive_town, receive_address,
receive_postcode, receive_pcd, send_name,
send_company, send_mobile, send_tel, send_country, send_province, send_city,
send_county, send_town, send_address, send_postcode, send_pcd, payment_type,
calc_fee_type, cust_no, trans_line_type, product_type, time_type, meter_type,
customs_clear, customs_eclaration, estimate_date, pack_type, dispatch_method,
pickup_method, pick_start_date, pick_finish_date, pick_fail_reason, into_warehouse_code,
into_warehouse_name, into_warehouse_address, into_warehouse_contact, into_warehouse_phone,
into_warehouse_bill_code, warehouse_in_no, customer_delivery_begin_time, customer_delivery_end_time,
goods_type, goods_info, goods_pics, bl_prepare_in_freight, prepare_in_est_fee, prepare_in_real_fee,
prepare_in_express, prepare_in_bill_code, prepare_in_remark, prepare_in_supplier, total_weight, total_volume,
parcel_qty, bill_weight, volume_weight, currency, settlement_weight, fee_weight, freight,
bl_over_long, bl_bill, bl_bill_text, bl_over_weight, over_weight_number, fee_remaker, third_code,
real_value, bl_insure, insure_value, insure_value_currency, insure_fee_currency, insure_fee, insure_remark,
insure_site_code, insure_date, bl_print, print_man_code, print_site, print_date, print_count, bl_disp_fd,
transfer_code, transfer_billcode, disp_fd_date, disp_fd_reason, current_site_code, next_site_code,
last_site_code, register_site_code, register_date, register_man_code, take_piece_employee_code, send_site_code,
send_date, dispatch_man_code, dispatch_date, dispatch_site_code, produce_bill_date, produce_bill_site_code,
produce_bill_man_code, destination_code, destination_province, destination_city, destination_county,
dispatch_underling_site_code, destination_center_code, market_man_code, payee, salesmen, operate_employee_code,
bl_is_question, problem_type, problem_cause, problem_delay_days, bl_message, bl_accept_message,
bl_gen_subbill, sign_man, sign_man_code, sign_site_code, sign_date, bill_pic_send_rmk, bill_pic_dispatch_rmk,
timezone_offset, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
from emis_waybill
where billCode in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{billCode}
</foreach>
</select>
<select id="selectEmisWaybillList" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
<include refid="selectEmisWaybillVo"/>