demand: 运单录入界面-缅甸虚拟单调整

committer: heyu
This commit is contained in:
aike 2025-06-16 16:19:03 +08:00
parent 501319d514
commit 97ff62ca74
7 changed files with 131 additions and 2 deletions

View File

@ -108,6 +108,17 @@ public class EmisWaybillController extends EmisBaseController
return AjaxResult.success("操作成功", emisBaseService.checkWaybillIsExists(billCode));
}
/**
* 查询主单号列表
*/
@GetMapping(value = "/getMasterBillCodes")
public TableDataInfo getMasterBillCodes(EmisWaybill emisWaybill){
startPage();
emisWaybill.getParams().put("privSiteCode", getLoginUser().getUser().getOwnerSiteCode());
List<String> list = emisWaybillService.selectMasterBillCodes(emisWaybill);
return getDataTable(list);
}
/**
* 获取运单信息
*/

View File

@ -314,6 +314,8 @@ public class EmisWaybill extends BaseEntity
private String blOverLong;
/* 是否虚拟单 */
private String blVirtual;
/* 主单号 */
private String masterBillCode;
/* 是否付款 */
private String blBill;

View File

@ -389,6 +389,10 @@ public class WaybillOrder implements Serializable {
/* 箱量 */
private String boxQuantity;
/* 是否虚拟单 0:否,1:是,默认为0 */
private String blVirtual;
/* 主单号 */
private String masterBillCode;
// 销售,回款
// private String salesmenName;
@ -732,6 +736,10 @@ public class WaybillOrder implements Serializable {
dbWaybill.setUserId(this.getUserId());
dbWaybill.setCustomerCode(this.getCustomerCode());
// 虚拟单
dbWaybill.setBlVirtual(this.getBlVirtual());
dbWaybill.setMasterBillCode(this.getMasterBillCode());
// dbWaybill.setCustomerName(this.getCustomerName());
// dbWaybill.setReceiveCustomerCode(this.getReceiveCustomerCode());
// dbWaybill.setReceiveCustomerName(this.getReceiveCustomerName());

View File

@ -304,4 +304,12 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
EmisWaybill selectCustEmisWaybillByBillCode(EmisWaybill queryWaybill);
EmisWaybill selectEmisWaybillByCustOrderId(String custOrderId);
/**
* 查询主单号列表
*
* @param emisWaybill
* @return
*/
List<String> selectMasterBillCodes(EmisWaybill emisWaybill);
}

View File

@ -289,4 +289,12 @@ public interface IEmisWaybillService extends IDataAuditService
* @throws EmisBizError 业务异常
*/
void updateWaybillInfo(JSONObject orderData, String appId) throws EmisBizError;
/**
* 查询主单号
*
* @param emisWaybill
* @return
*/
List<String> selectMasterBillCodes(EmisWaybill emisWaybill);
}

View File

