This commit is contained in:
linfso 2024-12-26 13:39:04 +08:00
parent 8cbb06f203
commit 5daee1d73c
3 changed files with 48 additions and 44 deletions

View File

@ -10,15 +10,21 @@
package com.xdadan.erp.emis.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import cn.hutool.core.collection.CollectionUtil;
import com.xdadan.erp.common.utils.StringUtils;
import com.xdadan.erp.emis.domain.EmisWarehouseInDtl;
import com.xdadan.erp.emis.domain.EmisWaybill;
import com.xdadan.erp.emis.domain.EmisWaybillAttachment;
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
import com.xdadan.erp.emis.domain.enumtype.WaybillAttachType;
import com.xdadan.erp.emis.domain.exception.EmisBizError;
import com.xdadan.erp.emis.mapper.EmisWarehouseInDtlMapper;
import com.xdadan.erp.emis.mapper.EmisWarehouseInMapper;
import com.xdadan.erp.emis.service.EmisBaseService;
import com.xdadan.erp.emis.utils.WaybillHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -35,7 +41,7 @@ import org.springframework.util.CollectionUtils;
* @date 2024-05-22 00:20:32
*/
@Service
public class EmisWarehouseInBatchServiceImpl implements IEmisWarehouseInBatchService
public class EmisWarehouseInBatchServiceImpl extends EmisBaseService implements IEmisWarehouseInBatchService
{
@Autowired
private EmisWarehouseInBatchMapper emisWarehouseInBatchMapper;
@ -101,9 +107,24 @@ public class EmisWarehouseInBatchServiceImpl implements IEmisWarehouseInBatchSer
emisWarehouseInDtlMapper.insertEmisWarehouseInDtl(item);
}
emisWarehouseInBatch.setId(null);
emisWarehouseInBatchMapper.insertEmisWarehouseInBatch(emisWarehouseInBatch);
// 插入运单商品附件图片
if(!StringUtils.isEmpty(emisWarehouseInBatch.getPicUrl()) ){
EmisWaybill waybill = getWaybillByBillCode(emisWarehouseInBatch.getBillCode());
if(waybill!=null){
EmisWaybillAttachment goodsPicAttachment = new EmisWaybillAttachment();
goodsPicAttachment.setAttachType(WaybillAttachType.GOODS_PIC.typeCode);
goodsPicAttachment.setFileUrl(emisWarehouseInBatch.getPicUrl());
goodsPicAttachment.setWaybillId(waybill.getId());
goodsPicAttachment.setBillCode(waybill.getBillCode());
emisWaybillAttachmentMapper.insertEmisWaybillAttachment(goodsPicAttachment);
}
}
// 更新入库状态
emisWarehouseInMapper.updateHasStockInFlag(emisWarehouseInBatch.getInNo());

View File

@ -1498,23 +1498,16 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
emisWaybillSave.setSendSiteCode("88888");
}
if( "1".equals(emisWaybillSave.getPickupMethod()) && "3".equals(emisWaybillSave.getPickupMethod()) && emisWaybillSave.getIntoWarehouseCode()==null ) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"收货仓库必填");
}
if( "1".equals(emisWaybillSave.getPickupMethod()) && "3".equals(emisWaybillSave.getPickupMethod()) && emisWaybillSave.getSalesmen()==null ) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"收货仓库/整柜提货 销售联系人必填");
}
if( emisWaybillSave.getPickStartDate()==null ){
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"发货/取件日期必填");
}
// 回款联系人
if(isNew) {
emisWaybillSave.setPayee(emisWaybillSave.getSalesmen());
if( ( "1".equals(emisWaybillSave.getPickupMethod()) || "3".equals(emisWaybillSave.getPickupMethod()) ) && StringUtils.isEmpty(emisWaybillSave.getIntoWarehouseCode()) ) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"收货仓库必填");
}
if( emisWaybillSave.getPickStartDate()==null ){
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"发货/取件日期必填");
}
// 登记网点,总部
if(isNew) {
@ -1549,14 +1542,12 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
// 如果是仓库收货/整柜提货,寄件网点使用仓库编号
if( "1".equals(emisWaybillSave.getPickupMethod()) || "3".equals(emisWaybillSave.getPickupMethod()) ){
if(StringUtils.isEmpty(emisWaybillSave.getIntoWarehouseCode()) ) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "仓库不能为空");
}else{
emisWaybillSave.setSendSiteCode(emisWaybillSave.getIntoWarehouseCode());
}
emisWaybillSave.setSendSiteCode(emisWaybillSave.getIntoWarehouseCode());
}
// 发件网点
if(!StringUtils.isEmpty(emisWaybillSave.getSendSiteCode())){
// 寄件网点财务中心
@ -1675,6 +1666,20 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
emisWaybillSave.setSendDate(new Date());
}
// 销售联系人
if( "1".equals(emisWaybillSave.getPickupMethod()) || "3".equals(emisWaybillSave.getPickupMethod()) ) {
if (StringUtils.isEmpty(emisWaybillSave.getSalesmen())) {
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "销售联系人必填");
}
// 默认回款联系人=销售联系人
if (StringUtils.isEmpty(emisWaybillSave.getPayee())) {
emisWaybillSave.setPayee(emisWaybillSave.getSalesmen());
}
}
// 仓库收货/整柜提货 建立入仓预报单
if( "1".equals(emisWaybillSave.getPickupMethod()) || "3".equals(emisWaybillSave.getPickupMethod()) ) {
// 获取进仓单号
@ -1719,26 +1724,6 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
log.error("===OMS下单模式,计费错误:",ex.getMessage());
}
// // 开单当天不算时效
// Date estDate = getEstimateDate(
// emisWaybillSave.getSendDate(),emisWaybillSave.getProductType(),
// emisWaybillSave.getSendCountry(),
// emisWaybillSave.getReceiveCountry(),0);
//
// // 预计到达时间
// log.info("预估到达时间==>"+ DateUtils.dateTime(estDate));
// emisWaybillSave.setEstimateDate(estDate);
//
// // 子单号
// if("1".equals(emisWaybillSave.getBlGenSubbill()) ){
// // 子单号拼接
// StringBuilder sb = new StringBuilder();
// for(int i=1;i<=emisWaybillSave.getParcelQty().intValue();i++){
// sb.append(emisWaybillSave.getBillCode()+ StringUtils.leftPad(String.valueOf(i),4,"0")+",");
// }
// emisWaybillSave.setBillCodeSub(sb.toString());
// }
}

View File

@ -265,8 +265,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update emis_warehouse_in set stock_in_flag = '1' where in_no = #{inNo}
</update>
<update id="useInNo" parameterType="EmisWarehouseIn">
update emis_warehouse_in set used_status='1'
where bill_code = #{billCode} and in_no = #{inNo}