md
This commit is contained in:
parent
2e6bb036e8
commit
4d515c862b
@ -13,6 +13,8 @@ package com.xdadan.erp.web.emis;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -91,19 +93,27 @@ public class EmisWarehouseInBatchController extends EmisBaseController
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody EmisWarehouseInBatch emisWarehouseInBatch)
|
public AjaxResult add(@RequestBody EmisWarehouseInBatch emisWarehouseInBatch)
|
||||||
{
|
{
|
||||||
return toAjax(emisWarehouseInBatchService.insertEmisWarehouseInBatch(emisWarehouseInBatch));
|
try {
|
||||||
|
return toAjax(emisWarehouseInBatchService.insertEmisWarehouseInBatch(emisWarehouseInBatch));
|
||||||
|
} catch (EmisBizError emisBizError) {
|
||||||
|
emisBizError.printStackTrace();
|
||||||
|
return AjaxResult.error(emisBizError.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "进仓单登记", businessType = BusinessType.INSERT)
|
@Log(title = "进仓单登记", businessType = BusinessType.INSERT)
|
||||||
@RequestMapping("/registerWarehouseInInfo")
|
@RequestMapping("/registerWarehouseInInfo")
|
||||||
public AjaxResult registerWarehouseInInfo(@RequestBody EmisWarehouseInBatch emisWarehouseInBatch)
|
public AjaxResult registerWarehouseInInfo(@RequestBody EmisWarehouseInBatch emisWarehouseInBatch)
|
||||||
{
|
{
|
||||||
return toAjax(emisWarehouseInBatchService.insertEmisWarehouseInBatch(emisWarehouseInBatch));
|
try {
|
||||||
|
return toAjax(emisWarehouseInBatchService.insertEmisWarehouseInBatch(emisWarehouseInBatch));
|
||||||
|
} catch (EmisBizError emisBizError) {
|
||||||
|
emisBizError.printStackTrace();
|
||||||
|
return AjaxResult.error(emisBizError.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改进仓单批次
|
* 修改进仓单批次
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -11,8 +11,9 @@ package com.xdadan.erp.emis.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.xdadan.erp.emis.domain.EmisWarehouseInBatch;
|
import com.xdadan.erp.emis.domain.EmisWarehouseInBatch;
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName EmisWarehouseInBatchService
|
* @ClassName EmisWarehouseInBatchService
|
||||||
* @Description 进仓单批次
|
* @Description 进仓单批次
|
||||||
* @author linfso
|
* @author linfso
|
||||||
@ -41,7 +42,7 @@ public interface IEmisWarehouseInBatchService
|
|||||||
* @param emisWarehouseInBatch 进仓单批次
|
* @param emisWarehouseInBatch 进仓单批次
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertEmisWarehouseInBatch(EmisWarehouseInBatch emisWarehouseInBatch);
|
public int insertEmisWarehouseInBatch(EmisWarehouseInBatch emisWarehouseInBatch) throws EmisBizError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改进仓单批次
|
* 修改进仓单批次
|
||||||
|
|||||||
@ -11,13 +11,21 @@
|
|||||||
package com.xdadan.erp.emis.service.impl;
|
package com.xdadan.erp.emis.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.xdadan.erp.emis.domain.EmisWarehouseInDtl;
|
||||||
|
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
|
import com.xdadan.erp.emis.mapper.EmisWarehouseInDtlMapper;
|
||||||
|
import com.xdadan.erp.emis.utils.WaybillHelper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.xdadan.erp.emis.domain.EmisWarehouseInBatch;
|
import com.xdadan.erp.emis.domain.EmisWarehouseInBatch;
|
||||||
import com.xdadan.erp.emis.mapper.EmisWarehouseInBatchMapper;
|
import com.xdadan.erp.emis.mapper.EmisWarehouseInBatchMapper;
|
||||||
import com.xdadan.erp.emis.service.IEmisWarehouseInBatchService;
|
import com.xdadan.erp.emis.service.IEmisWarehouseInBatchService;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 进仓单批次Service业务层处理
|
* 进仓单批次Service业务层处理
|
||||||
*
|
*
|
||||||
* @author linfso
|
* @author linfso
|
||||||
@ -29,6 +37,9 @@ public class EmisWarehouseInBatchServiceImpl implements IEmisWarehouseInBatchSer
|
|||||||
@Autowired
|
@Autowired
|
||||||
private EmisWarehouseInBatchMapper emisWarehouseInBatchMapper;
|
private EmisWarehouseInBatchMapper emisWarehouseInBatchMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EmisWarehouseInDtlMapper emisWarehouseInDtlMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询进仓单批次
|
* 查询进仓单批次
|
||||||
*
|
*
|
||||||
@ -59,9 +70,23 @@ public class EmisWarehouseInBatchServiceImpl implements IEmisWarehouseInBatchSer
|
|||||||
* @param emisWarehouseInBatch 进仓单批次
|
* @param emisWarehouseInBatch 进仓单批次
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public int insertEmisWarehouseInBatch(EmisWarehouseInBatch emisWarehouseInBatch)
|
public int insertEmisWarehouseInBatch(EmisWarehouseInBatch emisWarehouseInBatch) throws EmisBizError {
|
||||||
{
|
// 进仓序列号
|
||||||
|
String serialNo= WaybillHelper.genWsInSerialNo();
|
||||||
|
emisWarehouseInBatch.setSerialNo(serialNo);
|
||||||
|
emisWarehouseInBatchMapper.insertEmisWarehouseInBatch(emisWarehouseInBatch);
|
||||||
|
List<EmisWarehouseInDtl> cargoList=emisWarehouseInBatch.getCargoList();
|
||||||
|
if(CollectionUtils.isEmpty(cargoList)){
|
||||||
|
throw new EmisBizError(EmisBizErrorType.FAIL,"进仓货物列表不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
for(EmisWarehouseInDtl item:cargoList){
|
||||||
|
item.setId(null);
|
||||||
|
emisWarehouseInDtlMapper.insertEmisWarehouseInDtl(item);
|
||||||
|
}
|
||||||
|
|
||||||
return emisWarehouseInBatchMapper.insertEmisWarehouseInBatch(emisWarehouseInBatch);
|
return emisWarehouseInBatchMapper.insertEmisWarehouseInBatch(emisWarehouseInBatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -86,6 +86,18 @@ public class WaybillHelper {
|
|||||||
// return billId;
|
// return billId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进仓流水号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String genWsInSerialNo(){
|
||||||
|
Snowflake snowflake = IdUtil.getSnowflake(0, 0);
|
||||||
|
Long inSerialNo = snowflake.nextId();
|
||||||
|
return inSerialNo.toString();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成流水号
|
* 生成流水号
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user