@ -14,6 +14,7 @@ package com.xdadan.erp.emis.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.beust.jcommander.internal.Lists;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.data.PictureType;
@ -135,6 +136,9 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
@Autowired
private EmisCustomerSignMapper emisCustomerSignMapper;
@Autowired
private EmisTmsSiteBatchMapper emisTmsSiteBatchMapper;
/**
* 获取稽核数据
* @param id
@ -3075,6 +3079,13 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
}
// 是否是虚拟问题件
if (!StringUtils.isEmpty(emisWaybillSave.getBlVirtual())) {
if ("1".equals(emisWaybillSave.getBlVirtual())) {
checkVirtual(emisWaybillSave);
}
}
// 设定为业务开单
emisWaybillSave.setOrderType("1");
emisWaybillSave.setOrderDate(new Date());
@ -3240,6 +3251,62 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
}
}
private void checkVirtual(EmisWaybill emisWaybillSave) throws EmisBizError {
if (StringUtil.isBlank(emisWaybillSave.getMasterBillCode())) {
throw new EmisBizError(EmisBizErrorType.FAIL, "主单号不能为空");
}
EmisWaybill masterWaybill = emisWaybillMapper
.selectEmisWaybillByBillCode(emisWaybillSave.getMasterBillCode());
if (Objects.isNull(masterWaybill)) {
throw new EmisBizError(EmisBizErrorType.FAIL, "主单号不存在");
}
if (!emisWaybillSave.getReceiveCountry().equals(masterWaybill.getReceiveCountry())
|| !emisWaybillSave.getTransLineType().equals(masterWaybill.getTransLineType())) {
throw new EmisBizError(EmisBizErrorType.FAIL, "主单和虚拟单线路不一致");
}
List<EmisTmsSiteBatch> batchList = emisTmsSiteBatchMapper.selectEmisTmsSiteBatchListByBillCodes(
Lists.newArrayList(Collections.singleton(emisWaybillSave.getMasterBillCode())));
if (CollectionUtil.isNotEmpty(batchList)) {
throw new EmisBizError(EmisBizErrorType.FAIL, "该单号已经录入批次,请先在组批次中剔除该运单");
}
String remark = masterWaybill.getRemark();
String virtualBillCode = emisWaybillSave.getBillCode();
String virtualBillCodeLastSix = virtualBillCode.substring(virtualBillCode.length() - 6);
if (remark != null && remark.contains("该运单为主单,对应虚拟单为")) {
// 如果包含关键字,在最后一个虚拟单号后添加新的虚拟单号
int lastIndex = remark.lastIndexOf("该运单为主单,对应虚拟单为");
String prefix = remark.substring(0, lastIndex + "该运单为主单,对应虚拟单为".length());
String suffix = remark.substring(lastIndex + "该运单为主单,对应虚拟单为".length());
// 处理虚拟单号去重
Set<String> virtualBillSet = new LinkedHashSet<>();
if (!suffix.trim().isEmpty()) {
// 将现有虚拟单号添加到Set中,并去除空格
String[] codes = suffix.split(",");
for (String code : codes) {
String trimmedCode = code.trim();
if (!trimmedCode.isEmpty()) {
virtualBillSet.add(trimmedCode);
}
}
}
// 添加新的虚拟单号
virtualBillSet.add(virtualBillCodeLastSix);
// 重新拼接去重后的虚拟单号,保持原有顺序
remark = prefix + String.join(",", virtualBillSet);
} else {
// 如果不包含关键字,在备注末尾添加新的信息
remark = (remark != null ? remark + " " : "") + "该运单为主单,对应虚拟单为" + virtualBillCodeLastSix;
}
EmisWaybill emisWaybill = new EmisWaybill();
emisWaybill.setRemark(remark);
emisWaybill.setId(masterWaybill.getId());
emisWaybillSave.setRemark("该单为虚拟单:对应主单为" + emisWaybillSave.getMasterBillCode());
emisWaybillMapper.updateEmisWaybill(emisWaybill);
}
private void checkCountry(EmisWaybill emisWaybillSave) throws EmisBizError {
EmisTransLine emisTransLine = new EmisTransLine();
emisTransLine.setLineCode(emisWaybillSave.getTransLineType());
@ -5813,8 +5880,11 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
reUpdateWayBillByOms(oldWaybill, waybillUpdate);
}
@Override
public List<String> selectMasterBillCodes(EmisWaybill emisWaybill) {
return emisWaybillMapper.selectMasterBillCodes(emisWaybill);
}
public static void main(String[] args) {

View File

@ -225,6 +225,9 @@
<result property="customerNickName" column="customer_nick_name" />
<result property="customerAvatar" column="customer_avatar" />
<result property="blVirtual" column="bl_virtual" />
<result property="masterBillCode" column="master_bill_code" />
<result property="transType" column="trans_type" />
@ -298,7 +301,7 @@
a.goods_type, a.goods_info, a.goods_pics, a.bl_prepare_in_freight, a.prepare_in_est_fee,
a.prepare_in_real_fee, a.prepare_in_express, a.prepare_in_bill_code, a.prepare_in_remark,
a.prepare_in_supplier, a.total_weight, a.total_volume, a.parcel_qty, a.bill_weight, a.volume_weight, a.currency,
a.settlement_weight, a.scan_weight, a.fee_weight, a.freight, a.real_payment_type, a.real_fee, a.bl_special_quote,
a.settlement_weight, a.scan_weight, a.fee_weight, a.freight, a.real_payment_type, a.real_fee, a.bl_special_quote,a.bl_virtual,a.master_bill_code
a.bl_over_long, a.bl_bill, a.bl_bill_text, a.bl_over_weight, a.over_weight_number, a.fee_remark, a.third_code,
a.real_value, a.bl_insure, a.insure_value, a.insure_value_currency, a.insure_fee_currency, a.insure_fee, a.insure_remark,
a.insure_site_code, a.insure_date, a.bl_print, a.print_man_code, a.print_site, a.print_date, a.print_count, a.bl_disp_fd,
@ -547,6 +550,22 @@
</if>
</select>
<select id="selectMasterBillCodes" parameterType="EmisWaybill" resultType="string">
select bill_code
from emis_waybill
where del_flag = '0'
and send_date >= date_sub(curdate(), interval 3 day)
and trans_line_type = #{transLineType}
and (bl_virtual is null or bl_virtual != '1')
<if test="billCode != null and billCode != ''">
and bill_code like concat('%', #{billCode}, '%')
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.send_site_code=#{params.privSiteCode}
)
</if>
</select>
<select id="selectWaitGotOrderList" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
<include refid="selectEmisWaybillVo"/>
@ -2755,6 +2774,7 @@
<if test="blSensitive != null and blSensitive != ''">bl_sensitive,</if>
<if test="blOverLong != null and blOverLong != ''">bl_over_long,</if>
<if test="blVirtual != null and blVirtual != ''">bl_virtual,</if>
<if test="masterBillCode != null and masterBillCode != ''">master_bill_code,</if>
<if test="blBill != null and blBill != ''">bl_bill,</if>
<if test="blBillText != null and blBillText != ''">bl_bill_text,</if>
<if test="blProfit != null and blProfit != ''">bl_profit,</if>
@ -2939,6 +2959,7 @@
<if test="blSensitive != null and blSensitive != ''">#{blSensitive},</if>
<if test="blOverLong != null and blOverLong != ''">#{blOverLong},</if>
<if test="blVirtual != null and blVirtual != ''">#{blVirtual},</if>
<if test="masterBillCode != null and masterBillCode != ''">#{masterBillCode},</if>
<if test="blBill != null and blBill != ''">#{blBill},</if>
<if test="blBillText != null and blBillText != ''">#{blBillText},</if>
<if test="blProfit != null and blProfit != ''">#{blProfit},</if>
@ -3125,6 +3146,7 @@
<if test="blSensitive != null and blSensitive != ''">bl_sensitive = #{blSensitive},</if>
<if test="blOverLong != null and blOverLong != ''">bl_over_long = #{blOverLong},</if>
<if test="blVirtual != null and blVirtual != ''">bl_virtual = #{blVirtual},</if>
<if test="masterBillCode != null and masterBillCode != ''">master_bill_code= #{masterBillCode},</if>
<if test="blBill != null and blBill != ''">bl_bill = #{blBill},</if>
<if test="blBillText != null and blBillText != ''">bl_bill_text = #{blBillText},</if>
<if test="blProfit != null and blProfit != ''">bl_profit = #{blProfit},</if>