opt:优化
This commit is contained in:
@@ -25,7 +25,7 @@ public interface WmsToErpService {
|
||||
* message: 信息
|
||||
* }
|
||||
*/
|
||||
JSONObject instorinfoToErp(JSONObject whereJson);
|
||||
JSONObject instorinfoToErp(JSONObject whereJson, String iostorinv_id);
|
||||
|
||||
/**
|
||||
* 出库单据回传
|
||||
@@ -43,5 +43,5 @@ public interface WmsToErpService {
|
||||
* message:错误信息
|
||||
* }
|
||||
*/
|
||||
JSONObject outstorinfoToErp(JSONObject whereJson);
|
||||
JSONObject outstorinfoToErp(JSONObject whereJson, String iostorinv_id);
|
||||
}
|
||||
|
||||
@@ -1,23 +1,35 @@
|
||||
package org.nl.wms.ext_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.wms.system_manage.enums.SysParamConstant;
|
||||
import org.nl.wms.system_manage.service.param.impl.SysParamServiceImpl;
|
||||
import org.nl.wms.ext_manage.enums.EXTConstant;
|
||||
import org.nl.wms.ext_manage.service.WmsToErpService;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_manage.service.ReturnService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.IOStorInv;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class WmsToErpServiceImpl implements WmsToErpService {
|
||||
|
||||
@Resource
|
||||
private ReturnService returnService;
|
||||
|
||||
@Override
|
||||
public JSONObject instorinfoToErp(JSONObject whereJson) {
|
||||
public JSONObject instorinfoToErp(JSONObject whereJson, String iostorinv_id) {
|
||||
log.info("instorinfoToErp回传接口输入参数为:-------------------" + whereJson.toString());
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
@@ -34,10 +46,20 @@ public class WmsToErpServiceImpl implements WmsToErpService {
|
||||
log.info("instorinfoToErp回传接口输出参数为:-------------------" + result.toString());
|
||||
|
||||
|
||||
|
||||
String status = result.getString("status");
|
||||
if (EXTConstant.ERROR.equals(status)) {
|
||||
throw new BadRequestException(result.getString("message"));
|
||||
if (!EXTConstant.SUCCESS.equals(status)) {
|
||||
log.info("ERP提示错误=【{}】",result.getString("message"));
|
||||
}
|
||||
else {
|
||||
// 更新主表
|
||||
returnService.update(
|
||||
new UpdateWrapper<IOStorInv>().lambda()
|
||||
.eq(IOStorInv::getIostorinv_id, iostorinv_id)
|
||||
.set(IOStorInv::getIs_upload, IOSConstant.IS_DELETE_YES)
|
||||
.set(IOStorInv::getUpdate_optid, "JOB")
|
||||
.set(IOStorInv::getUpdate_optname, "JOB")
|
||||
.set(IOStorInv::getUpdate_time, DateUtil.now())
|
||||
);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -49,7 +71,7 @@ public class WmsToErpServiceImpl implements WmsToErpService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject outstorinfoToErp(JSONObject whereJson) {
|
||||
public JSONObject outstorinfoToErp(JSONObject whereJson, String iostorinv_id) {
|
||||
log.info("outstorinfoToErp回传接口输入参数为:-------------------" + whereJson.toString());
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
@@ -66,12 +88,20 @@ public class WmsToErpServiceImpl implements WmsToErpService {
|
||||
log.info("outstorinfoToErp回传接口输出参数为:-------------------" + result.toString());
|
||||
|
||||
|
||||
|
||||
String status = result.getString("status");
|
||||
if (!EXTConstant.ERROR.equals(status)) {
|
||||
throw new BadRequestException(result.getString("message"));
|
||||
if (!EXTConstant.SUCCESS.equals(status)) {
|
||||
log.info("ERP提示错误=【{}】", result.getString("message"));
|
||||
} else {
|
||||
// 更新主表
|
||||
returnService.update(
|
||||
new UpdateWrapper<IOStorInv>().lambda()
|
||||
.eq(IOStorInv::getIostorinv_id, iostorinv_id)
|
||||
.set(IOStorInv::getIs_upload, IOSConstant.IS_DELETE_YES)
|
||||
.set(IOStorInv::getUpdate_optid, "JOB")
|
||||
.set(IOStorInv::getUpdate_optname, "JOB")
|
||||
.set(IOStorInv::getUpdate_time, DateUtil.now())
|
||||
);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("ERP提示错误:" + e.getMessage());
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public class RetrunServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
param.put("pallet_sn", mst.getVehicle_code());
|
||||
param.put("instor_time", mst.getConfirm_time());
|
||||
param.put("barcode", mst.getBarcode());
|
||||
wmsToErpService.instorinfoToErp(param);
|
||||
wmsToErpService.instorinfoToErp(param,row.getString("iostorinv_id"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -171,7 +171,7 @@ public class RetrunServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
param.put("order_type", dtlDao.getSource_bill_type());
|
||||
// 业务类型
|
||||
param.put("outstor_time", mst.getConfirm_time());
|
||||
wmsToErpService.outstorinfoToErp(param);
|
||||
wmsToErpService.outstorinfoToErp(param,row.getString("iostorinv_id"));
|
||||
|
||||
BigDecimal total_qty = pmform.getTotal_qty();
|
||||
total_qty.add(disDao.getReal_qty());
|
||||
@@ -218,7 +218,7 @@ public class RetrunServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
param.put("order_type", formDao.getForm_type());
|
||||
// 业务类型
|
||||
param.put("outstor_time", mst.getConfirm_time());
|
||||
wmsToErpService.outstorinfoToErp(param);
|
||||
wmsToErpService.outstorinfoToErp(param,row.getString("iostorinv_id"));
|
||||
break;
|
||||
}else //明细数大于订单数
|
||||
if(real_qty.compareTo(un_qty) > 0){
|
||||
@@ -238,7 +238,7 @@ public class RetrunServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
param.put("order_type", formDao.getForm_type());
|
||||
// 业务类型
|
||||
param.put("outstor_time", mst.getConfirm_time());
|
||||
wmsToErpService.outstorinfoToErp(param);
|
||||
wmsToErpService.outstorinfoToErp(param,row.getString("iostorinv_id"));
|
||||
//更新明细可分配数
|
||||
real_qty = real_qty.subtract(un_qty);
|
||||
}else //明细数小于订单数
|
||||
@@ -257,7 +257,7 @@ public class RetrunServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
param.put("order_type", formDao.getForm_type());
|
||||
// 业务类型
|
||||
param.put("outstor_time", mst.getConfirm_time());
|
||||
wmsToErpService.outstorinfoToErp(param);
|
||||
wmsToErpService.outstorinfoToErp(param,row.getString("iostorinv_id"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -267,19 +267,6 @@ public class RetrunServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
||||
}
|
||||
}
|
||||
}
|
||||
// 更新主表
|
||||
this.update(
|
||||
new UpdateWrapper<IOStorInv>().lambda()
|
||||
.in(IOStorInv::getIostorinv_id, rows.stream()
|
||||
.map(row -> row.getString("iostorinv_id"))
|
||||
.collect(Collectors.toList())
|
||||
)
|
||||
.set(IOStorInv::getIs_upload, IOSConstant.IS_DELETE_YES)
|
||||
.set(IOStorInv::getUpdate_optid, SecurityUtils.getCurrentUserId())
|
||||
.set(IOStorInv::getUpdate_optname, SecurityUtils.getCurrentNickName())
|
||||
.set(IOStorInv::getUpdate_time, DateUtil.now())
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user