扫码枪出库接口
This commit is contained in:
@@ -163,4 +163,13 @@ public class WmsStockIoController extends BaseController {
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
@PostMapping("/scanOutStock")
|
||||
public R<Void> scanOutStock(@RequestBody WmsStockIoDetailBo bo) {
|
||||
try {
|
||||
boolean result = iWmsStockIoService.scanOutStockByBo(bo);
|
||||
return toAjax(result);
|
||||
} catch (Exception e) {
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,4 +77,6 @@ public interface IWmsStockIoService {
|
||||
|
||||
|
||||
boolean scanInStockByBo(WmsStockIoDetailBo bo);
|
||||
|
||||
boolean scanOutStockByBo(WmsStockIoDetailBo bo);
|
||||
}
|
||||
|
||||
@@ -162,6 +162,27 @@ public class WmsStockIoServiceImpl implements IWmsStockIoService {
|
||||
changeStock(bo.getWarehouseId(), bo.getItemType(), bo.getItemId(), bo.getQuantity(), true, unit);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean scanOutStockByBo(WmsStockIoDetailBo bo) {
|
||||
String unit = bo.getUnit();
|
||||
// 如果unit为空,自动查item表补全
|
||||
if (unit == null || unit.trim().isEmpty()) {
|
||||
if ("product".equals(bo.getItemType())) {
|
||||
WmsProduct p = productMapper.selectById(bo.getItemId());
|
||||
unit = p != null ? p.getUnit() : null;
|
||||
} else if ("raw_material".equals(bo.getItemType())) {
|
||||
WmsRawMaterial r = rawMaterialMapper.selectById(bo.getItemId());
|
||||
unit = r != null ? r.getUnit() : null;
|
||||
}
|
||||
}
|
||||
if (unit == null || unit.trim().isEmpty()) {
|
||||
throw new RuntimeException("未能获取到单位");
|
||||
}
|
||||
// 出库操作
|
||||
changeStock(bo.getWarehouseId(), bo.getItemType(), bo.getItemId(), bo.getQuantity(), false, unit);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user