新增调拨单批量添加明细

master
maxw@mesnac.com 7 days ago
parent 7fd415def9
commit 73aa065843

@ -76,7 +76,7 @@ public class WmsAllocateOrderDetailController extends BaseController {
@Log(title = "调拨子", businessType = BusinessType.INSERT) @Log(title = "调拨子", businessType = BusinessType.INSERT)
@RepeatSubmit() @RepeatSubmit()
@PostMapping() @PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsAllocateOrderDetailBo bo) { public R<Void> add( @RequestBody List<WmsAllocateOrderDetailBo> bo) {
return toAjax(wmsAllocateOrderDetailService.insertByBo(bo)); return toAjax(wmsAllocateOrderDetailService.insertByBo(bo));
} }

@ -47,7 +47,7 @@ public interface IWmsAllocateOrderDetailService {
* @param bo * @param bo
* @return * @return
*/ */
Boolean insertByBo(WmsAllocateOrderDetailBo bo); Boolean insertByBo(List<WmsAllocateOrderDetailBo> bo);
/** /**
* *

@ -15,9 +15,7 @@ import org.dromara.wms.mapper.WmsAllocateOrderDetailMapper;
import org.dromara.wms.service.IWmsAllocateOrderDetailService; import org.dromara.wms.service.IWmsAllocateOrderDetailService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.Collection;
/** /**
* Service * Service
@ -88,13 +86,17 @@ public class WmsAllocateOrderDetailServiceImpl implements IWmsAllocateOrderDetai
* @return * @return
*/ */
@Override @Override
public Boolean insertByBo(WmsAllocateOrderDetailBo bo) { public Boolean insertByBo(List<WmsAllocateOrderDetailBo> bo) {
WmsAllocateOrderDetail add = MapstructUtils.convert(bo, WmsAllocateOrderDetail.class); ArrayList<WmsAllocateOrderDetail> list = new ArrayList<>();
validEntityBeforeSave(add); for (WmsAllocateOrderDetailBo detailBo : bo) {
boolean flag = baseMapper.insert(add) > 0; WmsAllocateOrderDetail add = MapstructUtils.convert(detailBo, WmsAllocateOrderDetail.class);
if (flag) { list.add(add);
bo.setAoDId(add.getAoDId());
} }
boolean flag = baseMapper.insertBatch(list);
// if (flag) {
// bo.setAoDId(add.getAoDId());
// }
return flag; return flag;
} }

Loading…
Cancel
Save