demand: TMS系统 - 运输管理 -货物组批次-删除批次时校验如果该批次已录入成本,不允许删除
committer: heyu
This commit is contained in:
parent
eba423e598
commit
df61352045
@ -217,8 +217,7 @@ public class EmisTmsSiteBatchController extends EmisBaseController
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisTmsSiteBatch:remove')")
|
||||
@Log(title = "一级网点TMS组批次", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
public AjaxResult remove(@PathVariable Long[] ids) throws EmisBizError {
|
||||
return toAjax(emisTmsSiteBatchService.deleteEmisTmsSiteBatchByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
@ -108,4 +108,12 @@ public interface EmisTmsCostFeeMapper extends BaseMapper<EmisTmsCostFee>
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisTmsCostFeeByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据批次ID列表查询成本费用记录
|
||||
*
|
||||
* @param batchIds 批次ID数组
|
||||
* @return 成本费用记录列表
|
||||
*/
|
||||
public List<EmisTmsCostFee> selectEmisTmsCostFeeByBatchIds(Long[] batchIds);
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ public interface IEmisTmsSiteBatchService extends IDataAuditService
|
||||
* @param ids 需要删除的一级网点TMS组批次主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisTmsSiteBatchByIds(Long[] ids);
|
||||
public int deleteEmisTmsSiteBatchByIds(Long[] ids) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 删除一级网点TMS组批次信息
|
||||
|
||||
@ -25,6 +25,7 @@ import com.xdadan.erp.emis.mapper.EmisTmsSiteBatchLoadingMapper;
|
||||
import com.xdadan.erp.emis.mapper.EmisTransPlanRuleMapper;
|
||||
import com.xdadan.erp.emis.mapper.EmisTmsSiteBatchLogMapper;
|
||||
import com.xdadan.erp.emis.mapper.EmisWaybillMapper;
|
||||
import com.xdadan.erp.emis.mapper.EmisTmsCostFeeMapper;
|
||||
import com.xdadan.erp.emis.service.EmisBaseService;
|
||||
import jodd.util.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -67,6 +68,9 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
|
||||
@Autowired
|
||||
private EmisWaybillMapper emisWaybillMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisTmsCostFeeMapper emisTmsCostFeeMapper;
|
||||
|
||||
/**
|
||||
* 获取稽核数据
|
||||
*
|
||||
@ -469,7 +473,17 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEmisTmsSiteBatchByIds(Long[] ids) {
|
||||
public int deleteEmisTmsSiteBatchByIds(Long[] ids) throws EmisBizError {
|
||||
// 检查批次是否已录入成本费用
|
||||
if (ids != null && ids.length > 0) {
|
||||
// 一次性查询所有ids对应的成本费用记录
|
||||
List<EmisTmsCostFee> costFeeList = emisTmsCostFeeMapper.selectEmisTmsCostFeeByBatchIds(ids);
|
||||
if (CollectionUtil.isNotEmpty(costFeeList)) {
|
||||
// 取第一条记录的批次号作为提示
|
||||
String firstBatchNo = costFeeList.get(0).getBatchNo();
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "批次号[" + firstBatchNo + "]已录入成本,无法删除");
|
||||
}
|
||||
}
|
||||
return emisTmsSiteBatchMapper.deleteEmisTmsSiteBatchByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
@ -292,6 +292,16 @@
|
||||
where a.batch_no = #{batchNo} limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectEmisTmsCostFeeByBatchIds" parameterType="Long[]" resultMap="EmisTmsCostFeeResult">
|
||||
select c.id, c.cost_no, c.cost_name, c.batch_no, c.fee_type, c.split_type, c.trans_type, c.trans_sign_no, c.supplier_code, c.supplier_name, c.send_place, c.dest_place, c.cost_fee, c.usd_cost_fee, c.bill_month, c.trade_date, c.send_piece_sum, c.piece_number, c.total_weight, c.total_volume, c.bl_confirm_center, c.real_piece_number, c.real_total_weight, c.real_total_volume, c.confirm_center_date, c.confirm_center_note, c.confirm_center_man_code, c.confirm_center_code, c.bl_confirm_site, c.confirm_site_date, c.confirm_site_man_code, c.confirm_site_note, c.confirm_site_code, c.bl_has_calc, c.calc_date, c.remark, c.del_flag, c.create_by, c.create_time, c.update_by, c.update_time, c.create_site, c.update_site
|
||||
from emis_tms_cost_fee c
|
||||
inner join emis_tms_site_batch b on c.batch_no = b.batch_no
|
||||
where b.id in
|
||||
<foreach collection="array" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<insert id="insertEmisTmsCostFee" parameterType="EmisTmsCostFee" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into emis_tms_cost_fee
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user