md
This commit is contained in:
parent
b1ef17831a
commit
d3e1bdb697
@ -193,6 +193,36 @@ public class EmisWaybillController extends EmisBaseController
|
||||
|
||||
}
|
||||
|
||||
@Log(title = "取消订单", businessType = BusinessType.INSERT)
|
||||
@PostMapping(value = "/cancelOrder")
|
||||
public AjaxResult cancelOrder(@Valid @RequestBody WaybillOrder waybillOrder)
|
||||
{
|
||||
try {
|
||||
|
||||
if(StringUtils.isEmpty(waybillOrder.getOrderSn()) ){
|
||||
return AjaxResult.error("订单号不能为空");
|
||||
}
|
||||
|
||||
EmisWaybill emisWaybill = new EmisWaybill();
|
||||
emisWaybill.setOrderSn(waybillOrder.getOrderSn());
|
||||
emisWaybill.setOrderRemark(waybillOrder.getOrderRemark());
|
||||
emisWaybillService.cancelOrder(emisWaybill);
|
||||
|
||||
return AjaxResult.success("取消成功");
|
||||
}catch(EmisBizError ex){
|
||||
ex.printStackTrace();
|
||||
return AjaxResult.error("("+ex.getErrorCode()+")"+ex.getMessage());
|
||||
}
|
||||
catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
// 返回子定义异常
|
||||
if(ex instanceof EmisBizError){
|
||||
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
|
||||
}
|
||||
|
||||
return AjaxResult.error("服务器异常,联系客服");
|
||||
}
|
||||
}
|
||||
|
||||
@Log(title = "运单实时下单", businessType = BusinessType.INSERT)
|
||||
@PostMapping(value = "/realSubmitOrder")
|
||||
|
||||
@ -6,16 +6,25 @@ package com.xdadan.erp.emis.domain.enumtype;
|
||||
public enum OrderStatus {
|
||||
|
||||
|
||||
INIT("0","创建成功"),
|
||||
|
||||
INIT("0","待接单"),
|
||||
CONFIRM("1","已接单"),
|
||||
CANCEL("-1","已取消"),
|
||||
CANCEL("2","已取消"),
|
||||
ASSIGN_TAKEMAN("3","已分配业务员"),
|
||||
HAS_GOT("4","已揽收"),
|
||||
TRANSING("5","运输中"),
|
||||
ARRIVAL("6","已到达目的地"),
|
||||
DISPATCH("7","派送"),
|
||||
SIGN("8","已签收"),
|
||||
SIGN_EXCEPTION("9","签收异常"),
|
||||
TRANSFER("10","已转单"),
|
||||
|
||||
OTHER("999","其他"),
|
||||
OTHER("99","其他"),
|
||||
|
||||
|
||||
;
|
||||
|
||||
|
||||
|
||||
public String statusCode;
|
||||
public String statusName;
|
||||
|
||||
|
||||
@ -255,8 +255,12 @@ public class WaybillOrder implements Serializable {
|
||||
/* 预入仓供应商 */
|
||||
private String prepareInSupplier;
|
||||
|
||||
// 录单备注
|
||||
private String remark;
|
||||
|
||||
/* 订单备注 */
|
||||
private String orderRemark;
|
||||
|
||||
/* 揽收图片备注 */
|
||||
private String billPicSendRmk;
|
||||
/* 派件签收底单图片 */
|
||||
@ -613,6 +617,8 @@ public class WaybillOrder implements Serializable {
|
||||
voItem.setLockFlag(dbWaybill.getLockFlag());
|
||||
voItem.setLockReason(dbWaybill.getLockReason());
|
||||
|
||||
voItem.setOrderRemark(dbWaybill.getOrderRemark());
|
||||
|
||||
|
||||
|
||||
return voItem;
|
||||
@ -817,6 +823,8 @@ public class WaybillOrder implements Serializable {
|
||||
// dbWaybill.setCreateSite(this.getCreateSite());
|
||||
// dbWaybill.setUpdateSite(this.getUpdateSite());
|
||||
|
||||
dbWaybill.setOrderRemark(this.getOrderRemark());
|
||||
|
||||
return dbWaybill;
|
||||
|
||||
}
|
||||
|
||||
@ -98,6 +98,15 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
||||
|
||||
public int updatePrintStatus(EmisWaybill emisWaybill);
|
||||
|
||||
// 接单-确认订单
|
||||
public int confirmOrder(EmisWaybill emisWaybill);
|
||||
|
||||
// 分配业务员-取件员
|
||||
public int assignTakeMan(EmisWaybill emisWaybill);
|
||||
|
||||
// 取消订单
|
||||
public int cancelOrder(EmisWaybill emisWaybill);
|
||||
|
||||
// 更新派件状态
|
||||
public int updateDispatchStatus(EmisWaybill emisWaybill);
|
||||
|
||||
|
||||
@ -84,6 +84,30 @@ public interface IEmisWaybillService
|
||||
public int realSubmitOrder(EmisWaybill emisWaybill) throws EmisBizError;
|
||||
|
||||
|
||||
/**
|
||||
* 取消订单
|
||||
* @param emisWaybill
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
public int cancelOrder(EmisWaybill emisWaybill) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 确认订单
|
||||
* @param emisWaybill
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
public int confirmOrder(EmisWaybill emisWaybill) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 指派业务员
|
||||
* @param emisWaybill
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
public int assignTakeMan(EmisWaybill emisWaybill)throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 费用试算
|
||||
* @param emisWaybill
|
||||
|
||||
@ -588,6 +588,88 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 取消订单
|
||||
* @param emisWaybill
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
@Override
|
||||
public int cancelOrder(EmisWaybill emisWaybill) throws EmisBizError {
|
||||
// 已开单
|
||||
// 已揽收不允许取消
|
||||
EmisWaybill emisWaybillOld = this.selectEmisWaybillByOrderSn(emisWaybill.getOrderSn());
|
||||
if(emisWaybillOld==null){
|
||||
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS,"订单不存在");
|
||||
}
|
||||
|
||||
if(OrderStatus.CANCEL.statusCode.equals(emisWaybillOld.getOrderStatus())){
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"订单已取消");
|
||||
}
|
||||
|
||||
if(!WaybillStatus.INIT.statusCode.equals(emisWaybillOld.getWaybillStatus())){
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"已揽收,不允许取消");
|
||||
}
|
||||
|
||||
return emisWaybillMapper.cancelOrder(emisWaybill);
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认订单
|
||||
* @param emisWaybill
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
@Override
|
||||
public int confirmOrder(EmisWaybill emisWaybill) throws EmisBizError{
|
||||
// 已接单不允许再接单
|
||||
EmisWaybill emisWaybillOld = this.selectEmisWaybillByOrderSn(emisWaybill.getOrderSn());
|
||||
if(emisWaybillOld==null){
|
||||
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS,"订单不存在");
|
||||
}
|
||||
|
||||
if(OrderStatus.CANCEL.statusCode.equals(emisWaybillOld.getOrderStatus())){
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"订单已取消");
|
||||
}
|
||||
|
||||
if(!OrderStatus.INIT.statusCode.equals(emisWaybillOld.getOrderStatus())){
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"已接单");
|
||||
}
|
||||
|
||||
return emisWaybillMapper.confirmOrder(emisWaybill);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分配取件员
|
||||
* @param emisWaybill
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
@Override
|
||||
public int assignTakeMan(EmisWaybill emisWaybill) throws EmisBizError{
|
||||
|
||||
EmisWaybill emisWaybillOld = this.selectEmisWaybillByOrderSn(emisWaybill.getOrderSn());
|
||||
if(emisWaybillOld==null){
|
||||
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS,"订单不存在");
|
||||
}
|
||||
|
||||
if(OrderStatus.CANCEL.statusCode.equals(emisWaybillOld.getOrderStatus())){
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"订单已取消");
|
||||
}
|
||||
|
||||
if(StringUtils.isEmpty(emisWaybillOld.getTakePieceEmployeeCode())){
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"取件员不能为空");
|
||||
}
|
||||
|
||||
return emisWaybillMapper.assignTakeMan(emisWaybill);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算运单公共信息
|
||||
* @param emisWaybillSave
|
||||
* @param isNew
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
private void calcWayBillCommonInfo(EmisWaybill emisWaybillSave,boolean isNew) throws EmisBizError {
|
||||
|
||||
String orderSn = WaybillHelper.genOrderSn();
|
||||
@ -901,8 +983,6 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
* 新开单
|
||||
* @param emisWaybillSave
|
||||
*/
|
||||
|
||||
// @DataAuditFilter(tableName="emis_waybill",operationType="1",mapper="emisWaybillMapper")
|
||||
private void addNewWaybill(EmisWaybill emisWaybillSave) throws EmisBizError {
|
||||
|
||||
// 子单号做扣减
|
||||
|
||||
@ -1362,6 +1362,38 @@
|
||||
where bill_code=#{billCode}
|
||||
</update>
|
||||
|
||||
<!-- 取消订单 -->
|
||||
<update id="cancelOrder" parameterType="EmisWaybill">
|
||||
update emis_waybill set
|
||||
order_status = 2,
|
||||
order_remark = #{orderRemark}
|
||||
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
|
||||
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
|
||||
where order_sn=#{orderSn}
|
||||
</update>
|
||||
|
||||
<!-- 确认订单 -->
|
||||
<update id="confirmOrder" parameterType="EmisWaybill">
|
||||
update emis_waybill set
|
||||
order_status = 1
|
||||
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
|
||||
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
|
||||
where order_sn=#{orderSn}
|
||||
</update>
|
||||
|
||||
<!-- 分配取件员 -->
|
||||
<update id="assignTakeMan" parameterType="EmisWaybill">
|
||||
update emis_waybill set
|
||||
take_piece_employee_code = #{takePieceEmployeeCode}
|
||||
<if test="updateBy != null and updateBy != ''">,update_by = #{updateBy}</if>
|
||||
<if test="updateSite != null and updateSite != ''">,update_site = #{updateSite}</if>
|
||||
where order_sn=#{orderSn}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<update id="updateUnSignStatus" parameterType="EmisWaybill">
|
||||
update emis_waybill
|
||||
set sign_man=null,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user