Merge pull request 'develop' (#52) from develop into master
Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/52
This commit is contained in:
commit
4868f7bace
@ -1317,6 +1317,55 @@ public class EmisCommonController extends EmisBaseController
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出进仓单-对接外部
|
||||
*
|
||||
* @param response HTTP响应对象
|
||||
* @param queryInfo 查询参数JSON对象
|
||||
* @return JSONObject 统一格式的响应
|
||||
*/
|
||||
@Log(title = "导出进仓单", businessType = BusinessType.EXPORT)
|
||||
@RequestMapping("/exportCustomerWarehouse")
|
||||
public void exportCustomerWarehouse(HttpServletResponse response, @RequestBody JSONObject queryInfo) {
|
||||
try {
|
||||
// 1. 参数校验
|
||||
if (queryInfo == null) {
|
||||
log.error("查询参数不能为空");
|
||||
}
|
||||
|
||||
// 2. 获取参数
|
||||
String logisticNo = queryInfo.getString("logisticNo");
|
||||
String fileType = queryInfo.getString("fileType");
|
||||
String appId = queryInfo.getString("appId");
|
||||
String appKey = queryInfo.getString("appKey");
|
||||
String sign = queryInfo.getString("sign");
|
||||
|
||||
// 3. 参数完整性校验
|
||||
if (StringUtils.isAnyEmpty(logisticNo, fileType, appId, appKey, sign)) {
|
||||
log.error("参数不完整");
|
||||
}
|
||||
|
||||
// 4. 验证签名
|
||||
if (!emisCustomerSignService.verifySign(appId, appKey, logisticNo, sign)) {
|
||||
log.error("签名验证失败");
|
||||
}
|
||||
|
||||
EmisWaybill emisWaybill = emisWaybillService.selectCustEmisWaybillByBillCode(logisticNo, appId);
|
||||
if (emisWaybill == null) {
|
||||
log.error("运单号不存在");
|
||||
}
|
||||
|
||||
// 5. 调用service处理导出
|
||||
emisWaybillService.genWarehouseInTplFile(response, emisWaybill.getOrderSn(), fileType);
|
||||
log.debug("导出成功");
|
||||
|
||||
} catch (EmisBizError ex) {
|
||||
log.error("导出异常", ex.getMessage());
|
||||
} catch (Exception ex) {
|
||||
log.error("导出异常,请联系客服", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 对接外部接口-根据订单信息生成运单
|
||||
*/
|
||||
@ -1418,10 +1467,281 @@ public class EmisCommonController extends EmisBaseController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 对接外部接口-查询运单信息
|
||||
*/
|
||||
@PostMapping("/queryWaybillInfo")
|
||||
@ResponseBody
|
||||
public JSONObject queryWaybillInfo(@RequestBody JSONObject queryInfo) {
|
||||
try {
|
||||
if (queryInfo == null) {
|
||||
JSONObject errorResponse = new JSONObject();
|
||||
errorResponse.put("code", 1);
|
||||
errorResponse.put("message", "查询信息不能为空");
|
||||
errorResponse.put("data", "[]");
|
||||
return errorResponse;
|
||||
}
|
||||
|
||||
// 1. 获取参数
|
||||
String appId = queryInfo.getString("appId");
|
||||
String appKey = queryInfo.getString("appKey");
|
||||
String logisticNo = queryInfo.getString("logisticNo");
|
||||
String sign = queryInfo.getString("sign");
|
||||
|
||||
// 2. 参数校验
|
||||
if (StringUtils.isAnyEmpty(appId, appKey, logisticNo, sign)) {
|
||||
JSONObject errorResponse = new JSONObject();
|
||||
errorResponse.put("code", 1);
|
||||
errorResponse.put("message", "参数不完整");
|
||||
errorResponse.put("data", "[]");
|
||||
return errorResponse;
|
||||
}
|
||||
|
||||
// 3. 验证签名
|
||||
if (!emisCustomerSignService.verifySign(appId, appKey, logisticNo, sign)) {
|
||||
JSONObject errorResponse = new JSONObject();
|
||||
errorResponse.put("code", 1);
|
||||
errorResponse.put("message", "签名验证失败");
|
||||
errorResponse.put("data", "[]");
|
||||
return errorResponse;
|
||||
}
|
||||
|
||||
// 4. 解码查询数据
|
||||
|
||||
// 5. 调用service处理查询
|
||||
Map<String, Object> result = emisWaybillService.queryWaybillInfo(logisticNo, appId);
|
||||
|
||||
// 6. 转换返回结果
|
||||
JSONObject response = new JSONObject();
|
||||
List<Map<String, Object>> resultList = (List<Map<String, Object>>) result.get("result");
|
||||
|
||||
// 构建返回的data数据
|
||||
JSONArray dataArray = new JSONArray();
|
||||
if (resultList != null) {
|
||||
for (Map<String, Object> item : resultList) {
|
||||
JSONObject dataItem = new JSONObject();
|
||||
// 订单基本信息
|
||||
dataItem.put("orderNo", item.get("orderNo"));
|
||||
dataItem.put("logisticNo", item.get("logisticNo"));
|
||||
dataItem.put("orderDate", item.get("orderDate"));
|
||||
dataItem.put("intoWarehouseBillCode", item.get("intoWarehouseBillCode"));
|
||||
dataItem.put("intoWarehouseName", item.get("intoWarehouseName"));
|
||||
dataItem.put("intoWarehouseContact", item.get("intoWarehouseContact"));
|
||||
dataItem.put("intoWarehousePhone", item.get("intoWarehousePhone"));
|
||||
dataItem.put("intoWarehouseAddress", item.get("intoWarehouseAddress"));
|
||||
dataItem.put("pickStartDate", item.get("pickStartDate"));
|
||||
dataItem.put("sendDate", item.get("sendDate"));
|
||||
dataItem.put("blSign", item.get("blSign"));
|
||||
dataItem.put("orderStatus", item.get("orderStatus"));
|
||||
|
||||
// 运输信息
|
||||
dataItem.put("transLine", item.get("transLine"));
|
||||
dataItem.put("productType", item.get("productType"));
|
||||
dataItem.put("customsClear", item.get("customsClear"));
|
||||
dataItem.put("customsEclaration", item.get("customsEclaration"));
|
||||
dataItem.put("pickupMethod", item.get("pickupMethod"));
|
||||
dataItem.put("dispatchMethod", item.get("dispatchMethod"));
|
||||
dataItem.put("packType", item.get("packType"));
|
||||
dataItem.put("paymentType", item.get("paymentType"));
|
||||
dataItem.put("custNo", item.get("custNo"));
|
||||
dataItem.put("salemen", item.get("salemen"));
|
||||
|
||||
// 收件人信息
|
||||
dataItem.put("country", item.get("country"));
|
||||
dataItem.put("province", item.get("province"));
|
||||
dataItem.put("city", item.get("city"));
|
||||
dataItem.put("district", item.get("district"));
|
||||
dataItem.put("consignee", item.get("consignee"));
|
||||
dataItem.put("company", item.get("company"));
|
||||
dataItem.put("tel", item.get("tel"));
|
||||
dataItem.put("address", item.get("address"));
|
||||
dataItem.put("postCode", item.get("postCode"));
|
||||
|
||||
// 寄件人信息
|
||||
dataItem.put("sender", item.get("sender"));
|
||||
dataItem.put("senderCountry", item.get("senderCountry"));
|
||||
dataItem.put("senderProvince", item.get("senderProvince"));
|
||||
dataItem.put("senderCity", item.get("senderCity"));
|
||||
dataItem.put("senderDistrict", item.get("senderDistrict"));
|
||||
dataItem.put("senderCompany", item.get("senderCompany"));
|
||||
dataItem.put("senderTel", item.get("senderTel"));
|
||||
dataItem.put("senderAddress", item.get("senderAddress"));
|
||||
|
||||
// 包裹信息
|
||||
dataItem.put("batchNumber", item.get("batchNumber"));
|
||||
dataItem.put("parcelQty", item.get("parcelQty"));
|
||||
dataItem.put("weight", item.get("weight"));
|
||||
dataItem.put("volume", item.get("volume"));
|
||||
dataItem.put("goodsInfo", item.get("goodsInfo"));
|
||||
|
||||
// 其他信息
|
||||
dataItem.put("estimateFreight", item.get("estimateFreight"));
|
||||
dataItem.put("signDate", item.get("signDate"));
|
||||
dataItem.put("signMan", item.get("signMan"));
|
||||
dataItem.put("remark", item.get("remark"));
|
||||
|
||||
dataArray.add(dataItem);
|
||||
}
|
||||
}
|
||||
|
||||
// 设置返回状态
|
||||
response.put("code", 0); // 查询成功
|
||||
response.put("message", "查询成功");
|
||||
response.put("data", dataArray.toJSONString());
|
||||
|
||||
return response;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
JSONObject response = new JSONObject();
|
||||
response.put("code", 1);
|
||||
response.put("message", ex instanceof EmisBizError ? ex.getMessage() : "查询异常,请联系客服");
|
||||
response.put("data", "[]");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 对接客户接口-查询物流轨迹信息
|
||||
*/
|
||||
@PostMapping("/queryCustomerTraceInfo")
|
||||
@ResponseBody
|
||||
public JSONObject queryCustomerTraceInfo(@RequestBody JSONObject queryInfo) {
|
||||
try {
|
||||
if (queryInfo == null) {
|
||||
JSONObject errorResponse = new JSONObject();
|
||||
errorResponse.put("code", 1);
|
||||
errorResponse.put("message", "查询信息不能为空");
|
||||
errorResponse.put("data", "[]");
|
||||
return errorResponse;
|
||||
}
|
||||
|
||||
// 1. 获取参数
|
||||
String appId = queryInfo.getString("appId");
|
||||
String appKey = queryInfo.getString("appKey");
|
||||
String logisticNo = queryInfo.getString("logisticNo");
|
||||
String lang = queryInfo.getString("lang");
|
||||
String sign = queryInfo.getString("sign");
|
||||
|
||||
// 2. 参数校验
|
||||
if (StringUtils.isAnyEmpty(appId, appKey, logisticNo, sign)) {
|
||||
JSONObject errorResponse = new JSONObject();
|
||||
errorResponse.put("code", 1);
|
||||
errorResponse.put("message", "参数不完整");
|
||||
errorResponse.put("data", "[]");
|
||||
return errorResponse;
|
||||
}
|
||||
|
||||
// 3. 验证签名
|
||||
if (!emisCustomerSignService.verifySign(appId, appKey, logisticNo, sign)) {
|
||||
JSONObject errorResponse = new JSONObject();
|
||||
errorResponse.put("code", 1);
|
||||
errorResponse.put("message", "签名验证失败");
|
||||
errorResponse.put("data", "[]");
|
||||
return errorResponse;
|
||||
}
|
||||
|
||||
// 4. 调用service处理查询
|
||||
EmisWaybill emisWaybill = emisWaybillService.selectCustEmisWaybillByBillCode(logisticNo, appId);
|
||||
if (emisWaybill == null) {
|
||||
JSONObject errorResponse = new JSONObject();
|
||||
errorResponse.put("code", 1);
|
||||
errorResponse.put("message", "运单不存在");
|
||||
errorResponse.put("data", "[]");
|
||||
return errorResponse;
|
||||
}
|
||||
|
||||
// 获取轨迹信息
|
||||
List<Map> stepList = emisTmsScanRecordService.queryWaybillTraceInfo(logisticNo, lang, false);
|
||||
|
||||
// 构建返回数据
|
||||
JSONObject response = new JSONObject();
|
||||
JSONArray dataArray = new JSONArray();
|
||||
|
||||
JSONObject dataItem = new JSONObject();
|
||||
dataItem.put("logisticNo", logisticNo);
|
||||
dataItem.put("sendCountry", emisWaybill.getSendCountryName());
|
||||
dataItem.put("country", emisWaybill.getReceiveCountryName());
|
||||
dataItem.put("steps", stepList);
|
||||
dataArray.add(dataItem);
|
||||
|
||||
// 设置返回状态
|
||||
response.put("code", 0); // 查询成功
|
||||
response.put("message", "查询成功");
|
||||
response.put("data", dataArray.toJSONString());
|
||||
|
||||
return response;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
JSONObject response = new JSONObject();
|
||||
response.put("code", 1);
|
||||
response.put("message", ex instanceof EmisBizError ? ex.getMessage() : "查询异常,请联系客服");
|
||||
response.put("data", "[]");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 对接外部接口-更新运单信息
|
||||
*/
|
||||
@PostMapping("/updateWaybillInfo")
|
||||
@ResponseBody
|
||||
public JSONObject updateWaybillInfo(@RequestBody JSONObject orderInfo) {
|
||||
try {
|
||||
if (orderInfo == null) {
|
||||
JSONObject errorResponse = new JSONObject();
|
||||
errorResponse.put("code", 1);
|
||||
errorResponse.put("message", "订单信息不能为空");
|
||||
return errorResponse;
|
||||
}
|
||||
|
||||
// 1. 获取参数
|
||||
String appId = orderInfo.getString("appId");
|
||||
String appKey = orderInfo.getString("appKey");
|
||||
String orderBase64Data = orderInfo.getString("orderBase64Data");
|
||||
String sign = orderInfo.getString("sign");
|
||||
|
||||
// 2. 参数校验
|
||||
if (StringUtils.isAnyEmpty(appId, appKey, orderBase64Data, sign)) {
|
||||
JSONObject errorResponse = new JSONObject();
|
||||
errorResponse.put("code", 1);
|
||||
errorResponse.put("message", "参数不完整");
|
||||
return errorResponse;
|
||||
}
|
||||
|
||||
// 3. 验证签名
|
||||
if (!emisCustomerSignService.verifySign(appId, appKey, orderBase64Data, sign)) {
|
||||
JSONObject errorResponse = new JSONObject();
|
||||
errorResponse.put("code", 1);
|
||||
errorResponse.put("message", "签名验证失败");
|
||||
return errorResponse;
|
||||
}
|
||||
|
||||
// 4. 解码订单数据
|
||||
String orderDataStr = new String(Base64.getDecoder().decode(orderBase64Data), StandardCharsets.UTF_8);
|
||||
JSONObject orderData = JSONObject.parseObject(orderDataStr);
|
||||
|
||||
// 5. 调用service处理更新
|
||||
emisWaybillService.updateWaybillInfo(orderData, appId);
|
||||
|
||||
// 6. 返回成功响应
|
||||
JSONObject response = new JSONObject();
|
||||
response.put("code", 0);
|
||||
response.put("message", "更新成功");
|
||||
return response;
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
JSONObject response = new JSONObject();
|
||||
response.put("code", 1);
|
||||
response.put("message", ex instanceof EmisBizError ? ex.getMessage() : "处理异常,请联系客服");
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String appId = "APP17490075851304001";
|
||||
String appKey = "sDAbUqxjsWCbHGJlEi0bL3OXgB9SoyK4";
|
||||
String orderBase64Data = "W3sKICAib3JkZXJObyI6ICIxOTIxMDMwNzI3Njc2MTk4OTE0IiwKICAidHJhbnNMaW5lIjogIuafrOWflOWvqOmZhui/kCIsCiAgInByb2R1Y3RUeXBlIjogIumZhui/kOeJueaDoOi+viIsCiAgImN1c3RvbXNDbGVhciI6ICIzIiwKICAiY3VzdG9tc0VjbGFyYXRpb24iOiAiMyIsCiAgInBpY2t1cE1ldGhvZCI6ICIxIiwKICAiZGlzcGF0Y2hNZXRob2QiOiAiMSIsCiAgInBhY2tUeXBlIjogIjIiLAogICJwYXltZW50VHlwZSI6ICIyIiwKICAiY3VzdE5vIjogIlRMWjA1MTIzMDE2IiwKICAic2FsZW1lbiI6ICLnlLDlsI/ovokiLAogICJjb3VudHJ5IjogIuafrOWflOWvqCIsCiAgInByb3ZpbmNlIjogIumHkei+uSIsCiAgImNpdHkiOiAiIiwKICAiZGlzdHJpY3QiOiAiIiwKICAiY29uc2lnbmVlIjogIuWNjuS4sCIsCiAgImNvbXBhbnkiOiAi5Y2O5LiwU09LIEhVT04iLAogICJ0ZWwiOiAiMDk3NzU3MDI3NSIsCiAgImFkZHJlc3MiOiAiWWFucWluZyBJbmR1c3RyaWFsIFBhcmsgSUlJLCBLbS4zNCBSb2FkICM0IFNhbmdrcm9zIGNoZWF0IHZpbGxhZ2UsIFRyYXBlYW5nIEtvbmcgY29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W5kZXJBZGRyZXNzIjogIuaxn+iLj+ecgeW8oOWutua4r+W4guS6uuawkei3rzEyNeWPt+WbveazsOaWsOS4lue6quW5v+WcujI35qW8MSIsCiAgInBhcmNlbFF0eSI6IDEsCiAgIndlaWdodCI6IDEwMDAsCiAgImdvb2RzSW5mbyI6ICLpnaLovoXmlpkiCn0=";
|
||||
String securityKey = "M7SGAUenMSkYfBZR8t9FQjwqwbZCDaGY";
|
||||
String signStr = appId + appKey + orderBase64Data + securityKey;
|
||||
String generatedSign = DigestUtils.md5Hex(signStr);
|
||||
|
||||
@ -37,7 +37,7 @@ public class EmisTmsSiteBatchMissController extends BaseController {
|
||||
/**
|
||||
* 查询TMS漏组批次信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:tms:site:batch:miss:list')")
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisTmsSiteBatchMiss:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(EmisTmsSiteBatchMiss emisTmsSiteBatchMiss) {
|
||||
startPage();
|
||||
@ -73,7 +73,7 @@ public class EmisTmsSiteBatchMissController extends BaseController {
|
||||
/**
|
||||
* 导出TMS漏组批次信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:tms:site:batch:miss:export')")
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisTmsSiteBatchMiss:export')")
|
||||
@Log(title = "TMS漏组批次信息", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(EmisTmsSiteBatchMiss emisTmsSiteBatchMiss) {
|
||||
@ -86,7 +86,7 @@ public class EmisTmsSiteBatchMissController extends BaseController {
|
||||
/**
|
||||
* 获取TMS漏组批次信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:tms:site:batch:miss:query')")
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisTmsSiteBatchMiss:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(emisTmsSiteBatchMissService.selectEmisTmsSiteBatchMissById(id));
|
||||
@ -95,7 +95,7 @@ public class EmisTmsSiteBatchMissController extends BaseController {
|
||||
/**
|
||||
* 新增TMS漏组批次信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:tms:site:batch:miss:add')")
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisTmsSiteBatchMiss:add')")
|
||||
@Log(title = "TMS漏组批次信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EmisTmsSiteBatchMiss emisTmsSiteBatchMiss) {
|
||||
@ -105,7 +105,7 @@ public class EmisTmsSiteBatchMissController extends BaseController {
|
||||
/**
|
||||
* 修改TMS漏组批次信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:tms:site:batch:miss:edit')")
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisTmsSiteBatchMiss:edit')")
|
||||
@Log(title = "TMS漏组批次信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EmisTmsSiteBatchMiss emisTmsSiteBatchMiss) {
|
||||
@ -115,7 +115,7 @@ public class EmisTmsSiteBatchMissController extends BaseController {
|
||||
/**
|
||||
* 删除TMS漏组批次信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:tms:site:batch:miss:remove')")
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisTmsSiteBatchMiss:remove')")
|
||||
@Log(title = "TMS漏组批次信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
|
||||
@ -57,6 +57,14 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
||||
*/
|
||||
public List<EmisWaybill> selectEmisWaybillList(EmisWaybill emisWaybill);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param emisWaybill
|
||||
* @return 集合
|
||||
*/
|
||||
public List<EmisWaybill> selectEmisWaybillListByExternal(EmisWaybill emisWaybill);
|
||||
|
||||
/**
|
||||
* 查询订单列表
|
||||
* @param emisWaybill
|
||||
@ -290,10 +298,12 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
||||
List<EmisWaybill> selectWaybillListBySiteBatchStatus(@Param("offset") int offset, @Param("pageSize") int pageSize);
|
||||
|
||||
/**
|
||||
* 根据客户单号查运单
|
||||
* 查询客户运单信息
|
||||
*
|
||||
* @param custOrderId
|
||||
* @param queryWaybill
|
||||
* @return
|
||||
*/
|
||||
EmisWaybill selectCustEmisWaybillByBillCode(EmisWaybill queryWaybill);
|
||||
|
||||
EmisWaybill selectEmisWaybillByCustOrderId(String custOrderId);
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xdadan.erp.common.core.audit.IDataAuditService;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybill;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
@ -261,4 +262,31 @@ public interface IEmisWaybillService extends IDataAuditService
|
||||
*/
|
||||
Map<String, Object> processOrderToWaybill(JSONArray orderInfo, String appId) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 查询运单信息
|
||||
*
|
||||
* @param logisticNo 运单号
|
||||
* @param appId 应用ID
|
||||
* @return 查询结果
|
||||
* @throws EmisBizError 业务异常
|
||||
*/
|
||||
Map<String, Object> queryWaybillInfo(String logisticNo, String appId) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 查询客户运单信息
|
||||
*
|
||||
* @param logisticNo
|
||||
* @param appId
|
||||
* @return
|
||||
*/
|
||||
EmisWaybill selectCustEmisWaybillByBillCode(String logisticNo, String appId);
|
||||
|
||||
/**
|
||||
* 更新运单信息
|
||||
*
|
||||
* @param orderData 订单数据
|
||||
* @param appId 应用ID
|
||||
* @throws EmisBizError 业务异常
|
||||
*/
|
||||
void updateWaybillInfo(JSONObject orderData, String appId) throws EmisBizError;
|
||||
}
|
||||
|
||||
@ -31,6 +31,7 @@ import com.xdadan.erp.emis.mapper.*;
|
||||
import com.xdadan.erp.emis.service.EmisBaseService;
|
||||
import com.xdadan.erp.emis.utils.Kd100Helper;
|
||||
import com.xdadan.erp.emis.utils.WaybillHelper;
|
||||
import jodd.util.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -2661,6 +2662,9 @@ public class EmisTmsScanRecordServiceImpl extends EmisBaseService implements IEm
|
||||
Map<String, Object> step = new HashMap<>();
|
||||
step.put("time", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,scanRecord.getScanDate()));
|
||||
step.put("status",scanRecord.getScanType());
|
||||
if (StringUtil.isNotBlank(scanRecord.getScanType())) {
|
||||
step.put("scanType", DictUtils.getDictLabel("emis_scan_type", scanRecord.getScanType()));
|
||||
}
|
||||
step.put("content", content);
|
||||
stepList.add(step);
|
||||
}
|
||||
|
||||
@ -49,6 +49,7 @@ package com.xdadan.erp.emis.service.impl;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
@ -60,6 +61,7 @@ package com.xdadan.erp.emis.service.impl;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.LocalDate;
|
||||
@ -5026,6 +5028,87 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
// }
|
||||
}
|
||||
|
||||
private void cvtWaybillByUpdateExternal(EmisWaybill emisWaybillSave) throws EmisBizError {
|
||||
|
||||
// 线路转换
|
||||
EmisTransLine transLine = getTransLineByName(emisWaybillSave.getTransLineType());
|
||||
if (transLine == null) {
|
||||
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "线路不正确");
|
||||
}
|
||||
emisWaybillSave.setTransLineType(transLine.getLineCode());
|
||||
|
||||
// 产品转换
|
||||
EmisTransProduct transProduct = getTransProductByName(transLine.getLineCode(),
|
||||
emisWaybillSave.getProductType());
|
||||
if (transProduct == null) {
|
||||
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "产品不正确");
|
||||
}
|
||||
emisWaybillSave.setProductType(transProduct.getProdCode());
|
||||
|
||||
// 收件国家省市区转换
|
||||
String receiveCountryCode = getCountryCodeByName(emisWaybillSave.getReceiveCountry());
|
||||
if (receiveCountryCode == null) {
|
||||
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "收件国家不正确");
|
||||
}
|
||||
|
||||
String rcvProviceCode = getChildRegionCodeByName(receiveCountryCode, null,
|
||||
emisWaybillSave.getReceiveProvince());
|
||||
if (rcvProviceCode == null) {
|
||||
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "收件省不正确");
|
||||
}
|
||||
|
||||
String rcvCityCode = null;
|
||||
if (!StringUtils.isEmpty(emisWaybillSave.getReceiveCity())) {
|
||||
rcvCityCode = getChildRegionCodeByName(receiveCountryCode, rcvProviceCode,
|
||||
emisWaybillSave.getReceiveCity());
|
||||
}
|
||||
|
||||
String rcvDistrictCode = null;
|
||||
if (!StringUtils.isEmpty(emisWaybillSave.getReceiveCounty())) {
|
||||
rcvDistrictCode = getChildRegionCodeByName(receiveCountryCode, rcvCityCode,
|
||||
emisWaybillSave.getReceiveCounty());
|
||||
}
|
||||
|
||||
emisWaybillSave.setReceiveCountry(receiveCountryCode);
|
||||
emisWaybillSave.setReceiveProvince(rcvProviceCode);
|
||||
emisWaybillSave.setReceiveCity(rcvCityCode);
|
||||
emisWaybillSave.setReceiveCounty(rcvDistrictCode);
|
||||
|
||||
// 寄件国家省市区
|
||||
String sendCountryCode = getCountryCodeByName(emisWaybillSave.getSendCountry());
|
||||
if (sendCountryCode == null) {
|
||||
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "寄件国家不正确");
|
||||
}
|
||||
String sendProviceCode = getChildRegionCodeByName(sendCountryCode, null, emisWaybillSave.getSendProvince());
|
||||
if (sendProviceCode == null) {
|
||||
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "寄件省不正确");
|
||||
}
|
||||
|
||||
String sendCityCode = null;
|
||||
if (!StringUtils.isEmpty(emisWaybillSave.getSendCity())) {
|
||||
sendCityCode = getChildRegionCodeByName(sendCountryCode, sendProviceCode, emisWaybillSave.getSendCity());
|
||||
}
|
||||
String sendDistrictCode = null;
|
||||
if (!StringUtils.isEmpty(emisWaybillSave.getSendCounty())) {
|
||||
sendDistrictCode = getChildRegionCodeByName(sendCountryCode, sendCityCode, emisWaybillSave.getSendCounty());
|
||||
}
|
||||
|
||||
emisWaybillSave.setSendCountry(sendCountryCode);
|
||||
emisWaybillSave.setSendProvince(sendProviceCode);
|
||||
emisWaybillSave.setSendCity(sendCityCode);
|
||||
emisWaybillSave.setSendCounty(sendDistrictCode);
|
||||
|
||||
// // 获取月结客户的编码和名称
|
||||
// EmisCustomerUser emisCustomerUser = getCustomerUserByMonthlyPayCode(emisWaybillSave.getCustNo());
|
||||
// if (emisCustomerUser == null) {
|
||||
// throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "月结客户不存在");
|
||||
// }
|
||||
// emisWaybillSave.setCustomerCode(emisCustomerUser.getCustomerCode());
|
||||
// emisWaybillSave.setPayee(emisCustomerUser.getPayee());
|
||||
// emisWaybillSave.setSalesmen(emisCustomerUser.getSalesmen());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 新开单-外部
|
||||
*
|
||||
@ -5498,6 +5581,238 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryWaybillInfo(String logisticNo, String appId) throws EmisBizError {
|
||||
// 1. 构建查询条件
|
||||
EmisWaybill queryWaybill = new EmisWaybill();
|
||||
|
||||
EmisCustomerSign emisCustomerSign = emisCustomerSignMapper.selectEmisCustomerSignByAppId(appId);
|
||||
queryWaybill.setCustNo(emisCustomerSign.getCustNo());
|
||||
queryWaybill.setBillCode(logisticNo);
|
||||
|
||||
// 2. 执行查询
|
||||
List<EmisWaybill> waybillList = emisWaybillMapper.selectEmisWaybillListByExternal(queryWaybill);
|
||||
|
||||
// 3. 转换结果
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
for (EmisWaybill waybill : waybillList) {
|
||||
Map<String, Object> resultItem = new HashMap<>();
|
||||
|
||||
// 订单基本信息
|
||||
resultItem.put("orderNo", waybill.getCustOrderId());
|
||||
resultItem.put("logisticNo", waybill.getBillCode());
|
||||
resultItem.put("orderDate",
|
||||
DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, waybill.getOrderDate()));
|
||||
resultItem.put("intoWarehouseBillCode", waybill.getIntoWarehouseBillCode());
|
||||
|
||||
// 获取仓库信息
|
||||
if (StringUtils.isNotEmpty(waybill.getIntoWarehouseCode())) {
|
||||
EmisSite warehouse = getSiteByCode(waybill.getIntoWarehouseCode());
|
||||
if (warehouse != null) {
|
||||
resultItem.put("intoWarehouseName", warehouse.getSiteName());
|
||||
resultItem.put("intoWarehouseContact", warehouse.getManager());
|
||||
resultItem.put("intoWarehousePhone", warehouse.getManagerPhone());
|
||||
resultItem.put("intoWarehouseAddress", warehouse.getAddress());
|
||||
}
|
||||
}
|
||||
|
||||
resultItem.put("blSign", waybill.getBlSign());
|
||||
resultItem.put("orderStatus", waybill.getOrderStatus());
|
||||
|
||||
// 运输信息
|
||||
resultItem.put("transLine", waybill.getTransLineTypeName());
|
||||
resultItem.put("productType", waybill.getProductTypeName());
|
||||
// resultItem.put("customsClear", DictUtils.getDictLabel("emis_customs_clear",
|
||||
// waybill.getCustomsClear()));
|
||||
// resultItem.put("customsEclaration",
|
||||
// DictUtils.getDictLabel("emis_declare_mode", waybill.getCustomsEclaration()));
|
||||
// resultItem.put("pickupMethod", DictUtils.getDictLabel("emis_qujian_fangshi",
|
||||
// waybill.getPickupMethod()));
|
||||
// resultItem.put("dispatchMethod",
|
||||
// DictUtils.getDictLabel("emis_tab_dispatch_mode",
|
||||
// waybill.getDispatchMethod()));
|
||||
// resultItem.put("packType", DictUtils.getDictLabel("emis_tab_packing_type",
|
||||
// waybill.getPackType()));
|
||||
// resultItem.put("paymentType", DictUtils.getDictLabel("emis_payment_type",
|
||||
// waybill.getPaymentType()));
|
||||
resultItem.put("customsClear", waybill.getCustomsClear());
|
||||
resultItem.put("customsEclaration", waybill.getCustomsEclaration());
|
||||
resultItem.put("pickupMethod", waybill.getPickupMethod());
|
||||
resultItem.put("dispatchMethod", waybill.getDispatchMethod());
|
||||
resultItem.put("packType", waybill.getPackType());
|
||||
resultItem.put("paymentType", waybill.getPaymentType());
|
||||
resultItem.put("custNo", waybill.getCustNo());
|
||||
resultItem.put("salemen", waybill.getSalesmen());
|
||||
|
||||
// 收件人信息
|
||||
resultItem.put("country", waybill.getReceiveCountryName());
|
||||
resultItem.put("province", waybill.getReceiveProvinceName());
|
||||
resultItem.put("city", waybill.getReceiveCityName());
|
||||
resultItem.put("district", waybill.getReceiveCountyName());
|
||||
resultItem.put("consignee", waybill.getReceiveName());
|
||||
resultItem.put("company", waybill.getReceiveCompany());
|
||||
resultItem.put("tel", waybill.getReceiveMobile());
|
||||
resultItem.put("address", waybill.getReceiveAddress());
|
||||
resultItem.put("postCode", waybill.getReceivePostcode());
|
||||
|
||||
// 寄件人信息
|
||||
resultItem.put("sender", waybill.getSendName());
|
||||
resultItem.put("senderCountry", waybill.getSendCountryName());
|
||||
resultItem.put("senderProvince", waybill.getSendProvinceName());
|
||||
resultItem.put("senderCity", waybill.getSendCityName());
|
||||
resultItem.put("senderDistrict", waybill.getSendCountyName());
|
||||
resultItem.put("senderCompany", waybill.getSendCompany());
|
||||
resultItem.put("senderTel", waybill.getSendMobile());
|
||||
resultItem.put("senderAddress", waybill.getSendAddress());
|
||||
|
||||
// 包裹信息
|
||||
resultItem.put("parcelQty", waybill.getParcelQty());
|
||||
if (waybill.getBillWeight() != null) {
|
||||
resultItem.put("weight", waybill.getBillWeight().setScale(2, RoundingMode.HALF_UP));
|
||||
|
||||
}
|
||||
if (waybill.getSettlementWeight() != null) {
|
||||
resultItem.put("settlementWeight", waybill.getSettlementWeight().setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (waybill.getTotalVolume() != null) {
|
||||
resultItem.put("volume", waybill.getTotalVolume().setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
resultItem.put("goodsInfo", waybill.getGoodsInfo());
|
||||
|
||||
// 其他信息
|
||||
resultItem.put("estimateFreight", waybill.getFreight().setScale(2, RoundingMode.HALF_UP));
|
||||
if (waybill.getSignDate() != null) {
|
||||
resultItem.put("signDate",
|
||||
DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, waybill.getSignDate()));
|
||||
}
|
||||
resultItem.put("signMan", waybill.getSignMan());
|
||||
resultItem.put("remark", waybill.getRemark());
|
||||
|
||||
resultList.add(resultItem);
|
||||
}
|
||||
|
||||
// 4. 返回结果
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("result", resultList);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmisWaybill selectCustEmisWaybillByBillCode(String logisticNo, String appId) {
|
||||
if (StringUtils.isAnyBlank(logisticNo, appId)) {
|
||||
return null;
|
||||
}
|
||||
EmisCustomerSign emisCustomerSign = emisCustomerSignMapper.selectEmisCustomerSignByAppId(appId);
|
||||
if (emisCustomerSign == null) {
|
||||
return null;
|
||||
}
|
||||
EmisWaybill queryWaybill = new EmisWaybill();
|
||||
queryWaybill.setCustNo(emisCustomerSign.getCustNo());
|
||||
queryWaybill.setBillCode(logisticNo);
|
||||
return emisWaybillMapper.selectCustEmisWaybillByBillCode(queryWaybill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWaybillInfo(JSONObject orderData, String appId) throws EmisBizError {
|
||||
// 1. 获取订单号
|
||||
String logisticNo = orderData.getString("logisticNo");
|
||||
if (StringUtils.isEmpty(logisticNo)) {
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "运单号不能为空");
|
||||
}
|
||||
|
||||
// 2. 查询原运单信息
|
||||
EmisWaybill oldWaybill = selectCustEmisWaybillByBillCode(logisticNo,appId);
|
||||
if (oldWaybill == null) {
|
||||
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "运单不存在");
|
||||
}
|
||||
|
||||
// 3. 检查运单状态
|
||||
if (OrderStatus.CANCEL.statusCode.equals(oldWaybill.getOrderStatus())) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "已取消,不能修改");
|
||||
}
|
||||
if (!"0".equals(oldWaybill.getOrderStatus())) {
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "已揽件,不能修改!");
|
||||
}
|
||||
|
||||
// 4. 构建更新对象
|
||||
EmisWaybill waybillUpdate = new EmisWaybill();
|
||||
BeanUtils.copyProperties(oldWaybill, waybillUpdate);
|
||||
|
||||
// 5. 更新基本信息
|
||||
waybillUpdate.setTransLineType(orderData.getString("transLine"));
|
||||
waybillUpdate.setProductType(orderData.getString("productType"));
|
||||
waybillUpdate.setCustomsClear(orderData.getString("customsClear"));
|
||||
waybillUpdate.setCustomsEclaration(orderData.getString("customsEclaration"));
|
||||
waybillUpdate.setPickupMethod(orderData.getString("pickupMethod"));
|
||||
waybillUpdate.setDispatchMethod(orderData.getString("dispatchMethod"));
|
||||
waybillUpdate.setPackType(orderData.getString("packType"));
|
||||
waybillUpdate.setPaymentType(orderData.getString("paymentType"));
|
||||
// waybillUpdate.setCustNo(orderData.getString("custNo"));
|
||||
// waybillUpdate.setSalesmen(orderData.getString("salemen"));
|
||||
|
||||
// 6. 更新收件人信息
|
||||
waybillUpdate.setReceiveCountry(orderData.getString("country"));
|
||||
waybillUpdate.setReceiveProvince(orderData.getString("province"));
|
||||
waybillUpdate.setReceiveCity(orderData.getString("city"));
|
||||
waybillUpdate.setReceiveCounty(orderData.getString("district"));
|
||||
waybillUpdate.setReceiveName(orderData.getString("consignee"));
|
||||
waybillUpdate.setReceiveCompany(orderData.getString("company"));
|
||||
waybillUpdate.setReceiveTel(orderData.getString("tel"));
|
||||
waybillUpdate.setReceiveAddress(orderData.getString("address"));
|
||||
waybillUpdate.setReceivePostcode(orderData.getString("postCode"));
|
||||
|
||||
// 7. 更新寄件人信息
|
||||
waybillUpdate.setSendName(orderData.getString("sender"));
|
||||
waybillUpdate.setSendCountry(orderData.getString("senderCountry"));
|
||||
waybillUpdate.setSendProvince(orderData.getString("senderProvince"));
|
||||
waybillUpdate.setSendCity(orderData.getString("senderCity"));
|
||||
waybillUpdate.setSendCounty(orderData.getString("senderDistrict"));
|
||||
waybillUpdate.setSendCompany(orderData.getString("senderCompany"));
|
||||
waybillUpdate.setSendTel(orderData.getString("senderTel"));
|
||||
waybillUpdate.setSendAddress(orderData.getString("senderAddress"));
|
||||
|
||||
// 8. 更新包裹信息
|
||||
waybillUpdate.setParcelQty(orderData.getInteger("parcelQty"));
|
||||
waybillUpdate.setBillWeight(orderData.getBigDecimal("weight"));
|
||||
waybillUpdate.setTotalVolume(orderData.getBigDecimal("volume"));
|
||||
waybillUpdate.setGoodsInfo(orderData.getString("goodsInfo"));
|
||||
waybillUpdate.setOrderRemark(orderData.getString("remark"));
|
||||
|
||||
// 9. 更新货物信息
|
||||
String goods = orderData.getString("goods");
|
||||
// 处理goods信息
|
||||
List<EmisWaybillDeclareGoods> declareGoodsList = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(goods)) {
|
||||
JSONArray goodsArray = JSON.parseArray(goods);
|
||||
if (CollectionUtil.isNotEmpty(goodsArray)) {
|
||||
for (int j = 0; j < goodsArray.size(); j++) {
|
||||
JSONObject goodsItem = goodsArray.getJSONObject(j);
|
||||
EmisWaybillDeclareGoods declareGoods = new EmisWaybillDeclareGoods();
|
||||
declareGoods.setHscode(goodsItem.getString("itemNo"));
|
||||
declareGoods.setGoodsName(goodsItem.getString("name"));
|
||||
declareGoods.setBrand(goodsItem.getString("brand"));
|
||||
declareGoods.setGoodsModel(goodsItem.getString("model"));
|
||||
declareGoods.setBarcode(goodsItem.getString("barcode"));
|
||||
declareGoods.setHscode(goodsItem.getString("hscode"));
|
||||
declareGoods.setCargoQty(BigDecimal.valueOf(goodsItem.getInteger("qty")));
|
||||
declareGoods.setPrice(goodsItem.getBigDecimal("price"));
|
||||
declareGoods.setUnit(goodsItem.getString("unit"));
|
||||
declareGoods.setMaterial(goodsItem.getString("texture"));
|
||||
declareGoods.setPurpose(goodsItem.getString("purpose"));
|
||||
declareGoods.setNationArea(goodsItem.getString("nativeCountry"));
|
||||
declareGoodsList.add(declareGoods);
|
||||
}
|
||||
}
|
||||
}
|
||||
waybillUpdate.setDeclareGoodsList(declareGoodsList);
|
||||
|
||||
cvtWaybillByUpdateExternal(waybillUpdate);
|
||||
|
||||
waybillUpdate.setId(oldWaybill.getId());
|
||||
waybillUpdate.setCustomerCode(oldWaybill.getCustomerCode());
|
||||
reUpdateWayBillByOms(oldWaybill, waybillUpdate);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1482,6 +1482,362 @@
|
||||
createDay
|
||||
</select>
|
||||
|
||||
<select id="selectEmisWaybillListByExternal" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
|
||||
<include refid="selectEmisWaybillVo"/>
|
||||
<where>
|
||||
a.del_flag='0'
|
||||
<if test="id != null "> and a.id = #{id}</if>
|
||||
|
||||
<if test="orderSn != null and orderSn != ''"> and ( FIND_IN_SET(`order_sn`,#{orderSn}) or order_sn like concat('%', #{orderSn}, '%') ) </if>
|
||||
|
||||
<if test="billCode != null and billCode != '' and ( params.billCodeSortList == null or (params.billCodeSortList != null and params.billCodeSortList.size() == 1 ) )">
|
||||
and ( a.`bill_code`=#{billCode} or a.bill_code like concat('%',#{billCode}) )
|
||||
</if>
|
||||
<if test="params.billCodeSortList != null and params.billCodeSortList.size() > 1 ">
|
||||
and a.bill_code in
|
||||
<foreach collection="params.billCodeSortList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="custOrderId != null and custOrderId != ''"> and cust_order_id=#{custOrderId}</if>
|
||||
<if test="billCodeSub != null and billCodeSub != ''"> and bill_code_sub like concat('%', #{billCodeSub}, '%')</if>
|
||||
<if test="orderStatus != null and orderStatus != ''"> and order_status=#{orderStatus}</if>
|
||||
<if test="waybillStatus != null and waybillStatus != ''"> and waybill_status=#{waybillStatus}</if>
|
||||
<if test="orderType != null and orderType != ''"> and order_type=#{orderType}</if>
|
||||
<if test="orderDate != null "> and order_date = #{orderDate}</if>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="customerCode != null and customerCode != ''"> and customer_code=#{customerCode}</if>
|
||||
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
|
||||
<if test="openId != null and openId != ''"> and open_id like concat('%', #{openId}, '%')</if>
|
||||
<if test="receiveName != null and receiveName != ''"> and receive_name like concat('%', #{receiveName}, '%')</if>
|
||||
<if test="receiveCompany != null and receiveCompany != ''"> and receive_company like concat('%', #{receiveCompany}, '%')</if>
|
||||
<if test="receiveMobile != null and receiveMobile != ''"> and receive_mobile like concat('%', #{receiveMobile}, '%')</if>
|
||||
<if test="receiveTel != null and receiveTel != ''"> and receive_tel like concat('%', #{receiveTel}, '%')</if>
|
||||
<if test="receiveCountry != null and receiveCountry != ''"> and receive_country=#{receiveCountry}</if>
|
||||
<if test="receiveProvince != null and receiveProvince != ''"> and receive_province=#{receiveProvince}</if>
|
||||
<if test="receiveCity != null and receiveCity != ''"> and receive_city=#{receiveCity}</if>
|
||||
<if test="receiveCounty != null and receiveCounty != ''"> and receive_county=#{receiveCounty}</if>
|
||||
<if test="receiveTown != null and receiveTown != ''"> and receive_town=#{receiveTown}</if>
|
||||
<if test="receiveAddress != null and receiveAddress != ''"> and receive_address like concat('%', #{receiveAddress}, '%')</if>
|
||||
<if test="receivePostcode != null and receivePostcode != ''"> and receive_postcode like concat('%', #{receivePostcode}, '%')</if>
|
||||
<if test="receivePcd != null and receivePcd != ''"> and receive_pcd like concat('%', #{receivePcd}, '%')</if>
|
||||
<if test="sendName != null and sendName != ''"> and send_name like concat('%', #{sendName}, '%')</if>
|
||||
<if test="sendCompany != null and sendCompany != ''"> and send_company like concat('%', #{sendCompany}, '%')</if>
|
||||
<if test="sendMobile != null and sendMobile != ''"> and send_mobile like concat('%', #{sendMobile}, '%')</if>
|
||||
<if test="sendTel != null and sendTel != ''"> and send_tel like concat('%', #{sendTel}, '%')</if>
|
||||
<if test="sendCountry != null and sendCountry != ''"> and send_country=#{sendCountry}</if>
|
||||
<if test="sendProvince != null and sendProvince != ''"> and send_province=#{sendProvince}</if>
|
||||
<if test="sendCity != null and sendCity != ''"> and send_city=#{sendCity}</if>
|
||||
<if test="sendCounty != null and sendCounty != ''"> and send_county=#{sendCounty}</if>
|
||||
<if test="sendTown != null and sendTown != ''"> and send_town=#{sendTown}</if>
|
||||
<if test="sendAddress != null and sendAddress != ''"> and send_address like concat('%', #{sendAddress}, '%')</if>
|
||||
<if test="sendPostcode != null and sendPostcode != ''"> and send_postcode like concat('%', #{sendPostcode}, '%')</if>
|
||||
<if test="paymentType != null and paymentType != ''"> and FIND_IN_SET(payment_type,#{paymentType})</if>
|
||||
<if test="calcFeeType != null and calcFeeType != ''"> and calc_fee_type=#{calcFeeType}</if>
|
||||
<if test="custNo != null and custNo != ''"> and cust_no like concat('%', #{custNo}, '%')</if>
|
||||
<if test="custName != null and custName != ''"> and cust_name like concat('%', #{custName}, '%')</if>
|
||||
<if test="transLineType != null and transLineType != ''"> and trans_line_type=#{transLineType}</if>
|
||||
<if test="productType != null and productType != ''"> and product_type=#{productType}</if>
|
||||
<if test="timeType != null and timeType != ''"> and time_type like concat('%', #{timeType}, '%')</if>
|
||||
<if test="meterType != null and meterType != ''"> and meter_type=#{meterType}</if>
|
||||
<if test="carryType != null and carryType != ''">and FIND_IN_SET(a.carry_type,#{carryType})</if>
|
||||
<if test="customsClear != null and customsClear != ''"> and customs_clear=#{customsClear}</if>
|
||||
<if test="customsEclaration != null and customsEclaration != ''"> and customs_eclaration=#{customsEclaration}</if>
|
||||
<if test="estimateDate != null "> and estimate_date = #{estimateDate}</if>
|
||||
<if test="packType != null and packType != ''"> and FIND_IN_SET(#{packType},pack_type)</if>
|
||||
<if test="dispatchMethod != null and dispatchMethod != ''"> and dispatch_method=#{dispatchMethod}</if>
|
||||
<if test="pickupMethod != null and pickupMethod != ''"> and pickup_method= #{pickupMethod}</if>
|
||||
<if test="pickStartDate != null "> and pick_start_date = #{pickStartDate}</if>
|
||||
<if test="pickFinishDate != null "> and pick_finish_date = #{pickFinishDate}</if>
|
||||
<if test="pickFailReason != null and pickFailReason != ''"> and pick_fail_reason like concat('%', #{pickFailReason}, '%')</if>
|
||||
<if test="intoWarehouseCode != null and intoWarehouseCode != ''"> and into_warehouse_code like concat('%', #{intoWarehouseCode}, '%')</if>
|
||||
<if test="intoWarehouseName != null and intoWarehouseName != ''"> and into_warehouse_name like concat('%', #{intoWarehouseName}, '%')</if>
|
||||
<if test="intoWarehouseAddress != null and intoWarehouseAddress != ''"> and into_warehouse_address like concat('%', #{intoWarehouseAddress}, '%')</if>
|
||||
<if test="intoWarehouseContact != null and intoWarehouseContact != ''"> and into_warehouse_contact like concat('%', #{intoWarehouseContact}, '%')</if>
|
||||
<if test="intoWarehousePhone != null and intoWarehousePhone != ''"> and into_warehouse_phone like concat('%', #{intoWarehousePhone}, '%')</if>
|
||||
<if test="intoWarehouseBillCode != null and intoWarehouseBillCode != ''"> and into_warehouse_bill_code like concat('%', #{intoWarehouseBillCode}, '%')</if>
|
||||
<if test="warehouseInNo != null and warehouseInNo != ''"> and warehouse_in_no like concat('%', #{warehouseInNo}, '%')</if>
|
||||
<if test="customerDeliveryBeginTime != null and customerDeliveryBeginTime != ''"> and customer_delivery_begin_time like concat('%', #{customerDeliveryBeginTime}, '%')</if>
|
||||
<if test="customerDeliveryEndTime != null and customerDeliveryEndTime != ''"> and customer_delivery_end_time like concat('%', #{customerDeliveryEndTime}, '%')</if>
|
||||
<if test="goodsInfo != null and goodsInfo != ''"> and goods_info like concat('%', #{goodsInfo}, '%')</if>
|
||||
<if test="blPrepareInFreight != null and blPrepareInFreight != ''"> and bl_prepare_in_freight=#{blPrepareInFreight}</if>
|
||||
<if test="prepareInEstFee != null "> and prepare_in_est_fee = #{prepareInEstFee}</if>
|
||||
<if test="prepareInRealFee != null "> and prepare_in_real_fee = #{prepareInRealFee}</if>
|
||||
<if test="prepareInExpress != null and prepareInExpress != ''"> and prepare_in_express like concat('%', #{prepareInExpress}, '%')</if>
|
||||
<if test="prepareInBillCode != null and prepareInBillCode != ''"> and prepare_in_bill_code like concat('%', #{prepareInBillCode}, '%')</if>
|
||||
<if test="prepareInRemark != null and prepareInRemark != ''"> and prepare_in_remark like concat('%', #{prepareInRemark}, '%')</if>
|
||||
<if test="prepareInSupplier != null and prepareInSupplier != ''"> and prepare_in_supplier like concat('%', #{prepareInSupplier}, '%')</if>
|
||||
<if test="totalWeight != null "> and total_weight = #{totalWeight}</if>
|
||||
<if test="totalVolume != null "> and total_volume = #{totalVolume}</if>
|
||||
<if test="parcelQty != null "> and parcel_qty = #{parcelQty}</if>
|
||||
<if test="billWeight != null "> and bill_weight = #{billWeight}</if>
|
||||
<if test="volumeWeight != null "> and volume_weight = #{volumeWeight}</if>
|
||||
<if test="currency != null and currency != ''"> and currency= #{currency}</if>
|
||||
<if test="settlementWeight != null "> and settlement_weight = #{settlementWeight}</if>
|
||||
<if test="scanWeight != null "> and scan_weight = #{scanWeight}</if>
|
||||
<if test="feeWeight != null "> and fee_weight = #{feeWeight}</if>
|
||||
<if test="freight != null "> and freight = #{freight}</if>
|
||||
<if test="realPaymentType != null and realPaymentType != ''"> and real_payment_type=#{realPaymentType}</if>
|
||||
<if test="realFee != null "> and real_fee = #{realFee}</if>
|
||||
<if test="blSpecialQuote != null and blSpecialQuote != ''"> and bl_special_quote=#{blSpecialQuote}</if>
|
||||
<if test="blOverLong != null and blOverLong != ''"> and bl_over_long=#{blOverLong}</if>
|
||||
<if test="blBill != null and blBill != ''"> and bl_bill=#{blBill}</if>
|
||||
<if test="blBillText != null and blBillText != ''"> and bl_bill_text like concat('%', #{blBillText}, '%')</if>
|
||||
<if test="blOverWeight != null and blOverWeight != ''"> and bl_over_weight like concat('%', #{blOverWeight}, '%')</if>
|
||||
<if test="overWeightNumber != null and overWeightNumber != ''"> and over_weight_number like concat('%', #{overWeightNumber}, '%')</if>
|
||||
<if test="feeRemark != null and feeRemark != ''"> and fee_remark like concat('%', #{feeRemark}, '%')</if>
|
||||
<if test="thirdCode != null and thirdCode != ''"> and third_code like concat('%', #{thirdCode}, '%')</if>
|
||||
<if test="realValue != null and realValue != ''"> and real_value like concat('%', #{realValue}, '%')</if>
|
||||
<if test="blInsure != null and blInsure != ''"> and bl_insure= #{blInsure}</if>
|
||||
<if test="insureValue != null and insureValue != ''"> and insure_value like concat('%', #{insureValue}, '%')</if>
|
||||
<if test="insureValueCurrency != null and insureValueCurrency != ''"> and insure_value_currency like concat('%', #{insureValueCurrency}, '%')</if>
|
||||
<if test="insureFeeCurrency != null and insureFeeCurrency != ''"> and insure_fee_currency like concat('%', #{insureFeeCurrency}, '%')</if>
|
||||
<if test="insureFee != null "> and insure_fee = #{insureFee}</if>
|
||||
<if test="insureRemark != null and insureRemark != ''"> and insure_remark like concat('%', #{insureRemark}, '%')</if>
|
||||
<if test="insureSiteCode != null and insureSiteCode != ''"> and insure_site_code=#{insureSiteCode}</if>
|
||||
<if test="blPrint != null and blPrint != ''"> and bl_print=#{blPrint}</if>
|
||||
<if test="printManCode != null and printManCode != ''"> and print_man_code like concat('%', #{printManCode}, '%')</if>
|
||||
<if test="printSite != null and printSite != ''"> and print_site=#{printSite},</if>
|
||||
<if test="printDate != null and printDate != ''"> and print_date like concat('%', #{printDate}, '%')</if>
|
||||
<if test="blDispFd != null and blDispFd != ''"> and bl_disp_fd=#{blDispFd}</if>
|
||||
<if test="transferCode != null and transferCode != ''"> and transfer_code like concat('%', #{transferCode}, '%')</if>
|
||||
<if test="transferBillcode != null and transferBillcode != ''"> and transfer_billcode like concat('%', #{transferBillcode}, '%')</if>
|
||||
<if test="dispFdDate != null "> and disp_fd_date = #{dispFdDate}</if>
|
||||
<if test="dispFdReason != null and dispFdReason != ''"> and disp_fd_reason like concat('%', #{dispFdReason}, '%')</if>
|
||||
<if test="currentSiteCode != null and currentSiteCode != ''"> and current_site_code=#{currentSiteCode}</if>
|
||||
<if test="nextSiteCode != null and nextSiteCode != ''"> and next_site_code= #{nextSiteCode}</if>
|
||||
<if test="lastSiteCode != null and lastSiteCode != ''"> and last_site_code=#{lastSiteCode}</if>
|
||||
<if test="registerSiteCode != null and registerSiteCode != ''"> and register_site_code=#{registerSiteCode}</if>
|
||||
<if test="registerDate != null "> and register_date = #{registerDate}</if>
|
||||
<if test="registerManCode != null and registerManCode != ''"> and register_man_code= #{registerManCode}</if>
|
||||
<if test="takePieceEmployeeCode != null and takePieceEmployeeCode != ''"> and take_piece_employee_code=#{takePieceEmployeeCode}</if>
|
||||
|
||||
<if test="sendDate != null "> and send_date = #{sendDate}</if>
|
||||
<if test="dispatchManCode != null and dispatchManCode != ''"> and dispatch_man_code=#{dispatchManCode}</if>
|
||||
<if test="dispatchSiteCode != null and dispatchSiteCode != ''"> and dispatch_site_code=#{dispatchSiteCode}</if>
|
||||
<if test="produceBillDate != null "> and produce_bill_date = #{produceBillDate}</if>
|
||||
<if test="produceBillSiteCode != null and produceBillSiteCode != ''"> and produce_bill_site_code=#{produceBillSiteCode}</if>
|
||||
<if test="produceBillManCode != null and produceBillManCode != ''"> and produce_bill_man_code=#{produceBillManCode}</if>
|
||||
<if test="destinationCode != null and destinationCode != ''"> and destination_code =#{destinationCode}</if>
|
||||
<if test="destinationProvince != null and destinationProvince != ''"> and destination_province=#{destinationProvince}</if>
|
||||
<if test="destinationCity != null and destinationCity != ''"> and destination_city=#{destinationCity}</if>
|
||||
<if test="destinationCounty != null and destinationCounty != ''"> and destination_county=#{destinationCounty}</if>
|
||||
<if test="dispatchUnderlingSiteCode != null and dispatchUnderlingSiteCode != ''"> and dispatch_underling_site_code=#{dispatchUnderlingSiteCode}</if>
|
||||
<if test="destinationCenterCode != null and destinationCenterCode != ''"> and destination_center_code=#{destinationCenterCode}</if>
|
||||
<if test="marketManCode != null and marketManCode != ''"> and market_man_code = #{marketManCode}</if>
|
||||
<if test="payee != null and payee != ''"> and a.payee=#{payee}</if>
|
||||
<if test="salesmen != null and salesmen != ''"> and a.salesmen like concat('%', #{salesmen}, '%')</if>
|
||||
<if test="operateEmployeeCode != null and operateEmployeeCode != ''"> and operate_employee_code=#{operateEmployeeCode}</if>
|
||||
<if test="blIsQuestion != null and blIsQuestion != ''"> and bl_is_question=#{blIsQuestion}</if>
|
||||
<if test="problemType != null and problemType != ''"> and problem_type=#{problemType}</if>
|
||||
<if test="problemCause != null and problemCause != ''"> and problem_cause like concat('%', #{problemCause}, '%')</if>
|
||||
<if test="problemDelayDays != null "> and problem_delay_days = #{problemDelayDays}</if>
|
||||
<if test="blMessage != null and blMessage != ''"> and bl_message=#{blMessage}</if>
|
||||
<if test="blAcceptMessage != null and blAcceptMessage != ''"> and bl_accept_message=#{blAcceptMessage}</if>
|
||||
<if test="blGenSubbill != null and blGenSubbill != ''"> and bl_gen_subbill=#{blGenSubbill}</if>
|
||||
<if test="signMan != null and signMan != ''"> and sign_man like concat('%', #{signMan}, '%')</if>
|
||||
<if test="signManCode != null and signManCode != ''"> and sign_man_code=#{signManCode}</if>
|
||||
<if test="signSiteCode != null and signSiteCode != ''"> and sign_site_code=#{signSiteCode}</if>
|
||||
<if test="paymentStatus != null and paymentStatus != ''"> and FIND_IN_SET(payment_status,#{paymentStatus})</if>
|
||||
<if test="paymentDate != null "> and payment_date = #{paymentDate}</if>
|
||||
<if test="paymentRemark != null and paymentRemark != ''"> and payment_remark like concat('%', #{paymentRemark}, '%')</if>
|
||||
<if test="orderRemark != null and orderRemark != ''"> and order_remark like concat('%', #{orderRemark}, '%')</if>
|
||||
|
||||
<if test="sendSiteCode != null and sendSiteCode != ''"> and FIND_IN_SET(`send_site_code`,#{sendSiteCode})</if>
|
||||
|
||||
<if test="remark != null and remark != ''"> and a.remark like concat('%', #{remark}, '%')</if>
|
||||
<if test="createBy != null and createBy != ''"> and a.create_by= #{createBy}</if>
|
||||
<if test="updateBy != null and updateBy != ''"> and a.update_by=#{updateBy}</if>
|
||||
<if test="createSite != null and createSite != ''"> and a.create_site=#{createSite}</if>
|
||||
<if test="updateSite != null and updateSite != ''"> and a.update_site=#{updateSite}</if>
|
||||
|
||||
|
||||
<if test="params.problemQueryType != null and params.problemQueryType == 1 and params.problemQueryIds != null and params.problemQueryIds !=''">
|
||||
and exists (
|
||||
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and FIND_IN_SET( ewpi.`problem_type`, #{params.problemQueryIds} )
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="params.problemQueryType != null and params.problemQueryType == 2 and params.problemQueryIds != null and params.problemQueryIds !=''">
|
||||
and not exists (
|
||||
select 1 from emis_waybill_problem_info ewpi where a.bill_code=ewpi.bill_code and ewpi.del_flag='0' and FIND_IN_SET( ewpi.`problem_type`, #{params.problemQueryIds} )
|
||||
)
|
||||
</if>
|
||||
|
||||
|
||||
<if test="params.waybillStatType != null and params.waybillStatType == 1">
|
||||
and a.order_type='0'
|
||||
and a.waybill_status='0'
|
||||
and a.order_status in('0','3')
|
||||
and (
|
||||
a.take_piece_employee_code=#{params.privEmpCode}
|
||||
or (a.pickup_method in('1','3') and a.operate_employee_code is null )
|
||||
or (a.operate_employee_code=#{params.privEmpCode} )
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="params.waybillStatType != null and params.waybillStatType == 2">
|
||||
and a.waybill_status!='0' and a.order_status!='2'
|
||||
and (
|
||||
a.operate_employee_code=#{params.privEmpCode}
|
||||
or a.take_piece_employee_code=#{params.privEmpCode}
|
||||
or a.register_man_code=#{params.privEmpCode}
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="params.waybillStatType != null and params.waybillStatType == 3">
|
||||
and a.order_status='2'
|
||||
and (
|
||||
a.operate_employee_code=#{params.privEmpCode}
|
||||
or a.take_piece_employee_code=#{params.privEmpCode}
|
||||
)
|
||||
</if>
|
||||
|
||||
<!-- 转单 -->
|
||||
<if test="params.waybillStatType != null and params.waybillStatType == 4">
|
||||
and a.order_status in('0','3') and exists (
|
||||
select 1 from emis_waybill_change_to ewcto where a.bill_code=ewcto.bill_code and ewcto.change_from=#{params.privEmpCode}
|
||||
)
|
||||
</if>
|
||||
|
||||
|
||||
<if test="params.beginOrderDate != null and params.beginOrderDate != ''">
|
||||
and a.order_date <![CDATA[ >= ]]> #{params.beginOrderDate}
|
||||
</if>
|
||||
<if test="params.endOrderDate != null and params.endOrderDate != ''">
|
||||
and a.order_date <![CDATA[ <= ]]> #{params.endOrderDate}
|
||||
</if>
|
||||
|
||||
<if test="payee != null and payee != ''">
|
||||
and a.payee=#{payee}
|
||||
</if>
|
||||
|
||||
<if test="salesmen != null and salesmen != '' " >
|
||||
and a.salesmen=#{salesmen}
|
||||
</if>
|
||||
|
||||
<if test="blSign != null and blSign != ''">
|
||||
and a.bl_sign=#{blSign}
|
||||
</if>
|
||||
|
||||
<if test="params.beginDate != null and params.beginDate != ''">
|
||||
and a.send_date <![CDATA[ >= ]]> #{params.beginDate}
|
||||
</if>
|
||||
<if test="params.endDate != null and params.endDate != ''">
|
||||
and a.send_date <![CDATA[ <= ]]> #{params.endDate}
|
||||
</if>
|
||||
|
||||
<if test="params.blUploadGoodsPic != null and params.blUploadGoodsPic != '' and params.blUploadGoodsPic == 1">
|
||||
and a.goods_pics is not null
|
||||
</if>
|
||||
|
||||
<if test="params.blUploadGoodsPic != null and params.blUploadGoodsPic != '' and params.blUploadGoodsPic == 0">
|
||||
and a.goods_pics is null
|
||||
</if>
|
||||
|
||||
|
||||
<if test="params.beginSendDate != null and params.beginSendDate != ''">
|
||||
and a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
|
||||
</if>
|
||||
<if test="params.endSendDate != null and params.endSendDate != ''">
|
||||
and a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
|
||||
</if>
|
||||
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != ''">
|
||||
and a.create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
|
||||
</if>
|
||||
<if test="params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and a.create_time <![CDATA[ <= ]]> #{params.endCreateTime}
|
||||
</if>
|
||||
|
||||
<if test="params.expireNotSign != null and params.expireNotSign == 1">
|
||||
and a.estimate_date <![CDATA[ < ]]> now() and bl_sign!='1'
|
||||
</if>
|
||||
|
||||
<if test="params.printFlag != null ">
|
||||
and a.bl_print=#{params.printFlag}
|
||||
</if>
|
||||
|
||||
<if test="params.isNeedPack != null and params.isNeedPack == 1">
|
||||
and not EXISTS ( select 1 from emis_tms_pack_dtl etp where etp.del_flag='0' and etp.main_bill_code=a.bill_code )
|
||||
and a.trans_line_type in(
|
||||
select line_code from emis_trans_line etl where etl.trans_type=1
|
||||
)
|
||||
and bl_sign!='1' and waybill_status!='40'
|
||||
and a.send_site_code=#{params.privSiteCode} and a.current_site_code=#{params.privSiteCode}
|
||||
</if>
|
||||
|
||||
|
||||
<if test="params.isNeedBatch != null and params.isNeedBatch == 1">
|
||||
and a.bill_code = #{billCode}
|
||||
<!--
|
||||
and a.bill_code not in(
|
||||
select etsbd.bill_code from emis_tms_site_batch_dtl etsbd,emis_tms_site_batch etsb
|
||||
where etsbd.batch_no=etsb.batch_no and etsbd.del_flag='0' and etsb.del_flag='0' and etsb.batch_type=#{params.batchType}
|
||||
)
|
||||
-->
|
||||
</if>
|
||||
|
||||
<!-- 查询现金客户额度属性; 1:查询超期额度,2:查询账期内额度 -->
|
||||
<if test="params.queryQuotaType != null and params.queryQuotaType == 1">
|
||||
and a.send_date is not null
|
||||
and DATEDIFF(NOW(), a.send_date) > 10
|
||||
</if>
|
||||
<if test="params.queryQuotaType != null and params.queryQuotaType == 2">
|
||||
and a.send_date is not null
|
||||
and DATEDIFF(NOW(), a.send_date) <![CDATA[ <= ]]> 10
|
||||
</if>
|
||||
|
||||
<if test="(params.isNeedBatch == null or (params.isNeedBatch != null and params.isNeedBatch != 1) ) " >
|
||||
<if test="(salesmen == null or salesmen=='') and params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
and (
|
||||
|
||||
a.send_site_code=#{params.privSiteCode}
|
||||
or a.dispatch_site_code=#{params.privSiteCode}
|
||||
<if test="params.isQueryPrintOrder != null and params.isQueryPrintOrder == 1">
|
||||
or EXISTS (select 1 from emis_tms_scan_record etsr where a.bill_code=etsr.main_bill_code and etsr.scan_site_code=#{params.privSiteCode})
|
||||
</if>
|
||||
<if test="custNo != null and custNo != ''">
|
||||
or EXISTS (
|
||||
select 1 from emis_customer_user ecu where a.cust_no=ecu.monthly_pay_code and ecu.owner_site=#{params.privSiteCode}
|
||||
)
|
||||
</if>
|
||||
|
||||
or a.salesmen=#{params.privEmpName}
|
||||
or a.payee=#{params.privEmpName}
|
||||
or a.salesmen in(
|
||||
select salesmen from emis_salesmen_rel esr where esr.del_flag='0' and esr.bl_open='1' and now() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date and esr.sales_ass=#{params.privEmpName}
|
||||
)
|
||||
or a.operate_employee_code=#{params.privEmpCode}
|
||||
or a.take_piece_employee_code=#{params.privEmpCode}
|
||||
)
|
||||
</if>
|
||||
</if>
|
||||
|
||||
</where>
|
||||
|
||||
<if test="params.orderSnSortList != null ">
|
||||
ORDER BY FIELD
|
||||
<foreach collection="params.orderSnSortList" item="item" open="(order_sn," separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
</if>
|
||||
<if test="params.billCodeSortList != null ">
|
||||
ORDER BY FIELD
|
||||
<foreach collection="params.billCodeSortList" item="item" open="(bill_code," separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
</if>
|
||||
|
||||
<if test="params.billCodeSortList == null ">
|
||||
ORDER BY a.send_date desc
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 寄件网点寄件统计-->
|
||||
<select id="getSiteSendStatInfoMap" parameterType="EmisWaybill" resultType="map">
|
||||
@ -3184,4 +3540,21 @@
|
||||
order by a.create_time desc
|
||||
limit #{offset}, #{pageSize}
|
||||
</select>
|
||||
|
||||
<select id="selectCustEmisWaybillById" parameterType="Long" resultMap="EmisWaybillResult">
|
||||
<include refid="selectEmisWaybillVo"/>
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectCustEmisWaybillByBillCode" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
|
||||
<include refid="selectEmisWaybillVo"/>
|
||||
where a.del_flag='0'
|
||||
<if test="custNo != null and custNo != ''">
|
||||
and a.cust_no=#{custNo}
|
||||
</if>
|
||||
<if test="billCode != null and billCode != ''">
|
||||
and a.bill_code=#{billCode}
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user